* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg0: #0a0720;
  --bg1: #160b32;
  --ink: #efe9ff;
  --sub: #b3a7d6;
  --gold: #ffd36b;
  --amethyst: #b388ff;
  --teal: #5be0c8;
  --rose: #ff7aa8;
  --danger: #ff5d6c;
  --line: rgba(179,136,255,.22);
}

html, body {
  height: 100%;
  background: radial-gradient(120% 90% at 50% -10%, #1d1147 0%, #0a0720 60%, #05030f 100%);
  color: var(--ink);
  font-family: "Pretendard", "Apple SD Gothic Neo", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: 44px; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 14px;
  background: linear-gradient(180deg, rgba(10,7,32,.92), rgba(10,7,32,0));
  font-size: 13px; letter-spacing: .3px; font-weight: 700;
}
.topbar .back { color: var(--amethyst); text-decoration: none; opacity: .92; }
.topbar .back:hover { opacity: 1; }
.topbar .brand { color: var(--ink); opacity: .92; font-size: 13px; text-shadow: 0 0 14px rgba(179,136,255,.4); }
.topbar .hs { color: var(--gold); font-size: 12px; }
.topbar .hs b { color: #fff0c4; }

#stage {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
}

canvas#game {
  display: block;
  border-radius: 16px;
  background: transparent;
  box-shadow: 0 24px 70px rgba(0,0,0,.6), 0 0 0 1px rgba(179,136,255,.16), inset 0 0 80px rgba(60,30,120,.25);
  touch-action: none;
}

.hint {
  position: fixed; bottom: 8px; left: 0; right: 0; text-align: center;
  font-size: 12px; color: var(--sub); z-index: 12; pointer-events: none;
  text-shadow: 0 1px 3px rgba(0,0,0,.7); transition: opacity .6s;
  padding: 0 18px; font-weight: 600;
}
.hint.hide { opacity: 0; }

/* ── 오버레이(메뉴/지도/보상/상점/야영/사건/종료) ── */
#overlay {
  position: fixed; inset: 0; z-index: 40;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(120% 90% at 50% 0%, rgba(40,22,86,.82), rgba(6,4,16,.93));
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  padding: 16px;
}
#overlay.hidden { display: none; }

.panel {
  width: min(460px, 96vw); max-height: 92vh; overflow-y: auto;
  background: linear-gradient(180deg, rgba(36,20,72,.96), rgba(18,10,40,.97));
  border: 1px solid var(--line); border-radius: 20px;
  padding: 20px 18px 22px;
  box-shadow: 0 24px 70px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.06);
  animation: pop .28s cubic-bezier(.22,1.2,.4,1);
}
@keyframes pop { from { transform: scale(.94) translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.panel::-webkit-scrollbar { width: 8px; }
.panel::-webkit-scrollbar-thumb { background: rgba(179,136,255,.3); border-radius: 8px; }

.panel h1 {
  font-size: 30px; letter-spacing: -.4px; text-align: center;
  background: linear-gradient(180deg, #fff, var(--amethyst));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  text-shadow: 0 0 30px rgba(179,136,255,.3);
}
.panel h2 {
  font-size: 20px; letter-spacing: .2px; color: var(--amethyst);
  display: flex; align-items: center; gap: 8px; margin-bottom: 4px;
}
.panel .sub { font-size: 13px; color: var(--sub); margin: 6px 0 14px; line-height: 1.6; text-align: center; }
.panel .lead { font-size: 13px; color: var(--sub); margin-bottom: 12px; line-height: 1.6; }

.statbar {
  display: flex; gap: 8px; margin: 4px 0 14px; flex-wrap: wrap; justify-content: center;
}
.pill {
  background: rgba(179,136,255,.1); border: 1px solid var(--line);
  border-radius: 999px; padding: 5px 11px; font-size: 12px; font-weight: 800; color: var(--ink);
}
.pill .k { color: var(--sub); font-weight: 700; margin-right: 4px; }
.pill.hp { color: var(--teal); }
.pill.gold { color: var(--gold); }
.pill.pow { color: var(--rose); }

.relics { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-bottom: 6px; }
.relic-chip {
  display: flex; align-items: center; gap: 5px;
  background: rgba(255,211,107,.08); border: 1px solid rgba(255,211,107,.25);
  border-radius: 10px; padding: 4px 8px; font-size: 11px; color: var(--gold); font-weight: 700;
}

.choices { display: grid; gap: 11px; margin-top: 6px; }
.choice {
  display: flex; align-items: center; gap: 13px; text-align: left;
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08);
  border-radius: 15px; padding: 14px 15px; cursor: pointer; width: 100%;
  transition: transform .12s, border-color .2s, background .2s;
  color: var(--ink);
}
.choice:hover { transform: translateY(-2px); border-color: var(--amethyst); background: rgba(179,136,255,.1); }
.choice:active { transform: translateY(0); }
.choice .ico {
  width: 46px; height: 46px; flex: 0 0 auto; border-radius: 13px;
  display: flex; align-items: center; justify-content: center; font-size: 25px;
  background: radial-gradient(circle at 35% 30%, rgba(255,255,255,.16), rgba(0,0,0,.25));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}
.choice .info { flex: 1; min-width: 0; }
.choice .nm { font-size: 15px; font-weight: 800; display: flex; align-items: center; gap: 7px; }
.choice .ds { font-size: 11.5px; color: var(--sub); margin-top: 3px; line-height: 1.45; }
.choice .price { flex: 0 0 auto; font-size: 13px; font-weight: 800; color: var(--gold); }
.choice.dim { opacity: .45; cursor: default; }
.choice.dim:hover { transform: none; border-color: rgba(255,255,255,.08); background: rgba(255,255,255,.04); }

.tag { font-size: 10px; font-weight: 800; padding: 2px 7px; border-radius: 999px; text-transform: uppercase; letter-spacing: .4px; }
.tag.rare { background: rgba(91,224,200,.16); color: var(--teal); }
.tag.epic { background: rgba(255,122,168,.16); color: var(--rose); }

.btn {
  display: block; width: 100%; margin-top: 14px; border: none; border-radius: 15px; padding: 15px;
  font-size: 17px; font-weight: 900; letter-spacing: .4px; cursor: pointer; font-family: inherit;
  background: linear-gradient(180deg, #c69bff, #8a5cf0); color: #150633;
  box-shadow: 0 5px 0 #5a32b0, 0 8px 24px rgba(138,92,240,.4);
}
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #5a32b0; }
.btn.ghost {
  background: rgba(255,255,255,.06); color: var(--ink); box-shadow: 0 4px 0 rgba(0,0,0,.3);
  border: 1px solid var(--line); font-size: 14px; padding: 12px;
}
.btn.gold { background: linear-gradient(180deg, #ffe08a, #f0b53c); color: #3a2400; box-shadow: 0 5px 0 #a9760f, 0 8px 24px rgba(240,181,60,.35); }
.btn.danger { background: linear-gradient(180deg, #ff8a93, #ec4b5a); color: #3a0008; box-shadow: 0 5px 0 #9e2230; }

/* ── 막 지도(미니맵) ── */
.mapwrap { width: 100%; display: flex; justify-content: center; margin: 10px 0 4px; overflow-x: auto; }
.mapwrap svg { max-width: 100%; height: auto; display: block; }
.mapwrap svg g[data-action] { transition: opacity .15s; }
.mapwrap svg g[data-action]:hover { opacity: .85; }

.bigicon { font-size: 56px; text-align: center; margin: 4px 0 2px; filter: drop-shadow(0 0 22px rgba(179,136,255,.5)); }
.center { text-align: center; }
.mini { font-size: 11px; color: var(--sub); text-align: center; margin-top: 10px; line-height: 1.6; }
.divider { height: 1px; background: var(--line); margin: 14px 0; }

@media (max-width: 560px) {
  .topbar .brand { display: none; }
}
