:root {
  --void: #0b1015;
  --panel: #121a22;
  --panel-2: #16202a;
  --line: #24313d;
  --bone: #e8e2d4;
  --bone-dim: #9aa5ae;
  --amber: #d9a441;
  --amber-bright: #f0be5c;
  --artery: #c8544e;
  --vein: #5b7fa8;
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "Inter", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--sans);
  background: var(--void);
  color: var(--bone);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* On desktop the layout is pinned to the viewport so the figure has a definite
   height to scale against; the panel scrolls on its own. Narrow screens stack
   and scroll normally instead. */
@media (min-width: 901px) {
  body { height: 100vh; overflow: hidden; }
}

/* Masthead */

.masthead {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: 26px 34px 20px;
  border-bottom: 1px solid var(--line);
}

.masthead h1 {
  font-family: var(--serif);
  font-size: 40px;
  font-weight: 600;
  letter-spacing: 0.06em;
  line-height: 1;
}

.masthead h1::first-letter { color: var(--amber); }

.masthead-title p {
  font-family: var(--serif);
  font-style: italic;
  font-size: 17px;
  color: var(--bone-dim);
  margin-top: 4px;
}

.quiz-toggle {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--amber);
  background: transparent;
  border: 1px solid rgba(217, 164, 65, 0.45);
  border-radius: 3px;
  padding: 10px 18px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.quiz-toggle:hover { background: rgba(217, 164, 65, 0.12); color: var(--amber-bright); }

.quiz-toggle.active {
  background: var(--amber);
  border-color: var(--amber);
  color: #1a1205;
}

/* System tabs */

.systems {
  display: flex;
  gap: 4px;
  padding: 14px 34px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
}

.system-tab {
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--bone-dim);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 8px 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}

.system-tab:hover { color: var(--bone); }

.system-tab[aria-selected="true"] {
  color: var(--amber-bright);
  border-bottom-color: var(--amber);
}

/* Stage */

.stage {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 0;
  min-height: 0;
}

.figure-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  min-height: 0;
  overflow: hidden;
}

#figure {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: block;
}

.silhouette-part {
  fill: #131b23;
  stroke: #263340;
  stroke-width: 1.5;
}

/* Structures */

.structure {
  fill: var(--bone);
  fill-rule: evenodd;
  fill-opacity: 0.82;
  stroke: #0b1015;
  stroke-width: 1;
  cursor: pointer;
  transition: fill-opacity 0.15s, fill 0.15s;
}

.structure.stroked {
  fill: none;
  stroke: var(--bone);
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-opacity: 0.85;
}

.structure.artery { stroke: var(--artery); }
.structure.vein { stroke: var(--vein); }

/* Each system carries its own tint, roughly following the convention of a
   printed anatomical plate. */
.sys-skeletal { fill: var(--bone); }
.sys-muscular { fill: #bb5a50; }
.sys-circulatory { fill: #c8544e; }
.sys-respiratory { fill: #b98a9c; }
.sys-digestive { fill: #c3a25f; }
.sys-nervous { fill: #ddd08f; }

.structure:hover,
.structure.active {
  fill: var(--amber) !important;
  fill-opacity: 1;
}

.structure.stroked:hover,
.structure.stroked.active {
  stroke: var(--amber-bright);
  stroke-opacity: 1;
}

.structure.correct { fill: #5fb87a !important; fill-opacity: 1; }
.structure.stroked.correct { stroke: #5fb87a; stroke-opacity: 1; }
.structure.wrong { fill: #d1584f !important; fill-opacity: 1; }
.structure.stroked.wrong { stroke: #d1584f; stroke-opacity: 1; }

/* Labels */

.label-line { stroke: rgba(217, 164, 65, 0.5); stroke-width: 1; }

.label-text {
  font-family: var(--sans);
  font-size: 11px;
  fill: var(--amber-bright);
  letter-spacing: 0.04em;
  pointer-events: none;
}

/* Panel */

.panel {
  border-left: 1px solid var(--line);
  background: var(--panel);
  overflow-y: auto;
  min-height: 0;
}

.panel-inner { padding: 28px 26px 40px; }

.panel-kicker {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 12px;
}

.panel h2 {
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 600;
  line-height: 1.1;
  margin-bottom: 4px;
}

.panel .latin {
  font-family: var(--serif);
  font-style: italic;
  font-size: 17px;
  color: var(--bone-dim);
  margin-bottom: 18px;
}

.panel p.body {
  font-size: 15px;
  line-height: 1.68;
  color: #c3ccd4;
  margin-bottom: 16px;
}

.panel .hint {
  font-size: 14px;
  line-height: 1.6;
  color: var(--bone-dim);
}

.panel ul {
  list-style: none;
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.panel li {
  padding: 7px 0;
  font-size: 14px;
  color: var(--bone-dim);
  cursor: pointer;
  transition: color 0.12s;
}

.panel li:hover { color: var(--amber-bright); }

/* Quiz */

.score {
  display: flex;
  gap: 22px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.score div span {
  display: block;
  font-family: var(--serif);
  font-size: 30px;
  color: var(--amber-bright);
  line-height: 1;
}

.score div small {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--bone-dim);
}

.prompt {
  font-family: var(--serif);
  font-size: 15px;
  font-style: italic;
  color: var(--bone-dim);
  margin-bottom: 6px;
}

.feedback { font-size: 14.5px; line-height: 1.6; margin-top: 14px; }
.feedback.good { color: #7cc994; }
.feedback.bad { color: #e08a85; }

.foot {
  border-top: 1px solid var(--line);
  padding: 16px 34px 22px;
  font-size: 12.5px;
  color: #6d7883;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.foot a { color: var(--amber); text-decoration: none; }
.foot a:hover { text-decoration: underline; }

.disclaimer { font-style: italic; }

@media (max-width: 900px) {
  .stage { grid-template-columns: 1fr; }
  .panel { border-left: none; border-top: 1px solid var(--line); }
  #figure { height: 58vh; }
  .masthead { padding: 20px 20px 16px; }
  .systems { padding: 12px 20px; }
  .foot { flex-direction: column; padding: 16px 20px 20px; }
}

/* Detail-view nav */

.details {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 34px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.detail-hint {
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #6d7883;
  margin-right: 2px;
  white-space: nowrap;
}

.detail-chip {
  font: inherit;
  font-size: 13px;
  color: var(--bone-dim);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.detail-chip:hover {
  color: var(--amber-bright);
  border-color: rgba(217, 164, 65, 0.45);
}

.detail-chip[aria-pressed="true"] {
  color: #1a1205;
  background: var(--amber);
  border-color: var(--amber);
}

.detail-chip.back {
  color: var(--amber);
  border-color: rgba(217, 164, 65, 0.45);
  margin-right: 6px;
}

@media (max-width: 900px) {
  .details { padding: 10px 20px; }
}

/* Blood oxygenation and heart-specific strokes */

.structure.deoxy { fill: #4d76a6; }
.structure.stroked.deoxy { fill: none; stroke: var(--vein); }

.structure.stroked.wide { stroke-width: 7; }

.structure.stroked.valve {
  stroke: var(--bone);
  stroke-width: 5;
  stroke-linecap: butt;
  stroke-dasharray: 5 3;
}
