/* 횃불 미궁 — 어두운 돌벽과 횃불빛 */
/* Galmuri 픽셀 글꼴 (OFL) — 아케이드 공용 ../assets/fonts */
@font-face { font-family: 'Galmuri'; font-weight: 700; font-display: swap; src: url('../assets/fonts/Galmuri11-Bold.woff2') format('woff2'); }

:root {
  --bg: #0d0a10;
  --panel: #18131c;
  --panel2: #221a27;
  --line: #3a2d3f;
  --text: #f1e6d8;
  --dim: #a8968a;
  --torch: #ffb04a;
  --torch2: #ff7a2a;
  --gold: #ffd76a;
  --hp: #e8414f;
  --shield: #8fc4ff;
  --good: #6dff9a;
  --px: 'Galmuri', ui-monospace, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh; min-height: 100dvh;
  background: radial-gradient(900px 500px at 50% -10%, #3a1f12 0%, transparent 60%), var(--bg);
  color: var(--text);
  font-family: 'Pretendard', 'Apple SD Gothic Neo', 'Malgun Gothic', system-ui, sans-serif;
  font-size: 15px; line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
small { color: var(--dim); }
canvas { image-rendering: pixelated; image-rendering: crisp-edges; }

/* ───── 상단 ───── */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top));
  background: rgba(13, 10, 16, .92); backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.back-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--line);
  color: var(--text); text-decoration: none; font-size: 13px; white-space: nowrap;
}
.back-btn:hover { border-color: var(--torch); }
.top-title { font-family: var(--px); color: var(--torch); font-size: 15px; white-space: nowrap; }
.tools { display: flex; gap: 6px; margin-left: auto; align-items: center; }
.gold-chip { font-family: var(--px); padding: 4px 10px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); color: var(--gold); white-space: nowrap; }
.mini { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); font-size: 15px; display: inline-grid; place-items: center; padding: 0; flex: none; }
.mini:hover { border-color: var(--torch); }
.mini.off { opacity: .4; }
@media (max-width: 420px) { .back-txt, .top-title { display: none; } }

/* ───── 버튼 ───── */
.btn {
  padding: 10px 16px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel2); font-weight: 700;
}
.btn:hover:not(:disabled) { border-color: var(--torch); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: linear-gradient(180deg, #ff9a3a, #e2621c); border-color: #ffb36a; color: #1a0d05; box-shadow: 0 0 18px rgba(255, 140, 50, .35); }
.btn.ghost { background: transparent; }
.btn.big { font-size: 18px; padding: 14px 20px; font-family: var(--px); }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }

/* ───── 캠프 ───── */
.camp-wrap { max-width: 640px; margin: 0 auto; padding: 14px 14px 40px; }
.hero-title { position: relative; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: #000; }
.title-canvas { display: block; width: 100%; aspect-ratio: 4 / 3; max-height: 46vh; object-fit: cover; }
.title-text {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 40px 16px 14px;
  background: linear-gradient(180deg, transparent, rgba(8, 5, 8, .92) 60%);
}
.title-text h1 { margin: 0; font-family: var(--px); font-size: 34px; color: var(--torch); text-shadow: 0 0 16px rgba(255, 120, 30, .7), 2px 2px 0 #3a1505; letter-spacing: 2px; }
.title-text p { margin: 4px 0 0; font-size: 14px; color: #e9d9c6; }
.sec { font-family: var(--px); font-size: 16px; color: var(--torch); margin: 22px 0 8px; display: flex; align-items: baseline; gap: 8px; }
.sec small { font-family: inherit; font-size: 12px; }
.resume { margin-top: 12px; padding: 12px; border-radius: 12px; background: #2a1a10; border: 1px solid #7a4a1e; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

.class-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.class-card { display: flex; gap: 10px; text-align: left; padding: 10px; border-radius: 12px; border: 2px solid var(--line); background: var(--panel); align-items: flex-start; }
.class-card.on { border-color: var(--torch); background: #2a1c14; box-shadow: 0 0 14px rgba(255, 150, 60, .25); }
.class-card b { font-size: 16px; }
.class-card small { display: block; font-size: 11px; }
.class-card p { margin: 4px 0 0; font-size: 12px; color: var(--dim); }
.class-ico canvas { width: 40px; height: 40px; }
@media (max-width: 460px) { .class-pick { grid-template-columns: 1fr; } }

.zone-tabs { display: flex; gap: 6px; margin-bottom: 8px; overflow-x: auto; }
.zone-tab { flex: 1; padding: 8px 6px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); font-size: 13px; white-space: nowrap; }
.zone-tab.on { border-color: var(--torch); color: var(--torch); background: #2a1c14; }
.zone-tab:disabled { opacity: .5; cursor: default; }
.stage-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.stage { padding: 8px 2px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; align-items: center; gap: 2px; }
.stage b { font-family: var(--px); font-size: 14px; }
.stage span { font-size: 11px; color: var(--gold); letter-spacing: -1px; }
.stage.boss { background: #23141a; }
.stage.on { border-color: var(--torch); box-shadow: inset 0 0 0 1px var(--torch); }
.stage:disabled { opacity: .4; cursor: default; }
.go { width: 100%; margin-top: 10px; }

.endless { margin-top: 16px; padding: 12px; border-radius: 12px; border: 1px solid #4a3a6a; background: linear-gradient(135deg, #1d1530, #15101c); display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.endless .btn { flex: none; white-space: nowrap; }
.endless p { margin: 4px 0 0; font-size: 12px; color: var(--dim); }
.endless.locked { opacity: .6; }
.sec-sub { margin: -4px 0 8px; font-size: 12px; color: var(--dim); }
.relic-equip { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; margin-bottom: 8px; }
.relic-slot { min-width: 0; display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; border: 2px solid var(--gold); background: #2a2010; font-weight: 700; font-size: 13px; }
.relic-slot.empty { border-style: dashed; border-color: var(--line); background: var(--panel); color: var(--dim); font-weight: 400; }
.relic-slot canvas { width: 32px; height: 32px; }
.relic-list { display: flex; flex-direction: column; gap: 5px; max-height: 340px; overflow-y: auto; padding-right: 2px; }
.relic-row { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); }
.relic-row canvas { width: 32px; height: 32px; flex: none; }
.relic-row.on { border-color: var(--gold); background: #2a2010; }
.relic-row.unowned canvas { filter: grayscale(.8) brightness(.6); }
.relic-body { flex: 1; min-width: 0; }
.relic-body p { margin: 0; font-size: 12px; color: #dccbbb; }
.relic-body small { font-size: 11px; }
.relic-bar { display: inline-flex; gap: 3px; }
.relic-chip { width: 24px; height: 24px; padding: 0; border-radius: 6px; border: 1px solid var(--gold); background: #2a2010; display: grid; place-items: center; }
.relic-chip canvas { width: 20px; height: 20px; }
.cls-weapons { display: block; margin-top: 3px; font-size: 11px; color: var(--torch) !important; }
.lv.cls { background: #5a3a14; color: #ffd9a8; }
.drop { margin-top: 10px; padding: 8px 10px; border-radius: 10px; background: #2a2010; border: 1px solid var(--gold); text-align: left; font-size: 13px; }
.drop p { margin: 2px 0; }
.mastery { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 11px; color: var(--gold); }
.start-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.start-opt { display: flex; gap: 8px; align-items: flex-start; text-align: left; padding: 8px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); }
.start-opt canvas { width: 36px; height: 36px; flex: none; }
.start-opt.on { border: 2px solid var(--tag); background: color-mix(in srgb, var(--tag) 14%, var(--panel)); box-shadow: 0 0 10px color-mix(in srgb, var(--tag) 35%, transparent); }
.start-body { min-width: 0; }
.start-body b { font-size: 14px; }
.start-body p { margin: 2px 0; font-size: 11px; color: #dccbbb; }
.start-body small { font-size: 10px; color: var(--dim); }
@media (max-width: 380px) { .start-pick { grid-template-columns: 1fr; } }
.mastery i { flex: 1; height: 5px; border-radius: 3px; background: #2a2030; overflow: hidden; display: block; }
.mastery em { display: block; height: 100%; background: linear-gradient(90deg, #ffb04a, #ffd76a); }
.perks { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.perk { font-size: 11px; padding: 2px 7px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); color: var(--dim); }
.perk.on { color: var(--gold); border-color: #6a5320; background: #2a2010; }
.tier-tabs { display: flex; gap: 5px; margin-bottom: 6px; }
.tier-tab { flex: 1; padding: 6px 4px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel); font-family: var(--px); font-size: 13px; }
.tier-tab.on { border-color: #ff6a3a; color: #ffb07a; background: #2e1610; box-shadow: 0 0 10px rgba(255, 106, 58, .3); }
.tier-tab:disabled { opacity: .45; cursor: default; }
.zone-tab small { font-size: 10px; color: var(--dim); }
.relic-btns { display: flex; flex-direction: column; gap: 4px; }
.relic-btns .btn { min-width: 84px; padding: 6px 8px; font-size: 12px; }
.tints { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.tint { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); font-size: 12px; }
.tint canvas { width: 28px; height: 28px; }
.tint.on { border-color: var(--torch); background: #2a1c14; }
.tint.locked span { color: var(--dim); }
.ach-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.ach { padding: 8px 10px; border-radius: 10px; background: var(--panel2); border: 1px solid var(--line); opacity: .65; }
.ach.on { opacity: 1; border-color: #6a5320; }
.ach p { margin: 2px 0; font-size: 12px; color: var(--dim); }
.ach small { color: var(--gold); }
.summary { margin-top: 12px; text-align: left; }
.summary-build { display: flex; gap: 4px; justify-content: center; margin-bottom: 8px; }
.summary-build canvas { width: 32px; height: 32px; border-radius: 6px; background: var(--panel2); padding: 2px; }
.summary-dmg { display: flex; flex-direction: column; gap: 3px; font-size: 12px; }
.summary-dmg div { display: grid; grid-template-columns: 9em 1fr 3em; align-items: center; gap: 6px; }
.summary-dmg span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.summary-dmg i { height: 7px; border-radius: 4px; background: #2a2030; overflow: hidden; display: block; }
.summary-dmg em { display: block; height: 100%; background: linear-gradient(90deg, #ff7a2a, #ffd76a); }
.summary-dmg b { text-align: right; font-family: var(--px); font-size: 11px; }
.opt.k-event { border-color: #6a4a8a; background: #1e1628; }
.opt.k-event.off { opacity: .45; }
.opt.k-shard .kind { background: #2a3a5a; color: #cfe3ff; }
.lv.price { background: #4a3a10; color: var(--gold); }
.node.k-event { background: #241a34; }
@media (max-width: 460px) { .tints, .ach-list { grid-template-columns: 1fr 1fr; } }

.upgrades { display: flex; flex-direction: column; gap: 6px; }
.up { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); }
.up-ico canvas { width: 32px; height: 32px; }
.up-body { flex: 1; min-width: 0; }
.up-body p { margin: 0; font-size: 12px; color: var(--dim); }
.up-body em { color: var(--good); font-style: normal; }
.btn.buy { min-width: 84px; padding: 8px 10px; font-family: var(--px); color: var(--gold); }
.foot-row { margin-top: 16px; justify-content: center; }

/* ───── 스테이지 화면 ───── */
body.playing { overflow: hidden; }
.play-wrap { max-width: 800px; margin: 0 auto; padding: 6px 8px 10px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.stage-bar { width: 100%; display: flex; align-items: center; gap: 8px; }
.stage-bar > b { font-family: var(--px); color: var(--torch); white-space: nowrap; font-size: 14px; }
.stage-bar > b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.round-txt { font-family: var(--px); font-size: 13px; color: var(--dim); white-space: nowrap; }
.progress { width: 100%; display: flex; gap: 2px; justify-content: center; }
.node { flex: 1; max-width: 30px; height: 18px; border-radius: 4px; display: grid; place-items: center; font-size: 11px; line-height: 1; background: var(--panel); border: 1px solid var(--line); opacity: .8; }
.node.k-normal { background: #2a2030; }
.node.done { opacity: .28; filter: grayscale(1); }
.node.cur { opacity: 1; border-color: var(--torch); box-shadow: 0 0 8px rgba(255, 160, 60, .6); background: #4a2a14; }
.node.k-boss { background: #3a1418; }
.node.k-elite { background: #2e1636; }

.view-wrap { position: relative; line-height: 0; border-radius: 6px; overflow: hidden; border: 2px solid #2c2030; box-shadow: 0 0 30px rgba(255, 120, 40, .12); }
.view { display: block; width: 384px; height: 288px; background: #000; }
.enemy-bar { position: absolute; left: 8px; right: 8px; top: 6px; line-height: 1.3; pointer-events: none; text-shadow: 1px 1px 0 #000; }
.enemy-top { display: flex; justify-content: space-between; align-items: center; font-family: var(--px); font-size: 13px; }
.enemy-sub { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-top: 2px; }
.enemy-sub small { font-size: 11px; color: #d8c8b8; }
.badge { font-size: 10px; padding: 0 5px; border-radius: 4px; margin-right: 4px; vertical-align: 1px; }
.badge.elite { background: #6a1c6a; }
.badge.boss { background: #a8231d; }
.badge.curse { background: #4a1060; }
.bar { height: 8px; background: rgba(0, 0, 0, .6); border: 1px solid rgba(255, 255, 255, .25); position: relative; overflow: hidden; border-radius: 2px; }
.bar i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(180deg, #ff6a5a, #c42a2a); transition: width .12s; }
.enemy-bar.boss .bar { height: 10px; border-color: #ffd76a; }
.enemy-bar.boss .bar i { background: linear-gradient(180deg, #ffb04a, #d13a1a); }

.banner {
  position: absolute; left: 0; right: 0; top: 38%; text-align: center; line-height: 1.2; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 10px; background: linear-gradient(90deg, transparent, rgba(0, 0, 0, .75), transparent);
}
.banner b { font-family: var(--px); font-size: 26px; color: var(--torch); text-shadow: 0 0 12px rgba(255, 120, 30, .8), 2px 2px 0 #000; }
.banner small { color: #f1e0c8; font-size: 13px; }
.banner.boss b { color: #ff5a4a; }
.banner.warn { top: 22%; }
.banner.warn b { font-size: 18px; color: #ff6a5a; }
.banner.show { animation: bannerIn .35s ease-out; }
@keyframes bannerIn { from { opacity: 0; transform: scale(1.3); } to { opacity: 1; transform: none; } }

/* 스킬 이름 팝업: 적 이름·체력·상태 표시(위쪽) 아래 칸에만 쌓이고 넘치면 잘린다 */
.pops { position: absolute; right: 6px; top: 30%; bottom: 22%; display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-end; gap: 3px; pointer-events: none; line-height: 1; overflow: hidden; }
.card-pop em { font-style: normal; font-family: var(--px); font-size: 11px; color: #fff; }
.card-pop em:empty { display: none; }
.card-pop { display: flex; align-items: center; gap: 4px; padding: 3px 8px 3px 3px; border-radius: 6px; background: rgba(10, 6, 12, .85); border: 1px solid var(--tag); font-size: 12px; font-weight: 700; color: var(--tag); animation: popIn 1.1s ease-out forwards; }
.card-pop canvas { width: 24px; height: 24px; }
.card-pop.fused { box-shadow: 0 0 10px rgba(255, 215, 106, .6); }
.banner.fuse b { color: var(--gold); text-shadow: 0 0 14px rgba(255, 215, 106, .9), 2px 2px 0 #3a2a05; }
@keyframes popIn { 0% { opacity: 0; transform: translateX(20px); } 15% { opacity: 1; transform: none; } 75% { opacity: 1; } 100% { opacity: 0; transform: translateY(-10px); } }

.hero-panel { width: 100%; display: flex; flex-direction: column; gap: 5px; }
.hero-hp { position: relative; }
.hero-hp .bar { height: 18px; border-radius: 4px; border-color: #5a3a3a; }
.hero-hp .bar i { background: linear-gradient(180deg, #ff5a6a, #b8202e); }
.hero-hp .bar em { position: absolute; left: 0; top: 0; height: 5px; background: #9fd0ff; box-shadow: 0 0 6px #8fc4ff; }
.hero-hp span { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--px); font-size: 12px; text-shadow: 1px 1px 0 #000; }
.hero-hp.low .bar { animation: lowPulse .8s infinite alternate; }
@keyframes lowPulse { to { box-shadow: 0 0 10px #ff2a2a; } }
.stats { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; font-family: var(--px); font-size: 13px; justify-content: center; }
.stats > span { display: inline-flex; align-items: center; gap: 3px; }
.si canvas { width: 16px; height: 16px; display: block; }
.chips { gap: 4px; }
.chip { font-family: var(--px); font-size: 11px; padding: 1px 6px; border-radius: 4px; background: rgba(0, 0, 0, .6); border: 1px solid; }
.chip.poison { color: #9be35a; border-color: #4a7a2a; }
.chip.burn { color: #ff8a3d; border-color: #8a3a1a; }
.chip.bleed { color: #ff4f6d; border-color: #8a1a2a; }
.chip.stun { color: #ffe14d; border-color: #7a6a1a; }

.slots { display: flex; gap: 8px; justify-content: center; align-items: flex-end; flex-wrap: wrap; }
.slot-group { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.slot-label { font-size: 10px; line-height: 1; }
.slot-row { display: flex; gap: 4px; }
.slot { width: 50px; height: 58px; border-radius: 8px; border: 2px solid var(--tag, var(--line)); background: var(--panel); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 0; position: relative; }
.slot canvas { width: 34px; height: 34px; }
.slot.empty { border-style: dashed; opacity: .5; cursor: default; }
.slot.s-passive canvas { width: 28px; height: 28px; }
.slot.s-passive:not(.empty) { border-color: #6a5a7a; }
.slot.s-weapon:not(.empty) { background: #241a14; }
.slot.fused { background: linear-gradient(160deg, #3a2a10, #1c1410); box-shadow: 0 0 10px rgba(255, 215, 106, .35); }
.slot.paired::after { content: '🔗'; position: absolute; top: -6px; right: -6px; font-size: 11px; }
.pips { font-size: 9px; color: var(--tag, #c8b8d8); letter-spacing: 1px; line-height: 1; }
.slot.s-passive .pips { font-size: 7px; letter-spacing: 0; }
.slot.fused .pips { color: var(--gold); font-size: 11px; }
@media (max-width: 440px) {
  .slots { gap: 5px; }
  .slot-row { gap: 3px; }
  .slot { width: 42px; height: 50px; border-radius: 7px; }
  .slot canvas { width: 28px; height: 28px; }
  .slot.s-passive canvas { width: 24px; height: 24px; }
}
.slot.fire { animation: slotFire .5s ease-out; }
@keyframes slotFire { 0% { transform: scale(1.18); box-shadow: 0 0 16px var(--tag); background: #3a2a1a; } 100% { transform: none; } }
.resonance { display: flex; flex-wrap: wrap; gap: 4px 10px; justify-content: center; font-size: 12px; }
.resonance span { color: var(--tag); }
.stat-panel { width: 100%; max-width: 560px; padding: 6px 8px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 5px; }
.sp-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.sp-cell { display: flex; flex-direction: column; min-width: 0; }
.sp-cell span { font-size: 10px; color: var(--dim); white-space: nowrap; }
.sp-cell b { display: inline-flex; align-items: center; gap: 4px; font-family: var(--px); font-size: 14px; }
.sp-cell small { font-size: 10px; color: var(--dim); white-space: nowrap; }
.sp-shards { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; font-size: 12px; border-top: 1px dashed var(--line); padding-top: 5px; }
.sp-shards small { color: var(--dim); font-size: 11px; }
.sp-label { font-size: 10px; color: #cfe3ff; background: #2a3a5a; border-radius: 4px; padding: 1px 5px; }
.sp-shard { display: inline-flex; align-items: center; gap: 3px; }
.sp-shard em { font-style: normal; color: var(--gold); font-size: 11px; }
.sp-curse { color: #e08cff; font-size: 11px; }
.pick-actions { display: flex; gap: 8px; justify-content: center; }
.pick-actions .btn { flex: 0 1 auto; min-width: 0; padding-left: 10px; padding-right: 10px; font-size: 13px; white-space: nowrap; }
.tip { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); max-width: min(92vw, 420px); padding: 10px 14px; border-radius: 10px; background: rgba(20, 14, 24, .96); border: 1px solid var(--torch); font-size: 13px; z-index: 50; }

/* ───── 오버레이 ───── */
.overlay { position: fixed; inset: 0; z-index: 40; background: rgba(5, 3, 6, .78); display: grid; place-items: center; padding: 16px; overflow-y: auto; backdrop-filter: blur(2px); }
.pick-box, .result-box, .modal-box { width: min(520px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 18px; text-align: center; box-shadow: 0 10px 40px rgba(0, 0, 0, .6); animation: rise .25s ease-out; }
@keyframes rise { from { transform: translateY(20px); opacity: 0; } }
.pick-box h2, .result-box h2 { font-family: var(--px); margin: 0; color: var(--torch); font-size: 22px; }
.sub { margin: 6px 0 0; color: var(--dim); font-size: 13px; }
.opts { display: flex; flex-direction: column; gap: 8px; margin: 14px 0 10px; }
.opt { position: relative; display: flex; gap: 12px; align-items: center; text-align: left; padding: 12px; border-radius: 12px; border: 2px solid var(--line); background: var(--panel2); transition: transform .08s; }
.opt:hover { border-color: var(--torch); transform: translateY(-2px); }
.opt-icon canvas { width: 48px; height: 48px; display: block; }
.opt .kind { font-size: 10px; padding: 1px 5px; border-radius: 4px; background: #2e2436; color: var(--dim); }
.opt.k-skill { border-color: color-mix(in srgb, var(--tag) 55%, var(--line)); }
.opt.k-weapon { background: #261c16; border-color: #7a5a3a; }
.opt.k-weapon .kind { background: #5a3a1a; color: #ffd9a8; }
.opt.k-passive .kind { background: #3a2a4a; color: #e0ccff; }
.opt.k-heal .kind { background: #1e4a2a; color: #c8ffd4; }
.opt.fuse { border-color: var(--gold); box-shadow: 0 0 16px rgba(255, 215, 106, .35); background: linear-gradient(160deg, #3a2a12, var(--panel2)); }
.opt-pair { font-size: 11px !important; color: var(--dim) !important; }
.opt.paired { border-color: #c9a24a; border-style: dashed; }
.opt-link { font-size: 12px !important; color: #ffe29a !important; background: rgba(255, 215, 106, .1); border-radius: 6px; padding: 2px 6px; }
.opt-link small { color: var(--dim); }
.pick-build { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; align-items: center; margin-top: 10px; }
.pb-label { font-size: 10px; color: var(--dim); width: 100%; }
.pb-chip { position: relative; display: flex; align-items: center; gap: 4px; padding: 3px 7px 3px 3px; border-radius: 8px; border: 1px solid color-mix(in srgb, var(--tag, var(--line)) 60%, var(--line)); background: var(--panel2); text-align: left; }
.pb-chip canvas { width: 26px; height: 26px; }
.pb-txt { display: flex; flex-direction: column; font-size: 11px; line-height: 1.2; }
.pb-txt b { font-size: 11px; }
.pb-txt small { font-size: 10px; color: var(--dim); }
.pb-chip.fused { border-color: var(--gold); }
.pb-chip.hot { border: 1px dashed #ffd76a; box-shadow: 0 0 8px rgba(255, 215, 106, .45); }
.pb-marks { display: flex; gap: 2px; }
.pb-marks em { font-style: normal; font-family: var(--px); font-size: 11px; padding: 0 4px; border-radius: 4px; background: #2e2436; color: var(--dim); }
.pb-marks em.link { background: #4a3a10; color: #ffe29a; }
.opt-body { flex: 1; min-width: 0; }
.opt-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.opt-head b { font-size: 16px; }
.opt-body p { margin: 3px 0 0; font-size: 13px; color: #dccbbb; }
.opt-res { color: var(--gold) !important; font-size: 12px !important; }
.opt kbd { position: absolute; right: 8px; top: 6px; font-size: 10px; color: var(--dim); font-family: var(--px); }
.tag { font-size: 11px; padding: 0 6px; border-radius: 4px; color: var(--tag); border: 1px solid var(--tag); }
.lv { font-size: 11px; padding: 0 6px; border-radius: 4px; font-weight: 700; }
.lv.new { background: #2a6a3a; color: #c8ffd4; }
.lv.up { background: #6a4a1a; color: #ffe0a8; }
.lv.rare { background: #1f4a8a; color: #cfe3ff; }
.lv.epic { background: #5a2a8a; color: #ecd8ff; }
.stars { font-size: 34px; color: var(--gold); letter-spacing: 4px; margin: 6px 0; text-shadow: 0 0 10px rgba(255, 210, 90, .5); }
.result-box h2.lose { color: #c8b8c8; }
.hint { font-size: 13px; color: var(--dim); margin: 8px 0 0; }

.modal-box { text-align: left; position: relative; max-height: 86vh; overflow-y: auto; width: min(640px, 100%); }
.modal-box h2 { font-family: var(--px); color: var(--torch); margin: 0 0 8px; }
.close { position: sticky; float: right; top: 0; }
.help { padding-left: 4px; list-style: none; margin: 0; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.codex-tag { font-size: 14px; margin: 14px 0 6px; }
.codex-tag span { color: var(--tag); font-family: var(--px); }
.codex-tag small { font-size: 11px; font-weight: 400; }
.codex-list { display: flex; flex-direction: column; gap: 6px; }
.codex-card { display: flex; gap: 10px; padding: 8px; border-radius: 10px; background: var(--panel2); border-left: 3px solid var(--tag); }
.codex-card canvas { width: 36px; height: 36px; flex: none; }
.codex-card p { margin: 2px 0 0; font-size: 12px; color: var(--dim); }
.codex-card.unseen canvas { filter: brightness(0) opacity(.5); }

.loading { position: fixed; inset: 0; display: grid; place-items: center; font-family: var(--px); color: var(--torch); background: var(--bg); z-index: 60; }
.fatal { position: fixed; inset: 0; z-index: 70; background: rgba(0, 0, 0, .9); display: grid; place-items: center; padding: 20px; text-align: center; }
.fatal p { color: var(--dim); }

/* 무한 미궁 순위표 */
.endless-btns { display: flex; gap: 6px; flex: none; }
.btn.small { padding: 6px 10px; font-size: 12px; }
.rank-panel { margin-top: 10px; padding: 10px; border-radius: 10px; background: #1d1530; border: 1px solid #4a3a6a; font-size: 13px; }
.rank-panel p { margin: 2px 0 6px; }
.name-form { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin: 6px 0; }
.name-form input { flex: 1 1 160px; min-width: 0; max-width: 260px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; }
.name-form input:focus { outline: none; border-color: var(--torch); }
.name-err { flex-basis: 100%; color: var(--hp); font-size: 12px; }
.name-err:empty { display: none; }
.rank-list { display: flex; flex-direction: column; gap: 4px; margin: 8px 0 14px; }
.rank-list .sub { margin: 0 0 4px; }
.rank-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin: 8px 0 2px; }
.rank-tab { padding: 5px 10px; border-radius: 8px; border: 1px solid var(--line); background: transparent; color: var(--dim); font: inherit; font-size: 12px; cursor: pointer; }
.rank-tab:hover { color: var(--text); border-color: var(--dim); }
.rank-tab.on { color: var(--bg); background: var(--torch); border-color: var(--torch); }
/* 표처럼 칸을 맞춘다: 숫자는 고정 폭 글꼴·오른쪽 정렬 */
.rank-row { display: grid; gap: 6px; align-items: center; padding: 6px 10px; border-radius: 8px; background: var(--panel2); border: 1px solid var(--line); }
.rank-row.all { grid-template-columns: 30px minmax(0, 1fr) repeat(4, 38px) 46px; }
.rank-row.cls { grid-template-columns: 30px minmax(0, 1fr) 52px 56px; }
.rank-row.head { background: none; border-color: transparent; padding-top: 0; padding-bottom: 0; color: var(--dim); font-size: 12px; }
.rank-row.head span:first-child { text-align: center; }
.rank-row.me { border-color: var(--torch); box-shadow: inset 0 0 0 1px rgba(255, 176, 74, .35); }
.rank-no { font-family: var(--px); text-align: center; }
.rank-nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-v { text-align: right; font-family: var(--px); font-variant-numeric: tabular-nums; font-size: 13px; color: var(--text); }
.rank-row.head .rank-v { font-family: inherit; font-size: 13px; }
.rank-v.none { color: var(--line); }
.rank-v.best { color: var(--gold); }
.rank-sc { font-family: var(--px); color: var(--gold); text-align: right; font-variant-numeric: tabular-nums; }
.rank-row.head .rank-sc { font-family: inherit; color: var(--dim); }
/* 결과 화면 순위 칸의 직업별 최고 기록 */
.rank-splits { display: flex; flex-wrap: wrap; gap: 2px 10px; margin: 0; color: var(--dim); font-size: 12px; }
.rank-cls b { color: var(--text); font-family: var(--px); font-weight: normal; }
.rank-gap { text-align: center; color: var(--dim); line-height: 1; }
.rank-name h3 { margin: 0 0 4px; font-size: 14px; }
.rank-name .name-form { justify-content: flex-start; }
.rank-name .hint { margin: 2px 0 8px; }
@media (max-width: 420px) {
  .rank-row { padding: 6px 6px; gap: 4px; }
  .rank-row.all { grid-template-columns: 24px minmax(0, 1fr) repeat(4, 32px) 38px; }
  .rank-row.cls { grid-template-columns: 24px minmax(0, 1fr) 44px 50px; }
  .rank-v { font-size: 12px; }
  .endless { flex-wrap: wrap; }
}
