/* Bubblewire — trading-terminal theme v2 */

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/IBMPlexMono-400.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/assets/fonts/IBMPlexMono-500.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/assets/fonts/IBMPlexMono-600.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/assets/fonts/IBMPlexMono-700.woff2") format("woff2");
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/fonts/Inter-Variable.woff2") format("woff2");
}

:root {
  color-scheme: dark;
  --bg: #0a0a09;
  --panel: #100f0d;
  --panel-2: #14130f;
  --ink: #060605;
  --text: #ece9df;
  --muted: #a39c8b;
  --faint: rgba(163, 156, 139, 0.65);
  --line: rgba(236, 233, 223, 0.13);
  --line-soft: rgba(236, 233, 223, 0.07);
  --gold: #d8a84a;
  --gold-bright: #f0c469;
  --amber: #ffb454;
  --hot: #ff5d5d;
  --twitch: #9146ff;
  --x: #f4f2ea;
  --kick: #53fc18;
  --danger: #ff5d5d;
  --radius: 4px;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --chrome-h: 88px; /* topbar + tape */
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

* {
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: #2c2a23 transparent;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(900px 320px at 50% -80px, rgba(216, 168, 74, 0.08), transparent 70%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.93 0 0 0 0 0.91 0 0 0 0 0.87 0 0 0 0.022 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E"),
    linear-gradient(rgba(236, 233, 223, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(236, 233, 223, 0.02) 1px, transparent 1px);
  background-size: auto, 160px 160px, 28px 28px, 28px 28px;
}

::selection {
  background: rgba(216, 168, 74, 0.35);
}

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

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-thumb {
  background: #2c2a23;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #3a372e;
}

::-webkit-scrollbar-track {
  background: transparent;
}

button,
input {
  font: inherit;
}

button {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--muted);
  background: transparent;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: border-color 140ms ease, color 140ms ease, background-color 140ms ease, transform 80ms ease;
}

button:hover {
  color: var(--gold-bright);
  border-color: rgba(216, 168, 74, 0.55);
  background: rgba(216, 168, 74, 0.05);
}

button:active {
  transform: scale(0.97);
  background: rgba(216, 168, 74, 0.12);
}

kbd {
  padding: 2px 5px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 3px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
}

.shell {
  height: 100vh;
  display: grid;
  grid-template-rows: auto auto 1fr;
  overflow: hidden;
}

/* ---------- top bar ---------- */

.topbar {
  min-height: 58px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 8px 16px;
  background: rgba(8, 8, 7, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(6px);
  position: relative;
  z-index: 5;
  animation: fade-down 400ms cubic-bezier(0.2, 0, 0, 1) both;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--text);
  text-decoration: none;
}

.brand img {
  border: 1px solid var(--line);
  border-radius: 3px;
  transition: border-color 200ms ease;
}

.brand:hover img {
  border-color: rgba(216, 168, 74, 0.6);
}

.brand-text strong {
  display: block;
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1;
}

.brand-text small {
  display: block;
  margin-top: 4px;
  color: var(--gold);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.22em;
}

.cursor {
  color: var(--gold);
  animation: blink 1.2s steps(1) infinite;
}

.status-strip {
  display: flex;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  overflow-x: auto;
  padding: 2px;
  scrollbar-width: none;
}

.status-strip::-webkit-scrollbar {
  display: none;
}

.status-strip > * {
  flex: none;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: rgba(236, 233, 223, 0.03);
  font-family: var(--mono);
  white-space: nowrap;
  transition: border-color 200ms ease;
}

.status-pill:hover {
  border-color: rgba(236, 233, 223, 0.3);
}

.status-pill strong {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.status-pill small {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.04em;
}

.status-dot {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--muted);
  transition: background-color 300ms ease, box-shadow 300ms ease;
}

[data-state="connected"] .status-dot,
[data-state="webhook-ready"] .status-dot,
[data-state="live"] .status-dot {
  background: var(--kick);
  box-shadow: 0 0 6px rgba(83, 252, 24, 0.7);
}

[data-state="demo"] .status-dot {
  background: var(--gold);
  box-shadow: 0 0 6px rgba(216, 168, 74, 0.6);
}

[data-state="missing"] .status-dot,
[data-state="idle"] .status-dot {
  background: var(--muted);
  box-shadow: none;
}

[data-state="connecting"] .status-dot,
[data-state="retry"] .status-dot {
  background: var(--gold);
  animation: pulse 1s ease-in-out infinite;
}

[data-state="error"] .status-dot,
[data-state="down"] .status-dot {
  background: var(--danger);
  box-shadow: 0 0 6px rgba(255, 93, 93, 0.7);
}

.topbar-tools {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.link-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 2px;
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.clock {
  min-width: 100px;
  text-align: right;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 14px rgba(216, 168, 74, 0.35);
}

.overlay-link {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid rgba(216, 168, 74, 0.5);
  border-radius: 2px;
  color: var(--gold);
  text-decoration: none;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: background-color 140ms ease, color 140ms ease, box-shadow 140ms ease;
}

.overlay-link:hover {
  background: var(--gold);
  color: var(--bg);
  box-shadow: 0 0 18px rgba(216, 168, 74, 0.35);
}

/* ---------- tape ---------- */

.tape {
  display: flex;
  align-items: center;
  gap: 22px;
  min-height: 30px;
  padding: 4px 16px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--ink);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--muted);
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
  animation: fade-down 400ms cubic-bezier(0.2, 0, 0, 1) 50ms both;
}

.tape::-webkit-scrollbar {
  display: none;
}

.tape b {
  color: var(--gold);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.tape .src b {
  color: var(--src);
}

/* ---------- layout ---------- */

.layout {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr) 332px;
  gap: 12px;
  padding: 12px 16px;
  align-items: stretch;
  min-height: 0;
}

.rail,
.feed-panel,
.inspector {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.4), 0 14px 40px rgba(0, 0, 0, 0.2);
  min-height: 0;
}

.rail {
  animation: rise 450ms cubic-bezier(0.2, 0, 0, 1) 80ms both;
}

.feed-panel {
  animation: rise 450ms cubic-bezier(0.2, 0, 0, 1) 140ms both;
}

.inspector {
  animation: rise 450ms cubic-bezier(0.2, 0, 0, 1) 200ms both;
}

.rail,
.inspector {
  padding: 14px;
  overflow-y: auto;
}

.rail-section,
.panel-section {
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line-soft);
}

.rail-section:last-of-type,
.panel-section:last-child {
  border-bottom: 0;
  margin-bottom: 0;
}

h1,
h2 {
  margin: 0;
}

h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
}

h2 small {
  color: var(--faint);
  font-weight: 400;
  letter-spacing: 0.1em;
}

h2 label {
  color: inherit;
}

.count-chip {
  display: inline-block;
  min-width: 16px;
  padding: 1px 4px;
  border: 1px solid var(--line);
  border-radius: 2px;
  text-align: center;
  color: var(--muted);
}

.mini-btn {
  margin-left: auto;
  min-height: 22px;
  padding: 0 8px;
  font-size: 9px;
  letter-spacing: 0.1em;
}

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

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.segmented button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.segmented button small {
  font-size: 9px;
  font-weight: 500;
  opacity: 0.65;
  font-variant-numeric: tabular-nums;
}

.segmented button.active {
  color: var(--bg);
  background: var(--gold);
  border-color: var(--gold);
  box-shadow: 0 2px 14px rgba(216, 168, 74, 0.25);
}

.search-wrap {
  position: relative;
}

.search-wrap kbd {
  position: absolute;
  right: 9px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  transition: opacity 140ms ease;
}

.search-wrap:focus-within kbd {
  opacity: 0;
}

input[type="search"] {
  width: 100%;
  min-height: 36px;
  padding: 0 30px 0 10px;
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--text);
  background: var(--ink);
  font-family: var(--mono);
  font-size: 12px;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

input[type="search"]::placeholder {
  color: rgba(163, 156, 139, 0.6);
}

input[type="search"]:focus {
  outline: none;
  border-color: rgba(216, 168, 74, 0.6);
  box-shadow: 0 0 0 3px rgba(216, 168, 74, 0.08);
}

.switch-row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 32px;
  cursor: pointer;
  font-size: 13px;
}

.switch-row small {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
}

.switch-row input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.switch {
  flex: none;
  width: 28px;
  height: 16px;
  border: 1px solid var(--line);
  border-radius: 2px;
  position: relative;
  transition: border-color 140ms ease;
}

.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 10px;
  height: 10px;
  background: var(--muted);
  transition: transform 160ms cubic-bezier(0.2, 0, 0, 1), background-color 160ms ease;
}

.switch-row input:checked + .switch {
  border-color: var(--gold);
}

.switch-row input:checked + .switch::after {
  transform: translateX(12px);
  background: var(--gold);
}

.switch-row input:focus-visible + .switch {
  outline: 1px solid var(--gold);
  outline-offset: 2px;
}

.control-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

#pauseButton[aria-pressed="true"] {
  color: var(--bg);
  background: var(--gold);
  border-color: var(--gold);
}

.counters {
  margin: 0;
  display: grid;
  gap: 2px;
}

.counters div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 26px;
}

.counters dt {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.counters dd {
  margin: 0;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

.counters dd.tick {
  animation: tick-flash 600ms ease-out;
}

.rail-hint {
  margin: 14px 0 0;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  line-height: 1.7;
}

/* ---------- feed ---------- */

.feed-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.feed-head {
  flex: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 14px 18px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
}

h1 {
  font-family: var(--mono);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1::before {
  content: "▮ ";
  color: var(--gold);
}

.feed-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}

.live-meter {
  display: grid;
  grid-template-columns: repeat(5, 7px);
  align-items: end;
  gap: 4px;
  height: 32px;
}

.live-meter span {
  display: block;
  background: var(--gold);
  animation: meter 900ms ease-in-out infinite alternate;
  transform-origin: bottom;
}

.live-meter span:nth-child(1) { height: 14px; animation-delay: 0ms; }
.live-meter span:nth-child(2) { height: 24px; animation-delay: 80ms; }
.live-meter span:nth-child(3) { height: 11px; animation-delay: 160ms; }
.live-meter span:nth-child(4) { height: 30px; animation-delay: 240ms; }
.live-meter span:nth-child(5) { height: 19px; animation-delay: 320ms; }

.feed-panel.paused .live-meter span {
  animation-play-state: paused;
  opacity: 0.35;
}

.paused-banner {
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 18px;
  background: rgba(216, 168, 74, 0.08);
  border-bottom: 1px solid rgba(216, 168, 74, 0.25);
  color: var(--gold);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.paused-banner b {
  font-variant-numeric: tabular-nums;
}

.feed-scroll-zone {
  position: relative;
  flex: 1;
  min-height: 0;
}

.jump-pill {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 26px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: var(--gold);
  color: var(--bg);
  font-size: 10px;
  letter-spacing: 0.12em;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5), 0 0 20px rgba(216, 168, 74, 0.25);
  animation: pill-in 240ms cubic-bezier(0.2, 0, 0, 1);
}

.jump-pill:hover {
  color: var(--bg);
  background: var(--gold-bright);
  border-color: transparent;
}

.jump-pill b {
  font-variant-numeric: tabular-nums;
}

.feed {
  list-style: none;
  margin: 0;
  padding: 8px;
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.message {
  --src: var(--gold);
  flex: none;
  padding: 9px 12px 10px;
  border: 1px solid var(--line-soft);
  border-left: 2px solid var(--src);
  border-radius: 2px;
  background: rgba(236, 233, 223, 0.025);
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.message:hover {
  background: rgba(236, 233, 223, 0.05);
  border-color: var(--line);
  border-left-color: var(--src);
  box-shadow: inset 2px 0 0 var(--src);
}

.message.selected {
  background: rgba(216, 168, 74, 0.07);
  border-color: rgba(216, 168, 74, 0.5);
  border-left-color: var(--src);
  box-shadow: inset 2px 0 0 var(--src);
}

.msg-enter {
  animation: msg-in 260ms cubic-bezier(0.2, 0, 0, 1);
}

.msg-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 4px;
}

.src-tag {
  flex: none;
  padding: 1px 6px;
  border-radius: 2px;
  background: var(--src);
  color: var(--bg);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.author {
  font-weight: 700;
  font-size: 13.5px;
}

.verified {
  color: var(--gold);
  font-size: 11px;
}

.handle,
.channel,
.msg-time {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.02em;
}

.handle,
.channel {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.msg-time {
  font-variant-numeric: tabular-nums;
}

.mode-tag {
  padding: 1px 5px;
  border: 1px solid rgba(216, 168, 74, 0.45);
  border-radius: 2px;
  color: var(--gold);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.msg-spacer {
  flex: 1;
}

.heat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--gold);
  font-family: var(--mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.heat-bar {
  display: inline-flex;
  gap: 2px;
}

.heat-bar i {
  width: 3px;
  height: 9px;
  background: var(--line);
  transition: background-color 200ms ease;
}

.heat-bar i.on {
  background: var(--gold);
}

.heat[data-tier="2"] {
  color: var(--amber);
}

.heat[data-tier="2"] .heat-bar i.on {
  background: var(--amber);
}

.heat[data-tier="3"] {
  color: var(--hot);
  text-shadow: 0 0 10px rgba(255, 93, 93, 0.5);
}

.heat[data-tier="3"] .heat-bar i.on {
  background: var(--hot);
}

.pin-btn {
  min-height: 24px;
  padding: 0 8px;
  font-size: 9px;
}

.message.pinned-state .pin-btn {
  color: var(--gold);
  border-color: rgba(216, 168, 74, 0.5);
}

.msg-content {
  margin: 0;
  padding-left: 2px;
  font-size: 14px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  text-wrap: pretty;
}

.msg-content a {
  color: var(--gold-bright);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: rgba(240, 196, 105, 0.4);
}

.msg-content a:hover {
  text-decoration-color: var(--gold-bright);
}

.cashtag {
  color: var(--gold-bright);
  font-weight: 600;
}

.mention {
  color: var(--src);
  font-weight: 500;
}

mark {
  background: rgba(216, 168, 74, 0.32);
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
}

.empty-state {
  min-height: 180px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 2px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.empty-state::after {
  content: "▌";
  margin-left: 6px;
  color: var(--gold);
  animation: blink 1.2s steps(1) infinite;
}

/* ---------- inspector ---------- */

.source-cards,
.pinned-list {
  display: grid;
  gap: 6px;
}

.source-card,
.pinned-item {
  padding: 9px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 2px;
  background: rgba(236, 233, 223, 0.025);
}

.source-card {
  border-left: 2px solid var(--src, var(--line));
  transition: background-color 140ms ease;
}

.source-card:hover {
  background: rgba(236, 233, 223, 0.045);
}

.source-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.source-card-head strong {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.spark {
  display: block;
  width: 60px;
  height: 16px;
  margin-left: auto;
  opacity: 0.9;
}

.metric-value {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 500;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

.source-card p,
.pinned-item p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.source-card .last-at {
  margin-top: 4px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#radarCanvas {
  display: block;
  width: 100%;
  aspect-ratio: 2.2 / 1;
  border: 1px solid var(--line-soft);
  border-radius: 2px;
  background: var(--ink);
}

.radar-axis {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}

.radar-legend {
  display: flex;
  gap: 14px;
  margin-top: 6px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.radar-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.radar-legend i {
  width: 7px;
  height: 7px;
  border-radius: 1px;
}

.pinned-item {
  border-left: 2px solid var(--gold);
  position: relative;
}

.pinned-item strong {
  display: block;
  padding-right: 54px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.pinned-item .unpin-btn {
  position: absolute;
  top: 7px;
  right: 7px;
  min-height: 20px;
  padding: 0 6px;
  font-size: 8.5px;
}

.pinned-empty {
  border-left-color: var(--line);
}

.raw-section pre {
  max-height: 300px;
  overflow: auto;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 2px;
  background: var(--ink);
  color: #cfc9b8;
  font-family: var(--mono);
  font-size: 10.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ---------- toasts ---------- */

.toast-root {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  pointer-events: none;
}

.toast {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-left: 2px solid var(--gold);
  border-radius: 2px;
  background: rgba(6, 6, 5, 0.92);
  backdrop-filter: blur(8px);
  color: var(--text);
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  animation: toast-in 240ms cubic-bezier(0.2, 0, 0, 1);
  transition: opacity 300ms ease, transform 300ms ease;
}

.toast[data-tone="warn"] {
  border-left-color: var(--amber);
}

.toast[data-tone="err"] {
  border-left-color: var(--hot);
}

.toast.out {
  opacity: 0;
  transform: translateY(6px);
}

/* ---------- overlay ---------- */

.overlay-root {
  min-height: 100vh;
  padding: 24px;
  background: transparent;
}

.overlay-feed {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
  max-width: 720px;
}

.overlay-item {
  --src: var(--gold);
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 16px;
  border: 1px solid rgba(236, 233, 223, 0.14);
  border-left: 3px solid var(--src);
  border-radius: 4px;
  background: rgba(6, 6, 5, 0.88);
  backdrop-filter: blur(8px);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.45);
  animation: overlay-in 280ms cubic-bezier(0.2, 0, 0, 1);
}

.overlay-item .src-tag {
  margin-top: 3px;
}

.overlay-item strong {
  display: block;
  margin-bottom: 2px;
  font-size: 15px;
}

.overlay-item .msg-content {
  font-size: 15px;
  color: #f4f2ea;
}

/* ---------- animation ---------- */

@keyframes meter {
  from { transform: scaleY(0.45); opacity: 0.6; }
  to { transform: scaleY(1); opacity: 1; }
}

@keyframes blink {
  50% { opacity: 0; }
}

@keyframes pulse {
  50% { opacity: 0.25; }
}

@keyframes msg-in {
  from { opacity: 0; transform: translateY(-7px); }
}

@keyframes overlay-in {
  from { opacity: 0; transform: translateX(-14px); }
}

@keyframes fade-down {
  from { opacity: 0; transform: translateY(-8px); }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
}

@keyframes pill-in {
  from { opacity: 0; transform: translate(-50%, -6px); }
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
}

@keyframes tick-flash {
  0% {
    color: var(--gold-bright);
    text-shadow: 0 0 10px rgba(240, 196, 105, 0.8);
  }
}

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

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

@media (max-width: 1180px) {
  .shell {
    height: auto;
    overflow: visible;
  }

  .layout {
    grid-template-columns: 214px minmax(0, 1fr);
  }

  .feed-panel {
    height: calc(100vh - 130px);
  }

  .rail {
    position: sticky;
    top: 12px;
    max-height: calc(100vh - 24px);
  }

  .inspector {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 18px;
    align-items: start;
  }
}

@media (max-width: 820px) {
  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    padding: 8px 10px;
  }

  .brand,
  .brand-text {
    min-width: 0;
  }

  .brand-text small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .status-strip {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: flex-start;
  }

  .clock {
    display: none;
  }

  .link-label {
    display: none;
  }

  .link-state,
  .overlay-link {
    padding: 0 9px;
  }

  .layout {
    grid-template-columns: 1fr;
    padding: 10px;
  }

  .rail,
  .inspector {
    position: static;
    max-height: none;
    overflow: visible;
  }

  .feed-panel {
    height: 68vh;
  }

  .inspector {
    grid-template-columns: 1fr;
  }

  .handle,
  .channel {
    max-width: 110px;
  }

  .rail-hint {
    display: none;
  }

  .toast-root {
    right: 10px;
    bottom: 10px;
  }
}

/* ---------- v3: setup drawer, watchlist, history, collapse ---------- */

.setup-button {
  min-height: 36px;
}

.setup-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(6, 6, 5, 0.6);
  backdrop-filter: blur(2px);
  animation: backdrop-in 200ms ease both;
}

.setup-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 31;
  width: min(400px, 94vw);
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-left: 1px solid var(--line);
  box-shadow: -24px 0 60px rgba(0, 0, 0, 0.5);
  animation: drawer-in 260ms cubic-bezier(0.2, 0, 0, 1) both;
}

.setup-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-2);
}

.setup-head h2 {
  margin: 0;
}

.setup-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
}

.setup-loading {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.setup-section {
  --src: var(--gold);
  padding: 12px;
  margin-bottom: 10px;
  border: 1px solid var(--line-soft);
  border-left: 2px solid var(--src);
  border-radius: 2px;
  background: rgba(236, 233, 223, 0.02);
}

.setup-section h3 {
  margin: 0 0 10px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.setup-section h3 small {
  color: var(--muted);
  font-weight: 400;
  letter-spacing: 0.08em;
}

.setup-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.45;
}

.env-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 26px;
  font-family: var(--mono);
  font-size: 10.5px;
}

.env-row code {
  color: var(--text);
  letter-spacing: 0.02em;
}

.env-row .env-state {
  margin-left: auto;
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 9.5px;
}

.env-dot {
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--muted);
}

.env-row[data-present="true"] .env-dot {
  background: var(--kick);
  box-shadow: 0 0 5px rgba(83, 252, 24, 0.6);
}

.env-row[data-present="true"] .env-state {
  color: var(--kick);
}

.env-details {
  margin-top: 8px;
}

.env-details summary {
  cursor: pointer;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 4px 0;
}

.env-details summary:hover {
  color: var(--gold);
}

.webhook-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 7px 9px;
  border: 1px solid var(--line-soft);
  border-radius: 2px;
  background: var(--ink);
}

.webhook-row code {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--gold-bright);
  font-family: var(--mono);
  font-size: 10px;
}

.setup-foot {
  flex: none;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
}

.setup-foot-link {
  color: var(--gold);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
}

.setup-foot-link:hover {
  color: var(--gold-bright);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* watchlist */

.watch-add {
  display: flex;
  gap: 6px;
}

.watch-add input {
  flex: 1;
  min-width: 0;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--text);
  background: var(--ink);
  font-family: var(--mono);
  font-size: 12px;
}

.watch-add input:focus {
  outline: none;
  border-color: rgba(216, 168, 74, 0.6);
}

.watch-add button {
  min-height: 34px;
  padding: 0 10px;
}

.watch-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 8px 0;
}

.watch-chip {
  min-height: 24px;
  padding: 0 8px;
  font-size: 9.5px;
  letter-spacing: 0.06em;
  text-transform: none;
  color: var(--gold);
  border-color: rgba(216, 168, 74, 0.4);
}

.watch-chip:hover {
  color: var(--hot);
  border-color: rgba(255, 93, 93, 0.5);
  background: rgba(255, 93, 93, 0.06);
}

.watch-empty {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
}

.watch-tag {
  padding: 1px 6px;
  border-radius: 2px;
  background: rgba(216, 168, 74, 0.18);
  border: 1px solid rgba(216, 168, 74, 0.5);
  color: var(--gold-bright);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.message.watch-hit {
  border-color: rgba(216, 168, 74, 0.35);
  background: rgba(216, 168, 74, 0.045);
}

/* collapse + history */

.dupe-badge {
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(236, 233, 223, 0.1);
  border: 1px solid var(--line);
  color: var(--text);
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.feed-foot {
  flex: none;
  padding: 8px;
  border-top: 1px solid var(--line-soft);
  background: var(--panel-2);
}

.feed-foot button {
  width: 100%;
  min-height: 32px;
  font-size: 10px;
}

.feed-foot button:disabled {
  opacity: 0.45;
  cursor: default;
  color: var(--muted);
  border-color: var(--line-soft);
  background: transparent;
}

.older-row {
  opacity: 0.82;
}

.author[data-author-q] {
  cursor: pointer;
}

.author[data-author-q]:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* overlay alignment + fade */

.overlay-root.align-bottom {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 100vh;
}

.overlay-item.overlay-out {
  opacity: 0;
  transform: translateX(-10px);
  transition: opacity 420ms ease, transform 420ms ease;
}

@keyframes drawer-in {
  from { opacity: 0; transform: translateX(30px); }
}

@keyframes backdrop-in {
  from { opacity: 0; }
}

@media (max-width: 820px) {
  .setup-button {
    padding: 0 9px;
  }

  .setup-drawer {
    width: 100vw;
  }
}

/* ---------- overlay configurator page ---------- */

.config-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.config-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 12px;
  padding: 12px 16px;
  align-items: stretch;
}

.config-rail {
  position: static;
  max-height: none;
}

.cfg-slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cfg-slider-row input[type="range"] {
  flex: 1;
  accent-color: var(--gold);
  background: transparent;
}

.cfg-slider-row output {
  min-width: 48px;
  text-align: right;
  color: var(--gold);
  font-family: var(--mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.cfg-url-row code {
  font-size: 10.5px;
}

.config-preview-panel {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: hidden;
}

.config-preview {
  flex: 1;
  min-height: 420px;
  background:
    linear-gradient(45deg, #161512 25%, transparent 25%, transparent 75%, #161512 75%),
    linear-gradient(45deg, #161512 25%, transparent 25%, transparent 75%, #161512 75%),
    #1d1b17;
  background-size: 22px 22px;
  background-position: 0 0, 11px 11px;
}

.config-preview iframe {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 420px;
  border: 0;
}

@media (max-width: 900px) {
  .config-layout {
    grid-template-columns: 1fr;
  }
}

/* ---------- v4: themes ---------- */

[data-theme="matrix"] {
  --bg: #050a06;
  --panel: #0a120c;
  --panel-2: #0d1710;
  --ink: #030604;
  --gold: #3dff6e;
  --gold-bright: #7dffa1;
  --amber: #c8ff4d;
  --line: rgba(120, 255, 160, 0.14);
  --line-soft: rgba(120, 255, 160, 0.07);
  --text: #dcf5e2;
  --muted: #84a78d;
  --faint: rgba(132, 167, 141, 0.65);
}

[data-theme="ice"] {
  --bg: #06090c;
  --panel: #0a1014;
  --panel-2: #0d141a;
  --ink: #04060a;
  --gold: #6fd6ff;
  --gold-bright: #a5e6ff;
  --amber: #8fb8ff;
  --line: rgba(150, 210, 245, 0.14);
  --line-soft: rgba(150, 210, 245, 0.07);
  --text: #e2eef5;
  --muted: #8aa3b3;
  --faint: rgba(138, 163, 179, 0.65);
}

[data-theme="synthwave"] {
  --bg: #0b0612;
  --panel: #130b1e;
  --panel-2: #170e25;
  --ink: #070310;
  --gold: #ff6ec7;
  --gold-bright: #ff9ddb;
  --amber: #c084ff;
  --line: rgba(255, 140, 220, 0.16);
  --line-soft: rgba(255, 140, 220, 0.08);
  --text: #f2e6f5;
  --muted: #aa8fb8;
  --faint: rgba(170, 143, 184, 0.65);
}

.theme-row {
  display: flex;
  gap: 8px;
}

.theme-swatch {
  min-height: 30px;
  width: 38px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.theme-swatch i {
  width: 14px;
  height: 14px;
  border-radius: 2px;
}

.theme-swatch.active {
  border-color: var(--gold);
  box-shadow: 0 0 10px rgba(216, 168, 74, 0.3);
}

/* ---------- v4: signal stream ---------- */

.signal-stream {
  display: block;
  width: 100%;
  height: 54px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--ink);
}

.shell {
  grid-template-rows: auto auto auto auto 1fr;
}

@media (prefers-reduced-motion: reduce) {
  .signal-stream {
    display: none;
  }
}

/* ---------- v4: spike moments ---------- */

.spike-chip {
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 18px;
  background: rgba(255, 93, 93, 0.1);
  border-bottom: 1px solid rgba(255, 93, 93, 0.4);
  color: var(--hot);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  animation: spike-in 240ms cubic-bezier(0.2, 0, 0, 1);
}

body.spiking .tape {
  animation: tape-flash 900ms ease-in-out 3;
}

body.spiking .live-meter span {
  background: var(--hot);
}

@keyframes tape-flash {
  50% { background: rgba(255, 93, 93, 0.12); }
}

@keyframes spike-in {
  from { opacity: 0; transform: translateY(-6px); }
}

/* ---------- v4: live meter speed ---------- */

.live-meter span {
  animation-duration: var(--meter-ms, 900ms);
}

/* ---------- v4: channel hero ---------- */

.channel-hero {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  background: linear-gradient(90deg, rgba(216, 168, 74, 0.12), rgba(216, 168, 74, 0.03));
  border-bottom: 1px solid rgba(216, 168, 74, 0.35);
  animation: fade-down 400ms cubic-bezier(0.2, 0, 0, 1) 150ms both;
}

.channel-hero-label {
  color: var(--gold-bright);
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.channel-hero input {
  width: min(240px, 34vw);
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--text);
  background: var(--ink);
  font-family: var(--mono);
  font-size: 12px;
}

.channel-hero input:focus {
  outline: none;
  border-color: rgba(216, 168, 74, 0.6);
}

#heroWatchButton {
  min-height: 34px;
  color: var(--bg);
  background: var(--gold);
  border-color: var(--gold);
  font-weight: 700;
}

#heroWatchButton:hover {
  background: var(--gold-bright);
  color: var(--bg);
}

.hero-dismiss {
  margin-left: auto;
  min-height: 28px;
  width: 28px;
  padding: 0;
  font-size: 13px;
}

/* ---------- v4: presence ---------- */

.watching-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--kick);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  white-space: nowrap;
}

.watching-chip b {
  font-variant-numeric: tabular-nums;
}

/* ---------- v4: avatars + density ---------- */

.avatar {
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 3px;
  object-fit: cover;
  border: 1px solid var(--line-soft);
}

.avatar-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--src) 22%, var(--ink));
  color: var(--src);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
}

body[data-density="compact"] .message {
  padding: 5px 10px 6px;
}

body[data-density="compact"] .msg-head {
  margin-bottom: 2px;
  gap: 6px;
}

body[data-density="compact"] .msg-content {
  font-size: 13px;
  line-height: 1.4;
}

body[data-density="compact"] .avatar {
  width: 16px;
  height: 16px;
}

body[data-density="compact"] .feed {
  gap: 4px;
}

body[data-density="compact"] .pin-btn {
  min-height: 20px;
}

/* ---------- v4: boot screen ---------- */

.boot-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: var(--bg);
  cursor: pointer;
  transition: opacity 350ms ease;
}

.boot-screen.boot-done {
  opacity: 0;
  pointer-events: none;
}

.boot-card {
  display: grid;
  gap: 16px;
  justify-items: start;
  min-width: min(480px, 86vw);
}

.boot-card img {
  border: 1px solid var(--line);
  border-radius: 4px;
}

.boot-card pre {
  margin: 0;
  min-height: 110px;
  color: var(--gold);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.7;
  letter-spacing: 0.04em;
}

.boot-card pre::after {
  content: "▌";
  animation: blink 0.9s steps(1) infinite;
}

.boot-skip {
  margin: 0;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

@media (max-width: 820px) {
  .signal-stream {
    height: 38px;
  }

  .channel-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 34px;
    gap: 8px;
    padding: 8px 10px 10px;
  }

  .channel-hero-label {
    grid-column: 1 / 2;
    min-width: 0;
    white-space: normal;
    font-size: 10.5px;
    line-height: 1.35;
  }

  .hero-dismiss {
    grid-column: 2 / 3;
    justify-self: end;
    margin-left: 0;
    min-height: 34px;
    width: 34px;
  }

  .channel-hero input {
    grid-column: 1 / -1;
    order: 2;
    width: 100%;
  }

  #heroWatchButton {
    grid-column: 1 / -1;
    order: 3;
    width: 100%;
  }

  .watching-chip {
    display: none;
  }
}
