:root {
  --bg: #0f2423;
  --raise: #163230;
  --line: #24423f;
  --ink: #eae6d8;
  --dim: #93a7a1;
  --faint: #66807a;
  --gold: #e2b54a;
  --gold-soft: rgba(226, 181, 74, 0.14);
  --buy: #5cc08a;
  --buy-soft: rgba(92, 192, 138, 0.14);
  --sell: #ec7a62;
  --sell-soft: rgba(236, 122, 98, 0.14);
  --font: "Archivo", system-ui, sans-serif;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #eef2f0; --raise: #ffffff; --line: #d3dcd8; --ink: #10312f; --dim: #4f6a64; --faint: #7d948e;
    --gold: #a7781a; --gold-soft: rgba(167, 120, 26, 0.12);
    --buy: #1f8a55; --buy-soft: rgba(31, 138, 85, 0.1); --sell: #c24a33; --sell-soft: rgba(194, 74, 51, 0.1);
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #eef2f0; --raise: #ffffff; --line: #d3dcd8; --ink: #10312f; --dim: #4f6a64; --faint: #7d948e;
  --gold: #a7781a; --gold-soft: rgba(167, 120, 26, 0.12);
  --buy: #1f8a55; --buy-soft: rgba(31, 138, 85, 0.1); --sell: #c24a33; --sell-soft: rgba(194, 74, 51, 0.1);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font: 400 15px/1.5 var(--font);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.app { max-width: 480px; margin: 0 auto; min-height: 100dvh; padding: 0 16px calc(84px + env(safe-area-inset-bottom)); }

/* status strip */
.strip {
  position: sticky; top: 0; z-index: 5; background: var(--bg);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(12px + env(safe-area-inset-top)) 0 10px; border-bottom: 1px solid var(--line);
}
.engine { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--dim); }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.pulse.on { background: var(--gold); box-shadow: 0 0 0 0 var(--gold-soft); animation: beat 2.4s infinite; }
@keyframes beat { 0% { box-shadow: 0 0 0 0 rgba(226,181,74,.45); } 70% { box-shadow: 0 0 0 8px rgba(226,181,74,0); } 100% { box-shadow: 0 0 0 0 rgba(226,181,74,0); } }
@media (prefers-reduced-motion: reduce) { .pulse.on { animation: none; } }
.price { font-weight: 600; font-size: 17px; font-stretch: 112%; }
.price small { font-weight: 400; font-size: 12px; color: var(--dim); font-stretch: 100%; margin-right: 6px; }

h1 { font-size: 26px; line-height: 1.15; font-weight: 700; font-stretch: 118%; margin: 22px 0 4px; letter-spacing: -0.01em; }
h2 { font-size: 15px; font-weight: 600; margin: 26px 0 8px; color: var(--dim); }
.sub { color: var(--dim); font-size: 14px; margin: 0 0 14px; max-width: 60ch; }

/* mood */
.mood { margin: 18px 0 6px; }
.mood .line { font-size: 22px; font-weight: 600; font-stretch: 115%; line-height: 1.2; }
.mood .tip { color: var(--gold); font-size: 14px; margin-top: 4px; }
.mood .when { color: var(--faint); font-size: 12px; margin-top: 2px; }

/* trade card */
.card { background: var(--raise); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-top: 12px; }
.card.sniper { border-color: var(--gold); }
.card.strong { border-color: var(--buy); }
.card.short.strong { border-color: var(--sell); }
.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.dir { font-size: 30px; line-height: 1; font-weight: 800; font-stretch: 125%; letter-spacing: -0.01em; }
.dir.buy { color: var(--buy); }
.dir.sell { color: var(--sell); }
.kind { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 99px; white-space: nowrap; }
.kind.normal { background: var(--line); color: var(--dim); }
.kind.strong { background: var(--buy-soft); color: var(--buy); }
.kind.sniper { background: var(--gold-soft); color: var(--gold); }
.strat { color: var(--dim); font-size: 13px; margin: 6px 0 12px; }
.conf { color: var(--ink); font-weight: 600; }

.body { display: grid; grid-template-columns: 44px 1fr; gap: 14px; }
.ladder { position: relative; }
.ladder svg { display: block; width: 44px; height: 100%; min-height: 150px; }
.levels { display: flex; flex-direction: column; }
.lv { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line); font-size: 14px; }
.lv:first-child { border-top: 0; }
.lv .k { color: var(--dim); }
.lv .v { font-weight: 600; text-align: right; }
.lv .v small { display: block; font-weight: 400; color: var(--faint); font-size: 12px; }
.lv.stop .v { color: var(--sell); }
.lv.tgt .v { color: var(--buy); }
.why { margin-top: 12px; font-size: 14px; }
.hist { color: var(--faint); font-size: 12px; margin-top: 4px; }
.only { color: var(--faint); font-size: 12px; margin-top: 10px; }
.acts { display: flex; gap: 8px; margin-top: 12px; }
.btn { flex: 1; min-height: 44px; border-radius: 10px; border: 1px solid var(--line); background: transparent; font-weight: 600; cursor: pointer; }
.btn.picked { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn:active { transform: scale(0.98); }
.status-live { font-size: 12px; color: var(--dim); margin-top: 8px; }

.empty { border: 1px dashed var(--line); border-radius: 14px; padding: 20px 16px; margin-top: 12px; color: var(--dim); font-size: 14px; }
.empty b { color: var(--ink); display: block; font-size: 16px; margin-bottom: 4px; }

/* rows */
.rows { margin-top: 4px; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.row .t { font-size: 15px; }
.row .s { font-size: 12px; color: var(--faint); margin-top: 2px; }
.row .r { text-align: right; font-weight: 600; white-space: nowrap; }
.pos { color: var(--buy); }
.neg { color: var(--sell); }
.muted { color: var(--faint); }
.tag { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 99px; display: inline-block; margin-top: 4px; }
.tag.active { background: var(--buy-soft); color: var(--buy); }
.tag.paused { background: var(--sell-soft); color: var(--sell); }
.tag.testing { background: var(--gold-soft); color: var(--gold); }

.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.trio { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.stat { background: var(--raise); border-radius: 12px; padding: 12px; }
.stat .k { font-size: 12px; color: var(--dim); }
.stat .v { font-size: 22px; font-weight: 700; font-stretch: 112%; }

.bars { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--dim); }
.bar { flex: 1; height: 6px; background: var(--line); border-radius: 3px; position: relative; overflow: hidden; }
.bar i { position: absolute; inset: 0 auto 0 0; background: var(--gold); border-radius: 3px; }
.bar i.lv2 { background: var(--buy); }

.tipbox { background: var(--gold-soft); border-radius: 12px; padding: 12px 14px; margin-top: 16px; font-size: 14px; }

/* practice */
.chart { background: var(--raise); border-radius: 14px; padding: 10px; margin-top: 12px; }
.chart svg { display: block; width: 100%; height: 220px; }
.answers { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 12px; }
.answers .buy { color: var(--buy); }
.answers .sell { color: var(--sell); }
.verdict { margin-top: 14px; font-size: 15px; }
.verdict b { font-stretch: 115%; font-size: 18px; display: block; }

/* tab bar */
nav.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: var(--bg); border-top: 1px solid var(--line);
  display: flex; justify-content: center; padding-bottom: env(safe-area-inset-bottom);
}
nav.tabs .in { display: grid; grid-template-columns: repeat(5, 1fr); width: 100%; max-width: 480px; }
nav.tabs button {
  background: none; border: 0; padding: 10px 0 8px; display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 11px; color: var(--faint); cursor: pointer;
}
nav.tabs button svg { width: 22px; height: 22px; }
nav.tabs button[aria-current="page"] { color: var(--gold); }

/* pin */
.pin { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; max-width: 340px; margin: 0 auto; padding: 0 16px; }
.pin h1 { font-size: 34px; }
.pin input {
  width: 100%; font: 600 24px var(--font); letter-spacing: 0.3em; text-align: center; padding: 12px; margin-top: 18px;
  background: var(--raise); color: var(--ink); border: 1px solid var(--line); border-radius: 12px;
}
.pin .btn { margin-top: 12px; width: 100%; background: var(--gold); color: #1a1405; border: 0; }
.err { color: var(--sell); font-size: 13px; margin-top: 8px; min-height: 18px; }
.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: 99px; font-size: 13px; opacity: 0; transition: opacity .2s; pointer-events: none; }
.toast.show { opacity: 1; }
