/* ===================================================================
   call-numbers.css  —  Casino / game-show theme for the BINGO caller
   Scoped to call-numbers.html only. Loaded LAST so it overrides
   Bootstrap + the shared bingo-cards.css for this page.
   No JS hooks are renamed — this is a re-skin only.
   ------------------------------------------------------------------
   Phase 1 — foundation: design tokens, felt table, header/nav,
   typography, buttons, base panels. (Hero ball + pattern board and
   the B-I-N-G-O flashboard arrive in later phases.)
   =================================================================== */

:root {
    /* felt table */
    --bingo-felt-top:    #0c4a37;
    --bingo-felt-bottom: #062318;
    --bingo-felt-panel:  #06281d;
    --bingo-felt-card:   #072c20;
    --bingo-header:      #06251b;
    --bingo-line:        #11402f;
    --bingo-line-2:      #1c5a43;

    /* gold trim */
    --bingo-gold:     #f4cf5a;
    --bingo-gold-rim: #c9a83a;
    --bingo-gold-1:   #f9d976;
    --bingo-gold-2:   #d99e1c;
    --bingo-gold-ink: #5a3d05;

    /* call ball (red) */
    --bingo-ball-1: #ff9094;
    --bingo-ball-2: #e3122e;
    --bingo-ball-3: #9e0b1e;

    /* ink */
    --bingo-cream: #e8dcc0;
    --bingo-muted: #9bb3a6;

    /* B-I-N-G-O column colors */
    --bingo-b: #2563eb;
    --bingo-i: #dc2626;
    --bingo-n: #d99e1c;
    --bingo-g: #16a34a;
    --bingo-o: #7e22ce;

    /* shape */
    --bingo-radius:    18px;
    --bingo-radius-sm: 12px;
    --bingo-pill:      999px;
    --bingo-font: 'Montserrat', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

/* ── Page / felt table ───────────────────────────────────────────── */
html, body { background: var(--bingo-felt-bottom); }

body {
    font-family: var(--bingo-font);
    color: var(--bingo-cream);
    background: linear-gradient(180deg, var(--bingo-felt-top), var(--bingo-felt-bottom)) no-repeat;
    background-attachment: fixed;
    min-height: 100vh;
}

.bingo-caller-section {
    background: transparent;
    min-height: auto;
}

/* ── Header / nav ────────────────────────────────────────────────── */
.header-bingo {
    background: var(--bingo-header);
    border-bottom: 2px solid var(--bingo-gold-rim);
}

.header-bingo .navbar-brand,
.header-bingo .navbar-brand.text-primary {
    color: var(--bingo-gold);
    font-weight: 700;
    letter-spacing: 2px;
}

.header-bingo hr { border-color: var(--bingo-line-2); opacity: .45; }

.header-bingo .nav-link {
    color: var(--bingo-cream);
    letter-spacing: 1px;
    transition: color .2s ease;
}

.header-bingo .nav-link:hover,
.header-bingo .nav-link:focus,
.header-bingo .nav-link.active {
    color: var(--bingo-gold);
}

.header-bingo .navbar-toggler { border-color: var(--bingo-gold-rim); }

.header-bingo .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='%23f4cf5a' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

.header-bingo .btn-outline-primary {
    color: var(--bingo-gold);
    border-color: transparent;
}
.header-bingo .btn-outline-primary:hover { color: var(--bingo-gold-1); background: transparent; }

.header-bingo .dropdown-menu {
    background: var(--bingo-felt-card);
    border: 1px solid var(--bingo-line-2);
}
.header-bingo .dropdown-item { color: var(--bingo-cream); letter-spacing: .5px; }
.header-bingo .dropdown-item:hover,
.header-bingo .dropdown-item:focus {
    background: var(--bingo-gold);
    color: var(--bingo-gold-ink);
}

.header-bingo .text-muted { color: var(--bingo-muted) !important; }

.btn-logout,
.header-bingo .btn-logout {
    background: transparent;
    color: var(--bingo-gold);
    border: 1.5px solid var(--bingo-gold-rim);
    border-radius: var(--bingo-pill);
}
.btn-logout:hover { background: var(--bingo-gold); color: var(--bingo-gold-ink); }

/* marquee bulb strip (sits just under the header) */
.bingo-bulbs {
    height: 13px;
    background-image: radial-gradient(circle at center, #ffd86b 0 3px, #7a5a12 3px 4px, transparent 4px);
    background-size: 22px 13px;
    background-repeat: repeat-x;
}

/* ── Typography ──────────────────────────────────────────────────── */
.bingo-caller-section h1.display-4 {
    color: var(--bingo-gold);
    font-weight: 800;
    letter-spacing: 4px;
    text-transform: uppercase;
    text-shadow: 0 2px 0 rgba(0, 0, 0, .35);
}

/* ── Panels / cards ──────────────────────────────────────────────── */
.bingo-caller-section .card {
    background: var(--bingo-felt-panel);
    border: 1px solid var(--bingo-line);
    border-radius: var(--bingo-radius);
    color: var(--bingo-cream);
}

.bingo-caller-section .card-title {
    color: var(--bingo-gold);
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: .95rem;
}

/* ── Current call (interim circular ball — refined in Phase 2) ────── */
.current-call {
    width: 96%;
    max-width: 460px;
    aspect-ratio: 1;
    margin: 0 auto;
    padding: 0;
    border-radius: 50%;
    border: 6px solid var(--bingo-gold);                       /* fallback for engines without clamp() */
    border: clamp(4px, 1.5vw, 8px) solid var(--bingo-gold);
    background: radial-gradient(circle at 38% 30%, var(--bingo-ball-1), var(--bingo-ball-2) 56%, var(--bingo-ball-3));
    box-shadow: 0 0 52px rgba(227, 18, 46, .5),
                inset 0 12px 24px rgba(255, 255, 255, .3),
                inset 0 -18px 28px rgba(120, 0, 15, .55);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #fff;
    container-type: inline-size;
    overflow: hidden;
}

/* reset the teal chip styling bleeding in from bingo-cards.css */
.current-call .bingo-letter,
.current-call .bingo-number {
    background: transparent;
    padding: 0;
    border-radius: 0;
    color: #fff;
    width: auto;
}

.current-call .bingo-letter {
    font-size: clamp(18px, 20cqi, 84px);
    line-height: .9;
    letter-spacing: 3px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, .4);
}

.current-call .bingo-number {
    font-size: clamp(48px, 66cqi, 260px);
    line-height: .82;
    letter-spacing: -2px;
    text-shadow: 0 4px 8px rgba(0, 0, 0, .45);
}

/* ── Called-numbers history — fixed B-I-N-G-O flashboard ─────────── */
.card-history { background: var(--bingo-felt-panel); }

.bingo-history-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}
.bingo-fb-legend {
    display: flex;
    gap: 12px;
    color: var(--bingo-muted);
    font-size: .66rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}
.bingo-fb-legend i {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    display: inline-block;
    vertical-align: -1px;
    margin-right: 5px;
}
.bingo-fb-legend .dot-called  { background: var(--bingo-g); }
.bingo-fb-legend .dot-dim     { background: var(--bingo-felt-bottom); border: 1px solid var(--bingo-line); }
.bingo-fb-legend .dot-current { background: var(--bingo-gold); }

.bingo-flashboard {
    display: grid;
    grid-template-columns: repeat(16, minmax(0, 1fr));
    gap: 5px;
    padding: 4px;
}
.bingo-flashboard.is-90 {
    grid-template-columns: repeat(10, minmax(0, 1fr));
}

.bingo-fb-letter {
    aspect-ratio: 1;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 800;
    border: 2px solid var(--bingo-gold);
    container-type: inline-size;
}
.bingo-fb-letter span { font-size: 56cqi; }
.bingo-fb-letter.col-b { background: var(--bingo-b); }
.bingo-fb-letter.col-i { background: var(--bingo-i); }
.bingo-fb-letter.col-n { background: var(--bingo-n); color: #3a2705; }
.bingo-fb-letter.col-g { background: var(--bingo-g); }
.bingo-fb-letter.col-o { background: var(--bingo-o); }

.bingo-fb-cell {
    aspect-ratio: 1;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bingo-felt-bottom);
    border: 1px solid var(--bingo-line);
    container-type: inline-size;
}
.bingo-fb-cell span {
    font-size: clamp(10px, 60cqi, 40px);
    font-weight: 800;
    line-height: 1;
    color: rgba(244, 207, 90, .26);
}
.bingo-fb-cell.is-called { background: var(--bingo-g); border-color: rgba(255, 255, 255, .2); }
.bingo-fb-cell.is-called span { color: #fff; }
.bingo-fb-cell.is-called.col-b { background: var(--bingo-b); }
.bingo-fb-cell.is-called.col-i { background: var(--bingo-i); }
.bingo-fb-cell.is-called.col-n { background: var(--bingo-n); }
.bingo-fb-cell.is-called.col-g { background: var(--bingo-g); }
.bingo-fb-cell.is-called.col-o { background: var(--bingo-o); }
.bingo-fb-cell.is-called.col-n span { color: #3a2705; }
.bingo-fb-cell.is-current {
    background: linear-gradient(180deg, var(--bingo-gold-1), var(--bingo-gold-2));
    border: 1px solid #fff;
    box-shadow: 0 0 12px rgba(244, 198, 61, .75);
}
.bingo-fb-cell.is-current span { color: var(--bingo-gold-ink); }

/* ── Stats ───────────────────────────────────────────────────────── */
.bingo-caller-section .text-muted { color: var(--bingo-muted) !important; }

.bingo-caller-section .display-6 {
    color: var(--bingo-gold);
    font-weight: 800;
}

/* ── Buttons ─────────────────────────────────────────────────────── */
.bingo-caller-section .btn-primary {
    background: linear-gradient(180deg, var(--bingo-gold-1), var(--bingo-gold-2));
    border: none;
    color: var(--bingo-gold-ink);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-radius: var(--bingo-radius-sm);
    box-shadow: 0 4px 0 #8a6410;
    padding: 14px 34px;
    transition: filter .15s ease;
}
.bingo-caller-section .btn-primary:hover { filter: brightness(1.06); color: var(--bingo-gold-ink); transform: none; }
.bingo-caller-section .btn-primary:disabled { opacity: .45; box-shadow: none; }

.bingo-caller-section .btn-secondary {
    background: transparent;
    color: var(--bingo-gold);
    border: 2px solid var(--bingo-gold-rim);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-radius: var(--bingo-radius-sm);
    padding: 14px 28px;
}
.bingo-caller-section .btn-secondary:hover { background: var(--bingo-gold); color: var(--bingo-gold-ink); }

/* ===================================================================
   Phase 2 — Hero: call ball (maxed in circle) + winning-pattern board
   =================================================================== */
.bingo-sub {
    color: var(--bingo-muted);
    font-size: .78rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    margin-top: .4rem;
}

.bingo-hero {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: start;
}
@media (max-width: 768px) {
    .bingo-hero { grid-template-columns: 1fr; }
}

.bingo-cap {
    color: var(--bingo-muted);
    font-size: .7rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    text-align: center;
    margin-bottom: .45rem;
}

.bingo-call-card {
    aspect-ratio: 1;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bingo-felt-card);
    border: 3px solid var(--bingo-gold-rim);
    border-radius: var(--bingo-radius);
    padding: 12px;
    box-shadow: 0 0 0 5px var(--bingo-header), 0 0 42px rgba(244, 198, 61, .18);
}

/* ── Winning-pattern board ───────────────────────────────────────── */
.bingo-pattern-card {
    width: 100%;
    max-width: 460px;
    margin: 0 auto;
    background: var(--bingo-felt-panel);
    border: 2px solid var(--bingo-line-2);
    border-radius: var(--bingo-radius);
    padding: 16px;
    display: flex;
    flex-direction: column;
}

.bingo-pattern-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.bingo-pattern-title {
    color: var(--bingo-gold);
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: .8rem;
    font-weight: 700;
    margin: 0;
}
.bingo-pattern-name { color: var(--bingo-cream); font-size: .8rem; }
.bingo-pattern-name b { color: var(--bingo-gold); }

.bingo-pattern-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    justify-content: center;
    margin-bottom: 14px;
}
.bingo-preset {
    background: transparent;
    color: var(--bingo-gold);
    border: 1.5px solid var(--bingo-gold-rim);
    border-radius: var(--bingo-pill);
    font-family: inherit;
    font-weight: 700;
    font-size: .68rem;
    letter-spacing: .5px;
    padding: 6px 13px;
    text-transform: uppercase;
    cursor: pointer;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.bingo-preset:hover { border-color: var(--bingo-gold); }
.bingo-preset.on {
    background: linear-gradient(180deg, var(--bingo-gold-1), var(--bingo-gold-2));
    color: var(--bingo-gold-ink);
    border-color: #fff;
}
.bingo-preset.clear { color: #f1a3a3; border-color: #7a2c2c; }
.bingo-preset.clear:hover { border-color: #c45c5c; }

.bingo-pattern-letters,
.bingo-pattern-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 7px;
    max-width: 250px;
    width: 100%;
    margin: 0 auto;
}
.bingo-pattern-letters { margin-bottom: 7px; }

.bingo-pat-letter {
    aspect-ratio: 1;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 800;
    border: 2px solid var(--bingo-gold);
    container-type: inline-size;
}
.bingo-pat-letter span { font-size: 56cqi; }

.bingo-pat-cell {
    aspect-ratio: 1;
    border-radius: 8px;
    background: var(--bingo-felt-bottom);
    border: 1px solid var(--bingo-line-2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(244, 207, 90, .35);
    font-size: .55rem;
    font-weight: 800;
    cursor: pointer;
    transition: border-color .15s ease;
}
.bingo-pat-cell:hover { border-color: var(--bingo-gold-rim); }
.bingo-pat-cell.on {
    background: linear-gradient(180deg, var(--bingo-gold-1), var(--bingo-gold-2));
    color: var(--bingo-gold-ink);
    border: 1px solid #fff;
    box-shadow: 0 0 11px rgba(244, 198, 61, .55);
}

/* ===================================================================
   Phase 4 — focus rings + responsive polish
   =================================================================== */
.bingo-preset:focus-visible,
.bingo-caller-section .btn-primary:focus-visible,
.bingo-caller-section .btn-secondary:focus-visible,
.header-bingo .nav-link:focus-visible,
.header-bingo .navbar-brand:focus-visible,
.header-bingo .dropdown-item:focus-visible,
.header-bingo .btn-logout:focus-visible {
    outline: 2px solid var(--bingo-gold);
    outline-offset: 2px;
}

/* tighten the flashboard on small phones so cells stay legible */
@media (max-width: 480px) {
    .bingo-flashboard { gap: 2px; padding: 2px; }
    .bingo-fb-legend { font-size: .58rem; gap: 8px; }
    .bingo-pattern-letters,
    .bingo-pattern-grid { max-width: 230px; }
}

/* ===================================================================
   Phase 5 — host-synced pattern: read-only state + hint
   =================================================================== */
.bingo-pattern-hint {
    color: var(--bingo-muted);
    font-size: .66rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    text-align: center;
    margin: 12px 0 0;
}
.bingo-preset:disabled { opacity: .4; cursor: not-allowed; }
.bingo-pattern-grid.is-readonly .bingo-pat-cell { cursor: default; }
.bingo-pattern-grid.is-readonly .bingo-pat-cell:hover { border-color: var(--bingo-line-2); }

/* ===================================================================
   Legacy fallbacks — mid-era smart-TV browsers (~2018–2021,
   Chromium ~60–90). They lack container-query units (cqi, Chrome 105)
   and aspect-ratio (Chrome 88), so the circular ball + square cells
   would otherwise collapse and the "maxed" numbers would shrink.
   CSS variables (Chrome 49) + grid (57) are assumed present for this
   range. These @supports-not blocks ONLY apply when the feature is
   missing — modern browsers keep the declarations above untouched.
   NOTE: this fixes VISUALS only. The board's JS (optional chaining in
   bingo-caller.js, Firebase v10) still needs ~Chromium 80+ to run.
   =================================================================== */

/* 1) Square sizing without aspect-ratio.
   The call card is width-capped and the boards live in capped
   containers, so fixed heights approximate squares well on a TV. */
@supports not (aspect-ratio: 1) {
    .bingo-call-card  { height: 400px; }
    .current-call     { height: 360px; }
    .bingo-fb-cell,
    .bingo-fb-letter  { height: 56px; }
    .bingo-pat-cell,
    .bingo-pat-letter { height: 46px; }

    @media (max-width: 991px) {
        .bingo-call-card { height: 340px; }
        .current-call    { height: 300px; }
        .bingo-fb-cell,
        .bingo-fb-letter { height: 38px; }
    }
    @media (max-width: 575px) {
        .bingo-call-card { height: 300px; }
        .current-call    { height: 270px; }
        .bingo-fb-cell,
        .bingo-fb-letter { height: 20px; }
        .bingo-pat-cell,
        .bingo-pat-letter { height: 34px; }
    }
}

/* 2) Fixed font sizes without container-query units (cqi / cqmin).
   No clamp() here either, so pre-2019 engines render these too. */
@supports not (font-size: 1cqi) {
    .current-call .bingo-number { font-size: 220px; }
    .current-call .bingo-letter { font-size: 52px; }
    .bingo-fb-cell span,
    .bingo-fb-letter span       { font-size: 30px; }
    .bingo-pat-letter span      { font-size: 24px; }

    @media (max-width: 991px) {
        .current-call .bingo-number { font-size: 130px; }
        .current-call .bingo-letter { font-size: 34px; }
        .bingo-fb-cell span,
        .bingo-fb-letter span       { font-size: 19px; }
    }
    @media (max-width: 575px) {
        .current-call .bingo-number { font-size: 96px; }
        .current-call .bingo-letter { font-size: 26px; }
        .bingo-fb-cell span,
        .bingo-fb-letter span       { font-size: 11px; }
        .bingo-pat-letter span      { font-size: 16px; }
    }
}

/* respect reduced motion for any themed animation added later */
@media (prefers-reduced-motion: reduce) {
    * { animation-duration: .001ms !important; animation-iteration-count: 1 !important; }
}
