/* 쏘왓 화면 시제품 v0.1 — 웹툰 대면형(모드 A). 빌드 없음. */
:root {
  --bg: #0f0e11;
  --bg2: #18161c;
  --panel: #1d1b22;
  --line: #34303c;
  --text: #f4f1ea;
  --muted: #a39dab;
  --boss: #3cc8f5;
  --ai: #ff4b4b;
  --gold: #ffc23c;
  --ok: #45d483;
  --warn: #ffb547;
  --bad: #ff5a5a;
  --ink: #111;
  --paper: #fffdf7;
  --display: "Black Han Sans", "Malgun Gothic", sans-serif;
  --body: "Noto Sans KR", "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
  --hud-h: 64px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; touch-action: manipulation; }
body { height: 100vh; height: 100dvh; overscroll-behavior: none; touch-action: manipulation; }  /* iPhone: 보이는 높이(주소창 제외) */
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button, input, textarea, select { font: inherit; color: inherit; }
button, a, input, textarea, select, label, [role="radio"], [role="tab"] { touch-action: manipulation; }  /* 두 번 탭 확대 막기 */
[hidden] { display: none !important; }

#app { height: 100%; display: flex; flex-direction: column; }

/* ---------- 상단 띠 ---------- */
.topbar {
  height: 44px; flex: none;
  display: flex; align-items: center; gap: 12px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: #0b0a0d;
}
.logo {
  font-family: var(--display); font-size: 22px; letter-spacing: .5px;
  transform: skewX(-8deg);
}
.logo span { color: var(--ai); }
.mode { font-size: 12px; color: var(--muted); padding: 3px 8px; border: 1px solid var(--line); border-radius: 99px; }
.mode.paid { color: var(--gold); border-color: #6b5520; }
.coins { margin-left: auto; display: flex; align-items: center; gap: 6px; font-weight: 700; }
.coin { width: 16px; height: 16px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ffe08a, #e0a019); box-shadow: inset 0 0 0 2px #b07a0c; }

/* ---------- 공통 화면 ---------- */
.screen { flex: 1; min-height: 0; overflow: auto; }
.panel { max-width: 860px; margin: 0 auto; padding: 28px 16px 40px; }
.screen-title { font-family: var(--display); font-weight: 400; font-size: 30px; margin: 4px 0 6px; letter-spacing: .3px; }
.lead { color: var(--muted); margin: 0 0 20px; }
.row { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.row.end { justify-content: flex-end; }
.row.wrap { flex-wrap: wrap; align-items: flex-end; }
.select > .row.wrap { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 22%); padding: 22px 0 12px; margin-top: 4px; }
.grow { flex: 1; min-width: 220px; }
.hint { color: var(--muted); font-size: 13px; }
.err { color: var(--bad); min-height: 1.5em; margin: 10px 0 0; }

.fld { display: block; margin: 14px 0 0; }
.fld-label { display: flex; justify-content: space-between; font-weight: 700; font-size: 13px; margin-bottom: 6px; }
.fld-label em { font-style: normal; font-weight: 400; color: var(--muted); }
textarea, input {
  width: 100%; background: var(--bg2); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; outline: none; resize: vertical;
  font-size: 16px;  /* iOS 사파리: 16px 미만 입력칸에 초점이 가면 화면을 확대한다 */
}
textarea:focus, input:focus { border-color: #6a6276; box-shadow: 0 0 0 3px rgba(255,255,255,.06); }
.fld .sub { color: var(--muted); font-size: 12px; margin-top: 4px; }

.btn {
  border: 1px solid var(--line); background: var(--panel); border-radius: 10px;
  padding: 10px 16px; font-weight: 700; cursor: pointer; white-space: nowrap;
  transition: transform .08s, background .15s, opacity .15s;
}
.btn:hover { background: #26232d; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--ai); border-color: var(--ai); color: #fff; }
.btn.primary:hover { background: #ff6262; }
.btn.big { padding: 14px 26px; font-size: 17px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.loading { position: relative; color: transparent !important; }
.btn.loading::after {
  content: ""; position: absolute; inset: 0; margin: auto; width: 18px; height: 18px;
  border: 2px solid #fff; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.seg { display: flex; gap: 8px; flex-wrap: wrap; }
.seg button {
  flex: 1; min-width: 120px; padding: 10px 12px; border-radius: 10px; cursor: pointer;
  background: var(--bg2); border: 1px solid var(--line); text-align: left;
}
.seg button b { display: block; font-family: var(--display); font-weight: 400; font-size: 18px; }
.seg button small { color: var(--muted); }
.seg button[aria-checked="true"] { border-color: var(--ai); background: #2a1719; }

.back { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0; }
.back:hover { color: var(--text); }

/* 상황 카드 편집 */
.cardform { margin-top: 22px; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.verdict { font-weight: 700; padding: 8px 12px; border-radius: 8px; margin-bottom: 4px; }
.verdict.ok { background: rgba(69,212,131,.1); color: var(--ok); }
.verdict.weak { background: rgba(255,181,71,.1); color: var(--warn); }
.verdict.block { background: rgba(255,90,90,.12); color: var(--bad); }

/* 캐릭터 선택 */
.cardsum { margin: 10px 0 16px; padding: 12px 14px; border-left: 3px solid var(--ai); background: var(--panel); border-radius: 0 10px 10px 0; color: #dcd7e2; font-size: 14px; }
.cardsum b { color: var(--text); }
.chargrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.ch {
  position: relative; border: 2px solid var(--line); border-radius: 14px; overflow: hidden; cursor: pointer;
  background: radial-gradient(circle at 50% 35%, #2f2a37, #17151b 70%); text-align: left; padding: 0;
  transition: border-color .15s, transform .15s;
}
.ch:hover { transform: translateY(-2px); }
.ch img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; object-position: 50% 8%; display: block; }
.ch .meta { padding: 8px 10px 10px; }
.ch .meta b { display: block; font-size: 14px; }
.ch .meta small { color: var(--muted); font-size: 12px; }
.ch[aria-checked="true"] { border-color: var(--ai); box-shadow: 0 0 0 3px rgba(255,75,75,.25); }
.ch .tag { position: absolute; top: 8px; left: 8px; background: var(--gold); color: var(--ink); font-weight: 900; font-size: 11px; padding: 2px 8px; border-radius: 99px; }
.ch.disabled { cursor: not-allowed; opacity: .55; display: flex; align-items: center; justify-content: center; text-align: center; min-height: 160px; border-style: dashed; }
.ch.disabled:hover { transform: none; }
.ch.disabled .meta { padding: 16px; }

/* ---------- 대전 ---------- */
.battle { display: flex; flex-direction: column; overflow: hidden; }
.hud {
  height: var(--hud-h); flex: none;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 14px;
  padding: 0 16px; background: linear-gradient(#0b0a0d, #141217);
  border-bottom: 1px solid var(--line);
}
.gauge { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; min-width: 0; }
.gauge.ai { grid-template-columns: auto 1fr auto; }
.gauge.ai .g-name { order: 3; }
.gauge.ai .g-num { order: 1; }
.gauge.ai .g-bar { order: 2; transform: scaleX(-1); }
.g-name { font-family: var(--display); font-size: 16px; white-space: nowrap; max-width: 130px; overflow: hidden; text-overflow: ellipsis; }
.g-num { font-family: var(--display); font-size: 18px; min-width: 34px; text-align: center; }
.g-bar {
  position: relative; height: 18px; border-radius: 3px; overflow: hidden;
  background: #2a2730; border: 2px solid #000; box-shadow: 0 0 0 1px #4a4552;
  transform: skewX(-14deg);
}
.g-bar i { position: absolute; inset: 0 auto 0 0; width: 100%; }
.g-bar .trail { background: #fff; transition: width .5s ease .6s; }
.g-bar .fill { transition: width .3s ease-out; }
.boss .fill { background: linear-gradient(#7fe0ff, var(--boss)); }
.ai .fill { background: linear-gradient(#ff8b8b, var(--ai)); }
.g-bar.low .fill { animation: pulse .8s ease-in-out infinite; }
@keyframes pulse { 50% { filter: brightness(1.6); } }

.hud-mid { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 120px; }
.round { font-family: var(--display); font-size: 26px; line-height: 1; }
.round small { font-size: 14px; color: var(--muted); }
.obj { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--gold); font-weight: 700; }
.obj-bar { width: 96px; height: 7px; background: #2a2730; border-radius: 99px; overflow: hidden; }
.obj-bar i { display: block; height: 100%; width: 0; background: var(--gold); transition: width .6s ease; }

.stage { position: relative; flex: 1; min-height: 0; overflow: hidden; background: radial-gradient(ellipse at 50% 60%, #2b2533 0%, #16131a 55%, #0d0b10 100%); }
.spot { position: absolute; inset: 0; background: radial-gradient(ellipse 38% 55% at 50% 62%, rgba(255,235,210,.10), transparent 70%); pointer-events: none; }
.stage.shake { animation: shake .45s cubic-bezier(.36,.07,.19,.97); }
@keyframes shake {
  10%, 90% { transform: translate(-2px, 1px); }
  20%, 80% { transform: translate(4px, -2px); }
  30%, 50%, 70% { transform: translate(-7px, 2px); }
  40%, 60% { transform: translate(7px, -1px); }
}

.char { position: absolute; left: 50%; bottom: 0; height: 96%; aspect-ratio: 2 / 3; transform: translateX(-50%); }
.char img { width: 100%; height: 100%; object-fit: contain; object-position: bottom; display: block; user-select: none; }
.char.pop img { animation: pop .28s ease-out; }
@keyframes pop { 0% { transform: scale(1.06) translateY(-6px); } 100% { transform: none; } }
.char.jolt img { animation: jolt .4s ease-out; }
@keyframes jolt { 0% { transform: translateX(0); } 15% { transform: translateX(-18px) rotate(-2deg); } 35% { transform: translateX(12px) rotate(1deg); } 60% { transform: translateX(-5px); } 100% { transform: none; } }
.char.breathe img { animation: breathe 3.2s ease-in-out infinite; transform-origin: 50% 100%; }
@keyframes breathe { 50% { transform: scaleY(1.008) translateY(-2px); } }

.nameplate {
  position: absolute; left: 50%; bottom: 3%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 6px; white-space: nowrap;
  background: rgba(10,9,12,.85); border: 1px solid #4b4554; border-radius: 6px; padding: 4px 10px;
  font-weight: 700; font-size: 14px; max-width: 92%;
}
.nameplate span { overflow: hidden; text-overflow: ellipsis; }
.ai-badge { background: var(--boss); color: var(--ink); font-size: 11px; padding: 1px 6px; border-radius: 4px; font-weight: 900; }

/* 말풍선 — 웹툰식 */
.bubble {
  position: absolute; max-width: min(380px, 42%);
  background: var(--paper); color: var(--ink);
  border: 3px solid var(--ink); border-radius: 22px;
  padding: 12px 16px; font-size: 17px; font-weight: 700; line-height: 1.45;
  box-shadow: 4px 5px 0 rgba(0,0,0,.45);
  word-break: keep-all; overflow-wrap: anywhere;
}
.bubble.ai { right: max(4%, calc(50% - 560px)); top: 12%; }
.bubble.ai::after {
  content: ""; position: absolute; left: -18px; top: 38px; width: 22px; height: 18px;
  background: var(--paper); border: 3px solid var(--ink); border-right: 0; border-top: 0;
  transform: skewY(28deg) rotate(10deg);
}
.bubble.measure { visibility: hidden; pointer-events: none; }  /* 말풍선 높이 미리 재기용(app.js measureBubble) */
.bubble.ai.thinking { font-size: 26px; letter-spacing: 4px; padding: 4px 18px 12px; }
.bubble.ai.thinking span { animation: dots 1s infinite; display: inline-block; }
.bubble.ai.thinking span:nth-child(2) { animation-delay: .15s; }
.bubble.ai.thinking span:nth-child(3) { animation-delay: .3s; }
@keyframes dots { 50% { transform: translateY(-6px); opacity: .4; } }
.bubble.boss {
  left: max(4%, calc(50% - 560px)); bottom: 10%;
  background: #e8f8ff; border-color: #0b3a4a; color: #06232d; font-size: 15px;
  transition: transform .45s cubic-bezier(.2,.8,.3,1), opacity .3s;
}
.bubble.boss.fly { transform: translate(4vw, -3vh) scale(.9); }
.bubble.boss.hit { opacity: 0; transform: translate(10vw, -6vh) scale(.5) rotate(-6deg); }

/* 타격 연출 */
.burst {
  position: absolute; left: 50%; top: 42%; width: 140vmax; height: 140vmax; transform: translate(-50%, -50%) scale(.2);
  background: repeating-conic-gradient(from 0deg, rgba(255,255,255,.16) 0 4deg, transparent 4deg 13deg);
  opacity: 0; pointer-events: none;
  -webkit-mask: radial-gradient(circle, transparent 12%, #000 40%); mask: radial-gradient(circle, transparent 12%, #000 40%);
}
.burst.on { animation: burst .7s ease-out; }
.burst.gold { background: repeating-conic-gradient(from 0deg, rgba(255,194,60,.28) 0 4deg, transparent 4deg 12deg); }
@keyframes burst { 0% { opacity: 0; transform: translate(-50%,-50%) scale(.2) rotate(0); } 20% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%,-50%) scale(1) rotate(8deg); } }

.hitword {
  position: absolute; left: 50%; top: 22%; transform: translate(-50%, 0) rotate(-6deg);
  font-family: var(--display); font-size: clamp(34px, 7vw, 76px); line-height: 1;
  color: #fff; -webkit-text-stroke: 3px #000; paint-order: stroke fill; text-shadow: 5px 6px 0 rgba(0,0,0,.5);
  opacity: 0; pointer-events: none; white-space: nowrap;
}
.hitword.gold { color: var(--gold); }
.hitword.red { color: var(--ai); }
.hitword.blue { color: var(--boss); }
.hitword.gray { color: #bdb6c6; }
.hitword.on { animation: hitword 1.2s cubic-bezier(.2,1.4,.4,1); }
@keyframes hitword {
  0% { opacity: 0; transform: translate(-50%, 0) rotate(-6deg) scale(2.2); }
  18% { opacity: 1; transform: translate(-50%, 0) rotate(-6deg) scale(1); }
  75% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -18px) rotate(-6deg) scale(1); }
}
.hitword small { display: block; font-size: .36em; text-align: center; margin-top: 6px; -webkit-text-stroke: 2px #000; }

.dmg {
  position: absolute; font-family: var(--display); font-size: 42px; -webkit-text-stroke: 2px #000; paint-order: stroke fill;
  opacity: 0; pointer-events: none;
}
.dmg.ai { color: var(--ai); right: 22%; top: 8%; }
.dmg.boss { color: var(--boss); left: 8%; top: 8%; }
.dmg.on { animation: dmg 1.3s ease-out; }
@keyframes dmg { 0% { opacity: 0; transform: translateY(16px) scale(.7); } 15% { opacity: 1; transform: none; } 80% { opacity: 1; } 100% { opacity: 0; transform: translateY(-26px); } }

.flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.flash.on { animation: flash .35s ease-out; }
@keyframes flash { 0% { opacity: .85; } 100% { opacity: 0; } }
.vignette { position: absolute; inset: 0; pointer-events: none; opacity: 0; box-shadow: inset 0 0 140px 30px rgba(255,30,30,.75); }
.vignette.on { animation: vig .9s ease-out; }
@keyframes vig { 0% { opacity: 1; } 100% { opacity: 0; } }

.banner {
  position: absolute; left: 0; right: 0; top: 40%; text-align: center; pointer-events: none;
  font-family: var(--display); font-size: clamp(40px, 8vw, 90px); color: #fff;
  -webkit-text-stroke: 3px #000; paint-order: stroke fill; opacity: 0;
}
.banner.on { animation: banner 1.3s ease-in-out; }
@keyframes banner { 0% { opacity: 0; transform: translateX(-30%) skewX(-12deg); } 25%, 70% { opacity: 1; transform: skewX(-12deg); } 100% { opacity: 0; transform: translateX(30%) skewX(-12deg); } }

.sitchip {
  position: absolute; left: 12px; top: 10px; z-index: 3; max-width: min(460px, 60%);
  text-align: left; cursor: pointer; font-size: 12px; color: #d9d3df;
  background: rgba(10,9,12,.75); border: 1px solid #3c3744; border-radius: 10px; padding: 6px 10px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sitchip[aria-expanded="true"] { white-space: normal; }
.sitchip b { color: var(--gold); }
.stage-btns { position: absolute; right: 12px; top: 10px; z-index: 3; display: flex; gap: 6px; }
.logbtn { font-size: 12px; cursor: pointer; background: rgba(10,9,12,.75); border: 1px solid #3c3744; border-radius: 10px; padding: 6px 10px; }
.quitbtn { color: #ffb0b0; border-color: #5a3438; }
.battle.ended .quitbtn { display: none; }

.drawer {
  position: absolute; right: 0; top: 0; bottom: 0; width: min(380px, 92%); z-index: 6;
  background: rgba(16,14,19,.97); border-left: 1px solid var(--line); overflow: auto; padding: 0 0 20px;
}
.drawer-head { position: sticky; top: 0; display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; background: inherit; border-bottom: 1px solid var(--line); }
.drawer-head button { background: none; border: 0; font-size: 22px; cursor: pointer; color: var(--muted); }
.drawer ol, .result-log { list-style: none; margin: 0; padding: 0 14px; }
.logrow { padding: 10px 0; border-bottom: 1px solid #26232c; font-size: 13px; }
.logrow .top { display: flex; gap: 8px; align-items: center; margin-bottom: 3px; }
.logrow .r { color: var(--muted); font-weight: 700; min-width: 26px; }
.pill { font-weight: 900; font-size: 12px; padding: 1px 8px; border-radius: 99px; background: #2b2731; }
.pill.s-hi { background: var(--gold); color: var(--ink); }
.pill.s-mid { background: #3d3746; }
.pill.s-lo { background: #2a3440; color: var(--boss); }
.logrow .flawtxt { color: #ff9b9b; margin-top: 2px; }

/* 판정 띠 */
.judge {
  flex: none; padding: 10px 16px 6px; background: #121015; border-top: 1px solid var(--line);
  min-height: 58px;
}
.judge-line { font-size: 14px; color: #e3dee8; }
.judge-line .sc { font-family: var(--display); font-size: 18px; margin-right: 6px; }
.judge-line .ht { font-size: 11px; font-weight: 900; padding: 1px 7px; border-radius: 4px; margin-right: 6px; vertical-align: 2px; }
.ht.logic { background: var(--boss); color: var(--ink); }
.ht.emotion { background: #ff7ab8; color: var(--ink); }
.ht.wit { background: var(--gold); color: var(--ink); }
.ht.none { background: #3a3542; color: var(--muted); }
.flaw { margin-top: 4px; font-size: 13px; color: #ffb0b0; }
.flaw b { background: rgba(255,90,90,.16); color: #ff8a8a; padding: 1px 7px; border-radius: 4px; margin-right: 6px; font-size: 12px; }
.judge .note { color: var(--warn); }

.inputbar {
  flex: none; display: flex; align-items: center; gap: 10px; padding: 10px 16px 14px; background: #121015;
}
.inputbar input { flex: 1; font-size: 16px; padding: 12px 14px; }
.inputbar .count { font-size: 12px; color: var(--muted); min-width: 52px; text-align: right; }
.inputbar .count.over { color: var(--bad); }

/* 결과 */
.result { position: absolute; inset: 0; z-index: 8; background: linear-gradient(90deg, transparent 0 46%, rgba(8,7,10,.88) 60%); display: flex; justify-content: flex-end; align-items: stretch; pointer-events: none; }
.result-card { pointer-events: auto; }
.battle.ended .judge, .battle.ended .inputbar { display: none; }
.stage.ended .char { left: 30%; transition: left .6s cubic-bezier(.2,.8,.3,1); }
.stage.ended .spot { background: radial-gradient(ellipse 30% 55% at 30% 62%, rgba(255,235,210,.12), transparent 70%); }
.result-card { width: min(520px, 100%); overflow: auto; padding: 26px 22px; }
.result-title { font-family: var(--display); font-size: 64px; line-height: 1; transform: skewX(-8deg); -webkit-text-stroke: 2px #000; paint-order: stroke fill; }
.result-title.win { color: var(--gold); }
.result-title.lose { color: #9fb3c8; }
.result-title.draw { color: #ddd; }
.result-sub { color: var(--muted); margin: 6px 0 14px; }
.result-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.result-stats div { background: var(--panel); border-radius: 10px; padding: 8px 10px; }
.result-stats b { display: block; font-family: var(--display); font-size: 22px; font-weight: 400; }
.result-stats small { color: var(--muted); font-size: 12px; }
.result-flaws { margin-bottom: 10px; font-size: 13px; }
.result-flaws b { display: inline-block; margin: 0 6px 6px 0; padding: 3px 9px; border-radius: 99px; background: rgba(255,90,90,.14); color: #ff9b9b; }
.result-log { padding: 0; max-height: none; }

/* ---------- 반응형 ---------- */
@media (max-width: 900px) {
  .chargrid { grid-template-columns: repeat(3, 1fr); }
  /* 얼굴 가림 방지(SW-30 보스 피드백): 무대 위쪽은 AI 말풍선 자리, 캐릭터는 그 아래에서 시작한다.
     --bub = 이번 대사 말풍선 높이(app.js layoutStage 가 미리 재서 넣는다). 대사 사이에는 자리를 유지해 캐릭터가 출렁이지 않게. */
  .char { left: 0; width: 100%; height: auto; aspect-ratio: auto; transform: none;
          top: calc(var(--chip-h, 44px) + var(--bub, 0px)); bottom: 0; transition: top .35s ease; }
  .char img { object-position: 50% 100%; }
  .bubble.ai { left: 4%; right: 4%; top: var(--chip-h, 44px); max-width: none; }
  .bubble.ai::after { left: 50%; top: auto; bottom: -11px; margin-left: -9px; transform: rotate(45deg); border: 3px solid var(--ink); border-left: 0; border-top: 0; width: 16px; height: 16px; }
  .bubble.ai.thinking { left: 50%; right: auto; transform: translateX(-50%); }
  .bubble.measure { left: 4%; right: 4%; top: 0; max-width: none; visibility: hidden; pointer-events: none; }
  /* 보스 말풍선 — 몸통 자리(무대 아래)에 두 줄로. 판정 대기 중에도 얼굴로 올라가지 않는다. */
  .bubble.boss { left: 4%; bottom: 10px; max-width: 86%; z-index: 2; transform-origin: 0 100%; }
  .bubble.boss .txt { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
  .bubble.boss.fly { transform: translateY(-4px) scale(.94); }
  .bubble.boss.hit { opacity: 0; transform: translate(12vw, -6px) scale(.6) rotate(-4deg); }
  /* 무대가 얕을 때(키보드가 열림 등) — 캐릭터 왼쪽, 말풍선 오른쪽 나란히 */
  .stage.side .sitchip, .stage.side .nameplate { display: none; }
  .stage.side .stage-btns { top: 6px; right: 3%; gap: 4px; }
  .stage.side .logbtn { font-size: 11px; padding: 4px 8px; border-radius: 8px; }
  .stage.side .char { top: 6px; width: 40%; transition: none; }
  .stage.side .bubble.ai { left: 40%; right: 3%; top: 40px; max-height: calc(100% - 48px); overflow-y: auto;
                           font-size: 13.5px; line-height: 1.4; padding: 8px 12px; border-radius: 16px; transform: none; }
  .stage.side .bubble.ai::after { display: none; }
  .stage.side .bubble.ai.thinking { font-size: 22px; }
  .stage.ended .char { left: -20%; top: var(--chip-h, 44px); transition: none; }
}
@media (max-width: 640px) {
  :root { --hud-h: 76px; }
  body { font-size: 14px; }
  .topbar { padding: 0 12px; }
  .mode { display: none; }
  .panel { padding: 18px 16px 32px; }
  .screen-title { font-size: 24px; }
  .chargrid { grid-template-columns: repeat(2, 1fr); }
  .hud { grid-template-columns: 1fr 1fr; grid-template-rows: auto auto; gap: 6px 10px; padding: 8px 12px; }
  .hud-mid { grid-column: 1 / -1; grid-row: 2; flex-direction: row; gap: 14px; justify-content: center; min-width: 0; }
  .round { font-size: 18px; }
  .g-name { font-size: 13px; max-width: 70px; }
  .g-num { font-size: 14px; min-width: 26px; }
  .bubble { font-size: 15px; max-width: 86%; }
  .sitchip { max-width: calc(100% - 190px); }
  .result { background: linear-gradient(transparent 0 30%, rgba(8,7,10,.92) 48%); align-items: flex-end; }
  .result { background: linear-gradient(transparent 0 34%, rgba(8,7,10,.94) 46%); }
  .result-card { max-height: 60%; padding: 16px 16px 20px; }
  .result-title { font-size: 40px; }
  .result-stats b { font-size: 18px; }
  .stage.ended .char { left: 0; top: 5%; bottom: auto; height: 58%; }
  .stage.ended .nameplate { display: none; }
  .result-title { font-size: 48px; }
  .inputbar { padding: 8px 12px 12px; }
  .inputbar .count { display: none; }
}
@media (max-width: 900px) and (max-height: 600px) {
  .judge { min-height: 0; padding: 5px 12px 3px; }
  .judge-line, .flaw { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .judge-line { font-size: 13px; }
  .judge-line .sc { font-size: 15px; }
  .flaw { margin-top: 1px; font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- v0.2 (D-57): 입장 · 상점 · 내 캐릭터 · 사진 ---------- */
.who { font-size: 13px; color: var(--muted); }
.coins { background: none; border: 1px solid var(--line); border-radius: 99px; padding: 3px 10px 3px 6px; cursor: pointer; color: var(--text); }
.coins:hover { border-color: var(--gold); }
.coins span { font-size: 11px; color: var(--gold); font-weight: 700; }
.gate { max-width: 460px; padding-top: 8vh; }
.biz { margin-top: 28px; padding-top: 14px; border-top: 1px solid #2a2631; color: #8f877a; font-size: 11px; line-height: 1.6; }
.biz-links { margin-bottom: 6px; }
.biz-links a { margin-right: 12px; color: #a39b8d; }
.gate-logo { font-family: var(--display); font-size: 56px; transform: skewX(-8deg); margin-bottom: 4px; }
.gate-logo span { color: var(--ai); }
.check { display: flex; gap: 10px; align-items: center; margin-top: 12px; font-weight: 700; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--ai); }
.sub-title { font-family: var(--display); font-weight: 400; font-size: 20px; margin: 22px 0 10px; }
.ch .tag.mine { background: var(--boss); }
.ch.pending { cursor: default; opacity: .7; }
.ch.pending:hover { transform: none; }
.ch .pending-box { aspect-ratio: 3 / 4; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 13px; text-align: center; padding: 10px; white-space: pre-line; }
.toast { position: fixed; left: 50%; top: calc(56px + env(safe-area-inset-top, 0px)); transform: translateX(-50%); z-index: 50; max-width: min(92vw, 420px);
         background: #1f2b22; border: 1px solid var(--ok); color: #dff7e8; padding: 10px 14px; border-radius: 10px; font-size: 14px;
         box-shadow: 0 6px 20px rgba(0,0,0,.45); transition: opacity .6s; }
.toast.off { opacity: 0; }
.ch.make { display: flex; align-items: center; justify-content: center; text-align: center; min-height: 160px; border-style: dashed; cursor: pointer; }
.ch.make .plus { font-size: 34px; color: var(--ai); line-height: 1; }
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(5,4,7,.72); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-card { width: min(460px, 100%); max-height: 92vh; max-height: calc(100dvh - 32px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)); overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 18px; }
.modal-card.wide { width: min(560px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; font-size: 17px; }
.modal-head .x { background: none; border: 0; font-size: 24px; cursor: pointer; color: var(--muted); }
.packs { display: grid; gap: 10px; margin-top: 12px; }
.pack { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg2); cursor: pointer; text-align: left; }
.pack:hover { border-color: var(--gold); }
.pack b { font-family: var(--display); font-weight: 400; font-size: 20px; }
.pack small { color: var(--muted); display: block; }
.pack .price { font-weight: 900; font-size: 16px; }
.pack .ptag { font-size: 11px; background: var(--gold); color: var(--ink); border-radius: 99px; padding: 1px 7px; margin-left: 6px; }
.notice { margin: 10px 0; padding-left: 18px; color: #d9d3df; font-size: 13px; }
.notice li { margin: 4px 0; }
.photo-preview { margin-top: 10px; }
.photo-preview img { max-width: 100%; max-height: 220px; border-radius: 10px; display: block; }
.ok { color: var(--ok); min-height: 1.2em; margin: 6px 0 0; }
@media (max-width: 640px) {
  .who { display: none; }
  .gate { padding-top: 4vh; }
  .gate-logo { font-size: 44px; }
}

/* ---------- 계정 메뉴·앱 안전 영역 (D-70) ---------- */
.menu { background: none; border: 1px solid #2f2a37; color: inherit; border-radius: 8px; padding: 2px 10px; font-size: 18px; line-height: 1.3; cursor: pointer; margin-left: 6px; }
.menu:hover { border-color: #5a4f66; }
@supports (padding: env(safe-area-inset-top)) {
  body { padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom);
         padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
  .modal { padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
}

/* ---------- 이용자 간 대전(모드 B, 2026-10-14 — 설계 v0.1 §7): 모드 탭 · 로비 · 대기 · 두 초상 대면 설전 ---------- */
.modetabs { display: flex; gap: 8px; margin: 0 0 16px; }
.modetabs button { flex: 1; padding: 11px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; font-weight: 700; font-size: 15px; }
.modetabs button[aria-selected="true"] { border-color: var(--ai); background: #2a1719; color: #fff; }
.sub-title.top { margin-top: 0; }
.sub-title small { font-family: var(--body); font-weight: 400; margin-left: 8px; }
.mapgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.mapcard { text-align: left; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg2); cursor: pointer; color: inherit; }
.mapcard[aria-checked="true"] { border-color: var(--ai); box-shadow: 0 0 0 3px rgba(255,75,75,.25); }
.mapcard b { display: block; font-family: var(--display); font-weight: 400; font-size: 19px; }
.mapcard small { color: var(--muted); display: block; font-size: 12px; line-height: 1.4; }
.mapcard .roles { margin-top: 6px; font-size: 12px; color: #dcd7e2; }
.chargrid.small { grid-template-columns: repeat(6, 1fr); gap: 8px; }
.chargrid.small .ch .meta { padding: 4px 6px 6px; }
.chargrid.small .ch .meta b { font-size: 11px; font-weight: 500; }
.lobby-resume .resume { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--gold); background: #2a2416; margin-bottom: 10px; }
.lobby-resume .resume b { display: block; }
.roomcode { font-family: var(--display); font-size: clamp(44px, 12vw, 80px); letter-spacing: .16em; text-align: center; margin: 10px 0 14px; color: var(--gold); -webkit-text-stroke: 2px #000; paint-order: stroke fill; user-select: all; }
.waiting-dots span { animation: dots 1s infinite; display: inline-block; margin-left: 2px; }
.waiting-dots span:nth-child(2) { animation-delay: .15s; }
.waiting-dots span:nth-child(3) { animation-delay: .3s; }
.turnmark { font-size: 12px; font-weight: 900; padding: 2px 10px; border-radius: 99px; background: #2b2731; color: var(--muted); white-space: nowrap; }
.turnmark.me { background: var(--boss); color: var(--ink); }
.turnmark.opp { background: var(--ai); color: #fff; }
.logrow .who { font-size: 11px; font-weight: 900; padding: 1px 6px; border-radius: 4px; background: #2b2731; }
.logrow .who.me { background: var(--boss); color: var(--ink); }
.logrow .who.opp { background: var(--ai); color: #fff; }
.logrow .dmgtag { color: var(--gold); font-weight: 900; font-size: 12px; }
.logrow .linetxt { color: #e8e3ee; }
/* 두 초상 대면 — 왼쪽 나, 오른쪽 상대 */
.duel .char { left: auto; right: auto; transform: none; top: auto; bottom: 0; height: 88%; width: auto; aspect-ratio: 2 / 3; transition: none; }
.duel .char.me { left: 7%; }
.duel .char.opp { right: 7%; }
.duel .nameplate { left: 50%; transform: translateX(-50%); }
.duel .bubble.duelb { top: 52px; max-width: min(520px, 58%); transition: transform .4s cubic-bezier(.2,.8,.3,1), opacity .3s; }
.duel .bubble.duelb.me { left: 4%; right: auto; background: #e8f8ff; border-color: #0b3a4a; color: #06232d; }
.duel .bubble.duelb.opp { right: 4%; left: auto; }
.duel .bubble.duelb.me::after { content: ""; position: absolute; left: 34px; bottom: -14px; width: 16px; height: 16px; background: #e8f8ff; border: 3px solid #0b3a4a; border-left: 0; border-top: 0; transform: rotate(45deg); }
.duel .bubble.duelb.opp::after { content: ""; position: absolute; right: 34px; bottom: -14px; width: 16px; height: 16px; background: var(--paper); border: 3px solid var(--ink); border-left: 0; border-top: 0; transform: rotate(45deg); }
.duel .bubble.duelb.me.hit { opacity: 0; transform: translate(14vw, -10px) scale(.6) rotate(-4deg); }
.duel .bubble.duelb.opp.hit { opacity: 0; transform: translate(-14vw, -10px) scale(.6) rotate(4deg); }
.duel .dmg.boss { left: 16%; top: 12%; }
.duel .dmg.ai { right: 16%; top: 12%; }
.duel .hitword { top: 30%; }
.duel .stage.ended .char.me { left: 4%; }
.duel .stage.ended .char.opp { right: auto; left: 30%; opacity: .55; }
.duel.ended .quitbtn { display: none; }
@media (max-width: 900px) {
  .mapgrid { grid-template-columns: 1fr; }
  .chargrid.small { grid-template-columns: repeat(3, 1fr); }
  .duel .char { width: 48%; height: auto; max-height: 100%; top: auto; bottom: 0; aspect-ratio: 2 / 3; transition: none; }
  .duel .char.me { left: 1%; }
  .duel .char.opp { right: 1%; left: auto; }
  .duel .bubble.duelb { top: 48px; max-width: 80%; }
  .duel .bubble.duelb.me { left: 3%; }
  .duel .bubble.duelb.opp { right: 3%; }
  .duel .stage.ended .char { top: auto; bottom: 0; height: auto; }
  .duel .stage.ended .char.me { left: 1%; }
  .duel .stage.ended .char.opp { left: auto; right: 1%; opacity: .55; }
  .duel .stage-btns { top: 6px; right: 3%; }
  .duel .sitchip { max-width: calc(100% - 170px); }
}
@media (max-width: 640px) {
  .duel .stage.ended .char { left: auto; top: auto; bottom: 0; height: auto; }
  .duel .stage.ended .char.me { left: 1%; height: auto; }
  .duel .stage.ended .nameplate { display: none; }
  .duel .result { align-items: flex-end; }
}

/* 방 만들기 — 자동 설정(2026-10-15 D-81) */
.autosetup { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.orline { display: flex; align-items: center; gap: 12px; margin: 18px 0 4px; color: var(--muted); font-size: 13px; }
.orline::before, .orline::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* 프리미엄 캐릭터(2026-10-15 D-83): 단계 배지 · 잠금 */
.ch .tier { position: absolute; top: 8px; right: 8px; z-index: 2; font-size: 11px; font-weight: 900; padding: 2px 8px; border-radius: 99px; background: #2b2731; color: #ddd; }
.ch .tier.t1 { background: #cfd3da; color: var(--ink); }
.ch .tier.t2 { background: var(--gold); color: var(--ink); }
.ch .tier.t3 { background: #111; color: var(--gold); border: 1px solid var(--gold); }
.ch.locked img { filter: grayscale(.95) brightness(.5); }
.ch.locked .lock { position: absolute; left: 0; right: 0; top: 34%; text-align: center; font-size: 34px; pointer-events: none; }
.ch.locked:hover { transform: none; border-color: var(--gold); }
.ch.premium[aria-checked="true"] { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(255,194,60,.25); }
.chargrid.small .ch.premium .meta small { display: none; }
.chargrid.small .ch .tier { top: 4px; right: 4px; font-size: 10px; padding: 1px 6px; }
.chargrid.small .ch.locked .lock { font-size: 24px; }
.pack small.unlock { color: var(--gold); }

/* 이용자 대전 — 턴 시간·AI 제안(2026-10-15 보스 실측 피드백) */
.turnmark .secs { margin-left: 4px; font-variant-numeric: tabular-nums; }
.turnmark.urgent { animation: pulse .8s ease-in-out infinite; background: var(--bad); color: #fff; }
.turnbar { height: 3px; background: #2a2730; position: relative; overflow: hidden; }
.turnbar i { position: absolute; inset: 0 auto 0 0; background: var(--gold); transition: width 1s linear; }
.turnbar.me i { background: var(--boss); }
.turnbar.opp i { background: var(--ai); }
.suggestbtn { flex: none; padding: 10px 12px; font-size: 13px; border-color: var(--gold); color: var(--gold); background: transparent; }
.suggests { display: flex; flex-direction: column; gap: 6px; padding: 8px 16px 0; background: #121015; }
.suggests .hint { font-size: 12px; }
.suggests button { text-align: left; padding: 9px 12px; border-radius: 10px; border: 1px solid #4b4554; background: var(--panel); color: var(--text); cursor: pointer; font-size: 14px; line-height: 1.4; }
.suggests button:hover { border-color: var(--gold); }
.logrow .selftag { color: #9fd9ff; font-weight: 900; font-size: 12px; }
@media (max-width: 640px) { .suggestbtn { padding: 10px 9px; font-size: 12px; } .suggests button { font-size: 13px; } }

/* ---------- 녹화 모드(?rec=1 — 마케팅 캡처용, app/README.md "녹화 모드"): 가격·코인·공급자 문구·부가 버튼 숨김. body.rec 이 없으면 영향 없음 ---------- */
body.rec #modeBadge, body.rec #btnCoins, body.rec #btnMenu, body.rec #premiumHint, body.rec .stage-btns, body.rec .rec-hide { display: none !important; }
body.rec .topbar .who { display: block; margin-left: auto; }
body.rec .sitchip { max-width: calc(100% - 24px); }

/* ---------- 홈 화면에 추가 안내(D-107 PWA) — 입장·상황 설정·로비 화면에서만 아래쪽에 ---------- */
.installbar {
  position: fixed; left: 50%; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  width: min(560px, calc(100% - 32px)); z-index: 60;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 10px 10px 14px; border-radius: 12px;
  background: var(--panel); border: 1px solid var(--line); box-shadow: 0 8px 28px rgba(0, 0, 0, .45);
  font-size: 14px;
}
.installbar-text { flex: 1; min-width: 0; color: var(--text); }
.installbar .btn { flex: none; padding: 6px 14px; }
.installbar .x { flex: none; background: none; border: 0; font-size: 22px; line-height: 1; cursor: pointer; color: var(--muted); padding: 2px 6px; }
.installbar.off { display: none; }
body.rec .installbar { display: none !important; }

/* 맵 소개 페이지에서 고른 공식 맵(D-107) — 방 만들기 안 */
.mappick { margin: 12px 0; padding: 12px; border: 1px solid var(--gold); border-radius: 12px; background: var(--bg2); }
.mappick .cardsum { margin: 0 0 10px; }

/* ---------- 키보드(D-110 ② — iOS 사파리) ----------
   app.js syncViewport 가 보이는 영역 높이(--vvh)와 밀린 양(--vvtop)을 넣고, 입력칸에 초점이 있고 보이는 영역이 줄었으면 body.kb-open.
   그때 #app 을 보이는 영역에 고정해 무대(캐릭터)가 줄고 입력칸이 키보드 바로 위에 남게 한다. */
body.kb-open #app { position: fixed; left: 0; right: 0; top: 0; height: var(--vvh, 100%); transform: translateY(var(--vvtop, 0px));
                    padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) 0 env(safe-area-inset-left, 0px); }  /* 홈 화면 모드: 노치 아래로 */
body.kb-open .battle .stage { min-height: 110px; }
body.kb-open .battle .sitchip, body.kb-open .battle .nameplate, body.kb-open .battle .turnbar { display: none; }
body.kb-open .duel .char { max-height: 100%; }
body.kb-open .battle .judge { min-height: 0; padding: 4px 12px 2px; }
body.kb-open .battle .judge-line, body.kb-open .battle .flaw { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.kb-open .battle .inputbar { padding-bottom: 8px; }
body.kb-open .suggests { max-height: calc(var(--vvh, 100vh) * .32); overflow-y: auto; }
body.kb-open .installbar { display: none; }

/* 입장 화면 초대 코드 안내(D-110 ①) */
.invite-note { display: block; margin-top: 4px; font-size: 12px; color: var(--ok); }
/* 홈 화면에 추가 띠가 떠 있으면 화면 끝 버튼이 띠에 가리지 않게 */
body.ib-on #scrGate .panel, body.ib-on #scrSetup .panel, body.ib-on #scrLobby .panel { padding-bottom: 110px; }

/* AI 대사 제안(D-110 ③) — 칩 + 닫기, 고른 뒤에도 다시 열 수 있다 */
.suggests .sg-head { display: flex; align-items: center; gap: 8px; }
.suggests .sg-head .hint { flex: 1; min-width: 0; }
.suggests .sg-close { flex: none; padding: 4px 10px; font-size: 12px; border-radius: 8px; border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; }
.suggests .sg-chips { display: flex; flex-direction: column; gap: 6px; padding-bottom: 6px; }
.suggests .sg-chip[aria-pressed="true"] { border-color: var(--gold); background: #2a2416; }
.suggestbtn.has { background: rgba(255, 194, 60, .12); }
/* 방 만들기 옵션 "AI 대사 제안" 켬/끔(D-110 ⑥) */
.coachopt .seg button { min-width: 88px; }
.nocoach { display: inline-block; margin-top: 6px; padding: 2px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; color: var(--warn); border: 1px solid #6b5520; }
body.kb-open .topbar { display: none; }  /* 키보드가 열리면 상단 띠를 접어 무대에 44px 더 준다 */

/* ---------- iPhone 점검(2026-10-18) — 터치 크기 44px · 끈적한 hover 없애기 ---------- */
.btn, .modetabs button, .suggestbtn, .suggests button, .seg button { min-height: 44px; }
.suggests .sg-close { min-height: 44px; min-width: 56px; }
.installbar .x, .modal-head .x, .drawer-head button { min-width: 44px; min-height: 44px; }
.menu, .coins { min-height: 36px; min-width: 40px; }
@media (hover: none) {  /* 손가락으로 누른 뒤 hover 모양이 남지 않게 — 동작은 전부 탭으로 된다 */
  .btn:hover { background: var(--panel); }
  .btn.primary:hover { background: var(--ai); }
  .ch:hover { transform: none; }
  .back:hover { color: var(--muted); }
  .coins:hover, .menu:hover, .pack:hover { border-color: var(--line); }
  .suggests button:hover { border-color: #4b4554; }
}

/* ---------- 실테스트 2차(D-113) ---------- */
/* ④ 로고 = 처음 화면 버튼 */
button.logo { background: none; border: 0; padding: 0 4px; margin: 0; color: var(--text); cursor: pointer; min-height: 44px; line-height: 1; }
/* ⑤ 상단 탭 3개 — 좁은 화면에서도 한 줄 */
.modetabs button { padding: 10px 6px; font-size: 14px; line-height: 1.25; word-break: keep-all; }
@media (max-width: 380px) { .modetabs { gap: 6px; } .modetabs button { font-size: 13px; padding: 8px 4px; } }
/* 확인 시트(로고 나가기)·홈 화면 팝업은 아래에서 올라오는 시트 */
.modal.sheet { align-items: flex-end; }
.modal.sheet .modal-card { border-radius: 18px 18px 0 0; padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px)); }
@media (min-width: 700px) { .modal.sheet { align-items: center; } .modal.sheet .modal-card { border-radius: 16px; } }
#leaveSheet { z-index: 70; }
#leaveSheet .modal-head b { font-size: 17px; line-height: 1.4; }
#dResSub.oppquit { color: var(--ok); font-weight: 700; font-size: 17px; }
/* ①② 홈 화면에 추가 팝업 — 큰 글자, 큰 버튼, 그림 단계 */
#installModal { z-index: 65; }
.install-card .modal-head b { font-size: 20px; line-height: 1.35; }
.install-card .im-lead { font-size: 16px; color: var(--muted); margin: 8px 0 14px; line-height: 1.5; }
.install-card .im-add { width: 100%; min-height: 56px; font-size: 19px; }
.install-card .im-add.ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); font-size: 16px; min-height: 48px; }
.im-steps { list-style: none; margin: 14px 0 4px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.im-step { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; background: var(--bg2); border: 1px solid var(--line); }
.im-num { flex: none; width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--ai); color: #fff; font-weight: 900; font-size: 16px; }
.im-ico { flex: none; width: 56px; height: 48px; display: flex; align-items: center; justify-content: center; color: var(--boss); }
.im-txt { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.im-txt b { font-size: 17px; line-height: 1.35; }
.im-txt small { font-size: 13px; color: var(--muted); line-height: 1.45; }
.im-pointer { position: fixed; z-index: 66; left: 50%; transform: translateX(-50%); color: var(--gold); pointer-events: none; filter: drop-shadow(0 2px 6px rgba(0,0,0,.6)); }
.im-pointer.down { bottom: calc(4px + env(safe-area-inset-bottom, 0px)); animation: imBounceDown 1s ease-in-out infinite; }
.im-pointer.up { top: calc(4px + env(safe-area-inset-top, 0px)); left: auto; right: 14px; transform: none; animation: imBounceUp 1s ease-in-out infinite; }
@keyframes imBounceDown { 0%, 100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, 8px); } }
@keyframes imBounceUp { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@media (prefers-reduced-motion: reduce) { .im-pointer { animation: none !important; } }
#installModal.sheet .modal-card { padding-bottom: calc(52px + env(safe-area-inset-bottom, 0px)); }  /* 아래 화살표가 버튼을 가리지 않게 */
body.im-on .installbar { display: none !important; }
