:root,
:root[data-theme="light"] {
    --bg: #f6f7fb;
    --bg-rgb: 246, 247, 251;
    --surface: #ffffff;
    --text: #141a2b;
    --muted: #5d667c;
    --border: #dfe3ee;
    --accent: #2f6fed;
    --accent-text: #ffffff;
    --donate: #e11d68;
    --donate-text: #ffffff;
    --cell: #eef0f6;
    --cell-text: #8b93a7;
    --ok: #17803d;
    --no: #b42318;
    --shadow: 0 1px 2px rgba(20, 26, 43, .06), 0 8px 28px rgba(20, 26, 43, .07);
    --c-B: #2f6fed; --c-I: #e5484d; --c-N: #7c5cff; --c-G: #1f9d63; --c-O: #f0a010;
    color-scheme: light;
}

:root[data-theme="dark"] {
    --bg: #0d111c;
    --bg-rgb: 13, 17, 28;
    --surface: #151b2b;
    --text: #e9edf7;
    --muted: #98a2bb;
    --border: #252d44;
    --accent: #5b8def;
    --accent-text: #0d111c;
    --donate: #ff5c93;
    --donate-text: #1a0610;
    --cell: #1b2236;
    --cell-text: #66708a;
    --ok: #4cc27d;
    --no: #ff7b72;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 28px rgba(0, 0, 0, .4);
    --c-B: #4d85f5; --c-I: #f0646a; --c-N: #9378ff; --c-G: #2fb677; --c-O: #f5b030;
    color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

/* Background photo: sits behind everything; the gradient keeps text readable in both themes. */
.bg { position: fixed; inset: 0; z-index: -1; background-size: cover; background-position: center; opacity: 0; transition: opacity .8s ease; }
.bg.loaded { opacity: 1; }
.bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(var(--bg-rgb), .88) 0%, rgba(var(--bg-rgb), .7) 45%, rgba(var(--bg-rgb), .92) 100%); }

/* Site name: each part styled on its own, Ready[To]Bingo.com */
.hero { text-align: center; margin: .25rem 0 1.25rem; }
h1 .w-ready, .brand .w-ready, h1 .w-to, .brand .w-to { font-weight: 400; }
h1 .w-bingo, .brand .w-bingo { font-weight: 700; letter-spacing: .02em; }
.w-bingo > span:nth-child(1) { color: var(--c-B); } .w-bingo > span:nth-child(2) { color: var(--c-I); } .w-bingo > span:nth-child(3) { color: var(--c-N); }
.w-bingo > span:nth-child(4) { color: var(--c-G); } .w-bingo > span:nth-child(5) { color: var(--c-O); }
.hero h1 { margin: 0; font-family: "Fredoka", system-ui, sans-serif; font-size: 2.1rem; letter-spacing: -.01em; line-height: 1.2; }
.subtitle { margin: .25rem 0 0; font-size: 1.05rem; color: var(--muted); }

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

a { color: var(--accent); }
button, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- header / footer ---------- */
.toolbar {
    display: flex; align-items: center; gap: .5rem;
    padding: .75rem 1rem;
    max-width: 72rem; width: 100%; margin: 0 auto;
}
.brand { font-family: "Fredoka", system-ui, sans-serif; font-size: 1.15rem; letter-spacing: -.01em; color: var(--text); text-decoration: none; }

.icon-btn, .lang > summary {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    height: 2.25rem; min-width: 2.25rem; padding: 0 .6rem;
    background: var(--surface); border: 1px solid var(--border); border-radius: .6rem;
    list-style: none; user-select: none;
}
.lang > summary::-webkit-details-marker { display: none; }
.icon-btn .i-sun { display: none; }
:root[data-theme="dark"] .icon-btn .i-sun { display: block; }
:root[data-theme="dark"] .icon-btn .i-moon { display: none; }
.lang { position: relative; margin-left: auto; }
.lang-code { font-size: .8rem; font-weight: 600; }
.flag { display: inline-flex; width: 1.4rem; }
.flag svg { width: 100%; height: auto; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .12); }
.lang-menu {
    position: absolute; right: 0; top: calc(100% + .35rem); z-index: 20;
    margin: 0; padding: .3rem; list-style: none; min-width: 11rem;
    background: var(--surface); border: 1px solid var(--border); border-radius: .75rem; box-shadow: var(--shadow);
}
.lang-menu a { display: flex; align-items: center; gap: .6rem; padding: .5rem .6rem; border-radius: .5rem; color: var(--text); text-decoration: none; }
.lang-menu a:hover, .lang-menu a[aria-current] { background: var(--cell); }

.credit { margin: 0 0 .5rem; font-size: .75rem; }
.credit a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.credit a:hover { color: var(--accent); }
.site-footer { margin-top: auto; padding: 1.5rem 1rem 2rem; text-align: center; color: var(--muted); font-size: .85rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: .25rem 1rem; justify-content: center; margin-bottom: .5rem; }
.footer-links a, .footer-links button { color: var(--muted); background: none; border: 0; padding: 0; text-decoration: underline; font-size: inherit; }

main { width: 100%; max-width: 72rem; margin: 0 auto; padding: 0 1rem; }

/* ---------- caller ---------- */
.app { display: grid; gap: 1rem; grid-template-columns: 1fr; padding-bottom: 1rem; }
.stage { display: flex; flex-direction: column; align-items: center; gap: .9rem; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 1rem; box-shadow: var(--shadow); }

.ball {
    --lc: var(--accent);
    position: relative; display: grid; place-items: center;
    width: min(62vw, 16rem); aspect-ratio: 1; border-radius: 50%; padding: 0;
    border: 0; color: #141a2b;
    background: radial-gradient(circle at 32% 28%, color-mix(in srgb, var(--lc) 70%, #fff) 0, var(--lc) 55%, color-mix(in srgb, var(--lc) 75%, #000) 100%);
    box-shadow: 0 10px 30px color-mix(in srgb, var(--lc) 35%, transparent), inset 0 -6px 14px rgba(0, 0, 0, .18);
    transition: filter .15s;
}
.ball:hover { filter: brightness(1.05); }
.ball:not(.has) { --lc: var(--cell-text); opacity: .85; }
.ball[data-l="B"] { --lc: var(--c-B); } .ball[data-l="I"] { --lc: var(--c-I); } .ball[data-l="N"] { --lc: var(--c-N); }
.ball[data-l="G"] { --lc: var(--c-G); } .ball[data-l="O"] { --lc: var(--c-O); }
.ball-disc {
    width: 68%; aspect-ratio: 1; border-radius: 50%; background: #fff;
    display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, .15);
}
.ball-letter { font-size: min(7vw, 1.9rem); font-weight: 800; color: var(--lc); min-height: 1em; }
.ball-letter:empty { display: none; }
.ball-number { font-size: min(18vw, 4.6rem); font-weight: 800; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.ball.pop { animation: pop .35s ease-out; }
@keyframes pop { 0% { transform: scale(.82); } 60% { transform: scale(1.05); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .ball.pop { animation: none; } }

.progress { margin: 0; color: var(--muted); font-size: .9rem; font-variant-numeric: tabular-nums; }
.finished { margin: 0; font-weight: 600; color: var(--ok); }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
    min-height: 2.5rem; padding: .45rem .95rem;
    background: var(--surface); border: 1px solid var(--border); border-radius: .7rem; font-weight: 600; font-size: .92rem;
}
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn:disabled { opacity: .45; cursor: default; }
.btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); min-height: 3.1rem; padding: .6rem 1.6rem; font-size: 1.05rem; }
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); }

.recent-wrap { text-align: center; }
.recent-wrap h2 { margin: 0 0 .35rem; font-size: .75rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.recent { display: flex; gap: .4rem; justify-content: center; list-style: none; margin: 0; padding: 0; min-height: 2.6rem; }
.mini {
    --lc: var(--accent);
    min-width: 2.7rem; height: 2.6rem; padding: 0 .35rem; display: grid; place-items: center;
    border-radius: 999px; font-weight: 700; font-size: .9rem; font-variant-numeric: tabular-nums;
    border: 2px solid var(--lc); color: var(--text); background: var(--surface);
}
.mini[data-l="B"] { --lc: var(--c-B); } .mini[data-l="I"] { --lc: var(--c-I); } .mini[data-l="N"] { --lc: var(--c-N); }
.mini[data-l="G"] { --lc: var(--c-G); } .mini[data-l="O"] { --lc: var(--c-O); }
.mini.now { background: var(--lc); color: #fff; }
.mini.now[data-l="O"] { color: #141a2b; }

/* ---------- board ---------- */
.board-wrap { padding: .9rem; min-width: 0; display: flex; flex-direction: column; gap: .6rem; }
.board { display: grid; gap: .25rem; container-type: inline-size; }
.board[data-mode="75"] { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.board[data-mode="90"] { grid-template-columns: repeat(10, minmax(0, 1fr)); width: 100%; max-width: 38rem; margin-inline: auto; }
.head {
    display: grid; place-items: center; font-weight: 800; color: var(--c-B); font-size: 1rem;
    grid-row: 1; grid-column: calc(var(--li) + 1);
}
.head[data-l="I"] { color: var(--c-I); } .head[data-l="N"] { color: var(--c-N); } .head[data-l="G"] { color: var(--c-G); } .head[data-l="O"] { color: var(--c-O); }
.cell {
    --lc: var(--accent);
    display: grid; place-items: center; padding: 0; border: 2px solid transparent; border-radius: .45rem;
    background: var(--cell); color: var(--cell-text); font-weight: 600; font-variant-numeric: tabular-nums;
    transition: background .15s, color .15s;
}
.board[data-mode="75"] .cell { height: 2.3rem; grid-row: calc(var(--pi) + 2); grid-column: calc(var(--li) + 1); font-size: 1rem; }
.board[data-mode="90"] .cell { aspect-ratio: 1; grid-row: calc(var(--r) + 1); grid-column: calc(var(--c) + 1); font-size: clamp(.8rem, 4.2cqw, 2.4rem); }
.cell[data-l="B"] { --lc: var(--c-B); } .cell[data-l="I"] { --lc: var(--c-I); } .cell[data-l="N"] { --lc: var(--c-N); }
.cell[data-l="G"] { --lc: var(--c-G); } .cell[data-l="O"] { --lc: var(--c-O); }
.cell.on { background: var(--lc); color: #fff; }
.cell.on[data-l="O"] { color: #141a2b; }
.cell.last { border-color: var(--text); }
.cell.check { outline: 3px solid var(--text); outline-offset: 1px; }
.verify { margin: 0; min-height: 1.5rem; text-align: center; font-size: .9rem; color: var(--muted); }
.verify[data-state="yes"] { color: var(--ok); font-weight: 600; }
.verify[data-state="no"] { color: var(--no); font-weight: 600; }

/* wide screens: the 75-ball board becomes B-I-N-G-O rows of 15 */
@media (min-width: 640px) {
    .board[data-mode="75"] { grid-template-columns: 1.6rem repeat(15, minmax(0, 1fr)); }
    .board[data-mode="75"] .head { grid-row: calc(var(--li) + 1); grid-column: 1; }
    .board[data-mode="75"] .cell { height: auto; aspect-ratio: 1; grid-row: calc(var(--li) + 1); grid-column: calc(var(--pi) + 2); font-size: clamp(.7rem, 2.9cqw, 2rem); }
}

/* ---------- controls ---------- */
.controls { display: flex; flex-wrap: wrap; gap: .6rem 1.25rem; align-items: center; justify-content: center; padding: .85rem 1rem; }
.group { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.group select {
    min-height: 2.5rem; padding: 0 .6rem; background: var(--surface); border: 1px solid var(--border); border-radius: .7rem;
}
.seg { display: inline-flex; }
.seg .btn { border-radius: 0; }
.seg .btn:first-child { border-radius: .7rem 0 0 .7rem; }
.seg .btn:last-child { border-radius: 0 .7rem .7rem 0; margin-left: -1px; }
.auto-bar { height: 4px; width: 100%; background: var(--cell); border-radius: 2px; overflow: hidden; }
.auto-bar::after { content: ""; display: block; height: 100%; width: calc(var(--p, 0) * 100%); background: var(--accent); }
.voice-note { flex-basis: 100%; margin: 0; text-align: center; font-size: .8rem; color: var(--no); }

dialog { border: 1px solid var(--border); border-radius: 1rem; background: var(--surface); color: var(--text); padding: 1.4rem; max-width: 24rem; box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(8, 12, 24, .55); }
dialog h2 { margin: 0 0 .4rem; font-size: 1.15rem; }
dialog p { margin: 0 0 1.1rem; color: var(--muted); }
.dialog-actions { display: flex; gap: .5rem; justify-content: flex-end; }
.btn-danger { background: var(--no); border-color: var(--no); color: #fff; }
:root[data-theme="dark"] .btn-danger { color: #0d111c; }

/* Donate: a solid, warm button so it stands out from the blue controls. */
.donate { display: inline-flex; align-items: center; gap: .5rem; padding: .6rem 1.4rem; background: var(--donate); color: var(--donate-text) !important; border-radius: 999px; font-size: 1rem; font-weight: 700; text-decoration: none !important; box-shadow: 0 4px 14px color-mix(in srgb, var(--donate) 40%, transparent); transition: transform .15s, filter .15s; }
.donate:hover { filter: brightness(1.08); transform: translateY(-1px); }
.donate > span:first-child { display: inline-block; animation: beat 2.4s ease-in-out infinite; }
@keyframes beat { 0%, 70%, 100% { transform: scale(1); } 80% { transform: scale(1.3); } 90% { transform: scale(1.1); } }
@media (prefers-reduced-motion: reduce) { .donate > span:first-child { animation: none; } }
.donate-row { margin: 0 0 1.1rem; }
.donate-nudge .donate { padding: .35rem .95rem; font-size: .9rem; }
.donate-nudge { margin: 0; max-width: 22rem; text-align: center; font-size: .85rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: .4rem .6rem; align-items: center; justify-content: center; }
.link-btn { background: none; border: 0; padding: 0; color: var(--muted); font-size: .8rem; text-decoration: underline; }
.ad { margin: 1rem auto; max-width: 48rem; min-height: 90px; }

/* ---------- text pages ---------- */
.prose { max-width: 46rem; margin: 1rem auto 2rem; }
.prose h1 { font-size: 1.9rem; line-height: 1.2; margin: 0 0 1rem; letter-spacing: -.02em; }
.prose h2 { font-size: 1.2rem; margin: 1.8rem 0 .4rem; }
.prose p, .prose li { color: var(--text); }
.prose .updated { color: var(--muted); font-size: .85rem; }
/* Content card: used by how-to-use, About, Privacy and Contact */
.card, .prose { background: var(--surface); border: 1px solid var(--border); border-radius: 1rem; box-shadow: var(--shadow); padding: 1.25rem 1.5rem; }
/* How-to-use: a pill that unfolds a card (grid-rows trick animates to the content height) */
.help { max-width: 36rem; margin: 1.25rem auto 1rem; text-align: center; }
.help-toggle { display: inline-flex; align-items: center; gap: .5rem; padding: .45rem .9rem .45rem .5rem; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; box-shadow: var(--shadow); font-weight: 600; font-size: .92rem; }
.help-toggle:hover { border-color: var(--accent); }
.help-icon { display: grid; place-items: center; width: 1.5rem; height: 1.5rem; border-radius: 50%; background: var(--accent); color: var(--accent-text); font-size: .85rem; font-weight: 800; }
.help-chevron { transition: transform .25s; }
.help-toggle[aria-expanded="true"] .help-chevron { transform: rotate(180deg); }
.help-panel { display: grid; grid-template-rows: 0fr; visibility: hidden; transition: grid-template-rows .3s ease, visibility .3s; }
.help-panel.open { grid-template-rows: 1fr; visibility: visible; }
.help-clip { overflow: hidden; min-height: 0; }
.howto { margin-top: .75rem; text-align: left; }
.howto ol { margin: 0; padding-left: 1.3rem; }
@media (prefers-reduced-motion: reduce) { .help-panel, .help-chevron { transition: none; } }
.more { margin-top: .75rem; }
.more summary { cursor: pointer; width: fit-content; color: var(--accent); font-size: .9rem; font-weight: 600; list-style: none; }
.more summary::before { content: "+ "; }
.more[open] summary::before { content: "\2212  "; }
.more summary::-webkit-details-marker { display: none; }
.more-body h2 { font-size: 1.05rem; margin: 1rem 0 .3rem; }
.more-body p { margin: .3rem 0; color: var(--muted); }

/* ---------- desktop layout ---------- */
@media (min-width: 900px) {
    .app { grid-template-columns: 21rem minmax(0, 1fr); align-items: start; }
    .controls { grid-column: 1 / -1; }
    .ball { width: 16rem; }
}

/* ---------- projector mode ---------- */
.proj-bar { display: none; }
body.projector { background: var(--bg); height: 100vh; overflow: hidden; }
body.projector .donate-nudge, body.projector .toolbar, body.projector .site-footer, body.projector .hero, body.projector .help, body.projector .more, body.projector .bg, body.projector .ad,
body.projector .controls, body.projector .hint, body.projector .stage > .btn-primary, body.projector #voice-note { display: none !important; }
body.projector main { max-width: none; height: 100vh; padding: 1.5vmin; }
body.projector .app { height: 100%; grid-template-columns: minmax(0, 36vw) minmax(0, 1fr); align-items: stretch; padding: 0; gap: 1.5vmin; }
body.projector .stage { justify-content: center; gap: 2.5vh; }
body.projector .ball { width: min(32vw, 52vh); }
body.projector .ball-letter { font-size: min(5.5vw, 9vh); }
body.projector .ball-number { font-size: min(14vw, 24vh); }
body.projector .progress { font-size: clamp(1rem, 2vh, 1.6rem); }
body.projector .mini { min-width: 5vh; height: 5vh; font-size: 2.4vh; }
body.projector .recent { min-height: 5vh; }
body.projector .recent-wrap h2 { font-size: 1.6vh; }
body.projector .board-wrap { justify-content: center; padding: 1.5vmin; }
body.projector .board[data-mode="75"] { grid-template-columns: 4vw repeat(15, minmax(0, 1fr)); }
body.projector .board[data-mode="75"] .head { font-size: 3vw; }
body.projector .board[data-mode="75"] .cell { height: auto; aspect-ratio: 1; grid-row: calc(var(--li) + 1); grid-column: calc(var(--pi) + 2); font-size: clamp(.8rem, 2.7cqw, 4rem); }
body.projector .board[data-mode="75"] .head { grid-row: calc(var(--li) + 1); grid-column: 1; }
body.projector .verify { font-size: clamp(.9rem, 2.2vh, 1.6rem); }
body.projector .proj-bar .btn { white-space: nowrap; min-height: 2.25rem; padding: .3rem .8rem; }
body.projector .proj-bar {
    display: flex; gap: .5rem; position: fixed; left: 50%; bottom: 1.2rem; transform: translateX(-50%);
    padding: .5rem; background: var(--surface); border: 1px solid var(--border); border-radius: 1rem; box-shadow: var(--shadow);
    transition: opacity .4s;
}
body.projector.idle .proj-bar { opacity: 0; pointer-events: none; }
body.projector.idle { cursor: none; }

@media (max-width: 899px) and (orientation: portrait) {
    body.projector .app { grid-template-columns: 1fr; grid-template-rows: auto 1fr; overflow: auto; }
    body.projector { overflow: auto; }
    body.projector .ball { width: min(48vw, 30vh); }
    body.projector .board[data-mode="75"] { grid-template-columns: repeat(5, minmax(0, 1fr)); }
    body.projector .board[data-mode="75"] .head { grid-row: 1; grid-column: calc(var(--li) + 1); font-size: 1.1rem; }
    body.projector .board[data-mode="75"] .cell { aspect-ratio: auto; height: 2.1rem; grid-row: calc(var(--pi) + 2); grid-column: calc(var(--li) + 1); font-size: 1rem; }
}

a.btn { text-decoration: none; color: var(--text); }
a.btn-primary { color: var(--accent-text); }
.prose .btn { margin-top: .5rem; }

/* ---------- SEO guide pages ---------- */
.hero h1 .brand-words { display: block; }
.hero h1 .subtitle { display: block; margin-top: .25rem; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 1.05rem; font-weight: 400; letter-spacing: 0; color: var(--muted); }
.hero .intro { max-width: 36rem; margin: .75rem auto 0; font-size: .95rem; color: var(--muted); }
.guide { max-width: 46rem; margin: 1.25rem auto; }
.crumbs { margin: 0 0 .75rem; font-size: .85rem; color: var(--muted); }
.crumbs a { color: var(--muted); }
.guide h2 { font-size: 1.1rem; margin: 1.4rem 0 .35rem; }
.guide ul, .guide ol { padding-left: 1.3rem; }
.guide li { margin: .2rem 0; }
.calls-list { columns: 3 13rem; column-gap: 1.5rem; list-style: none; padding: 0 !important; margin: 1rem 0; }
.calls-list li { break-inside: avoid; margin: .15rem 0; }
.calls-list b { display: inline-block; min-width: 2rem; color: var(--accent); }
.guide-links { margin: 0 0 .6rem; font-size: .85rem; }
.guide-links a { color: var(--muted); }
