:root {
  --brand-font: "ITC Franklin Gothic", "Franklin Gothic Medium", "Franklin Gothic", "Arial Narrow", Arial, sans-serif;
  --ink: #173f36;
  --muted: #60776f;
  --green: #24725f;
  --green-2: #4b9b83;
  --mint: #e6f4e9;
  --mint-2: #f4f9f2;
  --lime: #dff266;
  --coral: #ff9a70;
  --line: #c9ddd4;
  --white: #ffffff;
  font-family: var(--brand-font);
  color: var(--ink);
  background: var(--mint-2);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { height: 100%; overflow: hidden; }
body { min-width: 320px; height: 100%; min-height: 100vh; margin: 0; overflow: hidden; background: var(--mint-2); }
button { font: inherit; }
[hidden] { display: none !important; }

.lab-shell {
  height: 100dvh;
  min-height: 0;
  display: grid;
  grid-template-columns: 286px minmax(0, 1fr);
  overflow: hidden;
}

.sequencer {
  position: relative;
  height: 100%;
  min-height: 0;
  padding: 28px 24px;
  overflow: hidden;
  border-right: 1px solid #bad6ca;
  background:
    radial-gradient(circle at 10% 18%, rgba(223,242,102,.3), transparent 180px),
    linear-gradient(165deg, #eff8ec, #d9eee3);
}

.sequencer::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(36,114,95,.055) 1px, transparent 1px), linear-gradient(90deg, rgba(36,114,95,.055) 1px, transparent 1px);
  background-size: 38px 38px;
  pointer-events: none;
}

.sequence-intro,
.sequence-meta,
.sequence-cells,
.sequence-readout,
.helix { position: relative; }

.sequence-intro { display: flex; gap: 12px; align-items: flex-start; }
.sequence-symbol {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid #9ec8b8;
  border-radius: 50%;
  color: var(--green);
  background: rgba(255,255,255,.72);
  font-size: 19px;
}
.sequence-intro strong { display: block; margin: 2px 0 4px; font-size: 13px; }
.sequence-intro p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.35; }

.helix { width: 144px; height: 275px; margin: 24px auto 8px; }
.helix::before,
.helix::after {
  content: "";
  position: absolute;
  top: 5px;
  bottom: 5px;
  width: 18px;
  border: 3px solid #72ad9d;
  border-top: 0;
  border-bottom: 0;
  border-radius: 50%;
  opacity: .55;
}
.helix::before { left: 28px; transform: rotate(8deg); }
.helix::after { right: 28px; transform: rotate(-8deg); }
.helix-rung {
  position: absolute;
  top: calc(18px + var(--i) * 40px);
  left: 23px;
  width: 98px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  opacity: .16;
  transform: rotate(calc(-10deg + var(--i) * 4deg));
  transition: .35s ease;
}
.helix-rung span,
.helix-rung em { z-index: 2; width: 13px; height: 13px; border-radius: 50%; background: #82b5a6; }
.helix-rung b { position: absolute; left: 7px; right: 7px; height: 4px; border-radius: 4px; background: #82b5a6; }
.helix-rung.is-active { opacity: 1; filter: drop-shadow(0 0 7px rgba(75,155,131,.3)); }
.helix-rung.is-active span { background: var(--lime); }
.helix-rung.is-active em { background: var(--coral); }
.helix-rung.is-active b { background: linear-gradient(90deg, var(--lime), var(--coral)); }

.sequence-meta { display: grid; gap: 3px; text-align: center; }
.sequence-meta strong { font-size: 24px; }
.sequence-meta span { color: var(--muted); font-size: 12px; }
.sequence-cells { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 17px; }
.sequence-cell {
  min-height: 51px;
  display: grid;
  place-items: center;
  padding: 8px;
  border: 1px solid #b8d3c8;
  border-radius: 10px;
  color: #80968e;
  background: rgba(255,255,255,.42);
  text-align: center;
  transition: .35s ease;
}
.sequence-cell b { font-size: 11px; line-height: 1.15; }
.sequence-cell code { display: none; color: var(--green); font: 900 9px/1 var(--brand-font); }
.sequence-cell.is-active { color: var(--ink); border-color: #72b69f; background: rgba(255,255,255,.92); box-shadow: 0 8px 18px rgba(36,114,95,.1); }
.sequence-cell.is-wrong { border-color: #e8a38d; }
.sequence-cell.is-new { animation: cell-pop .72s ease; }
@keyframes cell-pop { 45% { transform: scale(1.08); box-shadow: 0 0 0 7px rgba(223,242,102,.3); } }
.sequence-readout { margin-top: 11px; padding: 12px; border: 1px solid #b8d3c8; border-radius: 9px; background: rgba(255,255,255,.5); text-align: center; }
.sequence-readout small { display: block; margin-bottom: 6px; color: var(--muted); font-size: 8px; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.sequence-readout code { color: var(--green); font: 900 10px/1 var(--brand-font); letter-spacing: .08em; }

.game {
  position: relative;
  min-width: 0;
  height: 100%;
  min-height: 0;
  display: flex;
  align-items: center;
  padding: clamp(28px, 4vw, 58px);
  overflow: hidden;
  background: radial-gradient(circle at 95% 3%, rgba(223,242,102,.3), transparent 360px), linear-gradient(135deg, #fbfcf7, #edf6ec);
}
.language-switch { position: absolute; z-index: 15; top: 16px; right: 18px; display: flex; padding: 3px; border: 1px solid #b9d4c9; border-radius: 999px; background: rgba(255,255,255,.9); box-shadow: 0 7px 18px rgba(36,114,95,.08); }
.language-switch button { min-width: 38px; height: 30px; padding: 0 9px; border: 0; border-radius: 999px; color: #587169; background: transparent; font-size: 10px; font-weight: 900; cursor: pointer; }
.language-switch button.is-active { color: #fff; background: var(--green); }
.screen { display: none; width: min(1220px, 100%); margin: auto; animation: screen-in .38s ease; }
.screen.is-active { display: block; }
@keyframes screen-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.eyebrow { margin: 0 0 14px; color: var(--green-2); font-size: 10px; font-weight: 900; letter-spacing: .15em; text-transform: uppercase; }
h1,h2,h3,p { margin-top: 0; }
h1 { max-width: 10ch; margin-bottom: 18px; font-size: clamp(46px, 5vw, 72px); line-height: .92; letter-spacing: -.052em; }
h1 em { color: var(--green); font-style: normal; }

.screen[data-screen="start"] { position: relative; grid-template-columns: minmax(390px, .92fr) minmax(440px, 1.08fr); gap: 22px 34px; align-items: center; }
.screen[data-screen="start"].is-active { display: grid; }
.opening-dialogue { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; width: min(850px, 100%); margin: 0 auto; }
.speaker { display: flex; align-items: center; gap: 9px; }
.speaker--right { justify-content: flex-end; }
.speaker img { width: 76px; height: 96px; object-fit: contain; filter: drop-shadow(0 8px 10px rgba(36,114,95,.16)); }
.speaker p { position: relative; max-width: 340px; margin: 0; padding: 11px 14px; border: 1px solid var(--line); border-radius: 18px 18px 18px 5px; color: #315c52; background: var(--white); font-size: 12px; font-weight: 800; line-height: 1.35; box-shadow: 0 10px 24px rgba(36,114,95,.08); }
.speaker p::after {
  content: "";
  position: absolute;
  top: 50%;
  left: -7px;
  width: 12px;
  height: 12px;
  border: 1px solid var(--line);
  border-top: 0;
  border-right: 0;
  background: var(--white);
  transform: translateY(-50%) rotate(45deg);
}
.speaker--right p { border-radius: 18px 18px 5px 18px; }
.speaker--right p::after {
  right: -7px;
  left: auto;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-left: 0;
}
.start-copy { min-width: 0; }
.lead { max-width: 640px; color: var(--muted); font-size: 18px; line-height: 1.5; }
.game-rule { margin-top: 18px; padding: 15px 17px; border-left: 5px solid var(--lime); background: rgba(255,255,255,.82); box-shadow: 0 10px 28px rgba(36,114,95,.06); }
.game-rule span { display: block; margin-bottom: 5px; color: var(--green); font-size: 10px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.game-rule p { margin: 0; color: #4f6b62; font-size: 13px; line-height: 1.45; }
.primary { min-height: 54px; display: inline-flex; align-items: center; justify-content: center; gap: 20px; margin-top: 20px; padding: 0 23px; border: 0; border-radius: 9px; color: #fff; background: var(--green); font-weight: 900; cursor: pointer; box-shadow: 0 12px 26px rgba(36,114,95,.18); }
.primary:hover { background: #1c5d4e; }
.primary:focus-visible,.answer:focus-visible { outline: 3px solid #aac82c; outline-offset: 3px; }
.primary span { color: var(--lime); font-size: 21px; }

.lab-art { position: relative; overflow: hidden; aspect-ratio: 16 / 10; border: 1px solid #9fc7b8; border-radius: 17px; background: #e3f2ec; box-shadow: 0 20px 48px rgba(36,114,95,.14); }
.lab-art img { display: block; width: 100%; height: 100%; object-fit: contain; transition: opacity .2s ease; }
.lab-art.is-loading img { opacity: 0; }
.scan-grid { position: absolute; inset: 0; background-image: linear-gradient(rgba(36,114,95,.07) 1px, transparent 1px), linear-gradient(90deg, rgba(36,114,95,.07) 1px, transparent 1px); background-size: 44px 44px; mask-image: linear-gradient(90deg, transparent, #000 26%, #000 74%, transparent); pointer-events: none; }
.art-status { position: absolute; right: 13px; bottom: 12px; padding: 7px 9px; border: 1px solid rgba(36,114,95,.18); border-radius: 5px; color: var(--green); background: rgba(255,255,255,.88); font-size: 9px; font-weight: 900; letter-spacing: .08em; }

.intro-dialogue { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px; }
.intro-dialogue .speaker p { max-width: 460px; }
.intro-layout { display: grid; grid-template-columns: .92fr 1.08fr; gap: 20px; align-items: start; }
.intro-copy { display: grid; gap: 11px; }
.fact-card { padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.82); }
.fact-card h2 { margin: 0 0 7px; font-size: 21px; }
.fact-card p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.48; }
.region-list { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.region-list b,.breed-labels b { padding: 7px 9px; border: 1px solid #c5ddd3; border-radius: 999px; color: #2d6557; background: #e8f3e9; font-size: 11px; }
.breed-labels { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 6px; margin-top: 10px; }
.breed-labels b { border-radius: 8px; text-align: center; }

.question-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.score { padding: 7px 11px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.75); font-size: 12px; font-weight: 900; }
.quiz-layout { display: grid; grid-template-columns: minmax(480px,1.12fr) minmax(360px,.88fr); gap: clamp(24px,3vw,42px); align-items: start; }
.question-column { min-width: 0; }
.quiz-guide { display: flex; align-items: center; width: fit-content; max-width: 560px; }
.quiz-guide img { z-index: 2; width: 58px; height: 73px; object-fit: contain; }
.quiz-guide p { position: relative; margin: 0 0 4px 7px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 17px; color: #315c52; background: #e7f3e9; font-size: 12px; font-weight: 800; line-height: 1.3; }
.quiz-guide p::before {
  content: "";
  position: absolute;
  top: 50%;
  left: -7px;
  width: 12px;
  height: 12px;
  border: 1px solid var(--line);
  border-top: 0;
  border-right: 0;
  background: #e7f3e9;
  transform: translateY(-50%) rotate(45deg);
}
.question-column h2 { max-width: 25ch; margin: 14px 0 12px; font-size: clamp(30px,2.45vw,46px); line-height: 1.03; letter-spacing: -.035em; }
.result-copy h2 { max-width: 17ch; margin: 16px 0 12px; font-size: clamp(34px,3.7vw,58px); line-height: .99; letter-spacing: -.043em; }
.question-copy { max-width: 640px; color: var(--muted); font-size: 16px; line-height: 1.48; }
.answers { display: grid; gap: 8px; margin-top: 18px; }
.answer { position: relative; min-height: 61px; padding: 13px 45px 13px 16px; border: 1px solid var(--line); border-radius: 10px; color: #214b40; background: rgba(255,255,255,.86); font-weight: 800; line-height: 1.35; text-align: left; cursor: pointer; transition: .18s ease; }
.answer::after { content: attr(data-key); position: absolute; top: 50%; right: 13px; width: 25px; height: 25px; display: grid; place-items: center; border: 1px solid #d0dfd7; border-radius: 6px; color: #738b83; font: 800 10px/1 var(--brand-font); transform: translateY(-50%); }
.answer:hover:not(:disabled) { border-color: var(--green-2); transform: translateX(3px); }
.answer.is-correct { border-color: #62aa77; background: #e8f5df; }
.answer.is-wrong { border-color: #df856d; background: #fae8e1; }
.choice-warning { margin: 10px 0 0; padding: 10px 12px; border-left: 4px solid var(--coral); color: #7b4232; background: #fff0e9; font-size: 13px; font-weight: 800; }
.feedback { margin-top: 12px; padding: 14px 16px; border-left: 5px solid var(--lime); background: #fff; box-shadow: 0 10px 24px rgba(36,114,95,.07); }
.feedback strong { font-size: 16px; }
.feedback p { margin: 5px 0 0; color: var(--muted); font-size: 14px; line-height: 1.42; }
.question-next { margin-top: 13px; }
.cross-card { display: grid; gap: 7px; margin-top: 12px; padding: 13px; border: 1px solid #bcd9cd; border-radius: 11px; background: #fff; }
.scheme-line { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.cross-card span { opacity: 0; padding: 7px 9px; border-radius: 7px; color: #245d50; background: #e5f2e8; font-size: 11px; font-weight: 900; animation: scheme-step .35s ease forwards; animation-delay: calc(var(--i) * .16s); }
.cross-card span.is-arrow { color: var(--green); background: transparent; font-size: 18px; }
@keyframes scheme-step { to { opacity: 1; transform: none; } from { opacity: 0; transform: translateX(-7px); } }

.result-layout { display: grid; grid-template-columns: .95fr 1.05fr; gap: 28px; align-items: center; }
.result-score-card { padding: 18px; border-left: 6px solid var(--lime); background: #fff; }
.result-score-card span { color: var(--muted); font-size: 11px; font-weight: 900; }
.result-score-card strong { display: block; margin: 7px 0; font-size: clamp(23px,2.7vw,33px); }
.result-score-card p { margin: 0; color: var(--muted); line-height: 1.45; }
.takeaways { display: grid; gap: 7px; margin-top: 12px; }
.takeaways p { margin: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; color: #46655c; background: rgba(255,255,255,.72); font-size: 12px; line-height: 1.35; }
.takeaways b { color: var(--ink); }
.formula { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-top: 12px; }
.formula span,.formula strong { padding: 7px 8px; background: #dfeee3; font-size: 11px; }
.formula strong { color: #fff; background: var(--green); }
.formula b { color: #789087; }
.result-fragments { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 6px; margin-top: 12px; }
.result-fragments span { padding: 8px; border: 1px solid #c2dacf; border-radius: 7px; color: var(--green); background: #eff7ee; font-size: 10px; font-weight: 900; text-align: center; }
.final-dialogue { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; margin-top: 14px; }

@media (max-width: 1050px) {
  html,body { height: auto; min-height: 100%; overflow-x: hidden; overflow-y: auto; }
  .lab-shell { height: auto; min-height: 100vh; overflow: visible; }
  .lab-shell { grid-template-columns: 1fr; }
  .sequencer { position: sticky; top: 0; z-index: 20; min-height: auto; padding: 9px 12px; border-right: 0; border-bottom: 1px solid #b8d3c8; }
  .sequence-intro,.helix,.sequence-meta,.sequence-readout { display: none; }
  .sequence-cells { grid-template-columns: repeat(6,minmax(0,1fr)); gap: 4px; margin: 0; }
  .sequence-cell { min-height: 38px; padding: 5px 3px; border-radius: 7px; }
  .sequence-cell b { display: none; }
  .sequence-cell code { display: block; }
  .game { height: auto; min-height: calc(100vh - 57px); padding: 60px 20px 30px; overflow: visible; }
  .screen[data-screen="start"].is-active,.intro-layout,.quiz-layout,.result-layout { grid-template-columns: 1fr; }
  .opening-dialogue { grid-column: 1; }
  .intro-dialogue { grid-template-columns: 1fr; }
  .visual-column { grid-row: 1; }
  .question-column { grid-row: 2; }
}

@media (min-width: 1051px) and (max-height: 800px) {
  .sequencer { padding: 18px 20px; }
  .sequence-intro p { font-size: 10px; }
  .helix { height: 210px; margin: 12px auto 4px; }
  .helix-rung { top: calc(10px + var(--i) * 31px); }
  .sequence-meta strong { font-size: 20px; }
  .sequence-cells { gap: 6px; margin-top: 10px; }
  .sequence-cell { min-height: 40px; padding: 5px; }
  .sequence-readout { margin-top: 8px; padding: 8px; }

  .game { padding: 14px 28px; }
  .language-switch { top: 10px; right: 14px; }
  .eyebrow { margin-bottom: 7px; }
  .opening-dialogue { gap: 12px; }
  .speaker img { width: 56px; height: 70px; }
  .speaker p { padding: 9px 12px; font-size: 10px; }
  h1 { margin-bottom: 10px; font-size: clamp(40px,4.2vw,56px); }
  .lead { margin-bottom: 8px; font-size: 15px; }
  .game-rule { margin-top: 9px; padding: 10px 13px; }
  .game-rule p { font-size: 11px; }
  .primary { min-height: 44px; margin-top: 10px; }

  .intro-dialogue { gap: 12px; margin-bottom: 9px; }
  .intro-copy { gap: 7px; }
  .fact-card { padding: 12px 14px; }
  .fact-card h2 { margin-bottom: 4px; font-size: 18px; }
  .fact-card p { font-size: 12px; line-height: 1.35; }
  .region-list,.breed-labels { margin-top: 7px; }
  .region-list b,.breed-labels b { padding: 5px 7px; font-size: 9px; }

  .question-column h2 { margin: 8px 0; font-size: clamp(27px,2.25vw,36px); }
  .quiz-guide img { width: 43px; height: 54px; }
  .quiz-guide p { padding: 8px 11px; font-size: 10px; }
  .question-copy { margin-bottom: 6px; font-size: 12px; line-height: 1.35; }
  .answers { gap: 5px; margin-top: 9px; }
  .answer { min-height: 45px; padding: 8px 42px 8px 13px; font-size: 12px; }
  .choice-warning { margin-top: 6px; padding: 7px 10px; font-size: 11px; }
  .feedback { margin-top: 7px; padding: 9px 12px; }
  .feedback strong { font-size: 13px; }
  .feedback p { margin-top: 3px; font-size: 11px; line-height: 1.3; }
  .cross-card { gap: 4px; margin-top: 6px; padding: 8px; }
  .cross-card span { padding: 4px 6px; font-size: 9px; }
  .cross-card span.is-arrow { font-size: 14px; }
  .question-next { margin-top: 7px; }

  .result-copy h2 { margin: 7px 0; font-size: clamp(28px,2.6vw,40px); }
  .result-score-card { padding: 11px 14px; }
  .result-score-card strong { margin: 4px 0; font-size: 22px; }
  .result-score-card p { font-size: 11px; }
  .takeaways { gap: 4px; margin-top: 7px; }
  .takeaways p { padding: 6px 9px; font-size: 10px; }
  .formula,.result-fragments { margin-top: 7px; }
  .formula span,.formula strong,.result-fragments span { padding: 5px 6px; font-size: 9px; }
  .final-dialogue { margin-top: 7px; }
}

@media (max-width: 650px) {
  .game { padding: 58px 14px 22px; }
  .opening-dialogue,.final-dialogue { grid-template-columns: 1fr; gap: 5px; }
  .speaker img { width: 58px; height: 73px; }
  .speaker p { max-width: 275px; font-size: 10px; }
  .speaker--right { justify-content: flex-end; }
  h1 { font-size: clamp(42px,12vw,49px); }
  .lead { font-size: 16px; }
  .primary { width: 100%; }
  .breed-labels { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .question-head { align-items: flex-start; }
  .question-column h2 { max-width: none; font-size: 30px; line-height: 1.05; }
  .result-copy h2 { font-size: 34px; }
  .answer { min-height: 58px; font-size: 13px; }
  .result-fragments { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .sequence-cell code { font-size: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *,*::before,*::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
