:root {
  --bg-deep: #060c1e;
  --bg-mid: #0b1428;
  --light-off-face: #181c2e;
  --light-off-rim: #242840;
  --light-on-core: #fff8e8;
  --light-on-warm: #f0a830;
  --light-on-outer: #c87818;
  --accent: #f0a830;
  --accent-soft: rgba(240, 168, 48, 0.15);
  --accent-border: rgba(240, 168, 48, 0.3);
  --light-size: clamp(62px, 12vmin, 100px);
  --circle-size: clamp(340px, 65vmin, 560px);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: var(--bg-deep);
  color: #c0c8e0;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  position: relative;
}

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

/* ── Game Wrapper ──────────────────────── */

#game-wrapper {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(24px, 4vh, 44px);
  padding: 24px;
}

/* ── Top Bar ───────────────────────────── */

#top-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  position: relative;
}

#title {
  font-size: clamp(1.5rem, 3.6vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  text-align: center;
  background: linear-gradient(135deg, var(--accent) 0%, var(--light-on-core) 50%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 18px rgba(240, 168, 48, 0.3));
}

/* ── Hint lightbulb button (upper left of screen) ── */
#hint-btn {
  position: fixed;
  top: clamp(14px, 2.4vh, 26px);
  left: clamp(14px, 2.4vw, 26px);
  width: clamp(58px, 7vw, 76px);
  height: clamp(58px, 7vw, 76px);
  border: none;
  border-radius: 50%;
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
  transition: transform 0.2s var(--spring), opacity 0.4s ease, filter 0.4s ease;
  -webkit-tap-highlight-color: transparent;
  padding: 0;
}

#hint-btn img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  display: block;
}

#hint-btn:hover { transform: scale(1.06); }
#hint-btn:active { transform: scale(0.94); }

#hint-btn.intro-hidden {
  opacity: 0.35;
  filter: grayscale(0.7);
  pointer-events: none;
  cursor: default;
}

/* ── Home button (upper right) ── */
#home-btn {
  position: fixed;
  top: clamp(14px, 2.4vh, 26px);
  right: clamp(14px, 2.4vw, 26px);
  width: clamp(44px, 5.5vw, 56px);
  height: clamp(44px, 5.5vw, 56px);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(240, 168, 48, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
  text-decoration: none;
  transition: transform 0.2s var(--spring), background 0.2s ease, color 0.2s ease;
  box-shadow:
    0 2px 10px rgba(0, 0, 0, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  -webkit-tap-highlight-color: transparent;
}

#home-btn svg {
  width: 56%;
  height: 56%;
}

#home-btn:hover {
  transform: scale(1.08);
  background: rgba(240, 168, 48, 0.12);
  color: var(--accent);
}

#home-btn:active { transform: scale(0.94); }

/* ── Hint panel (anchored below the lightbulb) ── */
#hint-panel {
  position: fixed;
  top: clamp(100px, 13vh, 140px);
  left: clamp(14px, 2.4vw, 26px);
  width: min(320px, calc(50vw - 40px));
  opacity: 0;
  transform: translateY(-6px) scale(0.96);
  transform-origin: top left;
  pointer-events: none;
  z-index: 25;
  transition: opacity 0.3s ease, transform 0.4s var(--spring);
  background:
    radial-gradient(ellipse 80% 60% at 30% 10%, rgba(240, 168, 48, 0.06) 0%, transparent 60%),
    rgba(14, 14, 30, 0.96);
  border-radius: 14px;
  border: 1px solid rgba(240, 168, 48, 0.25);
  box-shadow:
    0 14px 40px rgba(0, 0, 0, 0.5),
    0 4px 12px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  padding: clamp(16px, 2.4vw, 22px) clamp(16px, 2.4vw, 22px) clamp(8px, 1.2vw, 12px);
}

#hint-panel.show {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

#hint-close {
  position: absolute;
  top: 6px;
  right: 10px;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.3);
  font-size: clamp(1.1rem, 1.8vw, 1.3rem);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  line-height: 1;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

#hint-close:hover {
  color: rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.08);
}

#hint-body {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: clamp(10px, 1.6vw, 14px);
}

#hint-text {
  font-size: clamp(1rem, 2.15vw, 1.15rem);
  line-height: 1.55;
  color: rgba(245, 220, 170, 0.9);
  font-weight: 500;
  margin: 0;
  letter-spacing: 0.005em;
  text-align: center;
  transition: opacity 0.22s ease, transform 0.25s var(--spring);
}

#hint-text.fade-swap {
  opacity: 0;
  transform: translateY(-3px);
}

#hint-text strong {
  color: #fde68a;
  font-weight: 800;
  letter-spacing: 0.03em;
}

#hint-text .yes { color: #5ee6a3; font-weight: 800; }
#hint-text .no  { color: #ff7b7b; font-weight: 800; }

/* ── Insight title (e.g. "Insight #1") — big, prominent, distinct ─── */
#hint-text .hint-insight-title {
  font-family: inherit;
  font-size: clamp(1.25rem, 2.8vw, 1.55rem);
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #f5d888;
  text-align: center;
  margin-bottom: 0;
  line-height: 1.1;
  text-shadow: 0 1px 10px rgba(240, 168, 48, 0.25);
}

#hint-text .hint-insight-title .num {
  display: inline-block;
  margin-left: 4px;
  font-size: 1.18em;
  font-weight: 900;
  color: #ffd86b;
  letter-spacing: 0.04em;
  text-shadow: 0 0 14px rgba(255, 216, 107, 0.5);
}

/* Divider under insight title (and between stacked lines) */
#hint-text .hint-divider {
  width: clamp(80px, 18vw, 120px);
  height: 1.5px;
  margin: 10px auto 14px;
  background: linear-gradient(90deg, transparent, rgba(255, 216, 107, 0.75), transparent);
  border: 0;
}

#hint-text .hint-divider.subtle {
  width: clamp(50px, 12vw, 80px);
  height: 1px;
  margin: 10px auto;
  background: linear-gradient(90deg, transparent, rgba(245, 220, 170, 0.22), transparent);
}

/* ── Insight #1: three statements, progressive emphasis ─────────── */
#hint-text .hint-insight-main {
  font-size: clamp(0.98rem, 2.1vw, 1.1rem);
  font-weight: 800;
  color: #ffd86b;
  letter-spacing: 0.02em;
  margin: 6px 0 18px;
  white-space: nowrap;
  text-shadow: 0 0 10px rgba(255, 216, 107, 0.25);
}

#hint-text .hint-insight-sub {
  font-size: clamp(0.98rem, 2vw, 1.08rem);
  font-weight: 500;
  color: rgba(245, 220, 170, 0.92);
  margin: 14px 0;
}

#hint-text .hint-insight-micro {
  font-size: clamp(0.98rem, 2vw, 1.08rem);
  font-weight: 500;
  color: rgba(245, 220, 170, 0.78);
  margin-top: 16px;
}

/* Body lines inside a hint */
#hint-text .hint-line {
  margin: 0;
  padding: 2px 0;
}

#hint-text .hint-line-lead {
  color: rgba(245, 220, 170, 0.7);
  font-size: 0.98em;
  margin-bottom: 4px;
}

#hint-text .hint-line-muted {
  color: rgba(245, 220, 170, 0.62);
  font-style: italic;
  font-size: 0.92em;
  margin-top: 14px;
}

/* ── pulse-all: progressive color/weight for 3 lines ─────────────── */
#hint-text .hint-progression {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

#hint-text .hint-prog-line {
  margin: 0;
  line-height: 1.35;
}

#hint-text .hint-prog-1 {
  font-size: clamp(1.02rem, 2.15vw, 1.12rem);
  color: rgba(245, 220, 170, 0.85);
  font-weight: 500;
}

#hint-text .hint-prog-2 {
  font-size: clamp(1.02rem, 2.15vw, 1.12rem);
  color: rgba(245, 220, 170, 0.95);
  font-weight: 600;
}

#hint-text .hint-prog-3 {
  font-size: clamp(1.18rem, 2.55vw, 1.35rem);
  color: #ffd86b;
  font-weight: 800;
  font-style: italic;
  letter-spacing: 0.015em;
  text-shadow: 0 0 12px rgba(255, 216, 107, 0.3);
}

/* ── three-click-q: bullet list of bulbs to click ────────────────── */
#hint-text .hint-bullets {
  list-style: none;
  padding: 0;
  margin: 6px auto 12px;
  display: inline-block;
  text-align: left;
}

#hint-text .hint-bullets li {
  position: relative;
  padding: 3px 0 3px 22px;
  font-size: clamp(1rem, 2.1vw, 1.1rem);
  color: rgba(245, 220, 170, 0.95);
}

#hint-text .hint-bullets li::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 50%;
  width: 10px;
  height: 2px;
  background: rgba(255, 216, 107, 0.65);
  border-radius: 1px;
  transform: translateY(-50%);
}

/* The "focus" bullet — bulb the question is about. Slightly highlighted
   in gold so it visually ties to the ?-marks on the board. */
#hint-text .hint-bullets li.hint-bullet-focus {
  color: #ffd86b;
  font-weight: 700;
}

#hint-text .hint-bullets li.hint-bullet-focus::before {
  background: #ffd86b;
  box-shadow: 0 0 6px rgba(255, 216, 107, 0.55);
}

/* Bulb #1 cue in three-click-q: no hard outline ring — only a soft gold halo
   that pulses while asking; after the answer, a steady bright halo (still no stroke). */
.light.hint-ring-pulse .light-face,
.light.hint-ring-solid .light-face {
  outline: none !important;
  outline-offset: 0 !important;
}

.light.hint-ring-pulse .light-face {
  animation: hintBulbGlowPulse 3.4s cubic-bezier(0.42, 0.01, 0.58, 0.99) infinite !important;
}

@keyframes hintBulbGlowPulse {
  0%, 100% {
    filter:
      drop-shadow(0 0 4px rgba(255, 216, 107, 0.18))
      drop-shadow(0 0 11px rgba(255, 216, 107, 0.09))
      brightness(0.98);
  }
  50% {
    filter:
      drop-shadow(0 0 8px rgba(255, 216, 107, 0.55))
      drop-shadow(0 0 18px rgba(255, 216, 107, 0.32))
      brightness(1.04);
  }
}

.light.hint-ring-solid .light-face {
  animation: none !important;
  filter:
    drop-shadow(0 0 8px rgba(255, 216, 107, 0.95))
    drop-shadow(0 0 22px rgba(255, 216, 107, 0.52))
    brightness(1.06);
}

/* Insight #2 intro: only the middle bulb (#1) — static gold ring + soft glow.
   Three arrows still point at #7, #1, #2; hint-mode stays off (no numbers). */
.light.insight2-cue .light-face {
  outline-style: solid !important;
  outline-width: 4px !important;
  outline-offset: 8px !important;
  outline-color: rgba(255, 216, 107, 0.88) !important;
  animation: none !important;
  filter:
    drop-shadow(0 0 8px rgba(255, 216, 107, 0.5))
    drop-shadow(0 0 18px rgba(255, 216, 107, 0.28))
    brightness(1.04) !important;
}

/* ── Insight #2: IF/THEN blocks w/ reveal ─────────────────────────── */
#hint-text .hint-eq-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 4px auto;
  padding: 14px 22px 16px;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* IF / THEN tiny tag — centered gold/green pill */
#hint-text .hint-eq-tag {
  display: inline-block;
  align-self: center;
  margin: 0 0 8px;
  padding: 2px 11px;
  font-size: clamp(0.62rem, 1.2vw, 0.72rem);
  font-weight: 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #1a1410;
  background: linear-gradient(135deg, #ffd86b, #f0a830);
  border-radius: 4px;
  box-shadow: 0 0 10px rgba(255, 216, 107, 0.35);
}

#hint-text .hint-eq-tag.tag-then {
  color: #0a1410;
  background: linear-gradient(135deg, #aaf3c7, #5ee6a3);
  box-shadow: 0 0 10px rgba(94, 230, 163, 0.4);
}

#hint-text .hint-eq-cond {
  font-size: clamp(0.98rem, 2.05vw, 1.1rem);
  color: rgba(245, 220, 170, 0.95);
  font-weight: 600;
  font-style: normal;
  white-space: normal;
  text-align: center;
  padding: 0 4px;
  max-width: 100%;
  line-height: 1.45;
  word-break: normal;
  overflow-wrap: break-word;
}

/* Faint inner divider between the IF and THEN halves */
#hint-text .hint-eq-divider {
  height: 1px;
  width: 100%;
  margin: 12px 0;
  background: linear-gradient(90deg,
    transparent,
    rgba(255, 216, 107, 0.28),
    rgba(94, 230, 163, 0.28),
    transparent);
}

#hint-text .hint-eq-result {
  font-size: clamp(0.98rem, 2.05vw, 1.1rem);
  font-weight: 600;
  color: rgba(245, 220, 170, 0.95);
  text-align: center;
  padding: 0 4px;
  max-width: 100%;
  line-height: 1.45;
  white-space: normal;
  overflow-wrap: break-word;
}

#hint-text .hint-eq-result strong.on {
  color: #5ee6a3;
  text-shadow: 0 0 12px rgba(94, 230, 163, 0.55);
  margin-left: 6px;
  font-weight: 900;
  font-size: clamp(1.08rem, 2.35vw, 1.22rem);
  letter-spacing: 0.04em;
}

/* Insight #2 blocks — soft tinted panel (no heavy border; text can wrap). */
#hint-text .hint-eq-block-feature {
  position: relative;
  margin: 10px auto 6px;
  padding: 14px clamp(12px, 3vw, 20px) 18px;
  border-radius: 14px;
  border: 1px solid rgba(255, 216, 107, 0.12);
  background: linear-gradient(
    145deg,
    rgba(42, 38, 32, 0.92) 0%,
    rgba(94, 230, 163, 0.07) 45%,
    rgba(255, 216, 107, 0.08) 100%
  );
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
  overflow: visible;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* Big narrative bridge between the two IF/THEN blocks */
#hint-text .hint-eq-so {
  text-align: center;
  margin: clamp(14px, 2.2vh, 22px) auto clamp(6px, 1vh, 12px);
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(1.55rem, 4.2vw, 2.15rem);
  font-weight: 700;
  font-style: italic;
  letter-spacing: 0.02em;
  color: rgba(255, 216, 107, 0.88);
  text-shadow: 0 0 20px rgba(255, 216, 107, 0.25);
  line-height: 1.1;
}

/* Motivating finale — warm, prominent, draws the student toward free-play */
#hint-text .hint-finale {
  margin: 20px auto 4px;
  padding: 14px 18px 12px;
  text-align: center;
  border-radius: 14px;
  background: radial-gradient(ellipse at center,
    rgba(255, 216, 107, 0.08) 0%,
    transparent 75%);
}

#hint-text .hint-finale-lead {
  font-size: clamp(0.98rem, 2.05vw, 1.08rem);
  font-weight: 500;
  font-style: italic;
  color: rgba(245, 220, 170, 0.75);
  letter-spacing: 0.015em;
  margin-bottom: 10px;
}

#hint-text .hint-finale-cta {
  font-size: clamp(1.3rem, 2.8vw, 1.55rem);
  font-weight: 800;
  font-style: italic;
  font-family: Georgia, 'Times New Roman', serif;
  background: linear-gradient(135deg, #ffe9a3 0%, #5ee6a3 100%);
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: 0.015em;
  text-shadow: 0 0 18px rgba(255, 216, 107, 0.35);
  animation: finalePulse 2.6s ease-in-out infinite;
}

@keyframes finalePulse {
  0%, 100% { filter: brightness(1); transform: translateY(0); }
  50%      { filter: brightness(1.18); transform: translateY(-1px); }
}

/* Reveal button — click to expose second half of Insight #2 */
#hint-text .hint-reveal-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 14px auto 6px;
  width: 46px;
  height: 30px;
  padding: 0;
  background: rgba(240, 168, 48, 0.08);
  border: 1px solid rgba(240, 168, 48, 0.28);
  border-radius: 999px;
  color: var(--accent);
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease, opacity 0.35s ease;
  animation: revealPulse 2.2s ease-in-out infinite;
}

#hint-text .hint-reveal-btn:hover {
  background: rgba(240, 168, 48, 0.2);
  transform: translateY(1px);
}

#hint-text .hint-reveal-btn:active { transform: translateY(2px) scale(0.97); }

#hint-text .hint-reveal-btn svg {
  width: 20px;
  height: 20px;
}

#hint-text .hint-reveal-btn.spent {
  opacity: 0;
  pointer-events: none;
  height: 0;
  margin: 0 auto;
  border-width: 0;
  animation: none;
}

@keyframes revealPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 216, 107, 0.0); }
  50%      { box-shadow: 0 0 0 6px rgba(255, 216, 107, 0.14); }
}

#hint-text .hint-reveal-content {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.55s ease, opacity 0.4s ease 0.1s;
}

#hint-text .hint-reveal-content.revealed {
  max-height: 360px;
  opacity: 1;
}

#hint-next {
  display: flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-width: 54px;
  margin: clamp(10px, 1.6vw, 14px) auto 0;
  padding: clamp(5px, 0.9vw, 8px) clamp(22px, 2.8vw, 32px);
  background: rgba(240, 168, 48, 0.08);
  border: 1px solid rgba(240, 168, 48, 0.25);
  border-radius: 8px;
  color: var(--accent);
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease, opacity 0.25s ease;
  -webkit-tap-highlight-color: transparent;
}

#hint-next:hover { background: rgba(240, 168, 48, 0.16); }
#hint-next:active { transform: scale(0.96); }

#hint-next svg {
  width: clamp(20px, 2.6vw, 26px);
  height: clamp(20px, 2.6vw, 26px);
}

#hint-next.hidden {
  display: none;
}

/* ── Check / X badges on lights (proof walkthrough) ── */
.light-label {
  position: absolute;
  top: 50%;
  left: 50%;
  width: clamp(30px, 5.5vmin, 48px);
  height: clamp(30px, 5.5vmin, 48px);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0.3) rotate(-25deg);
  opacity: 0;
  pointer-events: none;
  z-index: 5;
  transition: opacity 0.32s ease, transform 0.5s var(--spring);
}

.light-label svg {
  width: 70%;
  height: 70%;
  stroke-width: 3.5;
}

.light-label.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1) rotate(0deg);
}

.light-label.yes {
  background: linear-gradient(160deg, #1a3a28, #0f2418);
  color: #7aefa8;
  border: 2px solid rgba(94, 230, 163, 0.75);
  box-shadow:
    0 0 18px rgba(94, 230, 163, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.light-label.no {
  background: linear-gradient(160deg, #3a1a1a, #240d0d);
  color: #ff9e9e;
  border: 2px solid rgba(255, 123, 123, 0.75);
  box-shadow:
    0 0 18px rgba(255, 123, 123, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* ── Decision rings (click / don't click) ── */
.light-face::before {
  content: '';
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 6px solid transparent;
  pointer-events: none;
  z-index: 3;
  transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.35s var(--spring);
  transform: scale(0.85);
  opacity: 0;
}

.light.decision-yes .light-face::before,
.light.decision-no .light-face::before {
  transform: scale(1);
  opacity: 1;
}

.light.decision-yes .light-face::before {
  border-color: rgba(94, 230, 163, 0.95);
  box-shadow:
    0 0 18px rgba(94, 230, 163, 0.55),
    inset 0 0 10px rgba(94, 230, 163, 0.35);
}

.light.decision-no .light-face::before {
  border-color: rgba(255, 95, 95, 0.95);
  box-shadow:
    0 0 18px rgba(255, 95, 95, 0.55),
    inset 0 0 10px rgba(255, 95, 95, 0.35);
}

/* Focus: suppress generic face animations unless the hint halo is active. */
.light.focus .light-face {
  animation: none;
}

.light.focus.hint-ring-pulse .light-face {
  animation: hintBulbGlowPulse 3.4s cubic-bezier(0.42, 0.01, 0.58, 0.99) infinite !important;
}

.light.focus.hint-ring-solid .light-face {
  animation: none !important;
}

/* Solid yellow ring used to call out a single bulb (e.g. "#1 ends ON"). */
.light.ring-yellow .light-face {
  outline-color: #ffd86b;
  outline-width: 4px;
  outline-offset: 6px;
}

/* Light flashing red on contradiction */
.light.contradict .light-face {
  animation: contradictFlash 0.7s ease-in-out 3;
}

@keyframes contradictFlash {
  0%, 100% {
    box-shadow:
      inset 0 2px 8px rgba(0, 0, 0, 0.6),
      0 0 0 rgba(255, 80, 80, 0);
    outline-color: transparent;
  }
  50% {
    box-shadow:
      inset 0 2px 8px rgba(0, 0, 0, 0.6),
      0 0 22px 8px rgba(255, 80, 80, 0.6);
    outline-color: rgba(255, 100, 100, 0.9);
  }
}

/* ── Contradiction flash (brief overlay over whole board) ── */
#lights-row.contradict-flash::after {
  content: '';
  position: absolute;
  inset: -40px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 70, 70, 0.25) 0%, transparent 65%);
  animation: contradictBurst 0.9s ease-out;
  pointer-events: none;
}

@keyframes contradictBurst {
  0%   { opacity: 0; transform: scale(0.8); }
  35%  { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.2); }
}

/* ── Light numbers + yes/no toggles (shown during hint walkthrough) ── */
.light-number {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: clamp(1rem, 2.4vmin, 1.35rem);
  font-weight: 800;
  color: rgba(255, 240, 200, 0.95);
  text-shadow:
    0 1px 2px rgba(0, 0, 0, 0.7),
    0 0 12px rgba(0, 0, 0, 0.55);
  pointer-events: none;
  z-index: 4;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.light.on .light-number {
  color: rgba(40, 20, 0, 0.85);
  text-shadow: 0 0 8px rgba(255, 240, 200, 0.8);
}

#lights-row.hint-mode .light-number {
  opacity: 1;
}

.light-toggle {
  position: absolute;
  bottom: calc(-1 * clamp(26px, 4.2vmin, 34px));
  left: 50%;
  transform: translateX(-50%);
  width: clamp(44px, 7.2vmin, 60px);
  height: clamp(22px, 3.6vmin, 28px);
  border-radius: 999px;
  background: rgba(30, 34, 55, 0.9);
  border: 1.5px solid rgba(140, 150, 190, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 4;
  opacity: 0;
  transition: opacity 0.3s ease, background 0.35s ease, border-color 0.35s ease,
              transform 0.35s var(--spring), box-shadow 0.35s ease;
}

.light-toggle svg {
  width: 60%;
  height: 60%;
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.light-toggle .toggle-q {
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: clamp(0.95rem, 2vmin, 1.15rem);
  font-weight: 800;
  color: rgba(200, 210, 240, 0.7);
  display: none;
}

.light-toggle .toggle-icon { display: none; }

.light-toggle.undecided { color: rgba(200, 210, 240, 0.7); }
/* Undecided toggles stay empty — no "?" or pill visible until marked. */
#lights-row.hint-mode .light-toggle.undecided { opacity: 0; }

.light-toggle.yes {
  background: linear-gradient(160deg, #1a4a2e, #0f2418);
  border-color: rgba(94, 230, 163, 0.85);
  color: #7aefa8;
  box-shadow:
    0 0 14px rgba(94, 230, 163, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.light-toggle.yes .icon-check { display: inline; }

.light-toggle.no {
  background: linear-gradient(160deg, #4a1a1a, #240d0d);
  border-color: rgba(255, 123, 123, 0.85);
  color: #ff9e9e;
  box-shadow:
    0 0 14px rgba(255, 123, 123, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.light-toggle.no .icon-x { display: inline; }

#lights-row.hint-mode .light-toggle {
  opacity: 1;
}

.light-toggle.flash {
  transform: translateX(-50%) scale(1.15);
  animation: toggleFlash 0.55s var(--spring);
}

@keyframes toggleFlash {
  0%   { transform: translateX(-50%) scale(0.6); }
  55%  { transform: translateX(-50%) scale(1.2); }
  100% { transform: translateX(-50%) scale(1); }
}

/* ── Experiment banner + growing logic list inside the hint panel ── */
#hint-banner {
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: clamp(0.82rem, 1.7vw, 0.95rem);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-align: center;
  color: #ffd08a;
  background: linear-gradient(90deg,
    rgba(240, 168, 48, 0.05),
    rgba(240, 168, 48, 0.18),
    rgba(240, 168, 48, 0.05));
  border-top: 1px solid rgba(240, 168, 48, 0.35);
  border-bottom: 1px solid rgba(240, 168, 48, 0.35);
  padding: clamp(6px, 1vw, 9px) clamp(8px, 1.4vw, 12px);
  margin: 0;
  text-transform: uppercase;
  animation: bannerIn 0.45s var(--spring);
}

@keyframes bannerIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

#hint-banner.hidden { display: none; }

#hint-logic-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: clamp(6px, 1vw, 9px);
  max-height: 38vh;
  overflow-y: auto;
}

#hint-logic-list.hidden { display: none; }

#hint-logic-list .logic-step {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: clamp(6px, 1vw, 9px) clamp(8px, 1.4vw, 11px);
  background: rgba(240, 168, 48, 0.05);
  border-left: 3px solid rgba(240, 168, 48, 0.35);
  border-radius: 6px;
  font-size: clamp(0.82rem, 1.65vw, 0.92rem);
  line-height: 1.35;
  color: rgba(220, 220, 240, 0.75);
  opacity: 0;
  transform: translateY(-4px);
  animation: logicStepIn 0.4s var(--spring) forwards;
}

@keyframes logicStepIn {
  to { opacity: 1; transform: translateY(0); }
}

#hint-logic-list .logic-step.current {
  background: rgba(240, 168, 48, 0.16);
  border-left-color: var(--accent);
  color: #fde68a;
  box-shadow: 0 0 0 1px rgba(240, 168, 48, 0.22) inset;
}

#hint-logic-list .logic-step .logic-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: clamp(18px, 2.8vmin, 22px);
  height: clamp(18px, 2.8vmin, 22px);
  border-radius: 50%;
  background: rgba(240, 168, 48, 0.18);
  color: var(--accent);
  font-weight: 800;
  font-size: clamp(0.7rem, 1.35vw, 0.8rem);
  flex-shrink: 0;
  line-height: 1;
}

#hint-logic-list .logic-step.current .logic-num {
  background: var(--accent);
  color: #1a0f00;
}

#hint-logic-list .logic-step.contradiction {
  background: rgba(255, 95, 95, 0.12);
  border-left-color: #ff7b7b;
  color: #ffbaba;
}

#hint-logic-list .logic-step.contradiction .logic-num {
  background: #ff7b7b;
  color: #3a0a0a;
}

#hint-logic-list .logic-step .logic-text .yes { color: #7aefa8; font-weight: 700; }
#hint-logic-list .logic-step .logic-text .no  { color: #ff9e9e; font-weight: 700; }
#hint-logic-list .logic-step .logic-text strong { color: #fde68a; font-weight: 800; }

/* Increase hint panel width when proof is being walked through */
#hint-panel.proof-mode {
  width: min(380px, calc(50vw - 28px));
}

/* In proof mode, the logic list IS the current message — hide the header text. */
#hint-panel.proof-mode #hint-text {
  display: none;
}

/* When numbers/toggles are on the bulbs, give some extra space for the toggle below */
#lights-row.hint-mode {
  padding-bottom: clamp(24px, 4vmin, 34px);
}

/* ── Center-to-light pointing arrow ── */
.center-arrow {
  --arrow-h: clamp(12px, 1.6vmin, 16px);
  --arrow-angle: -90deg;
  position: absolute;
  top: calc(50% - (var(--arrow-h) / 2));
  left: 50%;
  width: 24%;
  height: var(--arrow-h);
  transform: rotate(var(--arrow-angle));
  transform-origin: 0% 50%;
  pointer-events: none;
  z-index: 4;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.55s var(--spring);
}

.center-arrow.show { opacity: 1; }

.center-arrow svg {
  width: 100%;
  height: 100%;
  overflow: visible;
  filter: drop-shadow(0 0 6px rgba(255, 220, 100, 0.55));
}

.center-arrow .arrow-shaft,
.center-arrow .arrow-head {
  stroke: #ffd86b;
  stroke-width: 4;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── Yes / No choice in hint panel ── */
#hint-choice-row {
  display: flex;
  gap: 10px;
}

#hint-choice-row.hidden { display: none; }

.hint-choice {
  flex: 1 1 0;
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: clamp(0.95rem, 2.1vw, 1.1rem);
  font-weight: 700;
  color: var(--accent);
  background: rgba(240, 168, 48, 0.08);
  border: 1px solid rgba(240, 168, 48, 0.35);
  border-radius: 9px;
  padding: 10px 12px;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease, box-shadow 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  letter-spacing: 0.04em;
}

.hint-choice:hover {
  background: rgba(240, 168, 48, 0.18);
  box-shadow: 0 0 14px rgba(240, 168, 48, 0.35);
}

.hint-choice:active { transform: scale(0.96); }

.hint-choice.correct {
  background: rgba(94, 230, 163, 0.2);
  border-color: rgba(94, 230, 163, 0.7);
  color: #aaf3c7;
  box-shadow: 0 0 18px rgba(94, 230, 163, 0.45);
}

.hint-choice.wrong {
  background: rgba(255, 123, 123, 0.18);
  border-color: rgba(255, 123, 123, 0.65);
  color: #ffbfbf;
  animation: hintShake 0.38s ease 1;
}

@keyframes hintShake {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-5px); }
  75%      { transform: translateX(5px); }
}

/* ── Hint feedback line ── */
#hint-feedback {
  font-size: clamp(0.88rem, 2vw, 1rem);
  line-height: 1.45;
  margin: 0;
  font-style: italic;
  color: rgba(240, 168, 48, 0.85);
  opacity: 0;
  transform: translateY(-3px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  text-align: center;
}

#hint-feedback.hidden { display: none; }

#hint-feedback.show {
  opacity: 1;
  transform: translateY(0);
}

#hint-feedback.correct { color: #aaf3c7; font-style: normal; }
#hint-feedback.wrong   { color: #ffbfbf; font-style: normal; }

#hint-feedback strong.on {
  color: #5ee6a3;
  text-shadow: 0 0 10px rgba(94, 230, 163, 0.4);
  font-weight: 800;
}

@media (max-width: 600px) {
  #hint-panel {
    width: calc(100vw - 28px);
    max-width: 380px;
  }
}

/* ── Board Area ────────────────────────── */

#board-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(16px, 3vh, 28px);
  width: 100%;
}

@media (min-width: 1100px) {
  #board-area {
    justify-content: center;
  }
}

/* ── Circle Container ──────────────────── */

#lights-row {
  position: relative;
  width: var(--circle-size);
  height: var(--circle-size);
}

#lights-row::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: calc(100% + 60px);
  height: calc(100% + 60px);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(18, 25, 55, 0.4) 0%, transparent 65%);
  pointer-events: none;
}

/* ── Individual Light ──────────────────── */

.light {
  position: absolute;
  width: var(--light-size);
  height: var(--light-size);
  border-radius: 50%;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  outline: none;
  transform: translate(-50%, -50%) scale(1);
  transition: transform 0.18s var(--spring);
  animation: lightEnter 0.55s var(--spring) both;
  z-index: 2;
}

@keyframes lightEnter {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.3);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

.light:hover {
  transform: translate(-50%, -50%) scale(1.08);
}

.light:active:not(.pressing) {
  transform: translate(-50%, -50%) scale(0.92);
}

.light.pressing {
  transform: translate(-50%, -50%) scale(0.9);
}

/* ── Light Face ────────────────────────── */

.light-face {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  position: relative;
  transition: background 0.3s ease, box-shadow 0.3s ease, outline-color 0.18s ease;
  outline-style: solid;
  outline-width: 5px;
  outline-color: transparent;
  outline-offset: 5px;
}

/* Pilot glow (faint warm center in OFF state) */
.pilot-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 26%;
  height: 26%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(240, 168, 48, 0.1) 0%, transparent 70%);
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.light.on .pilot-glow {
  opacity: 0;
}

/* OFF state */
.light.off .light-face {
  background: radial-gradient(circle at 38% 32%, var(--light-off-rim) 0%, var(--light-off-face) 70%);
  box-shadow:
    inset 0 2px 8px rgba(0, 0, 0, 0.6),
    inset 0 -1px 3px rgba(80, 90, 130, 0.06),
    0 3px 8px rgba(0, 0, 0, 0.4);
}

.light.off .light-face::after {
  content: '';
  position: absolute;
  top: 13%;
  left: 19%;
  width: 30%;
  height: 20%;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(120, 140, 200, 0.1) 0%, transparent 70%);
  pointer-events: none;
}

/* ON state */
.light.on .light-face {
  background: radial-gradient(circle at 42% 36%, #fffdf5 0%, var(--light-on-core) 22%, var(--light-on-warm) 60%, var(--light-on-outer) 100%);
  box-shadow:
    0 0 10px 4px rgba(240, 168, 48, 0.55),
    0 0 25px 8px rgba(240, 168, 48, 0.28),
    0 0 50px 16px rgba(240, 168, 48, 0.13),
    0 0 80px 26px rgba(240, 168, 48, 0.06),
    inset 0 -2px 5px rgba(200, 110, 15, 0.18);
}

.light.on .light-face::after {
  content: '';
  position: absolute;
  top: 11%;
  left: 21%;
  width: 26%;
  height: 17%;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(255, 255, 240, 0.45) 0%, transparent 70%);
  pointer-events: none;
}

/* ── Hover Preview (static, no animation) ── */

.light.preview .light-face {
  outline-color: rgba(140, 200, 255, 0.5);
}

/* ── Hint Target Highlight ─────────────── */

.light.hint-target .light-face {
  animation: hintPulse 1.3s ease-in-out infinite;
}

@keyframes hintPulse {
  0%, 100% {
    outline-color: rgba(100, 200, 255, 0.3);
  }
  50% {
    outline-color: rgba(100, 200, 255, 0.75);
  }
}

/* ── Pressing State (1-second hold) ────── */

.light.pressing .light-face {
  outline-color: rgba(255, 220, 100, 0.9);
  animation: none;
}

/* ── Victory Glow ──────────────────────── */

.light.victory-glow .light-face {
  animation: victoryLightPulse 0.7s ease-in-out infinite alternate;
}

@keyframes victoryLightPulse {
  0% {
    box-shadow:
      0 0 12px 5px rgba(240, 168, 48, 0.6),
      0 0 28px 10px rgba(240, 168, 48, 0.3),
      0 0 55px 18px rgba(240, 168, 48, 0.14),
      0 0 85px 30px rgba(240, 168, 48, 0.06);
  }
  100% {
    box-shadow:
      0 0 18px 8px rgba(240, 168, 48, 0.8),
      0 0 40px 16px rgba(240, 168, 48, 0.45),
      0 0 75px 26px rgba(240, 168, 48, 0.22),
      0 0 115px 42px rgba(240, 168, 48, 0.1);
  }
}

/* ── Instruction Box (centered circle inside lights ring) ── */

#instruction-box {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 58%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background:
    radial-gradient(ellipse 80% 60% at 30% 10%, rgba(240, 168, 48, 0.09) 0%, transparent 60%),
    rgba(14, 14, 30, 0.92);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  border: 1.5px solid rgba(240, 168, 48, 0.45);
  padding: clamp(10px, 2vh, 18px) clamp(14px, 2vw, 22px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 1.5vh, 14px);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.45),
    0 0 28px rgba(240, 168, 48, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  animation: boxIn 0.35s var(--spring) forwards;
  z-index: 5;
  pointer-events: auto;
}

#instruction-box.hidden {
  display: none;
}

@keyframes boxIn {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.85);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

#instruction-text {
  font-size: clamp(0.85rem, 1.8vw, 1rem);
  line-height: 1.6;
  color: rgba(230, 222, 200, 0.9);
  text-align: center;
}

#instruction-btn {
  font-size: clamp(1.3rem, 2.5vw, 1.7rem);
  background: none;
  border: 1px solid rgba(240, 168, 48, 0.15);
  border-radius: 10px;
  padding: clamp(4px, 0.8vh, 8px) clamp(12px, 2vw, 20px);
  cursor: pointer;
  transition: transform 0.15s var(--spring), background 0.2s ease, box-shadow 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  line-height: 1;
}

#instruction-btn:hover {
  background: rgba(240, 168, 48, 0.12);
  box-shadow: 0 0 12px rgba(240, 168, 48, 0.12);
  transform: scale(1.12);
}

#instruction-btn:active {
  transform: scale(0.9);
}

/* ── Controls ──────────────────────────── */

#controls {
  display: flex;
  align-items: center;
  gap: clamp(16px, 3vw, 28px);
}

#move-counter {
  display: flex;
  align-items: center;
  gap: clamp(4px, 0.8vw, 8px);
  font-size: clamp(1rem, 2.2vw, 1.3rem);
}

#moves-icon {
  font-size: clamp(1.1rem, 2.4vw, 1.4rem);
  line-height: 1;
}

#moves-count {
  font-weight: 700;
  color: var(--accent);
  min-width: 1.5em;
}

#reset-btn {
  font-size: clamp(1.2rem, 2.5vw, 1.5rem);
  font-family: inherit;
  background: none;
  border: 1px solid rgba(180, 190, 220, 0.15);
  border-radius: 10px;
  padding: clamp(5px, 1vh, 8px) clamp(10px, 1.5vw, 16px);
  cursor: pointer;
  color: rgba(180, 190, 220, 0.5);
  transition: transform 0.15s var(--spring), background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  line-height: 1;
}

#reset-btn:hover {
  background: rgba(180, 190, 220, 0.06);
  border-color: rgba(180, 190, 220, 0.3);
  color: rgba(180, 190, 220, 0.8);
  transform: scale(1.06);
}

#reset-btn:active {
  transform: scale(0.92);
}

/* ── Victory Overlay ───────────────────── */

#victory-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(5, 10, 24, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 1;
  transition: opacity 0.5s ease;
}

#victory-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

#victory-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

#victory-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(10px, 2.2vh, 18px);
  animation: victoryIn 0.6s var(--spring) forwards;
}

#victory-headline {
  font-size: clamp(1.8rem, 5.5vw, 3.2rem);
  font-weight: 800;
  letter-spacing: -0.01em;
  text-align: center;
  background: linear-gradient(135deg, var(--accent) 0%, var(--light-on-core) 45%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 28px rgba(240, 168, 48, 0.5));
}

#victory-sub {
  font-size: clamp(0.95rem, 2.2vw, 1.2rem);
  color: rgba(230, 234, 250, 0.88);
  text-align: center;
  font-weight: 500;
  letter-spacing: 0.01em;
}

#victory-actions {
  display: flex;
  gap: clamp(10px, 1.8vw, 18px);
  align-items: center;
  margin-top: clamp(6px, 1vh, 12px);
  flex-wrap: wrap;
  justify-content: center;
}

#play-again-btn {
  font-family: inherit;
  font-size: clamp(0.85rem, 2vw, 1.05rem);
  font-weight: 600;
  padding: clamp(10px, 1.8vh, 14px) clamp(22px, 3.6vw, 32px);
  border-radius: 12px;
  border: 1px solid var(--accent-border);
  background: linear-gradient(135deg, rgba(240, 168, 48, 0.2), rgba(240, 168, 48, 0.06));
  color: var(--light-on-core);
  cursor: pointer;
  transition: transform 0.15s var(--spring), box-shadow 0.2s ease, background 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#victory-home {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: clamp(46px, 6vw, 56px);
  height: clamp(46px, 6vw, 56px);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.02));
  color: rgba(230, 234, 250, 0.9);
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s var(--spring), box-shadow 0.2s ease, background 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

#victory-home svg {
  width: 58%;
  height: 58%;
}

#play-again-btn:hover {
  box-shadow: 0 0 22px rgba(240, 168, 48, 0.25);
  transform: scale(1.06);
}

#victory-home:hover {
  box-shadow: 0 0 18px rgba(255, 255, 255, 0.1);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.04));
  transform: scale(1.06);
}

#play-again-btn:active,
#victory-home:active {
  transform: scale(0.95);
}

@keyframes victoryIn {
  from {
    opacity: 0;
    transform: scale(0.5) translateY(30px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* ── Small Screen Responsive ───────────── */

@media (max-width: 600px) {
  :root {
    --light-size: clamp(40px, 12vw, 58px);
    --circle-size: clamp(240px, 70vw, 340px);
  }
}

/* ── Size Gate ───────────────────────── */
#screen-gate {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #06060f;
  color: rgba(200, 204, 224, 0.85);
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 24px;
  font-size: 1rem;
}
@media (max-width: 359px), (max-height: 499px) {
  #game-wrapper, #victory-overlay { display: none !important; }
  #screen-gate { display: flex; }
}

/* ── Mobile: hint panel goes full-width across the top of the
   screen and scrolls internally if it gets long, so it never
   blocks the board entirely. ──────────────────────────────────── */
@media (max-width: 640px) {
  #hint-panel {
    top: clamp(60px, 9vh, 90px);
    left: 8px;
    right: 8px;
    width: auto;
    max-width: none;
    max-height: 38vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transform-origin: top center;
  }

  /* Allow vertical scroll so the board can slide down out of the
     way of the hint panel and the player can still reach everything. */
  body { overflow-y: auto; overflow-x: hidden; }

  /* When the hint panel is open, hide the "Turn on all the lights"
     title — it duplicates what the hint is teaching and just eats
     vertical space. */
  body:has(#hint-panel.show) #title {
    opacity: 0;
    transform: translateY(-6px);
    pointer-events: none;
  }
  #title {
    transition: opacity 0.3s ease, transform 0.3s ease;
  }

  /* Slide the game wrapper DOWN just enough that the bulbs sit
     immediately below the hint panel — no more, no less. */
  #game-wrapper {
    transition: transform 0.45s cubic-bezier(0.34, 1.3, 0.64, 1);
  }
  body:has(#hint-panel.show) #game-wrapper {
    transform: translateY(clamp(80px, 14vh, 130px));
  }
}

/* ── Orientation-aware gate messages (mobile rotation) ── */
.gate-rotate,
.gate-small {
  display: none;
}
@media (max-width: 479px) {
  .gate-small { display: block; }
}
@media (max-height: 499px) and (min-width: 480px) {
  .gate-rotate { display: block; }
}

