/* ────────────────────────────────────────────────────────────────
   ART DIRECTION: Dark financial dashboard
   Palette: Deep purple accent (#a86fdf / #7a39bb)
   Typography: Instrument Serif (display) + Inter (body)
   Density: Balanced — spacious hero, dense cards
──────────────────────────────────────────────────────────────── */

/* ── Design Tokens ── */
:root {
  /* Type scale */
  --text-xs:   clamp(0.75rem,  0.7rem  + 0.25vw, 0.875rem);
  --text-sm:   clamp(0.875rem, 0.8rem  + 0.35vw, 1rem);
  --text-base: clamp(1rem,     0.95rem + 0.25vw, 1.125rem);
  --text-lg:   clamp(1.125rem, 1rem    + 0.75vw, 1.5rem);
  --text-xl:   clamp(1.5rem,   1.2rem  + 1.25vw, 2.25rem);
  --text-2xl:  clamp(2rem,     1.2rem  + 2.5vw,  3.5rem);
  --text-hero: clamp(2.8rem,   1rem    + 5vw,    5.5rem);

  /* Spacing */
  --space-1: 0.25rem;  --space-2: 0.5rem;  --space-3: 0.75rem;
  --space-4: 1rem;     --space-5: 1.25rem; --space-6: 1.5rem;
  --space-8: 2rem;     --space-10: 2.5rem; --space-12: 3rem;
  --space-16: 4rem;    --space-20: 5rem;   --space-24: 6rem;

  /* Radius */
  --radius-sm: 0.375rem; --radius-md: 0.5rem;
  --radius-lg: 0.75rem;  --radius-xl: 1rem;
  --radius-full: 9999px;

  /* Transitions */
  --transition: 180ms cubic-bezier(0.16, 1, 0.3, 1);

  /* Content widths */
  --content-narrow: 640px;
  --content-default: 1000px;
  --content-wide: 1240px;

  /* Fonts */
  --font-display: 'Instrument Serif', Georgia, serif;
  --font-body: 'Inter', system-ui, sans-serif;
}

/* ── DARK MODE (default) ── */
:root, [data-theme="dark"] {
  --color-bg:             #0f0e0d;
  --color-surface:        #161514;
  --color-surface-2:      #1c1a19;
  --color-surface-offset: #221f1e;
  --color-border:         #312e2c;
  --color-divider:        #252220;

  --color-text:           #e2e0de;
  --color-text-muted:     #7a7774;
  --color-text-faint:     #4a4846;
  --color-text-inverse:   #1a1816;

  /* PURPLE PRIMARY */
  --color-primary:        #a86fdf;
  --color-primary-hover:  #9250d0;
  --color-primary-active: #7537ba;
  --color-primary-highlight: #2a1f3d;
  --color-primary-subtle: rgba(168, 111, 223, 0.12);

  --color-success:        #6daa45;
  --color-success-highlight: #1e2e16;
  --color-error:          #dd6974;
  --color-error-highlight: #2e1a1c;
  --color-gold:           #e8af34;
  --color-gold-highlight: #2a2210;
  --color-blue:           #5591c7;
  --color-blue-highlight: #162033;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.35);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.5);
}

/* ── LIGHT MODE ── */
[data-theme="light"] {
  --color-bg:             #f5f3f0;
  --color-surface:        #faf9f7;
  --color-surface-2:      #ffffff;
  --color-surface-offset: #eeebe7;
  --color-border:         #dbd7d2;
  --color-divider:        #e5e2de;

  --color-text:           #1a1816;
  --color-text-muted:     #6b6764;
  --color-text-faint:     #b0ada9;
  --color-text-inverse:   #faf9f7;

  --color-primary:        #7a39bb;
  --color-primary-hover:  #5f2699;
  --color-primary-active: #431673;
  --color-primary-highlight: #ede4f7;
  --color-primary-subtle: rgba(122, 57, 187, 0.1);

  --color-success:        #437a22;
  --color-success-highlight: #e8f2e0;
  --color-error:          #c23545;
  --color-error-highlight: #fce8ea;
  --color-gold:           #b07a00;
  --color-gold-highlight: #fdf3d0;
  --color-blue:           #2870b5;
  --color-blue-highlight: #deeaf7;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.10);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.14);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --color-bg: #f5f3f0; --color-surface: #faf9f7; --color-surface-2: #ffffff;
    --color-surface-offset: #eeebe7; --color-border: #dbd7d2; --color-divider: #e5e2de;
    --color-text: #1a1816; --color-text-muted: #6b6764; --color-text-faint: #b0ada9;
    --color-text-inverse: #faf9f7;
    --color-primary: #7a39bb; --color-primary-hover: #5f2699; --color-primary-active: #431673;
    --color-primary-highlight: #ede4f7; --color-primary-subtle: rgba(122,57,187,0.1);
    --color-success: #437a22; --color-success-highlight: #e8f2e0;
    --color-error: #c23545; --color-error-highlight: #fce8ea;
    --color-gold: #b07a00; --color-gold-highlight: #fdf3d0;
    --color-blue: #2870b5; --color-blue-highlight: #deeaf7;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08); --shadow-md: 0 4px 16px rgba(0,0,0,0.10);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.14);
  }
}

/* ── Base Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/*
 * FIX: The HTML `hidden` attribute sets display:none, but any explicit
 * CSS `display` rule (e.g. .empty-state { display: flex }) will override it
 * because CSS specificity beats the UA stylesheet. This rule restores the
 * expected behaviour so `hidden` always wins, regardless of component styles.
 */
[hidden] { display: none !important; }

html {
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility; scroll-behavior: smooth;
  scroll-padding-top: var(--space-16);
}
body {
  min-height: 100dvh; line-height: 1.6;
  font-family: var(--font-body); font-size: var(--text-base);
  color: var(--color-text); background-color: var(--color-bg);
}
img, picture, video, canvas, svg { display: block; max-width: 100%; height: auto; }
ul[role="list"], ol[role="list"] { list-style: none; }
input, button, textarea, select { font: inherit; color: inherit; }
h1,h2,h3,h4,h5,h6 { text-wrap: balance; line-height: 1.15; }
p, li, figcaption { text-wrap: pretty; max-width: 72ch; }
::selection { background: var(--color-primary-subtle); color: var(--color-text); }
:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 3px; border-radius: var(--radius-sm); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
button { cursor: pointer; background: none; border: none; }
table { border-collapse: collapse; width: 100%; }
a, button, [role="button"], input, select {
  transition: color var(--transition), background var(--transition),
              border-color var(--transition), box-shadow var(--transition), opacity var(--transition);
}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border-width: 0; }

/* ── Layout Utilities ── */
.container { max-width: var(--content-wide); margin-inline: auto; padding-inline: var(--space-6); }
.section { padding-block: clamp(var(--space-12), 6vw, var(--space-20)); }
.section-alt { background: var(--color-surface); }
.section-header { text-align: center; margin-bottom: var(--space-10); }
.section-header h2 { font-family: var(--font-display); font-size: var(--text-xl); color: var(--color-text); margin-bottom: var(--space-2); }
.section-header p { color: var(--color-text-muted); font-size: var(--text-base); }

/* ── Card ── */
.card {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  padding: var(--space-6);
}

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  padding: var(--space-2) var(--space-5);
  font-size: var(--text-sm); font-weight: 600; border-radius: var(--radius-full);
  text-decoration: none; white-space: nowrap; border: 1.5px solid transparent;
}
.btn-primary {
  background: var(--color-primary); color: #fff; border-color: var(--color-primary);
}
.btn-primary:hover { background: var(--color-primary-hover); border-color: var(--color-primary-hover); }
.btn-primary:active { background: var(--color-primary-active); transform: scale(0.98); }
.btn-ghost {
  background: transparent; color: var(--color-text-muted);
  border-color: var(--color-border);
}
.btn-ghost:hover { background: var(--color-surface-offset); color: var(--color-text); border-color: var(--color-primary); }
.btn-lg { padding: var(--space-3) var(--space-8); font-size: var(--text-base); }
.btn-full { width: 100%; margin-top: var(--space-3); }

/* ── Header ── */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in oklab, var(--color-bg) 88%, transparent);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--color-border);
}
.header-inner {
  display: flex; align-items: center; gap: var(--space-8);
  max-width: var(--content-wide); margin-inline: auto;
  padding: var(--space-3) var(--space-6);
}
.logo {
  display: flex; align-items: center; gap: var(--space-2);
  text-decoration: none; color: var(--color-primary);
  font-weight: 700; font-size: var(--text-sm); flex-shrink: 0;
}
.logo-hex { color: var(--color-primary); }
.site-nav { display: flex; gap: var(--space-6); margin-left: var(--space-4); }
.nav-link {
  font-size: var(--text-sm); color: var(--color-text-muted); text-decoration: none;
  padding: var(--space-1) 0; position: relative;
}
.nav-link::after {
  content: ''; position: absolute; bottom: -2px; left: 0; width: 0; height: 2px;
  background: var(--color-primary); transition: width var(--transition);
}
.nav-link:hover { color: var(--color-text); }
.nav-link:hover::after { width: 100%; }
.nav-link.active { color: var(--color-primary); }
.nav-link.active::after { width: 100%; }
.header-actions { display: flex; align-items: center; gap: var(--space-3); margin-left: auto; }
.theme-toggle {
  width: 36px; height: 36px; border-radius: var(--radius-full);
  background: var(--color-surface-offset); border: 1px solid var(--color-border);
  display: flex; align-items: center; justify-content: center;
  color: var(--color-text-muted);
}
.theme-toggle:hover { color: var(--color-primary); border-color: var(--color-primary); }

/* Mobile menu button — hidden on desktop, shown on mobile */
.mobile-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  padding: var(--space-2);
  /* Ensure it is always on top and fully clickable */
  position: relative;
  z-index: 10;
  min-width: 44px;
  min-height: 44px;
  flex-shrink: 0;
  margin-left: auto;
}
.mobile-menu-btn:hover { color: var(--color-primary); }

/* Mobile nav — hidden by default, shown when .open is added */
.mobile-nav {
  display: none;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-3) var(--space-6) var(--space-4);
  border-top: 1px solid var(--color-border);
}
.mobile-nav .nav-link { padding: var(--space-2) 0; font-size: var(--text-base); }
.mobile-nav.open { display: flex; }

@media (max-width: 768px) {
  /* Hide desktop nav and CTA button */
  .site-nav { display: none; }
  .header-actions .btn { display: none; }

  /* Keep lang toggle and theme toggle visible, but constrain header-actions */
  .header-actions {
    gap: var(--space-2);
    /* Remove margin-left: auto so hamburger button can take over */
    margin-left: 0;
  }

  /* Show hamburger button and push it to the far right */
  .mobile-menu-btn {
    display: flex;
    /* Override margin-left: auto from .header-actions — let the button sit at end of flex row */
    margin-left: auto;
  }

  /* header-inner: logo | [spacer] | actions (lang+theme) | hamburger */
  .header-inner {
    gap: var(--space-3);
  }
}

/* ── Hero ── */
.hero {
  position: relative; overflow: hidden;
  padding-block: clamp(var(--space-16), 10vw, var(--space-24));
  text-align: center;
}
.hero-inner { position: relative; z-index: 1; max-width: var(--content-narrow); margin-inline: auto; padding-inline: var(--space-6); }
.complexity-pills { display: flex; gap: var(--space-2); justify-content: center; flex-wrap: wrap; margin-bottom: var(--space-6); }
.pill {
  font-size: var(--text-xs); font-weight: 600; padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full); border: 1px solid;
}
.pill-green { color: var(--color-success); border-color: var(--color-success); background: var(--color-success-highlight); }
.pill-gold  { color: var(--color-gold);    border-color: var(--color-gold);    background: var(--color-gold-highlight); }
.pill-red   { color: var(--color-error);   border-color: var(--color-error);   background: var(--color-error-highlight); }

.hero-title {
  font-family: var(--font-display);
  font-size: var(--text-hero);
  color: var(--color-text); margin-bottom: var(--space-4);
  line-height: 1.05;
}
.hero-title em { color: var(--color-primary); font-style: italic; }
.hero-sub { font-size: var(--text-base); color: var(--color-text-muted); margin-bottom: var(--space-8); max-width: 52ch; margin-inline: auto; }
.hero-ctas { display: flex; gap: var(--space-3); justify-content: center; flex-wrap: wrap; margin-bottom: var(--space-10); }
.hero-stats { display: flex; align-items: center; justify-content: center; gap: var(--space-6); }
.stat { display: flex; flex-direction: column; align-items: center; }
.stat-num { font-size: var(--text-xl); font-weight: 700; color: var(--color-primary); line-height: 1; }
.stat-label { font-size: var(--text-xs); color: var(--color-text-muted); margin-top: var(--space-1); }
.stat-divider { width: 1px; height: 36px; background: var(--color-border); }
.hero-bg-glow {
  position: absolute; inset: 0; z-index: 0;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, color-mix(in oklch, var(--color-primary) 18%, transparent) 0%, transparent 70%);
  pointer-events: none;
}

/* ── Strategy Finder ── */
.finder-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: var(--space-8);
  align-items: start;
}
@media (max-width: 860px) { .finder-layout { grid-template-columns: 1fr; } }

.finder-form { display: flex; flex-direction: column; gap: var(--space-5); }
.finder-step {}
.step-label {
  font-size: var(--text-sm); font-weight: 700; color: var(--color-text);
  margin-bottom: var(--space-3); display: flex; align-items: center; gap: var(--space-2);
}
.step-num {
  width: 22px; height: 22px; border-radius: var(--radius-full);
  background: var(--color-primary); color: #fff;
  font-size: 11px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.option-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2);
}
.option-grid-col { grid-template-columns: 1fr; }
.option-btn {
  padding: var(--space-2) var(--space-3);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-offset);
  color: var(--color-text-muted);
  font-size: var(--text-sm); font-weight: 500;
  text-align: left;
}
.option-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-text);
  background: var(--color-primary-subtle);
}
.option-btn.active {
  border-color: var(--color-primary);
  background: var(--color-primary-highlight);
  color: var(--color-primary);
  font-weight: 600;
}

/* Results */
.results-header {
  display: flex; align-items: center; gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.match-badge {
  background: var(--color-primary); color: #fff;
  font-size: var(--text-xs); font-weight: 700;
  padding: var(--space-1) var(--space-3); border-radius: var(--radius-full);
}
.match-desc { font-size: var(--text-sm); color: var(--color-text-muted); }
.strategy-cards { display: flex; flex-direction: column; gap: var(--space-4); }

/* ── Strategy Card (used in Finder + All Strategies grid) ── */
.strategy-card {
  display: block;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-4) var(--space-5);
  text-decoration: none !important;
  color: inherit;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), border-color var(--transition), transform var(--transition);
}
.strategy-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--color-primary);
  transform: translateY(-2px);
}
.strategy-card-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}
.strategy-emoji {
  font-size: 1.8rem;
  line-height: 1;
  flex-shrink: 0;
}
.strategy-name {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: var(--space-1);
}
.strategy-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.strategy-desc {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
  max-width: none;
}

/* ── Tags ── */
.tag {
  font-size: var(--text-xs); font-weight: 600; padding: 2px var(--space-2);
  border-radius: var(--radius-full); border: 1px solid;
}
.tag-outlook  { color: var(--color-primary); border-color: var(--color-primary); background: var(--color-primary-highlight); }
.tag-cashflow { color: var(--color-success); border-color: var(--color-success); background: var(--color-success-highlight); }
.tag-risk-defined   { color: var(--color-blue);  border-color: var(--color-blue);  background: var(--color-blue-highlight); }
.tag-risk-undefined { color: var(--color-error); border-color: var(--color-error); background: var(--color-error-highlight); }
.tag-complexity-1 { color: var(--color-success); border-color: var(--color-success); background: var(--color-success-highlight); }
.tag-complexity-2 { color: var(--color-gold);    border-color: var(--color-gold);    background: var(--color-gold-highlight); }
.tag-complexity-3 { color: var(--color-error);   border-color: var(--color-error);   background: var(--color-error-highlight); }

/* Empty State */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  text-align: center; padding: var(--space-16) var(--space-8);
  color: var(--color-text-muted);
}
.empty-icon { font-size: 3rem; margin-bottom: var(--space-4); }
.empty-state h3 { color: var(--color-text); margin-bottom: var(--space-2); font-size: var(--text-lg); }
.empty-state p { max-width: 36ch; margin-bottom: var(--space-6); font-size: var(--text-sm); }

/* ── Filter Chips ── */
.filter-chips {
  display: flex; flex-wrap: wrap; gap: var(--space-2);
  justify-content: center; margin-bottom: var(--space-8);
}
.chip {
  padding: var(--space-1) var(--space-4);
  border-radius: var(--radius-full); border: 1.5px solid var(--color-border);
  background: var(--color-surface-offset);
  color: var(--color-text-muted); font-size: var(--text-sm); font-weight: 500;
}
.chip:hover { border-color: var(--color-primary); color: var(--color-primary); }
.chip.active {
  background: var(--color-primary); border-color: var(--color-primary);
  color: #fff; font-weight: 600;
}
.all-strategies-grid {
  display: grid; gap: var(--space-4);
  grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr));
}

/* ── Visualizer ── */
.visualizer-layout {
  display: grid; grid-template-columns: 280px 1fr; gap: var(--space-8); align-items: start;
}
@media (max-width: 860px) { .visualizer-layout { grid-template-columns: 1fr; } }
.visualizer-controls { display: flex; flex-direction: column; gap: var(--space-5); }
.control-group { display: flex; flex-direction: column; gap: var(--space-2); }
.control-group label { font-size: var(--text-sm); font-weight: 600; color: var(--color-text-muted); }
.select {
  padding: var(--space-2) var(--space-3);
  border: 1.5px solid var(--color-border); border-radius: var(--radius-md);
  background: var(--color-surface-offset); color: var(--color-text);
  font-size: var(--text-sm);
}
.select:focus { border-color: var(--color-primary); outline: none; }
.slider {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 4px;
  background: var(--color-border); border-radius: var(--radius-full);
  outline: none;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px;
  border-radius: 50%; background: var(--color-primary);
  cursor: pointer; border: 2px solid var(--color-bg);
  box-shadow: 0 0 0 2px var(--color-primary);
}
.slider::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--color-primary); cursor: pointer;
  border: 2px solid var(--color-bg);
}
.pnl-summary {
  background: var(--color-surface-offset);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  font-size: var(--text-sm);
  min-height: 96px;
}
.pnl-row { display: flex; justify-content: space-between; margin-bottom: var(--space-2); }
.pnl-row:last-child { margin-bottom: 0; }
/* Both .pnl-key and .pnl-label supported */
.pnl-key, .pnl-label { color: var(--color-text-muted); }
.pnl-val { font-weight: 700; font-variant-numeric: tabular-nums; }
.pnl-profit { color: var(--color-success); }
.pnl-loss   { color: var(--color-error); }

/*
 * FIX: Chart height growth loop.
 */
.visualizer-chart {
  height: 460px;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.visualizer-chart canvas {
  flex: 1;
  width: 100% !important;
  height: 0 !important;
  min-height: 0;
}

/* Profit / Loss zone legend */
.viz-legend {
  display: flex; gap: var(--space-5); justify-content: center;
  font-size: var(--text-xs); color: var(--color-text-muted);
}
.viz-legend-item { display: flex; align-items: center; gap: var(--space-2); }
.viz-legend-swatch {
  display: inline-block; width: 14px; height: 10px;
  border-radius: 2px; flex-shrink: 0;
}
.viz-legend-profit { background: rgba(67,122,34,0.35); }
.viz-legend-loss   { background: rgba(161,44,123,0.30); }

/* ── Building Blocks ── */
.blocks-tabs {
  display: flex; flex-wrap: wrap; gap: var(--space-2);
  margin-bottom: var(--space-8); justify-content: center;
}
.tab {
  padding: var(--space-2) var(--space-5);
  border-radius: var(--radius-full); border: 1.5px solid var(--color-border);
  background: var(--color-surface-offset);
  color: var(--color-text-muted); font-size: var(--text-sm); font-weight: 500;
}
.tab:hover { border-color: var(--color-primary); color: var(--color-primary); }
.tab.active {
  background: var(--color-primary); border-color: var(--color-primary);
  color: #fff; font-weight: 600;
}
.blocks-display {
  background: var(--color-surface-2); border: 1px solid var(--color-border);
  border-radius: var(--radius-xl); padding: var(--space-8);
  box-shadow: var(--shadow-sm);
}
.blocks-card {}
.blocks-composition {
  display: flex; align-items: center; gap: var(--space-6); flex-wrap: wrap;
  justify-content: center;
}
.block-group { display: flex; flex-direction: column; gap: var(--space-3); align-items: center; }
.block-desc {
  font-size: var(--text-xs); color: var(--color-text-muted);
  text-align: center; max-width: 160px;
}
.block {
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-lg); border: 2px solid;
  font-size: var(--text-sm); font-weight: 700; text-align: center; min-width: 160px;
  background: var(--color-surface-offset);
}
.block-green  { border-color: var(--color-success); color: var(--color-success); }
.block-red    { border-color: var(--color-error);   color: var(--color-error); }
.block-purple { border-color: var(--color-primary);  color: var(--color-primary); }
.block-gold   { border-color: var(--color-gold);     color: var(--color-gold); }
.block-blue   { border-color: var(--color-blue);     color: var(--color-blue); }
.composition-op {
  font-size: var(--text-xl); font-weight: 700; color: var(--color-text-muted);
  flex-shrink: 0;
}
.result-block {
  display: flex; flex-direction: column; align-items: center; gap: var(--space-2);
  background: var(--color-primary-highlight);
  border: 2px solid var(--color-primary);
  border-radius: var(--radius-xl); padding: var(--space-5) var(--space-8);
}
.result-emoji { font-size: 2.2rem; }
.result-name { font-size: var(--text-base); font-weight: 700; color: var(--color-primary); }
.blocks-legs {
  margin-top: var(--space-8); padding-top: var(--space-6);
  border-top: 1px solid var(--color-divider);
}
/* Both h3.legs-heading and h4 inside .blocks-legs are styled */
.blocks-legs h4,
.legs-heading {
  font-size: var(--text-sm); font-weight: 700; color: var(--color-text-muted);
  margin-bottom: var(--space-4); text-transform: uppercase; letter-spacing: 0.06em;
}
.legs-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: var(--space-3);
}
.leg {
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background: var(--color-surface-offset);
  border: 1px solid var(--color-border);
  font-size: var(--text-sm);
}
.leg-name { font-weight: 600; color: var(--color-text); margin-bottom: var(--space-1); }
.leg-detail { color: var(--color-text-muted); font-size: var(--text-xs); }
.blocks-info {
  margin-top: var(--space-6); padding: var(--space-4);
  background: var(--color-primary-highlight);
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm); color: var(--color-text-muted);
}
.blocks-info strong { color: var(--color-primary); }

/* ── Footer ── */
.site-footer {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding-block: var(--space-6);
}
.footer-inner {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: var(--space-4);
  font-size: var(--text-xs);
}
.logo-text { font-weight: 700; color: var(--color-primary); }
.footer-note { color: var(--color-text-faint); }
.footer-copy { color: var(--color-text-faint); }

/* ── Responsive ── */
@media (max-width: 600px) {
  .hero-stats { gap: var(--space-4); }
  .stat-num { font-size: var(--text-lg); }
  .blocks-composition { gap: var(--space-4); }
  .composition-op { font-size: var(--text-lg); }
  .result-block { padding: var(--space-4) var(--space-5); }
  .footer-inner { flex-direction: column; text-align: center; }
  .strategy-card { padding: var(--space-3) var(--space-4); }
  .strategy-emoji { font-size: 1.5rem; }
  .visualizer-chart { height: 320px; }
}
