:root {
  --bg: #1b1622;
  --panel: #2a2233;
  --panel-2: #342a40;
  --edge: #4a3c5a;
  --text: #f1e9ff;
  --muted: #a596b8;
  --gold: #ffcf4a;
  --comet: #7fd8ff;
  --accent: #ff6b6b;
  color-scheme: dark; /* 의도적으로 어두운 한 가지 테마만 사용 */
}
html { height: 100%; }
* { box-sizing: border-box; }
body {
  margin: 0;
  background: radial-gradient(ellipse at top, #2d2238, var(--bg) 70%);
  color: var(--text);
  font-family: "Pretendard", "Malgun Gothic", "Apple SD Gothic Neo", system-ui, sans-serif;
  min-height: 100vh;
}
.hud {
  display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center;
  padding: 12px 20px; background: #140f19; border-bottom: 2px solid var(--edge);
}
.hud .title { font-weight: 800; font-size: 18px; margin-right: auto; }
.hud .title small { color: var(--muted); font-weight: 400; font-size: 12px; margin-left: 6px; }
.hud .stat { background: var(--panel); padding: 6px 12px; border-radius: 8px; font-size: 14px; }
.hud .stat b { color: var(--gold); }
.hud .bless b { color: #fff3b0; }

main {
  display: grid; grid-template-columns: minmax(320px, 460px) minmax(280px, 1fr);
  gap: 20px; padding: 20px; max-width: 1100px; margin: 0 auto;
}
@media (max-width: 760px) { main { grid-template-columns: 1fr; padding: 12px 16px; } }

.panel { background: var(--panel); border: 1px solid var(--edge); border-radius: 12px; padding: 12px 14px; margin-bottom: 16px; }
.panel h3 { margin: 0 0 8px; font-size: 15px; }
.panel h3 small { color: var(--muted); font-weight: 400; }
.muted { color: var(--muted); }

/* ---- 슬롯 캐비닛 ---- */
.cabinet {
  background: linear-gradient(#4b2f3a, #2f1f2a);
  border: 4px solid #6e4a3a; border-radius: 18px; padding: 16px;
  box-shadow: 0 10px 30px #0008, inset 0 0 0 2px #0004;
  margin-bottom: 16px;
}
.marquee {
  text-align: center; font-weight: 700; padding: 8px; margin-bottom: 12px;
  background: #140f19; border-radius: 8px; color: var(--gold); min-height: 38px;
  transition: background .3s;
}
.marquee.blessed { background: linear-gradient(90deg, #6b4e00, #b8860b, #6b4e00); color: #fff; }

.reels-wrap { position: relative; aspect-ratio: 1; }
.reels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; height: 100%; }
.reel {
  display: grid; grid-template-rows: repeat(3, 1fr); gap: 8px;
  background: #e9dfcf; border-radius: 10px; padding: 6px;
  box-shadow: inset 0 6px 10px #0005, inset 0 -6px 10px #0005;
}
.reel.rolling .icon { filter: blur(1.5px); transform: translateY(4px); }
.reel.land { animation: land .25s ease-out; }
@keyframes land { 0% { transform: translateY(-8px); } 60% { transform: translateY(3px); } 100% { transform: none; } }

.cell {
  display: flex; align-items: center; justify-content: center;
  background: #fbf5ea; border-radius: 8px; border: 2px solid transparent;
  font-size: clamp(30px, 7vw, 54px); user-select: none; position: relative;
  transition: border-color .2s, box-shadow .2s;
}
.cell .icon { transition: transform .05s; }
.cell.comet { background: radial-gradient(circle, #1d3d5c, #0d1b2a); }
.cell.comet .icon { animation: twinkle 1.2s ease-in-out infinite; }
@keyframes twinkle { 50% { filter: drop-shadow(0 0 10px var(--comet)); transform: scale(1.08); } }
.cell.blessed { background: radial-gradient(circle, #fff6c8, #f2c94c); box-shadow: 0 0 14px #ffd54a; }
.cell.blessed::after { content: "✨"; position: absolute; top: 2px; right: 4px; font-size: 14px; }
.cell.win { border-color: var(--win); box-shadow: 0 0 0 2px var(--win), 0 0 18px var(--win); animation: pop .35s ease-out; }
@keyframes pop { 50% { transform: scale(1.08); } }

.lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.lines polyline {
  fill: none; stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; opacity: .85;
  stroke-dasharray: 1200; stroke-dashoffset: 1200; animation: draw .4s ease-out forwards;
  vector-effect: non-scaling-stroke;
}
@keyframes draw { to { stroke-dashoffset: 0; } }

.controls { display: flex; gap: 10px; margin-top: 14px; }
button {
  font: inherit; font-weight: 800; border: 0; border-radius: 10px; cursor: pointer;
  padding: 12px 16px; color: #2a1600; transition: transform .08s, filter .2s;
}
button:active:not(:disabled) { transform: translateY(2px); }
button:disabled { filter: grayscale(1) brightness(.6); cursor: not-allowed; }
.spin { flex: 2; background: linear-gradient(#ffe27a, #f0a500); font-size: 20px; box-shadow: 0 4px 0 #8a5a00; }
.spin span { font-size: 14px; margin-left: 6px; }
.wave { flex: 1; background: #b9a6d6; box-shadow: 0 4px 0 #5e4a7a; }
.hint { text-align: center; color: var(--muted); font-size: 12px; margin: 10px 0 0; }

/* ---- 결과/목록 ---- */
.result, .roster, .log { list-style: none; margin: 0; padding: 0; }
.result li, .roster li { padding: 6px 4px; border-bottom: 1px dashed var(--edge); }
.result li:last-child, .roster li:last-child { border-bottom: 0; }
.result .ico { font-size: 20px; }
.result .why { color: var(--muted); font-size: 12px; margin-left: 4px; }
.result li.special { background: linear-gradient(90deg, #1d3d5c, transparent); border-radius: 6px; }
.star { color: var(--gold); letter-spacing: -2px; }
.count { float: right; color: var(--gold); font-weight: 700; }
.log { max-height: 220px; overflow: auto; font-size: 13px; padding-left: 0; }
.log li { padding: 3px 0; }

.odds { width: 100%; border-collapse: collapse; font-size: 13px; }
.odds th { text-align: left; color: var(--muted); font-weight: 400; }
.odds td, .odds th { padding: 3px 4px; }
.odds .num { text-align: right; font-variant-numeric: tabular-nums; }
.odds .comet-row td { color: var(--comet); }
.sim { font-size: 12px; color: var(--muted); margin: 8px 0 0; line-height: 1.5; }
.sim b { color: var(--text); }

/* ---- 배너 ---- */
.banner {
  position: fixed; left: 50%; top: 40%; transform: translate(-50%, -50%) scale(1);
  padding: 18px 28px; border-radius: 14px; font-size: 22px; font-weight: 800; text-align: center;
  box-shadow: 0 10px 40px #000a; z-index: 10; transition: opacity .4s, transform .4s; pointer-events: none;
}
.banner.hidden { opacity: 0; transform: translate(-50%, -50%) scale(.8); }
.banner.jackpot { background: linear-gradient(135deg, #ffcf4a, #ff8c42); color: #2a1600; }
.banner.wanderer { background: linear-gradient(135deg, #0d1b2a, #3a5a8c); color: #e6f6ff; border: 2px solid var(--comet); }

/* ===== M2: 전장 ===== */
main { grid-template-columns: minmax(300px, 400px) minmax(320px, 1fr); max-width: 1280px; }
.small { font-size: 12px; }
.field-panel { padding: 10px; }
.field-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.field-btns { display: flex; gap: 8px; }
.field { width: 100%; aspect-ratio: 800 / 320; display: block; border-radius: 8px; background: #1a1424; }
.fight { background: linear-gradient(#ff8a7a, #e0453a); color: #fff; box-shadow: 0 4px 0 #7a1f18; padding: 10px 16px; }
.speed { background: #4a3c5a; color: var(--text); padding: 10px 12px; box-shadow: 0 4px 0 #2a2233; }
.army { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 4px 12px; }
.army li { padding: 5px 4px; border-bottom: 1px dashed var(--edge); }
.army .ico { font-size: 18px; }
.tag { font-size: 11px; color: var(--muted); margin-left: 4px; }
details.panel summary { cursor: pointer; list-style: none; }
details.panel summary h3 { display: inline; }
details.panel summary::before { content: "▸ "; color: var(--muted); }
details.panel[open] summary::before { content: "▾ "; }
details.panel[open] summary { margin-bottom: 8px; }
.banner.victory { background: linear-gradient(135deg, #3a7d44, #6bcb77); color: #fff; }
.banner small { font-size: 15px; font-weight: 600; }
.overlay { position: fixed; inset: 0; background: #000b; display: flex; align-items: center; justify-content: center; z-index: 20; }
.overlay.hidden { display: none; }
.overlay-box { background: var(--panel); border: 2px solid var(--edge); border-radius: 16px; padding: 24px 32px; text-align: center; min-width: 280px; }
.overlay-box h2 { margin-top: 0; }
.overlay-box button { width: 100%; }
@media (max-width: 900px) {
  main { grid-template-columns: 1fr; padding: 12px 16px; }
  .machine { display: grid; grid-template-columns: minmax(0, 1fr); }
  .cabinet { max-width: 420px; width: 100%; margin: 0 auto 16px; }
}
.side, .machine { min-width: 0; }

/* ===== M4: 성장 ===== */
.codex-btn { background: #4a3c5a; color: var(--text); padding: 6px 12px; font-size: 14px; box-shadow: none; }
.synergy { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.syn { font-size: 12px; padding: 3px 8px; border-radius: 999px; background: var(--panel-2); color: var(--muted); }
.syn.on { background: #3b5a3f; color: #d8ffd8; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
.cards.bench { margin-top: 4px; }
.bench-title { margin: 12px 0 4px; font-size: 13px; }
.card {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: var(--panel-2); border: 2px solid transparent; border-radius: 10px; padding: 6px 4px 5px;
  color: var(--text); font-weight: 400; box-shadow: none; text-align: center; cursor: pointer;
}
.card:hover { border-color: #6e5a86; }
.card.selected { border-color: #fff; box-shadow: 0 0 0 2px #ffffff40; }
.card.evolved { background: linear-gradient(#3e2c55, var(--panel-2)); }
.card.evolved .c-icon { filter: drop-shadow(0 0 6px #c77dff); }
.card.can-evolve::after { content: "진화!"; position: absolute; top: 3px; right: 4px; font-size: 10px; color: #c77dff; font-weight: 800; }
.card.feedable { border-color: #ff9f1c; border-style: dashed; }
.c-icon { font-size: 24px; line-height: 1; }
.c-name { font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.c-meta { font-size: 11px; color: var(--muted); }
.c-engr { font-size: 11px; min-height: 14px; }
.feed-tag { position: absolute; top: -6px; left: 50%; transform: translateX(-50%); background: #ff9f1c; color: #2a1600; font-size: 10px; font-weight: 800; padding: 1px 6px; border-radius: 999px; }
.xpbar { display: block; width: 100%; height: 4px; background: #0006; border-radius: 2px; overflow: hidden; }
.xpbar i { display: block; height: 100%; background: linear-gradient(90deg, #4d96ff, #7fd8ff); }

.detail .d-head { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.d-icon { font-size: 40px; }
.d-name { font-size: 17px; font-weight: 800; }
.lv { font-weight: 700; margin-bottom: 6px; }
.lv .xpbar { margin-top: 4px; height: 6px; }
.stats { font-size: 13px; margin: 4px 0; }
.stats.fx { color: #c7b6ff; }
.slots { display: grid; gap: 4px; margin: 10px 0; }
.slot { display: grid; grid-template-columns: 24px 1fr; column-gap: 6px; align-items: center; background: #0003; border-radius: 8px; padding: 5px 8px; font-size: 12px; color: var(--muted); }
.slot span { grid-row: span 2; font-size: 18px; }
.slot.on { color: var(--text); background: #4a3c5a80; }
.slot small { color: var(--muted); }
.evo { margin: 8px 0; }
.evo-title { font-size: 13px; margin-bottom: 4px; }
.evo .ready { color: #c77dff; }
.evo.done { font-size: 13px; background: #3e2c55; padding: 8px; border-radius: 8px; }
.evo-btn { display: flex; flex-direction: column; align-items: flex-start; width: 100%; margin-top: 4px; background: #3e2c55; color: var(--text); font-weight: 400; text-align: left; box-shadow: 0 3px 0 #23182f; padding: 8px 10px; }
.evo-btn b { color: #e3c8ff; }
.evo-btn small { color: var(--muted); }
.d-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.d-actions button { flex: 1; background: #4a3c5a; color: var(--text); padding: 8px; font-size: 13px; box-shadow: 0 3px 0 #2a2233; white-space: nowrap; }
.d-actions button.on { background: #ff9f1c; color: #2a1600; }
.hint-feed { font-size: 12px; color: #ffcf8a; margin: 8px 0 0; }

.overlay-box.wide { max-width: 720px; width: calc(100% - 32px); max-height: 85vh; overflow: auto; text-align: left; position: relative; }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.choice { display: flex; flex-direction: column; align-items: center; gap: 4px; background: var(--panel-2); color: var(--text); border: 2px solid var(--edge); padding: 14px 10px; font-weight: 400; box-shadow: none; }
.choice:hover { border-color: var(--gold); transform: translateY(-2px); }
.choice .big { font-size: 32px; }
.choice b { font-size: 16px; }
.choice .small { color: var(--muted); }
.close { position: absolute; top: 12px; right: 12px; background: transparent; color: var(--muted); font-size: 18px; padding: 4px 8px; box-shadow: none; }

.codex-box h3 { margin: 18px 0 8px; font-size: 15px; }
.cx-units { display: grid; gap: 8px; }
.cx-row { display: grid; grid-template-columns: minmax(150px, 1fr) auto minmax(0, 2fr); gap: 8px; align-items: center; }
.cx-unit { display: flex; flex-direction: column; background: #0003; border-radius: 8px; padding: 6px 10px; font-size: 13px; opacity: .55; }
.cx-unit.known { opacity: 1; background: #4a3c5a80; }
.cx-unit .big { font-size: 22px; }
.cx-unit small { color: var(--muted); font-size: 11px; }
.cx-arrow { font-size: 12px; color: #c77dff; }
.cx-evos { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.cx-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px; }
.cx-engr { display: grid; grid-template-columns: 26px 1fr; column-gap: 6px; background: #0003; border-radius: 8px; padding: 6px 8px; font-size: 13px; }
.cx-engr span { grid-row: span 2; font-size: 20px; }
.cx-engr small { color: var(--muted); font-size: 11px; }
@media (max-width: 600px) { .cx-row { grid-template-columns: 1fr; } .cx-arrow { display: none; } }

.banner.levelup { background: linear-gradient(135deg, #2b5876, #4e9fd1); color: #fff; }
.banner.evolve { background: linear-gradient(135deg, #5b2a86, #c77dff); color: #fff; }
.banner.codex { background: linear-gradient(135deg, #4a3c5a, #8b6fb0); color: #fff; font-size: 18px; }

/* ===== M5: 레버 기술 · 유물 ===== */
.lever { flex: 1; background: linear-gradient(#9ad0ff, #4d96ff); color: #06223f; box-shadow: 0 4px 0 #1f4f8a; font-size: 15px; white-space: nowrap; }
.lever small { font-size: 11px; opacity: .8; }
.lever.armed { background: linear-gradient(#ffe27a, #ff9f1c); color: #2a1600; box-shadow: 0 4px 0 #8a5a00; animation: pulse 1s infinite; }
@keyframes pulse { 50% { filter: brightness(1.15); } }
.reels.armed .cell { cursor: pointer; }
.reels.armed .cell:hover { outline: 3px solid #ffcf4a; outline-offset: -3px; }
.reels.armed[data-target="col"] .reel:hover { box-shadow: 0 0 0 3px #ffcf4a, inset 0 6px 10px #0005; }
.reels.armed[data-target="col"] .cell:hover { outline: none; }
.reel.held { box-shadow: 0 0 0 3px #4d96ff, inset 0 6px 10px #0005; position: relative; }
.reel.held::before { content: "📌"; position: absolute; top: -12px; left: 50%; transform: translateX(-50%); font-size: 18px; z-index: 2; }
.cell.pop2 { animation: pop2 .45s ease-out; }
@keyframes pop2 { 0% { transform: scale(.6) rotate(-8deg); opacity: .3; } 70% { transform: scale(1.1); } 100% { transform: none; opacity: 1; } }

.relic-bar { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; margin-top: 12px; }
.relic { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; font-size: 20px; background: #140f19; border: 1px solid #6e4a3a; border-radius: 8px; cursor: help; }
.relic.empty { opacity: .35; cursor: default; }
.relic-note { color: #9ad0ff; }
.choice .tag { font-size: 11px; background: #4a3c5a; padding: 1px 8px; border-radius: 999px; color: var(--muted); }
.cx-engr.owned { background: #3b5a3f; }
.banner.relic-get { background: linear-gradient(135deg, #6e4a3a, #c08a4a); color: #fff; }

/* ===== M6: 손맛 · 마감 ===== */
.reel { position: relative; overflow: hidden; }
.reel.spinning .cell { visibility: hidden; }
.strip { position: absolute; left: 6px; right: 6px; top: 6px; display: flex; flex-direction: column; will-change: transform; z-index: 1; }
.scell { display: flex; align-items: center; justify-content: center; background: #fbf5ea; border-radius: 8px; font-size: clamp(30px, 7vw, 54px); flex: none; }
.scell.comet { background: radial-gradient(circle, #1d3d5c, #0d1b2a); }
.reel.tease { box-shadow: 0 0 0 3px #ff6b6b, 0 0 24px #ff6b6b, inset 0 6px 10px #0005; animation: tease .25s infinite alternate; }
@keyframes tease { to { box-shadow: 0 0 0 3px #ffd93d, 0 0 34px #ffd93d, inset 0 6px 10px #0005; } }

.fx-layer { position: absolute; inset: 0; pointer-events: none; overflow: visible; z-index: 3; }
.particle { position: absolute; width: 8px; height: 8px; border-radius: 50%; margin: -4px 0 0 -4px; animation: burst .8s ease-out forwards; box-shadow: 0 0 8px currentColor; }
@keyframes burst { 0% { transform: translate(0, 0) scale(1.2); opacity: 1; } 100% { transform: translate(var(--dx), var(--dy)) scale(.2); opacity: 0; } }
.coin { position: fixed; top: -40px; font-size: 26px; pointer-events: none; z-index: 30; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(540deg); } }

.cabinet.shake { animation: shake .45s; }
@keyframes shake { 10%, 90% { transform: translate(-2px, 1px); } 20%, 80% { transform: translate(4px, -2px); } 30%, 50%, 70% { transform: translate(-6px, 2px); } 40%, 60% { transform: translate(6px, -1px); } }
.field-panel.hurt { animation: hurt .45s; }
@keyframes hurt { 0% { box-shadow: inset 0 0 0 4px #ff4d4d, 0 0 30px #ff4d4d80; } 100% { box-shadow: none; } }
.cell.win { animation: pop .35s ease-out, glow 1.2s ease-in-out .35s infinite alternate; }
@keyframes glow { to { box-shadow: 0 0 0 2px var(--win), 0 0 26px var(--win); } }
.banner:not(.hidden) { animation: bannerIn .35s cubic-bezier(.2,1.6,.4,1); }
@keyframes bannerIn { from { transform: translate(-50%, -50%) scale(.4); } }

.title-screen { background: radial-gradient(ellipse at center, #3a2448ee, #0b0810f5); z-index: 40; }
.title-box { text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: stretch; width: min(360px, calc(100% - 32px)); }
.logo { font-size: 44px; font-weight: 900; line-height: 1.15; color: var(--gold); text-shadow: 0 4px 0 #8a5a00, 0 0 30px #ffcf4a80; animation: float 3s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-6px); } }
.tagline { color: var(--text); margin: 0 0 8px; line-height: 1.5; }
.tagline small { color: var(--gold); }
.title-box .spin { width: 100%; }
.title-box .spin small { font-size: 11px; font-weight: 400; }
.sound-row { color: var(--muted); font-size: 14px; display: flex; gap: 6px; justify-content: center; align-items: center; }
#victory .overlay-box button { margin-top: 8px; }

@media (max-width: 600px) {
  .hud { gap: 6px; padding: 8px 12px; }
  .hud .title { width: 100%; font-size: 16px; }
  .hud .stat { padding: 4px 8px; font-size: 12px; }
  .codex-btn { padding: 4px 8px; font-size: 12px; }
  .controls { flex-wrap: wrap; }
  .field-head { flex-wrap: wrap; }
  .cards { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
}
#btn-continue.hidden { display: none; }
/* 모바일: 전장 → 슬롯 → 병력 → 상세 순서 */
@media (max-width: 900px) {
  main { display: flex; flex-direction: column; gap: 12px; }
  .machine, .side { display: contents; }
  main > * , .machine > *, .side > * { margin-bottom: 0; }
  #field-panel { order: 1; }
  #cabinet { order: 2; margin: 0 auto; }
  #detail { order: 4; }
  .side > .panel:nth-of-type(2) { order: 3; }
  #result-panel { order: 5; }
  details.panel { order: 6; }
}

/* ===== 모바일 전용 인터페이스 (≤700px, body.mobile) ===== */
.action-bar, .tab-bar, .sheet { display: none; }
.toast { position: fixed; left: 50%; top: 64px; transform: translateX(-50%); z-index: 50; background: #140f19f2; border: 1px solid var(--edge); color: var(--text);
  padding: 10px 14px; border-radius: 10px; font-size: 13px; line-height: 1.5; max-width: calc(100vw - 32px); box-shadow: 0 8px 24px #000a; transition: opacity .25s; }
.toast.hidden { opacity: 0; pointer-events: none; }

body.mobile {
  height: 100%; overflow: hidden; display: flex; flex-direction: column;
  touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
}
body.mobile .hud { flex: none; padding: 6px 16px; gap: 4px; justify-content: center; }
body.mobile .hud .title { display: none; }
body.mobile .hud .stat { font-size: 12px; padding: 3px 7px; }
body.mobile .codex-btn { padding: 3px 9px; font-size: 13px; }

body.mobile main { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; padding: 8px 16px; overflow: hidden; max-width: none; }
body.mobile .machine, body.mobile .side { display: contents; }
body.mobile #field-panel { order: 1; flex: none; padding: 6px; margin: 0; }
body.mobile .field-head { margin-bottom: 4px; flex-wrap: nowrap; }
body.mobile #field-title { font-size: 13px; }
body.mobile #next-wave { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 62vw; }
body.mobile .speed { padding: 6px 10px; font-size: 13px; }

body.mobile #cabinet { order: 2; flex: 1; min-height: 0; width: 100%; max-width: 440px; margin: 0 auto; padding: 10px; border-width: 3px; display: flex; flex-direction: column; }
body.mobile .marquee { font-size: 13px; padding: 6px 8px; min-height: 0; margin-bottom: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.mobile .reels-wrap { flex: 1 1 0; min-height: 120px; aspect-ratio: auto; width: 100%; }
body.mobile .reels, body.mobile .reel { gap: 6px; }
body.mobile .reel { padding: 5px; }
body.mobile .cell, body.mobile .scell { font-size: clamp(24px, 9vw, 46px); }
body.mobile .strip { left: 5px; right: 5px; top: 5px; }
body.mobile .controls, body.mobile .hint { display: none; }
body.mobile .relic-bar { margin-top: 8px; gap: 3px; }
body.mobile .relic { font-size: 16px; border-radius: 6px; }

/* 엄지 영역 행동 바 */
body.mobile .action-bar { display: flex; gap: 8px; flex: none; padding: 8px 16px; background: #140f19; border-top: 1px solid var(--edge); position: relative; z-index: 15; }
body.mobile .action-bar button { min-height: 54px; border-radius: 12px; }
body.mobile #btn-spin { flex: 2; font-size: 19px; }
body.mobile #btn-lever { flex: 1.3; font-size: 14px; padding: 6px; white-space: normal; line-height: 1.2; }
body.mobile #btn-fight { flex: 1.5; font-size: 15px; padding: 6px; }

/* 탭 바 */
body.mobile .tab-bar { display: flex; flex: none; background: #0f0b13; border-top: 1px solid var(--edge); position: relative; z-index: 15; }
.tab-bar button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px; background: none; box-shadow: none; color: var(--muted); padding: 6px 0 7px; font-size: 18px; font-weight: 400; border-radius: 0; }
.tab-bar button span { font-size: 11px; }
.tab-bar button b { color: var(--gold); font-weight: 700; }
.tab-bar button.on { color: var(--gold); background: #ffffff0a; }

/* 아래에서 올라오는 시트 */
body.mobile .sheet {
  display: flex; flex-direction: column; position: fixed; left: 0; right: 0; bottom: 0; z-index: 12;
  max-height: 74vh; max-height: 74dvh; background: var(--bg); border-top: 2px solid var(--edge); border-radius: 18px 18px 0 0;
  box-shadow: 0 -12px 40px #000c; padding-bottom: 128px;
  transform: translateY(100%); transition: transform .28s cubic-bezier(.2,.9,.3,1); visibility: hidden;
}
body.mobile .sheet.open { transform: none; visibility: visible; }
.sheet-handle { flex: none; background: none; box-shadow: none; padding: 10px 0 6px; width: 100%; display: flex; justify-content: center; border-radius: 0; }
.sheet-handle span { width: 44px; height: 5px; border-radius: 3px; background: var(--edge); }
.sheet-body { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 0 16px 10px; overscroll-behavior: contain; }
.sheet-page { display: none; }
.sheet-page.on { display: block; }
.sheet-page .panel { margin-bottom: 10px; }
body.mobile .detail .d-actions button { min-height: 44px; }
body.mobile .card { min-height: 92px; }
body.mobile .synergy .syn { cursor: pointer; }

/* 모달·배너 */
body.mobile .overlay-box { padding: 18px 16px; }
body.mobile .overlay-box.wide { max-height: 86dvh; }
body.mobile .choices { grid-template-columns: 1fr; }
body.mobile .choice { display: grid; grid-template-columns: 44px 1fr; grid-template-rows: auto auto; column-gap: 10px; text-align: left; align-items: center; padding: 12px; min-height: 64px; }
body.mobile .choice .big { grid-row: span 3; font-size: 30px; text-align: center; }
body.mobile .choice .tag { justify-self: start; }
body.mobile .banner { font-size: 18px; padding: 14px 18px; max-width: calc(100vw - 32px); }
body.mobile .logo { font-size: 38px; }

/* 확인 창 · 접근성 */
.confirm-box { max-width: 340px; }
.confirm-box p { font-size: 16px; line-height: 1.5; margin: 0 0 16px; }
.confirm-btns { display: flex; gap: 10px; }
.confirm-btns button { flex: 1; }
button:focus-visible, .card:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .coin, .particle { display: none; }
}
#confirm { z-index: 60; }
