:root {
  --bg: #090c10;
  --card: #10161d;
  --card-2: #141b24;
  --line: #1c2530;
  --text: #e8eef4;
  --muted: #7f8c9a;
  --accent: #3ddc97;
  --warn: #f5b84a;
  --bad: #ff6b6b;
  --radius: 14px;
  --chip: #0c1117;
  --title: #c9d3dd;
  --fade: rgba(9,12,16,0);
  --flash: #15241d;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f6f8fa;
  --card: #ffffff;
  --card-2: #eef2f5;
  --line: #dde3e9;
  --text: #0f1720;
  --muted: #5b6875;
  --accent: #0b7f50;
  --warn: #946200;
  --bad: #d64545;
  --chip: #f3f6f8;
  --title: #2a3541;
  --fade: rgba(246,248,250,0);
  --flash: #e3f6ec;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 14px/1.45 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  max-width: 640px; margin: 0 auto; padding: 0 14px env(safe-area-inset-bottom);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
button, select {
  font: inherit; color: var(--text); background: var(--card);
  border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; cursor: pointer;
}
button.ghost { background: transparent; }
button:disabled { opacity: .55; cursor: default; }

/* header */
.top {
  position: sticky; top: 0; z-index: 5; padding: 16px 0 12px;
  background: linear-gradient(var(--bg) 80%, var(--fade));
}
.brand { display: flex; align-items: center; gap: 12px; }
.mark { width: 34px; height: 34px; flex: none; fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; }
.mark .blip { fill: var(--accent); stroke: none; }
.top h1 { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -.2px; }
.sub { margin: 1px 0 0; color: var(--muted); font-size: 12.5px; }
.live-pill {
  margin-left: auto; display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600; letter-spacing: .4px; text-transform: uppercase;
  color: var(--accent); border: 1px solid rgba(61,220,151,.25); background: rgba(61,220,151,.07);
  padding: 3px 9px; border-radius: 999px;
}
.live-pill i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: pulse 1.8s ease-out infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(61,220,151,.6); } 100% { box-shadow: 0 0 0 7px rgba(61,220,151,0); } }

.controls { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.seg { display: flex; flex: 1; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 3px; }
.seg button { flex: 1; border: 0; background: transparent; color: var(--muted); padding: 7px 0; border-radius: 9px; font-weight: 600; font-size: 13px; }
.seg button[aria-checked="true"] { background: var(--card-2); color: var(--text); box-shadow: 0 0 0 1px var(--line) inset; }
.icon { width: 40px; height: 40px; padding: 0; display: grid; place-items: center; border-radius: 12px; border-color: var(--line); }
.icon svg { width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 1.7; stroke-linejoin: round; stroke-linecap: round; }
.icon.on svg { stroke: var(--accent); }
.icon.on { border-color: rgba(61,220,151,.35); }

/* meta row */
.meta-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin: 2px 2px 10px; font-size: 12px; }
.info summary { cursor: pointer; color: var(--muted); list-style: none; }
.info summary::-webkit-details-marker { display: none; }
.info summary::before { content: "ⓘ "; }
.info[open] summary { color: var(--text); }
.info p { position: absolute; right: 14px; left: 14px; max-width: 612px; margin: 6px auto 0; z-index: 4;
  background: var(--card-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; color: var(--muted); }

/* feed */
.cards, .feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.trade {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; display: grid; gap: 6px;
}
.trade.sharp { border-color: rgba(245,184,74,.55); background: linear-gradient(180deg, rgba(245,184,74,.06), var(--card) 60%); }
.trade.fresh { animation: flash 1.4s ease-out; }
@keyframes flash { from { background: var(--flash); } to { background: var(--card); } }
.row1 { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.pick { display: flex; align-items: center; gap: 8px; min-width: 0; }
.side { font-size: 10.5px; font-weight: 700; letter-spacing: .5px; padding: 2px 7px; border-radius: 6px; flex: none; }
.side-BUY { color: var(--accent); background: rgba(61,220,151,.1); }
.side-SELL { color: var(--bad); background: rgba(255,107,107,.1); }
.outcome { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.price { color: var(--muted); font-variant-numeric: tabular-nums; flex: none; }
.amt { font-weight: 700; font-size: 17px; letter-spacing: -.3px; font-variant-numeric: tabular-nums; flex: none; }
.title { color: var(--title); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.title:hover { color: var(--text); text-decoration: none; }
.row2 { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.who { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; min-width: 0; font-size: 11.5px; margin-top: 2px; }
.who > a { font-weight: 600; font-size: 12.5px; margin-right: 2px; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec { display: contents; }
.cast { margin-left: auto; width: 26px; height: 26px; padding: 0; flex: none; display: grid; place-items: center; background: transparent; border: 1px solid var(--line); border-radius: 8px; }
.cast svg { width: 14px; height: 14px; fill: none; stroke: var(--muted); stroke-width: 1.7; stroke-linejoin: round; stroke-linecap: round; }
.cast:hover { border-color: var(--accent); }
.cast:hover svg { stroke: var(--accent); }
.chip { color: var(--muted); background: var(--chip); border: 1px solid var(--line); padding: 0 7px; line-height: 18px; border-radius: 999px; font-variant-numeric: tabular-nums; }
.chip.ghost { border-style: dashed; }
.chip.pos { color: var(--accent); }
.chip.neg { color: var(--bad); }
.ago { color: var(--muted); flex: none; font-size: 11.5px; font-variant-numeric: tabular-nums; }
.sharp-tag { color: #1a1200; background: var(--warn); border-radius: 999px; padding: 0 8px; line-height: 18px; font-size: 11px; font-weight: 700; }

/* legacy bits still used by detail views */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; cursor: pointer; }
.meta { font-size: 12px; color: var(--muted); margin-top: 2px; }

dialog {
  width: min(720px, 100vw - 16px); max-height: 85vh; background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 14px;
}
dialog::backdrop { background: rgba(0,0,0,.6); }
dialog .close { float: right; }
dialog h3 { margin: 0 0 4px; font-size: 16px; }

/* footer */
.foot { margin-top: 28px; padding: 16px 0 30px; text-align: center; font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--line); }
.foot p { margin: 3px 0; }
.foot a { color: var(--text); }
.foot .dot { margin: 0 6px; opacity: .5; }
.foot .fine { font-size: 11px; opacity: .75; }
.empty { padding: 28px; text-align: center; color: var(--muted); }
.taker { flex: none; font-size: 10px; font-weight: 600; letter-spacing: .3px; color: var(--warn); border: 1px solid rgba(245,184,74,.45); border-radius: 6px; padding: 0 5px; line-height: 16px; }
:root[data-theme="light"] .sharp-tag { color: #fff; }
:root[data-theme="light"] .trade { box-shadow: 0 1px 2px rgba(15,23,32,.04); }
.icon .sun { display: none; }
:root[data-theme="light"] .icon .sun { display: block; }
:root[data-theme="light"] .icon .moon { display: none; }
:root[data-theme="light"] .trade.sharp { border: 2px solid #e08a00; background: linear-gradient(180deg, rgba(224,138,0,.12), var(--card) 70%); box-shadow: 0 2px 10px rgba(224,138,0,.18); }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 22px; margin-top: 12px; border-bottom: 1px solid var(--line); }
.tabs [role="tab"] { background: none; border: 0; border-radius: 0; padding: 8px 2px 9px; color: var(--muted); font-weight: 650; font-size: 14px; position: relative; }
.tabs [role="tab"][aria-selected="true"] { color: var(--text); }
.tabs [role="tab"][aria-selected="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; border-radius: 2px; background: var(--accent); }
[hidden] { display: none !important; }

/* ---------- today ---------- */
.today-bar { display: flex; gap: 8px; align-items: center; margin: 2px 0 10px; flex-wrap: wrap; }
.day-seg { flex: 0 1 220px; }
.lg-chips { display: flex; gap: 6px; margin-left: auto; }
.lg-chips button { border-radius: 999px; padding: 5px 12px; font-size: 12.5px; font-weight: 600; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.lg-chips button[aria-pressed="true"] { color: var(--text); border-color: var(--accent); background: rgba(61,220,151,.08); }
.dotlive { width: 6px; height: 6px; border-radius: 50%; background: var(--bad); display: inline-block; }

.lg { margin-bottom: 16px; }
.lg-h { display: flex; align-items: baseline; gap: 8px; margin: 0 2px 7px; font-size: 12px; font-weight: 700; letter-spacing: .3px; text-transform: uppercase; color: var(--title); }
.lg-h em { font-style: normal; font-weight: 600; color: var(--muted); font-size: 10.5px; }

.match { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 8px; overflow: hidden; }
:root[data-theme="light"] .match { box-shadow: 0 1px 2px rgba(15,23,32,.04); }
.match.is-live { border-color: rgba(255,107,107,.45); }
.m-head { display: grid; grid-template-columns: 54px 1fr 18px; align-items: center; gap: 10px; width: 100%; text-align: left; background: none; border: 0; border-radius: 0; padding: 11px 12px 9px; }
.m-status { font-size: 12.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.m-ko { font-weight: 650; color: var(--title); }
.m-ft { color: var(--muted); font-weight: 600; }
.m-live { color: var(--bad); font-weight: 700; display: inline-flex; align-items: center; gap: 5px; }
.m-live i { width: 6px; height: 6px; border-radius: 50%; background: var(--bad); animation: pulsered 1.6s ease-out infinite; }
@keyframes pulsered { 0% { box-shadow: 0 0 0 0 rgba(255,107,107,.6); } 100% { box-shadow: 0 0 0 6px rgba(255,107,107,0); } }
.m-teams { display: grid; gap: 5px; min-width: 0; }
.m-team { display: flex; align-items: center; gap: 8px; min-width: 0; }
.m-team img, .nologo { width: 22px; height: 22px; object-fit: contain; flex: none; }
.nologo { border-radius: 50%; background: var(--card-2); }
.m-team .nm { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.m-team.lost .nm, .m-team.lost .sc { color: var(--muted); }
.m-team .sc { margin-left: auto; font-weight: 800; font-size: 15px; font-variant-numeric: tabular-nums; min-width: 14px; text-align: right; }
.red { width: 8px; height: 11px; border-radius: 2px; background: var(--bad); flex: none; }
.form { display: inline-flex; gap: 2px; flex: none; margin-left: 4px; }
.form i, .frow i { font-style: normal; width: 15px; height: 15px; border-radius: 4px; display: grid; place-items: center; font-size: 9px; font-weight: 800; color: #08110c; }
.f-W { background: var(--accent); }
.f-D { background: #8a96a3; }
.f-L { background: var(--bad); color: #fff !important; }
.chev { width: 16px; height: 16px; fill: none; stroke: var(--muted); stroke-width: 2; transition: transform .2s; }
.match.open .chev { transform: rotate(180deg); }

.m-mkt { display: flex; align-items: center; gap: 10px; padding: 0 12px 11px 76px; cursor: pointer; }
.m-vol { flex: none; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pbar { flex: 1; display: flex; gap: 2px; height: 16px; border-radius: 6px; overflow: hidden; font-size: 10px; font-variant-numeric: tabular-nums; min-width: 0; }
.pbar span { display: flex; align-items: center; justify-content: center; white-space: nowrap; overflow: hidden; color: #08110c; font-weight: 600; }
.pbar b { font-weight: 800; }
.pb-h { background: var(--accent); }
.pb-d { background: #8a96a3; }
.pb-a { background: #6aa8ff; }
.pbar.big { height: 26px; font-size: 11.5px; border-radius: 8px; }

.m-body { border-top: 1px solid var(--line); padding: 4px 12px 10px; background: var(--card-2); }
.pad { padding: 12px 0; margin: 0; }
.sec { padding: 10px 0 8px; border-bottom: 1px dashed var(--line); }
.sec:last-of-type { border-bottom: 0; }
.sec-h { display: flex; align-items: baseline; gap: 8px; font-size: 11px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.sec-h .muted { text-transform: none; letter-spacing: 0; font-weight: 500; }
.sec-a { margin-left: auto; text-transform: none; letter-spacing: 0; font-weight: 600; font-size: 12px; }
.moves { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 8px; font-size: 12px; font-variant-numeric: tabular-nums; }
.mv b { font-weight: 600; color: var(--title); }
.mv em { font-style: normal; font-size: 11px; color: var(--muted); }
.mv em.pos { color: var(--accent); }
.mv em.neg { color: var(--bad); }
.flow { display: grid; gap: 6px; }
.flow p { margin: 2px 0 0; }
.fl { display: grid; grid-template-columns: 90px 1fr auto; gap: 8px; align-items: center; font-size: 12px; }
.fl-l { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fl-bar { height: 8px; border-radius: 4px; background: var(--chip); border: 1px solid var(--line); overflow: hidden; }
.fl-bar i { display: block; height: 100%; background: var(--warn); }
.fl-v { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 11.5px; }
.feed.mini { gap: 8px; }
.feed.mini .trade { background: var(--card); }
.fgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.fcol-h { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 12.5px; margin-bottom: 5px; }
.fcol-h img { width: 16px; height: 16px; object-fit: contain; }
.fcol-h em { font-style: normal; color: var(--muted); font-weight: 500; }
.frow { display: flex; align-items: center; gap: 7px; font-size: 12px; padding: 2px 0; }
.fo { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.fs { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--muted); }
.mt { width: 100%; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.mt th { font-size: 10.5px; color: var(--muted); font-weight: 600; text-align: center; padding: 2px 4px 5px; }
.mt td { text-align: center; padding: 4px; border-top: 1px solid var(--line); }
.mt .l { text-align: left; }
.mt + p { margin: 5px 0 0; }
.h2h { display: grid; grid-template-columns: 74px 1fr auto 1fr; gap: 8px; align-items: center; font-size: 12.5px; padding: 2px 0; }
.h2h span:nth-child(2) { text-align: right; }
.h2h .hd { color: var(--muted); font-size: 11.5px; }
.h2h .w { font-weight: 700; }
.h2h b { font-variant-numeric: tabular-nums; }
.lead { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12.5px; padding: 2px 0; }
.lead-t { font-weight: 700; min-width: 70px; }
.xi ol { margin: 0; padding: 0; list-style: none; font-size: 12px; display: grid; gap: 1px; }
.xi b { display: inline-block; min-width: 20px; color: var(--muted); font-variant-numeric: tabular-nums; }
.goals { display: grid; gap: 3px; padding: 8px 0 6px; border-bottom: 1px dashed var(--line); font-size: 12.5px; }
.goal { display: flex; gap: 8px; }
.goal.ga { flex-direction: row-reverse; text-align: right; }
.gm { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 34px; }
.goal.ga .gm { text-align: right; }
.m-foot { display: flex; justify-content: space-between; gap: 10px; padding-top: 9px; font-size: 12px; }
@media (max-width: 420px) {
  .lg-chips { margin-left: 0; }
  .day-seg { flex: 1 1 100%; }
  .m-head { grid-template-columns: 46px 1fr 16px; gap: 8px; }
  .m-mkt { padding-left: 66px; }
  .form i { width: 13px; height: 13px; font-size: 8px; }
  .h2h { grid-template-columns: 62px 1fr auto 1fr; }
}
