/* 한글 주석: 기본 리셋 + 모바일 세로 우선 */
*{box-sizing:border-box;margin:0;padding:0}
html,body{height:100%;background:#0f1114;color:#eee;font-family:Pretendard,system-ui,-apple-system,Segoe UI,Roboto}
/* 한글 주석: 캔버스에서 브라우저 스크롤/당겨새로고침 방지 */
html, body { overscroll-behavior: none; }
button,input,select{font:inherit}
:root{
  --glass:#1b1f2488; --glass-2:#0c0f1388; --stroke:#ffffff22;
  --acc:#7dd3fc; --acc2:#fca5a5; --ok:#22c55e; --warn:#f59e0b;
  --tab-h: 30px;          /* ← 원하면 34~38px 사이로만 조절 */
  --tab-pad-x: 5px;
}

/* 한글 주석: 유리/블러 배경 */
.glass-bg{background:radial-gradient(80% 120% at 50% 10%,#1c2130 0%,#0f1114 60%,#0b0d10 100%)}

/* 부드러운 카드/모달 */
.blur{backdrop-filter:blur(14px); background:var(--glass); border:1px solid var(--stroke); border-radius:16px}
.card{width:min(520px,92vw); padding:18px 16px; margin:16px auto}
.title{font-size:20px; font-weight:800; margin-bottom:12px}
/* 상단 HUD 내부의 타이틀은 작고 여백 제거 */
.hud .title{font-size:14px; margin-bottom:0;}
.field{display:grid; gap:6px; margin:10px 0}
.field input{background:#0c1218; color:#eee; border:1px solid #263041; padding:10px 12px; border-radius:12px}
.check{display:flex; gap:8px; align-items:center; margin:8px 0}
.row{display:flex; gap:8px; align-items:center; justify-content:center; margin-top:12px}
.btn{padding:10px 14px; border-radius:12px; border:1px solid #2a3647; background:#18202b; color:#eee; cursor:pointer}
.btn.primary{background:linear-gradient(180deg,#2a81ff,#1450df); border:0}
.btn.ghost{background:transparent; border:1px solid #3a475d}
.btn.sm{padding:6px 10px; font-size:12px}
.icon-btn{padding:6px 8px; border-radius:10px; background:#1a2330; border:1px solid #2b3a53; color:#cfe3ff}

/* 로그인 부트 */
.boot{position:fixed; inset:0; display:grid; place-items:center}
.boot-card{width:min(420px,92vw); padding:22px; border-radius:18px; border:1px solid var(--stroke); background:var(--glass)}
.logo{font-size:22px; font-weight:900; letter-spacing:.5px; text-align:center; margin-bottom:12px}
.bar{height:10px; background:#0e141b; border-radius:8px; overflow:hidden; border:1px solid #263041}
.bar span{display:block; height:100%; width:0%; background:linear-gradient(90deg,#61d0ff,#68f); transition:width .25s}
.tips{display:flex; gap:10px; align-items:center; justify-content:space-between; margin-top:12px; font-size:13px}
.center-col{min-height:100%; display:flex; flex-direction:column; justify-content:center; padding:14px}

/* HUD */
.hud{position:sticky; top:0; z-index:10; display:flex; align-items:center; justify-content:space-between; gap:8px; padding:8px; background:linear-gradient(180deg,#111820cc,#0f111480)}
.hud .lv{font-weight:800}
.hud .xp{display:grid; gap:4px; width:120px}
.xp-bar{height:8px; background:#0f1620; border-radius:6px; overflow:hidden; border:1px solid #1f2a3d}
.xp-bar span{display:block; height:100%; width:0%; background:linear-gradient(90deg,#67e8f9,#22d3ee)}
.xp.small{width:100px}
.xp-bar.small{height:6px}
.hud .coin,.hud .net{font-variant-numeric:tabular-nums}

/* 내 정보 패널 */
.panel.info{margin:10px; padding:10px}
.me{ display:grid; grid-template-columns:88px 1fr; gap:12px; align-items:start; }
.me-img{ width:64px; height:64px; image-rendering:pixelated }
.me-left{ display:grid; gap:6px; justify-items:center; }
.me-left .nick{ font-weight:800; }
.me-left .btn{ padding:6px 10px; border-radius:10px; }
/* 캐릭터 이름(직업명) 숨김 */
#meJob, .me-meta .job{ display:none !important; }

/* 미니 스탯(카드 오른쪽) — 세로 1열 리스트 */
#miniStats{
  display:grid; grid-template-columns:1fr; 
  gap:0px; align-content:start; font-size:12px;
  max-height:180px; overflow:auto; padding-right:1px;
  scrollbar-width:thin;
}
#miniStats .row{
  display:flex; justify-content:space-between; align-items:center;
  background:rgba(255,255,255,.04); border:1px solid rgba(255,255,255,.08);
  padding:4px 10px; border-radius:10px; line-height:7px;
}
#miniStats .k{ color:#9fb2d8; }
#miniStats .v{ color:#e8eefc; font-weight:700; }

.delta-burst{ margin-left:6px; font-weight:700; animation:popfade .9s ease forwards; }
.delta-burst.up{ color:#63ffa3; }
.delta-burst.down{ color:#ff7d7d; }
@keyframes popfade{
  0%{ transform:translateY(0) scale(.92); opacity:0; }
  25%{ transform:translateY(-4px) scale(1); opacity:1; }
  100%{ transform:translateY(-12px); opacity:0; }
}
.gear{display:grid; grid-template-columns:repeat(7,1fr); gap:6px; margin-top:10px}
.slot{height:46px; display:grid; place-items:center; font-size:11px; color:#a6b4d0; background:#10151d; border:1px dashed #2a3647; border-radius:10px}
/* 한글 주석: 상단 '내 정보' 장비 슬롯에 아이콘 표시 */
.gear .slot.filled{ position:relative; }
.gear .slot.filled::after{
  content:""; position:absolute; inset:0; border-radius:12px;
  box-shadow: 0 0 0 2px currentColor inset; pointer-events:none; opacity:.95;
}
.gear .slot.filled.rar-common   { color:#9aa4b2; }   /* 회색 */
.gear .slot.filled.rar-rare     { color:#5aa7ff; }   /* 파랑 */
.gear .slot.filled.rar-epic     { color:#b07cff; }   /* 보라 */
.gear .slot.filled.rar-unique   { color:#ff9550; }   /* 주황 */
.gear .slot.filled.rar-legendary{ color:#ffd652; }   /* 금색 */
.gear .slot img{ width:28px; height:28px; image-rendering:pixelated }
/* 한글 주석: 모달 버튼 숨김 시 여백 깨짐 방지 */
#itemModal .btns .btn{ display:inline-flex; }

/* ====== 레벨업 카드 선택 모달 ====== */
#levelModal .modal-card{ width:min(520px, 96vw); }
.card-grid{ display:grid; grid-template-columns:1fr; gap:10px; }
@media (min-width:420px){ .card-grid{ grid-template-columns:repeat(3,1fr); } }
.lv-card{
  background:#0e151f; border:1px solid #2a3647; border-radius:12px; padding:10px; cursor:pointer; display:grid; gap:6px;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.lv-card:hover{ transform:translateY(-2px); box-shadow:0 4px 20px rgba(0,0,0,.25); border-color:#3b82f6; }
.lv-card .t{ font-weight:800; }
.lv-card .d{ font-size:12px; color:#9fb2d8; min-height:32px; }
.lv-card .tag{ font-size:10px; padding:2px 6px; border-radius:999px; width:max-content; background:#111827; color:#a6b4d0 }
.lv-card.skill .tag{ background:#1e293b; color:#93c5fd }
.lv-card.passive .tag{ background:#1f2937; color:#fcd34d }
.lv-hint{ font-size:12px; color:#9fb2d8; margin-top:6px; }
.paused-dim{ position:fixed; inset:0; background:rgba(0,0,0,.25); pointer-events:none; opacity:0; transition:opacity .15s ease; }
.paused-dim.show{ opacity:1; }

/* ===== Segmented tabbar (Compact, mobile-first) ===== */
.tabbar{
  --seg-h: 32px;                 /* 시각 높이 ↓ */
  position:relative; display:flex; gap:6px;
  overflow-x:auto; padding:4px;
  border-radius:12px;
  background:rgba(255,255,255,.05);
  border:1px solid rgba(255,255,255,.10);
  backdrop-filter:blur(10px);
  -webkit-overflow-scrolling:touch;
  scroll-snap-type:x proximity;
}
.tabbar.compact{ --seg-h: 30px; padding:3px; gap:5px; } /* 더 얇게 */
.tabbar::-webkit-scrollbar{ height:6px }
.tabbar::-webkit-scrollbar-thumb{ background:rgba(255,255,255,.12); border-radius:999px }
.tabbar{ scrollbar-width:none }

.tabbar button{
  position:relative; z-index:1; flex:0 0 auto;
  height:var(--seg-h); padding:0 10px; min-width:72px;   /* 패딩/최소폭 ↓ */
  border:none; border-radius:9px; background:transparent;
  color:#cfe3ff; font-weight:700;
  font-size:clamp(12px,3.2vw,13px); letter-spacing:0;    /* 자간 ↓ */
  white-space:nowrap; scroll-snap-align:center;
  transition: color .16s ease, transform .10s ease;
}
.tabbar button:hover{ transform: translateY(-1px); }
.tabbar button:active{ transform: translateY(0); }
.tabbar button.active{ color:#ffffff; }

/* 얇은 슬라이더 (배경) */
.tabbar .tab-slider{
  position:absolute; top:50%; left:0; transform:translateY(-50%);
  height:calc(var(--seg-h) - 2px);    /* 아주 얇게 */
  border-radius:9px; width:0;
  pointer-events:none; z-index:0;
  background:linear-gradient(180deg,rgba(255,255,255,.20),rgba(255,255,255,.08));
  border:1px solid rgba(255,255,255,.22);
  box-shadow:0 6px 14px rgba(0,0,0,.22);
  transition:left .22s cubic-bezier(.2,.8,.2,1), width .22s cubic-bezier(.2,.8,.2,1);
}

/* 콘텐츠 여백 유지 */
.tab-content{ margin-top:6px; }
.tab-pane{display:none; min-height:180px; max-height:52vh; overflow:auto; padding:6px}
.tab-pane.show{display:block}

/* 스테이지 그리드 */
.stage-grid{display:grid; grid-template-columns:repeat(2,1fr); gap:8px}
.stage-card{padding:10px; border-radius:12px; border:1px solid #2a3647; background:#0e151f; cursor:pointer}
.stage-card .t{font-weight:700}
.stage-card .s{font-size:12px; color:#a6b4d0}
/* 한글 주석: 잠긴 스테이지 표시 */
.stage-card.locked{opacity:.55; filter:grayscale(.25); cursor:not-allowed; position:relative}
.stage-card.locked::after{content:"🔒 잠김"; position:absolute; top:8px; right:10px; font-size:12px; color:#fca5a5}

/* ========= 인벤토리/아이템 ========= */
.bag-grid{display:grid; grid-template-columns:repeat(5,1fr); gap:6px; padding:4px}
.bag-item{background:#0f1620; border:1px solid #233147; border-radius:10px; padding:6px; display:grid; gap:4px; cursor:pointer}
.bag-item img{width:36px; height:36px; image-rendering:pixelated; justify-self:center}
.bag-item .n{font-size:11px; text-align:center; line-height:1.1}
.rar{padding:2px 6px; border-radius:999px; font-size:10px; width:max-content}
.rar.common{background:#111827; color:#9ca3af}
.rar.rare{background:#1e3a8a; color:#93c5fd}
.rar.epic{background:#4c1d95; color:#c4b5fd}
.rar.unique{background:#7c2d12; color:#fbbf24}
.rar.legendary{background:#78350f; color:#fde68a; border:1px solid #f59e0b}
.stat{font-size:12px; color:#c8d2ea}
.stat .k{color:#9fb2d8}
.item-head{display:flex; align-items:center; gap:8px}
.item-head img{width:40px; height:40px; image-rendering:pixelated}
.equip-row{display:grid; grid-template-columns:repeat(7,1fr); gap:6px; margin:6px 0}
.equip-slot{height:46px; display:grid; place-items:center; background:#0f1620; border:1px dashed #2a3647; border-radius:10px; font-size:11px; color:#a6b4d0}
.equip-slot.filled{border-style:solid; border-color:#3b82f6}
.hint{font-size:12px; color:#9fb2d8; margin:6px 0}

/* ========= 아이템 모달 ========= */
#itemModal .modal-card{width:min(420px,92vw)}
#itemModal .meta{display:grid; gap:4px; margin:6px 0}
#itemModal .aff{display:grid; gap:2px; margin-top:6px}
#itemModal .btns{display:flex; gap:8px; justify-content:flex-end; margin-top:8px}
#itemModal .im-section{
  margin:8px 0 6px; padding-top:6px;
  border-top:1px solid rgba(255,255,255,0.08);
  font-size:12px; opacity:.75; text-align:center;
}
/* 상점 */
.shop-list{display:grid; gap:8px}
.shop-item{display:flex; gap:10px; align-items:center; background:#10161f; border:1px solid #2a3647; border-radius:12px; padding:8px}
.shop-item img{width:32px; height:32px; image-rendering:pixelated}
.shop-item .buy{margin-left:auto}

/* 채팅 */
.chat{position:fixed; left:8px; right:8px; bottom:8px; border-radius:12px; overflow:hidden}
.chat-body{max-height:120px; overflow:auto; padding:6px 8px; font-size:13px; line-height:1.2; background:#0a0f15cc}
.chat-body.compact{max-height:64px}
.chat-line{opacity:.9; margin:2px 0; word-break:break-word}
.chat-input{display:flex; gap:6px; background:#0a0f15; padding:6px}
.chat-input input{flex:1; background:#0f1620; color:#eee; border:1px solid #2a3647; border-radius:8px; padding:8px}

/* 모달 */
.modal{position:fixed; inset:0; display:none; align-items:center; justify-content:center; background:rgba(0,0,0,.35)}
.modal.show{display:flex}
.modal-card{width:min(420px,90vw); padding:14px; border-radius:14px}
/* ===== 설정 모달: 오디오 슬라이더 ===== */
.modal-card .opt-section{
  margin:10px 0 6px; font-weight:800; letter-spacing:.2px; color:#e8f0ff;
}
.modal-card .opt-row{
  display:grid; grid-template-columns:70px 1fr 36px; gap:8px; align-items:center; margin:8px 0;
}
.modal-card .opt-row .label{ color:#cfe3ff; font-weight:700; }
.modal-card .opt-row output{ text-align:right; font-variant-numeric:tabular-nums; opacity:.85; }
.modal-card input[type="range"]{
  -webkit-appearance:none; appearance:none; width:100%; height:6px; border-radius:999px;
  background:rgba(255,255,255,.14); outline:none; border:1px solid rgba(255,255,255,.18);
}
.modal-card input[type="range"]::-webkit-slider-thumb{
  -webkit-appearance:none; width:16px; height:16px; border-radius:50%;
  background:#5aa7ff; border:1px solid #c7dcff;
}
.modal-card input[type="range"]::-moz-range-thumb{
  width:16px; height:16px; border-radius:50%; background:#5aa7ff; border:1px solid #c7dcff;
}

/* 스테이지 씬 */
.stage-body{background:#0b0e12}
.stage-hud{background:linear-gradient(180deg,#0e1220ee,#0b0e12aa)}
/* 한글 주석: 캔버스는 높이에 맞추고 가로는 비율 유지(405:720), 찌그러짐 방지 */
#view{
  display:block;
  height:calc(100vh - 100px);
  aspect-ratio:405/720;
  width:auto;
  margin:0 auto;
  image-rendering:pixelated;
  background:linear-gradient(180deg,#0f172a,#0b1020);
}
/* 보스바 */
.bossbar{position:fixed; top:58px; left:8px; right:8px; z-index:12; display:grid; gap:6px}
.bossbar-bar{height:12px; border:1px solid #5a2033; background:#1b0a12; border-radius:10px; overflow:hidden}
.bossbar-bar i{display:block; height:100%; width:100%; background:linear-gradient(90deg,#ff6b6b,#ef4444)}

/* 조이스틱: 처음엔 숨김, 고정앵커 충돌 방지 */
.joy{
  position: fixed;
  /* 초기값은 의미 없음: JS가 매 터치마다 left/top을 설정하므로
     bottom/right는 아예 사용하지 않게 두는 게 안전 */
  left: 0; top: 0;
  width: 140px; height: 140px;
  pointer-events: none;
  display: none;            /* ← 처음엔 숨김 */
}
.joy .ring{ position:absolute; inset:0; border:2px solid #2a3647; border-radius:50%; background:#0c1118aa }
.joy .stick{ position:absolute; left:50%; top:50%; width:60px; height:60px; margin:0px 0 0 0px; border-radius:50%; background:#1a2740; border:2px solid #2a3647 }

/* 히트/데미지 숫자 */
.flt{position:absolute; pointer-events:none; color:#ffd166; text-shadow:0 1px 2px rgba(0,0,0,.6); font-weight:800}

/* 반응형(세로 고정 안내는 필요 시 stage.js에서 표시) */
.foot-note{opacity:.65; text-align:center; font-size:12px; margin:10px}

/* ★ 캐릭터 선택 그리드 */
.char-grid{
  display:grid; grid-template-columns:repeat(2,1fr); gap:10px; max-height:55vh; overflow:auto; margin-top:6px;
}
.char-card{
  display:flex; gap:10px; align-items:center; padding:10px;
  background:#0e151f; border:2px solid #2a3647; border-radius:12px; cursor:pointer;
}
.char-card img{ width:48px; height:48px; image-rendering:pixelated }
.char-card .meta{ display:grid; gap:2px }
.char-card .name{ font-weight:800 }
.char-card .tip{ font-size:12px; color:#a6b4d0 }
.char-card.active{ border-color:#3b82f6; box-shadow:0 0 0 2px #1d4ed880 inset }

/* ===== 상단 HUD 레이아웃(가로 정렬 + HP 바) ===== */
#hudTop.top-hud{display:grid; grid-template-columns:1fr auto 1fr; align-items:center; gap:8px; padding:8px 10px}
.hud-left .title{font-weight:800}
.hp-wrap{height:6px; background:#0b1220; border-radius:999px; overflow:hidden; margin-top:4px}
.hp-bar{height:100%; width:100%; background:linear-gradient(90deg,#34d399,#059669); transition:width .15s ease}
.xp-wrap{height:4px; background:#0b1220; border-radius:999px; overflow:hidden; margin-top:6px}
.xp-bar{height:100%; width:0%; background:linear-gradient(90deg,#60a5fa,#2563eb); transition:width .2s ease}
.hud-center{display:flex; align-items:center; justify-content:center; gap:10px}
.hud-center .pill{display:flex; align-items:center; gap:6px; font-size:12px; padding:2px 10px; border-radius:999px; background:rgba(255,255,255,.06); border:1px solid rgba(255,255,255,.08)}
.hud-right{display:flex; justify-content:flex-end}

/* ===== 상단 타이틀 내 LV · cur/need 한 줄 보조 텍스트 ===== */
#hudTop .title .xpnum, .top-hud .title .xpnum{
  font-size:12px; color:#9fb2d8; margin-left:6px; font-weight:600;
}

/* ===== 핑 숨김 ===== */
#ping, #pingWrap, .ping, .ping-wrap{ display:none !important; }

/* ===== 채팅창 축소(기본 높이 ↓, 입력창도 컴팩트) ===== */
#chatDock, .chat-dock{ padding:6px 10px; }
#chatList, .chat-log{ max-height:72px; overflow:auto; }
#chatDock input[type="text"], .chat-input{
  height:34px; line-height:34px; font-size:13px; padding:0 10px;
}
#chatDock .btn, .chat-send{ height:34px; padding:0 10px; font-size:13px; }

/* ===== 상점/대장간 공용 ===== */
.grid4{ display:grid; grid-template-columns:repeat(2,1fr); gap:10px; }
@media(min-width:480px){ .grid4{ grid-template-columns:repeat(4,1fr); } }
.shop-card, .pick{ background:#0e151f; border:1px solid #233042; border-radius:12px; padding:10px; }
.shop-card .itimg, .pick .itimg{ width:48px; height:48px; object-fit:contain; }
.shop-card .t, .pick .t{ font-weight:700; margin-top:6px; }
.r{ font-size:11px; padding:2px 6px; border-radius:999px; margin-left:6px; }
.r-common{ background:#0f172a; color:#cbd5e1; }
.r-rare{ background:#1e293b; color:#93c5fd; }
.r-unique{ background:#3b1d37; color:#f0abfc; }
.btns{ margin-top:8px; display:flex; gap:6px }
.ach.done{ border-color:#22c55e66; }
.stat-detail .row{ display:grid; grid-template-columns:120px 1fr; gap:6px; }
.btn.sm{ padding:4px 10px; font-size:12px; }

.stat-detail .plus{opacity:.85; font-size:.92em; color:#8ab4ff}
.stat-detail .sep{margin:6px 0 2px; opacity:.6}

/* ===== 상점: 리스트형 ===== */
#tab-shop #shopGrid.shop-list{
  display:block;
  max-height:60vh;
  overflow-y:auto;
  padding:6px 0;
}
.shop-row{
  display:flex; align-items:center; gap:8px;
  padding:8px 10px; margin:0 4px 6px;
  border-radius:12px;
  background:rgba(255,255,255,0.04);
}
.shop-row .icon{ width:36px; height:36px; object-fit:contain; }
.shop-row .meta{ flex:1; min-width:0; }
.shop-row .meta .t{
  font-weight:700; font-size:13px; line-height:1.1;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.shop-row .meta .sub{ font-size:11px; opacity:.7; margin-top:2px; }
.shop-row .price{ margin-right:6px; white-space:nowrap; font-size:13px; }
.shop-row .actions{ display:flex; gap:6px; }
.shop-row .actions .btn{ padding:6px 10px; font-size:12px; }

/* 상단 설명/새로고침 버튼 더 작게 */
.shop-head{ display:flex; justify-content:space-between; align-items:center; gap:8px; margin:4px 4px 8px; }
.shop-head .desc{ font-size:12px; opacity:.8; line-height:1.2; }
.shop-head .shop-refresh{ padding:6px 10px; font-size:12px; border-radius:10px; }

/* ===== 대장간: 선택 리스트 ===== */
#forgeSelectList.forge-list{
  max-height:60vh;
  overflow-y:auto;
  padding:6px 0;
}
.forge-row{
  display:flex; align-items:center; gap:10px;
  padding:8px 10px; margin:0 4px 6px;
  border-radius:12px;
  background:rgba(255,255,255,0.04);
}
.forge-row .icon{ width:36px; height:36px; object-fit:contain; }
.forge-row .meta{ flex:1; min-width:0; }
.forge-row .meta .t{
  font-weight:700; font-size:13px;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.forge-row .meta .sub{ font-size:11px; opacity:.7; margin-top:2px; }
.forge-row .btn.xs{ padding:6px 10px; font-size:12px; }

/* 대장간 작업 모달의 아이콘 크기 축소 */
#forgeBody .item-head .icon.sm{ width:56px; height:56px; object-fit:contain; }

/* 모달 안 리스트 스크롤 시 카드 고정 높이 */
.modal .modal-card .grid4{ overflow:visible; } /* 남아있을 경우 레이아웃 충돌 방지 */

/* ======= Compact HUD (Top) ======= */
#hudTop{
  position: fixed; left: 8px; right: 8px; top: 8px;
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  padding:6px 10px; border-radius:12px;
  background: rgba(0,0,0,.35); backdrop-filter: blur(4px);
  box-shadow: 0 4px 10px rgba(0,0,0,.12);
  z-index: 20;
}
#hudTop .title{ color:#e8f0ff; font-weight:700; letter-spacing:.2px; }

/* 알약(pill) 공통 */
.pill, #time, #coin, #btnLeave{
  display:inline-flex; align-items:center; gap:6px;
  height:28px; padding:0 10px; border-radius:9999px;
  font-weight:600; font-size:13px; line-height:28px;
  background: rgba(255,255,255,.08); color:#dfe7ff;
  border:1px solid rgba(255,255,255,.10);
}
#time{ min-width:56px; text-align:center; }
#coin{ min-width:52px; text-align:center; background: rgba(255,200,0,.14); border-color: rgba(255,200,0,.25);}
#coin::before{ content:"🪙"; margin-right:6px; }
#btnLeave{ cursor:pointer; background: rgba(255,90,90,.14); border-color: rgba(255,90,90,.25); }
#btnLeave:hover{ filter: brightness(1.1); }

/* ======= HP Bar with number ======= */
#hpWrap{
  position: fixed; left: 8px; right: 8px; top: 50px;
  height: 14px; border-radius: 10px;
  background: rgba(255,255,255,.08);
  border:1px solid rgba(255,255,255,.12);
  overflow:hidden; z-index: 19;
}
#hpBar{
  height:100%;
  background: linear-gradient(90deg, #3fd0a7, #27b899);
  border-radius: inherit;
  transition: width .15s ease;
}
.hp-num, #hpNum{
  position:absolute; inset:0;
  display:flex; align-items:center; justify-content:center;
  font-weight:700; font-size:12px; color:#e9fbff;
  text-shadow: 0 1px 2px rgba(0,0,0,.45);
  pointer-events:none; user-select:none;
}

/* (선택) XP bar를 더 얇고 은은하게 */
#xpBar{ height: 6px; border-radius: 6px; background: linear-gradient(90deg,#9bb7ff,#6e8cff); }

/* ===== HUD 겹침 제거 & 안전노치 대응 ===== */
:root{
  --safe-top: env(safe-area-inset-top, 0px);
  --hud-y: calc(var(--safe-top) + 8px);
}

/* header의 그라데이션/높이 제거(우린 #hudTop만 fixed로 씀) */
.hud.stage-hud{ position:static; background:transparent; padding:0; height:0; min-height:0; }

/* 상단 HUD(알약줄) */
#hudTop{ top: var(--hud-y); }

/* HP/XP 바 위치를 '한 줄 간격'으로 안전하게 배치 */
#hpWrap{ top: calc(var(--hud-y) + 42px); }
#xpWrap{
  position: fixed; left: 8px; right: 8px;
  top: calc(var(--hud-y) + 62px);
  height: 10px; border-radius: 8px;
  background: rgba(255,255,255,.07);
  border:1px solid rgba(255,255,255,.12);
  overflow:hidden; z-index:18;
}
#xpBar{
  height:100%;
  background: linear-gradient(90deg,#9bb7ff,#6e8cff);
  border-radius:inherit; transition: width .20s ease;
}
#xpWrap .xp-num, #xpNum{
  position:absolute; inset:0; display:flex; align-items:center; justify-content:center;
  font-weight:700; font-size:11px; color:#e6eeff;
  text-shadow:0 1px 2px rgba(0,0,0,.45); pointer-events:none; user-select:none;
}

/* 보스바는 HP/XP 아래로 내림(겹침 방지) */
.bossbar{ top: calc(var(--hud-y) + 84px); }

/* 전투 캔버스 높이 보정(상단 고정 HUD를 오버레이로 쓰므로 거의 풀높이) */
.stage-body #view{ height: calc(100vh - 16px); }

/* Achievements */
.ach-list .ach{ display:block; background:#0e151f; border:1px solid #233042; border-radius:12px; padding:10px; margin-bottom:8px; }
.ach .head{ display:flex; gap:10px; align-items:center; margin-bottom:6px; }
.ach .icon{ width:32px; height:32px; object-fit:contain; }
.ach .t{ font-weight:800; }
.ach .sub{ opacity:.7; font-weight:600; margin-left:4px; }
.ach .sub2{ font-size:12px; opacity:.7; margin-top:2px; }

.ach .tier{ margin:6px 0 8px; }
.ach .tier .line{ display:flex; justify-content:space-between; font-size:13px; }
.ach .tier .bar{ height:8px; background:#0f172a; border:1px solid #1f2a40; border-radius:999px; overflow:hidden; margin-top:4px; }
.ach .tier .bar i{ display:block; height:100%; width:0; background:linear-gradient(90deg,#60a5fa,#22d3ee); }
.ach .tier.done .bar i{ background:linear-gradient(90deg,#34d399,#059669); }
.ach.done{ border-color:#22c55e66; }

#boot { display:none; }

/* ============================================
 * 로비 탭 컴팩트 모드 (모바일 세로 우선)
 * - 얇은 높이(시각적 34~36px) + 촘촘한 자간/패딩
 * - 탭 하단 슬라이더(2px)로 상태 표현
 * - 실제 터치 타깃은 44px 이상 유지(접근성)
 * ============================================ */

/* 한글 주석: 탭 컨테이너 — 여백 줄이기 */
.tabs.compact,
.tabbar.compact {
  margin: 6px 8px 4px;           /* 위/아래 여백 축소 */
  padding: 0;                    /* 바깥 패딩 제거 */
}

/* 한글 주석: 탭 아이템 — 얇은 높이 + 글자 간격 축소 */
.tabs.compact [role="tab"],
.tabbar.compact [role="tab"],
.tabs.compact .tab,
.tabbar.compact .tab,
.tabs.compact > button,
.tabbar.compact > button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: auto;
  height: clamp(32px, 4.6vw, 36px); /* 시각적 높이 ↓ */
  padding: 0 10px;                  /* 좌우 패딩 ↓ */
  margin: 0 2px;                    /* 탭 사이 간격 ↓ */
  border-radius: 10px;
  font-size: clamp(12px, 3.2vw, 13.5px); /* 글자 크기 소폭 ↓ */
  font-weight: 700;
  letter-spacing: 0;                /* 자간(글자 사이) 붙임 */
  line-height: 1;                   /* 위아래 공간 타이트 */
  background: transparent;
  color: #cfd6e4;
  transition: background .15s ease, color .15s ease;
}

/* 한글 주석: 탭 활성/호버 — 가벼운 배경으로만 상태 표현 (두께 ↑ 없음) */
.tabs.compact [role="tab"].active,
.tabbar.compact [role="tab"].active,
.tabs.compact .tab.active,
.tabbar.compact .tab.active {
  background: rgba(255,255,255,.06);
  color: #fff;
}

/* 한글 주석: 텍스트가 너무 벌어져 보이면 아이콘/텍스트 간 간격도 축소 */
.tabs.compact [role="tab"] > i,
.tabbar.compact [role="tab"] > i,
.tabs.compact .tab > i,
.tabbar.compact .tab > i {
  margin-right: 6px; /* 아이콘 있을 때 */
}

/* 한글 주석: 하단 슬라이더(인디케이터) — 2px로 얇게 */
.tabs.compact .slider,
.tabbar.compact .slider,
.tabs.compact .indicator,
.tabbar.compact .indicator {
  position: relative;
  display: block;
  height: 2px;                 /* 얇게 */
  background: linear-gradient(90deg, #5a86ff, #6ee0ff);
  border-radius: 2px;
  margin-top: 4px;             /* 위쪽 공간 최소 */
  transition: width .2s ease, transform .2s ease;
}

/* 한글 주석: 탭 아래/위 불필요한 공간 제거 (탭 밑 콘텐츠 간격 타이트) */
.tabs.compact + .tab-panels,
.tabbar.compact + .tab-panels {
  margin-top: 6px;  /* 예: 기존 14~16px → 6px */
}

/* ── 접근성: 실제 터치 타깃은 키워서 오동작 방지 ── */
.tabs.compact [role="tab"]::after,
.tabbar.compact [role="tab"]::after,
.tabs.compact .tab::after,
.tabbar.compact .tab::after {
  content: "";
  position: absolute;
  inset: -6px;    /* 시각보다 6px 크게 잡아 터치 영역 확보(44px+) */
}