:root {
    --ink: #2b1d0e;
    --ink-soft: #5a4326;
    --parchment: #efe2c4;
    --parchment-2: #e6d4ac;
    --edge: #b89463;
    --wood: #3a2413;
    --wood-2: #26160a;
    --gold: #b8862f;
    --gold-bright: #e0a93c;
    --blood: #7a2216;
    --moss: #4f6b2a;
    --moss-bright: #6f9139;
}

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

html, body { height: 100%; }

body {
    font-family: 'IM Fell English', Georgia, serif;
    color: var(--ink);
    background:
        repeating-linear-gradient(90deg, rgba(0,0,0,0.05) 0 2px, transparent 2px 6px),
        var(--wood-2);
    min-height: 100vh;
    padding: 28px 18px 60px;
    -webkit-font-smoothing: antialiased;
}

.scene {
    max-width: 1120px;
    margin: 0 auto;
}

/* ---------- Banner ---------- */
.banner {
    text-align: center;
    margin-bottom: 28px;
    padding: 22px 16px;
    border: 3px solid var(--gold);
    border-radius: 4px;
    background: var(--wood);
    box-shadow: 0 6px 0 rgba(0,0,0,0.4), inset 0 0 0 2px rgba(0,0,0,0.35);
}

.banner h1 {
    font-family: 'MedievalSharp', cursive;
    color: var(--gold-bright);
    font-size: clamp(2rem, 5vw, 3.5rem);
    letter-spacing: 1px;
    text-shadow: 2px 2px 0 #000;
}

.banner .tagline {
    color: #e8d7ad;
    font-style: italic;
    margin-top: 6px;
    font-size: 1.05rem;
}

/* ---------- Board layout ---------- */
.board {
    display: grid;
    grid-template-columns: 1fr 0.9fr;
    gap: 26px;
    align-items: start;
}

@media (max-width: 860px) {
    .board { grid-template-columns: 1fr; }
}

/* ---------- Town Crier panel ---------- */
.crier {
    position: sticky;
    top: 20px;
    background: var(--wood);
    border: 3px solid var(--gold);
    border-radius: 4px;
    padding: 22px;
    box-shadow: 0 6px 0 rgba(0,0,0,0.4);
}

.crier-scroll {
    background:
        radial-gradient(120% 90% at 50% 0%, var(--parchment) 0%, var(--parchment-2) 100%);
    border: 2px solid var(--edge);
    border-radius: 3px;
    padding: 24px 20px 28px;
    min-height: 230px;
    display: flex;
    flex-direction: column;
    box-shadow: inset 0 0 40px rgba(120,84,30,0.35);
}

.crier-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    border-bottom: 1px dashed var(--edge);
    padding-bottom: 8px;
    margin-bottom: 14px;
}

.crier-label {
    font-family: 'MedievalSharp', cursive;
    color: var(--blood);
    font-size: 1.05rem;
}

.call-counter {
    font-size: 0.95rem;
    color: var(--ink-soft);
    font-style: italic;
}

.current-word {
    font-family: 'MedievalSharp', cursive;
    font-size: clamp(1.8rem, 6vw, 3rem);
    line-height: 1.1;
    color: var(--ink);
    text-align: center;
    margin: 6px 0 10px;
    min-height: 1.2em;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.current-word em { font-size: 0.55em; color: var(--ink-soft); }

.current-word.pop { animation: pop 0.4s ease; }

@keyframes pop {
    0%   { transform: scale(0.6); opacity: 0; }
    60%  { transform: scale(1.08); opacity: 1; }
    100% { transform: scale(1); }
}

.current-callout {
    text-align: center;
    font-style: italic;
    font-size: 1.08rem;
    color: var(--ink-soft);
    min-height: 3em;
}

.countdown {
    text-align: center;
    font-family: 'MedievalSharp', cursive;
    font-size: 1.4rem;
    color: var(--blood);
    margin-top: auto;
    height: 1.6em;
}

.tick-feedback {
    text-align: center;
    font-style: italic;
    font-size: 0.95rem;
    min-height: 1.4em;
    color: var(--moss);
    transition: opacity 0.3s ease;
}

.tick-feedback.warn { color: var(--blood); }

/* ---------- Controls ---------- */
.controls {
    display: flex;
    gap: 12px;
    margin-top: 18px;
}

.btn {
    flex: 1;
    font-family: 'MedievalSharp', cursive;
    font-size: 1.1rem;
    padding: 12px 14px;
    border: 2px solid #000;
    border-radius: 3px;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease, background-color 0.2s ease;
    box-shadow: 0 4px 0 rgba(0,0,0,0.45);
}

.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,0.45); }

.btn-primary {
    background: var(--gold-bright);
    color: var(--wood-2);
}
.btn-primary:hover { background: var(--gold); }

.btn-secondary {
    background: var(--parchment-2);
    color: var(--ink);
}
.btn-secondary:hover { background: var(--parchment); }

.rule-note {
    margin-top: 14px;
    color: #e8d7ad;
    font-size: 0.95rem;
    text-align: center;
    font-style: italic;
}
.rule-note strong { color: var(--gold-bright); }

/* ---------- Bingo list ---------- */
.card-panel {
    background:
        radial-gradient(120% 90% at 50% 0%, var(--parchment) 0%, var(--parchment-2) 100%);
    border: 3px solid var(--gold);
    border-radius: 4px;
    padding: 18px 20px 22px;
    box-shadow: 0 6px 0 rgba(0,0,0,0.4), inset 0 0 40px rgba(120,84,30,0.3);
}

.list-title {
    font-family: 'MedievalSharp', cursive;
    color: var(--blood);
    font-size: 1.6rem;
    text-align: center;
    border-bottom: 2px solid var(--edge);
    padding-bottom: 10px;
    margin-bottom: 8px;
}

.bingo-list { list-style: none; }

.bingo-row {
    border-bottom: 1px dashed rgba(120,84,30,0.45);
    transition: background-color 0.2s ease;
}
.bingo-row:last-child { border-bottom: none; }

.bingo-row.called .word-name::after {
    content: " \2014 cried!";
    color: var(--blood);
    font-style: italic;
    font-size: 0.8em;
}

.bingo-row.win {
    background: rgba(111,145,57,0.35);
    box-shadow: inset 4px 0 0 var(--moss-bright);
}

.bingo-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 6px;
    cursor: pointer;
    gap: 12px;
}

.word-name {
    font-size: 1.18rem;
    color: var(--ink);
    text-transform: capitalize;
}

/* custom tickbox */
.tick { position: absolute; opacity: 0; width: 0; height: 0; }

.tickbox {
    width: 26px;
    height: 26px;
    flex: 0 0 26px;
    border: 2px solid var(--wood);
    border-radius: 3px;
    background: #f6ecd2;
    position: relative;
    transition: background-color 0.15s ease, transform 0.15s ease;
}

.bingo-label:hover .tickbox { transform: scale(1.08); }

.tick:checked + .tickbox {
    background: var(--moss-bright);
    border-color: var(--wood);
}

.tick:checked + .tickbox::after {
    content: "";
    position: absolute;
    left: 7px;
    top: 2px;
    width: 8px;
    height: 15px;
    border: solid #fff;
    border-width: 0 3px 3px 0;
    transform: rotate(42deg);
}

.tick:focus-visible + .tickbox {
    outline: 3px solid var(--gold-bright);
    outline-offset: 2px;
}

/* ---------- Winner overlay ---------- */
.winner-overlay {
    position: fixed;
    inset: 0;
    background: rgba(20,10,3,0.82);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 50;
}
.winner-overlay.show { display: flex; animation: fade 0.35s ease; }

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

.winner-card {
    background:
        radial-gradient(120% 90% at 50% 0%, var(--parchment) 0%, var(--parchment-2) 100%);
    border: 4px solid var(--gold-bright);
    border-radius: 5px;
    padding: 40px 34px;
    max-width: 460px;
    text-align: center;
    box-shadow: 0 0 0 6px rgba(0,0,0,0.5), 0 20px 40px rgba(0,0,0,0.6);
    animation: pop 0.5s ease;
}

.winner-card h2 {
    font-family: 'MedievalSharp', cursive;
    color: var(--blood);
    font-size: 2.2rem;
    margin-bottom: 12px;
}

.winner-card p {
    font-style: italic;
    color: var(--ink-soft);
    font-size: 1.1rem;
    margin-bottom: 24px;
}

/* ---------- Wrong ticks (marked but do NOT count) ---------- */
.bingo-row.wrong-tick .tick:checked + .tickbox {
    background: var(--blood);
    border-color: var(--blood);
}
.bingo-row.wrong-tick .word-name {
    text-decoration: line-through;
    color: var(--blood);
    opacity: 0.8;
}

/* ---------- Scoreboard ---------- */
.scoreboard {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 16px;
    padding: 12px 14px;
    background: var(--wood-2);
    border: 2px solid var(--gold);
    border-radius: 3px;
}
.score-item { flex: 1; text-align: center; }
.score-num {
    display: block;
    font-family: 'MedievalSharp', cursive;
    font-size: 1.7rem;
    line-height: 1;
    color: var(--gold-bright);
    text-shadow: 1px 1px 0 #000;
}
.score-lbl {
    display: block;
    margin-top: 4px;
    font-size: 0.72rem;
    color: #e8d7ad;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.score-reset {
    background: transparent;
    border: 1px solid var(--edge);
    color: #e8d7ad;
    padding: 7px 12px;
    border-radius: 3px;
    cursor: pointer;
    font-family: 'IM Fell English', serif;
    font-size: 0.9rem;
    transition: background-color 0.2s ease;
}
.score-reset:hover { background: rgba(255,255,255,0.09); }