/* 학습 화면(원리 카드·문제 연습)과 조작 위젯. 부품(parts.css)은 건드리지 않고 이 파일에서만 더한다(E3).
   규칙: 색·크기는 tokens.css 이름만 쓰고, 누름 영역은 44px 이상, 움직임은 0.6초 이하(움직임 줄이기면 없음). */

/* ── 꾸밈 표시: 분수 {f:a/b}, 대분수 {mf:w a/b}, 줄바꿈 ── */
.frac { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; margin: 0 0.12em; line-height: 1.1; font-size: 0.82em; font-variant-numeric: tabular-nums; }
.frac b { font-weight: 600; padding: 0 0.2em; }
.frac b:first-child { border-bottom: 0.1em solid currentColor; }
.mixed { display: inline-flex; align-items: center; gap: 0.12em; }
.mixed-whole { font-weight: 600; }
mark { background: var(--lamp); color: var(--lamp-ink); padding: 0 0.2em; border-radius: 4px; }

/* ── 틀 ── */
.screen.learn { display: flex; flex-direction: column; min-height: 100dvh; padding: calc(6px + var(--sat)) var(--gutter) 0; }
.learn-top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: 52px; gap: 8px; }
.learn-top > :first-child { justify-self: start; }
.learn-top > :last-child { justify-self: end; }
/* 오른쪽 위 구석 친구(H25): 64px 친구가 줄 높이(52px)를 넘지 않게 위아래로 겹쳐 놓는다. 크기는 친구 부품이 config ui.learnFriend 에서 읽는다 */
.learn-top__friend { display: block; margin-block: -6px; }
.learn-top__right { display: flex; align-items: center; gap: var(--sp-2); }
.learn-body { flex: 1; display: flex; flex-direction: column; gap: var(--sp-3); padding: var(--sp-2) 0 var(--sp-4); min-width: 0; }
.learn-bar { position: sticky; bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin: 0 calc(-1 * var(--gutter)); padding: var(--sp-3) var(--gutter) calc(var(--sp-3) + var(--sab)); background: linear-gradient(180deg, rgba(10, 17, 40, 0), rgba(10, 17, 40, 0.96) 28%); z-index: 5; }
.learn-bar__main { margin-left: auto; }
/* 아래 단추 줄(sticky)이 보기·힌트를 덮지 않게: 초점 이동·scrollIntoView가 줄 위까지만 오게 한다(20판, 360×640 '힌트' 가림) */
html:has(.screen.learn) { scroll-padding-bottom: calc(var(--btn-h) + 2 * var(--sp-3) + 8px + var(--sab)); }
.learn-bar__main .ui-btn { min-width: 150px; }
.learn-bag-note { margin: 0; color: var(--text-mute); }
.learn-title { margin: 4px 0 0; font-family: var(--f-head); font-weight: 700; font-size: 22px; line-height: 1.3; }
.learn-text { margin: 0; white-space: pre-line; line-height: 1.6; }
.learn-center { flex: 1; display: grid; align-content: center; justify-items: center; gap: var(--sp-3); text-align: center; padding: var(--sp-5) 0; }
.learn-side { display: flex; gap: var(--sp-2); justify-content: flex-start; }
.learn-chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.learn-hint { margin: 0; color: var(--text-mute); font-size: var(--fs-small); text-align: center; }
.learn-key { font-family: var(--f-head); font-size: 20px; font-weight: 700; }
.learn-monster { margin: 0 0 6px; font-weight: 600; color: var(--c-ghost); }
.learn-score { font-size: 20px; }
.learn-widget { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); padding: var(--sp-3); }
.learn-expr { display: grid; gap: 2px; font-family: var(--f-num); font-variant-numeric: tabular-nums; font-size: 22px; font-weight: 600; text-align: center; }
.learn-expr:empty { display: none; }
.learn-step { padding: var(--sp-3) var(--sp-4); border-left: 4px solid var(--lamp); background: var(--surface-2); border-radius: 0 var(--radius) var(--radius) 0; }
.learn-step:empty { display: none; }

/* 글 안에서 그림으로 바뀐 기호(dom.js SYMBOL_ICONS, 지금은 ✓) */
.sym-icon { width: 1em; height: 1em; vertical-align: -0.12em; }

/* ── 바로 확인·보기 ── */
.learn-choices { display: grid; gap: var(--gap-choice); }
.learn-choice { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 10px 14px; text-align: left; border-radius: var(--radius); border: 2px solid var(--line-strong); background: var(--surface-2); color: var(--text); font-size: var(--fs-problem); cursor: pointer; flex-wrap: wrap; }
.learn-choice__mark { flex: none; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; border: 1.5px solid currentColor; font-size: 15px; font-family: var(--f-num); }
.learn-choice__mark .ui-icon { width: 18px; height: 18px; }
.learn-choice__txt { flex: 1; min-width: 0; }
.learn-choice__tag { flex: none; font-size: var(--fs-small); font-weight: 600; }
.learn-choice.is-picked { border-color: var(--lamp); background: color-mix(in srgb, var(--lamp) 16%, var(--surface-2)); box-shadow: 0 0 0 2px var(--lamp-glow); }
.learn-choice.is-right { border-color: var(--c-science); background: color-mix(in srgb, var(--c-science) 18%, var(--surface-2)); }
.learn-choice.is-maybe { border-style: dashed; border-color: var(--off-ink); color: var(--text-mute); } /* 글은 4.5:1 이상(24판 #14: 내가 고른 것 4.1:1) */
.learn-feedback, .learn-result { padding: var(--sp-3) var(--sp-4); border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); display: grid; gap: 6px; }
.learn-feedback:empty { display: none; }
.learn-feedback.is-good, .learn-result.is-good { border-color: var(--c-science); }
.learn-feedback.is-good > b::before, .learn-result.is-good > b::before { content: "✓ "; color: var(--c-science); }
.learn-feedback.is-soft, .learn-result.is-soft { border-color: var(--lamp); }

/* 첫 오답 뒤(H55): 어디를 볼까 한 줄 + 풀이 볼래요 / 귀신 문제를 맞힌 자리(H52): 물리쳤어요 + 불빛 +1 */
.learn-again { gap: var(--sp-2); }
.learn-again > b { color: var(--lamp); }
.learn-ghost-down { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); font-weight: 600; color: var(--c-ghost); }
.learn-lamp-chip { display: inline-block; padding: 1px 10px; border-radius: 999px; border: 1.5px solid var(--lamp); color: var(--lamp); font-size: var(--fs-small); font-weight: 600; }
/* 결과 화면(H54): 켜진(또는 꺼진) 가로등 + 별 칸 / 학교 복습 앞 핵심 모음 요약(H53) */
.result-lamp-row { display: flex; align-items: flex-end; justify-content: center; gap: var(--sp-3); }
.result-stars { display: flex; gap: 4px; padding-bottom: 6px; color: var(--off-ink); }
.result-star { display: grid; place-items: center; width: 30px; height: 30px; }
.result-star .ui-icon { width: 28px; height: 28px; }
.result-star.is-got { color: var(--lamp); filter: drop-shadow(0 0 6px var(--lamp-glow)); }
.learn-summary { margin: 0; padding-left: 1.4em; display: grid; gap: var(--sp-3); text-align: left; }

/* ── 문제 ── */
.learn-prompt { font-size: var(--fs-problem); font-weight: 500; }
.learn-passage { margin-bottom: var(--sp-3); padding-bottom: var(--sp-3); border-bottom: 1px dashed var(--paper-line); display: grid; gap: 4px; }
.learn-figure { margin-top: var(--sp-3); }
.learn-hintbox { display: grid; gap: var(--sp-2); padding: var(--sp-3); border: 1px dashed var(--line-strong); border-radius: var(--radius); background: var(--surface); }
.learn-hintbox[hidden], .learn-result[hidden], .learn-solution[hidden], .learn-hint[hidden] { display: none; }
.learn-hint-tabs { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.learn-hint-lines { display: grid; gap: 4px; }
.learn-steps { margin: 0; padding-left: 1.4em; display: grid; gap: 6px; }
.learn-solution { display: grid; gap: var(--sp-2); }
.learn-input { display: grid; gap: var(--sp-3); }
/* 숫자 키패드가 있는 입력(R24): 칸과 키패드를 주 단추 줄 바로 위에 붙여 둔다. 화면이 낮아도 처음부터 보이고, 내용은 그 위에서 스크롤된다.
   키는 48px(누름 영역 44px 이상). 아래 간격(--learn-bar-h)은 주 단추 줄 높이(padding 12+12 + 단추 --btn-h)이고 tests/e2e/keypad.e2e.test.mjs 가 겹치지 않는지 본다. */
.screen.learn { --learn-bar-h: calc(var(--sp-3) * 2 + var(--btn-h) + var(--sab)); }
.learn-input.has-pad { position: sticky; bottom: var(--learn-bar-h, 80px); z-index: 4; margin: 0 calc(-1 * var(--gutter)); padding: var(--sp-2) var(--gutter) var(--sp-2); gap: var(--sp-2); background: linear-gradient(180deg, rgba(10, 17, 40, 0), var(--sky0) 14px); }
.learn-blankbox { display: contents; } /* 칸 묶음이 본문의 직접 자식처럼 붙어야 위 sticky 가 본문 안에서 움직인다 */
.learn-input.has-pad .learn-field { min-height: 52px; }
.learn-input.has-pad .ui-key { min-height: 48px; }
.learn-keypad[hidden] { display: none; }
.learn-keypad .ui-keypad__display { display: none; } /* 답은 위의 칸에 보인다 */
.learn-keypad .ui-key--main { display: none; } /* 확인은 오른쪽 아래 주 행동 버튼 하나만(11절) */
.learn-fields { display: grid; gap: var(--sp-2); }
/* 낮은 폰(높이 700px 이하, 예: 360×640): 숫자 키패드를 가로 6칸 두 줄(1~6 / 7 8 9 0 ⌫)로, 간격만 줄여서 □ 줄이 처음 화면에 들어오게 한다.
   글자 크기는 그대로(제목 22·본문 19·이름표 14), 키는 44px 이상. 높은 폰(390×844)은 위의 3×4 키패드 그대로. 칸 묶음이 있는 화면에서만(:has) 적용해 다른 학습 화면은 안 바뀐다.
   위 --learn-bar-h 도 주 단추 줄을 줄인 만큼 같이 줄인다(tests/e2e/keypad.e2e.test.mjs 가 겹치지 않는지 본다). */
@media (max-height: 700px) {
  .screen.learn:has(.learn-input.has-pad) { --learn-bar-h: calc(var(--sp-2) * 2 + var(--btn-h) + var(--sab)); }
  .screen.learn:has(.learn-input.has-pad) .learn-bar { padding-top: var(--sp-2); padding-bottom: calc(var(--sp-2) + var(--sab)); }
  .screen.learn:has(.learn-input.has-pad) .learn-body { gap: 6px; padding-top: 4px; }
  .screen.learn:has(.learn-input.has-pad) .learn-title { margin-top: 0; } /* 제목이 두 줄로 접히는 카드(앉은 자리…)도 □ 줄이 들어오게 */
  .screen.learn:has(.learn-input.has-pad) .ui-card { padding: 10px 14px; }
  .screen.learn:has(.learn-input.has-pad) .learn-lines { gap: 4px; }
  .screen.learn:has(.learn-input.has-pad) .learn-line { padding-top: 4px; padding-bottom: 4px; }
  .learn-input.has-pad { padding-top: 4px; padding-bottom: 4px; gap: 6px; }
  .learn-input.has-pad .learn-field { min-height: 44px; }
  .learn-input.has-pad .ui-keypad__grid { grid-template-columns: repeat(6, 1fr); gap: 6px; }
  .learn-input.has-pad .ui-key { min-height: 44px; }
  .learn-input.has-pad .ui-key--sub { order: 2; } /* 7 8 9 0 ⌫ 순서로 보이게(모양만 바뀌고 키 역할은 그대로) */
}
.learn-fields.is-multi { grid-template-columns: 1fr 1fr; }
.learn-field { display: flex; align-items: baseline; justify-content: flex-end; gap: 6px; flex-wrap: wrap; min-height: 56px; padding: 6px 14px; border-radius: var(--radius); border: 2px dashed var(--line-strong); background: var(--surface); color: var(--text); font-family: var(--f-num); font-size: 24px; font-weight: 600; cursor: pointer; }
.learn-field__label { margin-right: auto; font-family: var(--f-body); font-size: var(--fs-small); font-weight: 400; color: var(--text-mute); }
.learn-field__unit { font-family: var(--f-body); font-size: var(--fs-small); font-weight: 400; color: var(--text-mute); }
.learn-field.is-active { border-style: solid; border-color: var(--lamp); background: color-mix(in srgb, var(--lamp) 12%, var(--surface)); }
.learn-fraction { display: flex; align-items: center; justify-content: center; gap: var(--sp-4); }
.learn-fraction__stack { display: grid; gap: 4px; justify-items: stretch; width: 120px; }
.learn-fraction__bar { height: 3px; background: var(--text); border-radius: 2px; }
.learn-fraction .learn-field { min-width: 120px; justify-content: center; }
.learn-char { margin: 0; font-family: var(--f-hanja); font-size: 72px; text-align: center; line-height: 1.2; }
.learn-self { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap-choice); }
.ui-dot.is-miss { border: 2px solid #FF9B9B; background: linear-gradient(#FF9B9B, #FF9B9B) center / 6px 2px no-repeat; }

/* ═══ 조작 위젯 ═══ */
.wd { --wd-ink: var(--text); --wd-line: var(--line-strong); --wd-fill: var(--c-math); --wd-accent: var(--lamp); --wd-bg: var(--surface-2); display: grid; gap: var(--sp-3); color: var(--wd-ink); min-width: 0; }
.ui-card--paper .wd { --wd-ink: var(--paper-ink); --wd-line: #5C6BA8; --wd-fill: #2F6BD6; --wd-accent: #B26A00; --wd-bg: #E3E9FA; }
.wd-out { margin: 0; min-height: 1.4em; text-align: center; color: var(--wd-ink); opacity: 0.85; font-size: var(--fs-small); }
.wd-controls { display: flex; flex-wrap: wrap; gap: var(--gap-choice); justify-content: center; }
.wd-press { display: block; width: 100%; min-height: var(--touch); margin: 0; padding: var(--sp-2); border: 2px dashed var(--wd-line); border-radius: var(--radius); background: transparent; color: inherit; cursor: pointer; }
.wd-press:active { filter: brightness(0.9); }
.wd-soon { display: grid; gap: 4px; justify-items: center; padding: var(--sp-5) var(--sp-3); color: var(--text-mute); }
.wd-soon b { color: var(--text); }

/* 수직선 */
.wd-nl { width: 100%; height: auto; display: block; overflow: visible; }
.wd-nl__axis { stroke: var(--wd-ink); stroke-width: 2.5; }
.wd-nl__tick { stroke: var(--wd-ink); stroke-width: 1.5; }
.wd-nl__label { fill: var(--wd-ink); font-size: 13px; font-family: var(--f-num); }
.wd-nl__dot { fill: var(--wd-accent); stroke: var(--wd-ink); stroke-width: 2; }
.wd-nl__mark { fill: var(--wd-fill); }
.wd-nl__arc { stroke: var(--wd-fill); stroke-width: 2.5; stroke-dasharray: 5 4; }

/* 색칠 */
.wd-grid { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 4px; justify-self: center; width: 100%; max-width: calc(var(--cols) * 52px); }
.wd-cell { aspect-ratio: 1; min-height: 28px; padding: 0; border: 2px dashed var(--wd-line); border-radius: 6px; background: transparent; cursor: pointer; }
.wd-cell.is-on { border-style: solid; border-color: var(--wd-ink); background: var(--wd-fill); }
.wd-grid--bar .wd-cell { aspect-ratio: auto; min-height: var(--touch); }
.wd-pie { width: 180px; height: 180px; justify-self: center; }
.wd-pie__slice { fill: transparent; stroke: var(--wd-ink); stroke-width: 2; stroke-dasharray: 4 3; cursor: pointer; }
.wd-pie__slice.is-on { fill: var(--wd-fill); stroke-dasharray: none; }

/* 분수 막대 */
.wd-bar { display: grid; grid-template-columns: repeat(var(--den), minmax(0, 1fr)); gap: 3px; }
.wd-seg { min-height: var(--touch); padding: 0; border: 2px solid var(--wd-ink); border-radius: 6px; background: transparent; cursor: pointer; }
.wd-seg[aria-disabled="true"] { cursor: default; }
.wd-seg.is-on { background: var(--wd-fill); }
.wd-seg.is-add { border-style: dashed; background: repeating-linear-gradient(45deg, transparent 0 5px, color-mix(in srgb, var(--wd-accent) 40%, transparent) 5px 8px); }
.wd-seg.is-add.is-on { border-style: solid; background: var(--wd-accent); }
.wd-seg.is-sub.is-on { border-style: dotted; }
.wd-seg.is-sub:not(.is-on) { border-style: dashed; background: repeating-linear-gradient(-45deg, transparent 0 5px, color-mix(in srgb, var(--wd-ink) 30%, transparent) 5px 7px); }
.wd-fraction[data-invalid="true"] .wd-seg { opacity: 0.5; }

/* 표·그래프 */
.wd-svg { width: 100%; height: auto; display: block; }
.wd-grid-line { stroke: var(--wd-line); stroke-width: 1; stroke-dasharray: 3 3; opacity: 0.6; }
.wd-axis { stroke: var(--wd-ink); stroke-width: 2; fill: none; }
.wd-axis-text { fill: var(--wd-ink); font-size: 12px; font-family: var(--f-num); }
.wd-barrect { fill: var(--wd-fill); stroke: var(--wd-ink); stroke-width: 1.5; }
.wd-line { stroke: var(--wd-fill); stroke-width: 3; }
.wd-pt { fill: var(--wd-accent); stroke: var(--wd-ink); stroke-width: 1.5; }
.wd-table { width: 100%; border-collapse: collapse; font-size: var(--fs-small); }
.wd-table th, .wd-table td { padding: 8px 10px; border: 1px solid var(--wd-line); text-align: center; }
.wd-table th { font-weight: 600; background: var(--wd-bg); }
.wd-table .is-total { font-weight: 600; }
.wd-pic { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.wd-pic li { display: flex; align-items: center; gap: 10px; }
.wd-pic__label { flex: none; width: 5.5em; font-size: var(--fs-small); }
.wd-pic__dots { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.wd-pic__dots i { display: inline-block; border-radius: 50%; background: var(--wd-fill); border: 1.5px solid var(--wd-ink); }
.wd-pic__dots i.big { width: 20px; height: 20px; }
.wd-pic__dots i.small { width: 10px; height: 10px; }
.wd-pic .wd-pic__legend { display: block; color: var(--wd-ink); opacity: 0.8; font-size: 13px; }

/* 분류·순서·짝·빈칸 공통 조각 */
.wd-item { min-height: var(--touch); padding: 6px 14px; border-radius: var(--radius); border: 2px solid var(--wd-line); background: var(--wd-bg); color: var(--wd-ink); font-size: var(--fs-body); cursor: pointer; overflow-wrap: anywhere; display: inline-flex; align-items: center; gap: 6px; }
.wd-item[data-jamo] { font-size: 1.5em; line-height: 1.1; font-weight: 600; } /* 자음·모음 글자는 글꼴에서 작게 그려져 키운다(칸 높이 48 이상은 그대로) */
.wd-item.is-picked { border-color: var(--wd-accent); box-shadow: 0 0 0 2px var(--lamp-glow); }
.wd-item.is-maybe { border-style: dashed; }
.wd-item__ask { font-size: 12px; opacity: 0.8; }
.wd-item.is-paired { border-style: dashed; opacity: 0.8; cursor: default; }
.wd-item[aria-disabled="true"] { cursor: default; }
.wd-no { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--wd-accent); color: var(--lamp-ink); font-size: 13px; font-weight: 600; }
.wd-tray { display: flex; flex-wrap: wrap; gap: var(--gap-choice); min-height: var(--touch); }
.wd-bins { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: var(--gap-choice); }
.wd-bin { display: grid; align-content: start; gap: 6px; min-height: 96px; padding: 8px; border-radius: var(--radius); border: 2px dashed var(--wd-line); background: transparent; color: var(--wd-ink); text-align: center; }
.wd-bin__put { min-height: var(--touch); padding: 4px 10px; border: 0; border-radius: 10px; background: color-mix(in srgb, var(--wd-ink) 10%, transparent); color: inherit; font: inherit; font-weight: 600; cursor: pointer; }
.wd-bin.is-target { border-color: var(--wd-accent); border-style: solid; }
.wd-bin__list { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.wd-slots { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.wd-slot__btn { display: flex; align-items: center; gap: 10px; width: 100%; min-height: var(--touch); padding: 4px 12px; border-radius: var(--radius); border: 2px dashed var(--wd-line); background: transparent; color: var(--wd-ink); text-align: left; cursor: pointer; }
.wd-slot.is-filled .wd-slot__btn { border-style: solid; background: var(--wd-bg); }
.wd-slot__no { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid currentColor; font-size: 14px; font-family: var(--f-num); }
.wd-cols { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); }
.wd-col { display: grid; gap: var(--gap-choice); align-content: start; }
.wd-col .wd-item { justify-content: center; text-align: center; }
.wd-fill__text { margin: 0; line-height: 2.2; white-space: pre-line; }
.wd-blank { display: inline-block; vertical-align: middle; min-width: 72px; min-height: var(--touch); padding: 0 10px; margin: 0 4px; border: 0; border-bottom: 3px solid var(--wd-accent); border-radius: 6px 6px 0 0; background: color-mix(in srgb, var(--wd-accent) 14%, transparent); color: var(--wd-ink); font: inherit; font-weight: 600; cursor: pointer; }
.wd-blank.is-filled { background: var(--wd-bg); }
.wd-blank__x { margin-left: 6px; font-size: var(--fs-small); font-weight: 400; opacity: 0.65; line-height: 1; }

/* 수 모형·배열 */
.wd-btb { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; justify-content: center; min-height: 72px; padding: var(--sp-2); }
.wd-btb__grp { display: flex; flex-wrap: wrap; gap: 5px; align-items: flex-end; }
.wd-btb__grp i { display: block; border: 2px solid var(--wd-ink); background: var(--wd-fill); border-radius: 3px; }
.wd-btb__cube i { width: 52px; height: 52px; }
.wd-btb__flat i { width: 44px; height: 44px; background-image: linear-gradient(var(--wd-ink) 1px, transparent 1px), linear-gradient(90deg, var(--wd-ink) 1px, transparent 1px); background-size: 10% 10%; }
.wd-btb__rod i { width: 10px; height: 44px; }
.wd-btb__one i { width: 10px; height: 10px; }
.wd-dots { display: grid; grid-template-columns: repeat(var(--cols), 1fr); gap: 6px; justify-items: center; max-width: 320px; margin: 0 auto; }
.wd-dots i { width: 16px; height: 16px; border-radius: 50%; background: var(--wd-fill); border: 1.5px solid var(--wd-ink); }

/* ── 움직임: 0.6초 이하, 움직임 줄이기면 없음 ── */
@media (prefers-reduced-motion: no-preference) {
  .wd-item.is-shake { animation: wd-shake 360ms ease-in-out; }
  .learn-choice, .wd-seg, .wd-cell, .wd-item { transition: background-color var(--t-fast) ease, border-color var(--t-fast) ease; }
}
@keyframes wd-shake { 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }
@media (prefers-reduced-motion: reduce) {
  .learn *, .wd * { animation: none !important; transition: none !important; }
}

/* ═══ 표현 도구 4종(수모형·배열·분수 막대·수직선)과 원리 흐름 화면 ═══
   색 묶음 c1~c3: 색 + 테두리·밑줄 무늬(c1 실선, c2 파선, c3 점선)를 함께 써서 색만으로 구분하지 않는다(11절). */
:root { --tc-c1: #76B2FF; --tc-c2: #5FE0BB; --tc-c3: #D2B8FF; }
.tc-c1 { --tc: var(--tc-c1); --tc-style: solid; }
.tc-c2 { --tc: var(--tc-c2); --tc-style: dashed; }
.tc-c3 { --tc: var(--tc-c3); --tc-style: dotted; }
.tl { gap: var(--sp-3); grid-template-columns: minmax(0, 1fr); }
.tl-note { margin: 0; text-align: center; font-family: var(--f-num); font-weight: 700; font-size: 17px; color: var(--lamp); }
.tl-note[hidden] { display: none; }
.tl-legend { margin: 0; text-align: center; font-size: var(--fs-small); color: var(--text-mute); font-family: var(--f-num); }
.tl-count { align-self: center; font-family: var(--f-num); font-weight: 600; min-width: 4.5em; text-align: center; }
.tl-sum { font-family: var(--f-num); font-variant-numeric: tabular-nums; }

/* 수모형 */
.tl-bt { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: var(--sp-3); }
.tl-bt__col { display: grid; align-content: start; justify-items: center; gap: var(--sp-2); min-height: 150px; padding: var(--sp-2); color: var(--text); font: inherit; border: 3px var(--tc-style, dashed) var(--tc, var(--line-strong)); border-radius: var(--radius); background: color-mix(in srgb, var(--tc, var(--line-strong)) 10%, transparent); }
button.tl-bt__col { cursor: pointer; }
button.tl-bt__col[aria-disabled="true"] { cursor: default; }
button.tl-bt__col:not([aria-disabled="true"]) { box-shadow: 0 0 0 2px var(--lamp-glow); }
.tl-bt__name { font-weight: 700; }
.tl-bt__count { font-family: var(--f-num); font-weight: 700; font-size: 24px; line-height: 1; }
.tl-bt__blocks { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-end; justify-content: center; min-height: 52px; }
.tl-bt__blocks i { display: block; border: 2px solid var(--text); border-radius: 3px; background: var(--tc, var(--wd-fill)); }
.tl-bt__blocks--h i { width: 36px; height: 36px; background-image: linear-gradient(var(--text) 1px, transparent 1px), linear-gradient(90deg, var(--text) 1px, transparent 1px); background-size: 10% 10%; background-color: var(--tc, var(--wd-fill)); }
.tl-bt__blocks--t i { width: 12px; height: 48px; }
.tl-bt__blocks--o i { width: 12px; height: 12px; }
.tl-bt__bundle { display: grid; grid-template-columns: repeat(5, 12px); gap: 5px; padding: 5px; border: 2px dashed var(--text); border-radius: 6px; }

/* 배열 */
.tl-ar { display: grid; justify-items: center; gap: var(--sp-2); }
.tl-ar__row { display: flex; align-items: center; gap: var(--sp-2); }
.tl-ar__tag { font-family: var(--f-num); font-weight: 600; padding: 2px 10px; border-radius: 999px; border: 2px var(--tc-style, solid) var(--tc, transparent); }
.tl-ar__tag--rows { writing-mode: horizontal-tb; }
.tl-ar__grid { display: grid; grid-template-columns: repeat(var(--cols), 20px); gap: 7px; padding: var(--sp-2); }
.tl-ar__grid i { width: 20px; height: 20px; border-radius: 50%; background: var(--wd-fill); border: 1.5px solid var(--text); }

/* 분수 막대 */
.tl-fb__name { margin: 0; min-height: 2.4em; display: grid; place-items: center; font-family: var(--f-num); font-weight: 700; font-size: 22px; }
.tl-fb__bar { display: flex; gap: 3px; padding: 3px; border: 3px var(--tc-style, solid) var(--tc, var(--line-strong)); border-radius: 10px; }
.tl-fb__seg { flex: 1 1 0; display: block; min-width: 0; min-height: 56px; padding: 0; border: 2px solid var(--text); border-radius: 5px; background: transparent; cursor: default; }
button.tl-fb__seg { cursor: pointer; }
.tl-fb__seg.is-on { background: var(--shade, var(--wd-fill)); border-style: solid; }
.tl-fb__seg.is-on::after { content: ""; display: block; height: 100%; background: repeating-linear-gradient(45deg, transparent 0 6px, rgba(10, 17, 40, 0.28) 6px 8px); }
.tl-fb__bar--cmp .tl-fb__seg { min-height: 40px; }
.tl-fb__cmpwrap { display: grid; gap: var(--sp-2); }
.tl-fb__cmpwrap .tl-fb__name { min-height: 1.6em; font-size: 17px; }

/* 수직선 */
.tl-nl__stage { position: relative; }
.tl-nl__svg { display: block; width: 100%; height: auto; }
.tl-nl__labels { position: relative; height: 2.6em; margin-top: -4px; }
.tl-nl__lab { position: absolute; top: 0; transform: translateX(-50%); font-family: var(--f-num); font-size: 13px; white-space: nowrap; }
.tl-nl__ticks { position: absolute; left: 0; right: 0; top: 0; height: 88px; }
.tl-nl__tickbtn { position: absolute; top: 0; height: 88px; transform: translateX(-50%); padding: 0; border: 0; background: transparent; cursor: pointer; border-radius: 6px; }
.tl-nl__tickbtn:hover, .tl-nl__tickbtn[aria-pressed="true"] { background: color-mix(in srgb, var(--tc-c1) 16%, transparent); }
.tl-nl__arc { stroke: var(--tc, var(--wd-fill)); stroke-width: 3; }
.tl-nl__arc.tc-c2 { stroke-dasharray: 6 4; }
.tl-nl__arc.tc-c3 { stroke-dasharray: 2 4; }
.tl-nl__mark { fill: var(--tc, var(--wd-fill)); stroke: var(--text); stroke-width: 2; }

/* 식: 그림과 같은 색 + 같은 밑줄 무늬 */
.tl-formula { margin: 0; display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline; gap: 6px 10px; font-family: var(--f-num); font-variant-numeric: tabular-nums; font-size: 26px; font-weight: 600; min-height: 1.6em; }
.tl-fx { padding: 0 6px 2px; border-bottom: 4px var(--tc-style, solid) var(--tc, transparent); }
.tl-fx.tc { color: color-mix(in srgb, var(--tc) 55%, var(--text)); }
.tl-fx--op { border-bottom-color: transparent; }
.tl-fx.is-hot { background: color-mix(in srgb, var(--tc) 28%, transparent); border-radius: 6px 6px 0 0; }
.tl-fx .frac { font-size: 0.8em; }

/* 손가락 시범(0.6초): 터치 점이 다가와 한 번 누른다 */
.learn-widget { position: relative; }
.tl-finger { position: absolute; z-index: 3; width: 36px; height: 36px; margin: -18px 0 0 -18px; border-radius: 50%; background: color-mix(in srgb, var(--lamp) 70%, transparent); border: 3px solid var(--lamp); pointer-events: none; box-shadow: 0 0 0 6px var(--lamp-glow); }
.is-demo { outline: 3px solid var(--lamp); outline-offset: 2px; }
@media (prefers-reduced-motion: no-preference) {
  .tl-finger { animation: tl-finger 600ms ease-out both; }
}
@keyframes tl-finger { 0% { opacity: 0; transform: translate(28px, 32px) scale(1.2); } 70% { opacity: 1; transform: translate(0, 0) scale(1.2); } 100% { opacity: 1; transform: translate(0, 0) scale(0.9); } }

/* 원리 흐름 화면 */
.learn-flowtext { display: grid; gap: var(--sp-2); }
.learn-flowtext .learn-text { font-size: var(--fs-problem); }
.learn-replay { justify-content: center; }
.learn-column { justify-self: center; display: grid; grid-template-columns: auto repeat(var(--n), 2.2em); gap: 2px 6px; font-family: var(--f-num); font-size: 26px; font-variant-numeric: tabular-nums; text-align: right; padding: var(--sp-2) var(--sp-4); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.learn-column__op { text-align: center; }
.learn-column__cell { padding: 0 2px; border-radius: 6px; border-bottom: 3px solid transparent; min-height: 1.4em; }
.learn-column__cell.is-here { background: color-mix(in srgb, var(--lamp) 26%, transparent); border-bottom: 3px double var(--lamp); }
.learn-column__rule { grid-column: 1 / -1; height: 2px; background: var(--text); }
.learn-column__name { grid-column: 1 / -1; margin: 0; font-family: var(--f-body); font-size: var(--fs-small); text-align: center; color: var(--lamp); min-height: 1.4em; }
.learn-lines { margin: 0; padding: 0; list-style: none; display: grid; gap: var(--sp-2); }
.learn-line { width: 100%; display: flex; align-items: center; gap: 10px; min-height: var(--touch); padding: 8px 12px; text-align: left; font: inherit; color: var(--text); border-radius: var(--radius); border: 2px dashed var(--line-strong); background: var(--surface); }
button.learn-line { cursor: pointer; }
.learn-line.is-here { border-style: solid; border-color: var(--lamp); background: color-mix(in srgb, var(--lamp) 14%, var(--surface)); }
.learn-line.is-blank { border-style: solid; }
/* 다 푼 문제(H28): 모든 줄이 처음부터 보이고 누를 때마다 한 줄씩 밝아진다. 밝아지는 건 불투명도뿐(움직임 줄이기면 바로 바뀜) */
/* 한 칸 빈 문제(H31): □ 뒤 줄은 글을 그리지 않고 줄 자리(번호 + 줄무늬 가림 칸)만 둔다. 채우면 글이 차례로 나타난다(0.6초 안, 움직임 줄이기면 한꺼번에) */
.learn-line.is-masked { border-style: dashed; }
.learn-mask { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: flex-end; height: 28px; padding: 0 10px; border-radius: 8px; background: repeating-linear-gradient(90deg, var(--panel) 0 14px, var(--panel2) 14px 28px); }
.learn-mask__tag { font-size: var(--fs-small); line-height: 1.3; color: var(--mute); }
.learn-line.is-appear { animation: learn-appear var(--t-fast) ease both; animation-delay: calc(var(--k, 0) * var(--t-star-step)); }
@keyframes learn-appear { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.learn-line.is-dim { opacity: 0.5; transition: opacity var(--t-fast) ease; }
.learn-line.is-lit { transition: opacity var(--t-fast) ease; }
.learn-line.is-lit:not(.is-here) { opacity: 0.8; border-style: solid; }
.learn-segs { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 4px; }
.learn-segs i { display: block; width: 22px; height: 6px; border-radius: 3px; background: var(--line); }
.learn-segs i.on { background: var(--lamp); }
/* 접어 둔 다 푼 문제(H50): 한 칸 빈 문제 화면 위. 접힘 = 작은 단추 하나, 펼침 = 단추 아래 테두리 상자(풀이 줄은 처음부터 모두 흐리게, '다음 줄 볼래요'로 한 줄씩 밝아짐).
   아래에 이어지는 한 칸 빈 문제와 섞이지 않게 상자에 테두리·바탕을 둔다. 움직임은 120ms 이하, 움직임 줄이기면 없음 */
.learn-fold { display: grid; gap: var(--sp-2); justify-items: start; }
.learn-fold__body { width: 100%; display: grid; gap: var(--sp-3); padding: var(--sp-3); border: 1px solid var(--line-strong); border-radius: var(--radius-lg); background: color-mix(in srgb, var(--surface) 80%, transparent); }
.learn-fold__body[hidden], .learn-fold__next[hidden] { display: none; }
.learn-fold__next { justify-self: end; }
@media (prefers-reduced-motion: no-preference) { .learn-fold__body { animation: learn-appear var(--t-fast) ease both; } }
.screen.learn:has(.learn-input.has-pad) .learn-fold__body { gap: 6px; padding: 8px 10px; }
.learn-line__no { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid currentColor; font-size: 14px; font-family: var(--f-num); }
.learn-recheck__title { margin: 0; }
.tl-narrow { min-width: 0; }
.tl-fx.is-pending { opacity: 0.5; }

.tl-nl__start { stroke: var(--tc, var(--lamp)); stroke-width: 3; }
.tl-nl__start.tc-c2 { stroke-dasharray: 5 3; }
.tl-nl__start.tc-c3 { stroke-dasharray: 2 3; }
.tl-frac { display: inline-flex; flex-direction: column; align-items: stretch; text-align: center; font-size: 0.8em; line-height: 1.15; vertical-align: middle; }
.tl-frac__bar { display: block; height: 3px; background: var(--text); border-radius: 2px; margin: 2px 0; }
.tl-frac .tl-fx { padding-bottom: 0; }
.learn-widget + .learn-widget { margin-top: 0; }

/* ── 카드 안 남은 칸 띠(H36, ui.cardProgress): 지난 칸 채움 · 지금 칸 고리 · 남은 칸 점선 + 숫자 글 ── */
.learn-cardstrip { display: flex; align-items: center; gap: var(--sp-3); margin: 2px 0 0; min-width: 0; }
.learn-cardstrip__segs { display: flex; flex: 1; gap: 4px; min-width: 0; max-width: 220px; }
.learn-cardstrip__segs i { flex: 1; height: 8px; border-radius: 4px; border: 1.5px dashed var(--line-strong); box-sizing: border-box; }
.learn-cardstrip__segs i.is-done { background: var(--lamp); border: 1.5px solid var(--lamp); }
.learn-cardstrip__segs i.is-now { flex: 1.5; border: 2px solid var(--lamp); background: transparent; }
.learn-cardstrip__text { flex: none; margin-left: auto; color: var(--mute); font-size: var(--fs-small); line-height: 1.3; }

/* ═══ 빌드 37: 문제은행 새 답 입력(src/ui/screens/learn/inputs-bank.js) ═══
   O/X · 빈칸 고르기 · 짝 맞추기 · 나누기 · 차례. 누르는 칸 48px 이상, 색 + 번호·모양·글자로 뜻을 함께 전한다. 움직임은 쓰지 않는다. */
.bank-slot-1 { --slot: var(--lamp); }
.bank-slot-2 { --slot: var(--c-math); }
.bank-slot-3 { --slot: var(--c-science); }
.bank-slot-4 { --slot: var(--c-moral); }
.bank-slot-5 { --slot: var(--c-rush); }
.bank-slot-6 { --slot: var(--text-mute); }
/* 번호 표시: 번호마다 모양도 다르다(동그라미·네모·마름모·육각형·오각형·팔각형) */
.bank-badge, .bank-tile__badge { flex: none; display: inline-grid; place-items: center; width: 30px; height: 30px; font-family: var(--f-num); font-size: 15px; font-weight: 700; line-height: 1; }
.bank-badge { background: var(--slot); color: var(--sky0); }
.bank-badge .ui-icon { width: 18px; height: 18px; }
.bank-badge.bank-slot-1 { border-radius: 50%; }
.bank-badge.bank-slot-2 { border-radius: 6px; }
.bank-badge.bank-slot-3 { clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.bank-badge.bank-slot-4 { clip-path: polygon(25% 5%, 75% 5%, 100% 50%, 75% 95%, 25% 95%, 0 50%); }
.bank-badge.bank-slot-5 { clip-path: polygon(50% 0, 100% 38%, 82% 100%, 18% 100%, 0 38%); }
.bank-badge.bank-slot-6 { clip-path: polygon(30% 0, 70% 0, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0 70%, 0 30%); }
.bank-tile__badge:not(.bank-badge) { border: 2px dashed var(--line-strong); border-radius: 50%; }
.bank-status { min-height: 1.5em; }
.bank-tag { flex: none; font-size: var(--fs-small); font-weight: 600; }

/* O/X */
.bank-ox-row { grid-template-columns: 1fr 1fr; gap: var(--gap-choice); }
.bank-ox { display: grid; justify-items: center; align-content: center; gap: 2px; min-height: 92px; padding: 8px; border-radius: var(--radius-lg); border: 2px solid var(--line-strong); background: var(--surface-2); color: var(--text); cursor: pointer; }
.bank-ox__glyph { font-family: var(--f-num); font-size: 44px; font-weight: 700; line-height: 1; }
.bank-ox__word { font-size: var(--fs-body); }
.bank-ox__tag { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-small); font-weight: 600; }
.bank-ox__tag .ui-icon { width: 16px; height: 16px; }
.bank-ox.is-picked { border-color: var(--lamp); background: color-mix(in srgb, var(--lamp) 16%, var(--surface-2)); box-shadow: 0 0 0 2px var(--lamp-glow); }
.bank-ox.is-right { border-color: var(--c-science); background: color-mix(in srgb, var(--c-science) 18%, var(--surface-2)); }
.bank-ox.is-maybe { border-style: dashed; border-color: var(--off-ink); color: var(--text-mute); }

/* 빈칸 고르기 */
.bank-blank { margin: 0; display: flex; align-items: center; gap: var(--sp-3); }
.bank-blank__label { color: var(--text-mute); font-size: var(--fs-small); }
.bank-blank__box { min-width: 64px; min-height: 48px; padding: 4px 14px; display: inline-grid; place-items: center; border-radius: var(--radius); border: 2px dashed var(--line-strong); background: var(--surface); font-size: 24px; font-weight: 600; }
.bank-blank__box.is-filled { border-style: solid; border-color: var(--lamp); }
.bank-fill__grid { grid-template-columns: 1fr 1fr; }
.bank-fill__opt.is-big .learn-choice__txt { font-family: var(--f-hanja); font-size: 34px; line-height: 1.2; text-align: center; }
.bank-fill__opt.is-big { min-height: 72px; }

/* 짝 맞추기 */
.bank-match__cols { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap-choice) 14px; align-items: start; }
.bank-col { display: grid; gap: var(--gap-choice); min-width: 0; }
.bank-tile { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; width: 100%; min-height: 56px; padding: 8px 10px; text-align: left; border-radius: var(--radius); border: 2px solid var(--line-strong); background: var(--surface-2); color: var(--text); font-size: var(--fs-body); line-height: 1.35; cursor: pointer; }
.bank-tile__txt { flex: 1; min-width: 0; overflow-wrap: anywhere; }
/* 자음·모음 글자(ㅎ ㅊ ㄹ ㄴ)는 글꼴에서 작게 그려져 보기 이름보다 작아 보인다 → 키운다(줄 높이를 낮춰 칸이 넘치지 않게) */
.bank-tile__txt[data-jamo] { font-size: 1.6em; line-height: 1.1; font-weight: 600; }
.bank-tile__note { flex-basis: 100%; font-size: var(--fs-small); color: var(--text-mute); }
.bank-tile.is-paired { border-color: var(--slot); background: color-mix(in srgb, var(--slot) 16%, var(--surface-2)); }
.bank-tile.is-armed { border-color: var(--lamp); background: color-mix(in srgb, var(--lamp) 16%, var(--surface-2)); box-shadow: 0 0 0 3px var(--lamp-glow), inset 0 0 0 2px var(--lamp); }
.bank-tile.is-right { border-color: var(--c-science); background: color-mix(in srgb, var(--c-science) 18%, var(--surface-2)); }
.bank-tile.is-maybe { border-style: dashed; }

/* 나누기 · 차례 공통: 말(칩)과 쌓는 곳 */
.bank-pool { display: flex; flex-wrap: wrap; gap: var(--sp-2); padding: var(--sp-2); border-radius: var(--radius); background: color-mix(in srgb, var(--surface) 60%, transparent); }
.bank-pool.is-empty { display: none; }
.bank-chip { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; min-height: 48px; min-width: 48px; padding: 8px 14px; border-radius: var(--radius); border: 2px solid var(--line-strong); background: var(--surface-2); color: var(--text); font-size: var(--fs-body); line-height: 1.35; text-align: left; cursor: pointer; max-width: 100%; overflow-wrap: anywhere; }
.bank-chip .ui-icon { width: 18px; height: 18px; flex: none; }
.bank-chip.is-armed { border-color: var(--lamp); background: color-mix(in srgb, var(--lamp) 16%, var(--surface-2)); box-shadow: 0 0 0 3px var(--lamp-glow), inset 0 0 0 2px var(--lamp); }
.bank-chip.is-armed::before { content: '●'; color: var(--lamp); font-size: 0.7em; }
.bank-chip.is-right { border-color: var(--c-science); background: color-mix(in srgb, var(--c-science) 18%, var(--surface-2)); }
.bank-chip.is-maybe { border-style: dashed; color: var(--text); }
.bank-chip__note { flex-basis: 100%; font-size: var(--fs-small); color: var(--text-mute); }
.bank-sort__out { display: flex; justify-content: flex-end; }
.bank-sort__out [hidden] { display: none; }
.bank-boxes { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--gap-choice); }
.bank-box { border-radius: var(--radius-lg); border: 2px solid var(--slot); background: color-mix(in srgb, var(--slot) 10%, var(--surface)); padding: 6px 8px 8px; min-width: 0; }
.bank-box__head { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 52px; padding: 4px 6px; border: 0; background: transparent; color: var(--text); text-align: left; font-size: var(--fs-body); font-weight: 600; cursor: pointer; border-radius: var(--radius); }
.bank-box__name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.bank-box__count { flex: none; font-size: var(--fs-small); font-weight: 400; color: var(--text-mute); }
.bank-box__items { display: flex; flex-wrap: wrap; gap: var(--sp-2); min-height: 32px; padding: 2px 0 0; }
.bank-box__items:empty::before { content: '여기에 넣어요'; color: var(--text-mute); font-size: var(--fs-small); align-self: center; padding: 0 6px; }
.bank-stack { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-2); }
.bank-slot { display: flex; align-items: center; gap: 10px; }
.bank-slot__no { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line-strong); font-family: var(--f-num); font-size: 15px; font-weight: 700; color: var(--text-mute); }
.bank-slot > .bank-chip { flex: 1; min-width: 0; }
.bank-slot__empty { flex: 1; min-height: 48px; border-radius: var(--radius); border: 2px dashed var(--line-strong); }
.bank-fill__opt { flex-wrap: wrap; }
.bank-fill__opt .learn-choice__tag { flex-basis: 100%; text-align: center; }

/* ═══ 빌드 37: 문제은행 본문 표시(src/ui/dom.js richText {big}·{note}·{eq}, src/ui/bank-view.js 그림·표·풀이 블록) ═══ */
.rt-big { font-size: 1.6em; line-height: 1.25; font-weight: 700; letter-spacing: .02em; }
.rt-note { display: block; margin-top: var(--sp-1); font-size: var(--fs-small); color: var(--paper-mute); }
.rt-eqb { display: block; margin: var(--sp-2) 0; }
.rt-eqline { display: block; white-space: nowrap; font-variant-numeric: tabular-nums; }
.learn-figure.bank-fig { background: var(--fig-paper); border-color: var(--paper-line); gap: var(--sp-1); overflow-x: auto; }
.learn-figure.bank-fig .fig { max-height: 260px; width: auto; max-width: 100%; }
.rt-table { border-collapse: collapse; margin: 6px auto; font-size: 22px; font-variant-numeric: tabular-nums; color: var(--fig-ink); }
.rt-table td { min-width: 26px; text-align: center; padding: 0 2px; }
.rt-table td.cr { font-size: 14px; color: var(--fig-accent); height: 18px; }
.rt-table td.op { min-width: 22px; }
.rt-table tr.ul td { border-bottom: 2px solid var(--fig-ink); }
.rt-table tr.res td { color: var(--fig-accent); font-weight: 700; }
.bt-panel .rt-table { background: var(--fig-paper); border-radius: var(--radius); padding: var(--sp-1) var(--sp-2); }
.bt-solp { margin: var(--sp-1) 0; }
.bt-sol .bt-sol { margin-top: var(--sp-1); }
.learn-choice.is-struck { opacity: .45; text-decoration: line-through; }
.learn-report { display: flex; justify-content: flex-end; margin-top: var(--sp-2); }
.learn-report .ui-btn { min-height: 44px; }

/* ── 비유 설명(H37, learn.analogy): 큰 그림(이야기·그림 예시) · 작은 그림(그림과 식·되짚기) · 다리 칸(다리 문장 + 짝 이름표) ──
   그림은 꾸밈(aria-hidden)이라 글과 겹치지 않는다. 짝 이름표 색은 도구·식과 같은 색 묶음(tc-c1~c3)이고, 색 + 밑줄 무늬를 함께 쓴다(11절).
   움직임은 나타나는 0.32초뿐이고, 움직임 줄이기면 없다(아래 reduce 규칙이 .learn 안의 모든 animation을 끈다). */
.az-pic { margin: 0; border: 1px solid var(--border); border-radius: var(--radius-lg); background: linear-gradient(180deg, var(--sheet), var(--panel)); padding: var(--sp-2) 6px 4px; min-width: 0; }
.az-pic svg { display: block; width: 100%; height: auto; overflow: visible; }
.az-pic--small { width: 54%; align-self: center; padding: 6px 8px 4px; }
.az-lab { font-family: var(--f-body); font-size: 13px; fill: var(--mute); }
.az-num { font-family: var(--f-num); font-weight: 700; }
.az-bridge { display: grid; gap: var(--sp-2); border: 1.5px solid var(--lamp); border-radius: var(--radius-lg); background: color-mix(in srgb, var(--lamp) 8%, transparent); padding: 10px 12px 12px; }
.az-bridge .learn-text { font-size: var(--fs-problem); }
.az-bridge b, .az-tag b { color: var(--lamp); font-weight: 700; }
.az-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.az-tag { display: inline-flex; align-items: baseline; flex-wrap: wrap; min-height: 32px; padding: 3px 12px; border-radius: var(--radius-pill); border: 1.5px solid var(--line-strong); background: var(--surface); font-size: var(--fs-small); line-height: 1.3; color: var(--ink); }
.az-tag__left { border-bottom: 3px var(--tc-style, solid) var(--tc, transparent); }
.az-tag__eq { white-space: pre; color: var(--mute); }
@media (prefers-reduced-motion: no-preference) {
  .az-pic, .az-bridge { animation: az-in 320ms ease-out both; }
}
@keyframes az-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ── 다리 문장 ↔ 그림 강조(H43): 굵은 교과서 말과 그림의 한 부분이 같은 색 묶음 + 같은 선 모양(실선·긴 점선·짧은 점선)으로 이어진다 ── */
.az-term { padding: 0 3px; border-radius: 4px; border-bottom: 4px var(--tc-style, solid) var(--tc, var(--lamp)); background: color-mix(in srgb, var(--tc, var(--lamp)) 16%, transparent); }
.az-hasHl [data-ap]:not(.az-hl) { opacity: .38; }
.az-halo { stroke: var(--tc, var(--lamp)); stroke-width: 3; vector-effect: non-scaling-stroke; pointer-events: none; }
.az-hl { filter: drop-shadow(0 0 2px color-mix(in srgb, var(--tc, var(--lamp)) 70%, transparent)); }

/* ── '더 알아보기' 표시(H42): 덤 카드는 제목 아래에 점선 테두리 알약. 글자가 뜻을 말해 색에 기대지 않는다 ── */
.learn-extra { margin: 2px 0 0; width: fit-content; display: inline-flex; align-items: center; min-height: 28px; padding: 2px 12px; border: 1.5px dashed var(--lamp); border-radius: var(--radius-pill); background: color-mix(in srgb, var(--lamp) 10%, transparent); color: var(--lamp); font-size: 14px; font-weight: 700; line-height: 1.3; }

/* ── 빈 곳 채우기(H40·H41): 이야기·조심! 칸 장면, 바로 확인 문제 그림, 들킨 괴물 + '틀린 생각 / 맞는 생각' 짝 ──
   그림은 꾸밈(aria-hidden), 나타날 때 한 번(0.45초 이하, 투명도·위치만)이고 읽기·풀이 중에는 움직이지 않는다. 움직임 줄이기에서는 정지 */
.az-scene { margin-top: var(--sp-3); border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--line); background: linear-gradient(180deg, var(--bg), var(--panel)); }
.az-scene svg { display: block; width: 100%; height: auto; }
.learn-figure { margin: 0; padding: var(--sp-2); border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); display: grid; justify-items: center; }
.learn-figure .az-pic { border: 0; background: none; padding: 0; width: 70%; }
.learn-figure--tool { pointer-events: none; }
.learn-figure--tool > * { zoom: .55; } /* 문제 그림은 보기와 한 화면에 들어오게 줄여 그린다 */
.learn-figure .is-answer { outline: 5px solid var(--lamp); outline-offset: 3px; background: color-mix(in srgb, var(--lamp) 22%, transparent); box-shadow: 0 0 10px color-mix(in srgb, var(--lamp) 70%, transparent); border-radius: 6px; }
.az-caught { display: grid; grid-template-columns: 112px 1fr; gap: var(--sp-2); align-items: center; margin-top: var(--sp-3); }
.az-caught__monster svg { display: block; width: 100%; height: auto; }
.az-caught__pair { display: grid; gap: var(--sp-2); min-width: 0; }
.az-think { display: grid; gap: 2px; padding: 8px 12px; border-radius: var(--radius-lg); min-width: 0; }
.az-think .learn-text { margin: 0; }
.az-think__label { font-size: 13px; font-weight: 700; color: var(--mute); }
.az-think--wrong { border: 2px dashed var(--line-strong); background: transparent; }
.az-think--right { border: 2px solid var(--lamp); background: color-mix(in srgb, var(--lamp) 10%, transparent); }
.az-think--right .az-think__label { color: var(--lamp); }
@media (prefers-reduced-motion: no-preference) {
  .az-scene, .az-caught { animation: az-in 420ms ease-out both; }
}
.learn-center .scene-fill, .learn-center .az-scene { width: 100%; }
/* 움직이지 않는 문제 그림에는 '○에서 ○번 뛰어서 ○'·'나타내는 수 ○' 같은 안내 줄을 붙이지 않는다(정답을 미리 말하거나 상관없는 글이 된다) */
.learn-figure--tool .wd-out { display: none; }
/* 바로 확인 그림 폭(H41): 칸이 가운데 맞춤 그리드라 분수 막대(flex)처럼 안쪽 폭이 내용만큼 줄어드는 그림이 작은 막대 하나로 보였다 → 그림 칸 가득 쓴다 */
.learn-figure > .wd, .learn-figure > .wd-press { width: 100%; box-sizing: border-box; }
.learn-figure--widget { padding: var(--sp-3); }
.learn-figure svg .is-answer { outline: none; background: none; box-shadow: none; stroke: var(--lamp); stroke-width: 4; paint-order: stroke; filter: drop-shadow(0 0 4px var(--lamp)); }
/* 맞혔는데 그림이 없으면: 놀라 도망가는 괴물(틀렸을 때 .az-caught와 짝) */
.az-flee { margin-top: var(--sp-3); border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--line); background: linear-gradient(180deg, var(--bg), var(--panel)); }
.az-flee svg { display: block; width: 100%; height: auto; }
@media (prefers-reduced-motion: no-preference) { .az-flee { animation: az-in 420ms ease-out both; } }

/* 도형 위젯 · 원(src/ui/widgets/shape.js): 반지름 c1(실선) · 지름 c2(긴 점선) · c3(짧은 점선). 색은 비유 그림 바퀴·H43 테두리와 같은 묶음이다 */
.wd-circle { justify-items: center; }
.wd-circle__svg { width: 100%; max-width: 340px; height: auto; display: block; overflow: visible; }
.wd-circle__svg.is-touch { touch-action: none; cursor: pointer; }
.wd-circle__ring { stroke: var(--wd-ink); stroke-width: 3; fill: color-mix(in srgb, var(--wd-fill) 8%, transparent); }
.wd-circle__center { fill: var(--wd-accent); stroke: var(--wd-ink); stroke-width: 2; }
.wd-circle__seg { fill: none; }
.wd-circle__seg--c1 { stroke: var(--c-math); }
.wd-circle__seg--c2 { stroke: var(--c-science); }
.wd-circle__seg--c3 { stroke: var(--lamp); }
.wd-circle__line:not(.is-now) .wd-circle__seg { opacity: .6; }
.wd-circle__end { fill: var(--wd-ink); }
.wd-circle__lab { fill: var(--wd-ink); font-family: var(--f-num); font-size: 15px; font-weight: 600; paint-order: stroke; stroke: var(--wd-bg); stroke-width: 4px; stroke-linejoin: round; }
.wd-circle__lab--sm { font-size: 12px; }
.wd-circle__ctr { font-family: var(--f-body); font-size: 15px; }
.wd-circle__brace { stroke: var(--wd-ink); stroke-width: 2; }
.learn-figure svg g.is-answer .wd-circle__seg { stroke: var(--lamp); stroke-width: 7; opacity: 1; }
.learn-figure--widget .wd-circle { max-width: 300px; justify-self: center; }
/* 강조 부분이 선·테두리 원·작은 점이면 상자 대신 그 선 뒤의 같은 색 굵은 겉선(parts/analogy.js outlineStrokes) */
.az-outline { stroke: var(--tc, var(--lamp)); opacity: .55; pointer-events: none; }

/* ═══ 전투 화면(E5, 시안 battle_v2) ═══
   위쪽 머리줄은 학습 틀 그대로(뒤로 · 진행 점 · 친구), 몸통 = 내 에너지 하트 · 괴물 무대(체력 칸 막대) · 문제 카드 · 입력 · 피드백 · 풀이 칸(방법 탭).
   움직임 길이는 --bt-fx(config battle.fxMs, 기본 450ms, 최대 600ms). 움직임 줄이기면 모두 생략한다. 빨간색·큰 X·겁주는 연출은 쓰지 않는다. */
.screen.learn[data-screen="battle"] { --bt-fx: 450ms; --bt-stage-h: 184px; --bt-mon: 104px; }
.learn-bar__left { display: flex; align-items: center; gap: var(--sp-2); }
.learn-bar__left:empty { display: none; }
.learn-bar .ui-btn--sub { min-height: var(--btn-h); }
.ui-btn.has-dot { position: relative; }
.ui-btn.has-dot::after { content: ""; position: absolute; top: 3px; right: 3px; width: 11px; height: 11px; border-radius: 50%; background: var(--lamp); border: 2px solid var(--sky0); }
.ui-dot.is-ok { border: 2px solid var(--lamp); background: var(--lamp); }
.ui-dot.is-ng { width: 12px; height: 12px; border: 2px solid var(--mute); background: var(--off-fill); border-radius: 3px; transform: rotate(45deg); }

/* 내 에너지 줄 */
.bt-status { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-2); min-height: 32px; }
.bt-status__lbl { font-size: var(--fs-small); color: var(--text-mute); }
.ui-cell.is-lost { animation: bt-lost var(--bt-fx) ease-out; }
.ui-cell.is-gain { animation: bt-gain var(--bt-fx) ease-out; }
@keyframes bt-lost { 0% { transform: scale(1.5); } 100% { transform: scale(1); } }
@keyframes bt-gain { 0% { transform: scale(0.5); } 60% { transform: scale(1.3); } 100% { transform: scale(1); } }

/* 괴물 무대 */
.bt-stage { position: relative; flex: none; min-height: var(--bt-stage-h); border-radius: var(--radius-lg); border: 1px solid var(--border); overflow: hidden; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; padding-bottom: 10px;
  background: radial-gradient(ellipse at 50% 100%, var(--sky2) 0, var(--sky1) 55%, var(--sky0) 120%); }
.bt-sky { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .7; pointer-events: none; }
.bt-mon { position: relative; width: var(--bt-mon); height: var(--bt-mon); flex: none; }
.bt-mon::after { content: ""; position: absolute; left: 14%; right: 14%; bottom: -3px; height: 9px; border-radius: 50%; background: var(--shade-shadow); opacity: .55; z-index: 0; }
.bt-mon-art { position: relative; z-index: 1; display: block; width: 100%; height: 100%; overflow: visible; }
.bt-mon.is-gone .bt-mon-art, .bt-mon.is-gone::after { opacity: 0; }
.bt-tag { position: relative; z-index: 3; width: max-content; max-width: calc(100% - 20px); margin: 10px 0 9px; padding: 7px 14px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--c-rush); font-size: 15px; line-height: 1.3; text-align: center; }
.bt-tag::after { content: ""; position: absolute; left: 50%; bottom: -7px; width: 11px; height: 11px; margin-left: -6px; transform: rotate(45deg); background: var(--surface-2); border-right: 1px solid var(--c-rush); border-bottom: 1px solid var(--c-rush); }
.bt-tag b { color: var(--c-rush); }
.bt-stage .ui-hp { position: relative; z-index: 2; }
.bt-burst { position: absolute; z-index: 2; left: 50%; top: 46%; width: 120px; height: 120px; margin: -60px 0 0 -60px; pointer-events: none; opacity: 0; }
.ui-hp__cells i.is-pop { animation: bt-pop var(--bt-fx) ease-out; }
@keyframes bt-pop { 0% { transform: scale(1.7); } 100% { transform: scale(1); } }
/* 상대역 움직임(캐릭터 시안 v1 후다닥, 29판 2026-11-06): 모든 상대역(후다닥·꼬미·깜빡이·책비·과목 보스)에 같은 동작을 CSS 로 입힌다. transform·opacity 만, 밝기 번쩍임 없음.
   길이는 config friend.motion.rival 과 같다(시험이 대조): 대기 1.4초 반복 · 해결 후 숨쉬기 3초 · 맞음 0.38초 · 버티기(틀렸을 때, 놀리지 않음) 0.5초 · 짐 0.6초(시안 0.9초를 ui.motionMaxMs 0.6초 안으로 줄임).
   해결 후 숨쉬기(rest)는 학습 화면이라 끝없이 돌지 않고 rest-n 번만 하고 멈춘다(전투 화면 '끝없는 움직임 0', 시험이 대조). 대기 흔들림은 아래에서 연결하지 않음.
   움직임 줄이기(아래)면 움직이지 않고 그림(도전 전 → 해결 후)만 바뀐다. */
.screen.learn[data-screen="battle"] { --bt-rv-idle: 1400ms; --bt-rv-rest: 3000ms; --bt-rv-hit: 380ms; --bt-rv-miss: 500ms; --bt-rv-lose: 600ms; --bt-rv-idle-n: 3; --bt-rv-rest-n: 2; }
.fx-hit .bt-mon-art { animation: rv-hit var(--bt-rv-hit) ease-out; }
.fx-miss .bt-mon-art { animation: rv-miss var(--bt-rv-miss) ease-in-out; }
.fx-in .bt-mon-art { animation: bt-bobin var(--bt-fx) ease-out; }
.fx-defeat .bt-mon-art { animation: rv-lose var(--bt-rv-lose) ease-in-out forwards; }
.fx-hit .bt-burst, .fx-defeat .bt-burst { animation: bt-burst var(--bt-fx) ease-out; }
/* 대기 흔들림(rv-idle)은 만들어 두기만 하고 화면에 연결하지 않는다: 전투 화면의 상대역은 푸는 동안 움직임 0(H40·채움 시험 '풀이 중에는 멈춘다')이라 시안의 대기 흔들림과 부딪친다(16절 확인 대기).
   쓰려면 .bt-stage 에 data-rv-idle 를 달면 나타난 뒤 idle-n 번만 흔들린다(끝없이 돌지 않음). 지금은 어디서도 달지 않는다. */
.bt-stage[data-rv-idle]:not(.fx-hit, .fx-miss, .fx-defeat, .fx-in) .bt-mon-art { animation: rv-idle var(--bt-rv-idle) ease-in-out var(--bt-rv-idle-n); }
.bt-stage[data-pose="flee"]:not(.fx-hit, .fx-miss, .fx-defeat) .bt-mon-art, .bt-hero .bt-mon-art { animation: rv-rest var(--bt-rv-rest) ease-in-out var(--bt-rv-rest-n); }
@keyframes rv-idle { 0%, 100% { transform: rotate(-2deg); } 50% { transform: rotate(2deg) translateX(1.5%); } }
@keyframes rv-rest { 0%, 100% { transform: none; } 50% { transform: translateY(-1.2%) scale(1, 1.01); } }
@keyframes rv-hit { 0% { transform: none; } 15% { transform: translateX(6%) scale(1.06, .86) rotate(4deg); } 40% { transform: translateX(-4%) scale(.97, 1.03) rotate(-3deg); } 65% { transform: translateX(2%) rotate(1deg); } 100% { transform: none; } }
@keyframes rv-miss { 0%, 100% { transform: none; } 40% { transform: translateX(3%) rotate(-4deg); } 70% { transform: translateX(1%) rotate(-1.5deg); } }
/* 짐: 어지러운 흔들림 뒤 날아가며 사라짐(시안은 0.9초 흔들림 뒤 해결 후 그림으로 바뀜. 앱은 이긴 판 화면이 처음부터 해결 후 그림이라 흔들림을 0.6초 안으로 줄여 잇는다) */
@keyframes rv-lose { 0% { transform: none; } 15% { transform: rotate(-12deg) translateX(-3%); } 32% { transform: rotate(10deg) translateX(3%); } 50% { transform: rotate(-8deg) translateX(-2%); } 68% { transform: rotate(6deg) translateX(1%) scale(1, .96); opacity: 1; } 100% { transform: translateY(-22px) scale(.55) rotate(-16deg); opacity: 0; } }
@keyframes bt-bobin { from { transform: translateY(-8px); opacity: 0.3; } to { transform: none; opacity: 1; } }
@keyframes bt-burst { 0% { transform: scale(.3); opacity: 1; } 100% { transform: scale(1.25); opacity: 0; } }

/* 문제 카드 · 힌트 */
.bt-aux { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); }
.bt-warn { margin: 0; font-size: 15px; line-height: 1.4; color: var(--text); } /* 별 3개 안내 줄(27판): 힌트 줄 아래, 바탕과 4.5:1 이상 */
.bt-warn[hidden] { display: none; }
.bt-hintline { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: var(--radius); background: var(--surface); border: 1px dashed var(--lamp); font-size: 15px; }
.bt-hintline .ui-icon { flex: none; width: 22px; height: 22px; color: var(--lamp); }
.ui-card.is-compact .learn-prompt { font-size: 17px; }

/* 피드백 카드(부드럽게) */
.bt-fb { display: grid; grid-template-columns: 40px 1fr; gap: 6px 12px; align-items: start; padding: 14px; border-radius: var(--radius-lg); background: var(--surface-2); border: 1.5px solid var(--line-strong); }
.bt-fb__ico { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); }
.bt-fb__ico .ui-icon { width: 24px; height: 24px; }
.bt-fb.ok { border-color: var(--c-science); }
.bt-fb.ok .bt-fb__ico { color: var(--c-science); border: 2px solid var(--c-science); }
.bt-fb.soft { border-color: var(--lamp); border-style: dashed; }
.bt-fb.soft .bt-fb__ico { color: var(--lamp); border: 2px dashed var(--lamp); }
.bt-fb__tt { margin: 0; align-self: center; min-height: 40px; display: flex; align-items: center; font-weight: 700; font-size: 20px; line-height: 1.3; }
.bt-fb__tx { grid-column: 2; margin: 0; font-size: 17px; }
.bt-fb > :not(.bt-fb__ico):not(.bt-fb__tt):not(.bt-fb__tx) { grid-column: 2; }
.bt-notes { display: flex; flex-wrap: wrap; gap: 6px; }
.bt-notes:empty { display: none; }
.bt-sub { display: flex; }
.bt-sub .ui-btn--sub { flex: 1; }
.bt-sub .ui-btn--small { background: transparent; border-color: var(--line-strong); }
.bt-badge { display: inline-flex; align-items: center; gap: 6px; width: fit-content; padding: 4px 12px 4px 8px; border-radius: var(--radius-pill); border: 1.5px solid var(--lamp); color: var(--lamp); font-size: 15px; font-weight: 700; }
.bt-badge .ui-icon { width: 20px; height: 20px; }
.bt-badge.is-pop { animation: bt-pop var(--bt-fx) ease-out; }

/* 풀이 칸(방법 탭) */
.bt-solbox { display: grid; }
.bt-tabs { display: flex; gap: 6px; padding: 0 4px; }
.bt-tab { min-height: var(--touch); min-width: 96px; padding: 0 18px; border-radius: 12px 12px 0 0; border: 1.5px solid var(--line-strong); border-bottom: 0; background: var(--surface-2); color: var(--text); font-family: inherit; font-size: 15px; font-weight: 600; cursor: pointer; touch-action: manipulation; }
.bt-tab[aria-selected="true"] { background: var(--paper); color: var(--paper-ink); border-color: var(--lamp); border-top: 4px solid var(--lamp); font-weight: 700; }
.bt-tab:focus-visible { outline: var(--focus) solid var(--focus-color); outline-offset: 2px; }
.bt-panel { padding: 10px 12px 12px; border-radius: 14px; background: var(--paper); color: var(--paper-ink); }
.bt-tabs + .bt-panel { border-radius: 4px 14px 14px 14px; }
.bt-mname { margin: 0 0 6px; font-weight: 700; font-size: 17px; color: var(--paper-ink); }
.bt-sol { margin: 0; padding: 0; list-style: none; display: grid; gap: 3px; font-size: 17px; font-variant-numeric: tabular-nums; counter-reset: bt-s; }
.bt-sol li { counter-increment: bt-s; padding-left: 1.6em; position: relative; }
.bt-sol li::before { content: counter(bt-s); position: absolute; left: 0; top: 0.05em; width: 1.3em; height: 1.3em; border-radius: 50%; background: var(--paper-line); color: var(--paper-ink); font-size: 0.8em; display: grid; place-items: center; font-weight: 700; }
/* H153 풀이 '까닭 한 줄'·오답 까닭: 까닭 줄은 내 답·정답 줄 아래 묶음 폭 전체(글 15), 식/정답 줄은 굵게, 단계는 접는 줄(.nx-fold) 안 */
.bt-ans__why { grid-column: 1 / -1; margin: 0; font-size: 15px; line-height: 1.45; color: var(--ink); }
.bt-solp.is-sum { font-weight: 700; }
.bt-panel .nx-fold { margin-top: var(--sp-2); }
.bt-panel .nx-fold .nx-fold__head { color: var(--paper-ink); border-bottom-color: var(--paper-line) !important; } /* 접는 줄을 종이(풀이 칸) 위에서: 종이 글색·종이 선(next.css :is(…) 단추 한 벌보다 한 칸 높게) */
.bt-panel .nx-fold__body .bt-sol, .bt-panel .nx-fold__body .rt-table { margin-top: var(--sp-1); }
.bt-badgebox { display: flex; }
.bt-badgebox:empty { display: none; }
.bt-badgebox .bt-badge { margin-top: 8px; }

/* 결과 화면 */
.bt-res { display: grid; justify-items: center; align-content: start; gap: var(--sp-3); text-align: center; }
.bt-res > * { min-width: 0; max-width: 100%; }
.bt-hero { position: relative; width: 100%; height: 168px; border-radius: var(--radius-lg); border: 1px solid var(--border); overflow: hidden; display: flex; align-items: flex-end; justify-content: center; gap: 12px; padding-bottom: 12px;
  background: radial-gradient(ellipse at 50% 100%, var(--sky2) 0, var(--sky1) 55%, var(--sky0) 120%); }
.bt-hero__mon { position: relative; width: 112px; height: 112px; }
.bt-hero .bt-mon-art { width: 100%; height: 100%; }
.bt-spark { position: absolute; left: 50%; bottom: 0; width: 112px; height: 112px; margin-left: -56px; overflow: visible; }
.bt-hero__lamp { position: relative; z-index: 2; align-self: flex-end; }
.bt-hero__lamp .result-lamp { width: 36px; }
.bt-res__title { margin: 0; font-size: 26px; }
.bt-res__sub { color: var(--text-mute); }
.bt-enough { display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2); margin: 0; color: var(--text-mute); }
.bt-res .ui-stars { width: 100%; text-align: left; }
.bt-chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); justify-content: center; }
.bt-chest { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 14px; border-radius: var(--radius); border: 1.5px solid var(--lamp); background: var(--surface-2); text-align: left; }
.bt-chest .ui-icon { flex: none; width: 38px; height: 38px; color: var(--lamp); }

/* 상자 확률 안내 판 안쪽(28판): 바닥 시트는 화면 밖(body)에 붙어서 여기 전역으로 둔다 */
.bt-odds { display: grid; gap: var(--sp-2); }
.bt-odds > p { margin: 0; line-height: 1.5; }
.bt-odds__h { margin: 6px 0 0; font-size: 17px; line-height: 1.35; }
.bt-odds__line { color: var(--text-mute); }
.bt-odds__drop { color: var(--text); }
.bt-odds__table { width: 100%; border-collapse: collapse; font-size: 15px; }
.bt-odds__table caption { text-align: left; font-weight: 700; font-size: 15px; padding: 6px 0 4px; }
.bt-odds__table[data-part="odds-chance"] caption { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.bt-odds__table th, .bt-odds__table td { text-align: left; padding: 8px 4px; border-top: 1px solid var(--border); vertical-align: middle; overflow-wrap: anywhere; }
.bt-odds__table tbody th { font-weight: 600; color: var(--text); }
.bt-odds__table td { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.bt-odds__v { font-weight: 700; }
.bt-odds__table td small { display: block; color: var(--text-mute); font-size: 13px; }
.bt-res .bt-sub { width: 100%; }
.bt-hearts-empty { display: flex; justify-content: center; }
.bt-missed { display: grid; gap: var(--sp-2); }
.bt-missed__ans { font-weight: 700; }

/* 키 큰 화면: 무대와 결과 그림을 키워 빈 곳을 줄인다 */
@media (min-height: 800px) {
  /* 문제를 푸는 화면(ask·retry)은 키패드가 아래를 차지해 무대를 키우지 않는다(힌트 단추가 가려짐). 키패드가 없는 답한 뒤 화면만 키운다 */
  .screen.learn[data-screen="battle"]:is([data-phase="hit"], [data-phase="redone"], [data-phase="again"], [data-phase="recheck"], [data-phase="expl"]) { --bt-stage-h: 224px; --bt-mon: 128px; }
  .bt-hero { height: clamp(168px, 37vh, 340px); } .bt-hero__mon { width: 176px; height: 176px; } .bt-spark { width: 176px; height: 176px; margin-left: -88px; }
}
/* 키패드가 아래를 차지하는 화면(문제 · 한 번 더 풀기)은 800~899px 높이에서도 무대를 줄여 힌트 단추·입력이 첫 화면에 보이게 한다 */
@media (max-height: 899px) {
  .screen.learn[data-screen="battle"]:is([data-phase="ask"], [data-phase="retry"]) { --bt-stage-h: 140px; --bt-mon: 74px; }
  .screen.learn[data-screen="battle"]:is([data-phase="ask"], [data-phase="retry"]) .bt-tag { font-size: 14px; padding: 5px 10px; margin: 6px 0 8px; }
  .screen.learn[data-screen="battle"]:is([data-phase="ask"], [data-phase="retry"]) .bt-stage:has(.bt-tag) .bt-mon { width: 58px; height: 58px; }
}
/* 낮은 폰(예: 360×640)이나 좁은 폰: 괴물 무대를 줄여 문제와 입력이 한 화면에 들어오게 한다 */
@media (max-height: 700px), (max-width: 370px) {
  .screen.learn[data-screen="battle"] { --bt-stage-h: 140px; --bt-mon: 74px; }
  .screen.learn[data-screen="battle"] .learn-body { gap: 8px; }
  .screen.learn[data-screen="battle"] .bt-tag { font-size: 14px; padding: 5px 10px; margin: 6px 0 8px; }
  .screen.learn[data-screen="battle"] .learn-body:has(.bt-solbox) .bt-stage { min-height: 112px; --bt-mon: 60px; }
  .screen.learn[data-screen="battle"] .bt-fb { padding: 10px 12px; }
  .bt-hero { height: 130px; }
  .bt-hero__mon, .bt-spark { width: 90px; height: 90px; margin-left: 0; }
  .bt-spark { margin-left: -45px; }
  .bt-res__title { font-size: 22px; }
  .bt-tab { min-width: 84px; padding: 0 14px; }
}

/* 움직임 줄이기: 기기 설정이거나 보호자 설정이면 모든 움직임을 없앤다(괴물은 잡히면 바로 사라진다) */
@media (prefers-reduced-motion: reduce) {
  .screen.learn[data-screen="battle"] * { animation: none !important; transition: none !important; }
  .screen.learn[data-screen="battle"] .fx-defeat .bt-mon-art { opacity: 0; }
}
.screen.learn[data-screen="battle"][data-reduce="true"] * { animation: none !important; transition: none !important; }
.screen.learn[data-screen="battle"][data-reduce="true"] .fx-defeat .bt-mon-art { opacity: 0; }
.learn-top .ui-dots[hidden] { display: none; }
/* 진행 점이 8개를 넘는 판(수학 대왕 10점)은 점·간격을 줄이고 가운데 칸이 남는 폭을 쓴다(뒤로 단추와 겹치지 않게) */
.screen.learn[data-screen="battle"] .learn-top { grid-template-columns: auto minmax(0, 1fr) auto; }
.screen.learn[data-screen="battle"] .learn-top .ui-dots { justify-self: center; flex-wrap: nowrap; }
.screen.learn[data-screen="battle"] .learn-top .ui-dots:has(.ui-dot:nth-child(8)) { gap: 5px; }
.screen.learn[data-screen="battle"] .learn-top .ui-dots:has(.ui-dot:nth-child(8)) .ui-dot:not(.is-now) { width: 10px; height: 10px; }
.screen.learn[data-screen="battle"] .learn-top .ui-dots:has(.ui-dot:nth-child(8)) .ui-dot.is-now { width: 16px; height: 16px; }

/* ── 언어 1단계(L1·L2, 2026-11-06): 용어 옆 작은 영어 · 듣기 단추 · 영어 낱말 카드. lang.release/preview가 꺼져 있으면 이 글자들은 화면에 나오지 않는다 ── */
/* 용어(영어)는 한 덩어리: 한 줄에 들어가면 통째로 같이 움직이고, 한 줄보다 길 때만 '(' 앞에서 줄을 바꾼다. 조사는 덩어리 안에 붙는다 */
.tm { display: inline-block; max-width: 100%; vertical-align: baseline; }
.tm > b, .tm > .tm-ko { white-space: nowrap; }
.tm-tail { white-space: nowrap; } /* 영어 괄호와 조사는 떨어지지 않는다(')' 와 조사 사이에서 줄이 바뀌지 않게) */
.tm-en { font-size: 0.8em; font-weight: 400; color: var(--en-ink); white-space: nowrap; letter-spacing: 0; }
/* 영어 글자는 굵은 글 안(핵심 칸 등)에서도 굵어지지 않는다 */
.learn-key .tm-en, .az-bridge .tm-en, .az-tag .tm-en { font-weight: 400; }
/* 영어 듣기 단추(위치표에 있는 글만): 소리 그림 + 영어 글. 누름 영역 44px */
.listen { display: inline-flex; align-items: center; gap: 6px; min-height: var(--touch); min-width: var(--touch); padding: 4px 12px; border-radius: var(--radius-pill); border: 1.5px solid var(--line-strong); background: var(--surface-2); color: var(--text); font: inherit; cursor: pointer; vertical-align: middle; }
.listen .en { color: var(--en-ink); }
.listen__ic { display: inline-grid; place-items: center; width: 22px; height: 22px; }
.listen__ic svg { width: 22px; height: 22px; }
.listen--solo { justify-content: center; padding: 0; width: var(--touch); }
.listen.is-playing, .listen[aria-pressed="true"] { border-color: var(--lamp); background: color-mix(in srgb, var(--lamp) 16%, var(--surface-2)); }
/* 영어 낱말 카드: 줄마다 한국어 | 영어(크게) | 듣기 */
.word-card { display: grid; gap: var(--sp-3); }
.word-chip { margin: 0; text-align: center; color: var(--text-mute); font-size: var(--fs-small); }
.words { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-2); }
.word { display: flex; align-items: center; gap: var(--sp-3); min-height: 56px; padding: 6px 14px; border: 1.5px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.word__ko { flex: 0 0 38%; min-width: 0; font-weight: 600; font-size: var(--fs-problem); }
.word__en { flex: 1 1 auto; min-width: 0; color: var(--en-ink); font-weight: 600; font-size: 22px; overflow-wrap: anywhere; }
.word .listen { margin-left: auto; flex: none; }
.hub-words { justify-content: center; }

/* 같이 읽어요(1~2학년, 소리 없음): 문제 카드·원리 카드 맨 위의 작은 표시 */
.learn-readtog { align-self: flex-start; display: inline-block; margin: 0 0 var(--sp-2); padding: 4px 12px; border-radius: 999px; border: 1px solid var(--lamp); background: var(--surface-2); color: var(--ink); font-size: var(--fs-small); font-weight: 600; line-height: 1.4; }
.bt-preview-note { margin: 0 0 8px; color: var(--mute); font-size: 14px; text-align: center; }
