/* ═══════════════════════════════════════════════════════════════
   RULETWIN — PREMIUM DESIGN SYSTEM
   Palette: Warm Cream / Soft Beige / Deep Magenta
   ═══════════════════════════════════════════════════════════════ */

:root {
  /* ── Dashboard (Light Cream/Beige) ── */
  --bg-page:        #f7f3ed;   /* warm cream — main page */
  --bg-surface:     #f2ece3;   /* soft beige — slightly deeper */
  --bg-card:        #fdfaf6;   /* lightest cream — card face */
  --bg-card-hover:  #f5f0e8;   /* warm hover state */
  --bg-raised:      #ede7dc;   /* muted sand — raised elements */

  /* ── Hero (Beige Minimalist Aesthetic) ── */
  --hero-bg:        #fdfbf7;   /* lighter, warmer cream */
  --hero-bg-mid:    #f4efe6;   /* slightly deeper beige */

  /* ── Borders (Warm Toned) ── */
  --border-subtle:  rgba(140,100,70,0.10);
  --border-soft:    rgba(140,100,70,0.17);
  --border-medium:  rgba(140,100,70,0.26);
  --border-strong:  rgba(140,100,70,0.42);

  /* ── Accent — Deep Rich Red ── */
  --accent:         #8b0000;   /* deep rich red */
  --accent-bright:  #a10000;   /* slightly brighter red */
  --accent-dark:    #5c0000;   /* deep wine */
  --accent-soft:    rgba(139,0,0,0.12);
  --accent-glow:    rgba(139,0,0,0.22);

  /* ── Text (On Cream / Light) ── */
  --text-primary:   #1c1410;   /* near-black warm */
  --text-secondary: #4a3a2e;   /* dark warm brown */
  --text-muted:     #8c7868;   /* warm gray-brown */
  --text-faint:     #b8a898;   /* light warm gray */
  --text-accent:    #a10000;   /* deep red */

  /* ── Hero Text (On Beige) ── */
  --hero-text:      #1c1410;   /* very dark warm brown */
  --hero-text-muted:#8c7868;   /* warm gray-brown */

  /* ── Status Colors ── */
  --danger:         #d32f2f;
  --danger-soft:    rgba(211,47,47,0.1);
  --success:        #2e7d5a;
  --success-soft:   rgba(46,125,90,0.1);
  --warning:        #c07d1a;
  --warning-soft:   rgba(192,125,26,0.1);
  --blue:           #1565c0;

  /* ── Shadows (Pinterest Aesthetic: soft, large blur, tinted) ── */
  --shadow-sm:      0 4px 14px rgba(60,30,10,0.06);
  --shadow-md:      0 12px 36px rgba(60,30,10,0.08);
  --shadow-lg:      0 24px 64px rgba(60,30,10,0.12);
  --shadow-accent:  0 12px 40px rgba(139,0,0,0.25);

  /* ── Typography ── */
  --font-display:   'Outfit', ui-sans-serif, system-ui, sans-serif;
  --font-body:      'Inter', ui-sans-serif, system-ui, sans-serif;
  --font-mono:      'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;

  /* ── Transitions ── */
  --ease-out:       cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring:    cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-smooth:    cubic-bezier(0.4, 0, 0.2, 1);
  --duration-fast:  120ms;
  --duration-base:  220ms;
  --duration-slow:  400ms;

  color-scheme: light;
  font-family: var(--font-body);
}

/* ─── Reset ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { min-width: 320px; scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
body {
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  background: var(--bg-page);
  color: var(--text-primary);
  overflow-x: hidden;
}
h1, h2, h3, h4 { font-family: var(--font-display); margin: 0; }
p { margin: 0; }
button, select, input { font: inherit; }
button { cursor: pointer; border: none; background: none; }
button:disabled { cursor: wait; opacity: 0.5; }
a { text-decoration: none; color: inherit; }
code, pre { font-family: var(--font-mono); }

button:focus-visible,
select:focus-visible,
input:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ─── Skip link ──────────────────────────────────────────────────── */
.skip-link {
  position: fixed; z-index: 1000; top: 12px; left: 12px;
  background: var(--accent); color: #fff; padding: 10px 16px;
  border-radius: 8px; font-weight: 600; font-size: 13px;
  transform: translateY(-200%);
  transition: transform var(--duration-base) var(--ease-out);
}
.skip-link:focus { transform: translateY(0); }

/* ═══════════════════════════════════════════════════════════════
   CUSTOM CURSOR
   ═══════════════════════════════════════════════════════════════ */
#cursor { position: fixed; top: 0; left: 0; z-index: 9999; pointer-events: none; }
#cursor-dot {
  position: absolute; width: 6px; height: 6px;
  background: var(--accent); border-radius: 50%;
  transform: translate(-50%, -50%);
}
#cursor-ring {
  position: absolute; width: 36px; height: 36px;
  border: 1.5px solid rgba(161,0,0,0.5); border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 200ms var(--ease-out), height 200ms var(--ease-out);
}
body.cursor-hover #cursor-ring { width: 52px; height: 52px; }
body.cursor-click #cursor-dot { transform: translate(-50%, -50%) scale(1.8); }

/* ═══════════════════════════════════════════════════════════════
   TOP NAVIGATION
   ═══════════════════════════════════════════════════════════════ */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: center; gap: 20px;
  height: 64px; padding: 0 40px;
  background: rgba(247,243,237,0.88);
  border-bottom: 1px solid var(--border-subtle);
  backdrop-filter: blur(24px) saturate(1.8);
  -webkit-backdrop-filter: blur(24px) saturate(1.8);
  transition: background var(--duration-slow);
}
.topbar.scrolled {
  background: rgba(247,243,237,0.97);
  border-bottom-color: var(--border-soft);
  box-shadow: var(--shadow-sm);
}

/* When topbar is on the beige hero */
.topbar.on-hero {
  background: rgba(253, 251, 247, 0.4);
  border-bottom-color: rgba(140,100,70,0.1);
}
.topbar.on-hero .brand-text { color: var(--hero-text); }
.topbar.on-hero .tnav { color: var(--hero-text-muted); }
.topbar.on-hero .tnav.active { color: var(--hero-text); }
.topbar.on-hero .brand-text { color: var(--text-primary); }

.brand {
  display: flex; align-items: center; gap: 11px;
  font-family: var(--font-display); font-weight: 700; font-size: 17px;
  color: var(--text-primary); letter-spacing: -0.02em;
}
.brand-icon {
  display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--accent); color: #fff;
  font-family: var(--font-display); font-weight: 800; font-size: 16px;
  box-shadow: 0 0 20px rgba(161,0,0,0.3);
  transition: box-shadow var(--duration-base);
  flex-shrink: 0;
}
.brand:hover .brand-icon { box-shadow: 0 0 32px rgba(161,0,0,0.5); }

.topbar-nav { display: flex; gap: 2px; }
.tnav {
  padding: 6px 14px; border-radius: 8px;
  font-size: 13.5px; font-weight: 500; color: var(--text-muted);
  transition: color var(--duration-fast), background var(--duration-fast);
}
.tnav:hover { color: var(--text-secondary); background: var(--bg-raised); }
.tnav.active { color: var(--text-primary); background: var(--bg-raised); font-weight: 600; }

.topbar-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.version-badge {
  padding: 4px 12px; border-radius: 100px;
  border: 1px solid var(--border-soft); background: var(--bg-raised);
  font-size: 11px; font-family: var(--font-mono); color: var(--text-muted);
}

/* ═══════════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════════ */
.btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 22px; border-radius: 10px;
  background: var(--accent); color: #fff;
  font-weight: 600; font-size: 13.5px; letter-spacing: -0.01em;
  border: 1px solid rgba(0,0,0,0.08);
  box-shadow: 0 2px 12px rgba(161,0,0,0.25);
  transition: transform var(--duration-fast) var(--ease-spring),
              box-shadow var(--duration-base),
              background var(--duration-fast);
  min-height: 40px;
}
.btn-primary:hover {
  background: var(--accent-bright); transform: translateY(-2px);
  box-shadow: 0 4px 24px rgba(161,0,0,0.4);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 22px; border-radius: 10px;
  background: var(--bg-card); color: var(--text-secondary);
  font-weight: 500; font-size: 13.5px;
  border: 1px solid var(--border-medium);
  min-height: 40px;
  transition: transform var(--duration-fast) var(--ease-spring),
              background var(--duration-fast), color var(--duration-fast);
}
.btn-secondary:hover {
  transform: translateY(-2px); background: var(--bg-surface);
  color: var(--text-primary); border-color: var(--border-strong);
}

.btn-ghost {
  padding: 8px 14px; border-radius: 8px;
  color: var(--text-muted); font-size: 13px; font-weight: 500;
  transition: color var(--duration-fast), background var(--duration-fast);
}
.btn-ghost:hover { color: var(--text-secondary); background: var(--bg-raised); }

.btn-danger {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 22px; border-radius: 10px;
  background: var(--danger-soft); color: var(--danger);
  font-weight: 500; font-size: 13.5px;
  border: 1px solid rgba(211,47,47,0.25);
  min-height: 40px;
  transition: background var(--duration-fast), transform var(--duration-fast) var(--ease-spring);
}
.btn-danger:hover { background: rgba(211,47,47,0.16); transform: translateY(-1px); }
.btn-full { width: 100%; justify-content: center; }

/* Judge trigger button (on beige hero) */
.btn-judge {
  display: inline-flex; align-items: center; gap: 14px;
  padding: 16px 32px; border-radius: 100px; /* Pinterest pill */
  background: var(--bg-card); /* beige */
  border: 1px solid var(--border-soft);
  color: var(--text-primary); font-size: 16px; font-weight: 600;
  font-family: var(--font-display);
  position: relative; overflow: hidden;
  box-shadow: 0 4px 20px rgba(122, 0, 22, 0.15);
  transition: transform var(--duration-base) var(--ease-spring),
              border-color var(--duration-base),
              background var(--duration-base),
              box-shadow var(--duration-base);
  min-height: 56px;
}
.btn-judge::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(122, 0, 22, 0.12), transparent 60%);
  opacity: 0; transition: opacity var(--duration-base);
}
.btn-judge:hover {
  transform: translateY(-4px);
  border-color: rgba(122, 0, 22, 0.4);
  background: #fff;
  box-shadow: 0 10px 30px rgba(122, 0, 22, 0.2);
}
.btn-judge:hover::before { opacity: 1; }
.btn-judge-icon {
  display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 12px;
  box-shadow: 0 0 20px rgba(122, 0, 22, 0.5); flex-shrink: 0;
  transition: box-shadow var(--duration-base);
}
.btn-judge:hover .btn-judge-icon { box-shadow: 0 0 32px rgba(122, 0, 22, 0.75); }
.btn-judge-time {
  margin-left: auto; padding: 2px 8px; border-radius: 100px;
  background: rgba(122, 0, 22, 0.08); border: 1px solid rgba(122, 0, 22, 0.15);
  color: var(--accent); font-size: 11px; font-family: var(--font-mono);
}

/* ═══════════════════════════════════════════════════════════════
   HERO SECTION (Split Layout)
   ═══════════════════════════════════════════════════════════════ */
.hero-section {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  background: var(--hero-bg);
  overflow: hidden;
  padding: 0 5%;
}

.hero-visual {
  position: absolute;
  top: 0; right: 0;
  width: 55vw;
  height: 100vh;
  z-index: 1;
  pointer-events: none;
}

#hero-canvas {
  width: 100%; height: 100%;
  display: block;
}

.hero-content {
  position: relative; z-index: 2; /* above overlay */
  width: 50%;
  max-width: 700px;
  padding: 128px 0px 100px;
  display: flex; flex-direction: column; gap: 28px;
}

.hero-eyebrow {
  display: flex; align-items: center; gap: 10px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.22em;
  color: var(--hero-text-muted); text-transform: uppercase;
}
.eyebrow-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 14px var(--accent);
  animation: pulse-dot 2.2s infinite;
  flex-shrink: 0;
}
@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 8px var(--accent), 0 0 0 0 rgba(161,0,0,0); }
  50% { box-shadow: 0 0 20px var(--accent), 0 0 0 6px rgba(161,0,0,0); }
}

.hero-headline {
  display: flex; flex-direction: column;
  font-family: var(--font-display);
  font-size: clamp(52px, 7.5vw, 88px);
  font-weight: 800; letter-spacing: -0.04em;
  line-height: 0.96;
  color: var(--hero-text);
}
.headline-line { display: block; }
.headline-line.accent {
  color: var(--accent);
  text-shadow: 0 0 60px rgba(161,0,0,0.35);
}

.hero-subtext {
  max-width: 480px; font-size: 17px; line-height: 1.65;
  color: var(--hero-text-muted); font-weight: 400;
}

.hero-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; }

.hero-stats {
  display: flex; align-items: center; padding-top: 24px;
  border-top: 1px solid rgba(0,0,0,0.06);
}
.hstat { padding: 0 32px; }
.hstat:first-child { padding-left: 0; }
.hstat strong {
  display: block; font-family: var(--font-display); font-size: 34px;
  font-weight: 700; color: var(--hero-text); letter-spacing: -0.03em;
}
.hstat span { display: block; font-size: 12px; color: var(--hero-text-muted); margin-top: 3px; }
.hstat-divider { width: 1px; height: 40px; background: rgba(0,0,0,0.08); flex-shrink: 0; }

.hero-scroll-hint {
  position: absolute; bottom: 36px; left: 72px; z-index: 2;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  color: var(--text-faint); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase;
}
.scroll-line {
  width: 1px; height: 44px;
  background: linear-gradient(to bottom, transparent, rgba(161,0,0,0.6));
  animation: scroll-line-anim 2.5s infinite;
}
@keyframes scroll-line-anim {
  0% { transform: scaleY(0); transform-origin: top; opacity: 0; }
  30% { opacity: 1; }
  50% { transform: scaleY(1); transform-origin: top; opacity: 1; }
  70% { transform: scaleY(1); transform-origin: bottom; opacity: 1; }
  100% { transform: scaleY(0); transform-origin: bottom; opacity: 0; }
}

/* ═══════════════════════════════════════════════════════════════
   JUDGE MODE OVERLAY
   ═══════════════════════════════════════════════════════════════ */
.judge-mode {
  position: fixed; inset: 0; z-index: 500;
  background: var(--hero-bg);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 500ms var(--ease-smooth);
}
.judge-mode.active { opacity: 1; }
#judge-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.judge-text {
  position: absolute; z-index: 10;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  font-family: var(--font-display);
  font-size: clamp(26px, 4vw, 52px);
  font-weight: 700; letter-spacing: -0.03em;
  color: var(--hero-text);
  line-height: 1.2; max-width: 680px;
  pointer-events: none;
  transition: opacity 450ms ease;
  /* Strong white/cream glow to ensure dark text is readable over dark red 3D elements */
  text-shadow: 
    0 0 20px rgba(253,251,247,0.9),
    0 0 40px rgba(253,251,247,0.95),
    0 0 80px rgba(253,251,247,1);
}

.judge-stats {
  position: absolute; z-index: 10;
  bottom: 110px; left: 50%;
  transform: translateX(-50%);
  display: flex; gap: 60px;
  transition: opacity 500ms ease;
}
.judge-stat { text-align: center; }
.jstat-number {
  display: block; font-family: var(--font-display); font-size: 56px;
  font-weight: 800; color: var(--hero-text); letter-spacing: -0.04em;
  text-shadow: 0 0 30px rgba(253,251,247,0.9), 0 0 60px rgba(253,251,247,1);
}
.jstat-label {
  display: block; font-size: 11px; font-weight: 600; color: var(--hero-text-muted);
  letter-spacing: 0.14em; text-transform: uppercase; margin-top: 4px;
  text-shadow: 0 0 20px rgba(253,251,247,1);
}

.judge-cta {
  position: absolute; z-index: 10;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 20px;
  transition: opacity 800ms ease;
}
.judge-logo {
  display: flex; align-items: center; gap: 14px;
  font-family: var(--font-display); font-size: 30px; font-weight: 800;
  color: var(--hero-text); letter-spacing: -0.03em;
}
.judge-logo-icon {
  display: grid; place-items: center;
  width: 54px; height: 54px; border-radius: 14px;
  background: var(--accent); color: #fff;
  font-size: 24px; font-weight: 800;
  box-shadow: 0 0 48px rgba(161,0,0,0.55);
}
.judge-tagline { font-size: 18px; color: var(--hero-text-muted); font-style: italic; }
.btn-judge-cta {
  padding: 15px 40px; border-radius: 12px;
  background: var(--accent); color: #fff;
  font-size: 16px; font-weight: 600; font-family: var(--font-display);
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 4px 40px rgba(161,0,0,0.4);
  transition: transform var(--duration-base) var(--ease-spring), box-shadow var(--duration-base);
}
.btn-judge-cta:hover { transform: scale(1.05); box-shadow: 0 4px 60px rgba(161,0,0,0.6); }

.judge-skip {
  position: absolute; top: 24px; right: 24px; z-index: 20;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px; border-radius: 100px;
  background: rgba(28,20,16,0.06); color: var(--hero-text-muted);
  font-family: var(--font-mono); font-size: 11px; font-weight: 500;
  transition: background var(--duration-fast), color var(--duration-fast);
}
.judge-skip span {
  font-family: var(--font-mono); font-size: 10px;
  padding: 1px 5px; border-radius: 4px;
  background: rgba(28,20,16,0.08); color: var(--hero-text-muted);
}
.judge-skip:hover { background: rgba(28,20,16,0.12); color: var(--hero-text); }

.judge-progress-bar {
  position: absolute; bottom: 0; left: 0; right: 0;
  height: 2px; background: rgba(28,20,16,0.08); z-index: 20;
}
.judge-progress-fill {
  height: 100%; background: var(--accent); width: 0%;
  box-shadow: 0 0 12px rgba(139,0,0,0.3);
  transition: width 0.4s linear;
}

/* ═══════════════════════════════════════════════════════════════
   DASHBOARD (Light Cream/Beige)
   ═══════════════════════════════════════════════════════════════ */
.dashboard-section {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 100vh;
  padding-top: 64px;
  background: var(--bg-page);
}

/* ─── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
  position: sticky; top: 64px;
  height: calc(100vh - 64px);
  display: flex; flex-direction: column;
  border-right: 1px solid var(--border-soft);
  background: var(--bg-surface);
  padding: 28px 14px;
  overflow-y: auto;
}
.sidebar-top { flex: 1; }
.sidebar-label {
  font-size: 10px; font-weight: 700; letter-spacing: 0.2em;
  color: var(--text-faint); text-transform: uppercase;
  padding: 0 10px; margin-bottom: 10px;
}
.sidebar-nav { display: flex; flex-direction: column; gap: 3px; }
.snav {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: 10px;
  color: var(--text-muted); font-size: 13.5px; font-weight: 500;
  text-align: left; width: 100%;
  transition: background var(--duration-fast), color var(--duration-fast), transform var(--duration-fast) var(--ease-spring);
}
.snav:hover { background: var(--bg-raised); color: var(--text-secondary); transform: translateX(2px); }
.snav.active {
  background: var(--bg-card); color: var(--text-primary);
  border-left: 2.5px solid var(--accent); padding-left: 10px;
  box-shadow: var(--shadow-sm);
}
.snav-num {
  font-family: var(--font-mono); font-size: 10px; color: var(--text-faint); letter-spacing: 0.05em;
}
.snav.active .snav-num { color: var(--accent); }
.snav-name { font-weight: 600; }

.sidebar-contract {
  margin-top: auto; padding: 16px; border-radius: 12px;
  border: 1px solid var(--border-soft); background: var(--bg-card);
}
.sidebar-contract .sidebar-label { padding: 0; margin-bottom: 8px; }
.sidebar-contract strong {
  display: block; font-size: 13px; color: var(--text-primary); margin-bottom: 5px;
}
.sidebar-contract span { display: block; font-size: 11px; color: var(--text-muted); line-height: 1.55; }

/* ─── Main Content ────────────────────────────────────────────── */
.dashboard-main { padding: 40px 48px; min-width: 0; }
.view { outline: none; }
.view.active { animation: view-in 280ms var(--ease-out) both; }
@keyframes view-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── View Header ─────────────────────────────────────────────── */
.view-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 24px; margin-bottom: 36px; padding-bottom: 28px;
  border-bottom: 1px solid var(--border-subtle);
}
.eyebrow-text {
  display: block; font-size: 10px; font-weight: 700;
  letter-spacing: 0.22em; color: var(--accent); text-transform: uppercase; margin-bottom: 10px;
}
.view-title {
  font-family: var(--font-display);
  font-size: clamp(26px, 3.5vw, 42px);
  font-weight: 800; letter-spacing: -0.04em; line-height: 1.05;
  color: var(--text-primary); margin-bottom: 10px;
}
.view-sub { font-size: 14px; color: var(--text-muted); line-height: 1.6; max-width: 580px; }
.view-actions { display: flex; gap: 10px; align-items: center; flex-shrink: 0; }

/* ═══════════════════════════════════════════════════════════════
   BUILDER / GRAPH
   ═══════════════════════════════════════════════════════════════ */
.builder-grid {
  display: grid;
  grid-template-columns: minmax(580px, 1fr) 300px;
  gap: 18px;
}
.canvas-card {
  border: 1px solid var(--border-soft); border-radius: 18px;
  background: var(--bg-card); box-shadow: var(--shadow-md); overflow: hidden;
}
.canvas-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 18px; height: 50px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 12px; font-weight: 600; color: var(--text-primary);
}
.toolbar-left { display: flex; align-items: center; gap: 10px; }
.toolbar-help { color: var(--text-faint); font-weight: 400; font-size: 11.5px; }

.status-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); flex-shrink: 0;
}
.status-dot.good { background: var(--success); box-shadow: 0 0 0 4px var(--success-soft); }
.status-dot.danger { background: var(--danger); box-shadow: 0 0 0 4px var(--danger-soft); }

#graph {
  width: 100%; height: 520px; display: block; touch-action: none;
  background:
    radial-gradient(circle, var(--border-subtle) 1px, transparent 1px);
  background-size: 22px 22px;
  background-position: 11px 11px;
  background-color: var(--bg-surface);
}

.canvas-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; height: 40px;
  border-top: 1px solid var(--border-subtle);
  font-family: var(--font-mono); font-size: 10px; color: var(--text-faint);
}

/* SVG Graph */
.node { cursor: grab; }
.node:active { cursor: grabbing; }
.node rect {
  fill: var(--bg-card); stroke: var(--border-medium); stroke-width: 1.5;
  filter: drop-shadow(0 4px 12px rgba(60,30,10,0.12));
}
.node.danger rect { fill: var(--danger-soft); stroke: var(--danger); stroke-width: 2; }
.node.good rect { stroke: var(--success); }
.node.selected rect { stroke: var(--accent); stroke-width: 2.5; filter: drop-shadow(0 0 10px rgba(161,0,0,0.2)); }
.node text.kind {
  fill: var(--text-faint); font: 9px var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase;
}
.node text.title { fill: var(--text-primary); font: 600 12px var(--font-body); }
.node text.value { fill: var(--text-muted); font: 10.5px var(--font-body); }
.edge { fill: none; stroke: var(--border-medium); stroke-width: 2; }
.edge.hot { stroke: var(--danger); stroke-width: 2.5; }
.port { fill: var(--bg-page); stroke: var(--border-strong); stroke-width: 1.5; }

/* Inspector */
.inspector-card {
  border: 1px solid var(--border-soft); border-radius: 18px;
  background: var(--bg-card); box-shadow: var(--shadow-md); overflow: hidden;
  display: flex; flex-direction: column;
}
.inspector-tabs {
  display: grid; grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--border-subtle); flex-shrink: 0;
}
.itab {
  padding: 14px; border-bottom: 2px solid transparent;
  font-size: 12px; font-weight: 600; color: var(--text-muted);
  transition: color var(--duration-fast), border-color var(--duration-fast);
}
.itab.active { border-bottom-color: var(--accent); color: var(--text-primary); }
.itab:hover:not(.active) { color: var(--text-secondary); }
.itab-panel { flex: 1; overflow-y: auto; }

.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 360px; padding: 32px; text-align: center; color: var(--text-muted);
}
.empty-icon { font-size: 38px; color: var(--accent); margin-bottom: 16px; opacity: 0.5; }
.empty-state h2 { font-size: 15px; color: var(--text-secondary); margin-bottom: 10px; }
.empty-state p { font-size: 12.5px; color: var(--text-muted); line-height: 1.65; max-width: 220px; }

.configure-panel { padding: 24px; }
.configure-panel h2 { font-size: 16px; color: var(--text-primary); margin: 10px 0 6px; }
.configure-panel p { font-size: 12.5px; color: var(--text-muted); line-height: 1.65; }
.configure-panel label, .dataset-bar label {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--text-secondary); margin: 18px 0 7px;
}
.helper-text { margin-top: 12px !important; color: var(--text-faint) !important; font-size: 11px !important; }

select, input[type="file"] {
  width: 100%; background: var(--bg-surface);
  border: 1px solid var(--border-medium); border-radius: 8px;
  padding: 9px 12px; color: var(--text-primary); font-size: 13px;
  transition: border-color var(--duration-fast);
}
select:focus, input[type="file"]:focus { border-color: var(--accent); }

.findings-list { padding: 12px; }
.finding {
  margin-bottom: 10px; border: 1px solid rgba(192,125,26,0.3);
  border-radius: 12px; background: var(--warning-soft); padding: 14px;
}
.finding.error { border-color: rgba(211,47,47,0.3); background: var(--danger-soft); }
.finding h2 { font-size: 13px; color: var(--text-primary); margin-bottom: 5px; }
.finding p { font-size: 11.5px; color: var(--text-muted); line-height: 1.6; }
.finding code { font-size: 9.5px; color: var(--warning); font-family: var(--font-mono); display: block; margin-top: 8px; }
.finding small { display: block; margin-top: 8px; color: var(--text-muted); font-size: 10.5px; }

/* ═══════════════════════════════════════════════════════════════
   SIMULATION
   ═══════════════════════════════════════════════════════════════ */
.dataset-bar {
  display: grid; grid-template-columns: 1fr 1fr minmax(200px, 1fr);
  align-items: end; gap: 16px; margin-bottom: 20px; padding: 18px 20px;
  border: 1px solid var(--border-soft); border-radius: 16px; background: var(--bg-card);
}
.dataset-field { display: flex; flex-direction: column; }
.dataset-bar label { margin-top: 0 !important; }
.dataset-msg { font-size: 12px; color: var(--text-muted); line-height: 1.55; }

.sim-grid {
  display: grid; grid-template-columns: minmax(520px, 1.6fr) 340px; gap: 18px;
}
.run-card {
  border: 1px solid var(--border-soft); border-radius: 18px;
  background: var(--bg-card); padding: 24px; box-shadow: var(--shadow-md);
}
.run-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.run-status-group { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; }
.run-id { font-family: var(--font-mono); font-size: 10px; color: var(--text-faint); }

.ring-wrapper {
  position: relative; width: 180px; height: 180px; margin: 20px auto;
}
.ring-svg { transform: rotate(-90deg); width: 100%; height: 100%; }
.ring-track { fill: none; stroke: var(--bg-raised); stroke-width: 8; }
.ring-progress {
  fill: none; stroke: var(--accent); stroke-width: 8; stroke-linecap: round;
  stroke-dasharray: 314; stroke-dashoffset: 314;
  transition: stroke-dashoffset 300ms var(--ease-smooth);
}
.ring-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.ring-center strong { font-family: var(--font-display); font-size: 32px; font-weight: 700; color: var(--text-primary); }
.ring-center span { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.shards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.shard {
  border: 1px solid var(--border-soft); border-radius: 10px;
  padding: 10px; color: var(--text-faint); font-size: 10.5px; background: var(--bg-surface);
}
.shard b, .shard span { display: block; }
.shard span { margin-top: 4px; font-size: 10px; }
.shard.active { border-color: var(--blue); color: var(--blue); background: rgba(21,101,192,0.06); }
.shard.retry { border-color: var(--warning); color: var(--warning); background: var(--warning-soft); }
.shard.complete { border-color: var(--success); color: var(--success); background: var(--success-soft); }
.shard.failed { border-color: var(--danger); color: var(--danger); background: var(--danger-soft); }

.stream {
  height: 160px; overflow-y: auto;
  border: 1px solid var(--border-subtle); border-radius: 10px;
  background: var(--bg-surface); padding: 12px;
  font-family: var(--font-mono); font-size: 10px; line-height: 1.8; color: var(--text-muted);
}
.stream div {
  display: grid; grid-template-columns: 68px 1fr; gap: 10px;
  border-bottom: 1px solid var(--border-subtle); padding: 3px 0;
}
.stream small { grid-column: 2; color: var(--warning); }

.metric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-content: start; }
.metric-card {
  border: 1px solid var(--border-soft); border-radius: 16px;
  background: var(--bg-card); padding: 20px; box-shadow: var(--shadow-sm);
}
.metric-card.big { grid-column: 1 / -1; min-height: 150px; }
.metric-label { display: block; font-size: 11px; font-weight: 600; color: var(--text-faint); letter-spacing: 0.06em; text-transform: uppercase; }
.metric-big {
  display: block; font-family: var(--font-display); font-size: 54px;
  font-weight: 800; letter-spacing: -0.04em; color: var(--text-primary); margin: 12px 0 6px;
}
.metric-num {
  display: block; font-family: var(--font-display); font-size: 34px;
  font-weight: 700; letter-spacing: -0.03em; color: var(--text-primary); margin: 10px 0 6px;
}
.metric-sub { font-size: 11px; color: var(--text-muted); line-height: 1.5; }

/* ═══════════════════════════════════════════════════════════════
   COMPARE
   ═══════════════════════════════════════════════════════════════ */
.compare-hero {
  display: grid; grid-template-columns: 1fr 200px 1fr;
  align-items: center; gap: 16px; margin-bottom: 24px;
}
.stat-card {
  border: 1px solid var(--border-soft); border-radius: 18px;
  background: var(--bg-card); padding: 28px; text-align: center; box-shadow: var(--shadow-md);
}
.stat-card.bad { border-top: 3px solid var(--danger); }
.stat-card.good { border-top: 3px solid var(--success); }
.stat-version { display: block; font-size: 11px; font-weight: 700; letter-spacing: 0.12em; color: var(--text-faint); text-transform: uppercase; margin-bottom: 10px; }
.stat-num {
  display: block; font-family: var(--font-display); font-size: 68px;
  font-weight: 800; letter-spacing: -0.05em; line-height: 1;
  color: var(--text-primary); margin: 8px 0;
}
.stat-sub { font-size: 11px; color: var(--text-muted); }
.compare-delta { text-align: center; padding: 20px; }
.delta-num {
  display: block; font-family: var(--font-display); font-size: 34px;
  font-weight: 800; color: var(--success); letter-spacing: -0.03em;
}
.delta-arrow { display: block; font-size: 20px; color: var(--border-medium); margin: 6px 0; }
.delta-label { font-size: 11px; color: var(--text-muted); }
.compare-grid { display: grid; grid-template-columns: 0.65fr 1.35fr; gap: 16px; }

.chip-group { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.chip {
  padding: 4px 10px; border-radius: 100px;
  border: 1px solid var(--border-soft); background: var(--bg-surface);
  font-family: var(--font-mono); font-size: 10px; color: var(--text-muted); cursor: pointer;
  transition: all var(--duration-fast);
}
.chip:hover, .chip.active { background: var(--accent-soft); border-color: rgba(161,0,0,0.3); color: var(--accent); }

.trace-view {
  padding: 16px; border-radius: 12px;
  background: var(--bg-surface); border: 1px solid var(--border-subtle);
  font-family: var(--font-mono); font-size: 11px; color: var(--text-muted);
  line-height: 1.7; white-space: pre-wrap; word-break: break-word; min-height: 200px;
}

/* ═══════════════════════════════════════════════════════════════
   PANELS & API
   ═══════════════════════════════════════════════════════════════ */
.api-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.panel-card {
  border: 1px solid var(--border-soft); border-radius: 18px;
  background: var(--bg-card); padding: 24px; box-shadow: var(--shadow-md);
}
.panel-card h2 { font-size: 15px; font-weight: 700; color: var(--text-primary); margin-bottom: 16px; }
.panel-card h2 small { font-size: 11px; font-weight: 400; color: var(--text-muted); margin-left: 6px; }
.code-block {
  background: var(--bg-surface); border: 1px solid var(--border-subtle);
  border-radius: 10px; padding: 14px; font-family: var(--font-mono); font-size: 11px;
  color: var(--text-muted); line-height: 1.7; white-space: pre-wrap; word-break: break-word;
  max-height: 300px; overflow-y: auto; margin-bottom: 16px;
}
.api-buttons { display: flex; gap: 10px; flex-wrap: wrap; }
.response-status { font-size: 10px; font-weight: 400; color: var(--text-muted); }
.endpoint-badge {
  font-family: var(--font-mono); font-size: 11px; padding: 6px 14px; border-radius: 100px;
  border: 1px solid var(--border-soft); background: var(--bg-raised); color: var(--text-muted);
}
.reliability-bar {
  display: flex; align-items: center; gap: 16px; padding: 16px 0;
  font-size: 12px; color: var(--text-muted);
}

/* ═══════════════════════════════════════════════════════════════
   ARCHITECTURE
   ═══════════════════════════════════════════════════════════════ */
.compliance-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 20px; }
.compliance-card {
  border: 1px solid var(--border-soft); border-radius: 14px;
  background: var(--bg-card); padding: 20px; box-shadow: var(--shadow-sm);
}
.compliance-card h3 { font-size: 13px; font-weight: 700; color: var(--text-primary); margin-bottom: 8px; }
.compliance-card .pass { color: var(--success); font-size: 11px; font-weight: 700; }
.compliance-card .fail { color: var(--danger); font-size: 11px; font-weight: 700; }

.services-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.service-card {
  border: 1px solid var(--border-soft); border-radius: 12px;
  background: var(--bg-card); padding: 16px;
}
.service-card b { display: block; font-size: 12px; color: var(--text-primary); margin-bottom: 5px; }
.service-card span { display: block; font-size: 10px; color: var(--text-muted); }
.flow-banner {
  padding: 16px 24px; margin-bottom: 20px; border-radius: 12px;
  border: 1px solid var(--border-subtle); background: var(--bg-surface);
  font-family: var(--font-mono); font-size: 11.5px; color: var(--text-muted); text-align: center;
}
.audit-list { display: flex; flex-direction: column; gap: 6px; }
.audit-row {
  display: grid; grid-template-columns: 120px 1fr 100px;
  align-items: center; gap: 12px; padding: 10px 14px;
  border-radius: 10px; border: 1px solid var(--border-subtle); background: var(--bg-surface);
  font-size: 11.5px;
}
.audit-row time { font-family: var(--font-mono); font-size: 10px; color: var(--text-faint); }
.audit-row span { color: var(--text-muted); }
.audit-row code { font-family: var(--font-mono); font-size: 10px; color: var(--text-faint); text-align: right; }

/* Country comparison */
.country-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px solid var(--border-subtle); font-size: 13px;
}
.country-row:last-child { border-bottom: none; }
.country-name { color: var(--text-secondary); font-weight: 500; }
.country-bars { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; flex: 1; margin: 0 12px; }
.country-bar { height: 5px; border-radius: 3px; min-width: 4px; }
.country-bar.v1 { background: var(--danger); opacity: 0.7; }
.country-bar.v2 { background: var(--success); }
.country-pct { font-family: var(--font-mono); font-size: 10px; color: var(--text-faint); width: 36px; text-align: right; flex-shrink: 0; }

/* ═══════════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ═══════════════════════════════════════════════════════════════ */
.toast-container {
  position: fixed; bottom: 24px; right: 24px; z-index: 200;
  display: flex; flex-direction: column; gap: 10px; align-items: flex-end;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px; border-radius: 12px;
  background: var(--text-primary); color: var(--bg-page);
  border: 1px solid rgba(0,0,0,0.08);
  box-shadow: var(--shadow-lg);
  font-size: 13px; font-weight: 500; max-width: 360px;
  animation: toast-in 250ms var(--ease-out) both;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px) scale(0.96); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateX(20px) scale(0.96); }
}
.toast.removing { animation: toast-out 200ms var(--ease-smooth) both; }

/* ═══════════════════════════════════════════════════════════════
   UTILITIES
   ═══════════════════════════════════════════════════════════════ */
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 1100px) {
  .builder-grid, .sim-grid, .compare-grid, .api-grid { grid-template-columns: 1fr; }
  .compare-hero { grid-template-columns: 1fr; gap: 12px; }
  .compliance-grid { grid-template-columns: repeat(2, 1fr); }
  .services-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 800px) {
  .hero-content { padding: 100px 28px 60px; }
  .dashboard-section { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .dashboard-main { padding: 24px 20px; }
  .topbar { padding: 0 20px; }
  .hero-stats { flex-wrap: wrap; }
  .hero-actions { flex-direction: column; align-items: flex-start; }
}

/* ═══════════════════════════════════════════════════════════════
   REDUCED MOTION
   ═══════════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  #cursor { display: none; }
  .hero-scroll-hint { display: none; }
}
