/* 족보로그 — 쪽빛 표지의 족보책. 한지 바탕 · 먹 글씨 · 계선(界線) · 주사 도장
   레이아웃: 폰 한 손 기준 한 단(최대 520px). 표지 → 본관 → 실록 펼침면 → 졸기 */
:root {
  --paper: #ECEFE9; --paper-2: #F9FAF7; --paper-3: #DFE4DC; --rule: #C7CFC4;
  --ink: #1B2333; --ink-2: #4D5667; --ink-3: #626A78;
  --indigo: #24396A; --indigo-2: #31497B; --indigo-ink: #EEF1F6; --indigo-tx: #2C4478; --chija-tx: #8A6316;
  --seal: #B0382D; --seal-2: #8E2C23; --chija: #C2913A; --jade: #3B705E;
  --good: #2F7A5E; --bad: #B0382D;
  --shadow: 0 1px 0 rgba(27, 35, 51, .06), 0 6px 18px -10px rgba(27, 35, 51, .35);
  --s0: #FFFFFF; --s1: #F4F5F1; --s2: #E3E7E0; --s3: #C8D0C6; --s4: #A7B1A7; --s5: #6E7973; --s6: #3A433F;
  --sr: #A13A33; --sw: #9DB2BE; --sg: #B6C39E; --sth: #B79A62; --sn: #27324A; --sl: #E7C266; --sy: #C9A24A;
  --yut-f: #EADFC4; --yut-b: #B98A55; --yut-g: #8A5E33;
  --f-display: 'Song Myung', 'Noto Serif KR', 'Nanum Myeongjo', serif;
  --f-body: 'Nanum Myeongjo', 'Noto Serif KR', 'AppleMyungjo', serif;
  --f-ui: 'IBM Plex Sans KR', 'Apple SD Gothic Neo', 'Malgun Gothic', system-ui, sans-serif;
  --r: 10px; --gut: 16px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #11151C; --paper-2: #1A1F28; --paper-3: #0C1015; --rule: #2B333F;
    --ink: #E7E9EE; --ink-2: #AEB5C2; --ink-3: #8C94A3;
    --indigo: #2A4174; --indigo-2: #36508A; --indigo-ink: #EEF1F6; --indigo-tx: #9DB3E3; --chija-tx: #E0B865;
    --seal: #D45A4B; --seal-2: #B4473A; --chija: #D6AC55; --jade: #5E9E88; --good: #5FAE8D; --bad: #E06B5C;
    --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 8px 22px -12px rgba(0, 0, 0, .8);
    --s0: #DDE3EA; --s1: #3A4554; --s2: #2B3442; --s3: #232B37; --s4: #1C232D; --s5: #141A22; --s6: #0B0F14;
    --sr: #7E3029; --sw: #2D4352; --sg: #2C3A2C; --sth: #5B4A2E; --sn: #0E1424; --sl: #C9A24A; --sy: #8F7633;
    --yut-f: #CDBF9E; --yut-b: #8E6A44; --yut-g: #6A4626;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #11151C; --paper-2: #1A1F28; --paper-3: #0C1015; --rule: #2B333F;
  --ink: #E7E9EE; --ink-2: #AEB5C2; --ink-3: #8C94A3;
  --indigo: #2A4174; --indigo-2: #36508A; --indigo-ink: #EEF1F6; --indigo-tx: #9DB3E3; --chija-tx: #E0B865;
  --seal: #D45A4B; --seal-2: #B4473A; --chija: #D6AC55; --jade: #5E9E88; --good: #5FAE8D; --bad: #E06B5C;
  --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 8px 22px -12px rgba(0, 0, 0, .8);
  --s0: #DDE3EA; --s1: #3A4554; --s2: #2B3442; --s3: #232B37; --s4: #1C232D; --s5: #141A22; --s6: #0B0F14;
  --sr: #7E3029; --sw: #2D4352; --sg: #2C3A2C; --sth: #5B4A2E; --sn: #0E1424; --sl: #C9A24A; --sy: #8F7633;
  --yut-f: #CDBF9E; --yut-b: #8E6A44; --yut-g: #6A4626;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.6 var(--f-ui); word-break: keep-all; overflow-wrap: anywhere; }
body { background-image: repeating-linear-gradient(90deg, transparent 0 46px, color-mix(in srgb, var(--rule) 38%, transparent) 46px 47px); }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--indigo-tx); }
:focus-visible { outline: 2.5px solid var(--chija); outline-offset: 2px; }
#app { max-width: 520px; margin: 0 auto; padding: 12px var(--gut) 40px; min-height: 100%; }
.scr { display: grid; gap: 14px; }
.hj { font-family: var(--f-display); }
.mute { color: var(--ink-3); }
.small { font-size: 12.5px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.btn { appearance: none; border: 1.5px solid var(--ink); background: var(--paper-2); color: var(--ink); border-radius: 8px; padding: 10px 16px; font-weight: 600; line-height: 1.3; box-shadow: 2px 2px 0 var(--ink); transition: transform .08s, box-shadow .08s; }
.btn:active { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--ink); }
.btn.pri { background: var(--indigo); color: var(--indigo-ink); border-color: var(--indigo); box-shadow: 2px 2px 0 var(--ink); }
.btn.seal { background: var(--seal); color: #fff; border-color: var(--seal-2); }
.btn.ghost { background: transparent; box-shadow: none; border-color: var(--rule); color: var(--ink-2); }
.btn.sm { padding: 6px 11px; font-size: 13px; }
.btn.wide { width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.card { background: var(--paper-2); border: 1px solid var(--rule); border-radius: var(--r); padding: 14px; box-shadow: var(--shadow); }
.lbl { font-size: 11.5px; letter-spacing: .08em; color: var(--ink-3); font-weight: 600; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 99px; border: 1px solid var(--rule); background: var(--paper-2); font-size: 12.5px; color: var(--ink-2); }

/* ── 사이트 띠 ── */
.sitebar { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--ink-3); }
.sitebar a { color: var(--ink-2); text-decoration: none; }
.sitebar .sp { flex: 1; }
.sitebar button { background: none; border: 1px solid var(--rule); border-radius: 6px; padding: 3px 8px; color: var(--ink-2); font-size: 12px; }

/* ── 표지 ── */
.cover { position: relative; background: var(--indigo); color: var(--indigo-ink); border-radius: 6px 12px 12px 6px; padding: 20px 46px 22px 18px; display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: start; overflow: hidden; box-shadow: var(--shadow); }
.cover::before { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(45deg, rgba(255, 255, 255, .035) 0 2px, transparent 2px 6px), repeating-linear-gradient(-45deg, rgba(0, 0, 0, .05) 0 2px, transparent 2px 7px); pointer-events: none; }
.cover .stitches { position: absolute; right: 14px; top: 10px; bottom: 10px; display: flex; flex-direction: column; justify-content: space-between; }
.cover .stitches i { width: 7px; height: 7px; border-radius: 50%; background: var(--paper-3); box-shadow: 0 0 0 2px rgba(0, 0, 0, .18); position: relative; }
.cover .stitches i::after { content: ''; position: absolute; left: 3px; top: 3px; width: 16px; height: 1.6px; background: #D9CBA6; transform-origin: left; }
.slip { position: relative; background: #F1E6C8; color: #2A2416; border: 1px solid #CDBB8C; padding: 12px 9px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 176px; box-shadow: inset 0 0 0 3px #F1E6C8, inset 0 0 0 4px #CDBB8C; }
.slip b { display: block; font-family: var(--f-display); font-weight: 400; font-size: 27px; line-height: 1.12; }
.slip small { display: block; margin-top: 8px; writing-mode: vertical-rl; text-orientation: upright; font-family: var(--f-ui); font-size: 11px; letter-spacing: .28em; color: #6B5A35; }
.cover-copy { position: relative; display: grid; gap: 8px; align-content: center; min-height: 176px; }
.cover-copy .kicker { margin: 0; font-size: 12px; letter-spacing: .14em; color: #C9D3EA; font-weight: 600; }
.cover-copy h1 { margin: 0; font-family: var(--f-display); font-weight: 400; font-size: clamp(25px, 7vw, 32px); line-height: 1.25; text-wrap: balance; }
.cover-copy p { margin: 0; font-size: 13.5px; color: #D5DCEB; line-height: 1.55; }
.cover-copy .count { font-size: 12px; color: #AEBAD6; }
.cover-copy .count span { white-space: nowrap; }

.bonform { display: grid; gap: 8px; }
.bonform label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.bonform .in { display: flex; gap: 8px; }
.bonform input { flex: 1; min-width: 0; border: 1.5px solid var(--ink); border-radius: 8px; background: var(--paper-2); padding: 11px 12px; font-size: 16px; font-family: var(--f-body); font-weight: 700; }
.sugg { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.sugg li button { width: 100%; text-align: left; display: flex; gap: 10px; align-items: center; background: var(--paper-2); border: 1px solid var(--rule); border-radius: 8px; padding: 8px 10px; }
.sugg li button b { font-family: var(--f-body); font-size: 16px; }
.sugg li button .mute { font-size: 12.5px; }
.sugg .tag { margin-left: auto; font-size: 11.5px; color: var(--seal); border: 1px solid currentColor; border-radius: 4px; padding: 1px 6px; white-space: nowrap; }
.pop { display: flex; flex-wrap: wrap; gap: 6px; }
.pop button { border: 1px solid var(--rule); background: var(--paper-2); border-radius: 99px; padding: 5px 11px; font-size: 13px; font-family: var(--f-body); font-weight: 700; color: var(--ink); }
.pop button .n { font-family: var(--f-ui); font-weight: 500; font-size: 11px; color: var(--ink-3); margin-left: 3px; }

.today { display: grid; grid-template-columns: 76px 1fr; gap: 12px; align-items: center; }
.ptbox { background: var(--paper-3); border-radius: 50% 50% 10px 10px / 40% 40% 10px 10px; overflow: hidden; aspect-ratio: 120/140; }
.ptbox svg { width: 100%; height: 100%; display: block; }
.today h3, .lg h3 { margin: 0; font-family: var(--f-body); font-size: 18px; font-weight: 800; }
.today .hook, .lg .hook { margin: 2px 0 6px; font-size: 13.5px; color: var(--ink-2); line-height: 1.45; text-wrap: pretty; }
.band { background: color-mix(in srgb, var(--chija) 16%, var(--paper-2)); border: 1px solid var(--chija); border-radius: var(--r); padding: 10px 12px; font-size: 13.5px; line-height: 1.5; }
.band b { font-family: var(--f-body); }
.tlinks { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; }
.tlinks button, .tlinks a { background: none; border: 0; padding: 0; color: var(--ink-2); text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: 3px; }
.foot { font-size: 11.5px; color: var(--ink-3); line-height: 1.6; padding-top: 8px; border-top: 1px solid var(--rule); }
.foot a { color: var(--ink-3); }

/* ── 본관 ── */
.clanhead { display: grid; gap: 6px; background: var(--paper-2); border: 1px solid var(--rule); border-radius: var(--r); padding: 16px; position: relative; overflow: hidden; }
.clanhead::after { content: ''; position: absolute; right: 0; top: 0; bottom: 0; width: 34px; background: repeating-linear-gradient(0deg, transparent 0 18px, var(--rule) 18px 19px); opacity: .55; }
.clanhead h2 { margin: 0; font-family: var(--f-display); font-weight: 400; font-size: 30px; line-height: 1.2; }
.clanhead h2 span { font-size: 17px; color: var(--ink-3); margin-left: 6px; }
.clanhead .meta { display: flex; flex-wrap: wrap; gap: 6px; }
.clanhead p { margin: 0; font-size: 13.5px; color: var(--ink-2); max-width: 46ch; }
.lgs { display: grid; gap: 10px; }
.lg { display: grid; grid-template-columns: 70px 1fr; gap: 12px; align-items: start; }
.lg .life { font-size: 12.5px; color: var(--ink-3); }
.lg .acts { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.lg .got { font-size: 12px; color: var(--ink-3); }
.lg.rand { grid-template-columns: 70px 1fr; }
.lg .bookicon { aspect-ratio: 120/140; background: var(--indigo); border-radius: 4px 8px 8px 4px; position: relative; display: grid; place-items: center; }
.lg .bookicon::before { content: ''; position: absolute; left: 12px; top: 10px; bottom: 10px; width: 16px; background: #F1E6C8; }
.lg .bookicon span { position: absolute; left: 12px; top: 10px; bottom: 10px; width: 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-family: var(--f-display); color: #2A2416; font-size: 12px; line-height: 1.1; }
.lg .bookicon span b { font-weight: 400; }
.famous { display: grid; gap: 4px; font-size: 13.5px; }
.famous li { list-style: none; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.famous ul { margin: 0; padding: 0; display: grid; gap: 4px; }
.famous b { font-family: var(--f-body); }

/* ── 실록 펼침면 (게임) ── */
.hud { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: var(--indigo); color: var(--indigo-ink); border-radius: 0 0 10px 10px; margin: -12px calc(var(--gut) * -1) 0; padding: 8px var(--gut) 9px; display: grid; gap: 6px; box-shadow: var(--shadow); }
.hud .r1 { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.hud .yr { font-family: var(--f-display); font-size: 18px; white-space: nowrap; }
.hud .yr small { font-family: var(--f-ui); font-size: 11.5px; color: #C2CCE2; margin-left: 4px; }
.hud .rank { margin-left: auto; font-size: 12px; color: #DCE3F2; text-align: right; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hud .menu { background: none; border: 1px solid rgba(255, 255, 255, .35); color: #fff; border-radius: 6px; padding: 1px 8px; font-size: 13px; flex: none; }
.gauges { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.g { display: grid; grid-template-columns: auto 1fr; gap: 5px; align-items: center; font-size: 12px; }
.g b { font-family: var(--f-display); font-weight: 400; font-size: 14px; }
.bar { height: 6px; background: rgba(255, 255, 255, .18); border-radius: 3px; overflow: hidden; }
.bar i { display: block; height: 100%; background: #E8EEF9; border-radius: 3px; transition: width .4s; }
.g.life .bar i { background: #F0B8A8; }
.g.low .bar i { background: #FF8C7A; }
.hud .r3 { display: flex; gap: 10px; align-items: center; font-size: 12px; }
.blade { display: flex; align-items: center; gap: 5px; flex: 1.2; min-width: 0; }
.blade .bar { flex: 1; background: rgba(255, 255, 255, .14); clip-path: polygon(0 0, 92% 0, 100% 50%, 92% 100%, 0 100%); height: 8px; border-radius: 0; }
.blade .bar i { background: linear-gradient(90deg, #E9B9AE, #FF6B57); border-radius: 0; }
.blade.hot .bar i { animation: hot 1s infinite alternate; }
@keyframes hot { to { filter: brightness(1.35); } }
.side { display: flex; align-items: center; gap: 4px; flex: 1.6; min-width: 0; font-size: 11px; }
.side .t { flex: 1; height: 2px; background: rgba(255, 255, 255, .35); position: relative; min-width: 40px; }
.side .t i { position: absolute; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--chija); transform: translateX(-50%); transition: left .4s; }
.side span { white-space: nowrap; max-width: 4.6em; overflow: hidden; text-overflow: ellipsis; }
.hud .more { background: rgba(255, 255, 255, .12); border: 0; color: #fff; border-radius: 6px; padding: 2px 8px; font-size: 12px; white-space: nowrap; }
.relrow { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-top: 2px; }
.relrow::-webkit-scrollbar { display: none; }
.rel { flex: none; width: 40px; text-align: center; font-size: 10.5px; line-height: 1.2; color: #DCE3F2; }
.rel .rp { width: 34px; height: 34px; margin: 0 auto 1px; border-radius: 50%; overflow: hidden; background: rgba(255, 255, 255, .15); border: 1.5px solid rgba(255, 255, 255, .5); }
.rel .rp svg { width: 140%; height: 140%; margin: -6% 0 0 -20%; }
.rel.pos .rp { border-color: #9FD9C2; }
.rel.neg .rp { border-color: #FF9A8A; }
.rel.dead .rp { filter: grayscale(1); opacity: .45; }
.rel .st { display: block; font-size: 9.5px; color: #B9C4DD; }

.stage { position: relative; height: clamp(190px, 34vh, 236px); border-radius: var(--r); overflow: hidden; border: 1px solid var(--rule); background: var(--paper-3); }
.stage .scene-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.stage .who { position: absolute; bottom: -2px; width: 132px; transition: opacity .2s, transform .25s; }
.stage .who svg { width: 100%; height: auto; display: block; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .18)); }
.stage .who.l { left: 4px; }
.stage .who.r { right: 4px; width: 104px; }
.stage .who.dim { opacity: .55; }
.stage .who.speak { transform: translateY(-3px); }
.stage .badge { position: absolute; top: 8px; left: 8px; font-size: 11.5px; background: rgba(0, 0, 0, .45); color: #fff; padding: 2px 8px; border-radius: 99px; backdrop-filter: blur(3px); }
.chcard { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; background: color-mix(in srgb, var(--paper) 86%, transparent); backdrop-filter: blur(2px); gap: 4px; padding: 10px; animation: chin .45s ease-out; }
@keyframes chin { from { opacity: 0; transform: translateY(8px); } }
.chcard .y { font-family: var(--f-display); font-size: 40px; line-height: 1; color: var(--ink); }
.chcard .y span { font-size: 22px; color: var(--seal); margin-left: 8px; }
.chcard .t { font-family: var(--f-display); font-size: 25px; line-height: 1.25; text-wrap: balance; }
.chcard .s { font-size: 12.5px; color: var(--ink-2); }
.box { background: var(--paper-2); border: 1px solid var(--rule); border-radius: var(--r); padding: 12px 14px 14px; min-height: 104px; position: relative; box-shadow: var(--shadow); cursor: pointer; }
.box .nm { display: inline-flex; gap: 6px; align-items: baseline; margin: -2px 0 6px; font-weight: 700; font-size: 14px; color: var(--indigo-tx); }
.box .nm small { font-weight: 500; font-size: 11.5px; color: var(--ink-3); }
.box .tx { font-family: var(--f-body); font-size: 16.5px; line-height: 1.72; word-break: keep-all; overflow-wrap: anywhere; }
.box.narr .tx { color: var(--ink); }
.box.narr::before { content: '史'; position: absolute; right: 10px; top: 8px; font-family: var(--f-display); font-size: 13px; color: var(--seal); border: 1.2px solid var(--seal); border-radius: 3px; width: 20px; height: 20px; display: grid; place-items: center; opacity: .75; }
.box .nx { position: absolute; right: 12px; bottom: 6px; font-size: 11px; color: var(--ink-3); animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .2; } }
.opts { display: grid; gap: 8px; }
.opt { text-align: left; background: var(--paper-2); border: 1.5px solid var(--ink); border-radius: 10px; padding: 10px 12px; display: grid; gap: 4px; box-shadow: 2px 2px 0 var(--ink); position: relative; }
.opt:active { transform: translate(2px, 2px); box-shadow: none; }
.opt .t { font-weight: 700; font-size: 15px; line-height: 1.35; padding-right: 26px; }
.opt .d { font-size: 13px; color: var(--ink-2); line-height: 1.45; }
.opt .ch { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 2px; }
.fx { font-size: 11.5px; border-radius: 4px; padding: 1px 6px; background: var(--paper-3); color: var(--ink-2); white-space: nowrap; }
.fx.up { color: var(--good); }
.fx.dn { color: var(--bad); }
.fx.chk { background: color-mix(in srgb, var(--indigo) 12%, var(--paper-2)); color: var(--indigo-tx); display: inline-flex; gap: 5px; align-items: center; }
.fx.chk i { display: inline-block; width: 34px; height: 5px; background: var(--rule); border-radius: 3px; overflow: hidden; }
.fx.chk i b { display: block; height: 100%; background: var(--indigo-2); }
.opt .shi { position: absolute; right: 10px; top: 9px; font-family: var(--f-display); font-size: 12px; color: var(--seal); border: 1.2px solid var(--seal); border-radius: 3px; width: 20px; height: 20px; display: grid; place-items: center; }
.opt[disabled] { border-style: dashed; box-shadow: none; opacity: .6; cursor: not-allowed; }
.opt .why { font-size: 12px; color: var(--seal); }
.opt.special { border-color: var(--chija); box-shadow: 2px 2px 0 var(--chija); }
.acts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.act { background: var(--paper-2); border: 1.5px solid var(--ink); border-radius: 10px; padding: 9px 6px; display: grid; justify-items: center; gap: 2px; text-align: center; box-shadow: 2px 2px 0 var(--ink); }
.act .gl { font-family: var(--f-display); font-size: 24px; line-height: 1.1; }
.act .t { font-weight: 700; font-size: 13px; }
.act .d { font-size: 11px; color: var(--ink-3); line-height: 1.35; }
.q { font-size: 13.5px; color: var(--ink-2); font-weight: 600; margin: 2px 2px -2px; }

/* 윷 */
.yutbox { position: absolute; inset: 0; background: color-mix(in srgb, var(--paper) 90%, transparent); display: grid; place-content: center; justify-items: center; gap: 6px; text-align: center; padding: 8px; }
.yutbox .lbl2 { font-size: 13px; color: var(--ink-2); }
.yutbox .sticks { display: flex; gap: 10px; height: 92px; align-items: flex-end; }
.yutbox .sticks svg { width: 20px; height: 80px; }
.yutbox .sticks span { display: inline-block; animation: toss .7s cubic-bezier(.3, .6, .4, 1) both; }
.yutbox .sticks span:nth-child(2) { animation-delay: .05s; } .yutbox .sticks span:nth-child(3) { animation-delay: .1s; } .yutbox .sticks span:nth-child(4) { animation-delay: .15s; }
@keyframes toss { 0% { transform: translateY(60px) rotate(0deg); opacity: 0; } 45% { transform: translateY(-46px) rotate(320deg); opacity: 1; } 100% { transform: translateY(0) rotate(var(--rot, 8deg)); } }
.yutbox .res { font-family: var(--f-display); font-size: 34px; line-height: 1; }
.yutbox .res.ok { color: var(--good); } .yutbox .res.no { color: var(--bad); }
.yutbox .res small { display: block; font-family: var(--f-ui); font-size: 13px; color: var(--ink-2); margin-top: 4px; }

/* 3합 */
.duel { position: absolute; inset: 0; display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; padding: 0 6px; background: color-mix(in srgb, var(--paper) 30%, transparent); }
.duel .who { position: static; width: 100%; max-width: 130px; justify-self: center; }
.duel .mid { align-self: center; text-align: center; display: grid; gap: 4px; padding-bottom: 20px; }
.duel .mid .nm2 { font-family: var(--f-display); font-size: 17px; background: var(--paper-2); padding: 2px 10px; border-radius: 6px; border: 1px solid var(--rule); }
.pips { display: flex; gap: 4px; justify-content: center; }
.pips i { width: 11px; height: 11px; border-radius: 50%; border: 1.5px solid var(--ink); background: var(--paper-2); }
.pips i.w { background: var(--good); border-color: var(--good); }
.pips i.l { background: var(--bad); border-color: var(--bad); }
.tri { font-size: 11.5px; color: var(--ink-3); text-align: center; }

/* 환국 */
.storm { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; gap: 4px; background: linear-gradient(180deg, color-mix(in srgb, var(--seal) 30%, transparent), color-mix(in srgb, var(--paper) 88%, transparent)); }
.storm .n { font-family: var(--f-display); font-size: 34px; line-height: 1.1; }
.storm .lv { font-size: 13px; color: var(--ink-2); }
.risk { display: flex; gap: 3px; justify-content: center; }
.risk i { width: 26px; height: 7px; border-radius: 2px; background: var(--rule); }
.risk i.on { background: var(--seal); }

/* 오버레이 */
.ov { position: fixed; inset: 0; z-index: 60; background: rgba(12, 16, 24, .55); display: grid; place-items: end center; padding: 16px; padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.sheet { width: 100%; max-width: 488px; max-height: 86vh; overflow: auto; background: var(--paper-2); color: var(--ink); border-radius: 14px; padding: 18px 16px; display: grid; gap: 12px; box-shadow: 0 20px 50px rgba(0, 0, 0, .35); animation: up .25s ease-out; }
@keyframes up { from { transform: translateY(20px); opacity: .5; } }
.sheet h3 { margin: 0; font-family: var(--f-display); font-weight: 400; font-size: 24px; line-height: 1.25; }
.sheet p { margin: 0; }
.sheet .tx { font-family: var(--f-body); line-height: 1.7; }
.sheet .acts2 { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.perks { display: grid; gap: 8px; }
.perks button { text-align: left; border: 1.5px solid var(--ink); background: var(--paper); border-radius: 10px; padding: 10px 12px; box-shadow: 2px 2px 0 var(--ink); }
.perks b { display: block; font-family: var(--f-body); font-size: 16px; }
.perks span { font-size: 13px; color: var(--ink-2); }
.itemglyph { width: 56px; height: 56px; border-radius: 8px; background: var(--seal); color: #fff; display: grid; place-items: center; font-family: var(--f-display); font-size: 32px; flex: none; box-shadow: inset 0 0 0 3px var(--seal), inset 0 0 0 4.5px rgba(255, 255, 255, .7); }
.itm { display: flex; gap: 12px; align-items: center; }
.abl { display: grid; gap: 6px; }
.abl .a { display: grid; grid-template-columns: 22px 46px 1fr; gap: 8px; align-items: center; font-size: 13px; }
.abl .a b { font-family: var(--f-display); font-weight: 400; font-size: 17px; }
.pipsx { display: flex; gap: 3px; }
.pipsx i { width: 12px; height: 12px; border-radius: 2px; background: var(--paper-3); border: 1px solid var(--rule); }
.pipsx i.on { background: var(--indigo-2); border-color: var(--indigo-2); }
.rellist { display: grid; gap: 6px; }
.rellist .r { display: grid; grid-template-columns: 38px 1fr auto; gap: 10px; align-items: center; font-size: 13px; }
.rellist .r .rp { width: 38px; height: 38px; border-radius: 50%; overflow: hidden; background: var(--paper-3); }
.rellist .r .rp svg { width: 140%; height: 140%; margin: -6% 0 0 -20%; }
.rellist .r .st { font-size: 12px; font-weight: 700; }
.rellist .r .st.pos { color: var(--good); } .rellist .r .st.neg { color: var(--bad); }
.loglist { margin: 0; padding-left: 18px; font-size: 13px; color: var(--ink-2); display: grid; gap: 3px; }
.toasts { position: fixed; left: 50%; transform: translateX(-50%); top: calc(env(safe-area-inset-top, 0px) + 112px); z-index: 70; display: grid; gap: 6px; justify-items: center; pointer-events: none; width: min(92vw, 420px); }
.toast { background: var(--ink); color: var(--paper); font-size: 13px; padding: 6px 12px; border-radius: 99px; box-shadow: var(--shadow); animation: tin .25s ease-out; text-align: center; }
.toast.d { background: var(--paper-2); color: var(--ink); border: 1px solid var(--rule); }
@keyframes tin { from { opacity: 0; transform: translateY(-6px); } }

/* ── 졸기 ── */
.obit { position: relative; background: var(--paper-2); border: 1px solid var(--rule); border-radius: var(--r); padding: 20px 18px 18px; display: grid; gap: 12px; overflow: hidden; box-shadow: var(--shadow); }
.obit::before { content: ''; position: absolute; inset: 8px; border: 1px solid var(--rule); border-radius: 6px; pointer-events: none; }
.obit .k { font-size: 12px; letter-spacing: .12em; color: var(--ink-3); font-weight: 600; }
.obit .nmline { font-family: var(--f-body); font-weight: 800; font-size: 22px; line-height: 1.3; }
.obit .nmline small { font-family: var(--f-ui); font-size: 12.5px; font-weight: 500; color: var(--ink-3); margin-left: 4px; }
.sealbig { justify-self: start; display: inline-grid; place-items: center; background: var(--seal); color: #fff; border-radius: 6px; padding: 10px 14px; font-family: var(--f-display); font-size: clamp(22px, 6.6vw, 30px); line-height: 1.15; text-align: center; box-shadow: inset 0 0 0 3px var(--seal), inset 0 0 0 5px rgba(255, 255, 255, .75); transform: rotate(-2deg); max-width: 100%; text-wrap: balance; animation: stamp .5s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes stamp { from { transform: scale(1.8) rotate(-8deg); opacity: 0; } }
.kind { display: inline-flex; gap: 6px; align-items: center; font-size: 12.5px; font-weight: 700; }
.kind i { font-style: normal; font-family: var(--f-display); font-size: 14px; border: 1.2px solid currentColor; border-radius: 3px; padding: 0 5px; }
.kind.k1 { color: var(--jade); } .kind.k2 { color: var(--indigo-tx); } .kind.k3, .kind.k4 { color: var(--seal); } .kind.k5 { color: var(--chija-tx); }
.obit .tx { font-family: var(--f-body); font-size: 16px; line-height: 1.8; word-break: keep-all; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; text-align: center; }
.stats div { background: var(--paper); border: 1px solid var(--rule); border-radius: 8px; padding: 6px 2px; }
.stats small { display: block; font-size: 11px; color: var(--ink-3); }
.stats b { font-family: var(--f-display); font-weight: 400; font-size: 20px; font-variant-numeric: tabular-nums; }
.emo { font-size: 20px; letter-spacing: 2px; text-align: center; }
.mourn { display: grid; gap: 3px; font-size: 13px; color: var(--ink-2); }
.tangle { display: flex; flex-wrap: wrap; gap: 6px; }
.tangle span { font-size: 12.5px; border-radius: 6px; padding: 3px 8px; border: 1px solid var(--rule); background: var(--paper); }
.tangle span.f { border-color: var(--seal); color: var(--seal); }
.tangle span.g { border-color: var(--good); color: var(--good); }
.hist { background: var(--paper); border-left: 3px solid var(--indigo-2); padding: 10px 12px; border-radius: 0 8px 8px 0; font-size: 13.5px; line-height: 1.65; color: var(--ink-2); }
.hist h4 { margin: 0 0 4px; font-size: 12.5px; color: var(--indigo-tx); letter-spacing: .06em; }
.hist ol { margin: 6px 0 0; padding-left: 18px; font-size: 12px; }
.hist ol a { color: var(--ink-3); word-break: break-all; }
.share4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.share4 button { border: 1.5px solid var(--ink); background: var(--paper-2); border-radius: 8px; padding: 8px 2px; font-size: 12px; font-weight: 700; display: grid; gap: 2px; justify-items: center; box-shadow: 2px 2px 0 var(--ink); }
.share4 button i { font-style: normal; font-size: 18px; }
.share4 .kk { background: #FEE500; color: #191600; border-color: #191600; }
.shimg { background: var(--paper-3); border-radius: 8px; padding: 8px; display: grid; place-items: center; }
.shimg img { max-height: min(48vh, 440px); width: auto; max-width: 100%; box-shadow: var(--shadow); }
.dogam { display: grid; gap: 8px; }
.dogam .f { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: baseline; font-size: 13.5px; border-bottom: 1px solid var(--rule); padding-bottom: 6px; }
.dogam .f b { font-family: var(--f-body); }
.dogam .es { grid-column: 1/-1; display: flex; flex-wrap: wrap; gap: 4px; }
.dogam .es span { font-size: 11.5px; border: 1px solid var(--rule); border-radius: 4px; padding: 0 6px; color: var(--ink-3); }
.dogam .es span.on { border-color: var(--seal); color: var(--seal); }

/* 광고 */
.adwrap { display: grid; justify-items: center; gap: 4px; margin-top: 150px; margin-bottom: 24px; }
.adslot { max-width: 100%; }
.adslot .adlbl { font-size: 10px; color: var(--ink-3); letter-spacing: .06em; }
.adslot .addisc { font-size: 10px; color: var(--ink-3); margin: 0 0 3px; word-break: keep-all; max-width: 320px; }
.adslot .adbody { max-width: 100%; overflow: hidden; }
.adslot .adbody.pv { border: 1.5px dashed var(--rule); color: var(--ink-3); display: grid; place-items: center; font-size: 11px; text-align: center; padding: 6px; }
.adslot iframe { border: 0; display: block; max-width: 100%; }

/* 위장 */
.xl { position: fixed; inset: 0; z-index: 100; background: #fff; color: #222; display: flex; flex-direction: column; font: 12px 'Malgun Gothic', 'Apple SD Gothic Neo', sans-serif; }
.xl .t1 { background: #217346; color: #fff; display: flex; gap: 14px; padding: 8px 10px; }
.xl .t2 { border-bottom: 1px solid #d0d0d0; padding: 4px 8px; }
.xl .t2 span { color: #888; margin-right: 10px; font-style: italic; }
.xl .g2 { flex: 1; overflow: auto; }
.xl table { border-collapse: collapse; white-space: nowrap; }
.xl th { background: #f3f3f3; color: #666; font-weight: 400; border: 1px solid #d9d9d9; padding: 2px 6px; min-width: 22px; }
.xl td { border: 1px solid #e3e3e3; padding: 2px 8px; text-align: right; }
.xl td.h { font-weight: 700; background: #e2efda; text-align: center; }
.xl .t3 { display: flex; border-top: 1px solid #ccc; background: #f3f3f3; }
.xl .t3 span { padding: 7px 14px; cursor: pointer; color: #444; }
.xl .t3 span.on { background: #fff; color: #217346; font-weight: 700; border-bottom: 2px solid #217346; }

/* 게임 소개 */
.about { display: grid; gap: 10px; font-size: 14px; line-height: 1.7; }
.about h2 { margin: 0; font-family: var(--f-display); font-weight: 400; font-size: 26px; }
.about h3 { margin: 6px 0 0; font-size: 15px; }
.about p, .about ul { margin: 0; max-width: 62ch; }
.about ul { padding-left: 18px; }
.about .figlist { font-size: 12.5px; color: var(--ink-2); }

@media (max-width: 380px) {
  .gauges { gap: 5px; } .g { font-size: 11px; } .hud .yr { font-size: 16px; }
  .acts { grid-template-columns: repeat(2, 1fr); }
  .share4 { grid-template-columns: repeat(2, 1fr); }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stage .who { width: 112px; } .stage .who.r { width: 88px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ── 화면 보조 (app.js) ── */
.scr.game { gap: 10px; }
.stage .sc { position: absolute; inset: 0; }
.stage .who[hidden] { display: none; }
.g, .blade { background: none; border: 0; padding: 0; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.hud .bar { display: block; }
.rel { background: none; border: 0; padding: 0; color: #DCE3F2; font: inherit; font-size: 10.5px; line-height: 1.2; cursor: pointer; }
.rel .rp { display: block; }
.box .tx.hint { color: var(--ink-3); font-family: var(--f-ui); font-size: 13.5px; }
.q .riskq { display: inline-flex; align-items: center; gap: 5px; margin-left: 4px; color: var(--seal); font-weight: 700; white-space: nowrap; }
.q .riskq .risk i { width: 14px; height: 6px; }
.opt.picked { border-color: var(--seal); box-shadow: 2px 2px 0 var(--seal); }
.opts.locked, .acts.locked { pointer-events: none; }
.opts.locked .opt:not(.picked), .acts.locked .act:not(.picked) { opacity: .45; }
.acts.n4 { grid-template-columns: repeat(2, 1fr); }
.act.picked { border-color: var(--seal); box-shadow: 2px 2px 0 var(--seal); }
.toast .up { color: var(--good); font-weight: 700; } .toast .dn { color: var(--bad); font-weight: 700; }
.intro { display: grid; grid-template-columns: 84px 1fr; gap: 12px; align-items: center; }
.intro h3 small { font-size: 15px; color: var(--ink-3); font-family: var(--f-display); }
.intro .lg { display: block; }
.saju { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.sheet .itm .ptbox { width: 84px; flex: none; }
.itemglyph.sm { width: 40px; height: 40px; font-size: 22px; }
.sheet .sec { display: grid; gap: 8px; }
.sheet .sec h4 { margin: 0; font-size: 12px; letter-spacing: .1em; color: var(--ink-3); }
.gw { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; }
.gw .g2 { display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; align-items: center; }
.gw .g2 b { font-weight: 400; font-size: 17px; grid-row: span 2; }
.gw .bar2 { height: 6px; background: var(--paper-3); border-radius: 3px; overflow: hidden; }
.gw .bar2 i { display: block; height: 100%; background: var(--indigo-2); }
.endbtns { display: grid; gap: 8px; }
.endbtns .row { justify-content: center; }
.cont { display: grid; gap: 6px; }
.lg.hl { outline: 2.5px solid var(--chija); outline-offset: 2px; }
.famous li .chip { cursor: pointer; }
.load { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; background: color-mix(in srgb, var(--paper) 72%, transparent); font-family: var(--f-display); font-size: 20px; color: var(--ink-2); }
.foot .mail { user-select: all; }
.shimg { gap: 8px; text-align: center; }
@media (max-width: 380px) { .gw { grid-template-columns: 1fr; } }

.toasts.bot { top: auto; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
.g, .blade { position: relative; }
.fly { position: absolute; left: 50%; top: -4px; transform: translateX(-50%); font-size: 11px; font-weight: 800; letter-spacing: -1px; pointer-events: none; animation: fly 1.2s ease-out forwards; text-shadow: 0 1px 2px rgba(0,0,0,.35); }
.fly.up { color: #9FE3C6; } .fly.dn { color: #FF9C8C; }
@keyframes fly { 0% { opacity: 0; transform: translate(-50%, 6px); } 20% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -14px); } }
.rel.pulse .rp { animation: pulse 1.1s; } .rel.pulse-n .rp { animation: pulsen 1.1s; }
@keyframes pulse { 30% { box-shadow: 0 0 0 4px rgba(159, 217, 194, .8); transform: scale(1.12); } }
@keyframes pulsen { 30% { box-shadow: 0 0 0 4px rgba(255, 154, 138, .8); transform: scale(.92); } }
.duel .who { max-width: 112px; }
.duel .mid .tri { background: var(--paper-2); color: var(--ink-2); border: 1px solid var(--rule); border-radius: 6px; padding: 3px 8px; line-height: 1.45; }
.duel .mid .tri b.ok { color: var(--good); } .duel .mid .tri b.no { color: var(--bad); }
.box.narr .tx { padding-right: 24px; }

.duel .mid { max-width: 48vw; }
.duel .mid .nm2 { word-break: keep-all; line-height: 1.25; }
.trail { border-top: 1px solid var(--rule); padding-top: 8px; font-size: 13px; color: var(--ink-2); }
.trail summary { cursor: pointer; font-weight: 700; color: var(--indigo-tx); font-size: 12.5px; letter-spacing: .04em; }
.trail ol { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; }
.trail li { display: grid; grid-template-columns: 44px 1fr; gap: 8px; align-items: baseline; }
.trail li b { font-family: var(--f-display); font-weight: 400; font-size: 15px; color: var(--ink); font-variant-numeric: tabular-nums; }
.trail li small { display: block; color: var(--ink-3); font-size: 12px; }
.trail li.end span { color: var(--seal); font-weight: 700; }

/* ── 검수 반영 ── */
.msg.err { color: var(--seal); font-weight: 600; }
.box.narr::before { content: '記'; }
.stage:has(.chcard, .yutbox, .storm, .duel) .badge { visibility: hidden; }
.lg .acts .btn, .cont .btn, .today .btn, .endbtns .btn { min-height: 44px; }
.hud .menu { padding: 5px 11px; font-size: 15px; }
.hud .more { padding: 6px 11px; }
.hud .r4 { display: flex; align-items: center; gap: 6px; font-size: 11.5px; min-width: 0; background: none; border: 0; padding: 0; color: inherit; cursor: pointer; width: 100%; }
.hud .r4 .t { flex: 1; height: 2px; background: rgba(255, 255, 255, .35); position: relative; min-width: 40px; display: block; }
.hud .r4 .t i { position: absolute; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--chija); transform: translateX(-50%); transition: left .4s; }
.hud .r4 .sl, .hud .r4 .sr { white-space: nowrap; max-width: 44%; overflow: hidden; text-overflow: ellipsis; }
.hud .r4 .sl::before { content: '줄 · '; color: #AEBAD6; }
.rel { width: 38px; }
.rel .rp { width: 30px; height: 30px; }
.rel .st { display: none; }
.duel .who { position: relative; }
.duel .who .tag { position: absolute; left: 50%; bottom: 6px; transform: translateX(-50%); background: var(--paper-2); color: var(--ink); border: 1px solid var(--rule); border-radius: 99px; padding: 0 8px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.toasts.top { top: var(--toast-top, 120px); bottom: auto; }
.xl { overflow-wrap: normal; word-break: normal; }
.xl .t1 { overflow-x: auto; white-space: nowrap; } .xl .t1 > * { flex: none; white-space: nowrap; }
.famous .soon { font-size: 11px; color: var(--chija-tx); border: 1px solid currentColor; border-radius: 4px; padding: 0 5px; white-space: nowrap; }
.soonbox { display: grid; gap: 6px; }
.soonbox ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.soonbox li { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; font-size: 13.5px; }
.soonbox li b { font-family: var(--f-body); font-size: 15px; }
.guide { display: grid; gap: 8px; font-size: 13.5px; line-height: 1.55; }
.guide .gl2 { display: grid; grid-template-columns: 44px 1fr; gap: 8px; align-items: start; }
.guide .gl2 b { font-family: var(--f-display); font-weight: 400; font-size: 18px; text-align: center; background: var(--indigo); color: var(--indigo-ink); border-radius: 6px; padding: 2px 0; }
@media (max-height: 760px) { .stage { height: clamp(150px, 27vh, 236px); } .box { min-height: 88px; } }
.sugg .tag.soon2 { color: var(--ink-3); }
.duel .mid { align-self: end; padding-bottom: 10px; }

.lineage-note{flex-basis:100%;font-size:12px;line-height:1.65;color:inherit;margin:2px 0 9px;padding:8px 10px;background:rgba(128,91,53,.06);border-radius:6px}.lineage-note summary{cursor:pointer;color:inherit}.lineage-note p{margin:7px 0}.lineage-note a{text-decoration:underline;overflow-wrap:anywhere}

.clan-directory summary{cursor:pointer;font-weight:700;min-height:44px;line-height:1.6}.clan-directory summary span{margin-left:8px}.clan-directory .figlist{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:10px 24px;padding-left:20px}.clan-directory li{line-height:1.8;overflow-wrap:anywhere}.clan-directory a{font-weight:700;text-underline-offset:3px}
