:root {
  --ink: #172334;
  --muted: #607086;
  --paper: #f7f9fc;
  --panel: #ffffff;
  --line: #dce4ee;
  --navy: #17395f;
  --navy-dark: #102b49;
  --blue: #2d74b9;
  --cyan: #39a6b8;
  --teal: #187c78;
  --green: #3b8c66;
  --amber: #d58a21;
  --red: #b94b58;
  --purple: #7256a5;
  --shadow: 0 18px 48px rgba(20, 45, 78, 0.12);
  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 9px;
  --base-a: #3f82c4;
  --base-t: #d86c5f;
  --base-u: #9c64b8;
  --base-c: #e1a62a;
  --base-g: #33936d;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 0%, rgba(57, 166, 184, 0.12), transparent 30rem),
    radial-gradient(circle at 96% 10%, rgba(45, 116, 185, 0.11), transparent 34rem),
    var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

button, select, input, textarea { font: inherit; }
button { cursor: pointer; }

.skip-link {
  position: fixed;
  left: 1rem;
  top: -5rem;
  z-index: 1000;
  padding: 0.8rem 1rem;
  border-radius: 0 0 8px 8px;
  color: white;
  background: var(--navy-dark);
}
.skip-link:focus-visible { top: 0; }

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(1rem, 3vw, 3rem);
  color: white;
  background: linear-gradient(115deg, var(--navy-dark), var(--navy) 62%, #1b5476);
  box-shadow: 0 10px 30px rgba(16, 43, 73, 0.2);
}

.brand-lockup { display: flex; align-items: center; gap: 0.9rem; }
.brand-name { margin: 0; font-size: 1.12rem; font-weight: 800; letter-spacing: 0.01em; }
.brand-tagline { margin: 0; font-size: 0.75rem; color: #c9d8e7; }

.brand-mark {
  position: relative;
  width: 44px;
  height: 44px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 12px;
  background: rgba(255,255,255,.08);
}
.helix {
  position: absolute;
  left: 9px;
  width: 24px;
  height: 7px;
  border-top: 2px solid #87d7e1;
  border-bottom: 2px solid #87d7e1;
  border-radius: 50%;
  transform: rotate(22deg);
}
.helix::after {
  content: "";
  position: absolute;
  left: 10px;
  top: -5px;
  height: 12px;
  border-left: 2px solid #e9b657;
}
.helix-a { top: 10px; }
.helix-b { top: 25px; transform: rotate(-22deg); }

.header-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.55rem; }

.ghost-button, .primary-button, .secondary-button, .text-button, .icon-button {
  border: 0;
  border-radius: 10px;
  font-weight: 750;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}
.ghost-button {
  padding: .62rem .85rem;
  color: white;
  border: 1px solid rgba(255,255,255,.28);
  background: rgba(255,255,255,.08);
}
.ghost-button:hover, .ghost-button:focus-visible { background: rgba(255,255,255,.16); }
.primary-button {
  padding: .78rem 1rem;
  color: white;
  background: linear-gradient(135deg, var(--blue), #235e99);
  box-shadow: 0 8px 18px rgba(45,116,185,.22);
}
.secondary-button {
  padding: .78rem 1rem;
  color: var(--navy);
  border: 1px solid #c9d7e6;
  background: #f2f6fa;
}
.text-button { padding: .55rem 0; color: var(--blue); background: transparent; }
.icon-button {
  width: 40px;
  height: 40px;
  color: var(--ink);
  background: #eef3f8;
  font-size: 1.5rem;
}
.primary-button:hover, .secondary-button:hover, .text-button:hover,
.primary-button:focus-visible, .secondary-button:focus-visible, .text-button:focus-visible {
  transform: translateY(-1px);
}
button:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(57,166,184,.35);
  outline-offset: 2px;
}
button:disabled { cursor: not-allowed; opacity: .5; transform: none; }

main { width: min(1540px, calc(100% - 2rem)); margin: 1.4rem auto 3rem; }

.hero-panel {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 1.5rem;
  padding: clamp(1.5rem, 3vw, 2.5rem);
  border: 1px solid rgba(45,116,185,.12);
  border-radius: var(--radius-lg);
  background: linear-gradient(120deg, #ffffff, #f3f9fb);
  box-shadow: var(--shadow);
}
.eyebrow, .panel-kicker {
  margin: 0 0 .4rem;
  color: var(--teal);
  font-size: .73rem;
  font-weight: 900;
  letter-spacing: .12em;
}
h1, h2, h3 { line-height: 1.15; }
h1 { margin: 0; font-size: clamp(2rem, 4.3vw, 3.5rem); letter-spacing: -.045em; }
h2 { margin: 0; font-size: clamp(1.35rem, 2.2vw, 2rem); letter-spacing: -.025em; }
h3 { margin: 0; }
.hero-copy { max-width: 760px; margin: .8rem 0 0; color: var(--muted); font-size: 1.04rem; }
.objective-card {
  width: min(360px, 33%);
  min-width: 260px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 1.25rem;
  border-radius: 16px;
  color: white;
  background: linear-gradient(145deg, var(--navy), #24617d);
}
.objective-label { margin-bottom: .45rem; color: #aee2e8; font-size: .72rem; font-weight: 850; text-transform: uppercase; letter-spacing: .09em; }

.mode-tabs {
  display: flex;
  gap: .75rem;
  margin: 1.2rem 0 .8rem;
  overflow-x: auto;
  padding-bottom: .25rem;
}
.mode-tab {
  flex: 1 1 0;
  min-width: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .65rem;
  padding: .85rem 1rem;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255,255,255,.75);
  font-weight: 850;
}
.mode-tab.active { color: white; border-color: transparent; background: var(--navy); box-shadow: 0 9px 24px rgba(23,57,95,.18); }
.tab-number {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(23,57,95,.08);
  font-size: .78rem;
}
.mode-tab.active .tab-number { background: rgba(255,255,255,.17); }

.status-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr)) minmax(180px, 2fr);
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--line);
}
.status-metric, .progress-shell { background: white; }
.status-metric { padding: .7rem 1rem; }
.status-metric span { display: block; color: var(--muted); font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.status-metric strong { display: block; margin-top: .12rem; font-size: .95rem; white-space: nowrap; }
.progress-shell { position: relative; min-height: 58px; }
.progress-shell::after { content: "Guided progress"; position: absolute; left: 1rem; top: .65rem; z-index: 2; color: var(--muted); font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
html:lang(es) .progress-shell::after { content: "Progreso guiado"; }
.progress-fill { position: absolute; inset: 0 auto 0 0; width: 0; background: linear-gradient(90deg, rgba(57,166,184,.15), rgba(45,116,185,.22)); transition: width .35s ease; }

.mode-view { margin-top: 1rem; }
.lab-grid { display: grid; grid-template-columns: minmax(220px, .72fr) minmax(500px, 1.85fr) minmax(250px, .85fr); gap: 1rem; align-items: start; }
.mission-panel, .workbench-panel, .cell-panel, .case-list-panel, .case-main-panel, .mutation-controls, .mutation-results {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,.95);
  box-shadow: 0 12px 32px rgba(20,45,78,.07);
}
.mission-panel, .cell-panel, .case-list-panel, .mutation-controls { padding: 1.25rem; }
.workbench-panel, .case-main-panel, .mutation-results { padding: clamp(1.1rem, 2vw, 1.8rem); }
.mission-panel { position: sticky; top: 1rem; }
.mission-panel > p { color: var(--muted); }
.learning-target { margin: 1rem 0; padding: .95rem; border-left: 4px solid var(--cyan); border-radius: 0 10px 10px 0; background: #eef8f9; }
.learning-target span { color: var(--teal); font-size: .68rem; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; }
.learning-target p { margin: .3rem 0 0; font-size: .88rem; font-weight: 650; }
.stage-nav { display: grid; gap: .45rem; margin: 1rem 0; }
.stage-pill { display: flex; align-items: center; gap: .7rem; width: 100%; padding: .58rem .65rem; text-align: left; color: var(--muted); border: 1px solid transparent; border-radius: 9px; background: transparent; }
.stage-pill.active { color: var(--navy); border-color: #c9dcea; background: #eef6fb; }
.stage-pill.complete::before { content: "✓"; color: white; background: var(--green); }
.stage-pill::before { content: attr(data-number); display: grid; place-items: center; flex: 0 0 24px; height: 24px; border-radius: 50%; color: var(--navy); background: #e7edf4; font-size: .7rem; font-weight: 900; }
.button-row { display: flex; justify-content: flex-end; gap: .65rem; margin-top: 1rem; }
.mission-panel .button-row > * { flex: 1; }

.workbench-header { display: flex; align-items: start; justify-content: space-between; gap: 1rem; padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.direction-key { display: flex; gap: .8rem; padding: .55rem .7rem; border-radius: 9px; color: var(--muted); background: #f2f6f9; font-size: .75rem; }
.direction-key b { color: var(--navy); }
#guidedWorkspace { min-height: 430px; padding: 1.35rem 0 .4rem; }
.feedback-box { margin-top: 1rem; padding: .9rem 1rem; border-radius: 11px; border: 1px solid; font-size: .9rem; font-weight: 650; }
.feedback-box.neutral { color: #49647c; border-color: #cfdae6; background: #f3f7fa; }
.feedback-box.success { color: #235e43; border-color: #b9dfcc; background: #ebf7f0; }
.feedback-box.error { color: #8c3542; border-color: #edc1c6; background: #fff0f2; }
.feedback-box.hint { color: #7a5518; border-color: #efd6a8; background: #fff7e8; }

.sequence-order-list { display: grid; gap: .62rem; max-width: 760px; margin: 0 auto; }
.order-card { display: grid; grid-template-columns: 42px 1fr auto; align-items: center; gap: .85rem; padding: .8rem .9rem; border: 1px solid #d5e0ea; border-radius: 12px; background: white; box-shadow: 0 5px 15px rgba(20,45,78,.04); }
.order-card.dragging { opacity: .48; }
.order-number { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; color: white; background: var(--navy); font-weight: 900; }
.order-card strong { display: block; font-size: .92rem; }
.order-card span { color: var(--muted); font-size: .78rem; }
.order-controls { display: flex; gap: .35rem; }
.order-controls button { width: 32px; height: 32px; color: var(--navy); border: 1px solid #d8e2ec; border-radius: 8px; background: #f4f7fa; font-weight: 900; }

.molecule-stack { display: grid; gap: 1rem; }
.molecule-row { padding: 1rem; border: 1px solid #dce5ed; border-radius: 13px; background: #fbfcfe; }
.molecule-row-header { display: flex; justify-content: space-between; gap: .8rem; margin-bottom: .8rem; }
.molecule-row-header strong { color: var(--navy); }
.molecule-row-header span { color: var(--muted); font-size: .78rem; }
.base-sequence { display: flex; flex-wrap: wrap; align-items: center; gap: .36rem; }
.base-token, .base-slot {
  display: grid;
  place-items: center;
  width: 38px;
  height: 42px;
  border-radius: 9px;
  font-weight: 900;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.08);
}
.base-token { color: white; }
.base-token[data-base="A"] { background: var(--base-a); }
.base-token[data-base="T"] { background: var(--base-t); }
.base-token[data-base="U"] { background: var(--base-u); }
.base-token[data-base="C"] { background: var(--base-c); }
.base-token[data-base="G"] { background: var(--base-g); }
.base-token.changed { outline: 3px solid #172334; outline-offset: 2px; }
.base-slot { color: #76879a; border: 2px dashed #bdcbd9; background: #edf2f6; box-shadow: none; }
.base-slot.filled[data-base="A"] { background: var(--base-a); }
.base-slot.filled[data-base="T"] { background: var(--base-t); }
.base-slot.filled[data-base="U"] { background: var(--base-u); }
.base-slot.filled[data-base="C"] { background: var(--base-c); }
.base-slot.filled[data-base="G"] { background: var(--base-g); }
.base-slot.selected { border-style: solid; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(45,116,185,.16); }
.base-slot.filled { color: white; border: 0; }
.base-slot.correct { outline: 3px solid rgba(59,140,102,.28); }
.base-slot.incorrect { animation: shake .32s ease; outline: 3px solid rgba(185,75,88,.34); }
.sequence-spacer { width: 9px; }
.base-bank { display: flex; justify-content: center; gap: .6rem; margin-top: 1.1rem; padding: .8rem; border-radius: 12px; background: #eef3f7; }
.base-bank .base-token { cursor: grab; border: 0; }
.base-bank-label { margin: 0 0 .45rem; text-align: center; color: var(--muted); font-size: .76rem; font-weight: 750; }
.bond-lines { display: flex; flex-wrap: wrap; gap: .36rem; margin: -1rem 0; padding-left: 1rem; }
.bond-lines span { width: 38px; text-align: center; color: #8da0b3; font-size: .7rem; letter-spacing: -2px; }

.reading-frame-board { display: grid; gap: 1rem; }
.frame-options { display: grid; gap: .65rem; }
.frame-option { width: 100%; padding: .9rem; text-align: left; color: var(--ink); border: 1px solid #d8e2ea; border-radius: 11px; background: white; }
.frame-option:hover, .frame-option.selected { border-color: var(--blue); background: #eef6fb; }
.codon-line { display: flex; flex-wrap: wrap; gap: .65rem; margin-top: .5rem; }
.codon-chip { display: inline-flex; flex-direction: column; align-items: center; gap: .15rem; padding: .5rem .7rem; border: 1px solid #d9e2eb; border-radius: 9px; background: #f7f9fb; }
.codon-chip strong { letter-spacing: .12em; }
.codon-chip span { color: var(--muted); font-size: .66rem; }
.codon-chip.start { border-color: #8fcbb4; background: #eaf7f0; }
.codon-chip.stop { border-color: #e6b4ba; background: #fff0f1; }
.codon-chip.leftover { border-style: dashed; color: var(--red); }

.translation-board { display: grid; gap: .9rem; }
.translation-progress { display: flex; justify-content: space-between; gap: 1rem; align-items: center; padding: .7rem .85rem; border: 1px solid #d7e3ec; border-radius: 10px; background: #f2f6f9; }
.translation-progress strong { color: var(--navy); font-size: .82rem; }
.translation-progress span { color: var(--muted); font-size: .74rem; text-align: right; }
.translation-row { display: grid; grid-template-columns: 100px 1fr; gap: 1rem; align-items: start; padding: .85rem; border: 1px solid #dce4ec; border-radius: 12px; background: #fbfcfd; }
.translation-row.complete { border-color: #a9d7be; background: #eff8f3; }
.translation-row.incorrect { border-color: #dca8ae; background: #fff3f4; }
.translation-row.correct { border-color: #72b491; background: #eaf6ef; }
.codon-display { text-align: center; }
.codon-display strong { display: block; padding: .6rem; border-radius: 9px; color: white; background: var(--navy); letter-spacing: .12em; }
.codon-display span { color: var(--muted); font-size: .7rem; }
.trna-options { display: grid; grid-template-columns: repeat(2, minmax(150px, 1fr)); gap: .55rem; }
.trna-card { padding: .68rem .75rem; text-align: left; color: var(--ink); border: 1px solid #d8e2eb; border-radius: 9px; background: white; }
.trna-card:hover, .trna-card.selected { border-color: var(--purple); background: #f3eff9; }
.trna-card.selected.answer-correct { border-color: #3b8c66; background: #e1f3e9; box-shadow: 0 0 0 2px rgba(59,140,102,.14); }
.trna-card.selected.answer-incorrect { border-color: var(--red); background: #ffe9ec; box-shadow: 0 0 0 2px rgba(185,75,88,.12); }
.trna-card strong { display: block; color: var(--purple); font-size: .82rem; }
.trna-card span { display: block; color: var(--muted); font-size: .72rem; }
.translation-match-status { margin: .45rem 0 0; font-size: .72rem; font-weight: 850; }
.translation-match-status.correct { color: #2f7654; }
.translation-match-status.incorrect { color: var(--red); }
.protein-preview { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; min-height: 65px; padding: .85rem; border-radius: 12px; background: #edf4f7; }
.amino-bead { display: grid; place-items: center; min-width: 48px; height: 48px; padding: 0 .45rem; border-radius: 50% 42% 52% 45%; color: white; background: linear-gradient(145deg, var(--purple), #4f3b77); font-size: .67rem; font-weight: 850; box-shadow: inset -4px -5px 0 rgba(0,0,0,.11); }
.peptide-bond { width: 18px; height: 3px; background: #8796a8; }
.stop-marker { padding: .5rem .7rem; border-radius: 999px; color: var(--red); background: #ffe7ea; font-size: .75rem; font-weight: 900; }

.function-test { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.protein-machine { min-height: 230px; display: grid; place-items: center; padding: 1rem; border: 1px solid #dbe5ed; border-radius: 14px; background: linear-gradient(145deg, #f7fafc, #edf4f7); }
.folded-protein { position: relative; width: 170px; height: 140px; }
.folded-protein span { position: absolute; width: 55px; height: 55px; border-radius: 50% 42% 48% 55%; background: linear-gradient(145deg, var(--purple), #4d3974); box-shadow: inset -7px -8px 0 rgba(0,0,0,.12); animation: proteinFloat 3.8s ease-in-out infinite; }
.folded-protein span:nth-child(1) { left: 18px; top: 45px; }
.folded-protein span:nth-child(2) { left: 55px; top: 18px; animation-delay: -.8s; }
.folded-protein span:nth-child(3) { left: 93px; top: 46px; animation-delay: -1.5s; }
.folded-protein span:nth-child(4) { left: 61px; top: 78px; animation-delay: -2.1s; }
.function-readout { display: grid; gap: .7rem; }
.readout-line { display: flex; justify-content: space-between; gap: 1rem; padding: .72rem .8rem; border-bottom: 1px solid #dde5ec; }
.readout-line span { color: var(--muted); }
.readout-line strong { text-align: right; }
.function-readout label { display: grid; gap: .4rem; color: var(--navy); font-size: .82rem; font-weight: 800; }
.function-readout select, .function-readout textarea { width: 100%; padding: .72rem .78rem; color: var(--ink); border: 1px solid #cfdbe6; border-radius: 9px; background: white; font-weight: 500; }
.function-meter { height: 15px; overflow: hidden; border-radius: 999px; background: #e0e8ef; }
.function-meter > span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--amber), var(--green)); transition: width .8s ease; }

.cell-panel { position: sticky; top: 1rem; }
.cell-visual { padding: .7rem 0; }
.cell-membrane { position: relative; height: 310px; overflow: hidden; border: 4px solid rgba(45,116,185,.35); border-radius: 49% 51% 45% 55% / 55% 45% 53% 47%; background: radial-gradient(circle at 68% 25%, #f9ffff, #dceff2); box-shadow: inset 0 0 34px rgba(45,116,185,.14); }
.nucleus { position: absolute; left: 30px; top: 61px; width: 128px; height: 128px; display: grid; place-items: center; border: 5px solid rgba(114,86,165,.35); border-radius: 50%; background: rgba(114,86,165,.16); }
.nucleus-label, .cytoplasm-label { position: absolute; padding: .18rem .45rem; border-radius: 999px; color: var(--navy); background: rgba(255,255,255,.82); font-size: .65rem; font-weight: 850; }
.nucleus-label { bottom: 7px; }
.cytoplasm-label { right: 28px; bottom: 12px; }
.dna-mini { display: grid; gap: 5px; transform: rotate(-14deg); }
.dna-mini span { display: block; width: 52px; height: 5px; border-left: 5px solid var(--base-a); border-right: 5px solid var(--base-t); background: #fff; transform: skewX(-22deg); }
.nuclear-pore { position: absolute; left: 151px; top: 125px; width: 18px; height: 25px; border-radius: 50%; background: var(--navy); opacity: .55; }
.mrna-thread { position: absolute; left: 140px; top: 138px; width: 85px; height: 44px; border-top: 5px dashed var(--base-u); border-radius: 50%; opacity: .2; transition: opacity .35s ease, transform .35s ease; }
.ribosome { position: absolute; right: 30px; top: 132px; width: 80px; height: 58px; opacity: .3; transition: opacity .35s ease, transform .35s ease; }
.ribosome-top, .ribosome-bottom { position: absolute; left: 4px; width: 72px; border-radius: 50%; background: var(--cyan); box-shadow: inset -8px -6px 0 rgba(0,0,0,.09); }
.ribosome-top { top: 0; height: 34px; }
.ribosome-bottom { bottom: 0; height: 29px; }
.protein-chain { position: absolute; right: 45px; top: 188px; width: 55px; height: 70px; opacity: .15; background: radial-gradient(circle at 20% 20%, var(--purple) 0 7px, transparent 8px), radial-gradient(circle at 48% 38%, var(--amber) 0 7px, transparent 8px), radial-gradient(circle at 66% 64%, var(--green) 0 7px, transparent 8px), radial-gradient(circle at 30% 82%, var(--blue) 0 7px, transparent 8px); transition: opacity .35s ease; }
.organelle { position: absolute; width: 48px; height: 20px; border: 3px solid rgba(213,138,33,.35); border-radius: 50%; transform: rotate(-18deg); }
.organelle::after { content: ""; position: absolute; inset: 5px 7px; border-top: 2px wavy var(--amber); }
.organelle-one { right: 27px; top: 45px; }
.organelle-two { left: 42px; bottom: 34px; transform: rotate(22deg); }
.organelle-three { right: 108px; bottom: 32px; transform: rotate(-2deg); }
.cell-visual.stage-transcription .mrna-thread, .cell-visual.stage-frame .mrna-thread, .cell-visual.stage-translation .mrna-thread, .cell-visual.stage-function .mrna-thread { opacity: 1; }
.cell-visual.stage-frame .mrna-thread, .cell-visual.stage-translation .mrna-thread, .cell-visual.stage-function .mrna-thread { transform: translateX(34px); }
.cell-visual.stage-translation .ribosome, .cell-visual.stage-function .ribosome { opacity: 1; transform: scale(1.05); }
.cell-visual.stage-function .protein-chain { opacity: 1; }
.cell-caption { color: var(--muted); font-size: .8rem; }
.legend-card { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.legend-card h3 { font-size: .8rem; }
.base-key-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .45rem; margin-top: .6rem; color: var(--muted); font-size: .7rem; }
.base-key-grid span { display: flex; align-items: center; gap: .4rem; }
.base-dot { width: 12px; height: 12px; border-radius: 4px; }
.base-a { background: var(--base-a); } .base-t { background: var(--base-t); } .base-u { background: var(--base-u); } .base-c { background: var(--base-c); } .base-g { background: var(--base-g); }

.case-layout { display: grid; grid-template-columns: minmax(245px, .7fr) minmax(620px, 2fr); gap: 1rem; align-items: start; }
.case-list-panel { position: sticky; top: 1rem; }
.case-list-panel > p { color: var(--muted); }
.case-list { display: grid; gap: .6rem; margin-top: 1rem; }
.case-list-button { width: 100%; padding: .78rem; text-align: left; color: var(--ink); border: 1px solid #dbe3eb; border-radius: 11px; background: #fbfcfd; }
.case-list-button:hover, .case-list-button.active { border-color: var(--blue); background: #eef6fb; }
.case-list-button.solved { border-left: 5px solid var(--green); }
.case-list-button strong, .case-list-button span { display: block; }
.case-list-button span { margin-top: .18rem; color: var(--muted); font-size: .72rem; }
.case-header { display: flex; align-items: start; justify-content: space-between; gap: 1rem; padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.case-header p { max-width: 760px; margin: .5rem 0 0; color: var(--muted); }
.case-code { color: var(--teal); font-size: .72rem; font-weight: 900; letter-spacing: .1em; }
.case-status { padding: .48rem .7rem; border-radius: 999px; color: #7a5518; background: #fff3da; font-size: .74rem; font-weight: 900; white-space: nowrap; }
.case-status.solved { color: #235e43; background: #e6f5ed; }
.comparison-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1.2rem; }
.sequence-card { overflow: hidden; border: 1px solid #dce5ed; border-radius: 15px; background: #fbfcfd; }
.sequence-card-header { display: flex; align-items: center; justify-content: space-between; gap: .8rem; padding: .75rem .9rem; border-bottom: 1px solid #dce5ed; }
.reference-card .sequence-card-header { background: #ebf7f0; }
.sample-card .sequence-card-header { background: #fff4e7; }
.sequence-card-header span { color: var(--muted); font-size: .67rem; font-weight: 900; letter-spacing: .08em; }
.sequence-card-header strong { font-size: .82rem; }
.evidence-stack { padding: .9rem; }
.evidence-row { padding: .72rem 0; border-bottom: 1px solid #e3e9ef; }
.evidence-row:last-child { border-bottom: 0; }
.evidence-row-label { display: flex; justify-content: space-between; gap: .7rem; margin-bottom: .35rem; color: var(--muted); font-size: .69rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.sequence-text { overflow-wrap: anywhere; font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; font-weight: 800; letter-spacing: .07em; }
.sequence-text .changed-char { padding: .08rem .14rem; border-radius: 4px; color: white; background: var(--red); }
.protein-text { color: var(--purple); letter-spacing: .02em; }
.function-badge { display: inline-flex; align-items: center; gap: .4rem; padding: .35rem .58rem; border-radius: 999px; font-size: .72rem; font-weight: 850; }
.function-badge.normal { color: #235e43; background: #e6f5ed; }
.function-badge.reduced { color: #7b5518; background: #fff2d7; }
.function-badge.failed { color: #8b3541; background: #ffe7ea; }
.diagnosis-panel { margin-top: 1rem; padding: 1rem; border: 1px solid #dbe4ec; border-radius: 14px; background: #f8fafc; }
.diagnosis-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
label { display: grid; gap: .42rem; color: var(--navy); font-size: .82rem; font-weight: 800; }
select, input[type="range"], textarea { width: 100%; }
select, textarea { padding: .7rem .75rem; color: var(--ink); border: 1px solid #cbd7e3; border-radius: 9px; background: white; }
textarea { resize: vertical; min-height: 105px; font-weight: 500; }
.cer-label { margin-top: 1rem; }

.mutation-layout { display: grid; grid-template-columns: minmax(245px, .66fr) minmax(620px, 2fr); gap: 1rem; align-items: start; }
.mutation-controls { position: sticky; top: 1rem; }
.mutation-controls > p { color: var(--muted); }
.mutation-controls label { margin-top: 1rem; }
.mutation-controls output { justify-self: end; min-width: 34px; padding: .15rem .42rem; border-radius: 7px; color: white; background: var(--navy); text-align: center; }
.mutation-summary { display: flex; align-items: center; gap: 1rem; padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.summary-icon { display: grid; place-items: center; flex: 0 0 62px; height: 62px; border-radius: 18px; color: white; background: linear-gradient(145deg, var(--navy), var(--blue)); font-size: .74rem; font-weight: 900; letter-spacing: .08em; }
.mutation-summary p { margin: .25rem 0 0; color: var(--muted); }
.analysis-dashboard { display: grid; grid-template-columns: repeat(4, 1fr); gap: .75rem; margin-top: 1rem; }
.analysis-metric { padding: .85rem; border: 1px solid #dce5ed; border-radius: 11px; background: #f8fafc; }
.analysis-metric span { display: block; color: var(--muted); font-size: .67rem; font-weight: 900; text-transform: uppercase; letter-spacing: .07em; }
.analysis-metric strong { display: block; margin-top: .25rem; font-size: .9rem; }

.modal-dialog { width: min(1050px, calc(100% - 2rem)); max-height: calc(100vh - 2rem); padding: 1.3rem; border: 0; border-radius: 18px; box-shadow: 0 28px 85px rgba(16,43,73,.3); }
.modal-dialog::backdrop { background: rgba(15,31,49,.58); backdrop-filter: blur(3px); }
.dialog-header { display: flex; align-items: start; justify-content: space-between; gap: 1rem; padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.dialog-actions { display: flex; justify-content: flex-end; margin-top: 1rem; }
.codon-chart-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .65rem; margin-top: 1rem; }
.codon-family { padding: .7rem; border: 1px solid #dce5ed; border-radius: 11px; background: #f8fafc; }
.codon-family h3 { margin-bottom: .45rem; color: var(--navy); font-size: .83rem; }
.codon-family-list { display: grid; grid-template-columns: 1fr 1fr; gap: .25rem .6rem; font-family: "SFMono-Regular", Consolas, monospace; font-size: .72rem; }
.codon-family-list b { color: var(--purple); }
.teacher-notes-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 1rem 0; }
.teacher-notes-grid section { padding: 1rem; border: 1px solid #dce5ed; border-radius: 12px; background: #f8fafc; }
.teacher-notes-grid p { margin: .4rem 0 0; color: var(--muted); font-size: .88rem; }
.reset-progress-panel { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1rem; padding: 1rem; border: 1px solid #e3c2c6; border-radius: 12px; background: #fff6f7; }
.reset-progress-panel h3 { color: var(--red); }
.reset-progress-panel p { margin: .3rem 0 0; color: var(--muted); font-size: .84rem; }
.reset-progress-button { flex: 0 0 auto; padding: .72rem .9rem; color: white; border: 0; border-radius: 9px; background: var(--red); font-weight: 800; }
.reset-progress-button:hover, .reset-progress-button:focus-visible { background: #983c48; }

.science-note { margin-top: 1rem; padding: .8rem .9rem; border-left: 4px solid var(--cyan); border-radius: 0 10px 10px 0; color: var(--muted); background: #eef8f9; font-size: .84rem; }
.muted-copy, .sr-note { color: var(--muted); font-size: .8rem; }
.sr-note { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.site-footer { display: flex; justify-content: space-between; gap: 2rem; width: min(1540px, calc(100% - 2rem)); margin: 0 auto 2rem; padding: 1.1rem 1.3rem; color: #cdd9e5; border-radius: 14px; background: var(--navy-dark); }
.site-footer div { display: flex; flex-direction: column; }
.site-footer p { max-width: 760px; margin: 0; text-align: right; font-size: .78rem; }

@keyframes shake { 25% { transform: translateX(-4px); } 50% { transform: translateX(4px); } 75% { transform: translateX(-2px); } }
@keyframes proteinFloat { 0%,100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-5px) rotate(5deg); } }

@media (max-width: 1160px) {
  .lab-grid { grid-template-columns: 240px 1fr; }
  .cell-panel { position: static; grid-column: 1 / -1; display: grid; grid-template-columns: 320px 1fr; align-items: center; gap: 1rem; }
  .cell-visual { max-width: 320px; }
  .case-layout, .mutation-layout { grid-template-columns: 240px 1fr; }
  .analysis-dashboard { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 820px) {
  .site-header { align-items: flex-start; flex-direction: column; }
  .header-actions { justify-content: flex-start; }
  .hero-panel { flex-direction: column; }
  .objective-card { width: 100%; min-width: 0; }
  .status-strip { grid-template-columns: 1fr 1fr; }
  .progress-shell { grid-column: 1 / -1; }
  .lab-grid, .case-layout, .mutation-layout { grid-template-columns: 1fr; }
  .mission-panel, .case-list-panel, .mutation-controls { position: static; }
  .cell-panel { display: block; }
  .cell-visual { margin: auto; }
  .comparison-grid, .function-test, .diagnosis-grid { grid-template-columns: 1fr; }
  .codon-chart-grid { grid-template-columns: 1fr 1fr; }
  .teacher-notes-grid { grid-template-columns: 1fr; }
  .reset-progress-panel { align-items: stretch; flex-direction: column; }
  .reset-progress-button { width: 100%; }
  .site-footer { flex-direction: column; }
  .site-footer p { text-align: left; }
}

@media (max-width: 560px) {
  main { width: min(100% - 1rem, 1540px); margin-top: .6rem; }
  .site-header { padding: .8rem; }
  .brand-tagline { display: none; }
  .header-actions { width: 100%; }
  .ghost-button { flex: 1; padding: .55rem .4rem; font-size: .75rem; }
  .hero-panel { padding: 1.15rem; }
  .mode-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .35rem; overflow: visible; }
  .mode-tab { min-width: 0; padding: .65rem .25rem; gap: .3rem; font-size: .68rem; }
  .tab-number { width: 21px; height: 21px; font-size: .64rem; }
  .status-strip { grid-template-columns: 1fr 1fr; }
  .status-metric { padding: .55rem .7rem; }
  .lab-grid, .case-layout, .mutation-layout { gap: .65rem; }
  .mission-panel, .workbench-panel, .cell-panel, .case-list-panel, .case-main-panel, .mutation-controls, .mutation-results { border-radius: 15px; }
  .workbench-header, .case-header { flex-direction: column; }
  #guidedWorkspace { min-height: 360px; }
  .order-card { grid-template-columns: 34px 1fr; }
  .order-controls { grid-column: 2; }
  .base-token, .base-slot { width: 31px; height: 36px; font-size: .78rem; }
  .bond-lines span { width: 31px; }
  .translation-row { grid-template-columns: 1fr; }
  .translation-progress { align-items: flex-start; flex-direction: column; gap: .2rem; }
  .translation-progress span { text-align: left; }
  .trna-options { grid-template-columns: 1fr; }
  .analysis-dashboard { grid-template-columns: 1fr; }
  .codon-chart-grid { grid-template-columns: 1fr; }
  .stacked-mobile { flex-direction: column; }
}

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