:root {
  --ink: #212329;
  --muted: #65717c;
  --surface: #ffffff;
  --line: #d9e2df;
  --sky: #dff6ff;
  --mint: #d9f7df;
  --sun: #ffd45a;
  --coral: #ff756d;
  --leaf: #3a9b69;
  --blue: #2187d0;
  --plum: #7b5bb8;
  --shadow: 0 14px 36px rgba(33, 35, 41, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(223, 246, 255, 0.82), rgba(248, 252, 247, 0.96) 320px),
    #f8fcf7;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
select,
textarea,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: default;
  opacity: 0.55;
}

body.pack-chooser-open {
  overflow: hidden;
}

.topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px clamp(16px, 4vw, 42px);
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  font-weight: 900;
}

.brand strong,
.brand small {
  display: block;
  line-height: 1.05;
}

.brand small {
  margin-top: 3px;
  color: var(--blue);
  font-weight: 800;
}

.nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav a {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  color: var(--ink);
  text-decoration: none;
  border-radius: 8px;
  font-weight: 800;
}

.nav a:hover,
.nav a:focus-visible {
  background: var(--sky);
  outline: none;
}

.shell {
  width: min(1220px, calc(100% - 28px));
  margin: 24px auto;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 280px;
  gap: 16px;
  align-items: start;
}

.lesson-panel,
.stage,
.teacher-panel,
.word-tray,
.design-strip {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.lesson-panel,
.teacher-panel {
  border-radius: 8px;
  padding: 18px;
}

.stage {
  border-radius: 8px;
  padding: clamp(18px, 3vw, 28px);
  min-height: 680px;
}

.section-kicker {
  color: var(--blue);
  font-size: 12px;
  line-height: 1.2;
  font-weight: 900;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 8px;
  font-size: 30px;
  line-height: 1.05;
}

h2 {
  margin-bottom: 0;
  font-size: 24px;
  line-height: 1.1;
}

.lesson-note {
  margin-bottom: 18px;
  color: var(--muted);
  line-height: 1.45;
  font-weight: 650;
}

.set-picker,
.word-list {
  display: grid;
  gap: 8px;
}

.current-pack {
  min-height: 70px;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--blue);
  border-radius: 8px;
  background: #eef9ff;
}

.choose-pack-button {
  width: 100%;
  min-height: 44px;
  margin-top: 10px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: var(--ink);
  color: white;
  font-weight: 900;
}

.set-button {
  width: 100%;
  min-height: 60px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  text-align: left;
}

.set-button.is-active {
  border-color: var(--blue);
  background: var(--sky);
}

.set-icon,
.word-chip svg,
.set-icon .picture-photo,
.word-chip .picture-photo,
.word-mini-card {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  overflow: hidden;
}

.word-mini-card {
  display: grid;
  place-items: center;
  border: 2px dashed var(--line);
  background: white;
  color: var(--ink);
  font-size: 14px;
  font-weight: 950;
  letter-spacing: 0;
  text-transform: uppercase;
}

.set-title,
.set-meta {
  display: block;
}

.set-title {
  font-weight: 900;
}

.set-meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.progress-block {
  margin-top: 18px;
}

.progress-copy,
.mini-results,
.feedback-row,
.mode-toolbar,
.prompt-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.progress-copy span,
.mini-results span,
.small-report span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.progress-copy strong,
.mini-results strong,
.small-report strong {
  font-size: 18px;
}

.progress-bar {
  height: 12px;
  margin-top: 8px;
  border-radius: 99px;
  background: #edf3f1;
  overflow: hidden;
}

.progress-bar span {
  width: 0%;
  height: 100%;
  display: block;
  background: linear-gradient(90deg, var(--leaf), var(--sun));
  transition: width 180ms ease;
}

.mini-results {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.mode-toolbar {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.mode-tabs {
  display: inline-grid;
  grid-template-columns: repeat(5, minmax(64px, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f4f8f6;
}

.mode-tab {
  min-height: 42px;
  min-width: 0;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  font-weight: 900;
}

.mode-tab.is-active {
  background: var(--ink);
  color: white;
}

.pack-modal[hidden] {
  display: none;
}

.pack-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(33, 35, 41, 0.42);
}

.pack-modal-panel {
  width: min(1040px, 100%);
  max-height: min(720px, calc(100vh - 48px));
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: 0 20px 70px rgba(33, 35, 41, 0.24);
}

.pack-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.icon-button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font-size: 26px;
  line-height: 1;
  font-weight: 850;
}

.pack-search {
  display: grid;
  gap: 6px;
}

.pack-search span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.pack-search input {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  font-weight: 850;
}

.pack-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  align-content: start;
  overflow: auto;
  padding-right: 2px;
}

.pack-manager {
  min-height: 0;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 14px;
  overflow: hidden;
}

.folder-pane,
.pack-browser {
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf9;
}

.folder-pane {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
  padding: 10px;
}

.folder-pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.folder-pane-header span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.folder-pane-header button {
  min-height: 32px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
}

.folder-list {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 6px;
  overflow: auto;
}

.folder-button {
  width: 100%;
  min-height: 42px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: white;
  color: var(--ink);
  text-align: left;
  font-weight: 900;
}

.folder-button span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-button strong {
  min-width: 28px;
  min-height: 24px;
  display: grid;
  place-items: center;
  border-radius: 99px;
  background: #edf3f1;
  color: var(--muted);
  font-size: 12px;
}

.folder-button.is-active {
  border-color: var(--blue);
  background: var(--sky);
}

.pack-browser {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
  padding: 10px;
  overflow: hidden;
}

.pack-folder-note {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.pack-card {
  min-width: 0;
  display: grid;
  gap: 7px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.pack-card.is-active {
  border-color: var(--blue);
  background: #f7fcff;
}

.pack-card .set-button {
  border-color: transparent;
  background: transparent;
  padding: 2px;
}

.pack-move-control {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.pack-move-control span,
.pack-current-folder {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.pack-move-control select {
  min-height: 34px;
  padding: 0 8px;
  font-size: 13px;
}

.pack-current-folder {
  justify-self: start;
  padding: 4px 8px;
  border-radius: 99px;
  background: #edf3f1;
}

.pack-empty {
  min-height: 80px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-weight: 850;
}

.prompt-row {
  justify-content: flex-start;
  margin: 22px 0;
}

.sound-button {
  width: 86px;
  height: 86px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: var(--sun);
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.14);
}

.sound-button span {
  width: 34px;
  height: 34px;
  display: block;
  clip-path: polygon(0 30%, 32% 30%, 72% 0, 72% 100%, 32% 70%, 0 70%);
  background: var(--ink);
}

.prompt-label {
  margin-bottom: 2px;
  color: var(--muted);
  font-weight: 850;
}

.target-word {
  margin: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  font-size: clamp(32px, 4.8vw, 66px);
  line-height: 1;
  font-weight: 950;
}

.target-word.is-phrase {
  font-size: clamp(28px, 3.2vw, 46px);
  line-height: 1.05;
}

.activity-zone {
  min-height: 380px;
}

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

.picture-card {
  min-height: 180px;
  padding: 14px;
  border: 3px solid transparent;
  border-radius: 8px;
  background: #f7fbff;
  box-shadow: inset 0 -7px 0 rgba(0, 0, 0, 0.08);
}

.picture-card.is-image-only {
  display: grid;
  place-items: center;
  min-height: 190px;
}

.picture-card:focus-visible,
.letter-tile:focus-visible,
.word-choice:focus-visible,
.run-choice:focus-visible,
.memory-card:focus-visible,
.next-button:focus-visible,
.choose-pack-button:focus-visible,
.icon-button:focus-visible,
.folder-pane-header button:focus-visible,
.folder-button:focus-visible,
.teacher-actions button:focus-visible,
.speech-panel button:focus-visible,
.pack-search input:focus-visible,
.upload-actions button:focus-visible,
.file-button:focus-within,
.sound-button:focus-visible {
  outline: 3px solid var(--plum);
  outline-offset: 2px;
}

.picture-card.is-correct {
  border-color: var(--leaf);
  background: var(--mint);
}

.picture-card.is-wrong {
  border-color: var(--coral);
  background: #fff0ef;
}

.picture-card svg {
  width: 100%;
  height: 118px;
  display: block;
}

.picture-photo {
  width: 100%;
  height: 118px;
  display: block;
  border-radius: 8px;
  background: #eef3f1;
  object-fit: cover;
}

.picture-card.is-image-only svg {
  height: 150px;
}

.picture-card.is-image-only .picture-photo {
  height: 150px;
}

.text-visual {
  width: 100%;
  min-height: 118px;
  display: grid;
  place-items: center;
  padding: 12px;
  border: 2px dashed var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font-size: clamp(22px, 3vw, 34px);
  line-height: 1.08;
  font-weight: 950;
  text-align: center;
  overflow-wrap: anywhere;
}

.picture-card.is-image-only .text-visual {
  min-height: 150px;
}

.picture-card strong {
  display: block;
  margin-top: 10px;
  font-size: 24px;
  line-height: 1.05;
}

.hunt-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.hunt-strip div {
  min-height: 62px;
  display: grid;
  align-content: center;
  gap: 3px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf2;
}

.hunt-strip span,
.round-break-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.hunt-strip strong {
  font-size: 24px;
  line-height: 1;
}

.round-break-card {
  min-height: 300px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  padding: 28px;
  border: 2px dashed var(--line);
  border-radius: 8px;
  background: #f7faf9;
  text-align: center;
}

.round-break-card strong {
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.05;
}

.round-break-card p {
  margin: 0;
  color: var(--muted);
  font-weight: 850;
}

.round-break-card button {
  min-height: 46px;
  padding: 0 16px;
  border: 1px solid var(--blue);
  border-radius: 8px;
  background: var(--blue);
  color: white;
  font-weight: 900;
}

.completion-card {
  min-height: 300px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  padding: 28px;
  border: 2px dashed var(--line);
  border-radius: 8px;
  background: #f7faf9;
  text-align: center;
}

.completion-card strong {
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.05;
}

.completion-card p {
  margin: 0;
  color: var(--muted);
  font-weight: 850;
}

.completion-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.completion-actions button {
  min-height: 46px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font-weight: 900;
}

.completion-actions button:first-child {
  border-color: var(--blue);
  background: var(--blue);
  color: white;
}

.build-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
}

.build-picture {
  border-radius: 8px;
  background: #f7fbff;
  border: 1px solid var(--line);
  padding: 18px;
}

.build-picture svg {
  width: 100%;
  height: 190px;
  display: block;
}

.build-picture .picture-photo {
  height: 190px;
}

.build-picture .text-visual {
  min-height: 190px;
}

.answer-slots {
  min-height: 78px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.slot {
  width: 54px;
  height: 62px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: white;
  border: 2px solid var(--line);
  font-size: 30px;
  font-weight: 950;
  text-transform: uppercase;
}

.word-slot {
  width: auto;
  min-width: 96px;
  padding: 0 12px;
  font-size: 22px;
  text-transform: none;
}

.letter-bank {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.letter-tile,
.word-choice {
  min-width: 58px;
  min-height: 58px;
  border: 0;
  border-radius: 8px;
  background: var(--blue);
  color: white;
  font-size: 25px;
  font-weight: 950;
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.18);
}

.letter-tile:disabled {
  opacity: 0.35;
  cursor: default;
}

.word-tile {
  min-width: 96px;
  padding: 8px 14px;
  font-size: 20px;
  line-height: 1.1;
  text-transform: none;
}

.build-tools {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.build-tools button,
.teacher-actions button,
.next-button {
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font-weight: 900;
}

.match-board {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.match-column {
  display: grid;
  gap: 10px;
}

.match-picture,
.word-choice {
  border: 3px solid transparent;
}

.match-picture.is-selected,
.word-choice.is-selected {
  border-color: var(--plum);
}

.match-picture.is-done,
.word-choice.is-done {
  border-color: var(--leaf);
  opacity: 0.66;
}

.word-choice {
  width: 100%;
  background: #fff7d7;
  color: var(--ink);
  padding: 8px;
  font-size: clamp(18px, 2vw, 28px);
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.run-layout {
  display: grid;
  gap: 16px;
}

.run-track {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.run-lane {
  position: relative;
  height: 22px;
  border: 2px solid var(--line);
  border-radius: 99px;
  background:
    repeating-linear-gradient(90deg, transparent 0 34px, rgba(33, 35, 41, 0.08) 34px 36px),
    #fffdf2;
}

.runner {
  position: absolute;
  top: 50%;
  width: 36px;
  height: 36px;
  border: 4px solid white;
  border-radius: 50%;
  background: var(--coral);
  box-shadow: 0 8px 18px rgba(33, 35, 41, 0.18);
  transform: translate(-50%, -50%);
  transition: left 180ms ease;
}

.runner::after {
  content: "";
  position: absolute;
  inset: 9px 6px;
  border-radius: 50%;
  border-bottom: 4px solid var(--ink);
}

.run-card {
  min-height: 245px;
  display: grid;
  place-items: center;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fbff;
}

.run-card svg,
.run-card .picture-photo {
  width: 100%;
  height: 210px;
  display: block;
}

.run-card .picture-photo {
  object-fit: cover;
}

.run-card .text-visual {
  min-height: 210px;
}

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

.run-choice {
  min-height: 62px;
  padding: 10px;
  border: 3px solid transparent;
  border-radius: 8px;
  background: var(--blue);
  color: white;
  font-size: clamp(18px, 2.2vw, 28px);
  line-height: 1.05;
  font-weight: 950;
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.18);
  overflow-wrap: anywhere;
}

.run-choice.is-correct {
  border-color: var(--leaf);
  background: var(--leaf);
}

.run-choice.is-wrong {
  border-color: var(--coral);
  background: #fff0ef;
  color: var(--ink);
}

.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.memory-card {
  position: relative;
  min-height: 126px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #fffdf2;
  color: var(--ink);
  font-weight: 950;
  overflow: hidden;
}

.memory-card.is-open,
.memory-card.is-matched {
  background: #f7fbff;
  border-color: var(--blue);
}

.memory-card.is-matched {
  border-color: var(--leaf);
  opacity: 0.72;
}

.memory-back,
.memory-front {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 10px;
  transition: opacity 120ms ease, transform 120ms ease;
}

.memory-back {
  background:
    linear-gradient(135deg, rgba(255, 212, 90, 0.45), rgba(33, 135, 208, 0.2)),
    white;
  color: var(--ink);
  font-size: 38px;
}

.memory-front {
  opacity: 0;
  transform: scale(0.96);
  background: white;
}

.memory-card.is-open .memory-back,
.memory-card.is-matched .memory-back {
  opacity: 0;
}

.memory-card.is-open .memory-front,
.memory-card.is-matched .memory-front {
  opacity: 1;
  transform: scale(1);
}

.memory-front svg,
.memory-front .picture-photo {
  width: 100%;
  height: 88px;
  display: block;
}

.memory-front .picture-photo {
  object-fit: cover;
}

.memory-front .text-visual {
  min-height: 88px;
  font-size: 16px;
}

.memory-front strong {
  font-size: clamp(18px, 2vw, 26px);
  line-height: 1.05;
  overflow-wrap: anywhere;
  text-align: center;
}

.feedback-row {
  min-height: 60px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.feedback-row p {
  margin: 0;
  color: var(--muted);
  font-size: 18px;
  font-weight: 850;
}

.next-button {
  background: var(--ink);
  color: white;
  border-color: var(--ink);
}

.field,
.field-group {
  display: grid;
  gap: 8px;
  margin: 16px 0;
}

.field span,
.field-group legend {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 0 10px;
  color: var(--ink);
  font-weight: 850;
}

.field-group {
  border: 0;
  padding: 0;
}

.field-group label {
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
}

.field-group input {
  width: 18px;
  height: 18px;
  accent-color: var(--blue);
}

.teacher-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.teacher-actions button:last-child,
.studio-link,
.studio-hero-actions button {
  background: var(--blue);
  color: white;
  border-color: var(--blue);
}

.studio-link {
  min-height: 44px;
  display: grid;
  place-items: center;
  margin-top: 8px;
  border: 1px solid var(--blue);
  border-radius: 8px;
  text-decoration: none;
  font-weight: 900;
}

.studio-link.secondary {
  background: white;
  color: var(--ink);
  border-color: var(--line);
}

.field input,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 10px;
  color: var(--ink);
  line-height: 1.35;
  font-weight: 800;
}

.field input {
  min-height: 44px;
}

.field textarea {
  resize: vertical;
}

.upload-panel {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf2;
}

.upload-panel h3 {
  margin: 3px 0 6px;
  font-size: 18px;
  line-height: 1.15;
}

.upload-panel p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  font-weight: 750;
}

.upload-panel textarea {
  width: 100%;
  min-height: 112px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 10px;
  color: var(--ink);
  line-height: 1.35;
}

.upload-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

.upload-actions button,
.file-button {
  min-height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font-weight: 900;
}

.file-button {
  position: relative;
  cursor: pointer;
  overflow: hidden;
}

.file-button input {
  width: 1px;
  height: 1px;
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.upload-actions button:last-child {
  grid-column: 1 / -1;
  background: var(--leaf);
  color: white;
  border-color: var(--leaf);
}

.upload-status {
  margin: 8px 0 0 !important;
}

.upload-status.is-error {
  color: var(--coral);
}

.speech-panel {
  margin: 16px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf2;
}

.speech-panel h3 {
  margin: 3px 0 8px;
  font-size: 18px;
  line-height: 1.15;
}

.speech-panel .field {
  margin: 10px 0;
}

.speech-panel button {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font-weight: 900;
}

.speech-panel p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  font-weight: 750;
}

.studio-shell {
  width: min(1220px, calc(100% - 28px));
  margin: 24px auto 28px;
}

.studio-workspace {
  display: grid;
  gap: 16px;
}

.studio-hero,
.studio-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.studio-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
}

.studio-hero h1,
.studio-card h2,
.studio-card p {
  margin: 0;
}

.studio-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.studio-hero-actions button,
.studio-hero-actions .studio-link {
  min-height: 44px;
  margin-top: 0;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  font-weight: 900;
}

.studio-hero-actions button:last-child {
  background: var(--leaf);
  border-color: var(--leaf);
  color: white;
}

.studio-card {
  padding: 18px;
}

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

.studio-preview {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf9;
}

.studio-preview span,
.studio-preview small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.studio-preview strong {
  font-size: 22px;
  line-height: 1.1;
}

.studio-preview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.studio-preview-grid svg,
.studio-preview-grid .text-visual,
.studio-preview-grid .picture-photo {
  width: 100%;
  height: 54px;
  min-height: 54px;
  border-radius: 8px;
  background: white;
}

.studio-preview-grid .text-visual {
  padding: 4px;
  font-size: 11px;
}

.studio-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.studio-editor-header p {
  margin-top: 5px;
  color: var(--muted);
  font-weight: 750;
}

.studio-editor-header button,
.studio-row button {
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font-weight: 900;
}

.studio-rows {
  display: grid;
  gap: 10px;
}

.studio-row {
  display: grid;
  grid-template-columns: 96px minmax(150px, 1fr) minmax(220px, 1.25fr) minmax(170px, 0.8fr) auto;
  gap: 10px;
  align-items: end;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

.studio-row-preview {
  align-self: stretch;
  display: grid;
  place-items: center;
  min-height: 82px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  overflow: hidden;
}

.studio-picture-field {
  grid-row: 1 / span 3;
}

.studio-row-preview svg {
  width: 88px;
  height: 68px;
}

.studio-row-preview .picture-photo {
  width: 100%;
  height: 100%;
  min-height: 82px;
  border-radius: 8px;
}

.studio-row-preview .text-visual {
  min-height: 68px;
  padding: 6px;
  border: 0;
  font-size: 13px;
}

.studio-row label {
  display: grid;
  gap: 6px;
}

.studio-row label span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.studio-row input,
.studio-row select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 0 10px;
  color: var(--ink);
  font-weight: 850;
}

.studio-picture-tools {
  grid-column: 2 / 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.studio-picture-tools span {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.studio-picture-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.studio-picture-tools button {
  min-height: 34px;
  padding: 0 10px;
  white-space: nowrap;
}

.studio-picture-results {
  grid-column: 2 / 5;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.picture-result {
  min-height: 92px;
  display: grid;
  grid-template-rows: 54px auto;
  gap: 5px;
  align-content: start;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font-weight: 900;
}

.picture-result.is-selected {
  border-color: var(--blue);
  background: var(--sky);
}

.picture-result span {
  display: grid;
  place-items: center;
  min-width: 0;
}

.picture-result svg {
  width: 100%;
  height: 54px;
}

.picture-result .picture-photo {
  height: 54px;
  border-radius: 6px;
}

.picture-result .text-visual {
  min-height: 54px;
  padding: 4px;
  font-size: 10px;
}

.picture-result strong {
  min-width: 0;
  font-size: 11px;
  line-height: 1.05;
  text-align: center;
  overflow-wrap: anywhere;
}

.picture-search-empty {
  grid-column: 1 / -1;
  min-height: 54px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.studio-row [data-studio-remove] {
  grid-column: 5;
  grid-row: 1 / span 3;
  align-self: center;
}

.studio-empty {
  padding: 20px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-weight: 850;
  text-align: center;
}

.print-panel {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf9;
}

.print-panel h3 {
  margin: 3px 0 6px;
  font-size: 18px;
  line-height: 1.15;
}

.print-panel p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  font-weight: 750;
}

.print-actions {
  display: grid;
  gap: 8px;
}

.print-actions button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font-weight: 900;
}

.print-actions button:hover,
.print-actions button:focus-visible {
  border-color: var(--blue);
  outline: 3px solid rgba(33, 135, 208, 0.2);
}

.print-area {
  display: none;
}

.print-area.is-preparing-print {
  display: block;
  position: fixed;
  top: 0;
  left: -10000px;
  width: 188mm;
  min-height: 252mm;
  background: white;
  opacity: 0;
  pointer-events: none;
  z-index: -1;
}

.small-report {
  margin: 16px 0;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.word-tray {
  grid-column: 1 / -1;
  display: grid;
  gap: 14px;
  border-radius: 8px;
  padding: 18px;
}

.word-tray-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.word-tray-header h2,
.word-tray-header p {
  margin: 0;
}

.word-tray-header p {
  color: var(--muted);
  font-weight: 750;
}

.word-list {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.word-chip {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 68px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf9;
  font-weight: 900;
}

.word-chip small {
  display: block;
  color: var(--muted);
  font-weight: 750;
}

.design-strip {
  width: min(1220px, calc(100% - 28px));
  margin: 0 auto 28px;
  border-radius: 8px;
  padding: 18px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.design-strip div {
  min-height: 92px;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  column-gap: 12px;
  align-items: center;
}

.design-strip p {
  grid-column: 2;
  margin: -22px 0 0;
  color: var(--muted);
  font-weight: 720;
}

.step-number {
  width: 48px;
  height: 48px;
  grid-row: span 2;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--coral);
  color: white;
  font-size: 24px;
  font-weight: 950;
}

.design-strip div:nth-child(2) .step-number {
  background: var(--blue);
}

.design-strip div:nth-child(3) .step-number {
  background: var(--leaf);
}

@media (max-width: 1060px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .studio-import,
  .studio-row {
    grid-template-columns: 1fr;
  }

  .studio-picture-field,
  .studio-picture-tools,
  .studio-picture-results,
  .studio-row [data-studio-remove] {
    grid-column: auto;
    grid-row: auto;
  }

  .studio-picture-results {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .lesson-panel,
  .teacher-panel {
    display: block;
  }

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

  .teacher-panel {
    order: 3;
  }

  .word-tray {
    order: 4;
  }
}

@media (max-width: 720px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav {
    width: 100%;
    justify-content: space-between;
  }

  .pack-modal {
    padding: 12px;
  }

  .pack-manager {
    grid-template-columns: 1fr;
  }

  .folder-pane {
    max-height: 190px;
  }

  .mode-toolbar,
  .prompt-row,
  .feedback-row,
  .studio-hero,
  .studio-editor-header,
  .word-tray-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .studio-hero-actions {
    width: 100%;
    justify-content: stretch;
  }

  .studio-hero-actions button,
  .studio-hero-actions .studio-link {
    width: 100%;
  }

  .mode-tabs {
    width: 100%;
  }

  .mode-tab {
    min-width: 0;
  }

  .picture-grid,
  .hunt-strip,
  .build-layout,
  .match-board,
  .run-choices,
  .design-strip,
  .upload-actions {
    grid-template-columns: 1fr;
  }

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

  .stage {
    min-height: 0;
  }

  .set-picker {
    grid-template-columns: 1fr;
  }

  .word-list {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }
}

@media print {
  @page {
    size: A4 portrait;
    margin: 10mm;
  }

  :root {
    --print-width: 188mm;
    --print-height: 252mm;
  }

  html,
  body {
    width: 210mm;
    background: white;
    color: #111;
  }

  body > :not(.print-area) {
    display: none !important;
  }

  .print-area {
    display: block;
    width: var(--print-width);
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  }

  .print-area.is-preparing-print {
    position: static;
    top: auto;
    left: auto;
    min-height: 0;
    opacity: 1;
    pointer-events: auto;
    z-index: auto;
  }

  .print-page {
    width: var(--print-width);
    height: var(--print-height);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    break-after: page;
    page-break-after: always;
  }

  .print-page:last-child {
    break-after: auto;
    page-break-after: auto;
  }

  .print-header {
    flex: 0 0 24mm;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10mm;
    margin-bottom: 4mm;
    padding-bottom: 2.5mm;
    border-bottom: 2px solid #111;
  }

  .print-header strong,
  .print-header span {
    display: block;
  }

  .print-header strong {
    font-size: 15pt;
    line-height: 1.08;
  }

  .print-header span {
    margin-top: 1.4mm;
    font-size: 9.5pt;
    line-height: 1.1;
  }

  .print-card-grid {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(3, minmax(0, 1fr));
    gap: 4mm;
  }

  .print-card {
    min-height: 0;
    display: grid;
    grid-template-rows: 1fr auto auto;
    align-items: center;
    justify-items: center;
    padding: 3mm;
    border: 2px solid #111;
    break-inside: avoid;
    page-break-inside: avoid;
    overflow: hidden;
  }

  .print-card svg {
    width: 42mm;
    height: 30mm;
  }

  .print-card .picture-photo {
    width: 42mm;
    height: 30mm;
    border-radius: 2mm;
    object-fit: cover;
  }

  .print-card .text-visual {
    min-height: 30mm;
    padding: 2mm;
    border: 1px dashed #111;
    font-size: 16pt;
    line-height: 1.05;
  }

  .print-card strong {
    font-size: 23pt;
    line-height: 1;
  }

  .print-card span {
    margin-top: 1mm;
    font-size: 10pt;
  }

  .trace-sheet {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-rows: repeat(6, minmax(0, 1fr));
    gap: 3mm;
  }

  .trace-row {
    min-height: 0;
    display: grid;
    grid-template-columns: 24mm 1fr;
    gap: 4mm;
    align-items: center;
    padding: 2.5mm;
    border: 2px solid #111;
    break-inside: avoid;
    page-break-inside: avoid;
    overflow: hidden;
  }

  .trace-picture svg {
    width: 22mm;
    height: 17mm;
  }

  .trace-picture .picture-photo {
    width: 22mm;
    height: 17mm;
    border-radius: 1.5mm;
    object-fit: cover;
  }

  .trace-picture .text-visual,
  .match-sheet-picture .text-visual {
    min-height: 17mm;
    padding: 1mm;
    border: 1px dashed #111;
    font-size: 7pt;
    line-height: 1;
  }

  .trace-row strong {
    display: block;
    margin-bottom: 1mm;
    font-size: 17pt;
    line-height: 1;
  }

  .trace-word {
    color: #777;
    font-size: 21pt;
    letter-spacing: 0.04em;
    border-bottom: 1px dashed #777;
  }

  .write-lines {
    display: grid;
    gap: 3.5mm;
    margin-top: 3mm;
  }

  .write-lines span {
    height: 1px;
    border-bottom: 1px solid #111;
  }

  .match-sheet {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10mm;
  }

  .match-sheet-column {
    min-height: 0;
    display: grid;
    grid-template-rows: repeat(6, minmax(0, 1fr));
    gap: 3mm;
  }

  .match-sheet-picture,
  .match-sheet-word {
    min-height: 0;
    display: grid;
    grid-template-columns: 8mm 1fr;
    gap: 3mm;
    align-items: center;
    padding: 2.5mm;
    border: 2px solid #111;
    break-inside: avoid;
    page-break-inside: avoid;
    overflow: hidden;
  }

  .match-sheet-picture span {
    width: 7mm;
    height: 7mm;
    display: grid;
    place-items: center;
    border: 1px solid #111;
    border-radius: 50%;
    font-weight: 900;
  }

  .match-sheet-picture svg {
    width: 34mm;
    height: 19mm;
  }

  .match-sheet-picture .picture-photo {
    width: 34mm;
    height: 19mm;
    border-radius: 1.5mm;
    object-fit: cover;
  }

  .match-sheet-word {
    grid-template-columns: minmax(0, 1fr) 28mm;
  }

  .match-sheet-word strong {
    min-width: 0;
    font-size: 18pt;
    line-height: 1;
  }

  .match-sheet-word span {
    height: 1px;
    border-bottom: 2px solid #111;
  }
}
