:root {
  --bg: #08090c;
  --bg-soft: #0c0e13;
  --panel: #101218;
  --panel-2: #141720;
  --panel-3: #191d27;
  --line: rgba(255, 255, 255, 0.075);
  --line-strong: rgba(255, 255, 255, 0.13);
  --text: #eef0f6;
  --muted: #8b91a1;
  --muted-2: #626879;
  --orange: #f7931a;
  --orange-soft: rgba(247, 147, 26, 0.12);
  --green: #16c784;
  --green-soft: rgba(22, 199, 132, 0.12);
  --red: #ea3943;
  --red-soft: rgba(234, 57, 67, 0.12);
  --blue: #5b8cff;
  --blue-soft: rgba(91, 140, 255, 0.12);
  --radius: 16px;
  --radius-sm: 10px;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Code", Consolas, "Liberation Mono", monospace;
  --sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--text);
  background:
    radial-gradient(1000px 500px at 15% -160px, rgba(247, 147, 26, 0.11), transparent 65%),
    radial-gradient(900px 500px at 92% 10%, rgba(91, 140, 255, 0.07), transparent 60%),
    var(--bg);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input, select { font: inherit; }
button { cursor: pointer; touch-action: manipulation; }
body { overflow-x: hidden; }
button:disabled { cursor: not-allowed; opacity: 0.45; }
a { color: var(--orange); }
p { margin: 0; }
h1, h2, h3, b, strong { letter-spacing: -0.01em; }
::selection { background: rgba(247, 147, 26, 0.28); color: #fff; }

:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}

.skip-link {
  position: fixed;
  left: 12px;
  top: -60px;
  z-index: 100;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--orange);
  color: #101218;
  font-weight: 700;
  text-decoration: none;
  transition: top 0.15s ease;
}
.skip-link:focus { top: 12px; }

/* ---------- risk banner ---------- */
.risk-banner {
  position: relative;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 48px 9px 22px;
  border-bottom: 1px solid rgba(247, 147, 26, 0.2);
  background:
    linear-gradient(90deg, rgba(247, 147, 26, 0.15), rgba(234, 57, 67, 0.08) 60%, rgba(247, 147, 26, 0.03));
  color: #f4dcc2;
  font-size: 12.5px;
}
.risk-banner strong { color: #ffd6a5; }
.risk-banner p { max-width: 1480px; }
.risk-banner__mark {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: var(--orange);
  color: #14100a;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 800;
}
.risk-banner__close {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #b9a691;
  font-size: 20px;
  line-height: 1;
}
.risk-banner__close:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.risk-banner.is-hidden { display: none; }
.file-warning {
  padding: 7px 22px;
  border-bottom: 1px solid rgba(91, 140, 255, 0.22);
  background: rgba(91, 140, 255, 0.09);
  color: #a8bcff;
  font-size: 11px;
  line-height: 1.5;
}
.file-warning b { color: #dbe4ff; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px 28px;
  padding: 13px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(8, 9, 12, 0.84);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.brand { display: flex; align-items: center; gap: 11px; flex: 1 1 228px; min-width: 0; }
.brand__mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(247, 147, 26, 0.4);
  border-radius: 12px;
  background: linear-gradient(145deg, #f7931a, #c46a05);
  color: #130d05;
  font-size: 22px;
  font-weight: 800;
  box-shadow: 0 8px 24px rgba(247, 147, 26, 0.18);
}
.brand__title { font-size: 13px; font-weight: 800; letter-spacing: 0.08em; white-space: nowrap; }
.brand__title span { margin-left: 7px; color: var(--orange); font-family: var(--mono); font-size: 11px; letter-spacing: 0; }
.brand__sub { color: var(--muted-2); font-size: 10.5px; white-space: nowrap; }

.quote { flex: 0 0 auto; }
.quote__price { font-family: var(--mono); font-size: 27px; font-weight: 700; line-height: 1.05; letter-spacing: -0.04em; }
.quote__meta { display: flex; align-items: center; gap: 7px; margin-top: 4px; color: var(--muted); font-size: 11px; }
.quote__sep { color: var(--muted-2); }
.change { display: inline-flex; align-items: center; gap: 4px; font-family: var(--mono); font-weight: 700; }
.change.pos { color: var(--green); }
.change.neg { color: var(--red); }
.change.neutral { color: var(--muted); }

.day-stats { display: flex; align-items: stretch; gap: 0; flex: 0 0 auto; }
.day-stat { padding: 0 15px; border-left: 1px solid var(--line); }
.day-stat:first-child { border-left: 0; padding-left: 0; }
.day-stat span { display: block; color: var(--muted-2); font-size: 10px; }
.day-stat b { display: block; margin-top: 2px; color: #cdd1dc; font-family: var(--mono); font-size: 11.5px; font-weight: 600; white-space: nowrap; }

.connection {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  min-width: 174px;
  padding: 7px 8px 7px 10px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.025);
}
.connection__copy { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.connection__copy b { font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.connection__copy span { color: var(--muted-2); font-size: 9.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 142px; }
.status-dot { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: var(--muted-2); }
.status-dot.is-live { background: var(--green); box-shadow: 0 0 0 4px rgba(22, 199, 132, 0.12); animation: pulse 2.2s ease-in-out infinite; }
.status-dot.is-loading { background: var(--orange); box-shadow: 0 0 0 4px rgba(247, 147, 26, 0.12); animation: pulse 1.3s ease-in-out infinite; }
.status-dot.is-error { background: var(--red); box-shadow: 0 0 0 4px rgba(234, 57, 67, 0.12); }
.status-dot.is-demo { background: var(--blue); box-shadow: 0 0 0 4px rgba(91, 140, 255, 0.12); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }

.icon-btn {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  margin-left: auto;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 17px;
  line-height: 1;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.08); color: var(--text); }
.diag-top {
  flex: 0 0 auto;
  padding: 2px 4px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted-2);
  font-size: 8.5px;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.diag-top:hover { background: rgba(255, 255, 255, 0.06); color: var(--orange); }
.icon-btn.is-spinning { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.topbar__clock { flex: 0 0 auto; text-align: right; }
.topbar__clock span { display: block; color: var(--muted-2); font-size: 9.5px; }
.topbar__clock b { font-family: var(--mono); font-size: 11.5px; color: #c5c9d4; }

/* ---------- layout ---------- */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 424px;
  gap: 16px;
  width: min(1580px, 100%);
  margin: 0 auto;
  padding: 16px 18px 34px;
}
.workspace, .sidebar { min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.sidebar { gap: 14px; }

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.032), rgba(255, 255, 255, 0.008)),
    var(--panel);
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.2);
}
.panel__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 17px 12px;
}
.panel__head h2 { margin: 3px 0 0; font-size: 15px; font-weight: 700; }
.panel__head p { max-width: 440px; color: var(--muted-2); font-size: 10.5px; text-align: right; }

.eyebrow {
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: #c8ccd7;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}
.pill--quiet { color: var(--muted-2); border-color: var(--line); }
.pill--danger { border-color: rgba(234, 57, 67, 0.3); background: var(--red-soft); color: #ff8b93; }

/* ---------- confluence ---------- */
.confluence {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(170px, 0.8fr) minmax(0, 1.05fr);
  gap: 22px;
  padding: 18px 19px;
  overflow: hidden;
  position: relative;
}
.confluence::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(500px 180px at 8% 0%, rgba(247, 147, 26, 0.09), transparent 70%);
}
.confluence > * { position: relative; z-index: 1; }
.confluence__title { margin: 5px 0 3px; font-size: clamp(21px, 2.3vw, 28px); line-height: 1.15; font-weight: 800; letter-spacing: -0.035em; }
.confluence__desc { max-width: 430px; color: var(--muted); font-size: 11.5px; }
.confluence__tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 11px; }
.confluence.is-long .confluence__title { color: var(--green); }
.confluence.is-short .confluence__title { color: var(--red); }
.confluence.is-neutral .confluence__title { color: #d3d6df; }
.confluence.is-conflict .confluence__title { color: var(--orange); }

.tf-scores { display: flex; flex-direction: column; justify-content: center; gap: 13px; padding-left: 2px; }
.tf-score__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.tf-score__head span { color: var(--muted); font-family: var(--mono); font-size: 10px; font-weight: 700; }
.tf-score__head b { font-family: var(--mono); font-size: 14px; font-weight: 700; }
.tf-score small { display: block; margin-top: 3px; color: var(--muted-2); font-size: 9.5px; }
.score-meter { position: relative; height: 4px; border-radius: 99px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.score-meter::after { content: ""; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: rgba(255, 255, 255, 0.2); }
.score-meter i { display: block; height: 100%; width: 50%; margin-left: 50%; border-radius: 99px; background: var(--muted); transition: width 0.35s ease, margin-left 0.35s ease, background 0.35s ease; }
.score-meter i.pos { background: linear-gradient(90deg, rgba(22, 199, 132, 0.45), var(--green)); }
.score-meter i.neg { background: linear-gradient(90deg, var(--red), rgba(234, 57, 67, 0.45)); }

.verdict {
  align-self: center;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.18);
}
.verdict__label { color: var(--muted-2); font-family: var(--mono); font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase; }
.verdict__action { display: block; margin: 3px 0 2px; font-size: 18px; line-height: 1.25; color: #d5d8e1; }
.verdict__action.is-long { color: var(--green); }
.verdict__action.is-short { color: var(--red); }
.verdict__hint { color: var(--muted-2); font-size: 10.5px; }

/* ---------- clock predictions ---------- */
#predictionPanel, #chartsSection, #paperPanel { scroll-margin-top: 84px; }
.prediction-panel {
  position: relative;
  padding: 18px 19px 14px;
  border-color: rgba(247, 147, 26, 0.25);
  background:
    radial-gradient(620px 220px at 8% 0%, rgba(247, 147, 26, 0.12), transparent 70%),
    radial-gradient(500px 220px at 100% 50%, rgba(91, 140, 255, 0.055), transparent 70%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.008)),
    var(--panel);
  overflow: hidden;
}
.prediction-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.prediction-head__copy { min-width: 0; }
.prediction-head h1 { margin: 5px 0 4px; font-size: clamp(23px, 2.5vw, 31px); line-height: 1.15; letter-spacing: -0.04em; }
.prediction-head p { max-width: 560px; color: var(--muted); font-size: 11.5px; }
.prediction-clock { display: flex; flex: 0 0 auto; gap: 8px; }
.clock-block {
  min-width: 116px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.18);
}
.clock-block span { display: block; color: var(--muted-2); font-size: 8.5px; }
.clock-block b { display: block; margin-top: 2px; color: var(--orange); font-family: var(--mono); font-size: 16px; line-height: 1.15; }
.clock-block small { display: block; margin-top: 1px; color: #6e7483; font-family: var(--mono); font-size: 9px; }
.clock-block--blue b { color: #8eaeff; }

.prediction-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.pred-card {
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.17);
  transition: border-color 0.2s ease, background 0.2s ease;
}
.pred-card.is-up { border-color: rgba(22, 199, 132, 0.32); background: linear-gradient(180deg, rgba(22, 199, 132, 0.08), rgba(0, 0, 0, 0.14)); }
.pred-card.is-down { border-color: rgba(234, 57, 67, 0.3); background: linear-gradient(180deg, rgba(234, 57, 67, 0.08), rgba(0, 0, 0, 0.14)); }
.pred-card.is-idle { background: rgba(0, 0, 0, 0.12); }
.pred-card__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pred-status {
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 99px;
  color: var(--muted);
  font-size: 8.5px;
  white-space: nowrap;
}
.pred-status.is-pending { border-color: rgba(247, 147, 26, 0.3); background: var(--orange-soft); color: #f0b86b; }
.pred-status.is-hit { border-color: rgba(22, 199, 132, 0.3); background: var(--green-soft); color: var(--green); }
.pred-status.is-miss { border-color: rgba(234, 57, 67, 0.3); background: var(--red-soft); color: #ff858d; }
.pred-status.is-late { border-color: rgba(91, 140, 255, 0.25); background: var(--blue-soft); color: #9cb6ff; }
.pred-direction { margin: 8px 0 1px; font-family: var(--mono); font-size: 31px; font-weight: 800; line-height: 1.1; letter-spacing: -0.05em; }
.pred-direction.is-up { color: var(--green); }
.pred-direction.is-down { color: var(--red); }
.pred-direction.is-idle { color: var(--muted-2); font-size: 25px; }
.pred-window { color: var(--muted); font-family: var(--mono); font-size: 10px; }
.pred-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin-top: 9px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--line); }
.pred-meta > div { min-width: 0; padding: 6px 8px; background: #111318; }
.pred-meta span { display: block; color: var(--muted-2); font-size: 8px; }
.pred-meta b { display: block; margin-top: 1px; font-family: var(--mono); font-size: 10.5px; color: #dfe2ea; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pred-ref { margin-top: 8px; color: #5f6573; font-size: 8.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.prediction-stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 1px; margin-top: 10px; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--line); }
.prediction-stats > div { min-width: 0; padding: 7px 9px; background: #111318; }
.prediction-stats span { display: block; color: var(--muted-2); font-size: 8px; }
.prediction-stats b { display: block; margin-top: 2px; font-family: var(--mono); font-size: 10.5px; color: #e2e5ed; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prediction-note { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 14px; margin-top: 8px; color: #565c6a; font-size: 8.5px; line-height: 1.5; }
.prediction-link { color: var(--orange); font-size: 8.5px; text-decoration: none; }
.prediction-link:hover { text-decoration: underline; }

.prediction-history { padding-bottom: 12px; scroll-margin-top: 84px; }
.prediction-history .table-wrap { padding: 0 17px; }
.prediction-history > .fineprint { padding: 0 17px; }
.pred-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; padding: 0 17px 10px; }
.segmented { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: #0b0d12; }
.segmented button { padding: 4px 9px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 9px; }
.segmented button:hover { color: var(--text); }
.segmented button.is-active { background: var(--orange); color: #171004; font-weight: 700; }
.check { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 9px; cursor: pointer; }
.check input { width: 12px; height: 12px; accent-color: var(--orange); }
.pred-actions { display: flex; gap: 5px; margin-left: auto; }
.pred-table { width: 100%; border-collapse: collapse; font-size: 9.5px; }
.pred-table th { padding: 6px 8px; color: var(--muted-2); font-weight: 500; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.pred-table td { padding: 6px 8px; color: #b9bec9; border-bottom: 1px solid rgba(255, 255, 255, 0.035); font-family: var(--mono); white-space: nowrap; }
.pred-table tr:last-child td { border-bottom: 0; }
.pred-table tr.is-pending td { background: rgba(247, 147, 26, 0.035); }
.pred-dir { font-family: var(--mono); font-weight: 700; }
.pred-dir.up, .pred-actual.up { color: var(--green); }
.pred-dir.down, .pred-actual.down { color: var(--red); }
.pred-actual.flat { color: var(--muted); }
.pred-chip { display: inline-flex; align-items: center; padding: 1px 6px; border-radius: 99px; font-size: 8px; }
.pred-chip.pending { background: var(--orange-soft); color: #f0b86b; }
.pred-chip.hit { background: var(--green-soft); color: var(--green); }
.pred-chip.miss { background: var(--red-soft); color: #ff858d; }
.pred-chip.void { background: rgba(255, 255, 255, 0.06); color: var(--muted); }
.pred-badge { display: inline-flex; margin-left: 3px; padding: 1px 5px; border: 1px solid var(--line); border-radius: 4px; color: #737a89; font-size: 7.5px; font-family: var(--sans); }
.prediction-empty { padding: 18px 17px 20px; color: var(--muted-2); font-size: 9.5px; text-align: center; }

/* ---------- charts ---------- */
.charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.chart-card { padding: 14px 14px 10px; overflow: hidden; }
.chart-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.chart-card__title { display: flex; align-items: center; gap: 9px; min-width: 0; }
.chart-card__title h2 { margin: 0; font-size: 14px; font-weight: 700; }
.chart-card__title p { margin: 2px 0 0; color: var(--muted-2); font-size: 9.5px; }
.tf-badge {
  display: inline-grid;
  place-items: center;
  min-width: 34px;
  height: 25px;
  padding: 0 7px;
  border: 1px solid rgba(247, 147, 26, 0.3);
  border-radius: 7px;
  background: var(--orange-soft);
  color: var(--orange);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 800;
}
.tf-badge--blue { border-color: rgba(91, 140, 255, 0.3); background: var(--blue-soft); color: #8eaeff; }
.chart-card__price { font-family: var(--mono); font-size: 13px; font-weight: 700; color: #d9dce5; white-space: nowrap; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 10px; margin: 11px 0 7px; color: var(--muted-2); font-size: 9.5px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 4px; }
.legend-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.legend-dot.ema20 { background: var(--orange); }
.legend-dot.ema50 { background: var(--blue); }
.legend-dot.bb { background: rgba(255, 255, 255, 0.34); }

.chart-wrap {
  position: relative;
  height: 300px;
  border: 1px solid rgba(255, 255, 255, 0.045);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.018), transparent 55%),
    #0b0d12;
  overflow: hidden;
}
.chart-canvas { display: block; width: 100%; height: 100%; cursor: crosshair; touch-action: none; }
.chart-tip {
  position: absolute;
  z-index: 3;
  min-width: 156px;
  padding: 8px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: rgba(10, 12, 17, 0.96);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  color: #c9cdd8;
  font-size: 10px;
  pointer-events: none;
  backdrop-filter: blur(8px);
}
.chart-tip__time { color: var(--muted-2); font-family: var(--mono); font-size: 9px; margin-bottom: 5px; }
.chart-tip__row { display: flex; justify-content: space-between; gap: 14px; font-family: var(--mono); }
.chart-tip__row span { color: var(--muted-2); font-family: var(--sans); }
.chart-tip__row b { font-weight: 600; }
.chart-card__foot { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 11px; min-height: 24px; padding: 8px 1px 0; color: var(--muted-2); font-family: var(--mono); font-size: 9px; }
.chart-card__foot .chart-hint { margin-left: auto; font-family: var(--sans); font-size: 8.5px; color: #4f5563; }

/* ---------- factors ---------- */
.factors__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; padding: 0 17px 17px; }
.factor-col__head { display: flex; align-items: center; justify-content: space-between; padding-bottom: 8px; border-bottom: 1px solid var(--line); margin-bottom: 7px; }
.factor-col__head b { font-family: var(--mono); font-size: 13px; }
.factor-list { display: flex; flex-direction: column; gap: 2px; }
.factor-row { display: grid; grid-template-columns: minmax(0, 1fr) 92px 35px; align-items: center; gap: 8px; min-height: 27px; padding: 1px 3px; border-radius: 5px; }
.factor-row:hover { background: rgba(255, 255, 255, 0.03); }
.factor-label { min-width: 0; color: #aeb3c0; font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.factor-label small { display: block; color: var(--muted-2); font-family: var(--mono); font-size: 8.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.factor-track { position: relative; height: 4px; border-radius: 99px; background: rgba(255, 255, 255, 0.055); }
.factor-track::after { content: ""; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: rgba(255, 255, 255, 0.16); }
.factor-fill { position: absolute; top: 0; bottom: 0; border-radius: 99px; }
.factor-fill.pos { background: var(--green); }
.factor-fill.neg { background: var(--red); }
.factor-value { font-family: var(--mono); font-size: 10px; font-weight: 600; text-align: right; }
.factor-value.pos { color: var(--green); }
.factor-value.neg { color: var(--red); }
.factor-value.neutral { color: var(--muted); }

/* ---------- playbook ---------- */
.rules { display: grid; grid-template-columns: 1fr 1fr; gap: 0 26px; padding: 0 17px 14px; }
.rule { display: flex; gap: 11px; padding: 11px 0; border-top: 1px solid var(--line); }
.rule > span { flex: 0 0 auto; color: var(--orange); font-family: var(--mono); font-size: 10px; font-weight: 700; padding-top: 2px; }
.rule b { display: block; font-size: 11.5px; font-weight: 650; color: #d7dae3; }
.rule p { margin-top: 2px; color: var(--muted-2); font-size: 10px; line-height: 1.55; }

/* ---------- sidebar ---------- */
.goal-check {
  padding: 15px 16px;
  border-color: rgba(247, 147, 26, 0.24);
  background:
    radial-gradient(400px 160px at 100% 0%, rgba(247, 147, 26, 0.14), transparent 70%),
    linear-gradient(180deg, rgba(247, 147, 26, 0.055), rgba(255, 255, 255, 0.01)),
    var(--panel);
}
.goal-check__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.goal-check__line { display: flex; align-items: baseline; gap: 10px; margin: 9px 0 10px; font-family: var(--mono); }
.goal-check__line b { font-size: 22px; letter-spacing: -0.04em; }
.goal-check__line b:last-child { color: var(--orange); }
.goal-check__line span { color: var(--muted-2); font-size: 13px; }
.goal-check__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.goal-check__grid div { padding: 7px 8px; border: 1px solid var(--line); border-radius: 8px; background: rgba(0, 0, 0, 0.16); }
.goal-check__grid span { display: block; color: var(--muted-2); font-size: 8.5px; }
.goal-check__grid b { display: block; margin-top: 2px; font-family: var(--mono); font-size: 11px; color: #e4d8c8; white-space: nowrap; }
.goal-check__note { margin-top: 9px; color: #8c8174; font-size: 9.5px; line-height: 1.5; }

.planner { overflow: hidden; }
.tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; padding: 7px; border-bottom: 1px solid var(--line); background: rgba(0, 0, 0, 0.14); }
.tab-btn {
  min-width: 0;
  padding: 8px 4px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
}
.tab-btn:hover { color: #d4d8e2; background: rgba(255, 255, 255, 0.04); }
.tab-btn.is-active { color: #171004; background: var(--orange); box-shadow: 0 5px 16px rgba(247, 147, 26, 0.18); }
.tab-btn span { display: inline-grid; place-items: center; min-width: 15px; height: 15px; margin-left: 2px; padding: 0 3px; border-radius: 99px; background: rgba(255, 255, 255, 0.15); font-family: var(--mono); font-size: 8px; vertical-align: 1px; }
.tab-btn.is-active span { background: rgba(0, 0, 0, 0.18); }
.tab-panel { padding: 14px 16px 16px; }

.paper-status { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; background: rgba(0, 0, 0, 0.16); }
.paper-status > div:first-child { min-width: 0; }
.paper-status p { margin-top: 3px; color: var(--muted); font-size: 10px; line-height: 1.45; }
.paper-balance { flex: 0 0 auto; text-align: right; }
.paper-balance span { display: block; color: var(--muted-2); font-size: 8px; }
.paper-balance b { display: block; margin-top: 1px; font-family: var(--mono); font-size: 13px; color: #ffd08a; white-space: nowrap; }
.paper-status .pill.is-up { border-color: rgba(22, 199, 132, 0.35); background: var(--green-soft); color: var(--green); }
.paper-status .pill.is-down { border-color: rgba(234, 57, 67, 0.35); background: var(--red-soft); color: #ff858d; }
.switch-field { display: flex; align-items: center; gap: 6px; align-self: end; min-height: 31px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: 7px; background: #0b0d12; color: var(--muted); font-size: 9.5px; cursor: pointer; }
.switch-field input { width: 13px; height: 13px; margin: 0; accent-color: var(--orange); }
.paper-box { margin-top: 10px; padding: 11px 12px; border: 1px solid rgba(247, 147, 26, 0.2); border-radius: 10px; background: linear-gradient(180deg, rgba(247, 147, 26, 0.065), rgba(0, 0, 0, 0.12)); }
.paper-box > span { display: block; color: #bca58b; font-size: 9.5px; }
.paper-box > b { display: block; margin: 1px 0; color: #ffc172; font-family: var(--mono); font-size: 28px; line-height: 1.15; letter-spacing: -0.04em; }
.paper-box > small { display: block; color: #8b7a67; font-size: 8.5px; }
.paper-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin-top: 8px; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--line); }
.paper-metrics > div { padding: 7px 9px; background: #111318; min-width: 0; }
.paper-metrics span { display: block; color: var(--muted-2); font-size: 8px; }
.paper-metrics b { display: block; margin-top: 2px; font-family: var(--mono); font-size: 10.5px; color: #dfe2ea; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.paper-actions { display: flex; gap: 6px; margin-top: 9px; }
.paper-actions .btn { margin-top: 0; }
.paper-ledger-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin-top: 9px; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--line); }
.paper-ledger-stats > div { padding: 7px 9px; background: #111318; }
.paper-ledger-stats span { display: block; color: var(--muted-2); font-size: 8px; }
.paper-ledger-stats b { display: block; margin-top: 2px; font-family: var(--mono); font-size: 10.5px; color: #dfe2ea; }
.bet-table td:nth-child(4), .bet-table td:nth-child(5), .bet-table td:nth-child(6) { font-family: var(--mono); }
.bet-table td.pos { color: var(--green); }
.bet-table td.neg { color: var(--red); }
.journal-head .pred-actions { margin-left: auto; }

.plan-status { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; background: rgba(0, 0, 0, 0.16); }
.plan-status > div { min-width: 0; }
.plan-status p { margin-top: 3px; color: var(--muted); font-size: 10px; line-height: 1.45; }
.plan-status__risk { flex: 0 0 auto; color: var(--muted-2); font-family: var(--mono); font-size: 9px; white-space: nowrap; padding-top: 4px; }
.plan-status.is-long { border-color: rgba(22, 199, 132, 0.25); background: var(--green-soft); }
.plan-status.is-long .pill { border-color: rgba(22, 199, 132, 0.35); color: var(--green); }
.plan-status.is-short { border-color: rgba(234, 57, 67, 0.25); background: var(--red-soft); }
.plan-status.is-short .pill { border-color: rgba(234, 57, 67, 0.35); color: #ff7f87; }

.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 10px; }
.field-grid--goal { grid-template-columns: 1fr 1fr 1fr; }
.field { display: flex; flex-direction: column; gap: 4px; color: var(--muted-2); font-size: 9.5px; }
.field input, .field select {
  width: 100%;
  height: 31px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  outline: none;
  background: #0b0d12;
  color: #e6e8ef;
  font-family: var(--mono);
  font-size: 11px;
}
.field input:focus, .field select:focus { border-color: rgba(247, 147, 26, 0.6); box-shadow: 0 0 0 3px rgba(247, 147, 26, 0.08); }
.field input:hover, .field select:hover { border-color: rgba(255, 255, 255, 0.2); }
.field--inline { flex-direction: row; align-items: center; gap: 7px; margin: 0; }
.field--inline select { width: auto; min-width: 128px; height: 29px; }
select { color-scheme: dark; }

.levels { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 10px; }
.level { padding: 8px 9px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255, 255, 255, 0.017); }
.level span { display: block; color: var(--muted-2); font-size: 8.5px; }
.level b { display: block; margin-top: 2px; font-family: var(--mono); font-size: 11.5px; font-weight: 600; color: #dfe2ea; white-space: nowrap; }
.level b.pos { color: var(--green); }
.level b.neg { color: var(--red); }

.bet-box { margin-top: 10px; border: 1px solid rgba(247, 147, 26, 0.2); border-radius: 11px; background: linear-gradient(180deg, rgba(247, 147, 26, 0.065), rgba(0, 0, 0, 0.12)); overflow: hidden; }
.bet-box__main { padding: 11px 12px 9px; border-bottom: 1px solid rgba(247, 147, 26, 0.13); }
.bet-box__main > span { display: block; color: #bca58b; font-size: 9.5px; }
.bet-box__main > b { display: block; margin: 1px 0 1px; color: #ffc172; font-family: var(--mono); font-size: 28px; line-height: 1.15; letter-spacing: -0.04em; }
.bet-box__main > small { display: block; color: #8b7a67; font-size: 9px; }
.bet-box__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: rgba(255, 255, 255, 0.04); }
.bet-box__grid > div { padding: 8px 10px; background: #111318; }
.bet-box__grid span { display: block; color: var(--muted-2); font-size: 8.5px; }
.bet-box__grid b { display: block; margin-top: 2px; font-family: var(--mono); font-size: 10.5px; font-weight: 600; color: #d9dce5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.plan-warning { margin-top: 9px; padding: 8px 9px; border: 1px solid rgba(234, 57, 67, 0.25); border-radius: 8px; background: var(--red-soft); color: #ffb2b7; font-size: 9.5px; line-height: 1.5; }
.plan-warning[hidden] { display: none; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 36px;
  margin-top: 10px;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.04);
  color: #d6d9e2;
  font-size: 11px;
  font-weight: 650;
}
.btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.075); }
.btn--primary { border-color: transparent; background: linear-gradient(180deg, #ffa52f, #e88409); color: #1b1206; box-shadow: 0 8px 22px rgba(247, 147, 26, 0.15); }
.btn--primary:hover:not(:disabled) { background: linear-gradient(180deg, #ffb54d, #f39114); }
.btn--ghost { width: auto; min-height: 28px; margin: 0; padding: 4px 9px; font-size: 9.5px; }
.btn--small { min-height: 26px; }

.fineprint { margin-top: 9px; color: #565c6a; font-size: 8.5px; line-height: 1.55; }

.ladder { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); }
.ladder summary {
  color: var(--muted);
  font-size: 9.5px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.ladder summary::-webkit-details-marker { display: none; }
.ladder summary::before { content: "＋"; display: inline-block; margin-right: 5px; color: var(--orange); font-family: var(--mono); }
.ladder[open] summary::before { content: "－"; }
.ladder[open] summary { color: #d3b28b; }
.ladder-table { margin-top: 5px; }
.ladder p { margin-top: 5px; color: #565c6a; font-size: 8px; line-height: 1.55; }

/* ---------- goal tab ---------- */
.callout { margin-top: 10px; padding: 10px 11px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255, 255, 255, 0.025); color: var(--muted); font-size: 10px; line-height: 1.55; }
.callout b { color: #d6d9e2; }
.callout--warn { border-color: rgba(247, 147, 26, 0.24); background: var(--orange-soft); color: #d7b68e; }
.callout--warn b { color: #ffd39a; }
.callout--quiet { color: var(--muted-2); }
.preset-row { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
.chip-btn { padding: 4px 7px; border: 1px solid var(--line); border-radius: 99px; background: transparent; color: var(--muted); font-size: 9px; }
.chip-btn:hover { border-color: rgba(247, 147, 26, 0.35); color: var(--orange); }

.goal-readout { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin-top: 10px; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--line); }
.goal-readout > div { padding: 8px 9px; background: #111318; }
.goal-readout span { display: block; color: var(--muted-2); font-size: 8.5px; }
.goal-readout b { display: block; margin-top: 2px; font-family: var(--mono); font-size: 11px; color: #dfe2ea; }

.allin-box { margin-top: 10px; padding: 10px; border: 1px solid rgba(234, 57, 67, 0.2); border-radius: 9px; background: linear-gradient(180deg, rgba(234, 57, 67, 0.07), rgba(0, 0, 0, 0.1)); }
.allin-box__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.allin-box__head b { font-size: 10.5px; color: #ffc0c4; }
.allin-box__head span { color: #8f6267; font-size: 8.5px; }
.allin-box__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 7px; }
.allin-box__grid div { min-width: 0; }
.allin-box__grid span { display: block; color: #8f6267; font-size: 8px; }
.allin-box__grid b { display: block; margin-top: 1px; font-family: var(--mono); font-size: 10.5px; color: #ffd4d6; white-space: nowrap; }
.allin-box p { margin-top: 7px; color: #8b6569; font-size: 8.5px; line-height: 1.5; }

.sim-results { margin-top: 12px; }
.sim-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--line); }
.sim-stats > div { padding: 8px; background: #111318; min-width: 0; }
.sim-stats span { display: block; color: var(--muted-2); font-size: 8px; }
.sim-stats b { display: block; margin-top: 2px; font-family: var(--mono); font-size: 11.5px; color: #e3e6ee; white-space: nowrap; }
.sim-stats b.neg { color: #ff858d; }
.sim-chart-wrap { height: 176px; margin-top: 10px; border: 1px solid var(--line); border-radius: 9px; background: #0b0d12; overflow: hidden; }
.sim-chart { display: block; width: 100%; height: 100%; }
.sim-caption { display: flex; justify-content: space-between; gap: 8px; margin-top: 4px; color: var(--muted-2); font-size: 8px; }
.table-wrap { margin-top: 8px; overflow-x: auto; }
.risk-table { width: 100%; border-collapse: collapse; font-size: 9px; }
.risk-table th { padding: 5px 3px; color: var(--muted-2); font-weight: 500; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
.risk-table th:first-child, .risk-table td:first-child { text-align: left; }
.risk-table td { padding: 5px 3px; color: #adb2bf; text-align: right; border-bottom: 1px solid rgba(255, 255, 255, 0.035); font-family: var(--mono); white-space: nowrap; }
.risk-table tr.is-current td { color: #ffd19a; background: rgba(247, 147, 26, 0.06); }
.risk-table tr:last-child td { border-bottom: 0; }

/* ---------- binary ---------- */
.binary-verdict { margin-top: 10px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); font-size: 11px; font-weight: 700; text-align: center; }
.binary-verdict.is-negative { border-color: rgba(234, 57, 67, 0.3); background: var(--red-soft); color: #ff8e96; }
.binary-verdict.is-positive { border-color: rgba(22, 199, 132, 0.3); background: var(--green-soft); color: var(--green); }
.binary-stake { margin-top: 8px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: rgba(0, 0, 0, 0.16); }
.binary-stake > span { display: block; color: var(--muted-2); font-size: 9px; }
.binary-stake > b { display: block; margin: 1px 0; color: var(--orange); font-family: var(--mono); font-size: 27px; line-height: 1.2; letter-spacing: -0.04em; }
.binary-stake > b.neg { color: var(--red); }
.binary-stake > small { display: block; color: var(--muted-2); font-size: 8.5px; }
.binary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin-top: 8px; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--line); }
.binary-grid > div { padding: 8px 9px; background: #111318; }
.binary-grid span { display: block; color: var(--muted-2); font-size: 8.5px; }
.binary-grid b { display: block; margin-top: 2px; font-family: var(--mono); font-size: 11px; color: #dfe2ea; }
.binary-grid b.pos { color: var(--green); }
.binary-grid b.neg { color: var(--red); }

/* ---------- journal ---------- */
.journal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-bottom: 9px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.journal-head b { color: var(--orange); font-family: var(--mono); font-size: 14px; }
.journal-list { display: flex; flex-direction: column; gap: 7px; margin-top: 9px; }
.journal-empty { padding: 22px 12px; border: 1px dashed var(--line-strong); border-radius: 9px; color: var(--muted-2); font-size: 9.5px; text-align: center; line-height: 1.6; }
.journal-item { padding: 8px 9px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255, 255, 255, 0.018); }
.journal-item__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.journal-item__side { display: flex; align-items: center; gap: 5px; font-family: var(--mono); font-size: 9px; }
.journal-item__side b { font-size: 9.5px; }
.journal-item__side b.long { color: var(--green); }
.journal-item__side b.short { color: var(--red); }
.journal-item__time { color: var(--muted-2); font-family: var(--mono); font-size: 8px; }
.journal-item__meta { margin-top: 4px; color: var(--muted-2); font-family: var(--mono); font-size: 8.5px; line-height: 1.55; }
.journal-item__actions { display: flex; gap: 4px; margin-top: 6px; }
.journal-item__actions button { padding: 2px 6px; border: 1px solid var(--line); border-radius: 5px; background: transparent; color: var(--muted); font-size: 8px; }
.journal-item__actions button:hover { border-color: var(--line-strong); color: var(--text); }
.journal-item__actions button[data-status="win"]:hover { color: var(--green); border-color: rgba(22, 199, 132, 0.4); }
.journal-item__actions button[data-status="loss"]:hover { color: var(--red); border-color: rgba(234, 57, 67, 0.4); }
.journal-status { padding: 1px 5px; border-radius: 99px; background: rgba(255, 255, 255, 0.05); color: var(--muted); font-size: 8px; }
.journal-status.open { background: rgba(247, 147, 26, 0.1); color: #d7a563; }
.journal-status.win { background: var(--green-soft); color: var(--green); }
.journal-status.loss { background: var(--red-soft); color: #ff858d; }
.journal-status.be { background: rgba(255, 255, 255, 0.07); color: #c6cad4; }

/* ---------- data panel ---------- */
.data-panel { padding: 11px 13px; }
.data-panel__row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 10px; }
.data-panel__actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.data-panel__status { color: var(--muted-2); font-family: var(--mono); font-size: 8.5px; white-space: nowrap; }
.data-panel p { margin-top: 7px; color: #555b68; font-size: 8.5px; line-height: 1.55; }
.mobile-access { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 8px; margin-top: 7px; padding: 7px 8px; border: 1px solid rgba(22, 199, 132, 0.2); border-radius: 8px; background: var(--green-soft); font-size: 9px; }
.mobile-access span { color: #7e9c91; }
.mobile-access a { color: var(--green); font-family: var(--mono); font-size: 9px; text-decoration: none; word-break: break-all; user-select: all; }
.mobile-access a:hover { text-decoration: underline; }
.diag-output {
  margin-top: 8px;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0b0d12;
  color: #aab0bd;
  font-family: var(--mono);
  font-size: 8.5px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ---------- footer, toast ---------- */
.page-footer { width: min(1580px, 100%); margin: 0 auto; padding: 0 22px 30px; color: #555b68; font-size: 9.5px; line-height: 1.65; }
.page-footer b { color: #8b91a1; }
.page-footer__meta { margin-top: 5px; color: #464b57; font-family: var(--mono); font-size: 8.5px; }
.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 60;
  transform: translate(-50%, 10px);
  max-width: min(420px, calc(100vw - 32px));
  padding: 9px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #191d27;
  color: #e8eaf0;
  font-size: 11px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.mobile-nav { display: none; }
.noscript { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: var(--bg); color: var(--text); font-size: 16px; }

/* ---------- responsive ---------- */
@media (max-width: 1360px) {
  .layout { grid-template-columns: minmax(0, 1fr) 400px; }
  .day-stat { padding: 0 10px; }
  .topbar { gap: 12px 18px; }
}

@media (max-width: 1160px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { display: grid; grid-template-columns: 1fr 1fr; align-items: start; }
  .goal-check { grid-column: 1; }
  .planner { grid-column: 1 / -1; grid-row: 2; }
  .data-panel { grid-column: 2; grid-row: 1; }
  .sidebar .planner { max-width: none; }
  .chart-wrap { height: 320px; }
}

@media (max-width: 860px) {
  .topbar { padding: 11px 14px; gap: 11px 18px; }
  .brand { flex-basis: 190px; }
  .quote__price { font-size: 23px; }
  .day-stats { order: 5; width: 100%; padding-top: 4px; }
  .day-stat { flex: 1; padding: 0 10px; }
  .day-stat:first-child { padding-left: 0; }
  .connection { margin-left: auto; }
  .topbar__clock { display: none; }
  .layout { padding: 13px 12px 28px; }
  .confluence { grid-template-columns: 1fr 1fr; }
  .confluence__main { grid-column: 1 / -1; }
  .verdict { grid-column: 1 / -1; }
  .prediction-head { flex-direction: column; gap: 12px; }
  .prediction-clock { width: 100%; }
  .clock-block { flex: 1; }
  .prediction-stats { grid-template-columns: repeat(3, 1fr); }
  .charts { grid-template-columns: 1fr; }
  .chart-wrap { height: 300px; }
  .factors__grid { gap: 16px; }
  .panel__head { align-items: flex-start; flex-direction: column; gap: 3px; }
  .panel__head p { text-align: left; }
}

@media (max-width: 640px) {
  body {
    font-size: 13px;
    padding-bottom: calc(58px + env(safe-area-inset-bottom));
  }
  .mobile-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 55;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    padding-bottom: env(safe-area-inset-bottom);
    border-top: 1px solid var(--line-strong);
    background: rgba(8, 9, 12, 0.96);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
  }
  .mobile-nav button {
    min-height: 56px;
    border: 0;
    border-right: 1px solid var(--line);
    background: transparent;
    color: var(--muted);
    font-size: 11px;
    font-weight: 650;
  }
  .mobile-nav button:last-child { border-right: 0; }
  .mobile-nav button.is-active { color: var(--orange); background: rgba(247, 147, 26, 0.06); }
  .toast { bottom: calc(70px + env(safe-area-inset-bottom)); }
  .field input, .field select { height: 40px; font-size: 16px; }
  .switch-field { min-height: 40px; font-size: 10.5px; }
  .btn { min-height: 44px; font-size: 12px; }
  .btn--small { min-height: 32px; font-size: 10px; }
  .tab-btn { min-height: 42px; padding: 8px 4px; font-size: 11px; }
  .segmented button { min-height: 36px; padding: 6px 9px; font-size: 10px; }
  .chip-btn { min-height: 34px; padding: 6px 9px; font-size: 9.5px; }
  .icon-btn { width: 34px; height: 34px; font-size: 18px; }
  .diag-top { min-height: 30px; padding: 4px 5px; }
  .day-stats { display: none; }
  .risk-banner { padding: 8px 38px 8px 12px; font-size: 10.5px; line-height: 1.5; }
  .risk-banner__mark { display: none; }
  .file-warning { padding: 7px 12px; font-size: 10px; }
  .risk-banner__close { right: 6px; }
  .brand__mark { width: 32px; height: 32px; font-size: 19px; border-radius: 9px; }
  .brand__title { font-size: 11.5px; }
  .brand__sub { font-size: 9px; }
  .quote__price { font-size: 21px; }
  .connection { min-width: 0; flex: 1 1 150px; }
  .connection__copy span { max-width: 112px; }
  .day-stats { overflow-x: auto; }
  .day-stat b { font-size: 10px; }
  .confluence { grid-template-columns: 1fr; gap: 12px; padding: 14px; }
  .confluence__main { grid-column: auto; }
  .verdict { grid-column: auto; }
  .tf-scores { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .prediction-panel { padding: 14px; }
  .prediction-head h1 { font-size: 23px; }
  .prediction-grid { grid-template-columns: 1fr; }
  .prediction-stats { grid-template-columns: 1fr 1fr; }
  .paper-status { flex-direction: column; gap: 6px; }
  .paper-balance { text-align: left; }
  .paper-actions { flex-direction: column; }
  .pred-toolbar { align-items: flex-start; padding: 0 13px 9px; }
  .prediction-history .table-wrap { padding: 0 13px; }
  .prediction-history > .fineprint { padding: 0 13px; }
  .pred-actions { margin-left: 0; }
  .charts { gap: 12px; }
  .chart-card { padding: 11px 10px 8px; }
  .chart-wrap { height: 260px; }
  .chart-card__foot .chart-hint { display: none; }
  .factors__grid { grid-template-columns: 1fr; gap: 18px; padding: 0 13px 14px; }
  .rules { grid-template-columns: 1fr; gap: 0; padding: 0 13px 12px; }
  .sidebar { display: flex; }
  .goal-check, .planner, .data-panel { width: 100%; }
  .tabs { grid-template-columns: repeat(2, 1fr); }
  .tab-btn { padding: 7px 4px; }
  .field-grid--goal { grid-template-columns: 1fr 1fr; }
  .goal-check__line b { font-size: 19px; }
  .goal-check__grid b { font-size: 9.5px; }
  .bet-box__main > b { font-size: 25px; }
  .sim-stats { grid-template-columns: 1fr 1fr; }
  .page-footer { padding: 0 14px 24px; }
}

@media (max-width: 640px) {
  .table-wrap { -webkit-overflow-scrolling: touch; }
  .pred-direction { font-size: 28px; }
  .clock-block b { font-size: 15px; }
  .prediction-stats b { font-size: 10px; }
  .prediction-note { font-size: 8.5px; }
  .mobile-access { font-size: 9.5px; }
}

@media (max-width: 380px) {
  .brand { flex-basis: 100%; }
  .connection { margin-left: 0; }
  .goal-check__grid { grid-template-columns: 1fr 1fr; }
  .goal-check__grid div:last-child { grid-column: 1 / -1; }
  .allin-box__grid { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
