:root {
  --ink: #27333f;
  --muted: #87919b;
  --soft-muted: #aab2b8;
  --line: #e9edf0;
  --surface: #ffffff;
  --canvas: #fffefa;
  --accent: #6958d9;
  --accent-dark: #5544c4;
  --mint: #73d8bd;
  --cream: #f7f8fc;
  --shadow: 0 22px 55px rgba(56, 66, 91, .08);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
/* 펜으로 빠르게 쓰면 브라우저가 더블클릭으로 보고 둘레의 글자를 잡아 버립니다.
   태블릿 앱에서 글자를 드래그해 고를 일은 없으므로 입력칸만 남기고 막습니다. */
body { margin: 0; color: var(--ink); background: #eef0f6; font-family: "Manrope", "Apple SD Gothic Neo", sans-serif; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
input, textarea { -webkit-user-select: text; user-select: text; }
button, input { font: inherit; }
button { border: 0; cursor: pointer; }
.app-shell { min-height: 100vh; background: var(--cream); }
.topbar { height: 80px; padding: 0 38px; background: rgba(255,255,255,.92); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); min-width: 250px; }
/* 로고는 brand.js 가 그립니다. 여기서는 자리와 그림자만 잡습니다 */
.brand-mark { width: 38px; height: 38px; border-radius: 13px; display: grid; place-items: center; overflow: hidden; box-shadow: 0 7px 16px rgba(75,60,174,.3); }
.brand-mark svg { display: block; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 16px; letter-spacing: -.04em; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 10px; font-weight: 600; letter-spacing: .02em; }
.mode-switch { padding: 4px; border: 1px solid var(--line); background: #fafbfc; border-radius: 13px; display: flex; gap: 3px; }
.mode-button { padding: 9px 19px; border-radius: 10px; color: var(--muted); background: transparent; font-size: 13px; font-weight: 800; text-align: center; }
.mode-button small { display: block; margin-top: 2px; font-size: 9px; font-weight: 600; opacity: .75; }
.mode-button.active { color: var(--accent-dark); background: #eeecff; }
.topbar-actions { min-width: 250px; display: flex; align-items: center; justify-content: flex-end; gap: 18px; }
.save-state { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; font-weight: 600; }
.save-dot, .writing-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; background: var(--mint); box-shadow: 0 0 0 4px #e8faf4; }
.icon-button { width: 29px; height: 29px; border: 1px solid var(--line); border-radius: 50%; background: #fff; color: var(--muted); display: grid; place-items: center; transition: .16s; }
.icon-button:hover { color: var(--accent); border-color: #d9d4f6; }
.profile { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 12px; font-weight: 800; }
.profile { padding: 5px 9px 5px 5px; border-radius: 99px; background: transparent; transition: background .16s; }
.profile:hover { background: #f2f1fb; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; overflow: hidden; background: #f0eff9; }
.avatar svg { display: block; margin-bottom: -7px; }
.chevron { color: var(--muted); font-size: 17px; }
.app-body { display: flex; min-height: calc(100vh - 80px); }
.sidebar { width: 182px; padding: 29px 18px 20px; border-right: 1px solid var(--line); background: #fafbfc; display: flex; flex-direction: column; justify-content: space-between; }
.side-nav { display: grid; gap: 6px; }
.nav-item { min-height: 44px; padding: 0 15px; border-radius: 11px; color: #9ba3aa; background: transparent; display: flex; align-items: center; gap: 13px; text-align: left; font-size: 12px; font-weight: 700; }
.nav-item:hover { color: var(--accent); background: #f0effd; }
.nav-item.active { color: var(--accent-dark); background: #eeecff; box-shadow: inset 3px 0 var(--accent); }
.nav-icon { width: 21px; height: 21px; display: grid; place-items: center; }
.nav-icon svg { display: block; }
.sidebar-bottom { display: grid; gap: 18px; }
.streak-card { padding: 12px 10px; border: 1px solid #f0e6d8; border-radius: 12px; background: #fffaf3; display: flex; align-items: center; gap: 8px; }
.streak-emoji { font-size: 20px; }
.streak-card strong, .streak-card small { display: block; }
.streak-card strong { color: #7c5e35; font-size: 10px; }
.streak-card small { margin-top: 2px; color: #b7a083; font-size: 9px; }
.settings-button { min-height: 38px; padding: 0 15px; border-radius: 10px; color: #a3abb2; background: transparent; display: flex; align-items: center; gap: 12px; font-size: 11px; font-weight: 700; text-align: left; transition: .16s; }
.settings-button:hover { color: var(--accent); background: #f0effd; }
.main-content { width: min(1370px, calc(100% - 182px)); margin: 0 auto; padding: 43px 48px 36px; }
.page-heading { margin-bottom: 26px; display: flex; align-items: flex-end; justify-content: space-between; }
.eyebrow { margin: 0 0 7px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.heading-line { display: inline-block; width: 19px; height: 1px; margin: 0 8px 3px; background: #cfd5da; }
.page-heading h1 { margin: 0; color: var(--ink); font-size: clamp(23px, 2.3vw, 31px); letter-spacing: -.06em; }
.progress-wrap { width: 220px; }
.progress-label { margin-bottom: 9px; display: flex; justify-content: space-between; color: var(--muted); font-size: 10px; font-weight: 700; }
.progress-label strong { color: var(--accent); }
.progress-track { height: 6px; overflow: hidden; border-radius: 99px; background: #e5e7ed; }
.progress-track span { height: 100%; display: block; border-radius: inherit; background: linear-gradient(90deg, #8b7cec, var(--accent)); transition: width .35s ease; }
.drill-layout { display: grid; grid-template-columns: minmax(350px, .88fr) minmax(500px, 1.42fr); gap: 22px; }
.panel { border: 1px solid var(--line); border-radius: 17px; background: var(--surface); box-shadow: var(--shadow); }
.question-panel { min-height: 560px; padding: 28px 29px 24px; display: flex; flex-direction: column; }
.panel-topline, .notebook-heading, .notebook-footer { display: flex; align-items: center; justify-content: space-between; }
.unit-chip { padding: 6px 9px; border-radius: 6px; color: #7770bc; background: #f0efff; font-size: 9px; font-weight: 800; }
.difficulty { color: var(--muted); font-size: 10px; font-weight: 700; }
.difficulty i { margin-left: 5px; color: #e4b36f; font-style: normal; letter-spacing: 2px; }
.question-copy { padding: 43px 4px 30px; }
.question-number { margin: 0 0 13px; color: var(--accent); font-size: 12px; font-weight: 800; }
.question-number span { margin-left: 4px; font-family: "Manrope", sans-serif; }
.question-copy h2 { margin: 0 0 13px; font-size: 22px; letter-spacing: -.06em; }
.question-text { margin: 0; color: var(--muted); font-family: "Gowun Dodum", sans-serif; font-size: 16px; }
.equation { min-height: 100px; margin-top: 25px; display: flex; align-items: center; color: #27333f; font-family: Georgia, serif; font-size: 42px; letter-spacing: -.08em; }
.equation[hidden] { display: none; }
/* 혼합 계산·소수의 곱셈처럼 식을 글로 그대로 보여 주는 문항 */
.plain-expression { font-family: Georgia, serif; letter-spacing: -.02em; white-space: nowrap; }
.fraction { width: 42px; display: inline-flex; flex-direction: column; align-items: center; line-height: 1; letter-spacing: 0; font-size: 35px; }
.fraction span:first-child { padding: 0 7px 7px; border-bottom: 2px solid var(--ink); }
.fraction span:last-child { padding-top: 6px; }
.operator { padding: 0 18px; font-size: 31px; }
.answer-area { margin-top: auto; }
.answer-area label { display: block; margin-bottom: 9px; color: var(--muted); font-size: 11px; font-weight: 700; }
/*
 * 답 칸은 손가락으로 눌러 스스로 지울 수 있을 만큼 커야 합니다.
 * 처음엔 분자·분모 칸이 72×27px 였는데, 태블릿에서 「너무 좁다」는 말을 들었습니다.
 * 문제는 42px 로 크게 띄우면서 답 칸만 17px 로 작았던 것이 어긋나 보이기도 했습니다.
 * 지금은 칸 높이를 48px 이상(손가락 닿는 최소 크기)으로 두고 글씨도 식과 비슷하게 키웠습니다.
 * 아래 --답칸높이 하나만 고치면 세 칸이 함께 움직입니다.
 */
.answer-area { --답칸높이: 50px; --답글씨: 27px; }
/* 대분수는 자연수와 분수를 나란히 씁니다. 둘이 한 수로 읽히도록 바짝 붙입니다 */
.fraction-answer { min-height: 128px; padding: 15px 18px; border: 1px solid #dde2e7; border-radius: 12px; background: #fbfcfd; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; transition: .2s; }
/* display 를 준 요소는 hidden 속성만으로 감춰지지 않습니다 — 반드시 같이 적어야 합니다 */
.fraction-answer[hidden] { display: none; }
.fraction-answer:focus-within { border-color: #968de6; background: #fff; box-shadow: 0 0 0 4px #f0efff; }
/* 이름표를 흐름에서 빼야 자연수가 분수선 높이에 맞습니다 (대분수는 가운데 정렬) */
.answer-part { position: relative; display: flex; flex-direction: column; align-items: center; }
/* display 를 준 요소는 hidden 속성만으로 감춰지지 않습니다 */
.answer-part[hidden] { display: none; }
.answer-part input { outline: none; border: 1px solid #d9dfe4; border-radius: 9px; color: var(--ink); background: #fff; text-align: center; font-size: var(--답글씨); font-weight: 800; box-shadow: 0 1px 2px rgba(39,51,63,.04); transition: .18s; }
.answer-part input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px #eeecff; }
.answer-part input::placeholder { color: #bdc4ca; font-size: 13px; font-weight: 700; }
.whole-part { width: 76px; }
/* 자연수 칸은 분수 두 칸을 합한 높이라야 대분수가 한 수로 보입니다 */
.whole-part input { width: 76px; height: calc(var(--답칸높이) * 2 + 8px); }
.answer-part small { position: absolute; top: calc(100% + 4px); left: 50%; transform: translateX(-50%); color: #b5bdc3; font-size: 9px; font-weight: 700; white-space: nowrap; }
.fraction-part { width: 104px; gap: 3px; }
.fraction-part input { width: 104px; height: var(--답칸높이); }
.fraction-bar { width: 104px; height: 2px; display: block; border-radius: 2px; background: #6e7882; }
.answer-hint { margin-left: auto; color: #b7bec4; font-size: 10px; font-weight: 600; white-space: nowrap; }
/* 넓이·평균처럼 한 칸이면 되는 답 */
.number-answer { min-height: 96px; padding: 15px 18px; border: 1px solid #dde2e7; border-radius: 12px; background: #fbfcfd; display: flex; flex-wrap: wrap; align-items: center; gap: 11px; transition: .2s; }
.number-answer[hidden] { display: none; }
.number-answer:focus-within { border-color: #968de6; background: #fff; box-shadow: 0 0 0 4px #f0efff; }
/* 한 칸뿐이니 남는 자리를 다 씁니다 — 「25000」 같은 큰 수도 잘려 보이지 않게 */
.number-answer input { flex: 1 1 190px; min-width: 150px; max-width: 340px; height: calc(var(--답칸높이) + 12px); outline: none; border: 1px solid #d9dfe4; border-radius: 9px; color: var(--ink); background: #fff; text-align: center; font-size: var(--답글씨); font-weight: 800; box-shadow: 0 1px 2px rgba(39,51,63,.04); transition: .18s; }
.number-answer input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px #eeecff; }
.number-answer input::placeholder { color: #bdc4ca; font-size: 13px; font-weight: 700; }
.answer-unit { color: #6b747c; font-family: Georgia, serif; font-size: 21px; font-weight: 700; }
.answer-unit:empty { display: none; }
/*
 * 도형·측정 문항의 그림 (figures.js 가 SVG 로 만듭니다)
 *
 * 색은 여기서 정합니다 — figures.js 는 무엇을 그릴지만 알고 무슨 색인지는 모릅니다.
 * 그래야 나중에 어두운 화면을 만들 때 이 줄만 고치면 됩니다.
 */
.figure-box { margin-top: 20px; display: flex; justify-content: center; }
.figure-box[hidden] { display: none; }
.figure { width: 100%; max-width: 330px; height: auto; overflow: visible; }
.figure .f-face { fill: #f3f1fe; stroke: #5b5470; stroke-width: 1.7; }
/* 원기둥·통조림의 «몸통» — 테두리 없이 색만 채우는 자리.
   figures.js 에서 stroke="none" 을 줘도 위의 .f-face 가 이깁니다 (hidden 과 같은 함정).
   그래서 칠만 하는 클래스를 따로 둡니다. */
.figure .f-body { fill: #f3f1fe; stroke: none; }
.figure .f-top { fill: #e6e2fb; stroke: #5b5470; stroke-width: 1.7; }
.figure .f-side { fill: #ddd8f7; stroke: #5b5470; stroke-width: 1.7; }
/* 빛을 등진 면. 빛은 보는 사람 쪽(조금 왼쪽 위)에서 옵니다 — figures.js 의 `면색()` 참고 */
.figure .f-back { fill: #cec7f1; stroke: #5b5470; stroke-width: 1.7; }
.figure .f-fill { fill: var(--accent); stroke: #5b5470; stroke-width: 1.7; }
.figure .f-edge { stroke: #3c3550; stroke-width: 1.9; stroke-linecap: round; fill: none; }
.figure .f-axis { stroke: #3c3550; stroke-width: 2; fill: none; }
/* 꺾은선그래프의 선 */
.figure .f-line { stroke: var(--accent); stroke-width: 2.4; fill: none; stroke-linejoin: round; }
/* 안 보이는 모서리는 교과서처럼 점선입니다 */
.figure .f-dash { stroke: #8b83a6; stroke-width: 1.5; stroke-dasharray: 5 4; fill: none; }
.figure .f-dim-line { stroke: #7a719a; stroke-width: 1.4; fill: none; }
.figure .f-arc { stroke: var(--accent); stroke-width: 2; fill: none; }
.figure .f-mark { stroke: #6d6489; stroke-width: 1.4; fill: none; }
.figure .f-mark-fill { fill: #3c3550; stroke: none; }
.figure .f-open { fill: #fff; stroke: #3c3550; stroke-width: 2; }
.figure .f-label, .figure .f-dim { fill: #4a4360; font-family: Georgia, serif; font-size: 15px; font-weight: 700; }
/* 그림 아래 이름은 한글이라 본문 글꼴로 씁니다 — Georgia 는 한글이 없어 자간이 벌어집니다 */
.figure .f-name { fill: #4a4360; font-family: "Gowun Dodum", sans-serif; font-size: 14px; font-weight: 700; }
.figure .f-tick { fill: #6d6489; font-family: Georgia, serif; font-size: 12px; }
/* 시계 */
.figure .f-clock-face { fill: #fdfcf7; stroke: #3c3550; stroke-width: 2.4; }
/* 생활 속 물건 */
.figure .f-ribbon { stroke: var(--accent); stroke-width: 4; stroke-linecap: round; }
.figure .f-label-band { fill: #ded8fb; stroke: #5b5470; stroke-width: 1.4; }
/* 빈 칸 — 규칙표의 ☐ 와 무늬의 물음표 자리. 「여기를 채워라」로 보여야 합니다 */
.figure .f-blank { fill: #fff8ec; stroke: #d9a24f; stroke-width: 2; stroke-dasharray: 5 3; }
/* 쌓기나무가 없는 자리. 칸은 있으되 비어 있음을 보여 줍니다 */
.figure .f-empty { fill: #fbfbfd; stroke: #cfd4dd; stroke-width: 1.4; }
/* 1학년 그림의 큰 숫자 — 모으기·가르기, 수 배열. 작으면 세다 놓칩니다 */
.figure .f-bond { fill: #3b3557; font-family: "Manrope", sans-serif; font-size: 21px; font-weight: 800; }
.figure .f-clock-no { fill: #4a4360; font-family: "Manrope", sans-serif; font-size: 15px; font-weight: 800; }
.figure .f-tickline { stroke: #b6b0c9; stroke-width: 1; }
.figure .f-hand-hour { stroke: #3c3550; stroke-width: 5; stroke-linecap: round; }
.figure .f-hand-min { stroke: var(--accent); stroke-width: 3.2; stroke-linecap: round; }
/* 계단 잠금 스위치 — 켜면 앞 칸을 통과해야 다음 칸이 열립니다 */
/* 그림 없이 조건만 주는 문항의 조건 칩 */
.given-row { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 8px; }
.given-row[hidden] { display: none; }
.given-chip { padding: 8px 12px; border: 1px solid #e7eaee; border-radius: 9px; background: #fafbfc; display: flex; align-items: baseline; gap: 7px; }
.given-chip small { color: var(--muted); font-size: 10px; font-weight: 700; }
.given-chip strong { color: var(--ink); font-family: Georgia, serif; font-size: 17px; }
.given-chip.asked { border-color: #d9d4f6; background: #f7f6ff; }
.given-chip.asked small { color: var(--accent-dark); }
.given-chip.asked strong { color: var(--accent); }
.answer-feedback { min-height: 17px; margin: 7px 2px 0; font-size: 11px; font-weight: 700; }
.answer-feedback.correct { color: #35a982; }
.answer-feedback.incorrect { color: #e3786e; }
.question-actions { margin-top: 17px; display: flex; align-items: center; justify-content: space-between; }
.ghost-button { padding: 10px 0; color: var(--muted); background: transparent; font-size: 11px; font-weight: 700; }
.ghost-button span { padding-left: 7px; font-size: 16px; }
.ghost-button[hidden] { display: none; }
/* 무한 문제은행 — 같은 유형의 새 문제를 뽑습니다 */
.more-button { color: var(--accent-dark); font-weight: 800; }
.more-button:hover { color: var(--accent); }
.generated-chip[hidden] { display: none; }
.generated-chip { margin-left: 7px; padding: 3px 7px; border-radius: 5px; color: var(--accent-dark); background: #eeecff; font-size: 9px; font-weight: 800; }
.primary-button { min-width: 125px; padding: 13px 17px; border-radius: 9px; color: #fff; background: var(--accent); box-shadow: 0 9px 16px rgba(105,88,217,.22); font-size: 12px; font-weight: 800; transition: .2s; }
.primary-button:hover { background: var(--accent-dark); transform: translateY(-1px); }
.primary-button span { padding-left: 9px; font-size: 16px; }
.coach-note { margin-top: 23px; padding-top: 15px; border-top: 1px solid #f0f1f3; display: flex; gap: 7px; color: #a1a8af; font-family: "Gowun Dodum", sans-serif; font-size: 12px; }
.sparkle { color: #f0be68; font-family: sans-serif; }
.notebook-panel { min-height: 560px; padding: 25px 23px 17px; display: flex; flex-direction: column; overflow: hidden; }
.notebook-heading { padding: 0 5px 17px; }
.notebook-heading .eyebrow { margin-bottom: 3px; }
.notebook-heading h2 { margin: 0; font-size: 18px; letter-spacing: -.06em; }
.writing-status { color: var(--muted); font-size: 10px; font-weight: 700; }
.writing-dot { margin-right: 7px; vertical-align: 1px; }
.toolbar { min-height: 52px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 10px 10px 0 0; background: #fbfcfd; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.tool-button { width: 42px; min-height: 38px; padding: 3px 2px; border-radius: 7px; color: #9aa3ab; background: transparent; display: grid; place-items: center; gap: 0; }
.tool-button span { line-height: 17px; font-size: 18px; }
.tool-button small { font-size: 8px; font-weight: 700; }
.tool-button:hover, .tool-button.active { color: var(--accent); background: #eeecff; }
.toolbar-divider { width: 1px; height: 26px; margin: 0 5px; background: #e7eaed; }
.zoom-value { min-width: 34px; color: var(--muted); font-size: 9px; font-weight: 800; text-align: center; }
.clear-button { margin-left: auto; padding: 9px 10px; color: #b0b7bd; background: transparent; font-size: 9px; font-weight: 800; }
.clear-button:hover { color: #e3786e; }
/* 종이와 모눈은 이제 캔버스에 직접 그립니다 — 그래야 확대·이동을 같이 따라옵니다 */
.canvas-viewport { position: relative; height: 403px; overflow: hidden; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 10px 10px; background: #eeece6; }
canvas { position: absolute; inset: 0; touch-action: none; cursor: crosshair; }
.tool-button:disabled { opacity: .35; cursor: default; }
.tool-button:disabled:hover { color: #9aa3ab; background: transparent; }
.pen-widths { padding: 3px; border-radius: 8px; background: #f2f3f6; display: flex; align-items: center; gap: 1px; }
.pen-widths[hidden] { display: none; }
.width-button { width: 24px; height: 30px; border-radius: 6px; background: transparent; display: grid; place-items: center; }
.width-button i { display: block; width: 13px; border-radius: 99px; background: #a7aeb6; }
.width-button[data-width="thin"] i { height: 2px; }
.width-button[data-width="medium"] i { height: 3px; }
.width-button[data-width="thick"] i { height: 5px; }
.width-button:hover { background: #e6e8ee; }
.width-button.active { background: #fff; box-shadow: 0 1px 3px rgba(56,66,91,.14); }
.width-button.active i { background: var(--accent); }
.paper-placeholder { position: absolute; inset: 0; pointer-events: none; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #c6cbd0; }
.paper-placeholder.hidden { display: none; }
.placeholder-icon { margin-bottom: 9px; color: #d5d8dc; font-size: 30px; }
.paper-placeholder strong { font-family: "Gowun Dodum", sans-serif; font-size: 14px; font-weight: 400; }
.paper-placeholder small { margin-top: 5px; color: #cfd3d6; font-size: 9px; }
.notebook-footer { padding: 13px 6px 0; color: #b0b7bd; font-size: 9px; font-weight: 600; }
.notebook-footer b { color: var(--accent); }
.notebook-footer i { color: #abb2b8; font-size: 12px; font-style: normal; vertical-align: -1px; }
.insight-row { margin-top: 20px; display: grid; grid-template-columns: 1fr 1fr 1.45fr; gap: 15px; }
.insight-card { min-height: 82px; padding: 15px 16px; border: 1px solid var(--line); border-radius: 13px; background: #fff; display: flex; align-items: center; gap: 11px; }
.insight-icon { width: 35px; height: 35px; border-radius: 11px; display: grid; place-items: center; font-size: 19px; }
.insight-icon.mint { color: #39b894; background: #e7f9f3; }
.insight-icon.purple { color: var(--accent); background: #eeecff; }
.insight-icon.yellow { color: #e3a646; background: #fff5df; }
.insight-card small, .insight-card strong { display: block; }
.insight-card small { margin-bottom: 4px; color: var(--muted); font-size: 9px; font-weight: 700; }
.insight-card strong { font-size: 15px; letter-spacing: -.04em; }
.insight-trend { margin-left: auto; align-self: flex-start; color: #43bd98; font-size: 9px; font-weight: 800; }
.insight-trend.neutral { color: #a8afb5; }
.tip-card { padding-left: 18px; }
.tip-card strong { color: #69737b; font-family: "Gowun Dodum", sans-serif; font-size: 12px; line-height: 1.55; font-weight: 400; }
.toast { position: fixed; left: 50%; bottom: 25px; z-index: 5; padding: 12px 16px; border-radius: 10px; color: #fff; background: #303943; box-shadow: 0 12px 30px rgba(30,35,40,.18); font-size: 11px; font-weight: 700; opacity: 0; transform: translate(-50%, 15px); pointer-events: none; transition: .25s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.app-view[hidden] { display: none; }
.secondary-view { animation: view-in .25s ease both; }
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.secondary-heading { margin-bottom: 27px; display: flex; align-items: flex-end; justify-content: space-between; }
.secondary-heading h1 { margin: 0; color: var(--ink); font-size: clamp(24px, 2.4vw, 31px); letter-spacing: -.07em; }
.secondary-heading p:not(.eyebrow) { margin: 7px 0 0; color: var(--muted); font-family: "Gowun Dodum", sans-serif; font-size: 14px; }
.secondary-action { padding: 12px 15px; border: 1px solid #dedcf5; border-radius: 9px; color: var(--accent-dark); background: #f7f6ff; font-size: 11px; font-weight: 800; }
.secondary-action span { padding-left: 7px; font-size: 15px; }
.result-hero { margin-bottom: 19px; padding: 30px 36px; display: flex; align-items: center; gap: 34px; background: linear-gradient(100deg, #fff 0%, #fcfbff 100%); }
.result-ring { width: 145px; height: 145px; flex: 0 0 auto; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--accent) 0deg, var(--accent) 0deg, #efedf9 0deg 360deg); position: relative; }
.result-ring::after { content: ""; position: absolute; inset: 10px; border-radius: 50%; background: #fff; }
.result-ring > div { position: relative; z-index: 1; text-align: center; }
.result-ring strong, .result-ring small { display: block; }
.result-ring strong { color: var(--accent-dark); font-size: 29px; letter-spacing: -.07em; }
.result-ring small { margin-top: 1px; color: var(--muted); font-size: 10px; font-weight: 800; }
.result-summary .unit-chip { display: inline-block; }
.result-summary h2 { margin: 12px 0 5px; font-size: 22px; letter-spacing: -.07em; }
.result-summary > p { margin: 0; color: var(--muted); font-family: "Gowun Dodum", sans-serif; font-size: 13px; }
.result-mini-stats { margin-top: 22px; display: flex; gap: 28px; }
.result-mini-stats span { padding-right: 28px; border-right: 1px solid var(--line); }
.result-mini-stats span:last-child { padding-right: 0; border-right: 0; }
.result-mini-stats small, .result-mini-stats strong { display: block; }
.result-mini-stats small { margin-bottom: 5px; color: var(--muted); font-size: 9px; font-weight: 700; }
.result-mini-stats strong { font-size: 16px; }
.results-section, .events-panel { padding: 24px 27px 10px; }
.section-title { margin-bottom: 16px; display: flex; align-items: flex-end; justify-content: space-between; }
.section-title .eyebrow { margin-bottom: 4px; }
.section-title h2 { margin: 0; font-size: 18px; letter-spacing: -.06em; }
.result-caption { color: var(--soft-muted); font-size: 9px; font-weight: 700; }
.result-table { display: grid; }
.result-row { min-height: 64px; padding: 11px 4px; border-top: 1px solid #f0f1f3; display: grid; grid-template-columns: 38px minmax(180px, 1.5fr) 100px 100px 92px; align-items: center; gap: 12px; }
.result-row:first-child { border-top: 0; }
.result-index { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: #8f99a0; background: #f4f5f6; font-size: 10px; font-weight: 800; }
.result-row h3 { margin: 0 0 3px; font-size: 12px; letter-spacing: -.03em; }
.result-row p { margin: 0; color: var(--muted); font-size: 10px; }
.result-state { width: fit-content; padding: 5px 8px; border-radius: 99px; font-size: 9px; font-weight: 800; }
.result-state.correct { color: #2fa883; background: #e8f9f3; }
.result-state.incorrect { color: #db796f; background: #fff0ee; }
.result-state.pending { color: #a1a8af; background: #f4f5f6; }
.result-cell { color: #7f8991; font-size: 10px; font-weight: 700; }
.row-action { padding: 7px 9px; border-radius: 7px; color: var(--accent-dark); background: #f3f1ff; font-size: 9px; font-weight: 800; }
.record-total { padding: 12px 16px; border: 1px solid #f3e2e0; border-radius: 11px; color: #d2786e; background: #fff7f5; text-align: center; }
.record-total strong, .record-total span { display: block; }
.record-total strong { font-size: 21px; letter-spacing: -.06em; }
.record-total span { margin-top: 2px; font-size: 9px; font-weight: 800; }
.records-grid { margin-bottom: 19px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.record-card { padding: 19px 20px; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: 0 11px 30px rgba(56,66,91,.05); }
.record-card-top { margin-bottom: 13px; display: flex; justify-content: space-between; align-items: center; }
.record-card h2 { margin: 0 0 5px; font-size: 15px; letter-spacing: -.05em; }
.record-card p { margin: 0; color: var(--muted); font-family: "Gowun Dodum", sans-serif; font-size: 11px; }
.record-answer { margin: 17px 0; padding: 11px 12px; border-radius: 9px; background: #fafbfc; display: flex; justify-content: space-between; align-items: center; }
.record-answer span { color: var(--muted); font-size: 9px; font-weight: 700; }
.record-answer strong { color: #d2786e; font-family: Georgia, serif; font-size: 16px; }
.record-meta { padding-top: 12px; border-top: 1px solid #f0f1f3; display: flex; justify-content: space-between; color: var(--soft-muted); font-size: 9px; font-weight: 700; }
.record-card .row-action { margin-top: 15px; width: 100%; }

.event-list { display: grid; }
.event-item { min-height: 46px; padding: 10px 4px; border-top: 1px solid #f0f1f3; display: flex; align-items: center; gap: 11px; }
.event-icon { width: 27px; height: 27px; border-radius: 8px; display: grid; place-items: center; color: var(--accent); background: #f0efff; font-size: 13px; }
.event-item strong { display: block; color: #67717a; font-size: 10px; }
.event-item small { display: block; margin-top: 2px; color: var(--soft-muted); font-size: 9px; }
.event-time { margin-left: auto; color: var(--soft-muted); font-size: 9px; font-weight: 700; }
.coming-soon { min-height: 520px; padding: 90px 25px; border: 1px solid var(--line); border-radius: 17px; background: #fff; text-align: center; box-shadow: var(--shadow); }
.coming-icon { width: 58px; height: 58px; margin: 0 auto 19px; border-radius: 19px; display: grid; place-items: center; color: #e3a646; background: #fff5df; font-size: 28px; }
.coming-soon .eyebrow { margin-bottom: 7px; }
.coming-soon h1 { margin: 0; font-size: 29px; letter-spacing: -.07em; }
.coming-soon > p:not(.eyebrow) { max-width: 380px; margin: 12px auto 24px; color: var(--muted); font-family: "Gowun Dodum", sans-serif; font-size: 14px; line-height: 1.7; }

/* ── 계단 (학습) ─────────────────────────────────────────────── */

/* ── 결과에서 겹쳐 보기 ───────────────────────────────────────── */
.review-backdrop { position: fixed; inset: 0; z-index: 40; padding: 24px; background: rgba(39, 51, 63, .42); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; }
.review-backdrop[hidden] { display: none; }
.review-card { width: min(1020px, 100%); max-height: calc(100vh - 48px); overflow: auto; padding: 26px 28px 22px; border-radius: 18px; background: #fff; box-shadow: 0 30px 80px rgba(39, 51, 63, .28); }
.review-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.review-head .unit-chip { display: inline-block; margin-bottom: 9px; }
.review-head h2 { margin: 0; font-size: 21px; letter-spacing: -.05em; }
.review-head p { margin: 6px 0 0; color: var(--muted); font-family: "Gowun Dodum", sans-serif; font-size: 13px; }
.review-close { width: 34px; height: 34px; flex: none; border-radius: 50%; color: var(--muted); background: #f4f5f7; font-size: 13px; font-weight: 800; }
.review-close:hover { color: var(--ink); background: #e9ebef; }
.review-body { margin-top: 20px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; }
.review-equation { min-height: 0; margin-top: 4px; font-size: 34px; flex-wrap: wrap; }
.review-equation .plain-expression { font-size: 28px; }
.review-equation:empty { display: none; }
.review-answers { margin-top: 20px; display: grid; gap: 9px; }
.review-answers div { padding: 11px 13px; border-radius: 9px; background: #fafbfc; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.review-answers small { color: var(--muted); font-size: 10px; font-weight: 700; }
.review-answers strong { color: #d2786e; font-family: Georgia, serif; font-size: 18px; }
.review-answers .right-answer { color: #2fa883; }
.review-meta { margin-top: 14px; display: flex; align-items: center; gap: 12px; color: var(--soft-muted); font-size: 10px; font-weight: 700; }
.review-right .eyebrow { margin-bottom: 9px; }
.review-paper { position: relative; height: 320px; border: 1px solid var(--line); border-radius: 12px; background: var(--canvas); overflow: hidden; }
.review-paper canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.review-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--soft-muted); font-family: "Gowun Dodum", sans-serif; font-size: 13px; }
.review-empty[hidden] { display: none; }
.review-foot { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.review-nav { display: flex; align-items: center; gap: 14px; }
.review-nav .ghost-button:disabled { opacity: .35; cursor: default; }
.review-count { color: var(--muted); font-size: 11px; font-weight: 800; }

/* ── 단원 고르기 ─────────────────────────────────────────────── */
.grade-tabs { margin-bottom: 26px; padding: 5px; border: 1px solid var(--line); border-radius: 12px; background: #fafbfc; display: inline-flex; gap: 3px; }
.grade-tab { padding: 10px 20px; border-radius: 9px; color: var(--muted); background: transparent; font-size: 13px; font-weight: 800; }
.grade-tab:hover { color: var(--accent-dark); background: #f2f1fd; }
.grade-tab.active { color: #fff; background: var(--accent); box-shadow: 0 6px 14px rgba(105,88,217,.26); }
.endless { color: var(--accent-dark); font-weight: 800; }
.picker-grid { display: grid; gap: 30px; }
.picker-group h2 { margin: 0 0 14px; color: var(--ink); font-size: 15px; letter-spacing: -.05em; }
.picker-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.unit-card { padding: 18px 19px 16px; border: 1px solid var(--line); border-radius: 15px; background: #fff; box-shadow: 0 11px 30px rgba(56,66,91,.05); display: flex; flex-direction: column; gap: 9px; text-align: left; transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease; }
.unit-card:hover:not(:disabled) { transform: translateY(-2px); border-color: #d9d4f6; box-shadow: 0 16px 34px rgba(105,88,217,.12); }
.unit-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.unit-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.unit-no { color: var(--accent-dark); font-size: 10px; font-weight: 800; }
.domain-chip { padding: 4px 8px; border-radius: 99px; color: #7c858d; background: #f4f5f7; font-size: 9px; font-weight: 800; }
.unit-card strong { color: var(--ink); font-size: 16px; letter-spacing: -.05em; }
.unit-card-meta { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 10px; font-weight: 700; }
.dot-sep { color: var(--soft-muted); }
.unit-progress { margin-top: 4px; padding-top: 11px; border-top: 1px solid #f2f3f5; display: grid; gap: 6px; }
.unit-progress-track { height: 5px; border-radius: 99px; background: #f0f1f4; overflow: hidden; }
.unit-progress-track i { display: block; height: 100%; border-radius: 99px; background: var(--accent); }
.unit-progress small { color: var(--soft-muted); font-size: 9px; font-weight: 700; }
.unit-card.not-ready { background: #fbfbfc; border-style: dashed; cursor: default; box-shadow: none; }
.unit-card.not-ready strong { color: var(--soft-muted); }
.unit-card.not-ready .unit-no, .unit-card.not-ready .domain-chip { opacity: .55; }

/* ── 문제 화면에 더한 것 ──────────────────────────────────────── */
.heading-side { display: flex; flex-direction: column; align-items: flex-end; gap: 13px; }
.heading-side[hidden] { display: none; }
.type-chip { margin-left: 7px; padding: 3px 7px; border-radius: 5px; color: #7c858d; background: #f4f5f7; font-size: 9px; font-weight: 800; }
.unknown { color: var(--accent); }
.question-actions { gap: 14px; }
.question-actions .primary-button { margin-left: auto; }
.answer-feedback.nudge { color: #c98b2f; }
.save-state.failed { color: #d9534f; }
.save-state.failed .save-dot { background: #d9534f; box-shadow: 0 0 0 4px #fdecec; }
.record-card .unit-chip { display: inline-block; margin-bottom: 9px; }
.record-answer { display: grid; grid-template-columns: auto 1fr; gap: 7px 12px; align-items: center; }
.record-answer strong { text-align: right; }
.record-answer .right-answer { color: #2fa883; }

@media (max-width: 1050px) {
  .review-body { grid-template-columns: 1fr; }
  .review-paper { height: 240px; }
  .picker-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar { padding: 0 22px; }
  .topbar-actions { min-width: auto; }
  .save-state, .profile-name, .chevron { display: none; }
  .main-content { padding: 30px 24px; }
  .sidebar { width: 155px; }
  .main-content { width: calc(100% - 155px); }
  .drill-layout { grid-template-columns: 1fr; }
  .question-panel { min-height: auto; }
  .question-copy { padding: 30px 4px 20px; }
  .notebook-panel { min-height: 510px; }
  .result-hero { padding: 25px; }
  .result-row { grid-template-columns: 35px minmax(150px, 1.5fr) 85px 85px; }
  .result-row .row-action { display: none; }
}
@media (max-width: 680px) {
  .picker-cards { grid-template-columns: 1fr; }
  .heading-side { align-items: stretch; margin-top: 17px; }
  .question-actions { flex-wrap: wrap; }
  .topbar { height: 67px; }
  .brand { min-width: auto; }
  .brand small, .mode-switch { display: none; }
  .app-body { min-height: calc(100vh - 67px); }
  .sidebar { width: 62px; padding: 19px 8px; }
  .nav-item { justify-content: center; padding: 0; }
  .nav-item span:last-child, .streak-card, .settings-button { display: none; }
  .main-content { width: calc(100% - 62px); padding: 25px 13px; }
  .page-heading { display: block; }
  .progress-wrap { width: 100%; margin-top: 17px; }
  .insight-row { grid-template-columns: 1fr; }
  .tip-card { display: none; }
  .secondary-heading { display: block; }
  .secondary-action { margin-top: 17px; }
  .result-hero { display: block; text-align: center; }
  .result-ring { margin: 0 auto 22px; }
  .result-mini-stats { justify-content: center; gap: 13px; }
  .result-mini-stats span { padding-right: 13px; }
  .result-row { grid-template-columns: 30px minmax(130px, 1fr) 70px; gap: 7px; }
  .result-row .result-cell:nth-of-type(2) { display: none; }
  .results-section, .events-panel { padding-left: 15px; padding-right: 15px; }
  .result-caption { display: none; }
  .records-grid { grid-template-columns: 1fr; }
  .record-total { margin-top: 16px; width: fit-content; }
  .toolbar { gap: 0; }
  .toolbar-divider { margin: 0 2px; }
  .tool-button { width: 35px; }
  .width-button { width: 19px; }
  .clear-button { padding-right: 2px; }
}

/* ══ 무한의 수학 계단 ══════════════════════════════════════════════
 *
 * 계단은 «오르는 느낌»이 전부입니다. 그래서 그림을 크게 두고,
 * 칸이 오를 때 계단 전체가 아래로 내려가며 아이가 한 칸 위에 서게 합니다
 * (아이를 올리는 것보다 배경을 내리는 쪽이 「올라갔다」로 읽힙니다).
 */
.climb-top { margin-bottom: 20px; display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.climb-top h1 { margin: 0; font-size: clamp(23px, 2.3vw, 31px); letter-spacing: -.06em; }
.climb-top p:last-child { margin: 7px 0 0; color: var(--muted); font-family: "Gowun Dodum", sans-serif; font-size: 13px; }
.climb-stage { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(240px, .75fr); gap: 20px; align-items: stretch; }

.stairs-frame { position: relative; height: 494px; overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: linear-gradient(180deg, #eef1fb 0%, #f7f8fc 55%, #fdfcfa 100%); box-shadow: var(--shadow); }
.stairs-sky { position: absolute; inset: 0; background:
    radial-gradient(2px 2px at 18% 14%, #cdd3ef 50%, transparent 51%),
    radial-gradient(2px 2px at 72% 9%, #d6dbf2 50%, transparent 51%),
    radial-gradient(1.6px 1.6px at 45% 22%, #dde1f4 50%, transparent 51%),
    radial-gradient(2px 2px at 88% 27%, #d2d8ef 50%, transparent 51%); pointer-events: none; }
/* 계단 전체를 담는 띠. 지금 칸이 늘 가운데 오도록 통째로 옮깁니다 */
.stairs-scroll { position: absolute; left: 26px; bottom: 0; width: 100%; height: 100%; }
.stairs-fade { position: absolute; left: 0; right: 0; height: 64px; pointer-events: none; }
.stairs-fade.top { top: 0; background: linear-gradient(180deg, #eef1fb, rgba(238,241,251,0)); }
.stairs-fade.bottom { bottom: 0; background: linear-gradient(0deg, #fdfcfa, rgba(253,252,250,0)); }

/* 계단 한 칸 — 디딤판(tread)과 챌판(riser)이 있어야 계단으로 읽힙니다 */




.climber.hop { animation: 깡충 .85s cubic-bezier(.3,1.5,.5,1); }
@keyframes 숨쉬기 { 0%, 100% { transform: translateX(-50%) translateY(0) } 50% { transform: translateX(-50%) translateY(-4px) } }
@keyframes 깡충 { 0% { transform: translateX(-50%) translateY(44px) scale(.9) } 45% { transform: translateX(-50%) translateY(-18px) scale(1.07) } 100% { transform: translateX(-50%) translateY(0) scale(1) } }

.climb-side { display: flex; flex-direction: column; gap: 15px; }
.climb-now { padding: 19px 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.climb-floor { display: inline-block; padding: 5px 10px; border-radius: 7px; color: #7770bc; background: #f0efff; font-size: 10px; font-weight: 800; }
.climb-now strong { display: block; margin: 11px 0 3px; color: var(--ink); font-size: 42px; font-family: "Manrope", sans-serif; letter-spacing: -.05em; line-height: 1; }
.climb-now strong small { margin-left: 4px; font-size: 15px; color: var(--muted); font-weight: 700; }
.climb-now p { margin: 0; color: var(--muted); font-size: 11px; font-weight: 700; }
/* 다음 칸까지 남은 걸음 — 점으로 보여 주면 「몇 문제 남았나」가 한눈에 들어옵니다 */
.steps-gauge { display: flex; flex-wrap: wrap; gap: 6px; }
.steps-gauge i { width: 15px; height: 15px; border-radius: 50%; background: #e3e5ee; transition: background .35s, transform .35s; }
.steps-gauge i.filled { background: var(--accent); transform: scale(1.08); }
.steps-gauge i.just { animation: 걸음채움 .55s cubic-bezier(.3,1.4,.5,1); }
@keyframes 걸음채움 { 0% { transform: scale(.3); background: #cfc7f7 } 60% { transform: scale(1.35) } 100% { transform: scale(1.08) } }
.climb-button { width: 100%; padding: 17px 20px; border-radius: 14px; color: #fff; background: var(--accent); font-size: 15px; font-weight: 800; box-shadow: 0 12px 26px rgba(105,88,217,.3); transition: transform .15s, box-shadow .15s; }
.climb-button:hover { transform: translateY(-2px); box-shadow: 0 16px 32px rgba(105,88,217,.36); }
.climb-button span { padding-left: 6px; }
.climb-stats { margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.climb-stats div { padding: 11px 8px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); text-align: center; }
.climb-stats dt { color: var(--muted); font-size: 9px; font-weight: 700; }
.climb-stats dd { margin: 4px 0 0; color: var(--ink); font-size: 17px; font-weight: 800; font-family: "Manrope", sans-serif; }
.climb-hint { margin: 0; color: var(--soft-muted); font-size: 10px; font-weight: 600; text-align: center; }

/* 칸을 올랐을 때 — 화면을 떠나지 않고 잠깐 떴다 사라집니다 */
.climb-cheer { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(35,38,60,.34); backdrop-filter: blur(3px); animation: 스밈 .25s ease; }
.climb-cheer[hidden] { display: none; }
.cheer-card { padding: 30px 44px 26px; border-radius: 22px; background: #fff; text-align: center; box-shadow: 0 30px 70px rgba(40,44,70,.3); animation: 솟음 .5s cubic-bezier(.2,1.4,.4,1); }
.cheer-stairs { display: flex; align-items: flex-end; justify-content: center; gap: 3px; height: 58px; margin-bottom: 14px; }
.cheer-stairs i { width: 20px; border-radius: 4px 4px 2px 2px; background: #e7e3fb; }
.cheer-stairs i:nth-child(1) { height: 16px } .cheer-stairs i:nth-child(2) { height: 27px } .cheer-stairs i:nth-child(3) { height: 38px }
.cheer-stairs i.here { width: auto; height: auto; background: none; line-height: 0; align-self: flex-start; animation: 깡충 .8s cubic-bezier(.3,1.5,.5,1) .15s both; }
.cheer-eyebrow { margin: 0; color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .06em; }
.cheer-card strong { display: block; margin: 6px 0 4px; font-size: 40px; letter-spacing: -.05em; font-family: "Manrope", sans-serif; }
.cheer-card p:last-child { margin: 0; color: var(--muted); font-size: 12px; font-weight: 700; }
@keyframes 스밈 { from { opacity: 0 } to { opacity: 1 } }
@keyframes 솟음 { from { opacity: 0; transform: translateY(22px) scale(.94) } to { opacity: 1; transform: none } }

/* 문제 화면 위에 붙는 계단 띠 — 계단 모드로 풀 때만 보입니다 */
.climb-bar { margin-bottom: 18px; padding: 13px 18px; border: 1px solid #ded9f8; border-radius: 14px; background: linear-gradient(90deg, #f4f2ff, #fbfaff); display: flex; align-items: center; gap: 15px; }
.climb-bar[hidden] { display: none; }
.climb-bar .who { font-size: 21px; line-height: 1; }
.climb-bar .where { color: var(--accent-dark); font-size: 12px; font-weight: 800; white-space: nowrap; }
.climb-bar .track { flex: 1; height: 9px; border-radius: 99px; background: #e6e3f7; overflow: hidden; }
.climb-bar .track span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #8b7cec, var(--accent)); transition: width .5s cubic-bezier(.3,1,.4,1); }
.climb-bar .left { color: var(--muted); font-size: 10px; font-weight: 700; white-space: nowrap; }
.climb-bar .quit { padding: 7px 11px; border-radius: 9px; color: var(--accent-dark); background: #ece9ff; font-size: 10px; font-weight: 800; }

@media (max-width: 1050px) {
  .climb-stage { grid-template-columns: 1fr; }
  .stairs-frame { height: 330px; }
}

/* ── 차시 고르기 ─────────────────────────────────────────────────── */
.type-list { display: grid; gap: 10px; }
.type-card { padding: 15px 18px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); display: flex; align-items: center; gap: 14px; text-align: left; width: 100%; transition: border-color .18s, transform .18s, box-shadow .18s; }
.type-card:hover:not(:disabled) { border-color: #d5cffa; transform: translateY(-1px); box-shadow: 0 10px 24px rgba(56,66,91,.07); }
.type-card:disabled { opacity: .5; cursor: default; }
.type-lesson { flex: none; width: 46px; height: 46px; border-radius: 12px; background: #f2f1fd; color: #7770bc; display: grid; place-items: center; font-size: 11px; font-weight: 800; }
.type-card.done .type-lesson { background: #e6f7f1; color: #2fa883; }
.type-main { flex: 1; min-width: 0; }
.type-main strong { display: block; color: var(--ink); font-size: 14px; letter-spacing: -.03em; }
.type-main small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; font-weight: 600; }
.type-score { flex: none; text-align: right; }
.type-score b { display: block; color: var(--ink); font-size: 15px; font-weight: 800; font-family: "Manrope", sans-serif; }
.type-score small { color: var(--soft-muted); font-size: 9px; font-weight: 700; }
.type-go { flex: none; padding: 9px 14px; border-radius: 10px; color: #fff; background: var(--accent); font-size: 11px; font-weight: 800; }
.type-card:disabled .type-go { background: #dfe3e7; color: #fff; }
.type-all { margin-bottom: 14px; padding: 17px 19px; border: 1px dashed #cfc9f2; border-radius: 13px; background: #faf9ff; display: flex; align-items: center; justify-content: space-between; gap: 14px; width: 100%; text-align: left; }
.type-all strong { display: block; color: var(--accent-dark); font-size: 14px; }
.type-all small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; font-weight: 600; }

/* ── 고르는 답 ────────────────────────────────────────────────────
 * 「어느 것이 더 길까요」처럼 답이 수가 아닌 문항.
 * 손가락으로 누르는 것이므로 답 칸과 같은 크기 규칙(44px)을 지킵니다.
 */
.choice-answer { min-height: 96px; padding: 15px 18px; border: 1px solid #dde2e7; border-radius: 12px; background: #fbfcfd; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.choice-answer[hidden] { display: none; }
.choice-button { min-height: 52px; padding: 13px 20px; border: 1.5px solid #d9dfe4; border-radius: 11px; color: var(--ink); background: #fff; font-size: 16px; font-weight: 800; transition: border-color .15s, background .15s, transform .15s; }
.choice-button:hover { border-color: #b9b0ee; transform: translateY(-1px); }
.choice-button.picked { border-color: var(--accent); background: #efecff; color: var(--accent-dark); box-shadow: 0 0 0 3px #f2f0ff; }

/* 차시 고르기 머리 오른쪽 — 연습/시험 고르개와 되돌아가기 */
.type-head-side { display: flex; flex-direction: column; align-items: flex-end; gap: 11px; }
/* 시험지 안내 — 시험은 문제 수가 정해져 있습니다 */
.exam-bar { margin-bottom: 18px; padding: 13px 18px; border: 1px solid #f2ddc4; border-radius: 14px; background: linear-gradient(90deg, #fdf6ea, #fffdf9); display: flex; align-items: center; gap: 15px; }
.exam-bar[hidden] { display: none; }
.exam-bar .who { font-size: 19px; line-height: 1; }
.exam-bar .where { color: #9a7433; font-size: 12px; font-weight: 800; white-space: nowrap; }
.exam-bar .track { flex: 1; height: 9px; border-radius: 99px; background: #f2e5cf; overflow: hidden; }
.exam-bar .track span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #edbf72, #dda44a); transition: width .4s ease; }
.exam-bar .left { color: #a98f60; font-size: 10px; font-weight: 700; white-space: nowrap; }
.exam-bar .quit { padding: 7px 11px; border-radius: 9px; color: #8a6a2c; background: #f7e9d1; font-size: 10px; font-weight: 800; }

/* ── 「몇 시 몇 분」 답 ────────────────────────────────────────────── */
.time-answer { min-height: 96px; padding: 15px 18px; border: 1px solid #dde2e7; border-radius: 12px; background: #fbfcfd; display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.time-answer[hidden] { display: none; }
.time-answer:focus-within { border-color: #968de6; background: #fff; box-shadow: 0 0 0 4px #f0efff; }
.time-part { display: flex; align-items: baseline; gap: 7px; }
.time-part input { width: 96px; height: 62px; outline: none; border: 1px solid #d9dfe4; border-radius: 9px; color: var(--ink); background: #fff; text-align: center; font-size: 27px; font-weight: 800; box-shadow: 0 1px 2px rgba(39,51,63,.04); transition: .18s; }
.time-part input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px #eeecff; }
.time-part input::placeholder { color: #bdc4ca; font-size: 15px; font-weight: 700; }
.time-part small { color: var(--muted); font-size: 15px; font-weight: 800; }

/* ── 묻는 말이 제목입니다 ────────────────────────────────────────────
   차시 이름을 크게, 묻는 말을 작게 두었더니 「△를 알아보고 찾아볼까요」가
   문제처럼 읽히고 정작 「이 도형의 이름은?」이 눈에 안 들어왔습니다. */
.question-lesson { margin: 0 0 7px; color: var(--soft-muted); font-size: 12px; font-weight: 700; letter-spacing: -.02em; }
.question-lesson[hidden] { display: none; }
.question-ask { margin: 0; color: var(--ink); font-family: "Gowun Dodum", sans-serif; font-size: 22px; font-weight: 700; letter-spacing: -.03em; line-height: 1.45; }

/* 조건 칸에 놓이는 분수는 식만큼 클 필요가 없습니다 */
.given-chip.fraction-chip { align-items: center; }
.given-chip .fraction { width: 27px; font-size: 21px; }
.given-chip .fraction span:first-child { padding: 0 5px 3px; border-bottom-width: 1.5px; }
.given-chip .fraction span:last-child { padding-top: 3px; }

/* ── 얼마나 익었나 ────────────────────────────────────────────────
   「약해요」는 겁주는 말이 아니라 «여기부터 하자»는 표시입니다. 붉게 쓰지 않습니다. */
.skill-chip { padding: 5px 9px; border-radius: 7px; font-size: 9px; font-weight: 800; white-space: nowrap; }
.skill-chip.약함 { color: #b4772c; background: #fdf1de; }
.skill-chip.보통 { color: #4a7fb5; background: #e9f1fa; }
.skill-chip.탄탄 { color: #2fa883; background: #e6f7f1; }
.type-score .skill-chip { display: inline-block; margin-top: 3px; }
.unit-card.weak { border-color: #f0dcc0; }
.type-card.weak { border-color: #f0dcc0; }
.secondary-action.resume { margin-top: 13px; }

/* ── 홈 — 대시보드 ────────────────────────────────────────────────── */
.home-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-content: start; }
.home-card { padding: 20px 22px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); box-shadow: 0 11px 30px rgba(56,66,91,.05); display: flex; flex-direction: column; gap: 13px; }
.card-eyebrow { margin: 0; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.home-note { margin: 0; color: var(--muted); font-size: 11px; font-weight: 600; }
.empty-note { margin: 0; padding: 18px 0; color: var(--soft-muted); font-size: 12px; font-weight: 600; text-align: center; }

.today-stats { display: flex; gap: 26px; }
.today-stats span { display: flex; flex-direction: column; gap: 3px; }
.today-stats strong { color: var(--ink); font-size: 30px; font-weight: 800; letter-spacing: -.05em; }
.today-stats small { color: var(--muted); font-size: 10px; font-weight: 700; }
/* 요즘 이레. 오늘이 오른쪽 끝입니다 */
.week-strip { margin-top: auto; height: 62px; display: flex; align-items: flex-end; gap: 9px; }
.week-day { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 5px; }
.week-day i { width: 100%; min-height: 5px; border-radius: 5px 5px 3px 3px; background: #e4e8f3; transition: height .35s ease; }
.week-day.today i { background: linear-gradient(180deg, #8b7cec, var(--accent)); }
.week-day small { color: var(--soft-muted); font-size: 9px; font-weight: 700; }
.week-day.today small { color: var(--accent); }

.climb-card-body { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; }
.climb-card-body strong { color: var(--ink); font-size: 38px; font-weight: 800; letter-spacing: -.06em; }
.climb-card-body strong small { margin-left: 3px; font-size: 14px; font-weight: 700; color: var(--muted); }
.climb-card-body p { margin: 3px 0 0; color: var(--muted); font-size: 11px; font-weight: 700; }
.mini-stairs { line-height: 0; }


.home-progress { height: 8px; border-radius: 99px; background: #eceef5; overflow: hidden; }
.home-progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #8b7cec, var(--accent)); transition: width .35s ease; }
.climb-card .primary-button { margin-top: auto; }

/* 약한 곳 — 짚어 주고 그 자리에서 바로 갈 수 있어야 합니다 */
.weak-card, .domain-card { grid-column: span 2; }
.domain-card .domain-list { grid-template-columns: repeat(2, minmax(0, 1fr)); display: grid; gap: 11px 30px; }
.weak-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.weak-item { padding: 13px 15px; border: 1px solid #f0dcc0; border-radius: 12px; background: #fffdf8; display: flex; align-items: center; gap: 13px; text-align: left; width: 100%; transition: transform .16s, box-shadow .16s; }
.weak-item:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(56,66,91,.07); }
.weak-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.weak-main strong { color: var(--ink); font-size: 13px; letter-spacing: -.04em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.weak-main small { color: var(--muted); font-size: 10px; font-weight: 700; }
.weak-score { flex: none; color: #b4772c; font-size: 14px; font-weight: 800; font-family: "Manrope", sans-serif; text-align: right; }
.weak-score small { display: block; color: var(--soft-muted); font-size: 9px; font-weight: 700; }
.weak-go { flex: none; padding: 7px 11px; border-radius: 8px; color: #fff; background: #d9a24f; font-size: 10px; font-weight: 800; white-space: nowrap; }

.domain-list { display: flex; flex-direction: column; gap: 11px; }
.domain-row { display: flex; align-items: center; gap: 12px; }
.domain-name { flex: none; width: 82px; color: var(--ink); font-size: 11px; font-weight: 700; }
.domain-track { flex: 1; height: 9px; border-radius: 99px; background: #eceef5; overflow: hidden; }
.domain-track i { display: block; height: 100%; border-radius: inherit; background: #c9cede; transition: width .35s ease; }
.domain-row.약함 .domain-track i { background: #e5ae5f; }
.domain-row.보통 .domain-track i { background: #7f9fd0; }
.domain-row.탄탄 .domain-track i { background: var(--mint); }
.domain-value { flex: none; width: 38px; color: var(--muted); font-size: 11px; font-weight: 800; font-family: "Manrope", sans-serif; text-align: right; }

/* 좁은 화면(10인치 태블릿 세로)에서는 한 줄로 */
@media (max-width: 1100px) {
  .home-grid { grid-template-columns: minmax(0, 1fr); }
  .weak-card, .domain-card { grid-column: auto; }
  .domain-card .domain-list { grid-template-columns: minmax(0, 1fr); }
  .weak-list { grid-template-columns: minmax(0, 1fr); }
}

/* ── 시작 화면 ────────────────────────────────────────────────────────
   앱을 처음 열었을 때 **가장 먼저 보이는 화면**입니다.
   여기서 「무엇을 하는 앱인가」가 한눈에 들어와야 합니다 — 로고, 한 줄, 그리고 시작 단추. */
.welcome { position: fixed; inset: 0; z-index: 60; overflow: auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; padding: 40px 20px;
  background: radial-gradient(120% 90% at 50% -10%, #efedff 0%, #eef0f6 46%, #e8eaf4 100%); }
.welcome[hidden] { display: none; }

/* 뒤에 뜬 별들. 움직임은 아주 느리게 — 눈에 걸리면 안 됩니다 */
.welcome-sky { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.welcome-sky i { position: absolute; width: 7px; height: 7px; border-radius: 50%; background: #cfc9f2; opacity: .5; animation: 별뜨기 7s ease-in-out infinite; }
.welcome-sky i:nth-child(1) { top: 14%; left: 16%; }
.welcome-sky i:nth-child(2) { top: 26%; right: 18%; width: 10px; height: 10px; animation-delay: 1.4s; }
.welcome-sky i:nth-child(3) { bottom: 22%; left: 24%; width: 5px; height: 5px; animation-delay: 2.6s; }
.welcome-sky i:nth-child(4) { bottom: 16%; right: 22%; animation-delay: 3.8s; }
.welcome-sky i:nth-child(5) { top: 46%; left: 8%; width: 5px; height: 5px; animation-delay: 5s; }
@keyframes 별뜨기 { 0%, 100% { opacity: .28; transform: translateY(0); } 50% { opacity: .68; transform: translateY(-7px); } }

.welcome-card { position: relative; width: min(460px, 100%); padding: 38px 36px 32px; border-radius: 26px; background: #fff; box-shadow: 0 30px 70px rgba(56,66,91,.13); }
.welcome-brand { text-align: center; margin-bottom: 28px; }
.welcome-mark { display: inline-grid; place-items: center; margin-bottom: 15px; border-radius: 24px; box-shadow: 0 16px 34px rgba(75,60,174,.32); }
.welcome-mark svg { display: block; }
.welcome-brand h1 { margin: 0 0 9px; font-size: 27px; letter-spacing: -.06em; }
.welcome-brand p { margin: 0; color: var(--muted); font-family: "Gowun Dodum", sans-serif; font-size: 13px; line-height: 1.6; }

.welcome-form { display: grid; gap: 19px; }
/* `display: grid` 가 `hidden` 을 이깁니다. 이 줄이 없으면 시작 화면에 폼 두 개가
   나란히 뜹니다 — 「혼자 풀기」와 「우리 반」이 같이 보입니다.
   test.js 가 이 짝(display 를 준 클래스에는 [hidden] 규칙도 있어야 한다)을 잽니다. */
.welcome-form[hidden] { display: none; }
.field { display: grid; gap: 9px; }
.field > span { color: var(--muted); font-size: 11px; font-weight: 800; }
.field input { height: 52px; padding: 0 16px; border: 1.5px solid #e2e6ea; border-radius: 13px; color: var(--ink); background: #fbfcfd; font-size: 16px; font-weight: 700; outline: none; transition: .18s; }
.field input:focus { border-color: var(--accent); background: #fff; box-shadow: 0 0 0 4px #eeecff; }
.field input::placeholder { color: #bdc4ca; font-weight: 600; }

/* 여섯 학년이 한 줄에 들어가야 합니다 — 6학년만 다음 줄로 떨어지면 고른 것처럼 보입니다 */
.chip-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.chip { padding: 11px 4px; border: 1.5px solid #e2e6ea; border-radius: 11px; color: var(--muted); background: #fbfcfd; font-size: 13px; font-weight: 800; transition: .16s; }
.chip:hover { border-color: #cfc8f3; color: var(--accent); }
.chip.on { border-color: var(--accent); color: var(--accent-dark); background: #eeecff; box-shadow: 0 0 0 3px #f4f2ff; }

/* 캐릭터 고르기 — 고른 것이 «확실히» 보여야 합니다. 아이에게는 이것이 첫 선택입니다 */
.char-row { display: flex; gap: 9px; }
.char { flex: 1; padding: 12px 0 6px; border: 1.5px solid #e2e6ea; border-radius: 15px; background: #fbfcfd; display: grid; place-items: center; transition: .16s; }
.char:hover { border-color: #cfc8f3; transform: translateY(-2px); }
.char.on { border-color: var(--accent); background: #f4f2ff; box-shadow: 0 0 0 3px #eeecff; transform: translateY(-2px); }
.char svg { display: block; }

.welcome-error { margin: -6px 0 0; color: #c9743f; font-size: 12px; font-weight: 700; }
.welcome-error[hidden] { display: none; }
.welcome-start { width: 100%; justify-content: center; }
.text-button { padding: 10px; border-radius: 10px; color: var(--muted); background: transparent; font-size: 12px; font-weight: 700; }
.text-button:hover { color: var(--accent); background: #f4f3fd; }
.text-button[hidden] { display: none; }
.welcome-foot { position: relative; margin: 0; color: #98a0aa; font-size: 11px; font-weight: 600; }

/* ── 프로필 판 ────────────────────────────────────────────────────── */
.sheet-backdrop { position: fixed; inset: 0; z-index: 55; display: grid; place-items: center; padding: 20px; background: rgba(39,51,63,.4); backdrop-filter: blur(3px); }
.sheet-backdrop[hidden] { display: none; }
.sheet-card { width: min(380px, 100%); padding: 24px; border-radius: 22px; background: #fff; box-shadow: 0 30px 70px rgba(56,66,91,.2); }
.sheet-card header { position: relative; display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.sheet-avatar { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; overflow: hidden; background: #f0eff9; }
.sheet-avatar svg { display: block; margin-bottom: -12px; }
.sheet-card header h2 { margin: 0; font-size: 19px; letter-spacing: -.05em; }
.sheet-card header p { margin: 3px 0 0; color: var(--muted); font-size: 12px; font-weight: 700; }
.sheet-card header .review-close { position: absolute; top: -4px; right: -4px; }
.sheet-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0 0 18px; padding: 15px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.sheet-stats div { text-align: center; }
.sheet-stats dt { color: var(--muted); font-size: 10px; font-weight: 700; }
.sheet-stats dd { margin: 4px 0 0; color: var(--ink); font-size: 17px; font-weight: 800; }
.sheet-actions { display: grid; gap: 8px; }
.sheet-actions .secondary-action { width: 100%; text-align: center; }
.secondary-action.danger { color: #b5673c; border-color: #f0dcc9; background: #fdf6f0; }
.sheet-note { margin: 12px 0 0; color: var(--soft-muted); font-size: 10px; font-weight: 600; text-align: center; }

/* 계단 띠·시험 띠의 그림 자리 */
.climb-bar .who, .exam-bar .who { display: grid; place-items: center; line-height: 0; }
.exam-bar .who { color: #b8862f; }
/* 쉼터 이름 옆의 배지 */
.climb-floor { display: inline-flex; align-items: center; gap: 7px; }
.climb-floor svg { display: block; }

/* 계단은 brand.js 가 SVG 로 그립니다. 여기서는 자리와 움직임만 */
.stairs-scroll { position: absolute; inset: 0; display: grid; place-items: end center; padding: 14px 18px 0; }
.stairs-art { max-height: 100%; filter: drop-shadow(0 8px 18px rgba(56,66,91,.08)); }
.stairs-kid { transform-box: fill-box; transform-origin: bottom center; animation: 숨쉬기 2.8s ease-in-out infinite; }
.stairs-kid.hop { animation: 깡충 .85s cubic-bezier(.3,1.5,.5,1); }

/* 빈 화면 — 글자만 있으면 «고장 난 것»처럼 보입니다. 그림 하나가 「비어 있는 게 정상」이라고 말해 줍니다 */
.empty-records { padding: 40px 20px; display: grid; justify-items: center; gap: 4px; text-align: center; }
.empty-records.small { padding: 22px 16px; }
.empty-records .empty-art { margin-bottom: 8px; }
.empty-records.small .empty-art { width: 60px; height: 60px; }
.empty-records strong { color: var(--ink); font-size: 14px; letter-spacing: -.04em; }
.empty-records span { color: var(--muted); font-size: 12px; font-weight: 600; }

/* ── 우리 반으로 들어가기  〔2026-08-20〕 ─────────────────────────────
 *
 * 시작 화면이 두 갈래가 됐습니다. 「혼자 풀기」는 그대로 두었습니다 —
 * 서버가 죽어도, 집에서도, 계정 없이도 앱은 돌아야 하기 때문입니다. */

.welcome-swap {
  display: block;
  width: 100%;
  margin-top: 14px;
  font-size: 13.5px;
  color: var(--muted, #87919b);
}
.welcome-swap:hover { color: var(--accent, #6958d9); }

/* 학급 코드와 비밀번호는 한 글자씩 또박또박 보여야 합니다 —
 * 쪽지에 적힌 것을 그대로 옮겨 치는 것이라, 맞게 쳤는지 눈으로 확인합니다. */
.code-input {
  letter-spacing: .34em;
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
}
.code-input::placeholder { letter-spacing: .34em; font-weight: 600; }
