/* ════════════════════════════════════════════════════════════════════
   Trivia House - all game styling (single file, like the other games)
   Theme: twilight suburb - deep navy sky, warm porch-light gold accents.
   ════════════════════════════════════════════════════════════════════ */

:root {
    --bg: #141a30;
    --bg2: #1b2340;
    --panel: #222b4d;
    --panel2: #2a3560;
    --line: #3a4675;
    --text: #eef1ff;
    --muted: #9aa3c7;
    --accent: #f6c453;
    --accent2: #ff8a5c;
    --easy: #2fae5a;
    --medium: #2f7fe0;
    --hard: #d9403a;
    --good: #59d68a;
    --bad: #ff6b6b;
    --radius: 12px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    min-height: 100%;
    background:
        radial-gradient(ellipse at 50% -10%, #34407a 0%, transparent 60%),
        radial-gradient(circle at 88% 9%, #f4ead0 0 22px, rgba(244, 234, 208, .12) 23px 60px, transparent 61px),
        var(--bg);
    background-attachment: fixed;
    color: var(--text);
    font-family: "Fredoka", "Segoe UI", system-ui, sans-serif;
    font-size: 16px;
}

h1, h2, h3 { margin: .4em 0; font-weight: 600; }
h1:focus { outline: none; }
h3 { color: var(--accent); font-size: 1.05rem; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.error-text { color: var(--bad); margin: .4rem 0; }

/* ── Buttons / inputs ───────────────────────────────────────────── */
button { font-family: inherit; cursor: pointer; }
button:disabled { opacity: .5; cursor: not-allowed; }

.primary-btn, .secondary-btn, .done-btn, .step-btn {
    border: none;
    border-radius: 10px;
    padding: .6rem 1.1rem;
    font-size: 1rem;
    font-weight: 600;
    transition: transform .08s, filter .15s;
}
.primary-btn:not(:disabled):hover, .secondary-btn:hover, .done-btn:hover, .step-btn:hover { filter: brightness(1.12); }
.primary-btn:not(:disabled):active, .secondary-btn:active, .done-btn:active, .step-btn:active { transform: translateY(1px); }
.primary-btn { background: linear-gradient(#ffd56e, #f0b23a); color: #3a2600; box-shadow: 0 3px 0 #b07a14; }
.primary-btn.small { padding: .35rem .8rem; font-size: .9rem; }
.secondary-btn { background: var(--panel2); color: var(--text); box-shadow: 0 3px 0 #161d38; }
.step-btn { background: var(--panel2); color: var(--text); padding: .45rem .7rem; }
.icon-btn {
    background: var(--panel2); border: none; color: var(--text);
    border-radius: 8px; padding: .35rem .55rem; font-size: 1rem;
}

.text-input {
    width: 100%;
    background: #10152a;
    border: 2px solid var(--line);
    color: var(--text);
    border-radius: 10px;
    padding: .6rem .8rem;
    font-size: 1rem;
    font-family: inherit;
    margin-bottom: .6rem;
}
.text-input:focus { outline: none; border-color: var(--accent); }
.text-input.big { font-size: 1.3rem; padding: .8rem 1rem; }

label { display: block; margin: .5rem 0 .25rem; color: var(--muted); font-size: .9rem; }

/* ── Index / lobby ──────────────────────────────────────────────── */
.index-page { max-width: 720px; margin: 0 auto; padding: 1rem; }
.title-block { display: flex; align-items: center; justify-content: center; gap: .5rem; flex-wrap: wrap; }
.game-title { font-size: 2.6rem; font-weight: 700; letter-spacing: .5px; margin: 0; text-shadow: 0 3px 0 rgba(0,0,0,.35); }
.game-title.small { font-size: 1.3rem; }
.accent { color: var(--accent); }
.tagline { color: var(--muted); margin: .2rem 0 1rem; }

.index-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.2rem;
    margin-bottom: 1rem;
    box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
.index-card > button { margin: .4rem .4rem 0 0; }

.home-page-tabs, .index-tabs { display: flex; gap: .4rem; margin: .5rem 0 .8rem; }
.tab-btn {
    flex: 1; background: var(--bg2); color: var(--muted);
    border: 1px solid var(--line); border-radius: 10px; padding: .55rem; font-size: .95rem;
}
.tab-btn.active { background: var(--panel2); color: var(--accent); border-color: var(--accent); }

.table-row {
    display: flex; align-items: center; justify-content: space-between; gap: .5rem;
    background: var(--bg2); border: 1px solid var(--line); border-radius: 10px;
    padding: .7rem .9rem; margin-bottom: .4rem; cursor: pointer;
}
.table-row.selected { border-color: var(--accent); }
.table-row-main { display: flex; flex-direction: column; min-width: 0; }
.table-row-main .muted { font-size: .85rem; }
.join-panel { padding: .5rem .2rem 1rem; display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.join-panel .text-input { margin: 0; }
.phase-chip { font-size: .75rem; padding: .2rem .55rem; border-radius: 999px; white-space: nowrap; }
.phase-chip.lobby { background: #2f5d50; }
.phase-chip.playing { background: #6b3b2a; }

.player-list { list-style: none; padding: 0; margin: .2rem 0 .8rem; }
.lobby-lots { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: 1rem; }
.lobby-lot { display: flex; flex-direction: column; align-items: center; }

.guide-card ul, .guide-card ol { padding-left: 1.3rem; line-height: 1.5; }
.guide-card li { margin-bottom: .3rem; }

/* ── Difficulty colors ──────────────────────────────────────────── */
.diff-chip {
    display: inline-block; font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .5px;
    padding: .12rem .5rem; border-radius: 999px; color: #fff;
}
.diff-chip.easy { background: var(--easy); }
.diff-chip.medium { background: var(--medium); }
.diff-chip.hard { background: var(--hard); }
.diff-text.easy { color: var(--easy); } .diff-text.medium { color: #6aaaf5; } .diff-text.hard { color: #ff7b75; }

/* ── Game page layout ───────────────────────────────────────────── */
.game-page { display: flex; flex-direction: column; min-height: 100vh; }

.game-header {
    display: flex; align-items: center; gap: .6rem; padding: .5rem 1rem;
    background: rgba(16, 21, 42, .85); border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 50; backdrop-filter: blur(6px);
}
.header-left { display: flex; flex-direction: column; line-height: 1.1; }
.hood-name { font-size: .8rem; }
.header-right { display: flex; align-items: center; gap: .4rem; margin-left: auto; flex-wrap: wrap; justify-content: flex-end; }
.banner-slot { flex: 1; display: flex; justify-content: center; min-width: 0; }
.banner-display {
    background: linear-gradient(#ffe28a, #f0b23a); color: #3a2600; font-weight: 600;
    padding: .35rem 1rem; border-radius: 999px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    max-width: 100%; animation: banner-in .35s ease-out; box-shadow: 0 3px 0 #b07a14;
}
@keyframes banner-in { from { transform: translateY(-14px) scale(.9); opacity: 0; } }
.round-pill, .budget-pill, .timer {
    background: var(--panel2); border-radius: 999px; padding: .25rem .7rem; font-weight: 600; white-space: nowrap;
}
.budget-pill { background: #2e5a3a; color: #b9f5c8; }
.timer { font-variant-numeric: tabular-nums; }
.timer.urgent { background: var(--hard); animation: pulse 1s infinite; }
@keyframes pulse { 50% { filter: brightness(1.3); } }

/* ── Neighborhood strip (all houses) ────────────────────────────── */
.neighborhood {
    display: flex; gap: .4rem; overflow-x: auto; padding: .6rem 1rem .2rem;
    align-items: flex-end;
    background: linear-gradient(transparent 70%, rgba(60, 120, 50, .25));
    border-bottom: 1px solid var(--line);
    scrollbar-width: thin;
}
.neighborhood.big { justify-content: center; flex-wrap: wrap; overflow: visible; }
.lot-card {
    flex: 0 0 auto; display: flex; flex-direction: column; align-items: center;
    padding: .2rem .4rem .4rem; border-radius: var(--radius);
}
.lot-card.me { background: rgba(246, 196, 83, .07); outline: 1px solid rgba(246, 196, 83, .3); }
.lot-card.winner { background: rgba(246, 196, 83, .18); outline: 2px solid var(--accent); }
.lot-name { font-weight: 600; font-size: .95rem; text-align: center; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lot-stats { display: flex; gap: .6rem; font-size: .8rem; color: var(--muted); }
.lot-status { font-size: .75rem; color: var(--accent); min-height: 1em; }

.play-area { flex: 1; padding: .8rem 1rem 1rem; display: flex; flex-direction: column; min-height: 0; }

.center-msg { text-align: center; margin: 1.5rem auto; max-width: 640px; width: 100%; }
.spinner {
    width: 48px; height: 48px; margin: 0 auto; border-radius: 50%;
    border: 5px solid var(--panel2); border-top-color: var(--accent); animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.answer-status { display: flex; flex-direction: column; gap: .4rem; margin-top: .8rem; text-align: left; }
.answer-row {
    display: flex; flex-wrap: wrap; gap: .6rem; align-items: center;
    background: var(--panel); border-radius: 10px; padding: .5rem .8rem;
}

/* ── Bidding: scrollable card table ─────────────────────────────── */
.bidding { display: flex; flex-direction: column; gap: .7rem; flex: 1; min-height: 0; }
.card-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .8rem;
    overflow-y: auto; max-height: calc(100vh - 430px); min-height: 250px;
    padding: .9rem .9rem 1rem;   /* room for the 12px selected ring inside the scroll box */
    background:
        radial-gradient(ellipse at center, rgba(255,255,255,.03), transparent 70%),
        repeating-linear-gradient(90deg, rgba(0,0,0,.08) 0 2px, transparent 2px 46px),
        #3b2a20;   /* wooden table */
    border-radius: var(--radius); border: 6px solid #2a1d15;
    box-shadow: inset 0 0 30px rgba(0,0,0,.5);
}

.qcard {
    position: relative; display: flex; flex-direction: column;
    height: 256px; border-radius: 12px; overflow: hidden; cursor: pointer;
    background: #fdf8ec; color: #222; border: 4px solid #ccc;
    box-shadow: 0 4px 0 rgba(0,0,0,.35), 0 8px 18px rgba(0,0,0,.35);
    transition: transform .12s, box-shadow .12s;
}
.qcard:hover { transform: translateY(-3px) rotate(-.4deg); }
/* Card + leading-bid bar; the selected ring wraps both. */
.qcard-slot { display: flex; flex-direction: column; gap: .35rem; border-radius: 12px; transition: transform .12s, box-shadow .12s; }
.qcard-slot.selected { box-shadow: 0 0 0 12px var(--accent), 0 8px 18px rgba(0,0,0,.4); background: var(--accent); transform: translateY(-3px); }
.qcard-slot.selected .qcard:hover { transform: none; }
.qcard.mine::after {
    content: "YOU LEAD"; position: absolute; top: 44px; right: -30px; transform: rotate(35deg);
    background: var(--accent); color: #3a2600; font-weight: 700; font-size: .7rem; padding: .15rem 2.2rem;
}
.qcard.easy { border-color: var(--easy); }
.qcard.medium { border-color: var(--medium); }
.qcard.hard { border-color: var(--hard); }

/* Category: white text on a textured dark rectangle. */
.qcard-banner {
    flex: 0 0 auto; color: #fff; font-weight: 600; font-size: .85rem; letter-spacing: .4px; text-transform: uppercase;
    padding: .4rem .6rem; text-align: center; text-shadow: 0 1px 2px #000;
    background: url(../img/noise.svg), repeating-linear-gradient(45deg, rgba(255,255,255,.04) 0 3px, transparent 3px 7px),
                linear-gradient(#2a2d38, #15171f);
    border-bottom: 2px solid rgba(0,0,0,.4);
}
.qcard-banner.big { font-size: 1.05rem; padding: .6rem; border-radius: 8px; }

.qcard-text { flex: 1; padding: .6rem .7rem; overflow: hidden; line-height: 1.25; font-weight: 500; }

.qcard-back { flex: 1; display: flex; align-items: center; justify-content: center; }
.qcard.face-down { color: #fff; }
.qcard.face-down.easy { background: repeating-linear-gradient(45deg, #2fae5a 0 10px, #28994e 10px 20px); }
.qcard.face-down.medium { background: repeating-linear-gradient(45deg, #2f7fe0 0 10px, #296fc5 10px 20px); }
.qcard.face-down.hard { background: repeating-linear-gradient(45deg, #d9403a 0 10px, #c13832 10px 20px); }
.qcard-emblem {
    width: 92px; height: 92px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,.18); border: 3px solid rgba(255,255,255,.6); color: #fff;
}
.qcard-emblem svg { width: 62px; height: 62px; }

.qcard-footer {
    flex: 0 0 auto; display: flex; align-items: center; gap: .35rem; padding: .35rem .5rem;
    background: rgba(0,0,0,.08); font-size: .85rem;
}
.qcard.face-down .qcard-footer { background: rgba(0,0,0,.25); }
.typed-chip { font-size: .7rem; background: #444; color: #fff; padding: .1rem .4rem; border-radius: 6px; }
.qcard-leader {
    display: flex; align-items: baseline; gap: .4rem; padding: .3rem .6rem; cursor: pointer;
    background: #12162a; border: 3px solid; border-radius: 10px; color: #fff;
}
.qcard-leader.none { justify-content: center; border-color: #2a1d15; color: rgba(255,255,255,.45); font-size: .85rem; }
.bid-amt { font-weight: 700; font-size: 1.05rem; margin-left: auto; }
.bid-who { font-weight: 700; font-size: 1.05rem; text-shadow: 0 1px 2px rgba(0,0,0,.6); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.bid-bar {
    display: flex; flex-wrap: wrap; align-items: center; gap: .6rem;
    background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem .9rem;
}
.bid-info { flex: 1 1 260px; display: flex; flex-direction: column; gap: .2rem; }
.flip-chip { font-size: .7rem; background: var(--accent); color: #222; padding: .1rem .4rem; border-radius: 6px; }
.bid-controls { display: flex; align-items: center; gap: .3rem; flex-wrap: wrap; }
.dollar { font-weight: 700; color: var(--accent); }
.bid-input { width: 80px; margin: 0; text-align: center; }
/* PC: own row, Done dead-center, Bid just left of it. */
.bid-actions { flex: 1 1 100%; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: .5rem; }
.bid-actions .bid-btn { grid-column: 1; justify-self: end; }
.bid-actions .done-btn, .bid-actions .lead-note { grid-column: 2; }
.lead-note { color: var(--accent); text-align: center; }
.done-btn { background: #3c6e4f; color: #fff; box-shadow: 0 3px 0 #23452f; }
.done-btn.is-done { background: #2e5a3a; color: #b9f5c8; }

/* ── Results ────────────────────────────────────────────────────── */
.results { max-width: 820px; margin: 0 auto; width: 100%; text-align: center; }
.result-list { display: flex; flex-direction: column; gap: .5rem; margin: .8rem 0; text-align: left; }
.result-row { background: var(--panel); border-radius: 10px; padding: .6rem .9rem; border-left: 6px solid var(--bad); }
.result-row.right { border-left-color: var(--good); }
.result-head { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
summary.result-head { cursor: pointer; list-style: none; }
summary.result-head::-webkit-details-marker { display: none; }
summary.result-head::before { content: "▸"; font-size: 1.2rem; line-height: 1; color: var(--muted); transition: transform .15s; }
details[open] > summary.result-head::before { transform: rotate(90deg); }
details.result-row[open] > summary.result-head { margin-bottom: .3rem; }
.result-name { font-weight: 700; }
.result-mark { margin-left: auto; font-weight: 700; }
.result-row.right .result-mark { color: var(--good); }
.result-row.wrong .result-mark { color: var(--bad); }
.result-q { margin: .3rem 0; }
.result-a { color: var(--muted); }
.result-a b { color: var(--text); }
.winner-banner {
    font-size: 2rem; font-weight: 700; margin: .5rem 0; color: var(--accent);
    text-shadow: 0 3px 0 rgba(0,0,0,.4); animation: banner-in .5s ease-out;
}
.gameover-actions { display: flex; gap: .6rem; justify-content: center; }

/* ── Overlays ───────────────────────────────────────────────────── */
.overlay-backdrop {
    position: fixed; inset: 0; background: rgba(5, 8, 20, .75);
    display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 1rem;
}
.overlay-backdrop.top { z-index: 1100; }
.overlay-panel {
    background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
    padding: 1.3rem; max-width: min(720px, 96vw); min-width: min(320px, 96vw); width: 100%;
    box-shadow: 0 0 40px rgba(0,0,0,.6); animation: pop .2s ease-out;
}
.overlay-panel.scroll { max-height: 88vh; overflow-y: auto; }
@keyframes pop { from { transform: scale(.94); opacity: 0; } }
.overlay-header { display: flex; justify-content: space-between; align-items: center; font-weight: 600; margin-bottom: .6rem; color: var(--accent); }
.overlay-close { cursor: pointer; padding: 0 .3rem; }

.answer-panel { border-top: 8px solid var(--line); }
.answer-panel.easy { border-top-color: var(--easy); }
.answer-panel.medium { border-top-color: var(--medium); }
.answer-panel.hard { border-top-color: var(--hard); }
.answer-meta { display: flex; gap: .6rem; align-items: center; margin: .7rem 0; }
.answer-meta .timer { margin-left: auto; }
.answer-question { font-size: clamp(1.2rem, 3.2vw, 1.8rem); font-weight: 500; line-height: 1.3; margin: .4rem 0 1.1rem; }
.choice-list { display: flex; flex-direction: column; gap: .5rem; }
.choice-btn {
    display: flex; align-items: center; gap: .8rem; text-align: left;
    background: var(--panel2); color: var(--text); border: 2px solid var(--line); border-radius: 12px;
    padding: .7rem .9rem; font-size: 1.1rem;
}
.choice-btn:hover { border-color: var(--accent); }
.choice-num {
    flex: 0 0 auto; width: 2rem; height: 2rem; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
    background: var(--accent); color: #3a2600; font-weight: 700;
}
.typed-answer { display: flex; gap: .5rem; align-items: flex-start; }
.typed-answer .text-input { margin: 0; }
.confirm-box { background: var(--bg2); border-radius: 12px; padding: 1rem; text-align: center; font-size: 1.15rem; }
.confirm-btns { display: flex; gap: .6rem; justify-content: center; margin-top: .8rem; flex-wrap: wrap; }

.vote-q { font-size: 1.15rem; margin: .7rem 0; }
.vote-compare { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.vote-compare > div { background: var(--bg2); border-radius: 10px; padding: .6rem .8rem; display: flex; flex-direction: column; gap: .2rem; }
.vote-compare b { font-size: 1.25rem; }

/* ── Chat side panel ────────────────────────────────────────────── */
.side-panel {
    position: fixed; right: 0; top: 0; bottom: 0; width: min(340px, 92vw); z-index: 900;
    background: var(--panel); border-left: 1px solid var(--line); display: flex; flex-direction: column;
    box-shadow: -10px 0 30px rgba(0,0,0,.4);
}
.side-panel-header { display: flex; justify-content: space-between; align-items: center; padding: .7rem 1rem; border-bottom: 1px solid var(--line); font-weight: 600; }
.chat-messages { flex: 1; overflow-y: auto; padding: .6rem 1rem; display: flex; flex-direction: column; gap: .35rem; }
.chat-msg { word-wrap: break-word; }
.chat-time { color: var(--muted); font-size: .75rem; margin-right: .3rem; }
.chat-name { font-weight: 600; }
.chat-input-row { display: flex; gap: .4rem; padding: .6rem; border-top: 1px solid var(--line); }
.chat-input-row .text-input { margin: 0; }

/* ════════════════════════════════════════════════════════════════════
   3D HOUSE (House3D.razor) - orthographic CSS 3D, faces positioned
   around the lot center; transforms are inline from C#.
   ════════════════════════════════════════════════════════════════════ */
.house-stage { position: relative; overflow: visible; flex: 0 0 auto; }
.house-stage.highlight { filter: drop-shadow(0 0 14px rgba(246, 196, 83, .8)); }
.house-scene {
    position: absolute; width: 0; height: 0;
    transform-style: preserve-3d;
    transform-origin: 0 0;
}
.house-scene .face {
    position: absolute; left: 0; top: 0;
    transform-style: preserve-3d;
    backface-visibility: visible;
}

.face.lot {
    background: url(../img/grass.svg) 0 0 / 40px 40px, #4f9a3c;
    border-radius: 18px;
    box-shadow: inset 0 0 0 6px rgba(0,0,0,.12);
}

/* Unbuilt pieces: dashed blueprint outlines. */
.face.ghost {
    background: rgba(120, 180, 255, .05);
    border: 1.5px dashed rgba(160, 205, 255, .5);
}
.face.ghost.roof, .face.ghost.ceiling { border-color: rgba(160, 205, 255, .3); }

.face.built.floor { background: url(../img/wood.svg) 0 0 / 40px 20px, #c58b4f; box-shadow: inset 0 0 0 3px #7a4f27; }
.face.built.ceiling { background: url(../img/deck.svg) 0 0 / 22px 22px, #8d8f96; box-shadow: inset 0 0 0 3px #5d5f66; }

.face.built.brick { background-color: #a63f28; background-image: url(../img/brick.svg); background-size: 22px 11px; }
.face.built.siding { background-color: var(--siding); background-image: url(../img/siding.svg); background-size: 30px 9px; }
.face.built.wall { box-shadow: inset 0 0 0 3px rgba(0,0,0,.18), inset 0 -6px 0 rgba(0,0,0,.18); }

.face.built.brick.win, .face.built.siding.win {
    background-image: url(../img/window.svg), url(../img/brick.svg);
    background-size: 46% auto, 22px 11px;
    background-position: center 45%, 0 0;
    background-repeat: no-repeat, repeat;
}
.face.built.siding.win {
    background-image: url(../img/window.svg), url(../img/siding.svg);
    background-size: 46% auto, 30px 9px;
}
.face.built.siding.win2 {
    background-image: url(../img/window.svg), url(../img/window.svg), url(../img/siding.svg);
    background-size: 36% auto, 36% auto, 30px 9px;
    background-position: 12% 45%, 88% 45%, 0 0;
    background-repeat: no-repeat, no-repeat, repeat;
}
.face.built.brick.door {
    background-image: url(../img/door.svg), url(../img/window.svg), url(../img/brick.svg);
    background-size: auto 78%, 36% auto, 22px 11px;
    background-position: 24% 100%, 86% 40%, 0 0;
    background-repeat: no-repeat, no-repeat, repeat;
}

/* Gable triangles take the siding color (brick for single-story brick houses looks odd at the peak). */
.face.gable {
    background-color: var(--siding); background-image: url(../img/siding.svg); background-size: 30px 9px;
    clip-path: polygon(50% 0, 100% 100%, 0 100%);
    filter: brightness(.9);
}

.face.built.roof {
    background: url(../img/shingles.svg) 0 0 / 18px 12px, #4a5168;
    box-shadow: inset 0 3px 0 #2b2e3a, inset 0 -4px 0 rgba(0,0,0,.35);
}

/* Fake lighting: walls facing away from the light are a little darker. */
.face.built.shade { filter: brightness(.82); }

/* Newest piece drops in from above. `translate` composes with the inline transform. */
.face.new { animation: drop-in 1s cubic-bezier(.2, .9, .3, 1.25) both; }
@keyframes drop-in {
    0% { translate: 0 -160px 0; opacity: 0; }
    40% { opacity: 1; }
    100% { translate: 0 0 0; opacity: 1; }
}

/* ── Mobile ─────────────────────────────────────────────────────── */
@media (max-width: 700px) {
    .game-header { flex-wrap: wrap; padding: .4rem .6rem; }
    .banner-slot { order: 3; flex-basis: 100%; }
    .game-title { font-size: 2rem; }
    .card-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); max-height: none; }
    .qcard { height: 236px; }
    .play-area { padding: .6rem; }
    .vote-compare { grid-template-columns: 1fr; }
    .typed-answer { flex-direction: column; align-items: stretch; }
}

#blazor-error-ui {
    background: #5a1d1d; color: #fff; bottom: 0; box-shadow: 0 -1px 2px rgba(0,0,0,.2);
    display: none; left: 0; padding: .6rem 1.25rem .7rem; position: fixed; width: 100%; z-index: 2000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }

/* ── Round results overlay ──────────────────────────────────────── */
.results-panel { position: relative; max-width: min(860px, 96vw); padding-top: 1rem; }
.results-title { margin: 0 3rem .6rem 0; color: var(--accent); }
.close-x {
    position: absolute; top: .7rem; right: .7rem; z-index: 2;
    width: 2.4rem; height: 2.4rem; border: none; border-radius: 10px;
    background: linear-gradient(#ef5a52, #c8302a); color: #fff;
    font-size: 1.35rem; font-weight: 700; line-height: 1;
    box-shadow: 0 3px 0 #8e1f1a, 0 0 0 2px rgba(255,255,255,.15);
    transition: transform .08s, filter .15s;
}
.close-x:hover { filter: brightness(1.12); transform: rotate(90deg); }
.close-x:active { transform: translateY(1px); }

.result-choices { margin: .3rem 0 0; padding-left: 1.6rem; display: flex; flex-direction: column; gap: .2rem; }
.result-choices li { padding: .2rem .5rem; border-radius: 6px; }
.result-choices li.correct { background: rgba(89, 214, 138, .16); color: #c9f7d9; font-weight: 600; }
.result-choices li.picked-wrong { background: rgba(255, 107, 107, .16); color: #ffd0d0; text-decoration: line-through; text-decoration-color: rgba(255,107,107,.7); }
.choice-tag { margin-left: .6rem; font-size: .8rem; text-decoration: none; display: inline-block; }
.choice-tag.pick { font-weight: 700; }
.typed-result { display: flex; flex-direction: column; gap: .2rem; margin-top: .2rem; }
.ans-right { color: var(--good); }
.ans-wrong { color: var(--bad); }

/* ── Header back button, host remove, late joiners, notices ─────── */
.back-btn {
    background: transparent; color: var(--muted); border: 1px solid var(--line);
    border-radius: 999px; padding: .25rem .75rem; font-size: .85rem; white-space: nowrap;
}
.back-btn:hover { color: var(--text); border-color: var(--accent); }
.lot-card { position: relative; }
.lot-remove {
    position: absolute; top: .2rem; right: .2rem; width: 1.5rem; height: 1.5rem;
    border: none; border-radius: 6px; background: rgba(217, 64, 58, .75); color: #fff;
    font-size: .8rem; font-weight: 700; opacity: 0; transition: opacity .15s;
}
.lot-card:hover .lot-remove, .lot-remove:focus { opacity: 1; }
@media (hover: none) { .lot-remove { opacity: .8; } }
.pending-lots {
    flex: 0 0 auto; align-self: center; display: flex; flex-direction: column; gap: .2rem;
    padding: .5rem .8rem; border: 1px dashed var(--line); border-radius: var(--radius);
}
.pending-name { font-weight: 600; }
.notice-bar { background: #2e5a3a; color: #d6f7df; padding: .5rem 1rem; text-align: center; }
.notice-bar.warn { background: #5a2e2e; color: #ffd6d6; }
.primary-btn.danger { background: linear-gradient(#ef5a52, #c8302a); color: #fff; box-shadow: 0 3px 0 #8e1f1a; }
.secondary-btn.small { padding: .3rem .7rem; font-size: .85rem; }
.link-btn { background: none; border: none; color: var(--muted); text-decoration: underline; font-size: .8rem; padding: .1rem; }
.link-btn:hover { color: var(--bad); }

/* ── Admin ──────────────────────────────────────────────────────── */
.index-page.wide { max-width: 1100px; }
.admin-toolbar { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-bottom: .6rem; }
.admin-toolbar > span { margin-right: auto; }
.admin-table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.admin-table th, .admin-table td { text-align: left; padding: .45rem .5rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.admin-table th { color: var(--muted); font-weight: 500; }
.admin-table tr.finished td { opacity: .65; }
.admin-table td:last-child { white-space: nowrap; }

/* ── Pause ──────────────────────────────────────────────────────── */
.pause-btn {
    background: transparent; color: var(--accent); border: 1px solid var(--accent);
    border-radius: 999px; padding: .25rem .75rem; font-size: .85rem; white-space: nowrap;
}
.pause-btn:disabled { opacity: .45; cursor: default; }
.notice-bar.pause { background: #5a4a1e; color: #ffeec2; display: flex; gap: .6rem; align-items: center; justify-content: center; flex-wrap: wrap; }
.overlay-backdrop.paused { z-index: 850; }   /* under the chat panel (900) so people can talk while paused */
.pause-panel { text-align: center; max-width: 420px; display: flex; flex-direction: column; gap: .6rem; align-items: center; }
.pause-panel h2 { margin: 0; color: var(--accent); font-size: 2rem; }

/* ── Game Log panel (right third of the screen) ─────────────────── */
.log-panel {
    position: fixed; top: 0; right: 0; bottom: 0; z-index: 1050;   /* over results (1000), under host prompts (1100) */
    width: max(33.333vw, 380px); max-width: 100vw; overflow-y: auto;
    background: var(--panel); border-left: 1px solid var(--line);
    box-shadow: -12px 0 36px rgba(0,0,0,.5); padding: 0 1rem 1.5rem;
    animation: log-slide .2s ease-out;
}
@keyframes log-slide { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.log-panel-top {
    position: sticky; top: 0; z-index: 3; display: flex; align-items: center; justify-content: space-between;
    background: var(--panel); padding: .8rem 0 .6rem; border-bottom: 1px solid var(--line); margin-bottom: .6rem;
}
.log-panel-top h2 { margin: 0; color: var(--accent); font-size: 1.3rem; }
.close-x.sticky { position: static; flex: none; }
.log-round { margin-bottom: 1.1rem; }
.log-round-title { margin: .4rem 0 .5rem; font-size: 1.05rem; border-bottom: 1px dashed var(--line); padding-bottom: .25rem; }
.log-entry { background: rgba(255,255,255,.04); border-radius: 10px; padding: .55rem .75rem; margin-bottom: .5rem; border-left: 5px solid var(--bad); }
.log-entry.right { border-left-color: var(--good); }
.log-entry-head { display: flex; gap: .5rem; align-items: center; }
.log-entry.right .result-mark { color: var(--good); }
.log-entry.wrong .result-mark { color: var(--bad); }
.log-q { margin: .35rem 0 .15rem; font-weight: 500; }
.log-typed { display: grid; grid-template-columns: auto 1fr; gap: .15rem .6rem; margin-top: .3rem; }
.log-entry .result-choices { padding-left: 1.4rem; }

/* ── Piece kind: card bottom strip, chips, Wild picker ─────────────── */
:root {
    --kind-floor: #a0703f;    /* planks */
    --kind-wall: #b4483a;     /* brick */
    --kind-ceiling: #7d8796;  /* plaster */
    --kind-roof: #3d4a5c;     /* slate shingles */
}
.qcard-kind {
    flex: 0 0 auto; height: 26px; display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700; font-size: .8rem; letter-spacing: 1.5px; text-transform: uppercase;
    text-shadow: 0 1px 2px rgba(0,0,0,.7); border-top: 2px solid rgba(0,0,0,.35);
}
.kind-floor { background: repeating-linear-gradient(90deg, var(--kind-floor) 0 22px, #8d6236 22px 24px); }
.kind-wall { background: repeating-linear-gradient(0deg, var(--kind-wall) 0 7px, #8f3a2f 7px 8px); }
.kind-ceiling { background: var(--kind-ceiling); }
.kind-roof { background: repeating-linear-gradient(0deg, var(--kind-roof) 0 6px, #2c3644 6px 8px); }
.kind-wild { background: linear-gradient(90deg, #e2524a, #f2a33a, #e7d24a, #4cbf6b, #4a9be2, #9a63e0); }

.kind-chip {
    display: inline-block; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
    padding: .12rem .5rem; border-radius: 999px; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.6);
}

.wild-picker {
    margin: .6rem auto 1rem; padding: .8rem 1rem; max-width: 560px; text-align: center;
    background: var(--panel); border: 2px solid var(--accent); border-radius: var(--radius);
}
.wild-title { font-weight: 600; margin-bottom: .6rem; }
.wild-options { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; margin-bottom: .4rem; }
.wild-btn {
    display: flex; flex-direction: column; align-items: center; gap: .1rem; min-width: 110px;
    padding: .5rem .9rem; border: 2px solid rgba(255,255,255,.35); border-radius: 10px; cursor: pointer;
    color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.7); font: inherit;
}
.wild-btn:hover { border-color: #fff; transform: translateY(-2px); }

/* ── Flip prompt over a double-tapped face-down card ───────────────── */
.qcard { touch-action: manipulation; user-select: none; -webkit-user-select: none; }   /* no zoom or text-select on double-tap (game.js) */
.qcard-back { flex-direction: column; gap: .5rem; }
.flip-hint { font-size: .72rem; font-weight: 600; opacity: .85; text-shadow: 0 1px 2px rgba(0,0,0,.6); }
.flip-overlay {
    position: absolute; inset: 0; z-index: 3; cursor: default;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .8rem;
    background: rgba(10,14,30,.9); color: #fff; padding: .8rem; text-align: center;
}
.flip-q { font-weight: 700; font-size: 1.05rem; color: var(--accent); }
.flip-btns { display: flex; gap: .5rem; }
.flip-btns button { min-width: 64px; }

/* ── Mobile bidding: cards scroll, bid bar pinned to the bottom ────── */
@media (max-width: 700px) {
    .bidding { padding-bottom: 130px; }   /* last cards can scroll clear of the pinned bar */
    .bid-bar {
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 800;   /* under chat (900) and overlays */
        border-radius: 0; border-width: 1px 0 0; gap: .45rem;
        padding: .5rem .6rem calc(.5rem + env(safe-area-inset-bottom));
        box-shadow: 0 -6px 18px rgba(0,0,0,.45);
    }
    .bid-info { flex: 1 1 100%; }
    .bid-info:not(:has(.error-text)) { display: none; }
    .bid-text { display: none; }
    .bid-controls { flex: 1 1 100%; flex-wrap: nowrap; }
    .bid-controls .step-btn { flex: 1 1 0; padding: .45rem .3rem; }
    .bid-input { flex: 1.4 1 0; width: auto; min-width: 0; }
    .bid-actions { display: flex; }
    .bid-actions > * { flex: 1 1 0; }
}

/* ── Mobile "Large Tiles": one card per row, twice the size ───────── */
.tile-size-toggle { display: none; }
@media (max-width: 700px) {
    .tile-size-toggle {
        display: flex; align-items: center; gap: .45rem; align-self: flex-start;
        font-weight: 600; cursor: pointer; user-select: none;
    }
    .tile-size-toggle input { width: 1.2rem; height: 1.2rem; accent-color: var(--accent); margin: 0; }
    .large-tiles .card-grid { grid-template-columns: 1fr; }
    .large-tiles .qcard { height: 472px; }
    .large-tiles .qcard-banner { font-size: 1.25rem; padding: .7rem .8rem; }
    .large-tiles .qcard-text { padding: 1rem 1.1rem; }
    .large-tiles .qcard-footer { font-size: 1.1rem; padding: .55rem .8rem; }
    .large-tiles .qcard-footer .diff-chip, .large-tiles .typed-chip, .large-tiles .flip-chip { font-size: .95rem; }
    .large-tiles .qcard-kind { font-size: 1.15rem; height: 44px; }
    .large-tiles .qcard-emblem { width: 170px; height: 170px; }
    .large-tiles .qcard-emblem svg { width: 115px; height: 115px; }
    .large-tiles .flip-hint { font-size: 1rem; }
    .large-tiles .qcard-leader { font-size: 1.15rem; padding: .5rem .8rem; }
    .large-tiles .qcard-leader .bid-who, .large-tiles .qcard-leader .bid-amt { font-size: 1.3rem; }
    .large-tiles .qcard.mine::after { top: 60px; font-size: .95rem; }
    .large-tiles .flip-q { font-size: 1.5rem; }
    .large-tiles .flip-btns button { min-width: 110px; font-size: 1.2rem; }
}
