/* Annales Mathesis · e-book 읽기 화면과 인쇄(PDF) */
:root{ --ink:#2b2318; --ink2:#5b4f3d; --paper:#fbf7ee; --line:#d9ccb2; --acc:#1d3f63; --gold:#b8862e; --bg:#2a2f38; --ui:#f6f1e6; --pw:min(92vw, calc((100vh - 120px) * .7071)); }
*{ box-sizing:border-box; }
html,body{ margin:0; }
body{ background:var(--bg); color:var(--ink); font-family:'Noto Serif KR','Nanum Myeongjo','Batang','AppleMyungjo',serif; -webkit-font-smoothing:antialiased; }
body.night{ --paper:#1d1c19; --ink:#ece3cf; --ink2:#b8ad96; --line:#4a4334; --bg:#0d0e11; }
.ab-bar{ position:sticky; top:0; z-index:10; display:flex; flex-wrap:wrap; align-items:center; gap:6px; padding:8px 12px; background:rgba(20,22,28,.92); backdrop-filter:blur(8px); color:var(--ui); font:500 14px/1 'Noto Sans KR','Malgun Gothic',sans-serif; }
.ab-bar b{ font:700 15px/1 'Times New Roman',serif; letter-spacing:.14em; margin-right:8px; color:#e8cf8e; }
.ab-bar button,.ab-bar a,.ab-bar input{ font:inherit; color:var(--ui); background:rgba(255,255,255,.08); border:1px solid rgba(255,255,255,.16); border-radius:999px; padding:7px 12px; cursor:pointer; text-decoration:none; }
.ab-bar button:hover,.ab-bar a:hover{ background:rgba(255,255,255,.18); }
.ab-bar button[aria-pressed='true']{ background:#e8cf8e; color:#1b1408; }
.ab-bar input{ width:150px; cursor:text; }
.ab-bar .sp{ flex:1; }
.ab-bar .pgno{ min-width:74px; text-align:center; font-variant-numeric:tabular-nums; }
.ab-prog{ position:sticky; top:0; height:3px; background:#e8cf8e; width:0; z-index:11; transition:width .3s; }
.ab-panel{ position:fixed; z-index:12; top:56px; left:12px; width:min(360px, calc(100vw - 24px)); max-height:calc(100vh - 80px); overflow:auto; padding:16px 18px; border-radius:16px; background:#f6f1e6; color:#2b2318; box-shadow:0 20px 50px rgba(0,0,0,.5); font-family:'Noto Sans KR','Malgun Gothic',sans-serif; }
.ab-panel h4{ margin:0 0 10px; font:700 16px/1.3 'Noto Serif KR',serif; }
.ab-panel ol,.ab-panel ul{ margin:0; padding-left:20px; } .ab-panel li{ margin:6px 0; font-size:14.5px; }
.ab-panel a{ color:#1d3f63; cursor:pointer; }
.ab-panel[hidden]{ display:none; }
.ab-book{ display:flex; justify-content:center; gap:18px; padding:24px 12px 60px; }
.ab-book.scroll{ flex-direction:column; align-items:center; }
.pg{ position:relative; width:var(--pw); aspect-ratio:210 / 297; background:var(--paper); color:var(--ink); box-shadow:0 18px 50px rgba(0,0,0,.45); overflow:hidden; container-type:inline-size; }
.ab-book:not(.scroll) .pg{ display:none; } .ab-book:not(.scroll) .pg.on{ display:block; animation:pgin .35s ease; }
@keyframes pgin{ from{ opacity:0; transform:translateX(8px); } }
body.spread .ab-book{ --pw:min(46vw, calc((100vh - 120px) * .7071)); }
.pg-in{ position:absolute; inset:0; padding:7cqw 8cqw 9cqw; display:flex; flex-direction:column; font-size:calc(2.12cqw * var(--fs, 1)); line-height:1.7; }
.pg-hd{ display:flex; justify-content:space-between; font:600 1.55cqw/1 'Times New Roman',serif; letter-spacing:.18em; color:var(--gold); border-bottom:1px solid var(--line); padding-bottom:1.6cqw; margin-bottom:3cqw; text-transform:uppercase; }
.pg-sec{ margin:0; font:700 1.9cqw/1.3 'Noto Sans KR','Malgun Gothic',sans-serif; color:var(--acc); letter-spacing:.04em; }
body.night .pg-sec{ color:#9fc2e6; }
.pg h2{ margin:1.2cqw 0 2.6cqw; font-size:4.6cqw; line-height:1.25; letter-spacing:-.02em; }
.pg p{ margin:0 0 1.4cqw; text-align:justify; word-break:keep-all; }
.pg-fig{ margin:0 0 2.4cqw; padding:2cqw; border:1px solid var(--line); border-radius:1.2cqw; color:var(--gold); background:rgba(184,134,46,.05); }
.pg-fig svg{ display:block; width:100%; height:auto; max-height:30cqw; }
body.night .pg-fig text{ fill:#ece3cf; }
.pg-box{ margin-top:auto; margin-bottom:3cqw; padding:1.8cqw 2.4cqw; border-left:.6cqw solid var(--gold); background:rgba(184,134,46,.08); border-radius:0 1cqw 1cqw 0; font-family:'Noto Sans KR','Malgun Gothic',sans-serif; font-size:1.95cqw; line-height:1.6; }
.pg-box b{ display:block; margin-bottom:.8cqw; color:var(--acc); } body.night .pg-box b{ color:#9fc2e6; }
.pg-box ul{ margin:0; padding-left:2.6cqw; }
.pg-ft{ position:absolute; left:8cqw; right:8cqw; bottom:4cqw; display:flex; justify-content:space-between; font:500 1.5cqw/1 'Times New Roman',serif; letter-spacing:.12em; color:var(--ink2); }
.pg-list{ list-style:none; margin:0; padding:0; } .pg-list li{ display:grid; grid-template-columns:22cqw 1fr; gap:2cqw; padding:1.4cqw 0; border-bottom:1px dashed var(--line); }
.pg-list li b{ color:var(--acc); font-family:'Noto Sans KR',sans-serif; font-size:.9em; } body.night .pg-list li b{ color:#9fc2e6; }
/* 표지 */
.pg.cover{ background:radial-gradient(70% 60% at 50% 38%, #2a5a86 0%, #13304d 55%, #0b1a2c 100%); color:#f6ecd6; }
.cv-in{ position:absolute; inset:0; padding:9cqw 8cqw; display:flex; flex-direction:column; align-items:center; text-align:center; }
.cv-mast{ font:700 9.2cqw/1 'Times New Roman',serif; letter-spacing:.06em; color:#f3dca3; margin:0; }
.cv-mast small{ display:block; font:600 2cqw/1 'Times New Roman',serif; letter-spacing:.5em; color:#cbb27a; margin-top:2.4cqw; }
.cv-rule{ width:70%; height:1px; background:linear-gradient(90deg,transparent,#d4a24c,transparent); margin:4cqw 0; }
.cv-zero{ width:46cqw; height:46cqw; margin:2cqw 0; }
.cv-t{ font-size:7.4cqw; font-weight:700; margin:2cqw 0 1cqw; } .cv-s{ font-size:2.6cqw; color:#d9cfb6; margin:0; }
.cv-lines{ margin-top:auto; font:500 2.1cqw/1.9 'Noto Sans KR',sans-serif; color:#e8dcc0; }
.cv-ft{ margin-top:3cqw; font:600 1.8cqw/1 'Times New Roman',serif; letter-spacing:.3em; color:#cbb27a; }
/* 차례 */
.toc li{ display:flex; gap:2cqw; align-items:baseline; padding:1.15cqw 0; border-bottom:1px dotted var(--line); cursor:pointer; }
.toc li span{ flex:1; } .toc li em{ font-style:normal; font-family:'Times New Roman',serif; color:var(--gold); }
.toc li small{ color:var(--ink2); font-family:'Noto Sans KR',sans-serif; font-size:.8em; width:24cqw; }
mark.hit{ background:#ffe08a; color:#1b1408; }
.ab-nav{ position:fixed; top:50%; z-index:9; width:52px; height:52px; border-radius:50%; border:0; background:rgba(255,255,255,.12); color:#fff; font-size:22px; cursor:pointer; transform:translateY(-50%); }
.ab-nav.prev{ left:10px; } .ab-nav.next{ right:10px; }
.ab-nav:hover{ background:rgba(255,255,255,.25); }
.ab-book.scroll ~ .ab-nav{ display:none; }
@media (max-width:700px){ .ab-bar input{ width:110px; } .ab-nav{ display:none; } }
@page{ size:A4; margin:0; }
@media print{
  body{ background:#fff; } .ab-bar,.ab-prog,.ab-panel,.ab-nav{ display:none !important; }
  .ab-book{ display:block !important; padding:0 !important; }
  .pg{ display:block !important; width:210mm !important; height:297mm !important; aspect-ratio:auto; box-shadow:none; break-after:page; page-break-after:always; animation:none !important; }
  .pg:last-child{ break-after:auto; }
  .pg.cover{ -webkit-print-color-adjust:exact; print-color-adjust:exact; }
  .pg-box,.pg-fig{ -webkit-print-color-adjust:exact; print-color-adjust:exact; }
}

/* ── 꼭지마다 다른 옷 */
.pg-body{ column-gap:4cqw; } .pg.two .pg-body{ columns:2; } .pg.two .pg-body p{ break-inside:avoid-column; }
/* 배경 그림 · 쪽의 위쪽에 깔고 아래로 갈수록 종이에 스민다 */
.pg.hasimg::before{ content:''; position:absolute; inset:0 0 auto 0; height:58%; background:var(--img) center / cover no-repeat; opacity:.22; -webkit-mask-image:linear-gradient(180deg,#000 30%,transparent); mask-image:linear-gradient(180deg,#000 30%,transparent); }
.pg.hasimg .pg-in{ z-index:1; }
/* 창간의 말 · 큰 첫 글자 */
.th-edit .pg-body p:first-child::first-letter{ float:left; font-size:7.6cqw; line-height:.9; margin:.6cqw 1.4cqw 0 0; color:var(--gold); font-weight:700; }
/* 표지 이야기 · 위쪽 색 띠(그림이 비치는)에 제목, 그림 상자는 띠에 걸치고, 큰 인용구 */
.th-story .pg-in{ padding-top:0; }
.th-story .pg-hd, .th-story .pg-sec, .th-story h2{ margin-left:-8cqw; margin-right:-8cqw; padding-left:8cqw; padding-right:8cqw; background:var(--band); }
.th-story.hasimg .pg-hd, .th-story.hasimg .pg-sec, .th-story.hasimg h2{ background:linear-gradient(90deg, var(--band) 30%, color-mix(in srgb, var(--band) 55%, transparent)), var(--img) center 30% / cover; background-attachment:local; }
.th-story.hasimg::before{ display:none; }
.th-story .pg-hd{ padding-top:5cqw; padding-bottom:1.6cqw; margin-bottom:0; color:#e8cf8e; border:0; }
.th-story .pg-sec{ padding-top:1.6cqw; color:#e8cf8e !important; }
.th-story h2{ margin-top:0; margin-bottom:3cqw; padding-top:1cqw; padding-bottom:3.4cqw; color:#fff8e6; font-size:5cqw; }
.th-story .pg-fig{ margin:-2cqw 0 2.6cqw; background:#fffaf0; border:0; box-shadow:0 2cqw 4cqw -2cqw rgba(0,0,0,.35); }
.th-story.lay1 .pg-fig{ margin-left:20cqw; } .th-story.lay0 .pg-fig{ margin-right:20cqw; }
.pg-pull{ margin:0 0 2.4cqw; padding:0 0 0 3cqw; border-left:.7cqw solid var(--band); font-size:3cqw; line-height:1.45; font-weight:700; color:var(--band); }
body.night .pg-pull{ color:#e8cf8e; }
/* 세계 수학관 · 짙은 남색, 금빛 격자 */
.th-halls{ --paper:#0f2236; --ink:#ece3cf; --ink2:#b8c4d0; --line:#2c4560; --acc:#e8cf8e; background-image:radial-gradient(60% 50% at 80% 10%, rgba(212,162,76,.18), transparent 70%), repeating-linear-gradient(0deg, transparent 0 5cqw, rgba(212,162,76,.06) 5cqw calc(5cqw + 1px)), repeating-linear-gradient(90deg, transparent 0 5cqw, rgba(212,162,76,.06) 5cqw calc(5cqw + 1px)); }
.th-halls.hasimg::before{ opacity:.35; }
.th-halls .pg-sec{ color:#e8cf8e !important; } .th-halls .pg-fig{ background:rgba(255,255,255,.04); } .th-halls .pg-fig text{ fill:#ece3cf; } .th-halls .pg-box{ background:rgba(212,162,76,.12); } .th-halls .pg-box b{ color:#e8cf8e; }
/* 그림 한 장 · 모눈종이 */
.th-grid{ --paper:#fdfcf7; background-image:repeating-linear-gradient(0deg, transparent 0 2.5cqw, rgba(31,107,143,.12) 2.5cqw calc(2.5cqw + 1px)), repeating-linear-gradient(90deg, transparent 0 2.5cqw, rgba(31,107,143,.12) 2.5cqw calc(2.5cqw + 1px)); }
.th-grid .pg-fig{ background:#fff; border:2px solid #1f6b8f; }
/* 인물 탐방 · 세피아 */
.th-person{ --paper:#efe2c6; --ink:#3a2a18; --line:#c9b48a; --acc:#7a3b1c; background-image:radial-gradient(80% 60% at 50% 0%, rgba(255,250,235,.7), transparent 70%), radial-gradient(120% 90% at 50% 120%, rgba(90,60,20,.25), transparent 60%); }
.th-person.hasimg::before{ opacity:.3; }
.th-person h2{ font-size:4.8cqw; }
/* 퍼즐 · 노란 모눈 */
.th-puzzle{ --paper:#fff6cf; --acc:#9a5a00; background-image:repeating-linear-gradient(0deg, transparent 0 3cqw, rgba(154,90,0,.1) 3cqw calc(3cqw + 1px)), repeating-linear-gradient(90deg, transparent 0 3cqw, rgba(154,90,0,.1) 3cqw calc(3cqw + 1px)); }
.th-puzzle .pg-body p{ padding:1.6cqw 2cqw; margin-bottom:1.6cqw; background:rgba(255,255,255,.7); border-radius:1cqw; border:1px dashed rgba(154,90,0,.4); }
/* 교실 · 칠판 머리 */
.th-class .pg-in{ padding-top:0; }
.th-class .pg-hd, .th-class .pg-sec, .th-class h2{ margin-left:-8cqw; margin-right:-8cqw; padding-left:8cqw; padding-right:8cqw; background:#24402f; color:#f3ead8 !important; }
.th-class .pg-hd{ padding-top:5cqw; border:0; margin-bottom:0; color:#cfe3c8; } .th-class h2{ margin-top:0; padding-bottom:3cqw; margin-bottom:3cqw; border-bottom:1.2cqw solid #8a6036; }
/* Paradox · 보라 */
.th-paradox{ --paper:#1f1636; --ink:#efe8ff; --ink2:#c2b6e6; --line:#3f3268; --acc:#c9b6ff; background-image:radial-gradient(70% 50% at 50% 30%, rgba(127,227,214,.12), transparent 70%); }
.th-paradox .pg-sec{ color:#7fe3d6 !important; } .th-paradox .pg-fig{ background:rgba(255,255,255,.05); } .th-paradox .pg-fig text{ fill:#efe8ff; } .th-paradox .pg-box b{ color:#7fe3d6; }
/* 수학사 · 연표 */
.th-cal .pg-list{ position:relative; padding-left:3cqw !important; border-left:.5cqw solid var(--gold); }
.th-cal .pg-list li{ position:relative; border-bottom:0; } .th-cal .pg-list li::before{ content:''; position:absolute; left:-4.15cqw; top:2.2cqw; width:2cqw; height:2cqw; border-radius:50%; background:var(--gold); }
/* 감상실 · 별밤 */
.th-music{ --paper:#120f24; --ink:#efe8d8; --ink2:#bdb3d0; --line:#2f2950; --acc:#e9c46a; background-image:radial-gradient(1px 1px at 20% 30%, #fff, transparent), radial-gradient(1px 1px at 70% 20%, #fff, transparent), radial-gradient(1.5px 1.5px at 40% 70%, #fff8, transparent), radial-gradient(1px 1px at 85% 60%, #fff, transparent), radial-gradient(80% 50% at 50% 100%, rgba(233,196,106,.18), transparent 70%); }
.th-music .pg-sec{ color:#e9c46a !important; } .th-music .pg-box{ background:rgba(233,196,106,.12); } .th-music .pg-box b{ color:#e9c46a; }
.th-halls .pg-ft, .th-paradox .pg-ft, .th-music .pg-ft{ color:rgba(255,255,255,.55); }
@media print{ .pg[class*='th-']{ -webkit-print-color-adjust:exact; print-color-adjust:exact; } }
/* 표지 이야기 · 쪽 위쪽 3분의 1을 그림으로 채우고 그 위에 제목 */
.th-story.hasimg::before{ display:block !important; height:40%; opacity:1; -webkit-mask-image:none; mask-image:none;
  background:linear-gradient(180deg, rgba(0,0,0,.25) 0%, color-mix(in srgb, var(--band) 35%, transparent) 45%, var(--band) 100%), var(--img) center / cover no-repeat; }
.th-story.hasimg .pg-hd, .th-story.hasimg .pg-sec, .th-story.hasimg h2{ background:transparent !important; }
.th-story.hasimg .pg-hd{ padding-top:5cqw; } .th-story.hasimg .pg-sec{ padding-top:9cqw; }
.th-story.hasimg h2{ text-shadow:0 .4cqw 2cqw rgba(0,0,0,.6); padding-bottom:3cqw; font-size:5.4cqw; }
.th-story.hasimg .pg-fig{ position:relative; }

/* 제목 줄바꿈 · 낱말 단위로, 줄 길이를 고르게 */
.pg h2{ word-break:keep-all; overflow-wrap:break-word; text-wrap:balance; }

/* 그림 속 수식(foreignObject) · 어두운 쪽에서는 밝게 */
.th-halls .pg-fig foreignObject div, .th-paradox .pg-fig foreignObject div, .th-music .pg-fig foreignObject div{ color:#efe8ff !important; }
.pg .katex{ font-size:1.08em; }
.pg-box .katex{ font-size:1em; } .pg-box li{ line-height:1.5; }
.pg-box.cols ul{ columns:2; column-gap:4cqw; } .pg-box.cols li{ break-inside:avoid; }
