/* TeamPoolHub — design system. Tenant colors/fonts arrive as CSS variables from the server. */
:root {
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-2: #cbd5e1;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --ok: #16a34a;
  --ok-bg: #dcfce7;
  --warn: #ca8a04;
  --warn-bg: #fef9c3;
  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .08);
  --shadow: 0 4px 16px rgba(15, 23, 42, .08), 0 1px 3px rgba(15, 23, 42, .06);
  --shadow-lg: 0 20px 50px rgba(15, 23, 42, .18);
  --safe-b: env(safe-area-inset-bottom, 0px);
  /* Four-state square colors (fixed by spec) */
  --sq-a-bg: #D1D5DB; --sq-a-bd: #9CA3AF; --sq-a-fg: #374151;
  --sq-u-bg: #111111; --sq-u-bd: #FACC15;
  --sq-p-bg: #111111; --sq-p-bd: #22C55E;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--font-body); color: var(--ink); background: var(--bg);
  line-height: 1.5; font-size: 16px; -webkit-font-smoothing: antialiased; min-height: 100vh;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.1; margin: 0 0 .4em; letter-spacing: .01em; }
h1 { font-size: clamp(1.8rem, 5vw, 3rem); }
h2 { font-size: clamp(1.35rem, 3vw, 1.8rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 .8em; }
.skip-link { position: absolute; left: -999px; top: 8px; background: #000; color: #fff; padding: 8px 12px; border-radius: 8px; z-index: 1000; }
.skip-link:focus { left: 8px; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 70%, white); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.tiny { font-size: .75rem; }
.center { text-align: center; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 1rem; }
.grow { flex: 1 1 auto; }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .02em; }
.pre { white-space: pre-line; }

/* ---------- Buttons ---------- */
.btn {
  --b-bg: var(--surface); --b-fg: var(--ink); --b-bd: var(--line-2);
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 44px; padding: .6rem 1.1rem; border-radius: 12px; border: 1.5px solid var(--b-bd);
  background: var(--b-bg); color: var(--b-fg); font-weight: 700; text-decoration: none; line-height: 1.1;
  transition: transform .08s ease, filter .15s ease, background .15s ease; user-select: none; white-space: nowrap;
}
.btn:hover { filter: brightness(.96); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn[disabled], .btn.is-busy { opacity: .55; pointer-events: none; }
.btn-primary { --b-bg: var(--brand); --b-fg: var(--brand-ink); --b-bd: var(--brand); }
.btn-dark { --b-bg: var(--dark); --b-fg: var(--dark-ink); --b-bd: var(--dark); }
.btn-ghost { --b-bg: transparent; --b-bd: transparent; }
.btn-outline { --b-bg: transparent; --b-bd: currentColor; }
.btn-danger { --b-bg: var(--danger); --b-fg: #fff; --b-bd: var(--danger); }
.btn-success { --b-bg: var(--ok); --b-fg: #fff; --b-bd: var(--ok); }
.btn-sm { min-height: 36px; padding: .4rem .8rem; font-size: .875rem; border-radius: 10px; }
.btn-xs { min-height: 30px; padding: .25rem .6rem; font-size: .8rem; border-radius: 8px; }
.btn-lg { min-height: 54px; padding: .85rem 1.5rem; font-size: 1.05rem; border-radius: 14px; }
.btn-block { width: 100%; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; border: 0; background: transparent; }
.icon-btn:hover { background: rgba(0, 0, 0, .06); }
.link-btn { background: none; border: 0; padding: 0; color: var(--brand); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Cards, chips ---------- */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-sm); border: 1px solid var(--line); padding: 1.1rem; }
.card-title { font-family: var(--font-head); text-transform: uppercase; letter-spacing: .04em; font-size: 1.05rem; margin: 0 0 .75rem; display: flex; align-items: center; gap: .5rem; }
.card + .card { margin-top: 1rem; }
.chip { display: inline-flex; align-items: center; gap: .35rem; font-size: .75rem; font-weight: 700; padding: .25rem .6rem; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.chip-live { background: #fee2e2; color: #b91c1c; border-color: #fecaca; }
.chip-live::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #dc2626; animation: pulse 1.4s infinite; }
.chip-open { background: var(--ok-bg); color: #166534; border-color: #bbf7d0; }
.chip-closed { background: #e0e7ff; color: #3730a3; border-color: #c7d2fe; }
.chip-final { background: #111; color: #fff; border-color: #111; }
.chip-draft { background: var(--warn-bg); color: #854d0e; border-color: #fde68a; }
.chip-demo { background: #f3e8ff; color: #6b21a8; border-color: #e9d5ff; }
.chip-archived { opacity: .7; }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.8); } }

/* ---------- Forms ---------- */
.field { display: block; margin-bottom: .95rem; }
.field > span, .label { display: block; font-weight: 700; font-size: .875rem; margin-bottom: .35rem; color: var(--ink-2); }
.field .hint { display: block; font-weight: 400; color: var(--muted); font-size: .8rem; margin-top: .3rem; }
.input, .field input:not([type=checkbox]):not([type=radio]):not([type=color]):not([type=file]), .field select, .field textarea {
  width: 100%; min-height: 48px; padding: .7rem .85rem; border: 1.5px solid var(--line-2); border-radius: 12px; background: #fff;
  font-size: 16px; transition: border-color .15s, box-shadow .15s;
}
.field textarea { min-height: 96px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent); }
.field.invalid input, .field.invalid select { border-color: var(--danger); }
.input-prefix { display: flex; align-items: stretch; }
.input-prefix > b { display: grid; place-items: center; padding: 0 .75rem; border: 1.5px solid var(--line-2); border-right: 0; border-radius: 12px 0 0 12px; background: var(--surface-2); color: var(--muted); font-weight: 600; }
.input-prefix > input { border-radius: 0 12px 12px 0 !important; }
.check { display: flex; gap: .65rem; align-items: flex-start; font-size: .92rem; cursor: pointer; }
.check input { width: 22px; height: 22px; margin-top: 1px; accent-color: var(--brand); flex: none; }
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 0 1rem; }
.grid-3 { display: grid; grid-template-columns: 1fr; gap: 0 1rem; }
@media (min-width: 640px) { .grid-2 { grid-template-columns: 1fr 1fr; } .grid-3 { grid-template-columns: repeat(3, 1fr); } }
.radio-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: .6rem; }
.radio-card { position: relative; display: flex; flex-direction: column; gap: .15rem; padding: .85rem; border: 2px solid var(--line-2); border-radius: 12px; cursor: pointer; background: #fff; font-weight: 700; }
.radio-card small { font-weight: 400; color: var(--muted); }
.radio-card input { position: absolute; opacity: 0; }
.radio-card:has(input:checked) { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 7%, white); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 15%, transparent); }
.radio-card:has(input:focus-visible) { outline: 3px solid var(--brand); }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: .45rem .85rem; border-radius: 9px; font-weight: 700; font-size: .875rem; color: var(--muted); min-height: 36px; }
.seg button[aria-pressed=true] { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }
.error-text { color: var(--danger); font-weight: 600; font-size: .875rem; }
.notice { padding: .8rem 1rem; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); font-size: .9rem; }
.notice.warn { background: var(--warn-bg); border-color: #fde68a; color: #713f12; }
.notice.ok { background: var(--ok-bg); border-color: #bbf7d0; color: #14532d; }
.notice.danger { background: var(--danger-bg); border-color: #fecaca; color: #7f1d1d; }
.notice.info { background: #eff6ff; border-color: #bfdbfe; color: #1e3a8a; }

/* ---------- Loading / toasts ---------- */
.page-loading { min-height: 60vh; display: grid; place-items: center; }
.spinner { width: 42px; height: 42px; border-radius: 50%; border: 4px solid color-mix(in srgb, var(--brand) 20%, transparent); border-top-color: var(--brand); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toasts { position: fixed; left: 50%; transform: translateX(-50%); top: max(12px, env(safe-area-inset-top)); z-index: 300; display: grid; gap: .5rem; width: min(92vw, 420px); pointer-events: none; }
.toast { pointer-events: auto; background: #111; color: #fff; padding: .8rem 1rem; border-radius: 12px; box-shadow: var(--shadow-lg); font-weight: 600; font-size: .92rem; animation: toast-in .25s ease; display: flex; gap: .6rem; align-items: center; }
.toast.ok { background: #14532d; }
.toast.err { background: #991b1b; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }

/* ---------- Site header (tenant) ---------- */
.site-header { background: var(--dark); color: var(--dark-ink); border-bottom: 5px solid var(--brand); position: relative; }
.site-header.hero-brand { background: var(--brand); color: var(--brand-ink); border-bottom-color: var(--dark); }
.site-header.hero-light { background: #fff; color: var(--ink); }
.site-header .inner { max-width: 1240px; margin: 0 auto; padding: 1rem 1rem 1.1rem; display: flex; align-items: center; gap: 1rem; }
.site-header .logo { width: 120px; height: auto; max-height: 92px; object-fit: contain; flex: none; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .35)); }
.site-header .titles { min-width: 0; }
.site-header .team { font-family: var(--font-head); font-weight: 600; text-transform: uppercase; letter-spacing: .08em; font-size: clamp(.95rem, 2.6vw, 1.2rem); opacity: .92; }
.site-header .event { font-family: var(--font-head); font-weight: 700; text-transform: uppercase; font-size: clamp(2rem, 7vw, 3.6rem); line-height: .95; letter-spacing: .01em; margin: .1rem 0 .2rem; }
.site-header .sub { color: color-mix(in srgb, currentColor 70%, transparent); font-weight: 600; text-transform: uppercase; letter-spacing: .12em; font-size: .8rem; }
.site-header .head-actions { margin-left: auto; display: flex; gap: .5rem; align-self: flex-start; }
.site-header .head-actions .btn { --b-bg: rgba(255, 255, 255, .1); --b-fg: currentColor; --b-bd: rgba(255, 255, 255, .25); }
.site-header.hero-light .head-actions .btn { --b-bg: #fff; --b-bd: var(--line-2); }
@media (max-width: 640px) {
  .site-header .inner { flex-direction: column; text-align: center; gap: .4rem; padding-top: .9rem; }
  .site-header .logo { width: 104px; }
  .site-header .head-actions { position: absolute; top: .5rem; right: .5rem; }
  .site-header .head-actions .btn span { display: none; }
}
.demo-banner { background: repeating-linear-gradient(45deg, #6b21a8, #6b21a8 12px, #7e22ce 12px, #7e22ce 24px); color: #fff; text-align: center; padding: .45rem 1rem; font-weight: 700; font-size: .85rem; letter-spacing: .03em; }
.preview-banner { background: #fef9c3; color: #713f12; text-align: center; padding: .5rem 1rem; font-weight: 600; font-size: .9rem; border-bottom: 1px solid #fde68a; }
.site-footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 2rem 1rem calc(6rem + var(--safe-b)); }
.site-footer a { color: inherit; }

/* ---------- Contest layout ---------- */
.contest { max-width: 1240px; margin: 0 auto; padding: 1rem; display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1040px) { .contest { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; padding: 1.5rem 1rem; } .contest .side { position: sticky; top: 1rem; } }
.contest .main { min-width: 0; }
.tabs { display: flex; gap: .25rem; overflow-x: auto; scrollbar-width: none; border-bottom: 2px solid var(--line); margin-bottom: 1rem; position: sticky; top: 0; background: var(--bg); z-index: 20; padding-top: .25rem; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button, .tabs a { border: 0; background: none; padding: .7rem .9rem; font-weight: 800; font-size: .92rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; text-decoration: none; min-height: 44px; }
.tabs [aria-selected=true] { color: var(--ink); border-bottom-color: var(--brand); }
.tabs .count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; background: var(--brand); color: var(--brand-ink); font-size: .7rem; margin-left: .3rem; }

/* Mobile: one section at a time via tabs. Desktop: everything visible, tabs hidden. */
@media (max-width: 1039px) {
  .contest .sec { display: none; }
  .contest[data-tab=board] .sec-board, .contest[data-tab=info] .sec-info, .contest[data-tab=pay] .sec-pay,
  .contest[data-tab=mine] .sec-mine, .contest[data-tab=standings] .sec-standings { display: block; }
  .contest .side .sec-mine { margin-top: 0 !important; }
}
@media (min-width: 1040px) { .mobile-tabs { display: none !important; } .sec-info, .sec-standings { margin-top: 1rem; } }
@media (max-width: 560px) {
  .contest { padding: .5rem; }
  .board-scroller { padding: 4px; }
  .board { --label-w: 18px; --digit-w: 24px; gap: 2px; }
}
.sec-info .card + .card, .sec-standings .card { margin-top: 1rem; }

/* Scorebug */
.scorebug { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: .5rem; background: var(--dark); color: var(--dark-ink); border-radius: var(--radius); padding: .85rem 1rem; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.scorebug::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 6px; background: var(--brand); }
.scorebug .team { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.scorebug .team.right { flex-direction: row-reverse; text-align: right; }
.scorebug .team img { width: 40px; height: 40px; object-fit: contain; flex: none; }
.scorebug .team .tlogo { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .12); font-weight: 800; font-size: .8rem; flex: none; }
.scorebug .tname { font-family: var(--font-head); font-weight: 600; text-transform: uppercase; font-size: .95rem; line-height: 1.05; overflow: hidden; text-overflow: ellipsis; }
.scorebug .tname small { display: block; opacity: .65; font-family: var(--font-body); text-transform: none; font-weight: 500; font-size: .72rem; }
.scorebug .pts { font-family: var(--font-head); font-size: 2.2rem; font-weight: 700; min-width: 2ch; text-align: center; }
.scorebug .mid { text-align: center; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; opacity: .9; }
.scorebug .mid .when { display: block; font-size: .72rem; opacity: .7; font-weight: 500; text-transform: none; letter-spacing: 0; }
.scorebug .axis-tag { display: inline-block; font-size: .62rem; padding: 1px 5px; border-radius: 4px; background: rgba(255, 255, 255, .15); margin-top: 2px; letter-spacing: .05em; }
.linescore { width: 100%; border-collapse: collapse; font-size: .8rem; margin-top: .6rem; color: inherit; }
.linescore th, .linescore td { padding: .2rem .35rem; text-align: center; }
.linescore th { opacity: .6; font-weight: 600; }
.linescore td:first-child, .linescore th:first-child { text-align: left; }
.linescore .tot { font-weight: 800; }
@media (max-width: 480px) { .scorebug .tname { font-size: .8rem; } .scorebug .pts { font-size: 1.8rem; } .scorebug .team img, .scorebug .team .tlogo { width: 30px; height: 30px; } }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; margin: 1rem 0; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: .6rem .7rem; text-align: center; }
.stat b { display: block; font-family: var(--font-head); font-size: 1.5rem; line-height: 1.1; }
.stat span { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.stat.price b { color: var(--brand); }
@media (max-width: 420px) { .stat b { font-size: 1.2rem; } .stat span { font-size: .62rem; } }

/* Legend */
.legend { display: flex; flex-wrap: wrap; gap: .4rem .9rem; margin: .25rem 0 .75rem; font-size: .8rem; font-weight: 600; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: .35rem; }
.legend i { width: 18px; height: 18px; border-radius: 4px; border: 3px solid; display: inline-block; }
.legend .l-a { background: var(--sq-a-bg); border-color: var(--sq-a-bd); }
.legend .l-s { background: var(--sq-selected); border-color: var(--sq-selected); }
.legend .l-u { background: var(--sq-u-bg); border-color: var(--sq-u-bd); }
.legend .l-p { background: var(--sq-p-bg); border-color: var(--sq-p-bd); }
.legend .l-m { background: #111; border-color: #9ca3af; position: relative; }
.legend .l-m::after { content: '★'; position: absolute; inset: -4px -6px auto auto; font-size: 11px; color: #facc15; text-shadow: 0 0 2px #000; font-style: normal; }

/* ---------- Squares board ---------- */
.board-tools { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .5rem; flex-wrap: wrap; }
.board-scroller { overflow: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); padding: .5rem; overscroll-behavior-x: contain; }
.board {
  --n: 10; --cell: minmax(0, 1fr); --label-w: 26px; --digit-w: clamp(22px, 5vw, 40px);
  display: grid; grid-template-columns: var(--label-w) var(--digit-w) repeat(var(--n), var(--cell)); grid-template-rows: auto var(--digit-w) repeat(var(--n), auto);
  gap: 3px; min-width: 300px; user-select: none; -webkit-user-select: none;
}
.board.zoom { --cell: 68px; width: max-content; }
.board.n5.zoom { --cell: 110px; }
.board .top-title { grid-column: 3 / -1; grid-row: 1; text-align: center; font-family: var(--font-head); font-weight: 700; letter-spacing: .14em; text-transform: uppercase; font-size: clamp(.8rem, 2.4vw, 1.15rem); padding: .15rem 0 .3rem; color: var(--ink); }
.board .left-title { grid-column: 1; grid-row: 3 / -1; writing-mode: vertical-rl; transform: rotate(180deg); text-align: center; font-family: var(--font-head); font-weight: 700; letter-spacing: .14em; text-transform: uppercase; font-size: clamp(.8rem, 2.4vw, 1.15rem); color: var(--ink); display: flex; align-items: center; justify-content: center; }
.board .corner { grid-column: 2; grid-row: 2; }
.board .digit { display: grid; place-items: center; background: var(--dark); color: var(--dark-ink); font-family: var(--font-head); font-weight: 700; font-size: clamp(.85rem, 2.8vw, 1.3rem); border-radius: 6px; min-height: var(--digit-w); }
.board .digit.hidden-digit { background: var(--charcoal); color: color-mix(in srgb, var(--dark-ink) 55%, transparent); }
.board .digit.hl { background: var(--brand); color: var(--brand-ink); }
.board .digit small { font-size: .7em; letter-spacing: .1em; }
.square {
  position: relative; aspect-ratio: 1; border: 4px solid; border-radius: 6px; padding: 0; display: grid; place-items: center; overflow: hidden;
  font-weight: 700; font-size: clamp(.55rem, 1.9vw, .85rem); line-height: 1.05; text-align: center; transition: transform .08s, box-shadow .2s; min-width: 0; touch-action: manipulation;
}
.square .num { font-family: var(--font-head); font-size: clamp(.7rem, 2.6vw, 1.1rem); font-weight: 600; }
.square .nm { display: block; padding: 0 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; font-size: clamp(.5rem, 1.6vw, .78rem); }
.square .st { display: block; font-size: clamp(.42rem, 1.1vw, .6rem); text-transform: uppercase; letter-spacing: .04em; opacity: .75; }
.square .corner-num { position: absolute; top: 1px; left: 3px; font-size: clamp(.4rem, 1vw, .58rem); opacity: .55; font-weight: 600; }
.square.available { background: var(--sq-a-bg); border-color: var(--sq-a-bd); color: var(--sq-a-fg); }
.square.available:hover { filter: brightness(1.04); transform: scale(1.03); }
.square.selected { background: var(--sq-selected); border-color: var(--sq-selected); color: #fff; animation: pop .18s ease; }
.square.reserved-unpaid { background: var(--sq-u-bg); border-color: var(--sq-u-bd); color: #fff; }
.square.reserved-paid { background: var(--sq-p-bg); border-color: var(--sq-p-bd); color: #fff; }
.square.locked { cursor: default; }
.square.mine::after { content: '★'; position: absolute; top: -1px; right: 1px; font-size: clamp(.55rem, 1.6vw, .8rem); color: #facc15; text-shadow: 0 0 3px rgba(0, 0, 0, .9); }
.board.dim-others .square:not(.mine):not(.selected) { opacity: .28; }
.square.winner { box-shadow: 0 0 0 3px #fff, 0 0 0 6px #f59e0b, 0 0 18px 4px rgba(245, 158, 11, .7); z-index: 2; }
.square .wtag { position: absolute; bottom: 0; left: 0; right: 0; background: #f59e0b; color: #111; font-size: clamp(.4rem, 1vw, .58rem); font-weight: 800; letter-spacing: .03em; text-transform: uppercase; line-height: 1.4; }
.square.live { animation: live-ring 1.2s ease-in-out infinite; z-index: 3; }
@keyframes live-ring { 0%, 100% { box-shadow: 0 0 0 2px #fff, 0 0 0 5px var(--brand); } 50% { box-shadow: 0 0 0 2px #fff, 0 0 0 9px color-mix(in srgb, var(--brand) 40%, transparent); } }
@keyframes pop { 50% { transform: scale(1.1); } }
.board.n5 .square { font-size: clamp(.7rem, 2.4vw, 1rem); }
.board.n5 .square .nm { font-size: clamp(.6rem, 2.2vw, .95rem); }
.board.n5 .digit { font-size: clamp(.7rem, 2.2vw, 1.05rem); }
.closed-note { margin: .5rem 0 0; }

/* Winners strip */
.periods { display: grid; grid-template-columns: repeat(2, 1fr); gap: .5rem; }
@media (min-width: 560px) { .periods { grid-template-columns: repeat(4, 1fr); } }
.period { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: .55rem .7rem; position: relative; overflow: hidden; min-width: 0; }
.period .p-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 800; color: var(--muted); }
.period .p-amt { font-family: var(--font-head); font-size: 1.2rem; font-weight: 700; line-height: 1.2; }
.period .p-who { font-weight: 700; font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.period .p-score { font-size: .78rem; color: var(--muted); }
.period.done { border-color: #f59e0b; background: linear-gradient(180deg, #fffbeb, #fff); }
.period.done::after { content: '🏆'; position: absolute; top: .4rem; right: .55rem; font-size: 1.1rem; }
.period.rolled { border-style: dashed; }
.period.mine { box-shadow: 0 0 0 3px #facc15; }
.period.live { border-color: var(--brand); }

/* Checkout bar */
.checkout-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 90; padding: .65rem .85rem calc(.65rem + var(--safe-b)); background: rgba(17, 17, 17, .96); color: #fff; display: flex; gap: .75rem; align-items: center; transform: translateY(110%); transition: transform .25s cubic-bezier(.2, .8, .2, 1); backdrop-filter: blur(8px); box-shadow: 0 -8px 30px rgba(0, 0, 0, .25); }
.checkout-bar.show { transform: none; }
.checkout-bar:not(.show) { visibility: hidden; transition: transform .25s, visibility 0s .25s; }
.checkout-bar .sum { flex: 1; min-width: 0; line-height: 1.2; }
.checkout-bar .sum b { font-size: 1.05rem; }
.checkout-bar .sum small { display: block; opacity: .7; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.checkout-bar .btn-ghost { --b-fg: #fff; }
@media (min-width: 1040px) { .checkout-bar { left: 50%; right: auto; bottom: 1rem; width: 620px; transform: translate(-50%, 140%); border-radius: 16px; padding-bottom: .65rem; } .checkout-bar.show { transform: translate(-50%, 0); } }

/* Sheet / modal */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, .55); z-index: 200; display: flex; align-items: flex-end; justify-content: center; animation: fade .2s ease; }
.sheet { background: #fff; width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; border-radius: 20px 20px 0 0; padding: 0 1.1rem calc(1.1rem + var(--safe-b)); box-shadow: var(--shadow-lg); animation: up .28s cubic-bezier(.2, .8, .2, 1); overscroll-behavior: contain; }
.sheet.wide { max-width: 760px; }
.sheet-head { position: sticky; top: 0; background: #fff; z-index: 2; display: flex; align-items: center; gap: .5rem; padding: .9rem 0 .6rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; }
.sheet-head::before { content: ''; position: absolute; top: 6px; left: 50%; transform: translateX(-50%); width: 40px; height: 4px; border-radius: 4px; background: var(--line-2); }
.sheet-head h2 { margin: 0; flex: 1; font-size: 1.3rem; text-transform: uppercase; }
.sheet-foot { position: sticky; bottom: calc(-1.1rem - var(--safe-b)); background: #fff; padding: .8rem 0 calc(.2rem + var(--safe-b)); border-top: 1px solid var(--line); margin-top: 1rem; display: flex; gap: .6rem; }
@media (min-width: 640px) { .sheet-backdrop { align-items: center; } .sheet { border-radius: 20px; max-height: 88vh; } .sheet-head::before { display: none; } }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.sel-list { display: flex; flex-wrap: wrap; gap: .35rem; }
.sel-pill { display: inline-flex; align-items: center; gap: .3rem; background: var(--sq-selected); color: #fff; font-weight: 800; border-radius: 8px; padding: .2rem .55rem; font-size: .85rem; }
.sel-pill button { border: 0; background: rgba(255, 255, 255, .25); color: #fff; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: .7rem; padding: 0; }
.total-line { display: flex; justify-content: space-between; align-items: baseline; padding: .75rem 0; border-top: 1px dashed var(--line-2); border-bottom: 1px dashed var(--line-2); margin: .75rem 0 1rem; }
.total-line b { font-family: var(--font-head); font-size: 1.6rem; }

/* Receipt */
.receipt { text-align: center; }
.receipt .check-icon { width: 64px; height: 64px; margin: .5rem auto .75rem; border-radius: 50%; background: var(--ok-bg); color: var(--ok); display: grid; place-items: center; font-size: 2rem; }
.receipt .ref { font-family: ui-monospace, Menlo, monospace; font-size: 1.6rem; font-weight: 800; letter-spacing: .08em; background: var(--surface-2); border: 2px dashed var(--line-2); border-radius: 12px; padding: .5rem 1rem; display: inline-block; margin: .25rem 0 .75rem; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: .35rem 1rem; text-align: left; font-size: .92rem; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; font-weight: 700; }

/* Payment panel */
.pay-panel { border: 2px solid var(--dark); border-radius: var(--radius); overflow: hidden; background: #fff; }
.pay-panel .pay-head { background: var(--dark); color: var(--dark-ink); padding: .6rem 1rem; font-family: var(--font-head); text-transform: uppercase; letter-spacing: .08em; font-weight: 700; display: flex; justify-content: space-between; align-items: center; }
.pay-panel .pay-body { padding: 1rem; }
.qr-box { width: 180px; max-width: 100%; aspect-ratio: 1; margin: 0 auto .6rem; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: #fff; display: grid; place-items: center; }
.qr-box img { width: 100%; height: 100%; object-fit: contain; }
.qr-placeholder { border: 2px dashed var(--line-2); color: var(--muted); font-weight: 700; font-size: .85rem; text-align: center; padding: 1rem; background: repeating-linear-gradient(45deg, #f8fafc, #f8fafc 10px, #f1f5f9 10px, #f1f5f9 20px); }
.venmo-handle { text-align: center; font-weight: 800; font-size: 1.1rem; color: #008CFF; }
.pay-method { padding: .75rem 0; border-top: 1px solid var(--line); }
.pay-method:first-child { border-top: 0; padding-top: 0; }
.pay-method h4 { font-family: var(--font-body); font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: .35rem; }

/* Payout table */
.payout-list { list-style: none; padding: 0; margin: 0; }
.payout-list li { display: flex; justify-content: space-between; padding: .5rem 0; border-bottom: 1px solid var(--line); font-weight: 600; }
.payout-list li:last-child { border-bottom: 0; }
.payout-list b { font-family: var(--font-head); font-size: 1.1rem; }
.rich { font-size: .95rem; white-space: pre-line; color: var(--ink-2); }

/* My squares */
.mine-list { display: grid; gap: .6rem; }
.mine-item { border: 1px solid var(--line); border-radius: 12px; padding: .75rem; display: grid; gap: .25rem; }
.mine-item .sqs { display: flex; flex-wrap: wrap; gap: .3rem; }
.mini-sq-tag { display: inline-grid; place-items: center; min-width: 34px; height: 28px; padding: 0 .35rem; border-radius: 6px; border: 3px solid var(--sq-u-bd); background: #111; color: #fff; font-weight: 800; font-size: .8rem; }
.mini-sq-tag.paid { border-color: var(--sq-p-bd); }

/* ---------- Pick'em ---------- */
.games-list { display: grid; gap: .75rem; }
.game-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem; box-shadow: var(--shadow-sm); }
.game-card .g-head { display: flex; justify-content: space-between; align-items: center; font-size: .78rem; color: var(--muted); font-weight: 600; margin-bottom: .5rem; gap: .5rem; }
.game-card .g-teams { display: grid; grid-template-columns: 1fr auto 1fr; gap: .5rem; align-items: stretch; }
.game-card .vs { align-self: center; font-weight: 800; color: var(--muted); font-size: .8rem; }
.team-btn { --tc: var(--brand); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .3rem; border: 2.5px solid var(--line-2); border-radius: 14px; background: #fff; padding: .7rem .4rem; min-height: 96px; font-weight: 800; text-align: center; transition: all .15s; position: relative; }
.team-btn img { width: 44px; height: 44px; object-fit: contain; }
.team-btn .tlogo { width: 44px; height: 44px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-size: .8rem; }
.team-btn .tn { font-size: .85rem; line-height: 1.1; }
.team-btn .rec { font-size: .7rem; color: var(--muted); font-weight: 600; }
.team-btn .sc { font-family: var(--font-head); font-size: 1.5rem; }
.team-btn[aria-pressed=true] { border-color: var(--tc); background: color-mix(in srgb, var(--tc) 10%, white); box-shadow: 0 0 0 3px color-mix(in srgb, var(--tc) 25%, transparent); }
.team-btn[aria-pressed=true]::after { content: '✓'; position: absolute; top: 6px; right: 8px; width: 22px; height: 22px; border-radius: 50%; background: var(--tc); color: #fff; display: grid; place-items: center; font-size: .75rem; }
.team-btn:disabled { cursor: default; }
.team-btn.won { border-color: var(--ok); }
.team-btn.lost { opacity: .55; }
.conf-row { display: flex; align-items: center; gap: .5rem; margin-top: .6rem; font-size: .85rem; font-weight: 700; }
.conf-row select { min-height: 40px; border-radius: 10px; border: 1.5px solid var(--line-2); padding: .3rem .5rem; font-weight: 800; }
.leader-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.leader-table th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: .5rem; border-bottom: 2px solid var(--line); }
.leader-table td { padding: .6rem .5rem; border-bottom: 1px solid var(--line); }
.leader-table tr.mine td { background: #fefce8; }
.leader-table .rank { font-family: var(--font-head); font-size: 1.1rem; width: 2.5rem; }
.leader-table .pts { font-family: var(--font-head); font-size: 1.2rem; text-align: right; }
.pick-dots { display: flex; gap: 3px; flex-wrap: wrap; margin-top: 3px; }
.pick-dot { font-size: .62rem; font-weight: 800; padding: 1px 4px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--line); }
.pick-dot.w { background: var(--ok-bg); border-color: #86efac; color: #166534; }
.pick-dot.l { background: var(--danger-bg); border-color: #fecaca; color: #991b1b; text-decoration: line-through; }

/* ---------- Tenant home ---------- */
.home-wrap { max-width: 1100px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
.pool-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 1rem; }
.pool-card { display: flex; flex-direction: column; text-decoration: none; background: #fff; border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--shadow-sm); overflow: hidden; transition: transform .15s, box-shadow .15s; }
.pool-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.pool-card .pc-top { background: var(--dark); color: var(--dark-ink); padding: 1rem; border-bottom: 4px solid var(--brand); }
.pool-card .pc-top h3 { font-size: 1.4rem; text-transform: uppercase; margin: .3rem 0 0; }
.pool-card .pc-body { padding: 1rem; display: grid; gap: .5rem; flex: 1; }
.pool-card .bar { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; }
.pool-card .bar i { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.pool-card .pc-cta { margin-top: auto; }
.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty .big { font-size: 2.5rem; }

/* ---------- Auth ---------- */
.auth-page { background: radial-gradient(1200px 600px at 10% -10%, color-mix(in srgb, var(--brand) 22%, transparent), transparent), var(--dark); min-height: 100vh; }
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem 1rem; }
.auth-card { width: min(100%, 460px); background: #fff; border-radius: 20px; box-shadow: var(--shadow-lg); padding: 1.6rem 1.4rem; }
.auth-card.wide { width: min(100%, 620px); }
.auth-brand { display: flex; align-items: center; gap: .6rem; justify-content: center; margin-bottom: 1rem; text-decoration: none; }
.auth-brand img { height: 48px; width: auto; }
.auth-brand b { font-family: var(--font-head); font-size: 1.3rem; text-transform: uppercase; letter-spacing: .04em; }
.auth-card h1 { font-size: 1.7rem; text-align: center; text-transform: uppercase; }
.auth-alt { text-align: center; font-size: .9rem; color: var(--muted); margin-top: 1rem; }
.auth-alt a { color: var(--brand); font-weight: 700; }
.slug-preview { font-size: .85rem; color: var(--muted); margin-top: .3rem; }
.slug-preview b { color: var(--ink); }
.slug-preview .ok { color: var(--ok); font-weight: 700; }
.slug-preview .bad { color: var(--danger); font-weight: 700; }

/* ---------- Admin ---------- */
.admin-page { background: #f1f5f9; }
@media (max-width: 959px) { .hide-mobile { display: none; } }
.admin { display: grid; grid-template-columns: 1fr; min-height: 100vh; }
.admin-side { background: var(--dark); color: var(--dark-ink); padding: .75rem 1rem; display: flex; align-items: center; gap: .75rem; position: sticky; top: 0; z-index: 50; border-bottom: 4px solid var(--brand); }
.admin-side .brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; min-width: 0; flex: 1; }
.admin-side .brand img { height: 36px; width: auto; max-width: 70px; object-fit: contain; }
.admin-side .brand b { font-family: var(--font-head); text-transform: uppercase; font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-side .brand small { display: block; font-size: .7rem; opacity: .65; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.admin-nav { display: none; }
.admin-nav a { display: flex; align-items: center; gap: .65rem; padding: .7rem .85rem; border-radius: 10px; text-decoration: none; font-weight: 700; opacity: .8; }
.admin-nav a:hover { background: rgba(255, 255, 255, .08); opacity: 1; }
.admin-nav a[aria-current=page] { background: var(--brand); color: var(--brand-ink); opacity: 1; }
.admin-nav .ico { width: 22px; text-align: center; }
.admin-mobile-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; background: #fff; border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(4, 1fr); padding-bottom: var(--safe-b); }
.admin-mobile-nav a { display: grid; place-items: center; gap: 2px; padding: .5rem 0; font-size: .7rem; font-weight: 700; text-decoration: none; color: var(--muted); min-height: 56px; }
.admin-mobile-nav a .ico { font-size: 1.2rem; }
.admin-mobile-nav a[aria-current=page] { color: var(--brand); }
.admin-main { padding: 1rem 1rem calc(6rem + var(--safe-b)); max-width: 1180px; width: 100%; margin: 0 auto; min-width: 0; }
.user-menu { position: relative; }
.user-menu > button { background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .2); color: inherit; border-radius: 999px; width: 38px; height: 38px; font-weight: 800; }
.menu { position: absolute; right: 0; top: calc(100% + 8px); background: #fff; color: var(--ink); border-radius: 12px; box-shadow: var(--shadow-lg); min-width: 230px; padding: .4rem; z-index: 100; border: 1px solid var(--line); }
.menu a, .menu button { display: block; width: 100%; text-align: left; padding: .6rem .75rem; border-radius: 8px; text-decoration: none; border: 0; background: none; font-weight: 600; font-size: .92rem; }
.menu a:hover, .menu button:hover { background: var(--surface-2); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: .3rem 0; }
.menu .who { padding: .5rem .75rem; font-size: .8rem; color: var(--muted); }
@media (min-width: 960px) {
  .admin { grid-template-columns: 250px 1fr; }
  .admin-side { flex-direction: column; align-items: stretch; height: 100vh; padding: 1.1rem .8rem; border-bottom: 0; border-right: 4px solid var(--brand); }
  .admin-side .brand { flex: none; padding: 0 .4rem .9rem; border-bottom: 1px solid rgba(255, 255, 255, .12); margin-bottom: .6rem; }
  .admin-side .brand img { height: 46px; }
  .admin-nav { display: grid; gap: .2rem; }
  .admin-side .side-foot { margin-top: auto; display: flex; align-items: center; gap: .6rem; padding: .5rem; }
  .admin-mobile-nav { display: none; }
  .admin-main { padding: 1.75rem 2rem 3rem; }
}
.page-head { display: flex; align-items: flex-start; gap: .75rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-head h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); text-transform: uppercase; margin: 0; }
.page-head .actions { margin-left: auto; display: flex; gap: .5rem; flex-wrap: wrap; }
.back-link { display: inline-flex; align-items: center; gap: .3rem; color: var(--muted); font-weight: 700; text-decoration: none; font-size: .85rem; margin-bottom: .35rem; }
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; margin-bottom: 1.25rem; }
@media (min-width: 760px) { .kpis { grid-template-columns: repeat(4, 1fr); } }
.kpi { background: #fff; border-radius: var(--radius); padding: .9rem 1rem; border: 1px solid var(--line); }
.kpi span { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 800; }
.kpi b { display: block; font-family: var(--font-head); font-size: 1.7rem; line-height: 1.15; }
.kpi small { color: var(--muted); font-size: .78rem; }
.contest-rows { display: grid; gap: .75rem; }
.contest-row { display: grid; grid-template-columns: 1fr auto; gap: .5rem 1rem; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; text-decoration: none; transition: box-shadow .15s; }
.contest-row:hover { box-shadow: var(--shadow); }
.contest-row h3 { margin: 0; font-size: 1.15rem; text-transform: uppercase; }
.contest-row .meta { font-size: .82rem; color: var(--muted); display: flex; gap: .4rem .8rem; flex-wrap: wrap; align-items: center; }
.contest-row .progress { grid-column: 1 / -1; height: 6px; background: var(--line); border-radius: 9px; overflow: hidden; }
.contest-row .progress i { display: block; height: 100%; background: var(--brand); }
.table-wrap { overflow-x: auto; background: #fff; border-radius: var(--radius); border: 1px solid var(--line); }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: .7rem .75rem; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: .7rem .75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table .actions-cell { white-space: nowrap; text-align: right; }
@media (max-width: 760px) {
  .table.cards thead { display: none; }
  .table.cards, .table.cards tbody, .table.cards tr, .table.cards td { display: block; width: 100%; }
  .table.cards tr { padding: .75rem; border-bottom: 1px solid var(--line); }
  .table.cards td { border: 0; padding: .15rem 0; }
  .table.cards td[data-label]::before { content: attr(data-label) ': '; font-weight: 700; color: var(--muted); font-size: .78rem; }
  .table.cards .actions-cell { text-align: left; padding-top: .5rem; }
}
.pay-badge { display: inline-flex; align-items: center; gap: .3rem; font-size: .72rem; font-weight: 800; padding: .2rem .5rem; border-radius: 6px; text-transform: uppercase; border: 2px solid; }
.pay-badge.paid { color: #166534; border-color: #22c55e; background: var(--ok-bg); }
.pay-badge.unpaid { color: #854d0e; border-color: #facc15; background: var(--warn-bg); }
.pay-badge.released { color: var(--muted); border-color: var(--line-2); background: var(--surface-2); }
.filters { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .75rem; align-items: center; }
.filters .input { min-height: 42px; padding: .5rem .75rem; width: auto; flex: 1 1 200px; }
.filters select.input { flex: 0 1 160px; }
.wizard-steps { display: flex; gap: .35rem; margin-bottom: 1.25rem; overflow-x: auto; }
.wizard-steps span { flex: 1; min-width: 80px; font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding-top: .5rem; border-top: 4px solid var(--line); }
.wizard-steps span.on { color: var(--ink); border-top-color: var(--brand); }
.type-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: .75rem; }
.type-card { text-align: left; border: 2px solid var(--line-2); background: #fff; border-radius: var(--radius); padding: 1rem; display: grid; gap: .35rem; }
.type-card[aria-pressed=true] { border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent); }
.type-card .ill { height: 64px; display: grid; place-items: center; font-size: 2rem; background: var(--surface-2); border-radius: 10px; }
.type-card b { font-family: var(--font-head); text-transform: uppercase; font-size: 1.1rem; }
.type-card small { color: var(--muted); }
.sched-bar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: .75rem; }
.chips-scroll { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .4rem; scrollbar-width: thin; }
.chips-scroll button { flex: none; border: 1.5px solid var(--line-2); background: #fff; border-radius: 999px; padding: .4rem .8rem; font-weight: 700; font-size: .82rem; min-height: 36px; }
.chips-scroll button[aria-pressed=true] { background: var(--dark); color: var(--dark-ink); border-color: var(--dark); }
.sched-list { display: grid; gap: .5rem; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.sched-game { display: grid; grid-template-columns: 1fr auto; gap: .5rem; align-items: center; border: 2px solid var(--line); background: #fff; border-radius: 12px; padding: .65rem .75rem; text-align: left; }
.sched-game[aria-pressed=true] { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 6%, white); }
.sched-game .tm { display: flex; align-items: center; gap: .4rem; font-weight: 700; font-size: .9rem; }
.sched-game .tm img { width: 22px; height: 22px; object-fit: contain; }
.sched-game .when { grid-column: 1 / -1; font-size: .75rem; color: var(--muted); font-weight: 600; }
.sched-game .pick-ind { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line-2); display: grid; place-items: center; font-size: .8rem; color: #fff; }
.sched-game[aria-pressed=true] .pick-ind { background: var(--brand); border-color: var(--brand); }
.color-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .75rem; }
.color-field { display: flex; align-items: center; gap: .6rem; border: 1.5px solid var(--line-2); border-radius: 12px; padding: .45rem .6rem; background: #fff; }
.color-field input[type=color] { width: 40px; height: 40px; border: 0; padding: 0; background: none; border-radius: 8px; cursor: pointer; }
.color-field span { font-size: .8rem; font-weight: 700; line-height: 1.15; }
.color-field small { display: block; color: var(--muted); font-family: ui-monospace, monospace; font-weight: 500; }
.presets { display: flex; flex-wrap: wrap; gap: .5rem; }
.preset { border: 2px solid var(--line); border-radius: 12px; padding: .35rem .6rem .35rem .35rem; background: #fff; display: inline-flex; align-items: center; gap: .45rem; font-weight: 700; font-size: .82rem; }
.preset i { width: 26px; height: 26px; border-radius: 8px; display: inline-block; }
.brand-preview { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow); background: var(--pv-bg); }
.brand-preview .pv-head { background: var(--pv-dark); color: #fff; padding: 1rem; border-bottom: 5px solid var(--pv-primary); display: flex; gap: .8rem; align-items: center; }
.brand-preview .pv-head img { width: 64px; height: 56px; object-fit: contain; }
.brand-preview .pv-team { font-family: var(--pv-body); text-transform: uppercase; font-size: .78rem; letter-spacing: .08em; opacity: .85; font-weight: 700; }
.brand-preview .pv-title { font-family: var(--pv-head); font-size: 1.8rem; text-transform: uppercase; line-height: 1; font-weight: 700; }
.brand-preview .pv-body { padding: 1rem; font-family: var(--pv-body); display: grid; gap: .75rem; }
.brand-preview .pv-btn { background: var(--pv-primary); color: #fff; border-radius: 10px; padding: .6rem 1rem; font-weight: 800; display: inline-block; }
.brand-preview .pv-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 3px; }
.brand-preview .pv-grid i { aspect-ratio: 1; border: 3px solid; border-radius: 4px; }
.logo-drop { border: 2px dashed var(--line-2); border-radius: var(--radius); padding: 1rem; display: flex; gap: 1rem; align-items: center; background: #fff; }
.logo-drop img { width: 96px; height: 80px; object-fit: contain; background: repeating-conic-gradient(#f1f5f9 0 25%, #fff 0 50%) 0 0 / 16px 16px; border-radius: 8px; }
.admin-board .square { cursor: pointer; }
.sim-panel { background: linear-gradient(135deg, #2e1065, #4c1d95); color: #fff; border-radius: var(--radius); padding: 1rem; }
.sim-panel .btn { --b-bg: rgba(255, 255, 255, .12); --b-fg: #fff; --b-bd: rgba(255, 255, 255, .25); }
.sim-panel .btn-primary { --b-bg: #facc15; --b-fg: #111; --b-bd: #facc15; }
.sim-panel h3 { color: #fff; }
.score-entry { display: grid; grid-template-columns: 1.4fr repeat(5, minmax(42px, 1fr)) .8fr; gap: .35rem; align-items: center; font-size: .85rem; }
.score-entry input { min-height: 42px !important; text-align: center; padding: .3rem !important; }
.score-entry .h { font-weight: 800; font-size: .72rem; color: var(--muted); text-transform: uppercase; text-align: center; }
.share-box { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.share-box img { width: 150px; height: 150px; border: 1px solid var(--line); border-radius: 12px; padding: 6px; background: #fff; }
.copy-field { display: flex; gap: .4rem; }
.copy-field input { flex: 1; min-width: 0; }
.audit-list { list-style: none; margin: 0; padding: 0; font-size: .85rem; }
.audit-list li { padding: .5rem 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: auto 1fr; gap: .1rem .75rem; }
.audit-list time { color: var(--muted); font-size: .78rem; white-space: nowrap; }
.welcome { background: linear-gradient(120deg, var(--dark), color-mix(in srgb, var(--brand) 60%, var(--dark))); color: #fff; border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1.25rem; }
.welcome h2 { color: #fff; }
.welcome .btn { --b-bg: #fff; --b-fg: #111; --b-bd: #fff; }
.checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: .4rem; }
.checklist li { display: flex; gap: .5rem; align-items: center; font-weight: 600; font-size: .92rem; }
.checklist li::before { content: '○'; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); color: var(--muted); font-size: .8rem; flex: none; }
.checklist li.done::before { content: '✓'; background: var(--ok); color: #fff; }

/* ---------- Error page ---------- */
.error-wrap { min-height: 80vh; display: grid; place-items: center; padding: 1rem; }
.error-card { text-align: center; max-width: 460px; }
.error-code { font-family: var(--font-head); font-size: 6rem; font-weight: 700; color: var(--brand); line-height: 1; }

/* ---------- Landing (marketing) ---------- */
.landing { background: #fff; }
.mk-nav { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem clamp(1rem, 4vw, 3rem); position: sticky; top: 0; background: rgba(255, 255, 255, .9); backdrop-filter: blur(10px); z-index: 30; border-bottom: 1px solid var(--line); }
.mk-logo { display: flex; align-items: center; gap: .55rem; text-decoration: none; font-family: var(--font-head); font-size: 1.35rem; text-transform: uppercase; letter-spacing: .02em; }
.mk-logo b { color: var(--brand); }
.mk-mark { width: 36px; height: 36px; border-radius: 10px; background: var(--dark); color: #fff; display: grid; place-items: center; font-size: 1rem; border-bottom: 3px solid var(--brand); }
.mk-nav nav { display: flex; align-items: center; gap: 1.1rem; font-weight: 600; font-size: .95rem; }
.mk-nav nav a:not(.btn) { text-decoration: none; color: var(--ink-2); }
@media (max-width: 760px) { .mk-nav nav a:not(.btn):not(.mk-signin) { display: none; } }
.mk-hero { display: grid; grid-template-columns: 1fr; gap: 2rem; padding: clamp(2rem, 6vw, 5rem) clamp(1rem, 4vw, 3rem); max-width: 1240px; margin: 0 auto; align-items: center; }
@media (min-width: 960px) { .mk-hero { grid-template-columns: 1.15fr .85fr; } }
.mk-eyebrow { font-weight: 800; color: var(--brand); text-transform: uppercase; letter-spacing: .12em; font-size: .8rem; }
.mk-hero h1 { font-size: clamp(2.4rem, 6.5vw, 4.4rem); text-transform: uppercase; line-height: .98; }
.mk-hero h1 span { color: var(--brand); }
.mk-lead { font-size: clamp(1.05rem, 2vw, 1.25rem); color: var(--ink-2); max-width: 40rem; }
.mk-cta { display: flex; gap: .75rem; flex-wrap: wrap; margin: 1.5rem 0 1rem; }
.mk-cta.center { justify-content: center; }
.mk-proof { display: flex; gap: 1.2rem; flex-wrap: wrap; list-style: none; padding: 0; margin: 0; color: var(--muted); font-weight: 600; font-size: .9rem; }
.mk-proof li::before { content: '✓ '; color: var(--ok); font-weight: 800; }
.mk-hero-art { display: grid; place-items: center; }
.mk-phone { width: min(100%, 340px); background: #0b1220; border-radius: 34px; padding: 14px; box-shadow: 0 40px 80px rgba(37, 99, 235, .25), 0 10px 30px rgba(0, 0, 0, .3); border: 3px solid #1e293b; transform: rotate(2deg); }
.mk-phone-head { color: #fff; text-align: center; padding: .6rem 0 .5rem; border-bottom: 3px solid #ff001b; margin-bottom: .6rem; font-family: var(--font-head); }
.mk-phone-head b { display: block; letter-spacing: .1em; font-size: .85rem; opacity: .8; }
.mk-phone-head small { display: block; font-size: 1.4rem; font-weight: 700; }
.mk-dot { display: block; width: 50px; height: 6px; border-radius: 6px; background: #1e293b; margin: 0 auto .5rem; }
.mk-score { display: flex; justify-content: space-between; align-items: center; color: #fff; font-family: var(--font-head); font-size: .95rem; background: #111827; border-radius: 10px; padding: .4rem .6rem; margin-bottom: .6rem; }
.mk-score b { font-size: 1.3rem; }
.mk-score em { font-style: normal; font-size: .72rem; background: #dc2626; padding: 2px 6px; border-radius: 4px; }
.mini-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 2px; }
.mini-sq { aspect-ratio: 1; border-radius: 2px; border: 2px solid; }
.mini-sq.a { background: #d1d5db; border-color: #9ca3af; }
.mini-sq.u { background: #111; border-color: #facc15; }
.mini-sq.p { background: #111; border-color: #22c55e; }
.mini-sq.win { background: #dc2626; border-color: #f59e0b; box-shadow: 0 0 8px #f59e0b; }
.mk-phone-bar { margin-top: .6rem; background: #dc2626; color: #fff; border-radius: 10px; padding: .55rem .7rem; display: flex; justify-content: space-between; font-weight: 700; font-size: .85rem; }
.mk-section { padding: clamp(2.5rem, 6vw, 5rem) clamp(1rem, 4vw, 3rem); max-width: 1240px; margin: 0 auto; }
.mk-section h2 { text-align: center; text-transform: uppercase; font-size: clamp(1.7rem, 4vw, 2.6rem); margin-bottom: 2rem; }
.mk-alt { background: var(--bg); max-width: none; }
.mk-alt > * { max-width: 1240px; margin-left: auto; margin-right: auto; }
.mk-features { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }
.mk-features article { border: 1px solid var(--line); border-radius: 16px; padding: 1.25rem; background: #fff; }
.mk-features i { font-style: normal; font-size: 1.6rem; }
.mk-features h3 { margin-top: .5rem; text-transform: uppercase; }
.mk-features p { color: var(--ink-2); font-size: .95rem; margin: 0; }
.mk-types { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1rem; }
.mk-types article { background: #fff; border-radius: 16px; padding: 1.25rem; border-top: 5px solid var(--brand); box-shadow: var(--shadow-sm); }
.mk-types h3 { text-transform: uppercase; }
.mk-note { text-align: center; color: var(--ink-2); margin-top: 1.5rem; }
.mk-steps { list-style: none; counter-reset: s; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }
.mk-steps li { counter-increment: s; background: var(--dark); color: #fff; border-radius: 16px; padding: 1.4rem; display: grid; gap: .3rem; }
.mk-steps li::before { content: counter(s); font-family: var(--font-head); font-size: 2.5rem; color: var(--accent); line-height: 1; }
.mk-steps b { font-family: var(--font-head); text-transform: uppercase; font-size: 1.2rem; }
.mk-steps span { opacity: .8; }
.mk-footer { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: 1.5rem clamp(1rem, 4vw, 3rem); border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; }

/* ---------- Print ---------- */
@media print {
  @page { size: landscape; margin: 10mm; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body { background: #fff; }
  .no-print, .checkout-bar, .tabs, .toasts, .site-footer, .board-tools, .demo-banner, .preview-banner, .head-actions, .side, .admin-side, .admin-mobile-nav { display: none !important; }
  .contest .sec { display: none !important; }
  .contest .sec-board, .contest .sec-standings { display: block !important; }
  .contest { display: block; padding: 0; max-width: none; }
  .site-header { border-bottom-width: 4px; }
  .site-header .inner { padding: .4rem 0; flex-direction: row; text-align: left; }
  .site-header .logo { width: 80px; }
  .site-header .event { font-size: 2rem; }
  .board-scroller { border: 0; box-shadow: none; padding: 0; overflow: visible; }
  .board, .board.zoom { --cell: minmax(0, 1fr); width: 100%; }
  .square.mine::after { display: none; }
  .square .nm { white-space: normal; }
  .print-only { display: block !important; }
  .scorebug { box-shadow: none; }
}
.print-only { display: none; }
.print-mode .tabs, .print-mode .checkout-bar, .print-mode .board-tools { display: none; }
