:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #1e293b;
  --muted: #475569;
  --line: #e2e8f0;
  --primary: #0f766e;
  --primary-soft: #ccfbf1;
  --accent: #b45309;
  --accent-soft: #fef3c7;
  --ok: #15803d;
  --ok-soft: #dcfce7;
  --bad: #b91c1c;
  --bad-soft: #fee2e2;
  --info-soft: #e0f2fe;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 2px 8px rgba(15, 23, 42, 0.04);
  font-family: -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Malgun Gothic', 'Noto Sans KR', 'Segoe UI', sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

* { box-sizing: border-box; }
/* hidden 속성은 언제나 숨긴다(.btn처럼 display를 정한 요소에도, 2026-11-29 점검) */
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; background: var(--bg); line-height: 1.55; }
/* 한국어 줄바꿈: 낱말 가운데서 끊지 않는다('있어/요', '5/개를' 같은 끊김). 칸보다 긴 낱말(주소·키)만 끊는다(2026-11-29 디자인 점검) */
body { word-break: keep-all; overflow-wrap: break-word; }
h1, h2, h3 { line-height: 1.3; margin: 0 0 0.5rem; }
h1 { font-size: 1.35rem; }
h2 { font-size: 1.12rem; }
h3 { font-size: 1rem; }
p { margin: 0.35rem 0; }
a { color: var(--primary); }
button, input, textarea, select { font: inherit; color: inherit; }
sup { font-size: 0.7em; }

.container { max-width: 760px; margin: 0 auto; padding: 0.75rem 0.9rem 6.5rem; }
.loading { text-align: center; color: var(--muted); margin-top: 3rem; }
/* 화면에는 보이지 않고 화면 낭독기만 읽는 글(2026-11-27 UI 점검) */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* 상단 */
.topbar { position: sticky; top: 0; z-index: 10; background: var(--panel); border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: 760px; margin: 0 auto; padding: 0.55rem 0.9rem; display: flex; align-items: center; gap: 0.6rem; }
.topbar .brand { font-weight: 700; color: var(--primary); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .stat { font-size: 0.85rem; color: var(--muted); white-space: nowrap; }
.topbar .stat b { color: var(--text); }

/* 하단 메뉴 */
.bottomnav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; background: var(--panel); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.bottomnav-inner { max-width: 760px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); }
.bottomnav button { border: 0; background: none; padding: 0.6rem 0.2rem 0.7rem; font-size: 0.82rem; color: var(--muted); cursor: pointer; position: relative; }
.bottomnav button .ico { display: block; font-size: 1.15rem; line-height: 1.2; }
.bottomnav button.on { color: var(--primary); font-weight: 700; }
.bottomnav .dot { position: absolute; top: 0.35rem; left: calc(50% + 0.35rem); min-width: 1.1rem; padding: 0 0.3rem; border-radius: 999px; background: var(--accent); color: #fff; font-size: 0.7rem; line-height: 1.1rem; }

/* 패널 */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 0.95rem; margin: 0.75rem 0; }
.panel.soft { background: var(--primary-soft); border-color: transparent; }
.panel.warn { background: var(--accent-soft); border-color: transparent; }
.panel-title { display: flex; align-items: center; justify-content: space-between; gap: 0.25rem 0.5rem; margin-bottom: 0.45rem; flex-wrap: wrap; }
/* 제목 옆 설명이 길면 제목을 줄이지 않고 설명을 다음 줄로('최근 7 / 일' 같은 끊김, 2026-11-29 디자인 점검) */
.panel-title > h1, .panel-title > h2, .panel-title > h3 { flex: none; max-width: 100%; margin-bottom: 0; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.row { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.row.spread { justify-content: space-between; }
.stack > * + * { margin-top: 0.5rem; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem; }
@media (max-width: 340px) { .grid3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
hr { border: 0; border-top: 1px solid var(--line); margin: 0.8rem 0; }

/* 버튼 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem; border: 1px solid var(--line); background: var(--panel); border-radius: 12px; padding: 0.62rem 0.95rem; cursor: pointer; font-weight: 600; min-height: 44px; text-decoration: none; color: var(--text); }
.btn:hover { border-color: #cbd5e1; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.ghost { background: transparent; }
.btn.small { min-height: 44px; padding: 0.4rem 0.8rem; font-size: 0.88rem; border-radius: 10px; }
.btn.block { width: 100%; }
.btn.danger { color: var(--bad); }
.linkbtn { border: 0; background: none; color: var(--primary); cursor: pointer; padding: 0; font-weight: 600; min-height: 44px; }

/* 배지·칩 */
.badge { display: inline-block; padding: 0.1rem 0.5rem; border-radius: 999px; font-size: 0.75rem; font-weight: 700; background: #f1f5f9; color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--accent-soft); color: var(--accent); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.pri { background: var(--primary-soft); color: var(--primary); }
.badge.s0 { background: #f1f5f9; color: #475569; } /* 작은 글자 대비 4.5:1 이상(2026-11-27 UI 점검) */
.badge.s1 { background: #fef9c3; color: #854d0e; }
.badge.s2 { background: #e0f2fe; color: #075985; }
.badge.s3 { background: #dcfce7; color: #166534; }
.badge.s4 { background: #ede9fe; color: #5b21b6; }
.chip { display: inline-block; border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 0.3rem 0.7rem; font-size: 0.85rem; cursor: pointer; margin: 0.15rem; }
.chip.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.chip.used { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.chip.unused { background: #f8fafc; color: var(--muted); }

/* 탭 */
.tabs { display: flex; gap: 0.35rem; overflow-x: auto; padding-bottom: 0.2rem; }
.tabs button { flex: 0 0 auto; min-height: 44px; border: 1px solid var(--line); background: var(--panel); padding: 0.45rem 0.85rem; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: 0.9rem; }
.tabs button.on { background: var(--text); color: #fff; border-color: var(--text); }

/* 진행 막대 */
.bar { height: 10px; background: #e2e8f0; border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--primary); border-radius: 999px; }
.bar.accent > span { background: var(--accent); }

/* 목록 */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 0.65rem 0; border-bottom: 1px solid var(--line); }
.list > li:last-child { border-bottom: 0; }
.unit-row { min-height: 44px; display: flex; align-items: center; gap: 0.6rem; width: 100%; text-align: left; background: none; border: 0; padding: 0; cursor: pointer; }
.unit-row .grow { flex: 1; min-width: 0; }
/* 누르면 열리는 줄(단원·사진 문제·검수 단원·논술): 오른쪽 끝에 ›(2026-11-29 디자인 점검) */
.unit-row { border-radius: 10px; }
.unit-row::after { content: '›'; flex: none; color: #94a3b8; font-size: 1.4rem; line-height: 1; margin: 0 0.1rem 0 0.15rem; }

/* 미션 */
.mission { display: flex; align-items: center; gap: 0.6rem; padding: 0.55rem 0; }
.mission .check { width: 1.5rem; height: 1.5rem; border-radius: 50%; border: 2px solid var(--line); display: inline-flex; align-items: center; justify-content: center; font-size: 0.8rem; flex: 0 0 auto; }
.mission.done .check { background: var(--ok); border-color: var(--ok); color: #fff; }
.mission .grow { flex: 1; }

/* 문제 */
.q-meta { display: flex; gap: 0.35rem; flex-wrap: wrap; margin-bottom: 0.45rem; }
.q-prompt { font-size: 1.08rem; font-weight: 600; margin: 0.2rem 0 0.8rem; word-break: keep-all; }
.choices { display: grid; gap: 0.5rem; }
.choices button { text-align: left; border: 1px solid var(--line); background: var(--panel); border-radius: 12px; padding: 0.7rem 0.85rem; cursor: pointer; min-height: 48px; }
.choices button:hover { border-color: var(--primary); }
.choices button.picked-wrong { border-color: var(--bad); background: var(--bad-soft); }
.choices button.is-answer { border-color: var(--ok); background: var(--ok-soft); }
.answer-row { display: flex; gap: 0.5rem; }
.answer-row input { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 12px; padding: 0.65rem 0.8rem; font-size: 1.05rem; }
.keypad { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.45rem; }
.keypad button { min-width: 44px; min-height: 44px; border: 1px solid var(--line); border-radius: 10px; background: #f8fafc; cursor: pointer; font-size: 1rem; }
.hintbox { background: var(--accent-soft); border-radius: 12px; padding: 0.6rem 0.8rem; margin-top: 0.55rem; }
.feedback { border-radius: 12px; padding: 0.7rem 0.85rem; margin-top: 0.7rem; font-weight: 600; }
.feedback.ok { background: var(--ok-soft); color: var(--ok); }
.feedback.bad { background: var(--bad-soft); color: var(--bad); }
.feedback.info { background: var(--info-soft); color: #075985; }
.explain { background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 12px; padding: 0.7rem 0.85rem; margin-top: 0.6rem; }
/* 듣기 문항: 답한 뒤 보여 주는 대본, 듣기 버튼 줄 */
.explain.script { background: #f0f9ff; border-color: #bae6fd; }
.explain.script div { margin-top: 0.25rem; }
.listen { align-items: center; gap: 0.5rem; flex-wrap: wrap; }

/* 카드 */
.flash { min-height: 180px; display: flex; flex-direction: column; justify-content: center; font-size: 1.12rem; text-align: center; padding: 1.4rem 1rem; }
.flash .back { margin-top: 0.9rem; padding-top: 0.9rem; border-top: 1px dashed var(--line); font-size: 0.98rem; color: #334155; }
.cloze { color: var(--accent); font-weight: 700; }
mark.cloze-answer { background: var(--primary-soft); color: var(--primary); font-weight: 700; padding: 0 0.2rem; border-radius: 4px; }
.rates { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.4rem; margin-top: 0.8rem; }
.rates button { border: 0; border-radius: 12px; padding: 0.55rem 0.2rem; cursor: pointer; font-weight: 700; color: #fff; min-height: 56px; }
.rates button small { display: block; font-weight: 500; opacity: 1; font-size: 0.8rem; }
.r1 { background: #dc2626; } .r2 { background: #b45309; } .r3 { background: #0f766e; } .r4 { background: #2563eb; }

/* 논술 */
/* 논술 단계 5개: 휴대폰 폭에서도 옆으로 밀리지 않게 다섯 칸으로 나누고 낱말 단위로 줄을 바꾼다(2026-11-28 UI 점검) */
.steps { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0.3rem; margin: 0.5rem 0 0.8rem; }
.steps button { min-height: 44px; border: 1px solid var(--line); background: var(--panel); border-radius: 10px; padding: 0.35rem 0.1rem; font-size: 0.78rem; line-height: 1.25; cursor: pointer; word-break: keep-all; overflow-wrap: anywhere; }
.steps button.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.steps button.done { border-color: var(--ok); color: var(--ok); }
textarea { width: 100%; min-height: 9rem; border: 1px solid var(--line); border-radius: 12px; padding: 0.7rem 0.8rem; resize: vertical; line-height: 1.7; }
input[type='text'], input[type='email'], input[type='number'], input[type='date'], input[type='password'], select { border: 1px solid var(--line); border-radius: 10px; padding: 0.55rem 0.7rem; background: var(--panel); min-height: 44px; }
label.field { display: block; margin: 0.55rem 0; }
label.field > span { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 0.2rem; }
label.field input, label.field select, label.field textarea { width: 100%; }
.counter { font-size: 0.85rem; color: var(--muted); }
.counter.ok { color: var(--ok); font-weight: 700; }
.rubric-row { padding: 0.55rem 0; border-bottom: 1px solid var(--line); }
.levels { display: flex; gap: 0.35rem; margin-top: 0.35rem; }
.levels button { flex: 1; min-height: 44px; border: 1px solid var(--line); background: var(--panel); border-radius: 10px; padding: 0.45rem 0.2rem; cursor: pointer; font-size: 0.85rem; }
.levels button.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.essay-text { white-space: pre-wrap; background: #f8fafc; border-radius: 12px; padding: 0.75rem 0.85rem; border: 1px solid var(--line); }
.sidebyside { display: grid; grid-template-columns: 1fr; gap: 0.6rem; }
@media (min-width: 700px) { .sidebyside { grid-template-columns: 1fr 1fr; } }

/* 표·그래프 */
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table-wrap { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
/* 옆으로 밀어도 첫 열(단원·과목·영역 이름)은 보이게 고정한다(2026-11-29 검토) */
.table-wrap th:first-child, .table-wrap td:first-child { position: sticky; left: 0; z-index: 1; background: var(--panel); }
th, td { text-align: left; padding: 0.45rem 0.35rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; white-space: nowrap; } /* 머리글은 한 줄로(넓으면 표 안에서 옆으로, 2026-11-29) */
.bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 0.4rem; align-items: end; height: 150px; padding-top: 0.4rem; }
.bars .col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
/* 막대 칸: 위에 막대 위 숫자(분) 자리를 둔다. 달성한 날은 날짜 아래 ✓(2026-11-29 검토) */
.bars .track { flex: 1; min-height: 0; width: 100%; display: flex; align-items: flex-end; justify-content: center; padding-top: 1.1rem; }
.bars .fill { position: relative; width: 70%; background: #cbd5e1; border-radius: 6px 6px 0 0; min-height: 2px; }
.bars .fill.met { background: var(--primary); }
.bars .val { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); padding-bottom: 0.1rem; font-size: 0.72rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.bars .lbl { font-size: 0.72rem; color: var(--muted); margin-top: 0.2rem; text-align: center; white-space: nowrap; }
.bars .lbl .mark { display: block; height: 1.1em; line-height: 1.1em; color: var(--primary); font-weight: 800; }
.big { font-size: 1.6rem; font-weight: 800; }

/* 알림 */
.toasts { position: fixed; left: 50%; bottom: 5.2rem; transform: translateX(-50%); z-index: 30; display: flex; flex-direction: column; gap: 0.4rem; width: min(92vw, 420px); pointer-events: none; }
.toast { background: #1e293b; color: #fff; padding: 0.65rem 0.9rem; border-radius: 12px; box-shadow: var(--shadow); font-size: 0.92rem; animation: pop 0.2s ease-out; }
.toast-ok { background: var(--ok); }
.toast-star { background: var(--accent); }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* 부모 모드 */
.parent-banner { background: #1e293b; color: #fff; }
.parent-banner .brand { color: #fff; }
.qpreview { border: 1px solid var(--line); border-radius: 12px; padding: 0.7rem; margin: 0.5rem 0; }
.qpreview.approved { border-color: #86efac; }
.qpreview.hidden { opacity: 0.55; }
details > summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; }
.center { text-align: center; }
.mt { margin-top: 0.8rem; }

/* 2차 개선(제미나이 UI/UX 검토 반영) */
:focus-visible { outline: 3px solid #0f766e; outline-offset: 2px; }
/* 어두운 부모 모드 위쪽 막대에서는 밝은 테두리로(키보드로 옮겨 다닐 때 보이게, 2026-11-29 점검) */
.parent-banner :focus-visible { outline-color: #5eead4; }
button.chip, label.chip { min-height: 44px; display: inline-flex; align-items: center; gap: 0.3rem; }
.kw { margin: 0.15rem; }
@media (max-width: 420px) { .rates { grid-template-columns: repeat(2, 1fr); gap: 0.5rem; } }
.flash.tappable { cursor: pointer; }
.panel.celebrate { background: #dcfce7; border-color: transparent; }
.panel.celebrate .big { color: var(--ok); }
.reward-line { margin-top: 0.7rem; }
.bar > span { transition: width 0.35s ease; }
.step-actions { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-top: 0.9rem; flex-wrap: wrap; }
.saved { font-size: 0.82rem; color: var(--ok); }
.saved.warn { color: var(--bad, #b91c1c); font-weight: 700; }
.tabs .count { display: inline-block; margin-left: 0.3rem; min-width: 1.3rem; padding: 0 0.35rem; border-radius: 999px; background: var(--accent); color: #fff; font-size: 0.72rem; line-height: 1.3rem; }
.tabs button.on .count { background: #fff; color: var(--text); }
/* 과목 학습(2026-11-27 UI 점검): 접어 둔 준비 중 단원. 과목 칩의 '열린 단원/전체'는 점수처럼 읽혀 뺐다(2026-11-29 검토) */
/* 과목 칩은 가려지지 않게: 여백을 조금 줄이고, 좁은 화면에서는 가로로 숨기지 않고 다음 줄로 내린다 */
.tabs.subject-tabs, .tabs.parent-tabs { flex-wrap: wrap; overflow: visible; }
.tabs.subject-tabs button, .tabs.parent-tabs button { padding: 0.45rem 0.7rem; }
.locked-units > summary { color: var(--muted); font-size: 0.92rem; }
.locked-units .list li { min-height: 40px; }
/* 단원 화면(2026-11-27 UI 점검): 고를 수 없는 난이도, 다음에 배울 개념, 접어 둔 숙달 기준 */
.chip:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.two-line { flex-direction: column; gap: 0.1rem; }
.btn.two-line .btn-sub { font-size: 0.85rem; font-weight: 500; opacity: 0.9; }
.list > li.is-next { box-shadow: inset 3px 0 0 var(--primary); padding-left: 0.6rem; }
.next-tag { color: var(--primary); font-weight: 700; white-space: nowrap; }
.rule-note { margin-top: 0.4rem; }
.rule-note > summary { color: var(--muted); font-size: 0.92rem; }
/* 부모 화면(2026-11-27 UI 점검): 설정 바로가기, 손가락으로 누르기 쉬운 체크 줄 */
.jump-row { margin-top: 0.4rem; }
#set-sem, #set-load, #set-pin, #set-sound, #set-sync, #set-device, #rev-questions, #rev-deck, #rev-concepts, #rev-speaking { scroll-margin-top: 4.2rem; }
/* 부모 설정: 바꾸고 저장하지 않은 카드는 저장 버튼이 주 버튼이 되고(main.js markDirty) '저장 안 됨'이 붙는다(2026-11-29 검토) */
form.dirty button[type='submit']::after { content: ' · 저장 안 됨'; }
.check-row { display: flex; align-items: center; gap: 0.55rem; min-height: 44px; cursor: pointer; }
.check-row input[type='checkbox'] { width: 1.25rem; height: 1.25rem; flex: 0 0 auto; }
/* 필기 연습장(2026-11-27): 모눈 바탕 위에 손가락·펜으로 쓴다. 그 안에서는 화면이 밀리지 않는다. */
.scratch-bar { margin-bottom: 0.4rem; }
.scratch-tools { gap: 0.3rem; }
.scratch-canvas { display: block; width: 100%; height: 300px; border: 1px solid var(--line); border-radius: 12px; background-color: #fff; background-image: linear-gradient(#e8edf3 1px, transparent 1px), linear-gradient(90deg, #e8edf3 1px, transparent 1px); background-size: 24px 24px; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; cursor: crosshair; }
@media (min-width: 700px) { .scratch-canvas { height: 440px; } }
/* 암기 카드(2026-11-27 UI 점검): 빈 화면의 카드 모으는 방법, 접어 둔 빈칸 만들기 */
.how-cards li p { margin: 0.2rem 0 0.4rem; }
.cloze-help { margin: 0.2rem 0 0.6rem; }
.cloze-help > summary { color: var(--muted); font-size: 0.92rem; }
.cloze-help .btn { margin-top: 0.3rem; }
/* 말하기(2026-11-27 UI 점검): 녹음 중 표시 */
.rec-live .rec-dot { color: var(--bad); }
.rec-live b { font-variant-numeric: tabular-nums; }
/* 리포트(2026-11-27 UI 점검): 다시 볼 오답은 단원 이름 + 문제 문장 두 줄 */
.wrong-row { flex-wrap: nowrap; }
.wrong-row .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.15rem; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 0.95rem; word-break: keep-all; }
.undo-bar { display: flex; justify-content: center; margin-top: 0.6rem; }
/* 위쪽 '별': 누를 수 있게 보이는 알약 모양(누르는 칸은 44px 그대로, 2026-11-29 검토) */
.topbar .starbtn { display: inline-flex; align-items: center; border: 0; background: none; cursor: pointer; padding: 0.35rem 0; min-height: 44px; font-size: 0.85rem; color: var(--text); }
.topbar .starbtn .pill { display: inline-flex; align-items: center; gap: 0.2rem; padding: 0.25rem 0.65rem; border: 1px solid #fcd34d; background: #fffbeb; border-radius: 999px; font-weight: 600; white-space: nowrap; }
.topbar .starbtn b { color: var(--text); }
.topbar .starbtn:active .pill { background: #fef3c7; }
@media (hover: hover) { .topbar .starbtn:hover .pill { background: #fef3c7; } }
/* 동기화 문제 표시(문제가 있을 때만, 3단계) */
#sync-chip:empty { display: none; }
/* 화면 안에서 옮겨 보여 줄 곳은 위쪽 막대에 가리지 않게(2026-11-28 점검) */
#photo-self, #app .feedback { scroll-margin-top: 4.5rem; scroll-margin-bottom: 5rem; }
/* 누름·마우스 반응(2026-11-29 디자인 점검): 터치로 누르면 바로 눌린 모양이 보이게(기본 회색 번쩍임 대신),
   마우스를 올리면 살짝 바뀌게(노트북). 움직임 줄이기 설정이면 움직이지 않는다. */
button, .btn, a, summary { -webkit-tap-highlight-color: transparent; }
.btn, .chip, .tabs button, .unit-row, .bottomnav button, .choices button, .choice-nums button, .rates button, .steps button { transition: background-color 0.12s ease, border-color 0.12s ease, transform 0.08s ease; }
.btn:active:not(:disabled), .chip:active, .tabs button:active, .choices button:active:not(:disabled), .choice-nums button:active:not(:disabled), .rates button:active, .steps button:active { transform: scale(0.97); }
.unit-row:active, .bottomnav button:active { background: #f1f5f9; }
@media (hover: hover) {
  .btn.primary:hover:not(:disabled) { background: #0d5f59; border-color: #0d5f59; }
  .btn:not(.primary):not(.accent):hover:not(:disabled) { background: #f8fafc; }
  .chip:not(.on):not(.used):hover, .tabs button:not(.on):hover { background: #f8fafc; border-color: #cbd5e1; }
  .unit-row:hover { background: #f8fafc; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .btn:active, .chip:active, .tabs button:active, .choices button:active, .choice-nums button:active, .rates button:active, .steps button:active { transform: none; }
}
/* 노트북·가로 태블릿: 부모 화면은 넓게(검수 목록·표·7일 막대를 한눈에), 아이 화면은 읽기 좋은 폭 그대로 */
@media (min-width: 1000px) {
  body.mode-parent .container, body.mode-parent .topbar-inner { max-width: 980px; }
}
/* 다른 탭에서 앱을 열어 이 탭을 멈췄을 때(2026-11-28 점검) */
.frozen { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 1rem; background: rgba(15, 23, 42, 0.55); }
.frozen .panel { width: 100%; max-width: 420px; }
/* 안드로이드: 당겨서 새로 고침으로 풀던 화면이 날아가지 않게, 버튼을 길게 눌러도 글자가 선택되지 않게 */
html, body { overscroll-behavior-y: contain; }
button, .btn, .chip, .bottomnav { -webkit-user-select: none; user-select: none; }
/* 터치 화면에서 글을 쓰는 동안에는 아래 메뉴를 숨겨 쓰는 칸을 넓힌다(화면 키보드가 올라와도 가리지 않게) */
@media (pointer: coarse) {
  body.typing .bottomnav { display: none; }
}
/* 새 버전 알림: 아래 메뉴 바로 위(2026-11-28 점검) */
.update-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(4.6rem + env(safe-area-inset-bottom)); z-index: 30; display: flex; align-items: center; gap: 0.6rem; max-width: calc(100% - 1.5rem); padding: 0.5rem 0.6rem 0.5rem 0.9rem; background: var(--text); color: #fff; border-radius: 12px; box-shadow: var(--shadow); font-size: 0.9rem; }
.photo-wait { display: inline-block; padding: 0.7rem 0.9rem; background: #f1f5f9; border-radius: 10px; }
.sync-chip { border: 1px solid #f59e0b; background: #fffbeb; color: #92400e; border-radius: 999px; padding: 0.2rem 0.65rem; min-height: 44px; font-size: 0.8rem; font-weight: 700; cursor: pointer; white-space: nowrap; }
/* 16px 아래면 아이폰·아이패드가 글상자를 누를 때 화면을 확대한다(2026-11-28 UI 점검) */
#sync-conn, textarea[name=conn] { min-height: 3.6rem; font-family: ui-monospace, monospace; font-size: 1rem; line-height: 1.5; }

/* 맞춤 학습 */
.step-note { margin: 0.7rem 0 0; padding: 0.7rem 0.85rem; }

/* 풀이 화면(2026-11-27 UI 점검): 답한 뒤 버튼 줄은 해설이 길어도 화면 아래에 붙어 보이고, 쓴 힌트는 접는다 */
.next-bar { position: sticky; bottom: 0; z-index: 5; margin: 0.8rem -0.95rem -0.95rem; padding: 0.65rem 0.95rem calc(0.65rem + env(safe-area-inset-bottom)); background: var(--panel); border-top: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius); }
.next-bar .btn.primary { flex: 1 1 7rem; }
.hints-used { margin-top: 0.55rem; }
/* 답한 뒤 결과 안의 '내 답'(꺼진 답 칸 대신, 2026-11-29 검토) */
.feedback .my-answer { margin-top: 0.3rem; font-weight: 500; color: var(--text); }
/* 홈: 진행 막대 바로 아래 목표 조건 */
.goal-rule { margin: 0.4rem 0 0; }
/* 리포트 단원별 마스터리: 2줄 목록(단원·단계 / 평균·푼 문제) */
.mastery-list .row.spread { flex-wrap: nowrap; align-items: flex-start; }
.mastery-list .row.spread b { min-width: 0; }
/* 사진 문제 스스로 채점: 두 답을 같은 무게로 */
.self-grade .btn { flex: 1 1 0; }
.hints-used > summary { color: var(--muted); font-size: 0.92rem; }
.q-ask { margin: 0.2rem 0 0.35rem; color: var(--muted); font-size: 0.95rem; font-weight: 600; word-break: keep-all; }
.q-prompt.long { font-weight: 500; line-height: 1.65; }
.concept-card { font-size: 1.02rem; line-height: 1.75; }

/* 사진 문제 */
.photo-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 12px; background: #fff; cursor: zoom-in; -webkit-overflow-scrolling: touch; }
.photo-wrap .photo-q { display: block; width: 100%; height: auto; }
.photo-wrap.zoom { cursor: zoom-out; max-height: 80vh; }
.photo-wrap.zoom .photo-q { width: auto; max-width: none; }
.photo-drop { min-height: 120px; border: 2px dashed #cbd5e1; border-radius: 12px; display: flex; align-items: center; justify-content: center; overflow: hidden; background: #f8fafc; }
.photo-drop .photo-q { display: block; width: 100%; height: auto; }
.sol-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 0.5rem; }
.sol-grid .sol { margin: 0; border: 1px solid var(--line); border-radius: 10px; padding: 0.35rem; background: #fff; }
.sol-grid .photo-sol { display: block; width: 100%; height: 110px; object-fit: cover; border-radius: 6px; }
.thumb { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); flex: 0 0 auto; background: #f1f5f9; }
.pp-row { display: flex; gap: 0.6rem; align-items: center; }
.pp-row .grow { flex: 1; min-width: 0; }
.answer-type { border: 1px solid var(--line); border-radius: 12px; padding: 0.4rem 0.75rem 0.6rem; }
.answer-type legend { font-size: 0.85rem; color: var(--muted); padding: 0 0.3rem; }
.answer-type .opt { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; min-height: 44px; margin: 0.2rem 0; }
.answer-type .opt input[type='text'] { flex: 1; min-width: 8rem; }
.field > .label { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 0.2rem; }
.choice-nums { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.45rem; margin-top: 0.7rem; }
.choice-nums button { min-height: 52px; border: 1px solid var(--line); background: var(--panel); border-radius: 12px; font-size: 1.35rem; cursor: pointer; }
.choice-nums button:hover:not(:disabled) { border-color: var(--primary); }
.choice-nums button.picked-wrong { border-color: var(--bad); background: var(--bad-soft); }
.choice-nums button.is-answer { border-color: var(--ok); background: var(--ok-soft); }
.photo-wrap + .small, .answer-row { margin-top: 0.5rem; }
/* 보기가 ①~④뿐인 문항: 앞번호 없이(검수함 목록) */
ol.plain { list-style: none; padding-left: 0; }
