/* Team-sheet picker. Same ink as rssl-live.co.uk: navy band, gold rule,
   paper ground, Source Serif. Mobile first -- most sheets come from phones. */
:root {
  --paper: #f3f2f2;
  --card: #fbfafa;
  --ink: #201e1d;
  --muted: #6d6966;
  --rule: rgba(32, 30, 29, 0.16);
  --navy: #002d62;
  --navy-2: #0b3d78;
  --gold: #d8b25e;
  --gold-soft: #f4ead2;
  --ok: #2c7a4b;
  --bad: #b3261e;
  --warn: #9a6400;
  --warn-soft: #fbf1dc;
  --bad-soft: #fbe9e7;
  --font: "Source Serif 4", Georgia, serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.4 var(--font); }
button, select, input { font: inherit; color: inherit; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.caps { text-transform: uppercase; letter-spacing: .14em; font-size: 11px; font-weight: 600; }
[hidden] { display: none !important; }

/* --- prototype bar ------------------------------------------------------ */
.devbar { background: var(--gold-soft); border-bottom: 1px solid var(--gold); font-size: 13px; }
.devbar .wrap { display: flex; gap: 10px; align-items: center; padding-top: 6px; padding-bottom: 6px; flex-wrap: wrap; }
.devbar select { padding: 3px 6px; border: 1px solid var(--gold); background: #fff; border-radius: 2px; max-width: 100%; }

/* --- masthead ------------------------------------------------------------- */
.masthead { border-bottom: 3px solid var(--navy); }
.masthead-inner { display: flex; gap: 12px; align-items: center; padding-top: 14px; padding-bottom: 12px; }
.logo { width: 52px; height: auto; }
.brand { color: var(--navy); font-weight: 700; font-size: 26px; line-height: 1.05; }
.strap { color: var(--muted); letter-spacing: .2em; text-transform: uppercase; font-size: 11px; margin-top: 3px; }

/* --- fixture header ------------------------------------------------------- */
.fixture { margin: 18px 0 14px; background: var(--card); border: 1px solid var(--rule); }
.fixture-band { background: var(--navy); color: #fff; padding: 8px 14px; display: flex; justify-content: space-between; gap: 10px; }
.fixture-band .caps { font-size: 11px; }
.fixture-band .gold { color: var(--gold); }
.fixture-body { padding: 12px 14px 14px; display: grid; gap: 8px; }
.teams { font-size: 19px; font-weight: 600; line-height: 1.25; }
.teams .side { font-weight: 400; color: var(--muted); font-size: 15px; }
.teams .v { font-weight: 400; color: var(--muted); padding: 0 4px; }
.meta-row { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; font-size: 14px; }
.status { display: inline-block; padding: 2px 8px; border-radius: 2px; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; font-weight: 700; }
.status.none { background: var(--bad-soft); color: var(--bad); }
.status.done { background: #e2f1e7; color: var(--ok); }
.status.dirty { background: var(--warn-soft); color: var(--warn); }

/* --- layout --------------------------------------------------------------- */
.cols { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; padding-bottom: 96px; }
@media (min-width: 900px) {
  .cols { grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); align-items: start; padding-bottom: 40px; }
  .cols .panel-sheet { position: sticky; top: 10px; max-height: calc(100vh - 20px); overflow: auto; }
}
.panel { scroll-margin-top: 10px; }
.view-sheet { max-width: 640px; margin-bottom: 40px; }
.panel { background: var(--card); border: 1px solid var(--rule); }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
  padding: 10px 14px; border-bottom: 2px solid var(--navy); }
.panel-head h2 { margin: 0; font-size: 13px; letter-spacing: .16em; text-transform: uppercase; color: var(--navy); }
.chip { font-size: 12px; padding: 2px 8px; border: 1px solid var(--rule); border-radius: 2px; background: #fff; white-space: nowrap; }
.chip.navy { background: var(--navy); color: #fff; border-color: var(--navy); }

/* --- sheet rows ----------------------------------------------------------- */
.block-label { padding: 8px 14px 4px; color: var(--muted); }
.row { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 4px 10px; align-items: center;
  padding: 8px 10px 8px 14px; border-top: 1px solid var(--rule); }
.row:first-of-type { border-top: 0; }
.num { color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }
.who { min-width: 0; }
.name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sub { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sub .nogame { color: var(--warn); }
.panel-sheet .row .sub { white-space: normal; }
.row-note { grid-column: 2 / -1; font-size: 12.5px; }
.row-note.error { color: var(--bad); }
.row-note.warning { color: var(--warn); }
.row.has-error { background: var(--bad-soft); }
.pos { display: inline-block; min-width: 20px; text-align: center; font-size: 11px; font-weight: 700; padding: 1px 4px;
  border-radius: 2px; background: #e6e4e3; margin-right: 6px; vertical-align: 1px; }
.pos.declared { background: var(--gold); color: var(--navy); }
.actions { display: flex; gap: 4px; align-items: center; }
.icon { width: 34px; height: 34px; border: 1px solid var(--rule); background: #fff; border-radius: 2px; cursor: pointer;
  display: inline-grid; place-items: center; font-size: 14px; line-height: 1; }
.icon.wide { width: auto; padding: 0 7px; font-size: 12px; font-weight: 600; }
.icon:disabled { opacity: .3; cursor: default; }
.icon:not(:disabled):hover { border-color: var(--navy); }
.possel { height: 34px; border: 1px solid var(--rule); background: #fff; border-radius: 2px; padding: 0 4px; font-size: 13px; max-width: 112px; }
.empty-slot { padding: 10px 14px; border-top: 1px dashed var(--rule); color: var(--muted); font-style: italic; font-size: 14px; display: flex; gap: 10px; }
.empty-slot .num { font-style: normal; width: 26px; }

/* --- rules checklist --------------------------------------------------------- */
.checks { list-style: none; margin: 0; padding: 10px 14px; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 4px 12px; border-top: 1px solid var(--rule); background: #f7f6f5; font-size: 13.5px; }
.checks li::before { display: inline-block; width: 18px; font-weight: 700; }
.checks li.ok::before { content: "✓"; color: var(--ok); }
.checks li.bad::before { content: "✗"; color: var(--bad); }
.checks li.warn::before { content: "!"; color: var(--warn); }
.problems { margin: 0; padding: 8px 14px 10px 32px; font-size: 13.5px; border-top: 1px solid var(--rule); }
.problems li.error { color: var(--bad); }
.problems li.warning { color: var(--warn); }
.problems .rule { color: var(--muted); font-style: italic; }

.submit-row { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 14px; border-top: 2px solid var(--navy); align-items: center; }
.btn { border: 1px solid var(--navy); background: #fff; color: var(--navy); padding: 9px 16px; border-radius: 2px; cursor: pointer;
  font-weight: 600; min-height: 40px; }
.btn.primary { background: var(--navy); color: #fff; }
.btn.primary:disabled { background: #9aa6b5; border-color: #9aa6b5; cursor: not-allowed; }
.btn.small { padding: 4px 10px; min-height: 32px; font-size: 13px; }
.btn.ghost { border-color: var(--rule); color: var(--ink); }

/* --- squad ------------------------------------------------------------------- */
.filters { display: flex; gap: 0; border-bottom: 1px solid var(--rule); position: sticky; top: 0; background: var(--card); z-index: 1; }
.filters button { flex: 1; border: 0; background: none; padding: 10px 4px; cursor: pointer; font-size: 13px; letter-spacing: .08em;
  border-bottom: 3px solid transparent; color: var(--muted); }
.filters button[aria-pressed="true"] { color: var(--navy); border-bottom-color: var(--gold); font-weight: 700; }
button.squad-row { width: 100%; text-align: left; border: 0; border-top: 1px solid var(--rule); background: none; cursor: pointer; }
button.squad-row:hover { background: #f4f3f1; }
.squad-row .who, .result .who { display: block; min-width: 0; }
.squad-row .name, .squad-row .sub { display: block; }
.squad-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 8px 10px 8px 14px; border-top: 1px solid var(--rule); }
.squad-row.picked { background: #f0efed; }
.squad-row.picked .name { color: var(--muted); }
.squad-row.locked { opacity: .55; }
.tag { font-size: 12px; color: var(--navy); font-weight: 600; white-space: nowrap; }
.squad-group { padding: 10px 14px 4px; color: var(--navy); border-top: 1px solid var(--rule); background: #f7f6f5; }

/* --- submitted view ------------------------------------------------------- */
.banner { padding: 12px 14px; background: #e2f1e7; border-left: 4px solid var(--ok); margin-bottom: 14px; }
.banner strong { color: var(--ok); }
.opponent { margin-top: 18px; }
details summary { cursor: pointer; padding: 10px 14px; }

/* --- sign in -------------------------------------------------------------- */
.signin { max-width: 440px; margin: 40px auto; background: var(--card); border: 1px solid var(--rule); padding: 22px; }
.signin h1 { margin: 0 0 6px; font-size: 22px; color: var(--navy); }
.signin select { width: 100%; padding: 10px; margin: 14px 0; border: 1px solid var(--rule); background: #fff; border-radius: 2px; }

/* --- mobile bottom bar ------------------------------------------------------ */
.bottombar { position: fixed; left: 0; right: 0; bottom: 0; background: var(--navy); color: #fff; z-index: 5;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.bottombar .counts { font-size: 14px; }
.bottombar .counts b { color: var(--gold); }
.bottombar .btn { background: transparent; color: #fff; border-color: rgba(255,255,255,.5); }
.bottombar .btn.primary { background: var(--gold); color: var(--navy); border-color: var(--gold); }
.bottombar .btn.primary:disabled { background: rgba(255,255,255,.2); color: rgba(255,255,255,.6); border-color: transparent; }
@media (min-width: 900px) { .bottombar { display: none !important; } }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 84px; background: var(--ink); color: #fff;
  padding: 9px 14px; border-radius: 3px; font-size: 14px; z-index: 10; max-width: calc(100% - 32px); }
@media (min-width: 900px) { .toast { bottom: 24px; } }

/* Narrow screens: the row's controls drop under the name, so the player and
   his fixture always get the full width. */
@media (max-width: 520px) {
  .row { grid-template-columns: 22px minmax(0, 1fr); }
  .row .actions { grid-column: 2; }
  .possel { max-width: none; flex: 1; }
}

/* --- highlighted squad player and his actions ------------------------------ */
.squad-item.focused { outline: 2px solid var(--navy); outline-offset: -2px; position: relative; z-index: 1; }
.squad-item.focused button.squad-row { background: #eef2f8; }
.focus-panel { padding: 10px 14px 12px; display: grid; gap: 10px; background: #eef2f8; border-top: 1px solid var(--rule); }
.choice-list { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn.choice { flex: 1 1 100%; text-align: left; background: #fff; }
@media (min-width: 520px) { .btn.choice { flex: 1 1 auto; } }
.pos-pick { display: flex; gap: 6px; align-items: center; }
.pos-pick .caps { margin-right: 6px; }
.seg { width: 40px; height: 34px; border: 1px solid var(--rule); background: #fff; border-radius: 2px; cursor: pointer; font-weight: 700; }
.seg[aria-pressed="true"] { background: var(--navy); color: #fff; border-color: var(--navy); }
.owner-note { font-size: 13px; color: var(--warn); }

/* --- players added this week: gold, so they stand out from the Bible list -- */
.is-added { box-shadow: inset 4px 0 0 var(--gold); }
.squad-item.is-added button.squad-row, .row.is-added { background: #fbf6ea; }
.added-tag { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; font-weight: 700; color: var(--navy);
  background: var(--gold); padding: 1px 5px; border-radius: 2px; vertical-align: 2px; margin-left: 4px; }

/* --- add a player: search ----------------------------------------------------- */
.add-bar { padding: 10px 14px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; border-bottom: 1px solid var(--rule); }
.add-bar .hint { font-size: 12.5px; }
.search { border-bottom: 2px solid var(--gold); background: #fbf6ea; }
.search-head { display: flex; gap: 8px; padding: 10px 14px; }
.search input { flex: 1; min-width: 0; padding: 9px 10px; border: 1px solid var(--navy); border-radius: 2px; background: #fff; font-size: 16px; }
.result { border-top: 1px solid var(--rule); }
.result-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 8px 14px; }
.result .focus-panel { background: #fff; }
.search-empty { padding: 4px 14px 12px; margin: 0; font-size: 13.5px; }

/* --- sign-in ------------------------------------------------------------------ */
.who-bar { margin-left: auto; font-size: 13px; text-align: right; }
.linkish { border: 0; background: none; color: var(--navy); text-decoration: underline; cursor: pointer; padding: 0 0 0 6px; font-size: 13px; }
.wide-btn { width: 100%; }
.notice { background: var(--warn-soft); border-left: 3px solid var(--gold); padding: 8px 10px; font-size: 14px; }
.notice.bad { background: var(--bad-soft); border-left-color: var(--bad); color: var(--bad); }
.notice a { color: var(--navy); font-weight: 600; }
.small-print { font-size: 13px; margin: 14px 0 0; }
@media (max-width: 520px) { .who-bar { font-size: 12px; } }
