:root {
  --bg: #f7f3e9;
  --bg-deep: #e8e0d0;
  --paper: rgba(255, 252, 246, 0.9);
  --ink: #1f2a26;
  --muted: #5f5a4f;
  --line: rgba(41, 52, 47, 0.12);
  --amber: #b46a1f;
  --amber-soft: #fff1dd;
  --sage: #2f6b57;
  --sage-soft: #e6f4ee;
  --slate: #27506a;
  --slate-soft: #e4eef6;
  --rose-soft: #f9e7e3;
  --good: #22654d;
  --bad: #9f382d;
  --shadow: 0 24px 55px rgba(59, 48, 27, 0.12);
  --radius-xl: 30px;
  --radius-lg: 24px;
  --radius-md: 18px;
}

* {
  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(180, 106, 31, 0.14), transparent 24%),
    radial-gradient(circle at bottom right, rgba(39, 80, 106, 0.12), transparent 30%),
    linear-gradient(180deg, #fbf8f2 0%, var(--bg) 54%, var(--bg-deep) 100%);
}

.page-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.22) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.22) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(circle at center, black 35%, transparent 84%);
  opacity: 0.5;
}

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

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

.hero {
  display: grid;
  gap: 22px;
  padding: 28px;
  border-radius: 34px;
}

.hero::after {
  content: "";
  position: absolute;
  right: -70px;
  bottom: -110px;
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, rgba(47, 107, 87, 0.2), transparent 68%);
}

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

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

h1 {
  margin: 12px 0 14px;
  font-size: clamp(2.3rem, 4.5vw, 4rem);
  line-height: 0.95;
  letter-spacing: -0.05em;
}

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

h3 {
  margin: 8px 0 0;
  font-size: 1.1rem;
}

.intro,
.panel-copy,
.feedback-line,
.response-label,
figcaption {
  line-height: 1.6;
  color: #4e473d;
}

.panel-copy.is-good {
  color: var(--good);
}

.panel-copy.is-bad {
  color: var(--bad);
}

.intro-list {
  margin: 0;
  padding-left: 22px;
  color: #4e473d;
}

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

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

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

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

.button.primary {
  background: linear-gradient(135deg, var(--amber), #cc8a42);
  color: #fff;
  box-shadow: 0 14px 26px rgba(180, 106, 31, 0.22);
}

.button.ghost {
  background: rgba(255, 255, 255, 0.8);
  color: var(--ink);
  border: 1px solid rgba(41, 52, 47, 0.12);
}

.hero-visuals {
  display: grid;
  gap: 14px;
}

.hero-banner {
  width: 100%;
  height: 84px;
  object-fit: cover;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: #f2e8df;
}

.visual-stack {
  display: grid;
  gap: 14px;
}

.photo-card,
.icon-card,
.dual-card,
.bank-panel,
.sort-card,
.code-figure,
.memory-card {
  border-radius: 22px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.84);
}

.photo-card {
  overflow: hidden;
}

.photo-card img,
.code-figure img {
  width: 100%;
  display: block;
}

.photo-card figcaption,
.code-figure figcaption {
  padding: 12px 14px 14px;
}

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

.icon-card {
  display: grid;
  place-items: center;
  padding: 14px;
  text-align: center;
}

.icon-card img {
  max-width: 100%;
  max-height: 112px;
  object-fit: contain;
}

.dual-coding-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
  padding: 18px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(180, 106, 31, 0.1), transparent 38%),
    linear-gradient(225deg, rgba(47, 107, 87, 0.1), transparent 34%),
    rgba(255, 255, 255, 0.64);
}

.dual-card {
  padding: 16px;
}

.dual-flow {
  display: grid;
  gap: 4px;
  margin-top: 8px;
}

.dual-node {
  min-height: 42px;
  display: grid;
  place-items: center;
  padding: 6px 10px;
  border-radius: 12px;
  background: #fff8eb;
  border: 1px solid rgba(180, 106, 31, 0.18);
  font-weight: 700;
  text-align: center;
  font-size: 0.95rem;
}

.dual-arrow {
  position: relative;
  justify-self: center;
  width: 18px;
  height: 14px;
}

.dual-arrow::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 6px;
  width: 2px;
  background: var(--amber);
}

.dual-arrow::after {
  content: "";
  position: absolute;
  left: 3px;
  bottom: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--amber);
}

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

.dual-link span {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  padding: 14px 10px;
  border-radius: 999px;
  background: rgba(39, 80, 106, 0.1);
  color: var(--slate);
  font-weight: 700;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  text-transform: uppercase;
}

.dual-points {
  margin: 14px 0 0;
  padding-left: 20px;
  color: #4e473d;
}

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

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

.panel::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 190px;
  height: 190px;
  border-radius: 0 0 100% 0;
  opacity: 0.18;
}

.panel-amber::before {
  background: radial-gradient(circle at top left, var(--amber), transparent 72%);
}

.panel-sage::before {
  background: radial-gradient(circle at top left, var(--sage), transparent 72%);
}

.panel-slate::before {
  background: radial-gradient(circle at top left, var(--slate), transparent 72%);
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.panel-heading.compact {
  margin-bottom: 10px;
}

.activity-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.concept-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.bank-panel {
  padding: 16px;
}

.chip-bank,
.drop-zone {
  min-height: 120px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-content: flex-start;
  padding: 12px;
  border-radius: 16px;
  border: 1px dashed rgba(41, 52, 47, 0.2);
  background: rgba(255, 255, 255, 0.7);
}

#termBank {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  min-height: 0;
}

#termBank .task-chip {
  width: 100%;
  text-align: left;
}

.canvas-panel {
  padding: 16px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(39, 80, 106, 0.05), transparent 24%),
    rgba(255, 255, 255, 0.84);
}

.canvas-toolbar {
  margin-bottom: 10px;
}

.canvas-help {
  margin-bottom: 0;
}

.canvas-key {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.key-chip {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(41, 52, 47, 0.14);
  background: rgba(255, 255, 255, 0.85);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.concept-canvas {
  position: relative;
  min-height: 620px;
  overflow: hidden;
  border-radius: 22px;
  border: 1px solid rgba(39, 80, 106, 0.14);
  background:
    radial-gradient(circle at 20% 15%, rgba(255, 255, 255, 0.14), transparent 22%),
    linear-gradient(180deg, #d8ecf8 0%, #c4e0f0 100%);
}

.canvas-connections {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.canvas-link {
  stroke: #b46a1f;
  stroke-width: 3;
  pointer-events: auto;
  cursor: pointer;
}

.canvas-link.is-selected {
  stroke: #9f382d;
  stroke-width: 4;
}

.canvas-link-delete circle {
  fill: #9f382d;
}

.canvas-link-delete text {
  fill: #fff;
  text-anchor: middle;
  font-weight: 700;
  pointer-events: none;
}

.canvas-node {
  position: absolute;
  z-index: 2;
  min-width: 120px;
  max-width: 170px;
  padding: 12px 34px 12px 14px;
  border: 0;
  border-radius: 16px;
  background: #fffdf8;
  box-shadow: 0 10px 22px rgba(59, 48, 27, 0.12);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  text-align: left;
  cursor: grab;
}

.canvas-node.is-selected {
  box-shadow: 0 0 0 3px rgba(180, 106, 31, 0.28), 0 10px 22px rgba(59, 48, 27, 0.12);
}

.canvas-node.is-connectable {
  box-shadow: 0 0 0 2px rgba(39, 80, 106, 0.22), 0 10px 22px rgba(59, 48, 27, 0.12);
}

.canvas-node-label {
  display: block;
  line-height: 1.25;
}

.canvas-node-delete {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(159, 56, 45, 0.1);
  color: #9f382d;
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1;
}

.image-wall-panel {
  margin-top: 16px;
  padding: 16px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
}

.image-wall {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}

.image-chip {
  border: 1px solid rgba(41, 52, 47, 0.14);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  padding: 12px;
  cursor: grab;
  box-shadow: 0 8px 18px rgba(59, 48, 27, 0.08);
}

.image-chip img {
  display: block;
  width: 100%;
  height: 86px;
  object-fit: contain;
}

.canvas-sticker {
  position: absolute;
  z-index: 2;
  width: 110px;
  padding: 10px;
  border: 0;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 10px 22px rgba(59, 48, 27, 0.12);
  cursor: grab;
}

.canvas-sticker.is-selected {
  box-shadow: 0 0 0 3px rgba(180, 106, 31, 0.28), 0 10px 22px rgba(59, 48, 27, 0.12);
}

.canvas-sticker.is-connectable:hover,
.canvas-sticker.is-connectable:focus-visible {
  box-shadow: 0 0 0 2px rgba(39, 80, 106, 0.24), 0 10px 22px rgba(59, 48, 27, 0.12);
}

.canvas-sticker img {
  display: block;
  width: 100%;
  height: 78px;
  object-fit: contain;
}

.canvas-sticker-delete {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(159, 56, 45, 0.1);
  color: #9f382d;
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1;
}

.chip-bank.is-over,
.drop-zone.is-over,
.drop-slot.is-over {
  border-color: var(--amber);
  background: rgba(255, 241, 221, 0.92);
}

.task-chip {
  border: none;
  border-radius: 14px;
  padding: 10px 12px;
  background: #fff8eb;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: grab;
  box-shadow: inset 0 0 0 1px rgba(180, 106, 31, 0.15);
}

.task-chip.is-correct {
  background: var(--sage-soft);
  box-shadow: inset 0 0 0 2px rgba(34, 101, 77, 0.32);
}

.task-chip.is-incorrect {
  background: var(--rose-soft);
  box-shadow: inset 0 0 0 2px rgba(159, 56, 45, 0.28);
}

.diagram-board {
  display: grid;
  gap: 12px;
  padding: 18px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(39, 80, 106, 0.05), transparent 24%),
    rgba(255, 255, 255, 0.84);
}

.diagram-stage {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.diagram-stage.single {
  grid-template-columns: minmax(220px, 360px);
  justify-content: center;
}

.stage-fixed,
.drop-slot {
  min-height: 78px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 12px;
  border-radius: 18px;
}

.stage-fixed {
  background: var(--slate-soft);
  border: 1px solid rgba(39, 80, 106, 0.14);
  font-weight: 700;
}

.drop-slot {
  position: relative;
  border: 2px dashed rgba(41, 52, 47, 0.2);
  background: rgba(255, 255, 255, 0.78);
}

.drop-slot::before {
  content: attr(data-label);
  position: absolute;
  top: 8px;
  left: 10px;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.drop-slot.wide {
  min-height: 86px;
}

.diagram-arrow-row {
  display: grid;
  grid-template-columns: 1fr minmax(180px, 280px) 1fr;
  gap: 12px;
  align-items: center;
}

.diagram-arrow-row.split {
  grid-template-columns: 1fr 1fr 1fr;
}

.diagram-arrow {
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, var(--amber) 12%, var(--amber) 88%, transparent 100%);
  position: relative;
}

.diagram-arrow::after {
  content: "";
  position: absolute;
  right: 10px;
  top: -5px;
  border-left: 9px solid var(--amber);
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}

.diagram-arrow.merge {
  transform: translateY(18px);
}

.memory-row {
  grid-template-columns: 220px minmax(0, 1fr);
  align-items: center;
}

.memory-card {
  position: relative;
  padding: 18px;
}

.memory-card img {
  display: block;
  width: min(100%, 360px);
  margin: 0 auto;
}

.drop-slot.overlay {
  position: absolute;
  inset: auto 18px 18px auto;
  width: 180px;
  min-height: 70px;
  background: rgba(255, 255, 255, 0.94);
}

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

.sort-card {
  padding: 16px;
}

.sort-head {
  margin-bottom: 12px;
}

.compare-intro {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 18px;
  align-items: center;
}

.code-figure {
  overflow: hidden;
}

.compare-rows {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.compare-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.84);
}

.compare-row.correct {
  background: var(--sage-soft);
}

.compare-row.incorrect {
  background: var(--rose-soft);
}

select,
.long-response {
  width: 100%;
  border-radius: 16px;
  border: 1px solid rgba(41, 52, 47, 0.18);
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  font: inherit;
}

select {
  padding: 12px 14px;
}

.long-response {
  min-height: 116px;
  margin-top: 10px;
  padding: 14px 16px;
  resize: vertical;
}

.response-label {
  display: block;
  margin-top: 18px;
  font-weight: 700;
}

.feedback-line {
  min-height: 28px;
  margin: 14px 0 0;
  font-weight: 700;
}

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

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

.floating-download-wrap {
  margin-top: 22px;
  width: fit-content;
  max-width: min(100%, 420px);
  margin-left: auto;
  margin-right: auto;
  padding: 0;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  background: transparent;
  backdrop-filter: none;
  border: 0;
  box-shadow: none;
}

.floating-download-wrap .button {
  box-shadow: 0 18px 36px rgba(59, 48, 27, 0.16);
}

@media (max-width: 960px) {
  .dual-coding-panel,
  .activity-layout,
  .concept-layout,
  .compare-intro {
    grid-template-columns: 1fr;
  }

  .dual-link {
    display: none;
  }

  .sort-grid,
  .icon-strip,
  .memory-row {
    grid-template-columns: 1fr;
  }

  .image-wall {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .diagram-stage,
  .diagram-arrow-row,
  .diagram-arrow-row.split,
  .compare-row {
    grid-template-columns: 1fr;
  }

  .drop-slot.overlay {
    position: static;
    width: 100%;
    margin-top: 12px;
  }
}

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

  .hero,
  .panel {
    padding: 18px;
  }

  .panel-heading,
  .floating-download-wrap {
    flex-direction: column;
    align-items: stretch;
  }

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