/* 읽기근육 — C. 학습 노트 디자인 (토큰은 css/tokens.css)
   원칙: 글이 주인공 · 형광펜(라임)은 "지금·핵심·완료"에만 · 손맛(비뚤게 칠한 형광펜·손 밑줄·체크박스)은 절제
   목차: 기본 · 아이콘 · 상단 바 · 버튼 · 칩·세그먼트 · 카드·시트 · 탭 바 · 홈 · 지문 목록 · 읽기 · 활동 · 결과 · 내 기록 · 설정 · Learning · 모달·알림 · 접근성 */

/* ---------- 기본 ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; overflow-x: clip; } /* hidden이면 body가 스크롤 상자가 돼 상단 바 sticky가 안 붙음 */
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Pretendard Variable', Pretendard, -apple-system, 'Apple SD Gothic Neo', 'Malgun Gothic', system-ui, sans-serif;
  font-size: var(--fs-ui);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
h1, h2, h3, p { margin: 0; }
main { padding: var(--s3) var(--gutter) var(--s6); max-width: 560px; margin: 0 auto; }
.muted { color: var(--sub); }
.small { font-size: 14px; }
.center { text-align: center; }
.num, .stopwatch, .stat b, .stepper-value, .big-stage, .result-stars, .mini-table, .lesson-no, .chart, .status-value { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum'; }
[hidden] { display: none !important; }

/* 형광펜: 글자 아래쪽 절반만, 끝이 살짝 비뚤게 */
.hl { background: linear-gradient(176deg, transparent 0 42%, var(--accent) 42% 92%, transparent 92%); padding: 0 3px; margin: 0 -3px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }

/* ---------- 아이콘 ---------- */
.ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: var(--stroke); stroke-linecap: round; stroke-linejoin: round; flex: none; vertical-align: -4px; }
.ico.sm { width: 16px; height: 16px; vertical-align: -3px; }
.ico.lg { width: 26px; height: 26px; }
.ico.fill { fill: var(--accent-mid); color: var(--text); stroke-width: 1.4; }
.ico.empty { color: var(--sub); opacity: .55; }
.with-ico { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- 상단 바 ---------- */
.toolbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; flex-wrap: wrap; gap: var(--s2);
  min-height: 56px; padding: 6px 12px 6px var(--gutter);
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.app-name { display: inline-flex; align-items: center; gap: 8px; flex: 1; min-width: 0; min-height: 44px; padding: 0; text-align: left; font-size: var(--fs-body); font-weight: 800; letter-spacing: -0.03em; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.exit-btn { display: inline-flex; align-items: center; gap: 2px; min-height: 44px; padding: 0 10px 0 0; margin-left: -6px; font-size: var(--fs-ui); font-weight: 700; color: var(--text); }
.toolbar-right { display: flex; align-items: center; margin-left: auto; padding: 0 2px; background: var(--surface); border: 1px solid var(--line); border-radius: 24px; }
.toolbar-right .icon-btn { border: 0; background: none; border-radius: 22px; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 44px; min-height: 44px; padding: 0 6px;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--surface);
  color: var(--sub); font-size: 14px; font-weight: 700;
}
.toolbar-right .icon-btn[aria-pressed='true'] { color: var(--text); background: var(--accent); }
#btn-back { border: 0; background: none; color: var(--text); margin-left: -12px; }
.stopwatch { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-ui); color: var(--sub); }
.update-bar {
  position: sticky; top: 56px; z-index: 9;
  display: flex; align-items: center; justify-content: space-between; gap: var(--s2);
  padding: 2px var(--gutter); background: var(--surface); border-bottom: 1px solid var(--line); font-size: 14px;
}

/* ---------- 버튼 ---------- */
.primary-btn, .secondary-btn {
  display: flex; align-items: center; justify-content: center; gap: var(--s2);
  width: 100%; min-height: 52px; padding: 0 var(--s3);
  border-radius: var(--r); font-size: var(--fs-ui); font-weight: 700; line-height: 1.3; text-align: center;
  transition: transform var(--dur) var(--ease), background-color var(--dur) var(--ease);
}
.primary-btn { margin-top: var(--s4); background: var(--ink); color: var(--on-ink); border: 0; }
.secondary-btn { background: var(--surface); color: var(--text); border: 1px solid var(--line); }
.primary-btn:active, .secondary-btn:active { transform: translateY(1px); }
.primary-btn:disabled { opacity: 0.45; cursor: default; }
.primary-btn.slim { min-height: 44px; margin-top: var(--s2); }
.secondary-btn.small-btn { width: auto; min-height: 44px; padding: 0 14px; font-size: 14px; white-space: nowrap; }
.block-btn { width: 100%; }
.text-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 var(--s2); color: var(--accent-strong); font-size: 14px; font-weight: 600; white-space: nowrap; }
.text-btn.block { display: flex; width: 100%; margin-top: var(--s2); }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); margin-top: var(--s2); }
.btn-row > span:empty { display: none; }
.btn-row:has(> span:empty) { grid-template-columns: 1fr; }

/* ---------- 칩 · 세그먼트 (고른 것 = 형광펜) ---------- */
.chip-list { display: flex; flex-wrap: wrap; gap: 4px var(--s2); margin-bottom: var(--s3); }
.chip {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 44px; min-height: 44px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 22px; background: var(--surface);
  color: var(--sub); font-size: 14px; font-weight: 600;
}
.chip[aria-pressed='true'] { color: var(--text); border-color: var(--text); background: var(--accent); }
.chip:disabled { cursor: default; }
.seg-buttons { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; position: relative; z-index: 0; }
.seg-buttons button { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 4px; color: var(--sub); font-size: 14px; font-weight: 600; white-space: nowrap; }
.seg-buttons button[aria-pressed='true'] { color: var(--text); font-weight: 700; }
.seg-buttons button[aria-pressed='true']::before { content: ''; position: absolute; left: 8%; right: 8%; top: 50%; height: 12px; margin-top: -1px; background: var(--accent); border-radius: 2px 6px 3px 7px; transform: rotate(-2deg); z-index: -1; }
.seg-buttons .ico { width: 18px; height: 18px; }
/* 한국어 | English = 노트 인덱스 탭 */
.track-switch { display: flex; gap: 4px; padding-left: var(--s3); margin: 0 0 -1px; position: relative; z-index: 1; }
.track-switch button { flex: none; min-width: 92px; min-height: 44px; padding: 0 var(--s3); border: 1px solid var(--line); border-bottom: 0; border-radius: 8px 8px 0 0; color: var(--sub); font-weight: 600; }
.track-switch button[aria-pressed='true'] { background: var(--surface); color: var(--text); font-weight: 700; margin-bottom: -1px; padding-bottom: 1px; }
.track-switch button[aria-pressed='true']::before { display: none; }

/* ---------- 카드 · 시트 ---------- */
.card { margin: 0 0 var(--s3); padding: var(--s3); border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.card-title { margin: 0 0 var(--s2); font-size: var(--fs-ui); font-weight: 700; }
.banner { margin: 0 0 var(--s3); padding: var(--s3); border: 1px solid var(--line); border-left: 3px solid var(--accent-mid); border-radius: var(--r); background: var(--surface); }
.banner p { margin: 0 0 var(--s2); word-break: keep-all; }
.banner-title { font-weight: 700; }
.banner.unlock { display: flex; align-items: center; gap: var(--s2); font-weight: 700; border-left-color: var(--accent-strong); }
.screen-title { margin: var(--s1) 0 var(--s3); font-size: var(--fs-display); font-weight: 800; letter-spacing: -0.035em; }
.screen-title small { font-size: var(--fs-ui); font-weight: 500; color: var(--sub); margin-left: 6px; letter-spacing: 0; }
.step-label { margin: 0 0 var(--s1); font-size: var(--fs-label); font-weight: 700; color: var(--accent-strong); letter-spacing: 0.02em; }
.step-q { margin: 0 0 var(--s3); font-size: 20px; line-height: 1.45; font-weight: 800; letter-spacing: -0.02em; word-break: keep-all; }
.record-msg { margin: var(--s2) 0 0; font-weight: 600; word-break: keep-all; }
.record-msg.good { color: var(--ok); }
.privacy { margin-top: var(--s4); text-align: center; font-size: var(--fs-label); color: var(--sub); }
.debug { font-size: 12px; color: var(--sub); white-space: pre-wrap; }
.rule { border: 0; border-top: 1px dashed var(--line); margin: var(--s3) 0; }
.plain-list { margin: 0 0 var(--s3); padding: 0; list-style: none; }
.plain-list li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px dashed var(--line); word-break: keep-all; }
.plain-list li .ico { margin-top: 2px; color: var(--accent-strong); }

/* ---------- 하단 탭 바 ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 6px 4px calc(8px + env(safe-area-inset-bottom));
  background: var(--bg); border-top: 1px solid var(--line);
}
.tabbar button { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 52px; padding: 0 2px; color: var(--sub); font-size: 11px; font-weight: 600; }
.tabbar .ico { width: 23px; height: 23px; position: relative; z-index: 1; }
.tabbar .tab-sub { font-size: 9px; margin-top: -3px; font-weight: 500; }
.tabbar button[aria-current='true'] { color: var(--text); }
.tabbar button[aria-current='true']::before { content: ''; position: absolute; top: 9px; left: 50%; width: 34px; height: 14px; margin-left: -15px; background: var(--accent); border-radius: 3px 8px 4px 9px; transform: rotate(-4deg); }
body.with-tabbar main { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }

/* ---------- 홈 ---------- */
.home-status { margin-bottom: var(--s5); }
.status-sheet { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: var(--s3) var(--s3) var(--s1); }
.status-two { display: grid; grid-template-columns: 1fr 1fr; padding-bottom: var(--s3); border-bottom: 1px solid var(--line); }
.status-two > div + div { padding-left: var(--s3); border-left: 1px dashed var(--line); }
.status-label { font-size: var(--fs-label); font-weight: 600; color: var(--sub); }
.status-value { display: flex; align-items: baseline; gap: 4px; margin-top: var(--s1); }
.status-value b { font-size: var(--fs-display); font-weight: 800; letter-spacing: -0.03em; line-height: 1.2; }
.status-value span { font-weight: 600; }
.status-value .ico { align-self: center; width: 18px; height: 18px; color: var(--accent-strong); }
.status-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); min-height: 48px; border-bottom: 1px dashed var(--line); flex-wrap: wrap; }
.status-row:last-child { border-bottom: 0; }
.status-row .r { display: flex; align-items: center; gap: var(--s2); font-weight: 600; }
.status-row .r small { color: var(--sub); font-size: var(--fs-label); font-weight: 500; }
.boxes { display: inline-flex; gap: 6px; }
.box { width: 20px; height: 20px; border: 1.5px solid var(--sub); border-radius: 4px 5px 4px 6px; display: inline-grid; place-items: center; }
.box.on { border-color: var(--text); background: var(--accent); }
.box .ico { width: 15px; height: 15px; stroke-width: 2.2; }
.today-label { display: inline-block; position: relative; font-size: var(--fs-label); font-weight: 700; color: var(--accent-strong); }
.today-label svg { position: absolute; left: -2px; bottom: -6px; width: calc(100% + 4px); height: 6px; fill: none; stroke: var(--accent-strong); stroke-width: 1.6; stroke-linecap: round; }
.today-title { margin: var(--s3) 0 var(--s2); font-size: var(--fs-display); font-weight: 800; letter-spacing: -0.035em; line-height: 1.35; word-break: keep-all; }
.today-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; color: var(--sub); }
.today-meta i { font-style: normal; color: var(--line); }
.today-card .primary-btn { margin-top: var(--s4); }
.today-card .secondary-btn { margin-top: var(--s2); }
.scale { display: flex; gap: 6px; }
.scale .chip { flex: 1; padding: 0; }
.scale-labels { display: flex; justify-content: space-between; font-size: var(--fs-label); color: var(--sub); margin-top: var(--s1); }
.install-steps { margin: 0 0 6px; padding-left: 22px; line-height: 1.8; }

/* 첫 방문 소개 3장 */
.intro-page { min-height: 360px; display: flex; flex-direction: column; justify-content: center; padding: var(--s4) 0 var(--s3); }
.intro-kicker { font-size: var(--fs-label); font-weight: 700; color: var(--accent-strong); }
.intro-title { margin: var(--s2) 0 var(--s3); font-size: var(--fs-display); line-height: 1.4; font-weight: 800; letter-spacing: -0.035em; word-break: keep-all; }
.intro-text { font-size: 17px; line-height: 1.8; word-break: keep-all; }
.intro-src { margin-top: var(--s4); padding-top: var(--s2); border-top: 1px dashed var(--line); font-size: var(--fs-label); color: var(--sub); line-height: 1.6; }

/* ---------- 지문 목록 ---------- */
.passage-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.passage-list li { border-bottom: 1px solid var(--line); }
.passage-list button { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 64px; padding: 10px 2px; text-align: left; }
.passage-list .pl-text { flex: 1; min-width: 0; }
.passage-list .pl-title { display: block; font-weight: 700; word-break: keep-all; }
.passage-list small { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; color: var(--sub); font-size: 13px; margin-top: 2px; }
.passage-list button.locked { color: var(--sub); }
.passage-list button.locked .pl-title { font-weight: 600; }
.passage-list .go { color: var(--sub); }
.paste-btn { margin-bottom: var(--s3); }
.cat-tabs { margin-bottom: var(--s2); }
.stars-inline { display: inline-flex; align-items: center; gap: 1px; }
.stars-inline .ico { width: 13px; height: 13px; vertical-align: 0; }

/* ---------- 읽기 ---------- */
.width-slider-row { display: flex; align-items: center; gap: var(--s2); }
.width-slider { flex: 1; min-width: 0; height: 44px; accent-color: var(--accent-strong); }
.width-label { font-size: 14px; font-weight: 700; text-align: center; }
.tts-rates { display: flex; gap: 2px; }
.strategy-bar { margin: 0 0 var(--s3); padding: 10px 12px; border: 1px dashed var(--accent-strong); border-radius: var(--r); background: var(--surface); }
.strategy-bar .chip-list { margin: 6px 0 2px; }
.read-title { margin: var(--s1) 0 var(--s4); font-size: var(--fs-display); font-weight: 800; letter-spacing: -0.035em; line-height: 1.35; word-break: keep-all; }
.reader {
  position: relative; width: 100%;
  font-size: var(--font-size); line-height: var(--line-height); letter-spacing: var(--letter-spacing);
  word-break: keep-all; overflow-wrap: anywhere;
}
/* 줄 노트 선: 글줄 높이에 맞춰 아주 연하게 */
.reader .para {
  margin: 0 0 calc(var(--line-height) * 1em);
  background-image: repeating-linear-gradient(to bottom, transparent 0 calc(var(--line-height) * 1em - 1px), var(--rule) calc(var(--line-height) * 1em - 1px) calc(var(--line-height) * 1em));
}
.reader .seg { margin: 0; }
.reader .line { display: block; border-radius: 3px; transition: opacity var(--dur) var(--ease), background-color var(--dur) var(--ease); }
.reader .seg[data-mode='flow'] .line { display: inline; }
.reader .line.hint { background: var(--accent); box-shadow: 0 0 0 3px var(--accent); }
.reader .line.speaking { background: var(--accent-soft); box-shadow: 0 0 0 3px var(--accent-soft); }
.reader.ruler .line { opacity: 0.38; }
.reader.ruler .line.focus { opacity: 1; background: var(--accent-soft); box-shadow: 0 0 0 4px var(--accent-soft); }
.reader .line.stuck { text-decoration: underline wavy var(--bad); text-underline-offset: 6px; }
.reader.review-stuck .line.stuck { background: var(--accent); }
.reader.paused { filter: blur(7px); user-select: none; pointer-events: none; }

/* ---------- 활동 · 이해 문제 ---------- */
.choice-list { display: grid; gap: var(--s2); }
.choice {
  display: flex; align-items: center; gap: 12px;
  width: 100%; min-height: 52px; padding: 12px 14px;
  text-align: left; font-size: 16px; line-height: 1.55; word-break: keep-all;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--surface);
  transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}
.choice:disabled { opacity: 1; cursor: default; }
.choice.is-current { border-color: var(--text); }
.scene-choice .emoji { font-size: 26px; flex: none; }
.is-correct { border-color: var(--ok) !important; background: var(--ok-bg) !important; color: var(--text) !important; }
.is-wrong { border-color: var(--bad) !important; background: var(--bad-bg) !important; color: var(--text) !important; }
.feedback { min-height: 1.5em; margin: var(--s3) 0 0; font-size: 15px; font-weight: 600; }
.feedback ol { font-weight: 400; padding-left: 20px; }
.order-answer { min-height: 60px; margin: 0 0 12px; padding: 10px 10px 10px 30px; border: 1px dashed var(--sub); border-radius: var(--r); display: grid; gap: var(--s2); }
.order-card.placed { border-color: var(--text); }

/* ---------- 결과 ---------- */
.result-stars { display: flex; align-items: center; gap: 4px; margin: var(--s3) 0 var(--s2); }
.result-stars .ico { width: 30px; height: 30px; }
.result-stars .count { margin-left: var(--s2); font-size: var(--fs-ui); font-weight: 700; }
.result-msg { margin: 0 0 var(--s3); font-size: var(--fs-display); font-weight: 800; letter-spacing: -0.035em; line-height: 1.35; word-break: keep-all; }
.result-msg.big { margin-top: var(--s2); }
.star-list { list-style: none; margin: 0 0 var(--s3); padding: 2px var(--s3); border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.star-list li { display: grid; grid-template-columns: 24px 1fr; gap: 12px; align-items: center; min-height: 56px; padding: 8px 0; border-bottom: 1px dashed var(--line); color: var(--sub); }
.star-list li:last-child { border-bottom: 0; }
.star-list li.got { color: var(--text); }
.star-list .star { width: 22px; height: 22px; border: 1.5px solid var(--sub); border-radius: 4px 6px 4px 7px; display: grid; place-items: center; }
.star-list li.got .star { border-color: var(--text); background: var(--accent); }
.star-list .star .ico { width: 16px; height: 16px; stroke-width: 2.4; }
.star-list b { display: block; font-weight: 700; }
.star-list small { display: block; font-size: 13px; color: var(--sub); }
.result-time { margin: var(--s4) 0 var(--s3); }
.result-time p { margin: 4px 0; }
.result-time .time-row { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s2); flex-wrap: wrap; }
.result-time .big-time { font-size: var(--fs-display); font-weight: 800; letter-spacing: -0.03em; }
.result-time .speed { color: var(--sub); font-weight: 600; padding-bottom: 4px; }
.sticker { display: inline-block; margin: var(--s2) 0 0; padding: 4px 10px; font-size: var(--fs-label); font-weight: 700; color: var(--accent-strong); background: var(--accent); border-radius: 3px 8px 4px 9px; transform: rotate(-1.5deg); }
.cmp { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; margin-top: var(--s2); padding: 10px 12px; border: 1px dashed var(--line); border-radius: var(--r); }
.cmp .was { color: var(--sub); }
.cmp .now { font-weight: 700; }
.cmp .ico { width: 16px; height: 16px; color: var(--sub); }
.cmp .delta { margin-left: auto; font-size: var(--fs-label); font-weight: 700; color: var(--ok); }
.cmp .delta.slow { color: var(--sub); }
.laps { margin: 6px 0; font-size: 14px; color: var(--sub); }
.laps summary { min-height: 32px; cursor: pointer; }
.laps ul { margin: 4px 0 0; padding-left: 20px; }
.translation { margin-top: 10px; }
.tr-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); }
.tr-list { margin: 6px 0 0; padding-left: 22px; display: grid; gap: 6px; }
.tr-sent { display: block; width: 100%; min-height: 44px; padding: 8px 10px; text-align: left; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg); font-size: 16px; line-height: 1.65; word-break: keep-all; }
.tr-sent[aria-expanded='true'] { border-color: var(--text); }
.tr-text { margin: 4px 0 2px; padding: 6px 10px; border-left: 3px solid var(--accent-mid); color: var(--sub); font-size: 15px; line-height: 1.65; word-break: keep-all; }
.next-btn { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 64px; margin-top: var(--s3); padding: 0 var(--s3); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); text-align: left; }
.next-btn .g { flex: 1; min-width: 0; }
.next-btn small { display: block; font-size: var(--fs-label); color: var(--sub); font-weight: 600; }
.next-btn b { display: block; font-weight: 700; word-break: keep-all; }
.share-btn { color: var(--sub); }

/* 진단 결과 */
.big-stage { margin: var(--s2) 0; font-size: 44px; font-weight: 800; letter-spacing: -0.04em; }
.compare { margin: var(--s3) 0; padding: 12px var(--s3); border: 1px dashed var(--line); border-radius: var(--r); }
.compare p { margin: 4px 0; }
.compare-line { font-weight: 700; }

/* ---------- 내 기록 ---------- */
.records-lead { margin: var(--s3) 0; padding-left: 10px; border-left: 3px solid var(--accent-mid); font-size: 14px; word-break: keep-all; }
.records-lead small { display: block; color: var(--sub); font-size: var(--fs-label); margin-top: 2px; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); margin-bottom: var(--s3); border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.stat { padding: 12px 6px; text-align: center; }
.stat + .stat { border-left: 1px dashed var(--line); }
.stat b { display: flex; align-items: center; justify-content: center; gap: 4px; font-size: 22px; font-weight: 800; }
.stat b .ico { width: 18px; height: 18px; color: var(--accent-strong); }
.stat span { font-size: var(--fs-label); color: var(--sub); }
.stage-history { margin: 6px 0 2px; font-weight: 700; }
.chart { display: block; width: 100%; height: auto; }
.chart-grid { stroke: var(--rule); stroke-width: 1; }
.chart-axis { fill: var(--sub); font-size: 11px; }
.chart-line { fill: none; stroke: var(--text); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.chart-dot { fill: var(--surface); stroke: var(--text); stroke-width: 1.5; }
.chart-dot.last { fill: var(--accent); }
.chart-stage { fill: var(--sub); font-size: 10px; font-weight: 700; }
.mini-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.mini-table th, .mini-table td { padding: 8px 2px; border-bottom: 1px dashed var(--line); text-align: center; word-break: keep-all; }
.mini-table th { color: var(--sub); font-weight: 600; font-size: var(--fs-label); }
.mini-table td:first-child { text-align: left; white-space: nowrap; }
.log-list { list-style: none; margin: 0; padding: 0; }
.log-list.card { padding: 4px var(--s3); }
.log-row { display: flex; flex-direction: column; align-items: flex-start; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.log-row:last-child { border-bottom: 0; }
.log-row small { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; color: var(--sub); font-size: 13px; }
.log-row.quit, .log-row.quit .log-title { color: var(--sub); }
.log-title { font-weight: 600; word-break: keep-all; }
.log-title.link { min-height: 32px; padding: 0; text-align: left; color: var(--text); text-decoration: underline; text-decoration-color: var(--accent-mid); text-decoration-thickness: 2px; text-underline-offset: 4px; }
.log-row .text-btn { min-height: 40px; padding: 0; }

/* ---------- 설정 ---------- */
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 56px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.card .setting-row:last-child { border-bottom: 0; }
.setting-row.stack { flex-direction: column; align-items: stretch; gap: var(--s2); padding: 12px 0; }
.setting-label { display: flex; flex-direction: column; min-width: 0; }
.setting-label span { font-weight: 600; word-break: keep-all; }
.setting-label small { color: var(--sub); font-size: var(--fs-label); }
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper-value { min-width: 46px; text-align: center; }
.font-sample { margin: 4px 0 8px; line-height: 1.6; color: var(--sub); }
.switch { position: relative; flex: none; width: 52px; min-height: 44px; padding: 0; }
.switch::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 28px; margin-top: -14px; border-radius: 99px; border: 1.5px solid var(--sub); background: var(--surface); transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease); }
.switch-knob { position: absolute; top: 50%; left: 6px; width: 18px; height: 18px; margin-top: -9px; border-radius: 50%; background: var(--sub); transition: left var(--dur) var(--ease), background-color var(--dur) var(--ease); }
.switch[aria-checked='true']::before { background: var(--accent); border-color: var(--text); }
.switch[aria-checked='true'] .switch-knob { left: 28px; background: var(--text); }
.card .tts-rates { flex-wrap: wrap; justify-content: flex-end; }
.setting-row.stack .tts-rates { justify-content: flex-start; }
.app-version { margin: var(--s1) 0 0; text-align: center; font-size: var(--fs-label); color: var(--sub); }
.paste-text {
  display: block; width: 100%; min-height: 200px; margin: var(--s2) 0 4px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); color: var(--text);
  font-size: 16px; line-height: 1.7; resize: vertical;
}
.paste-text:focus { border-color: var(--text); }
.paste-count { margin: 0 0 12px; text-align: right; font-size: var(--fs-label); }
.stage-label { margin: var(--s2) 0 4px; font-size: var(--fs-label); font-weight: 700; color: var(--sub); }
.backup-code { min-height: 110px; font-size: 12px; font-family: ui-monospace, Consolas, monospace; word-break: break-all; }
.summary-input { min-height: 96px; }

/* ---------- Learning ---------- */
.learning-lead { margin: 0 0 var(--s3); font-weight: 700; word-break: keep-all; }
.message-card { border-left: 3px solid var(--accent-mid); }
.message-card p { margin: 0 0 6px; word-break: keep-all; }
.message-card .src { font-size: var(--fs-label); color: var(--sub); margin: var(--s2) 0 0; }
.profile-list { margin: 0; padding: 0; list-style: none; }
.profile-list li { padding: 8px 0; border-bottom: 1px dashed var(--line); word-break: keep-all; }
.profile-list li:last-child { border-bottom: 0; }
.profile-rec { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: var(--s2); flex-wrap: wrap; }
.profile-rec p { margin: 0; }
.lesson-head { display: flex; align-items: baseline; justify-content: space-between; margin-top: var(--s4); }
.progress-bar { height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; margin: 6px 0 12px; }
.progress-bar span { display: block; height: 100%; background: var(--accent-mid); border-radius: 99px; }
.progress-bar.thin { height: 4px; }
.lesson-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.lesson-list li { border-bottom: 1px solid var(--line); }
.lesson-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 64px; padding: 10px 2px; text-align: left; }
.lesson-row.locked { color: var(--sub); }
.lesson-no { flex: none; width: 28px; height: 28px; border: 1.5px solid var(--sub); border-radius: 5px 7px 5px 8px; display: grid; place-items: center; font-size: 13px; font-weight: 700; }
.lesson-row.done .lesson-no { border-color: var(--text); background: var(--accent); color: var(--text); }
.lesson-row.locked .lesson-no { border-style: dashed; }
.lesson-no .ico { width: 15px; height: 15px; stroke-width: 2.2; }
.lesson-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.lesson-text b { font-weight: 700; }
.lesson-text small { color: var(--sub); font-size: 13px; word-break: keep-all; }
.lesson-card { min-height: 240px; padding: var(--s4) var(--s3); border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.lesson-card-title { margin: 6px 0 12px; font-size: 20px; line-height: 1.45; font-weight: 800; letter-spacing: -0.02em; word-break: keep-all; }
.lesson-card-text { margin: 0 0 var(--s2); font-size: 17px; line-height: 1.85; word-break: keep-all; }
.lesson-note { margin-top: var(--s4); padding-top: var(--s2); border-top: 1px dashed var(--line); font-size: 13px; }
.evidence { display: inline-flex; align-items: center; gap: 6px; margin: 4px 0 8px; padding: 3px 10px; border-radius: 99px; font-size: var(--fs-label); font-weight: 700; border: 1px solid var(--line); }
.ev-strong { color: var(--accent-strong); background: var(--accent); border-color: transparent; }
.ev-limited { color: var(--sub); }
.ev-myth { color: var(--bad); border-color: var(--bad); }
.dots { display: flex; justify-content: center; gap: 6px; margin: 12px 0 0; }
.dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--line); transition: width var(--dur) var(--ease); }
.dots span.on { background: var(--text); width: 16px; border-radius: 99px; }
.mission-done { margin-top: var(--s4); padding-top: var(--s3); border-top: 1px solid var(--line); }
.feel { margin: 12px 0; }
.feel p { margin: 0 0 6px; }
.feel-row { display: flex; flex-wrap: wrap; gap: 6px; }
.skim-card .skim-line { margin: 0 0 10px; line-height: 1.75; }
.mission-reader { margin: var(--s2) 0 var(--s3); }
.sig { min-height: 32px; padding: 0 3px; border-radius: 3px; border-bottom: 2px solid var(--accent-strong); font: inherit; color: inherit; }
.sig.ok { background: var(--accent); border-color: var(--ok); }
.sig.bad { background: var(--bad-bg); border-color: var(--bad); }
.sig-sheet { position: sticky; bottom: 8px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); box-shadow: 0 4px 16px rgba(0, 0, 0, .08); }
.pinned-q { position: sticky; top: 64px; z-index: 5; }
.pinned-q p { margin: 0; }
.para-card, .vocab-sent { line-height: 1.85; }
.vocab-sent mark { background: var(--accent); border-radius: 3px; padding: 0 2px; color: inherit; }
.strategy-card .mini-table { margin-bottom: 6px; }
.checklist { margin-bottom: 4px; }

/* ---------- 모달 · 알림 ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: var(--s3); background: var(--scrim); }
.modal-box { width: 100%; max-width: 360px; padding: var(--s4) var(--s3) var(--s3); border-radius: 14px; background: var(--surface); border: 1px solid var(--line); animation: pop var(--dur) var(--ease); }
.modal-box p { margin: 0 0 var(--s3); font-size: 17px; line-height: 1.6; word-break: keep-all; }
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); }
.modal-actions.stack { grid-template-columns: 1fr; gap: 12px; }
.modal-actions.stack .text-btn.block { margin-top: 0; color: var(--sub); }
.modal-actions .primary-btn { margin-top: 0; }
.toast {
  position: fixed; left: 50%; bottom: calc(100px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60;
  max-width: calc(100% - 40px); padding: 10px 16px; border-radius: var(--r); background: var(--ink); color: var(--on-ink); font-size: 14px; text-align: center;
  animation: rise var(--dur) var(--ease);
}
@keyframes pop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 6px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* 빈 상태 · 불러오기 · 오류 */
div.empty, li.empty { padding: var(--s5) var(--s3); text-align: center; color: var(--sub); }
div.empty .ico, li.empty .ico { width: 32px; height: 32px; margin-bottom: var(--s2); }
div.empty p, li.empty p { word-break: keep-all; }
.loading { padding: var(--s6) 0; text-align: center; color: var(--sub); font-size: 14px; }
.loading::after { content: ''; display: block; width: 40px; height: 3px; margin: 12px auto 0; background: var(--accent-mid); border-radius: 3px; animation: load 1.2s var(--ease) infinite alternate; }
@keyframes load { from { transform: scaleX(.3); } to { transform: scaleX(1); } }

/* ---------- 접근성 ---------- */
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.choice:focus-visible, .chip:focus-visible, .primary-btn:focus-visible, .secondary-btn:focus-visible { outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ---------- 다듬기 (스크린샷 점검 후) ---------- */
.toolbar .exit-btn { color: var(--text); }
.btn-row .primary-btn { margin-top: 0; }
.tr-block { margin: var(--s3) 0; }
.lesson-list + p { margin-top: var(--s3); }
.home-today-wrap { margin-bottom: var(--s4); }

/* ---------- 12차: 읽기 화면 = 글이 주인공 ---------- */
.read-meta { display: flex; align-items: center; gap: 6px; margin: 0 0 var(--s1); font-size: var(--fs-label); font-weight: 600; color: var(--sub); word-break: keep-all; }
.read-meta .ico { color: var(--accent-strong); }
#screen-read .read-title { margin-top: 0; margin-bottom: var(--s3); }
.strategy-bar { padding: 6px 10px; margin-bottom: var(--s2); }
.strategy-bar .chip-list { margin: 2px 0; align-items: center; }

/* 읽기 전 안내 */
.pre-list { margin: var(--s3) 0 0; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); padding: 0 var(--s3); }
.pre-row { display: grid; grid-template-columns: 24px 1fr; gap: 12px; padding: 14px 0; border-bottom: 1px dashed var(--line); }
.pre-list > :last-child .pre-row, .pre-list > .pre-row:last-child { border-bottom: 0; }
.pre-row > .ico { margin-top: 2px; color: var(--accent-strong); }
.pre-row b { display: block; font-weight: 700; word-break: keep-all; }
.pre-row p { margin: 4px 0 0; color: var(--sub); word-break: keep-all; }
.pre-row .text-btn { margin-left: -8px; }

/* ⋯ 도구 시트 (아래에서 올라옴) */
.sheet-wrap { position: fixed; inset: 0; z-index: 40; display: flex; align-items: flex-end; justify-content: center; background: var(--scrim); }
.sheet { width: 100%; max-width: 560px; max-height: 78vh; overflow-y: auto; padding: 4px var(--gutter) calc(var(--s3) + env(safe-area-inset-bottom)); border-radius: 16px 16px 0 0; background: var(--surface); border: 1px solid var(--line); border-bottom: 0; animation: sheet-up var(--dur) var(--ease); }
.sheet-head { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; padding: 6px 0; background: var(--surface); }
.sheet-head h3 { margin: 0; font-size: var(--fs-ui); font-weight: 800; }
.sheet-head .icon-btn { border: 0; background: none; margin-right: -10px; color: var(--text); }
.sheet-sec { padding: 6px 0 12px; border-bottom: 1px dashed var(--line); }
.sheet-label { margin: 4px 0 2px; font-size: var(--fs-label); font-weight: 700; color: var(--sub); }
.sheet-rows .setting-row:last-child { border-bottom: 0; }
.sheet .block-btn { margin-top: var(--s2); }
.tts-row { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.tts-row .tts-rates .chip { border-color: transparent; background: none; padding: 0 8px; }
.tts-row .tts-rates .chip[aria-pressed=true] { background: var(--accent); }
@keyframes sheet-up { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }

/* 글 폭 조절 */
.width-control { display: grid; gap: 2px; }
.width-quick { margin-top: 2px; }
.td-sub { display: block; font-size: 11px; color: var(--sub); font-weight: 400; }

/* 나가기 확인 창: 기록 안 남기고 나가기 (빨강) */
.danger-btn { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 52px; padding: 0 var(--s3); border-radius: var(--r); font-size: var(--fs-ui); font-weight: 700; color: var(--bad); background: var(--surface); border: 1.5px solid var(--bad); }
.danger-btn:active { background: var(--bad-bg); }

/* 홈 상태 시트: 연속 0일 */
.status-zero { display: flex; align-items: center; gap: 6px; margin: 6px 0 0; font-size: 14px; font-weight: 700; line-height: 1.4; word-break: keep-all; }
.status-zero .ico { color: var(--accent-strong); }

/* 결과: 별 요약 한 줄 + 자세히 */
.star-chips { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0 0 var(--s3); padding: 0; font-size: 14px; color: var(--sub); }
.star-chips li { display: inline-flex; align-items: center; gap: 6px; }
.star-chips li.got { color: var(--text); font-weight: 600; }
.star-chips .star { width: 18px; height: 18px; border: 1.5px solid var(--sub); border-radius: 3px 5px 3px 6px; display: grid; place-items: center; }
.star-chips li.got .star { border-color: var(--text); background: var(--accent); }
.star-chips .star .ico { width: 13px; height: 13px; stroke-width: 2.6; }
.more-info { margin: 0 0 var(--s3); }
.more-info > summary { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; color: var(--accent-strong); font-size: 14px; font-weight: 700; cursor: pointer; list-style: none; }
.more-info > summary::-webkit-details-marker { display: none; }
.more-info[open] > summary { margin-bottom: var(--s1); }

/* ---------- 13차: 초시계는 상단 바에 · 끄면 3버튼 시트 ---------- */
.toolbar-right .timer-btn { gap: 6px; }
.toolbar-right .timer-btn.on { padding: 0 12px; color: var(--text); background: var(--accent); font-size: 14px; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; font-feature-settings: 'tnum'; }
.toolbar-right .timer-btn.on .ico { color: var(--accent-strong); }
.modal.as-sheet { align-items: flex-end; padding: 0; }
.modal.as-sheet .modal-box { max-width: 560px; border-radius: 16px 16px 0 0; border-bottom: 0; padding: var(--s4) var(--gutter) calc(var(--s3) + env(safe-area-inset-bottom)); animation: sheet-up var(--dur) var(--ease); }
.skim-note { margin: -8px 0 var(--s3); color: var(--bad); font-size: 14px; font-weight: 700; word-break: keep-all; }

/* ---------- 14차: 학원 코드 · 관리자 ---------- */
.code-card { padding: var(--s3); }
.code-input {
  display: block; width: 100%; min-height: 56px; padding: 10px 14px;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--bg); color: var(--text);
  font-size: 24px; font-weight: 700; letter-spacing: 0.12em; text-align: center; text-transform: uppercase;
  font-variant-numeric: tabular-nums; font-feature-settings: 'tnum';
}
.code-input::placeholder { color: var(--sub); opacity: .6; letter-spacing: 0.12em; }
.code-input:focus { border-color: var(--text); outline: none; }
.code-input.admin { font-size: 18px; letter-spacing: 0.04em; text-transform: none; text-align: left; margin-bottom: var(--s2); }
.code-input.small { min-height: 44px; font-size: 16px; text-align: left; letter-spacing: 0.06em; margin-bottom: var(--s2); }
.code-msg { min-height: 1.4em; margin: var(--s2) 0 0; font-size: 14px; font-weight: 600; color: var(--bad); word-break: keep-all; }
.code-msg.warn { color: var(--sub); }
.code-current { margin: 0 0 var(--s3); }
.code-current b { font-variant-numeric: tabular-nums; letter-spacing: 0.06em; }
.mono { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum'; letter-spacing: 0.05em; }
.admin-head { margin-bottom: var(--s2); }
.admin-head .chip-list { align-items: center; }
.admin-head .text-btn { margin-left: auto; }
.admin-list { padding: 0 var(--s3); }
.admin-row { flex-direction: row; align-items: center; gap: var(--s2); }
.admin-row.zero .log-title { color: var(--bad); }
.admin-code-btn { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; min-height: 56px; padding: 6px 0; text-align: left; }
.admin-code-btn .log-title { display: block; word-break: keep-all; }
.admin-code-btn small { display: block; color: var(--sub); font-size: 13px; margin-top: 2px; }
.admin-row .switch { margin-left: auto; }
.admin-actions { display: grid; gap: var(--s2); margin: var(--s3) 0; }
.admin-detail { width: 100%; padding: 4px 0 8px 8px; border-left: 2px solid var(--accent-mid); margin-bottom: 6px; }
.admin-detail .ok { color: var(--ok); }
.admin-detail .bad { color: var(--bad); }
.admin-detail .plain-list li { padding: 4px 0; border: 0; display: block; }
.admin-detail p { margin: 4px 0; }
.log-list .admin-row { flex-wrap: wrap; }
.bars { display: grid; gap: 6px; }
.bar-row { display: grid; grid-template-columns: 64px 1fr 28px; align-items: center; gap: 8px; font-size: 13px; }
.bar-label { color: var(--sub); }
.bar { height: 14px; background: var(--rule); border-radius: 3px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--accent-mid); border-radius: 3px 6px 3px 7px; }
.bar-num { text-align: right; font-weight: 700; }
.date-input { min-height: 44px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); color: var(--text); font-size: 14px; }
.chip.mono { padding: 0 10px; }
a.secondary-btn { text-decoration: none; margin-top: var(--s3); }

/* ---------- 14-1차: 학생 등록 · 코드 생성 ---------- */
.admin-selects { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); margin-bottom: var(--s2); }
.admin-select { min-height: 44px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); color: var(--text); font-size: 14px; }
.admin-code-btn small + small { margin-top: 1px; }
.code-result { text-align: center; padding: var(--s4) var(--s3); }
.big-code { font-size: 40px; font-weight: 800; letter-spacing: 0.12em; line-height: 1.2; }
.notice-preview { margin: var(--s2) 0; padding: 12px 14px; border: 1px dashed var(--line); border-radius: var(--r); background: var(--bg); font: inherit; font-size: 14px; line-height: 1.7; white-space: pre-wrap; word-break: keep-all; color: var(--sub); }
.bulk-text { min-height: 150px; font-size: 14px; }
.code-line { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; padding: 12px var(--s3); }
.code-line .mono.big { font-size: 24px; font-weight: 800; }
.code-line .text-btn { margin-left: auto; min-width: 44px; }
.chip.danger-chip { color: var(--bad); border-color: var(--bad); }
.chip .ico.sm { margin-left: -4px; }

/* ---------- 14-1차 추가: 코드 돌려쓰기 방지 (정지 화면 · 기기 · 이력) ---------- */
.banner.danger { border-left-color: var(--bad); background: var(--bad-bg); }
.banner.danger .ico { color: var(--bad); }
.banner.danger .banner-title { color: var(--bad); }
.admin-row.suspended .log-title { color: var(--bad); }
.violation { align-items: flex-start; }
.violation b { display: block; }
.violation-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); margin-top: 6px; }
.violation-col { padding: 6px 8px; border: 1px dashed var(--line); border-radius: var(--r-sm); font-size: 12px; min-width: 0; }
.violation-col small { display: block; font-weight: 700; color: var(--sub); margin-bottom: 2px; }
.violation-col ul { margin: 0; padding-left: 14px; }
.violation-col li { word-break: keep-all; }
.violation-col p { margin: 0; }

/* 앱 이름: 로고 + Reading Muscle + 작은 한글 부제 */
.app-logo { width: 34px; height: 34px; flex: none; }
.app-name-text { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.app-name-text small { font-size: 11px; font-weight: 600; letter-spacing: 0; color: var(--sub); }

/* 관리자 로그인 (코드 화면 아래) */
.admin-toggle { margin-top: var(--s3); color: var(--sub); font-size: var(--fs-label); }
.admin-login { display: grid; gap: var(--s2); margin-top: var(--s2); }
.admin-login[hidden] { display: none; }
.admin-input { letter-spacing: 0.04em; font-size: var(--fs-ui); }

.danger-text { color: var(--bad); }

/* 화면 모드 버튼 3개 (자동/라이트/나이트) — 상단 바 + 설정 */
.theme-slot { margin-left: auto; flex: none; }
.theme-seg { display: inline-flex; align-items: center; gap: 2px; padding: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; }
.theme-btn { width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 18px; background: none; color: var(--sub); cursor: pointer; }
.theme-btn .ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.theme-btn[aria-pressed="true"] { background: var(--accent); color: var(--accent-strong); }
/* 읽는 중에는 상단 바가 좁아서 숨김 (읽기 도구가 그 자리를 씀) */
.toolbar:has(#read-tools:not([hidden])) .theme-slot { display: none; }
.home-hello { margin: 0 0 var(--s2); font-weight: 700; color: var(--text); }

/* ---------- 17차: 관리자 미리보기 띠 (모든 화면 맨 위, 라이트·나이트) ---------- */
.preview-bar { position: sticky; top: 0; z-index: 12; display: flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 6px 0 var(--gutter); background: var(--accent-strong); color: var(--bg); font-size: 13px; font-weight: 700; }
.preview-bar .pv-text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preview-bar button { min-height: 32px; padding: 0 10px; border-radius: 8px; color: inherit; font-size: 13px; font-weight: 700; background: rgba(255, 255, 255, .16); white-space: nowrap; }
.preview-bar .pv-more { min-width: 36px; padding: 0; }
.preview-bar .ico { width: 18px; height: 18px; }
body.with-preview .toolbar { top: 36px; }
body.with-preview .update-bar { top: 92px; }
.modal-actions.stack .secondary-btn { min-height: 44px; }

/* ---------- 18차: 학부모 주간 리포트 (report.html + 관리자 미리보기) ---------- */
.report-page main { padding-top: var(--s4); }
.rp-head { margin-bottom: var(--s3); }
.rp-brand { display: inline-flex; align-items: center; gap: 8px; margin-bottom: var(--s3); font-size: var(--fs-body); font-weight: 800; letter-spacing: -0.03em; }
.rp-h1 { margin: 0 0 var(--s1); font-size: var(--fs-display); font-weight: 800; letter-spacing: -0.035em; line-height: 1.3; word-break: keep-all; }
.rp-period { color: var(--sub); font-weight: 600; }
.rp-card { padding: var(--s3); }
.rp-title { margin: 0 0 var(--s2); font-size: var(--fs-ui); font-weight: 800; }
.rp-note { margin-top: var(--s2); }
.week-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.day { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.day-name { font-size: var(--fs-label); color: var(--sub); font-weight: 600; }
.day:nth-child(6) .day-name { color: var(--accent-strong); }
.day:nth-child(7) .day-name { color: var(--bad); }
.day-box { width: 100%; max-width: 44px; aspect-ratio: 1; border: 1.5px solid var(--line); border-radius: 6px 8px 6px 9px; display: grid; place-items: center; font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; }
.day.on .day-box { border-color: var(--text); background: var(--accent); }
.rp-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.rp-stat { padding: 10px 8px; border: 1px dashed var(--line); border-radius: var(--r-sm); text-align: center; }
.rp-stat b { display: flex; align-items: center; justify-content: center; gap: 4px; font-size: 22px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.rp-stat b .ico { width: 18px; height: 18px; }
.rp-stat span { font-size: var(--fs-label); color: var(--sub); }
.rp-levels { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.rp-level { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px dashed var(--line); border-radius: var(--r-sm); }
.rp-level-v { display: flex; align-items: baseline; gap: 4px; }
.rp-level-v b { font-size: 26px; font-weight: 800; }
.rp-level-v small { color: var(--sub); font-weight: 600; font-size: 13px; }
.rp-level .sticker { align-self: flex-start; margin-top: 4px; }
.rp-list { margin: 0; }
.rp-list li { padding: 8px 0; }
.rp-list li:last-child { border-bottom: 0; }
.rp-list li + li { border-top: 0; }
.rp-goal { margin: var(--s2) 0 0; font-weight: 700; word-break: keep-all; line-height: 1.7; }
.note-card { border-left: 3px solid var(--accent-strong); }
.rp-note-text { font-size: 17px; line-height: 1.7; word-break: keep-all; margin-bottom: 6px; }
.rp-foot { margin-top: var(--s4); padding-top: var(--s3); border-top: 1px dashed var(--line); text-align: center; font-weight: 600; }
.rp-foot p { margin: 0 0 4px; }
.rp-msg { padding-top: var(--s4); }
.admin-report-preview { margin-top: var(--s3); padding-top: var(--s3); border-top: 1px dashed var(--line); }
.admin-report-preview .rp-card { background: var(--bg); }
.note-input { min-height: 84px; font-size: 16px; margin-bottom: 0; }
.note-count { margin: 4px 0 6px; text-align: right; font-size: var(--fs-label); color: var(--sub); }
.admin-row.soon .log-title::after { content: ' ⏳'; }
.compare-hint { margin: var(--s2) 0 0; }

/* 관리자 미리보기: 잠긴 곳을 누르면 뜨는 "관리자 권한으로 풀기" (탭 바 위에 떠 있음) */
.admin-fab { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 60;
  width: min(calc(100% - 32px), 440px); padding: var(--s3); background: var(--surface); border: 1.5px solid var(--accent-strong);
  border-radius: var(--r); box-shadow: 0 8px 24px rgba(0,0,0,.18); display: grid; gap: var(--s2); animation: fab-in var(--dur) var(--ease); }
.admin-fab-label { margin: 0; font-size: var(--fs-ui); font-weight: 700; color: var(--text); }
.admin-fab-row { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }
.admin-fab-row .primary-btn, .admin-fab-row .secondary-btn { flex: 1 1 auto; min-height: 44px; }
@keyframes fab-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* 홈 첫 줄: 인사 + 로그아웃 */
.home-hello-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); margin-bottom: var(--s2); }
.home-hello-row .home-hello { margin: 0; min-width: 0; }
.logout-mini { flex: none; min-height: 44px; padding: 0 var(--s2); font-size: var(--fs-label); color: var(--sub); border: 1px solid var(--line); border-radius: 22px; }

/* 오답 뒤 근거 문장 보기 */
.hint-quote { margin: var(--s2) 0; padding: var(--s2) var(--s3); border-left: 3px solid var(--accent-mid); background: var(--accent-soft); border-radius: var(--r-sm); color: var(--text); font-size: var(--fs-ui); line-height: 1.6; }

/* ---------- 19차 (독자 QA 1묶음) ---------- */
button { word-break: keep-all; }
.step-q.long { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.stem-context { margin: 0 0 var(--s2); font-size: 17px; line-height: 1.6; word-break: keep-all; }
.bogi { position: relative; margin: 0 0 var(--s3); padding: 18px var(--s3) var(--s2); border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.bogi p { margin: 0; line-height: 1.6; word-break: keep-all; white-space: pre-line; }
.bogi-tag { position: absolute; top: -10px; left: 12px; padding: 0 8px; font-size: var(--fs-label); font-weight: 700; color: var(--sub); background: var(--bg); }
.toolbar-right.is-empty { display: none; }
#screen-read.reviewing #btn-done { position: sticky; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 5; box-shadow: 0 4px 16px rgba(0, 0, 0, .15); }
html.sheet-lock, html.sheet-lock body { overflow: hidden; }
.sheet { max-height: 78vh; max-height: 85dvh; overscroll-behavior: contain; }
.logout-mini { border: 0; min-height: 36px; padding: 0 4px; font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }
/* PC: 도구 시트 = 오른쪽 패널 (지문을 덮지 않게) */
@media (min-width: 900px) {
  .sheet-wrap { justify-content: flex-end; align-items: stretch; background: rgba(0, 0, 0, .12); }
  .sheet { width: 360px; max-width: 360px; height: 100%; max-height: none; border-radius: 0; border: 0; border-left: 1px solid var(--line); padding: 8px var(--s3) var(--s3); box-shadow: -8px 0 24px rgba(0, 0, 0, .08); animation: sheet-side var(--dur) var(--ease); }
}
@keyframes sheet-side { from { transform: translateX(24px); opacity: .6; } to { transform: none; opacity: 1; } }

/* 글 폭 떠 있는 바 (19차) */
.width-float { position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 35; max-width: 520px; margin: 0 auto; padding: 6px 14px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 8px 28px rgba(0, 0, 0, .18); animation: sheet-up var(--dur) var(--ease); }
.wf-head { display: flex; align-items: center; justify-content: space-between; }
.wf-head .wf-close { border: 0; background: none; margin-right: -10px; }
.wf-head .wf-close span:last-child { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
#screen-read:has(.width-float:not([hidden])) #btn-done { margin-bottom: 170px; }
@media (min-width: 900px) { .width-float { left: auto; right: 24px; width: 380px; bottom: 24px; } }

/* ---------- 20차: 레벨·연속 통과·해설 ---------- */
.streak-bar { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; margin: 6px 0 2px; }
.streak-bar span { height: 10px; border-radius: 5px; background: var(--line); }
.streak-bar span.on { background: var(--accent-strong, #5a8f3c); }
.streak-card { margin: var(--s2) 0; padding: var(--s2) var(--s3); border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.streak-card.reset { border-style: dashed; }
.streak-title { margin: 0; font-weight: 800; }
.explain-box { margin: var(--s2) 0; padding: 10px 14px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); }
.explain-box p { margin: 4px 0; line-height: 1.55; word-break: keep-all; }
.explain-box b { margin-right: 4px; }
.ex-bad b { color: var(--bad); }
.ex-ok b { color: var(--accent-strong, #3f7a28); }
.wrong-review { margin: var(--s3) 0; }
.wr-title { margin: 0 0 var(--s2); font-size: 17px; font-weight: 800; }
.wr-item { margin-bottom: var(--s2); padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.wr-item summary { cursor: pointer; font-weight: 700; line-height: 1.45; word-break: keep-all; }
.wr-line { margin: 10px 0 2px; word-break: keep-all; }
.wr-line.bad b { color: var(--bad); }
.wr-line.ok b { color: var(--accent-strong, #3f7a28); }
.wr-why { margin: 0 0 4px; font-size: 15px; color: var(--sub); line-height: 1.55; word-break: keep-all; }
.wr-passage { margin-top: 10px; padding: 10px 12px; border-left: 3px solid var(--accent); background: var(--bg); border-radius: 6px; }
.wr-passage p { margin: 4px 0; line-height: 1.7; word-break: keep-all; }
.wr-passage mark { background: var(--accent); color: var(--text); padding: 1px 2px; border-radius: 3px; }
.wr-label { font-size: var(--fs-label); font-weight: 700; color: var(--sub); }
.level-step { list-style: none; margin-bottom: 8px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.level-step.locked { opacity: .55; }
.level-step.done { background: var(--bg); }
.level-step.cur { border: 2px solid var(--accent-strong, #5a8f3c); }
.ls-head { display: flex; align-items: center; gap: 8px; }
.ls-ico { margin-left: auto; }
.ls-body { margin-top: 8px; display: grid; gap: 6px; }

/* 21차: 관리자 실시간 */
.live-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.live-card { padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.live-card.on { border: 2px solid var(--accent-strong, #5a8f3c); }
.live-name { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; padding: 0; border: 0; background: none; color: var(--text); font-size: 16px; text-align: left; cursor: pointer; }
.live-badge { flex: none; padding: 2px 10px; border-radius: 12px; font-size: 13px; color: var(--sub); background: var(--bg); }
.live-badge.on { color: var(--text); background: var(--accent); font-weight: 700; }
.live-passage { margin: 6px 0 2px; }
.live-recent { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.live-recent li { display: inline-flex; gap: 4px; align-items: baseline; padding: 2px 8px; border-radius: 10px; background: var(--bg); font-size: 13px; }
.live-recent small { color: var(--sub); }

/* 22차: 도전 퀘스트 */
.level-step.quest { border: 2px dashed var(--accent-strong, #5a8f3c); background: var(--surface); }
.quest-chip { min-height: 30px; padding: 0 10px; font-size: 13px; margin-left: 6px; }
.level-step.locked .quest-chip { opacity: 1; }
.level-step.locked { opacity: 1; }
.level-step.locked .ls-head b, .level-step.locked .ls-head .muted { opacity: .55; }
.quest-note { list-style: none; padding: 6px 4px; }

/* 22차: 관리자 지문 보기 */
.lib-text p { margin: 0 0 10px; line-height: 1.75; word-break: keep-all; }
.lib-quiz { list-style: none; padding: 0; display: grid; gap: 10px; }
.lib-q { margin: 4px 0 8px; font-weight: 700; white-space: pre-line; word-break: keep-all; }
.lib-choices { margin: 0 0 8px; padding-left: 20px; display: grid; gap: 4px; }
.lib-choices li { line-height: 1.5; word-break: keep-all; }
.lib-choices li.ok { font-weight: 700; color: var(--accent-strong, #3f7a28); }
.lib-choices small { color: var(--sub); font-weight: 400; }
