:root {
  --bg: #f3eee6;
  --paper: rgba(255, 251, 246, 0.94);
  --ink: #1f2721;
  --muted: #5b584f;
  --line: rgba(31, 39, 33, 0.12);
  --warm: #b6642d;
  --cool: #275f78;
  --sage: #2f705d;
  --deep: #4a385f;
  --good: #23664b;
  --bad: #9e382d;
  --shadow: 0 26px 58px rgba(60, 46, 26, 0.13);
  --radius-xl: 32px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(182, 100, 45, 0.16), transparent 28%),
    radial-gradient(circle at bottom right, rgba(39, 95, 120, 0.12), transparent 24%),
    linear-gradient(180deg, #fbf8f3 0%, #f4ede4 54%, #e9dfd2 100%);
}

.page-aura {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.38;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.44) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.42) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: radial-gradient(circle at center, black 36%, transparent 82%);
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 68px;
}

.hero,
.panel {
  position: relative;
  overflow: hidden;
  background: var(--paper);
  border: 1px solid rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
  padding: 38px 36px 34px;
  border-radius: 36px;
}

.panel {
  margin-top: 24px;
  padding: 26px;
  border-radius: 30px;
}

.floating-download {
  display: grid;
  justify-items: center;
  align-items: center;
  gap: 10px;
  margin: 24px auto 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.floating-download .feedback-line {
  margin: 0;
  min-height: 1.5em;
  text-align: center;
}

.floating-download:empty {
  display: none;
}

@media (max-width: 720px) {
  .floating-download .feedback-line {
    white-space: normal;
  }
}

.hero::after,
.panel::after {
  content: "";
  position: absolute;
  right: -100px;
  bottom: -120px;
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, rgba(39, 95, 120, 0.12), transparent 72%);
}

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

h1 {
  margin-bottom: 14px;
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 0.96;
  letter-spacing: -0.05em;
}

h2 {
  margin: 6px 0 0;
  font-size: clamp(1.5rem, 2.7vw, 2.2rem);
}

h3 {
  margin: 0;
  font-size: 1.08rem;
}

.eyebrow,
.step,
.mini-kicker,
.field-label,
.hero-label,
.bank-label {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--muted);
}

.intro-list,
.dual-points,
.panel-copy,
.feedback-line,
.reference-card figcaption {
  color: #4d4a43;
  line-height: 1.65;
}

.intro-list {
  margin: 0;
  padding-left: 22px;
}

.intro-list li + li,
.dual-points li + li {
  margin-top: 8px;
}

.hero-panel,
.dual-card,
.truth-card,
.field-card,
.reference-card,
.sim-card {
  min-width: 0;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
}

.hero-panel {
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 18px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.92), rgba(249, 244, 236, 0.86));
}

.hero-actions,
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.button {
  appearance: none;
  border: none;
  border-radius: 999px;
  padding: 12px 18px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:disabled {
  background: rgba(120, 125, 128, 0.18);
  color: rgba(31, 39, 33, 0.42);
  border-color: rgba(31, 39, 33, 0.08);
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

.button:focus-visible,
select:focus-visible,
textarea:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(39, 95, 120, 0.26);
  outline-offset: 2px;
}

.button.primary {
  background: linear-gradient(135deg, var(--warm), #ca7f3a);
  color: #fff;
  box-shadow: 0 14px 28px rgba(182, 100, 45, 0.24);
}

.button.ghost {
  background: linear-gradient(135deg, var(--warm), #ca7f3a);
  color: #fff;
  box-shadow: 0 14px 28px rgba(182, 100, 45, 0.24);
}

.hero-copy {
  max-width: 960px;
  padding: 12px 12px 8px;
}

.dual-coding-panel {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 0.92fr);
  gap: 16px;
  padding: 18px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(182, 100, 45, 0.11), transparent 40%),
    rgba(255, 255, 255, 0.72);
}

.dual-card {
  padding: 18px;
}

.dual-link {
  display: grid;
  place-items: center;
}

.dual-link span {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  padding: 10px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--line);
  font-weight: 800;
  color: var(--muted);
}

.dual-diagram {
  width: 100%;
  height: auto;
  margin-top: 10px;
}

.diagram-lines {
  stroke: rgba(42, 53, 45, 0.28);
  stroke-width: 3;
  fill: none;
  stroke-linecap: round;
}

.diagram-node rect {
  stroke: rgba(255, 255, 255, 0.5);
  stroke-width: 1.2;
}

.diagram-node text {
  fill: #fff;
  font-size: 16px;
  font-weight: 800;
  text-anchor: middle;
}

.diagram-node-law text {
  font-size: 14px;
}

.diagram-node-root rect {
  fill: url(#rootFill3c);
}

.diagram-node-law rect {
  fill: url(#lawFill3c);
}

.diagram-node-mini rect {
  fill: url(#miniFill3c);
}

.speech-bubble-row {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-top: 12px;
  padding: 0 10px 2px;
}

.speech-bubble {
  position: relative;
  max-width: 220px;
  padding: 12px 14px;
  border-radius: 18px;
  border: 1px solid rgba(47, 112, 93, 0.22);
  background: linear-gradient(180deg, rgba(229, 244, 238, 0.98), rgba(205, 233, 223, 0.98));
  color: #1f4f40;
  font-size: 0.92rem;
  line-height: 1.45;
  box-shadow: 0 12px 24px rgba(47, 112, 93, 0.14);
}

.speech-bubble::after {
  content: "";
  position: absolute;
  top: -10px;
  width: 18px;
  height: 18px;
  background: rgba(229, 244, 238, 0.98);
  border-top: 1px solid rgba(47, 112, 93, 0.22);
  border-left: 1px solid rgba(47, 112, 93, 0.22);
  transform: rotate(45deg);
}

.speech-bubble-left::after {
  left: 26px;
}

.speech-bubble-right::after {
  right: 26px;
}

.panel-warm {
  background: linear-gradient(180deg, rgba(255, 240, 227, 0.92), rgba(255, 251, 246, 0.94));
}

.panel-cool {
  background: linear-gradient(180deg, rgba(229, 240, 245, 0.92), rgba(255, 251, 246, 0.94));
}

.panel-sage {
  background: linear-gradient(180deg, rgba(229, 244, 238, 0.92), rgba(255, 251, 246, 0.94));
}

.panel-deep {
  background: linear-gradient(180deg, rgba(237, 230, 243, 0.92), rgba(255, 251, 246, 0.94));
}

.panel-cool > .panel-copy,
.panel-cool > .intro-list.panel-copy {
  margin-bottom: 20px;
}

.panel-cool > .sim-card,
.panel-cool > .truth-card,
.panel-cool > .question-grid,
.panel-cool > .subsection,
.panel-cool > .feedback-line {
  margin-top: 24px;
}

.panel-cool .question-grid .field-card textarea {
  min-height: 112px;
}

.panel-cool .subsection-head .button-row {
  padding-top: 6px;
}

.panel-heading,
.sim-head,
.table-head,
.subsection-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
}

.table-head-inline {
  align-items: center;
}

.question-grid,
.reference-grid,
.sim-grid {
  display: grid;
  gap: 16px;
}

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

.question-grid-single {
  grid-template-columns: 1fr;
}

.question-grid-padded {
  margin-top: 18px;
}

.question-grid.compact {
  margin-top: 14px;
}

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

.distribution-stack {
  display: grid;
  gap: 18px;
}

.distribution-card {
  width: 100%;
}

.field-card,
.truth-card,
.reference-card,
.sim-card {
  padding: 18px;
}

.field-card {
  display: grid;
  gap: 10px;
}

.field-card-wide {
  width: 100%;
  padding: 22px;
}

select,
textarea,
input {
  width: 100%;
  border-radius: 16px;
  border: 1px solid rgba(31, 39, 33, 0.16);
  padding: 12px 14px;
  font: inherit;
  background: #fff;
}

.sim-frame {
  display: block;
  width: 100%;
  min-height: 940px;
  height: 940px;
  margin-top: 14px;
  border: 1px solid rgba(39, 95, 120, 0.14);
  border-radius: 22px;
  background: #fff;
  overflow: hidden;
}

.sim-link {
  color: var(--cool);
  font-weight: 800;
  text-decoration: none;
}

.sim-link:hover,
.sim-link:focus-visible {
  text-decoration: underline;
}

.truth-card {
  margin-top: 18px;
}

.truth-table-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.truth-table-tools.is-inline {
  justify-content: flex-end;
}

.truth-table-status {
  margin: 0;
  min-height: 1.5em;
  font-weight: 700;
}

.truth-card table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  font-size: 0.96rem;
}

.truth-card th,
.truth-card td {
  border: 1px solid rgba(31, 39, 33, 0.14);
  padding: 8px;
  text-align: center;
}

.truth-card th {
  background: rgba(245, 239, 231, 0.9);
}

.truth-card input {
  min-width: 40px;
  text-align: center;
  padding: 8px 6px;
  border-radius: 12px;
}

.truth-card input.is-correct {
  border-color: rgba(35, 102, 75, 0.64);
  background: rgba(35, 102, 75, 0.14);
  color: #184834;
}

.truth-card input.is-incorrect {
  border-color: rgba(158, 56, 45, 0.62);
  background: rgba(158, 56, 45, 0.12);
  color: #7b281f;
}

.subsection {
  margin-top: 18px;
}

.reference-card img {
  width: 100%;
  height: auto;
  border-radius: 18px;
  border: 1px solid rgba(31, 39, 33, 0.1);
  background: #fff;
}

.feedback-line {
  min-height: 1.5em;
  margin: 14px 0 0;
}

.feedback-line.is-good {
  color: var(--good);
  font-weight: 700;
}

.feedback-line.is-bad {
  color: var(--bad);
  font-weight: 700;
}

@media (max-width: 900px) {
  .hero,
  .dual-coding-panel,
  .question-grid,
  .reference-grid,
  .sim-grid {
    grid-template-columns: 1fr;
  }

  .dual-link {
    display: none;
  }

  .speech-bubble-row {
    flex-direction: column;
    align-items: stretch;
  }

  .speech-bubble {
    max-width: none;
  }
}

@media (max-width: 720px) {
  .shell {
    width: min(100% - 20px, 1180px);
    padding-top: 18px;
  }

  .panel,
  .hero {
    padding: 20px;
    border-radius: 24px;
  }

  .sim-frame {
    min-height: 820px;
    height: 820px;
  }
}
