/* Taskmaster Fantasy League
   ---------------------------------------------------------------
   Mobile is the bulk of play: ninety seconds, four taps, once a week.
   Desktop is the same codebase at a wider breakpoint, plus the browsing
   surfaces that are genuinely desktop-shaped.

   The design language is the scoreboard: stacked bands, heavy numerals, a
   five-step scale. The signature is the point bar, which is the scoreboard
   atomised down to a single glyph and reused everywhere a score appears.
*/

@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,600;12..96,800&family=IBM+Plex+Mono:wght@500;600&family=IBM+Plex+Sans:wght@400;500;600&display=swap');

:root {
  --ink:     #12161B;
  --surface: #1A1F27;
  --raised:  #232935;
  --border:  #2E3643;
  --gold:    #E8B33C;
  --red:     #D6402F;
  --green:   #4FA96A;
  --text:    #EDEAE3;
  --muted:   #828D9E;
  --faint:   #5A6472;

  --display: 'Bricolage Grotesque', system-ui, sans-serif;
  --body:    'IBM Plex Sans', system-ui, sans-serif;
  --mono:    'IBM Plex Mono', ui-monospace, monospace;

  --r: 5px;
  --tab-h: 58px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  background: var(--ink);
  color: var(--text);
  font-family: var(--body);
  font-size: 15px;
  min-height: 100%;
}

body { padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom)); }

/* ---------------------------------------------------------------- head */

header {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--ink); z-index: 10;
}
.wordmark {
  font-family: var(--display); font-weight: 800; font-size: 15px;
  letter-spacing: -0.02em; color: var(--gold);
}
header .spacer { flex: 1; }
.streak {
  font-family: var(--mono); font-size: 12px; color: var(--gold);
  border: 1px solid var(--border); border-radius: 11px; padding: 2px 9px;
}
.whoami { font-size: 12px; color: var(--faint); }

/* ---------------------------------------------------------------- tabs */

.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs button {
  flex: 1; background: none; border: 0; cursor: pointer;
  height: var(--tab-h);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; color: var(--faint);
  font-family: var(--body); font-size: 10px; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase;
}
.tabs button b { font-family: var(--display); font-size: 17px; font-weight: 800; line-height: 1; }
.tabs button[aria-current='true'] { color: var(--gold); }
.tabs button:focus-visible { outline: 2px solid var(--gold); outline-offset: -3px; }

/* ---------------------------------------------------------------- shell */

main { padding: 18px 16px 26px; max-width: 720px; margin: 0 auto; }
.view { display: none; }
.view.active { display: block; }

h1 {
  font-family: var(--display); font-size: 26px; font-weight: 800;
  letter-spacing: -0.03em; line-height: 1.05; margin-bottom: 5px;
}
.sub { color: var(--muted); font-size: 13px; line-height: 1.5; margin-bottom: 18px; }
.eyebrow {
  font-family: var(--mono); font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.13em; color: var(--faint);
  margin-bottom: 7px;
}

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 15px; margin-bottom: 13px;
}

/* ---------------------------------------------------------------- podium */

.brief {
  font-size: 15px; line-height: 1.55; margin-bottom: 4px;
}
.brief b { font-family: var(--display); font-weight: 700; }
.brief-desc { color: var(--muted); font-size: 14px; line-height: 1.6; margin-top: 8px; }

.chips-list { display: flex; flex-direction: column; gap: 7px; margin: 16px 0; }

.chip {
  display: flex; align-items: center; gap: 11px;
  background: var(--raised); border: 1px solid var(--border);
  border-radius: var(--r); padding: 12px 13px;
  cursor: grab; user-select: none; touch-action: none;
}
.chip.dragging { opacity: 0.4; }
.chip.over { border-color: var(--gold); }
.chip .pos {
  font-family: var(--display); font-size: 17px; font-weight: 800;
  color: var(--faint); width: 20px; text-align: center; flex: 0 0 auto;
}
.chip .who { flex: 1; font-weight: 500; font-size: 15px; }
.chip .grip { color: var(--faint); font-size: 15px; letter-spacing: -1px; }
.chip .mark { font-size: 16px; width: 22px; text-align: center; }
.chip.ok { border-color: var(--green); background: rgba(79, 169, 106, 0.11); }
.chip.up, .chip.down { border-color: var(--gold); background: rgba(232, 179, 60, 0.08); }

.movers { display: flex; flex-direction: column; gap: 2px; }
.movers button {
  background: none; border: 0; color: var(--faint); cursor: pointer;
  font-size: 11px; line-height: 1; padding: 3px 5px;
}
.movers button:hover { color: var(--gold); }
.movers button:focus-visible { outline: 1px solid var(--gold); }

.attempts { display: flex; gap: 5px; margin-bottom: 14px; }
.attempts .slot {
  flex: 1; height: 3px; border-radius: 2px; background: var(--border);
}
.attempts .slot.used { background: var(--gold); }
.attempts .slot.miss { background: var(--red); }

.rows { display: flex; flex-direction: column; gap: 4px; margin: 12px 0; }
.rowline { font-size: 17px; letter-spacing: 3px; }

.result {
  text-align: center; padding: 18px 0 6px;
}
.result h2 {
  font-family: var(--display); font-size: 22px; font-weight: 800;
  margin-bottom: 5px; letter-spacing: -0.02em;
}
.result p { color: var(--muted); font-size: 13px; }

/* ---------------------------------------------------------------- reveal */

.reveal { margin-top: 15px; }
.reveal-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--border);
}
.reveal-row .rank {
  font-family: var(--display); font-weight: 800; font-size: 15px;
  color: var(--faint); width: 18px;
}
.reveal-row .who { flex: 1; font-size: 14px; }
.reveal-row .pts { font-family: var(--mono); font-size: 14px; font-weight: 600; color: var(--gold); }
.reveal-row.dq .pts { color: var(--red); }

/* ---------------------------------------------------------------- point bar */

.pbar { display: inline-flex; gap: 1.5px; vertical-align: middle; }
.pbar i { width: 4px; height: 13px; background: var(--border); border-radius: 1px; }
.pbar i.on { background: var(--gold); }
.pbar.dq i.on { background: var(--red); }

/* ---------------------------------------------------------------- fantasy */

.pick {
  display: flex; align-items: center; gap: 11px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 12px 13px; margin-bottom: 7px;
  cursor: pointer;
}
.pick.on { border-color: var(--gold); background: rgba(232, 179, 60, 0.09); }
.pick .who { flex: 1; font-weight: 500; }
.pick .box {
  width: 19px; height: 19px; border-radius: 3px;
  border: 1.5px solid var(--border); flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: var(--ink); font-weight: 700;
}
.pick.on .box { background: var(--gold); border-color: var(--gold); }
.capbtn {
  font-family: var(--display); font-weight: 800; font-size: 12px;
  width: 27px; height: 27px; border-radius: 50%;
  border: 1.5px solid var(--border); background: none; color: var(--faint);
  cursor: pointer; flex: 0 0 auto;
}
.capbtn.on { background: var(--gold); border-color: var(--gold); color: var(--ink); }

.cta {
  width: 100%; font-family: var(--display); font-weight: 800; font-size: 16px;
  color: var(--ink); background: var(--gold); border: 0; border-radius: var(--r);
  padding: 14px; cursor: pointer; letter-spacing: -0.01em;
}
.cta:disabled { opacity: 0.3; cursor: not-allowed; }
.cta.ghost { background: none; color: var(--muted); border: 1px solid var(--border); }
.cta:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.hint { font-size: 12px; color: var(--faint); text-align: center; margin-top: 9px; line-height: 1.5; }

.scoreline {
  display: flex; justify-content: space-between; padding: 9px 0;
  border-bottom: 1px solid var(--border); font-size: 14px;
}
.scoreline .n { font-family: var(--mono); font-weight: 600; }
.scoreline.tot .n { color: var(--gold); }

/* ---------------------------------------------------------------- board */

.board-row {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.board-row .rank {
  font-family: var(--display); font-weight: 800; font-size: 14px;
  color: var(--faint); width: 24px;
}
.board-row .who { flex: 1; font-size: 14px; }
.board-row .n { font-family: var(--mono); font-size: 14px; font-weight: 600; color: var(--gold); }
.board-row.me { background: rgba(232, 179, 60, 0.07); margin: 0 -8px; padding: 10px 8px; }

/* ---------------------------------------------------------------- archive */

.list-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 0; border-bottom: 1px solid var(--border);
  cursor: pointer; gap: 12px;
}
.list-item:hover .t { color: var(--gold); }
.list-item .t { font-weight: 500; font-size: 15px; }
.list-item .m { font-size: 12px; color: var(--faint); margin-top: 2px; }
.list-item .arrow { color: var(--faint); }

.crumb {
  font-size: 12px; color: var(--faint); margin-bottom: 12px;
  background: none; border: 0; cursor: pointer; font-family: var(--body); padding: 0;
}
.crumb:hover { color: var(--gold); }

.tag {
  font-family: var(--mono); font-size: 9px; text-transform: uppercase;
  letter-spacing: 0.06em; background: var(--raised); color: var(--muted);
  border: 1px solid var(--border); border-radius: 2px; padding: 1px 4px;
}

/* ---------------------------------------------------------------- auth */

.authwrap { max-width: 340px; margin: 8vh auto 0; text-align: center; }
.authwrap h1 { font-size: 30px; margin-bottom: 9px; }
.gbtn {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 9px;
  background: #fff; color: #1F1F1F; border: 0; border-radius: var(--r);
  padding: 13px; font-weight: 600; font-size: 14px; cursor: pointer;
  font-family: var(--body); text-decoration: none;
}
.divider {
  display: flex; align-items: center; gap: 11px; margin: 18px 0;
  color: var(--faint); font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em;
}
.divider::before, .divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}
input[type=text], input[type=email] {
  width: 100%; font-family: var(--body); font-size: 16px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 12px; color: var(--text);
  margin-bottom: 9px; text-align: center;
}
input:focus { outline: 2px solid var(--gold); outline-offset: -1px; }
input.code {
  font-family: var(--mono); font-size: 26px; letter-spacing: 9px; font-weight: 600;
}

/* ---------------------------------------------------------------- toast */

#toast {
  position: fixed; left: 50%; bottom: calc(var(--tab-h) + 14px);
  transform: translateX(-50%) translateY(70px);
  background: var(--raised); border: 1px solid var(--border);
  border-radius: var(--r); padding: 10px 15px; font-size: 13px;
  z-index: 30; transition: transform 0.16s ease; max-width: 90vw; text-align: center;
}
#toast.up { transform: translateX(-50%) translateY(0); }
#toast.err { border-color: var(--red); color: #FFC9C2; }
@media (prefers-reduced-motion: reduce) { #toast { transition: none; } }

.empty { text-align: center; color: var(--faint); padding: 40px 12px; font-size: 14px; line-height: 1.6; }
.empty b { display: block; color: var(--muted); font-family: var(--display); font-size: 17px; margin-bottom: 5px; }

/* ---------------------------------------------------------------- desktop
   Same code, wider breakpoint. Play is not blocked here; blocking it would
   cost more than allowing it. What desktop lacks is the desktop-shaped
   feature set, which is not in Mk I. */

@media (min-width: 780px) {
  body { padding-bottom: 0; }
  .tabs {
    position: static; border-top: 0; background: none;
    padding: 0; justify-content: flex-start; gap: 2px;
  }
  .tabs button {
    flex: 0 0 auto; height: auto; flex-direction: row; gap: 7px;
    padding: 7px 12px; border-radius: var(--r); font-size: 11px;
  }
  .tabs button b { font-size: 13px; }
  .tabs button[aria-current='true'] { background: var(--raised); }
  header { gap: 20px; padding: 13px 24px; }
  main { padding: 26px 24px 60px; }
  h1 { font-size: 32px; }
  #toast { bottom: 22px; }
}

/* ---------------------------------------------------------------- scope
   Presets exist to concentrate people into shared buckets. Arbitrary
   combinations are supported in the data, but a share grid only compares
   within a scope, so an unusual scope is a lonely one. Presets are the
   nudge; custom stays available for anyone who wants it. */

.scopebar {
  display: flex; align-items: center; gap: 8px; margin-bottom: 14px;
  flex-wrap: wrap;
}
.scopebtn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 13px; padding: 4px 11px; cursor: pointer;
  color: var(--muted); font-family: var(--mono); font-size: 11px;
}
.scopebtn:hover { border-color: var(--gold); color: var(--text); }
.scopebtn b { color: var(--gold); font-weight: 600; }
.scopebtn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.sheet {
  position: fixed; inset: 0; background: rgba(6,8,11,0.72); z-index: 40;
  display: none; align-items: flex-end; justify-content: center;
}
.sheet.open { display: flex; }
.sheet-inner {
  background: var(--surface); border-top: 1px solid var(--border);
  border-radius: 12px 12px 0 0; padding: 20px 16px calc(24px + env(safe-area-inset-bottom));
  width: 100%; max-width: 560px; max-height: 86vh; overflow: auto;
}
.sheet h3 {
  font-family: var(--display); font-size: 19px; font-weight: 800;
  margin-bottom: 4px; letter-spacing: -0.02em;
}
.presets { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 18px; }
.preset {
  font-family: var(--body); font-size: 12px; font-weight: 600;
  background: var(--raised); border: 1px solid var(--border); color: var(--muted);
  border-radius: 13px; padding: 6px 12px; cursor: pointer;
}
.preset.on { background: var(--gold); border-color: var(--gold); color: var(--ink); }

.edlist { display: flex; flex-direction: column; gap: 5px; margin-bottom: 16px; }
.edrow {
  display: flex; align-items: center; gap: 11px;
  background: var(--raised); border: 1px solid var(--border);
  border-radius: var(--r); padding: 10px 12px; cursor: pointer;
}
.edrow.on { border-color: var(--gold); background: rgba(232,179,60,0.09); }
.edrow .box {
  width: 18px; height: 18px; border-radius: 3px; border: 1.5px solid var(--border);
  flex: 0 0 auto; display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: var(--ink); font-weight: 700;
}
.edrow.on .box { background: var(--gold); border-color: var(--gold); }
.edrow .who { flex: 1; font-size: 14px; font-weight: 500; }
.edrow .who small { display: block; color: var(--faint); font-weight: 400; font-size: 11px; margin-top: 1px; }
.edrow .n { font-family: var(--mono); font-size: 11px; color: var(--faint); }

@media (min-width: 780px) {
  .sheet { align-items: center; }
  .sheet-inner { border-radius: 10px; border: 1px solid var(--border); padding-bottom: 20px; }
}

/* ---------------------------------------------------------------- rounds */

.roundtabs { display: flex; gap: 4px; margin-bottom: 14px; overflow-x: auto; padding-bottom: 2px; }
.roundtab {
  flex: 0 0 auto; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 8px 12px; cursor: pointer; color: var(--muted);
  font-family: var(--body); font-size: 12px; text-align: left; white-space: nowrap;
}
.roundtab b { display: block; font-family: var(--mono); font-size: 10px; color: var(--faint); }
.roundtab.on { border-color: var(--gold); color: var(--text); background: rgba(232,179,60,0.08); }
.roundtab.on b { color: var(--gold); }
.roundtab.done { opacity: 0.75; }
