/* ==========================================================================
   ScienceHutch: Spectrum Quest (em-spectrum.html only).
   Colors, buttons and type come from main.css. This page adds a calm
   "night sky" look with spectrum colors for the 7 kinds of light.
   Every animation switches off for people who ask for reduced motion.
   ========================================================================== */

/* ======= PAGE TOKENS (the 7 kinds of light) ======= */
.em-page {
  --radio: #FF6B8B;
  --microwave: #FF9F43;
  --infrared: #FF4D4D;
  --visible: #FFE14D;
  --ultraviolet: #B36BFF;
  --xray: #6C8CFF;
  --gamma: #3FE0D0;
  --spectrum: linear-gradient(90deg, #FF6B8B, #FF9F43, #FF4D4D, #FF2A1A 40%, #FFB000 43%, #FFE14D 45%, #7CFF4F 47%, #2FA8FF 50%, #8A4DFF 53%, #B36BFF 65%, #6C8CFF 82%, #3FE0D0);
  --rainbow: linear-gradient(90deg, #FF1A1A, #FF7A00, #FFE100, #3CFF3C, #00C8FF, #2E4BFF, #8A2BE2);
  --glass: rgba(28, 22, 34, 0.72);
  --glass-border: rgba(255, 255, 255, 0.09);
  --good: #7CFF9E;
  --bad: #FF9B8A;
}
.em-wrap { width: min(100% - 2rem, 72rem); margin-inline: auto; }
.em-page [hidden] { display: none !important; }
.em-page h1, .em-page h2 { font-family: var(--font-display); font-weight: 400; line-height: 1.08; }
.em-page button { font: inherit; }
.em-page button:focus-visible, .em-page input:focus-visible, .em-page summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

/* ======= INTRO ======= */
.em-hero {
  position: relative;
  overflow: hidden;
  padding-bottom: clamp(2rem, 5vw, 3.5rem);
  background:
    radial-gradient(ellipse 60% 50% at 82% 30%, rgba(138, 77, 255, 0.28), transparent 70%),
    radial-gradient(ellipse 50% 45% at 18% 70%, rgba(255, 138, 43, 0.18), transparent 70%),
    radial-gradient(ellipse 70% 40% at 50% 100%, rgba(63, 224, 208, 0.12), transparent 70%),
    var(--bg);
  border-bottom: 1px solid var(--border);
}
/* Tiny twinkling stars made only with CSS */
.em-stars, .em-stars::after {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(1.2px 1.2px at 12% 18%, #fff, transparent),
    radial-gradient(1px 1px at 28% 62%, #ffe9c7, transparent),
    radial-gradient(1.4px 1.4px at 44% 12%, #fff, transparent),
    radial-gradient(1px 1px at 63% 44%, #cfe3ff, transparent),
    radial-gradient(1.3px 1.3px at 78% 78%, #fff, transparent),
    radial-gradient(1px 1px at 90% 22%, #ffd6f0, transparent),
    radial-gradient(1px 1px at 6% 84%, #fff, transparent),
    radial-gradient(1.2px 1.2px at 54% 88%, #e6ffef, transparent),
    radial-gradient(1px 1px at 35% 34%, #fff, transparent),
    radial-gradient(1px 1px at 70% 8%, #fff, transparent);
  background-size: 420px 420px;
  opacity: 0.75;
}
.em-stars::after {
  content: "";
  background-size: 300px 300px;
  background-position: 120px 60px;
  animation: em-twinkle 5s ease-in-out infinite alternate;
}
@keyframes em-twinkle { from { opacity: 0.15; } to { opacity: 0.85; } }

.em-hero-inner {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(1.5rem, 4vw, 3rem);
  padding-block: clamp(2.5rem, 7vw, 5rem) clamp(1.5rem, 4vw, 2.5rem);
}
.em-hero h1 { margin: 0; font-size: clamp(2.8rem, 8.5vw, 5.6rem); }
.em-hero h1 span {
  background: linear-gradient(90deg, #FF9F43, #FFE14D 30%, #7CFF4F 50%, #2FA8FF 70%, #B36BFF);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  background-size: 200% 100%;
  animation: em-shimmer 8s ease-in-out infinite alternate;
}
@keyframes em-shimmer { from { background-position: 0% 0; } to { background-position: 100% 0; } }
.em-lead { max-width: 36em; margin: 18px 0 12px; font-size: clamp(1.08rem, 2.2vw, 1.25rem); }
.em-promise { max-width: 40em; margin: 0 0 26px; color: var(--muted); }
.em-hero-ctas { justify-content: flex-start; }
.em-waves-link {
  display: flex; align-items: center; gap: 14px;
  max-width: 34em;
  margin-top: 22px;
  padding: 12px 16px;
  border: 1px solid rgba(47, 168, 255, 0.45);
  border-radius: 16px;
  background: rgba(47, 168, 255, 0.08);
  color: var(--ink);
  text-decoration: none;
  transition: border-color 0.2s, background-color 0.2s;
}
.em-waves-link:hover { border-color: #7FD0FF; background: rgba(47, 168, 255, 0.14); }
.em-waves-link:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.em-waves-link strong { color: #9FD8FF; }
.em-waves-icon { flex: none; width: 40px; color: #7FD0FF; }
.em-waves-icon svg { display: block; width: 40px; height: 24px; }
.em-waves-go { flex: none; color: #9FD8FF; font-weight: 800; font-size: 1.2rem; }
.em-intro-link { margin-top: 12px; font-size: 1rem; }
.em-teacher p { color: var(--muted); margin: 0; }
.em-hero-art { width: 100%; max-width: 520px; justify-self: center; overflow: visible; }
.em-hero-wave { animation: em-float 6s ease-in-out infinite alternate; }
.em-hero-photons {
  fill: none;
  stroke-dasharray: 2 46;
  stroke-linecap: round;
  opacity: 0.9;
  animation: em-flow-photons 3.5s linear infinite;
}
@keyframes em-flow-photons { to { stroke-dashoffset: -480; } }
@keyframes em-float { from { transform: translateY(-4px); } to { transform: translateY(4px); } }

/* How to play */
.em-how {
  position: relative;
  padding: clamp(1.25rem, 3vw, 2rem);
  border: 1px solid var(--glass-border);
  border-radius: 22px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  scroll-margin-top: 80px;
}
.em-how::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  border-radius: 22px 22px 0 0;
  background: var(--spectrum);
}
.em-how h2 { margin: 0 0 16px; font-size: clamp(1.5rem, 3.5vw, 2rem); }
.em-how-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 0; padding: 0; list-style: none; }
.em-how-step { position: relative; padding: 18px 18px 16px; border-radius: 16px; background: rgba(255, 255, 255, 0.04); }
.em-how-step h3 { margin: 4px 0 6px; font-size: 1.2rem; }
.em-how-step p { margin: 0; color: var(--muted); }
.em-how-num {
  display: grid; place-items: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--orange);
  color: var(--on-accent);
  font-weight: 800;
  box-shadow: 0 0 18px rgba(255, 138, 43, 0.6);
}
.em-how-tip { margin: 18px 0 0; color: var(--ink); }

/* ======= QUEST BAR ======= */
.em-questbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--glass-border);
  background: rgba(10, 9, 8, 0.82);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.em-questbar-inner { display: flex; align-items: center; gap: 10px 16px; min-height: 52px; padding-block: 6px; }
.em-gems { display: flex; gap: 6px; margin-right: auto; }
.em-gem {
  width: 18px; height: 18px;
  transform: rotate(45deg);
  border-radius: 4px;
  border: 1.5px dashed #6B5A54;
  transition: background-color 0.3s, box-shadow 0.3s, border-color 0.3s;
}
.em-gem.on { border: 1.5px solid #fff; background: var(--c); box-shadow: 0 0 10px var(--c), 0 0 2px #fff inset; }
.em-badge-count {
  display: inline-flex; align-items: center; gap: 0;
  min-height: 40px; padding: 6px 12px;
  border: 1px solid #9A6A58; border-radius: 999px;
  color: var(--ink); font-weight: 700; text-decoration: none;
}
.em-badge-count:hover { border-color: var(--orange); }
.em-sound {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 40px; padding: 6px 12px;
  border: 1px solid #9A6A58; border-radius: 999px;
  background: transparent; color: var(--ink); font-weight: 600; cursor: pointer;
}
.em-sound[aria-pressed="true"] { border-color: var(--orange); background: rgba(255, 138, 43, 0.12); }

/* ======= LEVELS ======= */
.em-level { padding-block: clamp(2.5rem, 6vw, 4.5rem); scroll-margin-top: 60px; }
.em-level-alt {
  background:
    radial-gradient(ellipse 60% 40% at 10% 0%, rgba(108, 140, 255, 0.10), transparent 70%),
    radial-gradient(ellipse 50% 40% at 100% 100%, rgba(255, 107, 139, 0.08), transparent 70%),
    #0E0B10;
  border-block: 1px solid var(--border);
}
.em-level-head { margin-bottom: 28px; }
.em-level-tag {
  display: inline-block;
  margin: 0 0 10px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--spectrum);
  color: #120A06;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.em-level h2 { margin: 0 0 12px; font-size: clamp(1.9rem, 4.6vw, 2.9rem); }
.em-intro { max-width: 46em; margin: 0; color: var(--muted); font-size: 1.1rem; }
.em-intro strong { color: var(--ink); }

/* ======= GAME CARDS ======= */
.em-game {
  position: relative;
  margin-top: 28px;
  padding: clamp(1.1rem, 3vw, 2rem);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  background: linear-gradient(160deg, rgba(36, 26, 40, 0.75), rgba(18, 14, 20, 0.85));
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  scroll-margin-top: 64px;
}
.em-game-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 20px; }
.em-game-head h3 { margin: 0 0 4px; font-size: clamp(1.3rem, 3vw, 1.6rem); }
.em-game-head p { max-width: 50em; margin: 0; color: var(--muted); }
.em-game-icon {
  flex: none;
  display: grid; place-items: center;
  width: 52px; height: 52px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 1.6rem;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.em-bigidea {
  margin-top: 22px;
  padding: 16px 18px;
  border-left: 4px solid var(--orange);
  border-radius: 0 14px 14px 0;
  background: rgba(255, 138, 43, 0.07);
}
.em-bigidea p { margin: 0; }
.em-small-note { margin: 16px 0 0; color: var(--muted); font-size: 0.92rem; }

/* Reveal on scroll (only when JavaScript is running and motion is OK) */
.em-reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.7s ease, transform 0.7s ease; }
.em-reveal.in { opacity: 1; transform: none; }

/* A small "pop" used for celebrations */
.em-pop { animation: em-pop 0.45s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes em-pop { 0% { transform: scale(0.94); } 60% { transform: scale(1.04); } 100% { transform: scale(1); } }
.em-gem.em-pop { animation: em-gem-pop 0.6s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes em-gem-pop { 0% { transform: rotate(45deg) scale(0.5); } 60% { transform: rotate(225deg) scale(1.5); } 100% { transform: rotate(405deg) scale(1); } }

/* ======= 1A. WAVE TUNER ======= */
.em-tuner-screen {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  background: radial-gradient(ellipse at 50% 50%, #17121F, #07060A 75%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07);
}
.em-tuner-screen canvas { display: block; width: 100%; height: clamp(170px, 26vw, 250px); }
.em-tuner-bandname {
  position: absolute;
  left: 16px; bottom: 10px;
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 3vw, 1.6rem);
  text-shadow: 0 0 18px currentColor;
}
.em-invisible-tag {
  position: absolute;
  top: 10px; right: 10px;
  margin: 0;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: var(--ink);
  font-size: 0.8rem;
}
.em-tuner-label { display: block; margin: 18px 0 6px; font-weight: 700; }
.em-tuner-label span { color: var(--orange); }
.em-tuner-range, .em-prism-controls input[type="range"], .em-slider input[type="range"] {
  width: 100%;
  height: 34px;
  margin: 0;
  background: transparent;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
.em-tuner-range::-webkit-slider-runnable-track { height: 14px; border-radius: 999px; background: var(--spectrum); box-shadow: 0 0 14px rgba(179, 107, 255, 0.35); }
.em-tuner-range::-moz-range-track { height: 14px; border-radius: 999px; background: var(--spectrum); }
.em-tuner-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 32px; height: 32px; margin-top: -9px;
  border: 3px solid #fff; border-radius: 50%;
  background: var(--thumb, #FFE14D);
  box-shadow: 0 0 16px var(--thumb, #FFE14D), 0 2px 6px rgba(0, 0, 0, 0.5);
}
.em-tuner-range::-moz-range-thumb {
  width: 26px; height: 26px;
  border: 3px solid #fff; border-radius: 50%;
  background: var(--thumb, #FFE14D);
  box-shadow: 0 0 16px var(--thumb, #FFE14D);
}
.em-band-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.em-chip {
  min-height: 40px;
  padding: 6px 14px;
  border: 1px solid #6B5A54;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s;
}
.em-chip:hover { border-color: var(--orange); }
.em-chip[aria-pressed="true"] { border-color: #fff; background: rgba(255, 255, 255, 0.12); }
.em-chip[data-band="radio"] { box-shadow: inset 4px 0 0 var(--radio); }
.em-chip[data-band="microwave"] { box-shadow: inset 4px 0 0 var(--microwave); }
.em-chip[data-band="infrared"] { box-shadow: inset 4px 0 0 var(--infrared); }
.em-chip[data-band="visible"] { box-shadow: inset 4px 0 0 var(--visible); }
.em-chip[data-band="ultraviolet"] { box-shadow: inset 4px 0 0 var(--ultraviolet); }
.em-chip[data-band="xray"] { box-shadow: inset 4px 0 0 var(--xray); }
.em-chip[data-band="gamma"] { box-shadow: inset 4px 0 0 var(--gamma); }

.em-readout { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.em-stat {
  display: flex; flex-direction: column; gap: 2px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.045);
}
.em-stat-label { color: var(--muted); font-size: 0.8rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.em-stat-value { font-weight: 700; font-size: 1.02rem; overflow-wrap: anywhere; }
.em-stat-small { font-size: 0.92rem; }
.em-meter { display: block; height: 10px; margin: 6px 0 4px; border-radius: 999px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.em-meter-fill { display: block; height: 100%; width: 50%; border-radius: inherit; background: var(--spectrum); background-size: 100vw 100%; transition: width 0.2s; }

.em-bandcard {
  --c: #FFE14D;
  margin-top: 18px;
  padding: 18px 20px;
  border: 1px solid color-mix(in srgb, var(--c) 45%, transparent);
  border-radius: 18px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--c) 14%, transparent), rgba(255, 255, 255, 0.02) 60%);
}
.em-bandcard.is-visible { border-color: rgba(255, 255, 255, 0.35); background: linear-gradient(135deg, rgba(255, 26, 26, 0.10), rgba(60, 255, 60, 0.08), rgba(46, 75, 255, 0.10)); }
.em-bandcard-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
.em-bandcard h4 { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 1.4rem; color: var(--c); }
.em-bandcard.is-visible h4 { background: var(--rainbow); -webkit-background-clip: text; background-clip: text; color: transparent; }
.em-bc-range { margin: 0; color: var(--muted); }
.em-bc-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 22px; margin: 14px 0 0; }
.em-bc-facts dt { margin-bottom: 2px; font-weight: 700; }
.em-bc-facts dd { margin: 0; color: #E3D6CE; }
.em-bc-health { padding: 10px 12px; margin: -10px -12px; border-radius: 12px; background: rgba(124, 255, 158, 0.07); }

.em-truescale { margin-top: 22px; }
.em-truescale-title { margin: 0 0 32px; color: var(--muted); }
.em-truescale-title strong { color: var(--ink); }
.em-truescale-bar { display: flex; height: 26px; border-radius: 8px; }
.em-ts-seg {
  position: relative;
  display: grid; place-items: center;
  height: 100%;
  background: color-mix(in srgb, var(--c) 30%, #111);
  border-right: 1px solid rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  overflow: visible;
}
.em-ts-seg:first-child { border-radius: 8px 0 0 8px; }
.em-ts-seg:last-child { border-radius: 0 8px 8px 0; border-right: 0; }
.em-ts-seg > span:not(.em-ts-pin) { overflow: hidden; max-width: 100%; white-space: nowrap; text-overflow: clip; padding-inline: 2px; }
.em-ts-visible { background: var(--rainbow); box-shadow: 0 0 12px #fff; z-index: 1; min-width: 4px; }
.em-ts-pin {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  padding: 3px 10px;
  border-radius: 999px;
  background: #fff;
  color: #120A06;
  font-size: 0.75rem;
  font-weight: 800;
  white-space: nowrap;
}
.em-ts-pin::after { content: ""; position: absolute; top: 100%; left: 50%; margin-left: -5px; border: 5px solid transparent; border-top-color: #fff; }
.em-truescale-ends { display: flex; justify-content: space-between; gap: 12px; margin-top: 6px; color: var(--muted); font-size: 0.82rem; }

/* ======= 1B. LIGHT MIXER ======= */
.em-mixer { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: clamp(1rem, 3vw, 2rem); align-items: center; }
.em-mixer-stage {
  position: relative;
  aspect-ratio: 1;
  max-width: 380px;
  width: 100%;
  justify-self: center;
  border-radius: 24px;
  background: #000;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  isolation: isolate;
  overflow: hidden;
}
.em-spot {
  position: absolute;
  width: 58%; aspect-ratio: 1;
  border-radius: 50%;
  mix-blend-mode: screen;
  filter: blur(2px);
  transition: background-color 0.12s;
}
.em-spot-r { left: 8%; top: 8%; }
.em-spot-g { right: 8%; top: 8%; }
.em-spot-b { left: 21%; bottom: 6%; }
.em-slider { display: grid; grid-template-columns: 7.5em minmax(0, 1fr) 3.2em; align-items: center; gap: 10px; margin-bottom: 8px; }
.em-slider label { font-weight: 700; }
.em-slider output { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.em-slider input::-webkit-slider-runnable-track { height: 12px; border-radius: 999px; background: linear-gradient(90deg, var(--track-c) var(--fill, 0%), rgba(255, 255, 255, 0.12) var(--fill, 0%)); }
.em-slider input::-moz-range-track { height: 12px; border-radius: 999px; background: linear-gradient(90deg, var(--track-c) var(--fill, 0%), rgba(255, 255, 255, 0.12) var(--fill, 0%)); }
.em-slider input::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; margin-top: -7px; border: 3px solid #fff; border-radius: 50%; background: var(--track-c); box-shadow: 0 0 12px var(--track-c); }
.em-slider input::-moz-range-thumb { width: 22px; height: 22px; border: 3px solid #fff; border-radius: 50%; background: var(--track-c); }
.em-slider-r { --track-c: #FF2A2A; }
.em-slider-g { --track-c: #2AFF5A; }
.em-slider-b { --track-c: #3A6BFF; }
.em-mix-result { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 10px 0 12px; }
.em-mix-swatch { display: inline-block; width: 28px; height: 28px; border-radius: 8px; box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.4), 0 0 14px rgba(255, 255, 255, 0.15); }

.em-challenges, .em-finds { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.em-challenges { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.em-challenges li, .em-finds li {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  transition: background-color 0.3s;
}
.em-check {
  flex: none;
  display: grid; place-items: center;
  width: 24px; height: 24px;
  border: 2px solid #6B5A54;
  border-radius: 50%;
  font-size: 0.85rem;
  font-weight: 900;
}
.done .em-check { border-color: var(--good); background: var(--good); color: #062010; }
.done .em-check::before { content: "✓"; }
.em-challenges li.done, .em-finds li.done { background: rgba(124, 255, 158, 0.10); }

.em-feedback { min-height: 1.5em; margin: 12px 0 0; }
.em-feedback.good { color: var(--good); }
.em-feedback.bad { color: var(--bad); }

/* ======= 1C. HIDDEN LIGHT (prism) ======= */
.em-prism { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: clamp(1rem, 3vw, 2rem); align-items: start; }
.em-prism-svg { display: block; width: 100%; height: auto; border-radius: 18px; cursor: ew-resize; touch-action: pan-y; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07); }
.em-beam { animation: em-beam 3s ease-in-out infinite alternate; }
@keyframes em-beam { from { opacity: 0.7; } to { opacity: 1; } }
.em-hidden-fan { transition: opacity 1s ease; }
.em-hidden-fan.found { opacity: 0.32; }
#em-probe-card.glowing { filter: drop-shadow(0 0 8px #96FF78); }
.em-prism-controls label { display: block; margin-bottom: 4px; font-weight: 700; }
.em-prism-controls input[type="range"]::-webkit-slider-runnable-track { height: 12px; border-radius: 999px; background: linear-gradient(90deg, #2a0d0d 0 21%, #FF1A1A 21%, #FF7A00, #FFE100, #3CFF3C, #00C8FF, #2E4BFF, #8A2BE2 79%, #170d2a 79%); }
.em-prism-controls input[type="range"]::-moz-range-track { height: 12px; border-radius: 999px; background: linear-gradient(90deg, #2a0d0d 0 21%, #FF1A1A 21%, #FF7A00, #FFE100, #3CFF3C, #00C8FF, #2E4BFF, #8A2BE2 79%, #170d2a 79%); }
.em-prism-controls input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; margin-top: -7px; border: 3px solid #fff; border-radius: 50%; background: #E2412F; }
.em-prism-controls input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; border: 3px solid #fff; border-radius: 50%; background: #E2412F; }
.em-prism-readout { display: grid; gap: 8px; margin: 12px 0 0; }
.em-prism-readout .em-stat { flex-direction: row; justify-content: space-between; align-items: baseline; gap: 10px; }
.em-finds { margin-top: 12px; }

/* ======= QUIZ GAMES (sort, duel, clinic) ======= */
.em-scorebar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px;
  margin-bottom: 14px;
  color: var(--muted);
}
.em-scorebar strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.em-streak { margin-left: auto; color: #FFB86B; font-weight: 800; }
.em-hearts { margin-left: auto; letter-spacing: 2px; }
.em-card-stage { display: grid; place-items: center; min-height: 170px; margin-bottom: 16px; }
.em-sort-card {
  --c: #FFFFFF;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  width: min(100%, 420px);
  padding: 22px 22px 20px;
  border-radius: 22px;
  background: linear-gradient(160deg, #2A2030, #171219);
  border: 1px solid rgba(255, 255, 255, 0.14);
  text-align: center;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  transition: transform 0.5s cubic-bezier(.2, 1.4, .4, 1), box-shadow 0.4s, border-color 0.4s;
}
.em-sort-card.fly { border-color: var(--c); box-shadow: 0 0 0 2px var(--c), 0 0 40px color-mix(in srgb, var(--c) 55%, transparent); transform: translateY(-4px) rotate(-1.5deg); }
.em-sort-emoji { font-size: 3rem; line-height: 1; }
.em-sort-text { margin: 0; font-size: 1.2rem; font-weight: 700; }
.em-band-btns { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.em-band-btn {
  --c: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 64px;
  padding: 8px 6px;
  border: 1px solid color-mix(in srgb, var(--c) 50%, transparent);
  border-radius: 14px;
  background: color-mix(in srgb, var(--c) 10%, #120E14);
  color: var(--ink);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: transform 0.15s, background-color 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.em-band-btn:hover:not(:disabled) { transform: translateY(-2px); background: color-mix(in srgb, var(--c) 22%, #120E14); box-shadow: 0 0 18px color-mix(in srgb, var(--c) 40%, transparent); }
.em-band-btn:disabled { cursor: default; opacity: 0.55; }
.em-band-btn.right { opacity: 1; border: 2px solid var(--good); box-shadow: 0 0 22px rgba(124, 255, 158, 0.45); }
.em-band-btn.wrong { opacity: 1; border: 2px dashed var(--bad); }
.em-band-btn.right::after { content: "✓"; color: var(--good); font-weight: 900; }
.em-band-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--c); box-shadow: 0 0 10px var(--c); }
.em-band-btn[data-band="visible"] .em-band-dot { background: var(--rainbow); }
.em-next-row { display: flex; justify-content: flex-end; margin-top: 10px; }
.em-result { margin-top: 18px; padding: 22px; border-radius: 18px; background: rgba(255, 255, 255, 0.05); text-align: center; }
.em-result p { margin: 0 0 10px; }
.em-result-stars { font-size: 2.4rem; color: #FFD45A; letter-spacing: 6px; text-shadow: 0 0 18px rgba(255, 212, 90, 0.6); }
.em-result-title { font-weight: 800; font-size: 1.2rem; }
.finished .em-card-stage, .finished .em-band-btns, .finished .em-duel-q, .finished .em-duel-arena, .finished .em-case, .finished > .em-feedback { display: none; }

/* Wave Duel */
.em-duel-q { margin: 0 0 14px; font-size: clamp(1.15rem, 3vw, 1.4rem); font-weight: 800; text-align: center; }
.em-duel-arena { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 12px; }
.em-duel-card {
  --c: #fff;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  min-height: 120px;
  padding: 18px 12px;
  border: 1px solid color-mix(in srgb, var(--c) 50%, transparent);
  border-radius: 20px;
  background: radial-gradient(ellipse at 50% 30%, color-mix(in srgb, var(--c) 22%, transparent), #120E14 75%);
  color: var(--ink);
  font-size: 1.1rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s;
}
.em-duel-card:hover:not(:disabled) { transform: translateY(-3px) scale(1.02); box-shadow: 0 0 26px color-mix(in srgb, var(--c) 45%, transparent); }
.em-duel-wave { display: block; width: 100%; max-width: 180px; height: 28px; overflow: visible; }
.em-duel-wave path { stroke: var(--c); filter: drop-shadow(0 0 4px var(--c)); }
.em-vs { font-family: var(--font-display); font-size: 1.4rem; color: var(--orange); text-shadow: 0 0 16px rgba(255, 138, 43, 0.7); }
.em-duel-tie {
  grid-column: 1 / -1;
  justify-self: center;
  min-height: 44px;
  padding: 8px 18px;
  border: 1px dashed #9A6A58;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
}
.em-duel-tie:hover:not(:disabled) { border-color: var(--orange); }
.em-duel-card:disabled, .em-duel-tie:disabled { cursor: default; opacity: 0.55; }
.em-duel-card.right, .em-duel-tie.right { opacity: 1; border: 2px solid var(--good); box-shadow: 0 0 26px rgba(124, 255, 158, 0.45); }
.em-duel-card.wrong, .em-duel-tie.wrong { opacity: 1; border: 2px dashed var(--bad); }
.em-hint { margin-top: 18px; }
.em-hint summary, .em-teacher summary { cursor: pointer; font-weight: 700; color: var(--ink); }
.em-hint p { color: var(--muted); }
.em-order { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0; padding: 0; list-style: none; counter-reset: none; }
.em-order li { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); font-weight: 700; font-size: 0.9rem; }
.em-order li + li::before { content: "→ "; color: var(--muted); }
.em-order .em-order-vis { border-color: #fff; background: linear-gradient(90deg, rgba(255, 26, 26, 0.25), rgba(60, 255, 60, 0.2), rgba(46, 75, 255, 0.25)); }

/* Light Clinic */
.em-case {
  display: flex; align-items: flex-start; gap: 16px;
  margin-bottom: 16px;
  padding: 18px 20px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(255, 107, 139, 0.10), rgba(255, 255, 255, 0.03));
  border: 1px solid rgba(255, 107, 139, 0.25);
  transition: border-color 0.4s, box-shadow 0.4s, background-color 0.4s;
}
.em-case.healed { border-color: var(--good); box-shadow: 0 0 30px rgba(124, 255, 158, 0.2); }
.em-case-emoji { font-size: 2.6rem; line-height: 1; }
.em-case-title { margin: 0 0 4px; color: #FFB3C6; font-weight: 800; letter-spacing: 0.03em; }
.em-case-text { margin: 0; font-size: 1.1rem; }
.em-clinic-btns { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.em-band-btn-lg { min-height: 72px; font-size: 1rem; }

/* ======= 3B. SUNLIGHT TO LIFE ======= */
.em-sun { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: clamp(1rem, 3vw, 2rem); align-items: start; }
.em-sun-scene svg { display: block; width: 100%; height: auto; border-radius: 18px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07); }
.em-sun-disc { animation: em-sun-pulse 4s ease-in-out infinite alternate; transform-origin: 70px 70px; }
@keyframes em-sun-pulse { from { transform: scale(0.96); } to { transform: scale(1.05); } }
.em-air-layer { transition: opacity 0.6s; }
.em-ray-legend { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; padding: 0; list-style: none; }
.em-ray-legend li { padding: 4px 10px; border: 1px solid var(--c); border-radius: 999px; font-size: 0.82rem; }
.em-ray-legend li::before { content: "✓ "; color: var(--good); font-weight: 900; }
.em-ray-legend li.stopped { border-style: dashed; color: var(--muted); }
.em-ray-legend li.stopped::before { content: "✕ "; color: var(--bad); }
.em-ray-legend li.some::before { content: "◐ "; color: #FFD45A; }
.em-ray { stroke-dasharray: 16 8; animation: em-ray-flow 1.4s linear infinite; stroke-linecap: round; }
.em-ray-thin { opacity: 0.55; }
@keyframes em-ray-flow { to { stroke-dashoffset: -48; } }
.em-ray-stop { opacity: 0.85; animation: em-stop 1.2s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: center; }
@keyframes em-stop { from { transform: scale(0.6); opacity: 0.5; } to { transform: scale(1.3); opacity: 1; } }
.em-obj { transition: filter 0.3s; }
.em-obj.active { filter: drop-shadow(0 0 10px #FFE14D) drop-shadow(0 0 4px #fff); }
.em-obj.danger { filter: drop-shadow(0 0 10px #FF4D4D); animation: em-danger 0.9s ease-in-out infinite alternate; }
@keyframes em-danger { from { opacity: 0.7; } to { opacity: 1; } }
.em-toggle {
  display: inline-flex; align-items: center; gap: 12px;
  min-height: 48px;
  padding: 8px 18px 8px 10px;
  border: 1px solid #9A6A58;
  border-radius: 999px;
  background: rgba(79, 168, 255, 0.08);
  color: var(--ink);
  font-weight: 600;
  cursor: pointer;
}
.em-toggle-track { position: relative; width: 46px; height: 26px; border-radius: 999px; background: #3A2622; transition: background-color 0.3s; }
.em-toggle-knob { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform 0.3s cubic-bezier(.2, 1.4, .4, 1); }
.em-toggle[aria-pressed="true"] .em-toggle-track { background: #2F7FD6; box-shadow: 0 0 12px rgba(79, 168, 255, 0.6); }
.em-toggle[aria-pressed="true"] .em-toggle-knob { transform: translateX(20px); }
.em-sun-status { margin: 12px 0; color: var(--muted); }
.em-sun-prompt { margin: 0 0 8px; font-weight: 700; }
.em-objs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.em-obj-btn {
  min-height: 48px;
  padding: 8px 12px;
  border: 1px solid #6B5A54;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}
.em-obj-btn:hover { border-color: var(--orange); }
.em-obj-btn[aria-pressed="true"] { border-color: #FFE14D; background: rgba(255, 225, 77, 0.10); }
.em-obj-btn.seen::after { content: " ✓"; color: var(--good); }
.em-obj-info { margin-top: 12px; padding: 14px 16px; border-radius: 14px; background: rgba(255, 255, 255, 0.05); min-height: 5em; }
.em-obj-info p { margin: 0; }
.em-obj-info .em-warn { margin-top: 8px; color: #FFB3A8; font-weight: 700; }

/* ======= FINISH ======= */
.em-bigideas { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0; padding: 0; list-style: none; counter-reset: idea; }
.em-bigideas li {
  position: relative;
  padding: 16px 18px 16px 58px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  counter-increment: idea;
}
.em-bigideas li::before {
  content: counter(idea);
  position: absolute;
  left: 16px; top: 14px;
  display: grid; place-items: center;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--orange);
  color: var(--on-accent);
  font-weight: 900;
  box-shadow: 0 0 14px rgba(255, 138, 43, 0.5);
}
.em-badges-title { margin: 40px 0 14px; font-size: 1.4rem; }
.em-badges { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; margin: 0; padding: 0; list-style: none; }
.em-badge a {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  height: 100%;
  padding: 16px 8px;
  border: 1px dashed #6B5A54;
  border-radius: 18px;
  color: var(--muted);
  text-align: center;
  text-decoration: none;
}
.em-badge-icon {
  display: grid; place-items: center;
  width: 58px; height: 58px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  font-size: 1.7rem;
  font-weight: 800;
}
.em-badge-name { color: var(--ink); font-weight: 800; font-size: 0.95rem; }
.em-badge-desc { font-size: 0.8rem; }
.em-badge.earned a { border: 1px solid rgba(255, 212, 90, 0.55); background: radial-gradient(ellipse at 50% 0%, rgba(255, 212, 90, 0.14), transparent 70%); }
.em-badge.earned .em-badge-icon { background: radial-gradient(circle, #FFE9A8, #FF9F43); box-shadow: 0 0 22px rgba(255, 180, 70, 0.55); }
.em-badge a:hover { border-color: var(--orange); }

.em-cert-wrap { margin-top: 28px; }
.em-cert-locked { padding: 18px 20px; border-radius: 16px; background: rgba(255, 255, 255, 0.04); text-align: center; }
.em-cert-locked p { margin: 0; }
.em-cert {
  position: relative;
  max-width: 720px;
  margin: 0 auto;
  padding: clamp(1.5rem, 5vw, 3rem);
  border-radius: 22px;
  background: #FFFBF3;
  color: #2A1A12;
  text-align: center;
  box-shadow: 0 0 0 6px #120A06, 0 0 0 10px #FFB000, 0 30px 60px rgba(0, 0, 0, 0.5);
}
.em-cert p { margin: 0 0 10px; }
.em-cert-eyebrow { color: #8A3A10; font-size: 0.8rem; font-weight: 800; letter-spacing: 0.18em; text-transform: uppercase; }
.em-cert-title { font-family: var(--font-display); font-size: clamp(2rem, 6vw, 3.2rem); line-height: 1.05; background: linear-gradient(90deg, #D9480F, #B8860B, #1E8C3A, #1F5FD6, #7A2BC2); -webkit-background-clip: text; background-clip: text; color: transparent; }
.em-cert-name { font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.6rem, 5vw, 2.4rem); font-style: italic; border-bottom: 2px solid #D9C7B5; display: inline-block; padding: 0 18px 4px; }
.em-cert-text { color: #5A4436; }
.em-cert-spectrum { height: 10px; margin: 18px auto 12px; max-width: 420px; border-radius: 999px; background: var(--spectrum); }
.em-cert-date { color: #5A4436; font-size: 0.9rem; }
.em-cert-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; margin-top: 20px; }
.em-cert-actions label { font-weight: 700; }
.em-cert-actions input {
  min-height: 48px;
  padding: 8px 14px;
  border: 1px solid #9A6A58;
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--ink);
  font: inherit;
}
.em-reset-row { margin: 28px 0 0; color: var(--muted); font-size: 0.92rem; text-align: center; }
.em-link-btn { padding: 4px 2px; border: 0; background: none; color: var(--orange); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

.em-teacher { margin-top: 32px; padding: 16px 20px; border: 1px solid var(--border); border-radius: 16px; background: rgba(255, 255, 255, 0.02); }
.em-teacher h4 { margin: 18px 0 6px; }
.em-teacher ul { margin: 0; padding-left: 1.2em; color: var(--muted); }
.em-teacher li { margin-bottom: 6px; }
.em-teacher strong { color: var(--ink); }

.em-more { text-align: center; }
.em-more h2 { margin: 0 0 20px; font-size: clamp(1.6rem, 4vw, 2.2rem); }

/* ======= TOAST + CELEBRATION LAYER ======= */
.em-toast {
  position: fixed;
  left: 50%; top: 14px;
  z-index: 60;
  display: flex; align-items: center; gap: 12px;
  max-width: min(92vw, 460px);
  padding: 12px 18px 12px 12px;
  border: 1px solid rgba(255, 212, 90, 0.6);
  border-radius: 18px;
  background: rgba(24, 18, 28, 0.95);
  box-shadow: 0 0 30px rgba(255, 180, 70, 0.35), 0 18px 40px rgba(0, 0, 0, 0.5);
  color: var(--ink);
  transform: translate(-50%, -140%);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.5s cubic-bezier(.2, 1.4, .4, 1), opacity 0.3s;
}
.em-toast.show { transform: translate(-50%, 0); opacity: 1; }
.em-toast:empty { display: none; }
.em-toast-icon { display: grid; place-items: center; flex: none; width: 46px; height: 46px; border-radius: 50%; background: radial-gradient(circle, #FFE9A8, #FF9F43); font-size: 1.5rem; }
.em-toast-body { display: flex; flex-direction: column; }
.em-toast-body span { color: var(--muted); font-size: 0.9rem; }
.em-fx { position: fixed; inset: 0; z-index: 55; width: 100vw; height: 100vh; pointer-events: none; }

/* ======= TABLETS ======= */
@media (max-width: 899px) {
  .em-hero-inner { grid-template-columns: 1fr; }
  .em-hero-art { max-width: 460px; }
  .em-readout { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .em-mixer, .em-prism, .em-sun { grid-template-columns: 1fr; }
  .em-band-btns { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .em-badges { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ======= PHONES ======= */
@media (max-width: 640px) {
  .em-how-steps { grid-template-columns: 1fr; }
  .em-bc-facts { grid-template-columns: 1fr; }
  .em-bigideas { grid-template-columns: 1fr; }
  .em-challenges { grid-template-columns: 1fr; }
  .em-band-btns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .em-clinic-btns { grid-template-columns: 1fr 1fr; }
  .em-badges { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .em-game-head { flex-direction: column; gap: 10px; }
  .em-game-icon { width: 44px; height: 44px; font-size: 1.35rem; }
  .em-duel-arena { grid-template-columns: 1fr; }
  .em-vs { justify-self: center; }
  .em-slider { grid-template-columns: 6.2em minmax(0, 1fr) 3em; }
  .em-ts-seg > span:not(.em-ts-pin) { display: none; }
  .em-hero-ctas { flex-direction: column; align-items: stretch; }
  .em-sound-label { display: none; }
  .em-tuner-screen { display: flex; flex-direction: column; }
  .em-tuner-bandname { position: static; order: 1; margin: -6px 14px 4px; }
  .em-invisible-tag { position: static; order: 2; align-self: flex-start; margin: 0 0 12px 12px; }
  .em-objs { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 359px) {
  .em-readout { grid-template-columns: 1fr; }
  .em-gem { width: 14px; height: 14px; }
  .em-gems { gap: 5px; }
}

/* ======= REDUCED MOTION: everything holds still ======= */
@media (prefers-reduced-motion: reduce) {
  .em-page *, .em-page *::before, .em-page *::after, .em-toast {
    animation: none !important;
    transition: none !important;
  }
  .em-hero-photons { display: none; }
}

/* ======= PRINT: only the certificate when "Print certificate" is pressed ======= */
@media print {
  body.em-print-cert * { visibility: hidden; }
  body.em-print-cert .em-cert, body.em-print-cert .em-cert * { visibility: visible; }
  body.em-print-cert .em-cert { position: absolute; left: 0; top: 0; width: 100%; box-shadow: none; border: 6px double #B8860B; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
