:root {
  --bg: #eef0f4;
  --panel: #ffffff;
  --ink: #16181d;
  --ink-2: #4a4f5a;
  --ink-3: #7a7f8a;
  --line: #d9dce3;
  --brand: #14213d;
  --brand-ink: #ffffff;
  --accent: #2a78d6;
  --warn: #b25b00;
  --bad: #c4291c;
  --good: #1e7a3c;
  --col: #e3e6ec;
  --radius: 10px;
  --series-1: #2a78d6;
  --series-2: #eb6834;

  /* Name plate colors by position, matching the magnets on the big board:
     Attack red, Midfield green, Defense/LSM blue, Goalie gold, FOGO purple, unknown white. */
  --pos-A: #f2643a;
  --pos-M: #72c04a;
  --pos-F: #b58ae8;
  --pos-DM: #72c04a;
  --pos-LSM: #3aaee8;
  --pos-D: #3aaee8;
  --pos-G: #f6b324;
  --pos-none: #f4f4f1;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111317;
    --panel: #1b1e24;
    --ink: #eceef2;
    --ink-2: #b9bdc7;
    --ink-3: #8a8f9a;
    --line: #2f343d;
    --brand: #0d1528;
    --accent: #5598e7;
    --warn: #f0a24a;
    --bad: #ff6b5e;
    --good: #4cc27a;
    --col: #181b21;
    --series-1: #3987e5;
    --series-2: #d95926;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--ink);
  -webkit-text-size-adjust: 100%;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
.boot { padding: 40px; text-align: center; color: var(--ink-3); }

/* ---------- top bar ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  background: var(--brand); color: var(--brand-ink);
  padding: 8px 12px calc(8px) 12px; padding-top: max(8px, env(safe-area-inset-top));
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.top h1 { font-size: 17px; margin: 0; font-weight: 700; letter-spacing: .02em; white-space: nowrap; }
.top h1 small { font-weight: 500; opacity: .7; margin-left: 4px; }
.tabs { display: flex; gap: 2px; flex: 1; min-width: 0; overflow-x: auto; }
.tabs button {
  background: transparent; border: 0; color: inherit; opacity: .75;
  padding: 7px 11px; border-radius: 8px; white-space: nowrap;
}
.tabs button[aria-current="page"] { opacity: 1; background: rgba(255,255,255,.16); font-weight: 600; }
.who {
  background: rgba(255,255,255,.16); border: 0; color: inherit;
  border-radius: 999px; padding: 5px 10px; font-weight: 600;
}
.live { font-size: 12px; opacity: .7; white-space: nowrap; }
.live.off { color: #ffb4a8; opacity: 1; }

/* ---------- toolbars ---------- */
.bar {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  padding: 10px 12px; background: var(--panel); border-bottom: 1px solid var(--line);
}
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: transparent; padding: 6px 10px; }
.seg button[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); }
@media (prefers-color-scheme: dark) { .seg button[aria-pressed="true"] { background: var(--accent); } }
.chips { display: flex; gap: 4px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: var(--panel); border-radius: 999px;
  padding: 3px 9px; font-size: 13px;
}
.chip[aria-pressed="true"] { border-color: var(--ink); font-weight: 600; }
.chip .sw { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 4px; vertical-align: 0; }
input[type=search], input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], select, textarea {
  border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 7px 9px; min-width: 0;
}
textarea { width: 100%; min-height: 70px; resize: vertical; }
.btn {
  border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 7px 12px;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.danger { color: var(--bad); }
.btn:disabled { opacity: .5; cursor: default; }
.spacer { flex: 1; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }

/* ---------- board ---------- */
.board {
  display: flex; gap: 10px; padding: 12px; align-items: flex-start;
  overflow-x: auto; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch;
}
.col {
  background: var(--col); border-radius: var(--radius); flex: 0 0 auto;
  width: min(84vw, 270px); scroll-snap-align: start; min-height: 120px;
  border: 2px solid transparent;
}
.col.over { border-color: var(--accent); }
.col-h { padding: 9px 10px 6px; position: sticky; top: 0; }
.col-h h2 { margin: 0; font-size: 16px; display: flex; align-items: baseline; gap: 6px; }
.col-h h2 .n { font-size: 13px; font-weight: 500; color: var(--ink-3); }
.counts { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 5px; }
.count { font-size: 11.5px; padding: 1px 6px; border-radius: 5px; background: var(--panel); color: var(--ink-2); }
.count.overcap { background: var(--bad); color: #fff; font-weight: 600; }
.count.full { outline: 1px solid var(--good); }
.col-b { padding: 0 8px 10px; display: flex; flex-direction: column; gap: 6px; min-height: 60px; }
.col-empty { font-size: 13px; color: var(--ink-3); padding: 8px 4px; }

.plate {
  border-radius: 7px; padding: 6px 8px 6px; color: #15171b; background: var(--pos-none);
  box-shadow: 0 1px 0 rgba(0,0,0,.25), inset 0 0 0 1px rgba(0,0,0,.12), inset 0 -2px 0 rgba(0,0,0,.08);
  cursor: pointer; user-select: none; -webkit-user-select: none; position: relative;
  border: 0; text-align: left; width: 100%; display: block;
}
.plate:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; }
.plate.dragging { opacity: .4; }
.plate.faded { opacity: .6; }
.plate.pos-A { background: var(--pos-A); }
.plate.pos-M { background: var(--pos-M); }
.plate.pos-F { background: var(--pos-F); }
.plate.pos-DM { background: var(--pos-DM); }
.plate.pos-LSM { background: var(--pos-LSM); }
.plate.pos-D { background: var(--pos-D); }
.plate.pos-G { background: var(--pos-G); }
.pl-top { display: flex; align-items: baseline; gap: 6px; }
.pl-name { font-weight: 700; font-size: 14.5px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-meta { font-size: 12px; color: #3b3f47; white-space: nowrap; }
.pl-sub { font-size: 12px; color: #33363d; margin-top: 1px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.pl-dots { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 4px; }
.dot {
  font-size: 10.5px; font-weight: 700; line-height: 1; padding: 3px 4px; border-radius: 4px;
  background: rgba(255,255,255,.75); color: #20232a; letter-spacing: .02em;
}
.dot.mine { background: #14213d; color: #fff; }
.dot.other { background: transparent; color: #3b3f47; font-weight: 600; outline: 1px dashed rgba(0,0,0,.35); }
.flag { font-size: 11px; font-weight: 700; padding: 1px 5px; border-radius: 4px; background: rgba(0,0,0,.12); }
.flag.bad { background: #c4291c; color: #fff; }
.flag.warn { background: #8a4b00; color: #fff; }
.flag.lock { background: #14213d; color: #fff; }
.flag.split { background: #fff; color: #8a4b00; outline: 1px solid #8a4b00; }
.flag.allin { background: #5b2d9e; color: #fff; }
.flag.lead { background: #fff; color: #14213d; outline: 1px solid #14213d; }
.tchip { font-size: 11px; font-weight: 700; padding: 1px 5px; border-radius: 4px; background: rgba(255,255,255,.7); }

/* ---------- lists / panels ---------- */
.page { padding: 12px; max-width: 1100px; margin: 0 auto; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.card h2 { margin: 0 0 10px; font-size: 17px; }
.card h3 { margin: 14px 0 6px; font-size: 15px; }
table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
table.list th, table.list td { text-align: left; padding: 7px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list th { font-size: 12px; color: var(--ink-3); font-weight: 600; cursor: pointer; white-space: nowrap; }
table.list tr.click { cursor: pointer; }
table.list tr.click:hover td { background: var(--col); }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 6px 0; }
.row label { display: flex; flex-direction: column; gap: 3px; font-size: 13px; color: var(--ink-2); }
.grid-targets { border-collapse: collapse; }
.grid-targets td, .grid-targets th { padding: 3px; text-align: center; font-size: 13px; }
.grid-targets input { width: 52px; text-align: center; }
.err { color: var(--bad); }
.ok { color: var(--good); }
pre.report { white-space: pre-wrap; font-size: 13px; background: var(--col); padding: 10px; border-radius: 8px; max-height: 260px; overflow: auto; }

/* ---------- sheet (player detail) ---------- */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 40; display: flex; justify-content: flex-end; }
.sheet {
  background: var(--bg); width: min(100%, 620px); height: 100%; overflow-y: auto;
  box-shadow: -4px 0 24px rgba(0,0,0,.3); padding-bottom: 40px;
  overscroll-behavior: contain;
}
.sheet-h {
  position: sticky; top: 0; z-index: 2; padding: 12px 14px; padding-top: max(12px, env(safe-area-inset-top));
  display: flex; align-items: center; gap: 10px; background: var(--pos-none); color: #15171b;
}
.sheet-h.pos-A { background: var(--pos-A); } .sheet-h.pos-M { background: var(--pos-M); } .sheet-h.pos-F { background: var(--pos-F); }
.sheet-h.pos-DM { background: var(--pos-DM); } .sheet-h.pos-LSM { background: var(--pos-LSM); } .sheet-h.pos-D { background: var(--pos-D); }
.sheet-h.pos-G { background: var(--pos-G); }
.sheet-h h2 { margin: 0; font-size: 20px; flex: 1; min-width: 0; }
.sheet-h h2 small { font-size: 13px; font-weight: 500; display: block; color: #33363d; }
.sheet-h .x { border: 0; background: rgba(255,255,255,.6); border-radius: 999px; width: 36px; height: 36px; font-size: 20px; line-height: 1; color: #15171b; }
.sec { background: var(--panel); margin: 10px 10px 0; border-radius: var(--radius); padding: 12px; border: 1px solid var(--line); }
.sec h3 { margin: 0 0 8px; font-size: 14px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); }
.teamvote { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
.teamvote button { border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 10px 2px; font-weight: 600; font-size: 14px; }
.teamvote button[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }
@media (prefers-color-scheme: dark) { .teamvote button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); } }
.tally { display: flex; height: 10px; border-radius: 5px; overflow: hidden; gap: 2px; margin: 8px 0; background: var(--col); }
.tally span { display: block; }
.vlist { font-size: 14px; }
.vlist div { padding: 4px 0; border-bottom: 1px solid var(--line); }
.vlist div:last-child { border-bottom: 0; }
.scores { width: 100%; border-collapse: collapse; }
.scores td { padding: 4px 2px; border-bottom: 1px solid var(--line); font-size: 14px; }
.scores td.cat { width: 38%; }
.scores td.avg { width: 18%; text-align: right; color: var(--ink-2); font-size: 13px; white-space: nowrap; }
.s5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 3px; }
.s5 button { border: 1px solid var(--line); background: var(--panel); border-radius: 6px; padding: 6px 0; font-size: 14px; min-width: 30px; }
.s5 button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.note { border-bottom: 1px solid var(--line); padding: 7px 0; font-size: 14px; white-space: pre-wrap; }
.note:last-child { border-bottom: 0; }
.note .by { font-size: 12px; color: var(--ink-3); display: flex; gap: 8px; }
.note .by button { border: 0; background: none; color: var(--bad); padding: 0; font-size: 12px; }
.hist-year { margin-top: 10px; }
.hist-year h4 { margin: 0 0 4px; font-size: 15px; }
.hist-item { font-size: 14px; margin: 4px 0; white-space: pre-wrap; }
.hist-item b { font-weight: 600; }
.daychips { display: flex; gap: 4px; flex-wrap: wrap; }
.daychip { font-size: 12px; background: var(--col); border-radius: 5px; padding: 2px 6px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; font-size: 14px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; }

/* ---------- chooser (quick move) ---------- */
.chooser { position: fixed; inset: auto 0 0 0; z-index: 50; background: var(--panel); border-radius: 14px 14px 0 0; padding: 14px; padding-bottom: max(14px, env(safe-area-inset-bottom)); box-shadow: 0 -6px 30px rgba(0,0,0,.3); max-width: 560px; margin: 0 auto; }
.chooser h3 { margin: 0 0 10px; font-size: 16px; }
.chooser .opts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.chooser .opts button { padding: 12px 6px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); font-weight: 600; }
.chooser .opts button[aria-pressed="true"] { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ---------- login ---------- */
.login { max-width: 380px; margin: 10vh auto; padding: 0 16px; }
.login h1 { font-size: 22px; margin: 0 0 4px; }
.login form { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.login input { padding: 11px; font-size: 16px; }
.login .btn { padding: 11px; font-size: 16px; }

/* ---------- wall ball chart ---------- */
.wb-chart { width: 100%; height: auto; display: block; }
.wb-chart .grid { stroke: var(--line); stroke-width: 1; }
.wb-chart .axis { fill: var(--ink-3); font-size: 11px; }
.wb-chart .lbl { font-size: 12px; fill: var(--ink-2); font-weight: 600; }
.legend { display: flex; gap: 12px; font-size: 13px; color: var(--ink-2); margin-bottom: 4px; }
.legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: 3px; margin-right: 4px; }
.tip { position: fixed; z-index: 60; background: var(--ink); color: var(--panel); font-size: 12px; padding: 5px 8px; border-radius: 6px; pointer-events: none; white-space: nowrap; }

#toast {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 70;
  background: #16181d; color: #fff; padding: 9px 14px; border-radius: 8px; font-size: 14px;
  opacity: 0; transition: opacity .2s; pointer-events: none; max-width: 90vw;
}
#toast.show { opacity: 1; }
#toast.err { background: #c4291c; }

@media (max-width: 520px) {
  .top { gap: 6px; padding-left: 8px; padding-right: 8px; }
  .top h1 { display: none; }
  .tabs button { padding: 7px 7px; font-size: 14px; }
  .live:not(.off) { display: none; }
}
/* Computers: columns share the screen instead of scrolling sideways.
   Teams get the most room; bubbles and side columns (no votes, vote to see, quit) a little less. */
@media (min-width: 900px) {
  .board { scroll-snap-type: none; gap: 8px; padding: 10px; }
  .col { flex: 1 1 0; width: auto; min-width: 126px; }
  .col.col-bubble, .col.col-side { flex-grow: .8; min-width: 104px; }
  .col-h { padding: 8px 8px 5px; }
  .col-h h2 { font-size: 15px; }
  .count { font-size: 11px; padding: 1px 4px; }
  .col-b { padding: 0 6px 8px; gap: 5px; }
  .plate { padding: 5px 7px; }
  .pl-name { font-size: 13.5px; white-space: normal; overflow: visible; line-height: 1.2; }
  .pl-meta, .pl-sub { font-size: 11.5px; }
  .dot { font-size: 10px; padding: 2px 3px; }
}
/* Bubble columns look like the space between two teams. */
.col.col-bubble { background: transparent; border: 2px dashed var(--line); }
.col.col-bubble.over { border-color: var(--accent); }
@media print {
  body { background: #fff; color: #000; }
  .top, .bar, #toast, #chooser, #sheet { display: none !important; }
  .card { border: 0; padding: 0 0 10px; }
  .roster-card { break-inside: avoid; }
  #as-coaches, .card h3, .card h3 + p, .card .row { display: none; }
  .board { flex-wrap: wrap; overflow: visible; }
  .col { break-inside: avoid; }
}

/* ---------- meeting view: read in the room, easy on the eyes ---------- */
.meet {
  position: fixed; inset: 0; z-index: 45; display: flex; flex-direction: column;
  background: #fbfaf7; color: #16181d; color-scheme: light;
  font-size: var(--mfs, 20px);
}
.meet .m-bar, .meet .m-nav {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  background: #f1efe9; border-bottom: 1px solid #dedad0;
}
.meet .m-bar { padding-top: max(8px, env(safe-area-inset-top)); }
.meet .m-nav { border-top: 1px solid #dedad0; border-bottom: 0; padding-bottom: max(8px, env(safe-area-inset-bottom)); display: grid; grid-template-columns: 1fr 1.3fr 1fr; }
.meet .m-count { flex: 1; text-align: center; font-size: 14px; color: #5a5f6a; }
.meet .m-size { display: flex; gap: 6px; }
.meet .m-btn {
  min-height: 44px; padding: 8px 12px; font-size: 16px; border-radius: 10px;
  border: 1px solid #c9ccd3; background: #fff; color: #16181d; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.meet .m-btn:disabled { opacity: .35; }
.meet .m-todo { background: #14213d; border-color: #14213d; color: #fff; font-weight: 600; }
.meet .m-done { background: #1e7a3c; border-color: #1e7a3c; color: #fff; font-weight: 600; }
.meet .m-body { flex: 1; overflow-y: auto; padding: 18px 18px 40px; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.meet .m-body > * { max-width: 760px; margin-left: auto; margin-right: auto; }
.meet .m-name { font-size: 1.6em; font-weight: 800; line-height: 1.15; display: flex; align-items: center; gap: 10px; }
.meet .m-sw { width: .7em; height: .7em; border-radius: 4px; flex: none; outline: 1px solid rgba(0,0,0,.2); }
.meet .m-sub { color: #5a5f6a; font-size: .8em; margin-top: 4px; }
.meet .m-offer { margin-top: 16px; padding: 14px 16px; background: #fff; border: 1px solid #e3e0d8; border-radius: 12px; }
.meet .m-team { font-size: 1.5em; font-weight: 800; }
.meet .m-offer-line { margin-top: 6px; }
.meet .m-chip { display: inline-block; font-size: .7em; font-weight: 700; padding: 2px 8px; border-radius: 6px; vertical-align: .1em; }
.meet .m-chip.allin { background: #5b2d9e; color: #fff; }
.meet .m-chip.lead { background: #fff; color: #14213d; outline: 1.5px solid #14213d; }
.meet .m-warn { color: #9a4a00; font-size: .75em; margin-top: 8px; }
.meet .m-h { font-size: .72em; text-transform: uppercase; letter-spacing: .08em; color: #5a5f6a; margin: 1.6em auto .5em; }
.meet .m-text { white-space: pre-wrap; line-height: 1.55; }
.meet .m-main { font-size: 1.05em; }
.meet .m-year { margin-bottom: 1em; padding-left: 12px; border-left: 3px solid #dedad0; }
.meet .m-year-h { font-weight: 800; }
.meet .m-team-line { font-weight: 600; margin: 2px 0 4px; }
.meet .m-year .m-text { margin-bottom: .4em; }
.meet .m-muted { color: #6b707a; font-size: .8em; }
.meet details.m-coach { margin-top: 1.6em; padding: 12px 14px; background: #efece4; border-radius: 12px; font-size: .8em; }
.meet details.m-coach summary { font-weight: 700; cursor: pointer; font-size: 1.05em; min-height: 32px; }
.meet .m-line { margin: 8px 0; line-height: 1.45; }
.meet .m-h3 { font-size: 1em; margin: 16px 0 6px; }
.meet .m-prompts { margin: 0 0 10px; padding-left: 20px; line-height: 1.5; }
.meet textarea { background: #fff; color: #16181d; border-color: #c9ccd3; font-size: 16px; }
.meet .daychip { background: #e3e0d8; color: #16181d; }
.meet .btn { background: #fff; color: #16181d; border-color: #c9ccd3; }
.meet .btn.primary { background: #2a78d6; border-color: #2a78d6; color: #fff; }

.help p { margin: 0 0 10px; line-height: 1.45; }

/* wall ball drill grid: right and left side by side */
.drill-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; margin: 6px 0; }
.drill-grid label { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 600; font-size: 14px; }
.drill-grid input { width: 84px; font-size: 18px; text-align: center; padding: 8px; }
.wb-table td, .wb-table th { white-space: nowrap; text-align: right; }
.wb-table td:first-child, .wb-table th:first-child { text-align: left; }

.heat-chip { font-size: 12px; font-weight: 600; padding: 2px 6px; border-radius: 5px; background: var(--col); }
.wb-table td[style] { font-weight: 600; }

/* bubble buttons sit under the four teams */
.teamvote { grid-template-columns: repeat(4, 1fr); }
.teamvote.bub { grid-template-columns: repeat(3, 1fr); margin-top: 5px; }
.teamvote.bub button { font-weight: 500; font-size: 13px; padding: 7px 2px; border-style: dashed; }
/* finalize screen */
.fin-h { margin: 12px 0 6px; font-size: 14px; }
.fin-clear { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-bottom: 6px; }
.fin-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.fin-btns { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.fin-btns .btn { padding: 6px 10px; }
.fin-btns .fin-other { opacity: .65; font-size: 12px; }
.chip.chip-danger[aria-pressed="true"] { border-color: var(--bad); color: var(--bad); }
