:root {
    --bg: #0b0b10;
    --panel: #18181f;
    --panel-2: #222229;
    --line: #34343d;
    --ink: #f7f4ec;
    --muted: #aaa7b0;
    --accent: #d9ff62;
    --accent-ink: #111116;
    --danger: #ff777e;
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background:
        radial-gradient(circle at 10% 0%, color-mix(in srgb, var(--accent) 17%, transparent), transparent 32rem),
        radial-gradient(circle at 92% 100%, rgba(145, 124, 255, .13), transparent 34rem),
        var(--bg);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, textarea, select { font: inherit; }
button { cursor: pointer; }

.page {
    width: min(760px, calc(100% - 32px));
    margin: 0 auto;
    padding-bottom: 44px;
}

.nav {
    min-height: 76px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.brand, .back-link {
    color: var(--ink);
    text-decoration: none;
    font-weight: 900;
}

.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand-mark {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    color: var(--accent-ink);
    background: var(--accent);
    transform: rotate(-5deg);
}

.back-link {
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    font-size: .78rem;
}

.hero { padding: clamp(42px, 8vw, 76px) 0 28px; }
.eyebrow, .card-kicker, .turn-label {
    margin: 0 0 12px;
    color: var(--accent);
    font: 850 .72rem/1.3 ui-monospace, SFMono-Regular, Menlo, monospace;
    letter-spacing: .14em;
    text-transform: uppercase;
}

h1 {
    margin: 0 0 14px;
    font-size: clamp(2.8rem, 10vw, 5.6rem);
    line-height: .92;
    letter-spacing: -.065em;
}

.lead {
    max-width: 640px;
    margin: 0;
    color: var(--muted);
    font-size: 1.05rem;
    line-height: 1.65;
}

.panel {
    padding: clamp(20px, 5vw, 34px);
    border: 1px solid var(--line);
    border-radius: 26px;
    background: rgba(24, 24, 31, .94);
    box-shadow: 0 30px 80px rgba(0,0,0,.36);
}

.panel[hidden] { display: none; }
.panel h2 { margin: 0 0 8px; font-size: 1.5rem; letter-spacing: -.03em; }
.muted { margin: 0; color: var(--muted); line-height: 1.55; }

.field-grid { display: grid; gap: 18px; margin: 26px 0; }
.field { display: grid; gap: 8px; }
.field label { font-size: .8rem; font-weight: 850; letter-spacing: .04em; }
.field small { color: var(--muted); line-height: 1.4; }

input, textarea, select {
    width: 100%;
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 14px;
    outline: none;
    background: #101015;
    padding: 13px 14px;
}

input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent); }
select { appearance: none; cursor: pointer; }
textarea { min-height: 112px; resize: vertical; }

.team-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.btn {
    min-height: 48px;
    border: 1px solid transparent;
    border-radius: 14px;
    padding: 12px 17px;
    font-weight: 900;
    transition: transform .15s ease, filter .15s ease, border-color .15s ease;
}

.btn:hover { transform: translateY(-1px); filter: brightness(1.04); }
.btn-primary { color: var(--accent-ink); background: var(--accent); }
.btn-secondary { color: var(--ink); background: var(--panel-2); border-color: var(--line); }
.btn-danger { color: #fff; background: transparent; border-color: rgba(255,119,126,.45); }
.btn-block { width: 100%; }

.game-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
}

.turn-label { margin: 0; }
.timer {
    min-width: 66px;
    padding: 9px 12px;
    text-align: center;
    color: var(--accent);
    background: #101015;
    border: 1px solid var(--line);
    border-radius: 999px;
    font: 900 .85rem/1 ui-monospace, monospace;
}

.timer.danger { color: var(--danger); border-color: rgba(255,119,126,.48); }
.timer[hidden] { display: none; }

.scoreboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 8px;
    margin-bottom: 14px;
}

.score {
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    color: var(--muted);
    background: rgba(16,16,21,.7);
    font-size: .78rem;
}
.score strong { display: block; margin-top: 3px; color: var(--ink); font-size: 1rem; }

.prompt-card {
    min-height: 300px;
    display: grid;
    align-content: center;
    padding: clamp(24px, 7vw, 48px);
    border: 1px solid color-mix(in srgb, var(--accent) 36%, var(--line));
    border-radius: 24px;
    text-align: center;
    background:
        linear-gradient(145deg, color-mix(in srgb, var(--accent) 9%, transparent), transparent 55%),
        #111116;
    overflow-wrap: anywhere;
}

.card-kicker { margin-bottom: 16px; }
.prompt-text {
    margin: 0;
    white-space: pre-line;
    font-size: clamp(1.45rem, 5vw, 2.35rem);
    line-height: 1.25;
    letter-spacing: -.035em;
    font-weight: 900;
}

.answer-text {
    margin: 20px 0 0;
    padding-top: 18px;
    color: var(--accent);
    border-top: 1px solid var(--line);
    font-size: 1.05rem;
    line-height: 1.5;
}
.answer-text:empty { display: none; }

.pictionary-countdown {
    width: fit-content;
    min-width: min(100%, 230px);
    margin: 24px auto 0;
    padding: 14px 24px;
    color: var(--accent);
    border: 2px solid color-mix(in srgb, var(--accent) 55%, var(--line));
    border-radius: 24px;
    background: color-mix(in srgb, var(--accent) 9%, #0b0b10);
    font: 1000 clamp(4rem, 18vw, 7.5rem)/.9 ui-monospace, SFMono-Regular, Menlo, monospace;
    letter-spacing: -.08em;
    font-variant-numeric: tabular-nums;
}

.pictionary-countdown.is-final {
    color: #fff;
    border-color: var(--danger);
    background: rgba(255, 119, 126, .2);
    box-shadow: 0 0 42px rgba(255, 119, 126, .25);
    animation: countdown-pulse .72s ease-in-out infinite;
}

@keyframes countdown-pulse {
    50% { transform: scale(1.07); }
}

.controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); gap: 10px; margin-top: 14px; }
.footer-controls { display: flex; justify-content: center; margin-top: 24px; }
.footer-controls .btn { min-height: 40px; padding: 8px 14px; font-size: .78rem; }

.inline-form { width: 100%; display: grid; gap: 12px; text-align: left; }
.statement-row { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 10px; }
.statement-row input[type="radio"] { width: 18px; height: 18px; accent-color: var(--accent); }
.statement-list { display: grid; gap: 10px; margin: 18px 0 0; text-align: left; }
.statement {
    padding: 13px 15px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: var(--panel-2);
    line-height: 1.45;
}
.statement.lie { border-color: var(--danger); color: #fff; background: rgba(255,119,126,.12); }
.word-form { width: 100%; display: grid; gap: 10px; margin-top: 22px; }
.error { min-height: 1.2em; margin: 8px 0 0; color: var(--danger); font-size: .86rem; }
.chain { margin: 16px 0 0; color: var(--muted); font-size: .85rem; line-height: 1.5; }

@media (max-width: 560px) {
    .page { width: min(100% - 22px, 760px); }
    .nav { min-height: 66px; }
    .back-link { font-size: 0; }
    .back-link::after { content: "All games"; font-size: .75rem; }
    .team-fields { grid-template-columns: 1fr; }
    .prompt-card { min-height: 275px; }
}

@media (prefers-reduced-motion: reduce) {
    .pictionary-countdown.is-final { animation: none; }
}
