/* ===========================================================================
   Lab & game surfaces
   ---------------------------------------------------------------------------
   Everything interactive lives on the "night" surface so that specimen
   photography (bone, feather, skull — all shot on white) pops, and so a lab
   reads as a distinct place from the reading pages.
   ========================================================================= */

/* --- Lab shell ----------------------------------------------------------- */
.lab {
  background: var(--night-900);
  color: var(--night-text);
  border-radius: var(--r-xl);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--night-line);
}
.lab--bleed { border-radius: 0; border-inline: 0; }

.lab__bar {
  display: flex; align-items: center; gap: var(--sp-3);
  flex-wrap: wrap;
  padding: 0.85rem var(--sp-4);
  background: var(--night-800);
  border-bottom: 1px solid var(--night-line);
}
.lab__title {
  display: flex; align-items: center; gap: 0.6rem;
  font-family: var(--display); font-weight: 600;
  font-size: var(--step-1); color: var(--white);
  margin: 0;
}
.lab__title svg { color: var(--amber-400); flex: none; }
.lab__spacer { margin-left: auto; }
.lab__body { padding: var(--sp-4); }
.lab__body--flush { padding: 0; }

.lab__hint {
  display: flex; gap: 0.7rem; align-items: flex-start;
  padding: 0.8rem 1rem;
  background: color-mix(in srgb, var(--amber-400) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--amber-400) 28%, transparent);
  border-radius: var(--r-md);
  color: var(--amber-200);
  font-size: 0.94rem;
}
.lab__hint svg { flex: none; margin-top: 2px; color: var(--amber-400); }
.lab__hint strong { color: var(--white); }

/* --- Score / progress chips --------------------------------------------- */
.chip {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.35rem 0.8rem;
  background: var(--night-700); color: var(--night-text);
  border: 1px solid var(--night-line);
  border-radius: var(--r-pill);
  font-size: 0.82rem; font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.chip b { color: var(--amber-400); }
.chip--good { border-color: color-mix(in srgb, var(--good) 55%, transparent); }
.chip--good b { color: #6fd6a5; }

.meter {
  flex: 1 1 120px; min-width: 90px; max-width: 260px;
  height: 8px; border-radius: 999px;
  background: var(--night-700); overflow: hidden;
  border: 1px solid var(--night-line);
}
.meter__fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--teal-500), var(--amber-400));
  border-radius: 999px;
  transition: width 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* --- Stage steps --------------------------------------------------------- */
.steps {
  display: flex; gap: 0.25rem; list-style: none;
  margin: 0; padding: 0; flex-wrap: wrap;
}
.steps li {
  display: flex; align-items: center; gap: 0.45rem;
  padding: 0.3rem 0.75rem 0.3rem 0.35rem;
  border-radius: var(--r-pill);
  font-size: 0.8rem; font-weight: 600;
  color: var(--night-soft);
  border: 1px solid transparent;
}
.steps li i {
  display: grid; place-items: center;
  width: 1.35rem; height: 1.35rem; border-radius: 999px;
  background: var(--night-700); color: var(--night-soft);
  font-style: normal; font-size: 0.72rem; font-weight: 700;
}
.steps li[data-state="active"] {
  background: var(--night-700); color: var(--white);
  border-color: var(--night-line);
}
.steps li[data-state="active"] i { background: var(--amber-400); color: #3a1c04; }
.steps li[data-state="done"] { color: #6fd6a5; }
.steps li[data-state="done"] i { background: color-mix(in srgb, var(--good) 40%, var(--night-700)); color: #bdf3d8; }

/* =========================================================================
   Pellet Lab — the flagship dissection
   ========================================================================= */
.pellet {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  min-height: 560px;
}
@media (max-width: 940px) {
  .pellet { grid-template-columns: 1fr; }
}

.pellet__stage {
  position: relative;
  background:
    radial-gradient(75% 60% at 50% 42%, #12343b 0%, var(--night-900) 72%);
  display: grid; place-items: center;
  padding: var(--sp-4);
  min-height: 420px;
  overflow: hidden;
}
.pellet__canvas {
  display: block;
  width: 100%; height: auto;
  max-height: 62vh;
  touch-action: none;
  cursor: crosshair;
  border-radius: var(--r-lg);
}
.pellet__canvas[data-tool="tweezers"] { cursor: grab; }
.pellet__canvas[data-tool="tweezers"]:active { cursor: grabbing; }

/* Tool rail */
.pellet__tools {
  position: absolute; left: var(--sp-3); top: 50%;
  transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 0.4rem;
  padding: 0.45rem;
  background: color-mix(in srgb, var(--night-800) 88%, transparent);
  backdrop-filter: blur(8px);
  border: 1px solid var(--night-line);
  border-radius: var(--r-pill);
  z-index: 3;
}
@media (max-width: 640px) {
  .pellet__tools {
    left: 50%; top: auto; bottom: var(--sp-3);
    transform: translateX(-50%);
    flex-direction: row; border-radius: var(--r-pill);
  }
}
.tool {
  display: grid; place-items: center;
  width: 46px; height: 46px; padding: 0;
  background: transparent; color: var(--night-soft);
  border: 1px solid transparent; border-radius: 999px;
  cursor: pointer; transition: background 0.15s ease, color 0.15s ease;
}
.tool:hover { background: var(--night-700); color: var(--white); }
.tool[aria-pressed="true"] {
  background: var(--amber-400); color: #3a1c04;
  border-color: var(--amber-200);
}
.tool svg { width: 22px; height: 22px; }

/* Side panel: findings tray */
.pellet__panel {
  background: var(--night-800);
  border-left: 1px solid var(--night-line);
  display: flex; flex-direction: column;
  max-height: 62vh;
}
@media (max-width: 940px) {
  .pellet__panel { border-left: 0; border-top: 1px solid var(--night-line); max-height: none; }
}
.pellet__panel h3 {
  margin: 0; padding: var(--sp-3) var(--sp-3) 0.6rem;
  font-size: var(--step-0); color: var(--white);
  font-family: var(--sans); font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
}
.pellet__panel-scroll { overflow-y: auto; padding: 0 var(--sp-3) var(--sp-3); flex: 1; }

/* Bone chart slots */
.bone-chart { display: grid; gap: 0.4rem; list-style: none; margin: 0; padding: 0; }
.bone-slot {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.5rem 0.65rem;
  background: var(--night-700);
  border: 1px dashed var(--night-line);
  border-radius: var(--r-md);
  font-size: 0.88rem;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.bone-slot__thumb {
  flex: none; width: 40px; height: 32px;
  display: grid; place-items: center;
  background: var(--night-900); border-radius: var(--r-sm);
  overflow: hidden;
}
.bone-slot__thumb img { width: 100%; height: 100%; object-fit: contain; }
.bone-slot__thumb span { color: var(--night-line); font-size: 1rem; }
.bone-slot b { display: block; color: var(--white); font-weight: 600; }
.bone-slot small { color: var(--night-soft); font-size: 0.76rem; }
.bone-slot__count {
  margin-left: auto; flex: none;
  font-variant-numeric: tabular-nums;
  font-weight: 700; color: var(--night-soft);
}
.bone-slot[data-found="true"] {
  border-style: solid;
  border-color: color-mix(in srgb, var(--good) 60%, transparent);
  background: color-mix(in srgb, var(--good) 14%, var(--night-700));
}
.bone-slot[data-found="true"] .bone-slot__count { color: #6fd6a5; }
.bone-slot[data-hint="true"] { border-color: var(--amber-400); }

/* Floating "found it" toast */
.lab-toast {
  position: absolute; left: 50%; bottom: var(--sp-4);
  transform: translate(-50%, 1rem);
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.7rem 1.1rem;
  background: var(--white); color: var(--ink);
  border-radius: var(--r-pill);
  box-shadow: var(--shadow-lg);
  font-weight: 600; font-size: 0.92rem;
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 5; max-width: min(90%, 30rem);
}
.lab-toast[data-show="true"] { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 640px) {
  /* The tool rail sits along the bottom on a phone; keep the toast clear of it. */
  .lab-toast { bottom: calc(var(--sp-3) + 62px); }
}
.lab-toast__icon {
  display: grid; place-items: center; flex: none;
  width: 1.6rem; height: 1.6rem; border-radius: 999px;
  background: var(--good); color: var(--white); font-size: 0.85rem;
}
.lab-toast[data-kind="miss"] .lab-toast__icon { background: var(--ink-faint); }

/* --- Identify step: prey cards ------------------------------------------ */
.prey-grid { display: grid; gap: var(--sp-3); grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr)); }
.prey-card {
  position: relative;
  display: flex; flex-direction: column; gap: 0.4rem;
  padding: 0.8rem;
  background: var(--night-700);
  border: 2px solid var(--night-line);
  border-radius: var(--r-md);
  color: var(--night-text);
  cursor: pointer; text-align: left;
  transition: border-color 0.18s ease, transform 0.18s ease;
}
.prey-card:hover { border-color: var(--teal-300); transform: translateY(-3px); }
.prey-card[aria-pressed="true"] { border-color: var(--amber-400); background: var(--night-600); }
.prey-card img { border-radius: var(--r-sm); background: var(--night-900); aspect-ratio: 4/3; object-fit: contain; }
.prey-card b { font-size: 0.95rem; color: var(--white); }
.prey-card small { color: var(--night-soft); font-size: 0.78rem; line-height: 1.4; }
.prey-card[data-verdict="right"] { border-color: var(--good); }
.prey-card[data-verdict="wrong"] { border-color: var(--bad); opacity: 0.55; }

/* --- Lab report ---------------------------------------------------------- */
.report { display: grid; gap: var(--sp-4); }
.report__head { text-align: center; }
.report__grade {
  display: inline-grid; place-items: center;
  width: 7rem; height: 7rem; border-radius: 999px;
  background: conic-gradient(var(--amber-400) var(--pct, 0%), var(--night-700) 0);
  margin-bottom: var(--sp-2);
}
.report__grade span {
  display: grid; place-items: center;
  width: 5.9rem; height: 5.9rem; border-radius: 999px;
  background: var(--night-800);
  font-family: var(--display); font-size: 1.7rem; font-weight: 700;
  color: var(--white);
}
.report__rows { display: grid; gap: 0.4rem; }
.report__row {
  display: flex; gap: 0.8rem; align-items: center;
  padding: 0.6rem 0.9rem;
  background: var(--night-700); border-radius: var(--r-md);
  font-size: 0.92rem;
}
.report__row b { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--white); }
.report__row svg { flex: none; }

/* =========================================================================
   Skull Lab — multi-view specimen viewer
   ========================================================================= */
.skull-lab { display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: 540px; }
@media (max-width: 880px) { .skull-lab { grid-template-columns: 1fr; } }

.skull-list {
  background: var(--night-800);
  border-right: 1px solid var(--night-line);
  max-height: 62vh; overflow-y: auto;
  padding: var(--sp-2);
}
@media (max-width: 880px) {
  .skull-list { border-right: 0; border-bottom: 1px solid var(--night-line); max-height: 15rem; }
}
.skull-list__group {
  padding: 0.7rem 0.6rem 0.3rem;
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--amber-400);
}
.skull-list button {
  display: flex; align-items: center; gap: 0.6rem; width: 100%;
  padding: 0.5rem 0.6rem; margin-bottom: 1px;
  background: none; border: 0; border-radius: var(--r-sm);
  color: var(--night-soft); text-align: left;
  font-size: 0.9rem; cursor: pointer;
}
.skull-list button:hover { background: var(--night-700); color: var(--white); }
.skull-list button[aria-current="true"] { background: var(--teal-700); color: var(--white); font-weight: 600; }
.skull-list button img {
  width: 34px; height: 26px; flex: none;
  object-fit: contain; background: var(--night-900); border-radius: 3px;
}

.skull-view { display: flex; flex-direction: column; padding: var(--sp-4); gap: var(--sp-3); }
.skull-view__frame {
  position: relative; flex: 1;
  display: grid; place-items: center;
  min-height: 280px;
  background: radial-gradient(60% 60% at 50% 45%, #13383f, var(--night-900));
  border-radius: var(--r-lg);
  border: 1px solid var(--night-line);
  overflow: hidden;
}
.skull-view__frame img {
  max-height: 46vh; width: auto; max-width: 100%;
  filter: drop-shadow(0 18px 30px rgb(0 0 0 / 0.55));
}
.skull-view h3 { margin: 0; color: var(--white); }
.skull-view__note { color: var(--night-soft); font-size: 0.94rem; margin: 0; max-width: 62ch; }
.view-tabs { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.view-tabs button {
  padding: 0.35rem 0.8rem;
  background: var(--night-700); color: var(--night-soft);
  border: 1px solid var(--night-line); border-radius: var(--r-pill);
  font-size: 0.82rem; font-weight: 600; cursor: pointer;
}
.view-tabs button:hover { color: var(--white); }
.view-tabs button[aria-pressed="true"] { background: var(--amber-400); color: #3a1c04; border-color: var(--amber-200); }

/* =========================================================================
   Quiz — shared by Beak Match, Skull Detective, Diet Sorter, Feet ID
   ========================================================================= */
.quiz { display: grid; gap: var(--sp-4); }
.quiz__prompt {
  display: grid; gap: var(--sp-3);
  grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
  align-items: center;
}
@media (max-width: 720px) { .quiz__prompt { grid-template-columns: 1fr; } }
.quiz__figure {
  background: var(--white);
  border-radius: var(--r-lg); overflow: hidden;
  border: 1px solid var(--night-line);
  display: grid; place-items: center; padding: var(--sp-3);
  min-height: 190px;
}
.quiz__figure img { max-height: 240px; width: auto; }
.quiz__ask { font-family: var(--display); font-size: var(--step-2); color: var(--white); margin: 0 0 0.4em; }
.quiz__sub { color: var(--night-soft); margin: 0; }

.options { display: grid; gap: 0.6rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.option {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.85rem 1rem;
  background: var(--night-700); color: var(--night-text);
  border: 2px solid var(--night-line); border-radius: var(--r-md);
  font-size: 0.98rem; font-weight: 550;
  text-align: left; cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}
.option:hover:not([disabled]) { border-color: var(--teal-300); transform: translateY(-2px); }
.option i {
  display: grid; place-items: center; flex: none;
  width: 1.7rem; height: 1.7rem; border-radius: 999px;
  background: var(--night-600); color: var(--night-soft);
  font-style: normal; font-size: 0.8rem; font-weight: 700;
}
.option[data-verdict="right"] {
  border-color: var(--good);
  background: color-mix(in srgb, var(--good) 18%, var(--night-700));
}
.option[data-verdict="right"] i { background: var(--good); color: var(--white); }
.option[data-verdict="wrong"] {
  border-color: var(--bad);
  background: color-mix(in srgb, var(--bad) 16%, var(--night-700));
}
.option[data-verdict="wrong"] i { background: var(--bad); color: var(--white); }
.option[disabled] { cursor: default; }

.quiz__feedback {
  display: none; gap: 0.8rem; align-items: flex-start;
  padding: var(--sp-3);
  border-radius: var(--r-md);
  background: var(--night-700);
  border-left: 4px solid var(--amber-400);
  font-size: 0.96rem;
}
.quiz__feedback[data-show="true"] { display: flex; }
.quiz__feedback strong { color: var(--white); }
.quiz__feedback p { margin: 0.2em 0 0; color: var(--night-soft); }
.quiz__feedback[data-verdict="right"] { border-left-color: var(--good); }
.quiz__feedback[data-verdict="wrong"] { border-left-color: var(--bad); }

.quiz__foot { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; }

/* =========================================================================
   Topography — interactive bird map
   ========================================================================= */
.topo { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 0; min-height: 520px; }
@media (max-width: 900px) { .topo { grid-template-columns: 1fr; } }
.topo__stage {
  position: relative;
  display: grid; place-items: center;
  padding: var(--sp-4);
  background: radial-gradient(65% 65% at 50% 45%, #133a41, var(--night-900));
}
.topo__img-wrap { position: relative; width: 100%; max-width: 620px; }
.topo__img-wrap img { width: 100%; }
.topo__hot {
  position: absolute; width: 26px; height: 26px;
  transform: translate(-50%, -50%);
  border-radius: 999px; padding: 0; cursor: pointer;
  background: color-mix(in srgb, var(--amber-400) 85%, transparent);
  border: 2px solid var(--white);
  box-shadow: 0 2px 8px rgb(0 0 0 / 0.4);
  transition: transform 0.15s ease;
}
.topo__hot::after {
  content: ""; position: absolute; inset: -8px; border-radius: 999px;
  border: 2px solid var(--amber-400); opacity: 0;
  transition: opacity 0.2s ease;
}
.topo__hot:hover { transform: translate(-50%, -50%) scale(1.25); }
.topo__hot[aria-pressed="true"] { background: var(--white); }
.topo__hot[aria-pressed="true"]::after { opacity: 1; }
.topo__hot[data-done="true"] { background: color-mix(in srgb, var(--good) 85%, transparent); }

.topo__panel {
  background: var(--night-800);
  border-left: 1px solid var(--night-line);
  padding: var(--sp-3);
  display: flex; flex-direction: column; gap: var(--sp-2);
}
@media (max-width: 900px) { .topo__panel { border-left: 0; border-top: 1px solid var(--night-line); } }
.topo__panel h3 { color: var(--white); margin: 0; font-size: var(--step-1); }
.topo__detail-img {
  background: var(--white); border-radius: var(--r-md);
  overflow: hidden; border: 1px solid var(--night-line);
}
.topo__list {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 0.3rem;
  max-height: 12rem; overflow-y: auto;
}
.topo__list button {
  padding: 0.3rem 0.6rem; font-size: 0.78rem;
  background: var(--night-700); color: var(--night-soft);
  border: 1px solid var(--night-line); border-radius: var(--r-pill);
  cursor: pointer;
}
.topo__list button:hover { color: var(--white); }
.topo__list button[aria-current="true"] { background: var(--amber-400); color: #3a1c04; }

/* =========================================================================
   Explorer — card/detail pattern for beaks, feet, feathers, diets, eggs
   ========================================================================= */
.explorer { display: grid; gap: var(--sp-4); }
.explorer__strip {
  display: flex; gap: 0.6rem; overflow-x: auto;
  padding-bottom: 0.5rem;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
}
.explorer__strip button {
  flex: none; width: 110px; scroll-snap-align: start;
  padding: 0.4rem; background: var(--night-700);
  border: 2px solid var(--night-line); border-radius: var(--r-md);
  color: var(--night-soft); cursor: pointer;
  font-size: 0.76rem; font-weight: 600;
}
.explorer__strip button img {
  width: 100%; aspect-ratio: 4/3; object-fit: contain;
  background: var(--white); border-radius: var(--r-sm); margin-bottom: 0.35rem;
}
.explorer__strip button:hover { color: var(--white); border-color: var(--teal-300); }
.explorer__strip button[aria-current="true"] { border-color: var(--amber-400); color: var(--white); }

.explorer__detail {
  display: grid; gap: var(--sp-4);
  grid-template-columns: minmax(0, 420px) minmax(0, 1fr);
  align-items: start;
}
@media (max-width: 760px) { .explorer__detail { grid-template-columns: 1fr; } }
.explorer__figure {
  background: var(--white); border-radius: var(--r-lg);
  padding: var(--sp-3); border: 1px solid var(--night-line);
  display: grid; place-items: center; min-height: 200px;
}
.explorer__figure img { max-height: 320px; width: auto; }
.explorer__text h3 { color: var(--white); margin-bottom: 0.2em; }
.explorer__text .explorer__species {
  color: var(--amber-400); font-size: 0.9rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 0.9em;
}
.explorer__text p { color: var(--night-soft); }
.explorer__variants { display: grid; gap: var(--sp-2); grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); margin-top: var(--sp-3); }
.explorer__variant {
  padding: 0.7rem; background: var(--night-700);
  border: 1px solid var(--night-line); border-radius: var(--r-md);
}
.explorer__variant img { background: var(--white); border-radius: var(--r-sm); aspect-ratio: 4/3; object-fit: contain; margin-bottom: 0.4rem; }
.explorer__variant b { color: var(--white); font-size: 0.9rem; display: block; }
.explorer__variant small { color: var(--night-soft); font-size: 0.8rem; line-height: 1.45; }

/* --- Egg comparison ----------------------------------------------------- */
.eggs { display: grid; gap: var(--sp-3); grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); }
.egg {
  background: var(--night-700); border: 1px solid var(--night-line);
  border-radius: var(--r-md); overflow: hidden; text-align: center;
}
.egg__imgs { display: grid; grid-template-columns: 1fr 1fr; background: var(--white); }
.egg__imgs img { aspect-ratio: 1; object-fit: contain; padding: 0.3rem; }
.egg b { display: block; padding: 0.55rem 0.4rem; font-size: 0.85rem; color: var(--white); }

/* --- Reduced motion ----------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .card--link:hover, .option:hover, .prey-card:hover, .topo__hot:hover { transform: none; }
}

/* An explorer entry with no photograph: text takes the full width. */
.explorer__detail[data-noimg="true"] { grid-template-columns: 1fr; }
.explorer__noimg {
  display: block; width: 100%; aspect-ratio: 4/3;
  margin-bottom: 0.35rem; border-radius: var(--r-sm);
  background:
    repeating-linear-gradient(45deg, var(--night-600) 0 6px, var(--night-700) 6px 12px);
  opacity: 0.6;
}

/* =========================================================================
   Dissection kit — first cut, take apart, rebuild
   All art on these surfaces is lifted from the kit booklet; the CSS only
   stages it.
   ========================================================================= */
.kit { display: grid; grid-template-columns: minmax(0, 1fr) 360px; min-height: 600px; }
@media (max-width: 960px) { .kit { grid-template-columns: 1fr; } }

.kit__stage {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--sp-3);
  padding: var(--sp-4);
  background: radial-gradient(70% 60% at 50% 45%, #16414a 0%, var(--night-900) 75%);
  overflow: hidden;
}
.kit__hint {
  min-height: 1.5em;
  color: var(--amber-200); font-size: 0.92rem; font-weight: 600;
  text-align: center; max-width: 46ch;
}

.kit__panel {
  background: var(--night-800);
  border-left: 1px solid var(--night-line);
  padding: var(--sp-4) var(--sp-3);
  max-height: 80vh; overflow-y: auto;
}
@media (max-width: 960px) {
  .kit__panel { border-left: 0; border-top: 1px solid var(--night-line); max-height: none; }
}
.kit__panel h3 { color: var(--white); font-size: var(--step-2); margin-bottom: 0.35em; }
.kit-muted { color: var(--night-soft); font-size: 0.93rem; }
.kit-quote {
  margin: var(--sp-2) 0; padding: 0.7rem 0.9rem;
  border-left: 3px solid var(--amber-400);
  background: var(--night-700); border-radius: 0 var(--r-sm) var(--r-sm) 0;
  color: var(--night-text); font-size: 0.93rem; line-height: 1.55;
}
.kit-done { justify-content: space-between; align-items: center; flex-wrap: wrap; margin-bottom: var(--sp-3); }

/* --- Step 1: specimen ---------------------------------------------------- */
.kit__specimen {
  position: relative;
  height: min(58vh, 470px); max-width: 100%;
  touch-action: none; cursor: crosshair;
  border-radius: var(--r-lg);
  transition: transform 0.5s ease, opacity 0.5s ease, filter 0.5s ease;
}
.kit__specimen:focus-visible { outline-offset: 8px; }
.kit__specimen > img:first-child {
  width: 100%; height: 100%; object-fit: contain;
  filter: drop-shadow(0 22px 34px rgb(0 0 0 / 0.55));
  user-select: none; -webkit-user-drag: none;
}
.kit__specimen svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.kit-cut__guide {
  fill: none; stroke: rgb(255 238 200 / 0.9); stroke-width: 1.1;
  stroke-dasharray: 1.6 2.4; stroke-linecap: round;
}
.kit-cut__line { fill: none; stroke: #2a0606; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.kit-cut__line--edge { stroke: rgb(255 190 170 / 0.55); stroke-width: 0.7; }
.kit__specimen.is-opening { transform: scale(0.82); opacity: 0; filter: blur(3px); }

.kit-tool {
  position: absolute; pointer-events: none; z-index: 6;
  transform-origin: 50% 0;
  transform: translate(-50%, -2px) rotate(-28deg);
  filter: drop-shadow(0 6px 10px rgb(0 0 0 / 0.45));
}
.kit-tool--scalpel { height: 140px; width: auto; }
.kit-tool--tweezers { height: 120px; width: auto; }
@media (pointer: coarse) { .kit-tool { display: none; } }

/* --- Step 2/3: the exploded board ---------------------------------------- */
.kit__board {
  position: relative;
  height: min(72vh, 660px); max-width: 100%;
  touch-action: none; user-select: none;
  animation: kit-board-in 0.55s ease both;
}
@keyframes kit-board-in { from { opacity: 0; transform: scale(0.94); } to { opacity: 1; transform: none; } }
.kit__board:focus { outline: none; }

.kit-part, .kit-ghost {
  position: absolute; display: block; padding: 0; margin: 0;
  background: none; border: 0; cursor: inherit;
}
.kit-part img, .kit-ghost { width: 100%; height: 100%; object-fit: fill; -webkit-user-drag: none; }
.kit-part { z-index: 2; transition: transform 0.18s ease, opacity 0.3s ease; }
.kit-part img { pointer-events: none; filter: drop-shadow(0 3px 5px rgb(0 0 0 / 0.45)); }
.kit-part:focus-visible { outline: 3px solid var(--amber-400); outline-offset: 3px; border-radius: 6px; }

[data-step="apart"] .kit-part[data-state="free"] img {
  animation: kit-glow 1.8s ease-in-out infinite;
}
@keyframes kit-glow {
  0%, 100% { filter: drop-shadow(0 3px 5px rgb(0 0 0 / 0.45)) drop-shadow(0 0 0 rgb(245 166 35 / 0)); }
  50%      { filter: drop-shadow(0 3px 5px rgb(0 0 0 / 0.45)) drop-shadow(0 0 7px rgb(245 166 35 / 0.95)); }
}
.kit-part.is-lifting { z-index: 8; transition: none; }
.kit-part.is-lifting img { animation: none; filter: drop-shadow(0 16px 18px rgb(0 0 0 / 0.55)); }
.kit-part.is-leaving { opacity: 0; transition: transform 0.3s ease-in, opacity 0.3s ease-in; }
.kit-part.is-shaking { animation: kit-shake 0.42s ease; }
@keyframes kit-shake {
  0%, 100% { transform: none; }
  20% { transform: translateX(-5px) rotate(-2deg); }
  40% { transform: translateX(5px) rotate(2deg); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}
.kit-part.is-placing { animation: kit-place 0.38s cubic-bezier(0.2, 0.9, 0.3, 1.3); }
@keyframes kit-place { from { transform: scale(1.25); opacity: 0.2; } to { transform: none; opacity: 1; } }

/* Outlines of where each part goes, shown while rebuilding. */
.kit-ghost { z-index: 1; opacity: 0; pointer-events: none; transition: opacity 0.3s ease; }
/* Visible enough to read the whole shape you are rebuilding, faint enough
   that placed parts still stand out. */
[data-step="rebuild"] .kit-ghost { opacity: 0.24; filter: grayscale(1) brightness(1.9); }
[data-step="rebuild"] .kit-ghost[data-ready="true"] {
  opacity: 0.42;
  filter: grayscale(1) brightness(2.2) drop-shadow(0 0 5px rgb(245 166 35 / 0.9));
  animation: kit-ghost 1.6s ease-in-out infinite;
}
@keyframes kit-ghost { 50% { opacity: 0.22; } }

/* --- Tray & cards --------------------------------------------------------- */
.kit-tray { margin: var(--sp-3) 0; }
.kit-tray__title {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--amber-400); margin-bottom: 0.5rem;
}
.kit-tray__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 0.4rem; }
.kit-tray__item {
  position: relative; aspect-ratio: 1; padding: 5px;
  background: var(--night-700); border: 1px solid var(--night-line); border-radius: var(--r-sm);
  cursor: pointer; animation: kit-place 0.3s ease;
}
.kit-tray__item img { width: 100%; height: 100%; object-fit: contain; }
.kit-tray__item span {
  position: absolute; top: 2px; left: 3px;
  font-size: 0.62rem; font-weight: 700; color: var(--night-soft);
}
.kit-tray__item:hover { border-color: var(--teal-300); }
.kit-tray__item[data-ready="true"] { border-color: var(--amber-400); box-shadow: 0 0 0 1px var(--amber-400) inset; }

.kit-card { margin-top: var(--sp-2); }
.kit-card__head { display: flex; gap: 0.7rem; align-items: center; margin-bottom: var(--sp-2); }
.kit-card__head h3 { margin: 0; font-size: var(--step-1); }
.kit-card__num {
  display: grid; place-items: center; flex: none;
  width: 2.1rem; height: 2.1rem; border-radius: 999px;
  background: var(--amber-400); color: #3a1c04;
  font-family: var(--display); font-weight: 700;
}
.kit-card__snap { margin: 0.15em 0 0; color: var(--night-soft); font-size: 0.82rem; }
.kit-card__figure {
  margin: 0 0 var(--sp-2); padding: var(--sp-2);
  display: grid; place-items: center;
  background: radial-gradient(circle at 50% 40%, var(--night-600), var(--night-700));
  border: 1px solid var(--night-line); border-radius: var(--r-md);
}
.kit-card__figure img { max-height: 200px; width: auto; max-width: 100%; }
.kit-card__figure--bone img { height: 190px; object-fit: contain; }
.kit-card__labels { display: flex; flex-wrap: wrap; gap: 0.3rem; align-items: center; margin-bottom: var(--sp-2); }
.kit-card__labels span { width: 100%; font-size: 0.7rem; color: var(--night-soft); text-transform: uppercase; letter-spacing: 0.07em; }
.kit-card__labels b {
  font-weight: 600; font-size: 0.78rem; color: var(--night-text);
  padding: 0.18rem 0.55rem; border-radius: 999px;
  background: var(--night-700); border: 1px solid var(--night-line);
}

.kit-section { border-top: 1px solid var(--night-line); padding: 0.55rem 0; }
.kit-section summary {
  cursor: pointer; list-style: none;
  font-weight: 700; color: var(--white); font-size: 0.95rem;
  display: flex; justify-content: space-between; align-items: center;
}
.kit-section summary::-webkit-details-marker { display: none; }
.kit-section summary::after { content: "+"; color: var(--amber-400); font-size: 1.1rem; }
.kit-section[open] summary::after { content: "–"; }
.kit-section p { color: var(--night-soft); font-size: 0.9rem; line-height: 1.6; margin: 0.5em 0 0; }

@media (prefers-reduced-motion: reduce) {
  [data-step="apart"] .kit-part[data-state="free"] img,
  [data-step="rebuild"] .kit-ghost[data-ready="true"] { animation: none; }
}

.kit__hint .btn { margin-left: 0.6rem; vertical-align: middle; }
.kit__hint strong { color: var(--white); }
.kit-tray__empty { grid-column: 1 / -1; margin: 0; }
/* The board is taller than most screens, so a toast anchored to the stage
   lands below the fold — and anchored to its top, it covers the hint and its
   button. Pin it to the viewport instead. */
.kit__stage .lab-toast { position: fixed; bottom: 1.4rem; }
/* On a phone the width is the constraint: size by it and let aspect-ratio set
   the height, instead of a fixed height that leaves dead space. */
@media (max-width: 600px) {
  .kit__stage { padding: var(--sp-3) var(--sp-2); }
  .kit__specimen, .kit__board { height: auto; width: 100%; }
}

/* Where the scalpel tip is. Stands in for a tool image until a licensed one
   is supplied. */
.kit-cutpoint {
  position: absolute; z-index: 6; pointer-events: none;
  width: 22px; height: 22px; margin: -11px 0 0 -11px;
  border-radius: 999px;
  border: 2px solid rgb(255 255 255 / 0.95);
  box-shadow: 0 0 0 2px rgb(20 30 34 / 0.55), 0 0 14px rgb(245 166 35 / 0.9);
}
.kit-cutpoint::after {
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 4px; height: 4px; margin: -2px 0 0 -2px;
  border-radius: 999px; background: var(--amber-400);
}
.kit__specimen { cursor: none; }
@media (pointer: coarse) { .kit__specimen { cursor: auto; } }

/* Booklet diagrams have black labels on white; they need a white ground. */
.kit-card__figure--diagram { background: #fff; border-color: var(--night-line); padding: 0.4rem; }
.kit-card__figure--diagram img { max-height: 260px; }
