/* 봉황도감 — 한지 · 먹 · 인주(도장)
   밝은 테마 = 낮의 한지, 어두운 테마 = 밤의 먹지. light-dark()로 한 번에 정의한다. */
:root {
  color-scheme: light dark;
  --paper: light-dark(#f2ebdd, #121010);
  --paper-2: light-dark(#e9dfcb, #1a1614);
  --card: light-dark(#fbf7ee, #1c1816);
  --ink: light-dark(#1d1814, #ece3d5);
  --ink-2: light-dark(#3f362f, #cfc3b3);
  --muted: light-dark(#685c51, #a59686);
  --line: light-dark(#d8cab2, #332b25);
  --line-2: light-dark(#bba98c, #4a3f36);
  --seal: light-dark(#b3261e, #e45a48);
  --seal-ink: light-dark(#fff, #170c09);
  --seal-soft: light-dark(#f3ddd5, #3a1c17);
  --gold: light-dark(#80601a, #d9b25e);
  --gold-soft: light-dark(#efe2bf, #362c16);
  --jade: light-dark(#2b6658, #6cc4ad);
  --jade-soft: light-dark(#d9ebe4, #15302a);
  --bar: #191512;
  --bar-ink: #efe6d8;
  --bar-muted: #a99b8a;
  --serif: "Gowun Batang", "Nanum Myeongjo", "AppleMyungjo", serif;
  --sans: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  --r: 6px;
  --maxw: 1160px;
  interpolate-size: allow-keywords;
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .16s; }
.site-header { view-transition-name: site-header; }
.tabbar { view-transition-name: tabbar; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }
body {
  margin: 0; color: var(--ink); font-family: var(--sans); font-size: 16px; line-height: 1.65; word-break: keep-all; overflow-wrap: anywhere;
  background-color: var(--paper);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .36 0 0 0 0 .25 0 0 0 .06 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
h1, h2, h3 { text-wrap: balance; }
p, li { text-wrap: pretty; }
a { color: inherit; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-underline-offset: 3px; }
a:hover { color: var(--seal); }
:focus-visible { outline: 2px solid var(--seal); outline-offset: 2px; }
img, svg { max-width: 100%; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--seal); color: var(--seal-ink); padding: 8px 14px; z-index: 100; }
.skip:focus { left: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ── 머리띠 (항상 먹색) */
.site-header { position: sticky; top: 0; z-index: 40; background: var(--bar); color: var(--bar-ink); border-bottom: 3px solid var(--seal); }
.header-inner { max-width: var(--maxw); margin: 0 auto; padding: 0 18px; display: flex; align-items: center; gap: 14px; min-height: 58px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--bar-ink); flex: none; }
.brand:hover { color: var(--bar-ink); }
.seal { display: grid; place-items: center; width: 32px; height: 32px; background: #c8321f; color: #fff; font-family: var(--serif); font-weight: 700; font-size: 19px; line-height: 1; border-radius: 3px; box-shadow: inset 0 0 0 2px #c8321f, inset 0 0 0 3.5px rgba(255,255,255,.55); transform: rotate(-4deg); }
.brand .name { font-family: var(--serif); font-weight: 700; font-size: 21px; letter-spacing: -.01em; }
.nav { flex: 1; min-width: 0; }
.nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.nav ul::-webkit-scrollbar { display: none; }
.nav a { display: block; padding: 17px 10px 15px; font-size: 14.5px; font-weight: 600; color: var(--bar-muted); text-decoration: none; white-space: nowrap; border-bottom: 3px solid transparent; margin-bottom: -3px; }
.nav a:hover { color: var(--bar-ink); }
.nav a[aria-current="page"] { color: #fff; border-bottom-color: #f0c35a; }
.tier-btn, .icon-btn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 11px; border-radius: 4px; border: 1px solid #3b322b; background: #241e1a; color: var(--bar-ink); font: inherit; font-size: 13.5px; font-weight: 700; cursor: pointer; white-space: nowrap; flex: none; }
.icon-btn { width: 34px; padding: 0; justify-content: center; }
.tier-btn svg, .icon-btn svg { width: 16px; height: 16px; }
.tier-btn[data-set="true"] { background: #c8321f; border-color: #c8321f; color: #fff; }

/* ── 차수 고르기 (Popover API) */
.tier-dialog { margin: auto; inset: 0; border: 1px solid var(--line-2); border-radius: 8px; background: var(--card); color: var(--ink); padding: 22px; width: min(400px, calc(100vw - 28px)); height: fit-content; box-shadow: 0 24px 70px rgba(0, 0, 0, .35); opacity: 1; transform: none; transition: opacity .15s, transform .15s, overlay .15s allow-discrete, display .15s allow-discrete; }
.tier-dialog:not(:popover-open) { opacity: 0; transform: translateY(8px); }
@starting-style { .tier-dialog:popover-open { opacity: 0; transform: translateY(8px); } }
.tier-dialog::backdrop { background: rgba(15, 10, 8, .5); }
.tier-dialog h2 { font-family: var(--serif); }
.tier-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.tier-opt { height: 48px; border-radius: 5px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); font: inherit; font-weight: 700; font-size: 15px; cursor: pointer; }
.tier-opt:hover { border-color: var(--seal); }
.tier-opt[aria-pressed="true"] { background: var(--seal); border-color: var(--seal); color: var(--seal-ink); }

/* ── 본문 */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 22px 18px 60px; }
.with-rail { display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; }
@media (min-width: 1180px) { .with-rail { grid-template-columns: minmax(0, 1fr) 300px; } }
.rail { display: none; }
@media (min-width: 1180px) { .rail { display: block; } .rail .sticky { position: sticky; top: 90px; display: grid; gap: 16px; } }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.crumbs a { text-decoration: none; }
.crumbs span[aria-hidden] { margin: 0 6px; }
h1 { font-family: var(--serif); font-size: clamp(25px, 3.2vw, 32px); line-height: 1.25; letter-spacing: -.02em; margin: 0 0 6px; font-weight: 700; }
h2 { font-family: var(--serif); font-size: 21px; margin: 34px 0 12px; line-height: 1.3; font-weight: 700; display: flex; align-items: center; gap: 9px; }
h2::before { content: ""; width: 9px; height: 9px; background: var(--seal); transform: rotate(45deg); flex: none; }
.card > h2:first-child, h2.plain { margin-top: 0; }
h2.plain::before, .card h2::before { display: none; }
.card h2 { display: block; }
h3 { font-size: 16.5px; margin: 20px 0 8px; }
.lead { color: var(--ink-2); margin: 0 0 18px; max-width: 70ch; font-size: 16.5px; }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }

/* ── 상자 */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* 바로가기 목록: 아이콘 타일 대신 글자 중심 */
.tool-card { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 10px; text-decoration: none; padding: 13px 14px; border-radius: var(--r); background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--line-2); }
.tool-card:hover { color: inherit; border-left-color: var(--seal); background: color-mix(in srgb, var(--card) 70%, var(--seal-soft)); }
.tool-card .ico { display: none; }
.tool-card b { font-size: 15.5px; }
.tool-card span > span { display: block; font-size: 13px; color: var(--muted); }
.tool-card::after { content: "→"; color: var(--muted); font-size: 15px; }
.tool-card:hover::after { color: var(--seal); }

/* 버튼 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 40px; padding: 0 16px; border-radius: 4px; border: 1px solid var(--seal); background: var(--seal); color: var(--seal-ink); font: inherit; font-weight: 700; font-size: 15px; cursor: pointer; text-decoration: none; }
.btn:hover { color: var(--seal-ink); filter: brightness(1.08); }
.btn.big { height: 46px; padding: 0 22px; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line-2); }
.btn.ghost:hover { border-color: var(--seal); color: var(--seal); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13.5px; }
.btn:disabled { opacity: .6; cursor: default; }
.linklike { border: 0; background: none; padding: 0; font: inherit; color: var(--seal); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* 칩·배지 */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 3px; font-size: 12.5px; font-weight: 600; background: var(--paper-2); color: var(--ink-2); white-space: nowrap; }
button.chip, a.chip { cursor: pointer; font: inherit; font-size: 13.5px; padding: 5px 11px; border: 1px solid var(--line); background: var(--card); text-decoration: none; }
button.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.badge { display: inline-block; white-space: nowrap; padding: 0 6px; border-radius: 3px; font-size: 12px; font-weight: 700; background: var(--gold-soft); color: var(--gold); vertical-align: 2px; }
.badge.red { background: var(--seal-soft); color: var(--seal); }
.badge.jade { background: var(--jade-soft); color: var(--jade); }
.new { display: inline-block; padding: 0 5px; border-radius: 3px; font-size: 10.5px; font-weight: 800; background: var(--seal); color: var(--seal-ink); vertical-align: 2px; margin-right: 5px; letter-spacing: .03em; }
.reward { display: inline-block; padding: 0 6px; border-radius: 3px; background: var(--gold-soft); color: var(--gold); font-size: 12.5px; font-weight: 700; vertical-align: 1px; }

/* 목록 */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { border-top: 1px solid var(--line); }
.list > li:first-child { border-top: 0; }
.note-row { display: grid; grid-template-columns: 86px minmax(0, 1fr); gap: 2px 14px; padding: 11px 4px; text-decoration: none; }
.note-row:hover { color: inherit; background: var(--paper-2); }
.note-row time { color: var(--muted); font-size: 13.5px; font-variant-numeric: tabular-nums; padding-top: 1px; }
.note-row .t { font-weight: 650; }
.note-row .chips { grid-column: 2; }
@media (max-width: 560px) { .note-row { grid-template-columns: 1fr; } .note-row .chips { grid-column: 1; } }

/* 게시글 본문 */
.post h2 { font-size: 18.5px; margin: 28px 0 8px; padding-top: 14px; border-top: 1px solid var(--line); }
.post h3 { font-size: 15px; color: var(--gold); margin: 16px 0 6px; }
.post ul { margin: 0; padding-left: 20px; }
.post li { margin: 5px 0; }
.post li::marker { color: var(--seal); }
.source-box { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; padding: 10px 14px; border-radius: var(--r); background: var(--paper-2); font-size: 13.5px; color: var(--muted); }
.src-link { font-size: 12px; font-weight: 600; color: var(--muted); text-decoration: none; white-space: nowrap; margin-left: 4px; }
.src-link::after { content: " ↗"; }
.src-link:hover { color: var(--seal); }
mark { background: color-mix(in srgb, var(--gold) 28%, transparent); color: inherit; border-radius: 2px; padding: 0 2px; }
.toc a { text-decoration: none; }
.highlights { margin: 8px 0 0; padding-left: 18px; }
.highlights li { margin: 2px 0; }
.highlights li::marker { color: var(--seal); }

/* 표 */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--card); }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
th, td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--paper-2); font-size: 12.5px; color: var(--muted); font-weight: 700; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.mine td { background: var(--seal-soft); }
tr.mine td:first-child { box-shadow: inset 3px 0 0 var(--seal); }
.bar { height: 7px; border-radius: 2px; background: var(--paper-2); overflow: hidden; min-width: 60px; }
.bar > i { display: block; height: 100%; background: var(--seal); transition: width .3s; }
.bar.jade > i { background: var(--jade); }

/* 입력 */
.form-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.field { display: grid; gap: 4px; }
.field label, .field .lbl { font-size: 13px; font-weight: 700; color: var(--muted); }
select, input[type="number"], input[type="text"], input[type="search"] { height: 40px; border-radius: 4px; border: 1px solid var(--line-2); background: var(--card); color: var(--ink); padding: 0 10px; font: inherit; font-size: 15px; min-width: 0; }
input[type="number"] { width: 110px; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 4px; overflow: hidden; background: var(--card); }
.seg button { border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 14px; font-weight: 600; padding: 8px 14px; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.check { display: flex; gap: 12px; align-items: flex-start; padding: 11px 8px; border-radius: 4px; cursor: pointer; }
.check:hover { background: var(--paper-2); }
.check input { width: 22px; height: 22px; accent-color: var(--seal); margin-top: 1px; flex: none; }
.check.done .name { text-decoration: line-through; text-decoration-color: var(--seal); color: var(--muted); }
.check.done { opacity: .78; }
.off-tier .check { opacity: .55; }
.task-meta { font-size: 13px; color: var(--muted); }
.result { margin-top: 16px; display: grid; gap: 12px; }
.mytier { padding: 10px 12px; border-radius: 4px; background: var(--paper-2); font-size: 14.5px; }
.mytier b { color: var(--seal); }

/* 수치 상자 */
.stat-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.stat { padding: 13px 15px; border-radius: var(--r); background: var(--card); border: 1px solid var(--line); }
.stat .k { font-size: 12.5px; color: var(--muted); font-weight: 700; }
.stat .v { font-size: 24px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat .s { font-size: 12.5px; color: var(--muted); }

/* 홈 */
.dash { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.dash .card { display: grid; gap: 6px; align-content: start; }
.dash .card:first-child { border-top: 3px solid var(--seal); }
.dash .k { font-size: 13px; font-weight: 700; color: var(--muted); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.dash .v { font-size: 28px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
a.more { font-size: 13.5px; font-weight: 700; text-decoration: none; color: var(--seal); }
.onboard { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-radius: var(--r); background: var(--seal-soft); border-left: 4px solid var(--seal); margin-bottom: 14px; }
.onboard b { font-size: 16px; }
.streak { font-weight: 800; color: var(--gold); font-size: 13px; }
.week { display: flex; gap: 4px; margin-top: 2px; }
.week i { width: 24px; height: 24px; border-radius: 3px; background: var(--paper-2); display: grid; place-items: center; font-style: normal; font-size: 11px; font-weight: 700; color: var(--muted); }
.week i.on { background: var(--seal); color: var(--seal-ink); transform: rotate(-4deg); }
.week i.today { box-shadow: 0 0 0 1.5px var(--ink); }
.hero-search { display: flex; gap: 8px; }
.hero-search input { flex: 1; height: 46px; border-radius: 4px; border: 1px solid var(--line-2); background: var(--card); color: var(--ink); padding: 0 14px; font: inherit; }

/* 젠 타이머 */
.timers { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.timer { position: relative; padding: 14px; border-radius: var(--r); background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--line-2); display: grid; gap: 3px; }
.timer .name { font-weight: 800; padding-right: 30px; }
.timer .left { font-size: 32px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; line-height: 1.15; }
.timer .when { font-size: 13px; color: var(--muted); }
.timer .memo { height: 32px; font-size: 13.5px; margin: 6px 0 4px; }
.timer.window { border-left-color: var(--gold); }
.timer.window .left { color: var(--gold); }
.timer.ready { border-left-color: var(--jade); background: var(--jade-soft); }
.timer.ready .left { color: var(--jade); }
.timer .x { position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; border-radius: 4px; border: 0; background: transparent; color: var(--muted); font-size: 19px; cursor: pointer; }
.timer .x:hover { background: var(--paper-2); color: var(--seal); }
.preset-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.preset { text-align: left; padding: 12px 14px; border-radius: var(--r); border: 1px solid var(--line); border-left: 3px solid var(--seal); background: var(--card); color: var(--ink); font: inherit; cursor: pointer; display: grid; gap: 1px; }
.preset:hover { background: var(--seal-soft); }
.preset:active { transform: scale(.98); }
.preset b { font-size: 15.5px; }
.preset .t { color: var(--seal); font-weight: 800; font-variant-numeric: tabular-nums; }
.preset .d { font-size: 12.5px; color: var(--muted); }

/* 사냥터 등 정의 목록 */
dl.kv { display: grid; gap: 3px; margin: 6px 0 0; font-size: 14.5px; }
dl.kv > div { display: grid; grid-template-columns: 62px minmax(0, 1fr); gap: 8px; }
dl.kv dt { color: var(--muted); font-weight: 700; font-size: 13px; padding-top: 1px; }
dl.kv dd { margin: 0; }
article.card { content-visibility: auto; contain-intrinsic-size: auto 320px; }
.card.skill.removed { opacity: .72; }

/* 광고 */
.ad { display: grid; place-items: center; min-height: 100px; margin: 22px 0; position: relative; }
.ad.placeholder { border: 1px dashed var(--line-2); color: var(--muted); font-size: 12px; border-radius: var(--r); }
.ad.rail-ad { min-height: 600px; margin: 0; }
.ad-label { position: absolute; top: 4px; left: 8px; font-size: 11px; color: var(--muted); }

/* 기타 */
.notice { padding: 11px 14px; border-radius: var(--r); background: var(--gold-soft); color: var(--ink); font-size: 14px; border-left: 3px solid var(--gold); }
details.acc { border-top: 1px solid var(--line); }
details.acc:first-of-type { border-top: 0; }
details.acc summary { cursor: pointer; padding: 13px 4px; font-weight: 650; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
details.acc summary::-webkit-details-marker { display: none; }
details.acc summary::after { content: "+"; color: var(--seal); font-weight: 400; font-size: 20px; line-height: 1; }
details.acc[open] summary::after { content: "–"; }
details.acc .body { padding: 0 4px 14px; }
details::details-content { transition: height .2s, content-visibility .2s allow-discrete; height: 0; overflow: clip; }
details[open]::details-content { height: auto; }
kbd { display: inline-block; font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; padding: 0 6px; border-radius: 3px; border: 1px solid var(--line-2); border-bottom-width: 2px; background: var(--card); white-space: nowrap; }
.countdown { font-variant-numeric: tabular-nums; }
.empty { padding: 26px; text-align: center; color: var(--muted); }
.pill-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 14px; }
.toc a.chip { display: inline-flex; padding: 4px 12px; color: var(--ink); }

/* 바닥글 */
.site-footer { border-top: 1px solid var(--line); color: var(--muted); font-size: 13.5px; }
.footer-inner { max-width: var(--maxw); margin: 0 auto; padding: 24px 18px 40px; display: grid; gap: 12px; }
.footer-inner nav { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.footer-inner a { text-decoration: none; }

/* ── 모바일: 아래 탭바 */
.tabbar { display: none; }
@media (max-width: 820px) {
  .nav { display: none; }
  .header-inner { min-height: 52px; gap: 8px; }
  .tier-btn { margin-left: auto; }
  .wrap { padding: 16px 14px 40px; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; background: var(--bar); border-top: 1px solid #2c2520; padding-bottom: env(safe-area-inset-bottom); }
  .tabbar a { display: grid; justify-items: center; gap: 1px; padding: 8px 0 7px; font-size: 11px; font-weight: 700; color: var(--bar-muted); text-decoration: none; }
  .tabbar a svg { width: 22px; height: 22px; }
  .tabbar a[aria-current="page"] { color: #fff; }
  .tabbar a[aria-current="page"] svg { color: #f0c35a; }
  body { padding-bottom: 66px; }
  h2 { font-size: 19px; }
}
@media (prefers-reduced-motion: reduce) { *, ::view-transition-group(*) { transition: none !important; animation: none !important; } }
@media print { .site-header, .ad, .rail, .site-footer, .tabbar { display: none !important; } }
