/* ═══════════════════════════════
   GAME SCREEN
═══════════════════════════════ */

.game-body {
    background: #d8d0c8;
    display: flex;
    align-items: stretch;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh; /* exclude mobile browser chrome so the guess row stays visible */
    overflow: hidden;
}

.game-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 440px;
    height: 100vh;
    height: 100dvh; /* track the visible viewport as mobile browser bars show/hide */
    padding: 10px 10px 12px;
    gap: 10px;
}

/* ── The card ── */
.card {
    background: #f8f5f0;
    border-radius: 14px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.35), 0 2px 6px rgba(0,0,0,0.2);
    padding: 14px 12px 10px;
    width: 100%;
    flex: 1 1 0;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    /* subtle paper texture via gradient noise */
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
    background-repeat: repeat;
}

/* ── Name area (hosts the guess box until solved, then the name) ── */
.name-area {
    text-align: center;
    padding: 4px 8px 2px;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    min-height: 52px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.name-guess {
    display: flex;
    gap: 8px;
    align-items: center;
    width: 100%;
}

.player-name {
    font-family: 'Alfa Slab One', serif;
    font-size: 42px;
    line-height: 1.1;
    white-space: nowrap;
    display: block;
    letter-spacing: -0.5px;
    transition: opacity 0.4s ease, filter 0.4s ease;
}

.name-revealed {
    color: #111;
    filter: none;
}

.name-divider {
    height: 2px;
    background: #111;
    margin: 6px 4px 10px;
    border-radius: 1px;
}

/* ── Info bar ── */
.info-bar {
    background: #8da8c4;
    border-radius: 8px;
    padding: 8px 12px;
    margin: 0 2px 12px;
    text-align: center;
    color: #0d1a2a;
    font-family: Georgia, serif;
    font-size: 13.5px;
    line-height: 1.5;
    box-shadow: inset 0 1px 3px rgba(255,255,255,0.3), 0 2px 4px rgba(0,0,0,0.15);
}

.info-born {
    font-weight: 600;
}

.info-details {
    font-weight: 500;
}

/* ── Parchment ── */
.parchment {
    background: #c5b088;
    border-radius: 3px;
    padding: 0 16px 18px;
    margin: 0 2px 10px;
    position: relative;
    flex: 1 1 0;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow:
        3px 5px 14px rgba(0,0,0,0.45),
        -2px -2px 6px rgba(0,0,0,0.2),
        inset 0 0 12px rgba(0,0,0,0.12);
    /* roughen edges with clip-path */
    clip-path: polygon(
        0.5% 1.2%, 2% 0%, 5% 1%, 10% 0.2%, 18% 1%, 28% 0%, 40% 1.2%,
        55% 0.4%, 68% 1%, 80% 0.2%, 90% 1%, 96% 0%, 99.5% 1.5%,
        100% 5%, 99% 15%, 100% 30%, 99.5% 50%, 100% 70%, 99% 85%,
        100% 95%, 98.5% 98.5%, 95% 100%, 85% 99%, 72% 100%, 58% 99.2%,
        44% 100%, 30% 99%, 18% 100%, 8% 99.2%, 2% 100%, 0.5% 98%,
        0% 90%, 1% 75%, 0% 58%, 1% 42%, 0% 25%, 1% 10%
    );
}

.parchment-title {
    font-family: 'Alfa Slab One', serif;
    font-size: 22px;
    text-align: center;
    color: #111;
    margin-bottom: 4px;
    font-weight: 400;
}

.parchment-divider {
    height: 2px;
    background: #2a1a08;
    margin: 0 0 12px;
    border-radius: 1px;
    opacity: 0.7;
}

/* ── Clues ── */
.clue {
    font-family: 'Oswald', sans-serif;
    font-size: 16px;
    color: #0d0800;
    margin: 7px 0;
    line-height: 1.35;
    font-weight: 600;
    transition: opacity 0.3s ease, max-height 0.35s ease;
}

.clue-number {
    font-weight: 700;
}

.clue-suggest {
    cursor: pointer;
    margin-left: 6px;
    font-size: 14px;
    opacity: 0.55;
    font-family: sans-serif;
    filter: grayscale(1);
}

.clue-suggest:hover {
    opacity: 1;
}

.clue-visible {
    opacity: 1;
    max-height: 200px;
    overflow: hidden;
}

.clue-hidden {
    display: none;
}

/* ── Reveal clue button ── */
.reveal-clue-btn {
    display: block;
    width: 100%;
    margin-top: 14px;
    padding: 11px 16px;
    background: rgba(0,0,0,0.15);
    border: 2px dashed rgba(0,0,0,0.3);
    border-radius: 6px;
    font-family: 'Oswald', sans-serif;
    font-size: 16px;
    font-weight: 600;
    color: #2a1a08;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s;
}

.reveal-clue-btn:active {
    background: rgba(0,0,0,0.25);
}

/* ── Lifeline button ── */
.lifeline-btn {
    display: block;
    width: 100%;
    margin-top: 10px;
    padding: 11px 16px;
    background: rgba(180, 130, 20, 0.2);
    border: 2px dashed rgba(180, 130, 20, 0.55);
    border-radius: 6px;
    font-family: 'Oswald', sans-serif;
    font-size: 16px;
    font-weight: 600;
    color: #5c3a00;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s;
}

.lifeline-btn:active {
    background: rgba(180, 130, 20, 0.38);
}

/* ── Reveal answer button ── */
.reveal-name-wrap {
    margin-top: 14px;
    text-align: center;
}

.reveal-answer-btn {
    background: #2c5f8a;
    color: #fff;
    border: none;
    border-radius: 50px;
    padding: 11px 28px;
    font-family: 'Oswald', sans-serif;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.5px;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(0,0,0,0.3);
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s, transform 0.1s;
}

.reveal-answer-btn:active {
    background: #1a4060;
    transform: scale(0.97);
}

/* ── Guess input + button (live in the name area) ── */
.guess-input {
    flex: 1 1 auto;
    height: 44px;
    padding: 0 12px;
    border: 2px solid #8da8c4;
    border-radius: 50px;
    font-family: 'Oswald', sans-serif;
    font-size: 16px;
    font-weight: 600;
    color: #111;
    background: #fff;
    outline: none;
    -webkit-appearance: none;
}

.guess-input:focus {
    border-color: #2c5f8a;
}

.guess-btn {
    height: 44px;
    padding: 0 18px;
    background: #2c5f8a;
    color: #fff;
    border: none;
    border-radius: 50px;
    font-family: 'Oswald', sans-serif;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s, transform 0.1s;
}

.guess-btn:active {
    background: #1a4060;
    transform: scale(0.96);
}

/* ── Score bar (correct count + remaining lives) ── */
.score-bar {
    position: relative;
    flex-shrink: 0;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 8px;
    font-family: 'Oswald', sans-serif;
    font-weight: 700;
}

/* Pinned to the true horizontal center of the bar, independent of the
   correct/lives items on either side. */
.home-btn {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background: none;
    border: none;
    color: #2c5f8a;
    font-size: 22px;
    line-height: 1;
    padding: 2px 8px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.home-btn:active { transform: translate(-50%, -50%) scale(0.9); }

.score-correct {
    color: #2c5f8a;
    font-size: 16px;
    letter-spacing: 0.3px;
}

.score-lives {
    font-size: 18px;
    letter-spacing: 2px;
}

.score-lives .lives-used { color: #c0392b; }
.score-lives .lives-left { color: #9aa7b5; }
.score-lives .lifelines-left { color: #c8960a; margin-right: 6px; }

/* ── Game-over overlay ── */
.gameover-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 120;
}

.gameover-overlay.open { display: flex; }

.gameover-box {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 14px;
}

.gameover-title {
    font-family: 'Alfa Slab One', serif;
    font-size: 40px;
    color: #f3ead6;
    line-height: 1.1;
}

.gameover-score {
    font-family: 'Oswald', sans-serif;
    font-weight: 700;
    font-size: 24px;
    color: #8da8c4;
}

.gameover-sub {
    font-family: 'Oswald', sans-serif;
    font-size: 16px;
    color: #cdd6e0;
    max-width: 320px;
}

.gameover-btn {
    margin-top: 10px;
    display: inline-block;
    background: #2c5f8a;
    color: #fff;
    font-family: 'Oswald', sans-serif;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 1px;
    padding: 13px 38px;
    border-radius: 50px;
    text-decoration: none;
    box-shadow: 0 4px 14px rgba(0,0,0,0.5);
    border: 3px solid rgba(255,255,255,0.3);
    -webkit-tap-highlight-color: transparent;
}

.gameover-btn:active { background: #1a4060; transform: scale(0.97); }

/* Secondary action (e.g. "Keep playing") — outlined, not filled. */
.gameover-btn-ghost {
    background: none;
    border: 3px solid rgba(255,255,255,0.35);
    color: #cdd6e0;
    cursor: pointer;
}
.gameover-btn-ghost:active { background: rgba(255,255,255,0.08); transform: scale(0.97); }

.suggest-textarea, .suggest-input {
    width: 100%;
    max-width: 320px;
    font-family: 'Oswald', sans-serif;
    font-size: 16px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 2px solid #8da8c4;
    background: #fff;
    color: #111;
    outline: none;
}

.suggest-textarea:focus, .suggest-input:focus { border-color: #2c5f8a; }

.suggest-textarea { resize: vertical; }

/* ── Name + family-tree icon row ── */
.name-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.tree-btn {
    font-size: 24px;
    line-height: 1;
    flex-shrink: 0;
}

/* ── Relationship chart overlay ── */
.chart-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 50;
}

.chart-overlay.open { display: flex; }

.chart-box {
    width: 100%;
    height: 100%;
    background: transparent;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    text-align: center;
    overflow: auto;
}

.chart-pre {
    font-family: 'Courier New', Courier, monospace;
    font-size: 24px;
    line-height: 1.4;
    color: #f3ead6;
    white-space: pre;
    text-align: left;
    display: inline-block;
    margin: 0;
    overflow-x: auto;
    max-width: 100%;
}

.chart-close {
    display: block;
    margin: 14px auto 0;
    font-family: 'Oswald', sans-serif;
    font-weight: 700;
    font-size: 14px;
    background: #2c5f8a;
    color: #fff;
    border: none;
    border-radius: 50px;
    padding: 8px 24px;
    cursor: pointer;
}

/* ── Swipe-to-advance hint ── */
.swipe-hint {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    font-family: 'Oswald', sans-serif;
    font-size: 22px;
    font-weight: 700;
    color: #fff;
    background: rgba(44, 95, 138, 0.9);
    padding: 10px 16px;
    border-radius: 50px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.3);
    opacity: 0;
    pointer-events: none;
    z-index: 10;
}

.swipe-hint-next { right: 16px; }
.swipe-hint-prev { left: 16px; }

/* ── Translucent nav arrows (click target for desktop; fallback on mobile) ── */
.nav-arrow {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background: rgba(44, 95, 138, 0.18);
    color: #fff;
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 15;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s, opacity 0.15s;
}
.nav-arrow:hover  { background: rgba(44, 95, 138, 0.4); }
.nav-arrow:active { background: rgba(26, 64, 96, 0.55); transform: translateY(-50%) scale(0.94); }

.nav-arrow-prev { left: 10px; }
.nav-arrow-next { right: 10px; }

/* ── Race mode ── */
.race-timer-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 200;
    background: #1a4060;
    color: #f3ead6;
    text-align: center;
    padding: 5px 16px;
    font-family: 'Oswald', sans-serif;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 2px;
    pointer-events: none;
}
.race-timer-bar.urgent {
    background: #c0392b;
    animation: race-pulse 0.4s ease-in-out infinite alternate;
}
@keyframes race-pulse {
    from { opacity: 1; }
    to { opacity: 0.75; }
}
.race-mode .game-layout { padding-top: 36px; }
.race-name-input {
    display: block;
    width: 100%;
    padding: 11px 14px;
    font-family: 'Oswald', sans-serif;
    font-size: 20px;
    border: 2px solid #8da8c4;
    border-radius: 8px;
    margin-bottom: 12px;
    box-sizing: border-box;
    text-align: center;
    background: #1a1a2e;
    color: #f3ead6;
}
.race-name-input::placeholder { color: #5a6a7a; }

/* ── Scrollbar hidden on parchment ── */
.parchment-scroll { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding-top: 14px; }
.parchment-scroll::-webkit-scrollbar { display: none; }
.parchment-scroll { -ms-overflow-style: none; scrollbar-width: none; }

/* ── Celebration canvas (confetti / streamers / fireworks) ── */
#fx-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
    display: none;
}

/* ── Wrong-guess snark overlay ── */
.snark-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 60;
    cursor: pointer;
}

.snark-overlay.open {
    display: flex;
    animation: snark-fade 0.18s ease;
}

@keyframes snark-fade { from { opacity: 0; } to { opacity: 1; } }

.snark-box {
    width: 100%;
    height: 100%;
    background: transparent;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 26px;
    text-align: center;
    animation: snark-pop 0.5s cubic-bezier(0.2, 1.4, 0.4, 1);
}

/* Pop in, then a disapproving "no" head-shake. */
@keyframes snark-pop {
    0%   { transform: scale(0.7); }
    45%  { transform: scale(1) translateX(0); }
    55%  { transform: scale(1) translateX(-8px); }
    65%  { transform: scale(1) translateX(7px); }
    75%  { transform: scale(1) translateX(-5px); }
    85%  { transform: scale(1) translateX(4px); }
    100% { transform: scale(1) translateX(0); }
}

.snark-phrase {
    font-family: 'Alfa Slab One', serif;
    font-size: 24px;
    line-height: 1.3;
    color: #ff8a8a;
    margin-bottom: 16px;
    max-width: 600px;
}

.snark-keep {
    font-family: 'Oswald', sans-serif;
    font-weight: 700;
    font-size: 15px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: #cdd6e0;
}

