/* 청류 판본비교평가 — 설정창(popup.html)의 디자인 문법 그대로: 쿨톤 흰 바탕 · 명조 · 인디고 · 맑은 유리 · 물그물 머리띠 · 알약 · 스프링 움직임. 알갱이(잡티) 없음, 그림자는 약하게. */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --primary: #4f6fae; --primary-dark: #3f5f9c; --primary-deep: #365486; --primary-light: #eaf2ff;
  --bg: #f5f8fd; --text: #373a43; --text-2: #505667; --text-muted: #858d9e; --text-subtle: #b9c0cf;
  --glass-border: rgba(255,255,255,0.74); --divider: rgba(96,111,132,0.14);
  --radius: 18px;
  --soft-shadow-sm: 0 8px 20px rgba(62,82,122,0.06);
  --ease: cubic-bezier(0.4, 0.0, 0.2, 1); --ease-spring: cubic-bezier(0.22, 1.2, 0.36, 1); --spring-ms: 420ms;
  --font-korean-safe: 'Nanum Myeongjo', '나눔명조', 'Noto Serif KR', 'Noto Serif CJK KR', 'Source Han Serif K', 'Source Han Serif KR', 'Batang', '바탕', 'AppleMyungjo', 'Malgun Gothic', '맑은 고딕', 'Apple SD Gothic Neo', serif;
  --font-ui: 'KP KwangMyeong', '광명', 'KwangMyeong', var(--font-korean-safe);
  --font-ui-strong: 'KP KwangMyeong B', '광명굵은', 'KwangMyeong Bold', var(--font-ui);
  --font-version: 'PnPKwangMyeongChe B', 'PnPKwangMyeongCheB', 'PnPKwangMyeongChe', '광명납작체', var(--font-ui);
  --bar-old: #9fb1d6; --bar-combo: #7e97c9; --bar-now: #3f5f9c;
}
html { background: var(--bg); scroll-behavior: smooth; scroll-padding-top: 18px; }
body { font-family: var(--font-ui); color: var(--text); font-size: 15.5px; line-height: 1.85; -webkit-font-smoothing: antialiased; min-height: 100vh; background:
  radial-gradient(1200px 520px at 12% -8%, rgba(168,206,255,0.28), rgba(168,206,255,0) 62%),
  radial-gradient(900px 480px at 96% 4%, rgba(190,204,246,0.24), rgba(190,204,246,0) 60%), var(--bg); background-attachment: fixed; }
.page { max-width: 1000px; margin: 0 auto; padding: 22px 18px 64px; }

/* ── 머리띠: 인디고 유리 + 물그물 ── */
.header { position: relative; isolation: isolate; overflow: hidden; padding: 16px 22px; background: rgba(79,111,174,0.52); backdrop-filter: blur(16px) saturate(1.06); -webkit-backdrop-filter: blur(16px) saturate(1.06); color: #fff;
  display: flex; align-items: center; justify-content: space-between; gap: 14px; border-radius: 20px; border: 1px solid rgba(255,255,255,0.36);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.22), inset 0 1px 0 rgba(255,255,255,0.42), 0 9px 22px rgba(58,82,132,0.08), 0 2px 6px rgba(58,82,132,0.03); }
.header::before { content: ''; position: absolute; inset: 0; z-index: 0; border-radius: inherit; background: linear-gradient(180deg, rgba(255,255,255,0.18), rgba(255,255,255,0.035)); pointer-events: none; }
.water { position: absolute; inset: 0; z-index: 0; border-radius: inherit; overflow: hidden; pointer-events: none; }
.water::before { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(168,214,255,0.13), rgba(46,92,178,0.07)); }
.water i { position: absolute; will-change: transform; }
.water i:nth-child(1) { left: -300px; top: -132px; width: 2400px; height: 240px; opacity: 0.23; mix-blend-mode: screen; animation: water-a 17s linear infinite; }
.water i:nth-child(1)::before { content: ''; position: absolute; inset: 0; background: #fff; filter: url(#cr-net-a); will-change: transform; transform-origin: 50% 64%; animation: sway-a 5.3s ease-in-out infinite alternate; }
.water i:nth-child(2) { left: 0; top: -112px; width: 2200px; height: 300px; opacity: 0.10; mix-blend-mode: screen; animation: water-b 12s linear infinite; }
.water i:nth-child(2)::before { content: ''; position: absolute; inset: 0; background: #fff; filter: url(#cr-net-b); will-change: transform; transform-origin: 40% 50%; animation: sway-b 3.9s ease-in-out infinite alternate; }
.water i:nth-child(3) { left: -360px; top: 0; width: 2520px; height: 100%; background-image: radial-gradient(ellipse 120px 46px at 90px 30%, rgba(226,244,255,0.13), rgba(226,244,255,0) 70%), radial-gradient(ellipse 150px 52px at 262px 78%, rgba(30,62,132,0.06), rgba(30,62,132,0) 72%);
  background-size: 360px 100%; background-repeat: repeat-x; animation: water-c 23s linear infinite, water-glint 6.1s ease-in-out infinite alternate; }
@keyframes water-a { from { transform: translate(0, 0); } to { transform: translate(300px, 120px); } }
@keyframes water-b { from { transform: translate(0, 0); } to { transform: translate(-220px, 100px); } }
@keyframes water-c { from { transform: translateX(0); } to { transform: translateX(360px); } }
@keyframes sway-a { from { transform: skewX(-5deg) scale(0.985, 0.93); } to { transform: skewX(5deg) scale(1.03, 1.06); } }
@keyframes sway-b { from { transform: skewX(6deg) scale(1.04, 0.95); } to { transform: skewX(-6deg) scale(0.97, 1.07); } }
@keyframes water-glint { from { opacity: 0.55; } to { opacity: 1; } }
.fx-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.brand-lockup { position: relative; z-index: 1; display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand-logo { display: block; width: 92px; height: 40px; filter: drop-shadow(0 1px 1px rgba(29,39,58,0.10)); flex-shrink: 0; }
.brand-ink { display: block; width: 100%; height: 100%; background: linear-gradient(180deg, #ffffff 0%, #e9f3ff 100%); -webkit-mask: url('assets/chongryu.png') center / contain no-repeat; mask: url('assets/chongryu.png') center / contain no-repeat; }
.brand-title { font-family: var(--font-ui-strong); font-weight: 700; font-size: 16.5px; letter-spacing: 0.2px; color: rgba(255,255,255,0.96); text-shadow: 0 1px 1px rgba(29,39,58,0.12); white-space: nowrap; }
.header-pill { position: relative; z-index: 1; font-family: var(--font-version); font-size: 12.5px; letter-spacing: 0.4px; color: rgba(255,255,255,0.96); padding: 6px 15px; border-radius: 999px; background: rgba(255,255,255,0.18); border: 1px solid rgba(255,255,255,0.40); box-shadow: inset 0 1px 0 rgba(255,255,255,0.36); }

/* ── 첫머리: 제목 · 초록 ── */
.hero { padding: 38px 6px 4px; }
.hero h1 { font-family: var(--font-ui-strong); font-weight: 800; font-size: clamp(24px, 4vw, 34px); line-height: 1.36; letter-spacing: -0.5px; color: #2c3140; text-align: center; text-wrap: balance; }
.abstract { margin: 22px auto 0; max-width: 780px; font-size: 14.5px; line-height: 1.8; color: var(--text-2); }
.abstract p + p { margin-top: 4px; }
.abstract b { font-family: var(--font-ui-strong); font-weight: 700; color: #2f333d; margin-right: 4px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-top: 28px; }
.tile { background: rgba(255,255,255,0.52); backdrop-filter: blur(20px) saturate(1.14); -webkit-backdrop-filter: blur(20px) saturate(1.14); border: 1px solid var(--glass-border); border-radius: var(--radius); padding: 14px 18px 13px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.66), inset 0 0 0 1px rgba(255,255,255,0.20), var(--soft-shadow-sm); }
.tile-label { font-size: 12px; color: #768195; line-height: 1.5; }
.tile-now { font-family: var(--font-ui-strong); font-weight: 800; font-size: 28px; line-height: 1.3; color: var(--primary-deep); font-variant-numeric: tabular-nums; letter-spacing: -0.5px; margin-top: 2px; }
.tile-now small { font-size: 14px; font-weight: 700; margin-left: 3px; color: var(--primary-dark); letter-spacing: 0; }
.tile-old { font-size: 12.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; line-height: 1.5; }
.hero-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 18px; margin-top: 22px; }
.nav { display: flex; flex-wrap: wrap; gap: 7px; }
.nav a { font-size: 12.5px; line-height: 1.4; color: rgba(63,95,156,0.92); text-decoration: none; background: rgba(255,255,255,0.62); border: 1px solid rgba(79,111,174,0.13); border-radius: 999px; padding: 5px 13px 5.5px; box-shadow: inset 0 1px 0 rgba(255,255,255,0.58);
  transition: transform var(--spring-ms) var(--ease-spring), background 0.2s var(--ease); }
.nav a:hover { background: rgba(255,255,255,0.92); transform: translateY(-1px); }
a:focus-visible, button:focus-visible, svg:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ── 본문(론문) ── */
.intro, main { margin-top: 26px; }
.intro p, main section > p { text-indent: 1em; color: var(--text); text-align: justify; word-break: keep-all; overflow-wrap: anywhere; padding: 0 6px; }
section { margin-top: 44px; }
h2 { font-family: var(--font-ui-strong); font-weight: 800; font-size: 21.5px; letter-spacing: -0.3px; color: #2c3140; margin: 0 6px 10px; line-height: 1.4; }
h3.sub { font-family: var(--font-ui-strong); font-weight: 700; font-size: 17px; color: #2f333d; margin: 34px 6px 8px; letter-spacing: -0.2px; }
.card { margin: 16px 0; background: rgba(255,255,255,0.52); backdrop-filter: blur(20px) saturate(1.14); -webkit-backdrop-filter: blur(20px) saturate(1.14); border: 1px solid var(--glass-border); border-radius: var(--radius);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.66), inset 0 0 0 1px rgba(255,255,255,0.20), var(--soft-shadow-sm); }
.fig-no { font-family: var(--font-ui-strong); font-weight: 700; color: var(--primary-dark); margin-right: 3px; }

/* ── 형식을 바꾸는 알약(막대 ↔ 선): 길쭉한 길 + 둥근 손잡이, 스프링으로 미끄러진다 ── */
.seg { position: relative; display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 3px; border-radius: 999px; background: #dfe4ee; box-shadow: inset 0 0 0 1px rgba(72,82,103,0.07), inset 0 1px 2px rgba(72,82,103,0.07); flex-shrink: 0; }
.seg button { position: relative; z-index: 1; appearance: none; border: 0; background: none; font: inherit; font-size: 12px; line-height: 1; color: #6c7689; padding: 6px 14px 6.5px; border-radius: 999px; cursor: pointer; white-space: nowrap; transition: color 0.2s var(--ease); -webkit-tap-highlight-color: transparent; }
.seg button[aria-pressed="true"] { color: var(--primary-deep); }
.seg-thumb { position: absolute; z-index: 0; top: 3px; bottom: 3px; left: 3px; width: calc(50% - 3px); border-radius: 999px; background: #fff; box-shadow: 0 1px 3px rgba(40,56,92,0.16), 0 0 0 0.5px rgba(40,56,92,0.05); transition: transform 460ms var(--ease-spring); will-change: transform; }
.chart[data-view="line"] .seg-thumb, .seg-all[data-view="line"] .seg-thumb { transform: translateX(100%); }
.seg:active .seg-thumb { box-shadow: 0 1px 2px rgba(40,56,92,0.12), 0 0 0 0.5px rgba(40,56,92,0.05); }
.seg-all button { font-size: 12.5px; padding: 7px 16px 7.5px; }

/* ── 그림 ── */
.chart { padding: 18px 20px 16px; }
.chart figcaption { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px 14px; margin-bottom: 12px; }
.fig-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; min-width: 0; }
.chart h4 { font-family: var(--font-ui-strong); font-weight: 700; font-size: 15px; color: #2f333d; letter-spacing: -0.2px; line-height: 1.5; }
.chart figcaption p { grid-column: 1 / -1; font-size: 12.5px; color: #7a8496; line-height: 1.6; }
.dir { font-size: 10.5px; line-height: 1; padding: 3px 8px 3.5px; border-radius: 999px; color: #5d6a82; background: rgba(79,111,174,0.08); border: 1px solid rgba(79,111,174,0.12); white-space: nowrap; }
.views { position: relative; transition: height 520ms var(--ease-spring); }
.view { position: absolute; left: 0; right: 0; top: 0; opacity: 0; transform: translateY(10px) scale(0.985); transform-origin: 50% 0; pointer-events: none; visibility: hidden; transition: opacity 200ms var(--ease), transform 420ms var(--ease-spring), visibility 0s linear 220ms; }
.view.is-active { position: relative; opacity: 1; transform: none; pointer-events: auto; visibility: visible; transition: opacity 260ms var(--ease) 110ms, transform 460ms var(--ease-spring) 110ms, visibility 0s; }

/* 막대 */
.bars { display: grid; gap: 2px; }
.bar-row { display: grid; grid-template-columns: minmax(118px, 196px) 1fr; align-items: center; gap: 12px; padding: 3px 6px; border-radius: 8px; transition: background 0.15s var(--ease); }
.bar-row:hover { background: rgba(79,111,174,0.07); }
.bar-name { font-size: 12.5px; line-height: 1.4; color: var(--text-2); text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { display: flex; align-items: center; gap: 8px; min-width: 0; height: 20px; }
.bar-track i { display: block; height: 12px; min-width: 2px; width: calc((100% - 196px) * var(--w, 0)); background: var(--bar-old); border-radius: 0 4px 4px 0; flex-shrink: 0; transform-origin: left center; }
.view-bar.is-active .bar-track i { animation: bar-in 640ms var(--ease-spring) both; animation-delay: calc(90ms + var(--i, 0) * 16ms); }
.bar-track b { font-weight: 400; font-size: 12.5px; line-height: 1; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar-track b small { font-size: 10.5px; color: var(--text-muted); margin-left: 2px; }
.bar-track b em { font-style: normal; font-size: 11px; color: var(--text-muted); margin-left: 7px; }
.bar-track b.na { color: var(--text-subtle); font-size: 11.5px; }
.bar-row.g-combo .bar-track i { background: var(--bar-combo); }
.bar-row.g-now .bar-track i { background: var(--bar-now); height: 14px; }
.bar-row.g-now .bar-name, .bar-row.g-now .bar-track b { color: #2c3140; font-family: var(--font-ui-strong); font-weight: 700; }
.bar-row.is-best .bar-track b::after { content: '가장 좋음'; margin-left: 8px; font-family: var(--font-ui); font-size: 10px; color: rgba(63,95,156,0.9); background: rgba(255,255,255,0.8); border: 1px solid rgba(79,111,174,0.18); border-radius: 999px; padding: 1.5px 6px 2px; font-weight: 400; }
@keyframes bar-in { from { transform: scaleX(0.02); opacity: 0.2; } to { transform: none; opacity: 1; } }

/* 선 */
.line-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.line-inner { position: relative; min-width: 600px; }
.line-inner svg { display: block; width: 100%; height: auto; overflow: visible; touch-action: pan-y; cursor: crosshair; border-radius: 10px; }
.grid { stroke: rgba(96,111,132,0.16); stroke-width: 1; }
.ytick, .yunit { font-size: 11px; fill: #8a93a5; text-anchor: end; font-variant-numeric: tabular-nums; }
.yunit { fill: #a2aaba; }
.xtick { font-size: 11.5px; fill: #5a6276; text-anchor: end; }
.xtick.is-now { fill: #2c3140; font-weight: 700; }
.ln { fill: none; stroke: var(--primary); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 0; }
.view-line.is-active .ln { animation: draw 980ms cubic-bezier(0.3, 0.7, 0.2, 1) 140ms both; }
.pt { stroke: #fff; stroke-width: 2; transform-box: fill-box; transform-origin: center; transition: transform 320ms var(--ease-spring); }
.pt.g-old { fill: var(--primary); } .pt.g-combo { fill: var(--bar-combo); } .pt.g-now { fill: var(--primary-deep); }
.view-line.is-active .pt { animation: pop 460ms var(--ease-spring) both; animation-delay: calc(160ms + var(--i, 0) * 46ms); }
.pt.is-hot { transform: scale(1.45); }
.vlab { font-size: 11.5px; fill: #505667; font-variant-numeric: tabular-nums; paint-order: stroke; stroke: rgba(250,252,255,0.92); stroke-width: 3.5px; stroke-linejoin: round; }
.vlab.is-now { fill: #2c3140; font-weight: 700; font-size: 12.5px; }
.view-line.is-active .vlab { animation: fade-up 380ms var(--ease) both; animation-delay: calc(300ms + var(--i, 0) * 46ms); }
.cross { stroke: rgba(79,111,174,0.42); stroke-width: 1; opacity: 0; transition: opacity 140ms var(--ease); pointer-events: none; }
@keyframes draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes pop { from { transform: scale(0); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes fade-up { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.tip { position: absolute; left: 0; top: 0; display: grid; gap: 1px; padding: 8px 12px 9px; border-radius: 12px; background: rgba(255,255,255,0.86); backdrop-filter: blur(14px) saturate(1.1); -webkit-backdrop-filter: blur(14px) saturate(1.1); border: 1px solid rgba(255,255,255,0.8);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.7), 0 8px 20px rgba(62,82,122,0.12); font-size: 12px; line-height: 1.5; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity 140ms var(--ease), transform 220ms cubic-bezier(0.2, 0.9, 0.3, 1); will-change: transform; }
.tip.is-on { opacity: 1; }
.tip-name { font-family: var(--font-ui-strong); font-weight: 700; color: #2f333d; }
.tip-date { color: var(--text-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.tip-val { font-family: var(--font-ui-strong); font-weight: 700; color: var(--primary-deep); font-size: 14px; font-variant-numeric: tabular-nums; }
.line-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 6px 6px 0 60px; font-size: 11.5px; color: var(--text-2); }
.line-legend span { display: inline-flex; align-items: center; gap: 5px; }
.line-legend svg { width: 14px; height: 14px; overflow: visible; }
.line-legend .pt { animation: none !important; }

/* ── 표 ── */
.tab-cap { padding: 14px 18px 0; font-family: var(--font-ui-strong); font-weight: 700; font-size: 14.5px; color: #2f333d; }
.table-wrap { overflow-x: auto; border-radius: 0 0 var(--radius) var(--radius); -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 12.8px; line-height: 1.5; font-variant-numeric: tabular-nums; }
thead th { font-family: var(--font-ui-strong); font-weight: 700; font-size: 11.5px; color: #768195; text-align: right; padding: 11px 12px 9px; white-space: nowrap; border-bottom: 1px solid var(--divider); }
thead th:first-child, tbody th { text-align: left; }
tbody th { font-weight: 400; color: #2f333d; padding: 8px 12px 8px 18px; white-space: nowrap; position: sticky; left: 0; background: rgba(250,252,255,0.95); }
thead th:first-child { padding-left: 18px; position: sticky; left: 0; background: rgba(250,252,255,0.95); }
tbody td { text-align: right; padding: 8px 12px; color: var(--text); white-space: nowrap; }
tbody tr + tr th, tbody tr + tr td { border-top: 1px solid var(--divider); }
tbody tr:hover td, tbody tr:hover th { background: rgba(79,111,174,0.06); }
tbody tr.g-now th, tbody tr.g-now td { font-family: var(--font-ui-strong); font-weight: 700; color: #2c3140; background: rgba(79,111,174,0.07); }
tbody tr.g-combo th { color: var(--primary-deep); }
.t-versions tbody td, .t-versions thead th { text-align: left; }
.t-versions tbody td:nth-child(3) { white-space: normal; min-width: 150px; }
td:last-child, th:last-child { padding-right: 18px; }

/* ── 바닥 ── */
.footer { margin-top: 58px; text-align: center; color: #a5adbb; font-size: 12px; }
.version-pill { display: inline-block; padding: 7px 19px; font-family: var(--font-version); font-size: 12px; line-height: 1.4; color: #697184; letter-spacing: 0.4px; background: rgba(255,255,255,0.58); backdrop-filter: blur(18px) saturate(1.10); -webkit-backdrop-filter: blur(18px) saturate(1.10);
  border: 1px solid rgba(255,255,255,0.72); border-radius: 999px; box-shadow: inset 0 1px 0 rgba(255,255,255,0.62), 0 8px 18px rgba(62,82,122,0.06), 0 2px 6px rgba(62,82,122,0.04); }
.footer p { margin-top: 10px; }

/* 열릴 때: 우에서 물에 뜨듯 살짝 내려앉는다 */
.header, .hero > *, .intro { animation: settle-in var(--spring-ms) var(--ease-spring) both; }
.hero > :nth-child(2) { animation-delay: 40ms; } .hero > :nth-child(3) { animation-delay: 80ms; } .hero > :nth-child(4) { animation-delay: 120ms; } .intro { animation-delay: 160ms; }
@keyframes settle-in { from { transform: translateY(-9px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } html { scroll-behavior: auto; } }
@media (max-width: 640px) {
  .page { padding: 14px 16px 44px; } body { font-size: 15px; }
  .header { padding: 13px 16px; border-radius: 18px; } .brand-logo { width: 74px; height: 32px; } .brand-title { font-size: 14.5px; }
  .hero { padding-top: 26px; } .hero h1 { text-align: left; }
  .chart { padding: 16px 12px 14px; } .chart figcaption { grid-template-columns: 1fr; } .chart figcaption .seg { justify-self: start; }
  .bar-row { grid-template-columns: 104px 1fr; gap: 8px; padding: 3px 2px; } .bar-name { font-size: 11.5px; } .bar-track i { width: calc((100% - 92px) * var(--w, 0)); } .bar-track b em { display: none; }
  .bar-row.is-best .bar-track b::after { display: none; }
  .line-legend { margin-left: 6px; }
  h2 { font-size: 19.5px; } h3.sub { font-size: 16px; }
}
