/* tape-web: dark, mobile-first. Up = blue, Down = orange (CVD-safe pair, validated);
   our shadow = aqua diamonds; P&L uses status green/red WITH a sign, never colour alone. */
:root {
  color-scheme: dark;
  --bg: #0b0e14;
  --card: #131824;
  --card2: #192030;
  --line: #262f42;
  --grid: #1f2736;
  --baseline: #4a5568;
  --ink: #edf0f6;
  --ink2: #b9c1d0;
  --muted: #7f899c;
  --up: #3987e5;
  --down: #d95926;
  --shadow: #199e70;
  --bn: #c98500;
  --good: #2fbf4f;
  --bad: #f06060;
  --warn: #fab219;
  --zone: rgba(255, 255, 255, 0.045);
  --tip-bg: rgba(19, 24, 36, 0.96);
  --r: 16px;
  --tabh: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  padding-bottom: calc(var(--tabh) + var(--safe-b) + 12px);
  overflow-x: hidden;
}
button { font: inherit; color: inherit; }
a { color: var(--ink2); }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
h2 { font-size: 13px; font-weight: 600; color: var(--ink2); margin: 0; letter-spacing: .02em; text-transform: uppercase; }
h3 { margin: 0; font-size: 16px; }
.num, .count, .lead, .kv b, .tbl td, .feed, .fills { font-variant-numeric: tabular-nums; }

/* ---------- header / tabs ---------- */
.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 16px 10px; background: rgba(11, 14, 20, .97);
  border-bottom: 1px solid var(--grid); /* no backdrop-filter: it would trap the fixed tab bar */
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: .01em; flex: 1; min-width: 0; }
.brand svg { width: 20px; height: 20px; fill: none; stroke: var(--up); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.conn { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink2); padding: 4px 10px; border-radius: 99px; background: var(--card); border: 1px solid var(--line); white-space: nowrap; }
.conn i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.conn.ok i { background: var(--good); box-shadow: 0 0 0 3px rgba(47, 191, 79, .18); animation: pulse 2s infinite; }
.conn.warn i { background: var(--warn); }
.conn.bad i { background: var(--bad); }
.conn.warn, .conn.bad { color: var(--ink); }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(47, 191, 79, 0); } }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: space-around;
  height: calc(var(--tabh) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: rgba(15, 19, 28, .96); border-top: 1px solid var(--line);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.tabs button {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  background: none; border: 0; color: var(--muted); font-size: 11px; font-weight: 600; cursor: pointer;
}
.tabs svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabs button.on { color: var(--ink); }
.tabs button.on svg { stroke: var(--up); }

/* ---------- layout ---------- */
main { padding: 12px 12px 0; max-width: 1280px; margin: 0 auto; }
.grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.view > .card + .grid, .view > .card + .card { margin-top: 12px; }
.view > .card:first-child + .grid { margin-top: 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; min-width: 0; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.label { font-size: 13px; color: var(--ink2); font-weight: 600; }
.sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

/* ---------- hero ---------- */
.hero-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.count { font-size: 44px; font-weight: 700; line-height: 1; letter-spacing: -.02em; }
.count.final { color: var(--warn); }
.progress { position: relative; height: 6px; border-radius: 3px; background: var(--card2); margin: 12px 0 14px; overflow: hidden; }
.progress .bar { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--ink2); border-radius: 3px; transition: width .25s linear; }
.progress .zone { position: absolute; top: 0; bottom: 0; left: 79.33%; width: 20%; background: rgba(250, 178, 25, .22); }
.lead { display: flex; align-items: baseline; gap: 10px; font-size: 34px; font-weight: 750; line-height: 1.1; letter-spacing: -.01em; }
.lead-k { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.lead-amt.wait { font-size: 18px; font-weight: 600; color: var(--ink2); }
.lead-side { font-size: 15px; font-weight: 700; padding: 3px 10px; border-radius: 8px; background: var(--card2); color: var(--ink2); letter-spacing: .03em; }
.lead-side.up { background: rgba(57, 135, 229, .18); color: #8bbcf5; }
.lead-side.dn { background: rgba(217, 89, 38, .2); color: #f2a07f; }
.stale { opacity: .45; }
.frozen .card:not(.hero), .frozen .hero .lead, .frozen .hero #lead-sub { opacity: .4; filter: grayscale(.6); }
.stale-tag { font-size: 11px; font-weight: 700; color: var(--warn); border: 1px solid var(--warn); border-radius: 6px; padding: 0 5px; margin-left: 6px; vertical-align: middle; }

/* ---------- charts ---------- */
.chart { display: block; width: 100%; touch-action: pan-y; cursor: crosshair; }
.chart.tall { height: 270px; }
.chart.short { height: 170px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--ink2); margin: -2px 0 8px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.sw { display: inline-block; width: 14px; height: 3px; border-radius: 2px; }
.sw.up { background: var(--up); } .sw.dn { background: var(--down); } .sw.cl { background: var(--ink); } .sw.bn { background: var(--bn); }
.sw.zn { height: 10px; width: 12px; background: rgba(255, 255, 255, .12); }
.mk { display: inline-block; width: 9px; height: 9px; background: var(--ink2); }
.mk.dot { border-radius: 50%; }
.mk.tri { clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.dia { display: inline-block; width: 9px; height: 9px; background: var(--shadow); transform: rotate(45deg); margin-right: 6px; border-radius: 1px; }
.chip { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 99px; border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; }
.chip.on { color: var(--ink); background: var(--card2); border-color: #33405a; }
.chip:not(.on) .dia { background: var(--muted); }

/* ---------- key/value rows ---------- */
.kv { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 7px 0; border-top: 1px solid var(--grid); }
.kv span { color: var(--ink2); font-size: 14px; }
.kv b { font-size: 16px; font-weight: 650; text-align: right; }
.kv.big b { font-size: 22px; }
.pos { color: var(--good); } .neg { color: var(--bad); }
.legs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 8px; }
.leg { border-radius: 12px; padding: 10px 12px; background: var(--card2); border-left: 4px solid var(--up); }
.leg.dn { border-left-color: var(--down); }
.leg .k { font-size: 11px; font-weight: 700; color: var(--ink2); letter-spacing: .06em; }
.leg .v { font-size: 22px; font-weight: 700; margin-top: 2px; }
.leg .s { font-size: 12px; color: var(--muted); }
.split { font-size: 12px; color: var(--muted); margin-top: 8px; }
.ages { font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.ages .row { display: flex; justify-content: space-between; gap: 8px; }
.ages .row b { font-weight: 600; color: var(--ink2); }
.ages .row.bad b { color: var(--warn); }
.note { font-size: 12px; color: var(--muted); margin-top: 8px; }
.note-card { font-size: 13px; color: var(--ink2); }
.link { font-size: 13px; color: var(--ink2); text-decoration: none; }

/* ---------- today ---------- */
.seg { display: inline-flex; background: var(--card2); border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: none; color: var(--muted); font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 8px; cursor: pointer; }
.seg button.on { background: var(--line); color: var(--ink); }
.strip-wrap { overflow: hidden; }
.strip { display: grid; grid-template-columns: 30px repeat(12, 1fr); gap: 3px; }
.strip .hr { font-size: 10.5px; color: var(--muted); display: flex; align-items: center; }
.cell { aspect-ratio: 1.25; border-radius: 4px; background: var(--card2); border: 0; padding: 0; cursor: pointer; position: relative; }
.cell.none { background: #161c28; cursor: default; }
.cell.future { background: transparent; border: 1px dashed transparent; cursor: default; }
.cell.loss::after { content: ""; position: absolute; inset: 0; border-radius: 4px;
  background: repeating-linear-gradient(135deg, rgba(0,0,0,.28) 0 2px, transparent 2px 5px); }
.cell.pend { outline: 1.5px solid var(--ink2); outline-offset: -1.5px; }
.cell.cur { outline: 2px solid var(--ink); outline-offset: 0; }
.strip-legend { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--muted); margin-top: 10px; flex-wrap: wrap; }
.strip-legend .ramp { display: inline-flex; height: 10px; border-radius: 3px; overflow: hidden; }
.strip-legend .ramp i { display: block; width: 14px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: right; font-size: 11.5px; color: var(--muted); font-weight: 600; padding: 4px 0 6px; }
.tbl th:first-child, .tbl td:first-child { text-align: left; }
.tbl td { text-align: right; padding: 7px 0 7px 10px; border-top: 1px solid var(--grid); white-space: nowrap; }
.tbl th { padding-left: 10px; }
.tbl td:first-child { white-space: normal; padding-left: 0; }
.tbl td:first-child { color: var(--ink2); }
.tbl tr.tot td { font-weight: 700; }
.checks { display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: var(--ink2); }
.ck { display: flex; gap: 8px; align-items: flex-start; }
.ck .ic { flex: none; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 800; color: #0b0e14; background: var(--good); margin-top: 1px; }
.ck.warn .ic { background: var(--warn); }
.ck.na .ic { background: var(--line); color: var(--ink2); }

/* ---------- replay ---------- */
.nav-card { display: flex; align-items: center; gap: 10px; padding: 10px; }
.nb { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--card2); font-size: 26px; line-height: 1; cursor: pointer; flex: none; }
.nb:disabled { opacity: .3; cursor: default; }
.r-title { flex: 1; text-align: center; min-width: 0; }
.outcome .big { font-size: 26px; font-weight: 750; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.fills { max-height: 420px; overflow-y: auto; margin: 0 -4px; }

/* ---------- feed ---------- */
.feed { margin-top: 12px; }
.fgrp { position: sticky; top: var(--hdr, 56px); z-index: 2; display: flex; justify-content: space-between; align-items: center; background: var(--bg); padding: 10px 4px 6px; font-size: 12.5px; color: var(--ink2); font-weight: 600; cursor: pointer; }
.frow { display: grid; grid-template-columns: 64px 18px 52px 1fr 1fr 1fr; align-items: center; gap: 6px; padding: 9px 6px; border-bottom: 1px solid var(--grid); font-size: 14px; }
.frow:active { background: var(--card); }
.frow .t { color: var(--muted); font-size: 12.5px; }
.frow .r { text-align: right; }
.frow .mk { background: currentColor; }
.oc { font-size: 11px; font-weight: 800; letter-spacing: .04em; border-radius: 6px; padding: 2px 0; text-align: center; }
.oc.up { color: #8bbcf5; background: rgba(57, 135, 229, .18); }
.oc.dn { color: #f2a07f; background: rgba(217, 89, 38, .2); }
.c-up { color: var(--up); } .c-dn { color: var(--down); }
.sentinel { text-align: center; color: var(--muted); padding: 20px; font-size: 13px; }

/* ---------- bottom sheet ---------- */
.sheet-bg { position: fixed; inset: 0; background: rgba(0, 0, 0, .5); z-index: 40; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; background: var(--card); border-top: 1px solid var(--line);
  border-radius: 20px 20px 0 0; padding: 8px 16px calc(20px + var(--safe-b)); max-height: 80vh; overflow-y: auto;
  animation: up .18s ease-out;
}
@keyframes up { from { transform: translateY(40px); opacity: .4; } }
.grab { width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 4px auto 10px; }
.sheet-h { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.x { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--card2); font-size: 22px; cursor: pointer; }
.tx { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; color: var(--muted); word-break: break-all; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabh) + var(--safe-b) + 14px); z-index: 50; background: var(--card2); border: 1px solid var(--line); padding: 10px 14px; border-radius: 12px; font-size: 13px; max-width: calc(100vw - 32px); }

/* ---------- desktop ---------- */
@media (min-width: 900px) {
  body { padding-bottom: 24px; }
  .top { padding: 10px 24px; }
  .brand { flex: 0 0 auto; }
  .tabs { position: static; height: auto; padding: 0; border: 0; background: none; backdrop-filter: none; flex: 1; justify-content: center; gap: 4px; }
  .tabs button { flex: 0 0 auto; flex-direction: row; gap: 7px; font-size: 13.5px; padding: 8px 14px; border-radius: 10px; }
  .tabs button.on { background: var(--card); }
  .tabs svg { width: 18px; height: 18px; }
  main { padding: 20px 24px 0; }
  .grid { grid-template-columns: minmax(0, 1.65fr) minmax(320px, 1fr); gap: 16px; }
  .col { gap: 16px; }
  .chart.tall { height: 360px; }
  .chart.short { height: 210px; }
  .sheet { left: auto; right: 24px; bottom: 24px; width: 380px; border-radius: 20px; border: 1px solid var(--line); }
  .toast { bottom: 24px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- login ---------- */
body.login { padding: 0; min-height: 100vh; display: grid; place-items: center; }
.login-main { width: 100%; max-width: 380px; padding: 24px 16px; }
.login-card { display: flex; flex-direction: column; gap: 12px; padding: 22px; }
.login-card .brand { font-size: 18px; margin-bottom: 6px; }
.login-card input { font: 600 20px/1.2 system-ui, sans-serif; color: var(--ink); background: var(--card2); border: 1px solid var(--line); border-radius: 12px; padding: 14px; width: 100%; }
.login-card input:focus { outline: 2px solid var(--up); outline-offset: 1px; }
.go { font-weight: 700; font-size: 16px; padding: 14px; border-radius: 12px; border: 0; background: var(--up); color: #fff; cursor: pointer; }
.msg { color: var(--warn); font-size: 14px; margin: 0; min-height: 1em; }
.msg:empty { display: none; }

/* trader chooser (WHISKAS | 0x9417) */
.tw-who { display: inline-flex; flex: none; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--card); }
.tw-who-b { display: inline-flex; align-items: center; justify-content: center; height: 32px; padding: 0 11px; font-size: 11.5px; font-weight: 700; letter-spacing: .05em; color: var(--muted); text-decoration: none; white-space: nowrap; }
.tw-who-b + .tw-who-b { border-left: 1px solid var(--line); }
.tw-who-b.on { background: var(--up); color: #fff; }
@media (max-width: 420px) { .tw-who-b { padding: 0 8px; font-size: 10.5px; letter-spacing: .02em; } .brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } }
/* 5 traders: on a phone the chooser gets its own full-width row under the header, tabs share it equally */
@media (max-width: 520px) {
  .top { flex-wrap: wrap; }
  .tw-who { order: 9; flex: 1 1 100%; }
  .tw-who-b { flex: 1 1 0; padding: 0 4px; }
}
/* panels about OUR shadow exist only for Whiskas */
html[data-has-shadow="0"] .needs-shadow { display: none !important; }
@media (max-width: 420px) { .top { gap: 8px; padding-left: 12px; padding-right: 12px; } .brand svg { display: none; } }
@media (max-width: 420px) { .brand-t { display: none; } }
