/* 모바일 먼저. 넓은 화면은 720 · 1024에서 넓힌다. */
:root {
  --paper: #f7f2e7;
  --paper-2: #efe7d6;
  --card: #fffdf8;
  --ink: #1a2142;
  --ink-2: #4b5273;
  --ink-3: #7a7f97;
  --navy: #141a36;
  --navy-2: #1f2850;
  --gold: #a9833b;
  --gold-2: #d8b96b;
  --line: rgba(26, 33, 66, .14);
  --night: #120c1b;
  --crimson: #c0354b;
  --wing: linear-gradient(110deg, #8fdcff, #c3a6ff 38%, #ffc2df 68%, #ffe9a6);
  --serif: "Noto Serif KR", "Nanum Myeongjo", serif;
  --sans: "Pretendard Variable", Pretendard, "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  --top: 56px;
  --r: 14px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html.locked { overflow: hidden; }
html { scroll-padding-top: calc(var(--top) + 60px); -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.7 var(--sans); word-break: keep-all; overflow-wrap: anywhere; }
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
h1, h2, h3, h4, p, ul, ol, dl, dd, figure, blockquote { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
a, button { -webkit-touch-callout: none; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.skip { position: absolute; left: -999px; top: 0; z-index: 100; background: var(--gold-2); color: var(--navy); padding: 10px 14px; }
.skip:focus { left: 8px; top: 8px; }
:focus-visible { outline: 3px solid #7fb6ff; outline-offset: 2px; }
.wrap { width: min(1120px, 100% - 36px); margin-inline: auto; }
.wrap.narrow { width: min(760px, 100% - 36px); }

/* ── 머리띠 ── */
.top { position: sticky; top: 0; z-index: 30; height: var(--top); display: flex; align-items: center; gap: 6px; padding: 0 0 0 10px; background: rgba(20, 26, 54, .94); backdrop-filter: blur(10px); color: #f4ecd8; border-bottom: 1px solid rgba(216, 185, 107, .28); }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; flex: none; }
.brand img { width: 34px; height: 34px; object-fit: contain; }
.brand span { display: none; font-family: var(--serif); font-weight: 700; font-size: 15px; letter-spacing: -.01em; }
.tabs { display: flex; overflow-x: auto; scrollbar-width: none; flex: 1; height: 100%; align-items: stretch; padding-right: 6px; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { flex: 1 0 auto; display: flex; align-items: center; justify-content: center; padding: 0 6px; font-size: 13.5px; letter-spacing: -.02em; text-decoration: none; color: rgba(244, 236, 216, .72); position: relative; white-space: nowrap; }
.tabs a.on { color: #fff; font-weight: 700; }
.tabs a.on::after { content: ""; position: absolute; left: 6px; right: 6px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--wing); }

/* ── 공통 글 ── */
.eyebrow { font-size: 12.5px; font-weight: 700; letter-spacing: .12em; color: var(--gold); margin-bottom: 10px; }
.eyebrow.light { color: var(--gold-2); }
h1, h2, h3 { font-family: var(--serif); letter-spacing: -.02em; line-height: 1.32; }
.page-head { padding: 40px 0 22px; }
.page-head h1 { font-size: clamp(28px, 7.6vw, 46px); font-weight: 900; }
.page-head.center { text-align: center; }
.lead { color: var(--ink-2); margin-top: 12px; max-width: 46em; }
.page-head.center .lead { margin-inline: auto; }
.block { padding: 34px 0 6px; }
.block > h2, .quartet h2 { font-size: clamp(22px, 5.6vw, 30px); font-weight: 700; padding-bottom: 10px; margin-bottom: 16px; position: relative; }
.block > h2::after, .quartet h2::after { content: ""; position: absolute; left: 0; bottom: 0; width: 56px; height: 3px; border-radius: 3px; background: var(--wing); }
.aside { margin-top: 14px; padding: 12px 14px; border-left: 3px solid var(--gold-2); background: rgba(216, 185, 107, .12); border-radius: 0 10px 10px 0; color: var(--ink-2); font-size: 15px; }
.subnav { position: sticky; top: var(--top); z-index: 20; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -18px; padding: 10px 18px; background: linear-gradient(var(--paper) 78%, rgba(247, 242, 231, 0)); }
.subnav::-webkit-scrollbar { display: none; }
.subnav a { flex: none; display: inline-flex; align-items: center; min-height: 40px; padding: 0 15px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); font-size: 14.5px; text-decoration: none; color: var(--ink-2); }
.subnav a:active, .chips button:active, .seg button:active, .thumbs button:active { background: var(--paper-2); }
.subnav a:hover { border-color: var(--gold); color: var(--ink); }

.btn:active { transform: translateY(1px); filter: brightness(.96); }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 20px; border-radius: 999px; font-weight: 700; font-size: 15.5px; text-decoration: none; border: 1.5px solid transparent; }
.btn.primary { background: linear-gradient(180deg, #e7cc85, #c9a24f); color: #231a05; box-shadow: 0 6px 18px rgba(169, 131, 59, .32); }
.btn.ghost { border-color: rgba(244, 236, 216, .6); color: #fff; background: rgba(20, 26, 54, .35); }
.btn.ghost.dark { border-color: var(--line); color: var(--ink); background: var(--card); }
.btn.play { background: var(--wing); color: #1a1440; box-shadow: 0 6px 20px rgba(150, 130, 230, .4); flex: 1 0 100%; }
@media (min-width: 720px) { .btn.play { flex: none; } }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.actions.center { justify-content: center; }

/* ── 처음: 히어로 ── */
.hero { position: relative; background: var(--navy); color: #fff; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; min-height: min(92svh, 860px); }
.hero-art { position: absolute; inset: 0 0 auto 0; height: min(78svh, 700px); }
.hero-art img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 26%; }
.hero-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(20, 26, 54, .1) 0%, rgba(20, 26, 54, 0) 22%, rgba(20, 26, 54, .62) 42%, rgba(20, 26, 54, .9) 60%, var(--navy) 84%); }
.hero-body { position: relative; padding: 170px 0 32px; z-index: 1; }
.logo img { width: min(86%, 430px); filter: drop-shadow(0 6px 18px rgba(8, 10, 30, .6)); margin: 0 0 14px -6px; }
.hero-line { font-family: var(--serif); font-weight: 700; font-size: clamp(21px, 5.8vw, 30px); line-height: 1.4; }
.hero-text { margin-top: 10px; color: rgba(255, 255, 255, .86); max-width: 30em; }

.now { display: grid; gap: 22px; padding: 30px 0 8px; }
.statuscard { background: var(--navy); color: #eef0ff; border-radius: var(--r); padding: 16px 16px 14px; font-size: 14.5px; border: 1px solid rgba(216, 185, 107, .45); box-shadow: 0 14px 34px rgba(20, 26, 54, .22); position: relative; overflow: hidden; }
.statuscard::before { content: ""; position: absolute; left: 0; top: 0; right: 0; height: 3px; background: var(--wing); }
.sc-head { display: flex; flex-wrap: wrap; gap: 6px; }
.sc-head span { padding: 2px 9px; border-radius: 999px; background: rgba(255, 255, 255, .1); font-size: 13px; }
.statuscard dl { margin: 12px 0 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.statuscard dl div { background: rgba(255, 255, 255, .06); border-radius: 10px; padding: 9px 11px; }
.statuscard dt { font-size: 12px; color: var(--gold-2); letter-spacing: .08em; }
.statuscard dd { font-family: var(--serif); font-size: 22px; font-weight: 700; line-height: 1.3; }
.statuscard dd small { display: block; font-family: var(--sans); font-size: 12px; font-weight: 400; color: rgba(238, 240, 255, .7); }
.sc-foot { font-size: 13px; color: rgba(238, 240, 255, .75); }
.now-text h2 { font-size: clamp(24px, 6.4vw, 34px); font-weight: 900; }
.now-text > p:not(.eyebrow) { margin-top: 12px; color: var(--ink-2); }
.counts { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 18px; }
.counts li { font-size: 13.5px; color: var(--ink-2); display: flex; align-items: baseline; gap: 5px; }
.counts b { font-family: var(--serif); font-size: 26px; color: var(--ink); }

/* ── 정령 × 특기 ── */
.band { margin-top: 30px; padding: 38px 0 40px; background: linear-gradient(180deg, var(--paper-2), var(--paper)); border-block: 1px solid var(--line); }
.band h2, .first-faces h2 { font-size: clamp(24px, 6.4vw, 34px); font-weight: 900; }
.picker { margin-top: 22px; display: grid; gap: 20px; }
.pick-col h3 { font-family: var(--sans); font-size: 13px; letter-spacing: .1em; color: var(--ink-3); margin-bottom: 8px; }
.pick-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.pick-row button { background: var(--card); border: 1.5px solid var(--line); border-radius: 12px; padding: 0 0 9px; overflow: hidden; text-align: center; display: grid; gap: 1px; transition: transform .15s, box-shadow .15s; }
.pick-row button img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; object-position: 50% 22%; margin-bottom: 7px; }
.pick-row.emblems { grid-template-columns: repeat(4, 1fr); }
.pick-row.emblems button { padding-top: 10px; }
.pick-row.emblems img { width: 58%; aspect-ratio: 1; object-fit: contain; margin: 0 auto 6px; }
.pick-row b { font-family: var(--serif); font-size: 16px; }
.pick-row small { font-size: 12px; color: var(--ink-3); line-height: 1.3; padding: 0 4px; }
.pick-row button.on { border-color: transparent; background: linear-gradient(var(--card), var(--card)) padding-box, var(--wing) border-box; border-width: 2.5px; box-shadow: 0 10px 24px rgba(120, 110, 200, .22); transform: translateY(-2px); }
.pick-result { background: var(--navy); color: #eef0ff; border-radius: var(--r); padding: 18px 16px; }
.pick-result h3 { font-size: 24px; font-weight: 900; background: var(--wing); -webkit-background-clip: text; background-clip: text; color: transparent; display: inline-block; }
.pr-note { font-size: 14px; color: rgba(238, 240, 255, .72); margin-top: 2px; }
.pr-grid { display: grid; gap: 12px; margin-top: 14px; }
.pick-result h4 { font-size: 12px; letter-spacing: .1em; color: var(--gold-2); font-weight: 700; margin-bottom: 2px; }
.pr-grid p { font-size: 15px; }
.pr-who { margin-top: 16px; }
.whos { display: grid; gap: 8px; margin-top: 8px; }
.who { display: flex; align-items: center; gap: 10px; text-decoration: none; background: rgba(255, 255, 255, .07); border-radius: 10px; padding: 6px 10px 6px 6px; font-size: 13px; line-height: 1.35; color: rgba(238, 240, 255, .8); }
.who img { width: 66px; height: 44px; object-fit: cover; object-position: 50% 20%; border-radius: 7px; flex: none; }
.who b { display: block; font-size: 15px; color: #fff; }
.whos.small .who { background: var(--paper-2); color: var(--ink-2); }
.whos.small .who b { color: var(--ink); }

/* ── 처음: 문 다섯 · 첫 얼굴 ── */
.doors { display: grid; gap: 10px; padding: 34px 0 6px; }
.door { position: relative; display: grid; align-content: end; min-height: 124px; padding: 16px; border-radius: var(--r); overflow: hidden; text-decoration: none; color: #fff; background: var(--navy); isolation: isolate; }
.door img { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; }
.door::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, rgba(16, 20, 44, .92) 0%, rgba(16, 20, 44, .72) 48%, rgba(16, 20, 44, .18) 100%); }
.door span { font-size: 12px; letter-spacing: .12em; color: var(--gold-2); font-weight: 700; }
.door b { font-family: var(--serif); font-size: 21px; line-height: 1.3; }
.door i { font-style: normal; font-size: 13.5px; color: rgba(255, 255, 255, .78); }
.door::after { content: "→"; position: absolute; right: 16px; bottom: 14px; font-size: 20px; color: var(--gold-2); }
.first-faces { padding: 40px 0 10px; }
.more { margin-top: 14px; text-align: right; }
.more a { font-weight: 700; color: var(--gold); text-decoration: none; }

/* ── 인물 카드 ── */
.people-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 16px; }
.pcard { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; text-decoration: none; transition: transform .15s, box-shadow .15s; }
@media (hover: hover) { .pcard:hover { transform: translateY(-3px); box-shadow: 0 12px 26px rgba(26, 33, 66, .14); } }
.pcard:active, .door:active, .who:active, .sc:active, .vs-card:active { transform: scale(.985); }
.pimg { display: block; aspect-ratio: 3 / 2; background: var(--paper-2); overflow: hidden; }
.pimg img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 20%; }
.pbody { display: block; padding: 9px 11px 12px; }
.prole { display: block; font-size: 12px; color: var(--ink-3); line-height: 1.4; }
.pcard b { font-family: var(--serif); font-size: 18px; line-height: 1.4; }
.cls { font-style: normal; font-family: var(--sans); font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--navy); color: var(--gold-2); vertical-align: 3px; margin-left: 4px; white-space: nowrap; }
.pline { display: block; margin-top: 4px; font-size: 13px; color: var(--ink-2); line-height: 1.5; }
.g-spirit .pbody, .sheet-text.g-spirit { border-top: 3px solid transparent; border-image: var(--wing) 1; }
.g-twins .pbody { border-top: 3px solid var(--gold-2); }
.people-grid.shadow .pcard { background: #1c1326; border-color: rgba(192, 53, 75, .35); color: #f1e6ee; }
.people-grid.shadow .prole, .people-grid.shadow .pline { color: rgba(241, 230, 238, .66); }

.finder { position: sticky; top: var(--top); z-index: 20; background: linear-gradient(var(--paper) 82%, rgba(247, 242, 231, 0)); margin: 0 -18px; padding: 8px 18px 10px; }
.search { display: block; }
.search input { width: 100%; height: 46px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card); padding: 0 14px; font-size: 16px; }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -18px; padding: 0 18px; }
.chips::-webkit-scrollbar { display: none; }
.chips button, .seg button { flex: none; min-height: 40px; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 0 15px; font-size: 14.5px; color: var(--ink-2); }
.chips small { color: var(--ink-3); }
.chips button.on, .seg button.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.chips button.on small { color: var(--gold-2); }
.count { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.empty { padding: 30px 0; text-align: center; color: var(--ink-2); }
.empty button { border: 0; background: none; text-decoration: underline; color: var(--gold); font-weight: 700; }
.quartet { margin: 44px 0 10px; padding: 22px 18px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); }
.quartet li { padding: 8px 0; border-bottom: 1px dashed var(--line); color: var(--ink-2); }
.quartet li b { color: var(--ink); margin-right: 6px; }
.quartet p { margin-top: 12px; color: var(--ink-2); font-size: 15px; }

/* ── 인물 창 ── */
.sheet { border: 0; padding: 0; width: 100%; max-width: 100%; height: 100dvh; max-height: 100dvh; margin: 0; background: var(--paper); color: var(--ink); overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.sheet::backdrop { background: rgba(12, 14, 32, .72); backdrop-filter: blur(3px); }
.sheet-bar { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center; padding: 6px 8px 6px 16px; background: rgba(20, 26, 54, .95); color: #f4ecd8; font-size: 13px; }
.sheet-bar .x { width: 44px; height: 44px; border: 0; background: none; color: #fff; font-size: 30px; line-height: 1; }
.sheet-art figure { background: #0f1226; position: relative; touch-action: pan-y; }
.dots { position: absolute; left: 0; right: 0; bottom: 8px; display: flex; justify-content: center; gap: 5px; pointer-events: none; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: rgba(255, 255, 255, .45); box-shadow: 0 0 3px rgba(0, 0, 0, .5); }
.dots i.on { background: #fff; width: 16px; border-radius: 3px; }
.sheet-art figure img { width: 100%; aspect-ratio: 1216 / 832; object-fit: cover; }
.thumbs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 10px 14px; background: var(--paper-2); }
.thumbs::-webkit-scrollbar { display: none; }
.thumbs button { flex: none; min-height: 40px; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 0 15px; font-size: 14.5px; color: var(--ink-2); }
.thumbs button.skill { border-color: var(--gold-2); }
.thumbs button.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.sheet-text { padding: 18px 18px 8px; }
.sheet-text .prole { font-size: 13px; }
.sheet-text h2 { font-size: 32px; font-weight: 900; margin-top: 2px; }
.sheet-text h2 .cls { font-size: 12px; vertical-align: 8px; }
.sheet-text blockquote { margin: 12px 0 4px; padding: 12px 14px; background: var(--card); border-left: 3px solid var(--gold-2); border-radius: 0 10px 10px 0; font-family: var(--serif); font-size: 17px; line-height: 1.6; }
.sheet-text .pline { font-size: 16px; margin: 10px 0 4px; }
.sheet-text dl { margin-top: 14px; }
.sheet-text dl div { display: grid; grid-template-columns: 5.6em 1fr; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.sheet-text dt { font-size: 13px; font-weight: 700; color: var(--gold); padding-top: 2px; }
.sheet-text dd { font-size: 15.5px; }
.notes { margin-top: 6px; padding: 12px 0 2px; border-top: 1px solid var(--line); }
.notes li { position: relative; padding-left: 16px; font-size: 15px; color: var(--ink-2); margin-bottom: 6px; }
.notes li::before { content: ""; position: absolute; left: 2px; top: .7em; width: 6px; height: 6px; border-radius: 50%; background: var(--gold-2); }
.ties { margin-top: 12px; }
.ties h3 { font-family: var(--sans); font-size: 12px; letter-spacing: .1em; color: var(--ink-3); margin-bottom: 6px; }
.ties a { display: flex; align-items: center; gap: 10px; padding: 7px 12px 7px 7px; margin-bottom: 6px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; text-decoration: none; }
.ties img { width: 66px; height: 44px; object-fit: cover; object-position: 50% 20%; border-radius: 7px; flex: none; }
.ties b { display: block; font-family: var(--serif); font-size: 16px; color: var(--ink); }
.ties span { font-size: 14px; color: var(--ink-2); line-height: 1.45; }
.sheet-nav { position: sticky; bottom: 0; z-index: 2; display: flex; justify-content: space-between; gap: 8px; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); background: linear-gradient(rgba(247, 242, 231, 0), var(--paper) 30%); }
.sheet-nav a { flex: 1; text-align: center; padding: 12px 8px; box-shadow: 0 4px 14px rgba(26, 33, 66, .1); border: 1px solid var(--line); border-radius: 12px; background: var(--card); text-decoration: none; font-weight: 700; font-size: 14.5px; }

/* ── 프롤로그 ── */
body[data-page="prologue"] { background: #10142c; }
#prologue .page-head h1, #prologue .toon-end h2 { color: #fff; }
#prologue .lead, #prologue .toon-end p:not(.eyebrow) { color: rgba(255, 255, 255, .78); }
.toon { width: min(800px, 100%); margin: 6px auto 0; }
.toon img { width: 100%; }
.toon-progress { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; height: 44px; display: flex; align-items: center; justify-content: flex-end; padding: 0 10px calc(env(safe-area-inset-bottom)); background: rgba(16, 20, 44, .9); transform: translateY(100%); transition: transform .25s; }
.toon-progress.on { transform: none; }
.toon-progress span { position: absolute; left: 0; top: 0; width: 100%; height: 3px; background: var(--wing); transform: scaleX(0); transform-origin: 0 50%; }
.toon-progress button { min-height: 34px; border: 1px solid rgba(255, 255, 255, .35); background: none; color: #fff; border-radius: 999px; padding: 0 14px; font-size: 13px; }
.toon-end { text-align: center; padding: 46px 0 60px; }
.toon-end h2 { font-size: clamp(24px, 6.4vw, 34px); font-weight: 900; }
.toon-end p:not(.eyebrow) { margin-top: 8px; }

/* ── 세계 ── */
.timeline { border-left: 2px solid var(--gold-2); margin-left: 7px; }
.timeline li { position: relative; padding: 0 0 22px 22px; }
.timeline li::before { content: ""; position: absolute; left: -8px; top: 5px; width: 14px; height: 14px; border-radius: 50%; background: var(--paper); border: 3px solid var(--gold); }
.timeline li.nowpoint::before { background: var(--gold-2); box-shadow: 0 0 0 6px rgba(216, 185, 107, .28); }
.timeline b { font-size: 13px; color: var(--gold); letter-spacing: .04em; }
.timeline h3 { font-size: 20px; margin: 1px 0 4px; }
.timeline p { color: var(--ink-2); }
.versus { display: grid; gap: 12px; }
.vs-card { display: block; border-radius: var(--r); overflow: hidden; text-decoration: none; border: 1px solid var(--line); background: var(--card); }
.vs-card img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; object-position: 50% 20%; }
.vs-card > div { padding: 14px 16px 18px; }
.vs-card span { font-size: 12.5px; color: var(--gold); font-weight: 700; letter-spacing: .06em; }
.vs-card h3 { font-size: 26px; font-weight: 900; }
.vs-card blockquote { font-family: var(--serif); font-size: 17px; line-height: 1.6; margin: 8px 0; }
.vs-card p { font-size: 14.5px; color: var(--ink-2); }
.vs-card.dusk { background: #1c1326; color: #f4e9f0; border-color: rgba(192, 53, 75, .4); }
.vs-card.dusk span { color: #ef8fa0; }
.vs-card.dusk p { color: rgba(244, 233, 240, .7); }
.rules, .factions, .grade-cards, .quests { display: grid; gap: 10px; }
.rules article, .factions article, .grade-cards article, .quests article { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px 16px; }
.rules i { font-style: normal; font-family: var(--serif); font-size: 13px; color: var(--gold); letter-spacing: .1em; }
.rules h3, .factions h3, .grade-cards h3, .quests h3 { font-size: 18.5px; margin-bottom: 4px; }
.rules p, .factions p, .grade-cards p, .quests p { color: var(--ink-2); font-size: 15px; }
.night { margin-top: 44px; padding: 46px 0 54px; color: #f4e9f0; background: linear-gradient(180deg, rgba(18, 12, 27, .86), rgba(18, 12, 27, .95)), url(img/seal-800.webp) center top / cover; }
.night h2 { font-size: clamp(24px, 6.4vw, 34px); font-weight: 900; }
.night .lead { color: rgba(244, 233, 240, .78); }

/* ── 아카데미 ── */
.faces2 { display: grid; gap: 10px; margin-top: 14px; }
.faces2 article { border-radius: 12px; padding: 14px 16px; background: var(--card); border: 1px solid var(--line); }
.faces2 article + article { background: var(--navy); color: #eef0ff; border-color: var(--navy); }
.faces2 span { font-family: var(--serif); font-weight: 900; font-size: 20px; color: var(--gold); }
.faces2 article + article span { color: var(--gold-2); }
.classes { display: grid; gap: 10px; margin-top: 16px; }
.classes article { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; display: grid; grid-template-columns: 72px 1fr; column-gap: 14px; align-items: center; }
.classes article > img { width: 72px; height: 72px; object-fit: contain; grid-row: span 2; }
.classes h3 { font-size: 22px; font-weight: 900; align-self: end; }
.classes article > p { font-size: 14.5px; color: var(--ink-2); align-self: start; }
.classes .whos { grid-column: 1 / -1; margin-top: 12px; }
.ladder { display: grid; grid-template-columns: repeat(9, 1fr); gap: 4px; margin-top: 16px; align-items: end; }
.ladder li { text-align: center; font-family: var(--serif); font-weight: 900; font-size: 13px; padding: 6px 0; border-radius: 8px 8px 3px 3px; background: var(--navy); color: var(--gold-2); }
.ladder li:nth-child(1) { height: 92px; background: linear-gradient(180deg, #e7cc85, #b88f3f); color: #241a04; }
.ladder li:nth-child(2) { height: 84px; } .ladder li:nth-child(3) { height: 76px; } .ladder li:nth-child(4) { height: 68px; }
.ladder li:nth-child(5) { height: 60px; } .ladder li:nth-child(6) { height: 52px; } .ladder li:nth-child(7) { height: 46px; }
.ladder li:nth-child(8) { height: 40px; } .ladder li:nth-child(9) { height: 34px; }
.ladder li.freshman { background: var(--paper-2); color: var(--ink); border: 1.5px dashed var(--gold); }
.ladder-note { font-size: 13.5px; color: var(--ink-3); margin: 8px 0 16px; }
.duel { margin-top: 12px; background: var(--navy); color: #eef0ff; border-radius: var(--r); padding: 16px; }
.duel h3 { font-size: 18px; }
.duel-row { display: flex; align-items: end; gap: 12px; margin-top: 10px; }
.duel-row label { flex: 1; font-size: 12.5px; color: var(--gold-2); display: grid; gap: 4px; }
.duel-row select { height: 46px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, .25); background: #232c57; color: #fff; padding: 0 10px; font-family: var(--serif); font-weight: 700; font-size: 18px; }
.duel-row > span { padding-bottom: 11px; color: rgba(238, 240, 255, .6); }
.duel-out { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: rgba(255, 255, 255, .08); font-size: 15px; border-left: 3px solid var(--gold-2); }
.duel-out.lose { border-left-color: #ef8fa0; } .duel-out.win { border-left-color: #8fdcff; }
.seg { display: flex; gap: 6px; }
.day { margin-top: 14px; display: grid; gap: 8px; counter-reset: slot; }
.day li { counter-increment: slot; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px 12px 50px; position: relative; }
.day li::before { content: counter(slot); position: absolute; left: 14px; top: 12px; width: 26px; height: 26px; border-radius: 50%; background: var(--navy); color: var(--gold-2); font-family: var(--serif); font-weight: 700; font-size: 14px; display: grid; place-items: center; }
.day b { font-family: var(--serif); font-size: 17.5px; }
.day p { font-size: 14.5px; color: var(--ink-2); }
.year { display: grid; gap: 6px; margin-top: 14px; }
.year li { display: grid; grid-template-columns: 62px 1fr; gap: 12px; align-items: start; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 11px 14px; }
.year li > span { font-family: var(--serif); font-weight: 900; font-size: 19px; color: var(--gold); }
.year small { display: block; font-size: 11.5px; color: var(--ink-3); letter-spacing: .06em; }
.year b { font-family: var(--serif); font-size: 17px; }
.year p { font-size: 14px; color: var(--ink-2); }
.year li.break { background: var(--paper-2); border-style: dashed; }
.homes { margin-top: 14px; padding: 16px; border-radius: var(--r); background: var(--navy); color: #eef0ff; }
.homes h3 { font-size: 18px; margin-bottom: 8px; }
.homes ul { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.homes li { background: rgba(255, 255, 255, .08); border-radius: 10px; padding: 9px 11px; font-size: 14.5px; }
.homes a { color: var(--gold-2); font-weight: 700; text-decoration: none; }
.homes p { margin-top: 10px; font-size: 14.5px; color: rgba(238, 240, 255, .78); }
.places { display: grid; gap: 10px; }
.places figure { position: relative; border-radius: var(--r); overflow: hidden; background: var(--navy); color: #fff; }
.places img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }
.places figcaption { position: absolute; left: 0; right: 0; bottom: 0; padding: 40px 14px 12px; background: linear-gradient(180deg, transparent, rgba(12, 14, 32, .9) 62%); }
.places small { font-size: 11.5px; letter-spacing: .08em; color: var(--gold-2); }
.places b { display: block; font-family: var(--serif); font-size: 20px; line-height: 1.3; }
.places p { font-size: 13.5px; color: rgba(255, 255, 255, .86); line-height: 1.5; }
.chips-line { margin-top: 12px; font-size: 13.5px; color: var(--ink-3); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chips-line span { padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--ink-2); }
.quests span { font-size: 12px; font-weight: 700; letter-spacing: .08em; color: var(--gold); }
.quests .back { background: var(--navy); color: #eef0ff; border-color: var(--navy); }
.quests .back p { color: rgba(238, 240, 255, .78); }
.quests .back span { color: var(--gold-2); }

/* ── 가이드 ── */
.steps { counter-reset: step; display: grid; gap: 8px; }
.steps li { counter-increment: step; position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px 12px 54px; }
.steps li::before { content: counter(step); position: absolute; left: 14px; top: 13px; width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(180deg, #e7cc85, #c9a24f); color: #241a04; font-family: var(--serif); font-weight: 900; display: grid; place-items: center; }
.steps b { font-family: var(--serif); font-size: 18px; }
.steps p { font-size: 14.5px; color: var(--ink-2); }
.note { margin-top: 14px; padding: 16px; border-radius: var(--r); background: var(--navy); color: #eef0ff; }
.note h3 { font-size: 18px; margin-bottom: 6px; color: var(--gold-2); }
.note p { font-size: 15px; color: rgba(238, 240, 255, .86); }
.note p + p { margin-top: 8px; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; background: rgba(216, 185, 107, .22); padding: 1px 6px; border-radius: 6px; }
.copies { display: grid; gap: 10px; }
.copies article { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; }
.copies h3 { font-size: 17px; margin-bottom: 6px; }
.copies p { font-size: 14.5px; color: var(--ink-2); background: var(--paper-2); border-radius: 10px; padding: 10px 12px; }
.copy { margin-top: 10px; min-height: 42px; padding: 0 18px; border-radius: 999px; border: 0; background: var(--navy); color: #fff; font-weight: 700; }
.status-demo { display: grid; gap: 12px; margin-top: 14px; }
.status-demo pre { margin: 0; background: var(--navy); color: #dfe4ff; border-radius: var(--r); padding: 14px; font: 12.5px/1.75 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; overflow-x: auto; white-space: pre; }
.status-demo pre span { border-radius: 4px; cursor: pointer; }
.status-demo pre span.hit { background: rgba(216, 185, 107, .32); color: #fff; }
.status-demo dl div { padding: 9px 12px; border-radius: 10px; border: 1px solid transparent; cursor: pointer; }
.status-demo dl div.hit { background: var(--card); border-color: var(--gold-2); }
.status-demo dt { font-weight: 700; font-size: 14px; color: var(--gold); }
.status-demo dd { font-size: 14.5px; color: var(--ink-2); }
.shortcuts { display: grid; gap: 6px; }
.sc { display: grid; grid-template-columns: 5.2em 1fr auto; gap: 10px; align-items: center; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 11px 14px; min-height: 52px; }
.sc code { font-size: 15px; font-weight: 700; background: none; padding: 0; color: var(--ink); }
.sc span { font-size: 14.5px; color: var(--ink-2); }
.sc i { font-style: normal; font-size: 12.5px; color: var(--gold); font-weight: 700; }
.tips li { padding: 12px 0; border-bottom: 1px solid var(--line); color: var(--ink-2); }
.tips b { color: var(--ink); }
#guide .actions { margin-bottom: 20px; }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); z-index: 60; background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 14px; opacity: 0; pointer-events: none; transition: .2s; max-width: 90vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border: 1px solid rgba(216, 185, 107, .5); }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ── 바닥 ── */
.foot { margin-top: 60px; padding: 34px 0 calc(40px + env(safe-area-inset-bottom)); background: var(--navy); color: rgba(244, 236, 216, .78); text-align: center; }
body[data-page="prologue"] .foot, body[data-page="world"] .foot { margin-top: 0; }
.foot img { width: min(70%, 360px); margin: 0 auto 10px; }
.foot p { font-size: 13.5px; }
.foot nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; margin-top: 14px; }
.foot nav a { font-size: 13.5px; color: var(--gold-2); text-decoration: none; }

/* ── 넓은 화면 ── */
@media (min-width: 720px) {
  :root { --top: 62px; }
  .top { padding-left: 22px; }
  .brand span { display: block; }
  .tabs { justify-content: flex-end; padding-right: 18px; }
  .tabs a { flex: none; font-size: 15px; padding: 0 14px; letter-spacing: 0; }
  .tabs a.on::after { left: 10px; right: 10px; }
  .hero { min-height: min(82svh, 760px); justify-content: center; }
  .hero-art { inset: 0; height: auto; }
  .hero-art img { object-position: 60% 40%; }
  .hero-art::after { background: linear-gradient(90deg, rgba(20, 26, 54, .9) 0%, rgba(20, 26, 54, .62) 36%, rgba(20, 26, 54, 0) 66%), linear-gradient(180deg, transparent 70%, rgba(20, 26, 54, .8)); }
  .hero-body { padding: 56px 0; }
  .logo img { width: min(46vw, 520px); }
  .hero-text { font-size: 17px; }
  .now { grid-template-columns: 340px 1fr; gap: 40px; align-items: center; padding-top: 50px; }
  .pick-row { grid-template-columns: repeat(4, 1fr); gap: 12px; }
  .pick-row.emblems button { padding-top: 16px; }
  .pick-row.emblems img { width: 34%; }
  .pick-result { padding: 24px; }
  .pr-grid { grid-template-columns: repeat(3, 1fr); gap: 20px; }
  .whos { grid-template-columns: repeat(3, 1fr); }
  .doors { grid-template-columns: repeat(6, 1fr); }
  .door { grid-column: span 2; min-height: 150px; }
  .door:nth-child(1), .door:nth-child(2) { grid-column: span 3; min-height: 180px; }
  .people-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
  .people-grid.compact, .people-grid.shadow { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .versus, .faces2, .rules, .factions, .classes { grid-template-columns: 1fr 1fr; }
  .grade-cards { grid-template-columns: repeat(3, 1fr); }
  .quests { grid-template-columns: repeat(4, 1fr); }
  .places { grid-template-columns: repeat(3, 1fr); }
  .year { grid-template-columns: 1fr 1fr; }
  .homes ul { grid-template-columns: repeat(4, 1fr); }
  .status-demo { grid-template-columns: 1.1fr 1fr; align-items: start; }
  .status-demo pre { font-size: 14px; }
  .copies { grid-template-columns: repeat(3, 1fr); }
  .shortcuts { grid-template-columns: 1fr 1fr; }
  .ladder li { font-size: 17px; }
  .subnav, .finder, .chips { margin-inline: 0; padding-inline: 0; }
  .night { background-image: linear-gradient(180deg, rgba(18, 12, 27, .86), rgba(18, 12, 27, .95)), url(img/seal.webp); }
  .sheet-nav { position: static; background: none; padding: 14px 26px 22px; }
  .sheet { width: min(1040px, 94vw); height: auto; max-height: 92dvh; margin: auto; border-radius: 18px; }
  .sheet-grid { display: grid; grid-template-columns: 1.15fr 1fr; align-items: start; }
  .sheet-art { position: sticky; top: 56px; }
  .sheet-text { padding: 22px 26px 10px; }
}
@media (min-width: 1024px) {
  .people-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .people-grid.compact, .people-grid.shadow { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .rules { grid-template-columns: repeat(3, 1fr); }
  .factions, .classes { grid-template-columns: repeat(4, 1fr); }
  .classes article { grid-template-columns: 1fr; text-align: center; justify-items: center; }
  .classes article > img { grid-row: auto; width: 96px; height: 96px; }
  .classes .whos { width: 100%; text-align: left; grid-template-columns: 1fr; }
  .year { grid-template-columns: repeat(3, 1fr); }
  .block { padding-top: 48px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
