:root {
    --primary: #FFD700;
    --primary-glow: rgba(255, 215, 0, 0.3);
    --bg-dark: #0F172A;
    --bg-deeper: #0B1120;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-main: #F8FAFC;
    --text-muted: #94A3B8;
    --accent-red: #EF4444;
    --accent-green: #10B981;
    --accent-blue: #3B82F6;
}

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

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-dark);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    height: 100%;
    margin: 0;
    overflow: hidden;
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(255, 215, 0, 0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(59, 130, 246, 0.04) 0%, transparent 50%);
}

#app {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.glass-container {
    width: 100%;
    max-width: 500px;
    height: 100vh;
    position: relative;
    background: var(--bg-deeper);
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin: 0 auto;
}

@media (max-width: 480px) {
    .glass-container {
        border-radius: 0;
        border: none;
    }
}

/* ═══════════════════════════════════════════════
   HEADER / STATS BAR
   ═══════════════════════════════════════════════ */
.header-bar {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 10;
}

.stats-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

@media (max-width: 400px) {
    .stats-row {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .stat-chip {
        justify-content: space-between;
    }
}

.stat-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
}

.stat-chip .label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-weight: 700;
}

.stat-chip .value {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 18px;
    color: #fff;
    min-width: 30px;
    text-align: center;
}

.timer-chip {
    flex: 1;
}

.timer-chip .value {
    color: var(--primary);
    font-variant-numeric: tabular-nums;
}

.timer-critical .value {
    animation: pulse-red 0.5s ease-in-out infinite alternate;
    color: var(--accent-red) !important;
}

@keyframes pulse-red {
    from {
        opacity: 1;
    }

    to {
        opacity: 0.5;
    }
}

.score-chip .value {
    color: var(--accent-green);
}

.streak-chip {
    min-width: 50px;
    justify-content: center;
    transition: all 0.3s ease;
}

.streak-chip .value {
    color: #F59E0B;
}

.streak-active {
    background: rgba(245, 158, 11, 0.15) !important;
    border-color: rgba(245, 158, 11, 0.3) !important;
    animation: streak-glow 0.4s ease;
}

@keyframes streak-glow {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.08);
    }

    100% {
        transform: scale(1);
    }
}

/* Timer bar */
.timer-bar-bg {
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
    overflow: hidden;
}

.timer-bar-fill {
    height: 100%;
    width: 100%;
    background: var(--primary);
    box-shadow: 0 0 8px var(--primary-glow);
    transition: width 1s linear;
    border-radius: 2px;
}

/* ═══════════════════════════════════════════════
   SCREENS
   ═══════════════════════════════════════════════ */
.screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 24px;
    overflow-y: auto;
}

.hidden {
    display: none !important;
}

/* ═══════════════════════════════════════════════
   START SCREEN
   ═══════════════════════════════════════════════ */
.start-card {
    width: 100%;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 32px 24px;
    text-align: center;
}

.game-title {
    font-family: 'Outfit', sans-serif;
    font-size: 26px;
    font-weight: 800;
    margin-bottom: 4px;
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 50%, #FFD700 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.game-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 24px;
    line-height: 1.5;
}

.game-emoji {
    font-size: 48px;
    margin-bottom: 12px;
    display: block;
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 24px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border: 1px solid var(--glass-border);
}

.setting-row label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.setting-row input {
    width: 65px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--glass-border);
    color: var(--primary);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    text-align: center;
    outline: none;
    transition: border-color 0.2s;
}

.setting-row input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 10px var(--primary-glow);
}

.setting-row span {
    font-size: 13px;
    color: var(--text-muted);
}

.rules-list {
    text-align: left;
    list-style: none;
    padding: 0;
    margin-bottom: 24px;
}

.rules-list li {
    font-size: 13px;
    color: var(--text-muted);
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    display: flex;
    align-items: flex-start;
    gap: 8px;
    line-height: 1.4;
}

.rules-list li::before {
    content: '▸';
    color: var(--primary);
    font-weight: bold;
    flex-shrink: 0;
}

/* ═══════════════════════════════════════════════
   PRIMARY BUTTON
   ═══════════════════════════════════════════════ */
.primary-btn {
    background: var(--primary);
    color: #000;
    border: none;
    padding: 16px 32px;
    border-radius: 14px;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
    font-size: 16px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    width: 100%;
    letter-spacing: 0.02em;
}

.primary-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 0 24px var(--primary-glow);
}

.primary-btn:active {
    transform: scale(0.98);
}

/* ═══════════════════════════════════════════════
   GAME SCREEN
   ═══════════════════════════════════════════════ */
.game-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px 16px;
    gap: 16px;
    overflow-y: auto;
}

/* Category pill */
.category-label {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    padding: 4px 12px;
    border-radius: 20px;
    align-self: flex-start;
}

/* Target phrase card */
.target-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 20px;
    text-align: center;
}

.target-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
    margin-bottom: 6px;
}

.target-phrase {
    font-family: 'Outfit', sans-serif;
    font-size: 22px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 12px;
}

.base-word-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.base-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
}

.base-word {
    font-family: 'Outfit', sans-serif;
    font-size: 18px;
    font-weight: 600;
    color: var(--primary);
    background: rgba(255, 215, 0, 0.08);
    padding: 4px 14px;
    border-radius: 8px;
    border: 1px solid rgba(255, 215, 0, 0.15);
}

/* Assembled word preview */
.assembled-card {
    background: rgba(255, 255, 255, 0.03);
    border: 2px dashed var(--glass-border);
    border-radius: 16px;
    padding: 16px;
    text-align: center;
    min-height: 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: all 0.3s ease;
}

.assembled-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
    margin-bottom: 4px;
}

.assembled-word {
    font-family: 'Outfit', sans-serif;
    font-size: 24px;
    font-weight: 800;
    color: var(--text-main);
    transition: color 0.3s, transform 0.2s;
}

.assembled-word.correct-flash {
    color: var(--accent-green) !important;
    animation: correct-pop 0.4s ease;
}

.assembled-word.incorrect-flash {
    color: var(--accent-red) !important;
    animation: shake 0.4s ease;
}

@keyframes correct-pop {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.15);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    20% {
        transform: translateX(-8px);
    }

    40% {
        transform: translateX(8px);
    }

    60% {
        transform: translateX(-6px);
    }

    80% {
        transform: translateX(6px);
    }
}

/* Suffix button bank */
.suffix-bank {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    padding: 4px 0;
}

.suffix-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1.5px solid var(--glass-border);
    color: var(--text-main);
    padding: 14px 20px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    transition: all 0.15s ease;
    letter-spacing: 0.02em;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 80px;
    justify-content: center;
}

.choice-num {
    background: rgba(255, 255, 255, 0.1);
    color: var(--primary);
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    font-size: 9px;
    font-weight: 800;
    flex-shrink: 0;
}

.suffix-btn:hover {
    background: rgba(255, 215, 0, 0.1);
    border-color: rgba(255, 215, 0, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.suffix-btn:active {
    transform: translateY(0);
}

.suffix-btn.selected {
    background: rgba(255, 215, 0, 0.2);
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: 0 0 16px var(--primary-glow);
}

/* Action buttons row */
.action-row {
    display: flex;
    gap: 8px;
}

.submit-btn {
    flex: 2;
    background: var(--primary);
    color: #000;
    border: none;
    padding: 14px;
    border-radius: 12px;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.02em;
}

.submit-btn:hover:not(:disabled) {
    box-shadow: 0 0 20px var(--primary-glow);
    transform: scale(1.02);
}

.submit-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.action-secondary {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    padding: 14px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
}

.action-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Feedback */
.feedback {
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    min-height: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border-radius: 12px;
    padding: 8px 12px;
    transition: all 0.3s ease;
}

.feedback.correct {
    color: var(--accent-green);
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.feedback.incorrect {
    color: var(--accent-red);
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.hint {
    display: block;
    font-size: 12px;
    font-weight: 400;
    color: var(--text-muted);
    font-style: italic;
}

/* ═══════════════════════════════════════════════
   GAME OVER SCREEN
   ═══════════════════════════════════════════════ */
.gameover-card {
    width: 100%;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 28px 20px;
    text-align: center;
}

.gameover-title {
    font-family: 'Outfit', sans-serif;
    font-size: 22px;
    font-weight: 800;
    background: linear-gradient(135deg, #fff 0%, var(--primary) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 16px;
}

.rank-badge {
    background: rgba(255, 215, 0, 0.08);
    border: 1px solid rgba(255, 215, 0, 0.15);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 20px;
}

.rank-title {
    font-family: 'Outfit', sans-serif;
    font-size: 26px;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 4px;
}

.rank-desc {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.4;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 20px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 12px;
}

.stat-card .stat-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    font-weight: 700;
    display: block;
    margin-bottom: 4px;
}

.stat-card .stat-value {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 22px;
    color: #fff;
}

.share-row {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.share-btn {
    flex: 1;
    padding: 12px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.whatsapp-share {
    background: #25D366;
    color: #fff;
}

.whatsapp-share:hover {
    background: #128C7E;
    box-shadow: 0 0 16px rgba(37, 211, 102, 0.3);
}

.clipboard-share {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
}

.clipboard-share:hover {
    background: rgba(255, 255, 255, 0.12);
}

.x-share {
    background: #000;
    color: #fff;
    border: 1px solid var(--glass-border) !important;
}

.x-share:hover {
    background: #1d1f23;
    box-shadow: 0 0 16px rgba(255, 255, 255, 0.1);
}

.restart-btn {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    padding: 12px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
}

.restart-btn:hover {
    color: var(--accent-red);
    border-color: rgba(239, 68, 68, 0.3);
}

/* ═══════════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════════ */
.animate-fade-in {
    animation: fadeIn 0.5s ease-out forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}