@font-face {
  font-family: "WorksheetBody";
  src: url("/static/fonts/omyu-pretty.ttf") format("truetype");
  font-weight: 300 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --font-body: "WorksheetBody", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --game-blue: #0066cc;
  --game-blue-focus: #0071e3;
  --game-ink: #1d1d1f;
  --game-muted: #747478;
  --game-page: #f5f5f7;
  --game-canvas: #ffffff;
  --game-pearl: #fafafc;
  --game-line: #e0e0e0;
  --game-pill: 9999px;
  --accent: #7d65c1;
  --accent-soft: #f0ecff;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--game-ink);
  font-family: var(--font-body);
  background: var(--game-page);
}

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

button {
  cursor: pointer;
}

.app-shell {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 14px 0 72px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.9fr);
  gap: 22px;
  margin-bottom: 24px;
}

.hero__copy,
.hero__status,
.panel,
.worksheet-page,
.answer-page,
.empty-state {
  border: 1px solid var(--game-line);
  border-radius: 24px;
  background: var(--game-canvas);
}

.hero__copy {
  padding: 28px 30px;
}

.hero__copy h1,
.panel-heading h2,
.empty-state h3 {
  margin: 0;
  color: var(--game-ink);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.hero__copy h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.04;
}

.hero__copy > p {
  max-width: 58ch;
  margin: 16px 0 0;
  color: var(--game-muted);
  line-height: 1.72;
}

.seo-intro {
  margin-top: 14px;
}

.seo-intro h2 {
  margin: 0;
  color: var(--game-muted);
  font-size: 1.02rem;
  font-weight: 800;
}

.seo-intro p {
  margin: 6px 0 0;
  color: var(--game-muted);
  font-size: 0.92rem;
  line-height: 1.6;
}

.eyebrow,
.step-label {
  margin: 0 0 10px;
  color: var(--game-muted);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.hero__actions,
.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.hero__actions {
  margin-top: 20px;
}

.hero__status {
  padding: 24px;
}

.hero__status strong {
  display: block;
  font-size: 1.35rem;
  font-weight: 800;
}

.hero__status span {
  display: block;
  margin-top: 8px;
  color: var(--game-muted);
  line-height: 1.6;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 20px;
  border: 1px solid var(--game-line);
  border-radius: var(--game-pill);
  color: var(--game-ink);
  background: var(--game-canvas);
  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.button:hover:not(:disabled) {
  color: var(--game-blue);
  border-color: var(--game-blue);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.button--primary {
  color: #ffffff;
  border-color: var(--game-blue);
  background: var(--game-blue);
}

.button--primary:hover:not(:disabled) {
  color: #ffffff;
  background: var(--game-blue-focus);
}

.layout {
  display: grid;
  grid-template-columns: minmax(340px, 430px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.panel {
  padding: 24px;
}

.panel-heading {
  margin-bottom: 16px;
}

.preview-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.summary {
  margin: 0;
  color: var(--game-muted);
  font-size: 0.95rem;
}

.maker-form {
  display: grid;
  gap: 16px;
}

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

.field > span {
  font-size: 0.95rem;
  font-weight: 800;
}

.field input,
.field select,
.field textarea {
  padding: 12px 14px;
  border: 1px solid var(--game-line);
  border-radius: 14px;
  color: var(--game-ink);
  background: var(--game-pearl);
}

.field textarea {
  min-height: 190px;
  resize: vertical;
  line-height: 1.6;
}

.field-hint {
  color: var(--game-muted);
  font-size: 0.85rem;
  line-height: 1.5;
}

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

.option-card {
  margin: 0;
  padding: 14px 16px 16px;
  border: 1px solid var(--game-line);
  border-radius: 18px;
  background: var(--game-pearl);
}

.option-card legend {
  padding: 0 6px;
  font-size: 0.95rem;
  font-weight: 800;
}

.toggle-stack {
  display: grid;
  gap: 10px;
}

.toggle-stack label {
  display: flex;
  align-items: center;
  gap: 10px;
  line-height: 1.5;
}

.feedback {
  min-height: 1.4em;
  margin: 0;
  color: var(--game-muted);
  line-height: 1.55;
}

.feedback.is-success {
  color: #167044;
}

.feedback.is-error {
  color: #b3261e;
}

.empty-state {
  display: grid;
  place-content: center;
  gap: 8px;
  min-height: 260px;
  padding: 24px;
  text-align: center;
  background: var(--game-pearl);
}

.empty-state h3 {
  font-size: 1.25rem;
}

.empty-state p {
  margin: 0;
  color: var(--game-muted);
  line-height: 1.6;
}

.empty-state[hidden] {
  display: none !important;
}

.print-area {
  display: grid;
  gap: 22px;
}

.worksheet-page,
.answer-page {
  padding: 26px 28px 30px;
}

.worksheet-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 2px solid var(--game-ink);
}

.worksheet-title {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.worksheet-name {
  color: var(--game-muted);
  white-space: nowrap;
}

.worksheet-guide {
  margin: 0 0 16px;
  color: var(--game-muted);
  line-height: 1.5;
}

.sentence-list {
  display: grid;
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.sentence-item {
  padding: 14px 16px;
  border: 1px solid var(--game-line);
  border-radius: 16px;
  break-inside: avoid;
}

.sentence-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-right: 6px;
  border-radius: 50%;
  color: #ffffff;
  background: var(--accent);
  font-weight: 800;
}

.word-cards {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 7px;
  vertical-align: middle;
}

.word-card {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 5px 11px;
  border: 1.5px solid #c9c9d0;
  border-radius: 10px;
  background: #ffffff;
  font-weight: 800;
  line-height: 1.25;
}

.word-card--hint {
  color: #5f49a4;
  border-color: #9e8bd1;
  background: var(--accent-soft);
}

.card-size--large .word-card {
  font-size: 1.25rem;
}

.card-size--medium .word-card {
  font-size: 1.08rem;
}

.card-size--small .word-card {
  font-size: 0.94rem;
}

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

.writing-line {
  height: 25px;
  border-bottom: 1.5px solid #9a9aa2;
}

.answer-page {
  background: #fffefa;
}

.answer-list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.answer-item {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 8px;
  align-items: start;
  padding: 10px 12px;
  border-bottom: 1px solid var(--game-line);
  font-size: 1.08rem;
  line-height: 1.55;
}

.answer-item strong {
  color: var(--accent);
}

@media (max-width: 980px) {
  .hero,
  .layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .app-shell {
    width: min(100% - 20px, 1240px);
  }

  .hero__copy,
  .hero__status,
  .panel {
    padding: 20px;
  }

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

  .worksheet-page,
  .answer-page {
    padding: 20px;
  }

  .worksheet-head {
    align-items: flex-start;
    flex-direction: column;
  }
}

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

  body {
    margin: 0;
    background: #ffffff;
  }

  .hero,
  .controls-panel,
  .preview-heading,
  .empty-state {
    display: none !important;
  }

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

  .layout {
    display: block;
  }

  .preview-panel {
    padding: 0;
    border: 0;
    background: transparent;
  }

  .print-area {
    gap: 0;
  }

  .worksheet-page,
  .answer-page {
    min-height: 270mm;
    padding: 0;
    border: 0;
    border-radius: 0;
    page-break-after: always;
  }

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

  .sentence-item {
    border-color: #c9c9cf;
  }
}
