/* ═══════════════════════════════════════════════════════════
   Dividend Watcher Dashboard v2 — OpenClaw
   Drop Map · Bingo · War Room · Yield Nerd · Confetti
   ═══════════════════════════════════════════════════════════ */

:root {
  --bg0: #070b12;
  --bg1: #0c1220;
  --bg2: #111827;
  --bg3: #1a2332;
  --surface: rgba(17, 24, 39, 0.72);
  --surface-2: rgba(26, 35, 50, 0.85);
  --border: rgba(148, 163, 184, 0.12);
  --border-strong: rgba(148, 163, 184, 0.22);
  --text: #e8eef7;
  --text-dim: #94a3b8;
  --text-mute: #64748b;
  --emerald: #10b981;
  --emerald-glow: rgba(16, 185, 129, 0.35);
  --amber: #f59e0b;
  --amber-glow: rgba(245, 158, 11, 0.3);
  --rose: #f43f5e;
  --sky: #38bdf8;
  --violet: #a78bfa;
  --gold: #fbbf24;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  --font: "Segoe UI", "Inter", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", "SF Mono", "Fira Code", ui-monospace, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg0);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(16, 185, 129, 0.14), transparent 55%),
    radial-gradient(ellipse 60% 40% at 90% 0%, rgba(56, 189, 248, 0.1), transparent 50%),
    radial-gradient(ellipse 50% 40% at 50% 100%, rgba(167, 139, 250, 0.08), transparent 50%),
    linear-gradient(180deg, var(--bg0), var(--bg1) 40%, var(--bg0));
  transition: background 0.6s;
}

body.war-room::before {
  background:
    radial-gradient(ellipse 90% 55% at 15% -5%, rgba(244, 63, 94, 0.16), transparent 50%),
    radial-gradient(ellipse 70% 45% at 90% 5%, rgba(245, 158, 11, 0.12), transparent 50%),
    radial-gradient(ellipse 50% 40% at 50% 100%, rgba(16, 185, 129, 0.1), transparent 50%),
    linear-gradient(180deg, #0a0608, #120c10 40%, #070b12);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0.35;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, black 20%, transparent 75%);
  pointer-events: none;
}

#confetti-canvas {
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
}

/* ── Intro curtain ──────────────────────────────────────── */
.intro-curtain {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: grid;
  place-items: center;
  background: radial-gradient(ellipse at center, #0f172a, #070b12 70%);
  transition: opacity 0.7s ease, visibility 0.7s;
}
.intro-curtain.hide {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.intro-inner { text-align: center; animation: introIn 0.8s ease; }
.intro-emoji {
  font-size: 3.5rem;
  animation: bob 1.2s ease-in-out infinite;
  filter: drop-shadow(0 0 24px var(--emerald-glow));
}
.intro-line {
  margin-top: 1rem;
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #fff, #34d399, #38bdf8);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.intro-sub { margin-top: 0.5rem; color: var(--text-dim); font-size: 0.95rem; }

@keyframes introIn {
  from { opacity: 0; transform: scale(0.92) translateY(12px); }
  to { opacity: 1; transform: none; }
}
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* ── Layout ─────────────────────────────────────────────── */
.app {
  max-width: 1320px;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 3rem;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.5s ease 0.15s, transform 0.5s ease 0.15s;
}
.app.ready {
  opacity: 1;
  transform: none;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 0.9rem; }
.brand-mark {
  width: 48px; height: 48px; border-radius: 14px;
  background: linear-gradient(145deg, #10b981, #059669 50%, #0ea5e9);
  display: grid; place-items: center; font-size: 1.4rem;
  box-shadow: 0 8px 28px var(--emerald-glow), inset 0 1px 0 rgba(255,255,255,0.25);
  position: relative; overflow: hidden;
}
.brand-mark::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,0.2), transparent 70%);
  animation: sheen 4s ease-in-out infinite;
}
@keyframes sheen {
  0%, 100% { transform: translateX(-100%); }
  50% { transform: translateX(100%); }
}
.brand h1 { font-size: 1.35rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
.brand p { color: var(--text-dim); font-size: 0.82rem; }
.top-actions { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  appearance: none;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.6rem 1rem;
  border-radius: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  transition: transform 0.15s, background 0.15s, border-color 0.15s, box-shadow 0.15s;
  backdrop-filter: blur(10px);
}
.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(16, 185, 129, 0.4);
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(135deg, #10b981, #059669);
  border-color: transparent;
  color: #042f1f;
  box-shadow: 0 8px 24px var(--emerald-glow);
}
.btn-primary:hover:not(:disabled) {
  box-shadow: 0 12px 32px var(--emerald-glow);
  border-color: transparent;
}
.btn-ghost { background: transparent; }
.btn-sm { padding: 0.35rem 0.65rem; font-size: 0.75rem; border-radius: 8px; }
.btn .spinner {
  width: 14px; height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Cards ──────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.card::before {
  content: "";
  position: absolute; inset: 0 0 auto 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.12), transparent);
}
.card-pad { padding: 1.25rem 1.35rem; }
.card-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-mute);
  font-weight: 700;
  margin-bottom: 0.75rem;
}

/* ── Surprise banner ────────────────────────────────────── */
.surprise-banner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.15rem 1.4rem;
  margin-bottom: 1rem;
  border-radius: var(--radius);
  border: 1px solid rgba(16, 185, 129, 0.3);
  background: linear-gradient(120deg, rgba(16,185,129,0.12), rgba(56,189,248,0.08) 50%, rgba(167,139,250,0.1));
  overflow: hidden;
  animation: slideDown 0.6s ease;
}
body.war-room .surprise-banner {
  border-color: rgba(245, 158, 11, 0.4);
  background: linear-gradient(120deg, rgba(244,63,94,0.14), rgba(245,158,11,0.1) 55%, rgba(16,185,129,0.1));
  box-shadow: 0 0 40px rgba(245, 158, 11, 0.12);
}
.surprise-glow {
  position: absolute;
  width: 200px; height: 200px;
  right: -40px; top: -80px;
  background: radial-gradient(circle, rgba(56,189,248,0.25), transparent 70%);
  pointer-events: none;
}
.surprise-kicker {
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-mute);
  font-weight: 800;
}
.surprise-headline {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-top: 0.15rem;
}
.surprise-sub { color: var(--text-dim); font-size: 0.9rem; margin-top: 0.2rem; }
.surprise-score {
  font-family: var(--mono);
  font-weight: 800;
  font-size: 2.2rem;
  line-height: 1;
  color: var(--gold);
  text-shadow: 0 0 24px var(--amber-glow);
  flex-shrink: 0;
}
.ss-den { font-size: 1.1rem; opacity: 0.55; margin-left: 2px; }

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-16px); }
  to { opacity: 1; transform: none; }
}

.complete-banner {
  display: none;
  margin-bottom: 1rem;
  padding: 1rem 1.2rem;
  border-radius: var(--radius);
  background: linear-gradient(90deg, rgba(16,185,129,0.22), rgba(251,191,36,0.14));
  border: 1px solid rgba(16,185,129,0.45);
  font-weight: 600;
  align-items: center;
  gap: 0.85rem;
  box-shadow: 0 0 40px var(--emerald-glow);
}
.complete-banner.show { display: flex; }
.complete-emoji { font-size: 1.8rem; }
.complete-banner strong { display: block; font-size: 1.05rem; }
.complete-banner #complete-detail { font-weight: 500; color: var(--text-dim); font-size: 0.88rem; }

.anomaly-banner {
  margin-bottom: 1rem;
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius-sm);
  background: rgba(244, 63, 94, 0.12);
  border: 1px solid rgba(244, 63, 94, 0.35);
  color: #fda4af;
  font-size: 0.9rem;
  font-weight: 600;
}

/* ── Hero ───────────────────────────────────────────────── */
.hero {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}
body.war-room .hero { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 980px) {
  .hero { grid-template-columns: 1fr; }
}

.status-hero { display: flex; flex-direction: column; gap: 1rem; min-height: 220px; }
.status-row { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid transparent;
}
.badge-live { background: rgba(16,185,129,0.15); color: #34d399; border-color: rgba(16,185,129,0.35); }
.badge-wait { background: rgba(245,158,11,0.12); color: #fbbf24; border-color: rgba(245,158,11,0.35); }
.badge-done { background: rgba(56,189,248,0.12); color: #7dd3fc; border-color: rgba(56,189,248,0.3); }
.badge-off { background: rgba(100,116,139,0.15); color: #94a3b8; border-color: rgba(100,116,139,0.3); }
.badge-err { background: rgba(244,63,94,0.12); color: #fb7185; border-color: rgba(244,63,94,0.35); }
.badge-war {
  background: rgba(245,158,11,0.18);
  color: #fbbf24;
  border-color: rgba(245,158,11,0.45);
  animation: warPulse 1.6s ease-in-out infinite;
}
@keyframes warPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245,158,11,0.4); }
  50% { box-shadow: 0 0 0 8px transparent; }
}

.pulse-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: currentColor;
  animation: pulse 1.8s ease-out infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 currentColor; opacity: 1; }
  70% { box-shadow: 0 0 0 10px transparent; opacity: 0.7; }
  100% { box-shadow: 0 0 0 0 transparent; opacity: 1; }
}

.big-metric {
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  background: linear-gradient(135deg, #fff 20%, #94a3b8);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.metric-sub { color: var(--text-dim); font-size: 0.9rem; margin-top: 0.25rem; }

.meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; margin-top: auto; }
.meta-item {
  background: rgba(0,0,0,0.22);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.85rem;
}
.meta-item .k {
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-mute); font-weight: 700;
}
.meta-item .v { font-size: 0.95rem; font-weight: 600; margin-top: 0.15rem; font-variant-numeric: tabular-nums; }
.meta-item .v.mono { font-family: var(--mono); font-size: 0.82rem; color: var(--sky); }

.ring-wrap { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; min-height: 220px; }
.ring { position: relative; width: 170px; height: 170px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: rgba(148,163,184,0.12); stroke-width: 10; }
.ring-fg {
  fill: none; stroke: url(#ringGrad); stroke-width: 10; stroke-linecap: round;
  stroke-dasharray: 440; stroke-dashoffset: 440;
  transition: stroke-dashoffset 0.8s cubic-bezier(.2,.8,.2,1);
  filter: drop-shadow(0 0 8px var(--emerald-glow));
}
.ring-center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.ring-center .pct { font-size: 2.1rem; font-weight: 800; letter-spacing: -0.03em; line-height: 1; }
.ring-center .lbl { font-size: 0.72rem; color: var(--text-mute); text-transform: uppercase; letter-spacing: 0.1em; margin-top: 0.25rem; }

.countdown-box { text-align: center; }
.countdown-box .label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-mute); font-weight: 700; }
.countdown-box .time {
  font-family: var(--mono); font-size: 1.55rem; font-weight: 700;
  color: var(--gold); margin-top: 0.15rem; text-shadow: 0 0 24px var(--amber-glow);
}
body.war-room .countdown-box .time { font-size: 2rem; color: #fb7185; text-shadow: 0 0 28px var(--rose); }

.window-bar {
  height: 10px; border-radius: 999px;
  background: rgba(148,163,184,0.12); overflow: hidden;
  margin: 0.85rem 0 0.5rem;
}
.window-bar .fill {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, #10b981, #38bdf8, #a78bfa);
  transition: width 0.6s ease;
  box-shadow: 0 0 16px var(--emerald-glow);
}
.window-days { display: flex; justify-content: space-between; font-size: 0.72rem; color: var(--text-mute); font-family: var(--mono); }
.window-note {
  margin-top: 1rem; padding: 0.75rem 0.9rem;
  border-radius: var(--radius-sm);
  background: rgba(0,0,0,0.25); border: 1px solid var(--border);
  font-size: 0.85rem; color: var(--text-dim);
}
.window-note strong { color: var(--text); }

.section { margin-top: 1.75rem; }
.section-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 1rem; margin-bottom: 0.9rem; flex-wrap: wrap;
}
.section-head h2 { font-size: 1.15rem; font-weight: 700; letter-spacing: -0.02em; }
.section-head p { color: var(--text-dim); font-size: 0.85rem; }

.dual-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 900px) {
  .dual-grid { grid-template-columns: 1fr; }
}

/* ── Drop Map ───────────────────────────────────────────── */
.dropmap-card { overflow-x: auto; }
.dropmap-wrap { min-width: 640px; }
.dropmap-table { width: 100%; border-collapse: separate; border-spacing: 4px; }
.dropmap-table th {
  font-size: 0.68rem; color: var(--text-mute); font-weight: 700;
  font-family: var(--mono); padding: 0.25rem; text-align: center;
}
.dropmap-table th.today-col { color: var(--gold); }
.dropmap-table .fam-label {
  text-align: left; font-size: 0.78rem; font-weight: 700;
  padding-right: 0.6rem; white-space: nowrap; min-width: 88px;
}
.dm-cell {
  width: 42px; height: 36px;
  border-radius: 8px;
  background: rgba(148,163,184,0.06);
  border: 1px solid var(--border);
  position: relative;
  transition: transform 0.15s, box-shadow 0.15s;
}
.dm-cell:hover { transform: scale(1.08); z-index: 2; }
.dm-cell.heat-1 { background: color-mix(in srgb, var(--c, #10b981) 18%, transparent); border-color: color-mix(in srgb, var(--c) 30%, transparent); }
.dm-cell.heat-2 { background: color-mix(in srgb, var(--c, #10b981) 35%, transparent); border-color: color-mix(in srgb, var(--c) 45%, transparent); }
.dm-cell.heat-3 { background: color-mix(in srgb, var(--c, #10b981) 55%, transparent); border-color: color-mix(in srgb, var(--c) 60%, transparent); }
.dm-cell.live {
  background: var(--c, #10b981) !important;
  border-color: #fff3 !important;
  box-shadow: 0 0 16px color-mix(in srgb, var(--c) 60%, transparent);
  animation: livePop 0.6s ease;
}
.dm-cell.live::after {
  content: "✓";
  position: absolute; inset: 0;
  display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: 0.85rem;
  text-shadow: 0 1px 2px #0008;
}
.dm-cell.today-line {
  outline: 2px solid rgba(251, 191, 36, 0.55);
  outline-offset: 1px;
}
.dm-cell.future { opacity: 0.35; }
@keyframes livePop {
  0% { transform: scale(0.6); }
  60% { transform: scale(1.15); }
  100% { transform: scale(1); }
}
.dropmap-foot {
  margin-top: 0.75rem;
  font-size: 0.75rem;
  color: var(--text-mute);
  display: flex; gap: 1rem; flex-wrap: wrap; align-items: center;
}
.dropmap-foot .swatch {
  width: 14px; height: 14px; border-radius: 4px; display: inline-block;
  vertical-align: middle; margin-right: 0.3rem;
}

/* ── Bingo ──────────────────────────────────────────────── */
.bingo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.65rem;
}
.bingo-cell {
  aspect-ratio: 1.15;
  border-radius: 14px;
  border: 1px dashed var(--border-strong);
  background: rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  position: relative;
  transition: transform 0.2s, border-color 0.2s, background 0.2s;
  overflow: hidden;
}
.bingo-cell.stamped {
  border-style: solid;
  border-color: color-mix(in srgb, var(--c) 55%, transparent);
  background:
    radial-gradient(circle at 70% 30%, color-mix(in srgb, var(--c) 35%, transparent), transparent 55%),
    rgba(0,0,0,0.25);
  animation: stampIn 0.45s cubic-bezier(.2,1.4,.3,1);
}
.bingo-cell .b-icon {
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center;
  font-weight: 800; font-size: 0.8rem; color: #fff;
  background: linear-gradient(145deg, var(--c), color-mix(in srgb, var(--c) 55%, #000));
  opacity: 0.45;
}
.bingo-cell.stamped .b-icon { opacity: 1; box-shadow: 0 6px 16px color-mix(in srgb, var(--c) 40%, transparent); }
.bingo-cell .b-name { font-size: 0.78rem; font-weight: 700; color: var(--text-dim); }
.bingo-cell.stamped .b-name { color: var(--text); }
.bingo-cell .b-stamp {
  position: absolute;
  top: 6px; right: 8px;
  font-size: 1.1rem;
  opacity: 0;
  transform: rotate(-12deg) scale(0.5);
}
.bingo-cell.stamped .b-stamp {
  opacity: 1;
  transform: rotate(-12deg) scale(1);
  filter: drop-shadow(0 2px 4px #0008);
}
@keyframes stampIn {
  0% { transform: scale(0.85) rotate(-4deg); }
  60% { transform: scale(1.06) rotate(2deg); }
  100% { transform: scale(1) rotate(0); }
}
.bingo-footer {
  margin-top: 0.9rem;
  text-align: center;
  font-weight: 700;
  font-size: 0.95rem;
}
.bingo-footer.full {
  color: var(--gold);
  text-shadow: 0 0 20px var(--amber-glow);
  animation: glowText 1.5s ease-in-out infinite alternate;
}
@keyframes glowText {
  from { filter: brightness(1); }
  to { filter: brightness(1.25); }
}

/* ── Race timeline ──────────────────────────────────────── */
.race-empty { color: var(--text-mute); font-size: 0.9rem; padding: 0.5rem 0; }
.race-compare {
  font-size: 0.8rem; color: var(--text-dim);
  margin-bottom: 0.85rem;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  background: rgba(0,0,0,0.22);
  border: 1px solid var(--border);
}
.race-track { position: relative; padding-left: 1.25rem; }
.race-track::before {
  content: "";
  position: absolute; left: 7px; top: 4px; bottom: 4px;
  width: 2px;
  background: linear-gradient(180deg, var(--emerald), var(--sky), var(--violet));
  border-radius: 2px;
}
.race-event {
  position: relative;
  padding: 0.55rem 0 0.55rem 0.85rem;
  animation: fadeUp 0.4s ease both;
}
.race-event::before {
  content: "";
  position: absolute; left: -1.05rem; top: 1rem;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--c, var(--emerald));
  box-shadow: 0 0 10px var(--c, var(--emerald));
  border: 2px solid var(--bg1);
}
.race-event .place { font-size: 0.95rem; margin-right: 0.25rem; }
.race-event .r-title { font-weight: 700; font-size: 0.92rem; }
.race-event .r-meta { font-size: 0.78rem; color: var(--text-mute); font-family: var(--mono); }
.race-event a { color: var(--sky); text-decoration: none; font-size: 0.78rem; font-weight: 600; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ── Families ───────────────────────────────────────────── */
.families {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.9rem;
}
@media (max-width: 900px) { .families { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .families { grid-template-columns: 1fr; } }

.family-card {
  padding: 1.1rem 1.15rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  backdrop-filter: blur(12px);
  position: relative;
  overflow: hidden;
  transition: transform 0.18s, border-color 0.18s, box-shadow 0.18s;
  min-height: 180px;
  display: flex;
  flex-direction: column;
}
.family-card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--fam-color) 45%, transparent);
  box-shadow: 0 16px 40px rgba(0,0,0,0.35), 0 0 0 1px color-mix(in srgb, var(--fam-color) 25%, transparent);
}
.family-card.announced {
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--fam-color) 12%, transparent), transparent 55%),
    var(--surface);
}
.family-card.missing {
  background:
    linear-gradient(145deg, rgba(244, 63, 94, 0.06), transparent 50%),
    var(--surface);
}
.family-card .glow {
  position: absolute; top: -40px; right: -40px;
  width: 120px; height: 120px; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--fam-color) 30%, transparent), transparent 70%);
  pointer-events: none;
}
.fam-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.5rem; }
.fam-avatar {
  width: 42px; height: 42px; border-radius: 12px;
  display: grid; place-items: center;
  font-weight: 800; font-size: 0.85rem; color: #fff;
  background: linear-gradient(145deg, var(--fam-color), color-mix(in srgb, var(--fam-color) 60%, #000));
  box-shadow: 0 6px 18px color-mix(in srgb, var(--fam-color) 40%, transparent);
}
.fam-status {
  font-size: 0.68rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.08em; padding: 0.28rem 0.55rem; border-radius: 999px;
}
.fam-status.ok { color: #34d399; background: rgba(16,185,129,0.14); border: 1px solid rgba(16,185,129,0.3); }
.fam-status.miss { color: #fb7185; background: rgba(244,63,94,0.12); border: 1px solid rgba(244,63,94,0.28); }
.fam-name { margin-top: 0.75rem; font-weight: 700; font-size: 1.05rem; }
.fam-source { color: var(--text-mute); font-size: 0.78rem; font-family: var(--mono); margin-top: 0.15rem; }
.fam-meta-line {
  margin-top: 0.45rem;
  font-size: 0.78rem;
  color: var(--text-dim);
}
.fam-meta-line .tag {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: 6px;
  background: rgba(0,0,0,0.25);
  margin-right: 0.3rem;
  font-family: var(--mono);
  font-size: 0.72rem;
}
.yield-box {
  margin-top: 0.65rem;
  padding: 0.55rem 0.65rem;
  border-radius: 10px;
  background: rgba(0,0,0,0.28);
  border: 1px solid color-mix(in srgb, var(--fam-color) 25%, transparent);
  font-size: 0.78rem;
}
.yield-box .y-title { font-weight: 700; color: var(--text); margin-bottom: 0.25rem; line-height: 1.3; }
.yield-box .y-amts { color: var(--gold); font-family: var(--mono); font-weight: 700; }
.yield-box .y-tickers { color: var(--text-mute); margin-top: 0.2rem; font-family: var(--mono); font-size: 0.7rem; }
.fam-link { margin-top: auto; padding-top: 0.75rem; }
.fam-link a { color: var(--sky); font-size: 0.8rem; text-decoration: none; font-weight: 600; }
.fam-link a:hover { text-decoration: underline; }
.fam-waiting { margin-top: auto; padding-top: 0.75rem; font-size: 0.8rem; color: var(--text-mute); font-style: italic; }

/* ── Drop Watch ─────────────────────────────────────────── */
.watch-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.85rem;
}
@media (max-width: 900px) { .watch-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .watch-grid { grid-template-columns: 1fr; } }

.watch-card {
  padding: 1rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  position: relative;
  overflow: hidden;
}
.watch-card.anomaly {
  border-color: rgba(244, 63, 94, 0.45);
  box-shadow: 0 0 24px rgba(244, 63, 94, 0.15);
}
.watch-card.done { opacity: 0.85; }
.watch-top { display: flex; justify-content: space-between; align-items: center; }
.watch-name { font-weight: 700; }
.watch-eta {
  font-family: var(--mono); font-weight: 800; font-size: 0.9rem;
  color: var(--c, var(--sky));
}
.watch-msg { margin-top: 0.45rem; font-size: 0.82rem; color: var(--text-dim); }
.p-bar {
  margin-top: 0.7rem;
  height: 8px;
  border-radius: 999px;
  background: rgba(148,163,184,0.12);
  overflow: hidden;
}
.p-bar .fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--c, #38bdf8), #a78bfa);
  transition: width 0.6s ease;
}
.p-label {
  margin-top: 0.35rem;
  font-size: 0.72rem;
  color: var(--text-mute);
  font-family: var(--mono);
  display: flex; justify-content: space-between;
}

/* ── Radar ──────────────────────────────────────────────── */
.radar-table { width: 100%; border-collapse: separate; border-spacing: 4px; }
.radar-table th {
  font-size: 0.68rem; color: var(--text-mute); font-family: var(--mono);
  font-weight: 700; text-align: center; padding: 0.2rem;
}
.radar-table .r-fam {
  text-align: left; font-size: 0.8rem; font-weight: 700;
  white-space: nowrap; padding-right: 0.5rem;
}
.radar-dot {
  width: 28px; height: 28px; border-radius: 8px; margin: 0 auto;
  border: 1px solid var(--border);
  background: rgba(148,163,184,0.08);
}
.radar-dot.on {
  background: var(--c);
  box-shadow: 0 0 12px color-mix(in srgb, var(--c) 50%, transparent);
  border-color: transparent;
}
.radar-rate {
  font-family: var(--mono); font-size: 0.75rem; font-weight: 700;
  color: var(--text-dim); text-align: center; min-width: 40px;
}

/* ── Family history (dates) ─────────────────────────────── */
.fh-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.9rem;
}
@media (max-width: 900px) { .fh-grid { grid-template-columns: 1fr; } }

.fh-card {
  padding: 1.15rem 1.2rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  position: relative;
  overflow: hidden;
}
.fh-card::after {
  content: "";
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--c, #10b981), transparent);
}
.fh-top {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 0.75rem;
}
.fh-name { font-weight: 800; font-size: 1.05rem; }
.fh-badge {
  font-size: 0.68rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.06em; padding: 0.28rem 0.55rem; border-radius: 999px;
  white-space: nowrap;
}
.fh-badge.done { color: #34d399; background: rgba(16,185,129,0.14); border: 1px solid rgba(16,185,129,0.3); }
.fh-badge.wait { color: #fbbf24; background: rgba(245,158,11,0.12); border: 1px solid rgba(245,158,11,0.3); }

.fh-last {
  margin-top: 0.85rem;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  background: rgba(0,0,0,0.28);
  border: 1px solid var(--border);
}
.fh-last .k {
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-mute); font-weight: 700;
}
.fh-last .date {
  font-size: 1.25rem; font-weight: 800; letter-spacing: -0.02em;
  margin-top: 0.15rem; color: var(--text);
}
.fh-last .date.unknown { color: var(--text-mute); font-size: 0.95rem; font-weight: 600; }
.fh-last .sub { font-size: 0.78rem; color: var(--text-dim); margin-top: 0.2rem; }

.fh-next {
  margin-top: 0.65rem;
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(56,189,248,0.08), rgba(167,139,250,0.08));
  border: 1px solid rgba(56,189,248,0.22);
}
.fh-next .k {
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--sky); font-weight: 700;
}
.fh-next .date {
  font-size: 1.05rem; font-weight: 800; margin-top: 0.15rem;
  color: #7dd3fc;
}
.fh-next .range {
  font-family: var(--mono); font-size: 0.75rem; color: var(--text-dim); margin-top: 0.25rem;
}
.fh-next .conf {
  display: inline-block; margin-top: 0.35rem;
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
  padding: 0.15rem 0.45rem; border-radius: 6px;
  background: rgba(0,0,0,0.25); color: var(--text-mute);
}
.fh-next .conf.high { color: #34d399; }
.fh-next .conf.medium { color: #fbbf24; }
.fh-next .conf.low { color: #94a3b8; }

.fh-timeline {
  margin-top: 0.85rem;
  display: flex; flex-direction: column; gap: 0.4rem;
}
.fh-tl-item {
  display: grid;
  grid-template-columns: 14px 1fr auto;
  gap: 0.55rem;
  align-items: start;
  font-size: 0.82rem;
}
.fh-tl-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--c); margin-top: 0.3rem;
  box-shadow: 0 0 8px color-mix(in srgb, var(--c) 50%, transparent);
}
.fh-tl-dot.current { outline: 2px solid #fff4; outline-offset: 2px; }
.fh-tl-main { color: var(--text); font-weight: 600; }
.fh-tl-main a { color: inherit; text-decoration: none; }
.fh-tl-main a:hover { color: var(--sky); }
.fh-tl-sub { font-size: 0.72rem; color: var(--text-mute); font-family: var(--mono); }
.fh-tl-day {
  font-family: var(--mono); font-size: 0.72rem; font-weight: 700;
  color: var(--text-dim); white-space: nowrap;
}

/* ── History months ─────────────────────────────────────── */
.history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 0.9rem;
}
.hist-card {
  padding: 1.1rem 1.15rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
}
.hist-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.85rem; }
.hist-head h3 { font-size: 1rem; font-weight: 700; }
.hist-score { font-family: var(--mono); font-size: 0.85rem; font-weight: 700; color: var(--text-dim); }
.hist-score.full { color: #34d399; }
.hist-rows { display: flex; flex-direction: column; gap: 0.4rem; }
.hist-row {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  gap: 0.55rem;
  align-items: center;
  padding: 0.4rem 0.55rem;
  border-radius: 8px;
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--border);
  font-size: 0.8rem;
}
.hist-row.on {
  border-color: color-mix(in srgb, var(--fam-color) 40%, transparent);
  background: color-mix(in srgb, var(--fam-color) 10%, transparent);
}
.hist-row .ball {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--fam-color, #64748b); opacity: 0.35;
}
.hist-row.on .ball { opacity: 1; box-shadow: 0 0 8px var(--fam-color); }
.hist-row .name { font-weight: 600; color: var(--text-dim); }
.hist-row.on .name { color: var(--text); }
.hist-row .when {
  font-family: var(--mono); font-size: 0.72rem; font-weight: 700;
  color: var(--text-mute); white-space: nowrap;
}
.hist-row.on .when { color: var(--gold); }
/* legacy dots kept */
.hist-dots { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.hist-dot {
  display: flex; align-items: center; gap: 0.35rem;
  padding: 0.3rem 0.55rem; border-radius: 8px;
  background: rgba(0,0,0,0.25); border: 1px solid var(--border);
  font-size: 0.72rem; font-weight: 600; color: var(--text-dim);
}
.hist-dot.on {
  border-color: color-mix(in srgb, var(--fam-color) 45%, transparent);
  color: var(--text);
  background: color-mix(in srgb, var(--fam-color) 12%, transparent);
}
.hist-dot .ball { width: 8px; height: 8px; border-radius: 50%; background: var(--fam-color, #64748b); opacity: 0.35; }
.hist-dot.on .ball { opacity: 1; box-shadow: 0 0 8px var(--fam-color); }

/* ── Signal archive ─────────────────────────────────────── */
.signal-list { display: flex; flex-direction: column; gap: 0.7rem; }
.signal-item {
  display: flex; gap: 0.9rem; align-items: flex-start;
  padding: 1rem 1.15rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  transition: border-color 0.15s;
}
.signal-item:hover { border-color: color-mix(in srgb, var(--c) 40%, transparent); }
.sig-avatar {
  width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
  display: grid; place-items: center; font-weight: 800; color: #fff;
  background: linear-gradient(145deg, var(--c), color-mix(in srgb, var(--c) 55%, #000));
}
.sig-body { flex: 1; min-width: 0; }
.sig-title { font-weight: 700; font-size: 0.95rem; }
.sig-meta { font-size: 0.78rem; color: var(--text-mute); font-family: var(--mono); margin-top: 0.15rem; }
.sig-preview {
  margin-top: 0.45rem; font-size: 0.8rem; color: var(--text-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sig-actions { display: flex; gap: 0.4rem; flex-shrink: 0; flex-wrap: wrap; }

/* ── Runs ───────────────────────────────────────────────── */
.runs-card { overflow: hidden; }
.runs-table-wrap { overflow-x: auto; }
table.runs { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
table.runs th {
  text-align: left; padding: 0.75rem 1rem;
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-mute); border-bottom: 1px solid var(--border);
  background: rgba(0,0,0,0.2); white-space: nowrap;
}
table.runs td {
  padding: 0.7rem 1rem; border-bottom: 1px solid var(--border);
  color: var(--text-dim); white-space: nowrap; font-variant-numeric: tabular-nums;
}
table.runs tr:hover td { background: rgba(255,255,255,0.02); color: var(--text); }
table.runs tr.hit-row td {
  background: rgba(251, 191, 36, 0.06);
}
table.runs tr.hit-row:hover td {
  background: rgba(251, 191, 36, 0.1);
}
table.runs .mono { font-family: var(--mono); font-size: 0.78rem; }

.pill {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.15rem 0.5rem; border-radius: 999px;
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
}
.pill-ok { background: rgba(16,185,129,0.14); color: #34d399; }
.pill-err { background: rgba(244,63,94,0.14); color: #fb7185; }
.pill-muted { background: rgba(100,116,139,0.15); color: #94a3b8; }
.pill-hit { background: rgba(251,191,36,0.18); color: #fbbf24; box-shadow: 0 0 12px var(--amber-glow); }

.spark { display: flex; align-items: flex-end; gap: 2px; height: 36px; margin-top: 0.5rem; }
.spark span {
  flex: 1; min-width: 3px; border-radius: 2px 2px 0 0;
  background: linear-gradient(180deg, #38bdf8, #10b981); opacity: 0.75;
}

/* ── Toast / modal / misc ───────────────────────────────── */
.toasts {
  position: fixed; bottom: 1.25rem; right: 1.25rem; z-index: 100;
  display: flex; flex-direction: column; gap: 0.5rem;
  max-width: min(380px, calc(100vw - 2rem));
}
.toast {
  padding: 0.85rem 1rem; border-radius: 14px;
  background: var(--bg3); border: 1px solid var(--border-strong);
  box-shadow: var(--shadow); font-size: 0.88rem;
  animation: toastIn 0.25s ease;
}
.toast.ok { border-color: rgba(16,185,129,0.4); }
.toast.err { border-color: rgba(244,63,94,0.4); }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

.modal-backdrop {
  position: fixed; inset: 0; z-index: 120;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(6px);
  display: grid; place-items: center;
  padding: 1rem;
}
.modal {
  width: min(520px, 100%);
  background: var(--bg2);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.9rem 1.1rem; border-bottom: 1px solid var(--border);
}
.modal-body {
  padding: 1rem 1.1rem;
  max-height: 40vh; overflow: auto;
  font-family: var(--mono); font-size: 0.78rem;
  color: var(--text-dim); white-space: pre-wrap;
  background: rgba(0,0,0,0.25);
}
.modal-actions {
  display: flex; justify-content: flex-end; gap: 0.5rem;
  padding: 0.9rem 1.1rem; border-top: 1px solid var(--border);
}

.loading-overlay {
  position: fixed; inset: 0; display: grid; place-items: center;
  background: rgba(7, 11, 18, 0.75); z-index: 50;
  backdrop-filter: blur(6px); transition: opacity 0.3s;
}
.loading-overlay.hidden { opacity: 0; pointer-events: none; }
.loader-box { text-align: center; }
.loader-box .orb {
  width: 56px; height: 56px; border-radius: 50%;
  border: 3px solid rgba(16,185,129,0.2);
  border-top-color: var(--emerald);
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}
.loader-title { font-weight: 700; }
.loader-sub { color: var(--text-mute); font-size: 0.82rem; margin-top: 0.35rem; }

.footer {
  margin-top: 2.5rem; padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  color: var(--text-mute); font-size: 0.78rem;
}
.live-clock { font-family: var(--mono); color: var(--text-dim); }
.mono { font-family: var(--mono); }

.force-panel {
  margin-top: 1rem; padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  background: rgba(0,0,0,0.3); border: 1px solid var(--border);
  font-family: var(--mono); font-size: 0.75rem; color: var(--text-dim);
  max-height: 140px; overflow: auto; white-space: pre-wrap; display: none;
}
.force-panel.show { display: block; }

.refresh-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--text-mute); display: inline-block;
}
.refresh-dot.on { background: var(--emerald); box-shadow: 0 0 10px var(--emerald-glow); }
