/* ============================================================
   England Virtual · HT/FT Prediction
   Clean white cards on a soft blue canvas, one vivid blue accent.
   ============================================================ */

:root {
  --bg: #f3f6fd;
  --bg-2: #e9eefb;
  --panel: #ffffff;
  --panel-2: #f8fafe;
  --field: #f3f6fd;
  --field-2: #e8edfa;

  --ink: #0b1220;
  --ink-dim: #475569;
  --ink-faint: #7c879c;

  --line: #e1e7f4;
  --line-soft: #eef2fa;

  --accent: #2f56f0;
  --accent-deep: #1f3fce;
  --accent-ink: #1b37b8;
  --accent-wash: #eef2ff;
  --accent-line: #c6d2ff;

  --win: #059669;
  --win-wash: #e8f8f1;
  --loss: #dc2626;
  --loss-wash: #fdecec;

  --radius: 18px;
  --radius-sm: 11px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 6px 20px rgba(15, 23, 42, .04);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #070a13;
  --bg-2: #050811;
  --panel: #0f1421;
  --panel-2: #141b2b;
  --field: #161e30;
  --field-2: #1e2740;

  --ink: #f2f5fc;
  --ink-dim: #aeb9ce;
  --ink-faint: #7f8ba3;

  --line: #253149;
  --line-soft: #1b2438;

  --accent: #7b95ff;
  --accent-deep: #9aadff;
  --accent-ink: #aabcff;
  --accent-wash: #1a2444;
  --accent-line: #37477f;

  --win: #3ddc97;
  --win-wash: #0f2b22;
  --loss: #ff8080;
  --loss-wash: #2d1618;

  --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 10px 30px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, ol, ul { margin: 0; }
ol, ul { padding: 0; list-style: none; }
b, strong { font-weight: 680; }
[hidden] { display: none !important; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ---------------- header ---------------- */

.topbar {
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.topbar-row {
  max-width: 1120px;
  margin: 0 auto;
  padding: 16px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }

.dot {
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-wash);
  flex: none;
}

h1 {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -.015em;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.muted { color: var(--ink-faint); font-weight: 400; }

.theme-btn {
  flex: none;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 15px;
  min-height: 40px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.theme-btn:hover { background: var(--field-2); border-color: var(--accent-line); }

/* ---------------- layout ---------------- */

.layout { max-width: 1120px; margin: 0 auto; padding: 22px 22px 0; }

.col-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  min-width: 0;
}

.slip {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  margin-top: 16px;
}

/* ---------------- headings, notes ---------------- */

.panel-head { margin-bottom: 16px; }

.panel-head h2 {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.2;
}

.panel-head .hint { margin-top: 5px; max-width: 74ch; }

.hint { font-size: 13px; color: var(--ink-faint); }

.sub-h {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  font-size: 14.5px;
  font-weight: 680;
  letter-spacing: -.01em;
  margin: 26px 0 10px;
}
.h3-note { font-size: 12.5px; font-weight: 500; color: var(--ink-faint); }

.caveat {
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--ink-dim);
  margin-top: 12px;
  max-width: 86ch;
}
.caveat:empty { display: none; }

.caveat.intro {
  background: var(--accent-wash);
  border: 1px solid var(--accent-line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--ink);
  font-size: 13px;
  margin: 0 0 18px;
}

.lbl {
  font-size: 11.5px;
  font-weight: 650;
  color: var(--ink-faint);
}

/* ---------------- buttons & fields ---------------- */

.btn {
  font: inherit;
  font-size: 13.5px;
  font-weight: 650;
  color: #fff;
  background: var(--accent);
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 16px;
  min-height: 42px;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  white-space: nowrap;
}
.btn:hover { background: var(--accent-deep); }

.btn.ghost {
  color: var(--ink);
  background: var(--panel);
  border-color: var(--line);
}
.btn.ghost:hover { background: var(--panel-2); border-color: var(--accent-line); color: var(--accent-ink); }

.btn:disabled, .btn[disabled] {
  color: var(--ink-faint);
  background: var(--field-2);
  border-color: transparent;
  cursor: not-allowed;
}

input, select, button { font-family: inherit; }

input[type="number"], input[type="text"], select {
  font-size: 15px;
  color: var(--ink);
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 11px;
  min-height: 42px;
  width: 100%;
  min-width: 0;
}
select { appearance: none; padding-right: 32px; background-image: none; cursor: pointer; }
input:focus, select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-wash); }

/* ---------------- round bar ---------------- */

.round-bar {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px 20px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
}

.rnum { font-size: 13px; font-weight: 600; color: var(--ink-dim); white-space: nowrap; }
.rnum b { font-size: 17px; color: var(--ink); margin-left: 4px; }

.rprog { min-width: 0; font-size: 13px; color: var(--ink-dim); }
.rprog:empty { display: none; }

.r-bar {
  display: block;
  height: 7px;
  border-radius: 999px;
  background: var(--field-2);
  overflow: hidden;
  margin-top: 6px;
  max-width: 320px;
}
.r-bar i { display: block; height: 100%; border-radius: 999px; background: var(--accent); }

.racts { display: flex; gap: 8px; justify-content: flex-end; }

/* ---------------- match cards ---------------- */

.mcard {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  min-width: 0;
}
.mcard.logged { background: var(--panel-2); }

.mshell { display: block; min-width: 0; }

.mhead {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 15px;
  cursor: pointer;
  list-style: none;
  min-width: 0;
  flex-wrap: wrap;
}
.mhead::-webkit-details-marker { display: none; }
.mhead:hover { background: var(--panel-2); }
.mcard.logged .mhead:hover { background: var(--field); }

.mno {
  flex: none;
  min-width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-dim);
  background: var(--field);
  border-radius: 8px;
  font-variant-numeric: tabular-nums;
}

.mpair {
  font-size: 15px;
  font-weight: 680;
  letter-spacing: -.01em;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mcall {
  flex: none;
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-faint);
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
}
.mcall.on { color: var(--accent-ink); background: var(--accent-wash); border-color: var(--accent-line); }

.mstate {
  margin-left: auto;
  flex: none;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-faint);
  background: var(--field);
  border-radius: 999px;
  padding: 3px 9px;
  white-space: nowrap;
}

.mbody {
  display: grid;
  gap: 16px;
  padding: 16px 15px 18px;
  border-top: 1px solid var(--line-soft);
  min-width: 0;
}
.mcard.logged .mbody { border-top-color: var(--line); }

/* clubs + stars */

.mteams {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  min-width: 0;
}

.mteam { display: grid; gap: 7px; min-width: 0; }
.mteam .lbl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.mclub { font-size: 15px; font-weight: 600; }

.mstars { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }

.mstars button {
  font: inherit;
  font-size: 12.5px;
  font-weight: 650;
  color: var(--ink-dim);
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 9px;
  height: 36px;
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}
.mstars button:hover { border-color: var(--accent-line); color: var(--accent-ink); }
.mstars button.on {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.swap {
  align-self: center;
  margin-top: 26px;
  height: 36px;
  width: 40px;
  display: grid;
  place-items: center;
  font-size: 15px;
  color: var(--ink-dim);
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 9px;
  cursor: pointer;
}
.swap:hover { color: var(--accent-ink); border-color: var(--accent-line); }

/* odds grid */

.modds-cap { margin: 2px 0 -8px; }

.modds {
  display: grid;
  /* wide enough for the row labels' words, not just "1 / X / 2" */
  grid-template-columns: 56px repeat(3, minmax(0, 1fr));
  gap: 7px;
  min-width: 0;
  max-width: 720px;
}

.modd-corner, .modd-hd {
  font-size: 11px;
  font-weight: 650;
  color: var(--ink-faint);
  display: grid;
  place-items: center start;
  padding: 0 0 2px 9px;
  min-width: 0;
  white-space: nowrap;
}
.modd-corner { font-size: 10px; color: var(--ink-faint); }

.mcell {
  display: grid;
  gap: 1px;
  padding: 7px 9px;
  background: var(--field);
  border: 1.5px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  min-width: 0;
  transition: border-color .12s, background .12s;
}
.mcell:hover { border-color: var(--accent-line); }
.mcell.picked { border-color: var(--accent); background: var(--accent-wash); }

.mcell-key {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--ink-faint);
}
.mcell.picked .mcell-key { color: var(--accent-ink); }

.mcell input {
  font-size: 16.5px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  min-height: 0;
  width: 100%;
  -moz-appearance: textfield;
}
.mcell input::-webkit-outer-spin-button,
.mcell input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.mcell input:focus { outline: none; box-shadow: none; }

/* screenshot / paste */

.mread-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.mpaste { flex: 1 1 220px; font-size: 13.5px; }
.mread-note { flex: 1 1 100%; }

/* per-card call */

.mpred {
  display: grid;
  gap: 8px;
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  padding: 12px 14px;
}
.mpred-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
}
.mpred-key { font-size: 11.5px; font-weight: 650; color: var(--ink-faint); }
.mpred-p {
  font-family: var(--mono);
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--ink);
}
.mpred-fair { font-size: 12px; color: var(--ink-dim); }
.mpred-lock { font-size: 12.5px; color: var(--ink-faint); }

.pred-list { display: grid; gap: 6px; }
.pred-row {
  display: grid;
  grid-template-columns: 16px minmax(74px, auto) minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}
.pred-row.top .r-key { color: var(--accent-ink); font-weight: 700; }

.r-rank { font-size: 11.5px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.r-key { font-family: var(--mono); font-weight: 600; }
.r-bar {
  display: block;
  height: 7px;
  border-radius: 999px;
  background: var(--field-2);
  overflow: hidden;
}
.r-bar i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.r-p { font-weight: 650; font-variant-numeric: tabular-nums; }
.r-odds { font-size: 12px; color: var(--ink-faint); font-variant-numeric: tabular-nums; min-width: 38px; text-align: right; }

.pred-list.mini .pred-row { font-size: 12.5px; }

/* scores */

.mresult {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
}
.mresult .lbl { flex: 0 0 auto; margin-right: 2px; }
.mresult .lbl + .lbl { margin-left: 12px; }

.mresult .mgoal {
  font-size: 15px;
  font-weight: 650;
  text-align: center;
  font-variant-numeric: tabular-nums;
  width: 48px;
  min-width: 48px;
  max-width: 48px;
  min-height: 38px;
  padding: 6px 4px;
  color: var(--ink);
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 9px;
  -moz-appearance: textfield;
}
.mgoal::-webkit-outer-spin-button,
.mgoal::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.score-dash { color: var(--ink-faint); }

.pick-chip {
  font-family: var(--mono);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-faint);
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px 9px;
}
.pick-chip.empty { color: var(--ink-faint); }
.pick-chip:not(.empty) { color: var(--accent-ink); background: var(--accent-wash); border-color: var(--accent-line); }

/* card footer */

.mfoot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  padding-top: 4px;
}
.mpick {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-faint);
}
.mpick.on { color: var(--accent-ink); }
.mret { font-size: 12.5px; color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.mlog { margin-left: auto; }
.mnote { flex: 1 1 100%; font-size: 12px; color: var(--ink-faint); }
.mnote:empty { display: none; }

/* ---------------- stats ---------------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(116px, 1fr));
  gap: 10px;
}

.stat {
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  padding: 11px 13px;
  display: grid;
  gap: 2px;
  align-content: start;
  min-width: 0;
}

.s-key { font-size: 11.5px; font-weight: 650; color: var(--ink-faint); }
.s-val {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.s-sub { font-size: 11.5px; color: var(--ink-faint); line-height: 1.4; }

.s-val.pos, .pos { color: var(--win); }
.s-val.neg, .neg { color: var(--loss); }

/* ---------------- record ---------------- */

.rec-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 14px 0;
}
.sync-note { margin-left: auto; }
.sync-note.bad { color: var(--loss); }

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  text-align: left;
  font-size: 11.5px;
  font-weight: 650;
  color: var(--ink-faint);
  background: var(--panel-2);
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
  color: var(--ink-dim);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--panel-2); }

table.log td { font-variant-numeric: tabular-nums; }
table.log td:nth-child(2), table.log td:nth-child(7),
table.log td:nth-child(10) { color: var(--ink); font-weight: 550; }
table.log td.stars-col { color: var(--ink-dim); font-variant-numeric: tabular-nums; }

table.tiny { font-size: 12.5px; }
table.rank th:not(:first-child), table.rank td:not(:first-child) { text-align: right; }
table.tiny td { padding: 8px 12px; }

.teams-table td:nth-child(n+2) { font-variant-numeric: tabular-nums; }

.empty-note { color: var(--ink-faint); font-size: 13px; padding: 22px 12px; text-align: center; }

.match { color: var(--ink); font-weight: 600; }
.mine { color: var(--accent-ink); font-weight: 650; }
.top { font-weight: 650; }

.call { font-family: var(--mono); font-weight: 600; color: var(--ink); }
.score-col { font-family: var(--mono); letter-spacing: -.01em; }
.ro { color: var(--ink-faint); }
.hit { color: var(--win); font-weight: 600; }
.miss { color: var(--loss); font-weight: 600; }
.ok { color: var(--win); }
.warn { color: var(--loss); }

.msnap, .mfill { flex: none; }
.msel { justify-self: start; }
.miss-note { color: var(--ink-dim); }

.del {
  font: inherit;
  font-size: 15px;
  line-height: 1;
  color: var(--ink-faint);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
  width: 28px;
  height: 28px;
  cursor: pointer;
}
.del:hover { color: var(--loss); background: var(--loss-wash); border-color: var(--loss-wash); }

/* ---------------- ranking ---------------- */

.focus-head {
  display: grid;
  grid-template-columns: minmax(150px, 210px) minmax(0, 1fr) 132px 132px;
  gap: 12px 16px;
  align-items: start;
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 16px;
}

.focus-sel { display: grid; gap: 5px; min-width: 0; }

.pred-call { display: grid; gap: 2px; min-width: 0; }
.v-label { font-size: 11.5px; font-weight: 650; color: var(--ink-faint); }
.pred-sel {
  font-family: var(--mono);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -.03em;
  line-height: 1.15;
  color: var(--accent-ink);
}
.pred-sub { font-size: 12px; color: var(--ink-faint); min-height: 18px; }

.metric { display: grid; gap: 2px; min-width: 0; }
.m-key { font-size: 11.5px; font-weight: 650; color: var(--ink-faint); }
.m-val { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.m-sub { font-size: 11.5px; color: var(--ink-faint); line-height: 1.4; }

.pred-lock {
  background: var(--field);
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 16px;
}
.lock-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-dim);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 9px;
  margin-bottom: 8px;
}
.lock-title { font-size: 13.5px; font-weight: 600; }
.lock-steps { display: grid; gap: 6px; margin-top: 10px; }
.lock-steps li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--ink-dim);
}
.lock-mark {
  width: 16px; height: 16px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 10px;
  background: var(--field-2);
  color: var(--ink-faint);
}
.lock-label { flex: 1 1 auto; }
.lock-val { color: var(--ink-faint); font-variant-numeric: tabular-nums; }

#predList { gap: 7px; }
#predList .pred-row {
  grid-template-columns: 18px 52px minmax(0, 1fr) 56px 52px;
  font-size: 13.5px;
}

.learn-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }

.chip {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-size: 11.5px;
  color: var(--ink-dim);
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  padding: 4px 11px;
}
.chip b, .chip strong { color: var(--ink); font-variant-numeric: tabular-nums; }

.breakdown {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-2);
  overflow: hidden;
}
.breakdown summary {
  cursor: pointer;
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 650;
  color: var(--ink);
  list-style: none;
}
.breakdown summary::-webkit-details-marker { display: none; }
.breakdown summary::before {
  content: "›";
  display: inline-block;
  margin-right: 8px;
  color: var(--ink-faint);
  transition: transform .15s;
}
.breakdown[open] summary::before { transform: rotate(90deg); }
.breakdown table { background: var(--panel); }
.breakdown .caveat { padding: 0 14px 12px; margin-top: 10px; }

.conf-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin-top: 18px;
}
.conf-item {
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  padding: 10px 13px;
  display: grid;
  gap: 4px;
  min-width: 0;
}
.conf-item .mini { height: 5px; border-radius: 999px; background: var(--field-2); overflow: hidden; }
.conf-item .mini i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }

.rank-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--field-2);
  overflow: hidden;
  min-width: 60px;
}
.rank-bar i { display: block; height: 100%; background: var(--accent); }

/* ---------------- footer ---------------- */

.foot {
  max-width: 1120px;
  margin: 0 auto;
  padding: 22px;
  font-size: 12px;
  color: var(--ink-faint);
}

/* ---------------- phone ---------------- */

@media (max-width: 780px) {
  body { font-size: 15px; }

  .topbar-row { padding: 13px 15px; gap: 10px; }
  h1 { font-size: 16px; white-space: normal; }
  .theme-btn { font-size: 12.5px; padding: 8px 12px; min-height: 38px; }

  .layout { padding: 14px 12px 0; }
  .col-main { gap: 14px; }
  .panel { padding: 15px 14px; border-radius: 16px; }

  .panel-head h2 { font-size: 19px; }
  .panel-head .hint { font-size: 13px; }

  .round-bar {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 12px 10px;
    padding: 13px 14px;
  }
  .rnum { grid-column: 1; grid-row: 1; }
  .rprog { grid-column: 2; grid-row: 1; text-align: right; font-size: 12.5px; }
  .racts { grid-column: 1 / -1; grid-row: 2; }
  .racts .btn { flex: 1 1 0; min-height: 46px; }

  .mhead { padding: 12px 13px; gap: 8px; row-gap: 6px; }
  .mpair { font-size: 15.5px; flex: 1 1 40%; }
  .mcall { font-size: 12px; }
  .mstate { order: 3; flex: 0 0 auto; margin-left: 34px; }
  .mbody { padding: 14px 13px 16px; gap: 15px; }

  .mteams { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .mswap {
    width: auto;
    height: 36px;
    margin: 0 auto;
    padding: 0 22px;
    align-self: center;
  }
  .mclub { min-height: 46px; font-size: 16px; }
  .mstars button { height: 42px; font-size: 14px; }

  .modds { grid-template-columns: 30px repeat(3, minmax(0, 1fr)); gap: 6px; }
  .mcell { padding: 8px; }
  .mcell input { font-size: 17.5px; }

  .mread-row { gap: 8px; }
  .mpaste { flex: 1 1 100%; order: 1; min-height: 46px; font-size: 15px; }
  .mread-row .btn { flex: 1 1 0; order: 2; min-height: 44px; }
  .mread-note { order: 3; flex: 1 1 100%; }

  .mpred-p { font-size: 22px; }
  .pred-row { font-size: 13.5px; grid-template-columns: 16px 44px minmax(0, 1fr) auto auto; }

  .mresult { gap: 6px 8px; }
  .mresult .lbl:nth-of-type(n+2) { flex: 0 0 100%; margin: 4px 0 0; }
  .mresult .mgoal {
    width: 56px;
    min-width: 56px;
    max-width: 56px;
    min-height: 44px;
    font-size: 16px;
  }
  .mlog { flex: 1 1 auto; min-height: 46px; }

  .stats { grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: 8px; }
  .stat { padding: 10px 11px; }
  .s-val { font-size: 19px; }
  .s-sub { font-size: 11px; }

  .focus-head { grid-template-columns: 1fr 1fr; gap: 12px; }
  .focus-sel { grid-column: 1 / -1; }
  .pred-call { grid-column: 1 / -1; }
  .pred-sel { font-size: 22px; }

  #predList .pred-row { grid-template-columns: 16px 48px minmax(0, 1fr) 52px; }
  #predList .r-odds { display: none; }

  table { font-size: 12.5px; }
  th, td { padding: 9px 10px; }
  table.tiny { font-size: 12.5px; }

  .rec-actions { gap: 8px; }
  .sync-note { margin-left: 0; flex: 1 1 100%; }

  .sub-h { margin-top: 22px; }
  .foot { padding: 18px 14px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ---------------- why this call ---------------- */

.mwhy {
  margin-top: 12px;
  padding: 11px 13px;
  background: var(--field);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  display: grid;
  gap: 6px;
}

.mwhy[hidden] { display: none; }

.w-lbl {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--accent-ink);
}

.w-list {
  margin: 0;
  padding-left: 16px;
  display: grid;
  gap: 4px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink-dim);
}

.w-list li::marker { color: var(--accent); }

/* ---------------- link weight probe ---------------- */

.linkprobe {
  margin-top: 14px;
  padding: 14px 16px 12px;
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
}

.lp-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 13px;
  font-weight: 650;
  color: var(--ink);
}

.lp-bars {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 38px;
  margin: 12px 0 6px;
}

.lp-bar {
  flex: 1 1 0;
  min-width: 0;
  background: var(--line);
  border-radius: 3px 3px 0 0;
}

.lp-bar.on { background: var(--win); }

.lp-axis {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 10.5px;
  color: var(--ink-faint);
  margin-bottom: 10px;
}

.lp-lines {
  margin: 0;
  padding-left: 17px;
  display: grid;
  gap: 5px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--ink-dim);
  max-width: 92ch;
}

.lp-lines li::marker { color: var(--ink-faint); }

table.tiny tr.tot td {
  font-weight: 700;
  color: var(--ink);
  border-top: 1px solid var(--line);
  background: var(--panel-2);
}
.lp-lines .lp-ok { color: var(--ink-dim); }
.lp-lines .lp-warn { color: var(--ink); }

@media (max-width: 560px) {
  .lp-lines { font-size: 12px; }
  .modds { grid-template-columns: 50px repeat(3, minmax(0, 1fr)); gap: 6px; }
  .modd-corner, .modd-hd { font-size: 10px; padding-left: 7px; }
  .mcell-key { font-size: 9.5px; }
  .pred-row { grid-template-columns: 14px minmax(84px, auto) minmax(28px, 1fr) auto auto; gap: 7px; }
  .pred-list.mini .pred-row { font-size: 12px; }
}

@media print {
  body { background: #fff; }
  .theme-btn, .racts, .mread-row, .mlog, .del { display: none !important; }
  .panel { box-shadow: none; break-inside: avoid; }
}

/* ---------------- the short slips ---------------- */
.slip-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.slip-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  padding: 14px 15px;
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}
.slip-card:hover { border-color: var(--accent-line); }

.slip-hd { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.slip-tag {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.slip-conf {
  flex: none;
  font-size: 11px;
  font-weight: 650;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink-dim);
  white-space: nowrap;
}

.slip-main { display: flex; flex-direction: column; gap: 3px; }
.slip-match { font-size: 12.5px; color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.slip-sel { font-size: 23px; font-weight: 700; letter-spacing: -0.01em; color: var(--ink); }

.slip-mets { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.sm { display: inline-flex; align-items: baseline; gap: 5px; font-size: 11.5px; color: var(--ink-faint); }
.sm b { font-size: 14.5px; font-weight: 650; color: var(--ink); font-variant-numeric: tabular-nums; }

.slip-sub { margin: 0; font-size: 11.5px; color: var(--ink-faint); }
.slip-empty { margin: 0; font-size: 12.5px; line-height: 1.55; color: var(--ink-faint); }

.slip-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.slip-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: baseline;
  font-size: 12.5px;
}
.sr-no { font-size: 11px; font-weight: 650; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.sr-f { color: var(--ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-s { color: var(--ink-dim); }
.sr-p { color: var(--ink); font-weight: 650; font-variant-numeric: tabular-nums; }
.slip-row.clear .sr-s, .slip-row.clear .sr-p { color: var(--win); }

@media (max-width: 720px) {
  .slip-grid { grid-template-columns: minmax(0, 1fr); }
  .slip-sel { font-size: 21px; }
}

/* ---------------- the record card: fixed height, scrolls inside ---------------- */
/* The record grows a row per match, so it was the one panel that could push the
   whole page down indefinitely. It now holds a compact fixed height and the
   table scrolls inside it, with the header stuck to the top of that scroll. */
#historyPanel {
  display: flex;
  flex-direction: column;
  height: clamp(360px, 54vh, 500px);
  overflow: hidden;
}

#historyPanel .panel-head,
#historyPanel .stats,
#historyPanel .rec-actions { flex: 0 0 auto; }

#historyPanel .stats { margin-bottom: 10px; }

#historyPanel .table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
#historyPanel .table-wrap::-webkit-scrollbar { width: 10px; height: 10px; }
#historyPanel .table-wrap::-webkit-scrollbar-track { background: transparent; }
#historyPanel .table-wrap::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 999px;
  border: 2px solid var(--panel);
}
#historyPanel .table-wrap::-webkit-scrollbar-thumb:hover { background: var(--ink-faint); }
#historyPanel thead th { box-shadow: inset 0 -1px 0 var(--line); }

@media (max-width: 720px) {
  /* On a phone the record's own chrome has to stay small enough to leave the
     table a real window: four compact cards in two rows, tighter margins. */
  #historyPanel { height: min(76vh, 600px); }
  #historyPanel .panel-head { margin-bottom: 10px; }
  #historyPanel .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 8px;
  }
  #historyPanel .stat { padding: 8px 10px; }
  #historyPanel .stat .s-val { font-size: 17px; }
  #historyPanel .rec-actions { margin: 8px 0; }
}

/* ---------------- motion ---------------- */
/* Everything here is decoration: no layout depends on it, every rule is short
   enough to keep typing responsive, and the reduced-motion block at the end of
   this file switches all of it off. */
@keyframes panelIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes popIn {
  from { opacity: 0; transform: scale(0.94); }
  to { opacity: 1; transform: none; }
}
@keyframes sweep {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

/* Panels rise once, staggered, so the page assembles instead of appearing. */
.col-main > .panel {
  animation: panelIn 0.5s cubic-bezier(0.22, 0.75, 0.25, 1) both;
  transition: border-color 0.25s ease, box-shadow 0.25s ease, background-color 0.3s ease;
}
.col-main > .panel:nth-of-type(2) { animation-delay: 0.06s; }
.col-main > .panel:nth-of-type(3) { animation-delay: 0.12s; }
.col-main > .panel:nth-of-type(4) { animation-delay: 0.18s; }
.col-main > .panel:nth-of-type(5) { animation-delay: 0.24s; }
.col-main > .panel:nth-of-type(6) { animation-delay: 0.3s; }
.col-main > .panel:hover { border-color: var(--accent-line); }

body { transition: background-color 0.3s ease, color 0.3s ease; }

/* Cards, stats and chips respond to the pointer without moving their text. */
.mcard, .stat, .chip, .mcell, .mstars button, .mgoal, .btn, .del,
select, input[type="number"], input[type="text"] {
  transition: background-color 0.18s ease, border-color 0.18s ease,
              color 0.18s ease, box-shadow 0.18s ease, transform 0.12s ease;
}

.mcard:hover { border-color: var(--accent-line); box-shadow: var(--shadow); }
.stat:hover { transform: translateY(-1px); border-color: var(--accent-line); }
.mcell:active, .mstars button:active { transform: scale(0.97); }
.btn:active, .del:active { transform: translateY(1px) scale(0.99); }
.mcard.logged:hover { box-shadow: none; }

/* Bars grow to their value instead of jumping there. */
.r-bar i { transition: width 0.5s cubic-bezier(0.22, 0.75, 0.25, 1); }

/* The answer lands with a small pop, and the sync pill fades in. */
#predP, #predFair, .pred-sel { animation: popIn 0.32s cubic-bezier(0.22, 0.75, 0.25, 1) both; }
#predSel { display: inline-block; }
.sync-note { animation: fadeIn 0.35s ease both; }

/* A moving sheen only while the record is being written to the server. */
body[data-sync="busy"] #syncNote {
  background: linear-gradient(90deg, transparent 0%, var(--accent-line) 50%, transparent 100%);
  background-size: 200% 100%;
  animation: sweep 1.4s linear infinite;
  border-radius: 6px;
}

/* A new row settles in, and an opened card's body arrives softly. */
#logBody tr { animation: fadeIn 0.3s ease both; }
.mbody { animation: fadeIn 0.22s ease both; }

@media (prefers-reduced-motion: reduce) {
  .col-main > .panel, #predP, #predFair, .pred-sel, .sync-note,
  #logBody tr, .mbody { animation: none !important; }
  body[data-sync="busy"] #syncNote { animation: none !important; background: none; }
  .stat:hover, .btn:active, .del:active, .mcell:active, .mstars button:active { transform: none; }
}

/* ---------------- second price ---------------- */
.mbook2 {
  margin-top: 10px;
  padding-top: 6px;
  border-top: 1px solid var(--line-soft);
}
.mbook2-hd {
  font-size: 11.5px;
  font-weight: 650;
  color: var(--ink-faint);
  cursor: pointer;
  padding: 4px 0;
}
.mbook2-hd:hover { color: var(--ink-dim); }
.mbook2-cap { margin: 2px 0 4px; font-size: 11.5px; }
.mbook2 .modds { margin-top: 4px; }
