/* Games board (/games/): the compact lobby list. Phone first; a container query adds the tablet
   and desktop layouts. Classes start with gb-. Art is inline SVG (templates/games/_board_art.html).
   Row fills are fixed colours, not tokens: white text on them in both themes. Bump ?v= in board.html. */
.gb { container-type: inline-size; }
.gb-main, .gb-side { min-width: 0; }
/* phone and tablet: no side column. The wrappers vanish so the side panel can split around the list (see .ga-card).
   The heading sits outside both columns. */
.gb-lay { display: grid; gap: 16px; }
.gb-main, .gb-side { display: contents; }
.gb-head { order: 1; } .gb-list { order: 2; }
.gb-head h1 { margin-top: 4px; }

/* ---------- the rows ---------- */
.gb-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.gb-row { position: relative; display: grid; grid-template-columns: 76px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 14px; border-radius: 20px; color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), inset 0 0 0 1px rgba(255, 255, 255, .1), 0 12px 24px -14px var(--tint, rgba(0, 0, 0, .8)); }
:root[data-theme="dark"] .gb-row { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), inset 0 0 0 1px rgba(255, 255, 255, .1), 0 12px 24px -12px rgba(0, 0, 0, .8); }
.gb-color { --ink: #7d2a07; --glow: #ffb26b; --tint: #a3153d; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22'%3E%3Cpath d='M11 0 22 11 11 22 0 11Z' fill='none' stroke='white' stroke-opacity='.11' stroke-width='1.2'/%3E%3Cpath d='M0 0 22 22M22 0 0 22' stroke='white' stroke-opacity='.04'/%3E%3C/svg%3E"), linear-gradient(135deg, #b8430a, #a3153d); }
.gb-lucky { --ink: #045f59; --glow: #5ff0e3; --tint: #0b5d58; background: radial-gradient(180px 110px at 44px 50%, rgba(255, 255, 255, .2), transparent 72%), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .9 0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.1'/%3E%3C/svg%3E"), linear-gradient(135deg, #04776f, #0b5d58); }
.gb-trivia { --ink: #232f9e; --glow: #8e9bff; --tint: #232f9e; background: radial-gradient(rgba(255, 255, 255, .2) 1px, transparent 1.5px) 0 0 / 14px 14px, linear-gradient(135deg, #3644d6, #232f9e); }
.gb-cross { --ink: #5a4300; --glow: #ffd96b; --tint: #4a3800; background: linear-gradient(rgba(255, 255, 255, .08) 1px, transparent 1px) 0 0 / 18px 18px, linear-gradient(90deg, rgba(255, 255, 255, .08) 1px, transparent 1px) 0 0 / 18px 18px, linear-gradient(135deg, #7a5b00, #4a3800); }
.gb-row:not(.gb-color):not(.gb-lucky):not(.gb-trivia):not(.gb-cross) { --ink: #14203a; background: linear-gradient(135deg, #4a4f66, #2a2e40); }

.gb-art { position: relative; display: block; width: 100%; aspect-ratio: 100 / 68; }
.gb-art::before { content: ""; position: absolute; inset: -14%; background: radial-gradient(closest-side, color-mix(in srgb, var(--glow, #fff) 55%, transparent), transparent); }
.gb-svg { position: relative; display: block; width: 100%; height: 100%; overflow: visible; font-family: var(--display); }
.gb-txt { display: grid; gap: 1px; min-width: 0; }
.gb-txt h2 { color: #fff; font-size: 17px; }
.gb-blurb { display: none; color: rgba(255, 255, 255, .94); font-size: 13px; }
.gb-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 6px; }
.gb-chip { padding: 2px 8px; border-radius: 999px; background: rgba(0, 0, 0, .24); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .28); font: 600 9.5px/1.5 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: #fff; }
.gb-stat { font: 500 11.5px var(--mono); color: rgba(255, 255, 255, .92); }
.gb-stat b { font-weight: 600; color: #fff; }

.gb-go { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 48px; padding: 0 20px; border-radius: 999px; background: #fff; color: var(--ink, #14203a); font: 700 14px var(--ui); white-space: nowrap; box-shadow: 0 2px 0 rgba(0, 0, 0, .2), 0 8px 14px -6px rgba(0, 0, 0, .45); }
a.gb-go::after { content: ""; position: absolute; inset: 0; border-radius: 20px; } /* the whole row is the tap target */
.gb-go svg { flex: none; }
a.gb-go:hover { text-decoration: none; background: #fffdf6; box-shadow: 0 2px 0 rgba(0, 0, 0, .2), 0 10px 18px -6px rgba(0, 0, 0, .5); }
a.gb-go.off:hover { background: rgba(0, 0, 0, .36); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .45); } /* keep white text readable */
.gb-row:has(a.gb-go:active) { transform: translateY(1px); } /* press the row, not the link: a transform on the link would shrink its row-wide ::after to the button */
a.gb-go:active { box-shadow: 0 0 0 rgba(0, 0, 0, .2), 0 3px 6px -3px rgba(0, 0, 0, .5); }
a.gb-go:focus-visible { outline: none; }
.gb-row:has(a.gb-go:focus-visible) { outline: 3px solid #fff; outline-offset: 2px; box-shadow: 0 0 0 6px rgba(15, 20, 40, .7); }
.gb-go.off { padding: 0 14px; font-size: 12.5px; background: rgba(0, 0, 0, .26); color: #fff; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .3); }

/* ---------- The side panel: one card on desktop, a warm coins band over the week board. On phone and
   tablet .ga-card vanishes, so the band sits above the list and the board below it. Tabs in board.js. ---------- */
.ga-card { display: contents; }
.ga-hero, .ga-week { min-width: 0; border-radius: var(--r); box-shadow: 0 1px 2px var(--shadow); }
:root[data-theme="dark"] :is(.ga-hero, .ga-week) { box-shadow: inset 0 0 0 1px var(--line); }
.ga-hero { order: 3; padding: 16px 18px 2px; background: linear-gradient(165deg, color-mix(in srgb, var(--sun) 26%, var(--card)), color-mix(in srgb, var(--sun) 7%, var(--card)) 78%), var(--card); }
:root[data-theme="dark"] .ga-hero { background: linear-gradient(165deg, color-mix(in srgb, var(--sun) 10%, var(--card)), var(--card) 80%); }
.ga-week { order: 5; overflow: hidden; padding: 0 18px 14px; background: var(--card); }
.ga-card :focus-visible { outline: 2px solid var(--grape); outline-offset: 2px; }
.ga-ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.ga-bal { display: flex; align-items: center; gap: 12px; }
.ga-bal .gm-dot { width: 40px; height: 40px; }
.ga-bal-t { display: grid; min-width: 0; }
.ga-lab { font: 600 10.5px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--txt-2); }
.ga-num { font: 800 34px/1 var(--display); letter-spacing: -.02em; color: var(--txt-hi); }
.ga-num small { margin-left: 6px; font: 600 13px var(--mono); letter-spacing: 0; color: var(--txt-2); }
.ga-hero.slim .ga-num { font-size: 26px; }
.ga-hero.slim .gm-dot { width: 32px; height: 32px; }
.ga-bonus { margin: 12px 0 0; }
.ga-bonus p { margin: 0 0 8px; font-size: 13px; color: var(--txt-2); }
.ga-bonus p b { color: var(--txt-hi); }
.ga-btn { display: inline-flex; align-items: center; justify-content: center; width: 100%; min-height: 48px; padding: 0 22px; border: 0; border-radius: 999px; background: var(--txt-hi); color: var(--on-hi); font: 700 14px var(--ui); cursor: pointer; white-space: nowrap; }
.ga-btn:hover { text-decoration: none; opacity: .9; }
.ga-taken { display: flex; align-items: center; gap: 10px; margin: 8px 0 0; font-size: 12.5px; line-height: 1.35; color: var(--txt-2); }
.ga-cd { flex: none; padding: 3px 8px; border-radius: 999px; background: color-mix(in srgb, var(--card) 70%, transparent); box-shadow: inset 0 0 0 1px var(--line); font: 600 12.5px var(--mono); color: var(--txt-hi); font-variant-numeric: tabular-nums; }
.ga-hist { margin-top: 6px; border-top: 1px solid color-mix(in srgb, var(--txt-3) 22%, transparent); font-size: 13px; }
.ga-hist summary { display: flex; align-items: center; gap: 6px; min-height: 44px; cursor: pointer; list-style: none; font-weight: 700; color: var(--txt-2); }
.ga-hist summary::-webkit-details-marker { display: none; }
.ga-hist summary::after { content: ""; width: 7px; height: 7px; margin-left: 2px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-2px); }
.ga-hist[open] summary::after { transform: rotate(-135deg) translate(-2px, -1px); }
.ga-hist summary:hover { color: var(--txt-hi); }
.ga-hist ul { list-style: none; margin: 0; padding: 2px 0 8px; display: grid; gap: 7px; }
.ga-hist li { display: grid; grid-template-columns: 1fr auto; gap: 8px; color: var(--txt-2); }
.ga-hist li small { display: block; font-size: 11.5px; color: var(--txt-3); }
.ga-hist b { align-self: center; font: 600 12px var(--mono); color: var(--txt-hi); }
.ga-hist b.up { color: var(--ok); } .ga-hist b.dn { color: var(--danger); }
.ga-hist .ga-more { margin-bottom: 4px; }

/* the period: a small segmented control above the game tabs */
.ga-per { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; margin: 14px 0 14px; padding: 3px; border-radius: 999px; background: var(--sunk); }
.ga-per a { display: grid; place-items: center; min-height: 40px; border-radius: 999px; color: var(--txt-2); font: 600 12.5px var(--ui); white-space: nowrap; }
.ga-per a:hover { color: var(--txt-hi); text-decoration: none; }
.ga-per a[aria-current] { background: var(--card); color: var(--txt-hi); box-shadow: 0 1px 3px var(--shadow); }
:root[data-theme="dark"] .ga-per a[aria-current] { background: var(--line); }
.ga-panel { display: grid; min-width: 0; }

/* the rows: medals for the top three */
.ga-rows { list-style: none; margin: 0; padding: 0; display: grid; }
.ga-lr { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 10px; align-items: center; min-height: 46px; padding: 0 8px; font-size: 14px; }
.ga-lr + .ga-lr { border-top: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.ga-lr.mine + .ga-lr, .ga-lr + .ga-lr.mine { border-top-color: transparent; }
.ga-lr .n { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; font: 600 12px var(--mono); color: var(--txt-3); }
.ga-lr .n.m1 { background: #ffd23f; color: #5a4300; } .ga-lr .n.m2 { background: #d5dae6; color: #2d3550; } .ga-lr .n.m3 { background: #f0b27a; color: #6b3410; }
.ga-lr .u { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; color: var(--txt-hi); }
.ga-lr .p { font: 600 13px var(--mono); color: var(--ok); white-space: nowrap; }
.ga-lr .p.pts { color: var(--txt-hi); }
.ga-lr.mine { background: color-mix(in srgb, var(--tang) 10%, var(--card)); box-shadow: inset 3px 0 0 var(--tang); }
.ga-lr.mine .u { font-weight: 800; }
.ga-lr.you, .ga-lr.off { margin-top: 4px; border-radius: 12px; }
.ga-lr.off { padding-top: 2px; background: var(--sunk); }
.ga-lr.off .p { color: var(--txt-2); } .ga-lr .p.neg { color: var(--danger); }
.ga-nt { grid-column: 2 / -1; margin: -6px 0 0; padding-bottom: 8px; font-size: 12.5px; line-height: 1.4; color: var(--txt-2); }
.ga-more { display: inline-flex; align-items: center; min-height: 44px; font-size: 13.5px; font-weight: 700; white-space: nowrap; color: var(--tang-ink); }
.ga-more::after { content: "\2192"; margin-left: 6px; }
.ga-panel > .ga-more { justify-self: start; margin-top: 4px; }
.ga-empty { display: grid; justify-items: center; gap: 6px; padding: 26px 12px; text-align: center; }
.ga-empty .ga-ic { width: 34px; height: 34px; color: var(--txt-3); }
.ga-empty p { margin: 0; max-width: 26ch; color: var(--txt-2); }
.ga-empty p b { display: block; font: 800 16px var(--display); color: var(--txt-hi); }

/* ---------- tablet ---------- */
@container (min-width: 560px) {
  .gb-row { padding: 16px 20px; gap: 18px; grid-template-columns: 96px minmax(0, 1fr) auto; }
  .gb-blurb { display: block; font-size: 13.5px; }
  .gb-txt h2 { font-size: 20px; }
  .gb-go { padding: 0 24px; }
  .gb-go.off { padding: 0 16px; }
}
@container (min-width: 560px) and (max-width: 899px) {
  .ga-hero { display: grid; grid-template-columns: 1fr 1fr; column-gap: 24px; align-items: center; padding: 16px 22px; }
  .ga-hero .ga-bonus, .ga-hero .ga-taken { margin-top: 0; }
  .ga-hero .ga-hist { grid-column: 1 / -1; }
  .ga-week { padding: 0 22px 16px; }
}
/* ---------- desktop: list left, one panel card right ---------- */
@container (min-width: 900px) {
  .gb-lay { grid-template-columns: minmax(0, 1fr) 360px; gap: 18px 32px; align-items: start; }
  .gb-head { order: 0; grid-column: 1 / -1; } /* above both columns, so the panel top lines up with the first game */
  .gb-main { display: grid; gap: 18px; }
  .gb-side { display: grid; gap: 16px; position: sticky; top: 24px; }
  .gb-row { padding: 18px 26px; grid-template-columns: 124px minmax(0, 1fr) auto; gap: 24px; }
  .ga-card { display: block; overflow: hidden; border-radius: var(--r); background: var(--card); box-shadow: 0 1px 2px var(--shadow); }
  :root[data-theme="dark"] .ga-card { box-shadow: inset 0 0 0 1px var(--line); }
  .ga-hero, .ga-week, :root[data-theme="dark"] :is(.ga-hero, .ga-week) { border-radius: 0; box-shadow: none; }
  .ga-hero { padding: 18px 18px 2px; }
  .ga-hero.slim { padding-top: 14px; }
}
@media (max-width: 380px) { .gb-go { padding: 0 14px; } .gb-row { gap: 10px; } }

@media (prefers-reduced-motion: no-preference) {
  .gb-go { transition: transform .12s, box-shadow .15s, background .15s; }
  .gb-row { transition: transform .18s; }
  .gb-row:hover, .gb-row:focus-within { transform: translateY(-2px); }
  .gb-svg { transition: transform .25s; }
  .gb-row:hover .gb-svg { transform: scale(1.05) rotate(-2deg); }
}
