:root {
  color-scheme: only light;
  --bg-top: #d9e8f4;
  --bg-bottom: #f7f4ec;
  --panel: rgba(255, 252, 247, 0.9);
  --ink: #21313f;
  --muted: #61707f;
  --line: #ccd7df;
  --accent: #215e8b;
  --accent-deep: #133955;
  --accent-soft: #dbeaf7;
  --warm: #d67d42;
  --warm-soft: #fee9d8;
  --good: #15613e;
  --bad: #9a3528;
  --shadow: 0 22px 44px rgba(45, 58, 70, 0.14);
  --svg-top: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 -26 160 154'%3E%3Cpath d='M16 8H144Q152 8 152 16V108Q152 120 140 120H103C100 120 98 101 89 94C84 90 76 90 71 94C62 101 60 120 57 120H20Q8 120 8 108V16Q8 8 16 8Z' fill='none' stroke='%23111' stroke-width='4' stroke-linejoin='round'/%3E%3C/svg%3E");
  --svg-middle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 -26 160 154'%3E%3Cpath d='M20 8H57C60 8 62 -11 71 -18C76 -22 84 -22 89 -18C98 -11 100 8 103 8H140Q152 8 152 20V108Q152 120 140 120H103C100 120 98 101 89 94C84 90 76 90 71 94C62 101 60 120 57 120H20Q8 120 8 108V20Q8 8 20 8Z' fill='none' stroke='%23111' stroke-width='4' stroke-linejoin='round'/%3E%3C/svg%3E");
  --svg-bottom: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 -26 160 154'%3E%3Cpath d='M20 8H57C60 8 62 -11 71 -18C76 -22 84 -22 89 -18C98 -11 100 8 103 8H140Q152 8 152 20V108Q152 120 140 120H20Q8 120 8 108V20Q8 8 20 8Z' fill='none' stroke='%23111' stroke-width='4' stroke-linejoin='round'/%3E%3C/svg%3E");
  --mask-top: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 -26 160 154'%3E%3Cpath d='M16 8H144Q152 8 152 16V108Q152 120 140 120H103C100 120 98 101 89 94C84 90 76 90 71 94C62 101 60 120 57 120H20Q8 120 8 108V16Q8 8 16 8Z' fill='black'/%3E%3C/svg%3E");
  --mask-middle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 -26 160 154'%3E%3Cpath d='M20 8H57C60 8 62 -11 71 -18C76 -22 84 -22 89 -18C98 -11 100 8 103 8H140Q152 8 152 20V108Q152 120 140 120H103C100 120 98 101 89 94C84 90 76 90 71 94C62 101 60 120 57 120H20Q8 120 8 108V20Q8 8 20 8Z' fill='black'/%3E%3C/svg%3E");
  --mask-bottom: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 -26 160 154'%3E%3Cpath d='M20 8H57C60 8 62 -11 71 -18C76 -22 84 -22 89 -18C98 -11 100 8 103 8H140Q152 8 152 20V108Q152 120 140 120H20Q8 120 8 108V20Q8 8 20 8Z' fill='black'/%3E%3C/svg%3E");
  font-family: "Instrument Sans", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(33, 94, 139, 0.16), transparent 32%),
    radial-gradient(circle at top right, rgba(214, 125, 66, 0.14), transparent 24%),
    linear-gradient(180deg, var(--bg-top), var(--bg-bottom) 52%, #efe5d9 100%);
}

h1,
h2,
h3,
summary {
  margin: 0;
  font-family: "Archivo Black", "Arial Black", sans-serif;
  letter-spacing: 0.02em;
}

p,
ul {
  margin: 0;
}

button,
select,
textarea {
  font: inherit;
}

button,
select,
textarea {
  border-radius: 18px;
}

button {
  border: 0;
  cursor: pointer;
  font-weight: 700;
  padding: 12px 18px;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

button:hover,
button:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 12px 18px rgba(39, 53, 65, 0.14);
}

button:focus-visible,
textarea:focus-visible,
select:focus-visible,
details:focus-visible {
  outline: 3px solid rgba(33, 94, 139, 0.25);
  outline-offset: 2px;
}

.hero,
.layout {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.7fr);
  gap: 22px;
  padding: 34px 0 20px;
}

.hero-copy,
.hero-panel,
.panel {
  background: var(--panel);
  border: 1px solid rgba(204, 215, 223, 0.95);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  border-radius: 30px;
}

.hero-copy,
.hero-panel,
.panel {
  padding: 26px;
}

.eyebrow,
.section-tag,
.tile-label {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--accent-deep);
}

.eyebrow,
.section-tag {
  margin-bottom: 10px;
}

h1 {
  font-size: clamp(2.4rem, 5vw, 4.6rem);
  line-height: 0.95;
  max-width: 8ch;
}

.lede,
.panel-heading p:last-child,
.focus-list,
.feedback,
.column-help,
.answer-box p,
.screenshot-card figcaption {
  color: var(--muted);
}

.lede {
  margin-top: 18px;
  max-width: 62ch;
  line-height: 1.7;
  font-size: 1.04rem;
}

.focus-list {
  margin-top: 16px;
  padding-left: 20px;
  display: grid;
  gap: 12px;
  line-height: 1.6;
}

.layout {
  display: grid;
  gap: 22px;
  padding-bottom: 36px;
}

.wide-panel {
  margin-bottom: 10px;
}

.export-panel {
  text-align: center;
  padding: 6px 0 14px;
}

.export-actions {
  justify-content: center;
}

.export-button {
  min-width: min(100%, 320px);
  padding: 16px 28px;
  font-size: 1.02rem;
  box-shadow: 0 18px 26px rgba(19, 57, 85, 0.18);
}

.panel-heading p:last-child {
  margin-top: 10px;
  line-height: 1.6;
}

.jigsaw-grid {
  margin-top: 22px;
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 18px;
}

.jigsaw-board {
  margin-top: 22px;
  display: grid;
  grid-template-columns: minmax(180px, 220px) minmax(0, 1fr) minmax(180px, 220px);
  gap: 20px;
  align-items: start;
}

.piece-bank {
  display: grid;
  gap: 12px;
}

.bank-grid {
  min-height: 240px;
  padding: 14px;
  border-radius: 24px;
  border: 1px solid rgba(204, 215, 223, 0.95);
  background: rgba(255, 255, 255, 0.74);
  display: grid;
  gap: 12px;
  align-content: start;
}

.jigsaw-stack {
  display: grid;
  gap: 0;
  align-content: start;
  justify-items: stretch;
  transition: transform 0.18s ease;
  transform: none;
}

.jigsaw-stack.correct {
  transform: translateY(-2px);
}

.jigsaw-stack.correct .puzzle-piece,
.jigsaw-stack.correct .puzzle-slot {
  --piece-fill: #e6f6eb;
}

.jigsaw-stack.incorrect .puzzle-piece,
.jigsaw-stack.incorrect .puzzle-slot {
  --piece-fill: #fde9e6;
}

.screenshot-card,
.statement,
.drop-zone,
.answer-box,
.question-stack textarea {
  border: 1px solid rgba(204, 215, 223, 0.95);
}

.statement,
.drop-zone,
.answer-box,
.question-stack textarea,
.screenshot-card {
  background: rgba(255, 255, 255, 0.8);
}

.puzzle-piece,
.puzzle-slot,
.draggable-piece {
  min-height: 108px;
  padding: 12px;
  display: grid;
  place-items: center;
  text-align: center;
  font-weight: 700;
  position: relative;
  isolation: isolate;
  border: 0;
  background: transparent;
}

.puzzle-piece.os-piece {
  --piece-shape: var(--svg-top);
  --piece-mask: var(--mask-top);
  --piece-fill: linear-gradient(135deg, var(--accent-soft), #edf5fb);
  z-index: 3;
}

.puzzle-slot.middle-slot,
.draggable-piece.driver-piece {
  --piece-shape: var(--svg-middle);
  --piece-mask: var(--mask-middle);
}

.puzzle-slot.middle-slot {
  z-index: 2;
}

.puzzle-slot.bottom-slot,
.draggable-piece.device-piece {
  --piece-shape: var(--svg-bottom);
  --piece-mask: var(--mask-bottom);
}

.puzzle-slot.bottom-slot {
  z-index: 1;
}

.puzzle-piece::before,
.puzzle-slot::before,
.draggable-piece::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--piece-fill, #fff);
  -webkit-mask: var(--piece-mask) center / 100% 100% no-repeat;
  mask: var(--piece-mask) center / 100% 100% no-repeat;
  z-index: -1;
}

.puzzle-piece::after,
.puzzle-slot::after,
.draggable-piece::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--piece-shape);
  background-repeat: no-repeat;
  background-position: center;
  background-size: 100% 100%;
  z-index: 0;
  pointer-events: none;
}

.puzzle-piece > span,
.puzzle-slot > span,
.draggable-piece > span {
  position: relative;
  z-index: 1;
  padding: 10px 14px;
  max-width: 104px;
}

.puzzle-slot {
  min-height: 110px;
  color: var(--muted);
  --piece-fill: #f7f7f7;
}

.puzzle-slot.over {
  --piece-fill: #ecf4fb;
}

.puzzle-slot.filled {
  color: var(--ink);
  cursor: grab;
  touch-action: none;
}

.puzzle-slot.driver-filled {
  --piece-fill: #f6ead9;
}

.puzzle-slot.device-filled {
  --piece-fill: #e7f0f8;
}

.puzzle-slot.dragging-piece {
  opacity: 0.45;
}

.slot-label {
  font-size: 0.92rem;
  font-weight: 600;
}

.draggable-piece {
  cursor: grab;
  user-select: none;
  --piece-fill: #ffffff;
  touch-action: none;
}

.draggable-piece:active {
  cursor: grabbing;
}

.draggable-piece.dragging {
  opacity: 0.45;
}

.draggable-piece.selected {
  filter: drop-shadow(0 0 0 rgba(33, 94, 139, 0.1)) drop-shadow(0 0 10px rgba(33, 94, 139, 0.18));
}

.draggable-piece.driver-piece {
  --piece-fill: #f6ead9;
}

.draggable-piece.device-piece {
  --piece-fill: #e7f0f8;
}

.draggable-piece.driver-piece,
.draggable-piece.device-piece {
  --tilt: 0deg;
  transform: rotate(var(--tilt));
  min-height: 118px;
}

.drag-ghost {
  position: fixed;
  z-index: 1000;
  transform: translate(-50%, -50%);
  pointer-events: none;
  padding: 10px 14px;
  border-radius: 16px;
  border: 2px solid rgba(19, 57, 85, 0.18);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 16px 24px rgba(39, 53, 65, 0.18);
  font-weight: 700;
  max-width: 160px;
  text-align: center;
}

.drag-ghost.driver-ghost {
  background: #f6ead9;
}

.drag-ghost.device-ghost {
  background: #e7f0f8;
}

.variant-a {
  --tilt: -8deg;
}

.variant-b {
  --tilt: -10deg;
}

.variant-c {
  --tilt: 11deg;
}

.variant-d {
  --tilt: 9deg;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}

.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: white;
}

.primary:disabled {
  background: #b8c4cd;
  color: rgba(255, 255, 255, 0.82);
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.ghost {
  background: var(--warm-soft);
  color: #8c4b1f;
}

.feedback {
  margin-top: 14px;
  line-height: 1.6;
  min-height: 1.6em;
}

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

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

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

.screenshot-card {
  margin: 0;
  border-radius: 24px;
  padding: 14px;
}

.screenshot-card img {
  display: block;
  width: 100%;
  border-radius: 16px;
  background: #fff;
}

.screenshot-card figcaption {
  margin-top: 10px;
  font-size: 0.92rem;
  line-height: 1.5;
}

.question-stack {
  margin-top: 18px;
  display: grid;
  gap: 10px;
}

.field-label {
  font-weight: 700;
}

.wide-panel .field-label {
  display: block;
  margin-top: 24px;
  margin-bottom: 12px;
}

.question-stack textarea,
#printExplanation {
  width: 100%;
  padding: 14px 16px;
  resize: vertical;
}

.sort-grid {
  margin-top: 22px;
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}

.sort-bank,
.printer-column {
  display: grid;
  gap: 12px;
}

.printer-column {
  align-content: start;
}

.statement-bank,
.drop-zone {
  min-height: 220px;
  padding: 14px;
  border-radius: 24px;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 10px;
}

.drop-zone {
  min-height: 260px;
}

.drop-zone {
  background: rgba(255, 255, 255, 0.72);
}

.drop-zone.over,
.statement-bank.over {
  background: #eaf3fb;
  border-color: rgba(33, 94, 139, 0.42);
}

.statement {
  display: inline-flex;
  align-items: center;
  padding: 12px 14px;
  border-radius: 18px;
  font-weight: 600;
  line-height: 1.45;
  cursor: pointer;
}

.statement.selected {
  border-color: rgba(33, 94, 139, 0.52);
  background: #eaf3fb;
}

.statement.correct {
  border-color: rgba(21, 97, 62, 0.38);
  background: #e6f6eb;
  color: var(--good);
}

.statement.incorrect {
  border-color: rgba(154, 53, 40, 0.32);
  background: #fde9e6;
  color: var(--bad);
}

.statement.dragging {
  opacity: 0.45;
}

.answer-box {
  margin-top: -4px;
  border-radius: 22px;
  padding: 16px 18px;
}

.answer-box summary {
  cursor: pointer;
}

.answer-box p {
  margin-top: 12px;
  line-height: 1.7;
}

.answer-box ul {
  margin: 12px 0 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.7;
}

@media (max-width: 900px) {
  .hero,
  .image-grid,
  .sort-grid,
  .jigsaw-board,
  .jigsaw-grid {
    grid-template-columns: 1fr;
  }
}
