/* Shared bingo engine styles (prefix .bn-). Uses the kit's dark screen tokens.
   Loaded by all four bingo demos from /demos/sports-bingo/bingo-core.css. */
.dk-screen.bn-screen { padding: 0; }
.bn-grid { display: grid; grid-template-columns: 304px minmax(0, 1fr) 316px; height: clamp(660px, calc(100vh - 100px), 800px); min-height: 0; }
.dk-stage:fullscreen .bn-grid { height: calc(100vh - 100px); }
body.dk-embed .bn-grid { height: max(660px, calc(100vh - 100px)); }

.bn-h { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--s-dim); margin-bottom: 10px; }
.bn-h-r { margin-left: auto; font: 500 11px 'IBM Plex Mono', monospace; letter-spacing: 0; text-transform: none; color: var(--s-faint); }

/* ---------- left: show panel and log ---------- */
.bn-left { border-right: 1px solid var(--s-line); display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.bn-show { padding: 16px 16px 14px; border-bottom: 1px solid var(--s-line); }
.bn-logwrap { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 14px 16px 0; }
.bn-logwrap[hidden] { display: none; }
.bn-log { list-style: none; flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: none; padding-bottom: 24px; -webkit-mask-image: linear-gradient(#000 80%, transparent); mask-image: linear-gradient(#000 80%, transparent); }
.bn-log::-webkit-scrollbar { display: none; }
.bn-li { display: grid; grid-template-columns: 50px minmax(0, 1fr); gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--s-line); font-size: 12.5px; line-height: 1.42; color: #c9ced9; animation: bnIn .4s cubic-bezier(.2,.9,.3,1); }
.bn-li-t { font: 600 10.5px 'IBM Plex Mono', monospace; color: var(--s-faint); padding-top: 2px; white-space: nowrap; }
.bn-li-sit { display: block; font: 500 10.5px 'IBM Plex Mono', monospace; color: var(--s-dim); margin-bottom: 1px; }
.bn-li-tag { display: inline-block; font: 700 9.5px 'IBM Plex Mono', monospace; letter-spacing: .06em; padding: 1px 5px; border-radius: 4px; margin-right: 6px; background: var(--tc, var(--s-panel2)); color: var(--tci, #fff); vertical-align: 1px; }
.bn-li b { color: var(--s-text); font-weight: 700; }
.bn-li.big { color: var(--s-text); }
.bn-li.big > div { box-shadow: inset 2px 0 0 var(--tc, var(--you)); padding-left: 9px; }
.bn-li.note { color: var(--s-dim); }
.bn-li.note > div { font-style: italic; }
.bn-li-mk { display: block; margin-top: 3px; font: 600 10.5px 'IBM Plex Mono', monospace; color: var(--you); }
@keyframes bnIn { from { opacity: 0; transform: translateY(-6px); } }

/* ---------- center: tabs, card, patterns ---------- */
.bn-center { position: relative; display: flex; flex-direction: column; gap: 12px; padding: 16px 20px; min-width: 0; min-height: 0; }
.bn-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.bn-tab { appearance: none; display: flex; align-items: center; gap: 10px; min-width: 0; background: var(--s-panel); border: 1px solid var(--s-line); border-radius: 10px; padding: 8px 10px; color: var(--s-text); cursor: pointer; text-align: left; font-family: inherit; transition: border-color .2s; }
.bn-tab:hover { border-color: #3d4352; }
.bn-tab.on { border-color: var(--you); box-shadow: inset 0 0 0 1px var(--you); }
.bn-tab.flash { animation: bnFlash 1.1s; }
@keyframes bnFlash { 30% { border-color: var(--you); background: color-mix(in srgb, var(--you) 14%, var(--s-panel)); } }
.bn-mini { display: grid; grid-template-columns: repeat(5, 5px); gap: 1.5px; flex: none; }
.bn-mini i { width: 5px; height: 5px; border-radius: 1px; background: var(--s-line); }
.bn-mini i.on { background: var(--you); }
.bn-tab-t { min-width: 0; flex: 1; }
.bn-tab-t b { display: block; font-size: 13px; font-weight: 800; line-height: 1.2; }
.bn-tab-t small { display: block; font: 600 10.5px 'IBM Plex Mono', monospace; color: var(--s-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bn-tab-t small.hot { color: var(--you); }
.bn-tab-t small.won { color: var(--up); }
.bn-tab-n { font: 600 15px 'IBM Plex Mono', monospace; color: var(--s-text); }
.bn-tab-n i { font-style: normal; font-size: 10.5px; color: var(--s-faint); }

.bn-card { flex: 1; min-height: 0; display: flex; flex-direction: column; width: 100%; max-width: 760px; margin: 0 auto; }
.bn-letters { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 6px; }
.bn-letters span { text-align: center; font: 900 13px Inter, sans-serif; letter-spacing: .3em; color: var(--s-faint); }
.bn-cells { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); grid-template-rows: repeat(5, minmax(0, 1fr)); gap: 8px; }
.bn-sq { position: relative; appearance: none; isolation: isolate; border: 1px solid var(--s-line); background: var(--s-panel); color: var(--s-text); border-radius: 10px; padding: 9px 10px 8px; text-align: left; display: flex; flex-direction: column; justify-content: space-between; gap: 3px; cursor: pointer; overflow: hidden; font-family: inherit; min-height: 0; min-width: 0; transition: border-color .3s, background .3s, color .3s; }
.bn-sq:hover { border-color: #3d4352; }
.bn-tag { display: flex; align-items: center; gap: 5px; font: 700 9.5px 'IBM Plex Mono', monospace; letter-spacing: .08em; text-transform: uppercase; color: var(--s-dim); white-space: nowrap; overflow: hidden; padding-right: 14px; }
.bn-tag i { flex: none; width: 3px; height: 11px; border-radius: 1px; background: var(--tc, var(--s-faint)); }
.bn-lab { font-size: 13.5px; font-weight: 700; line-height: 1.18; letter-spacing: -.01em; hyphens: auto; -webkit-hyphens: auto; overflow-wrap: break-word; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.bn-when { font: 600 10px 'IBM Plex Mono', monospace; color: var(--s-faint); min-height: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bn-sq.on { background: color-mix(in srgb, var(--you) 15%, var(--s-panel)); border-color: color-mix(in srgb, var(--you) 50%, transparent); }
.bn-sq.on .bn-when { color: var(--you); }
.bn-sq.on::after { content: ''; position: absolute; top: 9px; right: 9px; width: 9px; height: 9px; border-radius: 50%; background: var(--you); }
.bn-sq.need { border-style: dashed; border-color: color-mix(in srgb, var(--you) 75%, transparent); }
.bn-sq.need .bn-when { color: var(--you); opacity: .8; }
.bn-sq.win { background: var(--you); color: var(--you-ink); border-color: var(--you); }
.bn-sq.win .bn-tag, .bn-sq.win .bn-when { color: color-mix(in srgb, var(--you-ink) 72%, transparent); }
.bn-sq.win .bn-tag i { background: var(--you-ink); opacity: .6; }
.bn-sq.win::after { background: var(--you-ink); }
.bn-sq.free { background: var(--s-panel2); align-items: center; justify-content: center; text-align: center; gap: 4px; }
.bn-sq.free::after { display: none; }
.bn-sq.free .bn-tag { padding: 0; color: var(--you); }
.bn-sq.free.win .bn-tag { color: var(--you-ink); }
.bn-sq.free.win { background: var(--you); }
.bn-sq.free.win .bn-when { color: color-mix(in srgb, var(--you-ink) 72%, transparent); }
.bn-sq.free .bn-lab { font-size: 15px; }
.bn-sq.sel { outline: 2px solid var(--s-text); outline-offset: 2px; }
.bn-sq.new::before { content: ''; position: absolute; z-index: -1; left: 50%; top: 50%; width: 150%; aspect-ratio: 1; border-radius: 50%; background: var(--you); transform: translate(-50%, -50%) scale(0); opacity: .6; animation: bnStamp .9s cubic-bezier(.2,.8,.3,1) forwards; }
.bn-sq.new { animation: bnPop .5s; }
@keyframes bnStamp { 60% { opacity: .35; } to { transform: translate(-50%, -50%) scale(1); opacity: 0; } }
@keyframes bnPop { 35% { transform: scale(1.05); } }

.bn-detail { display: flex; gap: 12px; align-items: baseline; min-height: 38px; font-size: 12.5px; line-height: 1.4; color: var(--s-dim); background: var(--s-panel); border: 1px solid var(--s-line); border-radius: 10px; padding: 9px 12px; }
.bn-detail b { color: var(--s-text); }
.bn-detail-r { margin-left: auto; font: 500 11px 'IBM Plex Mono', monospace; color: var(--s-faint); white-space: nowrap; }

.bn-pats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.bn-pat { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto auto; column-gap: 11px; row-gap: 1px; align-items: center; background: var(--s-panel); border: 1px solid var(--s-line); border-radius: 10px; padding: 9px 11px; transition: border-color .3s, background .3s; }
.bn-glyph { grid-row: 1 / 4; display: grid; grid-template-columns: repeat(5, 6px); gap: 2px; }
.bn-glyph i { width: 6px; height: 6px; border-radius: 1.5px; background: var(--s-line); }
.bn-glyph i.g { background: var(--s-dim); }
.bn-pat.won .bn-glyph i.g { background: var(--you); }
.bn-pat-n { min-width: 0; }
.bn-pat-n b { display: block; font-size: 13px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bn-pat-s { display: flex; justify-content: space-between; gap: 6px; font: 600 11px 'IBM Plex Mono', monospace; color: var(--s-text); white-space: nowrap; min-width: 0; }
.bn-pat-s > span { overflow: hidden; text-overflow: ellipsis; }
.bn-pat-s em { font-style: normal; color: var(--s-dim); }
.bn-pat-c { font-size: 10.5px; color: var(--s-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bn-pat.hot { border-color: color-mix(in srgb, var(--you) 60%, transparent); }
.bn-pat.hot .bn-pat-s > span { color: var(--you); }
.bn-pat.won { border-color: color-mix(in srgb, var(--you) 45%, transparent); background: color-mix(in srgb, var(--you) 9%, var(--s-panel)); }
.bn-pat.won .bn-pat-s > span { color: var(--up); }
.bn-pat.won .bn-pat-s em { color: var(--you); }

/* ---------- final panel ---------- */
.bn-final { position: absolute; inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center; padding: 20px; background: color-mix(in srgb, var(--s-bg) 70%, transparent); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); animation: bnFade .4s; }
.bn-final[hidden] { display: none; }
@keyframes bnFade { from { opacity: 0; } }
.bn-final-box { width: min(480px, 100%); background: var(--s-panel); border: 1px solid #343a48; border-radius: 16px; padding: 22px 24px; box-shadow: 0 30px 80px rgba(0,0,0,.55); animation: bnRise .5s cubic-bezier(.2,.9,.3,1.15); }
@keyframes bnRise { from { opacity: 0; transform: translateY(14px) scale(.97); } }
.bn-final-box small { font-size: 10.5px; font-weight: 800; letter-spacing: .24em; text-transform: uppercase; color: var(--you); }
.bn-final-box h3 { font-size: 26px; font-weight: 900; letter-spacing: -.025em; line-height: 1.1; margin: 4px 0 4px; }
.bn-final-box p { color: var(--s-dim); font-size: 13.5px; }
.bn-final-you { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin: 14px 0 10px; padding: 12px 14px; border-radius: 10px; background: var(--s-bg); border: 1px solid var(--s-line); font-size: 13px; color: var(--s-dim); }
.bn-final-you b { font: 600 28px 'IBM Plex Mono', monospace; color: var(--s-text); }
.bn-final-cards > div { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--s-line); font-size: 12.5px; }
.bn-final-cards span { color: var(--s-dim); }
.bn-final-cards em { font: 600 12.5px 'IBM Plex Mono', monospace; font-style: normal; }
.bn-final-cta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }

/* ---------- right rail ---------- */
.bn-right { border-left: 1px solid var(--s-line); padding: 16px; display: flex; flex-direction: column; min-height: 0; min-width: 0; overflow: hidden; }
.bn-right > .bn-h:first-child { margin-bottom: 2px; }
.bn-pts b { display: block; font-size: 46px; font-weight: 800; letter-spacing: -.035em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.bn-pts b.bump { animation: bnBump .7s; }
@keyframes bnBump { 35% { color: var(--you); transform: translateY(-2px); } }
.bn-pts span { display: block; font: 600 11.5px 'IBM Plex Mono', monospace; color: var(--s-faint); margin: 2px 0 12px; }
.bn-pts span.up { color: var(--up); }
.bn-boxes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.bn-boxes > div { background: var(--s-panel); border: 1px solid var(--s-line); border-radius: 12px; padding: 10px 12px; min-width: 0; }
.bn-boxes small { display: block; color: var(--s-dim); font-size: 11px; margin-bottom: 2px; }
.bn-boxes b { display: block; font-size: 23px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.bn-boxes b.hot { color: var(--you); }
.bn-boxes em { display: block; font-size: 11px; color: var(--s-faint); font-style: normal; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bn-lb { list-style: none; min-height: 0; overflow: hidden; }
.bn-lr { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto 44px; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--s-line); font-size: 12.5px; }
.bn-lr.you { background: color-mix(in srgb, var(--you) 13%, transparent); box-shadow: inset 3px 0 0 var(--you); margin: 0 -8px; padding-left: 8px; padding-right: 8px; border-radius: 6px; border-bottom-color: transparent; }
.bn-lr.up .bn-lr-rk { color: var(--up); }
.bn-lr.gap { display: block; padding: 0; height: 9px; border-bottom: 1px dashed var(--s-line); margin-bottom: 4px; }
.bn-lr-rk { font: 600 11.5px 'IBM Plex Mono', monospace; color: var(--s-faint); text-align: right; }
.bn-lr-nm { min-width: 0; line-height: 1.25; }
.bn-lr-nm b { display: block; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bn-lr-nm em { display: block; font: 500 10.5px 'IBM Plex Mono', monospace; font-style: normal; color: var(--s-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bn-lr-nm em.hot { color: var(--you); }
.bn-lr-ch { display: flex; gap: 2px; }
.bn-lr-ch i { width: 15px; height: 15px; border-radius: 4px; display: flex; align-items: center; justify-content: center; font: 700 8.5px 'IBM Plex Mono', monospace; font-style: normal; color: var(--s-faint); background: var(--s-panel); border: 1px solid var(--s-line); }
.bn-lr-ch i.on { background: var(--you); border-color: var(--you); color: var(--you-ink); }
.bn-lr-pt { font: 600 12.5px 'IBM Plex Mono', monospace; text-align: right; }
.bn-note { margin-top: auto; padding-top: 12px; font-size: 11px; line-height: 1.45; color: var(--s-faint); }

/* paused */
.bn-paused .dk-dot { animation: none; background: var(--s-faint); }
.bn-done .dk-dot { animation: none; background: var(--s-text); }

/* ---------- tablet ---------- */
@media (max-width: 1180px) {
  .bn-grid { grid-template-columns: 290px minmax(0, 1fr); grid-template-areas: "show center" "log center" "right right"; grid-template-rows: auto minmax(0, 1fr) auto; height: auto; }
  .bn-left { display: contents; }
  .bn-show { grid-area: show; border-right: 1px solid var(--s-line); }
  .bn-logwrap { grid-area: log; border-right: 1px solid var(--s-line); max-height: 420px; }
  .bn-center { grid-area: center; min-height: 640px; }
  .bn-right { grid-area: right; border-left: 0; border-top: 1px solid var(--s-line); display: grid; grid-template-columns: 1fr 1.4fr; column-gap: 24px; align-items: start; }
  .bn-right > * { grid-column: 1; }
  .bn-right > .bn-h:nth-of-type(2), .bn-right > .bn-lb, .bn-right > .bn-note { grid-column: 2; }
  .bn-right > .bn-h:nth-of-type(2) { grid-row: 1; }
  .bn-right > .bn-lb { grid-row: 2 / 5; }
  .bn-right > .bn-note { grid-row: 5; margin-top: 0; }
}

/* ---------- phone ---------- */
@media (max-width: 760px) {
  .bn-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "show" "center" "right" "log"; grid-template-rows: auto; }
  .bn-show, .bn-logwrap { border-right: 0; }
  .bn-show { padding: 14px; }
  .bn-logwrap { border-top: 1px solid var(--s-line); max-height: 380px; padding: 14px 14px 0; }
  .bn-center { min-height: 0; padding: 14px 10px; gap: 10px; }
  .bn-tabs { gap: 6px; }
  .bn-tab { padding: 7px 8px; gap: 7px; }
  .bn-mini, .bn-tab-n { display: none; }
  .bn-tab-t small { font-size: 9.5px; }
  .bn-letters { gap: 5px; }
  .bn-cells { grid-template-rows: none; grid-auto-rows: minmax(76px, auto); gap: 4px; }
  .bn-letters { gap: 4px; }
  .bn-sq { padding: 6px 5px 5px; border-radius: 8px; gap: 2px; }
  .bn-sq.lw .bn-lab { font-size: 9px; letter-spacing: -.03em; }
  .bn-tag { font-size: 8px; letter-spacing: .02em; gap: 3px; padding-right: 9px; }
  .bn-tag i { height: 9px; width: 2px; }
  .bn-lab { font-size: 10.5px; line-height: 1.15; -webkit-line-clamp: 4; letter-spacing: -.015em; overflow-wrap: anywhere; }
  .bn-when { font-size: 8.5px; min-height: 11px; }
  .bn-sq.on::after { top: 6px; right: 5px; width: 6px; height: 6px; }
  .bn-sq.free .bn-lab { font-size: 11px; }
  .bn-detail { display: block; font-size: 12px; }
  .bn-detail-r { display: none; }
  .bn-pats { grid-template-columns: 1fr 1fr; gap: 6px; }
  .bn-right { display: flex; padding: 14px; }
  .bn-final { align-items: flex-start; padding: 14px 10px; }
  .bn-final-box { padding: 18px; }
}
