/* ══════════════════════════════════════════════════════════
   GAME PAGE — Do You Know Your Type?
   Uses CSS variables from index.css (linked in game.html)
   ══════════════════════════════════════════════════════════ */

/* ── Pixel grid background ─────────────────────────────── */
.game__bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    background-image:
        radial-gradient(circle, var(--text-faint) 1px, transparent 1px);
    background-size: 28px 28px;
    opacity: 0.35;
    filter: blur(0.5px);
    pointer-events: none;
    transition: opacity 0.3s ease;
}

/* ── TV fade transition overlay ───────────────────────── */
#iris-wipe {
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: #000;
    pointer-events: all;
    opacity: 1;
}

/* ── Back button ───────────────────────────────────────── */
.game__back {
    position: fixed;
    top: 5vh;
    left: 5vw;
    z-index: 100000;
    display: inline-flex;
    align-items: center;
    gap: 0.5em;
    text-decoration: none;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.82rem;
    font-weight: 400;
    letter-spacing: 0.04em;
    text-transform: lowercase;
    color: var(--text-primary);
    border: 1px solid rgba(0,0,0,0.35);
    border-radius: 999px;
    height: 36px;
    box-sizing: border-box;
    padding: 0 1.1em 0 0.8em;
    background: transparent;
    transition: color 0.3s ease, border-color 0.3s ease;
    cursor: none;
}
[data-theme="dark"] .game__back {
    border-color: rgba(255,255,255,0.45);
}
@media (hover: hover) and (pointer: fine) {
    .game__back:hover {
        color: var(--accent);
        border-color: var(--accent);
    }
    .game__back:hover .material-symbols-outlined {
        transform: translateX(-3px);
    }
}
.game__back .material-symbols-outlined {
    font-size: 18px;
    transition: transform 0.3s ease;
}

/* ── Game container ────────────────────────────────────── */
#game {
    position: relative;
    z-index: 1;
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0 5vw;
    box-sizing: border-box;
}

/* ── Shared button styles ──────────────────────────────── */
.game__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55em;
    font-family: 'DM Sans', sans-serif;
    font-size: clamp(0.85rem, 1vw, 1rem);
    font-weight: 400;
    letter-spacing: 0.06em;
    text-transform: lowercase;
    padding: 0.7em 1.8em;
    border: 1px solid;
    border-radius: 100px;
    background: transparent;
    backdrop-filter: blur(8px);
    cursor: none;
    transition: color 0.3s ease, border-color 0.3s ease, background 0.3s ease;
    outline: none;
}
.game__btn--primary {
    color: var(--accent);
    border-color: var(--accent);
    background: rgba(255, 61, 0, 0.06);
}
@media (hover: hover) and (pointer: fine) {
    .game__btn--primary:hover {
        background: rgba(255, 61, 0, 0.14);
    }
}
.game__btn--secondary {
    color: var(--text-secondary);
    border-color: var(--text-faint);
    background: var(--bg-card);
}
@media (hover: hover) and (pointer: fine) {
    .game__btn--secondary:hover {
        color: var(--text-primary);
        border-color: var(--text-secondary);
    }
}
.game__btn--ghost {
    color: var(--text-muted);
    border-color: transparent;
    background: transparent;
    backdrop-filter: none;
}
@media (hover: hover) and (pointer: fine) {
    .game__btn--ghost:hover {
        color: var(--text-primary);
    }
}

/* ── Intro screen ──────────────────────────────────────── */
#game__intro {
    text-align: center;
}
#game__title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(2rem, 4vw, 3.6rem);
    font-weight: 300;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin: 0 0 1rem;
    transition: color 0.3s ease;
}
#game__tagline {
    font-family: 'DM Sans', sans-serif;
    font-size: clamp(0.85rem, 1.1vw, 1rem);
    font-weight: 300;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
    line-height: 1.6;
    margin: 0 0 2.5rem;
    transition: color 0.3s ease;
}

/* ── Intro Leaderboard ────────────────────────────────── */
#game__intro-lb {
    margin-top: 3.5rem;
    width: 100%;
    max-width: 320px;
    opacity: 0;
    margin-left: auto;
    margin-right: auto;
}
#game__intro-lb-title {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.68rem;
    font-weight: 400;
    letter-spacing: 0.20em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 0 0 0.8rem;
    text-align: center;
    transition: color 0.3s ease;
}
#game__intro-lb-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
#game__intro-lb-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.35em 0;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.8rem;
    font-weight: 300;
    color: var(--text-muted);
    transition: color 0.3s ease;
}
#game__intro-lb-list .lb__rank {
    width: 2em;
    text-align: left;
    color: var(--text-muted);
}
#game__intro-lb-list .lb__name {
    flex: 1;
    text-align: left;
    padding-left: 0.5em;
}
#game__intro-lb-list .lb__score {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 300;
    letter-spacing: -0.02em;
    color: var(--text-muted);
}

/* ── HUD ───────────────────────────────────────────────── */
#game__hud {
    display: flex;
    justify-content: center;
    margin-bottom: 2.5rem;
}
.game__hud-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
}
.game__hud-label {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.72rem;
    font-weight: 400;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-muted);
    transition: color 0.3s ease;
}
.game__hud-value {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(1.8rem, 3vw, 2.8rem);
    font-weight: 300;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    line-height: 1;
    transition: color 0.3s ease;
}

/* ── Difficulty Indicator ──────────────────────────────── */
#game__difficulty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 1.8rem;
}
#game__diff-track {
    display: flex;
    gap: 3px;
}
.game__diff-seg {
    width: 22px;
    height: 3px;
    border-radius: 1.5px;
    background: var(--text-faint);
    opacity: 0.3;
    transition: background 0.4s ease, opacity 0.4s ease;
    transform-origin: center bottom;
}
.game__diff-seg.active {
    background: var(--accent);
    opacity: 1;
}
#game__diff-label {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.68rem;
    font-weight: 400;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-muted);
    transition: color 0.3s ease;
}

/* ── Canvas letter display ─────────────────────────────── */
#game__letter-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
}
#game__canvas {
    max-width: 100%;
    display: block;
}

/* ── Choice buttons ────────────────────────────────────── */
#game__choices {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 2rem;
}
.game__choice {
    font-family: 'DM Sans', sans-serif;
    font-size: clamp(0.9rem, 1.2vw, 1.1rem);
    font-weight: 400;
    letter-spacing: 0.02em;
    color: var(--text-primary);
    padding: 1em 2.2em;
    border: 1px solid var(--text-faint);
    border-radius: 100px;
    background: var(--bg-card);
    backdrop-filter: blur(8px);
    cursor: none;
    transition: all 0.3s ease;
    min-width: 200px;
    text-align: center;
    outline: none;
}
@media (hover: hover) and (pointer: fine) {
    .game__choice:hover {
        border-color: var(--accent);
        color: var(--accent);
        background: rgba(255, 61, 0, 0.06);
    }
}
.game__choice--correct {
    border-color: #22c55e !important;
    color: #22c55e !important;
    background: rgba(34, 197, 94, 0.08) !important;
}
.game__choice--wrong {
    border-color: #ef4444 !important;
    color: #ef4444 !important;
    background: rgba(239, 68, 68, 0.08) !important;
}
.game__choice:disabled {
    pointer-events: none;
}

/* ── Hint system ───────────────────────────────────────── */
#game__hint-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.8rem;
    width: auto;
}
#game__hint-count {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.78rem;
    font-weight: 300;
    color: var(--text-muted);
    margin: 0;
    letter-spacing: 0.02em;
    transition: color 0.3s ease;
}
#game__hint-btn {
    font-size: 0.8rem;
    padding: 0.5em 1.4em;
}
#game__hint-btn.game__btn--danger {
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.04);
}
@media (hover: hover) and (pointer: fine) {
    #game__hint-btn.game__btn--danger:hover {
        border-color: #ef4444;
        background: rgba(239, 68, 68, 0.1);
    }
}
#game__hints {
    text-align: center;
    min-height: 1em;
}
.game__hint {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.82rem;
    font-weight: 300;
    font-style: italic;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0 0 0.2em;
    opacity: 0;
    transition: color 0.3s ease;
}
.game__hint.visible {
    opacity: 1;
}

/* ── Feedback text ─────────────────────────────────────── */
#game__feedback {
    font-family: 'Caveat', cursive;
    font-size: clamp(1.2rem, 2vw, 1.8rem);
    font-weight: 400;
    color: var(--accent);
    min-height: 1.5em;
    text-align: center;
    margin-top: 0.5rem;
}

/* ── Game over screen ──────────────────────────────────── */
#game__over {
    text-align: center;
}
#game__over-label {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.72rem;
    font-weight: 400;
    letter-spacing: 0.20em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 0 0 0.5rem;
    transition: color 0.3s ease;
}
#game__final-score {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(4rem, 10vw, 8rem);
    font-weight: 200;
    color: var(--text-primary);
    letter-spacing: -0.04em;
    line-height: 1;
    margin: 0 0 0.5rem;
    transition: color 0.3s ease;
}
#game__final-message {
    font-family: 'DM Sans', sans-serif;
    font-size: 1rem;
    font-weight: 300;
    color: var(--text-secondary);
    margin: 0 0 2rem;
    transition: color 0.3s ease;
}

/* ── Leaderboard qualification ─────────────────────────── */
#game__qualify-wrap {
    margin-bottom: 1.5rem;
}
#game__qualify-msg {
    font-family: 'Caveat', cursive;
    font-size: clamp(1.2rem, 2vw, 1.6rem);
    font-weight: 400;
    color: var(--accent);
    margin: 0 0 1.2rem;
    text-align: center;
    transition: color 0.3s ease;
}

/* ── Name input ────────────────────────────────────────── */
#game__name-wrap {
    display: flex;
    gap: 0.8rem;
    justify-content: center;
    align-items: center;
    margin-bottom: 1.5rem;
}
#game__name-input {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.95rem;
    font-weight: 400;
    letter-spacing: 0.02em;
    color: var(--text-primary);
    background: var(--bg-card);
    border: 1px solid var(--text-faint);
    border-radius: 100px;
    padding: 0.65em 1.4em;
    outline: none;
    width: 180px;
    cursor: none;
    transition: border-color 0.3s ease, color 0.3s ease, background 0.3s ease;
}
#game__name-input:focus {
    border-color: var(--accent);
}
#game__name-input::placeholder {
    color: var(--text-muted);
}

/* ── Game over actions ─────────────────────────────────── */
#game__over-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}
#game__over-back {
    text-decoration: none;
}

/* ── Leaderboard ───────────────────────────────────────── */
#game__leaderboard {
    text-align: center;
    max-width: 440px;
    width: 100%;
}
#game__lb-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(1.6rem, 2.5vw, 2.2rem);
    font-weight: 300;
    color: var(--text-primary);
    margin: 0 0 1.5rem;
    letter-spacing: -0.02em;
    transition: color 0.3s ease;
}
#game__lb-list {
    list-style: none;
    padding: 0;
    margin: 0 0 2rem;
}
#game__lb-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.45em 0;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.9rem;
    font-weight: 300;
    color: var(--text-muted);
    transition: color 0.3s ease;
}
.lb__rank {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 300;
    width: 2em;
    text-align: left;
    color: var(--text-muted);
}
.lb__name {
    flex: 1;
    text-align: left;
    padding-left: 0.5em;
}
.lb__score {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 400;
    letter-spacing: -0.02em;
}

/* ── Anti-cheat overlay ────────────────────────────────── */
#game__cheat-msg {
    position: fixed;
    inset: 0;
    z-index: 999998;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    transition: background 0.3s ease;
}
#game__cheat-msg p {
    font-family: 'Caveat', cursive;
    font-size: clamp(2rem, 5vw, 4rem);
    font-weight: 400;
    color: var(--accent);
    text-align: center;
    padding: 0 2rem;
}

/* ── Play area centered layout ─────────────────────────── */
#game__play {
    display: flex;
    flex-direction: column;
    align-items: center;
}
