/* Positioning terminal. Blue = calm / bullish / long dealer gamma, orange = stress / bearish / short gamma.
   Model overlays are white and dashed so they never read as market data. */
:root {
  --ink-0: #0c1a29;      /* page */
  --ink-1: #102236;      /* panels */
  --ink-2: #17304a;      /* raised controls */
  --line: #1f3a55;       /* hairlines */
  --text: #e7eef5;
  --text-2: #a3b6c8;
  --text-3: #6f8aa3;
  --bull: #5aaeff;
  --bear: #ff8a57;
  --model: #f2f5f8;
  --focus: #ffe08a;
  --font: "Archivo", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--ink-0); color: var(--text); }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  font-variation-settings: "wdth" 100;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------- tape (header) ---------- */
.tape {
  position: sticky; top: 0; z-index: 5;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 28px;
  padding: 14px 28px;
  background: rgba(12, 26, 41, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.quote { display: flex; align-items: baseline; gap: 16px; min-width: 0; }
.quote .sym {
  font-size: 15px; font-weight: 700; letter-spacing: 0.02em;
  font-variation-settings: "wdth" 112;
}
.quote .last {
  font-size: 40px; font-weight: 600; line-height: 1;
  font-variation-settings: "wdth" 120;
  font-variant-numeric: tabular-nums;
  transition: color 600ms ease;
}
.quote .last.tick-up { color: var(--bull); }
.quote .last.tick-down { color: var(--bear); }
.quote .chg { font-size: 16px; font-variant-numeric: tabular-nums; }
.up { color: var(--bull); }
.down { color: var(--bear); }
.muted { color: var(--text-3); }

.tickers { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tickers button {
  background: transparent; border: 1px solid var(--line); border-radius: 6px;
  padding: 4px 10px; cursor: pointer; color: var(--text-2);
  font-variation-settings: "wdth" 85;
}
.tickers button[aria-pressed="true"] { background: var(--ink-2); color: var(--text); border-color: #2c5378; }
.tickers input {
  width: 74px; background: transparent; border: 1px solid var(--line); border-radius: 6px;
  padding: 4px 8px; text-transform: uppercase;
}
.clock { text-align: right; font-size: 13px; color: var(--text-2); line-height: 1.35; }
.clock b { color: var(--text); font-weight: 600; }
.pulse {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--text-3); margin-right: 6px; vertical-align: 1px;
}
.pulse.live { background: var(--bull); box-shadow: 0 0 0 0 rgba(90, 174, 255, 0.6); animation: ping 2s infinite; }
.pulse.stale { background: var(--bear); }
@keyframes ping { 70% { box-shadow: 0 0 0 8px rgba(90, 174, 255, 0); } 100% { box-shadow: 0 0 0 0 rgba(90, 174, 255, 0); } }

/* ---------- hero: positioning map ---------- */
main { padding: 24px 28px 48px; max-width: 1680px; margin: 0 auto; }
.map-head { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 10px; }
h1 {
  margin: 0; font-size: 30px; line-height: 1.12; font-weight: 650;
  font-variation-settings: "wdth" 116;
  max-width: 24ch;
}
.map-head p { margin: 6px 0 0; color: var(--text-2); max-width: 70ch; }
.legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; color: var(--text-2); justify-content: flex-end; }
.legend span::before {
  content: ""; display: inline-block; width: 18px; height: 0; margin-right: 6px; vertical-align: 3px;
  border-top: 2px solid currentColor;
}
.legend .l-bull { color: var(--bull); }
.legend .l-bear { color: var(--bear); }
.legend .l-model::before { border-top: 2px dashed var(--model); }
.legend .l-dark::before { border-top: 3px solid #4d6880; }
.legend span { color: var(--text-2); }
.legend .l-bull::before { border-color: var(--bull); }
.legend .l-bear::before { border-color: var(--bear); }

.chart-map { height: min(64vh, 640px); min-height: 420px; }

/* ---------- panels ---------- */
.grid {
  display: grid;
  grid-template-columns: minmax(320px, 1.05fr) 1fr 1fr;
  grid-auto-rows: minmax(300px, auto);
  gap: 1px;
  margin-top: 26px;
  background: var(--line);            /* hairline gutters between panels */
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.panel { background: var(--ink-1); padding: 18px 20px 14px; min-width: 0; display: flex; flex-direction: column; }
.panel.model { grid-row: span 2; }
.panel.news { grid-column: 1 / -1; }
.panel header { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 8px; }
h2 {
  margin: 0; font-size: 17px; font-weight: 600; line-height: 1.25;
  font-variation-settings: "wdth" 108;
}
.age { font-size: 12px; color: var(--text-3); white-space: nowrap; font-variation-settings: "wdth" 80; }
.panel .note { margin: 0 0 6px; color: var(--text-2); font-size: 13px; }
.chart { flex: 1; min-height: 230px; }
.err { color: var(--bear); font-size: 13px; }

/* ---------- model read ---------- */
.model .forecast-day { color: var(--text-2); font-size: 13px; margin: -2px 0 14px; }
.stat { padding: 12px 0; border-top: 1px solid var(--line); }
.stat:first-of-type { border-top: 0; padding-top: 4px; }
.stat .k { font-size: 13px; color: var(--text-2); font-variation-settings: "wdth" 88; }
.stat .v {
  font-size: 26px; font-weight: 600; line-height: 1.15; margin-top: 2px;
  font-variation-settings: "wdth" 116;
}
.stat .v small { font-size: 14px; font-weight: 450; color: var(--text-2); font-variation-settings: "wdth" 100; }
.stat .d { font-size: 13px; color: var(--text-2); margin-top: 4px; }
.ruler { position: relative; height: 26px; margin: 10px 0 2px; }
.ruler .track { position: absolute; left: 0; right: 0; top: 11px; height: 4px; background: var(--ink-2); border-radius: 2px; }
.ruler .used { position: absolute; top: 9px; height: 8px; background: var(--text-2); border-radius: 2px; }
.ruler .tick { position: absolute; top: 2px; width: 0; height: 22px; border-left: 2px dashed var(--model); }
.ruler .tick.adj { border-left-color: var(--bear); }
.ruler .lab { position: absolute; top: -14px; font-size: 11px; color: var(--text-3); transform: translateX(-50%); white-space: nowrap; }
.pips { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.pip {
  font-size: 12px; padding: 2px 8px; border-radius: 999px; border: 1px solid currentColor;
  font-variation-settings: "wdth" 82;
}
.verdict { font-size: 12px; padding: 1px 7px; border-radius: 4px; border: 1px solid var(--text-3); color: var(--text-2); margin-left: 6px; }
.verdict.good { border-color: var(--bull); color: var(--bull); }
.verdict.weak { border-color: #c9b16b; color: #e2cd8c; }
.faded .v { color: var(--text-3); }
.spark { height: 46px; margin-top: 6px; }

/* ---------- news ---------- */
.news ol { list-style: none; margin: 0; padding: 0; overflow: auto; max-height: 340px; }
.news li { display: grid; grid-template-columns: 52px auto 1fr; gap: 12px; padding: 7px 0; border-top: 1px solid var(--line); align-items: baseline; }
.news li:first-child { border-top: 0; }
.news time { color: var(--text-3); font-size: 13px; font-variant-numeric: tabular-nums; }
.news .tk { display: flex; gap: 4px; }
.news .tk span { font-size: 11px; color: var(--text-2); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; font-variation-settings: "wdth" 80; }
.news .t { font-size: 14px; }
.news li.fresh .t { color: var(--bull); transition: color 4s ease; }

@media (max-width: 1100px) {
  .grid { grid-template-columns: 1fr 1fr; }
  .panel.model { grid-row: auto; grid-column: span 2; }
  .panel.news { grid-column: 1 / -1; }
}
@media (max-width: 720px) {
  .tape { grid-template-columns: 1fr; gap: 10px; padding: 12px 16px; }
  .clock { text-align: left; }
  main { padding: 16px; }
  .map-head { flex-direction: column; align-items: start; }
  .legend { justify-content: flex-start; }
  h1 { font-size: 24px; }
  .grid { grid-template-columns: 1fr; }
  .panel.model, .panel.news { grid-column: auto; }
  .quote .last { font-size: 32px; }
}
@media (prefers-reduced-motion: reduce) {
  .pulse.live { animation: none; }
  .quote .last, .news li.fresh .t { transition: none; }
}

.hint { margin: 6px 0 0; font-size: 12px; }

/* ---------- sign-in page ---------- */
body.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-box { width: min(380px, 100%); padding: 0; }
.login-box h1 { font-size: 28px; margin-bottom: 6px; }
.login-box p { margin: 0 0 22px; }
.login-box label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.login-box input {
  width: 100%; padding: 10px 12px; border-radius: 6px; border: 1px solid var(--line);
  background: var(--ink-1); color: var(--text); font-size: 16px;
}
.login-box button {
  margin-top: 14px; width: 100%; padding: 10px 12px; border-radius: 6px; border: 1px solid #2c5378;
  background: var(--ink-2); color: var(--text); font-weight: 600; cursor: pointer;
}
.login-box button:hover { border-color: var(--bull); }
.login-msg { color: var(--bear); font-size: 14px; }
.signout { color: var(--text-3); font-size: 12px; margin-left: 10px; }
.signout:hover { color: var(--text-2); }

/* ---------- 3D section ---------- */
.three { margin-top: 30px; }
.three-head { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 10px; flex-wrap: wrap; }
.three-head h2 { font-size: 24px; font-variation-settings: "wdth" 116; font-weight: 650; }
.three-head p { margin: 0; max-width: 64ch; font-size: 13px; }
.three-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px;
  background: var(--line); border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
}
.chart-3d { min-height: 380px; }
@media (max-width: 1100px) { .three-grid { grid-template-columns: 1fr; } }

/* ---------- decorative contour lines (no data) ---------- */
.map-head { position: relative; isolation: isolate; }
.head-contours { position: absolute; inset: -24px -28px -8px -28px; width: calc(100% + 56px); height: calc(100% + 32px);
  z-index: -1; opacity: 0.45; pointer-events: none;
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 35%, #000 70%, transparent 100%);
          mask-image: linear-gradient(90deg, transparent 0%, #000 35%, #000 70%, transparent 100%); }
body.login { position: relative; overflow: hidden; }
.login-contours { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none;
  animation: drift 60s ease-in-out infinite alternate; }
@keyframes drift { from { transform: scale(1.04) translate(-1%, -1%); } to { transform: scale(1.08) translate(1%, 1%); } }
.login-box { position: relative; z-index: 1; background: rgba(12, 26, 41, 0.78); backdrop-filter: blur(6px); padding: 28px 26px 26px; border-radius: 12px;
  border: 1px solid var(--line); }
@media (prefers-reduced-motion: reduce) { .login-contours { animation: none; } }

/* mid widths: price and clock on one row, ticker buttons on their own row, so the sticky header stays short */
@media (max-width: 1100px) and (min-width: 721px) {
  .tape { grid-template-columns: 1fr auto; row-gap: 8px; padding: 10px 24px; }
  .tickers { grid-column: 1 / -1; grid-row: 2; }
  .quote .last { font-size: 32px; }
}
