/* Bingo only. The page, panels, buttons and all five tones come from kit/midnight.css: this file names no colour. */

html, body { touch-action: manipulation; }
body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }

/* Start screen (approved sample 6-bingo-room, screen 1): Against bots, With friends, a small line, the waves */
.menu { gap: calc(28 * var(--u)); }
.menu .btn { height: max(calc(118 * var(--u)), 46px); font-size: max(calc(44 * var(--u)), 16px); }
.option { flex: none; width: 100%; flex-direction: column; gap: calc(22 * var(--u)); padding: calc(20 * var(--u)) calc(28 * var(--u)) calc(30 * var(--u)); }
.option h2 { margin: 0; font-size: max(calc(58 * var(--u)), 19px); font-weight: 400; }
.choices { width: 100%; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: calc(20 * var(--u)); }
/* The chosen option is unmistakable: a filled amber face with dark text. The others stay plain glass. --card-black is dark in every tone. */
.pick.on { background: var(--amber); border-color: var(--amber); color: var(--card-black); font-weight: 600; box-shadow: 0 0 calc(16 * var(--u)) rgba(var(--amber-rgb), 0.55); }
.pick.on:hover { filter: none; }
.play, .menu .play { flex: none; width: 100%; height: max(calc(124 * var(--u)), 52px); font-size: max(calc(62 * var(--u)), 22px); }
.option .wide { width: 100%; }
.small { flex: none; margin: 0; min-height: 1.2em; color: var(--ink-soft); font-size: max(calc(30 * var(--u)), 12px); text-align: center; }
.small.warn, .warn { color: var(--warn); }
.note { flex: none; margin: 0 0 max(calc(14 * var(--u)), env(safe-area-inset-bottom)); min-height: 1.2em; color: var(--ink-soft); font-size: max(calc(32 * var(--u)), 13px); }
.note:empty { display: none; }
.menu .wave { margin: auto 0 0; flex: 1 1 calc(100 * var(--u)); max-height: calc(260 * var(--u)); }

/* Your room (screen 2) and Join a room (screen 3) */
.lobby, .join { gap: calc(26 * var(--u)); }
.roominfo { flex: none; width: 100%; display: flex; flex-direction: column; align-items: center; gap: calc(22 * var(--u)); }
.say, .join .title { margin: calc(14 * var(--u)) 0 0; font-weight: 400; font-size: max(calc(44 * var(--u)), 17px); }
.join .title { font-size: max(calc(64 * var(--u)), 24px); }
.soft { margin: 0; color: var(--ink-soft); font-size: max(calc(36 * var(--u)), 14px); text-align: center; }
.bignum { flex: none; width: calc(840 * var(--u)); height: max(calc(210 * var(--u)), 84px); border-radius: calc(30 * var(--u)); color: var(--amber); font-size: max(calc(150 * var(--u)), 54px); font-weight: 300; letter-spacing: 0.02em; text-shadow: 0 0 calc(18 * var(--u)) rgba(var(--amber-rgb), 0.75); }
.share { flex: none; width: calc(400 * var(--u)); min-width: 140px; }
.seats { flex: none; width: 100%; margin: 0; padding: 0; list-style: none; flex-direction: column; align-items: stretch; overflow: hidden; }
.seats li { display: flex; align-items: center; gap: calc(28 * var(--u)); min-height: max(calc(108 * var(--u)), 52px); padding: 0 calc(20 * var(--u)) 0 calc(40 * var(--u)); font-size: max(calc(44 * var(--u)), 16px); border-bottom: 1px solid var(--cell-edge); }
.seats li:last-child { border-bottom: 0; }
.seats .dot { flex: none; width: max(calc(24 * var(--u)), 9px); height: max(calc(24 * var(--u)), 9px); border-radius: 50%; background: var(--ink-soft); opacity: 0.45; }
.seats .on .dot { background: var(--amber); opacity: 1; box-shadow: 0 0 calc(10 * var(--u)) rgba(var(--amber-rgb), 0.85); }
.seats .away .dot { background: var(--amber); opacity: 0.45; }
.seats .empty span { color: var(--ink-soft); }
.seats .btn { margin-left: auto; height: max(calc(76 * var(--u)), 44px); padding: 0 calc(26 * var(--u)); font-size: max(calc(32 * var(--u)), 13px); }
.start, .joingo { flex: none; width: 100%; margin: auto 0 max(calc(22 * var(--u)), env(safe-area-inset-bottom)); height: max(calc(112 * var(--u)), 52px); font-size: max(calc(58 * var(--u)), 22px); }
.start[hidden], .icon[hidden] { display: none; }
.digits { flex: none; width: calc(860 * var(--u)); display: grid; grid-template-columns: repeat(6, 1fr); gap: calc(14 * var(--u)); }
.digit { aspect-ratio: 0.86; border-radius: calc(14 * var(--u)); color: var(--amber); font-size: max(calc(80 * var(--u)), 26px); font-weight: 300; text-shadow: 0 0 calc(12 * var(--u)) rgba(var(--amber-rgb), 0.7); }
.digit.now { border-color: var(--amber); box-shadow: 0 0 calc(16 * var(--u)) rgba(var(--amber-rgb), 0.45), inset 0 1px 0 var(--sheen); }
.keypad { flex: 0 1 calc(820 * var(--u)); min-height: 0; width: calc(860 * var(--u)); display: grid; align-items: stretch; justify-items: stretch; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(4, 1fr); overflow: hidden; }
.key { min-width: 0; min-height: 44px; padding: 0; display: grid; place-items: center; color: var(--ink); font: inherit; font-size: max(calc(84 * var(--u)), 26px); font-weight: 300; line-height: 1; cursor: pointer; border: 0; border-right: 1px solid var(--edge); border-bottom: 1px solid var(--edge); background: var(--cell); touch-action: manipulation; transition: filter 0.12s ease; }
.key:nth-child(3n) { border-right: 0; }
.key:nth-child(n + 10) { border-bottom: 0; }
.key:hover:not(.blank) { filter: brightness(var(--hover)); }
.key:active:not(.blank) { filter: brightness(var(--press)); }
.key.blank { cursor: default; }
.key svg { width: max(calc(64 * var(--u)), 24px); height: max(calc(64 * var(--u)), 24px); fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.key:focus-visible, body.nav .key:focus { outline-offset: calc(-6 * var(--u)); z-index: 1; }
.joingo:disabled { opacity: 0.55; }

/* The room's number on the game bar (screen 4) */
.bar .round.badge { padding: calc(6 * var(--u)) calc(18 * var(--u)); border: max(1px, calc(2 * var(--u))) solid var(--edge); border-radius: calc(12 * var(--u)); color: var(--ink); background: var(--cell); }

/* The game, top to bottom. On a tall phone your card grows to its full square, then the rest spreads out. */
:root { --room: calc(100vh - 1536 * var(--u)); }
@supports (height: 1dvh) {
  :root { --room: calc(100dvh - 1536 * var(--u)); }
}
.game { padding: max(calc(12 * var(--u)), env(safe-area-inset-top)) calc(16 * var(--u)) 0; gap: calc(16 * var(--u)); justify-content: space-between; }
.bar { height: max(calc(72 * var(--u)), 44px); justify-content: flex-start; gap: calc(16 * var(--u)); padding: 0 calc(14 * var(--u)); }
.bar h1 { font-size: max(calc(44 * var(--u)), 18px); }
.menu .bar { justify-content: space-between; }
.bar .round { margin-left: auto; font-size: max(calc(32 * var(--u)), 13px); color: var(--ink-soft); white-space: nowrap; }
.bar .icon svg { width: max(calc(46 * var(--u)), 24px); height: max(calc(46 * var(--u)), 24px); }

/* The bots' cards. Hidden numbers stay blank until picked. */
.bots { flex: none; width: 100%; display: flex; justify-content: center; gap: calc(14 * var(--u)); grid-area: bots; }
.botcard { flex: none; display: flex; align-items: center; gap: calc(28 * var(--u)); padding: calc(20 * var(--u)) calc(30 * var(--u)) calc(20 * var(--u)) calc(52 * var(--u)); border: max(1px, calc(2 * var(--u))) solid var(--edge); border-radius: calc(30 * var(--u)); background: var(--glass); box-shadow: 0 0 calc(14 * var(--u)) var(--glow), inset 0 1px 0 var(--sheen); }
.botcard.turn { border-color: var(--amber); box-shadow: 0 0 calc(14 * var(--u)) rgba(var(--amber-rgb), 0.35), inset 0 1px 0 var(--sheen); }
.minicard { position: relative; flex: none; width: calc(316 * var(--u)); }
.minigrid { display: grid; grid-template-columns: repeat(5, 1fr); grid-auto-rows: calc(54 * var(--u)); }
.mini { position: relative; display: grid; place-items: center; border: 1px solid var(--cell-edge); background: var(--cell); font-size: max(calc(33 * var(--u)), 9px); font-weight: 300; line-height: 1; overflow: hidden; }
.who { padding-left: calc(32 * var(--u)); border-left: 1px solid var(--cell-edge); align-self: stretch; display: flex; flex-direction: column; justify-content: center; gap: calc(12 * var(--u)); white-space: nowrap; }
.who b { font-weight: 400; font-size: max(calc(52 * var(--u)), 16px); }
.who span { font-size: max(calc(40 * var(--u)), 13px); color: var(--ink-soft); }
/* Each bot's B I N G O, big enough to read its score at a glance (his ask, 8 Nov), smaller than the player's own row */
.miniletters { display: flex; gap: calc(16 * var(--u)); font-size: max(calc(56 * var(--u)), 18px); font-weight: 300; line-height: 1; margin-top: calc(6 * var(--u)); }
.miniletters i { position: relative; font-style: normal; color: var(--ink-soft); opacity: 0.6; }
.miniletters i.on { color: var(--amber); opacity: 1; text-shadow: 0 0 calc(8 * var(--u)) rgba(var(--amber-rgb), 0.7); }
.miniletters i.on::after { content: ""; position: absolute; left: -20%; right: -20%; top: 50%; height: max(2px, calc(4 * var(--u))); margin-top: calc(-2 * var(--u)); border-radius: 2px; background: var(--amber); }
.bots.many .miniletters { gap: calc(8 * var(--u)); font-size: max(calc(38 * var(--u)), 14px); margin-top: 0; }
.bots.three .miniletters { gap: calc(5 * var(--u)); font-size: max(calc(30 * var(--u)), 12px); }

/* With 2 or 3 bots: smaller, side by side, the words under each */
.bots.many .botcard { flex: 1 1 0; min-width: 0; max-width: calc(322 * var(--u)); flex-direction: column; gap: calc(8 * var(--u)); padding: calc(12 * var(--u)); border-radius: calc(22 * var(--u)); }
.bots.many .minicard { width: 100%; }
.bots.many .minigrid { grid-auto-rows: auto; }
.bots.many .mini { aspect-ratio: 1.12; font-size: max(calc(30 * var(--u)), 9px); }
.bots.many .who { padding-left: 0; border-left: 0; flex-direction: row; align-items: baseline; justify-content: center; gap: calc(14 * var(--u)); }
.bots.many .who b { font-size: max(calc(36 * var(--u)), 13px); }
.bots.many .who span { font-size: max(calc(30 * var(--u)), 12px); }
.bots.three .mini { font-size: max(calc(24 * var(--u)), 8px); }
.bots.three .who { gap: calc(10 * var(--u)); }
.bots.three .who b { font-size: max(calc(30 * var(--u)), 12px); }
.bots.three .who span { font-size: max(calc(26 * var(--u)), 11px); }

/* A crossed number, on either card */
.mini.x::before, .mini.x::after, .num.x::before, .num.x::after { content: ""; position: absolute; left: 50%; top: 50%; width: 66%; height: max(1px, calc(3 * var(--u))); background: var(--amber); box-shadow: 0 0 calc(5 * var(--u)) rgba(var(--amber-rgb), 0.85); pointer-events: none; }
.mini.x::before, .num.x::before { transform: translate(-50%, -50%) rotate(40deg); }
.mini.x::after, .num.x::after { transform: translate(-50%, -50%) rotate(-40deg); }
.mini.x::before, .mini.x::after { height: max(1px, calc(2 * var(--u))); width: 74%; }
.just { animation: just 0.7s ease-out; }
@keyframes just { 0% { box-shadow: inset 0 0 0 100px rgba(var(--amber-rgb), 0.5); } 100% { box-shadow: inset 0 0 0 100px rgba(var(--amber-rgb), 0); } }
.mini.open:not(.x) { color: var(--ink-soft); }

/* B I N G O */
.letters { flex: none; width: calc(780 * var(--u)); height: max(calc(110 * var(--u)), 34px); display: grid; grid-template-columns: repeat(5, 1fr); place-items: center; grid-area: letters; }
.letters span { position: relative; font-size: max(calc(92 * var(--u)), 30px); font-weight: 300; line-height: 1; transition: color 0.2s ease; }
.letters .on { color: var(--amber); text-shadow: 0 0 calc(14 * var(--u)) rgba(var(--amber-rgb), 0.85); }
.letters .on::after { content: ""; position: absolute; left: -24%; right: -24%; top: 50%; height: max(2px, calc(6 * var(--u))); margin-top: calc(-3 * var(--u)); border-radius: 3px; background: var(--amber); box-shadow: 0 0 calc(10 * var(--u)) rgba(var(--amber-rgb), 0.9); }
.letters .on.new::after { animation: strike 0.4s ease-out; transform-origin: left; }
@keyframes strike { from { transform: scaleX(0); } }

.picked { flex: none; width: calc(876 * var(--u)); min-height: max(calc(66 * var(--u)), 28px); padding: 0 calc(16 * var(--u)); font-size: max(calc(40 * var(--u)), 13px); text-align: center; grid-area: picked; color: var(--ink); }

/* Your card */
.mine { position: relative; flex: 1 1 calc(750 * var(--u)); min-height: 0; width: min(calc(992 * var(--u)), calc(860 * var(--u) + var(--room))); max-height: calc(992 * var(--u)); grid-area: board; }
.grid { width: 100%; height: 100%; display: grid; grid-template-columns: repeat(5, 1fr); grid-template-rows: repeat(5, 1fr); overflow: hidden; border: max(1px, calc(2 * var(--u))) solid var(--edge); border-radius: calc(24 * var(--u)); background: var(--glass); box-shadow: 0 0 calc(14 * var(--u)) var(--glow); }
.num { position: relative; min-width: 0; min-height: 0; padding: 0; color: var(--ink); font: inherit; font-size: max(calc(76 * var(--u)), 20px); font-weight: 300; line-height: 1; cursor: pointer; border: 0; border-right: 1px solid var(--edge); border-bottom: 1px solid var(--edge); background: var(--cell); touch-action: manipulation; transition: filter 0.12s ease; }
.num:nth-child(5n) { border-right: 0; }
.num:nth-child(n + 21) { border-bottom: 0; }
.num:hover:not(:disabled) { filter: brightness(var(--hover)); }
.num:active:not(:disabled) { filter: brightness(var(--press)); }
.num:disabled { cursor: default; color: var(--ink); }
.grid.wait .num:not(:disabled) { cursor: default; }
.num:focus-visible, body.nav .num:focus { outline-offset: calc(-6 * var(--u)); z-index: 1; }

/* A finished line: a bright line right across it */
.lineset { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.lineset line { stroke-linecap: round; }
.beam-halo { stroke: var(--light-halo); opacity: 0.5; stroke-width: max(4px, calc(13 * var(--u))); filter: blur(calc(4 * var(--u))); }
.beam-body { stroke: var(--light-body); stroke-width: max(2px, calc(6 * var(--u))); }
.beam-core { stroke: var(--light-core); stroke-width: max(1px, calc(2 * var(--u))); }
.minicard .beam-halo { stroke-width: max(2px, calc(6 * var(--u))); filter: none; }
.minicard .beam-body { stroke-width: max(1.5px, calc(3 * var(--u))); }
.minicard .beam-core { stroke-width: max(0.5px, calc(1 * var(--u))); }
.new-line line { stroke-dasharray: 1; stroke-dashoffset: 0; animation: draw-line 0.4s ease-out; }
@keyframes draw-line { from { stroke-dashoffset: 1; } }

.tray { flex: none; width: 100%; min-height: max(calc(96 * var(--u)), 44px); margin-bottom: max(calc(14 * var(--u)), env(safe-area-inset-bottom)); gap: calc(20 * var(--u)); padding: calc(8 * var(--u)) calc(20 * var(--u)); font-size: max(calc(44 * var(--u)), 15px); line-height: 1.15; text-align: center; grid-area: tray; }
.tray.say { color: var(--go-ink); }
.shuffle { flex: none; height: max(calc(72 * var(--u)), 36px); padding: 0 calc(26 * var(--u)); font-size: max(calc(36 * var(--u)), 14px); }
.shuffle[hidden] { display: none; }

/* Cards over the game */
.sheet h2 { font-size: calc(68 * var(--u)); }
.sub { margin: calc(12 * var(--u)) 0 calc(30 * var(--u)) !important; font-size: calc(36 * var(--u)) !important; color: var(--ink-soft); }
.table { display: grid; gap: calc(8 * var(--u)); margin-bottom: calc(40 * var(--u)); }
.row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: calc(30 * var(--u)); padding: calc(14 * var(--u)) calc(26 * var(--u)); border: 1px solid var(--cell-edge); border-radius: calc(14 * var(--u)); background: var(--cell); font-size: max(calc(40 * var(--u)), 14px); text-align: left; }
.row b { font-weight: 400; font-size: 1.1em; }
.row.top { border-color: var(--amber); color: var(--go-ink); }

/* One device: the curtain between turns. The game screen is hidden behind it, so no card shows through. */
.curtain .sub { margin-bottom: calc(44 * var(--u)) !important; }
.reveal { width: 100%; height: max(calc(112 * var(--u)), 52px); font-size: max(calc(52 * var(--u)), 20px); }

@media (prefers-reduced-motion: reduce) {
  .just, .letters .on.new::after, .new-line line { animation: none; }
}

/* Wide screens: your card on the left, everything else beside it */
@media (min-aspect-ratio: 5/4) {
  .screen.game { padding: 0; grid-template-rows: 1fr auto auto auto auto auto 1fr; grid-template-areas: "board ." "board bar" "board bots" "board letters" "board picked" "board tray" "board ."; row-gap: calc(20 * var(--u)); }
  .mine { width: var(--board); height: var(--board); max-height: none; }
  .bar { grid-area: bar; }
  .botcard { max-width: 100%; }
  .picked { width: 100%; }
  .letters { width: 100%; justify-self: center; }
  .tray { margin: 0; }
  .num { font-size: calc(var(--board) * 0.075); }
  .screen.menu { display: flex; width: var(--panel); padding: calc(24 * var(--u)) 0; overflow-y: auto; row-gap: calc(20 * var(--u)); }
  .menu .bar { width: 100%; }
  /* Your room: the number on the left where the card goes, the seats beside it */
  .screen.lobby { grid-template-rows: 1fr auto auto auto auto 1fr; grid-template-areas: "board ." "board bar" "board seats" "board lnote" "board start" "board ."; row-gap: calc(24 * var(--u)); }
  .roominfo { grid-area: board; width: auto; justify-self: stretch; }
  .bignum { width: calc(var(--board) * 0.82); height: calc(var(--board) * 0.26); font-size: calc(var(--board) * 0.16); }
  .seats { grid-area: seats; }
  #lobbyNote { grid-area: lnote; }
  .start { grid-area: start; margin: 0; }
  /* Join: the keypad on the left, the number and Join beside it */
  .screen.join { grid-template-rows: 1fr auto auto auto auto auto auto 1fr; grid-template-areas: "board ." "board bar" "board title" "board soft" "board digits" "board jnote" "board go" "board ."; row-gap: calc(22 * var(--u)); }
  .keypad { grid-area: board; width: calc(var(--board) * 0.76); height: calc(var(--board) * 0.94); justify-self: center; }
  .key { font-size: calc(var(--board) * 0.075); }
  .join .title { grid-area: title; margin: 0; text-align: center; }
  .join .soft { grid-area: soft; }
  .digits { grid-area: digits; width: 100%; }
  #joinNote { grid-area: jnote; }
  .joingo { grid-area: go; margin: 0; }
}
@media (min-aspect-ratio: 5/4) and (max-height: 560px) {
  .note { display: none; }
  .menu .wave { display: none; }
  /* A phone held sideways: the two panels side by side, so all of the start screen fits */
  .screen.menu { width: min(100%, calc(var(--panel) * 2 + 40px)); padding: 12px 16px; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: auto auto 1fr; grid-template-areas: "bar bar" "bots friends" "bots fnote"; align-content: center; align-items: start; column-gap: 16px; row-gap: 10px; }
  .menu .option:first-of-type { grid-area: bots; }
  .menu .option:last-of-type { grid-area: friends; }
  #friendsNote { grid-area: fnote; }
  .screen.lobby { row-gap: calc(14 * var(--u)); }
  .seats li { min-height: 44px; }
  .screen.game { row-gap: calc(12 * var(--u)); }
  /* Two bots on a phone held sideways: words beside each small card, so the height holds */
  .bots.many:not(.three) .botcard { flex-direction: row; gap: calc(12 * var(--u)); padding: calc(10 * var(--u)); }
  .bots.many:not(.three) .minicard { width: 64%; flex: none; }
  .bots.many:not(.three) .who { flex-direction: column; align-items: flex-start; gap: calc(6 * var(--u)); }
}
