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

:root {
    --primary-color: #6366f1;
    --secondary-color: #8b5cf6;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --dark-bg: #1f2937;
    --light-bg: #f3f4f6;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --border-radius: 12px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    min-height: 100vh;
    height: 100vh;
    color: var(--text-primary);
    overflow: hidden;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
}

/* Screens */
.screen {
    display: none;
    height: 100vh;
    max-height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
    animation: fadeIn 0.3s ease-in;
}

.screen.active {
    display: flex;
    flex-direction: column;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Container */
.container {
    max-width: 600px;
    width: 100%;
    margin: 0 auto;
    flex-shrink: 0;
}

/* Title */
.title {
    font-size: 3rem;
    font-weight: 800;
    color: white;
    text-align: center;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.9);
    text-align: center;
    margin-bottom: 30px;
}

/* Categories Grid */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.category-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 25px 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
    border: 3px solid transparent;
}

.category-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.category-card:active {
    transform: translateY(-2px);
}

.category-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.category-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: capitalize;
}

/* Stats */
.stats-container {
    display: flex;
    justify-content: space-around;
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--border-radius);
    padding: 20px;
    backdrop-filter: blur(10px);
}

.stat {
    text-align: center;
}

.stat-label {
    display: block;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.stat-value {
    display: block;
    color: white;
    font-size: 1.8rem;
    font-weight: 700;
}

/* Ready Screen */
.ready-container {
    text-align: center;
    color: white;
}

.ready-title {
    font-size: 2.5rem;
    margin-bottom: 30px;
}

.ready-instructions {
    font-size: 1.2rem;
    line-height: 2;
    margin-bottom: 30px;
    background: rgba(255, 255, 255, 0.1);
    padding: 30px;
    border-radius: var(--border-radius);
    backdrop-filter: blur(10px);
}

.countdown {
    font-size: 6rem;
    font-weight: 800;
    color: white;
    margin: 30px 0;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.3);
    display: none;
}

.countdown.active {
    display: block;
    animation: pulse 1s ease-in-out;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* Game Screen */
#game-screen {
    padding: 0;
    justify-content: space-between;
    overflow: hidden;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
}

.timer {
    font-size: 2.5rem;
    font-weight: 800;
    color: white;
    background: rgba(255, 255, 255, 0.25);
    padding: 12px 24px;
    border-radius: 25px;
    min-width: 100px;
    text-align: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.timer.warning {
    background: var(--warning-color);
    animation: timerPulse 0.5s ease-in-out infinite;
}

@keyframes timerPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.score {
    font-size: 1.8rem;
    font-weight: 700;
    color: white;
    background: rgba(255, 255, 255, 0.15);
    padding: 8px 20px;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.word-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
    width: 100%;
    overflow: hidden;
}

.word-card {
    background: white;
    border-radius: 24px;
    padding: 40px 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 650px;
    max-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
}

.word-card.correct {
    background: var(--success-color);
    animation: slideDown 0.3s ease-out;
}

.word-card.skip {
    background: var(--warning-color);
    animation: slideUp 0.3s ease-out;
}

@keyframes slideDown {
    from { transform: translateY(-100px) rotate(-5deg); opacity: 0; }
    to { transform: translateY(0) rotate(0); opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(100px) rotate(5deg); opacity: 0; }
    to { transform: translateY(0) rotate(0); opacity: 1; }
}

.word {
    font-size: 3rem;
    font-weight: 800;
    text-align: center;
    color: var(--text-primary);
    word-wrap: break-word;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.word-card.correct .word,
.word-card.skip .word {
    color: white;
}

.game-footer {
    padding: 25px 20px 30px;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
}

.instruction {
    text-align: center;
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    margin: 8px 0;
    opacity: 0.95;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.instruction::before {
    content: '';
    display: inline-block;
    width: 30px;
    height: 3px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 2px;
}

.instruction::after {
    content: '';
    display: inline-block;
    width: 30px;
    height: 3px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 2px;
}

/* Buttons */
.btn {
    padding: 15px 30px;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
    display: inline-block;
    text-align: center;
    margin: 5px;
}

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

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    backdrop-filter: blur(10px);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.3);
}

.btn-large {
    padding: 20px 40px;
    font-size: 1.3rem;
    display: block;
    width: 100%;
    margin: 10px 0;
}

.btn-pause {
    position: absolute;
    top: 15px;
    right: 15px;
    padding: 12px 24px;
    background: rgba(0, 0, 0, 0.4);
    color: white;
    font-size: 1rem;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    min-width: 100px;
}

/* Results Screen */
.results-container {
    text-align: center;
    color: white;
}

.results-title {
    font-size: 2.5rem;
    margin-bottom: 40px;
}

.results-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 40px;
}

.result-stat {
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--border-radius);
    padding: 30px 20px;
    backdrop-filter: blur(10px);
}

.result-value {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 10px;
}

.result-label {
    font-size: 1rem;
    opacity: 0.9;
}

.results-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

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

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: var(--border-radius);
    padding: 40px;
    max-width: 400px;
    width: 90%;
    text-align: center;
}

.modal-content h3 {
    font-size: 2rem;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.modal-content p {
    font-size: 1.1rem;
    margin-bottom: 30px;
    color: var(--text-secondary);
}

/* Responsive - Mobile First Approach */
@media (max-width: 768px) {
    .title {
        font-size: 2.5rem;
    }
    
    .word {
        font-size: 2.8rem;
    }
    
    .word-card {
        padding: 45px 25px;
        max-height: 350px;
    }
    
    .timer {
        font-size: 2.2rem;
        padding: 10px 20px;
        min-width: 90px;
    }
    
    .score {
        font-size: 1.6rem;
        padding: 6px 16px;
    }
    
    .results-stats {
        grid-template-columns: 1fr;
    }
    
    .categories-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .instruction {
        font-size: 1rem;
    }
    
    .instruction::before,
    .instruction::after {
        width: 20px;
    }
}

@media (max-width: 480px) {
    .title {
        font-size: 2rem;
    }
    
    .word {
        font-size: 2.2rem;
    }
    
    .word-card {
        padding: 40px 25px;
        max-height: 300px;
        width: 92%;
    }
    
    .word-container {
        padding: 20px 10px;
    }
    
    .game-header {
        padding: 12px 15px;
    }
    
    .timer {
        font-size: 2rem;
        padding: 8px 16px;
        min-width: 80px;
    }
    
    .score {
        font-size: 1.4rem;
        padding: 5px 12px;
    }
    
    .instruction {
        font-size: 0.9rem;
        margin: 6px 0;
    }
    
    .game-footer {
        padding: 20px 15px 25px;
    }
    
    .btn-pause {
        padding: 10px 18px;
        font-size: 0.9rem;
        min-width: 85px;
    }
}

@media (max-width: 375px) {
    .word {
        font-size: 2rem;
    }
    
    .word-card {
        padding: 35px 20px;
        max-height: 300px;
        width: 95%;
    }
    
    .word-container {
        padding: 15px 8px;
    }
    
    .timer {
        font-size: 1.8rem;
    }
}

/* Landscape Mode Optimizations */
@media (orientation: landscape) and (max-height: 600px) {
    .screen {
        padding: 10px;
    }
    
    .title {
        font-size: 2rem;
        margin-bottom: 5px;
    }
    
    .subtitle {
        font-size: 1rem;
        margin-bottom: 15px;
    }
    
    .ready-title {
        font-size: 2rem;
        margin-bottom: 15px;
    }
    
    .ready-instructions {
        font-size: 1rem;
        line-height: 1.6;
        padding: 20px;
        margin-bottom: 15px;
    }
    
    .game-header {
        padding: 8px 15px;
    }
    
    .timer {
        font-size: 1.8rem;
        padding: 6px 14px;
    }
    
    .score {
        font-size: 1.3rem;
        padding: 4px 10px;
    }
    
    .word-container {
        padding: 10px;
    }
    
    .word-card {
        padding: 25px 20px;
        max-height: 60vh;
        border-radius: 16px;
    }
    
    .word {
        font-size: 2.5rem;
    }
    
    .game-footer {
        padding: 12px 15px 15px;
    }
    
    .instruction {
        font-size: 0.9rem;
        margin: 4px 0;
    }
    
    .btn-pause {
        top: 10px;
        right: 10px;
        padding: 8px 16px;
        font-size: 0.85rem;
    }
    
    .results-title {
        font-size: 2rem;
        margin-bottom: 20px;
    }
    
    .results-stats {
        gap: 15px;
        margin-bottom: 20px;
    }
    
    .result-stat {
        padding: 20px 15px;
    }
    
    .result-value {
        font-size: 2.5rem;
    }
    
    .categories-grid {
        gap: 10px;
        margin-bottom: 15px;
    }
    
    .category-card {
        padding: 15px 10px;
    }
    
    .category-icon {
        font-size: 2rem;
        margin-bottom: 5px;
    }
    
    .stats-container {
        padding: 15px;
    }
}
