/* Heads or Tails · Four Suits — the parts of the board that are not Bingo's
   (content/flip-board.js). The setup card, the full-screen stage, the buttons,
   the modal and the pills come from content/bingo-board.css (#flipApp shares its
   variables); this file adds the coin, the card, the corners
   and the history column. Suit colours only help from the back of the room: the
   symbol always carries the meaning. */

#flipApp {
    --fl-s: #9A33FF; --fl-h: #F0525A; --fl-d: #EBC900; --fl-c: #5FB5A4;
    --fl-ink: #1F1438;
}

/* ── Setup ─────────────────────────────────────────────────────────────── */
.fl-setup { display: grid; gap: 4px; max-width: 640px; margin: 0 auto; }
.fl-setup > .bg-row { margin: 8px 0 2px; }
.fl-setup .bg-names { margin: 6px 0 8px; }
.fl-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 18px 0 4px; align-items: start; }
.fl-actions .bgh-main:disabled { opacity: .45; cursor: default; filter: none; }
.fl-actions a.bgh-quiet { align-self: stretch; display: flex; align-items: center; justify-content: center; }
.fl-setup > .bg-resume { margin: 10px 0 0; }
/* ── Stage ─────────────────────────────────────────────────────────────── */
.fl-stage { grid-template-rows: auto minmax(0, 1fr); }
.fl-counter { font-size: 1.1rem; color: var(--bg-ink-2); letter-spacing: 0; }
.fl-banner {
    position: absolute; top: 74px; left: 50%; transform: translateX(-50%); z-index: 5; white-space: nowrap; padding: 8px 20px; border-radius: 14px; font: 800 clamp(1rem, 2.2vh, 1.5rem)/1.2 var(--bg-font-display);
    background: rgba(251,191,36,.16); border: 2px solid rgba(251,191,36,.6); color: var(--bg-gold);
}
.fl-banner[hidden] { display: none; }
.fl-toast {
    position: absolute; left: 50%; bottom: 4vh; transform: translateX(-50%); z-index: 20;
    padding: 10px 20px; border-radius: 14px; background: rgba(16,8,34,.92); border: 1px solid rgba(255,255,255,.25);
    font: 800 1.05rem/1.2 var(--bg-font-body); color: #fff;
}
.fl-toast[hidden] { display: none; }
.bgs-btn[aria-pressed="true"] { background: var(--bg-purple); border-color: transparent; }

.fl-mid { grid-template-columns: minmax(0, 1fr) clamp(150px, 16vw, 230px); min-height: 0; }
.fl-main { display: grid; align-content: center; justify-items: center; gap: 1.6vh; min-height: 0; min-width: 0; }
.fl-hero { display: grid; place-items: center; min-height: 0; perspective: 1400px; }

/* The coin: gold face, darker rim, Bingo's ball highlight. Heads shows a face, Tails a curled tail. */
/* The shadow sits on the wrapper: a filter on a preserve-3d element flattens it and the tails face never shows. */
.fl-coin-wrap { --d: min(31vh, 38vw, 420px); width: var(--d); height: var(--d); perspective: 1400px; filter: drop-shadow(0 1.2vh 1.6vh rgba(0,0,0,.4)); }
.fl-coin { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; }
.fl-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.fl-face svg { width: 100%; height: 100%; display: block; }
.fl-face--t { transform: rotateY(180deg); }

/* The card: white face, radius 6% of its width; Hearts and Diamonds printed red. */
.fl-card-wrap { --w: min(22vh, 24vw, 300px); width: var(--w); height: calc(var(--w) * 1.4); perspective: 1400px; filter: drop-shadow(0 1.2vh 1.6vh rgba(0,0,0,.4)); }
.fl-card { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; }
.fl-cface {
    position: absolute; inset: 0; border-radius: 6%; backface-visibility: hidden; -webkit-backface-visibility: hidden;
    container-type: inline-size; overflow: hidden;
}
.fl-cface--front { background: #fff; color: var(--fl-ink); }
.fl-cface--front.is-red { color: #D32F3A; }
.fl-cface--back {
    transform: rotateY(180deg); display: grid; place-items: center;
    background: repeating-linear-gradient(45deg, #5B2BD0 0 8px, #6A3BE0 8px 16px); border: 6px solid #fff;
}
.fl-c-backmark { font-size: 15cqw; color: rgba(255,255,255,.55); letter-spacing: .1em; }
.fl-c-corner { position: absolute; display: grid; justify-items: center; font: 800 18cqw/1 var(--bg-font-display); }
.fl-c-corner span:last-child { font-size: 15cqw; }
.fl-c-tl { top: 5%; left: 7%; }
.fl-c-br { bottom: 5%; right: 7%; transform: rotate(180deg); }
.fl-c-pip { position: absolute; inset: 0; display: grid; place-items: center; font-size: 64cqw; line-height: 1; }

/* What the board says */
.fl-result { display: grid; justify-items: center; gap: .6vh; text-align: center; min-height: 25vh; align-content: start; width: 100%; }
.fl-big { font: 800 clamp(2.6rem, 8vh, 7rem)/1.05 var(--bg-font-display); color: var(--bg-gold); text-shadow: 0 .05em 0 rgba(0,0,0,.3); max-width: 100%; overflow: hidden; white-space: nowrap; }
.fl-big.is-green { color: var(--bg-green); }
.fl-sub { font: 800 clamp(1.3rem, 3.4vh, 2.4rem)/1.15 var(--bg-font-display); color: var(--bg-red); }
.fl-sub--calm { color: var(--bg-ink-2); }
.fl-corner { font: 800 clamp(1rem, 2.4vh, 1.6rem)/1.2 var(--bg-font-body); color: var(--bg-ink-2); }
.fl-lock-h { font: 800 clamp(1.2rem, 3vh, 2rem)/1.1 var(--bg-font-display); color: var(--bg-ink-2); text-transform: uppercase; letter-spacing: .12em; }
.fl-count { font: 800 clamp(3.5rem, 12vh, 9rem)/1 var(--bg-font-display); color: var(--bg-gold); animation: fl-tick 1s ease-out; }
.fl-count.is-freeze { color: #9FD8FF; }
.fl-flipper { font: 700 clamp(1rem, 2.6vh, 1.7rem)/1.2 var(--bg-font-body); color: var(--bg-ink-2); text-align: center; }
.fl-flipper-name { font: 800 1.25em/1 var(--bg-font-display); color: var(--bg-green); }
@keyframes fl-tick { 0% { transform: scale(1.5); opacity: 0; } 30% { opacity: 1; } 100% { transform: scale(1); } }

.fl-controls { display: grid; justify-items: center; gap: 1vh; width: 100%; }
.fl-void {
    appearance: none; border: 0; background: none; cursor: pointer; padding: 6px 10px;
    color: var(--bg-ink-2); font: 800 1rem/1.2 var(--bg-font-body); text-decoration: underline;
}
.fl-void:hover { color: #fff; }
.fl-void:focus-visible { outline: 3px solid var(--bg-gold); outline-offset: 2px; }
.fl-hint { font-size: .85rem; color: var(--bg-ink-3); }
.fl-win { padding: 14px 26px; font-size: clamp(1rem, 2vw, 1.3rem); }
.bgs-next:focus-visible, .bgs-check:focus-visible { outline: 3px solid var(--bg-gold); outline-offset: 3px; }

/* Cover: both gestures, before the first flip */
.fl-cover { display: grid; grid-template-columns: 1fr 1fr; gap: 3vw; width: min(100%, 900px); }
.fl-cover-side { display: grid; justify-items: center; gap: .6vh; padding: 2.4vh 1.5vw; border-radius: 22px; background: rgba(16,8,34,.45); border: 2px solid rgba(255,255,255,.14); }
.fl-cover-side.is-h { color: var(--bg-gold); }
.fl-cover-side.is-t { color: #C9B6FF; }
.fl-gesture { width: clamp(70px, 14vh, 150px); }
.fl-gesture svg { width: 100%; display: block; }
.fl-gesture--sm { width: clamp(30px, 5vh, 52px); }
.fl-cover-word { font: 800 clamp(2rem, 6vh, 4rem)/1 var(--bg-font-display); }
.fl-cover-text { font: 800 clamp(1.1rem, 2.8vh, 2rem)/1.1 var(--bg-font-body); color: var(--bg-ink-2); }

/* Four corners, as a reminder before a draw */
.fl-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 1.2vw; }
.fl-chip {
    display: flex; align-items: center; gap: .6em; padding: .5em 1em; border-radius: 14px;
    background: rgba(16,8,34,.45); border: 2px solid var(--sc); font: 800 clamp(1rem, 2.4vh, 1.5rem)/1 var(--bg-font-display);
}
.fl-chip-sym { color: var(--sc); font-size: 1.3em; }
.fl-chip-n { color: var(--bg-ink-2); font-weight: 700; font-family: var(--bg-font-body); font-size: .8em; }

/* History strip, newest first */
.fl-hist { display: flex; flex-wrap: wrap; gap: 8px; }
.fl-mark {
    width: clamp(34px, 4.4vh, 46px); height: clamp(34px, 4.4vh, 46px); border-radius: 50%; display: grid; place-items: center;
    font: 800 1rem/1 var(--bg-font-display); color: #fff; background: rgba(255,255,255,.14);
}
.fl-mark--H { background: var(--bg-gold); color: var(--fl-ink); }
.fl-mark--T { background: #5B4A8C; }
.fl-mark--s { background: var(--sc); font-size: 1.3rem; }
.fl-mark--s[style*="#EBC900"] { color: var(--fl-ink); }
.fl-mark.is-void { opacity: .45; background: transparent; border: 2px dashed rgba(255,255,255,.5); color: rgba(255,255,255,.7); text-decoration: line-through; }

/* End of a game */
.fl-over { display: grid; justify-items: center; gap: 2vh; text-align: center; }

@media (max-width: 760px) {
    .fl-mid { grid-template-columns: 1fr; }
        .fl-cover { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
    .fl-count, .fl-win-msg { animation: none; }
}
@media print { #flipApp { display: none; } }

/* Top bar: every button the same height, the icon buttons square, so the row lines up. */
.fl-stage .bgs-top { align-items: center; }
.fl-stage .bgs-acts { align-items: center; }
.fl-stage .bgs-acts .bgs-btn { height: 44px; display: inline-flex; align-items: center; justify-content: center; padding: 0 16px; box-sizing: border-box; line-height: 1; }
.fl-stage .bgs-acts .fl-ibtn { width: 44px; padding: 0; }
.fl-ibtn svg { width: 22px; height: 22px; display: block; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.fl-snd svg path:first-child { fill: currentColor; stroke-width: 1.6; }
.fl-snd .fl-ic-off { display: none; }
.fl-snd.is-off .fl-ic-on { display: none; }
.fl-snd.is-off .fl-ic-off { display: block; }
.fl-snd.is-off { color: var(--bg-ink-3); }
.fl-fs .fl-fs-exit, .fl-fs.is-full .fl-fs-enter { display: none; }
.fl-fs.is-full .fl-fs-exit { display: block; }
.bgs-btn[aria-pressed="true"].fl-ibtn { background: rgba(16,8,34,.5); }

/* Winner: fireworks over the whole stage, never in the way of a click. */
.fl-fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 15; }
.fl-win-msg { font-size: clamp(2.6rem, 9vh, 6rem); animation: fl-pop .7s cubic-bezier(.2,1.4,.4,1) both; }
@keyframes fl-pop { 0% { transform: scale(.4); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

/* The newest mark flies in from the coin or card, so the column must not clip it. */
.fl-side { overflow: visible; }
