:root { --bg:#070a18; --panel:rgba(10,13,30,.86); --line:rgba(120,140,220,.22); --ink:#eef1ff; --mute:#9aa3c7;
  --pink:#ff5ac8; --cyan:#6eebff; --amber:#ffd25a; --good:#5be38f; --bad:#ff7a7a; }
* { box-sizing:border-box; }
html, body { margin:0; height:100%; background:var(--bg); color:var(--ink); overflow:hidden;
  font:14px/1.35 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; -webkit-tap-highlight-color:transparent; user-select:none; }
#track { position:fixed; inset:0; width:100%; height:100%; display:block; }
.hidden { display:none !important; }
.neon { color:var(--pink); font-weight:800; letter-spacing:.12em; text-shadow:0 0 12px rgba(255,70,190,.75); }
.big { font-size:34px; }
.n { text-align:right; font-variant-numeric:tabular-nums; }

#top { position:fixed; left:0; right:0; top:0; display:flex; align-items:center; gap:10px; padding:10px 14px;
  padding-top:max(10px, env(safe-area-inset-top)); background:linear-gradient(rgba(7,10,24,.85), rgba(7,10,24,0)); pointer-events:none; }
.brand { display:flex; align-items:baseline; gap:10px; margin-right:auto; font-size:16px; }
#raceno { color:var(--cyan); font-weight:700; letter-spacing:.08em; }
.chip { background:var(--panel); border:1px solid var(--line); border-radius:999px; padding:6px 14px; font-weight:700;
  font-variant-numeric:tabular-nums; white-space:nowrap; }
.chip .lbl { color:var(--mute); font-weight:600; margin-right:8px; font-size:12px; letter-spacing:.06em; text-transform:uppercase; }
#clock.live { color:#0b0d1c; background:var(--pink); border-color:transparent; }
#clock.soon { color:var(--amber); }

#panel { position:fixed; right:12px; top:58px; bottom:12px; width:300px; display:flex; flex-direction:column; gap:8px;
  background:var(--panel); border:1px solid var(--line); border-radius:14px; padding:12px; backdrop-filter:blur(6px); }
.tabs { display:flex; gap:6px; }
.tab { flex:1; padding:8px 0; border-radius:9px; border:1px solid var(--line); background:transparent; color:var(--mute);
  font:inherit; font-weight:700; cursor:pointer; }
.tab.on { color:#0b0d1c; background:var(--cyan); border-color:transparent; }
.hint { margin:0; color:var(--mute); font-size:12.5px; min-height:17px; }
#card { display:flex; flex-direction:column; gap:4px; overflow:auto; min-height:0; }
.dog { display:grid; grid-template-columns:30px 1fr auto; align-items:center; gap:9px; width:100%; text-align:left;
  padding:6px 9px; border-radius:9px; border:1px solid transparent; background:rgba(255,255,255,.04); color:inherit;
  font:inherit; cursor:pointer; }
.dog:hover { background:rgba(255,255,255,.08); }
.dog.on { border-color:var(--cyan); background:rgba(110,235,255,.12); }
.dog.off { opacity:.45; cursor:default; }
.dog > span { min-width:0; }
.dog .nm { font-weight:700; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.dog .fm { color:var(--mute); font-size:12px; letter-spacing:.08em; }
.dog .pr { font-weight:800; font-variant-numeric:tabular-nums; color:var(--amber); }
.jk { display:inline-grid; place-items:center; width:28px; height:28px; border-radius:7px; font-weight:800; font-size:15px;
  border:1px solid rgba(255,255,255,.35); flex:none; }
.j1 { background:#ce2028; color:#fff; } .j2 { background:#1e56c8; color:#fff; } .j3 { background:#f4f4f0; color:#141414; }
.j4 { background:#1e8c42; color:#fff; } .j5 { background:#161618; color:#fff; } .j6 { background:#f6cc1e; color:#141414; }
.j7 { background:repeating-linear-gradient(#1e8c42 0 5px, #f4f4f0 5px 9px); color:#fff; text-shadow:0 0 3px #000, 0 0 3px #000; }
.j8 { background:repeating-linear-gradient(#f6cc1e 0 5px, #161618 5px 9px); color:#fff; text-shadow:0 0 3px #000, 0 0 3px #000; }
#money { display:grid; grid-template-columns:repeat(4, 1fr); gap:6px; }
.amt { padding:9px 0; border-radius:9px; border:0; background:var(--good); color:#06200f; font:inherit; font-weight:800; cursor:pointer; }
.amt:disabled { background:#2a2f48; color:#6b7396; cursor:default; }
#slip { border-top:1px solid var(--line); padding-top:8px; }
.sliphead { display:flex; justify-content:space-between; align-items:center; color:var(--mute); font-size:12px;
  letter-spacing:.06em; text-transform:uppercase; }
#clear { background:transparent; border:1px solid var(--line); color:var(--ink); border-radius:7px; padding:3px 10px; font:inherit;
  font-size:12px; cursor:pointer; }
#bets { display:flex; flex-direction:column; gap:3px; margin-top:6px; max-height:92px; overflow:auto; }
.bet { display:flex; justify-content:space-between; gap:8px; font-variant-numeric:tabular-nums; }
.bet .none { color:var(--mute); }
#panel.watch #money, #panel.watch #slip, #panel.watch .tabs { display:none; }
#panel.racing .tabs, #panel.racing #money, #panel.racing #clear, #panel.racing #hint { display:none; }
#panel.racing { bottom:auto; }
#panel.racing .dog { cursor:default; }

#order { position:fixed; left:50%; top:54px; transform:translateX(-50%); display:flex; gap:5px; padding:6px 8px;
  background:var(--panel); border:1px solid var(--line); border-radius:11px; }
#order .jk { width:26px; height:26px; font-size:14px; }

#tote { position:fixed; left:50%; bottom:5%; transform:translateX(-50%); width:min(600px, 94vw); padding:14px 20px 12px;
  background:rgba(6,8,20,.93); border:2px solid var(--pink); border-radius:14px;
  box-shadow:0 0 26px rgba(255,70,190,.45), inset 0 0 0 4px rgba(6,8,20,1), inset 0 0 0 5px rgba(110,235,255,.6);
  font-variant-numeric:tabular-nums; }
#tote .tt { text-align:center; color:var(--amber); font-weight:800; letter-spacing:.16em; margin-bottom:8px; }
#tote .row { display:grid; grid-template-columns:34px 1fr 84px 84px 84px; align-items:center; gap:8px; padding:4px 0; font-size:17px; font-weight:700; }
#tote .row.head { color:var(--mute); font-size:11.5px; letter-spacing:.12em; padding-bottom:2px; }
#tote .row .nm { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
#tote .row .n { color:var(--amber); }
#tote .row.q { grid-template-columns:auto 1fr 84px; border-top:1px solid var(--line); margin-top:6px; padding-top:9px; color:var(--cyan); }
#tote .row.q #tote-q { color:var(--ink); }
#tote .foot { display:flex; justify-content:space-between; color:var(--mute); font-size:12px; margin-top:4px; }
#mine { margin-top:9px; text-align:center; font-size:17px; font-weight:800; }
#mine.won { color:var(--good); } #mine.lost { color:var(--mute); font-weight:600; font-size:14px; }
#mine:empty { display:none; }

#call { position:fixed; left:50%; top:96px; transform:translateX(-50%); max-width:min(640px, 90vw); text-align:center;
  padding:8px 18px; border-radius:999px; background:rgba(6,8,20,.82); border:1px solid var(--line); font-weight:700; font-size:16px; }
#toast { position:fixed; left:50%; bottom:18px; transform:translateX(-50%); padding:9px 16px; border-radius:10px;
  background:#2a1020; border:1px solid var(--bad); color:#ffd9d9; font-weight:600; max-width:90vw; }
#loading { position:fixed; inset:0; display:grid; place-content:center; gap:14px; text-align:center; background:var(--bg); }
#loadmsg { color:var(--mute); }

body.side #tote, body.side #order, body.side #call { left:calc(50% - 156px); }
body.side #tote { width:min(600px, calc(94vw - 320px)); }
@media (max-width: 760px) {
  #panel { left:8px; right:8px; top:auto; bottom:8px; width:auto; max-height:56vh; padding:10px; }
  #panel.racing { display:none; }
  #card { display:grid; grid-template-columns:minmax(0, 1fr) minmax(0, 1fr); }
  .dog { grid-template-columns:26px minmax(0, 1fr) auto; gap:7px; padding:6px 7px; }
  .dog .fm { display:none; }
  .jk { width:24px; height:24px; font-size:13px; }
  #tote { bottom:14px; padding:10px 12px; }
  #tote .row { grid-template-columns:26px minmax(0, 1fr) 54px 54px 54px; gap:6px; font-size:14px; }
  #tote .row.q { grid-template-columns:auto minmax(0, 1fr) 54px; }
  #call { top:92px; font-size:14px; border-radius:14px; width:max-content; }
  .brand .neon, .chip .lbl { display:none; }
  #top { gap:6px; padding-left:10px; padding-right:10px; }
}
@media (max-width: 520px) {
  #panel { max-height:66vh; gap:6px; }
  #card { grid-template-columns:minmax(0, 1fr); gap:3px; }
  .dog { padding:4px 8px; }
  #panel .hint { font-size:12px; }
}
@media (max-height: 520px) and (min-width: 761px) {
  #panel { top:50px; bottom:6px; padding:8px; gap:5px; width:280px; }
  #panel .hint, .dog .fm { display:none; }
  .dog { padding:3px 8px; } .jk { width:23px; height:23px; font-size:13px; }
  .tab, .amt { padding:5px 0; }
  #bets { max-height:40px; }
  #panel.racing { display:none; }
  #tote { bottom:8px; padding:8px 14px; } #tote .row { font-size:14px; padding:2px 0; }
  #order { top:48px; } #call { top:86px; font-size:14px; }
}
@media (prefers-reduced-motion: reduce) { * { transition:none !important; } }
