/* ============================================================
   OSTEON · 정형외과 ICL 한글 아카이브
   Design system — "Ink & Bone": editorial medical journal
   meets anatomical atlas. Fraunces × Pretendard × IBM Plex Mono.
   ============================================================ */

@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.min.css');
@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,400;0,9..144,500;0,9..144,600;0,9..144,700;0,9..144,900;1,9..144,400;1,9..144,500&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

/* ---------- tokens ---------- */
:root {
  --bg:        #ece5d7;
  --bg-deep:   #e3dac8;
  --surface:   #faf6ee;
  --surface-2: #f2eae0;
  --ink:       #15212f;
  --ink-soft:  #3c4a59;
  --ink-faint: #74808d;
  --line:      rgba(21,33,47,.12);
  --line-soft: rgba(21,33,47,.07);

  --teal:      #0b8d83;
  --teal-2:    #0a6f67;
  --teal-ghost: rgba(11,141,131,.10);
  --coral:     #d2452b;
  --coral-ghost: rgba(210,69,43,.12);
  --amber:     #bd8126;
  --indigo:    #4a57c4;

  --v73: #0b8d83;   /* surgical teal  */
  --v74: #4a57c4;   /* clinical indigo */
  --v75: #c0682d;   /* burnt amber */

  --font-display: 'Fraunces', 'Pretendard', Georgia, 'Apple SD Gothic Neo', serif;
  --font-body: 'Pretendard', 'Apple SD Gothic Neo', 'Malgun Gothic', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', 'Pretendard', 'Apple SD Gothic Neo', 'Malgun Gothic', ui-monospace, monospace;

  --maxw: 1240px;
  --measure: 80ch;
  --radius: 16px;
  --radius-lg: 26px;
  --shadow: 0 1px 2px rgba(21,33,47,.04), 0 8px 24px -12px rgba(21,33,47,.18);
  --shadow-lg: 0 2px 6px rgba(21,33,47,.06), 0 30px 60px -28px rgba(21,33,47,.34);
  --ease: cubic-bezier(.22,.61,.36,1);
}

html[data-theme="dark"] {
  --bg:        #0a0f17;
  --bg-deep:   #070b11;
  --surface:   #111b27;
  --surface-2: #0d151f;
  --ink:       #e9f0f6;
  --ink-soft:  #aebccb;
  --ink-faint: #6d7d8d;
  --line:      rgba(255,255,255,.10);
  --line-soft: rgba(255,255,255,.055);

  --teal:      #2bcab9;
  --teal-2:    #5fded0;
  --teal-ghost: rgba(43,202,185,.14);
  --coral:     #ff6f52;
  --coral-ghost: rgba(255,111,82,.16);
  --amber:     #e7b35a;
  --indigo:    #8b96ff;

  --v73: #2bcab9;
  --v74: #8b96ff;
  --v75: #f0a35e;

  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 12px 30px -14px rgba(0,0,0,.6);
  --shadow-lg: 0 2px 8px rgba(0,0,0,.5), 0 40px 80px -30px rgba(0,0,0,.75);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  font-size: 1.156rem;   /* 18.5px at 100% root; scales with --font-scale */
  letter-spacing: -0.003em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  word-break: keep-all;
  overflow-wrap: break-word;
  overflow-x: hidden;
  transition: background .5s var(--ease), color .4s var(--ease);
}

/* atmospheric background: bone-paper gradient mesh + grain */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -2;
  background:
    radial-gradient(1100px 720px at 12% -8%, var(--teal-ghost), transparent 60%),
    radial-gradient(900px 680px at 96% 4%, var(--coral-ghost), transparent 58%),
    radial-gradient(1200px 900px at 50% 118%, rgba(74,87,196,.10), transparent 62%);
  pointer-events: none;
  transition: opacity .5s var(--ease);
}
.grain {
  position: fixed; inset: -50%; z-index: -1; pointer-events: none;
  opacity: .5; mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
}
html[data-theme="dark"] .grain { opacity: .28; }

::selection { background: var(--teal); color: #fff; }
html[data-theme="dark"] ::selection { background: var(--teal); color: #06231f; }

a { color: inherit; text-decoration: none; }

/* ---------- topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 60;
  display: flex; align-items: center; gap: 18px;
  padding: 14px clamp(18px, 4vw, 48px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  border-bottom: 1px solid var(--line-soft);
}
.brand { display: flex; align-items: center; gap: 11px; font-weight: 700; letter-spacing: .14em; }
.brand .mark {
  width: 30px; height: 30px; flex: none;
  display: grid; place-items: center;
  border-radius: 9px;
  background: linear-gradient(140deg, var(--teal), var(--teal-2));
  color: #fff; box-shadow: var(--shadow);
}
.brand .mark svg { width: 19px; height: 19px; }
.brand .word {
  font-family: var(--font-display);
  font-weight: 900; font-size: 1.16rem; letter-spacing: .19em;
  background: linear-gradient(100deg, var(--ink), var(--teal-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand .sub { font-family: var(--font-mono); font-size: .58rem; letter-spacing: .18em;
  color: var(--ink-faint); text-transform: uppercase; margin-top: 2px; }
.topbar .spacer { flex: 1; }

.topbar-link { font-size: .82rem; color: var(--ink-soft); font-weight: 500;
  padding: 7px 12px; border-radius: 9px; transition: .2s var(--ease); }
.topbar-link:hover { color: var(--ink); background: var(--surface-2); }

.icon-btn {
  width: 38px; height: 38px; flex: none; border: 1px solid var(--line);
  background: var(--surface); border-radius: 11px; color: var(--ink-soft);
  display: grid; place-items: center; cursor: pointer; transition: .2s var(--ease);
}
.icon-btn:hover { color: var(--ink); border-color: var(--teal); transform: translateY(-1px); }
.icon-btn:focus-visible, .topbar-link:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn .moon { display: none; }
html[data-theme="dark"] .icon-btn .sun { display: none; }
html[data-theme="dark"] .icon-btn .moon { display: block; }
.nav-toggle { flex: none; }

/* font-size control */
.fs-control { position: relative; flex: none; }
.fs-aa { font-family: var(--font-display); font-weight: 800; font-size: .98rem; line-height: 1; }
.fs-aa::after { content: "+"; font-size: .6em; vertical-align: super; opacity: .6; }
.fs-pop {
  position: absolute; top: 48px; right: 0; z-index: 90; width: 248px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow-lg); padding: 15px 16px; display: none;
}
.fs-pop.show { display: block; animation: rise .22s var(--ease) both; }
.fs-lbl-row { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.fs-lbl { font-family: var(--font-mono); font-size: .66rem; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-faint); }
.fs-val { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; color: var(--teal); }
.fs-slider-row { display: flex; align-items: center; gap: 10px; }
.fs-btn.sm { flex: none; width: 30px; height: 30px; border: 1px solid var(--line); background: var(--surface-2);
  border-radius: 9px; color: var(--ink-soft); cursor: pointer; display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; line-height: 1; transition: .15s var(--ease); padding: 0; }
.fs-btn.sm:hover { border-color: var(--teal); color: var(--teal); }
.fs-btn.sm:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

/* draggable bar */
.fs-range {
  -webkit-appearance: none; appearance: none; flex: 1; height: 7px; border-radius: 7px; margin: 0;
  cursor: pointer; outline: none;
  background: linear-gradient(90deg, var(--teal) 0 var(--p, 22%), var(--surface-2) var(--p, 22%) 100%);
}
.fs-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 22px; height: 22px; border-radius: 50%;
  background: var(--teal); border: 3px solid var(--surface); box-shadow: 0 2px 6px rgba(0,0,0,.25);
  cursor: grab; transition: transform .12s var(--ease); margin-top: 0;
}
.fs-range::-webkit-slider-thumb:active { cursor: grabbing; transform: scale(1.18); }
.fs-range::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%; background: var(--teal);
  border: 3px solid var(--surface); box-shadow: 0 2px 6px rgba(0,0,0,.25); cursor: grab;
}
.fs-range::-moz-range-track { height: 7px; border-radius: 7px; background: transparent; }
.fs-range:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px var(--teal-ghost); }
.fs-reset { width: 100%; margin-top: 12px; border: none; background: transparent; color: var(--ink-faint);
  font-family: var(--font-body); font-size: .78rem; cursor: pointer; padding: 6px; border-radius: 8px; }
.fs-reset:hover { background: var(--surface-2); color: var(--ink); }

/* ============================================================
   BOOK / CHAPTER SIDEBAR
   ============================================================ */
:root { --bn-w: 296px; }
body { transition: background .5s var(--ease), color .4s var(--ease), padding-left .34s var(--ease); }

.booknav {
  position: fixed; top: 0; left: 0; width: var(--bn-w); height: 100vh; height: 100dvh;
  z-index: 75; background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  transform: translateX(-100%); transition: transform .34s var(--ease);
  box-shadow: var(--shadow-lg); will-change: transform;
}
html.nav-open .booknav { transform: none; }
.booknav-head {
  display: flex; align-items: center; gap: 10px; flex: none;
  padding: 16px 14px 12px 18px; border-bottom: 1px solid var(--line-soft);
}
.bn-title { font-family: var(--font-display); font-weight: 800; font-size: 1.05rem; letter-spacing: .03em; }
.bn-close { margin-left: auto; width: 34px; height: 34px; }
.bn-search { flex: none; padding: 12px 14px 8px; }
.bn-search input {
  width: 100%; padding: 9px 13px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface-2); font-family: var(--font-body); font-size: .85rem; color: var(--ink);
  outline: none; transition: .2s var(--ease);
}
.bn-search input::placeholder { color: var(--ink-faint); }
.bn-search input:focus-visible { border-color: var(--teal); outline: 2px solid var(--teal); outline-offset: 1px; }
.bn-list { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 6px 8px 40px; scrollbar-width: thin; }
.bn-list::-webkit-scrollbar { width: 9px; }
.bn-list::-webkit-scrollbar-thumb { background: var(--line); border-radius: 9px; border: 2px solid var(--surface); }

.bn-vol { margin-bottom: 7px; border: 1px solid var(--line-soft); border-radius: 12px; overflow: hidden; }
.bn-vol:not(.collapsed) { border-color: var(--line); background: color-mix(in srgb, var(--vc) 5%, transparent); }
.bn-volhead {
  width: 100%; display: flex; align-items: center; gap: 11px; cursor: pointer;
  padding: 13px 13px; background: transparent; border: none; border-radius: 0;
  color: var(--ink); font-family: var(--font-body); font-size: .84rem; text-align: left;
}
.bn-volhead:hover { background: var(--surface-2); }
.bn-volhead:focus-visible { outline: 2px solid var(--vc, var(--teal)); outline-offset: -2px; }
.bn-volhead .bn-dot { width: 12px; height: 12px; border-radius: 50%; flex: none;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--vc) 18%, transparent); }
.bn-vinfo { display: flex; flex-direction: column; gap: 1px; }
.bn-volhead b { font-family: var(--font-display); font-weight: 800; letter-spacing: .02em; font-size: 1.08rem; line-height: 1.1; }
.bn-volhead .bn-vlabel { color: var(--ink-faint); font-size: .68rem; font-family: var(--font-mono); letter-spacing: .02em; }
.bn-volhead .bn-vc { margin-left: auto; font-family: var(--font-mono); font-size: .66rem; color: var(--ink-faint);
  background: var(--surface-2); padding: 2px 7px; border-radius: 20px; }
.bn-volhead .bn-chev { transition: transform .25s var(--ease); color: var(--ink-faint); display: inline-flex; flex: none; }
.bn-volhead .bn-chev svg { width: 15px; height: 15px; }
.bn-vol:not(.collapsed) .bn-volhead .bn-chev { transform: rotate(90deg); }
.bn-vol.collapsed .bn-chs { display: none; }

/* current-chapter progress (prominent, top of sidebar) */
.bn-curprog {
  margin: 2px 12px 12px; padding: 15px 15px 14px; border-radius: 14px;
  background: linear-gradient(140deg, color-mix(in srgb, var(--vc) 14%, var(--surface)), var(--surface));
  border: 1px solid color-mix(in srgb, var(--vc) 35%, var(--line));
}
.bn-curprog .cp-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.bn-curprog .cp-lbl { font-family: var(--font-mono); font-size: .64rem; letter-spacing: .14em;
  text-transform: uppercase; color: var(--ink-faint); }
.bn-curprog .cp-pct { font-family: var(--font-display); font-weight: 800; font-size: 1.9rem; line-height: 1;
  color: var(--vc); font-feature-settings: "tnum"; }
.bn-curprog .cp-title { font-size: .82rem; font-weight: 600; color: var(--ink); line-height: 1.35; margin: 8px 0 9px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bn-curprog .cp-bar { height: 9px; border-radius: 9px; background: var(--surface-2); overflow: hidden; }
.bn-curprog .cp-bar i { display: block; height: 100%; border-radius: 9px; width: 0;
  background: linear-gradient(90deg, var(--vc), var(--coral)); transition: width .25s var(--ease); }
.bn-curprog .cp-done { display: none; margin-top: 9px; font-size: .76rem; font-weight: 600; color: var(--vc);
  align-items: center; gap: 6px; }
.bn-curprog.is-done .cp-done { display: flex; }

/* my-progress summary (top of sidebar) */
.bn-mystat { margin: 2px 8px 10px; padding: 13px 14px; border-radius: 13px;
  background: linear-gradient(135deg, var(--teal-ghost), transparent 80%);
  border: 1px solid var(--line-soft); }
.bn-mystat .ms-top { display: flex; justify-content: space-between; align-items: baseline; }
.bn-mystat .ms-lbl { font-family: var(--font-mono); font-size: .62rem; letter-spacing: .16em;
  text-transform: uppercase; color: var(--ink-faint); }
.bn-mystat .ms-pct { font-family: var(--font-display); font-weight: 800; font-size: 1.35rem; color: var(--teal);
  line-height: 1; font-feature-settings: "tnum"; }
.bn-mystat .ms-bar { height: 8px; border-radius: 8px; background: var(--surface-2); overflow: hidden; margin: 9px 0 8px; }
.bn-mystat .ms-bar i { display: block; height: 100%; border-radius: 8px;
  background: linear-gradient(90deg, var(--teal), var(--amber), var(--coral)); transition: width .6s var(--ease); }
.bn-mystat .ms-sub { font-size: .72rem; color: var(--ink-faint); }
.bn-mystat .ms-sub b { color: var(--ink); font-weight: 700; }

/* per-book progress bar */
.bn-volprog { height: 4px; background: var(--surface-2); margin: 0 12px 7px; border-radius: 4px; overflow: hidden; }
.bn-volprog i { display: block; height: 100%; width: 0; background: var(--vc); border-radius: 4px; transition: width .6s var(--ease); }

.bn-chs { list-style: none; margin: 1px 0 7px; padding: 0; }
.bn-ch > a {
  display: flex; gap: 9px; align-items: baseline; padding: 6px 10px 6px 13px;
  border-radius: 8px; color: var(--ink-soft); font-size: .82rem; line-height: 1.4;
  border-left: 2px solid transparent; transition: background .15s var(--ease), color .15s var(--ease);
}
.bn-ch > a:hover { background: var(--surface-2); color: var(--ink); }
.bn-ch .bn-n { font-family: var(--font-mono); font-size: .66rem; color: var(--ink-faint); flex: none; }
.bn-ch .bn-t { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bn-ch.cur > a {
  color: var(--vc); background: var(--teal-ghost); border-left-color: var(--vc); font-weight: 650;
}
.bn-ch.cur .bn-n { color: var(--vc); }
.bn-ch .bn-pct { margin-left: auto; flex: none; align-self: center; font-family: var(--font-mono);
  font-size: .62rem; font-weight: 600; color: var(--vc); }
.bn-ch.done .bn-n { color: #fff; background: var(--vc); border-radius: 50%; width: 17px; height: 17px;
  display: inline-grid; place-items: center; font-size: .68rem; flex: none; }
.bn-prog { height: 3px; margin: 2px 10px 1px 13px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.bn-prog i { display: block; height: 100%; width: var(--pg, 0%); border-radius: 3px;
  background: var(--vc); opacity: .55; transition: width .45s var(--ease); }
.bn-ch.done .bn-prog i { opacity: .85; }

/* completion toast + confetti */
.osteon-toast {
  position: fixed; left: 50%; bottom: 42px; transform: translate(-50%, 18px); z-index: 210;
  background: var(--ink); color: var(--bg); padding: 13px 24px; border-radius: 100px;
  font-weight: 650; font-size: .98rem; box-shadow: var(--shadow-lg); opacity: 0;
  transition: opacity .35s var(--ease), transform .35s var(--ease); pointer-events: none; max-width: 90vw;
}
.osteon-toast.show { opacity: 1; transform: translate(-50%, 0); }
.confetti {
  position: fixed; top: 56px; width: 10px; height: 15px; border-radius: 2px; z-index: 205;
  pointer-events: none; opacity: 0;
  animation: confetti-fall 2.4s cubic-bezier(.3,.7,.5,1) forwards;
}

/* completion banner */
.done-banner {
  position: fixed; left: 50%; top: 40%; transform: translate(-50%, -50%) scale(.82); z-index: 215;
  background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--teal);
  border-radius: 22px; padding: 30px 44px 26px; text-align: center; box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none; max-width: 90vw;
  transition: opacity .35s var(--ease), transform .45s var(--ease);
}
.done-banner.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.done-banner .db-emoji { font-size: 3.4rem; line-height: 1; animation: db-pop .6s var(--ease) both; }
@keyframes db-pop { 0% { transform: scale(0) rotate(-30deg); } 60% { transform: scale(1.25) rotate(8deg); } 100% { transform: scale(1) rotate(0); } }
.done-banner .db-t { font-family: var(--font-display); font-weight: 800; font-size: 1.8rem; margin: 10px 0 6px;
  background: linear-gradient(100deg, var(--teal), var(--coral)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.done-banner .db-s { color: var(--ink); font-size: 1rem; font-weight: 600; max-width: 30ch; line-height: 1.4; margin: 0 auto; }
.done-banner .db-tag { color: var(--ink-faint); font-size: .85rem; margin-top: 10px; }
@keyframes confetti-fall {
  0% { opacity: 1; transform: translate(0, 0) rotate(0); }
  100% { opacity: 0; transform: translate(var(--dx, 0), var(--dy, 240px)) rotate(var(--r, 360deg)); }
}
@media (prefers-reduced-motion: reduce) { .confetti { display: none; } }

/* nested current-chapter sections */
.bn-secs { list-style: none; margin: 2px 0 8px; padding: 0; }
.bn-secs a {
  display: block; padding: 4px 10px 4px 34px; font-size: .76rem; color: var(--ink-faint);
  border-left: 2px solid var(--line); margin-left: 13px; line-height: 1.35;
}
.bn-secs a:hover { color: var(--ink); border-color: var(--ink-soft); }
.bn-secs a.active { color: var(--vc); border-left-color: var(--vc); font-weight: 600;
  background: linear-gradient(90deg, var(--teal-ghost), transparent); }
.bn-empty { padding: 30px 16px; color: var(--ink-faint); font-size: .82rem; text-align: center; font-family: var(--font-mono); }

/* backdrop (overlay mode) */
.nav-backdrop {
  position: fixed; inset: 0; z-index: 74; background: rgba(8,12,18,.5);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  opacity: 0; pointer-events: none; transition: opacity .3s var(--ease);
}

/* pinned (desktop) — push content, hide redundant inline TOC */
@media (min-width: 1280px) {
  html.nav-open body { padding-left: var(--bn-w); }
  html.nav-open .reader .toc { display: none; }
  html.nav-open .reader .article-body { grid-template-columns: 1fr; }
  .booknav { box-shadow: none; }
}
/* overlay (tablet/mobile) — float over content with backdrop */
@media (max-width: 1279px) {
  html.nav-open .nav-backdrop { opacity: 1; pointer-events: auto; }
}

/* ============================================================
   HOME
   ============================================================ */
.hero {
  position: relative;
  padding: clamp(56px, 11vw, 132px) clamp(18px, 4vw, 48px) clamp(40px, 7vw, 76px);
  max-width: var(--maxw); margin: 0 auto;
  overflow: hidden;
}
.hero-bones {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  opacity: .5;
}
html[data-theme="dark"] .hero-bones { opacity: .32; }
.hero-inner { position: relative; z-index: 2; }
.hero .eyebrow {
  font-family: var(--font-mono); font-size: .74rem; letter-spacing: .34em;
  text-transform: uppercase; color: var(--teal-2); font-weight: 600;
  display: inline-flex; align-items: center; gap: 10px;
  padding: 7px 15px; border: 1px solid var(--line); border-radius: 100px;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
}
.hero .eyebrow b { width: 7px; height: 7px; border-radius: 50%; background: var(--coral); }
.hero h1 {
  font-family: var(--font-display);
  font-weight: 900; font-size: clamp(3.6rem, 13vw, 10.5rem);
  line-height: .9; letter-spacing: -.02em; margin: .28em 0 .12em;
  background: linear-gradient(168deg, var(--ink) 28%, var(--teal-2) 78%, var(--coral));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero h1 .o { font-style: italic; position: relative;
  -webkit-text-fill-color: var(--coral); color: var(--coral); }
.hero .lead {
  font-size: clamp(1.05rem, 2.3vw, 1.42rem); max-width: 30ch;
  color: var(--ink-soft); line-height: 1.5; font-weight: 450;
}
.hero .lead b { color: var(--ink); font-weight: 650; }

.stats { display: flex; flex-wrap: wrap; gap: clamp(20px, 5vw, 60px); margin-top: clamp(30px, 5vw, 54px); }
.stat .num {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(2.2rem, 5vw, 3.4rem); line-height: 1;
  color: var(--ink); letter-spacing: -.01em;
  font-feature-settings: "tnum";
}
.stat .num em { color: var(--teal); font-style: normal; }
.stat .lbl { font-family: var(--font-mono); font-size: .68rem; letter-spacing: .16em;
  text-transform: uppercase; color: var(--ink-faint); margin-top: 8px; }

/* ---------- controls / search ---------- */
.controls {
  position: sticky; top: 67px; z-index: 40;
  max-width: var(--maxw); margin: 0 auto;
  padding: 14px clamp(18px, 4vw, 48px);
  display: flex; gap: 14px; flex-wrap: wrap; align-items: center;
}
.controls::before {
  content:""; position:absolute; inset:0; z-index:-1;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line-soft);
}
.search-box { position: relative; flex: 1; min-width: 240px; }
.search-box svg { position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; color: var(--ink-faint); pointer-events: none; }
.search-box input {
  width: 100%; font-family: var(--font-body); font-size: .98rem; color: var(--ink);
  padding: 13px 16px 13px 46px; border: 1px solid var(--line);
  border-radius: 13px; background: var(--surface); outline: none;
  transition: .2s var(--ease);
}
.search-box input::placeholder { color: var(--ink-faint); }
.search-box input:focus-visible { border-color: var(--teal); box-shadow: 0 0 0 4px var(--teal-ghost); outline: 2px solid var(--teal); outline-offset: 1px; }
.search-box kbd {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  font-family: var(--font-mono); font-size: .7rem; color: var(--ink-faint);
  border: 1px solid var(--line); border-radius: 6px; padding: 2px 7px;
}
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  font-family: var(--font-mono); font-size: .76rem; letter-spacing: .04em;
  padding: 9px 15px; border: 1px solid var(--line); border-radius: 100px;
  background: var(--surface); color: var(--ink-soft); cursor: pointer;
  transition: .2s var(--ease); white-space: nowrap; font-weight: 500;
}
.chip:hover { color: var(--ink); transform: translateY(-1px); }
.chip[aria-pressed="true"] { color: #fff; border-color: transparent; }
.chip[data-vol="all"][aria-pressed="true"] { background: var(--ink); }
.chip[data-vol="ICL73"][aria-pressed="true"] { background: var(--v73); }
.chip[data-vol="ICL74"][aria-pressed="true"] { background: var(--v74); }
.chip[data-vol="ICL75"][aria-pressed="true"] { background: var(--v75); }
.chip .dot { display:inline-block; width:7px;height:7px;border-radius:50%;margin-right:7px;vertical-align:middle; }
.chip[data-vol="ICL73"] .dot{background:var(--v73)} .chip[data-vol="ICL74"] .dot{background:var(--v74)} .chip[data-vol="ICL75"] .dot{background:var(--v75)}
.chip[aria-pressed="true"] .dot { background:#fff !important; }

/* ---------- volume sections ---------- */
main.home-main { max-width: var(--maxw); margin: 0 auto; padding: 30px clamp(18px,4vw,48px) 90px; }
.volume { margin-top: 64px; scroll-margin-top: 130px; }
.vol-head { display: flex; align-items: flex-end; gap: 22px; margin-bottom: 26px;
  padding-bottom: 18px; border-bottom: 2px solid var(--line); position: relative; }
.vol-head .vnum {
  font-family: var(--font-display); font-weight: 900; line-height: .82;
  font-size: clamp(3.4rem, 8vw, 5.8rem); letter-spacing: -.03em;
  color: var(--vc); position: relative;
}
.vol-head .vmeta { flex: 1; padding-bottom: 6px; }
.vol-head .vlabel { font-family: var(--font-mono); font-size: .72rem; letter-spacing: .22em;
  text-transform: uppercase; color: var(--ink-faint); }
.vol-head h2 { margin: 4px 0 0; font-size: clamp(1.3rem, 3vw, 1.85rem); font-weight: 750;
  letter-spacing: -.02em; }
.vol-head .vcount { font-family: var(--font-mono); font-size: .8rem; color: var(--vc);
  font-weight: 600; padding-bottom: 8px; }

.chapter-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
}
.chapter-card {
  position: relative; display: flex; flex-direction: column;
  padding: 22px 20px 18px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow); overflow: hidden;
  transition: transform .32s var(--ease), box-shadow .32s var(--ease), border-color .32s var(--ease);
  isolation: isolate;
}
.chapter-card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--vc); transform: scaleY(0); transform-origin: top;
  transition: transform .34s var(--ease);
}
.chapter-card::after {
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: 0;
  background: radial-gradient(420px 200px at 90% -20%, var(--vc), transparent 70%);
  transition: opacity .4s var(--ease);
}
.chapter-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--vc) 45%, var(--line)); }
.chapter-card:hover::before { transform: scaleY(1); }
.chapter-card:hover::after { opacity: .07; }
.chapter-card .c-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.chapter-card .c-num {
  font-family: var(--font-display); font-weight: 700; font-size: 1.7rem;
  color: var(--vc); line-height: 1; letter-spacing: -.02em;
}
.chapter-card .c-num small { font-family: var(--font-mono); font-size: .56rem; letter-spacing:.1em;
  color: var(--ink-faint); display:block; font-weight:500; margin-bottom:3px; }
.chapter-card .c-title {
  font-size: 1.04rem; font-weight: 650; line-height: 1.35; margin: 14px 0 6px;
  letter-spacing: -.01em; color: var(--ink);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.chapter-card .c-en {
  font-family: var(--font-display); font-style: italic; font-size: .82rem;
  color: var(--ink-faint); line-height: 1.3; margin-bottom: 14px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.chapter-card .c-foot {
  margin-top: auto; display: flex; align-items: center; gap: 12px;
  font-family: var(--font-mono); font-size: .68rem; color: var(--ink-faint);
  letter-spacing: .03em; padding-top: 8px; border-top: 1px solid var(--line-soft);
}
.chapter-card .c-foot .pill { display: inline-flex; align-items: center; gap: 5px; }
.chapter-card .c-foot svg { width: 13px; height: 13px; opacity: .7; }
.chapter-card .c-foot .grow { flex: 1; }
.chapter-card .bookmark {
  position: absolute; top: 14px; right: 14px; width: 30px; height: 30px;
  border-radius: 9px; border: 1px solid transparent; background: transparent;
  display: grid; place-items: center; cursor: pointer; color: var(--ink-faint);
  transition: .2s var(--ease); z-index: 3;
}
.chapter-card .bookmark:hover { background: var(--surface-2); color: var(--coral); }
.chapter-card .bookmark:focus-visible, .chip:focus-visible { outline: 2px solid var(--coral); outline-offset: 2px; }
.chapter-card .bookmark svg { width: 16px; height: 16px; }
.chapter-card.is-saved .bookmark { color: var(--coral); }
.chapter-card.is-saved .bookmark svg { fill: var(--coral); }
.chapter-card.is-read .c-num::after {
  content: "✓"; font-family: var(--font-body); font-size: .8rem; color: #fff;
  background: var(--teal); width: 18px; height: 18px; border-radius: 50%;
  display: inline-grid; place-items: center; margin-left: 8px; vertical-align: middle;
}
.no-results { text-align: center; padding: 80px 20px; color: var(--ink-faint);
  font-family: var(--font-mono); letter-spacing: .05em; display: none; }

/* ============================================================
   READER
   ============================================================ */
.progress-bar {
  position: fixed; top: 0; left: 0; height: 3px; width: 0;
  background: linear-gradient(90deg, var(--vc), var(--coral)); z-index: 70;
  box-shadow: 0 0 12px var(--vc); transition: width .08s linear;
}
.reader-top .crumb { font-family: var(--font-mono); font-size: .76rem; color: var(--ink-soft);
  display: flex; align-items: center; gap: 8px; }
.reader-top .crumb b { color: var(--vc); }

.article { max-width: 1280px; margin: 0 auto; padding: 0 clamp(18px,4vw,48px); }

.article-head {
  position: relative; padding: clamp(40px,7vw,78px) 0 clamp(28px,4vw,40px);
  border-bottom: 1px solid var(--line);
}
.article-head .kicker {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  font-family: var(--font-mono); font-size: .74rem; letter-spacing: .14em;
  text-transform: uppercase; color: var(--ink-faint); margin-bottom: 22px;
}
.vol-tag {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 13px;
  border-radius: 100px; color: #fff; font-weight: 600; letter-spacing: .1em;
  background: var(--vc);
}
.article-head h1 {
  font-size: clamp(2rem, 5.2vw, 3.5rem); line-height: 1.08; letter-spacing: -.025em;
  font-weight: 800; margin: 0 0 .4em; max-width: 19ch; color: var(--ink);
}
.article-head .title-en {
  font-family: var(--font-display); font-style: italic; font-weight: 500;
  font-size: clamp(1.05rem, 2.4vw, 1.5rem); color: var(--teal-2); line-height: 1.3;
  margin: 0 0 1.3em; max-width: 40ch;
}
.article-head .byline { font-size: .95rem; color: var(--ink-soft); line-height: 1.5; max-width: 60ch; }
.article-head .byline .who { color: var(--ink); font-weight: 600; }
.article-head .metarow {
  display: flex; gap: 10px 22px; flex-wrap: wrap; margin-top: 20px;
  font-family: var(--font-mono); font-size: .76rem; color: var(--ink-faint); letter-spacing: .02em;
}
.article-head .metarow .m { display: inline-flex; align-items: center; gap: 7px; }
.article-head .metarow svg { width: 14px; height: 14px; }
.overview {
  margin-top: 30px; padding: 22px 26px; border-radius: var(--radius);
  background: linear-gradient(120deg, var(--teal-ghost), transparent);
  border: 1px solid var(--line); border-left: 4px solid var(--teal);
  font-size: 1.12rem; line-height: 1.78; color: var(--ink-soft);
}
.overview b, .overview strong { color: var(--ink); }
.overview .ov-label { font-family: var(--font-mono); font-size: .68rem; letter-spacing: .2em;
  text-transform: uppercase; color: var(--teal-2); display: block; margin-bottom: 9px; font-weight: 600; }

/* layout: prose + sticky TOC */
.article-body { display: grid; grid-template-columns: 1fr; gap: 0; position: relative; }
@media (min-width: 1080px) {
  .article-body { grid-template-columns: 232px 1fr; gap: 56px; align-items: start; }
}
.toc {
  display: none; position: sticky; top: 92px; align-self: start;
  max-height: calc(100vh - 120px); overflow-y: auto; padding: 6px 0 30px;
  font-size: .84rem;
}
@media (min-width: 1080px) { .toc { display: block; } }
.toc .toc-label { font-family: var(--font-mono); font-size: .64rem; letter-spacing: .2em;
  text-transform: uppercase; color: var(--ink-faint); margin: 16px 0 14px; }
.toc a {
  display: block; padding: 5px 12px; color: var(--ink-faint); line-height: 1.35;
  border-left: 2px solid var(--line); transition: .2s var(--ease); margin-bottom: 1px;
}
.toc a.lvl3 { padding-left: 24px; font-size: .8rem; }
.toc a:hover { color: var(--ink); border-color: var(--ink-soft); }
.toc a.active { color: var(--vc); border-color: var(--vc); font-weight: 600;
  background: linear-gradient(90deg, var(--teal-ghost), transparent); }

/* ---------- prose ---------- */
.prose { max-width: var(--measure); padding-bottom: 30px; }
.prose > * { animation: rise .7s var(--ease) both; }

.prose h2 {
  font-size: clamp(1.45rem, 3vw, 2rem); font-weight: 760; letter-spacing: -.02em;
  line-height: 1.2; margin: 2.4em 0 .7em; padding-top: .3em; color: var(--ink);
  scroll-margin-top: 96px; position: relative;
}
.prose h2 .h2-idx {
  font-family: var(--font-display); font-style: italic; font-weight: 600;
  color: var(--vc); margin-right: .4em; font-size: .82em;
}
.prose h2::after { content:""; display:block; width:54px; height:3px; margin-top:.5em;
  background: linear-gradient(90deg, var(--vc), transparent); border-radius: 3px; }
.prose h2:first-child { margin-top: 1.2em; }
.prose h3 {
  font-size: clamp(1.12rem, 2.2vw, 1.35rem); font-weight: 700; letter-spacing: -.01em;
  margin: 1.9em 0 .5em; color: var(--ink); scroll-margin-top: 96px;
  padding-left: 16px; border-left: 3px solid var(--vc);
}
.prose p { margin: 0 0 1.2em; line-height: 1.9; color: var(--ink-soft);
  font-size: 1.16rem; letter-spacing: -.003em; }
.prose p.lead-p { font-size: 1.26rem; color: var(--ink); line-height: 1.75; }

/* inline emphasis */
.term {
  color: var(--ink); font-weight: 550;
  background: linear-gradient(transparent 62%, var(--teal-ghost) 62%);
  padding: 0 1px; border-radius: 2px; transition: background .25s var(--ease);
}
.term:hover { background: linear-gradient(transparent 0%, var(--teal-ghost) 0%); }
.pearl {
  color: #ab2f18; font-weight: 650;
  background: var(--coral-ghost); padding: .5px 5px; border-radius: 5px;
  box-decoration-break: clone; -webkit-box-decoration-break: clone;
}
html[data-theme="dark"] .pearl { color: var(--coral); }
.prose strong, .prose b { color: var(--ink); font-weight: 700; }
.prose em, .prose i { font-style: italic; }

/* lists */
.prose ul, .prose ol { margin: .4em 0 1.4em; padding-left: 0; list-style: none; }
.prose li { position: relative; padding-left: 30px; margin-bottom: .66em; line-height: 1.8;
  color: var(--ink-soft); font-size: 1.13rem; }
.prose ul > li::before {
  content: ""; position: absolute; left: 6px; top: .72em; width: 7px; height: 7px;
  border-radius: 2px; background: var(--vc); transform: rotate(45deg);
}
.prose ol { counter-reset: li; }
.prose ol > li { counter-increment: li; }
.prose ol > li::before {
  content: counter(li); position: absolute; left: 0; top: .12em;
  font-family: var(--font-mono); font-size: .72rem; font-weight: 600; color: var(--vc);
  width: 20px; height: 20px; border: 1.5px solid var(--vc); border-radius: 6px;
  display: grid; place-items: center; line-height: 1;
}
.prose li .term, .prose li .pearl { }

/* figures */
.figure {
  margin: 2.2em 0; padding: 0; border-radius: var(--radius-lg); overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.figure .fig-imgs { display: grid; gap: 2px; background: var(--line); }
.figure .fig-imgs.n2 { grid-template-columns: 1fr 1fr; }
.figure .fig-imgs.n3, .figure .fig-imgs.n4 { grid-template-columns: 1fr 1fr; }
.figure img {
  width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in;
  background: #fff; transition: filter .3s var(--ease); aspect-ratio: 4/3;
}
.figure .fig-imgs.single img { aspect-ratio: auto; max-height: 560px; object-fit: contain; }
html[data-theme="dark"] .figure img { filter: brightness(.92); }
.figure img:hover { filter: brightness(1.04); }
.figure figcaption {
  padding: 14px 20px; font-size: .9rem; line-height: 1.6; color: var(--ink-soft);
  border-top: 1px solid var(--line-soft);
}
.figure figcaption .fig-n {
  font-family: var(--font-mono); font-size: .72rem; font-weight: 600; letter-spacing: .06em;
  color: var(--vc); text-transform: uppercase; margin-right: 8px;
}
/* caption-only figure (image not embedded in source) — render as a quiet reference */
.figure-caponly { background: var(--surface-2); border-style: dashed; box-shadow: none; }
.figure-caponly figcaption { border-top: none; color: var(--ink-faint); }
.standalone-img {
  margin: 2.2em 0; border-radius: var(--radius-lg); overflow: hidden;
  border: 1px solid var(--line); box-shadow: var(--shadow); background: var(--surface);
}
.standalone-img img { width: 100%; display: block; cursor: zoom-in; background:#fff; max-height: 600px; object-fit: contain; }
html[data-theme="dark"] .standalone-img img { filter: brightness(.92); }

/* tables */
.tbl-wrap { margin: 2em 0; overflow-x: auto; border-radius: var(--radius);
  border: 1px solid var(--line); box-shadow: var(--shadow); background: var(--surface); }
.tbl-cap { padding: 13px 18px; font-size: .9rem; line-height: 1.55; color: var(--ink-soft);
  border-bottom: 1px solid var(--line-soft); background: var(--surface-2); }
.tbl-cap .fig-n { font-family: var(--font-mono); font-size: .72rem; font-weight: 600;
  letter-spacing: .06em; color: var(--vc); text-transform: uppercase; margin-right: 8px; }
table.data {
  width: 100%; border-collapse: collapse; font-size: .92rem; background: var(--surface);
}
table.data th, table.data td { padding: 12px 16px; text-align: left; vertical-align: top;
  border-bottom: 1px solid var(--line-soft); line-height: 1.55; }
table.data thead th, table.data tr:first-child td:only-child,
table.data .thead td {
  background: var(--vc); color: #fff; font-weight: 650; letter-spacing: .01em;
  font-family: var(--font-body); border: none;
}
table.data tbody tr:hover { background: var(--surface-2); }
table.data .term, table.data .pearl { }

/* callout / note */
.note {
  margin: 1.4em 0; padding: 14px 18px; font-size: .92rem; color: var(--ink-faint);
  background: var(--surface-2); border-radius: 12px; line-height: 1.6;
  border: 1px dashed var(--line);
}

/* references */
.references {
  margin: 3em 0 1em; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); overflow: hidden;
}
.references summary {
  cursor: pointer; list-style: none; padding: 18px 22px; font-weight: 650;
  display: flex; align-items: center; gap: 12px; font-size: 1rem; color: var(--ink);
}
.references summary::-webkit-details-marker { display: none; }
.references summary .chev { transition: transform .3s var(--ease); color: var(--ink-faint); display:inline-flex; }
.references[open] summary .chev { transform: rotate(90deg); }
.references summary .cnt { font-family: var(--font-mono); font-size: .76rem; color: var(--vc);
  margin-left: auto; }
.references ol { margin: 0; padding: 4px 22px 22px 22px; counter-reset: ref; list-style: none; }
.references li { counter-increment: ref; position: relative; padding-left: 36px;
  margin-bottom: 12px; font-size: .82rem; line-height: 1.55; color: var(--ink-faint);
  font-family: var(--font-body); }
.references li::before {
  content: counter(ref); position: absolute; left: 0; top: 1px;
  font-family: var(--font-mono); font-size: .68rem; color: var(--ink-soft);
  background: var(--surface-2); border-radius: 5px; padding: 2px 6px; min-width: 24px; text-align:center;
}

/* colophon */
.colophon {
  margin: 3em 0 1em; padding: 18px 22px; font-size: .85rem; line-height: 1.65;
  color: var(--ink-faint); border-radius: var(--radius);
  background: var(--surface-2); border: 1px solid var(--line-soft);
}
.colophon::before { content: "✦ 정리본 안내"; display:block; font-family: var(--font-mono);
  font-size: .66rem; letter-spacing: .14em; color: var(--ink-soft); margin-bottom: 8px; }

/* chapter nav */
.chapter-nav {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
  margin: 50px 0 90px; padding-top: 30px; border-top: 1px solid var(--line);
}
.chapter-nav a {
  display: flex; flex-direction: column; gap: 6px; padding: 20px 22px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  transition: .25s var(--ease); box-shadow: var(--shadow);
}
.chapter-nav a:hover { transform: translateY(-3px); border-color: var(--vc); box-shadow: var(--shadow-lg); }
.chapter-nav a.next { text-align: right; }
.chapter-nav .dir { font-family: var(--font-mono); font-size: .7rem; letter-spacing: .14em;
  text-transform: uppercase; color: var(--ink-faint); }
.chapter-nav .nt { font-weight: 600; line-height: 1.35; color: var(--ink);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.chapter-nav a.disabled { opacity: .4; pointer-events: none; }

/* to top */
.to-top {
  position: fixed; right: 24px; bottom: 24px; width: 46px; height: 46px; z-index: 55;
  border-radius: 14px; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); display: grid; place-items: center; cursor: pointer;
  box-shadow: var(--shadow-lg); opacity: 0; transform: translateY(14px) scale(.9);
  pointer-events: none; transition: .3s var(--ease);
}
.to-top.show { opacity: 1; transform: none; pointer-events: auto; }
.to-top:hover { color: var(--vc); border-color: var(--vc); }
.to-top:focus-visible { outline: 2px solid var(--vc); outline-offset: 3px; }

/* lightbox */
.lightbox {
  position: fixed; inset: 0; z-index: 100; background: rgba(8,12,18,.92);
  backdrop-filter: blur(8px); display: none; place-items: center; cursor: zoom-out;
  padding: 30px; opacity: 0; transition: opacity .25s var(--ease);
}
.lightbox.show { display: grid; opacity: 1; }
.lightbox img { max-width: 96vw; max-height: 92vh; border-radius: 10px;
  box-shadow: 0 40px 120px rgba(0,0,0,.6); animation: pop .3s var(--ease); }

/* footer */
.site-foot {
  border-top: 1px solid var(--line); padding: 50px clamp(18px,4vw,48px);
  max-width: var(--maxw); margin: 0 auto; color: var(--ink-faint);
  font-size: .85rem; display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap;
}
.site-foot .fbrand { font-family: var(--font-display); font-weight: 800; letter-spacing: .14em;
  color: var(--ink-soft); }
.site-foot a:hover { color: var(--teal); }

/* ---------- animations ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity:0; transform: scale(.94); } to { opacity:1; transform:none; } }
@keyframes floaty { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-12px)} }

.js .reveal { opacity: 0; transform: translateY(30px); transition: opacity .8s var(--ease), transform .8s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
.stagger > * { opacity: 0; transform: translateY(24px); animation: rise .7s var(--ease) forwards; }

@media (prefers-reduced-motion: reduce) {
  .prose > *, .stagger > *, .reveal { animation: none !important; opacity: 1 !important; transform: none !important; transition: none !important; }
}

/* ============================================================
   STUDY TOOLS — highlighter, notes, study panel, quiz
   ============================================================ */
/* pastel highlighter marks */
mark.hl {
  background: var(--hlc, #fff19a); color: #20242b; border-radius: 3px;
  padding: 0 1.5px; cursor: pointer; transition: filter .15s var(--ease);
  box-decoration-break: clone; -webkit-box-decoration-break: clone;
}
mark.hl * { color: #20242b !important; }
mark.hl:hover { filter: brightness(.95) saturate(1.15); }
mark.hl.has-note { box-shadow: inset 0 -0.35em 0 rgba(0,0,0,.16); }
.hl-y { --hlc: #fff09a; } .hl-p { --hlc: #ffc1d0; } .hl-g { --hlc: #b9efc8; }
.hl-b { --hlc: #bfe2ff; } .hl-v { --hlc: #e2cdff; } .hl-o { --hlc: #ffd9a8; }

/* selection popup */
.hl-pop {
  position: absolute; z-index: 95; background: var(--surface);
  border: 1px solid var(--line); border-radius: 13px; box-shadow: var(--shadow-lg);
  padding: 7px 8px; display: flex; gap: 6px; align-items: center;
  opacity: 0; transform: translateY(6px) scale(.96); pointer-events: none;
  transition: opacity .16s var(--ease), transform .16s var(--ease);
}
.hl-pop.show { opacity: 1; transform: none; pointer-events: auto; }
.hl-pop .sw { width: 25px; height: 25px; border-radius: 8px; cursor: pointer;
  border: 1px solid rgba(0,0,0,.12); transition: transform .14s var(--ease); }
.hl-pop .sw:hover { transform: scale(1.16) rotate(-4deg); }
.hl-pop .sw.sel { box-shadow: 0 0 0 2px var(--ink); }
.hl-pop .sep { width: 1px; height: 22px; background: var(--line); margin: 0 2px; }
.hl-pop .pbtn { border: none; background: var(--surface-2); color: var(--ink-soft);
  font-family: var(--font-body); font-size: .78rem; padding: 5px 10px; border-radius: 8px;
  cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.hl-pop .pbtn:hover { background: var(--teal-ghost); color: var(--teal-2); }
.hl-pop .pbtn.del:hover { background: var(--coral-ghost); color: var(--coral); }
.hl-pop .pbtn svg { width: 14px; height: 14px; }

/* study panel (right) */
.studypanel {
  position: fixed; top: 0; right: 0; width: 400px; max-width: 94vw; height: 100vh; height: 100dvh;
  z-index: 82; background: var(--surface); border-left: 1px solid var(--line);
  display: flex; flex-direction: column; box-shadow: var(--shadow-lg);
  transform: translateX(101%); transition: transform .34s var(--ease);
}
html.study-open .studypanel { transform: none; }
.study-backdrop { position: fixed; inset: 0; z-index: 81; background: rgba(8,12,18,.42);
  backdrop-filter: blur(2px); opacity: 0; pointer-events: none; transition: opacity .3s var(--ease); }
html.study-open .study-backdrop { opacity: 1; pointer-events: auto; }
.sp-head { flex: none; padding: 16px 16px 0; border-bottom: 1px solid var(--line-soft); }
.sp-titlerow { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.sp-titlerow .sp-t { font-family: var(--font-display); font-weight: 800; font-size: 1.1rem; letter-spacing: .02em; }
.sp-titlerow .icon-btn { margin-left: auto; }
.sp-tabs { display: flex; gap: 4px; }
.sp-tab { border: none; background: transparent; cursor: pointer; padding: 9px 13px 11px;
  font-family: var(--font-body); font-size: .86rem; color: var(--ink-faint); font-weight: 600;
  border-bottom: 2px solid transparent; display: inline-flex; align-items: center; gap: 6px; }
.sp-tab:hover { color: var(--ink); }
.sp-tab.active { color: var(--vc); border-bottom-color: var(--vc); }
.sp-tab .cnt { font-family: var(--font-mono); font-size: .66rem; background: var(--surface-2);
  padding: 1px 6px; border-radius: 20px; }
.sp-body { flex: 1; overflow-y: auto; padding: 16px; }
.sp-pane { display: none; }
.sp-pane.active { display: block; animation: rise .4s var(--ease) both; }
.sp-empty { color: var(--ink-faint); font-size: .88rem; text-align: center; padding: 40px 16px; line-height: 1.7; }

/* highlight list items */
.hl-item { display: flex; gap: 10px; padding: 11px 12px; border-radius: 11px;
  border: 1px solid var(--line-soft); margin-bottom: 9px; cursor: pointer; background: var(--surface);
  transition: .2s var(--ease); }
.hl-item:hover { border-color: var(--vc); transform: translateX(2px); }
.hl-item .hl-bar { width: 5px; border-radius: 4px; flex: none; background: var(--hlc); }
.hl-item .hl-txt { font-size: .9rem; line-height: 1.5; color: var(--ink); }
.hl-item .hl-note { margin-top: 5px; font-size: .8rem; color: var(--ink-faint);
  border-left: 2px solid var(--line); padding-left: 8px; }

/* memo */
.memo-area { width: 100%; min-height: 320px; resize: vertical; border: 1px solid var(--line);
  border-radius: 13px; background: var(--surface-2); color: var(--ink); padding: 14px 15px;
  font-family: var(--font-body); font-size: .95rem; line-height: 1.75; outline: none; }
.memo-area:focus-visible { border-color: var(--teal); outline: 2px solid var(--teal); outline-offset: 1px; }
.memo-saved { font-family: var(--font-mono); font-size: .7rem; color: var(--ink-faint); margin-top: 8px; }

/* quiz */
.quiz-q { border: 1px solid var(--line); border-radius: 14px; padding: 16px 16px 14px;
  margin-bottom: 16px; background: var(--surface); }
.quiz-q .qn { font-family: var(--font-mono); font-size: .68rem; color: var(--vc); letter-spacing: .08em;
  text-transform: uppercase; margin-bottom: 7px; display: flex; align-items: center; gap: 8px; }
.quiz-q .qtext { font-weight: 650; line-height: 1.55; margin-bottom: 12px; color: var(--ink); font-size: 1.02rem; }
.quiz-choices { display: flex; flex-direction: column; gap: 8px; }
.quiz-choice { text-align: left; border: 1px solid var(--line); background: var(--surface-2);
  border-radius: 10px; padding: 11px 13px; cursor: pointer; font-family: var(--font-body);
  font-size: .92rem; color: var(--ink-soft); line-height: 1.45; display: flex; gap: 10px;
  transition: .16s var(--ease); }
.quiz-choice:hover:not(:disabled) { border-color: var(--vc); color: var(--ink); }
.quiz-choice .ck { font-family: var(--font-mono); font-size: .74rem; font-weight: 600; color: var(--ink-faint);
  border: 1.5px solid var(--line); border-radius: 6px; width: 22px; height: 22px; flex: none;
  display: grid; place-items: center; }
.quiz-choice.correct { border-color: var(--teal); background: var(--teal-ghost); color: var(--ink); }
.quiz-choice.correct .ck { border-color: var(--teal); background: var(--teal); color: #fff; }
.quiz-choice.wrong { border-color: var(--coral); background: var(--coral-ghost); }
.quiz-choice.wrong .ck { border-color: var(--coral); background: var(--coral); color: #fff; }
.quiz-choice:disabled { cursor: default; }
.quiz-exp { margin-top: 12px; padding: 12px 14px; border-radius: 11px; font-size: .88rem; line-height: 1.6;
  background: var(--surface-2); border: 1px solid var(--line-soft); display: none; }
.quiz-exp.show { display: block; animation: rise .35s var(--ease) both; }
.quiz-exp .lbl { font-family: var(--font-mono); font-size: .64rem; letter-spacing: .12em; text-transform: uppercase;
  font-weight: 600; margin-right: 7px; }
.quiz-exp .lbl.ok { color: var(--teal-2); } .quiz-exp .lbl.no { color: var(--coral); }
.quiz-exp .ev { display: block; margin-top: 7px; color: var(--ink-faint); font-size: .82rem;
  border-left: 2px solid var(--vc); padding-left: 9px; }
.quiz-score { font-family: var(--font-mono); font-size: .8rem; color: var(--ink-soft);
  padding: 10px 0 16px; display: flex; align-items: center; gap: 10px; }
.quiz-score b { color: var(--vc); font-size: 1.1rem; }

/* topbar study buttons */
.icon-btn.hl-on { color: var(--coral); border-color: var(--coral); }

/* ============================================================
   STUDY PAGE (내 학습)
   ============================================================ */
.study-wrap { max-width: 980px; margin: 0 auto; padding: clamp(30px,6vw,60px) clamp(18px,4vw,48px) 90px; }
.study-wrap h1 { font-size: clamp(2rem,5vw,3rem); font-weight: 800; letter-spacing: -.02em; margin: 0 0 .2em; }
.study-wrap h1 .o { -webkit-text-fill-color: var(--coral); color: var(--coral); font-style: italic; font-family: var(--font-display); }
.study-lead { color: var(--ink-soft); font-size: 1.05rem; margin-bottom: 30px; }
.study-stats { display: flex; gap: clamp(18px,4vw,40px); flex-wrap: wrap; margin-bottom: 36px; }
.study-stats .num { font-family: var(--font-display); font-weight: 700; font-size: 2.2rem; }
.study-stats .num.c { color: var(--coral); } .study-stats .num.t { color: var(--teal); }
.study-stats .lbl { font-family: var(--font-mono); font-size: .66rem; letter-spacing: .14em;
  text-transform: uppercase; color: var(--ink-faint); margin-top: 4px; }
.study-sec { margin-bottom: 48px; }
.study-sec > h2 { font-size: 1.5rem; font-weight: 750; letter-spacing: -.01em; margin: 0 0 4px;
  display: flex; align-items: center; gap: 10px; }
.study-sec > h2 .badge { font-family: var(--font-mono); font-size: .72rem; color: #fff; background: var(--ink-soft);
  border-radius: 20px; padding: 2px 9px; }
.study-sec .seclead { color: var(--ink-faint); font-size: .9rem; margin: 0 0 18px; }
.study-ch { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 14px; overflow: hidden;
  background: var(--surface); }
.study-ch .ch-head { display: flex; align-items: center; gap: 10px; padding: 13px 16px;
  background: var(--surface-2); border-bottom: 1px solid var(--line-soft); }
.study-ch .ch-head a { font-weight: 650; color: var(--ink); }
.study-ch .ch-head a:hover { color: var(--teal); }
.study-ch .ch-head .vtag { font-family: var(--font-mono); font-size: .64rem; color: #fff; padding: 2px 8px;
  border-radius: 20px; }
.study-ch .ch-body { padding: 12px 16px; }
.study-hl { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.study-hl:last-child { border-bottom: none; }
.study-hl .bar { width: 5px; border-radius: 4px; flex: none; background: var(--hlc); }
.study-hl .t { font-size: .95rem; line-height: 1.55; }
.study-hl .n { color: var(--ink-faint); font-size: .84rem; margin-top: 4px; border-left: 2px solid var(--line); padding-left: 8px; }
.study-memo { white-space: pre-wrap; font-size: .94rem; line-height: 1.7; color: var(--ink-soft); }
.empty-big { text-align: center; padding: 60px 20px; color: var(--ink-faint); }
.empty-big svg { width: 48px; height: 48px; opacity: .4; margin-bottom: 14px; }
.study-wrap { --vc: var(--teal); }

/* ============================================================
   GAMIFICATION — daily quiz, combo, review, badges, focus, mascot
   ============================================================ */
/* home daily prompt */
.daily-home { margin-bottom: 24px; }
.daily-card { display: flex; align-items: center; gap: 16px; padding: 18px 22px; border-radius: var(--radius-lg);
  background: linear-gradient(120deg, var(--teal-ghost), var(--coral-ghost) 90%); border: 1px solid var(--line);
  box-shadow: var(--shadow); transition: transform .25s var(--ease), box-shadow .25s var(--ease); }
.daily-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.daily-card .dc-emoji { font-size: 2.1rem; flex: none; }
.daily-card .dc-t { font-weight: 750; font-size: 1.12rem; color: var(--ink); }
.daily-card .dc-s { color: var(--ink-soft); font-size: .9rem; margin-top: 2px; }
.daily-card .dc-streak { margin-left: auto; font-family: var(--font-mono); font-size: .82rem; color: var(--coral); white-space: nowrap; }
.daily-card .dc-streak b { font-size: 1.3rem; }

/* home — earned badges showcase */
.home-badges { margin-bottom: 26px; padding: 18px 22px 20px; border-radius: var(--radius-lg);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.hb-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 15px; }
.hb-title { font-weight: 700; font-size: 1.06rem; color: var(--ink); }
.hb-title b { color: var(--teal); }
.hb-tot { color: var(--ink-faint); font-weight: 500; font-size: .9rem; }
.hb-link { font-size: .85rem; color: var(--teal); font-weight: 600; white-space: nowrap; }
.hb-link:hover { color: var(--coral); }
.hb-row { display: flex; flex-wrap: wrap; gap: 16px 14px; }
.hb-medal { display: flex; flex-direction: column; align-items: center; gap: 5px; width: 66px; text-align: center; }
.hb-medal .b-medal { width: 48px; height: 48px; margin: 0; }
.hb-medal .b-ic { font-size: 1.2rem; }
.hb-medal .b-shape { animation: badge-in .5s var(--ease) both; }
.hb-medal .hb-name { font-size: .64rem; color: var(--ink-faint); line-height: 1.2;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hb-medal:hover .b-medal { transform: translateY(-3px); transition: transform .2s var(--ease); }
.hb-empty { color: var(--ink-faint); font-size: .9rem; padding: 4px 0 2px; }

/* daily quiz */
.dq-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.dq-title { font-family: var(--font-display); font-weight: 800; font-size: 1.4rem; }
.dq-sub { color: var(--ink-faint); font-size: .8rem; font-family: var(--font-mono); margin-top: 2px; }
.dq-combo { font-family: var(--font-mono); font-size: .82rem; color: var(--ink-faint); padding: 9px 16px;
  border-radius: 100px; border: 1px solid var(--line); transition: .2s var(--ease); }
.dq-combo.on { color: #fff; background: linear-gradient(90deg, var(--coral), var(--amber)); border-color: transparent; }
.dq-combo .cm-n { font-weight: 800; font-size: 1.15rem; }
.dq-combo.pulse { animation: combopulse .5s var(--ease); }
@keyframes combopulse { 0% { transform: scale(1); } 40% { transform: scale(1.28); } 100% { transform: scale(1); } }
.dq-score { margin-top: 12px; padding: 16px; text-align: center; font-size: .98rem; color: var(--ink-soft);
  background: var(--surface-2); border-radius: var(--radius); }
.dq-score b { color: var(--teal); }
.quiz-exp .ex { color: inherit; }

/* review (SRS) */
.rv-head, .bg-head { font-size: 1rem; color: var(--ink-soft); margin-bottom: 16px; }
.rv-head b, .bg-head b { color: var(--teal); font-size: 1.1rem; }
.rv-card { border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-bottom: 14px; background: var(--surface); }
.rv-ch { font-family: var(--font-mono); font-size: .68rem; color: var(--ink-faint); margin-bottom: 9px; }
.rv-hltext { font-size: 1.06rem; line-height: 1.6; background: var(--hlc, #fff09a); color: #20242b; padding: 11px 15px; border-radius: 11px; }
.rv-note { margin-top: 11px; color: var(--ink-soft); font-size: .9rem; line-height: 1.6; }
.rv-actions { margin-top: 13px; display: flex; gap: 10px; }
.rv-reveal, .rv-ok, .rv-no { border: 1px solid var(--line); background: var(--surface-2); border-radius: 10px;
  padding: 10px 18px; cursor: pointer; font-family: var(--font-body); font-size: .9rem; font-weight: 600; color: var(--ink); transition: .15s var(--ease); }
.rv-reveal:hover { border-color: var(--teal); color: var(--teal); }
.rv-rate { display: flex; gap: 10px; }
.rv-ok:hover { border-color: var(--teal); color: var(--teal); }
.rv-no:hover { border-color: var(--coral); color: var(--coral); }
.rv-card.graded { transition: opacity .4s; }

/* badges — collectible medals with varied shapes */
.bg-head { font-size: 1.05rem; color: var(--ink-soft); margin-bottom: 8px; }
.bg-head b { color: var(--teal); font-size: 1.3rem; }
.bg-pct { color: var(--ink-faint); font-size: .9rem; }
.bg-allbar { height: 9px; border-radius: 9px; background: var(--surface-2); overflow: hidden; margin: 0 0 26px; }
.bg-allbar i { display: block; height: 100%; border-radius: 9px;
  background: linear-gradient(90deg, var(--teal), var(--amber), var(--coral)); transition: width .6s var(--ease); }
.bg-cat { margin-bottom: 26px; }
.bg-cat-h { font-weight: 700; font-size: 1.05rem; margin-bottom: 13px; display: flex; align-items: center; gap: 9px; }
.bg-cat-h span { font-family: var(--font-mono); font-size: .72rem; color: var(--ink-faint);
  background: var(--surface-2); padding: 2px 9px; border-radius: 20px; }
.bg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(116px, 1fr)); gap: 13px; }
.badge { text-align: center; padding: 16px 8px 13px; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--surface); transition: .25s var(--ease); }
.badge:not(.got) { opacity: .7; background: var(--surface-2); }
.badge:not(.got) .b-medal { filter: grayscale(1); opacity: .45; }
.badge.got:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.b-medal { position: relative; width: 60px; height: 60px; margin: 0 auto 9px; color: var(--bc, var(--teal)); }
.b-shape { width: 100%; height: 100%; fill: currentColor; display: block; filter: drop-shadow(0 3px 5px rgba(0,0,0,.2)); }
.badge.got .b-shape { animation: badge-in .55s var(--ease) both; }
@keyframes badge-in { 0% { transform: scale(0) rotate(-45deg); } 55% { transform: scale(1.18) rotate(8deg); } 100% { transform: scale(1) rotate(0); } }
.b-medal .b-ic { position: absolute; inset: 0; display: grid; place-items: center; font-size: 1.5rem; line-height: 1;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,.35)); }
.badge:not(.got) .b-ic { filter: none; }
.b-name { font-weight: 700; font-size: .84rem; color: var(--ink); line-height: 1.25; }
.b-desc { font-size: .68rem; color: var(--ink-faint); margin-top: 4px; line-height: 1.35; }
.b-date { font-family: var(--font-mono); font-size: .6rem; color: var(--teal); margin-top: 5px; }

/* per-chapter reset (sidebar) */
.bn-curprog .cp-reset { margin-top: 11px; width: 100%; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink-faint); font-family: var(--font-body); font-size: .76rem; padding: 8px; border-radius: 9px;
  cursor: pointer; transition: .15s var(--ease); }
.bn-curprog .cp-reset:hover { border-color: var(--coral); color: var(--coral); }
.bn-curprog .cp-reset[data-armed] { background: var(--coral); color: #fff; border-color: var(--coral); }

/* progress management (study page) */
.study-manage { margin-top: 52px; padding: 24px; border: 1px dashed var(--line); border-radius: var(--radius); background: var(--surface-2); }
.study-manage h2 { font-size: 1.2rem; font-weight: 750; margin: 0 0 8px; }
.study-manage > p { color: var(--ink-soft); font-size: .9rem; margin: 0 0 16px; line-height: 1.6; }
.study-manage .mng-hint { color: var(--ink-faint); font-size: .82rem; margin: 15px 0 0; }
.manage-row { display: flex; flex-wrap: wrap; gap: 10px; }
.mng-btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); font-family: var(--font-body); font-size: .86rem; font-weight: 600; padding: 10px 16px;
  border-radius: 10px; cursor: pointer; transition: .15s var(--ease); }
.mng-btn:hover { border-color: var(--coral); color: var(--coral); }
.mng-btn .d { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.mng-btn.danger { border-color: color-mix(in srgb, var(--coral) 40%, var(--line)); color: var(--coral); }
.mng-btn.danger:hover { background: var(--coral); color: #fff; }
.mng-btn[data-armed] { background: var(--coral); color: #fff; border-color: var(--coral); }

/* focus mode */
html.focus-mode body { padding-left: 0 !important; }
html.focus-mode .topbar { transform: translateY(-115%); }
html.focus-mode .booknav { transform: translateX(-101%) !important; }
html.focus-mode .nav-backdrop, html.focus-mode .osteo, html.focus-mode .to-top,
html.focus-mode .studypanel, html.focus-mode .study-backdrop { display: none !important; }
html.focus-mode .reader .toc { display: none; }
html.focus-mode .article-body { grid-template-columns: 1fr !important; }
html.focus-mode .article { max-width: 800px; }
html.focus-mode .grain { opacity: .12; }
html.focus-mode body::before { opacity: .35; }
.focus-bar { position: fixed; top: 16px; left: 50%; transform: translateX(-50%) translateY(-90px); z-index: 120;
  display: flex; align-items: center; gap: 14px; background: var(--ink); color: var(--bg);
  padding: 9px 9px 9px 18px; border-radius: 100px; box-shadow: var(--shadow-lg);
  opacity: 0; transition: transform .4s var(--ease), opacity .4s var(--ease); pointer-events: none; }
html.focus-mode .focus-bar { transform: translateX(-50%) translateY(0); opacity: 1; pointer-events: auto; }
.focus-pulse { width: 9px; height: 9px; border-radius: 50%; background: var(--teal); animation: fpulse 2s infinite; }
@keyframes fpulse { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
.focus-time { font-family: var(--font-mono); font-weight: 600; font-size: 1rem; min-width: 56px; }
.focus-exit { border: none; background: rgba(255,255,255,.16); color: var(--bg); border-radius: 100px;
  padding: 8px 16px; cursor: pointer; font-family: var(--font-body); font-size: .84rem; font-weight: 600; }
.focus-exit:hover { background: rgba(255,255,255,.3); }

/* mascot 'osteo' */
.osteo { position: fixed; right: 22px; bottom: 22px; z-index: 90; display: flex; flex-direction: column; align-items: flex-end; gap: 9px; }
.osteo-char { width: 66px; height: 66px; border: none; background: none; padding: 0; cursor: pointer;
  filter: drop-shadow(0 7px 16px rgba(0,0,0,.2)); transition: transform .2s var(--ease); animation: obob 4s ease-in-out infinite; }
.osteo-char svg { width: 100%; height: 100%; display: block; }
.osteo-char:hover { transform: scale(1.09) rotate(-4deg); }
.osteo.bounce .osteo-char { animation: obounce .6s var(--ease); }
@keyframes obob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes obounce { 0%, 100% { transform: scale(1); } 30% { transform: scale(1.18) rotate(-8deg); } 60% { transform: scale(.95); } }
.osteo .o-eye { animation: oblink 4.5s infinite; transform-box: fill-box; transform-origin: center; }
@keyframes oblink { 0%, 92%, 100% { transform: scaleY(1); } 96% { transform: scaleY(.12); } }
.osteo.hot .osteo-char { animation: obob 2.1s ease-in-out infinite; }
.osteo-bubble { max-width: 232px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px 16px 4px 16px; padding: 11px 15px; font-size: .86rem; line-height: 1.5; color: var(--ink);
  box-shadow: var(--shadow-lg); opacity: 0; transform: translateY(8px) scale(.95); transform-origin: bottom right;
  transition: .28s var(--ease); pointer-events: none; }
.osteo-bubble.show { opacity: 1; transform: none; }
.osteo-bubble:empty { display: none; }
.osteo-hide { position: absolute; top: -4px; right: -4px; width: 20px; height: 20px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-faint); font-size: .85rem; line-height: 1;
  cursor: pointer; display: grid; place-items: center; opacity: 0; transition: opacity .2s; }
.osteo:hover .osteo-hide { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .osteo-char { animation: none; } .osteo .o-eye { animation: none; } }
@media (max-width: 620px) { .osteo { right: 14px; bottom: 14px; } .osteo-char { width: 54px; height: 54px; } }

/* ---------- login page ---------- */
.login-page { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login-wrap { width: 100%; display: grid; place-items: center; }
.login-card { width: 100%; max-width: 388px; text-align: center; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 42px 36px 34px; box-shadow: var(--shadow-lg); }
.login-mark { display: inline-grid; place-items: center; width: 58px; height: 58px; border-radius: 17px;
  background: linear-gradient(140deg, var(--teal), var(--teal-2)); color: #fff; margin-bottom: 18px; box-shadow: var(--shadow); }
.login-mark svg { width: 33px; height: 33px; }
.login-logo { font-family: var(--font-display); font-weight: 900; letter-spacing: .16em; font-size: 2.1rem; margin: 0 0 12px;
  background: linear-gradient(100deg, var(--ink), var(--teal-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.login-sub { color: var(--ink-soft); font-size: .93rem; line-height: 1.65; margin: 0 0 26px; }
.login-sub b { color: var(--ink); font-weight: 650; }
.login-form { display: flex; flex-direction: column; gap: 11px; }
.login-form input { padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2);
  font-family: var(--font-body); font-size: 1.02rem; color: var(--ink); outline: none; text-align: center; }
.login-form input:focus-visible { border-color: var(--teal); outline: 2px solid var(--teal); outline-offset: 1px; }
.login-form button { padding: 14px; border: none; border-radius: 12px; background: var(--teal); color: #fff;
  font-family: var(--font-body); font-weight: 700; font-size: 1.02rem; cursor: pointer; transition: .2s var(--ease); }
.login-form button:hover { background: var(--teal-2); transform: translateY(-1px); }
.login-err { color: var(--coral); font-size: .88rem; margin-top: 13px; }
.login-preview { display: inline-block; margin-top: 20px; color: var(--ink-faint); font-size: .9rem; font-weight: 500; }
.login-preview:hover { color: var(--teal); }

/* ---------- responsive ---------- */
@media (max-width: 620px) {
  body { font-size: 16px; }
  .chapter-nav { grid-template-columns: 1fr; }
  .stats { gap: 26px 36px; }
  .controls { top: 60px; }
  .vol-head { gap: 16px; }
  .search-box { min-width: min(240px, calc(100vw - 60px)); }
}
