* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-color: #121213;
    --text-color: #ffffff;
    --text-secondary: #818384;
    --border-color: #3a3a3c;
    --correct-color: #538d4e;
    --wrong-color: #b55151;
    --word-bg: #1a1a1b;
    --word-hover: #2a2a2b;
    --modal-bg: #1a1a1b;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    justify-content: center;
}

.container {
    width: 100%;
    max-width: 500px;
    padding: 0 16px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
}

header {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-color);
    position: relative;
}

header h1 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.icon-btn {
    position: absolute;
    right: 0;
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.icon-btn:hover {
    background-color: var(--word-hover);
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 24px 0;
}

#game-info {
    text-align: center;
    margin-bottom: 24px;
}

.instructions {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 16px;
}

.instructions strong {
    color: var(--text-color);
}

.score-display {
    display: flex;
    justify-content: center;
    gap: 24px;
    font-size: 1rem;
}

.score-display span {
    color: var(--text-secondary);
}

.score-display strong {
    color: var(--text-color);
}

#word-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.word-card {
    background-color: var(--word-bg);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 20px 24px;
    font-size: 1.4rem;
    font-weight: 600;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.word-card:hover:not(.disabled):not(.correct):not(.wrong) {
    background-color: var(--word-hover);
    border-color: #4a4a4c;
    transform: scale(1.02);
}

.word-card:active:not(.disabled):not(.correct):not(.wrong) {
    transform: scale(0.98);
}

.word-card.correct {
    background-color: var(--correct-color);
    border-color: var(--correct-color);
    cursor: default;
    animation: pop 0.3s ease;
}

.word-card.wrong {
    background-color: var(--wrong-color);
    border-color: var(--wrong-color);
    cursor: default;
    animation: shake 0.4s ease;
}

.word-card.disabled {
    opacity: 0.5;
    cursor: default;
}

.word-card.revealed {
    opacity: 0.6;
    cursor: default;
}

.word-card.revealed.was-real {
    border-color: var(--correct-color);
}

.word-card.revealed.was-fake {
    border-color: var(--wrong-color);
}

@keyframes pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-8px); }
    80% { transform: translateX(8px); }
}

#game-message {
    text-align: center;
    padding: 12px;
    border-radius: 8px;
    font-weight: 600;
    margin-bottom: 16px;
}

#game-message.success {
    background-color: rgba(83, 141, 78, 0.2);
    color: var(--correct-color);
}

#game-message.error {
    background-color: rgba(181, 81, 81, 0.2);
    color: var(--wrong-color);
}

#game-over {
    text-align: center;
    padding: 24px;
    background-color: var(--word-bg);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

#game-over h2 {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

#result-message {
    color: var(--text-secondary);
    margin-bottom: 16px;
}

#final-score {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 24px;
}

.btn {
    padding: 14px 32px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn.primary {
    background-color: var(--correct-color);
    color: white;
}

.btn.primary:hover {
    background-color: #4a7d45;
}

.comeback {
    margin-top: 16px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.hidden {
    display: none !important;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    padding: 16px;
}

.modal-content {
    background-color: var(--modal-bg);
    border-radius: 12px;
    padding: 24px;
    width: 100%;
    max-width: 400px;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px 8px;
}

.modal-content h2 {
    text-align: center;
    margin-bottom: 24px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.modal-content h3 {
    text-align: center;
    margin: 24px 0 16px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

#score-distribution {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dist-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dist-label {
    width: 20px;
    text-align: right;
    font-size: 0.9rem;
}

.dist-bar {
    height: 24px;
    background-color: var(--border-color);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
    min-width: 24px;
    font-size: 0.85rem;
    font-weight: 600;
}

.dist-bar.highlight {
    background-color: var(--correct-color);
}

/* Definition Modal */
.definition-modal {
    text-align: center;
    padding-top: 40px;
}

.definition-modal h2 {
    font-size: 1.6rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 16px;
    color: var(--correct-color);
}

.definition-modal p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    line-height: 1.6;
}

.word-card.clickable {
    cursor: pointer;
}

.word-card.clickable:hover {
    transform: scale(1.02);
    border-color: #5a5a5c;
}

/* Responsive adjustments */
@media (max-width: 360px) {
    header h1 {
        font-size: 1.6rem;
    }
    
    .word-card {
        padding: 16px 20px;
        font-size: 1.2rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
}

/* Safe area for notched phones */
@supports (padding: max(0px)) {
    .container {
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
        padding-bottom: max(16px, env(safe-area-inset-bottom));
    }
}
