/* Hallmark · shape: app screen · genre: editorial · theme: Ink (deal 3/3, seed private-member-library-portal-4a15·a3c0ea5e·2026-11-16·r0) · redesign: full
 * nav: kept top bar, current page as a teal pill · signature: the shelf as a ruled list (sign-in intro, home recent posts) · states: empty, error, busy, full · ink: paper
 * axes: light/grotesk-sans/chromatic-teal · posture: restrained · contrast: pass · v2.0.0 */
/* Hallmark · pre-emit critique: P3 H4 E4 S3 R3 V3 · weakest: R, the owner asked for motion on every screen so the theme's stillness was traded for page transitions and a staggered entrance; kept to transform and opacity under 420ms */
/* Hallmark · waive 22 · ink and greys at zero chroma · a notice board is printed in plain black */
@import url("./tokens.css");
@import url("./base.css");

/* Box개인 자료실 — 공통 스타일 (밝은 Ink 테마)
   PC, 모바일, macOS/iOS Safari 기준 */

:root {
  /* 인터넷 없이도 바로 표시되는 운영체제 내장 글꼴 */
  --font-display: -apple-system, BlinkMacSystemFont,
    "Apple SD Gothic Neo", "Malgun Gothic", "맑은 고딕", "Noto Sans KR", system-ui, sans-serif;
  --font-outlier: ui-monospace, "SF Mono", Menlo, Consolas, "D2Coding", monospace;

  /* 이 사이트 전용 색 */
  --color-error-soft: oklch(96% 0.025 27);
  --color-error-ink: oklch(40% 0.15 27);
  --color-error-rule: oklch(82% 0.08 27);
  --color-success-soft: oklch(96% 0.03 150);
  --color-success-ink: oklch(34% 0.09 150);
  --color-success-rule: oklch(82% 0.07 150);
  --color-gold: oklch(72% 0.14 85);
  --color-gold-deep: oklch(58% 0.12 75);
  --color-placeholder: oklch(60% 0 0);
  --color-top: oklch(99.5% 0.003 100 / 0.94);
  --color-night: oklch(16% 0 0);
  --color-night-ink: oklch(99.5% 0.003 100);
  /* 읽기 화면의 어두운 바탕 */
  --night-paper: oklch(18% 0.004 100); --night-paper-2: oklch(22% 0.004 100); --night-paper-3: oklch(27% 0.004 100);
  --night-ink: oklch(94% 0.004 100); --night-ink-2: oklch(84% 0.004 100); --night-muted: oklch(66% 0.004 100);
  --night-rule: oklch(31% 0.004 100); --night-rule-2: oklch(26% 0.004 100); --night-top: oklch(18% 0.004 100 / 0.94);
  --night-accent: oklch(72% 0.1 188); --night-accent-soft: oklch(32% 0.05 190); --night-accent-soft-ink: oklch(90% 0.05 190);
  --shadow-top: 0 1px 0 var(--color-rule), 0 8px 24px oklch(20% 0 0 / 0.06);
  --shadow-lift: 0 10px 24px oklch(20% 0 0 / 0.08);

  /* 예전 이름 (각 화면의 인라인 스타일이 쓰고 있어 유지) */
  --ink: var(--color-paper);
  --surface: var(--color-paper);
  --surface-2: var(--color-paper-2);
  --field: var(--color-paper);
  --line: var(--color-rule);
  --line-strong: var(--color-rule);
  --text: var(--color-ink);
  --text-2: var(--color-ink-2);
  --muted: var(--color-muted);
  --accent: var(--color-accent);
  --accent-soft: var(--color-accent-soft);
  --danger: var(--color-error);
  --focus: var(--color-focus);
  --font: var(--font-body);
  --mono: var(--font-outlier);
  --ease: var(--ease-out);

  --radius: var(--radius-card);
  --radius-sm: 10px;
  --tap: 44px;
  --wrap: 1120px;

  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 80px;
}
@media (max-width: 899px) { html { scroll-padding-top: 130px; } }

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  color: var(--color-ink-2);
  word-break: keep-all;
  overflow-wrap: anywhere;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}

img, svg, video, canvas { max-width: 100%; }
img.rank { display: inline-block; }
svg.icon { display: inline-block; }

a { color: var(--color-ink); text-underline-offset: 3px; transition: text-decoration-color var(--dur-micro) var(--ease-out), color var(--dur-micro) var(--ease-out); }
a:hover { text-decoration-color: var(--color-accent); }

:focus-visible { border-radius: 6px; }

.skip {
  position: absolute;
  left: 12px;
  top: 12px;
  z-index: var(--z-toast);
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-sm);
  background: var(--color-ink);
  color: var(--color-paper);
  font-weight: 700;
  text-decoration: none;
  transform: translateY(-80px);
}
.skip:focus { transform: none; }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.icon { width: 20px; height: 20px; flex: none; }

/* ───────── 머리글 ───────── */
.top {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky-nav);
  background: var(--color-top);
  border-bottom: 1px solid var(--color-rule);
  transition: box-shadow var(--dur-short) var(--ease-out);
  view-transition-name: top;
}
.top.is-stuck { box-shadow: var(--shadow-top); border-bottom-color: transparent; }
.top-inner {
  width: min(var(--wrap), 100%);
  margin: 0 auto;
  padding: var(--space-xs) max(var(--space-md), var(--safe-r)) var(--space-xs) max(var(--space-md), var(--safe-l));
  display: flex;
  align-items: center;
  gap: var(--space-xs) var(--space-lg);
  flex-wrap: wrap;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  min-height: var(--tap);
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.03em;
  text-decoration: none;
  white-space: nowrap;
  color: var(--color-ink);
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 30px; height: 30px;
  border-radius: 9px;
  background: var(--color-ink);
  color: var(--color-paper);
  font-size: 0.95rem;
  transition: transform var(--dur-short) var(--ease-out), background-color var(--dur-short) var(--ease-out);
}
.brand:hover .brand-mark { transform: rotate(-8deg) scale(1.06); background: var(--color-accent); }

.who {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  color: var(--color-muted);
  font-size: 0.9rem;
  white-space: nowrap;
}
.who .rank { width: 24px; height: 24px; }
.who-pts {
  font-variant-numeric: tabular-nums;
  color: var(--color-ink);
  font-weight: 700;
  padding: var(--space-3xs) var(--space-xs);
  border-radius: var(--radius-pill);
  background: var(--color-paper-2);
  border: 1px solid var(--color-rule);
  font-size: 0.82rem;
}
.who-link { display: inline-flex; align-items: center; gap: var(--space-xs); text-decoration: none; font-weight: 600; color: var(--color-ink-2); min-height: 40px; }
.who-link:hover { color: var(--color-ink); }
.who-link span { max-width: 9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 480px) { .who-link span { display: none; } .who { gap: 6px; } }

.nav {
  display: flex;
  gap: var(--space-3xs);
  align-items: center;
  font-weight: 600;
  font-size: 0.94rem;
}
.nav a {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 var(--space-sm);
  border-radius: var(--radius-pill);
  text-decoration: none;
  color: var(--color-muted);
  white-space: nowrap;
  transition: background-color var(--dur-short) var(--ease-out), color var(--dur-short) var(--ease-out);
}
.nav a:hover { background: var(--color-paper-2); color: var(--color-ink); }
.nav a:active { transform: scale(0.97); }
.nav a[aria-current="page"] {
  background: var(--color-accent-soft);
  color: var(--color-accent-soft-ink);
  view-transition-name: nav-current;
}
.nav .sep { width: 1px; height: 20px; background: var(--color-rule); margin: 0 var(--space-xs); }

@media (max-width: 899px) {
  .top-inner { padding-bottom: 0; }
  .nav {
    order: 3;
    flex: 1 0 100%;
    margin: 0 calc(var(--space-md) * -1);
    padding: var(--space-2xs) var(--space-md) var(--space-xs);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(90deg, transparent 0, var(--color-ink) 14px, var(--color-ink) calc(100% - 22px), transparent 100%);
    mask-image: linear-gradient(90deg, transparent 0, var(--color-ink) 14px, var(--color-ink) calc(100% - 22px), transparent 100%);
  }
  .nav::-webkit-scrollbar { display: none; }
}
@media (min-width: 900px) {
  .who { order: 3; margin-left: 0; }
  .nav { margin-left: auto; }
}

/* ───────── 본문 ───────── */
main {
  flex: 1;
  width: min(var(--wrap), 100%);
  margin: 0 auto;
  padding: 32px max(var(--space-md), var(--safe-r)) var(--space-2xl) max(var(--space-md), var(--safe-l));
}
footer {
  text-align: center;
  color: var(--color-muted);
  padding: var(--space-lg) var(--space-md) calc(var(--space-lg) + var(--safe-b));
  font-size: 0.85rem;
  border-top: 1px solid var(--color-rule);
}

h1, h2, h3 { color: var(--color-ink); }
h1 {
  font-size: clamp(1.6rem, 1.3rem + 1.2vw, 2.074rem);
  line-height: 1.2;
  margin: 0 0 var(--space-xs);
  max-width: none;
}
h2 {
  font-size: var(--text-section);
  letter-spacing: -0.02em;
  line-height: 1.3;
  margin: 0 0 var(--space-sm);
  max-width: none;
}
h1 + .lead, h1 + .meta { margin-top: calc(var(--space-3xs) * -1); }
p { margin: 0 0 var(--space-sm); }
p.lead { color: var(--color-ink-2); margin: 0 0 var(--space-lg); max-width: 62ch; }
.meta { color: var(--color-muted); font-size: 0.9rem; }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-sm);
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--color-ink);
}
.page-head h1 { margin: 0; }
.section-title { margin: 32px 0 var(--space-sm); }
.stack > * + * { margin-top: var(--space-sm); }

.card {
  background: var(--color-paper);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius);
  padding: clamp(var(--space-md), 3vw, var(--space-lg));
  margin-bottom: var(--space-md);
}
.card > :last-child { margin-bottom: 0; }
.grid { display: grid; gap: var(--space-md); }
@media (min-width: 800px) {
  .grid.two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
.grid.two > .card { margin-bottom: 0; }

/* ───────── 알림 ───────── */
.alert {
  display: flex;
  gap: var(--space-sm);
  align-items: flex-start;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-rule);
  background: var(--color-paper-2);
  color: var(--color-ink-2);
  margin: 0 0 var(--space-md);
}
.alert .icon { margin-top: var(--space-3xs); }
.alert.err, p.err { border-color: var(--color-error-rule); background: var(--color-error-soft); color: var(--color-error-ink); }
.alert.ok { border-color: var(--color-success-rule); background: var(--color-success-soft); color: var(--color-success-ink); }
.alert.info { border-color: var(--color-accent-soft); background: var(--color-accent-soft); color: var(--color-accent-soft-ink); }
p.err { padding: var(--space-sm) var(--space-md); border-radius: var(--radius-sm); border-width: 1px; border-style: solid; }

.pointbar {
  display: flex;
  gap: var(--space-xs) var(--space-md);
  align-items: center;
  flex-wrap: wrap;
  margin: 0 0 var(--space-lg);
  padding: var(--space-xs) var(--space-xs) var(--space-xs) var(--space-md);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-rule);
  background: var(--color-paper-2);
  color: var(--color-ink-2);
  font-size: 0.92rem;
}
.pointbar > span { flex: 1 1 220px; display: inline-flex; gap: var(--space-xs); align-items: center; }
.pointbar label { display: inline-flex; flex-direction: row; gap: var(--space-xs); align-items: center; font-size: 0.88rem; font-weight: 500; min-height: 36px; cursor: pointer; color: var(--color-muted); }
.pointbar button { min-height: 36px; height: 36px; }

/* ───────── 폼 ───────── */
form { display: grid; gap: var(--space-sm); }
label { display: grid; gap: 6px; font-size: 0.9rem; color: var(--color-ink-2); font-weight: 600; }
.hint { font-weight: 400; color: var(--color-muted); font-size: 0.84rem; margin-top: calc(var(--space-2xs) * -1); }

input, select, textarea, button { font: inherit; color: inherit; }

:where(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"])),
:where(select),
:where(textarea) {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  min-height: var(--tap);
  padding: var(--space-xs) var(--space-sm);
  font-size: 16px; /* iOS 확대 방지 */
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-rule);
  background: var(--color-paper);
  color: var(--color-ink);
  transition: border-color var(--dur-micro) var(--ease-out), box-shadow var(--dur-short) var(--ease-out), background-color var(--dur-short) var(--ease-out);
}
:where(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"])):hover,
:where(select):hover,
:where(textarea):hover { border-color: var(--color-muted); }
textarea { min-height: 140px; resize: vertical; line-height: 1.6; }
input::placeholder, textarea::placeholder { color: var(--color-placeholder); opacity: 1; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-soft);
}
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 1px; }
select {
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23474747' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  cursor: pointer;
}
select option { background: var(--color-paper); color: var(--color-ink); }
input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--color-accent); margin: 0; }
input[type="file"] {
  width: 100%;
  font-size: 0.92rem;
  color: var(--color-ink-2);
  padding: var(--space-xs);
  border: 1px dashed var(--color-rule);
  border-radius: var(--radius-sm);
  background: var(--color-paper-2);
}
input[type="file"]::file-selector-button,
input[type="file"]::-webkit-file-upload-button {
  font: inherit;
  font-weight: 600;
  margin-right: var(--space-sm);
  padding: var(--space-xs) var(--space-sm);
  border: 1px solid var(--color-rule);
  border-radius: 8px;
  background: var(--color-paper);
  color: var(--color-ink);
  cursor: pointer;
}

/* ───────── 버튼 ─────────
   button(기본) = 보조 버튼, .btn = 주 버튼 */
button, .btn, a.btn {
  -webkit-appearance: none;
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  min-height: var(--tap);
  height: auto;
  padding: 0 var(--space-md);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-rule);
  background: var(--color-paper-2);
  color: var(--color-ink);
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  transition: background-color var(--dur-short) var(--ease-out), border-color var(--dur-short) var(--ease-out), color var(--dur-short) var(--ease-out), transform var(--dur-micro) var(--ease-out), box-shadow var(--dur-short) var(--ease-out);
}
button:hover { background: var(--color-paper-3); border-color: var(--color-muted); color: var(--color-ink); }
button:active, .btn:active { transform: scale(0.97); }
button:disabled, button[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn, a.btn, button.btn {
  background: var(--color-ink);
  border-color: var(--color-ink);
  color: var(--color-paper);
  font-weight: 700;
}
.btn:hover, a.btn:hover, button.btn:hover {
  background: var(--color-ink-2);
  border-color: var(--color-ink-2);
  color: var(--color-paper);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lift);
}
.btn:active, a.btn:active, button.btn:active { transform: scale(0.97); box-shadow: none; }
.btn .icon { transition: transform var(--dur-short) var(--ease-out); }
.btn:hover .icon { transform: translateX(2px); }
.btn.ghost, a.btn.ghost, button.btn.ghost { background: var(--color-paper); border-color: var(--color-rule); color: var(--color-ink); }
.btn.ghost:hover { background: var(--color-paper-2); border-color: var(--color-muted); color: var(--color-ink); box-shadow: none; }
.btn-danger, button.btn-danger {
  background: var(--color-paper);
  border-color: var(--color-error-rule);
  color: var(--color-error-ink);
}
.btn-danger:hover, button.btn-danger:hover { background: var(--color-error); border-color: var(--color-error); color: var(--color-paper); }
.btn-sm, button.btn-sm, a.btn-sm { min-height: 36px; padding: 0 var(--space-sm); font-size: 0.88rem; border-radius: 8px; }
.is-on, button.is-on { background: var(--color-ink); border-color: var(--color-ink); color: var(--color-paper); }

.actions { display: flex; gap: var(--space-xs); align-items: center; flex-wrap: wrap; }
.actions form, .inline-form { display: inline-flex; }
form.row { display: flex; gap: var(--space-xs); align-items: center; flex-wrap: wrap; }
form.row > input:not([type="hidden"]) { flex: 1 1 200px; width: auto; }
.toolbar { display: flex; gap: var(--space-xs); align-items: center; flex-wrap: wrap; margin-bottom: var(--space-md); }
.toolbar > .grow { flex: 1 1 240px; }
.segmented {
  display: inline-flex;
  padding: var(--space-2xs);
  gap: var(--space-2xs);
  border-radius: 12px;
  background: var(--color-paper-2);
  border: 1px solid var(--color-rule);
}
.segmented form { display: inline-flex; }
.segmented button { border-color: transparent; background: transparent; min-height: 36px; color: var(--color-muted); }
.segmented button:hover { background: var(--color-paper-3); border-color: transparent; }
.segmented button[aria-pressed="true"] { background: var(--color-ink); color: var(--color-paper); }

/* ───────── 홈 ───────── */
.home-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-md);
  flex-wrap: wrap;
  padding-bottom: 20px;
  margin-bottom: var(--space-lg);
  border-bottom: 1px solid var(--color-ink);
}
.home-head h1 { margin: 0; font-size: clamp(1.8rem, 1.4rem + 1.8vw, 2.6rem); line-height: 1.1; }
.home-head .lead { margin: var(--space-xs) 0 0; }
.home-rank {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) var(--space-md) var(--space-xs) var(--space-xs);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-pill);
  background: var(--color-paper);
  text-decoration: none;
  transition: border-color var(--dur-short) var(--ease-out), transform var(--dur-short) var(--ease-out), box-shadow var(--dur-short) var(--ease-out);
}
.home-rank:hover { border-color: var(--color-ink); transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.home-rank .rank { width: 36px; height: 36px; }
.home-rank strong { display: block; font-size: 0.95rem; line-height: 1.2; color: var(--color-ink); }
.home-rank small { display: block; font-size: 0.82rem; color: var(--color-muted); font-variant-numeric: tabular-nums; }

.home-grid { display: grid; gap: 32px; align-items: start; }
@media (min-width: 960px) {
  .home-grid { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }
}
.home-grid h2 { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-sm); }
.home-grid h2 a { font-size: 0.86rem; font-weight: 600; letter-spacing: 0; color: var(--color-muted); }
.home-grid h2 a:hover { color: var(--color-ink); }

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr));
  gap: var(--space-sm);
  margin-top: 0;
}
.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--space-lg);
  min-height: 136px;
  padding: var(--space-md);
  border-radius: var(--radius);
  background: var(--color-paper);
  border: 1px solid var(--color-rule);
  text-decoration: none;
  overflow: hidden;
  transition: border-color var(--dur-short) var(--ease-out), transform var(--dur-short) var(--ease-out), box-shadow var(--dur-short) var(--ease-out);
}
.tile .icon {
  width: 40px; height: 40px;
  padding: 10px;
  border-radius: 10px;
  background: var(--color-paper-2);
  border: 1px solid var(--color-rule);
  color: var(--color-ink);
  transition: background-color var(--dur-short) var(--ease-out), color var(--dur-short) var(--ease-out), border-color var(--dur-short) var(--ease-out), transform var(--dur-long) var(--ease-out);
}
.tile strong { font-size: 1.1rem; letter-spacing: -0.02em; color: var(--color-ink); display: block; }
.tile small { display: block; color: var(--color-muted); font-weight: 400; font-size: 0.85rem; margin-top: var(--space-3xs); }
.tile::after {
  content: "";
  position: absolute;
  right: 16px; top: 22px;
  width: 9px; height: 9px;
  border-top: 2px solid var(--color-ink);
  border-right: 2px solid var(--color-ink);
  transform: translateX(-8px) rotate(45deg);
  opacity: 0;
  transition: transform var(--dur-short) var(--ease-out), opacity var(--dur-short) var(--ease-out);
}
.tile:hover { border-color: var(--color-ink); transform: translateY(-4px); box-shadow: var(--shadow-lift); }
.tile:hover .icon { background: var(--color-ink); border-color: var(--color-ink); color: var(--color-paper); transform: rotate(-6deg) scale(1.05); }
.tile:hover::after { transform: rotate(45deg); opacity: 1; }
.tile:active { transform: translateY(-1px) scale(0.99); }
@media (max-width: 480px) {
  .tiles { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-xs); }
  .tile { min-height: 120px; padding: var(--space-sm); gap: var(--space-md); }
}

/* 줄로 나눈 목록 (홈 최근 글, 로그인 소개) */
.ruled { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--color-ink); }
.ruled > li { border-bottom: 1px solid var(--color-rule); }
.ruled-link {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2xs) var(--space-md);
  flex-wrap: wrap;
  padding: var(--space-sm) var(--space-2xs);
  text-decoration: none;
  transition: background-color var(--dur-short) var(--ease-out);
}
.ruled-link strong { font-weight: 600; color: var(--color-ink); flex: 1 1 60%; min-width: 0; overflow-wrap: anywhere; transition: transform var(--dur-short) var(--ease-out), color var(--dur-short) var(--ease-out); }
.ruled-link small { color: var(--color-muted); font-size: 0.82rem; font-variant-numeric: tabular-nums; white-space: nowrap; transition: transform var(--dur-short) var(--ease-out); }
.ruled-link:hover { background: var(--color-paper-2); }
.ruled-link:hover strong { color: var(--color-accent-soft-ink); transform: translateX(8px); }
.ruled-link:hover small { transform: translateX(-8px); }

/* ───────── 목록 ───────── */
.list { display: grid; gap: var(--space-xs); }
.item {
  display: flex;
  justify-content: space-between;
  gap: var(--space-xs) var(--space-md);
  align-items: center;
  padding: var(--space-sm) var(--space-md);
  background: var(--color-paper);
  border: 1px solid var(--color-rule);
  border-radius: 12px;
  flex-wrap: wrap;
  transition: border-color var(--dur-short) var(--ease-out), transform var(--dur-short) var(--ease-out), box-shadow var(--dur-short) var(--ease-out);
}
.item:hover { border-color: var(--color-muted); transform: translateX(2px); }
.item > div:first-child { min-width: 0; flex: 1 1 220px; }
.item .name { font-weight: 600; overflow-wrap: anywhere; color: var(--color-ink); }
form.item { display: flex; }
.inner-list { max-height: 360px; overflow: auto; overscroll-behavior: contain; margin-top: var(--space-sm); -webkit-overflow-scrolling: touch; }
.inner-list .item { background: var(--color-paper-2); }
.zip-panel { width: 100%; margin-top: var(--space-2xs); }
.empty {
  padding: var(--space-xl) var(--space-md);
  text-align: center;
  color: var(--color-muted);
  border: 1px dashed var(--color-rule);
  border-radius: var(--radius);
  background: var(--color-paper-2);
}

.badge {
  display: inline-flex;
  align-items: center;
  color: var(--color-muted);
  background: transparent;
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-pill);
  padding: 0 var(--space-xs);
  font-size: 0.76rem;
  font-weight: 600;
  vertical-align: 2px;
  white-space: nowrap;
}
.badge.vip { color: var(--color-accent-soft-ink); background: var(--color-accent-soft); border-color: transparent; }

details > summary {
  cursor: pointer;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  min-height: 40px;
  font-weight: 600;
  color: var(--color-ink-2);
}
details > summary::-webkit-details-marker { display: none; }
details > summary::before {
  content: "";
  width: 8px; height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform var(--dur-short) var(--ease-out);
}
details[open] > summary::before { transform: rotate(45deg); }
details[open] > summary ~ * { animation: rise var(--dur-short) var(--ease-out) backwards; }

/* ───────── 표 ───────── */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-top: 1px solid var(--color-ink);
  border-bottom: 1px solid var(--color-rule);
  background: var(--color-paper);
}
.stats, .board { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.stats th, .stats td, .board th, .board td {
  padding: var(--space-sm);
  border-bottom: 1px solid var(--color-rule);
  text-align: center;
  white-space: nowrap;
  vertical-align: middle;
}
.stats th, .board th {
  color: var(--color-muted);
  font-size: 0.84rem;
  font-weight: 400;
}
.stats tr:last-child td, .board tr:last-child td { border-bottom: 0; }
.stats td .rank { width: 28px; height: 28px; }
.stats tbody tr, .board tbody tr { transition: background-color var(--dur-micro) var(--ease-out); }
.stats tbody tr:hover, .board tbody tr:hover { background: var(--color-paper-2); }

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 120px), 1fr));
  gap: var(--space-xs);
  margin-bottom: var(--space-xs);
}
.kpi {
  padding: var(--space-sm) var(--space-md);
  border-radius: 12px;
  background: var(--color-paper-2);
  border: 1px solid var(--color-rule);
}
.kpi span { display: block; color: var(--color-muted); font-size: 0.82rem; font-weight: 400; }
.kpi strong { display: block; font-size: 1.6rem; font-weight: 700; letter-spacing: -0.03em; color: var(--color-ink); font-variant-numeric: tabular-nums; }

/* ───────── 페이지 이동 ───────── */
.pager { display: flex; gap: var(--space-2xs); justify-content: center; flex-wrap: wrap; margin: 20px 0; }
.pager a {
  display: inline-grid;
  place-items: center;
  min-width: 40px;
  height: 40px;
  padding: 0 var(--space-xs);
  border-radius: 10px;
  border: 1px solid var(--color-rule);
  background: var(--color-paper);
  text-decoration: none;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  transition: border-color var(--dur-short) var(--ease-out), transform var(--dur-micro) var(--ease-out);
}
.pager a:hover { border-color: var(--color-ink); transform: translateY(-1px); }
.pager a.on, .pager a[aria-current="page"] { background: var(--color-ink); border-color: var(--color-ink); color: var(--color-paper); }

/* ───────── 계급 ───────── */
.rank { vertical-align: middle; }
.rank-line { display: flex; align-items: center; gap: var(--space-sm); margin: 0 0 var(--space-xs); font-size: 1.05rem; }
.rank-card { position: relative; overflow: hidden; }
.rank-line .rank { width: 64px; height: 64px; }
.rank-line strong { font-size: 1.35rem; letter-spacing: -0.02em; color: var(--color-ink); }
.rank-progress { margin: var(--space-2xs) 0 var(--space-md); max-width: 520px; }
.rank-progress-bar {
  height: 10px;
  border-radius: var(--radius-pill);
  background: var(--color-paper-3);
  overflow: hidden;
}
.rank-progress-bar > span {
  display: block;
  height: 100%;
  min-width: 6px;
  border-radius: inherit;
  background: var(--color-gold);
  transform-origin: left center;
}
.rank-progress-text {
  display: flex;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-top: var(--space-xs);
  font-size: 0.88rem;
  color: var(--color-ink-2);
  font-variant-numeric: tabular-nums;
}
.rank-progress-text strong { color: var(--color-gold-deep); }

/* ───────── 미디어 ───────── */
video {
  display: block;
  width: 100%;
  max-height: 72vh;
  background: var(--color-night);
  border-radius: 12px;
}
pre.text {
  margin: var(--space-md) 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--font-body);
  font-size: 1.05rem;
  line-height: 1.85;
  color: var(--color-ink-2);
  background: var(--color-paper-2);
  padding: clamp(var(--space-md), 4vw, 28px);
  border-radius: 12px;
  border: 1px solid var(--color-rule);
  overflow: auto;
  max-height: 72vh;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.reader-bar { display: flex; gap: var(--space-xs); align-items: center; justify-content: space-between; flex-wrap: wrap; }
.reader-bar .label { flex: 1; text-align: center; color: var(--color-ink-2); font-weight: 600; font-variant-numeric: tabular-nums; }

.scan-frame { padding: var(--space-xs); }
.scan-frame canvas, .scan-frame iframe { display: block; width: 100%; border-radius: 8px; background: var(--color-paper-3); }
.scan-frame canvas { height: auto; }
.scan-frame iframe { height: 75vh; border: 0; background: var(--color-paper); }

.path {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-2xs) var(--space-sm);
  border-radius: 8px;
  background: var(--color-paper-2);
  border: 1px solid var(--color-rule);
  font-size: 0.88rem;
  color: var(--color-ink-2);
  max-width: 100%;
  overflow-wrap: anywhere;
}

.board td.title, .board td.title a { text-align: left; white-space: normal; }

/* ───────── 로그인 · 회원가입 ───────── */
.auth-shell {
  display: grid;
  gap: 32px;
  align-items: center;
  min-height: min(640px, calc(100dvh - 220px));
}
@media (min-width: 900px) {
  .auth-shell { grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); gap: var(--space-2xl); }
}
.auth-intro h1 {
  font-size: clamp(2.2rem, 1.4rem + 3.6vw, 3.6rem);
  line-height: 1.05;
  margin: 0 0 var(--space-md);
}
.auth-intro .lead { margin-bottom: 28px; }
.auth-list > li:nth-child(1) { animation-delay: 160ms; }
.auth-list > li:nth-child(2) { animation-delay: 220ms; }
.auth-list > li:nth-child(3) { animation-delay: 280ms; }
.auth-list > li:nth-child(4) { animation-delay: 340ms; }
.auth-list > li:nth-child(5) { animation-delay: 400ms; }
.auth-row { display: flex; align-items: center; gap: var(--space-sm); padding: var(--space-sm) var(--space-2xs); }
.auth-row .icon { color: var(--color-ink); }
.auth-row strong { color: var(--color-ink); font-weight: 600; min-width: 4.5em; }
.auth-row small { color: var(--color-muted); font-size: 0.88rem; }
@media (max-width: 899px) {
  .auth-shell { min-height: 0; }
  .auth-list { display: none; }
  .auth-intro .lead { margin-bottom: 0; }
}

.auth-card {
  margin: 0;
  padding: clamp(20px, 3vw, 32px);
  box-shadow: var(--shadow-card);
  border-color: var(--color-rule-2);
  view-transition-name: auth-card;
}
.auth-tabs { display: none; }
.js .auth-tabs {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  padding: var(--space-2xs);
  margin-bottom: var(--space-lg);
  border-radius: 12px;
  background: var(--color-paper-2);
  border: 1px solid var(--color-rule);
}
.auth-tabs button {
  position: relative;
  z-index: 1;
  min-height: 40px;
  border: 0;
  background: transparent;
  color: var(--color-muted);
  font-weight: 700;
  transition: color var(--dur-short) var(--ease-out);
}
.auth-tabs button:hover { background: transparent; color: var(--color-ink); }
.auth-tabs button[aria-selected="true"] { color: var(--color-paper); }
.auth-ink {
  position: absolute;
  z-index: 0;
  top: 4px; bottom: 4px; left: 4px;
  width: calc(50% - 4px);
  border-radius: 9px;
  background: var(--color-ink);
  transition: transform 380ms var(--ease-out);
}
.auth-tabs[data-tab="signup"] .auth-ink { transform: translateX(100%); }

.auth-panel + .auth-panel { margin-top: 32px; padding-top: var(--space-lg); border-top: 1px solid var(--color-rule); }
.js .auth-panel + .auth-panel { margin-top: 0; padding-top: 0; border-top: 0; }
.js .auth-panel h2 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.auth-panel form { gap: var(--space-md); }
.auth-panel form button { width: 100%; margin-top: var(--space-2xs); min-height: 48px; font-size: 1rem; }
.auth-panel .meta { margin: 0; text-align: center; }
.auth-panel.is-entering form > * { animation: rise 420ms var(--ease-out) backwards; }
.auth-panel.is-entering form > *:nth-child(3) { animation-delay: 40ms; }
.auth-panel.is-entering form > *:nth-child(4) { animation-delay: 80ms; }
.auth-panel.is-entering form > *:nth-child(5) { animation-delay: 120ms; }
.auth-panel.is-entering form > *:nth-child(6) { animation-delay: 160ms; }
.auth-panel.is-entering form > *:nth-child(7) { animation-delay: 200ms; }
.auth-panel.from-left.is-entering form > * { animation-name: slide-from-left; }
.auth-panel.from-right.is-entering form > * { animation-name: slide-from-right; }

/* 입력 칸: 초점이 오면 살짝 떠오름 */
.auth-panel label { transition: color var(--dur-short) var(--ease-out); }
.auth-panel label:focus-within { color: var(--color-accent-soft-ink); }
.auth-panel input { min-height: 48px; transition: border-color var(--dur-micro) var(--ease-out), box-shadow var(--dur-short) var(--ease-out), transform var(--dur-short) var(--ease-out); }
.auth-panel input:focus { transform: translateY(-1px); }

/* ───────── 움직임 ───────── */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes drop { from { opacity: 0; transform: translateY(-8px); } }
@keyframes pop { from { opacity: 0; transform: scale(0.8) rotate(-8deg); } }
@keyframes fill { from { transform: scaleX(0); } }
@keyframes card-in { from { opacity: 0; transform: translateY(24px) scale(0.98); } }
@keyframes slide-from-left { from { opacity: 0; transform: translateX(-20px); } }
@keyframes slide-from-right { from { opacity: 0; transform: translateX(20px); } }
@keyframes nudge { 20% { transform: translateX(-5px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes page-out { to { opacity: 0; transform: translateY(-6px); } }
@keyframes page-in { from { opacity: 0; transform: translateY(10px); } }

/* 화면이 열릴 때 본문이 차례로 올라옴 */
/* .motion 은 화면이 실제로 그려지기 시작할 때 붙습니다. 그려지지 않는 환경에서는 내용이 그대로 보입니다. */
.motion main > * { animation: rise var(--dur-long) var(--ease-out) backwards; }
main > *:nth-child(2) { animation-delay: 50ms; }
main > *:nth-child(3) { animation-delay: 100ms; }
main > *:nth-child(4) { animation-delay: 150ms; }
main > *:nth-child(n+5) { animation-delay: 200ms; }
.motion main > .auth-shell, .motion main > script { animation: none; }
.motion .alert { animation: drop var(--dur-long) var(--ease-out) backwards; }
.motion .alert.err { animation: drop var(--dur-long) var(--ease-out) backwards, nudge 360ms var(--ease-in-out) 200ms; }
.motion .auth-intro h1 { animation: rise 600ms var(--ease-out) backwards; }
.motion .auth-intro .lead { animation: rise 600ms var(--ease-out) 80ms backwards; }
.motion .auth-list > li { animation: rise 520ms var(--ease-out) backwards; }
.motion .auth-card { animation: card-in 640ms var(--ease-out) 120ms backwards; }
.motion .rank-line .rank { animation: pop var(--dur-long) var(--ease-out) 120ms backwards; }
.motion .rank-progress-bar > span { animation: fill 900ms var(--ease-out) 200ms backwards; }

.motion .tiles > .tile, .motion .list > .item, .motion .kpis > .kpi, .motion .ruled > li, .motion .cmt-list > .cmt {
  animation: rise var(--dur-long) var(--ease-out) backwards;
}
.tiles > :nth-child(1), .list > :nth-child(1), .kpis > :nth-child(1), .ruled > :nth-child(1), .cmt-list > :nth-child(1) { animation-delay: 80ms; }
.tiles > :nth-child(2), .list > :nth-child(2), .kpis > :nth-child(2), .ruled > :nth-child(2), .cmt-list > :nth-child(2) { animation-delay: 120ms; }
.tiles > :nth-child(3), .list > :nth-child(3), .kpis > :nth-child(3), .ruled > :nth-child(3), .cmt-list > :nth-child(3) { animation-delay: 160ms; }
.tiles > :nth-child(4), .list > :nth-child(4), .kpis > :nth-child(4), .ruled > :nth-child(4), .cmt-list > :nth-child(4) { animation-delay: 200ms; }
.tiles > :nth-child(5), .list > :nth-child(5), .kpis > :nth-child(5), .ruled > :nth-child(5), .cmt-list > :nth-child(5) { animation-delay: 240ms; }
.tiles > :nth-child(6), .list > :nth-child(6), .kpis > :nth-child(6), .ruled > :nth-child(6), .cmt-list > :nth-child(6) { animation-delay: 280ms; }
.tiles > :nth-child(n+7), .list > :nth-child(n+7), .kpis > :nth-child(n+7), .ruled > :nth-child(n+7), .cmt-list > :nth-child(n+7) { animation-delay: 320ms; }

/* 화면 사이 이동 (지원하는 브라우저에서만) */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: page-out 140ms var(--ease-in) both; }
::view-transition-new(root) { animation: page-in 320ms var(--ease-out) 60ms both; }
::view-transition-group(nav-current) { animation-duration: 360ms; animation-timing-function: var(--ease-out); }
::view-transition-group(auth-card) { animation-duration: 380ms; animation-timing-function: var(--ease-out); }

/* 보내는 중 버튼 */
button[aria-busy="true"] { position: relative; color: transparent !important; }
button[aria-busy="true"] > * { visibility: hidden; }
button[aria-busy="true"]::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 2px solid var(--color-rule);
  border-top-color: var(--color-muted);
  animation: spin .7s linear infinite;
}
button.btn[aria-busy="true"]::after { border-color: var(--color-muted); border-top-color: var(--color-paper); }

@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root), ::view-transition-new(root), ::view-transition-group(*) { animation: none !important; }
}

/* 인쇄 */
@media print {
  .top, footer, .pointbar, .actions, .toolbar { display: none !important; }
  main > *, .tiles > *, .list > *, .ruled > li { animation: none !important; }
}

/* ───────── 문서: 찾기 ───────── */
.auth-intro h1 { margin-bottom: 28px; }
.auth-row strong { min-width: 0; }

.resume { display: flex; align-items: center; gap: var(--space-xs); flex-wrap: wrap; margin-bottom: var(--space-md); }
.resume form { display: inline-flex; min-width: 0; max-width: 100%; }
.resume-btn { border-radius: var(--radius-pill); background: var(--color-paper); min-height: 40px; max-width: 100%; font-weight: 600; }
.resume-btn:hover { border-color: var(--color-ink); background: var(--color-paper); }
.resume-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 22em; min-width: 0; }

.finder {
  position: sticky;
  top: var(--top-h, 61px);
  z-index: var(--z-sticky);
  margin: 0 calc(var(--space-md) * -1);
  padding: var(--space-sm) var(--space-md);
  background: var(--color-top);
  border-bottom: 1px solid var(--color-rule);
}
.finder-search {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-2xs) var(--space-2xs) var(--space-2xs) var(--space-sm);
  border: 1px solid var(--color-rule);
  border-radius: 12px;
  background: var(--color-paper);
  transition: border-color var(--dur-micro) var(--ease-out), box-shadow var(--dur-short) var(--ease-out);
}
.finder-search:focus-within { border-color: var(--color-accent); box-shadow: 0 0 0 3px var(--color-accent-soft); }
.finder-search > .icon { color: var(--color-muted); }
.finder-search input { flex: 1; min-width: 0; min-height: 40px; padding: 0 var(--space-2xs); border: 0; background: transparent; }
.finder-search input:hover { border: 0; }
.finder-search input:focus { box-shadow: none; }
.finder-search input:focus-visible { outline: none; }
.finder-row { display: flex; align-items: center; gap: var(--space-sm); margin-top: var(--space-xs); }
.chips { display: flex; gap: var(--space-2xs); flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding: var(--space-3xs); }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  min-width: 34px;
  min-height: 34px;
  padding: 0 var(--space-xs);
  border-radius: 8px;
  background: var(--color-paper);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-ink-2);
}
.chip[aria-pressed="true"] { background: var(--color-ink); border-color: var(--color-ink); color: var(--color-paper); }
.chip:disabled { opacity: 0.4; background: var(--color-paper-2); color: var(--color-muted); cursor: not-allowed; }
.finder-sort { flex: none; }
.finder-sort select { width: auto; min-height: 36px; padding-top: 0; padding-bottom: 0; font-size: 0.9rem; }
@media (max-width: 899px) {
  /* 좁은 화면에서는 머리글 대신 검색 줄이 위에 붙음 */
  body:has(.finder) .top { position: static; }
  body:has(.finder) { --top-h: 0px !important; }
  .finder-search .btn { padding: 0 var(--space-sm); }
}

.crumbs { display: flex; align-items: center; gap: var(--space-2xs); flex-wrap: wrap; margin: var(--space-md) 0 var(--space-xs); min-height: 36px; }
.crumb { min-height: 32px; padding: 0 var(--space-xs); border: 0; background: transparent; color: var(--color-muted); font-weight: 600; white-space: normal; text-align: left; }
.crumb:hover { background: var(--color-paper-2); color: var(--color-ink); }
.crumb[aria-current="page"] { color: var(--color-ink); }
.crumb-sep { width: 14px; height: 14px; color: var(--color-muted); }
.crumb-now { font-weight: 600; color: var(--color-ink); margin-right: var(--space-xs); }
.crumb-count { margin-left: auto; font-variant-numeric: tabular-nums; }

/* ───────── 문서: 제목 목록 ───────── */
.doc-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--color-ink); }
.doc-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0 var(--space-sm);
  border-bottom: 1px solid var(--color-rule);
  transition: background-color var(--dur-micro) var(--ease-out);
}
.doc-row:hover { background: var(--color-paper-2); }
.doc-open { display: block; flex: 1 1 320px; min-width: 0; }
.doc-title {
  width: 100%;
  min-height: 48px;
  justify-content: flex-start;
  gap: var(--space-sm);
  padding: var(--space-xs) var(--space-2xs);
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--color-ink);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
  text-align: left;
  white-space: normal;
  user-select: text;
  -webkit-user-select: text;
}
.doc-title:hover { background: transparent; color: var(--color-accent-soft-ink); }
.doc-title:active { transform: none; }
.doc-title .icon { color: var(--color-muted); transition: transform var(--dur-short) var(--ease-out), color var(--dur-short) var(--ease-out); }
.doc-title:hover .icon { transform: translateX(3px); color: var(--color-ink); }
.doc-title .name { min-width: 0; overflow-wrap: anywhere; }
.doc-title.is-plain { display: flex; align-items: center; flex: 1 1 320px; min-width: 0; font-weight: 400; color: var(--color-ink-2); }
.is-folder .doc-title .icon { color: var(--color-ink); }
.doc-meta { display: inline-flex; align-items: center; gap: var(--space-sm); padding-right: var(--space-2xs); color: var(--color-muted); font-size: 0.82rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.doc-where { max-width: 16em; overflow: hidden; text-overflow: ellipsis; }
.doc-get { min-height: 32px; }
@media (max-width: 640px) {
  .doc-title { min-height: 44px; padding-bottom: var(--space-3xs); }
  .doc-meta { flex: 1 0 100%; padding: 0 var(--space-2xs) var(--space-xs) 36px; flex-wrap: wrap; gap: var(--space-2xs) var(--space-sm); }
}
.doc-row.is-open { background: var(--color-paper-2); }
.doc-row.is-open > .doc-open .doc-title { color: var(--color-accent-soft-ink); }
.doc-row .zip-panel { flex: 1 0 100%; margin: 0; padding: 0 var(--space-sm) var(--space-md) 36px; }
.zip-head { display: flex; align-items: center; gap: var(--space-sm); flex-wrap: wrap; padding: var(--space-2xs) 0 var(--space-xs); }
.doc-list.inner-list { max-height: 420px; margin-top: 0; background: var(--color-paper); border: 1px solid var(--color-rule); border-radius: 10px; }
.doc-list.inner-list .doc-row:last-child { border-bottom: 0; }
.doc-list.inner-list .doc-title { padding-left: var(--space-sm); }
.doc-list.inner-list .doc-meta { padding-right: var(--space-sm); }
@media (max-width: 640px) {
  .doc-row .zip-panel { padding-left: var(--space-xs); padding-right: var(--space-xs); }
}

/* ───────── 문서: 읽기 ───────── */
body:has(.reader) .top { position: static; }
body:has(.reader) { --stick: 0px; }
body:has(.reader) .pointbar { display: none; }
body:has(.reader) footer { padding-bottom: var(--space-3xl); }
body:has(.reader) main { padding-top: 0; }
body:has(.reader.is-dark) {
  color-scheme: dark;
  --color-paper: var(--night-paper); --color-paper-2: var(--night-paper-2); --color-paper-3: var(--night-paper-3);
  --color-ink: var(--night-ink); --color-ink-2: var(--night-ink-2); --color-muted: var(--night-muted);
  --color-rule: var(--night-rule); --color-rule-2: var(--night-rule-2);
  --color-top: var(--night-top);
  --color-accent: var(--night-accent); --color-focus: var(--night-accent);
  --color-accent-soft: var(--night-accent-soft); --color-accent-soft-ink: var(--night-accent-soft-ink);
}
.reader { --reader-size: 1.05rem; padding-bottom: var(--space-3xl); }
.reader-top {
  position: sticky;
  top: var(--stick, var(--top-h, 61px));
  z-index: var(--z-sticky);
  display: flex;
  align-items: center;
  gap: var(--space-xs) var(--space-sm);
  flex-wrap: wrap;
  margin: 0 calc(var(--space-md) * -1);
  padding: var(--space-xs) var(--space-md);
  background: var(--color-top);
  border-bottom: 1px solid var(--color-rule);
}
.reader-title { flex: 1 1 140px; min-width: 0; display: flex; align-items: baseline; gap: var(--space-sm); }
.reader-title strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--color-ink); }
.reader-title span { flex: none; color: var(--color-muted); font-size: 0.86rem; font-variant-numeric: tabular-nums; }
.reader-tools { display: flex; align-items: center; gap: var(--space-2xs); }
.reader-tools button { padding: 0 var(--space-xs); min-width: 40px; }
.reader-progress { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; overflow: hidden; }
.reader-progress > span { display: block; height: 100%; background: var(--color-accent); transform: scaleX(0); transform-origin: left center; transition: transform var(--dur-micro) linear; }
@media (max-width: 640px) {
  .reader-tools .tool-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}
.reader-chapter {
  max-width: calc(34 * var(--reader-size));
  margin: var(--space-xl) auto var(--space-lg);
  font-size: clamp(1.3rem, 1.1rem + 1vw, 1.728rem);
  line-height: 1.3;
}
.reader pre.text {
  max-width: calc(34 * var(--reader-size));
  max-height: none;
  margin: 0 auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  overflow: visible;
  font-size: var(--reader-size);
  line-height: 1.95;
  color: var(--color-ink-2);
  transition: opacity var(--dur-short) var(--ease-out);
}
.reader pre.text.is-loading { opacity: 0.35; }
.motion .reader pre.text.is-fresh { animation: rise var(--dur-long) var(--ease-out); }
.reader-bottom {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: var(--z-sticky);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr) minmax(0, 1fr);
  gap: var(--space-xs);
  padding: var(--space-xs) max(var(--space-md), calc((100% - 720px) / 2)) calc(var(--space-xs) + var(--safe-b));
  background: var(--color-top);
  border-top: 1px solid var(--color-rule);
}
.reader-bottom button, .reader-bottom select { width: 100%; min-height: 48px; }
.reader-bottom select { text-align: center; text-overflow: ellipsis; }

.motion .doc-list > .doc-row:nth-child(-n+14) { animation: rise var(--dur-long) var(--ease-out) backwards; }
.motion .doc-list > .doc-row:nth-child(2) { animation-delay: 30ms; }
.motion .doc-list > .doc-row:nth-child(3) { animation-delay: 60ms; }
.motion .doc-list > .doc-row:nth-child(4) { animation-delay: 90ms; }
.motion .doc-list > .doc-row:nth-child(5) { animation-delay: 120ms; }
.motion .doc-list > .doc-row:nth-child(6) { animation-delay: 150ms; }
.motion .doc-list > .doc-row:nth-child(7) { animation-delay: 180ms; }
.motion .doc-list > .doc-row:nth-child(n+8):nth-child(-n+14) { animation-delay: 210ms; }
.motion .inner-list > .doc-row { animation: none; }
@media print {
  .finder, .crumbs, .resume, .reader-top, .reader-bottom { display: none !important; }
}
.motion main > .reader { animation: none; }
