/* ============================================================
   ABYSSAL design system
   Dark immersive tank + floating glass panels.
   ============================================================ */

:root {
  /* background */
  --bg-0: #020709;
  --bg-1: #031015;
  --bg-2: #06171d;

  /* glass panels */
  --glass-bg: rgba(10, 16, 29, 0.62);
  --glass-border: rgba(120, 160, 220, 0.14);
  --glass-shadow: inset 0 1px 0 rgba(111, 214, 255, 0.08), 0 8px 32px rgba(0, 0, 0, 0.4);
  --glass-blur: blur(18px) saturate(1.4);
  --radius: 14px;
  --radius-sm: 9px;

  /* text */
  --fg-1: #e6edf7;
  --fg-2: #93a3bd;
  --fg-3: #54637e;

  /* accents */
  --accent: #6fd6ff;
  --accent-dim: rgba(111, 214, 255, 0.16);
  --accent-glow: rgba(111, 214, 255, 0.3);
  --danger: #ff4d6d;
  --amber: #e0a34d;
  --gold: #ffd166;
  --silver: #c0c8d4;
  --bronze: #cd8c52;

  /* type */
  --font-display: "Space Grotesk", "Inter", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

  /* rhythm */
  --sp: 4px;
  --ease: 220ms cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg-0);
  color: var(--fg-1);
  font-family: var(--font-body);
  font-size: 13px;
  font-feature-settings: 'ss01';
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Subtle grain over the whole site so it does not look flat. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  opacity: 0.05;
  background-image: 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'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.6'/%3E%3C/svg%3E");
}

b { font-family: var(--font-display); font-variant-numeric: tabular-nums; font-weight: 500; }

/* ---------- canvas: the tank, absolute protagonist ---------- */
#world {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  z-index: 0;
}
body.targeting #world { cursor: cell; }

/* ---------- world legend (what the dots mean) ---------- */
/* Docked at the foot of the leaderboard panel: floating it over the tank put it
   behind #board, which is opaque and taller, so it was never readable. */
#world-legend {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: calc(var(--sp) * 3);
  padding-top: calc(var(--sp) * 2.5);
  border-top: 1px solid rgba(120, 160, 220, 0.1);
  font-family: var(--font-display);
  font-size: 10.5px;
  line-height: 1.45;
  letter-spacing: 0.04em;
  color: var(--fg-3);
}
#world-legend[hidden] { display: none; }
#world-legend span { display: flex; align-items: flex-start; gap: 7px; }
#world-legend i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: none;
  margin-top: 3px;
}
#world-legend .lg-creature {
  background: radial-gradient(circle at 35% 35%, #bff4ff, #38bdf8 60%, transparent);
  box-shadow: 0 0 6px rgba(56, 189, 248, 0.8);
}
#world-legend .lg-whale {
  width: 14px;
  height: 14px;
  margin-top: 1px;
  background: radial-gradient(circle at 35% 35%, #ffffff, #7dd3fc 45%, #1d4ed8 75%, transparent);
  box-shadow: 0 0 10px rgba(125, 211, 252, 0.9);
}
.pay-badge {
  margin-left: 8px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.35);
}
.pay-badge[data-mode='x402'] {
  color: #6ee7b7;
  border-color: rgba(110, 231, 183, 0.5);
  box-shadow: 0 0 8px rgba(110, 231, 183, 0.25);
}
#world-legend .lg-food {
  background: radial-gradient(circle at 35% 35%, #eafffe, #96ebee 60%, transparent);
  opacity: 0.8;
}
#world-legend .lg-meteor {
  background: radial-gradient(circle at 35% 35%, #ffe9c4, #ff9a3c 60%, transparent);
  box-shadow: 0 0 6px rgba(255, 154, 60, 0.8);
}

/* ---------- depth vignette over the tank ---------- */
#vignette {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 45%, transparent 52%, rgba(2, 4, 9, 0.55) 100%);
}
body.view-observe #vignette { display: none; }
/* The frozen tank frame must not leak behind the observatory cards. */
body.view-observe #world { display: none; }
body.view-observe {
  background:
    radial-gradient(1100px 520px at 18% -8%, rgba(38, 92, 128, 0.32), transparent 62%),
    radial-gradient(900px 480px at 84% 4%, rgba(74, 60, 132, 0.26), transparent 60%),
    radial-gradient(ellipse at 50% 0%, #0a1322 0%, var(--bg-0) 62%);
}

/* ---------- creature hover tooltip ---------- */
#tip {
  position: fixed;
  z-index: 40;
  pointer-events: none;
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(7, 12, 22, 0.88);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 0.5px;
  color: var(--fg-2);
  white-space: nowrap;
}
#tip[hidden] { display: none; }
#tip b { color: var(--fg-1); font-size: 11px; }

/* ---------- glass primitive ---------- */
.glass {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0) 46%), var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--glass-shadow);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  transition: transform var(--ease), box-shadow var(--ease);
}

::selection { background: rgba(77, 208, 225, 0.28); }
:focus-visible { outline: 1px solid rgba(120, 220, 240, 0.7); outline-offset: 2px; }

.rise { animation: rise 320ms ease both; }
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ---------- top strip ---------- */
#topbar {
  position: fixed;
  top: calc(var(--sp) * 3);
  left: calc(var(--sp) * 3);
  right: calc(var(--sp) * 3);
  z-index: 30;
  display: flex;
  align-items: center;
  gap: calc(var(--sp) * 6);
  padding: calc(var(--sp) * 2.5) calc(var(--sp) * 4);
  border-bottom: 1px solid transparent;
  background-image: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0) 46%), linear-gradient(to right, transparent, rgba(111,214,255,0.3), transparent);
  background-origin: border-box;
  background-clip: padding-box, border-box;
}
.brand {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 3px;
  font-size: 15px;
  background: linear-gradient(94deg, #f2f8ff 8%, #a8dcec 52%, #86a8ff 96%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  white-space: nowrap;
}
.brand .tag {
  display: block;
  font-family: var(--font-body);
  font-weight: 400;
  letter-spacing: 0;
  font-size: 10px;
  color: var(--fg-3);
  margin-top: 1px;
}
/* Scrollable rather than clipped: the English labels (HARVEST / JUDGMENT) are
   long enough that `overflow: hidden` silently amputated the last stat on
   narrow windows, while the shorter CJK labels happened to fit. */
.stats {
  display: flex; align-items: center; gap: calc(var(--sp) * 5);
  flex: 1; min-width: 0;
  overflow-x: auto; overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.stats::-webkit-scrollbar { display: none; }
.stat {
  display: flex; align-items: center; gap: calc(var(--sp) * 1.5);
  font-size: 11px; color: var(--fg-3);
  white-space: nowrap;
  flex: 0 0 auto;
}
.stat b { color: var(--fg-1); font-size: 12px; text-shadow: 0 0 8px var(--accent-glow); }
.stat-k {
  font-family: var(--font-display);
  font-size: 9px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--fg-3);
}
.tdot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px currentColor;
  transition: background var(--ease), box-shadow var(--ease);
}
.livedot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #54637e;
  box-shadow: 0 0 8px currentColor;
}
.livedot.live { background: #4ade80; color: #4ade80; animation: pulse 1.6s ease-in-out infinite; }
.livedot.degraded { background: var(--amber); color: var(--amber); }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}
.rain-status { color: var(--fg-3); font-size: 9px; }
.controls { display: flex; align-items: center; gap: calc(var(--sp) * 3); }
.fps { font-size: 10px; color: var(--fg-3); }
.fps b { color: var(--accent); }

.icon-btn {
  background: transparent;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--fg-3);
  font-size: 12px;
  padding: 3px 8px;
  cursor: pointer;
  transition: all var(--ease);
}
.icon-btn:hover { border-color: var(--accent); color: var(--fg-1); box-shadow: 0 0 12px rgba(111,214,255,0.2), inset 0 1px 0 rgba(255,255,255,0.05); }
.icon-btn:active { transform: scale(0.97); }
.icon-btn.active { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 10px var(--accent-dim); }

#causal-card {
  position: fixed;
  left: 50%;
  bottom: calc(var(--sp) * 16);
  transform: translateX(-50%);
  z-index: 35;
  max-width: min(560px, 86vw);
  padding: calc(var(--sp) * 2.5) calc(var(--sp) * 4);
  border-radius: 999px;
  font-size: 12px;
  color: var(--fg-1);
  text-align: center;
  pointer-events: none;
}
#causal-card[hidden] { display: none; }
#tax-chip {
  position: fixed;
  top: calc(var(--sp) * 17);
  left: 50%;
  transform: translateX(-50%);
  z-index: 34;
  padding: calc(var(--sp)) calc(var(--sp) * 3);
  border-radius: 999px;
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--danger);
  pointer-events: none;
}
#tax-chip[hidden] { display: none; }
.props {
  margin-top: calc(var(--sp) * 3);
  border-top: 1px solid var(--glass-border);
  padding-top: calc(var(--sp) * 2);
  font-size: 10px;
  color: var(--fg-3);
}
.props[hidden] { display: none; }
.props-h { letter-spacing: 1.2px; text-transform: uppercase; margin-bottom: calc(var(--sp)); }
.prop { display: flex; justify-content: space-between; gap: calc(var(--sp) * 2); padding: 1px 0; }
.prop span { flex: 0 0 auto; }
/* A value like a hash fragment must wrap inside a narrow column, not push the
   row wider than its drawer. */
.prop b { color: var(--fg-2); font-weight: 500; min-width: 0; text-align: right; overflow-wrap: anywhere; }
.props-y { margin-top: calc(var(--sp)); }
#pulse-play { margin-left: auto; }
.daily .prop, #reports .prop { padding: 1px 0; }
.memorial { padding: calc(var(--sp)) 0; border-bottom: 1px solid var(--glass-border); }
.memorial .epitaph { color: var(--fg-3); font-size: 9px; margin-top: 2px; }
/* badges, factions and the contribution board */
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 3px 0; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 6px;
  border: 1px solid var(--glass-border); border-radius: 999px;
  background: rgba(120, 160, 220, 0.06); color: var(--fg-2);
  font-family: var(--font-display); font-size: 9px; line-height: 14px;
}
.chip.tiny { font-size: 8px; line-height: 12px; padding: 0 5px; }
.chip.badge { color: var(--amber); border-color: rgba(224, 163, 77, 0.28); }
.chip b { color: var(--fg-1); font-weight: 500; font-variant-numeric: tabular-nums; }
.chip .cdot { width: 5px; height: 5px; border-radius: 50%; background: var(--chip, var(--accent)); flex: 0 0 auto; }
button.chip.faction { cursor: pointer; transition: border-color var(--ease), color var(--ease); }
button.chip.faction:hover { border-color: var(--chip, var(--accent)); color: var(--fg-1); }
button.chip.faction.mine {
  border-color: var(--chip, var(--accent)); color: var(--fg-1);
  background: rgba(120, 160, 220, 0.14);
}
#burners .af { flex-wrap: wrap; cursor: pointer; }
#burners .af .chips { flex-basis: 100%; margin: 0 0 3px; }
#burners .af:hover .who { color: var(--fg-1); }
#burners .af.me .who { color: var(--accent); }
.who-link { color: var(--accent); cursor: pointer; border-bottom: 1px solid transparent; }
.who-link:hover { border-bottom-color: var(--accent); }
#addr-tank { margin-top: calc(var(--sp) * 2); }
.rules-hint {
  margin-top: calc(var(--sp) * 2);
  font-size: 9px;
  line-height: 1.5;
  color: var(--fg-3);
}
#addr-world { margin-top: calc(var(--sp) * 2); }
.langs { position: relative; }
.lang-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  min-width: 118px;
  padding: calc(var(--sp));
}
.lang-menu[hidden] { display: none; }
.lang-menu button {
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  color: var(--fg-2);
  font-size: 12px;
  text-align: left;
  padding: 5px 10px;
  cursor: pointer;
  transition: color var(--ease), background var(--ease);
}
.lang-menu button:hover { color: var(--fg-1); background: rgba(120, 160, 220, 0.08); }
.lang-menu button.active { color: var(--accent); }
.langs .icon-btn svg { display: block; }

/* ---------- floating panels ---------- */
.panel {
  position: fixed;
  top: calc(var(--sp) * 20);
  z-index: 10;
  width: 232px;
  /* The board now carries the legend too, so clamp it above the dock instead of
     letting it run off the bottom of short windows. */
  max-height: calc(100vh - var(--sp) * 34);
  overflow-y: auto;
  transition: width var(--ease);
}
#board { left: calc(var(--sp) * 3); }
#panel { right: calc(var(--sp) * 3); }

.panel-head, .sub-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(var(--sp) * 2.5) calc(var(--sp) * 3.5);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 1.4px;
  color: var(--fg-1);
  cursor: pointer;
  user-select: none;
  background: linear-gradient(135deg, rgba(111,214,255,0.04) 0%, transparent 60%);
}
.panel-head { position: relative; }
.panel-head .ph-title { position: relative; padding-left: calc(var(--sp) * 2.5); }
.panel-head .ph-title::before {
  content: '';
  position: absolute; left: 0; top: 1px; bottom: 1px;
  width: 3px; border-radius: 2px;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-dim);
}
.sub-head {
  font-size: 10px;
  color: var(--fg-2);
  padding: calc(var(--sp) * 2) 0 calc(var(--sp));
  margin-top: calc(var(--sp) * 2);
  border-top: 1px solid rgba(120, 160, 220, 0.08);
}
.chev { width: 8px; height: 8px; border-right: 1.5px solid var(--fg-3); border-bottom: 1.5px solid var(--fg-3); transform: rotate(45deg); transition: transform var(--ease); }
.collapsed .chev { transform: rotate(-45deg); }
.panel-body { padding: 0 calc(var(--sp) * 3.5) calc(var(--sp) * 3); }
.collapsed .panel-body { display: none; }
.sub-body.collapsed { display: none; }

/* ---------- leaderboard ---------- */
.board-group { margin-bottom: calc(var(--sp) * 2.5); }
.board-group:last-child { margin-bottom: 0; }
.board-title { font-size: 10px; color: var(--fg-3); margin-bottom: calc(var(--sp)); letter-spacing: 0.02em; text-transform: uppercase; }
.board-list .row {
  display: flex; align-items: center; gap: calc(var(--sp) * 1.5);
  padding: 2px 0;
  font-size: 12px;
  transition: transform var(--ease), background var(--ease);
  border-radius: 4px;
}
.board-list .row:nth-child(even) { background: rgba(255, 255, 255, 0.015); }
.board-list .row:hover { transform: translateX(3px); background: rgba(111, 214, 255, 0.04); }
.board-list .row.ev-new { animation: ev-in 240ms ease-out; }
.board-list .row .odot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; box-shadow: 0 0 6px currentColor; }
.board-list .row .val { margin-left: auto; color: var(--fg-2); font-family: var(--font-display); font-variant-numeric: tabular-nums; }
.board-list .empty { color: var(--fg-3); font-size: 11px; }
/* followed creatures: clickable, and a dead one can be dropped from the list */
#following .row { cursor: pointer; }
#following .row:hover .nm { color: var(--fg-1); }
#following .row.gone .nm { color: var(--fg-3); text-decoration: line-through; }
#following .row .val b { cursor: pointer; padding: 0 3px; color: var(--fg-3); font-weight: 400; }
#following .row .val b:hover { color: var(--danger); }

/* creature card: story lines first, the raw numbers folded away */
#creature-card .prop span { color: var(--fg-3); }
#creature-card .prop b { color: var(--fg-1); font-weight: 500; }
.card-actions { display: flex; gap: 6px; margin: calc(var(--sp) * 1.5) 0 calc(var(--sp)); }
#card-adv {
  border-top: 1px solid var(--glass-border);
  padding-top: calc(var(--sp));
  margin-top: calc(var(--sp));
}
#card-adv .prop b { color: var(--fg-2); font-weight: 400; }

/* ---------- intervention buttons ---------- */
.hint { font-size: 11px; color: var(--fg-3); line-height: 1.6; margin-bottom: calc(var(--sp) * 2.5); }
button.iv {
  display: flex; justify-content: space-between; align-items: center;
  width: 100%;
  margin-bottom: calc(var(--sp) * 2);
  padding: calc(var(--sp) * 2.5) calc(var(--sp) * 3);
  background: linear-gradient(180deg, rgba(24, 38, 72, 0.6), rgba(12, 20, 40, 0.55));
  color: var(--fg-1);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-family: var(--font-body);
  transition: all var(--ease);
}
button.iv:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 0 12px rgba(111,214,255,0.2), inset 0 1px 0 rgba(255,255,255,0.05), 0 4px 18px rgba(0, 0, 0, 0.35), 0 0 16px var(--accent-dim);
}
button.iv:active { transform: scale(0.97); }
button.iv.armed { border-color: var(--amber); box-shadow: 0 0 16px rgba(224, 163, 77, 0.25); }
button.iv .price { color: var(--fg-3); font-size: 10px; font-family: var(--font-display); font-variant-numeric: tabular-nums; }

/* ---------- toast / creature card ---------- */
#toast {
  margin-top: calc(var(--sp) * 2);
  padding: calc(var(--sp) * 2);
  font-size: 11px;
  border-radius: var(--radius-sm);
  background: rgba(20, 60, 40, 0.5);
  border: 1px solid rgba(60, 180, 110, 0.35);
  color: #7ee2a8;
  word-break: break-all;
  animation: spring-in 320ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
#toast.error { background: rgba(70, 18, 30, 0.5); border-color: rgba(255, 77, 109, 0.35); color: #ff8fa3; }

@keyframes spring-in {
  0% { transform: translateY(-20px) scale(0.95); opacity: 0; }
  60% { transform: translateY(4px) scale(1.02); }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

#creature-card {
  margin-top: calc(var(--sp) * 2.5);
  padding: calc(var(--sp) * 2.5);
  font-size: 12px;
  background: rgba(7, 12, 22, 0.6);
  border: 1px solid var(--glass-border);
  border-left: 2px solid var(--accent);
  border-radius: var(--radius-sm);
  line-height: 1.8;
  animation: ev-in 200ms ease-out;
  box-shadow: -4px 0 12px rgba(111, 214, 255, 0.06);
}
#creature-card .cid { color: var(--accent); font-weight: 600; font-family: var(--font-display); }
#creature-card .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; box-shadow: 0 0 6px currentColor; }

/* ---------- live events / chain rain ---------- */
#events { max-height: 150px; overflow-y: auto; font-size: 11px; line-height: 1.7; color: var(--fg-2); }
#events .ev { padding: 2px 0; border-bottom: 1px solid rgba(120, 160, 220, 0.07); animation: ev-in 250ms ease-out; }
#events .ev.predation { color: #ff8fa3; }
#events .ev.judgment { color: var(--danger); }
#events .ev.harvest { color: var(--amber); }
#events .ev.intervention { color: var(--accent); }
#events .ev.whale { color: #7db6ff; }
@keyframes ev-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}

#rain { font-size: 10px; font-family: var(--font-display); font-variant-numeric: tabular-nums; color: var(--fg-3); }
#rain .tx { display: flex; gap: 6px; align-items: center; padding: 2px 0; cursor: pointer; transition: color var(--ease); }
#rain .tx:hover { color: var(--accent); }
#rain .tx .sizebar { height: 3px; background: var(--accent); border-radius: 2px; opacity: 0.7; }
#rain .tx .sim { opacity: 0.5; }
#rain .tx .amt { color: var(--fg-2); }
#rain .tx .x4 { color: #ffd166; font-size: 8px; border: 1px solid rgba(255, 209, 102, 0.4); border-radius: 3px; padding: 0 3px; }

/* ---------- bottom dock + drawers ---------- */
#dock {
  position: fixed;
  bottom: calc(var(--sp) * 3);
  /* Centering must not ride on `transform`: the shared .rise entrance
     animation fills forwards with `transform: none`, which would otherwise
     cancel a translateX(-50%) and leave the pill hanging off the midline. */
  left: 0;
  right: 0;
  width: fit-content;
  margin-inline: auto;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: calc(var(--sp) * 2);
  padding: calc(var(--sp) * 1.5) calc(var(--sp) * 2);
  border-radius: 999px;
}
.dock-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--fg-2);
  font-size: 11px;
  padding: calc(var(--sp) * 1.5) calc(var(--sp) * 3);
  cursor: pointer;
  transition: all var(--ease);
  white-space: nowrap;
}
.dock-btn:hover { color: var(--fg-1); box-shadow: 0 0 12px rgba(111,214,255,0.2), inset 0 1px 0 rgba(255,255,255,0.05); }
.dock-btn:active { transform: scale(0.97); }
.dock-btn.open { color: var(--accent); border-color: var(--accent); background: var(--accent-dim); }
#dock .token { font-size: 10px; color: var(--fg-3); padding: 0 calc(var(--sp) * 2); border-left: 1px solid var(--glass-border); }

.drawer {
  position: fixed;
  bottom: calc(var(--sp) * 16);
  left: 50%;
  transform: translateX(-50%);
  z-index: 25;
  width: min(860px, calc(100vw - 24px));
  max-height: 40vh;
  padding: calc(var(--sp) * 3) calc(var(--sp) * 4);
  overflow-y: auto;
  animation: drawer-in 240ms ease-out;
}
@keyframes drawer-in {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.section-title { font-size: 10px; color: var(--fg-3); margin-bottom: calc(var(--sp)); letter-spacing: 0.02em; }
.legend { margin-left: 10px; }
.legend .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin: 0 4px 0 10px; }
.legend .dot.harvest { background: var(--amber); }
.legend .dot.judgment { background: var(--danger); }

.day-anchor { display: flex; align-items: baseline; gap: calc(var(--sp) * 2); margin-bottom: calc(var(--sp) * 2); font-size: 10px; }
.day-anchor .da-label { color: var(--fg-3); text-transform: uppercase; letter-spacing: 1.2px; }
.day-anchor code { font-family: var(--font-display); font-size: 11px; color: #ffd166; letter-spacing: 0.5px; }
.day-anchor .da-note { color: var(--fg-3); font-size: 9px; }
.day-anchor .mini { margin-left: auto; }

/* Compact button for header rows, where a full dock button shouts. */
.dock-btn.mini {
  font-size: 9px;
  padding: 2px calc(var(--sp) * 2);
  letter-spacing: 0.6px;
  border-color: var(--glass-border);
  color: var(--fg-3);
}
.dock-btn.mini:hover { color: var(--fg-1); border-color: var(--accent); }
.obs-actions { margin-left: auto; display: flex; gap: 6px; align-items: center; }

/* ---- Pulse time-travel range selector (OBSERVE) ----
   A segmented "depth gauge": thin pills in a recessed track. The active
   range fills with the cyan accent and, for Live only, a breathing sonar
   pip marks the real-time feed; historical ranges sit frozen. */
.pulse-ranges {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  margin-left: calc(var(--sp) * 2);
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: rgba(3, 11, 16, 0.55);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.45);
}
.range-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 0;
  background: transparent;
  color: var(--fg-3);
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.9px;
  line-height: 1;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: color var(--ease), background var(--ease), box-shadow var(--ease), transform 120ms var(--ease);
  white-space: nowrap;
}
.range-btn:hover { color: var(--fg-1); background: rgba(111, 214, 255, 0.08); }
.range-btn:active { transform: scale(0.95); }
.range-btn.active {
  color: #04121a;
  background: linear-gradient(135deg, var(--accent), #46b9e6);
  box-shadow: 0 0 14px var(--accent-dim), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
.range-btn .rb-pip {
  width: 5px; height: 5px; border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 6px currentColor;
}
.range-btn.active .rb-pip { background: #04121a; box-shadow: none; }
/* Only the Live pip breathes; it is the one range that is still moving. */
.range-btn[data-range="live"]:not(.active) .rb-pip { animation: rb-pip 1.9s ease-in-out infinite; }
@keyframes rb-pip {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.3; transform: scale(0.65); }
}
/* A historical range turns the canvas into a brush surface. */
#pulse.brushable { cursor: crosshair; }
#pulse.brushing { cursor: ew-resize; }

.sig-guide { display: flex; flex-direction: column; gap: 4px; margin-bottom: calc(var(--sp) * 2); font-size: 10px; color: var(--fg-2); }
.sig-guide .sg-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; }
.sig-guide .sg-dot.chain { background: var(--accent); }
.sig-guide .sg-dot.market { background: #d8c832; }

/* The data drawer gets the room the charts need: text down the left, the two
   charts stacked on the right at close to full drawer width. */
#drawer-analytics { width: min(1180px, calc(100vw - 24px)); max-height: 74vh; }
.analytics-grid {
  display: grid;
  grid-template-columns: minmax(260px, 330px) 1fr;
  gap: calc(var(--sp) * 4);
  align-items: start;
}
.analytics-side {
  display: flex;
  flex-direction: column;
  gap: calc(var(--sp));
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 4px;
  min-width: 0;
}
.analytics-charts {
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: calc(var(--sp) * 3);
  height: 60vh;
  min-width: 0;
}
#chart-wrap, #temps-wrap { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
#chart, #temps {
  flex: 1;
  width: 100%;
  min-height: 0;
  background: rgba(7, 12, 22, 0.6);
  border-radius: var(--radius-sm);
  cursor: crosshair;
}

/* ---------- obituaries ---------- */
#death-stats { font-size: 10px; color: var(--fg-3); margin-bottom: calc(var(--sp)); }
#judgments { font-size: 11px; color: var(--fg-2); }
.obit-group { margin-bottom: calc(var(--sp) * 2); }
.obit-title { font-weight: 600; font-size: 11px; margin-bottom: 2px; font-family: var(--font-display); }
.obit-group.judgment .obit-title { color: var(--danger); }
.obit-group.harvest .obit-title { color: var(--amber); }
.obit { display: flex; align-items: center; gap: 6px; padding: 1px 0; color: var(--fg-1); }
.obit .odot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; }
.obit .obit-sub { color: var(--fg-3); margin-left: auto; }
.obit-note { font-size: 10px; color: var(--fg-3); font-style: italic; margin: 2px 0 4px; }

/* ---------- kill banner ---------- */
#banner {
  position: fixed;
  top: calc(var(--sp) * 18);
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  padding: calc(var(--sp) * 2.5) calc(var(--sp) * 6);
  background: rgba(10, 16, 29, 0.85);
  border: 1px solid rgba(255, 77, 109, 0.45);
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 500;
  color: var(--fg-1);
  box-shadow: 0 0 32px rgba(255, 77, 109, 0.2);
  backdrop-filter: blur(10px);
  animation: banner-spring 320ms cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
  white-space: nowrap;
}
@keyframes banner-spring {
  0% { transform: translateX(-50%) translateY(-20px) scale(0.95); opacity: 0; }
  60% { transform: translateX(-50%) translateY(4px) scale(1.02); }
  100% { transform: translateX(-50%) translateY(0) scale(1); opacity: 1; }
}
#banner .pred, #banner .prey { font-weight: 700; }

/* ---------- welcome overlay ---------- */
#welcome {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 7, 13, 0.72);
  backdrop-filter: blur(12px);
  animation: welcome-in 400ms ease both, breathe 6s ease-in-out infinite;
}
#welcome[hidden] { display: none; }
@keyframes welcome-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes breathe {
  0%, 100% { backdrop-filter: blur(12px); }
  50% { backdrop-filter: blur(16px); }
}
.welcome-card {
  max-width: 480px;
  padding: calc(var(--sp) * 10) calc(var(--sp) * 12);
  text-align: center;
}
.welcome-card h1 {
  font-family: var(--font-display);
  font-size: 42px;
  font-weight: 700;
  letter-spacing: 8px;
  background: linear-gradient(100deg, #f4f9ff 10%, #9fdcec 50%, #8fb0ff 92%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 44px rgba(77, 208, 225, 0.25);
  margin-bottom: calc(var(--sp) * 2);
}
.welcome-card .wtag { color: var(--accent); font-size: 13px; margin-bottom: calc(var(--sp) * 6); }
.welcome-card p:not(.wtag) { color: var(--fg-2); font-size: 13px; line-height: 1.8; margin-bottom: calc(var(--sp) * 3); }
.cta {
  margin-top: calc(var(--sp) * 4);
  padding: calc(var(--sp) * 3) calc(var(--sp) * 8);
  background: linear-gradient(135deg, rgba(77, 208, 225, 0.24), rgba(134, 168, 255, 0.18));
  border: 1px solid var(--accent);
  border-radius: 999px;
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all var(--ease);
}
.cta:hover { background: linear-gradient(135deg, rgba(77, 208, 225, 0.36), rgba(134, 168, 255, 0.28)); box-shadow: 0 0 28px var(--accent-dim); transform: translateY(-1px); }
.cta:active { transform: scale(0.97); }

/* ---------- view tabs ---------- */
.viewtabs { display: flex; gap: 2px; padding: 2px; border-radius: 999px; background: rgba(7, 12, 22, 0.5); border: 1px solid var(--glass-border); }
.viewtabs button {
  position: relative;
  background: transparent;
  border: none;
  border-radius: 999px;
  color: var(--fg-3);
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 1.5px;
  padding: 4px 14px;
  cursor: pointer;
  transition: all var(--ease);
  overflow: hidden;
}
.viewtabs button::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 20%;
  right: 20%;
  height: 1.5px;
  background: var(--accent);
  border-radius: 1px;
  transform: scaleX(0);
  transition: transform var(--ease);
}
.viewtabs button:hover { color: var(--fg-1); }
.viewtabs button:hover::after { transform: scaleX(0.6); }
.viewtabs button.active { color: var(--bg-0); background: var(--accent); box-shadow: 0 0 12px var(--accent-dim); }
.viewtabs button.active::after { transform: scaleX(1); background: var(--bg-0); }

/* ---------- live ticker (below topbar) ---------- */
#ticker {
  position: fixed;
  top: calc(var(--sp) * 16);
  left: calc(var(--sp) * 3);
  right: calc(var(--sp) * 3);
  z-index: 20;
  height: 28px;
  display: flex;
  align-items: center;
  padding: 0 calc(var(--sp) * 3);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255,255,255,0.03), transparent 50%), var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-bottom-color: rgba(111, 214, 255, 0.2);
  box-shadow: var(--glass-shadow), 0 2px 8px rgba(111, 214, 255, 0.06);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  overflow: hidden;
  user-select: none;
  mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
}
#ticker[hidden] { display: none; }
#ticker .tick-track {
  display: inline-flex;
  flex: 0 0 auto;
  gap: calc(var(--sp) * 8);
  white-space: nowrap;
  will-change: transform;
  animation: tick-scroll var(--tick-dur, 40s) linear infinite;
}
#ticker .tick-track .tick { cursor: pointer; transition: color 0.15s ease; }
#ticker .tick-track .tick:hover { color: var(--fg-1); }
#ticker:hover .tick-track { animation-play-state: paused; }
/* Content shorter than the bar: rest centered instead of scrolling. */
#ticker.static { justify-content: center; }
#ticker.static .tick-track { animation: none; }
#ticker .tick { display: inline-flex; align-items: center; gap: 7px; font-family: var(--font-display); font-size: 11px; font-variant-numeric: tabular-nums; color: var(--fg-3); }
#ticker .tick .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); flex: 0 0 auto; animation: pulse 2.4s ease-in-out infinite; }
#ticker .tick .amt { color: var(--fg-1); }
#ticker .tick .arrow { color: var(--fg-3); }
#ticker .tick.x402 .dot { background: #ffd166; box-shadow: 0 0 6px #ffd166; }
#ticker .tick.x402 .amt { color: #ffd166; }
@keyframes tick-scroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ---------- observe view layout ---------- */
#observe-view {
  position: fixed;
  top: calc(var(--sp) * 24);
  left: calc(var(--sp) * 3);
  right: calc(var(--sp) * 3);
  bottom: calc(var(--sp) * 3);
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: calc(var(--sp) * 3);
}
#observe-view[hidden] { display: none; }
.obs-col { display: flex; flex-direction: column; gap: calc(var(--sp) * 3); min-height: 0; }
.obs-card {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: calc(var(--sp) * 3) calc(var(--sp) * 4);
  overflow: hidden;
  border-radius: 16px;
  box-shadow: var(--glass-shadow), 0 12px 40px rgba(0, 0, 0, 0.3);
}
.obs-flowmap-card { flex: 3 1 0; }
.obs-pulse-card { flex: 2 1 0; }
.obs-stats-card { flex: 0 0 auto; }
.obs-endpoints-card { flex: 1 1 0; }
.obs-head {
  position: relative;
  display: flex; align-items: baseline; justify-content: space-between; gap: calc(var(--sp) * 2);
  flex-wrap: wrap;
  font-family: var(--font-display);
  font-size: 12px; font-weight: 500; letter-spacing: 1.4px; color: var(--fg-1);
  margin-bottom: calc(var(--sp) * 2);
  padding-left: calc(var(--sp) * 2.5);
  background: linear-gradient(135deg, rgba(111,214,255,0.04) 0%, transparent 60%);
  border-radius: 6px;
  padding-top: calc(var(--sp));
  padding-bottom: calc(var(--sp));
}
.obs-head::before {
  content: '';
  position: absolute; left: 0; top: 2px; bottom: 2px;
  width: 3px; border-radius: 2px;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-dim);
}
.obs-sub { font-family: var(--font-body); font-size: 10px; font-weight: 400; letter-spacing: 0; color: var(--fg-3); }
#flowmap, #pulse { flex: 1 1 0; width: 100%; min-height: 0; }

.flowmap-legend { display: flex; gap: calc(var(--sp) * 5); margin-top: calc(var(--sp) * 2); font-size: 10px; color: var(--fg-3); }
.flowmap-legend span { display: flex; align-items: center; gap: 6px; }
.flowmap-legend i { width: 16px; height: 2px; border-radius: 2px; display: inline-block; }
.lg-x402 { background: #ffd166; box-shadow: 0 0 6px #ffd166; }
.lg-plain { background: var(--accent); box-shadow: 0 0 6px var(--accent); }

#obs-stats { display: grid; grid-template-columns: 1fr 1fr; gap: calc(var(--sp) * 3) calc(var(--sp) * 3); }
.obs-stat {
  display: flex; flex-direction: column; gap: 2px;
  border-top: 1px solid rgba(111, 214, 255, 0.2);
  padding-top: calc(var(--sp) * 1.5);
  transition: box-shadow var(--ease);
}
.obs-stat:hover { box-shadow: 0 0 12px rgba(111, 214, 255, 0.08); }
.obs-stat .label { font-size: 9px; color: var(--fg-3); text-transform: uppercase; letter-spacing: 1.2px; }
.obs-stat .value { font-family: var(--font-display); font-size: 20px; font-variant-numeric: tabular-nums; color: var(--fg-1); line-height: 1.1; text-shadow: 0 0 8px var(--accent-glow); }
.obs-stat .value.gold { color: #ffd166; text-shadow: 0 0 18px rgba(255, 209, 102, 0.35); }
.obs-stat .value.sm { font-size: 15px; }

#endpoints { display: flex; flex-direction: column; gap: calc(var(--sp) * 1.5); overflow-y: auto; min-height: 0; }
.ep { display: flex; align-items: center; gap: calc(var(--sp) * 2); padding: 5px calc(var(--sp) * 2); border-radius: var(--radius-sm); background: rgba(7, 12, 22, 0.4); cursor: pointer; transition: background var(--ease), transform var(--ease); border-left: 2px solid transparent; }
.ep:hover { background: rgba(77, 208, 225, 0.1); transform: translateX(2px); }
.ep:nth-child(-n+3) .rank { font-weight: 700; }
.ep:nth-child(1) { border-left-color: var(--gold); }
.ep:nth-child(1) .rank { color: var(--gold); }
.ep:nth-child(2) { border-left-color: var(--silver); }
.ep:nth-child(2) .rank { color: var(--silver); }
.ep:nth-child(3) { border-left-color: var(--bronze); }
.ep:nth-child(3) .rank { color: var(--bronze); }
.ep .rank { font-family: var(--font-display); font-size: 11px; color: var(--fg-3); width: 16px; flex: 0 0 auto; }
.ep.top .rank { color: #ffd166; }
.ep.top .addr { color: var(--fg-1); }
.ep .mid { flex: 1 1 auto; min-width: 0; }
.ep .addr { font-family: var(--font-display); font-size: 11px; color: var(--fg-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ep .volbar { height: 3px; border-radius: 2px; background: var(--accent); margin-top: 3px; opacity: 0.7; }
.ep .right { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex: 0 0 auto; }
.ep .amt { font-family: var(--font-display); font-size: 12px; font-variant-numeric: tabular-nums; color: var(--fg-1); }
.ep .x4tag { font-size: 9px; color: #ffd166; font-family: var(--font-display); }

.obs-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.obs-empty[hidden] { display: none; }
.obs-empty .obs-card { align-items: center; max-width: 440px; gap: calc(var(--sp) * 2); }
.obs-empty p { color: var(--fg-2); font-size: 13px; }
.obs-empty .obs-hint { color: var(--fg-3); font-size: 11px; }
.obs-empty code { display: inline-block; margin-top: calc(var(--sp) * 2); padding: 7px 16px; background: rgba(7, 12, 22, 0.6); border: 1px solid var(--glass-border); border-radius: var(--radius-sm); color: var(--accent); font-family: var(--font-display); font-size: 12px; }

/* ---------- address detail drawer (observe) ---------- */
#addr-card {
  position: fixed;
  top: calc(var(--sp) * 24);
  right: calc(var(--sp) * 3);
  bottom: calc(var(--sp) * 3);
  z-index: 15;
  width: 320px;
  padding: calc(var(--sp) * 3.5);
  overflow-y: auto;
  font-size: 12px;
  animation: ev-in 200ms ease-out;
  border-left: 2px solid var(--accent);
  box-shadow: var(--glass-shadow), -4px 0 12px rgba(111, 214, 255, 0.06);
}
#addr-card[hidden] { display: none; }
/* In WORLD the dossier floats over the tank instead of vanishing: whales only
   exist here, so hiding the card made their dossiers unreachable. */
body.view-world #addr-card { bottom: auto; max-height: 70vh; }
#addr-card .tx-close { position: absolute; top: 6px; right: 11px; cursor: pointer; color: var(--fg-3); font-size: 15px; line-height: 1; }
#addr-card .tx-close:hover { color: var(--fg-1); }
#addr-card .addr-h { font-family: var(--font-display); font-size: 13px; color: var(--accent); margin-bottom: calc(var(--sp) * 2.5); padding-right: 16px; }
#addr-card .addr-sub { margin: calc(var(--sp) * 2.5) 0 calc(var(--sp)); font-size: 9px; color: var(--fg-3); text-transform: uppercase; letter-spacing: 1.2px; }
.af { display: flex; gap: 8px; align-items: center; padding: 3px 0; border-bottom: 1px solid rgba(120, 160, 220, 0.07); font-family: var(--font-display); font-size: 11px; font-variant-numeric: tabular-nums; }
.af .dir { width: 12px; flex: 0 0 auto; }
.af.in .dir { color: #7ee2a8; }
.af.out .dir { color: #ff8fa3; }
.af .who { color: var(--fg-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.af .amt { margin-left: auto; color: var(--fg-1); flex: 0 0 auto; }
.af.x402 .amt { color: #ffd166; }
.af .when { color: var(--fg-3); font-size: 9px; flex: 0 0 auto; }
.addr-empty { padding: calc(var(--sp) * 2) 0; font-size: 11px; line-height: 1.6; color: var(--fg-3); }
#addr-card a.explore { display: inline-block; margin-top: calc(var(--sp) * 2.5); color: var(--accent); font-size: 11px; text-decoration: none; border-bottom: 1px solid transparent; transition: border-color var(--ease); }
#addr-card a.explore:hover { border-bottom-color: var(--accent); }

/* ---------- tx provenance card ---------- */
#tx-card {
  position: fixed;
  left: calc(var(--sp) * 3);
  bottom: calc(var(--sp) * 3);
  z-index: 22;
  width: 320px;
  max-height: 62vh;
  overflow-y: auto;
  padding: calc(var(--sp) * 3.5);
  font-size: 12px;
  line-height: 1.7;
  animation: ev-in 200ms ease-out;
}
#tx-card[hidden] { display: none; }
#tx-card .tx-close { position: absolute; top: 6px; right: 11px; cursor: pointer; color: var(--fg-3); font-size: 15px; line-height: 1; }
#tx-card .tx-close:hover { color: var(--fg-1); }
#tx-card .tx-h { font-family: var(--font-display); font-size: 11px; color: var(--accent); word-break: break-all; margin-bottom: calc(var(--sp) * 2.5); padding-right: 16px; }
#tx-card .tx-row, #addr-card .tx-row { display: flex; justify-content: space-between; gap: calc(var(--sp) * 2); padding: 1px 0; }
#tx-card .tx-row .k, #addr-card .tx-row .k { color: var(--fg-3); flex: 0 0 auto; }
#tx-card .tx-row .v, #addr-card .tx-row .v { color: var(--fg-1); font-family: var(--font-display); font-variant-numeric: tabular-nums; text-align: right; word-break: break-all; }
#addr-card .tx-row .v.gold { color: #ffd166; }
#tx-card .x402-badge { display: inline-block; margin-top: calc(var(--sp) * 2.5); padding: 2px 9px; border-radius: 999px; background: rgba(255, 209, 102, 0.14); border: 1px solid rgba(255, 209, 102, 0.4); color: #ffd166; font-size: 10px; font-family: var(--font-display); }
#tx-card a.explore { display: inline-block; margin-top: calc(var(--sp) * 2.5); color: var(--accent); font-size: 11px; text-decoration: none; border-bottom: 1px solid transparent; transition: border-color var(--ease); }
#tx-card a.explore:hover { border-bottom-color: var(--accent); }

/* ---------- observe view dims/hides the world UI ---------- */
body.view-observe #board, body.view-observe #panel, body.view-observe #dock,
body.view-observe .drawer, body.view-observe #banner { display: none !important; }

/* ---------- scrollbars ---------- */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(120, 160, 220, 0.16); border-radius: 3px; transition: background 0.2s; }
::-webkit-scrollbar-thumb:hover { background: rgba(120, 160, 220, 0.35); }
* { scrollbar-width: thin; scrollbar-color: rgba(120, 160, 220, 0.16) transparent; }

/* ---------- hover lift on interactive cards ---------- */
.obs-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--glass-shadow), 0 12px 40px rgba(0, 0, 0, 0.35);
}
.drawer:hover {
  transform: translateX(-50%) translateY(-1px);
  box-shadow: var(--glass-shadow), 0 12px 40px rgba(0, 0, 0, 0.35);
}

/* ---------- typography polish ---------- */
.props-h { letter-spacing: 0.02em; }
.obs-stat .value, .stat b, .ep .amt, #rain .tx .amt, .board-list .row .val {
  font-variant-numeric: tabular-nums;
}

/* ---------- responsive: panels become bottom sheets ---------- */
@media (max-width: 768px) {
  #topbar { flex-wrap: wrap; gap: calc(var(--sp) * 3); }
  .stats { order: 3; width: 100%; gap: calc(var(--sp) * 3); }
  .brand .tag { display: none; }
  .panel {
    top: auto;
    bottom: calc(var(--sp) * 16);
    width: calc(50vw - 18px);
    max-height: 42vh;
    overflow-y: auto;
  }
  #board { left: calc(var(--sp) * 3); }
  #panel { right: calc(var(--sp) * 3); }
  .drawer { bottom: calc(var(--sp) * 24); max-height: 50vh; }
  /* One column on a phone: the drawer itself scrolls, the charts keep a height
     a finger can read instead of splitting the viewport in two. */
  #drawer-analytics { max-height: 62vh; }
  .analytics-grid { grid-template-columns: 1fr; gap: calc(var(--sp) * 3); }
  .analytics-side { max-height: none; overflow: visible; }
  .analytics-charts { grid-template-rows: auto auto; height: auto; }
  #chart, #temps { height: 30vh; flex: 0 0 auto; }
  #observe-view { top: calc(var(--sp) * 26); display: flex; flex-direction: column; overflow-y: auto; }
  .obs-col { flex: 0 0 auto; }
  /* Flex-basis-0 canvases contribute nothing to grid row sizing, so give them
     explicit heights here or the cards collapse and overlap. */
  #flowmap { flex: 0 0 auto; height: 36vh; }
  #pulse { flex: 0 0 auto; height: 120px; }
  .obs-flowmap-card { flex: 0 0 auto; }
  .obs-pulse-card { flex: 0 0 auto; }
  .obs-endpoints-card { flex: 0 0 auto; }
  #endpoints { max-height: 38vh; }
  .viewtabs button { padding: 4px 10px; letter-spacing: 1px; }
  #tx-card { left: calc(var(--sp) * 3); right: calc(var(--sp) * 3); width: auto; bottom: calc(var(--sp) * 20); }
}

/* ---------- Day Digest on-chain status ---------- */
.digest-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 9px;
  letter-spacing: 0.4px;
  padding: 1px 6px;
  border-radius: 3px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  transition: all 0.3s ease;
}
.digest-status .ds-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}
.digest-status.confirmed { color: #4ade80; border-color: rgba(74,222,128,0.25); }
.digest-status.confirmed .ds-dot { background: #4ade80; box-shadow: 0 0 4px #4ade80; }
.digest-status.pending { color: #fbbf24; border-color: rgba(251,191,36,0.25); }
.digest-status.pending .ds-dot { background: #fbbf24; animation: ds-pulse 1.2s ease-in-out infinite; }
.digest-status.failed { color: #f87171; border-color: rgba(248,113,113,0.25); }
.digest-status.failed .ds-dot { background: #f87171; }
.digest-status.unconfigured { color: var(--fg-3); border-color: rgba(255,255,255,0.06); }
.digest-status.unconfigured .ds-dot { background: var(--fg-3); opacity: 0.5; }
.digest-status .ds-link {
  color: inherit;
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 9px;
}
.digest-status .ds-link:hover { text-decoration: underline; }
@keyframes ds-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.75); }
}
