/* =========================================================
   NEON LUKE — 모바일 우선 스타일
   - 스크롤/줌/텍스트 선택/롱프레스 메뉴 차단
   - safe-area(노치) 대응
   ========================================================= */
:root {
  --pad-fit: 1; --nf-r: 0px; --nf-l: 0px;   /* 작은 화면 자동 축소 / 호스팅 배지(Powered by Netlify) 자리 */
  --bg: #0d0b14;
  --panel: rgba(20, 16, 30, 0.92);
  --panel-line: rgba(255, 255, 255, 0.12);
  --text: #f4ecdf;
  --muted: #b5a99a;
  --red: #e8343f;
  --red-dark: #9e1e28;
  --gold: #ffd25a;
  --hp: #e8463f;
  --exp: #5ad1ff;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --pad-scale: 1; --joy-scale: 1; --pad-opacity: 1;   /* 설정: 버튼 크기 / 조이스틱 크기 / 버튼 불투명도 */
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  width: 100%; height: 100%;
  overflow: hidden;
  position: fixed; inset: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", "Segoe UI", sans-serif;
  /* 터치 방해 요소 제거 */
  touch-action: none;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

#app { position: fixed; inset: 0; overflow: hidden; }

canvas#game {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  display: block;
  touch-action: none;
}

button {
  font: inherit; color: inherit;
  border: none; background: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}

.hidden { display: none !important; }

/* ───────────── HUD ───────────── */
#hud {
  position: absolute;
  top: calc(var(--sat) + 6px);
  left: calc(var(--sal) + 8px);
  right: calc(var(--sar) + 8px);
  display: flex; justify-content: space-between; align-items: flex-start;
  pointer-events: none;
  z-index: 10;
}
.hud-left {
  pointer-events: none;
  background: rgba(10, 8, 18, 0.55);
  border: 1px solid var(--panel-line);
  border-radius: 10px;
  padding: 6px 8px 5px;
  width: min(54vw, 230px);
  backdrop-filter: blur(2px);
}
.hud-row { display: flex; align-items: center; gap: 6px; }
.hud-row.small { font-size: 11px; margin-top: 3px; justify-content: space-between; }
.lv {
  font-size: 12px; font-weight: 800; color: var(--gold);
  min-width: 34px; letter-spacing: .3px;
}
.bar {
  position: relative; flex: 1;
  height: 12px; border-radius: 6px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.15);
  overflow: hidden;
}
.bar .fill { position: absolute; left: 0; top: 0; bottom: 0; width: 100%; transition: width .15s; }
.bar.hp .fill { background: linear-gradient(#ff6a5a, #c8262c); }
.bar.hp.low .fill { animation: lowhp .6s infinite alternate; }
@keyframes lowhp { to { filter: brightness(1.6); } }
.bar.exp { height: 4px; margin-top: 3px; border-radius: 2px; border: none; }
.bar.exp .fill { background: var(--exp); }
.bar-text {
  position: absolute; inset: 0;
  font-size: 10px; line-height: 11px; text-align: center; font-weight: 700;
  text-shadow: 0 1px 1px #000;
}
.gold { display: inline-flex; align-items: center; gap: 4px; color: var(--gold); font-weight: 700; }
.coin { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff3b0, #f0b030 60%, #a8701a); }
.zone { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quest {
  margin-top: 3px; font-size: 11px; color: #ffe9b0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.quest::before { content: "▶ "; color: var(--red); }

.hud-right { display: flex; flex-direction: column; gap: 4px; pointer-events: auto; }
.hud-btn {
  position: relative;
  width: 42px; height: 40px; border-radius: 10px;
  background: rgba(10, 8, 18, 0.6);
  border: 1px solid var(--panel-line);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
}
.hud-btn[hidden] { display: none; }
.hud-btn.casting { background: rgba(60, 140, 255, .45); border-color: #7ab4ff; }
.hud-btn small { font-size: 10px; color: var(--muted); line-height: 1; }
.hud-btn .hb { font-size: 16px; font-weight: 900; line-height: 1; color: var(--text); }
.hud-btn.dot::after {
  content: ""; position: absolute; top: 3px; right: 3px; width: 9px; height: 9px;
  border-radius: 50%; background: #ff3a3a; border: 1.5px solid #fff; animation: blink 1s infinite;
}
.hud-btn svg { width: 17px; height: 17px; fill: var(--text); }
.hud-btn:active { transform: scale(.92); background: rgba(232, 52, 63, .5); }
.hud-btn .snd-off { display: none; }
body.muted .hud-btn .snd-on { display: none; }
body.muted .hud-btn .snd-off { display: block; }

/* 보스 체력바 */
#boss-bar {
  position: absolute; left: 50%; transform: translateX(-50%);
  top: calc(var(--sat) + 96px);
  width: min(80vw, 420px); z-index: 9; pointer-events: none;
  text-align: center;
}
.boss-name { font-size: 12px; font-weight: 800; color: #ffb0a0; text-shadow: 0 1px 2px #000; margin-bottom: 3px; letter-spacing: 1px; }
.bar.boss { height: 10px; }
.bar.boss .fill { background: linear-gradient(#c060ff, #7a20b0); }

/* 토스트 / 배너 */
#toast {
  position: absolute; left: 50%; top: calc(var(--sat) + 128px);
  transform: translate(-50%, -6px);
  background: rgba(10, 8, 18, 0.85); border: 1px solid var(--panel-line);
  padding: 7px 14px; border-radius: 18px; font-size: 13px;
  opacity: 0; transition: opacity .2s, transform .2s;
  pointer-events: none; z-index: 30; max-width: 86vw; text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

#banner {
  position: absolute; left: 0; right: 0; top: 34%;
  text-align: center; pointer-events: none; z-index: 25; opacity: 0;
}
#banner.show { animation: banner 2.4s ease forwards; }
@keyframes banner {
  0% { opacity: 0; transform: translateY(8px) scale(.96); }
  12% { opacity: 1; transform: none; }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-6px); }
}
.banner-sub { font-size: 12px; letter-spacing: 4px; color: var(--muted); }
.banner-main {
  font-size: clamp(22px, 6vw, 34px); font-weight: 900; letter-spacing: 2px;
  color: #fff; text-shadow: 0 0 12px rgba(232, 52, 63, .8), 0 2px 3px #000;
}
#banner.gold .banner-main { color: #fff3c0; text-shadow: 0 0 14px rgba(255, 200, 60, .9), 0 2px 3px #000; }
#banner.boss .banner-main { color: #ffd0f0; text-shadow: 0 0 14px rgba(190, 80, 255, .9), 0 2px 3px #000; }

/* ───────────── 터치 컨트롤 ───────────── */
#controls { position: absolute; inset: 0; z-index: 8; pointer-events: none; }
#joy-zone {
  position: absolute; left: 0; bottom: 0;
  width: 55%; height: 68%;
  pointer-events: auto; touch-action: none;
}
#joy-base {
  position: absolute;
  left: calc(var(--sal) + 26px); bottom: calc(var(--sab) + 26px + var(--nf-l));
  width: calc(124px * var(--joy-scale)); height: calc(124px * var(--joy-scale)); border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.06), rgba(255,255,255,.12));
  border: 2px solid rgba(255, 255, 255, 0.18);
  opacity: .55; transition: opacity .15s;
}
#joy-base.active { opacity: 1; transition: none; }
#joy-knob {
  position: absolute; left: 50%; top: 50%;
  width: calc(54px * var(--joy-scale)); height: calc(54px * var(--joy-scale));
  margin: calc(-27px * var(--joy-scale)) 0 0 calc(-27px * var(--joy-scale)); border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #ff8a8a, var(--red) 55%, var(--red-dark));
  box-shadow: 0 2px 8px rgba(0,0,0,.5);
}

#action-pad {
  position: absolute;
  right: calc(var(--sar) + 14px); bottom: calc(var(--sab) + 18px + var(--nf-r));
  width: 232px; height: 172px; pointer-events: none;
  transform: scale(calc(var(--pad-scale) * var(--pad-fit))); transform-origin: bottom right; opacity: var(--pad-opacity);
}
.act-btn {
  position: absolute; pointer-events: auto; touch-action: none;
  border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(circle at 40% 30%, rgba(255,255,255,.22), rgba(20,16,30,.72) 70%);
  border: 2px solid rgba(255, 255, 255, 0.28);
  box-shadow: 0 3px 10px rgba(0,0,0,.45);
  color: #fff; overflow: hidden;
}
.act-btn .ico { font-size: 24px; line-height: 1; font-weight: 900; }
.act-btn .lbl { font-size: 11px; margin-top: 2px; font-weight: 700; opacity: .9; position: relative; }
.act-btn.down { transform: scale(.9); filter: brightness(1.35); }
.act-btn.attack {
  right: 0; bottom: 0; width: 92px; height: 92px;
  background: radial-gradient(circle at 40% 30%, #ff8070, var(--red) 55%, #6e1018);
  border-color: rgba(255, 210, 200, 0.55);
}
.act-btn.attack .ico { font-size: 32px; }
.act-btn.attack.talk { background: radial-gradient(circle at 40% 30%, #ffe08a, #e0a020 55%, #7a5010); }
.act-btn.dash { right: 104px; bottom: 2px; width: 68px; height: 68px; }
.act-btn.dash .ico { font-size: 28px; }
.act-btn.skill {
  right: 88px; bottom: 82px; width: 64px; height: 64px;
  background: radial-gradient(circle at 40% 30%, #d8a8ff, #7a3ac0 60%, #2e1050);
  border-color: rgba(230, 200, 255, .5);
}
.act-btn.skill .ico { font-size: 24px; }
.act-btn.skill2, .act-btn.skill3 {
  width: 54px; height: 54px;
  background: radial-gradient(circle at 40% 30%, #ffd08a, #c0702a 60%, #4a2410);
  border-color: rgba(255, 220, 180, .5);
}
.act-btn.skill2 { right: 163px; bottom: 103px; }
.act-btn.skill3 { right: 173px; bottom: 35px; }
.act-btn.skill2 .ico, .act-btn.skill3 .ico { font-size: 20px; }
.act-btn.skill2 .lbl, .act-btn.skill3 .lbl { font-size: 9px; max-width: 48px; text-align: center; line-height: 1.05; margin-top: 1px; }
.act-btn.hidden { display: none; }
.act-btn.potion {
  right: 8px; bottom: 104px; width: 56px; height: 56px;
  background: radial-gradient(circle at 40% 30%, #9af0a0, #2f9a4a 60%, #12401e);
}
.act-btn.potion .ico { font-size: 20px; }
.act-btn.potion.empty { filter: grayscale(1) brightness(.6); }
.act-btn .cd {
  position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(rgba(0,0,0,.6) var(--cd, 0%), transparent 0);
  pointer-events: none;
}

/* ───────────── 대화창 ───────────── */
#dialog {
  position: absolute; inset: 0; z-index: 20;
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0 calc(var(--sar) + 10px) calc(var(--sab) + 14px) calc(var(--sal) + 10px);
  background: linear-gradient(transparent 55%, rgba(0,0,0,.35));
}
.dlg-box {
  position: relative;
  width: 100%; max-width: 640px; min-height: 108px;
  background: var(--panel);
  border: 2px solid rgba(232, 52, 63, .55);
  border-radius: 14px;
  padding: 12px 16px 22px;
  box-shadow: 0 6px 24px rgba(0,0,0,.6);
}
.dlg-name {
  position: absolute; top: -13px; left: 14px;
  background: var(--red); color: #fff;
  font-size: 12px; font-weight: 800; padding: 3px 10px; border-radius: 10px;
}
.dlg-name:empty { display: none; }
.dlg-text { font-size: 15px; line-height: 1.6; white-space: pre-wrap; word-break: keep-all; }
.dlg-text.narration { color: #d8cfe8; font-style: italic; }
.dlg-next { position: absolute; right: 14px; bottom: 6px; font-size: 11px; color: var(--muted); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }

/* ───────────── 오버레이/메뉴 ───────────── */
.overlay {
  position: absolute; inset: 0; z-index: 40;
  display: flex; align-items: center; justify-content: center;
  background: rgba(5, 4, 10, 0.6);
  padding: calc(var(--sat) + 10px) calc(var(--sar) + 10px) calc(var(--sab) + 10px) calc(var(--sal) + 10px);
}
.panel {
  width: 100%; max-width: 520px; max-height: 100%;
  display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--panel-line);
  border-radius: 16px; overflow: hidden;
  box-shadow: 0 10px 40px rgba(0,0,0,.6);
}
.tabs { flex: none; display: flex; border-bottom: 1px solid var(--panel-line); overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: 1 0 auto; min-width: 42px; padding: 12px 6px; font-size: 14px; font-weight: 700; color: var(--muted); }
.tab.on { color: #fff; box-shadow: inset 0 -3px 0 var(--red); }
.close { flex: none; width: 48px; font-size: 18px; color: var(--muted); position: sticky; right: 0; background: var(--panel, #181422); }
#menu-body {
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  touch-action: pan-y; overscroll-behavior: contain;
  padding: 12px; flex: 1;
}
.sec-title { font-size: 12px; color: var(--muted); margin: 10px 2px 6px; letter-spacing: 1px; }
.sec-title:first-child { margin-top: 0; }
.stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
}
.stat { background: rgba(255,255,255,.05); border-radius: 8px; padding: 6px 8px; }
.stat .k { font-size: 11px; color: var(--muted); }
.stat .v { font-size: 15px; font-weight: 800; }
.card {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,.05); border: 1px solid transparent;
  border-radius: 10px; padding: 8px 10px; margin-bottom: 6px;
}
.card.equipped { border-color: rgba(232, 52, 63, .7); background: rgba(232, 52, 63, .12); }
.card .sw { width: 34px; height: 34px; border-radius: 8px; flex: none; display: grid; place-items: center; }
.card .sw canvas { width: 34px; height: 34px; }
.card .info { flex: 1; min-width: 0; }
.card .nm { font-size: 14px; font-weight: 800; }
.card .ds { font-size: 11px; color: var(--muted); margin-top: 2px; line-height: 1.35; }
.card .st { font-size: 11px; color: #9fe0ff; margin-top: 2px; }
.card .st .up { color: #8af08a; } .card .st .dn { color: #ff8a8a; }
.sbtn {
  flex: none; min-width: 66px; min-height: 40px; padding: 9px 12px; border-radius: 9px;   /* 손가락으로 누르기 편한 최소 40px */
  background: var(--red); color: #fff; font-size: 13px; font-weight: 800;
}
.sbtn:disabled { background: #3a3444; color: #8a8090; }
.sbtn.ghost { background: rgba(255,255,255,.1); }
.sbtn.wide { width: 100%; min-height: 46px; padding: 12px; font-size: 14px; margin-bottom: 8px; }
.note { font-size: 12px; color: var(--muted); line-height: 1.6; padding: 4px 2px; }
.price { color: var(--gold); font-weight: 800; }

/* 타이틀 등 전체 화면 */
.screen { background: radial-gradient(ellipse at 50% 40%, rgba(40, 10, 20, 0.55), rgba(5, 4, 10, 0.92)); }
.title-wrap { text-align: center; max-width: 520px; width: 100%; }
.title-sub { font-size: 12px; letter-spacing: 5px; color: var(--muted); }
.logo {
  margin: 6px 0 0; font-size: clamp(44px, 14vw, 76px); font-weight: 900; letter-spacing: 4px; line-height: 1;
  color: #fff; text-shadow: 0 0 18px rgba(90, 209, 255, .65), 0 3px 0 #2a1030;
}
.logo span { color: var(--red); text-shadow: 0 0 18px rgba(232, 52, 63, .9), 0 3px 0 #2a1030; }
.title-tag { margin-top: 8px; font-size: 15px; color: #ffd8c8; letter-spacing: 3px; }
.title-btns { display: flex; flex-direction: column; gap: 10px; align-items: center; margin: 26px 0 18px; }
.big-btn {
  width: min(72vw, 280px); padding: 14px; border-radius: 12px;
  background: rgba(255,255,255,.1); border: 1px solid var(--panel-line);
  font-size: 16px; font-weight: 800;
}
.big-btn.primary { background: linear-gradient(#f04a52, #b0202a); border-color: rgba(255,200,200,.4); }
.big-btn:disabled { opacity: .35; }
.big-btn:active { transform: scale(.97); }
.title-help { font-size: 11px; color: var(--muted); line-height: 1.8; }
.title-ver { margin-top: 12px; font-size: 10px; color: #6a6070; }
.dead-title { font-size: 34px; margin: 0 0 8px; color: #ff8a8a; }
.clear-title { font-size: 26px; margin: 8px 0 12px; color: #fff3c0; text-shadow: 0 0 14px rgba(255,200,60,.7); }
.dead-msg { color: var(--muted); font-size: 13px; line-height: 1.7; margin-bottom: 20px; }
.clear-stats { display: inline-grid; grid-template-columns: auto auto; gap: 4px 18px; font-size: 13px; text-align: left; }
.clear-stats b { color: var(--gold); }

#fade {
  position: absolute; inset: 0; background: #000;
  opacity: 0; pointer-events: none; z-index: 50;
  transition: opacity .28s;
}
#fade.on { opacity: 1; }

/* 대화·메뉴 중엔 컨트롤 숨김 */
body.ui-lock #controls { opacity: 0; pointer-events: none; }
body.ui-lock #controls * { pointer-events: none !important; }

/* 가로 모드 / 낮은 화면 */
@media (max-height: 430px) {
  .hud-left { width: min(40vw, 230px); }
  .hud-right { flex-direction: row; align-items: flex-start; gap: 5px; }   /* 가로 화면: 세로 공간을 조작 버튼에 양보 */
  #boss-bar { top: calc(var(--sat) + 8px); width: min(36vw, 320px); }
  #toast { top: calc(var(--sat) + 52px); }
  #joy-zone { height: 80%; width: 50%; }
  #joy-base { width: calc(110px * var(--joy-scale)); height: calc(110px * var(--joy-scale)); left: calc(var(--sal) + 30px); bottom: calc(var(--sab) + 16px + var(--nf-l)); }
  #action-pad { bottom: calc(var(--sab) + 10px + var(--nf-r)); right: calc(var(--sar) + 20px); }
  .title-btns { flex-direction: row; justify-content: center; margin: 16px 0 10px; }
  .big-btn { width: min(40vw, 220px); padding: 11px; }
  .logo { font-size: 48px; }
  .dlg-box { min-height: 84px; padding: 10px 14px 18px; }
  .dlg-text { font-size: 14px; line-height: 1.5; }
}
@media (min-width: 900px) and (min-height: 600px) {
  .hud-left { width: 260px; }
}

/* ───────────── 추가 UI (선택지 / 메뉴 세부) ───────────── */
.dlg-choices { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.dlg-choices:empty { display: none; }
.dlg-choice {
  padding: 11px 12px; border-radius: 10px; text-align: left; font-size: 14px; font-weight: 700;
  background: rgba(255,255,255,.09); border: 1px solid rgba(255,255,255,.18);
}
.dlg-choice:active { background: rgba(232, 52, 63, .55); }
#dialog .dlg-box { padding-bottom: 14px; }

.tabs { align-items: stretch; }
.tab { white-space: nowrap; }
.npchead {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  background: rgba(255,255,255,.06); border-radius: 10px; padding: 8px 10px; margin-bottom: 10px; font-size: 13px;
}
.npchead span { color: var(--muted); font-size: 11px; }
.npchead .gold-r { margin-left: auto; color: var(--gold); font-weight: 800; font-size: 12px; }
.up { color: #8af08a; } .dn { color: #ff8a8a; }
.strow {
  display: grid; grid-template-columns: 56px 34px 1fr auto; align-items: center; gap: 6px;
  background: rgba(255,255,255,.05); border-radius: 10px; padding: 6px 8px; margin-bottom: 5px;
}
.strow .sn { font-weight: 800; font-size: 14px; line-height: 1.1; }
.strow .sn small { display: block; font-size: 10px; opacity: .7; }
.strow .sv { font-size: 18px; font-weight: 900; text-align: right; }
.strow .sd { font-size: 11px; color: var(--muted); line-height: 1.3; }
.strow .sb { display: flex; gap: 4px; }
.strow .sb .sbtn { min-width: 42px; padding: 8px 6px; }
.sbs { display: flex; flex-direction: column; gap: 6px; }
.sbtn.warn { background: #c8201e; animation: blink 1s infinite; }
.card.dim { opacity: .55; }
.card .nm small { font-size: 10px; font-weight: 600; color: var(--muted); margin-left: 4px; }
.card .sw { width: 30px; height: 30px; border-radius: 8px; border: 1px solid rgba(255,255,255,.3); flex: none; }
.pbar { height: 6px; border-radius: 3px; background: rgba(255,255,255,.12); overflow: hidden; margin-top: 6px; }
.pbar.sm { height: 5px; margin: 4px 0; }
.pbar i { display: block; height: 100%; background: linear-gradient(90deg, #ffb43c, #ffe27a); }
.actbox { background: rgba(232,52,63,.1); border: 1px solid rgba(232,52,63,.45); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; }
.actbox .actn { font-size: 10px; letter-spacing: 2px; color: #ffb0a0; }
.actbox .actt { font-size: 16px; font-weight: 900; margin: 2px 0; }
.actbox .acts { font-size: 11px; color: var(--muted); }
.warnbox { background: rgba(255,170,40,.12); border: 1px solid rgba(255,170,40,.5); border-radius: 10px; padding: 9px 11px; font-size: 12px; line-height: 1.6; margin-bottom: 8px; }
.actrow { display: grid; grid-template-columns: 48px 1fr auto; grid-template-areas: "a n s" "a i s"; gap: 0 8px; align-items: center; background: rgba(255,255,255,.04); border-radius: 8px; padding: 6px 8px; margin-bottom: 4px; }
.actrow b { grid-area: a; font-size: 11px; color: var(--gold); }
.actrow .an { grid-area: n; font-size: 12px; font-weight: 700; }
.actrow .ai { grid-area: i; font-size: 10px; color: var(--muted); }
.actrow .as { grid-area: s; font-size: 11px; font-weight: 800; }
.actrow.now { border: 1px solid rgba(232,52,63,.6); background: rgba(232,52,63,.1); }
.actrow.clear .as { color: #8af08a; }
.actrow.lock { opacity: .55; }
.grades { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 4px; font-size: 11px; font-weight: 700; }

/* ───────────── 전직 UI ───────────── */
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 5px 0 2px; }
.chip { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 9px; background: rgba(255,255,255,.09); color: #d8ecff; }
.conds { list-style: none; margin: 6px 0 0; padding: 0; font-size: 11px; line-height: 1.55; }
.conds .ok { color: #8af08a; } .conds .ng { color: #ff9a9a; }
.jobcard { align-items: flex-start; border: 1px solid; }
.jobcard .sbtn { align-self: center; }
.act-btn.skill .lbl { font-size: 10px; max-width: 58px; text-align: center; line-height: 1.1; }

/* ───────────── 조작 설정: 왼손잡이 배치 / 미리보기 / 슬라이더 ───────────── */
body.lefty #joy-zone { left: auto; right: 0; }
body.lefty #joy-base { left: auto; right: calc(var(--sar) + 26px); }
body.lefty #action-pad { right: auto; left: calc(var(--sal) + 14px); transform-origin: bottom left; }
body.lefty .act-btn.attack { right: auto; left: 0; }
body.lefty .act-btn.dash { right: auto; left: 104px; }
body.lefty .act-btn.skill { right: auto; left: 88px; }
body.lefty .act-btn.potion { right: auto; left: 8px; }
body.lefty .act-btn.skill2 { right: auto; left: 163px; }
body.lefty .act-btn.skill3 { right: auto; left: 173px; }
@media (max-height: 430px) {
  body.lefty #joy-base { right: calc(var(--sar) + 30px); }
  body.lefty #action-pad { left: calc(var(--sal) + 20px); }
}
/* 슬라이더를 움직이는 동안 패널을 거의 투명하게 해서 뒤의 조작 UI를 보여 준다 */
#menu { transition: opacity .15s; }
body.ui-peek #menu { opacity: .1; }
body.ui-peek.ui-lock #controls { opacity: 1; }
.rng { display: grid; grid-template-columns: 92px 1fr 44px; align-items: center; gap: 8px; margin: 4px 0; font-size: 12px; }
.rng b { text-align: right; font-size: 12px; }
.rng input[type=range] { width: 100%; height: 40px; accent-color: var(--red); touch-action: pan-y; }   /* 터치하기 쉬운 높이 */
.setgroup { background: rgba(255,255,255,.04); border-radius: 10px; padding: 8px 10px; margin-bottom: 8px; }

/* ───────────── 광고·후원·링크 ───────────── */
.title-links { margin-top: 10px; display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; font-size: 11px; }
.title-links a, .ad-note a { color: #9ab0d0; text-decoration: underline; }
.title-links a[hidden], .big-btn[hidden], .ad-note[hidden], .title-games[hidden], .lang-btn[hidden] { display: none; }
.lang-btn { background: none; border: 1px solid rgba(154, 176, 208, .45); color: #bcd0ea; border-radius: 999px; padding: 4px 12px; min-height: 40px; font-size: 12px; cursor: pointer; }
.title-games { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: center; margin-top: 12px; min-height: 40px; padding: 6px 16px; border-radius: 999px; border: 1px solid rgba(255, 210, 74, .55); background: rgba(255, 210, 74, .08); color: #ffe9b0; font-size: 13px; font-weight: 700; text-decoration: none; }
.title-games small { font-weight: 400; font-size: 11px; color: #cdbf9a; }
.title-games:active { background: rgba(255, 210, 74, .2); }
.ad-note { font-size: 10px; color: var(--muted); line-height: 1.6; margin: 8px 0 0; }
#dead .big-btn + .big-btn { margin-top: 10px; }
a.sbtn { display: block; text-align: center; text-decoration: none; }
.adcard { border: 1px dashed rgba(255,210,120,.5); }

/* ───────────── 캐릭터 만들기 ───────────── */
.create-wrap { width: 100%; max-width: 520px; max-height: 100%; overflow-y: auto; text-align: left; padding: 4px 2px; touch-action: pan-y; -webkit-overflow-scrolling: touch; }
.create-title { margin: 0 0 6px; text-align: center; font-size: 22px; letter-spacing: 2px; color: #fff; text-shadow: 0 0 14px rgba(232,52,63,.6); }
.create-top { display: flex; gap: 10px; align-items: center; }
#create-preview { width: 38vw; max-width: 170px; aspect-ratio: 1; flex: none; border-radius: 14px; background: rgba(255,255,255,.05); border: 1px solid var(--panel-line); }
.create-side { flex: 1; min-width: 0; }
.create-lbl { font-size: 11px; color: var(--muted); margin: 8px 0 4px; letter-spacing: 1px; }
#create-name { width: 100%; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--panel-line); background: rgba(255,255,255,.08); color: #fff; font-size: 16px; font-weight: 700; outline: none; touch-action: manipulation; -webkit-user-select: text; user-select: text; }
#create-name:focus { border-color: var(--red); }
.seg { display: flex; gap: 6px; }
.seg button { flex: 1; padding: 10px 4px; border-radius: 10px; background: rgba(255,255,255,.08); border: 1px solid var(--panel-line); font-size: 14px; font-weight: 800; color: var(--muted); }
.seg button.on { background: linear-gradient(#f04a52, #b0202a); color: #fff; border-color: rgba(255,200,200,.4); }
.cls-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.cls-btn { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 9px 2px 7px; border-radius: 12px; background: rgba(255,255,255,.07); border: 2px solid transparent; color: var(--text); }
.cls-btn .ci { font-size: 20px; line-height: 1; color: var(--c); }
.cls-btn b { font-size: 14px; }
.cls-btn small { font-size: 10px; color: var(--muted); }
.cls-btn.on { border-color: var(--c); background: rgba(255,255,255,.14); box-shadow: 0 0 14px -2px var(--c); }
.create-info { margin-top: 8px; padding: 10px 12px; border-radius: 12px; background: rgba(255,255,255,.06); border: 1px solid var(--panel-line); }
.ci-name { font-size: 16px; font-weight: 900; } .ci-name small { font-size: 10px; color: var(--muted); font-weight: 600; margin-left: 4px; }
.ci-desc { font-size: 12px; line-height: 1.55; margin: 4px 0 6px; color: #e6dccc; }
.ci-path { font-size: 11px; color: var(--muted); margin-top: 7px; line-height: 1.6; } .ci-path b { color: #ffd8c8; }
.create-btns { display: flex; gap: 8px; margin-top: 10px; justify-content: center; }
.create-btns .big-btn { width: auto; flex: 1; max-width: 220px; padding: 13px 8px; }
@media (orientation: landscape) and (max-height: 520px) {
  .create-title { font-size: 17px; margin-bottom: 2px; }
  #create-preview { width: 22vw; max-width: 120px; }
  .create-info { margin-top: 4px; padding: 6px 10px; }
  .ci-desc { margin: 2px 0 4px; }
}

.tab .tdot { color: #ffd23a; font-style: normal; font-size: 9px; vertical-align: super; }

/* 무료 호스팅이 화면 오른쪽 아래에 붙이는 배지(Powered by Netlify)와 조작 버튼이 겹치지 않게, 배지가 있는 쪽 컨트롤을 위로 올린다 */
body.nf-badge { --nf-r: 58px; --nf-l: 0px; }
body.nf-badge.lefty { --nf-r: 58px; --nf-l: 58px; }   /* 왼손잡이: 오른쪽엔 조이스틱, 폭이 넓은 버튼 묶음도 배지 폭에 걸릴 수 있어 둘 다 올린다 */

/* 조합/제작 재료 칩 */
.chip.chip-ok { background: rgba(111, 224, 138, .16); color: #aef0be; }
.chip.chip-ng { background: rgba(255, 120, 120, .14); color: #ffb0b0; }
.card .chips { margin: 5px 0 3px; display: flex; gap: 4px; flex-wrap: wrap; }

/* 버프 표시 */
.buffs { display: flex; gap: 4px; margin-top: 3px; min-height: 0; }
.buffs span { display: inline-flex; align-items: center; gap: 2px; padding: 1px 5px; border-radius: 9px; font-size: 10px; font-weight: 800; color: var(--c); background: rgba(255,255,255,.1); border: 1px solid var(--c); }
.buffs i { font-style: normal; color: #fff; font-weight: 700; }

/* 동작 줄이기: 계속 깜박이는 장식 애니메이션을 끈다 (배너 등 1회성 안내는 유지) */
@media (prefers-reduced-motion: reduce) {
  .sbtn.warn, .hud-btn.dot::after { animation: none; }
}

/* 저장 코드 입력/출력 */
.codebox { width: 100%; margin: 4px 0 8px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--panel-line); background: rgba(255,255,255,.07); color: #e8e0d0; font: 11px/1.4 ui-monospace, Menlo, Consolas, monospace; word-break: break-all; resize: vertical; touch-action: manipulation; -webkit-user-select: text; user-select: text; }

/* 패치 노트 */
.plist { margin: 6px 0 2px; padding-left: 18px; font-size: 12px; line-height: 1.6; color: #e6dccc; }
.plist li { margin-bottom: 3px; }

/* ── 스킬 아이콘 (인라인 SVG) ── */
.skg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, .65)); }
.act-btn .ico:has(.skg) { display: block; width: 26px; height: 26px; font-size: 0; }
.act-btn.skill2 .ico:has(.skg), .act-btn.skill3 .ico:has(.skg) { width: 22px; height: 22px; }
.skico {
  --c: #7a8aa0;
  flex: none; width: 38px; height: 38px; border-radius: 10px; padding: 7px; display: block; position: relative;
  background: var(--c);
  background: radial-gradient(circle at 30% 22%, color-mix(in srgb, var(--c) 45%, #fff) 0%, var(--c) 48%, color-mix(in srgb, var(--c) 45%, #000) 100%);
  border: 1px solid rgba(255, 255, 255, .45);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .4), 0 0 9px color-mix(in srgb, var(--c) 55%, transparent);
}
.skico.pv { border-radius: 50%; padding: 8px; background: radial-gradient(circle at 30% 22%, color-mix(in srgb, var(--c) 30%, #fff) 0%, color-mix(in srgb, var(--c) 70%, #556) 55%, #1d2030 100%); }
.skico.dim { opacity: .45; filter: grayscale(.5); box-shadow: none; }

/* ── 아이템 아이콘 (인라인 SVG) ── */
.itico { flex: none; width: 40px; height: 40px; border-radius: 10px; border: 1.5px solid rgba(255, 255, 255, .22); display: block; padding: 3px; box-sizing: border-box; }
.itico svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, .6)); }
.itico.mon { padding: 2px; }
.itico img { width: 100%; height: 100%; display: block; object-fit: contain; filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, .55)); }
.itico.lg { width: 52px; height: 52px; padding: 4px; border-radius: 12px; }

/* ── 도감 ── */
.cdx-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 8px; }
.cdx-tabs .sbtn { line-height: 1.25; padding: 6px 4px; }
.cdx-tabs .sbtn small { opacity: .8; }
.cdx-row { cursor: pointer; }
.cdx-row:active { background: rgba(232, 52, 63, .18); }
.cdx-st { flex: none; text-align: right; font-size: 12px; color: var(--muted); max-width: 96px; line-height: 1.3; }
.cdx-st b { color: #ffe9b0; font-size: 14px; }
.cdx-line { padding: 6px 10px; }
.cdx-line .nm { font-size: 13px; }
.cdx .ok, .cdx-st .ok, .ok { color: #7be08a; font-weight: 700; }
.dim { color: var(--muted); opacity: .85; }
.itico.sm { width: 32px; height: 32px; padding: 2px; border-radius: 8px; }

/* ── 이사 안내 · 저장 코드 가져오기 ── */
.moved-box { margin: 10px 0; padding: 12px 14px; border-radius: 14px; background: rgba(255, 200, 80, .12); border: 1px solid rgba(255, 200, 80, .55); text-align: left; font-size: 13px; line-height: 1.5; }
.moved-box b { color: #ffd870; font-size: 15px; }
.moved-box p, .moved-box ol { margin: 6px 0; }
.moved-box ol { padding-left: 20px; }
.moved-box[hidden] { display: none; }
.moved-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.moved-btns { align-items: stretch; }
.moved-btns .big-btn { flex: 1 1 130px; display: flex; align-items: center; justify-content: center; text-align: center; text-decoration: none; color: var(--text, #fff); padding: 10px 8px; font-size: 15px; }
#import-screen { background: radial-gradient(ellipse at 50% 30%, #2a1030 0, #0d0b14 70%); z-index: 60; }
#import-screen .create-wrap { max-width: 420px; margin: 0 auto; padding: 24px 16px; }
#import-screen .big-btn { display: block; width: 100%; margin-top: 10px; box-sizing: border-box; }
#import-screen .codebox { width: 100%; box-sizing: border-box; }
.moved-box .moved-btns .sbtn { flex: 1 1 130px; display: flex; align-items: center; justify-content: center; text-align: center; text-decoration: none; color: var(--text, #fff); }

/* ── 출석 보상 ── */
.attend .att-row { display: flex; gap: 4px; margin: 8px 0; }
.att-cell { flex: 1; min-width: 0; text-align: center; padding: 4px 0; border-radius: 8px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .1); font-size: 14px; line-height: 1.2; color: var(--muted); }
.att-cell small { display: block; font-size: 10px; }
.att-cell.past { color: #7be08a; background: rgba(90, 200, 120, .12); border-color: rgba(90, 200, 120, .4); }
.att-cell.today { color: #ffe9b0; border-color: #ffd24a; box-shadow: 0 0 8px rgba(255, 210, 74, .45); }

/* 업적 */
.ach { align-items: center; }
.ach-ic { flex: none; width: 38px; height: 38px; display: grid; place-items: center; font-size: 22px; border-radius: 10px; background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .12); }
.ach.equipped .ach-ic { border-color: #ffd24a; box-shadow: 0 0 8px rgba(255, 210, 74, .45); }
.ach-bar { height: 5px; margin-top: 6px; border-radius: 3px; background: rgba(255, 255, 255, .1); overflow: hidden; }
.ach-bar i { display: block; height: 100%; background: linear-gradient(90deg, #e8343f, #ffd24a); }

/* 장비 슬롯 · 품질 */
.qb { display: inline-block; font-size: 10px; font-weight: 700; line-height: 1; padding: 2px 5px; border: 1px solid; border-radius: 6px; vertical-align: 1px; }
.rg { color: var(--muted); font-size: 10px; }
.slotbar { display: flex; flex-wrap: wrap; gap: 5px; margin: 6px 0 8px; }
.slotchip { flex: none; min-height: 40px; min-width: 48px; padding: 4px 12px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .18); background: rgba(255, 255, 255, .05); color: var(--muted); font-size: 13px; cursor: pointer; }
.slotchip.on { color: #fff; background: rgba(232, 52, 63, .35); border-color: #e8343f; font-weight: 700; }
.slot-empty { opacity: .8; }
.slot-empty .nm.dim { color: var(--muted); }
.itico.slotph { background: rgba(255, 255, 255, .04); border-style: dashed; }

/* ───────────── 타이틀 소개 (아래로 스크롤) ───────────── */
.title-scroll { width: 100%; height: 100%; overflow-x: hidden; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; touch-action: pan-y; scroll-behavior: smooth; }
.title-first { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.scroll-hint { margin: 14px 0 6px; min-height: 40px; padding: 6px 16px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .2); background: rgba(255, 255, 255, .06); color: #cfc6dc; font-size: 13px; cursor: pointer; animation: hintBob 2.2s ease-in-out infinite; }
.scroll-hint[hidden] { display: none; }
@keyframes hintBob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(4px); } }
@media (prefers-reduced-motion: reduce) { .scroll-hint { animation: none; } .title-scroll { scroll-behavior: auto; } }
.intro { width: 100%; padding: 28px 0 40px; border-top: 1px solid rgba(255, 255, 255, .1); background: rgba(5, 4, 10, .55); text-align: left; color: #e6dff0; }
.intro-in { max-width: 720px; margin: 0 auto; padding: 0 14px; }
.intro h2 { margin: 28px 0 10px; font-size: 20px; line-height: 1.35; color: #fff; }
.intro h2:first-child { margin-top: 0; font-size: 22px; }
.intro h3 { margin: 0 0 6px; font-size: 16px; color: #ffe9b0; }
.intro p { margin: 0 0 10px; font-size: 14.5px; line-height: 1.7; color: #d3cae0; }
.intro b { color: #fff; }
.intro .intro-lead { font-size: 15.5px; }
.intro-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; margin-top: 14px; }
.intro-card { background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .12); border-radius: 14px; padding: 12px 14px; }
.intro-card p { margin: 0; font-size: 14px; }
.shots { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; touch-action: pan-x pan-y; padding-bottom: 8px; -webkit-overflow-scrolling: touch; }
.shots figure { flex: none; margin: 0; scroll-snap-align: start; text-align: center; }
.shots img { display: block; width: min(60vw, 220px); height: auto; aspect-ratio: 9 / 16; border-radius: 12px; border: 1px solid rgba(255, 255, 255, .14); background: #120c22; }
.shots figcaption { margin-top: 6px; font-size: 13px; color: var(--muted); }
.intro-video { display: flex; justify-content: center; }
.intro-video video { width: min(72vw, 270px); height: auto; aspect-ratio: 9 / 16; border-radius: 12px; background: #000; border: 1px solid rgba(255, 255, 255, .14); touch-action: pan-y; }
.ctrl-tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.ctrl-tbl th, .ctrl-tbl td { padding: 8px 10px; border: 1px solid rgba(255, 255, 255, .12); vertical-align: top; line-height: 1.6; }
.ctrl-tbl th { width: 5.5em; text-align: left; color: #ffe9b0; white-space: nowrap; }
.intro-steps { margin: 0; padding-left: 1.3em; font-size: 14.5px; line-height: 1.75; color: #d3cae0; }
.intro-steps li { margin-bottom: 6px; }
.intro details { border: 1px solid rgba(255, 255, 255, .12); border-radius: 12px; margin-bottom: 8px; background: rgba(255, 255, 255, .04); }
.intro summary { min-height: 44px; display: flex; align-items: center; padding: 8px 14px; font-size: 15px; font-weight: 700; color: #fff; cursor: pointer; }
.intro details p { padding: 0 14px 10px; }
.intro-links { display: flex; flex-wrap: wrap; gap: 8px; }
.intro-links a { display: inline-flex; align-items: center; min-height: 44px; padding: 6px 14px; border-radius: 999px; border: 1px solid rgba(106, 208, 255, .45); color: #bfe9ff; text-decoration: none; font-size: 14px; }
.intro-links a:active { background: rgba(106, 208, 255, .18); }
.intro-foot { margin-top: 26px; font-size: 13px; color: var(--muted); }
.intro-foot a { color: var(--muted); }
