/* 첫눈 전에 — 화면. 시안 A(게임기형)의 뼈대와 부품 다섯 가지(단추·칩·카드·시트·탭)를 그대로 쓴다. 선 굵기는 전부 3px(= 그림 1픽셀). */
@font-face { font-family: "Galmuri11"; src: url("../fonts/Galmuri11.woff2") format("woff2"); font-weight: 400; font-display: block; }
@font-face { font-family: "Galmuri11"; src: url("../fonts/Galmuri11-Bold.woff2") format("woff2"); font-weight: 700; font-display: block; }
@font-face { font-family: "Galmuri14"; src: url("../fonts/Galmuri14.woff2") format("woff2"); font-weight: 400; font-display: block; }

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: #0c0c11; overflow: hidden; overscroll-behavior: none; }
body { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; word-break: keep-all; overflow-wrap: anywhere; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: manipulation; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; touch-action: manipulation; }
img { display: block; -webkit-user-drag: none; }

.px { image-rendering: pixelated; image-rendering: crisp-edges; flex: none; }
.x1 { width: 21.3333px; height: 21.3333px; }
.x2 { width: 26.6667px; height: 26.6667px; }
.x3 { width: 32px; height: 32px; }
.x4 { width: 48px; height: 48px; }
.x6 { width: 64px; height: 64px; }

.app {
  position: relative; width: 100%; max-width: 480px; height: 100vh; height: 100dvh; margin: 0 auto;
  overflow: hidden; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: var(--fs); line-height: var(--lh);
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
  --font: "Galmuri11", "Galmuri14", monospace;
  --fs: 16px; --lh: 1.5; --fs-read: 16px; --lh-read: 1.75; --fs-title: 20px; --fs-btn: 20px; --fs-num: 20px; --fs-num-s: 16px; --fs-nav: 16px;
  --fw-bold: 700; --fs-name: 16px;
  --ink: #17161f; --bg: #1c1b26; --text: #f3efe2; --text-2: #cbc7b6;
  --panel: #2a2836; --panel-hi: #4a4459; --panel-lo: #1f1d2a;
  --accent: #dcb53c; --accent-hi: #f0d870; --accent-lo: #b08a30;
  --danger: #d24f45; --danger-text: #ee8b6c; --good: #6fae62; --good-hi: #a5d482;
  --float: #f3efe2; --float-shadow: 3px 3px 0 #17161f, -3px 0 0 #17161f, 0 -3px 0 #17161f, 3px 0 0 #17161f, 0 3px 0 #17161f;
  --notch: polygon(3px 0, calc(100% - 3px) 0, calc(100% - 3px) 3px, 100% 3px, 100% calc(100% - 3px), calc(100% - 3px) calc(100% - 3px), calc(100% - 3px) 100%, 3px 100%, 3px calc(100% - 3px), 0 calc(100% - 3px), 0 3px, 3px 3px);
  -webkit-font-smoothing: none; font-smooth: never; letter-spacing: 0;
}
.screen { position: absolute; inset: 0; display: none; flex-direction: column; }
[data-screen="title"] #s-title, [data-screen="explore"] #s-explore, [data-screen="place"] #s-place, [data-screen="event"] #s-event,
[data-screen="battle"] #s-battle, [data-screen="ending"] #s-ending { display: flex; }
b, strong, h1, h2, h3 { font-weight: var(--fw-bold); }
.num { font-variant-numeric: tabular-nums; }
.dim { color: var(--text-2); }
.bad { color: var(--danger-text); }
.ok { color: var(--good-hi); }

/* ---------- 패널 ---------- */
.panel { background: var(--panel); border: 3px solid var(--ink); box-shadow: inset 3px 3px 0 var(--panel-hi), inset -3px -3px 0 var(--panel-lo); clip-path: var(--notch); }

/* ---------- 부품 1: 단추 (주 / 보조) ---------- */
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 56px; padding: 0 16px 4px; font-size: var(--fs-btn); font-weight: var(--fw-bold); white-space: nowrap; border: 3px solid var(--ink); clip-path: var(--notch); transition: transform .06s; }
.btn.primary { background: var(--accent); color: var(--ink); box-shadow: inset 0 3px 0 var(--accent-hi), inset 0 -6px 0 var(--accent-lo); }
.btn.secondary { background: #4a4459; color: var(--text); box-shadow: inset 0 3px 0 #6b6278, inset 0 -6px 0 #322e42; }
.btn:active:not([disabled]), .press:active:not([disabled]) { transform: translateY(3px); filter: brightness(.92); }
.btn[disabled] { cursor: default; background: #322e42; color: #8d899a; box-shadow: inset 0 3px 0 #3d394d, inset 0 -6px 0 #272433; }
.btn[disabled] img { opacity: .45; }
.btn.narrow { flex: 0 0 auto !important; padding-left: 14px; padding-right: 14px; }

/* ---------- 부품 2: 칩 ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 10px 0 7px; font-size: var(--fs); white-space: nowrap; flex: none; background: var(--ink); box-shadow: inset 0 0 0 3px var(--panel-hi); color: var(--text); }
.chip b { font-size: var(--fs-num-s); }
.chip.ship, .chip.warn { box-shadow: inset 0 0 0 3px var(--accent-lo); color: var(--accent-hi); }
.chip.need, .chip.atk { box-shadow: inset 0 0 0 3px var(--danger); color: var(--danger-text); }
.chip.good { box-shadow: inset 0 0 0 3px #4f7d47; color: var(--good-hi); }
.chip.turn { background: var(--accent); color: var(--ink); box-shadow: inset 0 0 0 3px var(--ink); font-weight: 700; padding: 0 10px; }
.chip.plain { padding: 0 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- 부품 3: 카드 ---------- */
.card { display: flex; align-items: center; gap: 12px; padding: 12px; }

/* ---------- 부품 5: 탭 ---------- */
.tabs { display: flex; gap: 4px; padding: 0 12px; box-shadow: inset 0 -3px 0 var(--panel-hi); flex: none; }
.tab { flex: 1; min-height: 48px; display: flex; align-items: center; justify-content: center; font-size: var(--fs-btn); color: var(--text-2); position: relative; }
.tab[aria-selected="true"] { color: var(--accent-hi); font-weight: var(--fw-bold); box-shadow: inset 0 -6px 0 var(--accent); }

/* 막대 */
.bar { position: relative; height: 12px; flex: none; align-self: stretch; min-width: 40px; overflow: hidden; background: var(--ink); box-shadow: inset 0 0 0 3px var(--ink); }
.bar > i { position: absolute; left: 3px; top: 3px; bottom: 3px; display: block; background: var(--good); box-shadow: inset 0 3px 0 var(--good-hi); max-width: calc(100% - 6px); transition: width .22s steps(6); }
.bar.foe > i { background: var(--danger); box-shadow: inset 0 3px 0 var(--danger-text); }
.bar.gold > i { background: var(--accent); box-shadow: inset 0 3px 0 var(--accent-hi); }
.bar.low > i { background: var(--danger); box-shadow: inset 0 3px 0 var(--danger-text); }

/* 위 제목 줄 / 아래 조작 줄 */
.topbar { display: flex; align-items: center; gap: 10px; padding: calc(10px + var(--sat)) 12px 14px; min-height: calc(60px + var(--sat)); flex: none; background: var(--panel); box-shadow: inset 0 -3px 0 var(--ink), inset 0 -6px 0 var(--panel-lo), inset 0 3px 0 var(--panel-hi); }
.topbar h2 { font-size: var(--fs-title); line-height: 1.2; flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; }
.bottom { flex: none; display: flex; gap: 8px; padding: 14px 12px calc(12px + var(--sab)); background: var(--panel); box-shadow: inset 0 3px 0 var(--ink), inset 0 6px 0 var(--panel-hi); }
.bottom .btn { flex: 1; min-width: 0; }

/* 강조(처음 배우는 조작): 테두리가 깜빡인다 */
/* 깜빡일 때 투명으로 가지 않는다(사진이나 눈길이 꺼진 쪽에 걸려도 보이게): 밝은 노랑 ↔ 짙은 노랑 */
@keyframes hl { 0%, 100% { outline-color: var(--accent-hi); } 50% { outline-color: var(--accent-lo); } }
.hl { outline: 3px solid var(--accent-hi); outline-offset: 3px; animation: hl .9s steps(2) infinite; clip-path: none !important; }

/* =========================================================  타이틀 */
#s-title { background: #100f17; }
#titleBg { position: absolute; left: 0; top: 0; }
.title-shade { position: absolute; inset: 0; background: linear-gradient(rgba(16,15,23,.55), rgba(16,15,23,.1) 34%, rgba(16,15,23,.25) 56%, rgba(16,15,23,.94) 74%); }
.title-head { position: relative; padding: calc(84px + var(--sat)) 24px 0; text-align: center; }
.title-head h1 { font-size: 48px; line-height: 1.2; color: var(--text); text-shadow: 3px 3px 0 var(--ink), -3px 0 0 var(--ink), 0 -3px 0 var(--ink), 3px 0 0 var(--ink), 0 3px 0 var(--ink), 6px 6px 0 rgba(0,0,0,.4); letter-spacing: 2px; }
.title-head p { margin-top: 12px; font-size: 16px; color: var(--accent-hi); text-shadow: var(--float-shadow); }
.title-menu { position: relative; margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding: 0 24px calc(28px + var(--sab)); }
.title-menu .btn { min-height: 60px; }
.title-menu .btn .sub { font-size: 16px; font-weight: 400; margin-left: 4px; opacity: .85; }
.title-row { display: flex; gap: 8px; }
.title-row .btn { flex: 1; font-size: 16px; padding: 0 8px 4px; }
@media (max-height: 780px) { .title-head { padding-top: calc(52px + var(--sat)); } }

/* =========================================================  1. 탐험 */
#map { position: absolute; left: 0; top: 0; touch-action: none; }
.hud { position: relative; flex: none; display: flex; flex-direction: column; padding: calc(6px + var(--sat)) 6px 0; gap: 6px; z-index: 2; pointer-events: none; }
.hud > * { pointer-events: auto; }
.hud-main { display: flex; flex-direction: column; gap: 6px; padding: 6px 9px 7px 9px; }
.hud-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.when { display: flex; align-items: center; gap: 6px; font-size: var(--fs); white-space: nowrap; }
.when b { font-size: var(--fs-num-s); margin-left: 4px; }
.gear { width: 46px; height: 46px; margin: -8px -6px -8px -2px; display: flex; align-items: center; justify-content: center; flex: none; }
.stats { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding-right: 3px; }
.stat { display: flex; align-items: center; gap: 6px; }
.stat b { font-size: var(--fs-num); line-height: 1; }
.stat .of { font-size: var(--fs); color: var(--text-2); }
.stat.hp .hpcol { display: flex; flex-direction: column; gap: 5px; }
.stat.hp .bar { width: 66px; flex: none; height: 9px; }
.stat.hp .bar > i { box-shadow: none; }
.stat.zero b { color: var(--danger-text); }
.goal { display: flex; align-items: flex-start; gap: 8px; font-size: var(--fs); line-height: 1.45; text-wrap: balance; padding: 8px 12px 9px 9px; text-align: left; width: 100%; }
.goal img { margin-top: -1px; }
.goal > span { flex: 1; }
.goal .go { margin-left: 4px; opacity: .9; }
@keyframes goalnew { 0%, 40% { background: var(--accent); color: var(--ink); } 100% { background: var(--panel); color: var(--text); } }
.goal.new { animation: goalnew 1.6s steps(8); }
.spacer { flex: 1; min-height: 0; pointer-events: none; }
.dock { position: relative; flex: none; display: flex; flex-direction: column; z-index: 2; padding: 0 6px calc(6px + var(--sab)); gap: 6px; pointer-events: none; }
.dock > * { pointer-events: auto; }
.place-card { padding: 6px; gap: 10px; }
.place-card .thumb { width: 64px; height: 64px; flex: none; display: flex; align-items: flex-end; justify-content: center; overflow: hidden; background: #95938a; box-shadow: inset 0 0 0 3px var(--ink); }
.place-card .thumb img { flex: none; }
.place-card .thumb.face img { width: 64px; height: 64px; }
.place-card .txt { flex: 1; min-width: 0; }
.place-card h3 { font-size: var(--fs-title); line-height: 1.2; }
.place-card p { font-size: var(--fs); color: var(--text-2); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.place-card .btn { padding: 0 14px 4px; min-height: 54px; }
@keyframes cardin { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
.place-card { animation: cardin .12s steps(3); }
.nav { display: flex; padding: 3px; }
.nav button { flex: 1; min-height: 75px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; padding: 3px 0 0; line-height: 1.3; font-size: var(--fs-nav); font-weight: var(--fw-bold); position: relative; }
.nav .ico { width: 48px; height: 48px; }
.nav button + button { box-shadow: -3px 0 0 var(--panel-lo); }
.nav button:active { background: var(--panel-hi); }
.nav .dot { position: absolute; top: 6px; right: 14px; width: 15px; height: 15px; background: var(--danger); border: 3px solid var(--ink); }
.banner { position: absolute; left: 0; right: 0; top: 34%; text-align: center; font-size: 32px; font-weight: 700; text-shadow: var(--float-shadow); pointer-events: none; z-index: 3; animation: banner 2.2s steps(12) forwards; }
.banner small { display: block; font-size: 16px; font-weight: 400; color: var(--accent-hi); }
@keyframes banner { 0% { opacity: 0; transform: translateY(9px); } 12%, 80% { opacity: 1; transform: none; } 100% { opacity: 0; } }

/* =========================================================  2. 장소 */
.scene { position: relative; flex: 0 100 196px; min-height: 96px; overflow: hidden; background: #17161f; }
.scene canvas { position: absolute; left: 50%; bottom: 0; width: 480px; margin-left: -240px; }
.scene::after { content: ""; position: absolute; inset: 0; box-shadow: inset 0 -3px 0 var(--ink); pointer-events: none; }
.body { flex: 1 1 auto; display: flex; flex-direction: column; gap: 12px; padding: 14px 12px 6px; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.body > * { flex: none; }
.desc { font-size: var(--fs-read); line-height: var(--lh-read); padding: 0 4px; }
.found { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 4px; margin-top: -4px; }
@keyframes pop { 0% { transform: scale(.4); opacity: 0; } 60% { transform: scale(1.15); opacity: 1; } 100% { transform: none; } }
.found .chip, .gains .chip { animation: pop .22s steps(4) backwards; }
.found .chip:nth-child(2), .gains .chip:nth-child(2) { animation-delay: .07s; } .found .chip:nth-child(3), .gains .chip:nth-child(3) { animation-delay: .14s; } .found .chip:nth-child(4), .gains .chip:nth-child(4) { animation-delay: .21s; }
.noise { display: flex; align-items: center; gap: 8px; font-size: var(--fs); padding: 0 4px; }
.noise .meter { display: flex; gap: 4px; }
.noise .meter i { display: block; width: 22px; height: 12px; background: var(--ink); box-shadow: inset 0 0 0 3px var(--panel-hi); }
.noise .meter i.on { background: var(--accent); box-shadow: inset 0 0 0 3px var(--ink); }
.noise.loud .meter i.on { background: var(--danger); }
.noise.loud .lab { color: var(--danger-text); }
.spots { display: flex; flex-direction: column; gap: 8px; }
.spot { width: 100%; text-align: left; min-height: 60px; padding: 9px 12px 10px; display: grid; grid-template-columns: auto 1fr auto; column-gap: 12px; row-gap: 8px; align-items: center; position: relative; }
.spot .name { font-size: var(--fs-title); font-weight: var(--fw-bold); }
.spot .req { grid-column: 2 / 4; display: flex; flex-wrap: wrap; gap: 6px; }
.spot .why { grid-column: 2 / 4; font-size: var(--fs); color: var(--danger-text); }
.spot.locked, .spot.done { background: var(--panel-lo); box-shadow: inset 3px 3px 0 #322e42, inset -3px -3px 0 #17161f; }
.spot.locked .name, .spot.done .name { color: var(--text-2); }
.spot.done { min-height: 48px; padding-top: 5px; padding-bottom: 6px; }
.spot.done .name { font-weight: 400; font-size: var(--fs); }
.spot.done img { opacity: .6; }
.spot .face { width: 32px; height: 32px; box-shadow: 0 0 0 3px var(--ink); }
.spot.busy::after { content: ""; position: absolute; left: 3px; top: 3px; bottom: 3px; width: 0; background: rgba(220,181,60,.35); animation: busy .38s steps(8) forwards; }
@keyframes busy { to { width: calc(100% - 6px); } }

/* =========================================================  3. 사건 */
.stage { position: relative; flex: 1 1 200px; min-height: 110px; display: flex; align-items: center; justify-content: center; overflow: hidden; padding-top: var(--sat); background: #100f17; box-shadow: inset 0 -3px 0 var(--ink), inset 0 -6px 0 var(--panel-hi); padding-bottom: 6px; }
.stage canvas { position: absolute; left: 50%; bottom: 0; width: 480px; margin-left: -240px; }
.stage.dimmed canvas { filter: brightness(.4); }
.stage .portrait { position: relative; width: 192px; height: 192px; border: 3px solid var(--ink); box-shadow: 0 0 0 3px var(--panel-hi), 0 0 0 6px var(--ink); box-sizing: content-box; background: #2a2836; }
.event-body { flex: none; display: flex; flex-direction: column; gap: 14px; padding: 18px 16px 6px; }
.narr { font-size: var(--fs-read); line-height: var(--lh-read); }
/* 말하는 사람 이름은 상자 안의 첫 줄에 따로 둔다(대사와 겹치지 않게) */
.say { display: block; padding: 10px 14px 13px; clip-path: none; }
.say .who { display: flex; align-items: center; gap: 8px; font-size: var(--fs); font-weight: var(--fw-bold); color: var(--accent-hi); line-height: 1.25; margin-bottom: 7px; padding-bottom: 7px; box-shadow: 0 3px 0 var(--panel-lo); }
.say p { font-size: var(--fs-read); line-height: var(--lh-read); }
.gains { display: flex; flex-wrap: wrap; gap: 6px; }
.choices { flex: none; display: flex; flex-direction: column; gap: 8px; padding: 12px 12px calc(14px + var(--sab)); }
.choice { justify-content: space-between; text-align: left; font-weight: 400; font-size: var(--fs-read); min-height: 56px; padding: 8px 14px 10px; white-space: normal; flex-wrap: wrap; row-gap: 6px; line-height: 1.4; }
.choice > span:first-child { flex: 1 1 52%; min-width: 0; }
.choice .chip { height: 32px; box-shadow: inset 0 0 0 3px #6b6278; }
.choice .chip.need, .choice .chip.atk { box-shadow: inset 0 0 0 3px var(--danger); }
.choice .chip.warn { box-shadow: inset 0 0 0 3px var(--accent-lo); }
.choice .cc { display: flex; gap: 6px; flex: 0 0 auto; max-width: 100%; flex-wrap: wrap; }
.choice.off { row-gap: 2px; }
.choice .why { flex-basis: 100%; font-size: var(--fs); color: var(--danger-text); margin-top: 2px; }
.choices .next { align-self: stretch; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.event-body > * { animation: fadein .14s steps(3); }

/* =========================================================  4. 전투 */
.field { position: relative; flex: 1 1 300px; min-height: 200px; display: flex; align-items: flex-end; justify-content: center; gap: 14px; padding: 0 12px 14px; overflow: hidden; background: #100f17; box-shadow: inset 0 -3px 0 var(--ink); }
.field canvas { position: absolute; left: 50%; bottom: 0; width: 390px; height: 540px; margin-left: -195px; filter: grayscale(.75) brightness(.42) contrast(.8) blur(1.5px); }
/* 배경은 흐리고 어둡게, 적은 잉크 테두리와 발밑 그림자로 가장 또렷하게 */
.field::before { content: ""; position: absolute; inset: 0; background: linear-gradient(rgba(16,15,23,.55), rgba(16,15,23,0) 30%, rgba(16,15,23,0) 70%, rgba(16,15,23,.5)); pointer-events: none; }
.enemy .mob { filter: drop-shadow(3px 0 0 #17161f) drop-shadow(-3px 0 0 #17161f) drop-shadow(0 3px 0 #17161f) drop-shadow(0 -3px 0 #17161f); }
.enemy::before { content: ""; position: absolute; left: 12%; right: 12%; top: calc(34px + 6px + 110px); height: 16px; background: radial-gradient(ellipse at center, rgba(0,0,0,.6), rgba(0,0,0,0) 70%); pointer-events: none; }
.field.n3 .enemy::before, .field.n4 .enemy::before { top: calc(34px + 6px + 80px); }
.chip.intent { height: 34px; padding: 0 8px 0 5px; gap: 4px; }
.chip.intent .tgt { width: 24px; height: 24px; margin-left: 2px; box-shadow: 0 0 0 2px var(--ink); }
.chip.intent.strong { background: #3a1717; animation: strongpulse .7s steps(2) infinite; }
@keyframes strongpulse { 50% { box-shadow: inset 0 0 0 3px var(--danger-text); } }
.chip.intent.wait, .chip.intent.guard, .chip.intent.flee, .chip.intent.pin { box-shadow: inset 0 0 0 3px #6b6278; color: var(--text-2); }
.field.n3 .chip.intent .lbl, .field.n4 .chip.intent .lbl { display: none; }
.intent.gone { visibility: hidden; }
.enemy.winding .mob { animation: crouch .8s steps(2) infinite; }
@keyframes crouch { 50% { transform: translateY(4px) scaleY(.94); } }
@keyframes dodge { 30% { transform: translateX(18px); } 70% { transform: translateX(18px); } } .dodge { animation: dodge .3s steps(4); }
@keyframes lungeBig { 50% { transform: translateY(26px) scale(1.12); } } .lunge-big { animation: lungeBig .3s steps(4); }
@keyframes blockfx { 0%, 100% { box-shadow: none; } 30%, 70% { box-shadow: inset 0 0 0 6px #9fc8ee; } } .blockfx { animation: blockfx .4s steps(4); }
.member.aimed { box-shadow: inset 0 0 0 3px var(--danger); }
.actions .btn { position: relative; }
.actions .btn .tag { position: absolute; right: 7px; top: 6px; font-size: 16px; line-height: 1; font-weight: 700; padding: 3px 6px 4px; background: var(--danger); color: var(--text); }
.btn.hl.warn { animation: hlwarn .9s steps(2) infinite; outline: 3px solid var(--danger-text); }
@keyframes hlwarn { 0%, 100% { outline-color: var(--danger-text); } 50% { outline-color: var(--accent-hi); } }
.field.n3, .field.n4 { gap: 6px; flex-wrap: wrap; align-content: flex-end; }
.enemy { position: relative; width: 150px; display: flex; flex-direction: column; align-items: center; gap: 6px; z-index: 1; transition: opacity .2s steps(4); }
.field.n3 .enemy { width: 116px; } .field.n4 .enemy { width: 46%; }
.enemy .mob { width: 128px; height: 128px; }
.field.n3 .enemy .mob, .field.n4 .enemy .mob { width: 96px; height: 96px; }
.enemy .plate { width: 100%; display: flex; flex-direction: column; gap: 5px; padding: 7px 10px 9px; }
.enemy .plate .row { display: flex; justify-content: space-between; align-items: baseline; font-size: var(--fs); white-space: nowrap; }
.enemy.dead { opacity: .0; pointer-events: none; }
.enemy.dead .intent { visibility: hidden; }
.enemy .intent { height: 34px; }
.enemy.pick .mob { outline: 3px solid var(--accent-hi); outline-offset: 0; animation: pick .7s steps(2) infinite; }
@keyframes pick { 50% { outline-color: var(--accent-lo); } }
.enemy.pick .plate { box-shadow: inset 0 0 0 3px var(--accent); }
.hitfx { position: absolute; left: 50%; top: 40%; width: 48px; height: 48px; margin: -24px 0 0 -44px; pointer-events: none; z-index: 3; animation: hitfx .28s steps(3) forwards; }
@keyframes hitfx { 0% { transform: scale(.6); } 50% { transform: scale(1.3); } 100% { transform: scale(1.4); opacity: 0; } }
.dmg { position: absolute; font-size: 28px; font-weight: 700; color: var(--float); text-shadow: var(--float-shadow); pointer-events: none; z-index: 4; animation: dmg .7s steps(10) forwards; white-space: nowrap; }
.dmg.heal { color: var(--good-hi); } .dmg.hurt { color: var(--danger-text); } .dmg.small { font-size: 20px; }
.dmg.nogo { font-size: 18px; color: var(--danger-text); transform: translateX(-30%); animation-duration: .9s; }
.dmg.miss { font-size: 22px; color: #cbc7b6; }
.dmg.block { font-size: 30px; color: #9fc8ee; }
.dmg.counter { color: var(--accent-hi); }
@keyframes dmg { 0% { transform: translateY(6px) scale(.7); opacity: 0; } 15% { transform: translateY(-6px) scale(1.15); opacity: 1; } 70% { transform: translateY(-24px); opacity: 1; } 100% { transform: translateY(-36px); opacity: 0; } }
@keyframes lunge { 50% { transform: translateY(-12px); } } .lunge { animation: lunge .2s steps(4); }
@keyframes lungeD { 50% { transform: translateY(15px) scale(1.06); } } .lunge-d { animation: lungeD .22s steps(4); }
@keyframes shake { 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(3px); } } .shake { animation: shake .24s steps(6); }
@keyframes flash { 50% { filter: brightness(2.4); } } .flash { animation: flash .18s steps(2); }
.party { flex: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 12px 2px; }
.member { flex: 1 1 40%; min-width: 0; padding: 8px 10px 8px 8px; gap: 10px; position: relative; text-align: left; }
.member .face { width: 64px; height: 64px; box-shadow: 0 0 0 3px var(--ink); }
.party.many .member .face { width: 48px; height: 48px; }
.member .col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.member .nm { display: flex; justify-content: space-between; align-items: baseline; font-size: var(--fs); white-space: nowrap; gap: 6px; }
.member .nm b { font-size: var(--fs-name); }
.member.down { opacity: .5; }
.member .stance { display: flex; align-self: flex-start; font-size: 16px; line-height: 1; box-shadow: 0 0 0 3px var(--ink); }
.member .stance i { font-style: normal; padding: 4px 8px 5px; background: var(--panel-lo); color: var(--text-2); }
.member .stance i.on { background: var(--accent); color: var(--ink); font-weight: 700; }
.member.guard::after { content: ""; position: absolute; inset: 0; box-shadow: inset 0 0 0 3px #7fb2e0; pointer-events: none; }
.actions { flex: none; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 10px 12px calc(12px + var(--sab)); }
.actions .btn { min-height: 64px; justify-content: flex-start; padding: 0 16px 4px; gap: 12px; font-size: var(--fs-title); }
.actions.busy { pointer-events: none; } .actions.busy .btn { filter: brightness(.7); }
.result { grid-column: 1 / 3; flex-direction: column; align-items: stretch; gap: 10px; padding: 12px; }
.result h3 { font-size: var(--fs-title); }

/* =========================================================  시트(전체 높이) */
.sheet-layer { position: absolute; inset: 0; z-index: 20; display: none; }
.sheet-layer.open { display: block; }
.sheet { position: absolute; inset: 0; display: flex; flex-direction: column; background: var(--bg); animation: sheetin .12s steps(4); }
@keyframes sheetin { from { transform: translateY(24px); opacity: .3; } to { transform: none; opacity: 1; } }
.fill { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.hint.low { flex: none; padding: 10px 20px 14px; }
.weight { display: flex; align-items: center; gap: 8px; font-size: var(--fs); white-space: nowrap; }
.weight .bar { width: 72px; flex: none; align-self: center; }
.grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; padding: 12px; align-content: start; }
.grid.six { grid-template-columns: repeat(6, 1fr); gap: 6px; padding: 8px 12px; } .grid.six .slot img.x4 { width: 32px; height: 32px; }
.slot { position: relative; aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center; background: var(--ink); box-shadow: inset 0 0 0 3px #322e42; }
.slot.empty { background: #201f2b; box-shadow: inset 0 0 0 3px #28263380; }
.slot.sel { background: #322e42; box-shadow: inset 0 0 0 3px var(--accent), inset 0 0 0 6px var(--ink); }
.slot .cnt { position: absolute; right: 4px; bottom: 2px; font-size: var(--fs); font-weight: var(--fw-bold); line-height: 1; text-shadow: 3px 0 0 var(--ink), -3px 0 0 var(--ink), 0 3px 0 var(--ink), 0 -3px 0 var(--ink); }
.slot .eq { position: absolute; left: 3px; top: 3px; font-size: 12px; line-height: 1; padding: 3px 4px; font-weight: var(--fw-bold); background: var(--accent); color: var(--ink); }
.slot .price { position: absolute; left: 3px; top: 3px; font-size: 12px; line-height: 1; padding: 3px 4px; font-weight: 700; background: var(--ink); color: var(--accent-hi); }
.slot.off img { opacity: .4; }
.detail { flex: none; margin: 0 12px 12px; display: grid; grid-template-columns: auto 1fr; column-gap: 12px; row-gap: 10px; align-items: center; padding: 12px; }
.detail .big { width: 64px; height: 64px; display: flex; align-items: center; justify-content: center; background: var(--ink); box-shadow: inset 0 0 0 3px var(--panel-hi); }
.detail .big img { width: 48px; height: 48px; }
.detail h3 { font-size: var(--fs-title); line-height: 1.25; }
.detail .sub { font-size: var(--fs); color: var(--text-2); margin-top: 2px; line-height: 1.4; }
.detail .req, .detail .why, .detail .wide { grid-column: 1 / 3; }
.detail .req { display: flex; flex-wrap: wrap; gap: 6px; }
.detail .why { font-size: var(--fs); color: var(--danger-text); }
.detail .btn { grid-column: 1 / 3; }
.detail .row2 { grid-column: 1 / 3; display: flex; gap: 8px; } .detail .row2 .btn { flex: 1; }
.hint { padding: 28px 24px; text-align: center; color: var(--text-2); font-size: var(--fs); line-height: 1.6; }
.seclabel { padding: 10px 16px 0; font-size: var(--fs); color: var(--text-2); display: flex; justify-content: space-between; }

/* 목록형 카드(일행·쉬기·특기·시설) */
.list { display: flex; flex-direction: column; gap: 8px; padding: 12px; }
.row { width: 100%; text-align: left; display: grid; grid-template-columns: auto 1fr auto; column-gap: 12px; row-gap: 8px; align-items: center; padding: 10px 12px 11px; min-height: 60px; }
.row h3 { font-size: var(--fs-title); line-height: 1.25; }
.row .sub { font-size: var(--fs); color: var(--text-2); line-height: 1.45; }
.row .wide { grid-column: 1 / 4; }
.row .face { width: 64px; height: 64px; box-shadow: 0 0 0 3px var(--ink); }
.row.sel { box-shadow: inset 0 0 0 3px var(--accent), inset 0 0 0 6px var(--ink); }
.row.off { background: var(--panel-lo); box-shadow: inset 3px 3px 0 #322e42, inset -3px -3px 0 #17161f; }
.row.off h3 { color: var(--text-2); }
.row .why { grid-column: 2 / 4; font-size: var(--fs); color: var(--danger-text); }
.pips { display: flex; gap: 4px; align-items: center; }
.pips i { display: block; width: 14px; height: 12px; background: var(--ink); box-shadow: inset 0 0 0 3px var(--panel-hi); }
.pips i.on { background: var(--accent); box-shadow: inset 0 0 0 3px var(--ink); }
.skill { display: flex; align-items: baseline; gap: 8px; font-size: var(--fs); line-height: 1.5; }
.skill.off { color: #8d899a; }
.skill b { flex: none; }
.kv { display: flex; justify-content: space-between; align-items: center; font-size: var(--fs); gap: 12px; min-height: 36px; }
.fgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 10px 12px 8px; }
.fcard { display: flex; align-items: center; gap: 8px; padding: 6px 8px 7px; min-height: 52px; text-align: left; }
.fcard .n { font-size: var(--fs); font-weight: 700; line-height: 1.2; }
.fcard.none { background: var(--panel-lo); box-shadow: inset 3px 3px 0 #322e42, inset -3px -3px 0 #17161f; }
.fcard.none .n { font-weight: 400; }
.fcard.sel { background: #322e42; box-shadow: inset 0 0 0 3px var(--accent), inset 0 0 0 6px var(--ink); }
.fcard.sel .n { color: var(--accent-hi); }
.fcard .col { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.fcard { position: relative; } .fcard .dot { position: absolute; top: 6px; right: 8px; width: 12px; height: 12px; background: var(--accent-hi); border: 3px solid var(--ink); }
.seg { display: flex; gap: 6px; } .seg .btn { min-height: 48px; font-size: 16px; padding: 0 12px 4px; flex: 1; }
.seg .btn[aria-pressed="true"] { background: var(--accent); color: var(--ink); box-shadow: inset 0 3px 0 var(--accent-hi), inset 0 -6px 0 var(--accent-lo); }

/* 지도 시트 */
.mapwrap { flex: 1 1 auto; min-height: 0; display: flex; align-items: center; justify-content: center; background: #100f17; position: relative; overflow: hidden; }
.mapwrap canvas { image-rendering: pixelated; display: block; }
.mapbox { position: relative; padding: 3px; clip-path: none; }
.mapbox .lbl { position: absolute; transform: translateX(-50%); font-size: 14px; line-height: 1; padding: 2px 4px 3px; background: rgba(23,22,31,.86); color: var(--text); white-space: nowrap; pointer-events: none; z-index: 1; }
.mapbox .lbl.sel { background: var(--accent); color: var(--ink); font-weight: 700; z-index: 2; }
.mapbox .me { position: absolute; width: 14px; height: 14px; margin: -7px 0 0 -7px; background: #5b8fd0; border: 3px solid var(--text); outline: 3px solid var(--ink); z-index: 3; pointer-events: none; animation: meblink 1s steps(2) infinite; }
@keyframes meblink { 50% { background: var(--text); } }
.mapcard { flex: none; margin: 0 12px 12px; min-height: 76px; }
.mapbox .lbl.new { color: var(--text-2); background: rgba(23,22,31,.78); }
.legend { flex: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; padding: 8px 12px; font-size: var(--fs); color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .lg { display: inline-block; width: 18px; height: 18px; box-shadow: inset 0 0 0 3px var(--ink); }
.legend .lg.visited { background: #cbc7b6; }
.legend .lg.new { background: #6c6878; position: relative; } .legend .lg.new::after { content: ""; position: absolute; right: -3px; top: -3px; width: 9px; height: 9px; background: #f3efe2; box-shadow: 0 0 0 2px var(--ink), inset 0 0 0 3px #f3efe2, inset 0 0 0 9px #dcb53c; }
.legend .lg.me { background: #5b8fd0; box-shadow: inset 0 0 0 3px var(--text); outline: 3px solid var(--ink); width: 14px; height: 14px; }
.mapcard .txt { flex: 1; min-width: 0; } .mapcard h3 { font-size: var(--fs-title); line-height: 1.2; } .mapcard p { font-size: var(--fs); color: var(--text-2); margin-top: 4px; }

/* 알림·효과 층 */
#fx { position: absolute; inset: 0; pointer-events: none; z-index: 40; overflow: hidden; }
.fly { position: absolute; width: 32px; height: 32px; image-rendering: pixelated; transition: transform .42s cubic-bezier(.3, -0.3, .7, 1), opacity .42s; will-change: transform; }
#toasts { position: absolute; left: 0; right: 0; top: calc(150px + var(--sat)); display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; z-index: 41; }
.toast { display: flex; align-items: center; gap: 8px; padding: 7px 12px 8px; font-size: var(--fs); background: var(--ink); box-shadow: inset 0 0 0 3px var(--accent-lo); color: var(--text); animation: toast 2.6s steps(16) forwards; max-width: 92%; }
.toast.bad { box-shadow: inset 0 0 0 3px var(--danger); }
.toast b { color: var(--accent-hi); }
@keyframes toast { 0% { transform: translateY(-9px); opacity: 0; } 8%, 82% { transform: none; opacity: 1; } 100% { opacity: 0; } }
[data-screen="place"] #toasts, [data-screen="event"] #toasts, [data-screen="battle"] #toasts { top: calc(70px + var(--sat)); }
.app.sheeting #toasts { top: calc(70px + var(--sat)); }
.fade { position: absolute; inset: 0; background: #0c0c11; z-index: 30; pointer-events: none; opacity: 0; transition: opacity .16s steps(4); }
.fade.on { opacity: 1; }
.dbg { position: absolute; left: 6px; bottom: 96px; z-index: 50; background: #7a2f6e; color: #fff; padding: 6px 10px; font-size: 12px; }

/* 엔딩 */
#s-ending { background: var(--bg); }
#s-ending .epi { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; justify-content: center; gap: 10px; padding: 14px 12px; }
.epicard { align-items: flex-start; padding: 12px; gap: 12px; }
.epicard .face { width: 64px; height: 64px; box-shadow: 0 0 0 3px var(--ink); flex: none; }
.epicard .txt b { display: block; color: var(--accent-hi); font-size: var(--fs); margin-bottom: 4px; }
.epicard p { font-size: var(--fs-read); line-height: var(--lh-read); }
#s-ending .endpic { flex: 1 1 200px; min-height: 120px; display: flex; align-items: center; justify-content: center; background: #100f17; box-shadow: inset 0 -3px 0 var(--ink); overflow: hidden; }
#s-ending .endpic canvas { box-shadow: 0 0 0 3px var(--ink), 0 0 0 6px var(--panel-hi); }
#s-ending .endbody { flex: none; text-align: center; padding: 18px 16px 6px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
#s-ending h1 { font-size: 40px; line-height: 1.2; text-shadow: var(--float-shadow); }
.bottom.col { flex-direction: column; }
.bottom.col .btn { flex: none; }
/* 엔딩 기록 */
.endlist { display: flex; flex-direction: column; gap: 8px; padding: 12px; }
.endcard { display: flex; align-items: center; gap: 12px; padding: 8px; min-height: 84px; }
.endcard .pic { width: 136px; height: 68px; flex: none; display: flex; align-items: center; justify-content: center; background: #100f17; box-shadow: inset 0 0 0 3px var(--ink); overflow: hidden; }
.endcard .pic canvas { width: 136px; height: 68px; }
.endcard .txt { position: relative; flex: 1; min-width: 0; }
.endcard .no { display: inline-block; font-size: 16px; font-weight: 700; padding: 1px 6px 2px; background: var(--accent); color: var(--ink); margin-bottom: 4px; }
.endcard h3 { font-size: var(--fs-title); line-height: 1.25; }
.endcard .sub { font-size: var(--fs); color: var(--text-2); margin-top: 2px; }
.endcard.off { background: var(--panel-lo); box-shadow: inset 3px 3px 0 #322e42, inset -3px -3px 0 #17161f; }
.endcard.off h3 { color: var(--text-2); font-weight: 400; font-size: var(--fs); }
.endcard.off .no { background: #4a4459; color: var(--text-2); }
/* 배의 자리 */
.seats-stage { flex: 0 100 160px; min-height: 84px; }
.seat-count { position: absolute; right: 10px; top: calc(10px + var(--sat)); }
.seats-body { flex: 1 1 auto; min-height: 0; padding-top: 12px; gap: 10px; }
.seatlist { display: flex; flex-direction: column; gap: 6px; }
.seat { width: 100%; text-align: left; padding: 6px 10px 6px 6px; gap: 10px; min-height: 60px; }
.seat .face { width: 48px; height: 48px; box-shadow: 0 0 0 3px var(--ink); }
.seat .txt { flex: 1; min-width: 0; display: flex; flex-direction: column; } .seat .txt b { font-size: var(--fs-title); } .seat .txt .sub { font-size: var(--fs); color: var(--text-2); }
.seat.on { background: #34402f; box-shadow: inset 0 0 0 3px var(--good), inset 0 0 0 6px var(--ink); }
.seat.must { background: #322e42; }
.seat[disabled]:not(.must) { opacity: .6; }

/* 낮은 화면(인앱 브라우저 바로 100px 줄어든 경우) */
@media (max-height: 780px) {
  .field { flex-basis: 220px; }
  .enemy .mob { width: 96px; height: 96px; }
  .actions .btn { min-height: 56px; }
  .event-body { gap: 10px; padding-top: 12px; }
  .member .face { width: 48px; height: 48px; }
  .scene { flex-basis: 150px; min-height: 96px; }
  .body { gap: 10px; padding-top: 10px; }
  .fgrid { gap: 4px; padding: 8px 12px 6px; } .fcard { min-height: 46px; padding: 3px 8px 4px; }
  .scene.small { flex-basis: 120px; }
  .list { gap: 6px; padding: 8px 12px; }
  .scene { min-height: 52px; }
  .spots { gap: 6px; } .spot { min-height: 52px; padding-top: 6px; padding-bottom: 7px; row-gap: 6px; } .spot.done { min-height: 44px; }
}
