:root {
  --ink: #1b2430;
  --muted: #5c6a78;
  --paper: #f3ecdf;
  --paper-2: #e7dcc8;
  --card: #fffaf3;
  --lagoon: #123f49;
  --lagoon-deep: #0c2f36;
  --foam: #e7f6f3;
  --teal: #157f78;
  --teal-deep: #0f5f5a;
  --coral: #e15a3a;
  --coral-deep: #c4472a;
  --apricot: #f09a45;
  --line: rgba(27, 36, 48, 0.12);
  --shadow: 0 16px 36px rgba(18, 63, 73, 0.08);
  --serif: "Fraunces", Georgia, serif;
  --sans: "Outfit", "Segoe UI", sans-serif;
  --header: 68px;
  color-scheme: light;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: clip;
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 0% -8%, rgba(240, 154, 69, 0.2), transparent 55%),
    radial-gradient(720px 380px at 100% 0%, rgba(21, 127, 120, 0.14), transparent 48%),
    var(--paper);
  font: 400 17px/1.5 var(--sans);
}

body::before {
  content: "";
  pointer-events: none;
  position: fixed;
  inset: 0;
  opacity: 0.28;
  background-image: radial-gradient(rgba(27, 36, 48, 0.055) 0.7px, transparent 0.7px);
  background-size: 7px 7px;
}

img { max-width: 100%; display: block; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 560;
  letter-spacing: -0.03em;
  line-height: 1.08;
  margin: 0;
}
h1 { font-size: clamp(2.15rem, 5.4vw, 4.5rem); }
h2 { font-size: clamp(1.35rem, 2vw, 1.7rem); }
h3 { font-size: 1.2rem; }
p { margin: 0; }

:focus-visible { outline: 3px solid var(--apricot); outline-offset: 2px; }
::selection { background: #f3c9a4; }
::placeholder { color: #8d98a4; }

.skip {
  position: absolute;
  left: 12px;
  top: -48px;
  background: var(--ink);
  color: white;
  padding: 8px 12px;
  border-radius: 8px;
  z-index: 8;
}
.skip:focus { top: 12px; }

.top, .strip, .ticker, #main, .foot { position: relative; z-index: 1; }

.top {
  --header: 64px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--header);
  padding: max(8px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 8px max(16px, env(safe-area-inset-left));
  position: sticky;
  top: 0;
  background: rgba(243, 236, 223, 0.88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  z-index: 5;
}

.brand {
  flex: none;
  color: var(--lagoon);
  text-decoration: none;
  font-family: var(--serif);
  font-size: 1.55rem;
  font-weight: 680;
  letter-spacing: -0.04em;
  line-height: 1;
  white-space: nowrap;
}
.brand .ai {
  font-family: var(--sans);
  font-size: 0.58em;
  font-weight: 600;
  letter-spacing: 0.12em;
  margin-left: 0.28em;
  color: var(--coral);
  vertical-align: 0.45em;
}

.nav, .tools { display: flex; align-items: center; }
.nav { margin-left: auto; gap: 2px; min-width: 0; }
.tools { flex: none; gap: 8px; }

.nav button, .dock button {
  background: transparent;
  border: 0;
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--muted);
  font-weight: 500;
}
.nav button:hover, .dock button:hover { color: var(--ink); }
.nav button.is-on, .dock button.is-on { background: var(--lagoon); color: var(--foam); }

.icon-btn {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
}
.icon-btn:hover { background: rgba(27, 36, 48, 0.06); color: var(--ink); }
.icon-btn[aria-pressed="true"] { color: var(--teal-deep); background: var(--foam); }
.icon-btn .sound-on { display: none; }
.icon-btn[aria-pressed="true"] .sound-off { display: none; }
.icon-btn[aria-pressed="true"] .sound-on { display: block; }
.ico { width: 20px; height: 20px; }

.corner-logo {
  width: 44px;
  height: 44px;
  margin-left: 4px;
  flex: none;
  border-radius: 50%;
  overflow: hidden;
  display: block;
  background: #efe4d2;
  box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--apricot);
}
.corner-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 38%;
}

#connect {
  max-width: 11.5rem;
  white-space: nowrap;
}
#connect .short { display: none; }

.strip, .ticker {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 10px 4px;
  color: var(--muted);
  font-size: 0.92rem;
}
.strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  font-variant-numeric: tabular-nums;
}
.ticker {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  padding-top: 0;
  font-family: var(--serif);
  font-style: italic;
  color: var(--lagoon);
  min-height: 1.45em;
}

.pill {
  border: 1.5px solid var(--coral);
  color: var(--coral);
  border-radius: 999px;
  padding: 2px 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.5;
}
.pill.live { border-color: var(--teal); color: var(--teal); }

#main { width: min(1120px, calc(100% - 32px)); margin: 8px auto 40px; }
.foot {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto 40px;
  color: var(--muted);
  font-size: 0.9rem;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 28px 48px;
  align-items: center;
  padding: 22px 0 4px;
}
.hero-copy { min-width: 0; }
.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--teal-deep);
}
.lede { margin-top: 12px; font-size: 1.08rem; max-width: 38rem; }
.speech {
  margin: 18px 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 3px solid var(--coral);
  border-radius: 4px 16px 16px 16px;
  padding: 12px 16px;
  box-shadow: var(--shadow);
  max-width: 38rem;
}
.speech span {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--coral);
  font-weight: 600;
}
.speech p { font-family: var(--serif); font-style: italic; font-size: 1.22rem; line-height: 1.35; }
.policy { margin-top: 12px; color: var(--muted); max-width: 40rem; }

.row, .chips, .swatches { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row { margin-top: 8px; }

.btn {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 11px 16px;
  font-weight: 600;
  line-height: 1.2;
  background: var(--card);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.btn.primary { background: var(--coral); color: white; }
.btn.primary:hover { background: var(--coral-deep); }
.btn.secondary { background: transparent; border-color: var(--ink); }
.btn.secondary:hover { background: rgba(27, 36, 48, 0.05); }
.btn.teal { background: var(--teal); color: white; }
.btn.teal:hover { background: var(--teal-deep); }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.ghost:hover { border-color: var(--muted); }
.btn.danger {
  justify-self: start;
  background: transparent;
  color: var(--coral-deep);
  border-color: transparent;
  padding-left: 0;
}
.btn.tiny { padding: 4px 10px; margin-left: 8px; font-size: 0.86rem; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.tools .btn { padding: 9px 14px; }

.specimen {
  width: min(100%, 400px);
  margin: 0 0 0 auto;
  background: var(--card);
  padding: 12px 12px 14px;
  border-radius: 4px 4px 18px 18px;
  box-shadow: var(--shadow);
  transform: rotate(1.5deg);
}
.frame { position: relative; }
.specimen img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  object-position: center 38%;
  border-radius: 2px;
  background: #efe4d2;
}
.specimen figcaption {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 4px 0;
}
.specimen figcaption span { color: var(--muted); }
.stamp {
  position: absolute;
  right: 12px;
  bottom: 12px;
  border: 2px solid var(--coral);
  color: var(--coral);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 5px 8px;
  border-radius: 4px;
  transform: rotate(-8deg);
  background: rgba(255, 250, 243, 0.9);
}
.stamp.live { color: var(--teal); border-color: var(--teal); }

.banner {
  margin: 16px 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--foam);
  color: var(--lagoon-deep);
}
.banner.live { background: #e5f4ea; }
.banner.warn { background: #fde8df; color: #8a341f; }
.page-head { display: grid; gap: 8px; padding: 18px 0 6px; }
.page-head .lede { margin: 0; }

.lagoon-card, .card, .stat, .question, .entry {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
}
.lagoon-card, .card, .question { padding: 16px; }
.lagoon-head, .entry header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px 14px;
  flex-wrap: wrap;
}
.lagoon-head { margin-bottom: 10px; }
.question header { display: grid; gap: 4px; justify-items: start; margin-bottom: 4px; }
.question header .eyebrow { margin: 0; }

#pond-canvas {
  width: 100%;
  height: 320px;
  display: block;
  border-radius: 16px;
  background: var(--lagoon);
  cursor: crosshair;
}
.hint, .label { color: var(--muted); font-size: 0.92rem; }
.label { margin: 14px 0 6px; }

.parade, .notes, .trades { list-style: none; padding: 0; margin: 12px 0 0; }
.parade { display: flex; flex-wrap: wrap; gap: 8px; }
.parade li, .notes li, .trades li {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
  max-width: 100%;
  background: var(--paper);
  border-radius: 999px;
  padding: 6px 12px;
}
.parade li em { font-style: normal; color: var(--muted); }
.notes, .trades { display: grid; gap: 8px; }
.notes li, .trades li {
  border-radius: 14px;
  justify-content: space-between;
  align-items: baseline;
}
.notes li span { min-width: 0; overflow-wrap: anywhere; }
.parade li.ghost, .notes li.ghost, .trades li.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px dashed var(--line);
}
p.ghost { color: var(--muted); margin: 8px 0; }
.dot, .mark-dot {
  width: 14px;
  height: 14px;
  flex: none;
  border-radius: 50%;
  background: var(--apricot);
}

.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-top: 16px; }
.card h2, .stack h3 { margin-bottom: 8px; }
.stack { display: grid; gap: 8px; padding-top: 8px; }
.stack + .stack { border-top: 1px solid var(--line); margin-top: 12px; }
label { font-size: 0.86rem; font-weight: 600; }
input {
  width: 100%;
  border: 1px solid var(--line);
  background: white;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 16px;
}
.stat-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}
.stat-row div {
  min-width: 0;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--paper);
}
.stat { padding: 14px; min-width: 0; }
.stat-row span, .stat span { display: block; color: var(--muted); font-size: 0.8rem; }
.stat-row strong, .stat strong {
  display: block;
  font-family: var(--serif);
  font-size: clamp(1.15rem, 2.2vw, 1.55rem);
  font-weight: 560;
  letter-spacing: -0.03em;
  line-height: 1.15;
  overflow-wrap: anywhere;
}
.swatch {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 0 0 1px var(--line);
  padding: 0;
}
.swatch.is-on, .chip.is-on { outline: 2px solid var(--lagoon); outline-offset: 2px; }
.chip {
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 999px;
  padding: 7px 12px;
}
.chip:hover { border-color: var(--muted); }
.card-parade { padding: 4px 2px 8px; }

.questions { display: grid; gap: 16px; }
.choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 12px 0; }
.choice {
  text-align: left;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 16px;
  padding: 12px;
  display: grid;
  gap: 4px;
  min-width: 0;
}
.choice strong { font-family: var(--serif); font-size: 1.12rem; }
.choice span, .choice em { color: var(--muted); font-style: normal; font-size: 0.9rem; }
.choice.is-on { background: var(--lagoon); color: var(--foam); border-color: var(--lagoon); }
.choice.is-on span, .choice.is-on em { color: #d5eeea; }
.choice:disabled { opacity: 0.55; }
.bars { display: grid; gap: 8px; }
.bar-row {
  display: grid;
  grid-template-columns: minmax(0, 9.2rem) minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  font-size: 0.88rem;
}
.bar-row > span:first-child { line-height: 1.2; }
.track { height: 8px; background: var(--paper-2); border-radius: 99px; overflow: hidden; }
.track span { display: block; height: 100%; background: var(--teal); border-radius: inherit; }
.leader { margin-top: 10px; color: var(--muted); }

.journal { display: grid; gap: 12px; }
.entry {
  padding: 14px 18px 16px;
  background-image: repeating-linear-gradient(transparent, transparent 31px, rgba(27, 36, 48, 0.06) 32px);
  background-position: 0 52px;
}
.entry p {
  font-family: var(--serif);
  font-size: 1.15rem;
  line-height: 32px;
  max-width: 46rem;
}
.entry time { color: var(--muted); font-size: 0.85rem; }
.pnl, .up { color: var(--teal-deep); }
.down { color: var(--coral-deep); }
.flat { color: var(--muted); }
.pnl { font-weight: 600; white-space: nowrap; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.spark-card { margin-top: 16px; }
#spark { width: 100%; height: 120px; display: block; }
#spark polyline { fill: none; stroke: var(--teal); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.trades li strong { white-space: nowrap; }

dialog {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: calc(100vw - 24px);
  max-height: calc(100dvh - 24px);
}
dialog::backdrop { background: rgba(12, 47, 54, 0.48); }
.dialog-card {
  width: min(480px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  overflow: auto;
  background: var(--card);
  border-radius: 22px;
  padding: 20px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 10px;
}
.dialog-card h2 { margin-bottom: 2px; }
.dialog-card ol { margin: 8px 0; padding-left: 18px; }
.dialog-card details { color: var(--muted); }
.dialog-card summary { cursor: pointer; color: var(--ink); font-weight: 600; }
.wallet {
  width: 100%;
  display: flex;
  gap: 10px;
  align-items: center;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 14px;
  padding: 10px 12px;
}
.wallet img { width: 28px; height: 28px; border-radius: 8px; }

#toasts {
  position: fixed;
  top: calc(var(--header) + 12px);
  left: 50%;
  transform: translateX(-50%);
  width: min(380px, calc(100% - 32px));
  display: grid;
  gap: 8px;
  z-index: 6;
  pointer-events: none;
}
.toast {
  margin: 0;
  background: var(--lagoon);
  color: var(--foam);
  padding: 12px 14px;
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.dock { display: none; }
code { font-size: 0.9em; }
.banner code, .dialog-card code { overflow-wrap: anywhere; }

@media (max-width: 860px) {
  html { scroll-padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
  input, button, .choice { scroll-margin-bottom: calc(84px + env(safe-area-inset-bottom)); }
  .nav { display: none; }
  .tools { margin-left: auto; }
  .top {
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }
  .brand { font-size: 1.35rem; }
  .strip, .ticker { width: min(1120px, calc(100% - 24px)); }
  .hero, .split { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero { gap: 20px; padding-top: 12px; }
  .specimen { transform: none; margin: 0 auto; }
  #pond-canvas { height: 240px; }
  .foot { margin-bottom: calc(92px + env(safe-area-inset-bottom)); }
  .dock {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 250, 243, 0.96);
    border-top: 1px solid var(--line);
    z-index: 4;
    padding: 4px max(4px, env(safe-area-inset-right)) calc(4px + env(safe-area-inset-bottom)) max(4px, env(safe-area-inset-left));
  }
  .dock button {
    min-height: 48px;
    padding: 8px 2px;
    font-size: 0.78rem;
  }
  #toasts { top: calc(var(--header) + env(safe-area-inset-top) + 8px); }
}

@media (max-width: 520px) {
  h1 { font-size: 2.05rem; }
  .icon-btn, .corner-logo { width: 38px; height: 38px; }
  .corner-logo { box-shadow: 0 0 0 2px var(--card), 0 0 0 3.5px var(--apricot); }
  #connect { padding-inline: 12px; }
  #connect .full { display: none; }
  #connect .short { display: inline; }
  .choices, .stat-row { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: minmax(0, 7.4rem) minmax(48px, 1fr) auto; }
  .entry p { font-size: 1.05rem; }
  .speech p { font-size: 1.08rem; }
}

@media (max-width: 360px) {
  .top { gap: 8px; }
  .brand { font-size: 1.22rem; }
  .tools { gap: 4px; }
  .icon-btn, .corner-logo { width: 34px; height: 34px; }
  .corner-logo { margin-left: 0; }
  .tools .btn { padding: 8px 10px; font-size: 0.92rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .specimen { transform: none; }
  .btn, .icon-btn, .nav button, .dock button, .choice, .chip { transition: none; }
}
