/* 값은 tokens.css 토큰만 쓴다 (Design.md) */
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; clip-path: inset(50%); }
.skip:focus { clip-path: none; left: var(--sp-4); top: var(--sp-2); z-index: var(--z-toast); background: var(--surface); padding: var(--sp-2) var(--sp-3); border-radius: var(--r-md); }
main:focus { outline: none; }
mark { background: var(--accent-soft); color: var(--text); text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; }
mark.current { background: var(--accent); color: var(--on-accent); }

/* 상단 바 */
.topbar { position: sticky; top: 0; z-index: var(--z-sticky); background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar-in { display: flex; align-items: center; gap: var(--sp-4); min-height: var(--topbar-h); }
.brand { font-weight: 700; color: var(--text); text-decoration: none; white-space: nowrap; }
.brand:hover { color: var(--text); }
.topnav { display: flex; gap: var(--sp-4); align-self: stretch; }
.topnav a { display: flex; align-items: center; font-size: var(--fs-sm); font-weight: 500; color: var(--text-2); text-decoration: none; border-bottom: 2px solid transparent; border-top: 2px solid transparent; white-space: nowrap; }
.topnav a:hover { color: var(--text); }
.topnav a[aria-current="page"] { color: var(--text); font-weight: 600; border-bottom-color: var(--accent); }
.top-search { flex: 1; min-width: 0; margin-left: auto; max-width: 360px; }
.icon-btn { width: var(--hit-min); padding: 0; flex: none; }
.tabbar { display: none; }

/* 페이지 */
.page { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-10); padding: var(--sp-8) 0 var(--sp-14); }
.page-head { display: grid; gap: var(--sp-2); }
.page-head p { color: var(--text-2); font-size: var(--fs-sm); line-height: var(--lh-sm); max-width: 68ch; }
.section { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-4); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-3); }
.section-head h2 { font-size: var(--fs-h3); line-height: var(--lh-h3); font-weight: 600; }
.section-head a { font-size: var(--fs-sm); white-space: nowrap; }
.crumb { font-size: var(--fs-sm); color: var(--text-2); }
.notice { display: grid; gap: var(--sp-1); padding: var(--sp-3) var(--sp-4); border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-2); color: var(--text-2); font-size: var(--fs-sm); line-height: var(--lh-sm); }
.notice code { color: var(--text); }
.notice strong { color: var(--text); font-weight: 600; }
.notice-error { background: var(--negative-soft); border-color: var(--border-strong); }
.sk-line { height: 32px; max-width: 320px; }
.sk-block { height: 280px; }

/* 카테고리 카드 */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--sp-3); }
.cat { display: grid; gap: var(--sp-1); align-content: start; padding: var(--sp-4); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); color: var(--text); text-decoration: none; transition: border-color var(--dur-fast) var(--ease); }
.cat:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface-2); }
.cat-top { display: flex; justify-content: space-between; align-items: baseline; gap: var(--sp-2); }
.cat-name { font-weight: 600; }
.cat-count { font-size: var(--fs-sm); color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cat-desc { font-size: var(--fs-xs); line-height: var(--lh-xs); color: var(--text-2); font-weight: 400; }
.cat.empty-cat .cat-name { color: var(--text-2); }

/* 영상 목록 */
.vlist { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.vrow { display: grid; gap: var(--sp-1); padding: var(--sp-4) 0; border-bottom: 1px solid var(--border); }
.vtitle { font-weight: 600; line-height: var(--lh-h3); color: var(--text); text-decoration: none; }
.vtitle:hover { color: var(--accent); text-decoration: underline; }
.vmeta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-1) var(--sp-2); font-size: var(--fs-xs); line-height: var(--lh-xs); color: var(--text-3); font-variant-numeric: tabular-nums; }
.vsum { font-size: var(--fs-sm); line-height: var(--lh-sm); color: var(--text-2); max-width: 68ch; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.kind::before { content: ""; width: 8px; height: 8px; border-radius: var(--r-full); background: var(--text-3); }
.kind-principle::before { background: var(--concept-1); }
.kind-market::before { background: var(--concept-2); }
.more { justify-self: start; }

/* 필터 */
.filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3) var(--sp-4); }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--r-md); overflow: hidden; }
.seg button { height: 32px; padding: 0 var(--sp-3); background: var(--surface); border: 0; border-left: 1px solid var(--border); font: inherit; font-size: var(--fs-sm); color: var(--text-2); cursor: pointer; white-space: nowrap; }
.seg button:first-child { border-left: 0; }
.seg button:hover { background: var(--surface-2); color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--text); font-weight: 600; }
.seg button:focus-visible { outline-offset: -2px; }
.chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.chip { display: inline-flex; align-items: center; gap: var(--sp-1); min-height: 32px; padding: 0 var(--sp-3); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-full); font: inherit; font-size: var(--fs-sm); line-height: var(--lh-sm); color: var(--text-2); cursor: pointer; text-decoration: none; }
.chip:hover { background: var(--surface-2); color: var(--text); }
.chip[aria-pressed="true"], .chip[aria-current="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--text); font-weight: 600; }
.chip-static { cursor: default; }
.chip-static:hover { background: var(--surface); color: var(--text-2); }
.chip .n { color: var(--text-3); font-variant-numeric: tabular-nums; }
.result-count { font-size: var(--fs-sm); color: var(--text-2); font-variant-numeric: tabular-nums; }
.grow { margin-left: auto; }

/* 영상 페이지 */
.vhead { display: grid; gap: var(--sp-3); }
.summary { max-width: 68ch; }
.claims { list-style: none; margin: 0; padding: 0; display: grid; }
.claim { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: var(--sp-3); padding: var(--sp-3) 0; border-top: 1px solid var(--border); color: var(--text); text-decoration: none; border-radius: var(--r-sm); }
a.claim:hover { color: var(--text); background: var(--surface-2); }
.claim-t { font-size: var(--fs-sm); color: var(--accent); font-variant-numeric: tabular-nums; }
.badge.speaker-own { color: var(--accent); background: var(--accent-soft); }
.badge.speaker-other { color: var(--text); background: var(--surface-2); border: 1px solid var(--border-strong); }
.claim-body { display: grid; gap: var(--sp-1); justify-items: start; font-size: var(--fs-sm); line-height: var(--lh-sm); max-width: 68ch; }
.tagrow { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-2); }
.tag-label { font-size: var(--fs-xs); line-height: var(--lh-xs); font-weight: 500; color: var(--text-2); }

/* 자막 */
.tr { border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); }
.tr > summary { display: flex; align-items: center; min-height: 48px; padding: 0 var(--sp-4); font-weight: 600; cursor: pointer; border-radius: var(--r-lg); }
.tr-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-4); padding: 0 var(--sp-4) var(--sp-4); }
.tr-tools { position: sticky; top: var(--topbar-h); display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); padding: var(--sp-2) 0; background: var(--surface); z-index: 1; }
.tr-tools .input { flex: 1; min-width: 160px; }
.tr-line { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: var(--sp-3); padding: var(--sp-1) 0; font-size: var(--fs-sm); line-height: var(--lh-sm); }
.tr-line a { font-variant-numeric: tabular-nums; }
.tr-line p { max-width: 68ch; }

/* 검색 */
.snips { display: grid; gap: var(--sp-1); margin-top: var(--sp-1); }
.snip { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: var(--sp-2); font-size: var(--fs-sm); line-height: var(--lh-sm); color: var(--text-2); }
.snip a { font-variant-numeric: tabular-nums; }
.progress { font-size: var(--fs-sm); color: var(--text-2); font-variant-numeric: tabular-nums; }

/* 시리즈 */
.slist { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.slist a { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3); min-height: 44px; padding: var(--sp-2) 0; border-bottom: 1px solid var(--border); color: var(--text); text-decoration: none; font-size: var(--fs-sm); }
.slist a:hover { background: var(--surface-2); }
.slist .n { color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* 타임라인 */
.key { width: 10px; height: 10px; border-radius: var(--chart-key-r); flex: none; background: var(--border-strong); }
.key-pending { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--text-3); }
.tl-year { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-2); }
.tl-year h2 { font-size: var(--fs-body); font-weight: 600; letter-spacing: 0; font-family: inherit; line-height: var(--lh-body); }
.tl-year h2 span { font-weight: 400; font-size: var(--fs-sm); color: var(--text-2); margin-left: var(--sp-2); font-variant-numeric: tabular-nums; }
.tl-months { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--sp-1); }
.tl-month { display: grid; grid-template-rows: 140px 20px; justify-items: center; padding: 0; background: none; border: 0; border-radius: var(--r-sm); font: inherit; color: inherit; cursor: pointer; text-decoration: none; }
.tl-month:hover { background: var(--surface-2); color: inherit; }
.tl-month[aria-current="true"] { background: var(--accent-soft); }
.tl-month:disabled, .tl-month.none { cursor: default; background: none; }
.tl-n { display: block; text-align: center; font-size: var(--fs-xs); line-height: 20px; color: var(--text); font-variant-numeric: tabular-nums; }
.tl-bar { display: flex; flex-direction: column-reverse; gap: var(--chart-gap); justify-content: flex-start; width: 100%; max-width: 24px; height: 140px; border-bottom: 1px solid var(--chart-axis); }
.tl-seg { width: 100%; min-height: 2px; }
.tl-seg:nth-last-child(2) { border-radius: var(--sp-1) var(--sp-1) 0 0; }
.tl-m { font-size: var(--fs-xs); line-height: 20px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.tl-table-wrap { display: grid; gap: var(--sp-3); }
.tl-table-wrap > summary { cursor: pointer; font-size: var(--fs-sm); color: var(--text-2); min-height: 32px; display: flex; align-items: center; }
.table td.c, .table th.c { text-align: right; font-variant-numeric: tabular-nums; padding: 0 var(--sp-2); }

/* 질문 패널 */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: var(--z-drawer); display: grid; grid-template-rows: auto minmax(0, 1fr) auto; width: var(--drawer-w); max-width: 100vw; background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow-pop); }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-2) var(--sp-3) var(--sp-2) var(--sp-6); border-bottom: 1px solid var(--border); }
.drawer-head h2 { font-size: var(--fs-h3); line-height: var(--lh-h3); font-weight: 600; }
.drawer-body { overflow-y: auto; padding: var(--sp-6); display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: var(--sp-6); }
.drawer-foot { display: grid; gap: var(--sp-3); padding: var(--sp-4) var(--sp-6); border-top: 1px solid var(--border); }
textarea.input { height: auto; padding: var(--sp-2) var(--sp-3); resize: vertical; line-height: var(--lh-sm); }
.ask-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--sp-2); }
.ask-model { margin-right: auto; }
.ask-model[hidden] { display: none; }
.qa-meta { font-size: var(--fs-xs); line-height: var(--lh-xs); color: var(--text-3); font-variant-numeric: tabular-nums; }
.qa { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-3); }
.qa-q { font-weight: 600; font-size: var(--fs-sm); line-height: var(--lh-sm); white-space: pre-wrap; }
.qa-wait { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); color: var(--text-2); font-variant-numeric: tabular-nums; }
.spin { width: 16px; height: 16px; border: 2px solid var(--border-strong); border-top-color: var(--text-2); border-radius: var(--r-full); animation: spin 1s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.md { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-3); font-size: var(--fs-sm); line-height: var(--lh-sm); }
.md h1, .md h2, .md h3, .md h4 { font-size: var(--fs-body); line-height: var(--lh-body); font-weight: 600; letter-spacing: 0; margin: var(--sp-1) 0 0; }
.md ul, .md ol { margin: 0; padding-left: var(--sp-5); display: grid; gap: var(--sp-1); }
.md blockquote { margin: 0; padding-left: var(--sp-3); border-left: 2px solid var(--border-strong); color: var(--text-2); }
.md pre { margin: 0; padding: var(--sp-3); background: var(--surface-2); border-radius: var(--r-md); overflow-x: auto; }
.md code { background: var(--surface-2); padding: 0 var(--sp-1); border-radius: var(--r-sm); }
.md pre code { background: none; padding: 0; }
.md hr { width: 100%; border: 0; border-top: 1px solid var(--border); margin: 0; }
.md a { overflow-wrap: anywhere; }
.md .table td { height: auto; padding: var(--sp-2) var(--sp-3); }

/* 토스트 */
.toast { z-index: var(--z-toast); padding: var(--sp-3) var(--sp-4); }

@media (max-width: 1024px) {
  .topnav { gap: var(--sp-3); }
}
@media (max-width: 640px) {
  .topbar-in { gap: var(--sp-2); }
  .brand { font-size: var(--fs-sm); }
  .topnav, .desktop-only { display: none; }
  .top-search { max-width: none; }
  .tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-sticky); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); min-height: var(--tabbar-h); padding-bottom: env(safe-area-inset-bottom); background: var(--surface); border-top: 1px solid var(--border); }
  .tabbar a, .tabbar button { display: flex; align-items: center; justify-content: center; background: none; border: 0; border-top: 2px solid transparent; font: inherit; font-size: var(--fs-xs); font-weight: 500; color: var(--text-2); text-decoration: none; cursor: pointer; }
  .tabbar a[aria-current="page"] { color: var(--text); font-weight: 600; border-top-color: var(--accent); }
  .page { padding-bottom: calc(var(--tabbar-h) + var(--sp-8)); }
  .cat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cat-desc { display: none; }
  .cat-top { display: grid; gap: var(--sp-1); }
  .seg { display: flex; }
  .seg button { flex: 1; height: var(--hit-min); }
  .chip { min-height: var(--hit-min); }
  .chips.scroll { flex-wrap: nowrap; overflow-x: auto; padding-bottom: var(--sp-1); }
  .chips.scroll .chip { flex: none; white-space: nowrap; }
  .drawer { top: auto; left: 0; width: 100vw; height: 85dvh; border-left: 0; border-top: 1px solid var(--border); border-radius: var(--r-lg) var(--r-lg) 0 0; }
  .drawer-foot { padding-bottom: calc(var(--sp-4) + env(safe-area-inset-bottom)); }
  .tl-month { grid-template-rows: 116px 20px; }
  .tl-bar { height: 116px; }
  .toast { bottom: calc(var(--tabbar-h) + var(--sp-3)); }
}

/* 공개판(web/build.py --public) */
.site-footer { padding-block: var(--sp-6); color: var(--text-2); font-size: var(--fs-sm); line-height: var(--lh-sm); }
.steps { display: grid; gap: var(--sp-3); padding-left: var(--sp-6); margin-bottom: var(--sp-4); line-height: var(--lh-body, 1.6); }
ol.steps { list-style: decimal; }
ul.steps { list-style: disc; }
.copy-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); margin-top: var(--sp-2); }
.copy-row code { overflow-wrap: anywhere; padding: var(--sp-1) var(--sp-2); border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-2); }
@media (max-width: 767px) { .site-footer { padding-bottom: calc(var(--tabbar-h) + var(--sp-6)); } }
