/* Ballast — hydrographic chart aesthetic.
   Light theme is chart stock; dark theme is a bridge display at night. */

/* ---- tokens: light (chart paper) ----------------------------------------- */
:root {
  color-scheme: light;

  --paper:      #e8ece6;
  --paper-2:    #f4f6f1;
  --paper-3:    #dde3db;
  --sunk:       #e0e6de;
  --buff:       #ded4bb;
  --shallow:    #a9d7de;

  --ink:        #0c232e;
  --ink-2:      #4a646e;
  --ink-3:      #778d95;

  --hair:       rgba(12, 35, 46, 0.20);
  --hair-soft:  rgba(12, 35, 46, 0.09);

  --accent:     #0c6474;
  --accent-ink: #f4f6f1;
  --accent-soft: rgba(12, 100, 116, 0.11);

  --starboard:  #0f7048;
  --starboard-soft: rgba(15, 112, 72, 0.13);
  --port:       #ac2530;
  --port-soft:  rgba(172, 37, 48, 0.13);
  --caution:    #9d1f64;
  --caution-soft: rgba(157, 31, 100, 0.12);

  --lift: 0 1px 2px rgba(12, 35, 46, 0.06), 0 8px 24px -18px rgba(12, 35, 46, 0.4);

  --display: "Chivo", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --sans: "Chivo", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, monospace;

  --rail: 1180px;
}

/* System-dark, unless an explicit light choice overrides it. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;

    --paper:     #07161e;
    --paper-2:   #0b2130;
    --paper-3:   #102a38;
    --sunk:      #061219;
    --buff:      #2b2a1d;
    --shallow:   #10404c;

    --ink:       #dee8e4;
    --ink-2:     #90a8b0;
    --ink-3:     #5f7d87;

    --hair:      rgba(222, 232, 228, 0.17);
    --hair-soft: rgba(222, 232, 228, 0.08);

    --accent:     #5cc6d6;
    --accent-ink: #04161c;
    --accent-soft: rgba(92, 198, 214, 0.14);

    --starboard:  #3acb8d;
    --starboard-soft: rgba(58, 203, 141, 0.15);
    --port:       #f4707a;
    --port-soft:  rgba(244, 112, 122, 0.15);
    --caution:    #f478b8;
    --caution-soft: rgba(244, 120, 184, 0.15);

    --lift: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 30px -20px rgba(0, 0, 0, 0.9);
  }
}

/* Explicit dark choice wins over a light OS. */
:root[data-theme="dark"] {
  color-scheme: dark;

  --paper:     #07161e;
  --paper-2:   #0b2130;
  --paper-3:   #102a38;
  --sunk:      #061219;
  --buff:      #2b2a1d;
  --shallow:   #10404c;

  --ink:       #dee8e4;
  --ink-2:     #90a8b0;
  --ink-3:     #5f7d87;

  --hair:      rgba(222, 232, 228, 0.17);
  --hair-soft: rgba(222, 232, 228, 0.08);

  --accent:     #5cc6d6;
  --accent-ink: #04161c;
  --accent-soft: rgba(92, 198, 214, 0.14);

  --starboard:  #3acb8d;
  --starboard-soft: rgba(58, 203, 141, 0.15);
  --port:       #f4707a;
  --port-soft:  rgba(244, 112, 122, 0.15);
  --caution:    #f478b8;
  --caution-soft: rgba(244, 120, 184, 0.15);

  --lift: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 30px -20px rgba(0, 0, 0, 0.9);
}

/* ---- base ---------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: -0.02em;
  text-wrap: balance;
  margin: 0;
}

h1 { font-size: clamp(2.15rem, 4.9vw, 3.7rem); line-height: 1.04; letter-spacing: -0.036em; }
h2 { font-size: clamp(1.42rem, 2.7vw, 2rem); line-height: 1.12; letter-spacing: -0.026em; }
h3 { font-size: 1.05rem; line-height: 1.28; letter-spacing: -0.012em; }

p { margin: 0; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 1px;
}

.wrap {
  max-width: var(--rail);
  margin-inline: auto;
  padding-inline: clamp(16px, 4vw, 34px);
}

/* Chart-label conventions: water features in italic, soundings in mono. */
.eyebrow {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 0.75rem;
}

.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.label {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.up { color: var(--starboard); }
.down { color: var(--port); }
.muted { color: var(--ink-2); }

/* ---- chart sheet: the page's structural unit ------------------------------
   Graduated hairline ticks along the top and bottom edges, the way a chart
   sheet carries its border scale. */

.sheet {
  position: relative;
  background: var(--paper-2);
  border: 1px solid var(--hair);
  padding: clamp(18px, 3vw, 34px);
}

.sheet::before,
.sheet::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 6px;
  background-image: repeating-linear-gradient(90deg, var(--hair) 0 1px, transparent 1px 11px);
  pointer-events: none;
}
.sheet::before { top: 0; }
.sheet::after { bottom: 0; transform: scaleY(-1); }

/* Corner title block: each sheet states what it actually is. */
.sheet-block {
  position: absolute;
  top: -1px;
  right: -1px;
  display: flex;
  gap: 0;
  border: 1px solid var(--hair);
  border-top-color: transparent;
  background: var(--paper-3);
}
.sheet-block span {
  padding: 4px 9px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--ink-2);
  border-left: 1px solid var(--hair);
}
.sheet-block span:first-child { border-left: 0; color: var(--ink); }

.sheet-head { max-width: 62ch; margin-bottom: 1.6rem; }
.sheet-head p { color: var(--ink-2); margin-top: 0.6rem; }

/* ---- masthead ------------------------------------------------------------ */

.masthead {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: blur(12px) saturate(140%);
  border-bottom: 1px solid var(--hair);
}
.masthead-in {
  display: flex;
  align-items: center;
  gap: 1.4rem;
  height: 62px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--display);
  font-size: 1.22rem;
  font-weight: 700;
  letter-spacing: -0.035em;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.brand svg { display: block; overflow: visible; }
.brand-sub {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  border-left: 1px solid var(--hair);
  padding-left: 0.55rem;
  margin-left: 0.1rem;
}

.nav { display: flex; gap: 1.25rem; margin-left: auto; }
.nav a {
  font-size: 13.5px;
  color: var(--ink-2);
  text-decoration: none;
  padding: 3px 0;
  border-bottom: 1px solid transparent;
  transition: color 0.16s, border-color 0.16s;
}
.nav a:hover { color: var(--ink); border-bottom-color: var(--accent); }

.masthead-tools { display: flex; align-items: center; gap: 0.5rem; }

/* ---- controls ------------------------------------------------------------ */

.btn {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 0.55rem 1rem;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.16s ease;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--hair);
}
.btn-ghost:hover { border-color: var(--ink-2); filter: none; }

.btn-lg { padding: 0.72rem 1.35rem; font-size: 14px; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--hair);
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  transition: color 0.16s, border-color 0.16s;
}
.icon-btn:hover { color: var(--ink); border-color: var(--ink-3); }
.icon-btn svg { display: block; }

/* ---- hero ---------------------------------------------------------------- */

.hero { position: relative; padding-block: clamp(2.6rem, 6vw, 4.6rem) 0; overflow: hidden; }
#soundings {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.85;
  pointer-events: none;
}
.hero-in { position: relative; }
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  gap: clamp(1.5rem, 4vw, 3.4rem);
  align-items: end;
}
.hero h1 { margin-bottom: 1rem; }
.hero h1 em {
  font-style: normal;
  font-weight: 400;
  color: var(--accent);
}
.hero-lede {
  font-size: 1.06rem;
  color: var(--ink-2);
  max-width: 46ch;
  margin-bottom: 1.5rem;
}
.hero-cta { display: flex; flex-wrap: wrap; gap: 0.65rem; align-items: center; }

.hero-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid var(--hair);
  background: var(--paper-2);
}
.fact { padding: 0.9rem 1rem; border-right: 1px solid var(--hair-soft); border-bottom: 1px solid var(--hair-soft); }
.fact:nth-child(2n) { border-right: 0; }
.fact:nth-last-child(-n+2) { border-bottom: 0; }
.fact-val { font-family: var(--mono); font-size: 1.24rem; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.fact-key { margin-top: 0.15rem; }

/* ---- ticker -------------------------------------------------------------- */

.ticker {
  margin-top: clamp(2rem, 4vw, 3rem);
  border-top: 1px solid var(--hair);
  border-bottom: 1px solid var(--hair);
  background: var(--sunk);
  overflow: hidden;
  position: relative;
}
.ticker-track {
  display: flex;
  width: max-content;
  animation: drift 64s linear infinite;
}
.ticker:hover .ticker-track { animation-play-state: paused; }
@keyframes drift { from { transform: translateX(0); } to { transform: translateX(-50%); } }

.tick {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.6rem 1.15rem;
  border-right: 1px solid var(--hair-soft);
  font-size: 12.5px;
  white-space: nowrap;
}
.tick b { font-weight: 600; font-size: 11.5px; letter-spacing: 0.04em; }
.tick .num { font-size: 12.5px; }

/* ---- terminal ------------------------------------------------------------ */

.terminal {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 232px 296px;
  gap: 1px;
  background: var(--hair);
  border: 1px solid var(--hair);
}
.panel {
  background: var(--paper-2);
  padding: 0.9rem 1rem 1rem;
  min-width: 0;
}
.panel-head {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding-bottom: 0.7rem;
  margin-bottom: 0.8rem;
  border-bottom: 1px solid var(--hair-soft);
  min-height: 30px;
}
.panel-head .label { margin-right: auto; }

/* market selector + price */
.mkt-row { display: flex; align-items: center; flex-wrap: wrap; gap: 0.9rem 1.4rem; margin-bottom: 0.9rem; }
.mkt-pick {
  font-family: var(--display);
  font-size: 1.26rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1px dashed var(--hair);
  padding: 0 1.3rem 2px 0;
  cursor: pointer;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
                    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: right 6px center, right 1px center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.mkt-pick:hover { border-bottom-color: var(--accent); }
.mkt-last { font-family: var(--mono); font-size: 1.6rem; font-variant-numeric: tabular-nums; letter-spacing: -0.03em; transition: color 0.4s ease; }
.mkt-stat { display: flex; flex-direction: column; gap: 1px; }
.mkt-stat .num { font-size: 13px; }

.tf { display: flex; gap: 0; border: 1px solid var(--hair); }
.tf button {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  padding: 0.28rem 0.5rem;
  border: 0;
  border-left: 1px solid var(--hair);
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
  transition: color 0.14s, background 0.14s;
}
.tf button:first-child { border-left: 0; }
.tf button:hover { color: var(--ink); }
.tf button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }

.chart-box { position: relative; }
#chart { display: block; width: 100%; height: 372px; touch-action: pan-y; }
.crosshair-read {
  position: absolute;
  top: 6px;
  left: 6px;
  display: flex;
  gap: 0.8rem;
  padding: 0.3rem 0.55rem;
  background: color-mix(in srgb, var(--paper-2) 92%, transparent);
  border: 1px solid var(--hair);
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-2);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
}
.crosshair-read.on { opacity: 1; }
.crosshair-read b { color: var(--ink); font-weight: 500; }

/* order book */
.book { display: flex; flex-direction: column; gap: 1px; font-family: var(--mono); font-size: 11.5px; }
.book-head { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; margin-bottom: 0.3rem; }
.book-head span:last-child { text-align: right; }
.book-row {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  padding: 1.5px 4px;
  font-variant-numeric: tabular-nums;
  isolation: isolate;
}
.book-row span:last-child { text-align: right; color: var(--ink-2); }
.book-row .depth {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  z-index: -1;
  transition: width 0.35s ease;
}
.book-row.ask span:first-child { color: var(--port); }
.book-row.ask .depth { background: var(--port-soft); }
.book-row.bid span:first-child { color: var(--starboard); }
.book-row.bid .depth { background: var(--starboard-soft); }
.book-row.flash { animation: flash 0.45s ease-out; }
@keyframes flash { from { background: var(--accent-soft); } to { background: transparent; } }

.book-mid {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 4px;
  margin: 0.3rem 0;
  border-top: 1px solid var(--hair-soft);
  border-bottom: 1px solid var(--hair-soft);
}
.book-mid .num { font-size: 13.5px; }

/* order ticket */
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border: 1px solid var(--hair); margin-bottom: 0.85rem; }
.seg button {
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.52rem;
  border: 0;
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
  transition: background 0.16s, color 0.16s;
}
.seg button + button { border-left: 1px solid var(--hair); }
.seg button[aria-pressed="true"]:first-child { background: var(--starboard-soft); color: var(--starboard); }
.seg button[aria-pressed="true"]:last-child { background: var(--port-soft); color: var(--port); }

.field { margin-bottom: 0.8rem; }
.field-top { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.32rem; }
.input-wrap { display: flex; align-items: stretch; border: 1px solid var(--hair); background: var(--paper); }
.input-wrap:focus-within { border-color: var(--accent); }
.input-wrap input {
  flex: 1;
  min-width: 0;
  font-family: var(--mono);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  padding: 0.5rem 0.6rem;
  border: 0;
  background: transparent;
  color: var(--ink);
}
.input-wrap input:focus { outline: 0; }
.input-wrap .unit {
  display: grid;
  place-items: center;
  padding-inline: 0.6rem;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  border-left: 1px solid var(--hair-soft);
}

.chips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 6px; }
.chips button {
  font-family: var(--mono);
  font-size: 10.5px;
  padding: 0.26rem 0;
  border: 1px solid var(--hair);
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  transition: border-color 0.14s, color 0.14s;
}
.chips button:hover { border-color: var(--accent); color: var(--accent); }

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 20px;
  background: transparent;
  cursor: grab;
}
input[type="range"]:active { cursor: grabbing; }
input[type="range"]::-webkit-slider-runnable-track {
  height: 3px;
  background: linear-gradient(90deg, var(--accent) var(--fill, 20%), var(--hair) var(--fill, 20%));
}
input[type="range"]::-moz-range-track { height: 3px; background: var(--hair); }
input[type="range"]::-moz-range-progress { height: 3px; background: var(--accent); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px;
  height: 13px;
  margin-top: -5px;
  border: 1px solid var(--paper-2);
  background: var(--accent);
  border-radius: 50%;
}
input[type="range"]::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border: 1px solid var(--paper-2);
  background: var(--accent);
  border-radius: 50%;
}
.lev-scale { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 9.5px; color: var(--ink-3); margin-top: -2px; }

.summary { border-top: 1px solid var(--hair-soft); margin-top: 0.9rem; padding-top: 0.7rem; display: flex; flex-direction: column; gap: 0.34rem; }
.sum-row { display: flex; align-items: baseline; justify-content: space-between; gap: 0.7rem; font-size: 12px; }
.sum-row > span:first-child { color: var(--ink-2); }
.sum-row .num { font-size: 12.5px; }

/* margin-ratio meter: a bar with the maintenance threshold marked on it */
.meter { margin-top: 0.85rem; }
.meter-bar {
  position: relative;
  height: 5px;
  background: var(--paper-3);
  border: 1px solid var(--hair-soft);
  overflow: hidden;
}
.meter-fill { position: absolute; inset: 0 auto 0 0; width: 40%; background: var(--starboard); transition: width 0.4s ease, background 0.4s ease; }
.meter-mark { position: absolute; top: -3px; bottom: -3px; left: 12%; width: 1px; background: var(--caution); }
.meter-legend { display: flex; justify-content: space-between; margin-top: 5px; }

.ticket-submit { width: 100%; margin-top: 0.95rem; }
.ticket-submit.long { background: var(--starboard); border-color: var(--starboard); }
.ticket-submit.short { background: var(--port); border-color: var(--port); }

.notice {
  margin-top: 0.7rem;
  padding: 0.45rem 0.6rem;
  border-left: 2px solid var(--caution);
  background: var(--caution-soft);
  font-size: 11.5px;
  color: var(--ink);
}
.notice.ok { border-left-color: var(--starboard); background: var(--starboard-soft); }
.notice[hidden] { display: none; }

/* ---- tables -------------------------------------------------------------- */

.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
thead th {
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
  text-align: right;
  padding: 0 0.7rem 0.5rem;
  border-bottom: 1px solid var(--hair);
  white-space: nowrap;
}
thead th:first-child { text-align: left; padding-left: 0; }
thead th:last-child { padding-right: 0; }
tbody td {
  padding: 0.58rem 0.7rem;
  text-align: right;
  border-bottom: 1px solid var(--hair-soft);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
tbody td:first-child { text-align: left; padding-left: 0; }
tbody td:last-child { padding-right: 0; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.pick { cursor: pointer; transition: background 0.14s; }
tbody tr.pick:hover { background: var(--accent-soft); }
tbody tr.active td:first-child { box-shadow: inset 2px 0 0 var(--accent); padding-left: 8px; }

.sym { font-family: var(--sans); font-weight: 600; font-size: 12.5px; }
.sym small { display: block; font-weight: 400; font-size: 10.5px; color: var(--ink-3); letter-spacing: 0.01em; }
.spark { display: block; width: 78px; height: 24px; margin-left: auto; }

.pill {
  display: inline-block;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 6px;
  border: 1px solid currentColor;
}
.pill.long { color: var(--starboard); }
.pill.short { color: var(--port); }

.mini {
  font-family: var(--sans);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.5rem;
  border: 1px solid var(--hair);
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  transition: color 0.14s, border-color 0.14s;
}
.mini:hover { color: var(--port); border-color: var(--port); }

.empty { padding: 1.3rem 0; color: var(--ink-3); font-size: 12.5px; }
.empty em { font-family: var(--sans); font-style: normal; font-weight: 600; color: var(--ink-2); }

/* account strip above the positions table */
.acct { display: flex; flex-wrap: wrap; gap: 1px; background: var(--hair); border: 1px solid var(--hair); margin-bottom: 1rem; }
.acct > div { flex: 1 1 140px; background: var(--paper-2); padding: 0.6rem 0.75rem; }
.acct .num { display: block; font-size: 1.02rem; margin-top: 1px; }

/* ---- mechanics ----------------------------------------------------------- */

.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); gap: 1px; background: var(--hair); border: 1px solid var(--hair); }
.col { background: var(--paper-2); padding: 1.1rem 1.15rem 1.25rem; }
.col h3 { margin-bottom: 0.5rem; }
.col p { font-size: 13px; color: var(--ink-2); }
.col-key {
  display: inline-block;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.7rem;
  padding-bottom: 3px;
  border-bottom: 1px solid var(--accent-soft);
}
.formula {
  margin-top: 0.85rem;
  padding: 0.65rem 0.7rem;
  background: var(--sunk);
  border: 1px solid var(--hair-soft);
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--ink);
  overflow-x: auto;
}
.formula i { color: var(--ink-3); font-style: normal; }

/* ---- soundings band (stats) ---------------------------------------------- */

.band { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); gap: 1px; background: var(--hair); border: 1px solid var(--hair); }
.band > div { background: var(--paper-2); padding: 1.15rem 1.2rem 1.2rem; }
.band .fact-val { font-size: clamp(1.5rem, 3vw, 2rem); letter-spacing: -0.035em; }
.band p { font-size: 12px; color: var(--ink-2); margin-top: 0.4rem; }

/* ---- licence ------------------------------------------------------------- */

.lic { display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr); gap: clamp(1.2rem, 3vw, 2.4rem); align-items: start; }
.lic-text {
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.75;
  color: var(--ink-2);
  background: var(--sunk);
  border: 1px solid var(--hair-soft);
  padding: 1rem 1.1rem;
  max-height: 260px;
  overflow-y: auto;
  white-space: pre-wrap;
}
.lic-text strong { color: var(--ink); font-weight: 500; }
.lic ul { margin: 1rem 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 0.55rem; }
.lic li { display: flex; gap: 0.6rem; font-size: 13px; color: var(--ink-2); }
.lic li svg { flex: none; margin-top: 3px; color: var(--accent); }

/* ---- footer -------------------------------------------------------------- */

.foot { border-top: 1px solid var(--hair); margin-top: clamp(2.5rem, 6vw, 4.5rem); background: var(--sunk); }
.foot-in { display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr)); gap: 1.6rem; padding-block: clamp(1.8rem, 4vw, 2.8rem); }
.foot h4 { font-family: var(--mono); font-size: 9.5px; font-weight: 500; letter-spacing: 0.13em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 0.7rem; }
.foot ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 0.4rem; }
.foot a { font-size: 13px; color: var(--ink-2); text-decoration: none; }
.foot a:hover { color: var(--ink); text-decoration: underline; }
.foot-note { font-size: 12px; color: var(--ink-3); max-width: 44ch; margin-top: 0.8rem; }
.foot-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.4rem;
  align-items: center;
  padding-block: 0.9rem;
  border-top: 1px solid var(--hair);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.05em;
  color: var(--ink-3);
}

/* ---- section rhythm ----------------------------------------------------- */

section.block { padding-block: clamp(2.6rem, 6vw, 4.4rem); scroll-margin-top: 74px; }
section.block.tight { padding-block: clamp(1.8rem, 4vw, 2.8rem); }

/* ---- motion -------------------------------------------------------------- */

/* Load sequence. Elements rest visible; the animation only plays on arrival. */
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
.rise { animation: rise 0.62s cubic-bezier(0.22, 0.7, 0.25, 1) both; }
.rise-2 { animation-delay: 0.07s; }
.rise-3 { animation-delay: 0.14s; }
.rise-4 { animation-delay: 0.21s; }
.rise-5 { animation-delay: 0.28s; }

/* Scroll reveal: the base state is visible, so nothing depends on the
   observer ever firing. JS adds .pending only to what is below the fold. */
.reveal { transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.22, 0.7, 0.25, 1); }
.reveal.pending { opacity: 0; transform: translateY(16px); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .ticker-track { animation: none; }
  .reveal.pending { opacity: 1; transform: none; }
}

/* ---- responsive ---------------------------------------------------------- */

@media (max-width: 1040px) {
  .terminal { grid-template-columns: minmax(0, 1fr) 1fr; }
  .terminal .panel-chart { grid-column: 1 / -1; }
  .hero-grid { grid-template-columns: 1fr; align-items: start; }
  .hero-facts { max-width: 520px; }
  .lic { grid-template-columns: 1fr; }
  .foot-in { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .nav { display: none; }
  .terminal { grid-template-columns: 1fr; }
  #chart { height: 240px; }
  .mkt-row { gap: 0.7rem 1.1rem; }
  .mkt-last { font-size: 1.35rem; }
  .brand-sub { display: none; }
}

@media (max-width: 460px) {
  .hero-facts { grid-template-columns: 1fr; }
  .fact { border-right: 0; }
  .fact:nth-last-child(2) { border-bottom: 1px solid var(--hair-soft); }
  .foot-in { grid-template-columns: 1fr; }
  .sheet-block { position: static; display: inline-flex; margin-bottom: 1rem; border-top-color: var(--hair); }
}

/* ---- entry gate ----------------------------------------------------------
   Blocks the site until the terms are accepted. The page stays visible but
   dimmed behind, so what is being gated is legible. */

.gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: clamp(16px, 4vw, 40px);
  overflow-y: auto;
  background: color-mix(in srgb, var(--sunk) 78%, transparent);
  backdrop-filter: blur(7px) saturate(120%);
}
.gate[hidden] { display: none; }

.gate-panel {
  position: relative;
  width: min(640px, 100%);
  max-height: min(88vh, 860px);
  overflow-y: auto;
  padding: clamp(20px, 3.4vw, 34px);
  background: var(--paper-2);
  border: 1px solid var(--hair);
  box-shadow: var(--lift);
}
.gate-panel::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 6px;
  background-image: repeating-linear-gradient(90deg, var(--hair) 0 1px, transparent 1px 11px);
}

.gate-mark { display: block; color: var(--accent); margin-bottom: 0.9rem; }
.gate-panel h2 { margin-bottom: 0.5rem; }
.gate-lede { color: var(--ink-2); font-size: 14px; max-width: 58ch; }

/* Clause numbers are real structure here: these are numbered terms. */
.gate-terms {
  margin: 1.3rem 0 0;
  padding: 0;
  list-style: none;
  counter-reset: clause;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
/* The clause text mixes <strong> with bare text nodes, so the li must stay a
   normal flow container: a grid here would split those into separate items. */
.gate-terms li {
  counter-increment: clause;
  position: relative;
  padding-left: 30px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-2);
}
.gate-terms li::before {
  content: counter(clause, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 2px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--ink-3);
}
.gate-terms strong { color: var(--ink); font-weight: 600; }

.gate-check {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.6rem;
  align-items: start;
  margin-top: 1.4rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--hair);
  background: var(--sunk);
  font-size: 12.5px;
  line-height: 1.55;
  cursor: pointer;
}
.gate-check input { width: 15px; height: 15px; margin: 2px 0 0; accent-color: var(--accent); cursor: pointer; }

.gate-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.6rem; margin-top: 1.2rem; }
.gate-actions .btn:disabled { opacity: 0.45; cursor: not-allowed; }
.gate-actions .btn:disabled:hover { filter: none; }

/* ---- wallet modal -------------------------------------------------------- */

.modal-veil {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: clamp(16px, 4vw, 40px);
  overflow-y: auto;
  background: color-mix(in srgb, var(--sunk) 72%, transparent);
  backdrop-filter: blur(5px);
}
.modal-veil[hidden] { display: none; }

.modal {
  position: relative;
  width: min(430px, 100%);
  padding: clamp(18px, 3vw, 26px);
  background: var(--paper-2);
  border: 1px solid var(--hair);
  box-shadow: var(--lift);
}
.modal::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 6px;
  background-image: repeating-linear-gradient(90deg, var(--hair) 0 1px, transparent 1px 11px);
}
.modal-head { display: flex; align-items: flex-start; gap: 1rem; margin-bottom: 1rem; }
.modal-head h2 { font-size: 1.25rem; }
.modal-head p { font-size: 12.5px; color: var(--ink-2); margin-top: 0.2rem; }
.modal-head .icon-btn { margin-left: auto; flex: none; }

.modal-note {
  padding: 0.55rem 0.7rem;
  margin-bottom: 0.9rem;
  border-left: 2px solid var(--accent);
  background: var(--accent-soft);
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink);
}
.modal-note[hidden] { display: none; }
.modal-note.bad { border-left-color: var(--port); background: var(--port-soft); }
.modal-note.ok { border-left-color: var(--starboard); background: var(--starboard-soft); }

.wallet-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.wallet-list[hidden] { display: none; }
.wallet-list[aria-busy="true"] { opacity: 0.55; pointer-events: none; }

.wallet-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--hair);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.14s, background 0.14s;
}
.wallet-row:hover { border-color: var(--accent); background: var(--accent-soft); }

.wallet-mono {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 7px;
  background: var(--brand, var(--accent));
  color: #fff;
  font-family: var(--display);
  font-size: 15px;
  font-weight: 700;
}
.wallet-name { min-width: 0; }
.wallet-tag { margin-left: auto; flex: none; }

.wallet-connected { display: flex; flex-direction: column; gap: 0.45rem; }
.wallet-connected[hidden] { display: none; }
.wc-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.8rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--hair-soft);
  font-size: 13px;
}
.wc-row .num { font-size: 12.5px; word-break: break-all; text-align: right; }
.wc-actions { display: flex; gap: 0.5rem; margin-top: 0.6rem; }
.wc-actions .btn { flex: 1; }

.modal-foot { margin-top: 1rem; font-size: 11.5px; line-height: 1.55; color: var(--ink-3); }

/* Masthead chip */
.wallet-chip { font-family: var(--mono); font-size: 12px; letter-spacing: 0.02em; white-space: nowrap; }
.wallet-chip.on { border-color: var(--starboard); color: var(--starboard); }

@media (max-width: 900px) {
  .open-terminal { display: none; }
}
@media (max-width: 420px) {
  .wallet-chip { font-size: 11px; padding-inline: 0.6rem; }
  .wc-actions { flex-direction: column; }
}
