:root {
  --bg-page: #f6efe3;
  --bg-panel: rgba(255, 251, 245, 0.92);
  --bg-panel-strong: #fffdf9;
  --bg-soft: #f3e5cf;
  --bg-accent: #d7efe5;
  --bg-inkwash: #163d36;
  --surface: #fffaf2;
  --surface-strong: #ffffff;
  --line: #d2c2a9;
  --line-strong: #8f7755;
  --ink: #1f2a24;
  --ink-soft: #4f5b54;
  --accent: #c8583d;
  --accent-strong: #8f311f;
  --accent-soft: #fbe3db;
  --green: #2b6d5f;
  --green-soft: #e0f1eb;
  --gold: #d6a43b;
  --gold-soft: #f9efd4;
  --shadow: 0 16px 40px rgba(49, 34, 18, 0.12);
  --radius-xl: 26px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(248, 214, 160, 0.28), transparent 28%),
    radial-gradient(circle at 85% 10%, rgba(95, 164, 145, 0.18), transparent 22%),
    linear-gradient(180deg, #fbf6ee 0%, #f1e7d8 100%);
  color: var(--ink);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  line-height: 1.6;
}

.skip-link {
  position: fixed;
  top: -60px;
  left: 20px;
  z-index: 30;
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--ink);
  box-shadow: var(--shadow);
  text-decoration: none;
  font-weight: 700;
}

.skip-link:focus,
.skip-link:focus-visible {
  top: 20px;
}

.bg-shape {
  position: fixed;
  z-index: -1;
  pointer-events: none;
  opacity: 0.7;
  filter: blur(4px);
}

.bg-shape-a {
  top: 40px;
  right: 40px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(214, 164, 59, 0.26), transparent 68%);
}

.bg-shape-b {
  left: -50px;
  bottom: 120px;
  width: 260px;
  height: 220px;
  border-radius: 45% 55% 50% 50%;
  background: radial-gradient(circle, rgba(43, 109, 95, 0.18), transparent 70%);
}

.bg-shape-c {
  top: 35%;
  right: 18%;
  width: 160px;
  height: 160px;
  border-radius: 60% 40% 52% 48%;
  background: radial-gradient(circle, rgba(200, 88, 61, 0.14), transparent 68%);
}

.app-shell {
  width: min(1440px, calc(100% - 28px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.panel {
  background: var(--bg-panel);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(143, 119, 85, 0.18);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.hero,
.workspace-grid {
  display: grid;
  gap: 20px;
}

.hero {
  grid-template-columns: 1.2fr 0.8fr;
  margin-bottom: 20px;
}

.hero-copy,
.hero-card,
.controls-panel,
.curriculum-panel,
.preview-panel,
.teacher-panel {
  padding: 24px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.lead {
  max-width: 60ch;
  margin-top: 8px;
  font-size: 1.03rem;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.15;
}

h1 {
  margin-bottom: 12px;
  font-size: clamp(2.8rem, 6vw, 4.4rem);
  color: var(--bg-inkwash);
}

h2 {
  font-size: clamp(1.55rem, 2.2vw, 2rem);
}

h3 {
  font-size: 1.12rem;
}

p {
  margin: 0;
}

.lead,
.heading-copy,
.curriculum-copy,
.sheet-meta-line,
.hero-note,
.editor-hint,
.muted-copy,
.plain-list,
.teacher-panel p,
.worksheet-sheet p,
.worksheet-sheet li {
  color: var(--ink-soft);
}

.hero-chip-row,
.pill-wrap,
.action-row,
.preview-actions,
.section-row,
.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-chip,
.term-badge,
.topic-chip,
.type-pill,
.curriculum-pill {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  font-weight: 700;
  color: var(--ink);
}

.term-badge {
  background: var(--green-soft);
  border-color: rgba(43, 109, 95, 0.22);
  color: var(--green);
}

.card-label {
  margin-bottom: 14px;
  font-weight: 800;
  color: var(--ink);
}

.metric-grid,
.teacher-stats,
.curriculum-grid,
.generator-form,
.editor-form {
  display: grid;
  gap: 14px;
}

.metric-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 16px;
}

.metric-grid article,
.teacher-stats article {
  padding: 16px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(250, 241, 227, 0.9));
  border: 1px solid rgba(143, 119, 85, 0.15);
}

.metric-grid strong,
.teacher-stats strong {
  display: block;
  font-size: 1.8rem;
  color: var(--accent-strong);
}

.metric-grid span,
.teacher-stats span {
  color: var(--ink-soft);
  font-weight: 700;
}

.hero-note {
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(224, 241, 235, 0.85), rgba(251, 239, 212, 0.82));
  border: 1px solid rgba(43, 109, 95, 0.14);
}

.hero-actions {
  margin-top: 18px;
}

.hero-guide {
  display: grid;
  gap: 16px;
}

.guide-list {
  margin: 0;
  padding-left: 22px;
  display: grid;
  gap: 12px;
}

.guide-list li strong {
  display: block;
  color: var(--ink);
}

.guide-list li span {
  color: var(--ink-soft);
}

.quick-tip {
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(224, 241, 235, 0.85), rgba(251, 239, 212, 0.82));
  border: 1px solid rgba(43, 109, 95, 0.14);
  color: var(--ink-soft);
}

.compact-metrics {
  margin-bottom: 0;
}

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

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

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

.compact-form {
  margin-top: 16px;
}

.field {
  display: grid;
  gap: 8px;
}

.field.wide {
  grid-column: 1 / -1;
}

.setup-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.step-chip {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(143, 119, 85, 0.18);
  color: var(--ink);
  font-weight: 700;
}

.config-card {
  display: grid;
  gap: 16px;
  padding: 18px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(247, 238, 225, 0.8));
  border: 1px solid rgba(143, 119, 85, 0.16);
}

.config-card.wide,
.summary-card,
.action-card {
  grid-column: 1 / -1;
}

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

.card-head,
.card-head-main {
  display: flex;
  gap: 12px;
  align-items: start;
}

.card-head-wrap {
  justify-content: space-between;
}

.step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 800;
}

.type-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.field span,
.type-picker legend {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--ink);
}

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

input,
select,
textarea {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid rgba(143, 119, 85, 0.28);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
}

textarea {
  resize: vertical;
  min-height: 88px;
}

input:focus,
select:focus,
textarea:focus,
button:focus {
  outline: 3px solid rgba(43, 109, 95, 0.18);
  outline-offset: 2px;
}

.type-picker {
  margin: 0;
  padding: 14px;
  border: 1px solid rgba(143, 119, 85, 0.22);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.6);
}

.type-option {
  display: flex;
  align-items: start;
  gap: 12px;
  margin: 0;
  padding: 14px;
  border-radius: var(--radius-md);
  background: rgba(243, 229, 207, 0.52);
  border: 1px solid rgba(143, 119, 85, 0.14);
  font-weight: 700;
}

.type-option input {
  width: auto;
  margin: 3px 0 0;
}

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

.type-text {
  display: grid;
  gap: 4px;
}

.type-text strong {
  color: var(--ink);
}

.type-text small {
  color: var(--ink-soft);
  font-size: 0.84rem;
  line-height: 1.4;
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.tab-btn {
  min-height: 46px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.primary-btn:hover,
.secondary-btn:hover,
.ghost-btn:hover,
.tab-btn:hover {
  transform: translateY(-1px);
}

.primary-btn {
  background: linear-gradient(135deg, var(--accent) 0%, #d9794f 100%);
  color: #ffffff;
  box-shadow: 0 10px 24px rgba(200, 88, 61, 0.22);
}

.secondary-btn {
  background: linear-gradient(135deg, var(--green) 0%, #408b7b 100%);
  color: #ffffff;
  box-shadow: 0 10px 24px rgba(43, 109, 95, 0.2);
}

.ghost-btn,
.tab-btn {
  background: rgba(255, 255, 255, 0.8);
  border-color: rgba(143, 119, 85, 0.2);
  color: var(--ink);
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.tab-btn.active {
  background: var(--gold-soft);
  border-color: rgba(214, 164, 59, 0.28);
  color: #6d4d08;
}

.small-btn {
  min-height: 38px;
  padding: 7px 14px;
}

.control-tip,
.selection-guide,
.preview-tip {
  color: var(--ink-soft);
}

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

.selection-summary article {
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(143, 119, 85, 0.14);
  background: rgba(255, 255, 255, 0.82);
}

.selection-summary span {
  display: block;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.selection-summary strong {
  display: block;
  margin-top: 6px;
  font-size: 1rem;
  color: var(--ink);
}

.selection-guide {
  font-weight: 700;
}

.warning-chip {
  background: var(--accent-soft);
  border-color: rgba(200, 88, 61, 0.24);
  color: var(--accent-strong);
}

.curriculum-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 18px;
}

.soft-card {
  padding: 18px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(247, 238, 225, 0.84));
  border: 1px solid rgba(143, 119, 85, 0.16);
}

.plain-list {
  margin: 10px 0 0;
  padding-left: 18px;
}

.workspace-grid {
  grid-template-columns: minmax(0, 1.32fr) minmax(320px, 0.78fr);
  align-items: start;
  margin-top: 20px;
}

body[data-page="teacher"] .workspace-grid {
  grid-template-columns: minmax(340px, 0.88fr) minmax(0, 1.12fr);
}

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

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

.preview-tip {
  margin-bottom: 12px;
  font-weight: 700;
}

.sheet-meta-line {
  margin-bottom: 14px;
  font-weight: 700;
}

.worksheet-sheet {
  padding: 28px;
  border-radius: 22px;
  background: var(--surface);
  border: 1px solid rgba(143, 119, 85, 0.18);
}

.sheet-header,
.answer-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
  padding-bottom: 18px;
  border-bottom: 2px solid rgba(143, 119, 85, 0.16);
}

.sheet-kicker {
  margin-bottom: 8px;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--accent-strong);
}

.sheet-title {
  margin-bottom: 10px;
  font-size: clamp(1.8rem, 3.2vw, 2.5rem);
}

.sheet-info-box {
  min-width: 240px;
  padding: 14px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(224, 241, 235, 0.8), rgba(255, 248, 236, 0.9));
  border: 1px solid rgba(43, 109, 95, 0.16);
}

.sheet-info-box p + p {
  margin-top: 8px;
}

.sheet-summary {
  margin-top: 18px;
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  background: var(--gold-soft);
  border: 1px solid rgba(214, 164, 59, 0.26);
}

.exercise-list {
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 18px;
}

.exercise-card,
.answer-card,
.list-card {
  border-radius: var(--radius-lg);
  border: 1px solid rgba(143, 119, 85, 0.18);
  background: var(--surface-strong);
  break-inside: avoid;
}

.exercise-card,
.answer-card {
  padding: 18px;
}

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

.exercise-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 800;
}

.exercise-head h3,
.answer-head h3 {
  margin-top: 6px;
}

.type-pill {
  background: var(--green-soft);
  color: var(--green);
}

.exercise-copy {
  margin-bottom: 14px;
}

.crossword-source {
  margin-bottom: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 248, 236, 0.94), rgba(255, 255, 255, 0.9));
  border: 1px solid rgba(214, 164, 59, 0.22);
}

.crossword-source-label {
  margin-bottom: 8px;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent-strong);
}

.crossword-source-text {
  color: var(--ink);
  line-height: 1.7;
}

.crossword-layout,
.board-layout {
  display: grid;
  gap: 16px;
}

.crossword-layout {
  grid-template-columns: minmax(220px, 0.9fr) minmax(240px, 1.1fr);
  align-items: start;
}

.crossword-grid {
  display: grid;
  gap: 2px;
  justify-content: start;
  align-content: start;
  padding: 12px;
  border-radius: var(--radius-lg);
  background: #efe4d0;
}

.crossword-cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 6px;
  background: #ffffff;
  border: 1px solid rgba(143, 119, 85, 0.18);
  font-weight: 800;
  text-transform: uppercase;
}

.crossword-cell.blocked {
  background: transparent;
  border-color: transparent;
}

.crossword-number {
  position: absolute;
  top: 3px;
  left: 4px;
  font-size: 0.6rem;
  font-weight: 800;
  color: var(--accent-strong);
}

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

.clue-columns ol,
.card-deck ol,
.clue-list,
.suspect-list,
.answer-list {
  margin: 10px 0 0;
  padding-left: 18px;
}

.sentence-task + .sentence-task,
.detective-box + .detective-box {
  margin-top: 16px;
}

.sentence-lead {
  font-weight: 700;
  color: var(--ink);
}

.word-bank {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.word-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 999px;
  background: var(--green-soft);
  border: 1px solid rgba(43, 109, 95, 0.16);
  color: var(--green);
  font-weight: 700;
}

.writing-lines {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.writing-lines span {
  display: block;
  border-bottom: 2px solid rgba(143, 119, 85, 0.3);
  height: 18px;
}

.detective-shell {
  padding: 16px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(251, 239, 212, 0.85), rgba(255, 255, 255, 0.92));
  border: 1px solid rgba(214, 164, 59, 0.2);
}

.test-shell,
.dice-shell,
.roleplay-shell,
.storyfill-shell {
  padding: 16px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(224, 241, 235, 0.65));
  border: 1px solid rgba(43, 109, 95, 0.14);
}

.test-list {
  margin: 14px 0 0;
  padding-left: 18px;
}

.test-item + .test-item {
  margin-top: 14px;
}

.roleplay-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.storyfill-prompts {
  display: grid;
  gap: 10px;
  margin: 14px 0;
}

.storyfill-row {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(143, 119, 85, 0.16);
}

.storyfill-answer {
  min-height: 24px;
  border-bottom: 2px dashed rgba(143, 119, 85, 0.34);
  color: var(--ink-soft);
  font-weight: 700;
}

.story-template {
  padding: 16px;
  border-radius: var(--radius-lg);
  background: rgba(255, 248, 236, 0.88);
  border: 1px solid rgba(214, 164, 59, 0.2);
  line-height: 1.9;
}

.dice-table-wrap {
  margin-top: 14px;
  overflow-x: auto;
}

.dice-table {
  width: 100%;
  min-width: 720px;
  border-collapse: separate;
  border-spacing: 0;
}

.dice-table th,
.dice-table td {
  padding: 12px;
  vertical-align: top;
  border: 1px solid rgba(143, 119, 85, 0.18);
  background: rgba(255, 255, 255, 0.9);
}

.dice-table th {
  background: rgba(224, 241, 235, 0.92);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--green);
}

.dice-table th:first-child,
.dice-table td:first-child {
  width: 88px;
}

.die-cell {
  text-align: center;
}

.die-face {
  width: 42px;
  height: 42px;
  margin: 0 auto 6px;
}

.die-face svg {
  display: block;
  width: 100%;
  height: 100%;
}

.die-value {
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--ink-soft);
}

.dice-prompt {
  line-height: 1.55;
}

.dice-cue-list {
  margin-top: 14px;
}

.story-chip {
  display: inline-flex;
  align-items: center;
  min-width: 86px;
  min-height: 28px;
  margin: 0 4px;
  padding: 2px 10px;
  border-radius: 999px;
  font-weight: 800;
}

.story-chip.blank {
  border: 1px dashed rgba(143, 119, 85, 0.34);
  background: rgba(255, 255, 255, 0.7);
  color: rgba(143, 119, 85, 0.45);
}

.story-chip.filled {
  background: var(--green-soft);
  color: var(--green);
}

.detective-story {
  margin-bottom: 14px;
  font-weight: 700;
  color: var(--ink);
}

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

.answer-box,
.case-question {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.84);
  border: 1px dashed rgba(143, 119, 85, 0.4);
}

.board-intro {
  margin-bottom: 12px;
}

.board-layout {
  grid-template-columns: minmax(280px, 0.9fr) minmax(220px, 0.8fr);
  align-items: start;
}

.board-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  padding: 12px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 243, 229, 0.92), rgba(224, 241, 235, 0.92));
}

.board-cell {
  min-height: 72px;
  padding: 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(143, 119, 85, 0.16);
}

.board-cell.challenge {
  background: rgba(251, 227, 219, 0.92);
}

.board-cell.ladder {
  background: rgba(224, 241, 235, 0.92);
}

.board-cell.snake {
  background: rgba(249, 239, 212, 0.9);
}

.board-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--bg-inkwash);
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 800;
}

.board-tag {
  display: block;
  margin-top: 8px;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--ink-soft);
}

.board-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-top: 6px;
}

.board-icon svg {
  display: block;
  width: 100%;
  height: 100%;
}

.card-deck,
.board-rules,
.answer-box-soft {
  padding: 14px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(143, 119, 85, 0.16);
}

.board-rules {
  margin-top: 12px;
}

.teacher-panel {
  position: sticky;
  top: 18px;
}

.teacher-stats {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 18px;
}

.teacher-section + .teacher-section {
  margin-top: 18px;
}

.section-row {
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.stack-list {
  display: grid;
  gap: 12px;
}

.list-card {
  padding: 14px;
  border: 1px solid rgba(143, 119, 85, 0.16);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.8);
}

.list-card.active {
  background: linear-gradient(180deg, rgba(255, 248, 236, 0.96), rgba(224, 241, 235, 0.74));
  border-color: rgba(43, 109, 95, 0.26);
}

.list-card-top {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.list-card h4 {
  margin-bottom: 8px;
}

.list-card p {
  margin-top: 4px;
}

.list-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.list-card-top .list-actions {
  margin-top: 0;
  justify-content: flex-end;
}

.compact-actions {
  margin-top: 0;
}

.mini-btn {
  min-height: 34px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(143, 119, 85, 0.2);
  background: #ffffff;
  cursor: pointer;
}

.mini-btn.active {
  border-color: rgba(43, 109, 95, 0.32);
  background: rgba(224, 241, 235, 0.94);
  color: var(--green);
}

.icon-btn {
  font-weight: 800;
}

.mini-btn.danger {
  color: var(--accent-strong);
}

.inline-editor-slot {
  margin-top: 14px;
}

.editor-dock {
  display: none;
}

.editor-section {
  padding: 18px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(243, 229, 207, 0.82));
  border: 1px solid rgba(143, 119, 85, 0.16);
}

.editor-hint {
  margin: 0;
  font-size: 0.94rem;
}

.empty-state {
  padding: 16px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.68);
  border: 1px dashed rgba(143, 119, 85, 0.32);
}

.answer-list li + li,
.plain-list li + li {
  margin-top: 8px;
}

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

.hidden {
  display: none !important;
}

.print-only {
  display: none !important;
}

.print-sheet-head {
  display: none;
}

.app-footer {
  margin-top: 20px;
  padding: 18px 22px;
  border-radius: var(--radius-xl);
  background: rgba(22, 61, 54, 0.92);
  color: rgba(255, 255, 255, 0.88);
}

.app-footer p {
  color: inherit;
}

@media (max-width: 1120px) {
  .hero,
  .workspace-grid,
  .generator-form,
  .config-grid,
  .type-grid,
  .selection-summary,
  .curriculum-grid,
  .crossword-layout,
  .board-layout,
  .detective-grid {
    grid-template-columns: 1fr;
  }

  .card-head-wrap,
  .panel-heading,
  .preview-topbar,
  .list-card-top {
    flex-direction: column;
    align-items: stretch;
  }

  .teacher-panel {
    position: static;
  }
}

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

  .hero-copy,
  .hero-card,
  .controls-panel,
  .curriculum-panel,
  .preview-panel,
  .teacher-panel,
  .worksheet-sheet {
    padding: 18px;
  }

  .metric-grid,
  .teacher-stats,
  .editor-form,
  .selection-summary {
    grid-template-columns: 1fr;
  }

  .preview-topbar,
  .sheet-header,
  .answer-header,
  .panel-heading,
  .card-head,
  .card-head-main {
    flex-direction: column;
  }

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

  .crossword-cell {
    width: 28px;
    height: 28px;
    font-size: 0.82rem;
  }
}

@page {
  size: A4;
  margin: 8mm;
}

@media print {
  html,
  body {
    width: auto;
    height: auto;
  }

  body {
    background: #ffffff;
    font-size: 10.5pt;
    line-height: 1.35;
  }

  .bg-shape,
  .no-print,
  .app-footer {
    display: none !important;
  }

  .app-shell {
    width: 100%;
    margin: 0;
    padding: 0;
  }

  .panel,
  .worksheet-sheet,
  .exercise-card,
  .answer-card {
    box-shadow: none;
    border-color: #cfcfcf;
    background: #ffffff;
  }

  .preview-panel {
    padding: 0;
    border: none;
    background: #ffffff;
  }

  .sheet-header,
  .sheet-summary,
  .answer-header {
    display: none;
  }

  .worksheet-sheet {
    padding: 0;
    border: none;
  }

  .exercise-list,
  .answer-grid {
    display: block;
    margin: 0;
    padding: 0;
  }

  .exercise-list {
    gap: 0;
  }

  .print-only {
    display: block !important;
  }

  .print-sheet-head {
    display: flex !important;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10mm;
    margin-bottom: 4mm;
    padding-bottom: 4mm;
    border-bottom: 1px solid #cfcfcf;
  }

  .print-sheet-head .sheet-title {
    margin-bottom: 4px;
    font-size: 1.28rem;
  }

  .print-sheet-head .sheet-info-box {
    min-width: 60mm;
    padding: 10px 12px;
    background: #ffffff;
    border-color: #d7d7d7;
  }

  .exercise-card,
  .answer-card {
    margin: 0;
    padding: 6mm;
    border: 1px solid #d5d5d5;
    border-radius: 0;
    page-break-after: always;
    break-after: page;
    break-inside: avoid;
  }

  .exercise-card:last-child,
  .answer-card:last-child {
    page-break-after: auto;
    break-after: auto;
  }

  .exercise-card,
  .answer-card,
  .board-grid,
  .crossword-grid,
  .dice-table-wrap,
  .storyfill-prompts,
  .detective-shell,
  .test-shell,
  .roleplay-shell,
  .storyfill-shell {
    break-inside: avoid;
  }

  .exercise-head,
  .answer-head {
    margin-bottom: 8px;
  }

  .exercise-head,
  .answer-head {
    display: none;
  }

  .exercise-head h3,
  .answer-head h3 {
    margin-top: 4px;
    font-size: 1.06rem;
  }

  .exercise-copy {
    margin-bottom: 8px;
  }

  .type-pill,
  .topic-chip,
  .term-badge {
    min-height: 28px;
    padding: 4px 9px;
    font-size: 0.75rem;
  }

  .sheet-kicker {
    margin-bottom: 4px;
    font-size: 0.78rem;
  }

  .crossword-source,
  .card-deck,
  .board-rules,
  .answer-box-soft,
  .detective-shell,
  .test-shell,
  .dice-shell,
  .roleplay-shell,
  .storyfill-shell,
  .story-template,
  .storyfill-row,
  .answer-box,
  .case-question {
    padding: 10px 12px;
  }

  .crossword-source {
    margin-bottom: 8px;
  }

  .crossword-source-text {
    line-height: 1.45;
  }

  .crossword-layout,
  .board-layout {
    gap: 10px;
  }

  .crossword-layout {
    grid-template-columns: minmax(180px, 0.88fr) minmax(0, 1.12fr);
  }

  .clue-columns {
    gap: 10px;
  }

  .clue-columns ol,
  .card-deck ol,
  .clue-list,
  .suspect-list,
  .answer-list,
  .test-list {
    margin-top: 6px;
  }

  .crossword-grid {
    padding: 8px;
    gap: 1px;
  }

  .crossword-cell {
    width: 30px;
    height: 30px;
    border: 1px solid #2f2f2f;
    border-radius: 0;
    background: #ffffff;
    font-size: 0.82rem;
  }

  .crossword-cell.blocked {
    border-color: transparent;
    background: transparent;
  }

  .crossword-number {
    color: #1f1f1f;
  }

  .word-bank {
    gap: 6px;
    margin-top: 8px;
  }

  .word-chip {
    padding: 6px 9px;
    font-size: 0.82rem;
  }

  .sentence-task + .sentence-task,
  .detective-box + .detective-box,
  .test-item + .test-item {
    margin-top: 10px;
  }

  .writing-lines {
    gap: 8px;
    margin-top: 10px;
  }

  .writing-lines span {
    height: 16px;
  }

  .detective-grid {
    gap: 10px;
  }

  .detective-story,
  .board-intro {
    margin-bottom: 8px;
  }

  .board-layout {
    grid-template-columns: minmax(0, 1.14fr) minmax(170px, 0.86fr);
  }

  .board-grid {
    padding: 8px;
    gap: 4px;
  }

  .board-cell {
    min-height: 58px;
    padding: 6px;
  }

  .board-number {
    min-width: 20px;
    height: 20px;
    font-size: 0.74rem;
  }

  .board-tag {
    margin-top: 4px;
    font-size: 0.7rem;
  }

  .board-icon {
    width: 22px;
    height: 22px;
    margin-top: 4px;
  }

  .roleplay-meta {
    margin-bottom: 8px;
  }

  .storyfill-prompts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 10px 0;
  }

  .storyfill-row {
    gap: 2px;
  }

  .storyfill-answer {
    min-height: 18px;
  }

  .story-template {
    line-height: 1.55;
  }

  .dice-table-wrap {
    margin-top: 8px;
    overflow: visible;
  }

  .board-grid,
  .board-cell,
  .board-icon svg,
  .die-face svg {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .dice-table {
    min-width: 0;
    width: 100%;
    table-layout: fixed;
    font-size: 0.74rem;
  }

  .dice-table th,
  .dice-table td {
    padding: 6px;
  }

  .dice-table th:first-child,
  .dice-table td:first-child {
    width: 58px;
  }

  .die-face {
    width: 28px;
    height: 28px;
    margin-bottom: 4px;
  }

  .die-value {
    font-size: 0.72rem;
  }

  .exercise-card--storyfill .story-template,
  .exercise-card--roleplay .board-rules,
  .exercise-card--test .test-shell,
  .exercise-card--dice .dice-shell,
  .exercise-card--board .card-deck {
    margin-top: 6px;
  }

  .exercise-card--dice {
    padding-top: 5mm;
    padding-bottom: 5mm;
  }

  .exercise-card--dice .print-sheet-head {
    margin-bottom: 3mm;
    padding-bottom: 3mm;
  }

  .exercise-card--dice > .exercise-copy {
    display: none;
  }

  .exercise-card--dice .dice-shell,
  .answer-card--dice .answer-box-soft {
    padding: 8px 10px;
  }

  .exercise-card--dice .detective-story,
  .answer-card--dice .detective-story,
  .exercise-card--dice .board-rules {
    margin-bottom: 6px;
    font-size: 0.78rem;
    line-height: 1.28;
  }

  .exercise-card--dice .dice-table-wrap,
  .answer-card--dice .dice-table-wrap {
    margin-top: 6px;
  }

  .exercise-card--dice .dice-table,
  .answer-card--dice .dice-table {
    font-size: 0.68rem;
  }

  .exercise-card--dice .dice-table th,
  .exercise-card--dice .dice-table td,
  .answer-card--dice .dice-table th,
  .answer-card--dice .dice-table td {
    padding: 4px;
  }

  .exercise-card--dice .dice-table th:first-child,
  .exercise-card--dice .dice-table td:first-child,
  .answer-card--dice .dice-table th:first-child,
  .answer-card--dice .dice-table td:first-child {
    width: 48px;
  }

  .exercise-card--dice .die-face,
  .answer-card--dice .die-face {
    width: 22px;
    height: 22px;
    margin-bottom: 2px;
  }

  .exercise-card--dice .die-value,
  .answer-card--dice .die-value {
    font-size: 0.64rem;
  }

  .exercise-card--dice .dice-prompt,
  .answer-card--dice .dice-prompt {
    line-height: 1.18;
  }
}
