:root {
  --bg: #07090b;
  --panel: #0d1013;
  --line: #1f252b;
  --line2: #2c343b;
  --ink: #e4dccb;
  --dim: #7f7a6d;
  --dim2: #57534a;
  --red: #c9462f;
  --gold: #d6a648;
  --good: #8fb07a;
  --sea: #5b8aa8;
  --pix: 'Galmuri11', 'Galmuri9', ui-monospace, monospace;
  --body: 'Galmuri11', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: var(--bg); color: var(--ink); }
body { font: 15px/1.8 var(--body); -webkit-font-smoothing: none; -webkit-tap-highlight-color: transparent; overflow: hidden; }
button { font: inherit; color: inherit; }
img { image-rendering: pixelated; }

#app {
  position: relative; height: 100dvh; max-width: 520px; margin: 0 auto;
  display: flex; flex-direction: column; background: var(--panel);
  border-left: 1px solid var(--line); border-right: 1px solid var(--line);
}
#app::before { /* 아주 옅은 스캔라인 */
  content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 5;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,.012) 0 1px, transparent 1px 3px);
}

/* ── HUD ── */
#hud { padding: 12px 16px 10px; border-bottom: 1px solid var(--line); font-family: var(--pix); font-size: 12px; cursor: pointer; flex: none; }
#hud .h1 { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
#hud .nm { font-size: 14px; }
#hud .nm i { font-style: normal; color: var(--dim); }
#hud .bty { color: var(--gold); white-space: nowrap; }
#hud .hp { display: flex; align-items: center; gap: 10px; margin: 6px 0 5px; }
#hud .hp .bar { flex: 1; height: 6px; background: #1a1d20; border: 1px solid var(--line2); }
#hud .hp .bar i { display: block; height: 100%; background: var(--ink); transition: width .4s steps(8); }
#hud .hp .bar i.low { background: var(--red); animation: blink 1s steps(2) infinite; }
#hud .hp span { color: var(--dim); min-width: 56px; text-align: right; }
#hud .h2 { display: flex; gap: 12px; color: var(--dim); flex-wrap: wrap; }
#hud .h2 b { color: var(--ink); font-weight: normal; }
#hud .h2 small { margin-left: 2px; }
#hud .h2 .sep { flex: 1; }

/* ── 로그 ── */
#log { flex: 1; overflow-y: auto; padding: 22px 18px 12px; scroll-behavior: smooth; scrollbar-width: thin; scrollbar-color: var(--line2) transparent; }
.line { margin: 0 0 14px; white-space: pre-wrap; word-break: keep-all; overflow-wrap: anywhere; }
.line.em { color: #fff; }
.line.bad { color: #e0806c; }
.line.good { color: var(--good); }
.line.odd { color: #c9a0d8; }
.line.skill { color: var(--gold); letter-spacing: .02em; }
.line.enemy { color: #b9b2a2; padding-left: 12px; border-left: 2px solid var(--red); }
.line.quake { animation: crack .9s steps(6); }
.talk .who { display: block; font-family: var(--pix); font-size: 12px; margin-bottom: 1px; }
.talk .q { color: #fff; }
.talk .q::before { content: '「'; color: var(--dim); }
.talk .q::after { content: '」'; color: var(--dim); }
.sys { font-family: var(--pix); font-size: 12px; color: var(--dim); margin: -6px 0 14px; }
.sys.good { color: var(--good); }
.sys.bad { color: var(--red); }
.sys.hit { color: #e8b56a; margin: -8px 0 8px; }
.sys.hit.dim { color: var(--dim); }
.sys.me { color: var(--ink); opacity: .55; margin: 4px 0 14px; }
.rule { height: 1px; margin: 22px 0; background: repeating-linear-gradient(90deg, var(--line2) 0 4px, transparent 4px 8px); }

/* 인물 등장 */
.pic { margin: 6px 0 18px; display: flex; flex-direction: column; align-items: center; }
.pic .frame { width: 208px; height: 208px; display: grid; place-items: end center; background: radial-gradient(ellipse at 50% 85%, #1d2328 0 38%, transparent 70%); border-bottom: 1px solid var(--line2); }
.pic img { width: 192px; height: 192px; }
.pic.first img { animation: reveal 1.4s ease-out both; }
.pic figcaption { text-align: center; margin-top: 8px; font-family: var(--pix); }
.pic figcaption b { display: block; font-weight: normal; font-size: 15px; }
.pic figcaption span { font-size: 11px; color: var(--dim); }

/* 판정 주사위 */
.dice { font-family: var(--pix); font-size: 12px; border: 1px solid var(--line2); padding: 8px 12px; margin: 0 0 14px; color: var(--dim); display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.dice b { color: var(--ink); font-size: 16px; font-weight: normal; min-width: 20px; text-align: center; }
.dice small { color: var(--dim2); }
.dice i { margin-left: auto; font-style: normal; }
.dice.ok { border-color: #4b5f40; } .dice.ok i { color: var(--good); }
.dice.no { border-color: #5e2f27; } .dice.no i { color: var(--red); }

/* 전투 카드 */
.battle { display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin: 4px 0 16px; border: 1px solid var(--line2); background: #0a0c0e; }
.battle img { width: 64px; height: 64px; flex: none; }
.battle .noimg { width: 40px; height: 40px; display: grid; place-items: center; color: var(--red); font-family: var(--pix); border: 1px dashed var(--line2); }
.battle .binfo { flex: 1; font-family: var(--pix); }
.battle b { font-weight: normal; font-size: 13px; }
.battle .bar { height: 5px; background: #1a1d20; margin: 6px 0 3px; }
.battle .bar i { display: block; height: 100%; background: var(--red); transition: width .35s steps(10); }
.battle.legend { border-color: #5e4a2a; }
.battle.legend .bar i { background: var(--gold); }
.battle small { color: var(--dim); font-size: 11px; }

/* ── 선택지 ── */
#choices { flex: none; padding: 10px 14px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; min-height: 64px; }
#choices:empty { min-height: 0; padding: 0; border: 0; }
.choice {
  display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 2px 12px;
  width: 100%; text-align: left; background: #11151a; border: 1px solid var(--line2);
  padding: 11px 14px; cursor: pointer; font-family: var(--body); font-size: 14px; line-height: 1.5;
  animation: rise .22s ease-out both;
}
.choice:nth-child(2) { animation-delay: .05s; } .choice:nth-child(3) { animation-delay: .1s; } .choice:nth-child(4) { animation-delay: .15s; } .choice:nth-child(5) { animation-delay: .2s; }
.choice:hover:not(:disabled), .choice:focus-visible { border-color: var(--ink); outline: none; background: #161b21; }
.choice:active:not(:disabled) { transform: translateY(1px); }
.choice em { font-style: normal; font-family: var(--pix); font-size: 12px; color: var(--gold); }
.choice small { grid-column: 1 / -1; font-family: var(--pix); font-size: 11px; color: var(--dim); }
.choice small.lock { color: var(--red); }
.choice:disabled { opacity: .45; cursor: default; }
.choice.next { text-align: center; grid-template-columns: 1fr; border-color: var(--dim2); }
.choice.next span::after { content: ' ▸'; color: var(--dim); }

.namebox { display: flex; gap: 8px; }
.namebox input { flex: 1; min-width: 0; background: #0a0c0e; border: 1px solid var(--line2); color: var(--ink); font: 16px var(--body); padding: 10px 12px; outline: none; }
.namebox input:focus { border-color: var(--ink); }
.namebox .choice { width: auto; }

/* ── 오버레이 공통 ── */
.overlay { position: fixed; inset: 0; z-index: 50; background: #050608; -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade .35s ease-out both; overflow-y: auto; }
.overlay > div { width: 100%; max-width: 440px; margin: auto; }
.dim { color: var(--dim); }

/* 타이틀 */
.title .logo { text-align: center; margin: 8vh 0 44px; }
.title .kanji { display: block; font-family: serif; font-size: 72px; line-height: 1; color: #fff; letter-spacing: .1em; opacity: .92; }
.title h1 { font-family: var(--pix); font-weight: normal; font-size: 18px; margin-top: 18px; letter-spacing: .3em; }
.title .logo p { font-family: var(--pix); font-size: 11px; color: var(--dim); margin-top: 6px; }
.tbtns { display: flex; flex-direction: column; gap: 8px; }
.recs { margin-top: 36px; font-family: var(--pix); font-size: 11px; }
.recs h4 { font-weight: normal; color: var(--dim); border-bottom: 1px solid var(--line); padding-bottom: 6px; margin-bottom: 8px; }
.rec { display: grid; grid-template-columns: auto 1fr; gap: 0 10px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.rec b { font-weight: normal; }
.rec span { color: var(--dim); text-align: right; }
.rec small { grid-column: 1 / -1; color: var(--dim2); }

/* 장 카드 */
.chap { text-align: center; }
.chap .no { font-family: var(--pix); font-size: 12px; color: var(--dim); letter-spacing: .4em; }
.chap h2 { font-weight: normal; font-size: 30px; margin: 10px 0 4px; color: #fff; letter-spacing: .08em; animation: rise .8s ease-out both; }
.chap .sub { font-family: var(--pix); font-size: 12px; color: var(--dim); }
.chap .paper { margin: 34px 0 28px; background: #d9d0bb; color: #1c1a16; padding: 14px 16px 16px; text-align: left; transform: rotate(-1.2deg); box-shadow: 0 8px 30px rgba(0,0,0,.6); animation: drop .6s .3s ease-out both; }
.chap .mast { font-family: serif; font-weight: bold; font-size: 15px; text-align: center; border-bottom: 3px double #1c1a16; padding-bottom: 6px; margin-bottom: 10px; letter-spacing: .3em; }
.chap .head { font-size: 16px; line-height: 1.5; font-weight: bold; font-family: serif; }
.chap .small { font-size: 12px; margin-top: 10px; color: #5a5446; border-top: 1px solid #b9ae95; padding-top: 8px; }

/* 룰렛 */
.roul { text-align: center; }
.roul h2 { font-family: var(--pix); font-weight: normal; font-size: 18px; letter-spacing: .3em; }
.roul > p { font-family: var(--pix); font-size: 11px; margin: 6px 0 22px; }
.reel { position: relative; height: 192px; overflow: hidden; border: 1px solid var(--line2); background: #0a0c0e; }
.reel::before, .reel::after { content: ''; position: absolute; left: 0; right: 0; height: 64px; z-index: 2; pointer-events: none; }
.reel::before { top: 0; background: linear-gradient(#0a0c0e, rgba(10,12,14,.4)); }
.reel::after { bottom: 0; background: linear-gradient(rgba(10,12,14,.4), #0a0c0e); }
.reel .mark { position: absolute; left: 0; right: 0; top: 64px; height: 64px; border-top: 1px solid var(--dim2); border-bottom: 1px solid var(--dim2); z-index: 3; pointer-events: none; }
.reel .mark::before, .reel .mark::after { content: '▸'; position: absolute; top: 50%; transform: translateY(-50%); font-family: var(--pix); color: var(--ink); left: 6px; }
.reel .mark::after { content: '◂'; left: auto; right: 6px; }
.reel.done .mark { border-color: var(--ink); animation: pulse 1.2s ease-in-out infinite; }
.strip { will-change: transform; }
.ri { height: 64px; display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 12px; padding: 0 28px; text-align: left; font-size: 14px; }
.ri img { width: 40px; height: 40px; }
.ri em { font-style: normal; font-family: var(--pix); font-size: 11px; }
.ri.hidden img { filter: brightness(0); opacity: .6; }
.ri.hidden span, .ri.hidden em { color: var(--dim2); }
.result { display: grid; grid-template-columns: auto 1fr; gap: 16px; text-align: left; align-items: center; margin: 20px 0 16px; min-height: 0; }
.result:empty { margin: 8px 0; }
.result .big { width: 100px; height: 100px; animation: pop .5s cubic-bezier(.2,1.6,.4,1) both; }
.result b { font-weight: normal; font-size: 17px; color: #fff; }
.result .kind { font-family: var(--pix); font-size: 11px; border: 1px solid; padding: 0 6px; margin-left: 4px; vertical-align: 2px; }
.result p { font-size: 13px; margin-top: 6px; line-height: 1.6; }
.result p.dim { font-family: var(--pix); font-size: 11px; }
.rbtns { display: flex; flex-direction: column; gap: 8px; }
.roul.rare .reel { box-shadow: 0 0 0 1px var(--gold), 0 0 40px rgba(214,166,72,.25); }

/* 수배서 */
.death { text-align: center; }
.poster { position: relative; width: 250px; margin: 6px auto 22px; background: #d8c9a3; color: #2a2116; padding: 14px 16px 16px; box-shadow: 0 10px 40px rgba(0,0,0,.7); transform: rotate(1.5deg); font-family: serif; animation: drop .7s ease-out both; }
.poster::before { content: ''; position: absolute; inset: 6px; border: 1px solid rgba(60,45,25,.35); pointer-events: none; }
.pw { font-size: 40px; font-weight: bold; letter-spacing: .06em; line-height: 1; }
.photo { height: 150px; margin: 10px 0 8px; background: #c4b38b; border: 2px solid #4a3b25; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; }
.photo img { width: 60px; height: 60px; filter: sepia(1) contrast(1.1); opacity: .8; }
.photo span { font-family: var(--pix); font-size: 11px; color: #6b5a3c; }
.pdoa { font-size: 13px; letter-spacing: .14em; font-weight: bold; }
.pname { font-size: 19px; font-weight: bold; margin: 4px 0; }
.pbty { font-size: 22px; font-weight: bold; letter-spacing: .02em; }
.pbty small { font-size: 12px; margin-left: 3px; }
.pmar { font-size: 10px; letter-spacing: .5em; margin-top: 6px; opacity: .7; }
.stamp { position: absolute; top: 46%; left: 50%; transform: translate(-50%,-50%) rotate(-16deg); font-family: var(--pix); font-size: 34px; color: #a8261a; border: 4px solid #a8261a; padding: 2px 16px; opacity: .85; animation: stamp .35s .7s cubic-bezier(.3,1.8,.5,1) both; mix-blend-mode: multiply; }
.end .stamp { color: #1f5a8a; border-color: #1f5a8a; }
.plines { margin-bottom: 20px; font-size: 14px; }
.plines p { margin: 4px 0; }
.plines .cause { color: #fff; font-size: 16px; }
.plines .dim { font-family: var(--pix); font-size: 11px; margin-top: 10px; }
.death .choice { margin-top: 8px; }

/* 상태 시트 */
.sheet { position: fixed; inset: 0; z-index: 60; background: rgba(5,6,8,.85); display: flex; align-items: flex-end; justify-content: center; animation: fade .2s both; }
.sheet-in { width: 100%; max-width: 520px; max-height: 86dvh; overflow-y: auto; background: var(--panel); border-top: 1px solid var(--line2); padding: 20px 18px 24px; animation: rise .25s ease-out both; }
.sheet h3 { font-weight: normal; font-size: 18px; }
.sheet h3 small { display: block; font-family: var(--pix); font-size: 11px; color: var(--dim); }
.sheet h4 { font-family: var(--pix); font-weight: normal; font-size: 11px; color: var(--dim); margin: 16px 0 4px; border-bottom: 1px solid var(--line); padding-bottom: 3px; }
.sheet p, .sheet li { font-size: 13px; }
.sheet ul { list-style: none; }
.sheet li small { color: var(--dim); font-family: var(--pix); font-size: 11px; margin-left: 4px; }
.sheet .frow { display: flex; gap: 12px; align-items: center; font-size: 13px; line-height: 1.5; }
.sheet .frow img { width: 48px; height: 48px; }
.sheet .choice { margin-top: 20px; }

/* ── 연출 ── */
.flash { position: fixed; inset: 0; z-index: 100; pointer-events: none; animation: flash 1s ease-out both; }
#app.hurt { animation: hurt .35s steps(3); }
#app.quake { animation: quake .12s steps(2) 12; }
#app.magma #log { box-shadow: inset 0 0 120px rgba(201,70,47,.45); transition: box-shadow .3s; }
#app.strings::after { content: ''; position: absolute; inset: 0; z-index: 6; pointer-events: none;
  background: repeating-linear-gradient(62deg, transparent 0 46px, rgba(228,134,176,.55) 46px 47px), repeating-linear-gradient(-48deg, transparent 0 71px, rgba(228,134,176,.4) 71px 72px);
  animation: strings 1.2s ease-out both; }
#app.haoshoku { animation: haki 2s ease-out; }
.choice.vanish { animation: dissolve .8s forwards !important; }

@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
@keyframes fade { from { opacity: 0; } }
@keyframes drop { from { opacity: 0; transform: translateY(-14px) rotate(-4deg); } }
@keyframes pop { from { transform: scale(.2); opacity: 0; } }
@keyframes stamp { from { transform: translate(-50%,-50%) rotate(-16deg) scale(2.4); opacity: 0; } }
@keyframes pulse { 50% { border-color: var(--dim2); } }
@keyframes blink { 50% { opacity: .4; } }
@keyframes reveal { 0% { filter: brightness(0); opacity: 0; transform: translateY(6px); } 45% { filter: brightness(0); opacity: 1; transform: none; } 100% { filter: none; } }
@keyframes flash { 0% { opacity: 1; } 100% { opacity: 0; } }
@keyframes hurt { 0% { transform: translate(-3px,0); } 33% { transform: translate(3px,1px); } 66% { transform: translate(-2px,-1px); } 100% { transform: none; } }
@keyframes quake { 0% { transform: translate(-4px,2px) rotate(-.3deg); } 100% { transform: translate(4px,-2px) rotate(.3deg); } }
@keyframes crack { 0% { letter-spacing: .4em; filter: blur(1px); } 100% { letter-spacing: normal; } }
@keyframes strings { 0% { opacity: 0; clip-path: inset(0 100% 0 0); } 30% { opacity: 1; clip-path: inset(0 0 0 0); } 100% { opacity: 0; } }
@keyframes haki { 0% { filter: none; } 10% { filter: invert(1) grayscale(1); } 20% { filter: grayscale(1) contrast(1.6); } 100% { filter: none; } }
@keyframes dissolve { to { opacity: 0; filter: blur(4px); transform: scaleY(.6); } }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; } }

/* ───── v2: HUD 추가 줄 · 장소 · 특수 선택지 ───── */
#hud .h3 { margin-top: 3px; }
#hud .gold { color: var(--gold); }
#hud .warn, #hud .warn b { color: var(--red); }
#hud .inj { color: var(--red); }
#hud b.down { color: var(--red); }
.line.place { font-family: var(--pix); font-size: 13px; color: var(--gold); letter-spacing: .08em; border-bottom: 1px solid var(--line); padding-bottom: 8px; margin-bottom: 18px; }
.choice.special { border-color: #6a5a8a; }
.choice.special span::before { content: '✦ '; color: #b9a0e0; }
.choice small.smell { color: #d8b070; }
.pic.small .frame { width: 132px; height: 132px; }
.pic.small img { width: 128px; height: 128px; }
.pic .frame { width: 264px; height: 264px; }
.pic img { width: 256px; height: 256px; }
@media (max-width: 400px) { .pic .frame { width: 216px; height: 216px; } .pic img { width: 208px; height: 208px; } }
.sheet li.bad { color: #e0806c; }

/* 전투 카드 v2 */
.battle { align-items: flex-start; }
.battle img { width: 72px; height: 72px; image-rendering: auto; }
.battle .rank { display: block; font-size: 10px; color: var(--dim); margin-top: 1px; }
.battle .chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; min-height: 0; }
.chip { font-style: normal; font-size: 10px; padding: 0 5px; border: 1px solid var(--line2); color: var(--dim); }
.chip.burn { color: #e8874f; border-color: #6a3a22; } .chip.bleed { color: #e05a5a; border-color: #5e2626; }
.chip.stun, .chip.sleep, .chip.bind { color: #9fc4e8; border-color: #2c4a66; } .chip.weak, .chip.blind, .chip.confuse { color: #c9a0d8; border-color: #4e3a5e; }
.chip.seal { color: #7fd0c0; border-color: #2a5a52; } .chip.buff { color: var(--red); border-color: #5e2f27; }
.battle .intent { margin-top: 6px; font-size: 11px; color: var(--dim); border-top: 1px dashed var(--line2); padding-top: 5px; }
.battle .intent b { font-weight: normal; color: var(--ink); }
.battle .intent b.heavy, .battle .intent b.multi { color: #ff9f7a; }
.battle .intent b.guard { color: #9fc4e8; } .battle .intent b.charge, .battle .intent b.buff { color: var(--gold); }

/* 해도 (항로 선택) */
.map .mhead { display: flex; justify-content: space-between; align-items: baseline; font-family: var(--pix); border-bottom: 3px double var(--line2); padding-bottom: 8px; }
.map .mhead span { font-size: 18px; letter-spacing: .4em; }
.map .mhead small { color: var(--dim); font-size: 11px; }
.map .path { display: flex; align-items: center; gap: 0; margin: 18px 0 10px; font-family: var(--pix); font-size: 12px; color: var(--dim2); flex-wrap: wrap; row-gap: 6px; }
.map .path i { flex: 1; min-width: 14px; height: 1px; background: repeating-linear-gradient(90deg, var(--line2) 0 3px, transparent 3px 6px); margin: 0 6px; }
.map .path .done { color: var(--good); } .map .path .now { color: var(--ink); animation: blink 1s steps(2) infinite; } .map .path .goal { color: var(--gold); }
.map > p { font-family: var(--pix); font-size: 11px; margin-bottom: 14px; }
.nodes { display: flex; flex-direction: column; gap: 10px; }
.node { display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: center; text-align: left; background: #11151a; border: 1px solid var(--line2); padding: 12px 14px; cursor: pointer; animation: rise .3s ease-out both; }
.node:nth-child(2) { animation-delay: .07s; } .node:nth-child(3) { animation-delay: .14s; }
.node:hover, .node:focus-visible { border-color: var(--ink); background: #161b21; outline: none; }
.node .ic { font-variant-emoji: text; width: 44px; height: 44px; display: grid; place-items: center; font-size: 22px; border: 1px solid var(--line2); background: #0a0c0e; color: var(--ink); font-family: var(--pix); }
.node.named .ic { color: var(--gold); border-color: #5e4a2a; }
.node .nb b { display: block; font-weight: normal; font-size: 15px; }
.node.named .nb b { color: #f0d9a0; }
.node .nb small { display: block; font-family: var(--pix); font-size: 11px; color: var(--dim); margin-top: 2px; line-height: 1.5; }
.node .dg { font-size: 9px; letter-spacing: 1px; color: var(--red); white-space: nowrap; }

/* v3: 현재 위치 */
#hud .loc { font-size: 11px; color: var(--dim); margin-bottom: 6px; padding-bottom: 6px; border-bottom: 1px dashed var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#hud .loc b { font-weight: normal; color: var(--gold); }
.chap .route { font-family: var(--pix); font-size: 11px; color: var(--ink); opacity: .75; margin-top: 14px; }

/* v4: 신문 카드의 뉴스쿠 */
.chap .paper { position: relative; }
.chap .paper .coo { position: absolute; width: 72px; height: 72px; right: -26px; top: -46px; transform: rotate(8deg); image-rendering: auto; filter: drop-shadow(0 4px 6px rgba(0,0,0,.5)); }

/* v5: 전투 카드 고정 */
.battle.live { position: sticky; top: -22px; z-index: 4; background: #0a0c0e; box-shadow: 0 10px 18px -8px rgba(0,0,0,.85); margin-left: -6px; margin-right: -6px; border-color: var(--dim2); }
.battle.live.legend { border-color: #8a6a2a; }
.battle .intent { font-size: 12px; }
.battle.live .intent { background: #14181d; margin: 6px -4px 0; padding: 6px 6px; border-top: 0; }
.battle .me { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; margin-top: 6px; font-size: 10px; color: var(--dim); }
.battle .me span:nth-child(2) { color: var(--ink); }
.battle.done { opacity: .55; padding: 6px 10px; }
.battle.done img { width: 36px; height: 36px; }
.battle.done .chips, .battle.done .me, .battle.done .rank { display: none; }
.battle.done .intent { border: 0; padding: 0; margin-top: 2px; }
.battle .res.win { color: var(--good); } .battle .res.fled { color: var(--dim); } .battle .res.survived, .battle .res.timeout { color: var(--gold); }

/* v6: 수배서 실루엣 사진 */
.photo { overflow: hidden; padding: 0; }
.photo img.sil { width: 100%; height: 100%; object-fit: cover; object-position: center 20%; filter: sepia(.35) contrast(1.05); opacity: 1; image-rendering: auto; }

/* ───── v7: 인물 전용 등장 연출 ───── */
.cfx { position: absolute; inset: 0; z-index: 7; pointer-events: none; overflow: hidden; }
.cfx i { position: absolute; display: block; }
/* 버기: 바라바라 */
.pic .frame { position: relative; }
.bara { position: absolute; inset: 0; pointer-events: none; }
.pic .frame .bara img { filter: none; opacity: 1; position: absolute; left: 50%; bottom: 0; width: 256px; height: 256px; transform: translateX(-50%); }
@media (max-width: 400px) { .pic .frame .bara img { width: 208px; height: 208px; } }
.pic .frame .bara img.s1 { clip-path: inset(0 0 64% 0); animation: bara1 1.4s cubic-bezier(.3,1.4,.5,1) both; }
.pic .frame .bara img.s2 { clip-path: inset(36% 0 30% 0); animation: bara2 1.4s cubic-bezier(.3,1.4,.5,1) both; }
.pic .frame .bara img.s3 { clip-path: inset(70% 0 0 0); animation: bara3 1.4s cubic-bezier(.3,1.4,.5,1) both; }
@keyframes bara1 { 0% { transform: translateX(-50%); } 25%, 60% { transform: translate(calc(-50% - 46px), -34px) rotate(-14deg); } 100% { transform: translateX(-50%); } }
@keyframes bara2 { 0% { transform: translateX(-50%); } 25%, 60% { transform: translate(calc(-50% + 52px), -6px) rotate(10deg); } 100% { transform: translateX(-50%); } }
@keyframes bara3 { 0% { transform: translateX(-50%); } 25%, 60% { transform: translate(calc(-50% - 22px), 20px) rotate(-6deg); } 100% { transform: translateX(-50%); } }
/* 물 · 바다왕 · 아론 */
.cfx-water { background: linear-gradient(to top, rgba(60,120,170,.45), transparent 55%); animation: cfxFade 1.5s ease-out both; }
.cfx-water i { left: calc(var(--x) * 100%); bottom: -10px; width: calc(6px + var(--s) * 8px); height: calc(6px + var(--s) * 8px); border: 1px solid rgba(190,230,255,.7); border-radius: 50%; animation: particle-rise 1.3s var(--d) ease-in both; }
@keyframes particle-rise { to { transform: translateY(-420px); opacity: 0; } }
/* 모래 · 크로커다일 */
.cfx-sand { background: rgba(190,150,80,.22); animation: cfxFade 2s ease-out both; }
.cfx-sand i { top: calc(var(--y) * 100%); left: -20px; width: calc(2px + var(--s) * 3px); height: 2px; background: rgba(230,200,140,.85); animation: blow 1.2s var(--d) linear both; }
@keyframes blow { to { transform: translate(600px, -40px); opacity: 0; } }
/* 얼음 · 아오키지 */
.cfx-frost { box-shadow: inset 0 0 90px 30px rgba(190,230,255,.65); animation: cfxFade 2s ease-out both; }
.cfx-frost i { top: calc(var(--y) * 100%); left: calc(var(--x) * 100%); width: 14px; height: 14px; background: conic-gradient(from 0deg, #fff 0 10%, transparent 10% 25%, #fff 25% 35%, transparent 35% 50%, #fff 50% 60%, transparent 60% 75%, #fff 75% 85%, transparent 85%); border-radius: 50%; opacity: .8; animation: twinkle 1.6s var(--d) ease-out both; }
@keyframes twinkle { 0% { transform: scale(0); } 30% { transform: scale(var(--s)); } 100% { transform: scale(0); opacity: 0; } }
/* 빛 · 키자루 */
.cfx-light { background: radial-gradient(circle at 50% 35%, rgba(255,240,160,.95), rgba(255,220,90,.35) 30%, transparent 65%), repeating-conic-gradient(from 0deg at 50% 35%, rgba(255,240,170,.35) 0 4deg, transparent 4deg 18deg); animation: lightFx 1.3s ease-out both; }
@keyframes lightFx { 0% { opacity: 0; transform: scale(.6); } 15% { opacity: 1; transform: scale(1.1); } 100% { opacity: 0; transform: scale(1.4); } }
/* 박쥐 · 모리아 */
.cfx-bats { background: radial-gradient(circle, transparent 40%, rgba(20,8,24,.6)); animation: cfxFade 2s ease-out both; }
.cfx-bats i { top: calc(var(--y) * 70% + 10%); left: -50px; width: calc(26px + var(--s) * 18px); height: calc(13px + var(--s) * 9px); background-size: contain; background-repeat: no-repeat; animation: batfly 1.4s var(--d) ease-in both; }
@keyframes batfly { 0% { transform: translate(0, 0) scaleY(1); } 50% { transform: translate(260px, -30px) scaleY(.4); } 100% { transform: translate(560px, 10px) scaleY(1); opacity: .2; } }
/* 떡 · 카타쿠리 */
.cfx-mochi i { top: calc(var(--y) * 100%); left: calc(var(--x) * 100%); width: 80px; height: 80px; border-radius: 50%; background: radial-gradient(circle, rgba(250,245,235,.75), transparent 70%); animation: blob 1.5s var(--d) ease-out both; }
@keyframes blob { 0% { transform: scale(0); } 40% { transform: scale(calc(var(--s) * 2)); } 100% { transform: scale(calc(var(--s) * 3)); opacity: 0; } }
/* 번개 · 카이도 */
.cfx-thunder { animation: thunder 1.4s steps(1) both; }
@keyframes thunder { 0% { background: transparent; } 8% { background: rgba(230,215,255,.85); } 14% { background: transparent; } 30% { background: rgba(160,110,230,.55); } 36% { background: transparent; } 52% { background: rgba(240,230,255,.7); } 58%, 100% { background: transparent; } }
/* 영혼 · 빅맘 */
.cfx-soul { box-shadow: inset 0 0 120px 40px rgba(230,100,160,.55); animation: cfxFade 1.8s ease-out both; }
.cfx-soul i { left: calc(var(--x) * 100%); bottom: 20%; width: 18px; height: 24px; border-radius: 50% 50% 40% 40%; background: rgba(255,230,240,.6); animation: particle-rise 1.6s var(--d) ease-out both; }
/* 연기 · 스모커 */
.cfx-smoke i { left: calc(var(--x) * 100%); bottom: -40px; width: calc(60px + var(--s) * 60px); height: calc(60px + var(--s) * 60px); border-radius: 50%; background: radial-gradient(circle, rgba(235,235,235,.55), transparent 70%); animation: smoke 1.9s var(--d) ease-out both; }
@keyframes smoke { to { transform: translate(calc((var(--x) - .5) * 160px), -380px) scale(1.8); opacity: 0; } }
/* 주먹 · 가프 · 모건 */
.cfx-punch { background: radial-gradient(circle at 50% 40%, rgba(255,255,255,.9), rgba(255,255,255,.2) 25%, transparent 50%); animation: punch .6s ease-out both; }
@keyframes punch { 0% { transform: scale(.2); opacity: 1; } 100% { transform: scale(2.2); opacity: 0; } }
/* 하트 · 핸콕 */
.cfx-hearts { background: rgba(240,120,160,.12); animation: cfxFade 2s ease-out both; }
.cfx-hearts i { left: calc(var(--x) * 100%); bottom: -20px; width: calc(14px + var(--s) * 12px); height: calc(13px + var(--s) * 11px); background-size: contain; background-repeat: no-repeat; animation: heart 1.7s var(--d) ease-out both; }
@keyframes heart { 0% { transform: translateY(0) scale(.4); } 100% { transform: translateY(-460px) scale(1.1) rotate(calc((var(--x) - .5) * 60deg)); opacity: 0; } }
/* 어둠 · 검은수염 */
.cfx-dark { background: radial-gradient(circle at 50% 40%, transparent 0, rgba(6,4,10,.95) 60%); animation: dark 1.7s ease-in-out both; }
@keyframes dark { 0% { opacity: 0; transform: scale(2); } 40% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(.8); } }
/* 손톱 · 쿠로 · 루치 */
.cfx-claws i { top: calc(10% + var(--y) * 60%); left: -10%; width: 120%; height: 2px; background: linear-gradient(90deg, transparent, #fff 40%, #fff 60%, transparent); transform: rotate(calc(-25deg + var(--x) * 20deg)); animation: slash .5s var(--d) ease-out both; }
@keyframes slash { 0% { clip-path: inset(0 100% 0 0); opacity: 1; } 50% { clip-path: inset(0 0 0 0); opacity: 1; } 100% { opacity: 0; } }
/* 최면 · 잔고 */
.cfx-hypno { background: repeating-conic-gradient(from 0deg at 50% 40%, rgba(255,255,255,.12) 0 15deg, rgba(0,0,0,.12) 15deg 30deg); animation: hypno 1.7s ease-in-out both; }
@keyframes hypno { 0% { opacity: 0; transform: rotate(0); } 30% { opacity: 1; } 100% { opacity: 0; transform: rotate(540deg) scale(1.3); } }
/* 폭발 · 크리크 */
.cfx-boom { background: radial-gradient(circle at 50% 45%, rgba(255,220,120,.95), rgba(240,110,40,.6) 30%, transparent 60%); animation: punch .8s ease-out both; }
/* 촛농 · Mr.3 */
.cfx-wax i { top: -10px; left: calc(var(--x) * 100%); width: calc(6px + var(--s) * 6px); height: 0; border-radius: 0 0 6px 6px; background: rgba(240,238,228,.85); animation: drip 1.5s var(--d) ease-in both; }
@keyframes drip { to { height: calc(80px + var(--s) * 160px); opacity: .2; } }
/* 스프링 · 벨라미 */
.pic.fx-spring img { animation: spring 1.1s cubic-bezier(.3,1.8,.5,1) both; transform-origin: 50% 100%; }
@keyframes spring { 0% { transform: scaleY(.6); } 30% { transform: translateY(-50px) scaleY(1.15); } 55% { transform: scaleY(.8); } 75% { transform: translateY(-16px); } 100% { transform: none; } }
/* 불(佛) · 센고쿠 */
.cfx-buddha { background: radial-gradient(circle at 50% 40%, rgba(255,215,90,.75), rgba(230,180,60,.25) 35%, transparent 65%); animation: cfxFade 1.6s ease-out both; }
/* 바람 · 드래곤 */
.cfx-wind i { top: calc(var(--y) * 100%); left: -40%; width: 40%; height: 1px; background: linear-gradient(90deg, transparent, rgba(210,240,220,.8), transparent); animation: wind 1s var(--d) linear both; }
@keyframes wind { to { transform: translateX(400%); } }
/* 쿠마 */
.cfx-paw { background: radial-gradient(circle at 50% 40%, rgba(255,240,250,.85), transparent 45%); animation: punch .9s ease-out both; }
@keyframes cfxFade { 0% { opacity: 0; } 15% { opacity: 1; } 100% { opacity: 0; } }

/* v8: 열매 역할 */
.result .role { font-family: var(--pix); font-size: 12px; color: var(--gold); margin-top: 6px; }

/* 잠긴 선택지는 눌리는 것처럼 보이지 않게 */
.choice:disabled, .choice[disabled] { cursor: not-allowed; }
.choice:disabled:hover { border-color: var(--line2); background: #11151a; }
/* 전투 중: 선택지를 2열로 촘촘히 — 전투 로그가 더 보이게 */
body:has(.battle.live) #choices { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding-top: 8px; }
body:has(.battle.live) #choices .choice { padding: 7px 10px; font-size: 13px; line-height: 1.35; grid-template-columns: 1fr; }
body:has(.battle.live) #choices .choice em { justify-self: start; }
body:has(.battle.live) #choices .choice small { font-size: 10px; line-height: 1.3; }
body:has(.battle.live) #choices .choice.next, body:has(.battle.live) #choices .choice:only-child { grid-column: 1 / -1; }
/* 상태창: 위쪽에 늘 보이는 닫기 */
.sheet-in { position: relative; }
.sheet-x { position: sticky; top: -20px; float: right; margin: -8px -6px 0 0; width: 34px; height: 34px; background: var(--panel); border: 1px solid var(--line2); color: var(--ink); font-size: 20px; line-height: 1; cursor: pointer; z-index: 2; }
.sheet-x:hover { border-color: var(--ink); }

/* 소리 버튼 (상단) */
#hud .loc { display: flex; align-items: baseline; }
#hud .mute { margin-left: auto; background: none; border: 0; color: var(--dim); font-family: var(--pix); font-size: 11px; cursor: pointer; padding: 0 0 0 10px; }
#hud .mute:hover { color: var(--ink); }
/* 타이틀 도감 */
.codex { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; margin: 18px 0 4px; font-family: var(--pix); font-size: 11px; color: var(--dim); }
.codex b { color: var(--ink); font-weight: normal; }
/* 항해 일지 (수배서 아래) */
.jr { list-style: none; margin: 14px auto 0; padding: 10px 0 0; border-top: 1px dashed var(--line2); text-align: left; font-family: var(--pix); font-size: 11px; color: var(--dim); max-width: 320px; }
.jr li { padding: 2px 0 2px 14px; position: relative; }
.jr li::before { content: '›'; position: absolute; left: 2px; color: var(--dim2); }
.jr li:last-child { color: var(--ink); }

/* 선택지가 5개 이상이면 (항구·잡화점·야영) 2열로 */
#choices:has(> .choice:nth-child(5)) { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
#choices:has(> .choice:nth-child(5)) .choice { padding: 8px 10px; font-size: 13px; line-height: 1.35; grid-template-columns: 1fr; }
#choices:has(> .choice:nth-child(5)) .choice em { justify-self: start; }
#choices:has(> .choice:nth-child(5)) .choice small { font-size: 10px; line-height: 1.3; }
