@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;
  --trace-guide: #c5c5cc;
  --trace-cross: #ececf1;
  --success-soft: #edf8f1;
  --error-soft: #fdeeee;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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,
.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-family: var(--font-body);
  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);
  font-size: 1rem;
  line-height: 1.72;
}

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

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

.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-weight: 800;
  font-size: 0.95rem;
}

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

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

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

.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-weight: 800;
  font-size: 0.95rem;
}

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

.toggle-stack label {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--game-ink);
  line-height: 1.5;
}

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

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

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

.empty-state {
  display: grid;
  gap: 8px;
  place-content: center;
  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;
}

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

/* --- 따라쓰기 활동지 --- */

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

.worksheet-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 12px;
  margin-bottom: 18px;
  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);
  font-size: 1rem;
  white-space: nowrap;
}

.trace-rows {
  display: grid;
  gap: 12px;
}

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

.trace-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 2em;
  padding: 0.18em 0.1em;
  border: 1.5px solid var(--game-line);
  border-radius: 12px;
  background: #ffffff;
  font-weight: 800;
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
}

.trace-cell--model {
  color: var(--game-ink);
  border-color: #bdbdc4;
  background: var(--game-pearl);
}

.trace-cell--guide {
  color: var(--trace-guide);
}

.trace-cell--blank {
  color: transparent;
}

.trace-cell--cross {
  background-image:
    linear-gradient(to bottom, transparent calc(50% - 0.75px), var(--trace-cross) calc(50% - 0.75px), var(--trace-cross) calc(50% + 0.75px), transparent calc(50% + 0.75px)),
    linear-gradient(to right, transparent calc(50% - 0.75px), var(--trace-cross) calc(50% - 0.75px), var(--trace-cross) calc(50% + 0.75px), transparent calc(50% + 0.75px));
}

.trace-size--large .trace-cell {
  font-size: 44px;
}

.trace-size--medium .trace-cell {
  font-size: 34px;
}

.trace-size--small .trace-cell {
  font-size: 26px;
}

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

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

@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;
    box-shadow: none;
    background: transparent;
  }

  .print-area {
    gap: 0;
  }

  .worksheet-page {
    border: 0;
    border-radius: 0;
    padding: 0 0 18px;
    page-break-after: always;
  }

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

  .trace-cell {
    border-color: #c9c9cf;
  }
}
