:root {
  --bg: #0f1420;
  --bg-2: #171d2b;
  --card: #1c2333;
  --card-2: #232c40;
  --line: #2b3550;
  --text: #e8ecf5;
  --muted: #93a0bd;
  --accent: #4f8cff;
  --accent-2: #2f6bdc;
  --good: #16a34a;
  --mid: #f59e0b;
  --bad: #dc2626;
  --radius: 12px;
  --shadow: 0 6px 24px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(1200px 600px at 80% -10%, #1a2540 0%, transparent 60%), var(--bg);
  background-color: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header */
.app-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 14px 22px;
  background: linear-gradient(180deg, var(--bg-2), transparent);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
  backdrop-filter: blur(6px);
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo { font-size: 30px; }
.app-header h1 { margin: 0; font-size: 20px; letter-spacing: .2px; }
.tagline { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }

.mode-toggle { display: flex; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 4px; }
.mode-btn {
  border: 0; background: transparent; color: var(--muted);
  padding: 8px 18px; border-radius: 999px; cursor: pointer;
  font-size: 14px; font-weight: 600; transition: .15s;
}
.mode-btn:hover { color: var(--text); }
.mode-btn.active { background: var(--accent); color: #fff; box-shadow: 0 2px 10px rgba(79,140,255,.4); }
.badge {
  display: inline-block; min-width: 19px; padding: 0 5px; margin-left: 5px;
  background: var(--good); color: #fff; border-radius: 999px;
  font-size: 11.5px; font-weight: 800; line-height: 19px; text-align: center;
  font-variant-numeric: tabular-nums; vertical-align: 1px;
}
.mode-btn.active .badge { background: #fff; color: var(--accent-2); }

/* Loader */
.loader { flex: 1; display: flex; align-items: center; justify-content: center; padding: 30px; }
.loader-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 30px; max-width: 520px; width: 100%; box-shadow: var(--shadow); }
.loader-card h2 { margin: 0 0 6px; }
.loader-card p { color: var(--muted); margin: 0 0 18px; }
.dropzone {
  border: 2px dashed var(--line); border-radius: var(--radius);
  padding: 34px; text-align: center; cursor: pointer; transition: .15s;
  background: var(--bg-2);
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: #1a2540; }
.dz-icon { font-size: 40px; display: block; margin-bottom: 8px; }
.dz-inner p { margin: 4px 0; color: var(--text); }
.dz-hint { color: var(--muted) !important; font-size: 13px; }
.file-status { margin-top: 16px; font-size: 13.5px; }
.file-status .ok { color: var(--good); }
.file-status .err { color: var(--bad); }

/* App layout */
.app { flex: 1; padding: 18px 22px 28px; max-width: 1400px; width: 100%; margin: 0 auto; }
.hidden { display: none !important; }
.pane { animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px);} to {opacity:1; transform:none;} }

.controls { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.search, .select {
  background: var(--card); color: var(--text); border: 1px solid var(--line);
  border-radius: 9px; padding: 10px 12px; font-size: 14px; outline: none;
}
.search { flex: 1; min-width: 180px; }
.search:focus, .select:focus { border-color: var(--accent); }
.select { cursor: pointer; }
.select-wide { min-width: 280px; flex: 1; }

.health-note { font-size: 12.5px; color: var(--muted); margin-bottom: 12px; }
.health-note b { color: var(--text); }
.health-note .warn { color: var(--mid); }

/* Fixture split */
.split { display: grid; grid-template-columns: 340px 1fr; gap: 18px; align-items: start; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }

.list { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; max-height: 74vh; overflow-y: auto; }
.list-group-head { position: sticky; top: 0; background: var(--card-2); padding: 8px 14px; font-size: 12px; font-weight: 700; color: var(--text); text-transform: uppercase; letter-spacing: .6px; border-bottom: 1px solid var(--line); z-index:1;}

/* Country › league › fixtures tree */
.tree-btn {
  width: 100%; display: flex; align-items: center; gap: 8px;
  background: transparent; border: 0; border-bottom: 1px solid var(--line);
  color: var(--text); cursor: pointer; font: inherit; text-align: left;
}
.tree-btn:hover { background: var(--card-2); }
.tree-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-count {
  font-size: 11px; font-variant-numeric: tabular-nums; color: var(--muted);
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 999px; padding: 1px 7px;
}
.caret { display: inline-block; width: 10px; color: var(--muted); transition: transform .12s; font-size: 10px; }
.tree-btn.open .caret { transform: rotate(90deg); }

.country-btn {
  position: sticky; top: 0; z-index: 2; background: var(--card-2);
  padding: 10px 14px; font-size: 12.5px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .6px;
}
.country-btn:hover { background: #2a3450; }
.country-btn.open { color: var(--accent); }

.league-btn { padding: 8px 14px 8px 24px; font-size: 13px; font-weight: 600; color: var(--muted); }
.league-btn.open { color: var(--text); }
.tree-league .fx-item { padding-left: 34px; }
.tree-league .fx-item.active { padding-left: 31px; }
.btn-ghost {
  background: var(--card); color: var(--muted); border: 1px solid var(--line);
  border-radius: 9px; padding: 10px 12px; font: inherit; font-size: 13px; cursor: pointer;
}
.btn-ghost:hover { color: var(--text); border-color: var(--accent); }
.fx-item { padding: 11px 14px; border-bottom: 1px solid var(--line); cursor: pointer; transition: .12s; }
.fx-item:hover { background: var(--card-2); }
.fx-item.active { background: #223056; border-left: 3px solid var(--accent); padding-left: 11px; }
.fx-teams { font-weight: 600; font-size: 14.5px; }
.fx-meta { font-size: 12px; color: var(--muted); margin-top: 3px; display: flex; gap: 8px; }
.fx-legs { color: var(--good); font-size: 11px; border: 1px solid var(--good); border-radius: 5px; padding: 0 5px; white-space: nowrap; }

/* Detail */
.detail { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; min-height: 300px; }
.detail-empty { color: var(--muted); text-align: center; padding: 60px 0; }
.fx-header { border-bottom: 1px solid var(--line); padding-bottom: 14px; margin-bottom: 14px; }
.fx-header .teams { font-size: 22px; font-weight: 700; }
.fx-header .sub { color: var(--muted); font-size: 13.5px; margin-top: 4px; display: flex; gap: 12px; flex-wrap: wrap; }
.sample-pill { background: var(--bg-2); border: 1px solid var(--line); border-radius: 999px; padding: 1px 10px; font-size: 12px; }

/* Last-5 form strips */
.form-strips { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
@media (max-width: 700px) { .form-strips { grid-template-columns: 1fr; } }
.strip { background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.strip-head { font-size: 13px; color: var(--muted); margin-bottom: 8px; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.strip-head b { color: var(--text); font-size: 14px; }
.strip-rec { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.strip-empty { font-size: 12.5px; color: var(--muted); padding: 6px 0; }
.res-list { list-style: none; margin: 0; padding: 0; }
.res {
  display: grid; grid-template-columns: 22px 40px 1fr auto;
  align-items: center; gap: 8px; padding: 5px 0;
  border-bottom: 1px solid var(--line); font-size: 13px;
}
.res:last-child { border-bottom: 0; }
.res-pill {
  width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center;
  font-size: 11px; font-weight: 800; color: #fff;
}
.res.w .res-pill { background: var(--good); }
.res.d .res-pill { background: var(--muted); }
.res.l .res-pill { background: var(--bad); }
.res-score { font-weight: 800; font-variant-numeric: tabular-nums; }
.res-opp { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res-when { color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.form-strips-hint {
  font-size: 12.5px; line-height: 1.5; color: var(--muted); margin-bottom: 18px;
  background: var(--bg-2); border: 1px dashed var(--line); border-radius: 10px; padding: 10px 12px;
}
.form-strips-hint b { color: var(--text); }

.mkt-group { margin-bottom: 18px; }
.mkt-group h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .6px; color: var(--accent); margin: 0 0 8px; display: flex; align-items: center; }
.mkt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.pick-hint { font-size: 12px; color: var(--muted); margin-top: 8px; }

.mkt {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 9px;
  padding: 9px 11px; position: relative; overflow: hidden;
  cursor: pointer; transition: border-color .12s, transform .06s;
}
.mkt:hover { border-color: var(--accent); }
.mkt:active { transform: scale(.99); }
.mkt:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.mkt.picked { border-color: var(--good); box-shadow: inset 0 0 0 1px var(--good); }
.mkt.picked::after {
  content: '✓'; position: absolute; top: 5px; right: 7px; z-index: 2;
  color: var(--good); font-size: 12px; font-weight: 800;
}
.mkt.picked .name { padding-right: 14px; }
.mkt .bar { position: absolute; left: 0; top: 0; bottom: 0; opacity: .16; z-index: 0; }
.mkt .row { position: relative; z-index: 1; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.mkt .name { font-size: 13px; color: var(--text); }
.mkt .pct { font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; }
.mkt .inv { position: relative; z-index:1; font-size: 11px; color: var(--muted); margin-top: 2px; }
.info-btn {
  width: 19px; height: 19px; padding: 0; margin-left: 7px; vertical-align: middle;
  border-radius: 50%; border: 1px solid var(--accent); background: transparent;
  color: var(--accent); font: inherit; font-size: 11.5px; font-weight: 800; font-style: italic;
  line-height: 1; cursor: pointer; flex: 0 0 auto; text-transform: none;
}
.info-btn:hover { background: var(--accent); color: #fff; }

.inv-btn {
  background: transparent; border: 1px dashed var(--line); color: var(--muted);
  border-radius: 6px; padding: 1px 6px; font: inherit; font-size: 11px; cursor: pointer;
}
.inv-btn:hover { border-color: var(--accent); color: var(--text); }
.inv-btn.picked { border-style: solid; border-color: var(--good); color: var(--good); font-weight: 700; }
.inv-btn.picked::after { content: ' ✓'; }

/* Team form */
.form-toggle { background: var(--card-2); border: 1px solid var(--line); color: var(--text); border-radius: 9px; padding: 10px 14px; cursor: pointer; width: 100%; text-align: left; font-weight: 600; font-size: 14px; }
.form-toggle:hover { border-color: var(--accent); }
.form-panel { margin-top: 10px; }
.form-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.form-table th, .form-table td { padding: 6px 10px; border-bottom: 1px solid var(--line); text-align: right; }
.form-table th:first-child, .form-table td:first-child { text-align: left; color: var(--muted); }
.form-table thead th { color: var(--accent); font-size: 12px; }

/* Info modal (per-market supporting stats) */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(6,9,16,.72); backdrop-filter: blur(2px); }
.modal-card {
  position: relative; z-index: 1; width: 100%; max-width: 460px; max-height: 85vh; overflow-y: auto;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
  animation: pop .14s ease;
}
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-x {
  position: absolute; top: 10px; right: 10px; width: 34px; height: 34px;
  background: transparent; border: 0; color: var(--muted); font-size: 15px; cursor: pointer; border-radius: 8px;
}
.modal-x:hover { color: var(--text); background: var(--card-2); }
.modal-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-right: 30px; }
.modal-head h3 { margin: 0; font-size: 18px; }
.modal-pct { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; }
.modal-sub { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.modal-why {
  font-size: 13px; line-height: 1.5; color: var(--muted); margin: 12px 0 14px;
  background: var(--bg-2); border-left: 3px solid var(--accent); border-radius: 0 8px 8px 0; padding: 9px 11px;
}
.modal-card .form-toggle { margin-top: 14px; font-size: 13px; }

/* Market table */
.market-table-wrap { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
table.mt { width: 100%; border-collapse: collapse; font-size: 14px; }
table.mt th, table.mt td { padding: 10px 14px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
table.mt thead th { position: sticky; top: 0; background: var(--card-2); color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
table.mt tbody tr { cursor: pointer; }
table.mt tbody tr:hover { background: var(--card-2); }
.prob-cell { display: flex; align-items: center; gap: 10px; min-width: 160px; }
.prob-bar { flex: 1; height: 8px; border-radius: 999px; background: var(--bg-2); overflow: hidden; }
.prob-bar > i { display: block; height: 100%; border-radius: 999px; }
.prob-val { font-weight: 800; font-variant-numeric: tabular-nums; width: 44px; text-align: right; }
.rank { color: var(--muted); font-variant-numeric: tabular-nums; }
.add-btn {
  width: 30px; height: 30px; border-radius: 8px; cursor: pointer;
  background: var(--bg-2); border: 1px solid var(--line); color: var(--muted);
  font-size: 16px; font-weight: 700; line-height: 1; transition: .12s;
}
.add-btn:hover { border-color: var(--accent); color: var(--text); }
.add-btn.picked { background: var(--good); border-color: var(--good); color: #fff; }

/* Accumulator */
.acc-legs { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
.acc-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--muted);
}
table.acc-table th, table.acc-table td { vertical-align: middle; }
.leg-fx { font-weight: 600; }
.leg-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.leg-mkt { font-weight: 600; white-space: normal; max-width: 240px; }
.acc-remove {
  background: transparent; border: 0; color: var(--muted); cursor: pointer;
  font-size: 15px; padding: 4px 6px; border-radius: 6px;
  min-width: 36px; min-height: 36px;   /* comfortable to tap on a touchscreen */
}
.acc-remove:hover { color: var(--bad); background: var(--bg-2); }
.acc-stale { padding: 10px 14px; font-size: 13px; color: var(--mid); border-bottom: 1px solid var(--line); }
.link-btn { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; text-decoration: underline; padding: 0; }

.acc-empty { text-align: center; color: var(--muted); padding: 70px 20px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.acc-empty-icon { font-size: 44px; margin-bottom: 10px; }
.acc-empty h2 { margin: 0 0 8px; color: var(--text); font-size: 19px; }
.acc-empty p { margin: 0 auto; max-width: 460px; font-size: 13.5px; line-height: 1.6; }
.acc-empty b { color: var(--text); }

/* ============ Accounts, submit & My Bets ============ */
.btn-primary {
  background: var(--accent); color: #fff; border: 0; border-radius: 8px;
  padding: 10px 16px; font: inherit; font-weight: 700; cursor: pointer; transition: .12s;
}
.btn-primary:hover { background: var(--accent-2); }
.btn-primary:disabled { opacity: .6; cursor: default; }

/* header auth widget */
.auth-area { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.auth-email { font-size: 12.5px; color: var(--muted); max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* login / sign-up modal */
.auth-card { max-width: 380px; }
.auth-card h2 { margin: 0 0 4px; font-size: 20px; }
.auth-sub { color: var(--muted); font-size: 13px; margin: 0 0 16px; }
.auth-label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 12px; }
.auth-label input {
  display: block; width: 100%; margin-top: 5px; padding: 10px 12px;
  background: var(--bg-2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; font: inherit;
}
.auth-label input:focus { border-color: var(--accent); outline: none; }
.auth-card .btn-primary { width: 100%; margin-top: 4px; }
.auth-msg { font-size: 12.5px; color: var(--muted); margin-top: 10px; min-height: 16px; }
.auth-msg.err { color: var(--bad); }
.auth-switch { font-size: 13px; color: var(--muted); margin-top: 14px; text-align: center; }

/* submit bar on the slip */
.acc-submit { display: flex; align-items: center; gap: 10px; padding: 14px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.acc-name {
  flex: 1 1 220px; min-width: 0; padding: 9px 12px;
  background: var(--bg-2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; font: inherit;
}
.acc-name:focus { border-color: var(--accent); outline: none; }
.acc-submit-msg { font-size: 12.5px; color: var(--bad); flex-basis: 100%; }

/* my bets */
.loading { color: var(--muted); text-align: center; padding: 50px 0; }
.muted { color: var(--muted); }
.mybets-stats { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 18px; }
.mybets-stats h3 { margin: 0 0 12px; font-size: 15px; }
.mybets-hint { color: var(--muted); font-size: 12px; margin: 10px 0 0; font-style: italic; }
.acca-list { display: grid; gap: 14px; }
.acca-card { background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--muted); border-radius: var(--radius); overflow: hidden; }
.acca-card.won { border-left-color: var(--good); }
.acca-card.lost { border-left-color: var(--bad); }
.acca-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; }
.acca-meta { padding: 0 16px 10px; font-size: 12px; color: var(--muted); }
.acca-status { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; padding: 2px 9px; border-radius: 999px; background: var(--card-2); color: var(--muted); }
.acca-status.won { background: var(--good); color: #06210f; }
.acca-status.lost { background: var(--bad); color: #2a0a0a; }
.acca-legs-tbl td { font-size: 13px; }
.outcome { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; color: #fff; }
.outcome.won { background: var(--good); color: #06210f; }
.outcome.lost { background: var(--bad); }
.outcome.pending { background: var(--card-2); color: var(--muted); border: 1px solid var(--line); }
.outcome.void { background: var(--card-2); color: var(--muted); border: 1px solid var(--line); }

/* form window toggle (Last 5 / Last 10) */
.win-toggle { display: flex; align-items: center; gap: 2px; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 4px 4px 4px 12px; }
.win-label { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-right: 4px; }
.win-btn { border: 0; background: transparent; color: var(--muted); padding: 6px 12px; border-radius: 999px; cursor: pointer; font: inherit; font-size: 13px; font-weight: 600; transition: .12s; }
.win-btn:hover { color: var(--text); }
.win-btn.active { background: var(--accent); color: #fff; box-shadow: 0 2px 10px rgba(79,140,255,.4); }

/* Model builder */
.model-builder { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; }
.mb-bet { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.mb-lead { color: var(--muted); font-size: 13px; }
.mb-bet .select-wide { flex: 0 1 260px; }
.mb-seg { display: flex; gap: 2px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.seg-btn { border: 0; background: transparent; color: var(--muted); padding: 5px 12px; border-radius: 999px; cursor: pointer; font: inherit; font-size: 13px; font-weight: 600; }
.seg-btn.active { background: var(--accent); color: #fff; }
.mb-conds { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.mb-cond { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mb-cond .mb-col { flex: 0 1 240px; }
.mb-cond .mb-op { flex: 0 0 84px; }
.mb-cond .mb-a, .mb-cond .mb-b { flex: 0 0 88px; }
.mb-and { color: var(--muted); font-size: 13px; }
.mb-unit { color: var(--muted); font-size: 13px; min-width: 12px; }
.mb-rm { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 15px; padding: 4px 6px; border-radius: 6px; }
.mb-rm:hover { color: var(--bad); background: var(--card-2); }
.mb-add { margin-top: 4px; }
.mb-count { font-size: 14px; color: var(--muted); margin: 6px 2px 12px; }
.mb-count b { color: var(--text); }
.mb-why { font-size: 11.5px; color: var(--muted); margin-top: 3px; white-space: normal; }
/* saved models */
.mb-saved { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.mb-saved-lead { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-right: 2px; }
.mb-saved-empty { font-size: 12.5px; color: var(--muted); margin-bottom: 14px; font-style: italic; }
.model-chip { display: inline-flex; align-items: center; background: var(--card-2); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.model-load { background: none; border: 0; color: var(--text); font: inherit; font-size: 13px; padding: 5px 4px 5px 12px; cursor: pointer; }
.model-load:hover { color: var(--accent); }
.model-del { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 5px 10px 5px 4px; font-size: 12px; }
.model-del:hover { color: var(--bad); }
.mb-save { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 16px; }
.mb-save-msg { font-size: 12.5px; color: var(--muted); }
.mb-save-msg.err { color: var(--bad); }
.mb-rec b { color: var(--good); }
.mb-rec.dim { opacity: .75; }
.chip-rec { font-size: 11px; font-weight: 700; color: var(--good); background: var(--bg-2); border-radius: 6px; padding: 1px 5px; margin-left: 2px; }
.chip-rec.dim { color: var(--muted); }

/* Footer */
.app-footer { border-top: 1px solid var(--line); padding: 12px 22px; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.disclaimer { font-style: italic; }

/* ============ Phones ============ */
@media (max-width: 640px) {
  /* A sticky 3-row header would eat a third of the screen. */
  .app-header { position: static; flex-direction: column; align-items: stretch; gap: 10px; padding: 12px 14px; }
  .app-header h1 { font-size: 18px; }
  .logo { font-size: 26px; }
  .tagline { font-size: 12px; }

  /* The three tabs must share the width, not overflow it. */
  .mode-toggle { width: 100%; }
  .mode-btn { flex: 1; min-width: 0; padding: 10px 4px; font-size: 13px; white-space: nowrap; }

  .app { padding: 14px 14px 24px; }

  /* Controls: search full width, the two filters side by side. */
  .controls { gap: 8px; }
  .search { flex: 1 1 100%; }
  .select { flex: 1 1 calc(50% - 4px); min-width: 0; }
  .select-wide { flex: 1 1 100%; }
  #expandAll { flex: 1 1 100%; }

  /* Keep the fixture list from filling the screen above the detail. */
  .list { max-height: 52vh; }
  .detail { padding: 14px; }
  .fx-header .teams { font-size: 18px; }

  /* Two market cards per row reads better than one tall column. */
  .mkt-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 7px; }
  .mkt .pct { font-size: 16px; }
  .inv-btn { padding: 4px 8px; font-size: 11.5px; }  /* was too small to tap */
  .info-btn { width: 24px; height: 24px; font-size: 13px; }
  .modal { padding: 12px; align-items: end; }        /* sheet-style on a phone */
  .modal-card { max-width: none; max-height: 88vh; padding: 18px 16px; }

  .res { grid-template-columns: 22px 36px 1fr; row-gap: 0; }
  .res-when { grid-column: 2 / -1; font-size: 11px; margin-top: -2px; }

  /* Accumulator: stack each selection as a card instead of a sideways-scrolling table. */
  .acc-legs { overflow-x: visible; }
  .acc-table thead { display: none; }
  .acc-table, .acc-table tbody, .acc-table tr, .acc-table td { display: block; width: 100%; }
  .acc-table tr { position: relative; padding: 12px 14px 10px; border-bottom: 1px solid var(--line); }
  .acc-table td { border: 0; padding: 4px 0; white-space: normal; }
  .acc-table td[data-label] { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
  .acc-table td[data-label]::before {
    content: attr(data-label); color: var(--muted); font-size: 12px; flex: 0 0 auto;
  }
  .leg-mkt { font-size: 15px; padding-right: 30px !important; }
  .prob-cell { min-width: 0; flex: 1; }
  .acc-remove { position: absolute; top: 6px; right: 6px; font-size: 17px; min-width: 40px; min-height: 40px; }
  .acc-empty { padding: 48px 16px; }

  /* ---- Newer tabs (added after the original mobile pass) ---- */
  /* 5 tabs won't fit at equal width — let the pill row scroll instead of clipping. */
  .mode-toggle { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .mode-toggle::-webkit-scrollbar { display: none; }
  .mode-btn { flex: 0 0 auto; padding: 9px 12px; }
  /* Header extras stack left-aligned. */
  .win-toggle { align-self: flex-start; }
  .auth-area { margin-left: 0; }

  /* Submit / save rows wrap tidily; inputs go full width. */
  .acc-submit, .mb-save { gap: 8px; }
  .acc-name { flex: 1 1 100%; }

  /* My Bets: let the small tables wrap rather than overflow the screen. */
  .mybets-stats { padding: 14px; }
  .mybets-stats table th, .mybets-stats table td, .acca-legs-tbl td { white-space: normal; }

  /* Model builder: stack each condition so nothing is cramped. */
  .mb-lead { font-size: 12px; }
  .mb-cond { gap: 6px 8px; }
  .mb-cond .mb-col { flex: 1 1 100%; }
  .mb-cond .mb-op { flex: 0 0 76px; }
  .mb-cond .mb-a, .mb-cond .mb-b { flex: 1 1 60px; }
  .mb-count { font-size: 13px; }
}
