:root {
  --ink: #18232c;
  --muted: #52616d;
  --page: #f5fbff;
  --panel: #ffffff;
  --line: #cbdce7;
  --navy: #17324d;
  --teal: #168b87;
  --teal-dark: #0e6967;
  --coral: #e15f4f;
  --gold: #f4bd3d;
  --lime: #71b857;
  --blue: #396fd6;
  --violet: #7955b8;
  --choice-bg: #edf7fb;
  --choice-bg-strong: #dff0f6;
  --choice-border: #9bc5d7;
  --ghost-bg: #fff3ce;
  --ghost-border: #d5a93a;
  --shadow: 0 18px 42px rgba(23, 50, 77, 0.16);
  --soft-shadow: 0 10px 24px rgba(23, 50, 77, 0.12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  background:
    linear-gradient(90deg, rgba(57, 111, 214, 0.08) 1px, transparent 1px),
    linear-gradient(180deg, rgba(22, 139, 135, 0.08) 1px, transparent 1px),
    radial-gradient(circle at 10% 8%, rgba(244, 189, 61, 0.24), transparent 24rem),
    radial-gradient(circle at 92% 20%, rgba(225, 95, 79, 0.18), transparent 22rem),
    linear-gradient(135deg, var(--page), #eef7f2);
  background-size: 36px 36px, 36px 36px, auto, auto, auto;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.lab-shell {
  width: min(1400px, calc(100% - 28px));
  margin: 0 auto;
  padding: 28px 0 44px;
}

.lab-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  gap: 22px;
  align-items: end;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--teal-dark);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin-bottom: 12px;
  color: var(--navy);
  font-size: clamp(3.1rem, 8vw, 7.4rem);
  line-height: 0.84;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 10px;
  color: var(--navy);
  font-size: clamp(1.55rem, 3vw, 2.3rem);
  line-height: 1;
}

h3 {
  margin-bottom: 8px;
  color: var(--navy);
  font-size: 1.1rem;
}

.brief {
  max-width: 780px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.55;
}

.score-guide {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 920px;
  margin-top: 16px;
}

.score-guide strong,
.score-guide span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 8px 10px;
  border: 1px solid rgba(23, 50, 77, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
  color: var(--navy);
  font-size: 0.95rem;
  line-height: 1.2;
}

.score-guide strong {
  border-color: rgba(22, 139, 135, 0.34);
  background: rgba(22, 139, 135, 0.1);
  color: var(--teal-dark);
}

.progress-card,
.machine-panel,
.challenge-panel,
.final-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.progress-card {
  padding: 18px;
  color: var(--navy);
  font-weight: 800;
}

.score-count {
  display: block;
  margin-top: 10px;
  color: var(--teal-dark);
}

.progress-track {
  height: 16px;
  margin-top: 12px;
  overflow: hidden;
  border: 1px solid rgba(23, 50, 77, 0.14);
  border-radius: 8px;
  background: #ddeaf1;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--gold), var(--coral));
  transition: width 260ms ease;
}

.machine-grid {
  display: grid;
  grid-template-columns: minmax(380px, 0.92fr) minmax(0, 1.08fr);
  gap: 22px;
  align-items: start;
}

.machine-panel {
  padding: 20px;
}

.machine-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 315px;
  margin-bottom: 16px;
  border: 1px solid rgba(23, 50, 77, 0.12);
  border-radius: 8px;
  background:
    linear-gradient(rgba(12, 26, 42, 0.1), rgba(12, 26, 42, 0.18)),
    url("assets/number-machine-bg.png?v=main-graphic-20260728") center / cover,
    linear-gradient(145deg, #132a42, #244a62);
  overflow: hidden;
}

.machine-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(255, 255, 255, 0.12), transparent 58%);
  pointer-events: none;
}

.number-core {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(100%, 360px);
  aspect-ratio: 1.12;
  isolation: isolate;
  z-index: 1;
}

.digit {
  color: rgba(255, 255, 255, 0.26);
  font-size: clamp(8rem, 20vw, 14rem);
  font-weight: 800;
  line-height: 0.8;
  text-shadow:
    0 5px 0 rgba(23, 50, 77, 0.62),
    0 0 24px rgba(255, 255, 255, 0.12);
  transition: color 260ms ease, text-shadow 260ms ease;
}

.number-core.active .digit {
  color: rgba(255, 244, 163, 0.92);
  text-shadow:
    0 5px 0 rgba(23, 50, 77, 0.62),
    0 0 32px rgba(244, 189, 61, 0.86);
}

.spark {
  position: absolute;
  width: 30px;
  height: 30px;
  border: 2px solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  transition: background 220ms ease, box-shadow 220ms ease, transform 220ms ease;
}

.spark.lit {
  border-color: rgba(255, 255, 255, 0.88);
  background: var(--gold);
  box-shadow: 0 0 24px rgba(244, 189, 61, 0.86);
  transform: scale(1.14);
}

.s1 { left: 15%; top: 16%; }
.s2 { left: 36%; top: 8%; }
.s3 { right: 35%; top: 10%; }
.s4 { right: 15%; top: 20%; }
.s5 { left: 10%; top: 45%; }
.s6 { left: 32%; top: 38%; }
.s7 { right: 33%; top: 40%; }
.s8 { right: 10%; top: 48%; }
.s9 { left: 17%; bottom: 20%; }
.s10 { left: 39%; bottom: 11%; }
.s11 { right: 36%; bottom: 12%; }
.s12 { right: 15%; bottom: 22%; }
.s13 { left: 50%; top: 52%; transform: translate(-50%, -50%); }
.s13.lit { transform: translate(-50%, -50%) scale(1.14); }

#machineMessage {
  color: var(--muted);
  line-height: 1.45;
}

.mission-ring {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.mission-button {
  min-height: 88px;
  padding: 10px;
  border: 1px solid rgba(23, 50, 77, 0.18);
  border-radius: 8px;
  color: var(--ink);
  background: #f7fbfd;
  box-shadow: var(--soft-shadow);
  text-align: left;
  transition: border-color 160ms ease, transform 160ms ease, background 160ms ease;
}

.mission-button:hover,
.mission-button:focus-visible {
  border-color: var(--teal);
  transform: translateY(-2px);
}

.mission-button.solved {
  border-color: rgba(22, 139, 135, 0.42);
  background: linear-gradient(135deg, rgba(22, 139, 135, 0.14), rgba(244, 189, 61, 0.22));
}

.mission-symbol {
  display: inline-grid;
  place-items: center;
  width: 38px;
  min-width: 38px;
  height: 34px;
  margin-bottom: 8px;
  border-radius: 8px;
  color: #ffffff;
  background: var(--blue);
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1;
  text-align: center;
}

.mission-button:nth-child(3n + 1) .mission-symbol { background: var(--teal); }
.mission-button:nth-child(3n + 2) .mission-symbol { background: var(--coral); }
.mission-button:nth-child(3n) .mission-symbol { background: var(--violet); }

.mission-name {
  display: block;
  color: var(--navy);
  font-weight: 800;
  line-height: 1.12;
}

.mission-status {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.86rem;
}

.challenge-panel {
  min-height: 690px;
  padding: 22px;
}

.challenge-top {
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.challenge-root {
  display: grid;
  gap: 18px;
}

.empty-state {
  min-height: 420px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  color: var(--muted);
  text-align: center;
}

.empty-number {
  color: var(--gold);
  font-size: clamp(5rem, 16vw, 12rem);
  font-weight: 800;
  line-height: 0.82;
  text-shadow: 0 8px 0 rgba(23, 50, 77, 0.12);
}

.mission-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.tool-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  padding: 18px;
}

.button-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(108px, 1fr));
  gap: 10px;
}

.choice-button,
.primary-button,
.ghost-button,
.key-button,
.slot,
.month-button,
.timeline-button,
.object-button,
.map-region {
  min-height: 46px;
  border: 1px solid var(--choice-border);
  border-radius: 8px;
  color: var(--ink);
  background: var(--choice-bg);
  box-shadow: 0 4px 10px rgba(23, 50, 77, 0.06);
}

.choice-button,
.month-button,
.timeline-button,
.object-button {
  padding: 10px 12px;
  font-weight: 800;
}

.choice-button:hover,
.choice-button:focus-visible,
.month-button:hover,
.month-button:focus-visible,
.timeline-button:hover,
.timeline-button:focus-visible,
.object-button:hover,
.object-button:focus-visible,
.key-button:hover,
.key-button:focus-visible {
  border-color: var(--teal);
  background: var(--choice-bg-strong);
}

.month-button:focus-visible {
  outline: 3px solid rgba(14, 128, 128, 0.45);
  outline-offset: 3px;
}

.choice-button.selected,
.month-button.selected,
.timeline-button.selected,
.object-button.selected,
.key-button.active {
  border-color: var(--teal);
  background: rgba(22, 139, 135, 0.14);
}

.month-button.selected:disabled {
  color: var(--ink);
  background: rgba(22, 139, 135, 0.14);
  opacity: 1;
}

.choice-button.wrong,
.month-button.wrong,
.map-region.wrong {
  animation: bounce 260ms ease;
}

.month-button.attempted {
  color: rgba(23, 50, 77, 0.58);
  background: #f4f0e8;
  border-color: rgba(23, 50, 77, 0.18);
  text-decoration: line-through;
  text-decoration-thickness: 3px;
  text-decoration-color: #8e640f;
  opacity: 1;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: start;
  padding: 0 18px;
  color: #ffffff;
  background: var(--teal);
  border-color: var(--teal-dark);
  font-weight: 800;
}

.primary-button:hover,
.primary-button:focus-visible {
  background: var(--teal-dark);
}

.primary-button:disabled,
.ghost-button:disabled {
  cursor: not-allowed;
  opacity: 0.54;
}

.ghost-button {
  padding: 0 14px;
  border-color: var(--ghost-border);
  background: var(--ghost-bg);
  color: var(--navy);
  font-weight: 800;
}

.ghost-button:hover,
.ghost-button:focus-visible {
  border-color: #8e640f;
  background: #f9e3a6;
}

.feedback {
  min-height: 24px;
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

.feedback.success {
  color: var(--teal-dark);
}

.phone-console,
.netherlands-panel,
.netherlands-question,
.phone-results {
  display: grid;
  gap: 14px;
}

.phone-feedback {
  min-height: 24px;
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

.phone-feedback.success {
  color: var(--teal-dark);
}

.netherlands-header,
.phone-action-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.netherlands-header h3,
.phone-results h3 {
  margin: 0;
  color: var(--navy);
}

.netherlands-question > p,
.phone-results p {
  margin: 0;
  color: var(--ink);
  font-size: 1.2rem;
  font-weight: 800;
  line-height: 1.35;
}

.true-false-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(110px, 1fr));
  gap: 10px;
}

.true-false-button {
  min-height: 60px;
  font-size: 1.15rem;
}

.calendar-status-row {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 10px;
  margin-bottom: 12px;
}

.calendar-results {
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid rgba(14, 128, 128, 0.2);
  border-radius: 8px;
  background: #fbfdff;
}

.calendar-results h3,
.calendar-results p {
  margin: 0;
}

.calendar-results h3 {
  color: var(--navy);
  font-size: 1.15rem;
}

.switch-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(48px, 1fr));
  gap: 12px;
}

.switch {
  display: grid;
  gap: 7px;
  place-items: center;
  min-height: 118px;
  padding: 10px 8px;
  border: 1px solid var(--choice-border);
  border-radius: 8px;
  background: var(--choice-bg);
  font-weight: 800;
  box-shadow: 0 4px 10px rgba(23, 50, 77, 0.06);
}

.switch:hover,
.switch:focus-visible {
  border-color: var(--teal);
  background: var(--choice-bg-strong);
}

.switch-track {
  width: 26px;
  height: 48px;
  border-radius: 8px;
  background: #c7d6df;
  box-shadow: inset 0 8px 0 rgba(255, 255, 255, 0.36);
}

.switch-value {
  color: var(--navy);
  font-size: 1rem;
  font-weight: 900;
}

.switch-digit {
  color: var(--navy);
  font-size: 1.35rem;
  font-weight: 900;
  line-height: 1;
}

.switch-state {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.switch[aria-pressed="true"] {
  border-color: var(--gold);
  background: rgba(244, 189, 61, 0.14);
}

.switch[aria-pressed="true"] .switch-track {
  background: var(--gold);
}

.switch[aria-pressed="true"] .switch-state {
  color: #8e640f;
}

.binary-status-row {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 10px;
}

.binary-explanation {
  padding: 14px;
  border: 1px solid rgba(22, 139, 135, 0.22);
  border-radius: 8px;
  color: var(--navy);
  background: rgba(22, 139, 135, 0.08);
}

.binary-explanation p {
  margin: 0;
  color: var(--muted);
  font-weight: 750;
  line-height: 1.45;
}

.binary-display,
.dial-display,
.total-display,
.temperature-display,
.calendar-display {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--navy);
  background: #f5fbff;
  font-size: 1.45rem;
  font-weight: 800;
}

.make31-status {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 10px;
}

.prime-score-row {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 10px;
}

.machine-score-line {
  margin: 0;
  color: #8e640f;
  font-weight: 900;
}

.roman-builder {
  display: grid;
  gap: 16px;
}

.tile-bank,
.slot-row,
.stack-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.roman-tile {
  min-width: 58px;
  min-height: 58px;
  border: 1px solid rgba(23, 50, 77, 0.22);
  border-radius: 8px;
  color: var(--navy);
  background: rgba(244, 189, 61, 0.22);
  font-size: 1.6rem;
  font-weight: 800;
  touch-action: none;
  user-select: none;
}

.roman-stack {
  position: relative;
  box-shadow:
    4px 4px 0 #f9d878,
    8px 8px 0 rgba(185, 133, 20, 0.25),
    0 8px 16px rgba(23, 50, 77, 0.12);
  cursor: grab;
}

.roman-stack:active,
.placed-roman-tile:active {
  cursor: grabbing;
}

.placed-roman-tile {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 1px solid rgba(23, 50, 77, 0.22);
  border-radius: 8px;
  color: var(--navy);
  background: rgba(244, 189, 61, 0.28);
  font-size: 1.6rem;
  font-weight: 800;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.slot {
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  border-style: dashed;
  color: var(--muted);
  background: #f3f9fd;
  font-size: 1.7rem;
  font-weight: 800;
}

.slot.filled {
  border-style: solid;
  border-color: var(--teal);
  color: var(--navy);
  background: rgba(22, 139, 135, 0.1);
}

.slot.roman-drop-target {
  border-color: var(--gold);
  background: rgba(244, 189, 61, 0.18);
}

.roman-drag-ghost {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border: 1px solid rgba(23, 50, 77, 0.22);
  border-radius: 8px;
  color: var(--navy);
  background: #fff3ce;
  box-shadow: 0 16px 28px rgba(23, 50, 77, 0.22);
  font-size: 1.6rem;
  font-weight: 800;
  pointer-events: none;
}

.roman-dragging {
  cursor: grabbing;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(34px, 1fr));
  gap: 6px;
}

.calendar-grid span,
.day-button {
  display: grid;
  place-items: center;
  min-height: 42px;
  border-radius: 8px;
}

.calendar-grid span {
  color: var(--muted);
  font-weight: 800;
}

.day-button {
  border: 1px solid var(--line);
  background: var(--choice-bg);
  font-weight: 800;
}

.day-button:hover,
.day-button:focus-visible {
  border-color: var(--teal);
  background: var(--choice-bg-strong);
}

.day-button.current {
  border-color: var(--coral);
  background: rgba(225, 95, 79, 0.12);
  box-shadow: 0 0 0 3px rgba(225, 95, 79, 0.18);
}

.day-button.target {
  border-color: var(--teal);
  background: rgba(22, 139, 135, 0.15);
}

.day-button.visited {
  border-color: rgba(22, 139, 135, 0.45);
  background: rgba(22, 139, 135, 0.08);
}

.halloween-route-builder {
  display: grid;
  gap: 18px;
}

.halloween-route-builder h3 {
  margin: 0 0 10px;
  color: var(--navy);
  font-size: 1.05rem;
}

.route-card-bank,
.route-space-row,
.route-control-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.route-card {
  min-height: 58px;
  padding: 10px 14px;
  border: 2px solid rgba(22, 139, 135, 0.32);
  border-radius: 8px;
  background: linear-gradient(180deg, #fffdf6, #f9ead0);
  color: var(--navy);
  font-size: 1rem;
  font-weight: 800;
  cursor: grab;
  box-shadow: 0 6px 12px rgba(23, 47, 72, 0.08);
  touch-action: none;
}

.route-card:disabled {
  cursor: default;
  opacity: 0.82;
}

.route-card:focus-visible,
.route-space:focus-visible {
  outline: 4px solid rgba(246, 181, 48, 0.62);
  outline-offset: 3px;
}

.route-card.route-dragging {
  opacity: 0.5;
  cursor: grabbing;
}

.route-drag-ghost {
  position: fixed;
  z-index: 1000;
  pointer-events: none;
  transform: rotate(-2deg);
  cursor: grabbing;
}

.route-space {
  display: grid;
  grid-template-columns: auto minmax(150px, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 78px;
  min-width: min(100%, 215px);
  padding: 10px;
  border: 2px dashed rgba(23, 47, 72, 0.22);
  border-radius: 8px;
  background: rgba(237, 247, 251, 0.86);
}

.route-space.filled {
  border-style: solid;
  border-color: rgba(22, 139, 135, 0.4);
}

.route-space.route-drop-target {
  border-color: var(--gold);
  background: rgba(246, 181, 48, 0.12);
}

.route-space-number {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--navy);
  color: #ffffff;
  font-weight: 900;
}

.route-placeholder {
  color: var(--muted);
  font-weight: 800;
}

.route-space .route-card {
  width: 100%;
}

.door {
  display: grid;
  place-items: center;
  min-height: 170px;
  border: 4px solid #5b3b2a;
  border-radius: 8px;
  color: #ffffff;
  background: linear-gradient(180deg, #7c4b2e, #4c2f22);
  font-size: 1.65rem;
  font-weight: 800;
  text-align: center;
  overflow: hidden;
  position: relative;
  transition: transform 0.35s ease, box-shadow 0.35s ease, background 0.35s ease;
}

.door.open {
  border-color: var(--gold);
  background:
    radial-gradient(circle at center, rgba(246, 181, 48, 0.75), transparent 42%),
    linear-gradient(120deg, #2b1f54 0%, #168b87 52%, #f6b530 100%);
  box-shadow: 0 0 32px rgba(246, 181, 48, 0.55);
  transform: perspective(700px) rotateY(-6deg);
}

.door.open::after {
  content: "";
  position: absolute;
  inset: 18px;
  border-radius: 8px;
  border: 2px solid rgba(255, 255, 255, 0.65);
  box-shadow: inset 0 0 22px rgba(255, 255, 255, 0.35);
  pointer-events: none;
}

.state-evidence-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.state-evidence-header h3 {
  margin: 0;
}

.clue-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.choice-button.ruled-out,
.choice-button:disabled:not(.selected) {
  color: rgba(23, 50, 77, 0.55);
  background: #f4f0e8;
  box-shadow: none;
  opacity: 1;
}

.choice-button.ruled-out {
  text-decoration: line-through;
  text-decoration-thickness: 3px;
  text-decoration-color: #8e640f;
}

.clue-list {
  display: grid;
  gap: 10px;
}

.clue-list span {
  display: block;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(57, 111, 214, 0.08);
  color: var(--navy);
  font-weight: 800;
}

.state-map-card {
  display: grid;
  gap: 12px;
}

.state-map-frame {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(23, 50, 77, 0.12);
  border-radius: 8px;
  background: #edf3f6;
  aspect-ratio: 4 / 3;
}

.state-map-frame img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  filter: blur(8px) grayscale(0.55) opacity(0.58);
  transform: scale(1.04);
  transition: filter 240ms ease, transform 240ms ease;
}

.state-map-card.revealed .state-map-frame img {
  filter: none;
  transform: scale(1);
}

.state-map-lock {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 6px;
  color: #ffffff;
  text-align: center;
  background: rgba(23, 50, 77, 0.46);
  transition: opacity 180ms ease;
}

.state-map-lock span {
  font-size: clamp(1.6rem, 4vw, 2.6rem);
  font-weight: 900;
}

.state-map-lock small {
  font-size: 1rem;
  font-weight: 800;
}

.state-map-card.revealed .state-map-lock {
  opacity: 0;
  pointer-events: none;
}

.california-callout {
  position: absolute;
  left: 7%;
  top: 57%;
  padding: 8px 12px;
  color: #ffffff;
  background: var(--teal-dark);
  border: 3px solid #ffffff;
  border-radius: 8px;
  box-shadow: var(--soft-shadow);
  font-size: clamp(1rem, 2.6vw, 1.55rem);
  font-weight: 900;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.state-map-card.revealed .california-callout {
  opacity: 1;
  transform: translateY(0);
}

.state-reveal {
  margin: 0;
  color: var(--teal-dark);
  font-weight: 900;
  line-height: 1.4;
}

.state-score-line {
  margin: 0;
  color: #8e640f;
  font-weight: 900;
}

.president-case {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid rgba(23, 50, 77, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(23, 50, 77, 0.055) 1px, transparent 1px),
    linear-gradient(180deg, rgba(23, 50, 77, 0.045) 1px, transparent 1px),
    #fff8e8;
  background-size: 30px 30px;
}

.case-timeline {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.timeline-case-card {
  position: relative;
  display: grid;
  gap: 6px;
  align-content: center;
  min-height: 94px;
  padding: 12px;
  border: 1px solid rgba(23, 50, 77, 0.16);
  border-radius: 8px;
  color: var(--navy);
  background: rgba(255, 255, 255, 0.9);
  text-align: center;
  font-weight: 900;
  box-shadow: 0 10px 24px rgba(23, 50, 77, 0.08);
}

.timeline-case-card strong {
  font-size: 1.45rem;
}

.timeline-case-card span {
  display: block;
}

.timeline-case-card.missing {
  border-color: #b98514;
  background: #f4bd3d;
  color: #17324d;
}

.case-evidence-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.case-evidence-header h3,
.suspect-section h3,
.case-result h3 {
  margin: 0;
}

.case-evidence-header span {
  padding: 8px 12px;
  border: 1px solid rgba(22, 139, 135, 0.28);
  border-radius: 8px;
  color: var(--teal-dark);
  background: rgba(22, 139, 135, 0.1);
  font-weight: 900;
}

.evidence-folder-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.evidence-folder {
  display: grid;
  align-content: start;
  min-height: 128px;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(23, 50, 77, 0.18);
  border-radius: 8px;
  color: var(--navy);
  background: #f2c86d;
  text-align: left;
  box-shadow: 0 10px 22px rgba(23, 50, 77, 0.08);
}

.folder-tab {
  justify-self: start;
  min-width: 78%;
  padding: 8px 12px;
  border-radius: 0 0 8px;
  color: #ffffff;
  background: var(--navy);
  font-size: 0.82rem;
  font-weight: 900;
}

.folder-clue {
  display: grid;
  align-items: center;
  min-height: 82px;
  padding: 12px;
  color: transparent;
  font-weight: 800;
  line-height: 1.32;
}

.evidence-folder.opened {
  background: #f5fbff;
}

.evidence-folder.opened .folder-clue {
  color: var(--ink);
}

.suspect-section {
  display: grid;
  gap: 10px;
}

.suspect-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.case-scoreboard {
  display: grid;
  gap: 2px;
  min-width: 132px;
  padding: 8px 12px;
  border: 1px solid rgba(185, 133, 20, 0.34);
  border-radius: 8px;
  color: #8e640f;
  background: #fff3ce;
  text-align: center;
  box-shadow: 0 8px 16px rgba(23, 50, 77, 0.08);
}

.case-scoreboard span {
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
}

.case-scoreboard strong {
  font-size: 1.05rem;
}

.suspect-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.suspect-card {
  display: grid;
  justify-items: center;
  gap: 8px;
  align-content: start;
  min-height: 176px;
  padding: 12px;
  border: 1px solid rgba(23, 50, 77, 0.18);
  border-radius: 8px;
  color: var(--navy);
  background: #f5fbff;
  font-weight: 900;
  box-shadow: 0 10px 22px rgba(23, 50, 77, 0.08);
}

.suspect-card:hover,
.suspect-card:focus-visible {
  border-color: var(--teal);
  background: var(--choice-bg-strong);
}

.suspect-card.selected {
  border-color: var(--teal);
  background: rgba(22, 139, 135, 0.12);
}

.suspect-card.ruled-out,
.suspect-card:disabled:not(.selected) {
  color: rgba(23, 50, 77, 0.62);
  background: #f4f0e8;
  box-shadow: none;
  opacity: 1;
}

.suspect-card.ruled-out .portrait {
  filter: grayscale(1);
  opacity: 0.56;
}

.ruled-out-label {
  display: none;
  padding: 4px 8px;
  border-radius: 999px;
  color: #ffffff;
  background: #8e640f;
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.suspect-card.ruled-out .ruled-out-label {
  display: inline-block;
}

.portrait {
  width: 82px;
  height: 96px;
  object-fit: cover;
  object-position: center 16%;
  border: 4px solid #fffaf0;
  border-radius: 8px;
  background: #fffaf0;
  box-shadow: 0 8px 16px rgba(23, 50, 77, 0.16);
}

.solve-case-button {
  justify-self: stretch;
  min-height: 52px;
  background: #b98514;
  border-color: #8e640f;
}

.solve-case-button:hover,
.solve-case-button:focus-visible {
  background: #8e640f;
}

.reset-case-button {
  justify-self: start;
}

.case-result {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid rgba(22, 139, 135, 0.28);
  border-radius: 8px;
  color: var(--navy);
  background: rgba(22, 139, 135, 0.1);
}

.case-result p,
.case-result ul {
  margin: 0;
}

.case-result ul {
  padding-left: 20px;
}

.score-line {
  color: var(--teal-dark);
  font-weight: 900;
}

.badge-line {
  color: #8e640f;
  font-weight: 900;
}

.gallium-lab {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 210px;
  gap: 18px;
  align-items: center;
}

.temperature-slider {
  width: 100%;
  accent-color: var(--teal);
}

.gallium-sample {
  position: relative;
  min-height: 210px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eaf6ff;
  overflow: hidden;
}

.gallium-sample img {
  width: 100%;
  height: 100%;
  min-height: 210px;
  object-fit: cover;
}

.melt-indicator {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 6px 12px;
  border: 1px solid rgba(23, 50, 77, 0.22);
  border-radius: 8px;
  color: var(--navy);
  background: rgba(255, 255, 255, 0.9);
  font-weight: 800;
  box-shadow: var(--soft-shadow);
  transition: background 220ms ease, color 220ms ease;
}

.melt-indicator.melted {
  color: #ffffff;
  background: var(--teal);
}

.item-grid,
.select-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.select-grid select {
  min-height: 48px;
  border: 1px solid var(--choice-border);
  border-radius: 8px;
  color: var(--navy);
  background: var(--choice-bg);
  font: inherit;
  font-weight: 800;
}

.select-grid select:focus {
  border-color: var(--teal);
  outline: 3px solid rgba(14, 128, 128, 0.24);
}

.item-check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 10px;
  border: 1px solid var(--choice-border);
  border-radius: 8px;
  background: var(--choice-bg);
  font-weight: 800;
}

.item-check:hover,
.item-check:focus-within {
  border-color: var(--teal);
  background: var(--choice-bg-strong);
}

.bunyan-research-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.bunyan-research-panel {
  padding: 12px;
  background: #ffffff;
}

.bunyan-research-panel img {
  display: block;
  width: 100%;
  max-height: 72vh;
  border: 1px solid rgba(23, 50, 77, 0.16);
  border-radius: 8px;
  object-fit: contain;
  background: #fff7e8;
}

.bunyan-plaque {
  border-color: rgba(142, 100, 15, 0.36);
  background:
    linear-gradient(135deg, rgba(244, 189, 61, 0.18), rgba(255, 255, 255, 0.94)),
    #ffffff;
}

.plaque-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.plaque-header span {
  display: inline-grid;
  width: 52px;
  min-width: 52px;
  height: 52px;
  place-items: center;
  border: 2px solid #8e640f;
  border-radius: 50%;
  color: #8e640f;
  background: rgba(244, 189, 61, 0.28);
  font-size: 1.35rem;
  font-weight: 900;
}

.plaque-header h3 {
  margin: 0;
  color: var(--navy);
  font-size: clamp(1.35rem, 3vw, 2rem);
}

.plaque-fields {
  display: grid;
  gap: 12px;
}

.plaque-field {
  display: grid;
  gap: 6px;
}

.plaque-field span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 900;
  text-transform: uppercase;
}

.plaque-field select {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--choice-border);
  border-radius: 8px;
  color: var(--navy);
  background: var(--choice-bg);
  font: inherit;
  font-weight: 800;
}

.bunyan-world-line {
  margin: 14px 0 0;
  color: #8e640f;
  font-weight: 900;
}

.flavor-name {
  min-height: 62px;
  display: grid;
  place-items: center;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--navy);
  background: rgba(244, 189, 61, 0.16);
  font-size: 1.25rem;
  font-weight: 800;
  text-align: center;
}

.flavor-name span {
  font-size: 1.05rem;
}

.flavor-name strong {
  display: block;
}

.flavor-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, minmax(64px, 1fr));
  gap: 10px;
  max-width: 330px;
}

.key-button {
  font-size: 1.25rem;
  font-weight: 800;
}

.stack-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(57, 111, 214, 0.14);
  font-weight: 800;
}

.history-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.history-timeline-builder,
.history-meaning-card {
  display: grid;
  gap: 14px;
}

.history-panel-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.history-panel-heading h3,
.history-meaning-card h3,
.history-timeline-builder h3,
.history-explanation h3 {
  margin: 0;
}

.history-event-bank {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.history-space-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.history-space {
  grid-template-columns: 1fr;
  min-height: 178px;
  align-content: start;
}

.history-space .route-space-number {
  width: auto;
  height: auto;
  justify-self: start;
  padding: 6px 10px;
  border-radius: 999px;
  line-height: 1;
}

.history-event-card {
  min-height: 128px;
  display: grid;
  align-content: start;
  gap: 7px;
  text-align: left;
  line-height: 1.25;
}

.history-event-card strong {
  color: var(--navy);
  font-size: 1rem;
}

.history-event-card span {
  font-size: 0.9rem;
  font-weight: 750;
}

.history-meaning-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.history-explanation {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid rgba(22, 139, 135, 0.22);
  border-radius: 8px;
  color: var(--navy);
  background: rgba(22, 139, 135, 0.08);
}

.history-explanation p {
  margin: 0;
  color: var(--muted);
  font-weight: 650;
  line-height: 1.45;
}

.final-panel {
  display: grid;
  gap: 18px;
  margin-top: 22px;
  padding: 22px;
}

.final-panel[hidden] {
  display: none;
}

.final-score {
  width: fit-content;
  margin: 0;
  padding: 10px 14px;
  border: 1px solid rgba(22, 139, 135, 0.28);
  border-radius: 8px;
  background: rgba(22, 139, 135, 0.08);
  color: var(--navy);
  font-weight: 900;
}

.sort-root {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(245px, 1fr));
  gap: 12px;
}

.sort-row {
  display: grid;
  gap: 8px;
  align-content: start;
  min-height: 166px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  padding: 12px;
  transition: background 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.sort-row.collected {
  place-items: center;
  border-color: rgba(22, 139, 135, 0.42);
  background:
    radial-gradient(circle at top, rgba(244, 189, 61, 0.22), transparent 9rem),
    rgba(22, 139, 135, 0.08);
  text-align: center;
  animation: collectPop 220ms ease;
}

.sort-row.missed {
  place-items: center;
  border-color: rgba(230, 92, 78, 0.34);
  background:
    radial-gradient(circle at top, rgba(230, 92, 78, 0.12), transparent 8rem),
    #fffaf6;
  text-align: center;
}

.sort-row label {
  color: var(--navy);
  font-weight: 800;
}

.sort-row select {
  min-height: 44px;
  border: 1px solid var(--choice-border);
  border-radius: 8px;
  background: var(--choice-bg);
}

.plaque-field select:focus,
.sort-row select:focus {
  border-color: var(--teal);
  outline: 3px solid rgba(14, 128, 128, 0.24);
}

.sort-attempts,
.sort-card-feedback {
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.35;
}

.sort-attempts {
  font-weight: 800;
}

.sort-collected {
  display: grid;
  justify-items: center;
  gap: 8px;
  color: var(--navy);
  font-weight: 900;
}

.sort-collected[hidden] {
  display: none;
}

.sort-collected img {
  width: min(100%, 112px);
  aspect-ratio: 1;
  border: 1px solid rgba(23, 50, 77, 0.16);
  border-radius: 8px;
  object-fit: cover;
  background: #ffffff;
  box-shadow: var(--soft-shadow);
}

.sort-collected span {
  line-height: 1.15;
}

.sort-collected small,
.sort-reveal small {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.sort-reveal {
  display: grid;
  justify-items: center;
  gap: 8px;
  color: var(--navy);
}

.sort-reveal[hidden] {
  display: none;
}

.sort-reveal span {
  color: var(--teal);
  font-size: 0.84rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sort-reveal strong {
  font-size: 1.35rem;
}

.badge-dialog {
  width: min(540px, calc(100% - 28px));
  padding: 0;
  border: 0;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.badge-dialog::backdrop {
  background: rgba(23, 50, 77, 0.52);
}

.badge-card {
  display: grid;
  gap: 14px;
  justify-items: center;
  padding: 34px;
  text-align: center;
  background:
    radial-gradient(circle at top, rgba(244, 189, 61, 0.28), transparent 18rem),
    #ffffff;
}

.badge-image {
  width: min(100%, 360px);
  aspect-ratio: 1;
  object-fit: contain;
  filter: drop-shadow(0 14px 28px rgba(23, 50, 77, 0.24));
}

@keyframes bounce {
  0%, 100% { transform: translateX(0); }
  32% { transform: translateX(-8px); }
  64% { transform: translateX(8px); }
}

@keyframes collectPop {
  0% { transform: scale(0.97); }
  100% { transform: scale(1); }
}

@media (max-width: 980px) {
  .lab-header,
  .machine-grid,
  .gallium-lab {
    grid-template-columns: 1fr;
  }

  .challenge-panel {
    min-height: 0;
  }
}

@media (max-width: 650px) {
  .lab-shell {
    width: min(100% - 18px, 540px);
    padding-top: 18px;
  }

  .machine-panel,
  .challenge-panel,
  .final-panel {
    padding: 14px;
  }

  .mission-ring,
  .history-row,
  .history-event-bank,
  .history-space-row,
  .history-meaning-grid,
  .clue-grid,
  .case-timeline,
  .evidence-folder-grid,
  .suspect-grid {
    grid-template-columns: 1fr;
  }

  .switch-row {
    grid-template-columns: repeat(3, minmax(72px, 1fr));
    gap: 6px;
  }

  .switch {
    min-height: 108px;
  }

  .switch-track {
    height: 38px;
  }

  .slot {
    width: 58px;
    height: 58px;
  }
}
