/* 공인중개사 37회 응축학습 — app.css */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --text: #15171c;
  --text-2: #3d424d;
  --muted: #737a87;
  --line: #e4e7ec;
  --line-2: #d3d8e0;
  --accent: #2c55e0;
  --accent-soft: #eaf0ff;
  --accent-ink: #1d3fb3;
  --ok: #10915a;
  --ok-soft: #e4f6ed;
  --bad: #d93a3f;
  --bad-soft: #fdeced;
  --warn: #b45309;
  --warn-soft: #fff5e1;
  --hl: #fff0a6;
  --star: #f2a900;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 20px 50px rgba(16, 24, 40, .18);
  --radius: 14px;
  --radius-sm: 10px;
  --s1: #2f6fed; --s2: #7a4de0; --s3: #0e9486; --s4: #e0620d; --s5: #c7336a; --s6: #a07c00;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1115; --surface: #171a20; --surface-2: #1e222a; --text: #eceef2; --text-2: #c4c9d3;
    --muted: #8b93a1; --line: #262b34; --line-2: #333a45; --accent: #6e8fff; --accent-soft: #1c2645;
    --accent-ink: #a9bcff; --ok: #3ccf8e; --ok-soft: #112a20; --bad: #ff6b6f; --bad-soft: #33171a;
    --warn: #f0b35a; --warn-soft: #2e2413; --hl: #5b4d0f; --shadow: 0 1px 2px rgba(0,0,0,.3);
    --shadow-lg: 0 20px 50px rgba(0,0,0,.55); color-scheme: dark;
    --s1: #6b9bff; --s2: #a88bff; --s3: #3cc5b5; --s4: #ff9150; --s5: #f06d9d; --s6: #e0b93a;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1115; --surface: #171a20; --surface-2: #1e222a; --text: #eceef2; --text-2: #c4c9d3;
  --muted: #8b93a1; --line: #262b34; --line-2: #333a45; --accent: #6e8fff; --accent-soft: #1c2645;
  --accent-ink: #a9bcff; --ok: #3ccf8e; --ok-soft: #112a20; --bad: #ff6b6f; --bad-soft: #33171a;
  --warn: #f0b35a; --warn-soft: #2e2413; --hl: #5b4d0f; --shadow: 0 1px 2px rgba(0,0,0,.3);
  --shadow-lg: 0 20px 50px rgba(0,0,0,.55); color-scheme: dark;
  --s1: #6b9bff; --s2: #a88bff; --s3: #3cc5b5; --s4: #ff9150; --s5: #f06d9d; --s6: #e0b93a;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  font-size: 15.5px; line-height: 1.65; letter-spacing: -0.01em; word-break: keep-all; overflow-wrap: anywhere;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
input, select { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -0.025em; line-height: 1.35; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: 256px 1fr; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; border-right: 1px solid var(--line);
  background: var(--surface); padding: 22px 16px 24px; display: flex; flex-direction: column; gap: 18px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; background: var(--text); color: var(--bg);
  display: grid; place-items: center; font-weight: 800; font-size: 13px; letter-spacing: -0.04em;
}
.brand b { display: block; font-size: 15px; }
.brand small { display: block; color: var(--muted); font-size: 12px; margin-top: -2px; }
/* 나도스터디 로고 */
.brand { flex-direction: column; align-items: center; gap: 6px; padding: 4px 0 0 !important; }
.brand img { width: 100%; max-width: 176px; height: auto; display: block; }
.brand .brand-sub { margin: 2px 0 0; text-align: center; }
.topbar .m-brand img { height: 36px; width: auto; display: block; }
.lg-dark { display: none !important; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .lg-light { display: none !important; }
  :root:not([data-theme="light"]) .lg-dark { display: block !important; }
}
:root[data-theme="dark"] .lg-light { display: none !important; }
:root[data-theme="dark"] .lg-dark { display: block !important; }
.dday-mini { margin: 0 6px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); }
.dday-mini .d { font-size: 22px; font-weight: 800; letter-spacing: -0.03em; }
.dday-mini .t { font-size: 12px; color: var(--muted); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 11.5px; font-weight: 700; color: var(--muted); padding: 8px 10px 4px; letter-spacing: .02em; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; color: var(--text-2);
  font-size: 14.5px; font-weight: 500;
}
.nav a:hover { background: var(--surface-2); }
.nav a.on { background: var(--accent-soft); color: var(--accent-ink); font-weight: 700; }
.nav a .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.nav a .pct { margin-left: auto; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.nav svg { width: 18px; height: 18px; flex: none; }

.main { min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: 12px 28px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid transparent;
}
.topbar.scrolled { border-bottom-color: var(--line); }
.topbar .m-brand { display: none; font-weight: 800; font-size: 15px; }
.search {
  flex: 1; max-width: 420px; display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px;
  border: 1px solid var(--line); background: var(--surface); border-radius: 10px;
}
.search svg { width: 16px; height: 16px; color: var(--muted); flex: none; }
.search input { border: 0; outline: 0; background: none; width: 100%; font-size: 14px; }
.topbar .spacer { flex: 1; }
.timer-pill {
  display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 13px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); font-size: 13.5px; font-weight: 600;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.timer-pill.run { border-color: var(--accent); color: var(--accent-ink); background: var(--accent-soft); }
.timer-pill.quiz { border-color: var(--warn); color: var(--warn); background: var(--warn-soft); }
.timer-pill svg { width: 16px; height: 16px; }
.icon-btn { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 20px; height: 20px; }
.m-only { display: none !important; }

.view { max-width: 880px; margin: 0 auto; padding: 18px 28px 80px; }
.tabbar { display: none; }

/* ---------- common ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.pad { padding: 20px 22px; }
.stack > * + * { margin-top: 14px; }
.section { margin-top: 30px; }
.section-h { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.section-h h2 { font-size: 18px; }
.section-h .sub { font-size: 13px; color: var(--muted); }
.crumb { font-size: 13px; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.crumb a:hover { color: var(--text); }
.page-h { margin: 6px 0 16px; }
.page-h h1 { font-size: 26px; font-weight: 800; }
.page-h p { margin: 6px 0 0; color: var(--muted); font-size: 14.5px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.grow { flex: 1; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px;
  border-radius: 9px; border: 1px solid var(--line-2); background: var(--surface); font-size: 14px; font-weight: 600;
  white-space: nowrap; transition: background .12s, border-color .12s, transform .06s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.98); }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.dark { background: var(--text); border-color: var(--text); color: var(--bg); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.lg { height: 46px; padding: 0 20px; font-size: 15px; border-radius: 11px; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn.study { color: var(--accent-ink); border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); background: var(--accent-soft); }
.btn.explain { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, var(--line)); background: var(--ok-soft); }
.btn.block { width: 100%; }

.chip {
  display: inline-flex; align-items: center; gap: 5px; height: 32px; padding: 0 13px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); font-size: 13.5px; font-weight: 600; color: var(--text-2);
}
.chip.on { background: var(--text); border-color: var(--text); color: var(--bg); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.tag {
  display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px;
  font-weight: 700; background: var(--surface-2); color: var(--text-2); white-space: nowrap;
}
.stars { color: var(--star); letter-spacing: -1px; font-size: 13px; white-space: nowrap; }
.stars i { color: var(--line-2); font-style: normal; }

.bar { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 99px; background: var(--accent); transition: width .4s; }
.bar.ok > span { background: var(--ok); }

/* ---------- home ---------- */
.hero {
  display: grid; grid-template-columns: 1.1fr 1fr; gap: 0; overflow: hidden;
}
.hero-l { padding: 24px 24px 22px; border-right: 1px solid var(--line); }
.hero-l .k { font-size: 13px; color: var(--muted); font-weight: 600; }
.hero-l .d { font-size: 46px; font-weight: 850; letter-spacing: -0.045em; line-height: 1.1; margin-top: 4px; }
.hero-l .date { color: var(--text-2); font-size: 14px; margin-top: 6px; }
.hero-r { padding: 22px 24px; display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; align-content: center; }
.stat .v { font-size: 22px; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.stat .l { font-size: 12.5px; color: var(--muted); }
.heat { display: flex; gap: 4px; margin-top: 16px; align-items: flex-end; height: 34px; }
.heat span { flex: 1; border-radius: 3px; background: var(--surface-2); min-height: 4px; }
.heat span.on { background: var(--accent); }
.heat-l { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 4px; }

.plan { display: flex; flex-direction: column; }
.plan-row {
  display: flex; align-items: center; gap: 12px; padding: 13px 18px; border-top: 1px solid var(--line);
}
.plan-row:first-child { border-top: 0; }
.plan-row:hover { background: var(--surface-2); }
.plan-row .n { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-size: 12.5px; font-weight: 800; color: #fff; flex: none; }
.plan-row .t { font-weight: 650; font-size: 14.5px; }
.plan-row .s { font-size: 12.5px; color: var(--muted); }
.plan-row .go { margin-left: auto; color: var(--muted); flex: none; }

.subj-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.subj-card { padding: 16px 16px 14px; display: flex; flex-direction: column; gap: 10px; position: relative; overflow: hidden; transition: border-color .15s, transform .15s; }
.subj-card:hover { border-color: var(--line-2); transform: translateY(-1px); }
.subj-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--c); }
.subj-card .exam { font-size: 12px; color: var(--muted); font-weight: 600; }
.subj-card h3 { font-size: 16px; }
.subj-card .meta { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.subj-card .bar > span { background: var(--c); }

.quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.quick a { padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.quick a:hover { border-color: var(--line-2); }
.quick .ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; margin-bottom: 6px; }
.quick .ic svg { width: 19px; height: 19px; }
.quick b { font-size: 15px; }
.quick span { font-size: 12.5px; color: var(--muted); }

/* ---------- subject / type ---------- */
.subj-head { padding: 22px 22px 18px; border-top: 4px solid var(--c); }
.subj-head .row { margin-top: 12px; }
.part-h { font-size: 13px; font-weight: 800; color: var(--muted); margin: 24px 4px 8px; letter-spacing: .01em; }
.type-list { overflow: hidden; }
.type-row { display: flex; align-items: center; gap: 14px; padding: 15px 18px; border-top: 1px solid var(--line); }
.type-row:first-child { border-top: 0; }
.type-row:hover { background: var(--surface-2); }
.type-row .no { font-size: 12.5px; font-weight: 800; color: var(--muted); width: 26px; flex: none; font-variant-numeric: tabular-nums; }
.type-row .body { flex: 1; min-width: 0; }
.type-row .ttl { font-weight: 700; font-size: 15px; }
.type-row .trend { font-size: 13px; color: var(--muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.type-row .prog { width: 92px; flex: none; text-align: right; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.type-row .prog .bar { margin-top: 5px; }
.type-row .done { color: var(--ok); font-weight: 700; }

.type-head { padding: 20px 22px; }
.type-head h1 { font-size: 23px; font-weight: 800; margin-top: 6px; }
.type-head .trend { margin-top: 8px; color: var(--text-2); font-size: 14.5px; }
.type-head .row { margin-top: 14px; }

/* ---------- question card ---------- */
.qcard { padding: 20px 22px 18px; scroll-margin-top: 80px; }
.qcard + .qcard { margin-top: 14px; }
.qtop { display: flex; align-items: flex-start; gap: 12px; }
.qno {
  flex: none; min-width: 34px; height: 26px; padding: 0 8px; border-radius: 8px; background: var(--text); color: var(--bg);
  display: grid; place-items: center; font-weight: 800; font-size: 13px; margin-top: 1px;
}
.qstem { flex: 1; min-width: 0; font-weight: 650; font-size: 16px; line-height: 1.6; }
.qside { flex: none; display: flex; gap: 6px; align-items: center; }
.qmeta { font-size: 12.5px; color: var(--muted); margin: 0 0 8px 46px; }
.qmeta a:hover { color: var(--text); text-decoration: underline; }
.bm { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; color: var(--muted); }
.bm:hover { background: var(--surface-2); }
.bm.on { color: var(--star); }
.bm svg { width: 18px; height: 18px; }
.opts { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.opt {
  width: 100%; text-align: left; display: flex; gap: 10px; padding: 11px 14px; border-radius: 11px;
  border: 1px solid var(--line); background: var(--surface); font-size: 15px; line-height: 1.55;
  transition: border-color .12s, background .12s;
}
.opt:hover { border-color: var(--line-2); background: var(--surface-2); }
.opt .on { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--line-2); display: grid; place-items: center; font-size: 12px; font-weight: 800; color: var(--muted); margin-top: 1px; }
.opt.right { border-color: var(--ok); background: var(--ok-soft); }
.opt.right .on { background: var(--ok); border-color: var(--ok); color: #fff; }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); }
.opt.wrong .on { background: var(--bad); border-color: var(--bad); color: #fff; }
.opts.locked .opt { cursor: default; }
.opts.locked .opt:not(.right):not(.wrong) { opacity: .62; }
.qfoot { display: flex; align-items: center; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.qresult { font-size: 13.5px; font-weight: 700; }
.qresult.ok { color: var(--ok); }
.qresult.bad { color: var(--bad); }
.qhist { font-size: 12px; color: var(--muted); margin-left: auto; }

/* rich content inside data */
.rich { font-size: 15px; line-height: 1.75; color: var(--text); }
.rich > :first-child { margin-top: 0; }
.rich h4 { font-size: 15.5px; margin: 20px 0 8px; padding-left: 10px; border-left: 3px solid var(--accent); }
.rich p { margin: 8px 0; }
.rich ul, .rich ol { margin: 8px 0; padding-left: 20px; }
.rich li { margin: 3px 0; }
.rich li::marker { color: var(--muted); }
.rich table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 14px; display: block; overflow-x: auto; }
.rich th, .rich td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; min-width: 70px; }
.rich th { background: var(--surface-2); font-weight: 700; white-space: nowrap; }
.hl { background: linear-gradient(transparent 55%, var(--hl) 55%); font-weight: 700; padding: 0 1px; }
.box { margin: 12px 0; padding: 12px 14px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); font-weight: 500; font-size: 14.5px; line-height: 1.75; }
.qstem .box { margin-top: 10px; font-weight: 500; }
.tip { margin: 12px 0; padding: 11px 14px 11px 40px; border-radius: 10px; background: var(--accent-soft); color: var(--text); position: relative; font-size: 14.5px; }
.tip::before { content: "💡"; position: absolute; left: 13px; top: 10px; }
.warn { margin: 12px 0; padding: 11px 14px 11px 40px; border-radius: 10px; background: var(--warn-soft); color: var(--text); position: relative; font-size: 14px; }
.warn::before { content: "⚠️"; position: absolute; left: 13px; top: 10px; }

/* ---------- modal (popup) ---------- */
.modal-wrap { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px; }
.modal-bg { position: absolute; inset: 0; background: rgba(10, 12, 16, .5); animation: fade .18s ease; }
.modal {
  position: relative; width: min(760px, 100%); max-height: min(86vh, 900px); display: flex; flex-direction: column;
  background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); animation: pop .2s cubic-bezier(.2, .9, .3, 1.1);
  overflow: hidden;
}
.modal-h { display: flex; align-items: flex-start; gap: 12px; padding: 18px 20px 14px; border-bottom: 1px solid var(--line); }
.modal-h .ttl { flex: 1; min-width: 0; }
.modal-h .kind { font-size: 12px; font-weight: 800; letter-spacing: .03em; }
.modal-h .kind.study { color: var(--accent); }
.modal-h .kind.explain { color: var(--ok); }
.modal-h .kind.theory { color: var(--s4); }
.modal-h h3 { font-size: 17px; margin-top: 2px; }
.modal-b { padding: 18px 22px 26px; overflow-y: auto; overscroll-behavior: contain; }
.modal-f { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.ans-badge svg { width: 18px; height: 18px; flex: none; }
.ans-badge { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 10px; background: var(--ok-soft); color: var(--ok); font-weight: 800; margin-bottom: 12px; }
.rich .why, .why { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-direction: column; gap: 8px; }
.why li { padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); font-size: 14.5px; }
.why li.c { border-color: color-mix(in srgb, var(--ok) 50%, var(--line)); background: var(--ok-soft); }
.why li .o { font-size: 12.5px; color: var(--muted); display: block; margin-bottom: 2px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.98); } }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 200; background: var(--text); color: var(--bg);
  padding: 11px 18px; border-radius: 12px; font-size: 14px; font-weight: 600; box-shadow: var(--shadow-lg); animation: pop .2s;
  display: flex; gap: 12px; align-items: center; max-width: calc(100vw - 32px);
}
.toast button { color: var(--hl); font-weight: 800; }

/* ---------- quiz ---------- */
.q-setup .opt-group { margin-top: 18px; }
.q-setup .opt-group > label { display: block; font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 8px; }
.modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.mode { text-align: left; padding: 15px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); }
.mode b { display: block; font-size: 15px; }
.mode span { font-size: 12.5px; color: var(--muted); }
.mode.on { border-color: var(--accent); background: var(--accent-soft); }
.mode .em { font-size: 22px; display: block; margin-bottom: 4px; }

.play { max-width: 720px; margin: 0 auto; }
.play-top { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; font-variant-numeric: tabular-nums; }
.play-top .idx { font-weight: 800; }
.play-top .score { margin-left: auto; font-weight: 800; font-size: 18px; }
.combo { font-weight: 800; color: var(--s4); font-size: 14px; }
.tbar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-bottom: 16px; }
.tbar > span { display: block; height: 100%; background: var(--accent); width: 100%; }
.tbar.low > span { background: var(--bad); }
.ox-stmt { font-size: 19px; font-weight: 700; line-height: 1.6; padding: 28px 24px; text-align: center; }
.ox-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.ox-btn { height: 88px; border-radius: 16px; border: 1.5px solid var(--line); background: var(--surface); font-size: 40px; font-weight: 900; }
.ox-btn.o { color: var(--accent); }
.ox-btn.x { color: var(--bad); }
.ox-btn:hover { background: var(--surface-2); }
.ox-btn.right { background: var(--ok-soft); border-color: var(--ok); }
.ox-btn.wrong { background: var(--bad-soft); border-color: var(--bad); }
.fb { margin-top: 14px; padding: 16px 18px; border-radius: 14px; animation: pop .2s; }
.fb.ok { background: var(--ok-soft); }
.fb.bad { background: var(--bad-soft); }
.fb .h { font-weight: 800; font-size: 16px; }
.fb.ok .h { color: var(--ok); }
.fb.bad .h { color: var(--bad); }
.fb .e { margin-top: 6px; font-size: 14.5px; }
.fb .row { margin-top: 12px; }
.pts { display: inline-block; font-weight: 800; color: var(--ok); animation: pop .3s; }
.result { text-align: center; padding: 34px 24px; }
.result .big { font-size: 56px; font-weight: 900; letter-spacing: -0.04em; line-height: 1.1; }
.result .grade { font-size: 18px; font-weight: 800; margin-top: 6px; }
.result .stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 24px 0 8px; }
.result .stats div { padding: 12px 6px; border-radius: 12px; background: var(--surface-2); }
.result .stats b { display: block; font-size: 19px; }
.result .stats span { font-size: 12px; color: var(--muted); }
.newbest { display: inline-block; margin-top: 10px; padding: 4px 12px; border-radius: 99px; background: var(--hl); font-weight: 800; font-size: 13px; color: var(--text); }
.hist-row { display: flex; gap: 10px; align-items: center; padding: 11px 18px; border-top: 1px solid var(--line); font-size: 14px; font-variant-numeric: tabular-nums; }
.hist-row:first-child { border-top: 0; }
.hist-row .w { color: var(--muted); font-size: 12.5px; }
.hist-row b { margin-left: auto; }

/* ---------- settings ---------- */
.set-row { display: flex; align-items: center; gap: 14px; padding: 16px 20px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.set-row:first-child { border-top: 0; }
.set-row .l { flex: 1; min-width: 180px; }
.set-row .l b { display: block; font-size: 15px; }
.set-row .l span { font-size: 13px; color: var(--muted); }
.inp { height: 38px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 9px; background: var(--surface); min-width: 0; }
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--surface-2); gap: 2px; }
.seg button { height: 32px; padding: 0 12px; border-radius: 8px; font-size: 13.5px; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty b { display: block; color: var(--text); font-size: 16px; margin-bottom: 4px; }
.loading { display: grid; place-items: center; min-height: 60vh; color: var(--muted); }
.kbd { display: inline-block; padding: 0 5px; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px; font-size: 11.5px; font-weight: 700; }
.foot-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 22px; }
.foot-nav a { flex: 1; padding: 14px 16px; }
.foot-nav a:hover { border-color: var(--line-2); }
.foot-nav small { display: block; color: var(--muted); font-size: 12px; }
.foot-nav b { font-size: 14.5px; }
.foot-nav .nx { text-align: right; }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .subj-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side { display: none; }
  .m-only { display: inline-flex !important; }
  .d-only { display: none !important; }
  .topbar { padding: 10px 16px; gap: 8px; padding-top: calc(10px + env(safe-area-inset-top)); }
  .topbar .m-brand { display: flex; align-items: center; gap: 8px; }
  .topbar .m-brand .brand-mark { width: 28px; height: 28px; font-size: 11px; border-radius: 8px; }
  .search { display: none; }
  .search.open { display: flex; position: absolute; left: 12px; right: 12px; top: 8px; max-width: none; height: 42px; box-shadow: var(--shadow-lg); z-index: 5; }
  .view { padding: 12px 16px calc(96px + env(safe-area-inset-bottom)); }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 600; color: var(--muted); padding: 4px 0; }
  .tabbar a svg { width: 22px; height: 22px; }
  .tabbar a.on { color: var(--text); }
  .hero { grid-template-columns: 1fr; }
  .hero-l { border-right: 0; border-bottom: 1px solid var(--line); padding: 20px; }
  .hero-l .d { font-size: 40px; }
  .hero-r { padding: 18px 20px; }
  .subj-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .quick { grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
  .quick a { padding: 13px 12px; }
  .quick span { display: none; }
  .page-h h1 { font-size: 22px; }
  .pad { padding: 16px; }
  .qcard { padding: 16px 16px 14px; }
  .qtop { flex-wrap: wrap; gap: 10px; }
  .qstem { font-size: 15.5px; flex-basis: calc(100% - 50px); }
  .qside { width: 100%; justify-content: flex-end; order: 3; margin-top: -2px; }
  .qmeta { margin-left: 0; }
  .opt { padding: 10px 12px; font-size: 14.5px; }
  .modes { grid-template-columns: 1fr; }
  .mode { display: flex; align-items: center; gap: 12px; }
  .mode .em { margin: 0; }
  .type-row { padding: 13px 14px; gap: 10px; }
  .type-row .prog { width: 64px; }
  .type-row .trend { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  /* popup = bottom sheet */
  .modal-wrap { padding: 0; place-items: end stretch; }
  .modal { width: 100%; max-height: 92vh; border-radius: 18px 18px 0 0; animation: sheet .24s cubic-bezier(.2, .9, .3, 1); }
  .modal-h { padding: 16px 16px 12px; }
  .modal-h::before { content: ""; position: absolute; top: 6px; left: 50%; width: 38px; height: 4px; border-radius: 9px; background: var(--line-2); transform: translateX(-50%); }
  .modal-b { padding: 16px 16px 24px; }
  .modal-f { padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); }
  .result .stats { grid-template-columns: repeat(2, 1fr); }
  .ox-stmt { font-size: 17px; padding: 22px 16px; }
  .toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .foot-nav { flex-direction: column; }
  .foot-nav .nx { text-align: left; }
}
@media (max-width: 420px) {
  .subj-grid { grid-template-columns: 1fr; }
  .hero-r { grid-template-columns: 1fr 1fr; gap: 12px; }
}
@keyframes sheet { from { transform: translateY(40px); opacity: .4; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ================= 고양이 교수님 강의 ================= */
.lec-head h1 { font-size: 23px; font-weight: 800; margin-top: 6px; }
.view.wide { max-width: 1240px; }
.lec-stage { display: grid; grid-template-columns: 1fr 168px; gap: 14px; align-items: end; margin-top: 14px; }
.board-wrap { position: relative; }
.board {
  position: relative; border-radius: 12px; padding: 16px 18px 20px;
  background: radial-gradient(circle at 30% 20%, #2f4b3f, #22382f 60%, #1b2c25);
  border: 12px solid #8a5f36; border-radius: 16px;
  box-shadow: inset 0 0 60px rgba(0,0,0,.45), 0 10px 28px rgba(16,24,40,.22);
  min-height: 400px; overflow: hidden;
}
.board::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .09;
  background-image: radial-gradient(circle at 12% 30%, #fff 0 1px, transparent 1px), radial-gradient(circle at 70% 60%, #fff 0 1px, transparent 1px);
  background-size: 90px 70px, 120px 100px;
}
.board-inner {
  color: #f6faf4; font-size: 17px; line-height: 1.7; font-weight: 500; letter-spacing: -0.005em;
  max-height: 480px; overflow-y: auto; scrollbar-width: none;
}
.board-inner::-webkit-scrollbar { display: none; }
.bl { margin: 5px 0; text-shadow: 0 1px 2px rgba(0,0,0,.35); animation: chalkIn .45s ease both; }
@keyframes chalkIn { from { opacity: 0; clip-path: inset(0 100% 0 0); } to { opacity: 1; clip-path: inset(0 0 0 0); } }
.bl-title { font-family: Gaegu, "Nanum Pen Script", inherit; font-size: 27px; font-weight: 700; color: #ffe9a8; border-bottom: 2px dashed rgba(255,233,168,.45); padding-bottom: 8px; margin-bottom: 10px; }
.bl-head { font-family: Gaegu, "Nanum Pen Script", inherit; font-size: 23px; font-weight: 700; color: #ffe9a8; margin-top: 14px; }
.bl-point { padding-left: 10px; }
.bl-tip { color: #b9f6ca; }
.bl-warn { color: #ffd0a6; }
.bl-box { border-left: 3px solid rgba(255,255,255,.35); padding-left: 10px; color: #dfe9e2; }
.bl-end { font-family: Gaegu, "Nanum Pen Script", inherit; font-size: 23px; color: #ffe9a8; }
.bl.cur { color: #fff; }

@keyframes caret { 50% { opacity: 0; } }
.bl table { border-collapse: collapse; font-size: 15px; margin: 8px 0; color: #f6faf4; }
.bl th, .bl td { border: 1px solid rgba(255,255,255,.45); padding: 4px 8px; }
.bl th { background: rgba(255,255,255,.12); }
.chalk-tray { height: 10px; margin: 0 16px; border-radius: 0 0 8px 8px; background: linear-gradient(#6f4c2c, #5a3d23); box-shadow: 0 4px 10px rgba(0,0,0,.2); }

.cat-wrap { text-align: center; padding-bottom: 6px; }
.cat { width: 100%; max-width: 186px; height: auto; animation: catIdle 3.4s ease-in-out infinite; }
.cat-name { font-size: 12.5px; font-weight: 700; color: var(--muted); margin-top: 2px; }
@keyframes catIdle { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-5px) rotate(-1deg); } }
.cat-head { transform-origin: 105px 150px; animation: catHead 5s ease-in-out infinite; }
@keyframes catHead { 0%, 100% { transform: rotate(-2deg); } 50% { transform: rotate(2.5deg); } }
.cat-tail { transform-origin: 158px 276px; animation: catTail 2.6s ease-in-out infinite; }
@keyframes catTail { 0%, 100% { transform: rotate(-8deg); } 50% { transform: rotate(10deg); } }
.cat-eyes .eye { animation: blink 5.5s infinite; transform-origin: center; }
@keyframes blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
.cat-mouth { transform-origin: 105px 134px; }
.cat-arm { transform-origin: 158px 204px; }
.cat-body { transform-origin: 105px 290px; animation: breathe 3.6s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.015, 1.01); } }
body.cat-talking .cat-mouth { animation: talk .3s ease-in-out infinite; }
@keyframes talk { 0% { transform: scaleY(.55); } 45% { transform: scaleY(1.25); } 70% { transform: scaleY(.8); } 100% { transform: scaleY(.55); } }
body.cat-talking .cat-arm { animation: writing 2.1s ease-in-out infinite; }
@keyframes writing { 0%, 100% { transform: rotate(0) translate(0, 0); } 30% { transform: rotate(-22deg) translate(-6px, -14px); } 60% { transform: rotate(-12deg) translate(-2px, -6px); } }
body.cat-talking .cat-head { animation: catHeadTalk 2.8s ease-in-out infinite; }
@keyframes catHeadTalk { 0%, 100% { transform: rotate(-1.5deg) translateY(0); } 35% { transform: rotate(2deg) translateY(-2px); } 70% { transform: rotate(-0.5deg) translateY(1px); } }
body.cat-talking .cat { animation-duration: 2.4s; }

.lec-bar { height: 5px; border-radius: 99px; background: var(--surface-2); margin: 14px 0 12px; overflow: hidden; }
.lec-bar > span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .35s; }
.lec-ctrl { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lec-subtitle {
  margin-top: 14px; padding: 14px 16px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line);
  font-size: 15.5px; line-height: 1.7; min-height: 60px; color: var(--text-2);
}
.lec-stage.playing .board { box-shadow: inset 0 0 60px rgba(0,0,0,.45), 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent), 0 10px 28px rgba(16,24,40,.22); }
.note-sec + .note-sec { margin-top: 16px; }
.note-ox { margin-top: 14px; border-top: 1px dashed var(--line); padding-top: 10px; }
.note-ox summary { cursor: pointer; font-weight: 700; font-size: 14px; color: var(--muted); }
.type-row .no svg { width: 16px; height: 16px; }

@media (max-width: 860px) {
  .lec-stage { grid-template-columns: 1fr; gap: 0; position: relative; display: flex; flex-direction: column; }
  .board { min-height: 46vh; border-width: 7px; padding: 12px 12px 14px; }
  .board-inner { font-size: 15.5px; line-height: 1.55; max-height: 52vh; }
  .bl { margin: 3px 0; }
  .bl-title { font-size: 19px; padding-bottom: 6px; margin-bottom: 7px; }
  .bl-head { font-size: 17px; margin-top: 9px; }
  .bl table { font-size: 12.5px; }
  .bl th, .bl td { padding: 3px 5px; }
  
  /* 고양이는 칠판을 가리지 않게 아래 띠로 내림 */
  .cat-wrap { display: flex; align-items: flex-start; justify-content: flex-end; gap: 8px; height: 76px; margin: 2px 6px 0 0; overflow: hidden; }
  .cat { max-width: 86px; margin-top: 0; }
  .cat-name { display: block; font-size: 11.5px; margin-top: 26px; }
  .lec-ctrl { position: sticky; bottom: calc(66px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--bg) 92%, transparent); padding: 8px 0; z-index: 5; }
  .lec-ctrl .btn.lg { flex: 1; }
}
@media print {
  .side, .tabbar, .topbar, .lec-ctrl, .foot-nav, .chips { display: none !important; }
  .view { max-width: none; padding: 0; }
  .card { break-inside: avoid; box-shadow: none; }
  .note-ox { display: block; }
  .note-ox[open] summary { display: none; }
}

/* ================= 기본학습 (과목 → 유형 → 단락) ================= */
.nav-group {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 9px;
  font-size: 14.5px; font-weight: 700; color: var(--text); text-align: left;
}
.nav-group:hover { background: var(--surface-2); }
.nav-group.on { color: var(--accent-ink); }
.nav-group svg { width: 18px; height: 18px; flex: none; }
.nav-group span { flex: 1; min-width: 0; }
.nav-group .cv { width: 16px; height: 16px; transition: transform .18s; }
.nav-group .cv.open { transform: rotate(180deg); }
.nav-sub { display: flex; flex-direction: column; gap: 2px; padding-left: 8px; margin-left: 12px; border-left: 1px solid var(--line); }
.nav-sub[hidden] { display: none; }
.nav-sub a { font-size: 13.5px; padding: 7px 10px; }
.nav-sub .nav-label { padding: 6px 10px 2px; }

.cyc {
  display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 12px;
  font-weight: 800; background: var(--accent); color: #fff; white-space: nowrap;
}
.cyc.none { background: var(--surface-2); color: var(--muted); }
.cyc.sm { height: 20px; font-size: 11.5px; padding: 0 8px; }

.learn-modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 16px; }
.mode-card { padding: 18px 16px; display: flex; flex-direction: column; gap: 4px; transition: transform .15s, border-color .15s; }
.mode-card:hover { transform: translateY(-2px); border-color: var(--line-2); }
.mode-card .ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 8px; }
.mode-card .ic svg { width: 21px; height: 21px; }
.mode-card b { font-size: 16px; }
.mode-card span { font-size: 12.5px; color: var(--muted); line-height: 1.5; }

.read-head { margin: 10px 0 14px; }
.read-head h1 { font-size: 24px; font-weight: 800; margin-top: 10px; }
.read-body { font-size: 16px; line-height: 1.8; }
.read-act { margin-top: 20px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.print-only { display: none; }

@media (max-width: 860px) {
  .learn-modes { grid-template-columns: 1fr; gap: 8px; }
  .mode-card { flex-direction: row; align-items: center; gap: 12px; padding: 14px; }
  .mode-card .ic { margin: 0; flex: none; }
  .mode-card span { display: block; }
  .read-head h1 { font-size: 21px; }
}

/* ================= 인쇄 ================= */
@media print {
  .no-print, .side, .tabbar, .topbar, .lec-ctrl, .foot-nav, .chips, .read-act, .btn { display: none !important; }
  .print-only { display: block; }
  body { background: #fff; font-size: 11pt; }
  .view { max-width: none; padding: 0; }
  .card { border: 0; box-shadow: none; padding: 0; break-inside: avoid; }
  .rich table { font-size: 10pt; }
  .hl { background: none; border-bottom: 2px solid #999; }
  .read-head h1 { font-size: 17pt; margin-bottom: 4pt; }
  #print-area h1 { font-size: 18pt; }
  #print-area h2 { font-size: 13pt; margin: 14pt 0 4pt; border-left: 3px solid #333; padding-left: 6pt; }
  body.printing-area > .app { display: none !important; }
  #print-area { display: block; }
}
#print-area { display: none; }

.inapp-banner {
  display: flex; flex-direction: column; gap: 6px; margin: 12px 0; padding: 14px 16px; border-radius: 12px;
  background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent);
}
.inapp-banner b { font-size: 14.5px; }
.inapp-banner span { font-size: 13.5px; color: var(--text-2); line-height: 1.6; }
.inapp-banner .btn { align-self: flex-start; margin-top: 4px; }

/* 모바일 전체메뉴 드로어 (PC 사이드바와 같은 구조) */
.menu-bg { position: fixed; inset: 0; z-index: 48; background: rgba(10,12,16,.45); animation: fade .18s ease; }
@media (max-width: 860px) {
  .side {
    display: flex !important; position: fixed; z-index: 49; left: 0; top: 0; bottom: 0; width: 284px; max-width: 86vw;
    height: 100%; transform: translateX(-102%); transition: transform .22s cubic-bezier(.2,.9,.3,1);
    box-shadow: 0 0 40px rgba(0,0,0,.25); padding-top: calc(18px + env(safe-area-inset-top));
    overflow-y: auto;
  }
  body.menu-open .side { transform: translateX(0); }
  body.menu-open { overflow: hidden; }
  .side .brand { padding-right: 34px; }
}

/* OX 단락 (문제 풀이형) */
.oxwrap { display: flex; flex-direction: column; gap: 12px; }
.oxhead { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.oxhead b { font-size: 15px; }
.oxhead .btn { margin-left: auto; }
.oxq { padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.oxq-s { display: flex; gap: 10px; font-size: 15.5px; line-height: 1.6; }
.oxq-s b { font-weight: 650; }
.oxno { flex: none; width: 24px; height: 24px; border-radius: 7px; background: var(--surface-2); color: var(--muted); display: grid; place-items: center; font-size: 12.5px; font-weight: 800; }
.oxq-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.ox-b { height: 52px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); font-size: 22px; font-weight: 900; transition: background .12s, border-color .12s; }
.ox-b.o { color: var(--accent); }
.ox-b.x { color: var(--bad); }
.ox-b:hover { background: var(--surface-2); }
.oxq.answered .ox-b { cursor: default; opacity: .55; }
.oxq.answered .ox-b.right { opacity: 1; background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.oxq.answered .ox-b.wrong { opacity: 1; background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.oxq-fb .fb { margin-top: 12px; padding: 12px 14px; font-size: 14.5px; }
.oxq-fb .fb .e { margin-top: 4px; }

/* 사진형 강사 아바타 */
.ava { position: relative; width: 100%; max-width: 172px; margin: 0 auto; border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); background: var(--surface-2); animation: avaIdle 5s ease-in-out infinite; }
.ava img { display: block; width: 100%; height: auto; }
@keyframes avaIdle { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-4px) rotate(-.6deg); } }



body.cat-talking .ava { animation-duration: 3s; }




body.cat-talking .ava img { animation: avaJaw .3s ease-in-out infinite; transform-origin: 50% 20%; }
@keyframes avaJaw { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(1.006); } }
.ava-cal { display: flex; gap: 16px; flex-wrap: wrap; width: 100%; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.ava-prev { width: 130px; flex: none; }
.ava-prev .cat-name { text-align: center; }
.ava-sliders { flex: 1; min-width: 240px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; align-content: start; }
.ava-sl { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.ava-sl span { width: 54px; flex: none; }
.ava-sl input { flex: 1; min-width: 60px; }
.ava-sl b { width: 26px; text-align: right; font-variant-numeric: tabular-nums; color: var(--text); }
.ava-sliders .btn { grid-column: 1 / -1; justify-self: start; }
@media (max-width: 860px) {
  .ava { max-width: 74px; border-radius: 10px; }
  .ava-sliders { grid-template-columns: 1fr; }
}

/* 아바타 움직임 강도 */
.ava.motion-off, .ava.motion-off img { animation: none !important; }


body.cat-talking .ava.motion-soft img { animation: none; }
.ava-wave { position: absolute; left: 50%; bottom: 6px; transform: translateX(-50%); display: none; gap: 3px; align-items: flex-end; height: 14px;
  padding: 4px 8px; border-radius: 999px; background: rgba(15,18,24,.55); backdrop-filter: blur(4px); }
.ava-wave i { display: block; width: 3px; height: 4px; border-radius: 2px; background: #fff; animation: wave .9s ease-in-out infinite; }
.ava-wave i:nth-child(2) { animation-delay: .15s; }
.ava-wave i:nth-child(3) { animation-delay: .3s; }
.ava-wave i:nth-child(4) { animation-delay: .45s; }
@keyframes wave { 0%, 100% { height: 4px; opacity: .6; } 50% { height: 12px; opacity: 1; } }
body.cat-talking .ava:not(.motion-off) .ava-wave { display: flex; }

/* 사진 교대 방식 (teacher.jpg / teacher_talk.jpg / teacher_blink.jpg) */
.ava { position: relative; background: #e9eaec; }
.ava-f { display: block; width: 100%; height: auto; }
.ava-f.vis-m1, .ava-f.vis-m2, .ava-f.vis-m3, .ava-f.vis-o, .ava-f.vis-u, .ava-f.blink, .ava-f.half {
  position: absolute; inset: 0; opacity: 0; transition: opacity .07s ease-out;
}
.ava-f.blink { transition: opacity .05s linear; }
.ava.v-m1 .ava-f.vis-m1, .ava.v-m2 .ava-f.vis-m2, .ava.v-m3 .ava-f.vis-m3, .ava.v-o .ava-f.vis-o, .ava.v-u .ava-f.vis-u { opacity: 1; }
.ava.eye-shut .ava-f.blink { opacity: 1; z-index: 2; }
.ava.eye-half .ava-f.half { opacity: 1; z-index: 2; }
.ava-f.half { transition: opacity .04s linear; }
.ava.nodding img.base { animation: nodAnim .6s ease-in-out; }
@keyframes nodAnim { 0%, 100% { transform: translateY(0) rotate(0); } 40% { transform: translateY(4px) rotate(.5deg); } 70% { transform: translateY(1px) rotate(.2deg); } }
.ava.eye-shut .ava-f.blink { opacity: 1; }
.ava.motion-off .ava-f:not(.base), .ava.motion-off .ava-wave { display: none; }
.ava.motion-off { animation: none; }

/* 고양이 입 모양을 음성 타이밍에 맞춤 (미리 만든 음성 재생 시) */
body.audio-sync .cat-mouth { animation: none !important; transition: transform .07s ease-out; }
body.audio-sync .cat[data-v=""] .cat-mouth,
body.audio-sync .cat:not([data-v]) .cat-mouth { transform: scaleY(.5); }
body.audio-sync .cat[data-v="m1"] .cat-mouth { transform: scaleY(1); }
body.audio-sync .cat[data-v="m2"] .cat-mouth { transform: scaleY(1.7); }
body.audio-sync .cat[data-v="m3"] .cat-mouth { transform: scaleY(2.4); }
body.audio-sync .cat[data-v="o"]  .cat-mouth { transform: scale(.72, 2.0); }
body.audio-sync .cat[data-v="u"]  .cat-mouth { transform: scale(.6, 1.5); }
body.audio-sync .cat-arm { animation: writing 2.6s ease-in-out infinite; }

/* 배속 선택 메뉴 */
.rate-wrap { position: relative; display: inline-block; }
.rate-menu {
  position: absolute; left: 0; top: calc(100% + 6px); z-index: 30; display: flex; flex-direction: column; gap: 2px;
  padding: 5px; border-radius: 11px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg);
  min-width: 92px;
}
.rate-menu[hidden] { display: none; }
.rate-menu button { padding: 8px 12px; border-radius: 8px; font-size: 14px; font-weight: 600; text-align: left; }
.rate-menu button:hover { background: var(--surface-2); }
.rate-menu button.on { background: var(--accent); color: #fff; }
@media (max-width: 860px) { .rate-menu { bottom: calc(100% + 6px); top: auto; } }

/* ===== 사람 일러스트 강사 (입이 연속 변형) ===== */
.human { width: 100%; max-width: 186px; height: auto; display: block; margin: 0 auto; animation: humanIdle 4.5s ease-in-out infinite; }
@keyframes humanIdle { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
.human-head { transform-origin: 105px 175px; animation: humanHead 6.5s ease-in-out infinite; }
@keyframes humanHead { 0%, 100% { transform: rotate(-1.2deg); } 50% { transform: rotate(1.4deg); } }
.human-body { transform-origin: 105px 300px; animation: humanBreathe 3.8s ease-in-out infinite; }
@keyframes humanBreathe { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.012, 1.008); } }
/* 입: data-v 에 따라 크기만 바뀌므로 중간값이 부드럽게 보간됨 */
.human .mouth-open, .human .teeth { transform-origin: 105px 152px; transform: scale(.18, .04); opacity: 0; transition: transform .075s ease-out, opacity .075s ease-out; }
.human .lip { transition: opacity .075s ease-out; }
.human[data-v="m1"] .mouth-open { opacity: 1; transform: scale(.5, .3); }
.human[data-v="m2"] .mouth-open { opacity: 1; transform: scale(.78, .72); }
.human[data-v="m3"] .mouth-open { opacity: 1; transform: scale(1, 1.1); }
.human[data-v="o"]  .mouth-open { opacity: 1; transform: scale(.5, .95); }
.human[data-v="u"]  .mouth-open { opacity: 1; transform: scale(.38, .62); }
.human[data-v="m2"] .teeth, .human[data-v="m3"] .teeth { opacity: .92; transform: scale(1, 1); }
.human .tongue { transform-origin: 105px 158px; transform: scale(.6, .5); opacity: 0; transition: transform .08s, opacity .08s; }
.human[data-v="m3"] .tongue { opacity: .85; transform: scale(1, 1); }
.human[data-v="o"] .tongue, .human[data-v="u"] .tongue { opacity: .5; transform: scale(.7, .6); }
.human[data-v="m1"] .lip, .human[data-v="m2"] .lip, .human[data-v="m3"] .lip, .human[data-v="o"] .lip, .human[data-v="u"] .lip { opacity: .2; }
.human .lid { transform-origin: center top; transform: scaleY(0); transition: transform .06s linear; }
.human.eye-shut .lid { transform: scaleY(1.15); }
body.cat-talking .human { animation-duration: 3.2s; }
@media (max-width: 860px) { .human { max-width: 96px; } }

/* 캐릭터 없음 */
.cat-wrap:empty { display: none; }

/* ===== 칠판: 형광펜 · 별표 · 써지는 효과 ===== */
.bl { position: relative; }
.bl .wr {
  display: inline;
  background-image: linear-gradient(90deg, transparent 0 0);
}
/* 한 글자씩 써지는 느낌: 왼쪽에서 오른쪽으로 드러남 + 분필 끝 반짝 */
.bl.cur .wr { animation: writeIn var(--wr, 700ms) steps(24, end) both; }
@keyframes writeIn { from { clip-path: inset(0 100% -20% 0); } to { clip-path: inset(0 -2% -20% 0); } }
.bl:not(.cur) .wr { animation: none; }
.bl.cur::after {
  content: ""; position: absolute; left: 0; top: 0; width: 100%; height: 100%;
  pointer-events: none; animation: chalkDust var(--wr, 700ms) linear both;
  background: radial-gradient(circle 3px at 0 60%, rgba(255,255,255,.85), transparent 70%);
  background-repeat: no-repeat; display: block;
}
@keyframes chalkDust { from { background-position: 0 0; opacity: .9; } to { background-position: 100% 0; opacity: 0; } }

/* 형광펜(분필 마커) — 핵심 용어 */
.hl-chalk {
  position: relative; color: #fffbe8; font-weight: 700; padding: 0 3px;
  box-shadow: inset 0 -0.62em 0 rgba(255, 214, 79, .32);
  border-radius: 3px;
}
/* 숫자·조문 */
.num-chalk { color: #ffe9a8; font-weight: 700; letter-spacing: .01em; }
/* 별표·글머리 */
.bl .star { color: #ffd84d; margin-right: 2px; text-shadow: 0 0 8px rgba(255,216,77,.45); }
.bl .star.warn-star { color: #ffb36b; }
.bl .dot { color: rgba(255,255,255,.55); margin-right: 4px; }
.bl-tip { color: #cbf5d6; }
.bl-tip .hl-chalk { box-shadow: inset 0 -0.62em 0 rgba(120, 255, 170, .22); }
.bl-warn { color: #ffd9b8; }

/* ===== 교안 패널 ===== */
.lec-notes-bar { display: flex; align-items: center; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.lec-notes {
  margin-top: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  box-shadow: var(--shadow); overflow: hidden;
}
.lec-notes[hidden] { display: none; }
.notes-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.notes-head b { font-size: 15px; }
.notes-list { list-style: none; margin: 0; padding: 0; max-height: 460px; overflow-y: auto; }
.nt { display: flex; gap: 12px; padding: 11px 16px; border-top: 1px solid var(--line); cursor: pointer; }
.nt:first-child { border-top: 0; }
.nt:hover { background: var(--surface-2); }
.nt.on { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.nt-ch { flex: none; width: 62px; font-size: 12px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; padding-top: 2px; }
.nt.on .nt-ch { color: var(--accent-ink); }
.nt-body { flex: 1; min-width: 0; }
.nt-body b { display: block; font-size: 14.5px; font-weight: 650; }
.nt-say { display: block; font-size: 13px; color: var(--muted); line-height: 1.6; margin-top: 3px; }
.nt-head .nt-body b, .nt-title .nt-body b { font-size: 15.5px; color: var(--accent-ink); }
.nt-head, .nt-title { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
.nt-tip .nt-body b { color: var(--ok); }
.nt-warn .nt-body b { color: var(--warn); }
@media (max-width: 860px) {
  .nt-ch { width: 48px; font-size: 11px; }
  .notes-list { max-height: 60vh; }
  .lec-notes-bar .muted { display: none; }
}
@media print { .wr .t, h2 .t { color: #888; font-size: 9pt; font-weight: 400; } }

/* 교안 문서형 */
.notes-doc { max-height: 620px; overflow-y: auto; padding: 4px 18px 18px; }
.nsec { padding: 16px 0; border-top: 1px solid var(--line); }
.nsec:first-child { border-top: 0; }
.nsec-h { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.nsec-h b { font-size: 16px; }
.nsec-h .btn { margin-left: auto; color: var(--accent-ink); }
.nsec .rich { font-size: 15px; }
.nsec-foot { display: flex; gap: 8px; padding-top: 14px; border-top: 1px solid var(--line); flex-wrap: wrap; }
@media (max-width: 860px) { .notes-doc { max-height: 70vh; padding: 4px 14px 14px; } .nsec-h .btn { margin-left: 0; } }
