/* Design tokens */
:root {
  --bg-0: #05060F;
  --bg-1: #0B1026;
  --cyan: #3EF0FF;
  --violet: #8B5CF6;
  --gold: #F5C76B;
  --green: #4ADE80;
  --warn: #FFB86B;
  --text: #E8ECF8;
  --muted: #9AA3BF;
  --line: rgba(255, 255, 255, 0.09);
  --glass-top: rgba(255, 255, 255, 0.055);
  --glass-bottom: rgba(255, 255, 255, 0.02);
  --radius: 22px;
  --radius-sm: 14px;
  --gap: 24px;
  --font-head: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(1200px 800px at 70% -10%, #121a45 0%, transparent 60%),
              linear-gradient(180deg, var(--bg-1) 0%, var(--bg-0) 55%);
  background-color: var(--bg-0);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

#stars { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -2; pointer-events: none; }

.aurora { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.aurora span {
  position: absolute;
  width: 46vmax;
  height: 46vmax;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.16;
  animation: float 38s ease-in-out infinite alternate;
}
.aurora span:nth-child(1) { background: var(--violet); top: -18vmax; left: -10vmax; }
.aurora span:nth-child(2) { background: var(--cyan); bottom: -24vmax; right: -12vmax; opacity: 0.1; animation-duration: 46s; }
.aurora span:nth-child(3) { background: #2b3fd6; top: 30%; left: 40%; opacity: 0.1; animation-duration: 54s; }
@keyframes float { to { transform: translate(6vmax, 4vmax) scale(1.08); } }

.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* Glass panel with a 1px gradient border */
.glass {
  position: relative;
  background: linear-gradient(180deg, var(--glass-top), var(--glass-bottom));
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border-radius: var(--radius);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 24px 60px rgba(0, 0, 0, 0.35);
}
.glass::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(140deg, rgba(62, 240, 255, 0.35), rgba(139, 92, 246, 0.18) 40%, rgba(255, 255, 255, 0.05) 70%, rgba(139, 92, 246, 0.25));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

/* Navigation */
.nav {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(5, 6, 15, 0.6);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.nav-inner { max-width: 1180px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.logo { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-family: var(--font-head); font-weight: 700; letter-spacing: 0.22em; font-size: 0.95rem; }
.logo-mark { width: 30px; height: 30px; }
.nav-actions { display: flex; gap: 8px; }

/* Buttons */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 50px;
  padding: 0 24px;
  border-radius: var(--radius-sm);
  border: 0;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 0.98rem;
  letter-spacing: 0.01em;
  color: var(--text);
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), color 0.2s, border-color 0.2s, background 0.2s;
}
.btn:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
.btn.small { height: 38px; padding: 0 14px; font-size: 0.85rem; border-radius: 12px; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn.primary {
  background: linear-gradient(135deg, rgba(62, 240, 255, 0.16), rgba(139, 92, 246, 0.3));
  box-shadow: 0 10px 34px rgba(139, 92, 246, 0.22);
}
.btn.primary::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(90deg, var(--cyan), var(--violet), var(--gold), var(--cyan));
  background-size: 300% 100%;
  animation: border-flow 6s linear infinite;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}
.btn.primary::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.16) 50%, transparent 70%);
  transform: translateX(-120%);
}
.btn.primary:hover { transform: translateY(-1px); box-shadow: 0 14px 40px rgba(139, 92, 246, 0.32); }
.btn.primary:hover::after { transition: transform 0.9s var(--ease); transform: translateX(120%); }
@keyframes border-flow { to { background-position: 300% 0; } }

.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.btn.ghost:hover:not(:disabled) { color: var(--text); border-color: rgba(255, 255, 255, 0.22); background: rgba(255, 255, 255, 0.03); }

/* Layout */
main { max-width: 1180px; margin: 0 auto; padding: 0 16px 64px; }

.hero { text-align: center; padding: 72px 0 36px; }
.eyebrow { margin: 0 0 14px; font-family: var(--font-head); font-size: 0.78rem; letter-spacing: 0.28em; text-transform: uppercase; color: var(--cyan); }
.hero h1 { margin: 0 auto 16px; max-width: 760px; font-family: var(--font-head); font-weight: 600; font-size: clamp(2.2rem, 6vw, 3.8rem); line-height: 1.05; letter-spacing: -0.02em; }
.grad { background: linear-gradient(90deg, var(--cyan), var(--violet)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { margin: 0 auto; max-width: 560px; color: var(--muted); font-size: 1.05rem; }

.section-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.section-head h2 { margin: 0; font-family: var(--font-head); font-weight: 600; font-size: 1.35rem; letter-spacing: -0.01em; }
.step { font-family: var(--font-head); font-size: 0.8rem; letter-spacing: 0.18em; color: var(--cyan); padding: 4px 10px; border: 1px solid rgba(62, 240, 255, 0.3); border-radius: 999px; }
.muted { color: var(--muted); }

/* Form */
.form-card { max-width: 760px; margin: 0 auto; padding: 32px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.field-row.three { grid-template-columns: repeat(3, 1fr); }
.field { position: relative; }
.field input, .field select {
  width: 100%;
  height: 60px;
  padding: 24px 16px 8px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: 500 1rem var(--font-body);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  -webkit-appearance: none;
  appearance: none;
}
.field select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239AA3BF' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
  padding-right: 38px;
}
.field select option { background: var(--bg-1); color: var(--text); }
.field label {
  position: absolute;
  left: 17px;
  top: 19px;
  color: var(--muted);
  pointer-events: none;
  transition: all 0.18s var(--ease);
}
.field input:focus + label,
.field input:not(:placeholder-shown) + label,
.field.select label {
  top: 9px;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.field input:focus + label, .field select:focus + label { color: var(--cyan); }
.field input:hover, .field select:hover { border-color: rgba(255, 255, 255, 0.16); }
.field input:focus, .field select:focus {
  border-color: rgba(62, 240, 255, 0.6);
  background-color: rgba(62, 240, 255, 0.04);
  box-shadow: 0 0 0 4px rgba(62, 240, 255, 0.1), 0 0 24px rgba(62, 240, 255, 0.12);
}
.field small { display: block; margin: 6px 4px 0; color: var(--muted); font-size: 0.78rem; }
.error { margin: 4px 0 0; color: #ff9b94; font-size: 0.92rem; }
.form-actions { display: flex; gap: 12px; margin-top: 24px; }
.form-actions .primary { flex: 1; }

/* Loading */
.scanning { display: grid; place-items: center; gap: 16px; padding: 72px 0; color: var(--muted); }
.scanning[hidden] { display: none; }
.scan-orb {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, #1a2a66, #0b1026 70%);
  box-shadow: 0 0 0 1px rgba(62, 240, 255, 0.4), 0 0 40px rgba(62, 240, 255, 0.35);
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse { 50% { transform: scale(1.12); box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.6), 0 0 60px rgba(139, 92, 246, 0.45); } }

/* Results */
.results { margin-top: 72px; scroll-margin-top: 80px; }
.results-head p { margin: 0; }
.results-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: var(--gap); align-items: start; }
.tree-col { position: sticky; top: 84px; }
.cards-col { display: grid; gap: var(--gap); }

/* Tree: slender branches fan out of the trunk, leaves along their tips. It grows in, then sways. */
.tree-card { padding: 18px 18px 14px; }
.tree-wrap { position: relative; }
#tree { display: block; width: 100%; max-width: 480px; height: auto; margin: 0 auto; overflow: visible; }
#tree .wood { fill: url(#bark); }
#tree .trunk { fill: url(#trunk-fill); }
#tree .rim { fill: none; stroke: rgba(62, 240, 255, 0.5); stroke-width: 1.4; stroke-linecap: round; }
#tree .rim.left { stroke: rgba(139, 92, 246, 0.45); stroke-width: 1.2; }
#tree .streak { fill: none; stroke: rgba(5, 6, 20, 0.35); stroke-linecap: round; }
#tree .tri { fill: none; stroke: rgba(255, 255, 255, 0.35); stroke-width: 1.2; }
#tree .ghost { fill: rgba(139, 92, 246, 0.1); }

/* Individual transform properties: "scale" grows a branch in while "rotate" sways it */
#tree .trunk-g, #tree .br, #tree .follow { transform-box: view-box; }
#tree .trunk-g { transform-origin: 200px 530px; scale: 1 0; }
#tree .br { scale: 0; }
#tree .leaf { transform-box: fill-box; transform-origin: 0% 50%; scale: 0; }
#tree .fx { opacity: 0; }
.play #tree .trunk-g { animation: grow 0.9s var(--ease) forwards 0.1s; }
.play #tree .br { animation: grow 0.9s var(--ease) forwards var(--gd), sway var(--sd) ease-in-out infinite var(--sp); }
.play #tree .follow { animation: sway var(--sd) ease-in-out infinite var(--sp); }
.play #tree .leaf { animation: grow 0.5s var(--ease) forwards var(--ld); }
.play #tree .fx { animation: fade-in 1.4s ease forwards 1.2s; }
.paused #tree * { animation-play-state: paused !important; }
@keyframes grow { to { scale: 1; } }
@keyframes sway { 25% { rotate: var(--a); } 75% { rotate: calc(var(--a) * -1); } }
@keyframes fade-in { to { opacity: 1; } }

#tree .fly { opacity: 0; }
.play #tree .fly { animation: fly var(--fd) ease-in-out infinite alternate var(--fdel); }
@keyframes fly { 0% { opacity: 0.15; translate: 0 0; } 50% { opacity: 0.9; } 100% { opacity: 0.25; translate: var(--fx) var(--fy); } }
#tree .falling { opacity: 0; transform-box: fill-box; transform-origin: center; }
.play #tree .falling { animation: fall var(--fd) linear infinite var(--fdel); }
@keyframes fall {
  0% { opacity: 0; translate: 0 0; rotate: 0deg; }
  10% { opacity: 0.9; }
  85% { opacity: 0.8; }
  100% { opacity: 0; translate: var(--fx) var(--fy); rotate: 400deg; }
}

/* Nodes: glass orbs, gold for master numbers */
#tree .node { opacity: 0; cursor: pointer; outline: none; }
.play #tree .node { animation: fade-in 0.6s var(--ease) forwards; animation-delay: calc(2.2s + var(--i) * 0.09s); }
#tree .node-inner { transform-box: fill-box; transform-origin: center; transition: scale 0.25s var(--ease); }
#tree .node:hover .node-inner, #tree .node.active .node-inner, #tree .node:focus-visible .node-inner { scale: 1.12; }
#tree .node-glow { fill: url(#glow-cyan); }
#tree .orb { fill: url(#orb-cyan); stroke: rgba(62, 240, 255, 0.9); stroke-width: 1.5; }
#tree .halo { fill: none; stroke: rgba(62, 240, 255, 0.35); stroke-width: 1; transform-box: fill-box; transform-origin: center; animation: halo 3.2s ease-in-out infinite; }
@keyframes halo { 50% { scale: 1.08; opacity: 0.5; } }
#tree .node-num { text-anchor: middle; fill: #fff; font: 600 17px var(--font-head); font-variant-numeric: tabular-nums; }
#tree .node.master .node-glow { fill: url(#glow-gold); }
#tree .node.master .orb { fill: url(#orb-gold); stroke: var(--gold); }
#tree .node.master .halo { stroke: rgba(245, 199, 107, 0.45); }
#tree .node.master .node-num { font-size: 14px; fill: #fff3d6; }
#tree .node:focus-visible .orb { stroke-width: 2.6; }

/* Fruits: as many as the Fruits number, popping in after the leaves */
#tree .fruit { display: none; }
#tree .fruit.shown { display: inline; }
#tree .fruit-in { transform-box: fill-box; transform-origin: 50% 0%; scale: 0; }
.play #tree .fruit.shown .fruit-in { animation: grow 0.6s var(--ease) forwards var(--fdl, 2s); }
#tree .fruit-body { fill: url(#fruit-grad); }
#tree .fruit-stem { fill: none; stroke: #4a3f9e; stroke-width: 1; stroke-linecap: round; }
#tree .fruit-shine { fill: rgba(255, 255, 255, 0.75); }
#tree .fruit-glow { fill: url(#fruit-glow); opacity: 0; transition: opacity 0.35s ease; }

/* Interactive tree: hovering a number lights up its part of the tree and dims the rest */
#tree :is(.wood, .trunk, .leaf, .fruit, .streak, .rim, .ghost) { transition: opacity 0.35s ease; }
#tree.focus :is(.wood, .trunk, .leaf, .fruit, .streak, .rim, .ghost) { opacity: 0.22; }
#tree.focus-leaves .leaf, #tree.focus-fruits .fruit, #tree.focus-branches .br .wood { opacity: 1; }
#tree.focus-branches .br .wood { fill: url(#bark-lit); }
#tree.focus-trunk .trunk, #tree.focus-bark :is(.trunk, .streak, .rim) { opacity: 1; }
#tree:is(.focus-firstRoot, .focus-secondRoot) .trunk { opacity: 0.5; }
#tree.focus-fruits .fruit-glow { opacity: 1; }
#tree .hl { opacity: 0; transition: opacity 0.35s ease; pointer-events: none; }
#tree .hl-wide { fill: none; stroke: rgba(62, 240, 255, 0.28); stroke-width: 9; stroke-linecap: round; }
#tree .hl-core { fill: none; stroke: #bff9ff; stroke-width: 2.4; stroke-linecap: round; }
#tree .hl-fill { fill: url(#trunk-lit); }
#tree.focus-firstRoot .hl-firstRoot, #tree.focus-secondRoot .hl-secondRoot, #tree.focus-trunk .hl-trunk,
#tree.focus-bark .hl-bark, #tree.focus-leaves .hl-leaves { opacity: 1; }

.hint { margin: 6px 0 0; text-align: center; font-size: 0.8rem; color: var(--muted); }

.tip {
  position: absolute;
  z-index: 5;
  transform: translate(40px, -50%);
  display: grid;
  gap: 2px;
  min-width: 110px;
  padding: 12px 14px;
  background: rgba(11, 16, 38, 0.86);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(62, 240, 255, 0.25);
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  font-size: 0.82rem;
  pointer-events: none;
  text-align: left;
}
.tip[hidden], .toast[hidden] { display: none; }
.tip.left { transform: translate(calc(-100% - 40px), -50%); }
.tip.under { transform: translate(-50%, 36px); }
.tip.above { transform: translate(-50%, calc(-100% - 36px)); }
.tip strong { font-family: var(--font-head); font-size: 0.78rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--cyan); }
.tip-num { font: 600 1.4rem var(--font-head); }
.tip-num small, .num small { font-size: 0.55em; opacity: 0.75; margin-left: 1px; }
.tip-num.master { color: var(--gold); }

/* Cards */
.card { padding: 26px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; color: var(--cyan); }
.card-head h3 { margin: 0; color: var(--text); font-family: var(--font-head); font-weight: 600; font-size: 1.08rem; }
.note { margin: -8px 0 16px; font-size: 0.88rem; }

.reveal { opacity: 0; transform: translateY(16px); transition: opacity 0.6s var(--ease), transform 0.6s var(--ease); transition-delay: calc(var(--i, 0) * 70ms); }
.reveal.in { opacity: 1; transform: none; }

.num { font-family: var(--font-head); font-weight: 600; font-variant-numeric: tabular-nums; color: #fff; text-shadow: 0 0 18px rgba(62, 240, 255, 0.35); }
.master .num, .num.master { color: var(--gold); text-shadow: 0 0 18px rgba(245, 199, 107, 0.4); }

.keys { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 12px; }
.key-tile {
  display: grid;
  gap: 6px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.025);
  transition: transform 0.25s var(--ease), border-color 0.25s, box-shadow 0.25s;
}
.key-tile:hover { transform: translateY(-2px); border-color: rgba(62, 240, 255, 0.3); box-shadow: 0 10px 30px rgba(62, 240, 255, 0.08); }
.key-tile.master { border-color: rgba(245, 199, 107, 0.35); }

/* Key icons: a small tree drawn faintly, with the key's own part lit in the tile's accent colour */
.key-tile { --accent: var(--cyan); --accent-soft: rgba(62, 240, 255, 0.12); --accent-line: rgba(62, 240, 255, 0.32); }
.key-tile.green { --accent: var(--green); --accent-soft: rgba(74, 222, 128, 0.12); --accent-line: rgba(74, 222, 128, 0.32); }
.key-tile.master { --accent: var(--gold); --accent-soft: rgba(245, 199, 107, 0.14); --accent-line: rgba(245, 199, 107, 0.42); }
.key-icon {
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  margin-bottom: 6px;
  border-radius: 16px;
  background: radial-gradient(circle at 35% 30%, var(--accent-soft), rgba(255, 255, 255, 0.02) 75%);
  border: 1px solid var(--accent-line);
}
.mini-tree { width: 48px; height: 48px; overflow: visible; }
.mini-tree .mt-leaves ellipse { fill: rgba(150, 165, 225, 0.2); }
.mini-tree .mt-branches path, .mini-tree .mt-root { fill: none; stroke: rgba(170, 180, 232, 0.34); stroke-width: 1.7; stroke-linecap: round; }
.mini-tree .mt-trunk { fill: rgba(170, 180, 232, 0.3); }
.mini-tree .mt-bark path { fill: none; stroke: rgba(170, 180, 232, 0.18); stroke-width: 0.9; stroke-linecap: round; stroke-linejoin: round; }
.mini-tree .mt-fruits circle { fill: rgba(170, 180, 232, 0.28); }
.mini-tree .on { filter: drop-shadow(0 0 3px var(--accent)); }
.mini-tree .mt-leaves.on ellipse, .mini-tree .mt-trunk.on, .mini-tree .mt-fruits.on circle { fill: var(--accent); }
.mini-tree .mt-branches.on path { stroke: var(--accent); stroke-width: 2.4; }
.mini-tree .mt-root.on { stroke: var(--accent); stroke-width: 3; }
.mini-tree .mt-bark.on path { stroke: var(--accent); stroke-width: 1.5; }
.key-tile .num { font-size: 2rem; line-height: 1.1; }
.label { font-size: 0.74rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }

.dynamic { display: flex; align-items: baseline; gap: 18px; flex-wrap: wrap; }
.dynamic p { margin: 0; }
.num.big { font-size: 3.4rem; line-height: 1; }

.timeline { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); position: relative; }
.timeline::before { content: ""; position: absolute; top: 24px; left: 12.5%; right: 12.5%; height: 1px; background: linear-gradient(90deg, var(--cyan), var(--violet)); opacity: 0.5; }
.timeline li { display: grid; justify-items: center; gap: 10px; position: relative; }
.orb-num {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, #16224f, #0d1533 75%);
  border: 1px solid rgba(139, 92, 246, 0.7);
  box-shadow: 0 0 16px rgba(139, 92, 246, 0.35);
  font: 600 1.2rem var(--font-head);
}

.tools { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.tool { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255, 255, 255, 0.02); }
.ring { position: relative; width: 52px; height: 52px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 3; }
.ring .track { stroke: rgba(255, 255, 255, 0.08); }
.ring .fill { stroke: var(--cyan); stroke-linecap: round; filter: drop-shadow(0 0 4px rgba(62, 240, 255, 0.5)); transition: stroke-dashoffset 0.8s var(--ease); }
.ring span { position: absolute; inset: 0; display: grid; place-items: center; font: 600 1.05rem var(--font-head); }
.tool-text { display: grid; gap: 1px; font-size: 0.82rem; }
.tool-label { font-weight: 600; font-size: 0.92rem; }
.tool.zero { border-style: dashed; border-color: rgba(255, 184, 107, 0.35); }
.tool.zero .track { stroke: rgba(255, 184, 107, 0.5); stroke-dasharray: 3 4; }
.tool.zero .fill { display: none; }
.tool.zero .ring span { color: var(--warn); }
.badge { justify-self: start; margin-top: 4px; padding: 2px 8px; border-radius: 999px; font-size: 0.7rem; letter-spacing: 0.04em; color: var(--warn); background: rgba(255, 184, 107, 0.1); border: 1px solid rgba(255, 184, 107, 0.3); }

.years { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stat { display: grid; gap: 6px; padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255, 255, 255, 0.02); }
.stat .num { font-size: 2.4rem; line-height: 1.05; }
.stat .muted { font-size: 0.8rem; }
.stat.featured { background: linear-gradient(140deg, rgba(62, 240, 255, 0.1), rgba(139, 92, 246, 0.14)); border-color: rgba(62, 240, 255, 0.4); box-shadow: 0 0 30px rgba(62, 240, 255, 0.08); }

.footer { max-width: 1180px; margin: 0 auto; padding: 28px 16px 40px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: 0.82rem; border-top: 1px solid var(--line); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 30;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(11, 16, 38, 0.92);
  border: 1px solid rgba(62, 240, 255, 0.3);
  font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 960px) {
  .results-grid { grid-template-columns: 1fr; }
  .tree-col { position: static; }
}
@media (max-width: 600px) {
  .nav-actions .btn span { display: none; }
  .nav-actions .btn.small { padding: 0 11px; }
  .hero { padding: 48px 0 28px; }
  .form-card { padding: 22px 18px; }
  .field-row, .field-row.three { grid-template-columns: 1fr; }
  .card { padding: 20px 18px; }
  .years { grid-template-columns: 1fr; }
  .timeline .wide-only { display: none; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
  *, *::before, *::after { animation-delay: 0s !important; }
  #tree .fly, #tree .falling { display: none; }
}

/* Print / PDF: light, ink-friendly */
@media print {
  body { background: #fff; color: #111; }
  #stars, .aurora, .nav, .hero, .form-card, .scanning, .footer, .hint, .toast { display: none !important; }
  .results { margin: 0; }
  .glass { background: #fff; box-shadow: none; backdrop-filter: none; border: 1px solid #ddd; break-inside: avoid; }
  .glass::before { display: none; }
  .results-grid { grid-template-columns: 1fr; }
  .tree-col { position: static; }
  .tree-card { background: #0B1026; }
  .reveal { opacity: 1; transform: none; }
  .num, .master .num { color: #111; text-shadow: none; }
  .muted, .label { color: #555; }
  .card-head, .card-head h3 { color: #111; }
  .key-tile, .tool, .stat { border-color: #ddd; background: #fff; }
  #tree .trunk-g, #tree .br, #tree .leaf, #tree .fruit-in { scale: 1 !important; rotate: 0deg !important; }
  #tree .node, #tree .fx { opacity: 1; }
  #tree .fly, #tree .falling { display: none; }
}
