:root {
  --bg: #f3eee6;
  --paper: rgba(255, 251, 246, 0.94);
  --ink: #1f2721;
  --muted: #5b584f;
  --line: rgba(31, 39, 33, 0.12);
  --warm: #b6642d;
  --warm-strong: #ef7f2d;
  --sage: #456f41;
  --sage-strong: #6f9244;
  --cool: #355b79;
  --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(69, 111, 65, 0.14), transparent 28%),
    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;
  gap: 24px;
  padding: 38px 36px 34px;
  border-radius: 36px;
}

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

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

.panel-warm::before,
.panel-sage::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 8px;
}

.panel-warm::before {
  background: linear-gradient(180deg, var(--warm-strong), var(--warm));
}

.panel-sage::before {
  background: linear-gradient(180deg, var(--sage-strong), var(--sage));
}

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 {
  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 {
  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-copy {
  max-width: 960px;
  padding: 12px 12px 8px;
}

.dual-coding-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) auto minmax(0, 0.9fr);
  gap: 16px;
  padding: 18px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.56);
}

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

.dual-card {
  padding: 18px;
}

.visual-card {
  background:
    linear-gradient(160deg, rgba(255, 247, 240, 0.96), rgba(245, 250, 242, 0.9));
}

.verbal-card {
  background:
    linear-gradient(160deg, rgba(247, 250, 252, 0.96), rgba(255, 250, 244, 0.9));
}

.dual-link {
  align-self: center;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.dual-diagram {
  width: 100%;
  height: auto;
  display: block;
}

.diagram-frame rect {
  fill: rgba(255, 255, 255, 0.7);
  stroke: rgba(31, 39, 33, 0.1);
}

.diagram-title {
  font-size: 28px;
  font-weight: 800;
  fill: #9f341d;
  text-anchor: start !important;
}

.diagram-title-center {
  text-anchor: middle !important;
}

.diagram-wire line {
  stroke: #1f2721;
  stroke-width: 4;
  stroke-linecap: round;
}

.carry-wire line {
  stroke: #355b79;
}

.diagram-node rect {
  stroke: rgba(31, 39, 33, 0.16);
  stroke-width: 1.5;
}

.diagram-node text,
.diagram-copy text,
.diagram-note text {
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  text-anchor: middle;
}

.half-node rect {
  fill: url(#halfFill3e);
}

.full-node rect {
  fill: url(#fullFill3e);
}

.full-node .carry-box {
  fill: url(#carryFill3e);
}

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

.diagram-labels text {
  fill: #6c2717;
  font-size: 18px;
  font-weight: 800;
}

.diagram-output-label {
  text-anchor: start !important;
}

.diagram-label-bg {
  fill: rgba(255, 251, 246, 0.96);
}

.diagram-note rect {
  fill: rgba(239, 127, 45, 0.16);
  stroke: rgba(182, 100, 45, 0.2);
}

.diagram-note-cool rect {
  fill: rgba(69, 111, 65, 0.16);
  stroke: rgba(69, 111, 65, 0.2);
}

.diagram-note text {
  fill: #3c4039;
  font-size: 15px;
  font-weight: 700;
}

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

.panel-copy {
  margin-top: 14px;
}

.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;
}

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

.button:focus-visible,
select:focus-visible,
textarea:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(53, 91, 121, 0.26);
  outline-offset: 2px;
}

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

.sim-card,
.truth-card,
.question-grid {
  margin-top: 18px;
}

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

.sim-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.sim-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(53, 91, 121, 0.1);
  color: var(--cool);
  text-decoration: none;
  font-weight: 800;
}

.sim-frame {
  width: 100%;
  min-height: 670px;
  border: 0;
  border-radius: 20px;
  background: #d8e7f2;
}

.sim-frame-workspace {
  min-height: 940px;
}

.truth-card {
  background:
    linear-gradient(180deg, rgba(255, 252, 248, 0.96), rgba(248, 244, 238, 0.92));
}

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

.truth-table-tools {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

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

.truth-table-status.is-good,
.feedback-line.is-good {
  color: var(--good);
}

.truth-table-status.is-bad,
.feedback-line.is-bad {
  color: var(--bad);
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

th,
td {
  border: 1px solid rgba(31, 39, 33, 0.1);
  padding: 10px;
  text-align: center;
}

th {
  background: var(--warm-strong);
  color: #fff;
  font-weight: 800;
}

td.fixed {
  background: #f6ede3;
  font-weight: 700;
}

td input {
  width: 100%;
  min-width: 34px;
  border: 1px solid rgba(31, 39, 33, 0.16);
  border-radius: 10px;
  padding: 8px 6px;
  text-align: center;
  font: inherit;
  font-weight: 800;
  background: #fffdfa;
}

td input.is-correct {
  background: #dff2e9;
  border-color: rgba(35, 102, 75, 0.32);
  color: #184834;
}

td input.is-incorrect {
  background: #f8e1de;
  border-color: rgba(158, 56, 45, 0.28);
  color: #7b281f;
}

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

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

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

.field-card-wide {
  min-height: 180px;
}

textarea,
select,
input {
  font: inherit;
}

textarea,
select {
  width: 100%;
  border: 1px solid rgba(31, 39, 33, 0.16);
  border-radius: 16px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
}

textarea {
  min-height: 130px;
  resize: vertical;
  line-height: 1.55;
}

.feedback-line {
  margin: 16px 2px 0;
  min-height: 1.5em;
  font-weight: 700;
}

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

.floating-download .feedback-line {
  margin: 0;
  text-align: center;
}

code {
  padding: 0.12em 0.32em;
  border-radius: 0.45em;
  background: rgba(53, 91, 121, 0.08);
  font-size: 0.95em;
}

@media (max-width: 980px) {
  .dual-coding-panel {
    grid-template-columns: 1fr;
  }

  .dual-link {
    writing-mode: initial;
    transform: none;
    justify-self: center;
  }
}

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

  .hero,
  .panel {
    padding: 22px 18px;
    border-radius: 26px;
  }

  .panel-heading,
  .sim-head,
  .table-head {
    flex-direction: column;
  }

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

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

  .sim-frame-workspace {
    min-height: 760px;
  }

  th,
  td {
    padding: 8px 6px;
    font-size: 0.92rem;
  }
}
