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

@font-face {
  font-family: "WorksheetDisplay";
  src: url("/static/fonts/Griun_Mongtori-Rg.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --font-body: "WorksheetBody", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --font-display: "WorksheetDisplay", "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;
  --maze-wall: #374151;
  --maze-start: #22c55e;
  --maze-goal: #f59e0b;
}

* {
  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 {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.hero {
  display: block;
  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);
  box-shadow: none;
}

.hero__copy {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 68px;
  padding: 12px 18px;
}

.eyebrow,
.hero__copy p,
.hero__status {
  display: none;
}

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

.hero__copy h1 {
  flex: 1 1 auto;
  font-size: clamp(1.15rem, 2.4vw, 1.45rem);
}

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

.hero__actions {
  margin: 0;
}

.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);
  box-shadow: none;
  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, 420px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.panel,
.preview-panel {
  padding: 28px;
}

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

.panel-heading h2 {
  font-size: clamp(1.5rem, 3vw, 2.2rem);
}

.preview-heading {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
}

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

.summary,
.empty-state p,
.worksheet-meta {
  color: var(--game-muted);
}

.summary {
  max-width: 28ch;
  margin: 4px 0 0;
  font-size: 0.95rem;
  text-align: right;
}

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

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

.field span,
.option-card legend {
  font-weight: 800;
}

.field input {
  width: 100%;
  min-height: 64px;
  padding: 0 16px;
  border: 1px solid var(--game-line);
  border-radius: 18px;
  background: var(--game-pearl);
  color: var(--game-ink);
  outline: none;
}

.field input:focus {
  border-color: var(--game-blue);
  box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.12);
}

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

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

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

.toggle-stack label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--game-line);
  border-radius: var(--game-pill);
  background: var(--game-canvas);
  color: var(--game-muted);
  font-weight: 700;
}

.toggle-stack input {
  width: 18px;
  height: 18px;
  accent-color: var(--game-blue);
}

.feedback {
  min-height: 24px;
  margin: 0;
  color: var(--game-muted);
  font-weight: 800;
}

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

.feedback.is-success {
  color: var(--game-blue);
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 420px;
  padding: 36px;
  border-style: dashed;
  text-align: center;
}

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

.empty-state p {
  max-width: 42ch;
  margin: 12px 0 0;
  line-height: 1.65;
}

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

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

.worksheet-header {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--game-line);
}

.worksheet-title {
  font-size: clamp(1.8rem, 4vw, 3rem);
}

.worksheet-meta {
  margin: 8px 0 0;
  font-size: 0.95rem;
}

.name-line {
  width: min(100%, 240px);
  padding: 10px 14px;
  border-bottom: 1px solid var(--game-line);
  text-align: left;
  font-weight: 700;
}

.maze-sheet {
  display: grid;
  gap: 16px;
}

.maze-board {
  border: 1px solid var(--game-line);
  border-radius: 24px;
  background: #ffffff;
  overflow: hidden;
}

.maze-svg {
  display: block;
  width: 100%;
  height: auto;
  shape-rendering: crispEdges;
}

.maze-bg {
  fill: #ffffff;
}

.maze-frame {
  fill: #fafafc;
  stroke: #e5e7eb;
  stroke-width: 1.5;
}

.maze-wall {
  fill: var(--maze-wall);
  shape-rendering: crispEdges;
}

.maze-solution {
  fill: none;
  stroke: var(--game-blue);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-opacity: 0.85;
}

.maze-start {
  fill: var(--maze-start);
}

.maze-goal {
  fill: var(--maze-goal);
}

.maze-label {
  fill: #4b5563;
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 800;
}

.maze-caption {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.maze-pill {
  padding: 6px 12px;
  border-radius: var(--game-pill);
  font-weight: 800;
}

.maze-pill--start {
  color: #166534;
  background: #dcfce7;
}

.maze-pill--goal {
  color: #92400e;
  background: #fef3c7;
}

.maze-arrow {
  color: var(--game-muted);
  font-weight: 800;
}

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

  .summary {
    text-align: left;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 16px;
  }

  .hero__copy,
  .panel,
  .worksheet-page,
  .answer-page,
  .empty-state {
    padding: 20px;
  }

  .field-grid,
  .preview-heading {
    display: grid;
    grid-template-columns: 1fr;
  }

  .name-line {
    width: 100%;
    text-align: left;
  }
}

@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 {
    page-break-after: always;
    width: 184mm;
    min-height: 260mm;
    margin: 0 auto;
    padding: 6.5mm 6mm;
    box-sizing: border-box;
    border: 0;
    border-radius: 0;
  }

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

/* Key mode and word map */
.field textarea {
  width: 100%;
  min-height: 156px;
  padding: 12px 14px;
  border: 1px solid var(--game-line);
  border-radius: 14px;
  background: var(--game-canvas);
  color: var(--game-ink);
  outline: none;
  resize: vertical;
  line-height: 1.6;
}

.field textarea:focus {
  border-color: var(--game-blue);
  box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.12);
}

.key-words-wrap {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--game-line);
}

.inline-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  margin-top: 10px;
  padding: 8px 12px;
  border: 1px solid var(--game-line);
  border-radius: var(--game-pill);
  background: var(--game-canvas);
  color: var(--game-muted);
  font-weight: 700;
}

.inline-toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--game-blue);
}

.maze-key {
  pointer-events: none;
}


.key-map-sheet {
  border: 1px solid var(--game-line);
  border-radius: 22px;
  background: #ffffff;
  padding: 22px;
}

.key-map-sheet__guide {
  margin: 0 0 16px;
  color: var(--game-muted);
  line-height: 1.7;
}

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

.key-map-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) minmax(220px, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 0 14px;
  border: 1px solid var(--game-line);
  border-radius: 14px;
  background: var(--game-pearl);
}

.key-map-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 2px solid var(--key-stroke);
  color: #1f2937;
  font-size: 0.86rem;
  font-weight: 800;
  background: var(--key-fill);
}

.key-map-word {
  color: var(--game-ink);
  font-size: 1.02rem;
  font-weight: 700;
}

.key-map-blank {
  display: block;
  width: 100%;
  min-height: 34px;
  border-bottom: 2px solid #b8c0cb;
}

.key-map-row--compact {
  grid-template-columns: 44px minmax(0, 1fr);
}




