:root {
  --bg: #0e1117;
  --panel: #161b22;
  --panel2: #1c2330;
  --border: #2a3344;
  --text: #e6edf3;
  --muted: #a8b6cc;
  --accent: #f0b429;
  --shorten: #ff6b7a;
  --shorten-bg: rgba(255, 80, 100, 0.18);
  --drift: #3dd68c;
  --drift-bg: rgba(61, 214, 140, 0.14);
  --chip: #243044;
  --first: #f0b429;
  --cold: #7aa2ff;
  --bf: #ff9f43;
  --touch: 44px;
  --radius: 10px;
  --topbar-h: 48px;
  --bottom-h: 60px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang HK", "Noto Sans TC", sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { overflow-x: hidden; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--text);
  font-size: 16px; line-height: 1.4;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; cursor: pointer; }

/* —— Top bar —— */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(14,17,23,.94); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 8px 12px; min-height: var(--topbar-h);
}
.brand { font-weight: 700; font-size: .95rem; white-space: nowrap; }
.brand span { color: var(--accent); }
.badge {
  display: inline-block; padding: 2px 7px; border-radius: 999px;
  background: var(--chip); color: var(--muted); font-size: .65rem;
  font-weight: 600; margin-left: 4px; vertical-align: middle;
}
.asof { color: var(--muted); font-size: .7rem; text-align: right; line-height: 1.3; max-width: 62%; }
.asof .batch-line { opacity: .85; }
.fetch-fail { color: var(--shorten); font-weight: 700; }

.race-chips, .horse-filter {
  display: flex; gap: 6px; padding: 0 10px 8px;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.race-chips::-webkit-scrollbar, .horse-filter::-webkit-scrollbar { display: none; }
.race-chips[hidden], .horse-filter[hidden] { display: none !important; }

.chip-btn {
  flex: 0 0 auto;
  min-height: 32px; min-width: 36px;
  padding: 4px 10px; border-radius: 8px;
  background: var(--panel); border: 1px solid var(--border);
  color: var(--text); font-weight: 600; font-size: .82rem;
}
.chip-btn.active { background: var(--accent); color: #111; border-color: var(--accent); }
.horse-filter .chip-btn { min-width: 34px; padding: 4px 8px; font-variant-numeric: tabular-nums; }

/* —— Layout —— */
.wrap {
  max-width: 1100px; margin: 0 auto;
  padding: 10px 10px calc(var(--bottom-h) + var(--safe-b) + 28px);
}
.loading { color: var(--muted); padding: 24px 8px; text-align: center; }
.meta { color: var(--muted); font-size: .875rem; margin: 0 0 8px; }
.h1 { font-size: 1.15rem; margin: 4px 0 6px; font-weight: 700; }
.h2 { font-size: .95rem; margin: 0 0 8px; font-weight: 700; color: var(--accent); }
.note {
  background: var(--panel2); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 10px; font-size: .75rem;
  color: var(--muted); margin: 8px 0 12px; line-height: 1.45;
}

/* —— Cards —— */
.card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px; margin: 8px 0;
}
.card.tap { display: block; color: inherit; }
.card.tap:hover { border-color: var(--accent); text-decoration: none; }
.card-row {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 8px; flex-wrap: wrap;
}
.grid2 { display: grid; grid-template-columns: 1fr; gap: 8px; }
@media (min-width: 720px) { .grid2 { grid-template-columns: 1fr 1fr; } }

/* —— Compact race overview cards —— */
.race-mini {
  display: block; color: inherit;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 8px 10px; margin: 6px 0;
}
.race-mini:hover { border-color: var(--accent); text-decoration: none; }
.race-mini .title { font-weight: 700; font-size: .9rem; }
.race-mini .line { margin-top: 4px; font-size: .85rem; }
.race-mini .sub { color: var(--muted); font-size: .72rem; margin-top: 3px; }

/* —— Runner cards (mobile) —— */
.runner-cards { display: flex; flex-direction: column; gap: 6px; }
.runner-card {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 118px;
  gap: 4px 8px;
  align-items: start;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 8px;
}
.runner-card.fav { border-left: 3px solid var(--accent); }
.runner-card .rc-main { min-width: 0; }
.runner-card .rc-name {
  display: flex; flex-wrap: wrap; gap: 3px; align-items: center;
  min-width: 0;
}
.runner-card .rc-name .name {
  font-weight: 600; font-size: .9rem;
  overflow-wrap: break-word; word-break: normal; min-width: 0;
}
.runner-card .rc-form {
  margin-top: 2px; font-size: .72rem; color: var(--muted); line-height: 1.35;
  overflow-wrap: break-word; word-break: normal;
}
.runner-card .rc-odds {
  width: 118px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px 4px;
  align-content: start;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.runner-card .rc-odds .w {
  font-weight: 700; font-size: .95rem; line-height: 1.2;
  justify-self: stretch; text-align: right;
}
.runner-card .rc-odds .p {
  color: var(--muted); font-size: .82rem; line-height: 1.2;
  justify-self: stretch; text-align: right;
}
.runner-card .rc-odds .pill-amp {
  font-size: .6rem; padding: 2px 2px; line-height: 1.15;
  justify-self: stretch; text-align: center;
  white-space: nowrap;
  letter-spacing: -0.03em;
  background: rgba(255,255,255,.06);
  max-width: 100%;
  overflow: visible;
}
.runner-card .rc-odds .pill-amp.shorten { background: var(--shorten-bg); color: var(--shorten); }
.runner-card .rc-odds .pill-amp.drift { background: var(--drift-bg); color: var(--drift); }
.runner-card .spark-wrap {
  grid-column: 1 / -1;
  margin-top: 2px;
  overflow: visible;
}
.runner-card .spark i, .runner-card .spark-hours em { width: 6px; }

@media (min-width: 641px) {
  .runner-cards { display: none; }
}

/* Desktop table for runners */
.desk-only { display: none; }
@media (min-width: 641px) {
  .desk-only { display: block; }
  .mobile-only { display: none !important; }
}

/* —— Tables —— */
.hour-scroll {
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  margin: 0 -2px; border-radius: 6px;
}
table.odds {
  width: 100%; border-collapse: collapse; font-size: .8rem;
  min-width: 0;
}
table.odds.wide { min-width: 640px; }
table.odds th, table.odds td {
  padding: 6px 5px; border-bottom: 1px solid var(--border);
  text-align: left; vertical-align: middle; white-space: nowrap;
}
table.odds th {
  color: var(--muted); font-weight: 600; font-size: .7rem;
  background: var(--panel);
  /* no sticky th on mobile — avoids clash with topbar */
  position: static;
}
table.odds td.sticky-col, table.odds th.sticky-col {
  position: sticky; left: 0; z-index: 2;
  background: var(--panel); box-shadow: 2px 0 0 var(--border);
}
table.odds tr:hover td { background: var(--panel2); }
table.odds tr:hover td.sticky-col { background: var(--panel2); }

.num { font-variant-numeric: tabular-nums; font-weight: 600; }
.no {
  display: inline-flex; width: 26px; height: 26px;
  align-items: center; justify-content: center;
  border-radius: 7px; background: #243044; font-weight: 700; font-size: .8rem;
}
.name { font-weight: 600; }
.sub { color: var(--muted); font-size: .875rem; }
.shorten { color: var(--shorten); background: var(--shorten-bg); }
.drift { color: var(--drift); background: var(--drift-bg); }
.cell {
  padding: 2px 5px; border-radius: 5px;
  display: inline-block; min-width: 2.2em; text-align: center;
}
.pill-amp {
  display: inline-block; padding: 1px 6px; border-radius: 999px;
  font-size: .7rem; font-weight: 700;
}

/* —— Tags —— */
.tag {
  display: inline-block; padding: 1px 6px; border-radius: 999px;
  font-size: .65rem; font-weight: 700;
}
.tag.first { background: rgba(240,180,41,.2); color: var(--first); }
.tag.cold { background: rgba(122,162,255,.18); color: var(--cold); }
.tag.bf { background: rgba(255,159,67,.2); color: var(--bf); }
.tag.w5p { background: rgba(61,214,140,.15); color: var(--drift); }
.tag.gu { background: rgba(255,107,122,.15); color: var(--shorten); }

/* —— Spark —— */
.spark-block {
  display: inline-flex; flex-direction: column; gap: 2px;
  vertical-align: middle; max-width: 100%;
  overflow: visible;
}
.spark { display: inline-flex; gap: 2px; align-items: flex-end; height: 22px; }
.spark i {
  display: block; width: 5px; border-radius: 2px 2px 0 0;
  background: #3d4f6a; min-height: 2px;
}
.spark i.shorten { background: var(--shorten); }
.spark i.drift { background: var(--drift); }
.spark-hours {
  display: inline-flex; gap: 2px; min-height: 12px; height: auto;
  font-size: .55rem; color: var(--muted); line-height: 1.1;
  overflow: visible;
}
.spark-hours em {
  display: block; width: 6px; font-style: normal; text-align: center;
  overflow: visible; letter-spacing: -0.04em;
}
.spark-legend { margin: 0 0 8px; overflow-wrap: anywhere; word-break: normal; }
.spark-legend .legend-full { display: none; }
.spark-legend .legend-short { display: inline; }
@media (min-width: 641px) {
  .spark-legend .legend-full { display: inline; }
  .spark-legend .legend-short { display: none; }
}
.chart-title {
  margin: 0 0 6px; font-size: .85rem; font-weight: 700; color: var(--text);
}
.chart-caption {
  margin: 4px 0 0; font-size: .875rem; color: var(--muted); line-height: 1.45;
  overflow-wrap: anywhere; word-break: normal;
}
.chart-caption .swatch {
  display: inline-block; width: 8px; height: 8px; border-radius: 2px;
  margin: 0 2px 0 0; vertical-align: -1px;
}
.chart-caption .swatch.shorten { background: var(--shorten); }
.chart-caption .swatch.drift { background: var(--drift); }
.chart-legend .legend-label {
  font-weight: 600; color: var(--text); margin-right: 2px;
}

/* —— Drawers (mobile collapsible) —— */
details.drawer {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); margin: 8px 0; overflow: hidden;
}
details.drawer > summary {
  list-style: none; cursor: pointer;
  padding: 10px 12px; font-weight: 700; font-size: .9rem;
  display: flex; justify-content: space-between; align-items: center;
  min-height: var(--touch); user-select: none;
}
details.drawer > summary::-webkit-details-marker { display: none; }
details.drawer > summary::after {
  content: "▾"; color: var(--muted); font-size: .85rem;
  transition: transform .15s;
}
details.drawer[open] > summary::after { transform: rotate(180deg); }
details.drawer .drawer-body { padding: 0 10px 10px; }

@media (min-width: 641px) {
  details.drawer > summary { pointer-events: none; }
  details.drawer > summary::after { display: none; }
  details.drawer:not([open]) .drawer-body { display: block; }
}

/* —— Charts —— */
.chart-box {
  background: var(--panel2); border-radius: 8px;
  padding: 8px; margin: 6px 0; overflow: hidden;
}
.chart-box svg { display: block; width: 100%; height: auto; max-height: 220px; }
.chart-legend {
  display: flex; flex-wrap: wrap; gap: 6px 10px;
  margin-top: 6px; font-size: .7rem; color: var(--muted);
}
.chart-legend span { display: inline-flex; align-items: center; gap: 4px; }
.chart-legend i {
  width: 10px; height: 3px; border-radius: 1px; display: inline-block;
}
.prob-bars { display: flex; flex-direction: column; gap: 4px; margin: 6px 0; }
.prob-row {
  display: grid; grid-template-columns: 28px 1fr 52px;
  gap: 6px; align-items: center; font-size: .78rem;
}
.prob-track {
  height: 10px; background: #1a2230; border-radius: 4px; overflow: hidden;
}
.prob-fill {
  height: 100%; border-radius: 4px; background: var(--accent);
  min-width: 2px;
}
.prob-fill.shorten { background: var(--shorten); }
.prob-fill.drift { background: var(--drift); }
.spark-bar-row {
  display: flex; align-items: center; gap: 8px;
  margin: 4px 0; font-size: .8rem;
}
.spark-bar-track {
  flex: 1; height: 8px; background: #1a2230; border-radius: 4px; overflow: hidden;
}
.spark-bar-fill {
  height: 100%; background: var(--shorten); border-radius: 4px;
}

/* —— List rows —— */
.list-row {
  display: flex; justify-content: space-between; align-items: center;
  gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border);
  color: inherit;
}
.list-row:last-child { border-bottom: 0; }
.list-row:hover { text-decoration: none; background: transparent; }
.list-row .main { font-weight: 600; font-size: .88rem; }
.list-row .side { text-align: right; font-variant-numeric: tabular-nums; }

/* —— Bottom nav —— */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: rgba(14,17,23,.96); backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  padding: 4px 2px calc(4px + var(--safe-b));
  min-height: calc(var(--bottom-h) + var(--safe-b));
}
.bnav {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; color: var(--muted); font-size: .78rem; font-weight: 700; letter-spacing: 0;
  min-height: var(--touch); text-decoration: none; border-radius: 8px;
}
.bnav:hover { text-decoration: none; color: var(--text); }
.bnav.active { color: var(--accent); }

.footer {
  margin-top: 16px; color: var(--muted); font-size: .7rem;
  border-top: 1px solid var(--border); padding-top: 10px; line-height: 1.45;
}
.race-header-line {
  font-size: .82rem; color: var(--muted); margin: 0 0 8px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.empty { color: var(--muted); padding: 12px 4px; font-size: .85rem; }

/* Race picker grid on 場次 tab */
.race-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0;
}
.race-grid a {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 56px; background: var(--panel); border: 1px solid var(--border);
  border-radius: 10px; color: var(--text); font-weight: 700; text-decoration: none;
}
.race-grid a:hover { border-color: var(--accent); }
.race-grid a small { font-weight: 500; color: var(--muted); font-size: .7rem; margin-top: 2px; }

/* —— Aligned tickets —— */
.align-race-filter {
  display: flex; gap: 6px; margin: 0 0 10px;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: none; padding-bottom: 2px;
}
.align-race-filter::-webkit-scrollbar { display: none; }
.align-card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px; margin: 8px 0;
}
.align-card .head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 8px; flex-wrap: wrap; margin-bottom: 8px;
}
.align-sec {
  border-top: 1px solid var(--border);
  padding: 8px 0 4px;
  display: grid;
  grid-template-columns: 4.5em 1fr;
  gap: 6px 10px;
  align-items: start;
}
.align-sec-label {
  font-size: .72rem; font-weight: 700; letter-spacing: .04em;
  color: var(--accent); padding-top: 2px; text-transform: none;
}
.align-sec.w5p .align-sec-label { color: #7aa2ff; }
.align-sec.cold .align-sec-label { color: var(--cold); }
.align-sec-body { min-width: 0; }
.align-horse {
  display: inline-block; font-weight: 700; font-size: .9rem;
  color: var(--text); text-decoration: none;
}
.align-horse:hover { color: var(--accent); text-decoration: underline; }
.align-horse.pass { color: var(--muted); }
.align-why {
  margin: 3px 0 0; font-size: .78rem; color: var(--muted); line-height: 1.4;
}
.align-pass-line {
  margin: 0 0 6px; font-size: .8rem; font-weight: 600; color: var(--muted);
}
.align-cold-row { margin: 0 0 8px; }
.align-cold-row:last-child { margin-bottom: 0; }
.align-cold-row .tag { margin-left: 6px; vertical-align: middle; }
.align-foot { margin: 8px 0 0; padding-top: 6px; border-top: 1px dashed var(--border); }
.tag.lock-open { background: rgba(240,180,41,.15); color: var(--first); }
.tag.lock-yes { background: rgba(61,214,140,.15); color: var(--drift); }
.banner-warn {
  background: rgba(240,180,41,.12); border: 1px solid rgba(240,180,41,.35);
  color: var(--accent); border-radius: 8px; padding: 8px 10px;
  font-size: .78rem; font-weight: 600; margin: 8px 0 12px; line-height: 1.4;
}


/* —— Decisions tab —— */
.decide-card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px; margin: 8px 0;
}
.decide-card.needs {
  border-color: rgba(240,180,41,.55);
  box-shadow: 0 0 0 1px rgba(240,180,41,.25);
  background: linear-gradient(180deg, rgba(240,180,41,.08), var(--panel) 48%);
}
.decide-card .head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 8px; flex-wrap: wrap; margin-bottom: 8px;
}
.decide-flags { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.tag.status-research { background: rgba(122,162,255,.18); color: #9bbcff; }
.tag.status-locked { background: rgba(61,214,140,.15); color: var(--drift); }
.tag.status-pass { background: rgba(139,155,180,.2); color: var(--muted); }
.tag.status-open { background: rgba(255,107,122,.18); color: var(--shorten); }
.tag.needs-flag {
  background: rgba(240,180,41,.2); color: var(--accent);
  font-weight: 700;
}
.decide-sec {
  border-top: 1px solid var(--border);
  padding: 7px 0 3px;
  display: grid;
  grid-template-columns: 4.5em 1fr;
  gap: 4px 10px;
  align-items: start;
}
.decide-sec-label {
  font-size: .72rem; font-weight: 700; color: var(--accent); padding-top: 2px;
}
.decide-sec.w5p .decide-sec-label { color: #7aa2ff; }
.decide-sec.cold .decide-sec-label { color: var(--cold); }
.decide-sec.stake .decide-sec-label { color: var(--bf); }
.decide-sec.note .decide-sec-label { color: var(--muted); }
.decide-updated {
  margin: 8px 0 0; padding-top: 6px; border-top: 1px dashed var(--border);
  font-size: .72rem; color: var(--muted);
}
.banner-tip {
  background: rgba(122,162,255,.1); border: 1px solid rgba(122,162,255,.3);
  color: #9bbcff; border-radius: 8px; padding: 8px 10px;
  font-size: .78rem; font-weight: 600; margin: 8px 0 12px; line-height: 1.4;
}


/* —— Subnav (研究／紀錄) —— */
.subnav {
  display: flex; gap: 6px; margin: 0 0 10px; flex-wrap: wrap;
}
.subnav a {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 6px 14px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--border);
  color: var(--text); font-weight: 600; font-size: .875rem; text-decoration: none;
}
.subnav a.active, .subnav a:hover {
  background: var(--accent); color: #111; border-color: var(--accent); text-decoration: none;
}

/* —— Form-first rows —— */
.form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.form-row:last-child { border-bottom: 0; }
.form-row .form-id {
  display: flex; gap: 8px; align-items: flex-start;
  min-width: 0;
}
.form-row .form-id .form-id-text { min-width: 0; flex: 1; }
.form-row .form-id .name {
  font-weight: 600;
  overflow-wrap: break-word; word-break: normal;
}
.form-row .form-id .form-tags {
  display: flex; flex-wrap: wrap; gap: 3px; margin-top: 3px;
}
.form-row .form-meta {
  min-width: 0;
  padding-left: 34px;
  overflow-wrap: break-word; word-break: normal;
}
.form-row .form-meta .sub { white-space: normal; }
.form-row .form-meta .align-why {
  overflow-wrap: break-word; word-break: normal;
}
.form-row .form-odds {
  padding-left: 34px;
  font-size: .85rem;
  white-space: normal;
  word-break: normal;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}
.form-row .form-odds .sub {
  white-space: normal;
  word-break: normal;
  overflow-wrap: anywhere;
}
@media (min-width: 641px) {
  .form-row {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr) minmax(0, 42%);
    gap: 8px 12px;
    align-items: start;
  }
  .form-row .form-meta,
  .form-row .form-odds { padding-left: 0; }
  .form-row .form-odds {
    text-align: right;
    max-width: 100%;
  }
}

/* Desk table: sticky # + name */
@media (max-width: 640px) {
  table.odds th:nth-child(1), table.odds td:nth-child(1),
  table.odds th:nth-child(2), table.odds td:nth-child(2) {
    /* cards used on mobile; keep wide table sticky-col */
  }
  .race-header-line { white-space: normal; }
}


/* First vs 1:5 visual distinction */
.align-sec.first, .decide-sec.first,
.align-sec.w5p, .decide-sec.w5p {
  background: transparent;
}
.sec-hint {
  display: block;
  font-size: .7rem; font-weight: 500; letter-spacing: 0;
  color: var(--muted); margin-top: 2px; line-height: 1.3;
}
.align-sec-label, .decide-sec-label { line-height: 1.25; }


/* —— Layout v1830 —— */
.once-note {
  margin: 0 0 8px; font-size: .8rem; font-weight: 700;
  color: var(--accent);
}
.data-details {
  display: inline-block; margin-top: 2px; text-align: left;
  max-width: 100%;
}
.data-details > summary {
  cursor: pointer; color: var(--accent); font-size: .65rem; font-weight: 600;
  list-style: none;
}
.data-details > summary::-webkit-details-marker { display: none; }
.data-details-body {
  margin-top: 4px; padding: 6px 8px; background: var(--panel);
  border: 1px solid var(--border); border-radius: 6px;
  font-size: .65rem; color: var(--muted); line-height: 1.45;
  white-space: normal; text-align: left;
}
.asof { max-width: 58%; }
.brand { font-size: .88rem; }
.race-mini.short .line { font-size: .86rem; font-weight: 600; }
.tag.cold.neutral, .tag.neutral {
  background: rgba(168,182,204,.14); color: #c5d0e0;
}
.tag.first {
  background: rgba(240,180,41,.16); color: var(--first);
}
.tag.w5p {
  background: rgba(168,182,204,.12); color: #c5d0e0;
}
.horse-pick {
  width: 100%;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--panel); padding: 0;
}
.horse-pick > summary {
  list-style: none; cursor: pointer; padding: 8px 10px;
  font-weight: 600; font-size: .82rem; min-height: var(--touch);
  display: flex; align-items: center;
}
.horse-pick > summary::-webkit-details-marker { display: none; }
.horse-pick-body {
  display: flex; flex-wrap: wrap; gap: 6px; padding: 0 8px 8px;
}
.race-tabs {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
  margin: 8px 0 10px;
}
.race-tab {
  min-height: var(--touch); border-radius: 8px;
  background: var(--panel); border: 1px solid var(--border);
  font-weight: 700; font-size: .875rem;
}
.race-tab.active {
  background: var(--accent); color: #111; border-color: var(--accent);
}
.sort-ctrl {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  margin: 0 0 8px; font-size: .8rem; color: var(--muted);
}
.align-card.compact .align-sec {
  grid-template-columns: 6.2em 1fr;
}
.align-sec-label { color: var(--muted) !important; }
.align-sec.first .align-sec-label { color: var(--accent) !important; }
.evidence {
  margin-top: 6px; border-top: 1px dashed var(--border); padding-top: 4px;
}
.evidence > summary {
  cursor: pointer; font-size: .75rem; color: var(--muted); font-weight: 600;
  list-style: none; min-height: 36px; display: flex; align-items: center;
}
.evidence > summary::-webkit-details-marker { display: none; }
.evidence-body { padding: 0 0 4px; }
.research-sum .line { margin-top: 4px; font-size: .88rem; }
.banner-warn, .banner-tip {
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border);
  color: var(--muted);
}
.decide-card.needs {
  border-color: var(--border);
  box-shadow: none;
  background: var(--panel);
}
.meta.tip-once { font-size: .75rem; }


/* —— CG-20261013-1852 site verify —— */
.align-sec.risk .align-sec-label { color: var(--shorten); }
.align-why.risk-line { color: #ffb4bc; }
.race-mini .sub + .sub { margin-top: 2px; }

/* Mobile 390/430: no page-wide horizontal overflow; local table scroll only */
@media (max-width: 430px) {
  .wrap {
    padding-left: 8px;
    padding-right: 8px;
    padding-bottom: calc(var(--bottom-h) + var(--safe-b) + 36px);
    max-width: 100vw;
    overflow-x: hidden;
  }
  .form-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .form-odds { text-align: left; }
  .align-sec {
    grid-template-columns: 1fr;
    gap: 2px 0;
  }
  .align-sec-label { margin-bottom: 2px; }
  .hour-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }
  table.odds { min-width: 520px; }
  table.odds td.sticky-col, table.odds th.sticky-col {
    position: sticky; left: 0; z-index: 2;
    background: var(--panel);
    box-shadow: 2px 0 0 var(--border);
  }
  .bottom-nav { min-height: calc(var(--bottom-h) + var(--safe-b)); }
  .runner-card {
    grid-template-columns: 28px minmax(0, 1fr) minmax(96px, 110px);
  }
  .form-tags { display: flex; flex-wrap: wrap; gap: 4px; }
  body { overflow-x: hidden; }
}

@media (max-width: 390px) {
  .h1 { font-size: 1.05rem; }
  .asof { font-size: .65rem; max-width: 58%; }
  .chip-btn { min-height: 36px; }
  .bnav { font-size: .72rem; min-height: var(--touch); }
}
