:root {
  color-scheme: light;
  --bg: #fff8ee;
  --surface: #ffffff;
  --surface-warm: #fff1d6;
  --ink: #1d2433;
  --muted: #667085;
  --border: #eadfcd;
  --primary: #ed7b2d;
  --primary-dark: #a9430d;
  --blue: #2563eb;
  --blue-soft: #eaf2ff;
  --up: #eb5d5d;
  --down: #2563eb;
  --gold: #ffbe3d;
  --shadow: 0 18px 48px rgba(91, 62, 20, 0.11);
  --radius-lg: 28px;
  --radius-md: 20px;
  font-family: Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; background: var(--bg); }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--ink); font-size: 16px; line-height: 1.65; overflow-x: hidden; }
button { font: inherit; }
button, summary { touch-action: manipulation; }
button:focus-visible, summary:focus-visible, a:focus-visible { outline: 3px solid rgba(37, 99, 235, 0.45); outline-offset: 3px; }
svg { display: block; }
.skip-link { position: fixed; left: 16px; top: -80px; z-index: 999; padding: 12px 16px; border-radius: 12px; background: var(--ink); color: white; font-weight: 800; }
.skip-link:focus { top: 16px; }

.app-header { max-width: 1120px; margin: 0 auto; padding: calc(20px + env(safe-area-inset-top)) 28px 18px; display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 48px; height: 56px; flex: 0 0 auto; }
.brand-flame, .teacher-glow { fill: var(--gold); stroke: #dc7c12; stroke-width: 2; }
.brand-wax, .teacher-body { fill: #fff8df; stroke: #d9b873; stroke-width: 2; }
.brand-face, .teacher-face { fill: none; stroke: #392d24; stroke-width: 2.5; stroke-linecap: round; }
.app-header h1 { margin: 0; font-size: 21px; line-height: 1.25; letter-spacing: -0.03em; }
.eyebrow { margin: 0 0 4px; color: var(--primary-dark); font-size: 12px; line-height: 1.4; font-weight: 900; letter-spacing: 0.06em; text-transform: uppercase; }
main { max-width: 1120px; margin: 0 auto; padding: 0 28px 80px; }

.hero { display: grid; grid-template-columns: 1.08fr 0.92fr; gap: 28px; align-items: stretch; border-radius: 36px; padding: 56px; background: linear-gradient(140deg, #fff1d2 0%, #fffaf1 58%, #eaf2ff 100%); border: 1px solid #f0dfbd; box-shadow: var(--shadow); overflow: hidden; position: relative; }
.hero::after { content: ""; position: absolute; width: 260px; height: 260px; border-radius: 50%; right: -110px; top: -100px; background: rgba(255, 190, 61, 0.23); }
.hero-copy { position: relative; z-index: 1; align-self: center; max-width: 540px; }
.badge { display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 7px 12px; border-radius: 999px; color: #8b4a09; background: rgba(255,255,255,.76); border: 1px solid #efcf9c; font-size: 13px; font-weight: 800; }
.badge svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.hero h2 { margin: 22px 0 14px; font-size: clamp(42px, 5vw, 66px); line-height: 1.08; letter-spacing: -0.06em; }
.hero h2 em { color: var(--primary-dark); font-style: normal; }
.hero-copy > p { max-width: 490px; margin: 0 0 28px; color: #4e5667; font-size: 18px; }
.primary-action, .secondary-action { min-height: 52px; border: 0; border-radius: 16px; padding: 0 22px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; font-weight: 900; transition: background-color .18s ease, box-shadow .18s ease, transform .18s ease; }
.primary-action { background: var(--ink); color: white; box-shadow: 0 9px 20px rgba(29, 36, 51, .18); }
.primary-action:hover { background: #333d52; }
.primary-action:active, .secondary-action:active, .lesson-card:active, .quiz-option:active { transform: scale(.98); }
.primary-action svg, .secondary-action svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.hero-card { position: relative; z-index: 1; display: grid; grid-template-columns: .75fr 1.25fr; align-items: center; gap: 22px; min-height: 344px; padding: 28px; border-radius: 30px; background: rgba(255,255,255,.86); border: 1px solid rgba(255,255,255,.95); box-shadow: 0 16px 40px rgba(63, 52, 34, .09); }
.teacher svg { width: 100%; max-height: 220px; filter: drop-shadow(0 14px 18px rgba(104, 67, 18, .15)); }
.teacher-wick { stroke: #49311c; stroke-width: 4; stroke-linecap: round; }
.teacher-drip { fill: none; stroke: #e5cd9e; stroke-width: 5; stroke-linecap: round; }
.teacher-face { stroke-width: 4; }
.teacher-cheek { fill: #ef9aa6; opacity: .5; }
.hero-card ol { margin: 0; padding: 0; display: grid; gap: 15px; list-style: none; }
.hero-card li { display: flex; align-items: center; gap: 12px; }
.hero-card li > span { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; flex: 0 0 auto; background: var(--surface-warm); color: var(--primary-dark); font-weight: 900; }
.hero-card b, .hero-card small { display: block; }
.hero-card b { font-size: 15px; }
.hero-card small { color: var(--muted); font-size: 12px; line-height: 1.4; }

.curriculum, .glossary { padding: 72px 8px 0; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 20px; }
.section-heading h2 { margin: 0; font-size: 32px; line-height: 1.2; letter-spacing: -0.04em; }
.progress-copy { display: flex; align-items: baseline; gap: 8px; }
.progress-copy b { font-size: 24px; }
.progress-copy span { color: var(--muted); font-size: 13px; }
.progress-track { height: 9px; margin-bottom: 22px; background: #ece4d8; border-radius: 999px; overflow: hidden; }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary), var(--gold)); transition: width .3s ease; }
.lesson-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.lesson-card { min-height: 180px; border: 1px solid var(--border); border-radius: var(--radius-md); padding: 20px; background: var(--surface); color: var(--ink); text-align: left; cursor: pointer; position: relative; transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease; }
.lesson-card:hover, .lesson-card.active { border-color: #f0a066; box-shadow: 0 10px 24px rgba(91, 62, 20, .09); }
.lesson-card.active { background: #fffaf1; }
.lesson-card.done::after { content: "완료"; position: absolute; right: 15px; top: 15px; padding: 3px 8px; border-radius: 999px; background: #eaf7ec; color: #247334; font-size: 11px; font-weight: 900; }
.lesson-card .lesson-no { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 13px; background: var(--surface-warm); color: var(--primary-dark); font-weight: 900; }
.lesson-card h3 { margin: 26px 0 6px; font-size: 18px; line-height: 1.3; }
.lesson-card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }

.classroom { margin-top: 76px; padding: 38px; border: 1px solid var(--border); border-radius: 32px; background: #fffdf9; box-shadow: var(--shadow); scroll-margin-top: 20px; }
.classroom-top { display: flex; justify-content: space-between; gap: 28px; margin-bottom: 24px; }
.classroom-top h2 { margin: 0; font-size: 34px; letter-spacing: -0.04em; }
.classroom-top > div:first-child > p:last-child { margin: 8px 0 0; color: var(--muted); max-width: 600px; }
.lesson-picker { display: flex; gap: 8px; align-self: start; }
.lesson-picker button { width: 46px; height: 46px; border: 1px solid var(--border); border-radius: 14px; background: white; color: var(--muted); cursor: pointer; font-weight: 900; }
.lesson-picker button[aria-selected="true"] { border-color: var(--primary); background: var(--surface-warm); color: var(--primary-dark); }
.chart-card { border: 1px solid #e4e8ef; border-radius: 24px; padding: 24px; background: var(--surface); overflow: hidden; }
.chart-head { display: flex; justify-content: space-between; align-items: start; gap: 16px; margin-bottom: 14px; }
.data-label { display: inline-block; color: #1d5dc2; background: var(--blue-soft); border-radius: 8px; padding: 4px 8px; font-size: 11px; font-weight: 900; }
.chart-head h3 { margin: 7px 0 0; font-size: 19px; }
.legend { display: flex; flex-wrap: wrap; justify-content: end; gap: 10px; color: var(--muted); font-size: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 14px; height: 8px; border-radius: 3px; background: var(--up); }
.legend .down { background: var(--down); }
.legend .line { width: 17px; height: 3px; border-radius: 999px; background: var(--gold); }
.canvas-wrap { position: relative; height: 360px; border-radius: 16px; overflow: hidden; background: #fbfcfe; }
canvas { display: block; width: 100%; height: 100%; }
.indicator-panel { margin-top: 14px; display: grid; grid-template-columns: 150px 1fr; min-height: 110px; align-items: center; gap: 20px; padding: 14px 18px; border-radius: 16px; background: #f5f8fd; }
.indicator-copy b, .indicator-copy span { display: block; }
.indicator-copy b { font-size: 14px; }
.indicator-copy span { color: var(--muted); font-size: 12px; }
.indicator-panel canvas { height: 82px; }
.data-table-wrap { margin-top: 14px; }
.data-table-wrap summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; color: #4a5365; font-size: 13px; font-weight: 800; }
.table-scroll { overflow-x: auto; }
table { width: 100%; min-width: 520px; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 13px; }
th, td { padding: 10px; border-bottom: 1px solid #e9edf3; text-align: right; }
th:first-child, td:first-child { text-align: left; }
th { color: var(--muted); }
.drawing-lab { margin-top: 18px; padding: 24px; border: 1px solid #edc87d; border-radius: 24px; background: linear-gradient(145deg, #fff9e9, #fff3cf); overflow: hidden; }
.drawing-copy { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; }
.drawing-copy .card-kicker { margin: 0 0 2px; }
.drawing-copy h3 { margin: 0; font-size: 21px; line-height: 1.35; }
.drawing-copy p:last-child { margin: 4px 0 0; color: #695b42; font-size: 14px; }
.draw-icon { color: #9c540d; }
.drawing-badge { padding: 6px 10px; border-radius: 999px; background: #fff; color: #8d561b; font-size: 12px; font-weight: 900; white-space: nowrap; }
.drawing-lab.success { border-color: #73b47e; background: linear-gradient(145deg, #f4fff4, #e8f7e9); }
.drawing-lab.success .drawing-badge { background: #28783a; color: white; }
.drawing-board { position: relative; height: 250px; margin-top: 18px; border: 1px solid #ebd8ae; border-radius: 18px; overflow: hidden; background: #fffdf7; touch-action: none; cursor: crosshair; }
.drawing-board canvas { position: relative; z-index: 1; }
.drawing-board.drawing { box-shadow: inset 0 0 0 3px rgba(237, 123, 45, .22); }
.drawing-guide { position: absolute; left: 50%; bottom: 12px; z-index: 2; transform: translateX(-50%); padding: 6px 10px; border-radius: 999px; background: rgba(29, 36, 51, .82); color: white; font-size: 11px; white-space: nowrap; pointer-events: none; transition: opacity .18s ease; }
.drawing-board.has-line .drawing-guide { opacity: 0; }
.drawing-status { min-height: 24px; margin: 12px 0 0; color: #65583e; font-size: 14px; font-weight: 750; }
.drawing-actions { display: grid; grid-template-columns: auto auto minmax(150px, 1fr); gap: 10px; margin-top: 12px; }
.drawing-actions button { min-height: 48px; padding: 10px 16px; border-radius: 14px; cursor: pointer; }
.drawing-check:disabled { opacity: .45; cursor: default; }
.drawing-assist.active { border-color: var(--primary); background: #fff6e9; color: var(--primary-dark); }

.learning-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 18px; }
.observe-card, .quiz-card { border-radius: 22px; padding: 26px; }
.observe-card { background: #fff3dc; border: 1px solid #f0d19c; }
.quiz-card { background: #eef4ff; border: 1px solid #cbdafa; }
.card-icon { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; background: white; color: var(--primary-dark); }
.card-icon.blue { color: var(--blue); }
.card-icon svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.card-kicker { margin: 14px 0 4px; color: var(--primary-dark); font-size: 12px; font-weight: 900; }
.quiz-card .card-kicker { color: #174ca9; }
.observe-card h3, .quiz-card h3 { margin: 0 0 8px; font-size: 21px; line-height: 1.35; }
.observe-card > p:not(.card-kicker) { color: #665536; }
.observe-card ul { margin: 16px 0 0; padding: 0; display: grid; gap: 9px; list-style: none; }
.observe-card li { padding-left: 18px; position: relative; font-size: 14px; }
.observe-card li::before { content: ""; width: 7px; height: 7px; border-radius: 50%; position: absolute; left: 0; top: .68em; background: var(--primary); }
.quiz-options { display: grid; gap: 9px; margin-top: 18px; }
.quiz-option { min-height: 48px; border: 1px solid #c8d5ef; border-radius: 13px; padding: 10px 14px; background: white; color: var(--ink); cursor: pointer; text-align: left; font-weight: 750; transition: border-color .18s ease, background-color .18s ease, transform .18s ease; }
.quiz-option:hover { border-color: var(--blue); }
.quiz-option.correct { border-color: #47a85b; background: #edf9ef; color: #1e6c2d; }
.quiz-option.wrong { border-color: #d85656; background: #fff0f0; color: #943131; }
.quiz-feedback { margin-top: 12px; border-radius: 12px; padding: 12px 14px; background: white; font-size: 14px; }
.lesson-actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 22px; }
.secondary-action { border: 1px solid var(--border); background: white; color: #4c5567; box-shadow: none; }
.secondary-action:disabled { opacity: .4; cursor: default; }
.primary-action.compact { min-width: 150px; }

.glossary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.glossary-card { border: 1px solid var(--border); border-radius: 18px; background: var(--surface); overflow: hidden; }
.glossary-card summary { min-height: 66px; padding: 16px 18px; display: flex; align-items: center; justify-content: space-between; gap: 10px; cursor: pointer; font-weight: 900; list-style: none; }
.glossary-card summary::-webkit-details-marker { display: none; }
.glossary-card summary::after { content: "+"; color: var(--primary-dark); font-size: 22px; }
.glossary-card[open] summary::after { content: "−"; }
.glossary-card p { margin: 0; padding: 0 18px 18px; color: var(--muted); font-size: 14px; }
.safety-note { margin: 60px 8px 0; display: flex; align-items: start; gap: 14px; padding: 20px; border-radius: 18px; background: #eff8f1; border: 1px solid #cfe7d4; }
.safety-note svg { width: 28px; height: 28px; flex: 0 0 auto; fill: none; stroke: #28783a; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.safety-note b { color: #205f2d; }
.safety-note p { margin: 3px 0 0; color: #4f6d55; font-size: 14px; }
footer { min-height: 100px; padding: 28px max(28px, env(safe-area-inset-right)) calc(28px + env(safe-area-inset-bottom)) max(28px, env(safe-area-inset-left)); display: flex; justify-content: center; align-items: center; gap: 10px; background: #f5ead8; color: #6d5b42; }
footer span { font-weight: 900; }
footer small { color: #8f7c61; }

@media (max-width: 850px) {
  .hero { grid-template-columns: 1fr; padding: 38px; }
  .hero-card { min-height: auto; }
  .lesson-grid, .glossary-grid { grid-template-columns: 1fr 1fr; }
  .classroom-top { display: block; }
  .lesson-picker { margin-top: 18px; }
}

@media (max-width: 560px) {
  .app-header { padding-left: 18px; padding-right: 18px; }
  main { padding: 0 16px 56px; }
  .hero { margin: 0 -2px; padding: 28px 20px; border-radius: 26px; }
  .hero h2 { font-size: 42px; }
  .hero-copy > p { font-size: 16px; }
  .primary-action { width: 100%; }
  .hero-card { grid-template-columns: 112px 1fr; gap: 8px; padding: 18px 14px; border-radius: 22px; }
  .teacher svg { max-height: 166px; }
  .hero-card li { gap: 8px; }
  .hero-card li > span { width: 31px; height: 31px; }
  .hero-card small { font-size: 11px; }
  .curriculum, .glossary { padding-top: 52px; }
  .section-heading h2 { font-size: 27px; }
  .progress-copy { display: block; text-align: right; }
  .progress-copy b, .progress-copy span { display: block; }
  .progress-copy b { font-size: 19px; }
  .lesson-grid, .glossary-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .lesson-card { min-height: 158px; padding: 16px; }
  .lesson-card h3 { margin-top: 20px; font-size: 16px; }
  .classroom { margin-left: -2px; margin-right: -2px; margin-top: 58px; padding: 22px 14px; border-radius: 26px; }
  .classroom-top { padding: 0 4px; }
  .classroom-top h2 { font-size: 29px; }
  .lesson-picker { width: 100%; }
  .lesson-picker button { flex: 1; min-width: 44px; }
  .chart-card { padding: 16px 10px; border-radius: 18px; }
  .chart-head { display: block; padding: 0 6px; }
  .legend { justify-content: start; margin-top: 12px; }
  .canvas-wrap { height: 290px; }
  .indicator-panel { grid-template-columns: 1fr; gap: 4px; }
  .indicator-copy b, .indicator-copy span { display: inline; margin-right: 6px; }
  .drawing-lab { padding: 18px 12px; border-radius: 20px; }
  .drawing-copy { grid-template-columns: auto 1fr; padding: 0 4px; }
  .drawing-badge { grid-column: 2; justify-self: start; }
  .drawing-board { height: 230px; }
  .drawing-actions { grid-template-columns: 1fr 1fr; }
  .drawing-check { grid-column: 1 / -1; }
  .learning-grid { grid-template-columns: 1fr; }
  .observe-card, .quiz-card { padding: 22px; }
  .lesson-actions .primary-action, .lesson-actions .secondary-action { width: auto; flex: 1; padding-left: 12px; padding-right: 12px; }
  footer { display: grid; text-align: center; gap: 0; }
}

@media (max-width: 370px) {
  .hero h2 { font-size: 36px; }
  .hero-card { grid-template-columns: 88px 1fr; }
  .lesson-grid, .glossary-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
