/* ===========================================================
   Watchmen Lite — shared product styles
   Whoscall green DNA + Watchmen heritage blue on Midnight Navy.
   Galaxy ambient. Sentinel-field motion.
   =========================================================== */

:root {
  --color-surface-primary:  #0B1530;
  --color-surface-elevated: #1A2547;
  --color-surface-raised:   #2A3556;
  --color-surface-card:     rgba(26, 37, 71, 0.55);
  /* Text tokens — all pass WCAG AA on Midnight Navy.
     primary  ~14.8:1 AAA · secondary ~9.0:1 AAA · tertiary ~5.4:1 AA */
  --color-text-primary:     #F1F5F9;
  --color-text-secondary:   #D0DBE8;
  --color-text-tertiary:    #8B9AAF;
  --color-text-on-cyan:     #0B1530;

  /* Brand greens — Whoscall family.
     The token names stay `cyan` for stability across all pages,
     but values now point to Whoscall green primary + light green. */
  --color-brand-cyan:        #36F285;  /* Whoscall primary green */
  --color-brand-cyan-pulse:  #B3FFD2;  /* Whoscall primary light green */
  --color-brand-cyan-deep:   #0E7490;  /* Cyan Deep — original (pressed/secondary) */
  --color-heritage-purple:   #007BB4;  /* Watchmen Heritage Blue (token name kept for stability) */
  --color-violet-pulse:      #A78BFA;
  --color-violet-soft:       #C4B5FD;
  --color-stellar-pink:      #EC4899;  /* cosmic-pink accent — used in planets only */
  --color-stellar-rose:      #F472B6;
  --color-electric-blue:     #3B82F6;
  --color-electric-blue-deep:#1D4ED8;

  --color-semantic-safe:    #22C55E;
  --color-semantic-caution: #F59E0B;  /* system-feedback only — risk-M badges, setup warnings */
  --color-semantic-danger:  #EF4444;
  --color-semantic-info:    #36F285;

  /* Brand red — used for DO/DON'T markers and brand-level error language */
  --color-brand-red:        #ED3537;

  --color-border-subtle:    rgba(255, 255, 255, 0.06);
  --color-border-default:   rgba(255, 255, 255, 0.10);
  --color-border-strong:    rgba(255, 255, 255, 0.18);
  --color-border-cyan:      rgba(54, 242, 133, 0.6);
  --color-border-violet:    rgba(167, 139, 250, 0.5);

  /* Whoscall family typography:
     Nunito for headings — rounded, friendly, modern.
     Noto Sans for body — clean, international, full CJK support. */
  --font-heading: 'Nunito', 'Noto Sans TC', system-ui, sans-serif;
  --font-body:    'Noto Sans', 'Noto Sans TC', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, Menlo, monospace;

  --spacing-1: 4px;  --spacing-2: 8px;  --spacing-3: 12px; --spacing-4: 16px;
  --spacing-5: 20px; --spacing-6: 24px; --spacing-8: 32px; --spacing-10: 40px;
  --spacing-12: 48px; --spacing-16: 64px; --spacing-20: 80px;

  --radius-sm: 8px; --radius-md: 14px; --radius-lg: 20px; --radius-xl: 28px;

  --shadow-md:     0 1px 0 rgba(255,255,255,0.06) inset, 0 2px 8px rgba(0,0,0,0.25);
  --shadow-lg:     0 4px 24px rgba(0,0,0,0.4);
  --shadow-xl:     0 8px 48px rgba(0,0,0,0.5);
  --shadow-cyan:   0 0 32px rgba(54,242,133,0.30);
  --shadow-violet: 0 0 36px rgba(167,139,250,0.30);

  --motion-fast: 180ms;
  --motion-default: 240ms;
  --motion-ambient: 16s;
  --motion-orbit:   28s;
  --motion-out:     cubic-bezier(0.2, 0.8, 0.2, 1);
  --motion-reveal:  cubic-bezier(0.77, 0, 0.18, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; font-size: clamp(0.85rem, 0.55rem + 0.5vw, 1rem); }
body {
  margin: 0;
  background: var(--color-surface-primary);
  color: var(--color-text-primary);
  font: 400 1rem/1.55 var(--font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  min-height: 100vh;
}

/* ===========================================================
   Film-grain noise — adds cinematic texture across every page.
   Generated via SVG feTurbulence (no asset, no network).
   Sits on top of everything as a fixed overlay.
   =========================================================== */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.08;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  background-size: 240px 240px;
}
h1, h2, h3, h4, h5 { font-family: var(--font-heading); margin: 0; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: var(--color-brand-cyan); text-decoration: none; }
a:hover { color: var(--color-brand-cyan-pulse); }
.mono { font-family: var(--font-mono); font-feature-settings: 'tnum' on; }

/* ===========================================================
   Stars background — canvas-based "flying toward us" starfield.
   Drop-in component: include `assets/stars.js` and place markup:
     <canvas class="stars-canvas" id="starsCanvas"></canvas>
   The JS handles perspective projection, streak trails, and mouse parallax.
   =========================================================== */
.stars-canvas {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  display: block;
  pointer-events: none;
}

/* ===========================================================
   Galaxy ambient background — subtle, on every page
   =========================================================== */
.galaxy {
  position: fixed; inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background: var(--color-surface-primary);
}
.galaxy::before, .galaxy::after {
  content: ""; position: absolute; inset: -20%;
  filter: blur(80px);
  mix-blend-mode: screen;
  animation: drift1 var(--motion-ambient) ease-in-out infinite alternate;
}
.galaxy::before {
  background:
    radial-gradient(circle at 12% 75%, rgba(54,242,133,0.18) 0%, transparent 35%),
    radial-gradient(circle at 88% 30%, rgba(54,242,133,0.12) 0%, transparent 32%);
}
.galaxy::after {
  background:
    radial-gradient(circle at 75% 80%, rgba(167,139,250,0.18) 0%, transparent 38%),
    radial-gradient(circle at 30% 20%, rgba(0,123,180,0.18) 0%, transparent 35%);
  animation-name: drift2;
  animation-duration: calc(var(--motion-ambient) * 1.4);
}
.galaxy .stars {
  position: absolute; inset: 0;
  background-image:
    radial-gradient(1px 1px at 8% 18%, rgba(255,255,255,0.6), transparent),
    radial-gradient(1px 1px at 22% 65%, rgba(255,255,255,0.4), transparent),
    radial-gradient(1px 1px at 41% 12%, rgba(255,255,255,0.55), transparent),
    radial-gradient(1px 1px at 55% 78%, rgba(255,255,255,0.4), transparent),
    radial-gradient(1.5px 1.5px at 70% 30%, rgba(255,255,255,0.5), transparent),
    radial-gradient(1px 1px at 84% 58%, rgba(255,255,255,0.4), transparent),
    radial-gradient(1px 1px at 92% 22%, rgba(255,255,255,0.5), transparent),
    radial-gradient(1px 1px at 14% 88%, rgba(255,255,255,0.4), transparent),
    radial-gradient(1px 1px at 60% 5%,  rgba(255,255,255,0.4), transparent),
    radial-gradient(1px 1px at 35% 45%, rgba(255,255,255,0.3), transparent),
    radial-gradient(1px 1px at 78% 92%, rgba(255,255,255,0.5), transparent);
  opacity: 0.5;
}
@keyframes drift1 {
  0%   { transform: translate(0%, 0%)   rotate(0deg)   scale(1);    }
  50%  { transform: translate(-4%, 3%)  rotate(20deg)  scale(1.1);  }
  100% { transform: translate(3%, -4%)  rotate(-15deg) scale(0.95); }
}
@keyframes drift2 {
  0%   { transform: translate(0%, 0%)   rotate(0deg)   scale(1);    }
  50%  { transform: translate(5%, -3%)  rotate(-25deg) scale(1.08); }
  100% { transform: translate(-4%, 4%)  rotate(18deg)  scale(0.94); }
}

/* Edge planets — bright-core radial gradients, cosmic style.
   Each planet is a glowing sphere with a hot-spot center fading
   to a deep cosmic edge. Optional ring on some. */
.edge-planet {
  position: fixed; z-index: 0;
  border-radius: 50%;
  pointer-events: none;
  animation: planetFloat 18s ease-in-out infinite alternate;
}

/* Top-right large violet planet with subtle ring */
.edge-planet.p1 {
  width: 200px; height: 200px;
  top: 6vh; right: -50px;
  background: radial-gradient(circle at 50% 50%,
    #fff 0%,
    #E9D5FF 6%,
    var(--color-violet-pulse) 28%,
    var(--color-heritage-purple) 65%,
    #2E1065 92%,
    #0F0524 100%);
  box-shadow: 0 0 120px rgba(167,139,250,0.45);
}
.edge-planet.p1::before {
  content: ""; position: absolute;
  left: -14%; right: -14%; top: 44%; height: 14%;
  border: 1px solid rgba(167,139,250,0.55);
  border-radius: 50%;
  transform: rotate(-18deg);
  box-shadow: 0 0 16px rgba(167,139,250,0.3);
}

/* Left-mid bright cyan planet — like the small bright marble */
.edge-planet.p2 {
  width: 100px; height: 100px;
  top: 38vh; left: -25px;
  background: radial-gradient(circle at 50% 50%,
    #fff 0%,
    #CFFAFE 8%,
    var(--color-brand-cyan-pulse) 32%,
    var(--color-brand-cyan) 60%,
    var(--color-brand-cyan-deep) 88%,
    #041F2A 100%);
  box-shadow: 0 0 80px rgba(54,242,133,0.5);
  animation-delay: -4s;
}

/* Bottom-right rose-pink planet (cosmic accent) */
.edge-planet.p3 {
  width: 150px; height: 150px;
  bottom: 12vh; right: 6vw;
  background: radial-gradient(circle at 50% 50%,
    #fff 0%,
    #FCE7F3 8%,
    var(--color-stellar-rose) 32%,
    var(--color-stellar-pink) 62%,
    #831843 92%,
    #2A0B1F 100%);
  box-shadow: 0 0 100px rgba(236,72,153,0.40);
  animation-delay: -8s;
}

/* Small violet moon */
.edge-planet.p4 {
  width: 56px; height: 56px;
  bottom: 22vh; left: 18vw;
  background: radial-gradient(circle at 50% 50%,
    #fff 0%,
    #DDD6FE 12%,
    var(--color-violet-pulse) 50%,
    var(--color-heritage-purple) 100%);
  box-shadow: 0 0 50px rgba(167,139,250,0.55);
  animation-delay: -12s;
}
@keyframes planetFloat {
  0%   { transform: translate(0, 0); }
  50%  { transform: translate(8px, -10px); }
  100% { transform: translate(-6px, 8px); }
}

/* ===========================================================
   Top navigation
   =========================================================== */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(11,21,48,0.7);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--color-border-subtle);
  height: 72px;
  display: flex; align-items: center;
}
.topbar .container {
  display: flex; align-items: center; gap: var(--spacing-8); width: 100%;
  max-width: 1200px; margin: 0 auto; padding: 0 var(--spacing-8);
}

/* Logo lockup — Watchmen Lite SVG wordmark */
.brand {
  display: inline-flex; align-items: center;
  text-decoration: none;
  height: 28px;
}
.brand .logo {
  height: 22px;
  width: auto;
  display: block;
}
.brand .shield {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--color-violet-pulse), var(--color-heritage-purple));
  display: grid; place-items: center;
  box-shadow: 0 4px 16px rgba(0,123,180,0.4), inset 0 1px 0 rgba(255,255,255,0.2);
  flex-shrink: 0;
}
.brand .shield svg { width: 18px; height: 18px; color: #fff; }

.nav { display: flex; gap: var(--spacing-1); margin-left: auto; }
.nav a {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  font: 500 0.875rem var(--font-body);
  color: var(--color-text-secondary);
  transition: color var(--motion-fast) var(--motion-out), background var(--motion-fast) var(--motion-out);
}
.nav a:hover { color: var(--color-text-primary); background: rgba(255,255,255,0.04); }
.nav a.active {
  color: var(--color-text-primary);
  background: rgba(255,255,255,0.08);
  box-shadow: inset 0 0 0 1px var(--color-border-subtle);
}
.nav a svg { width: 14px; height: 14px; opacity: 0.85; }

/* ===========================================================
   Page layout
   =========================================================== */
.page-wrap { position: relative; z-index: 1; min-height: calc(100vh - 72px); }
.container { max-width: 1100px; margin: 0 auto; padding: var(--spacing-12) var(--spacing-8); }
.container-narrow { max-width: 880px; margin: 0 auto; padding: var(--spacing-12) var(--spacing-8); }

/* Page back link */
.back-link {
  display: inline-flex; align-items: center; gap: var(--spacing-2);
  color: var(--color-text-secondary);
  font-size: 0.875rem;
  margin-bottom: var(--spacing-6);
  transition: color var(--motion-fast) var(--motion-out);
}
.back-link:hover { color: var(--color-text-primary); }
.back-link::before { content: "←"; font-size: 1rem; }

/* Page header */
.page-header { margin-bottom: var(--spacing-10); }
.page-header h1 {
  display: flex; align-items: center; gap: var(--spacing-3);
  font: 800 2.2rem/1.1 var(--font-heading);
  letter-spacing: -0.015em;
}
.page-header h1 .icon-box {
  width: 44px; height: 44px;
  border-radius: var(--radius-md);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.page-header h1 .icon-box.violet {
  background: linear-gradient(135deg, var(--color-violet-pulse), var(--color-heritage-purple));
  box-shadow: 0 4px 16px rgba(0,123,180,0.35);
}
.page-header h1 .icon-box.cyan {
  background: linear-gradient(135deg, var(--color-brand-cyan-pulse), var(--color-brand-cyan-deep));
  box-shadow: 0 4px 16px rgba(54,242,133,0.35);
}
.page-header h1 .icon-box svg { width: 22px; height: 22px; color: #fff; }
.page-header .subtitle {
  margin-top: var(--spacing-3);
  color: var(--color-text-secondary);
  font-size: 0.95rem;
}

/* Info banner — neutral or warning */
.info-banner {
  display: flex; align-items: flex-start; gap: var(--spacing-3);
  padding: var(--spacing-4) var(--spacing-5);
  background: var(--color-surface-card);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  margin-bottom: var(--spacing-8);
  backdrop-filter: blur(8px);
}
.info-banner.warn {
  background: rgba(245,158,11,0.06);
  border-color: rgba(245,158,11,0.35);
}
.info-banner svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 2px; opacity: 0.8; }
.info-banner strong { color: var(--color-text-primary); font-weight: 600; }

/* ===========================================================
   Buttons (pill, with arrow)
   =========================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--spacing-2);
  height: 48px; padding: 0 22px;
  border-radius: 999px;
  border: 1px solid var(--color-border-strong);
  background: rgba(255,255,255,0.04);
  color: var(--color-text-primary);
  font: 600 0.95rem/1 var(--font-body);
  cursor: pointer;
  transition: all var(--motion-fast) var(--motion-out);
  text-decoration: none;
}
.btn:hover { border-color: var(--color-brand-cyan); color: var(--color-brand-cyan-pulse); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--color-brand-cyan); outline-offset: 2px; }
.btn-primary {
  background: linear-gradient(135deg, var(--color-brand-cyan-pulse), var(--color-brand-cyan));
  color: var(--color-text-on-cyan);
  border-color: transparent;
  box-shadow: 0 4px 20px rgba(54,242,133,0.35);
}
.btn-primary:hover { color: var(--color-text-on-cyan); box-shadow: 0 6px 28px rgba(54,242,133,0.5); }
.btn-violet {
  background: linear-gradient(135deg, var(--color-violet-pulse), var(--color-heritage-purple));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 20px rgba(0,123,180,0.4);
}
.btn-violet:hover { color: #fff; box-shadow: 0 6px 28px rgba(0,123,180,0.55); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--color-text-secondary); padding: 0 14px; }
.btn-ghost:hover { color: var(--color-text-primary); background: rgba(255,255,255,0.05); }
.btn-sm { height: 36px; padding: 0 14px; font-size: 0.825rem; }

/* ===========================================================
   Cards
   =========================================================== */
.card {
  background: var(--color-surface-card);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  padding: var(--spacing-6);
  backdrop-filter: blur(10px);
  transition: border-color var(--motion-default) var(--motion-out), transform var(--motion-default) var(--motion-out);
}
.card:hover { border-color: var(--color-border-default); }
.card.alert-violet {
  border: 1px solid var(--color-border-violet);
  background: linear-gradient(180deg, rgba(167,139,250,0.10), var(--color-surface-card));
  box-shadow: 0 0 32px rgba(167,139,250,0.15);
}
.card.scanning-cyan {
  border: 1px solid var(--color-border-cyan);
  background: linear-gradient(180deg, rgba(54,242,133,0.06), var(--color-surface-card));
}

/* Stats card */
.stat {
  background: var(--color-surface-card);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  padding: var(--spacing-6);
  text-align: center;
  backdrop-filter: blur(10px);
}
.stat .icon-pill {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: grid; place-items: center;
  margin: 0 auto var(--spacing-4);
}
.stat .icon-pill.cyan   { background: rgba(54,242,133,0.12);  color: var(--color-brand-cyan); }
.stat .icon-pill.violet { background: rgba(167,139,250,0.12); color: var(--color-violet-pulse); }
.stat .icon-pill.danger { background: rgba(239,68,68,0.12);   color: var(--color-semantic-danger); }
.stat .icon-pill.safe   { background: rgba(34,197,94,0.12);   color: var(--color-semantic-safe); }
.stat .icon-pill svg { width: 20px; height: 20px; }
.stat .number {
  font: 800 3rem/1 var(--font-heading);
  letter-spacing: -0.02em;
  margin-bottom: var(--spacing-2);
}
.stat .number.cyan   { color: var(--color-brand-cyan); }
.stat .number.violet { color: var(--color-violet-pulse); }
.stat .number.danger { color: var(--color-semantic-danger); }
.stat .number.safe   { color: var(--color-semantic-safe); }
.stat .label { color: var(--color-text-secondary); font-size: 0.875rem; }

/* ===========================================================
   Badges
   =========================================================== */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 10px;
  border-radius: 999px;
  font: 600 0.7rem/1 var(--font-body);
  letter-spacing: 0.04em;
  white-space: nowrap;
}
/* Risk levels — H/M/L marker dot */
.risk-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font: 600 0.75rem/1 var(--font-body);
  letter-spacing: 0.02em;
}
.risk-pill .dot {
  width: 6px; height: 6px; border-radius: 50%;
  display: inline-block;
}
.risk-pill.high {
  background: rgba(239,68,68,0.15);
  color: #FCA5A5;
  box-shadow: inset 0 0 0 1px rgba(239,68,68,0.4), 0 0 12px rgba(239,68,68,0.25);
}
.risk-pill.high .dot { background: var(--color-semantic-danger); box-shadow: 0 0 8px var(--color-semantic-danger); }
.risk-pill.medium {
  background: rgba(245,158,11,0.15);
  color: #FCD34D;
  box-shadow: inset 0 0 0 1px rgba(245,158,11,0.4), 0 0 12px rgba(245,158,11,0.20);
}
.risk-pill.medium .dot { background: var(--color-semantic-caution); box-shadow: 0 0 8px var(--color-semantic-caution); }
.risk-pill.low {
  background: rgba(34,197,94,0.12);
  color: #86EFAC;
  box-shadow: inset 0 0 0 1px rgba(34,197,94,0.35);
}
.risk-pill.low .dot { background: var(--color-semantic-safe); }

/* H/M/L compact code badges (for notification list) */
.risk-code {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 26px; height: 18px; padding: 0 6px;
  border-radius: 4px;
  font: 700 0.65rem/1 var(--font-mono);
  letter-spacing: 0.04em;
}
.risk-code.h { background: var(--color-semantic-danger); color: #fff; box-shadow: 0 0 10px rgba(239,68,68,0.5); }
.risk-code.m { background: var(--color-semantic-caution); color: #1C1917; box-shadow: 0 0 10px rgba(245,158,11,0.4); }
.risk-code.l { background: var(--color-semantic-safe); color: #052E16; }

/* Status tags (新案件 / 狀態更新 / 環境變化 / 週報摘要) */
.status-tag {
  display: inline-flex; align-items: center;
  height: 22px; padding: 0 10px;
  border-radius: 6px;
  font: 600 0.7rem/1 var(--font-body);
  background: rgba(54,242,133,0.12);
  color: var(--color-brand-cyan-pulse);
  border: 1px solid rgba(54,242,133,0.25);
}
.status-tag.update   { background: rgba(54,242,133,0.10); color: var(--color-brand-cyan-pulse); border-color: rgba(54,242,133,0.25); }
.status-tag.env      { background: rgba(167,139,250,0.10); color: var(--color-violet-pulse); border-color: rgba(167,139,250,0.30); }
.status-tag.summary  { background: rgba(167,139,250,0.10); color: var(--color-violet-pulse); border-color: rgba(167,139,250,0.30); }
.status-tag.case     { background: rgba(54,242,133,0.12); color: var(--color-brand-cyan-pulse); border-color: rgba(54,242,133,0.30); }

/* Platform badges (real platform colors) */
.platform {
  display: inline-flex; align-items: center; justify-content: center;
  height: 24px; padding: 0 12px;
  border-radius: 999px;
  font: 600 0.75rem/1 var(--font-body);
  color: #fff;
  letter-spacing: 0.01em;
}
.platform.instagram { background: linear-gradient(135deg, #F58529 0%, #DD2A7B 50%, #8134AF 100%); }
.platform.facebook  { background: #1877F2; }
.platform.threads   { background: #0F0F0F; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.2); }
.platform.line      { background: #06C755; }

/* Tab bar */
.tabs {
  display: flex; flex-wrap: wrap; gap: var(--spacing-1);
  border-bottom: 1px solid var(--color-border-subtle);
  margin-bottom: var(--spacing-6);
}
.tab {
  display: inline-flex; align-items: center; gap: 8px;
  padding: var(--spacing-3) var(--spacing-4);
  font: 500 0.95rem/1 var(--font-body);
  color: var(--color-text-secondary);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all var(--motion-fast) var(--motion-out);
}
.tab .count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 999px;
  background: var(--color-surface-raised);
  color: var(--color-text-secondary);
  font-size: 0.7rem; font-weight: 600;
}
.tab.active {
  color: var(--color-text-primary);
  border-bottom-color: var(--color-brand-cyan);
}
.tab.active .count { background: var(--color-semantic-danger); color: #fff; }
.tab:hover { color: var(--color-text-primary); }

/* ===========================================================
   Site footer — rich, consistent across all pages
   =========================================================== */
.site-footer {
  position: relative;
  margin-top: var(--spacing-20);
  padding: var(--spacing-12) var(--spacing-8) var(--spacing-6);
  background: rgba(11,21,48,0.5);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--color-border-subtle);
}
.site-footer .footer-inner {
  max-width: 1200px;
  margin: 0 auto;
}

/* Top row: brand block on the left, brand-guideline button on the right */
.site-footer .footer-top {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--spacing-8);
  flex-wrap: wrap;
  padding-bottom: var(--spacing-8);
  border-bottom: 1px solid var(--color-border-subtle);
}
.site-footer .footer-brand .brand-lockup {
  display: inline-flex; align-items: center;
  text-decoration: none;
  height: 28px;
  margin-bottom: var(--spacing-3);
}
.site-footer .footer-brand .brand-lockup .logo {
  height: 22px;
  width: auto;
  display: block;
}
.site-footer .footer-brand .brand-lockup .shield-mini {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--color-violet-pulse), var(--color-heritage-purple));
  display: grid; place-items: center;
  box-shadow: 0 4px 14px rgba(0,123,180,0.4);
}
.site-footer .footer-brand .brand-lockup .shield-mini svg { width: 16px; height: 16px; color: #fff; }
.site-footer .footer-brand .brand-lockup .lite { color: var(--color-brand-cyan); }
.site-footer .footer-brand .slogan {
  font: 600 0.95rem var(--font-heading);
  background: linear-gradient(90deg, var(--color-brand-cyan), var(--color-violet-pulse));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-top: 6px;
}

/* Brand Guideline button — pill, prominent */
.brand-guideline-btn {
  display: inline-flex; align-items: center; gap: 12px;
  padding: 14px 22px;
  border-radius: 999px;
  background: rgba(54,242,133,0.06);
  border: 1px solid rgba(54,242,133,0.5);
  color: var(--color-brand-cyan);
  text-decoration: none;
  font: 700 0.875rem var(--font-body);
  letter-spacing: 0.02em;
  transition: all var(--motion-default) var(--motion-out);
  white-space: nowrap;
  flex-shrink: 0;
}
.brand-guideline-btn:hover {
  background: linear-gradient(135deg, var(--color-brand-cyan-pulse), var(--color-brand-cyan));
  color: var(--color-text-on-cyan);
  border-color: transparent;
  box-shadow: 0 8px 28px rgba(54,242,133,0.4);
  transform: translateY(-1px);
}
.brand-guideline-btn .label-eyebrow {
  display: block;
  font: 500 0.65rem var(--font-mono);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--color-text-tertiary);
  margin-bottom: 2px;
  transition: color var(--motion-fast) var(--motion-out);
}
.brand-guideline-btn:hover .label-eyebrow { color: rgba(11,21,48,0.7); }
.brand-guideline-btn .arrow-circle {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--color-brand-cyan);
  color: var(--color-text-on-cyan);
  display: grid; place-items: center;
  flex-shrink: 0;
  transition: all var(--motion-default) var(--motion-out);
}
.brand-guideline-btn:hover .arrow-circle {
  background: var(--color-text-on-cyan);
  color: var(--color-brand-cyan);
  transform: rotate(45deg);
}
.brand-guideline-btn .arrow-circle svg { width: 14px; height: 14px; }

/* Middle row: link columns */
.site-footer .footer-cols {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: var(--spacing-8);
  padding: var(--spacing-8) 0;
  border-bottom: 1px solid var(--color-border-subtle);
}
.site-footer .footer-col h5 {
  font: 600 0.7rem var(--font-mono);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--color-text-tertiary);
  margin-bottom: var(--spacing-4);
}
.site-footer .footer-col p {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  line-height: 1.7;
  max-width: 22rem;
}
.site-footer .footer-col ul {
  list-style: none;
  padding: 0; margin: 0;
  display: flex; flex-direction: column;
  gap: var(--spacing-2);
}
.site-footer .footer-col a {
  color: var(--color-text-secondary);
  font: 500 0.875rem var(--font-body);
  text-decoration: none;
  transition: color var(--motion-fast) var(--motion-out);
}
.site-footer .footer-col a:hover { color: var(--color-text-primary); }
.site-footer .footer-col a.external::after {
  content: " ↗";
  color: var(--color-text-tertiary);
  font-size: 0.7em;
}

/* Bottom row: legal line */
.site-footer .footer-bottom {
  padding-top: var(--spacing-5);
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--spacing-3);
  flex-wrap: wrap;
  font: 500 0.75rem var(--font-mono);
  letter-spacing: 0.04em;
  color: var(--color-text-tertiary);
}
.site-footer .footer-bottom .copy { letter-spacing: 0.08em; }
.site-footer .footer-bottom strong { color: var(--color-text-secondary); font-weight: 600; }
.site-footer .footer-bottom .legal-links { display: flex; gap: var(--spacing-4); }
.site-footer .footer-bottom .legal-links a {
  color: var(--color-text-tertiary);
  text-decoration: none;
  transition: color var(--motion-fast) var(--motion-out);
}
.site-footer .footer-bottom .legal-links a:hover { color: var(--color-text-secondary); }

@media (max-width: 768px) {
  .site-footer { padding: var(--spacing-10) var(--spacing-5) var(--spacing-5); }
  .site-footer .footer-top { flex-direction: column; gap: var(--spacing-5); }
  .site-footer .footer-cols { grid-template-columns: 1fr 1fr; }
  .site-footer .footer-bottom { flex-direction: column; align-items: flex-start; }
}

/* ===========================================================
   Reduced motion
   =========================================================== */
@media (prefers-reduced-motion: reduce) {
  .galaxy::before, .galaxy::after, .edge-planet { animation: none !important; }
}

/* ===========================================================
   Responsive
   =========================================================== */
@media (max-width: 768px) {
  .nav { display: none; }
  .topbar .container { justify-content: space-between; }
  .container, .container-narrow { padding: var(--spacing-8) var(--spacing-5); }
  .page-header h1 { font-size: 1.7rem; }
  .edge-planet.p1 { width: 130px; height: 130px; }
  .edge-planet.p3 { width: 90px; height: 90px; }
}
