/* =====================================================================
   Rift Games — 모바일 우선 HUD (가로 화면 기준, 세로/PC 도 대응)
   ===================================================================== */
:root {
  --bg: #0d1220;
  --panel: rgba(16, 22, 38, 0.92);
  --panel-2: rgba(30, 40, 64, 0.9);
  --line: rgba(160, 190, 255, 0.18);
  --text: #eef2ff;
  --muted: #9aa6c4;
  --gold: #ffcf3a;
  --hp: #4ad16a;
  --mp: #3f8cff;
  --exp: #ffd84a;
  --danger: #ff4a4a;
  --accent: #8fd3ff;
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --btn: clamp(48px, 7.2vmin, 64px);
  color-scheme: dark; /* 게임은 어두운 화면 하나로 고정 */
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text);
  font-family: 'Pretendard', 'Apple SD Gothic Neo', 'Malgun Gothic', system-ui, sans-serif;
  user-select: none; -webkit-user-select: none; touch-action: none;
}
button { font: inherit; color: inherit; cursor: pointer; border: none; background: none; }
.hidden { display: none !important; }

#app { position: fixed; inset: 0; }
#game { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#float-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }

/* ---------------- 플로팅 텍스트 (데미지 숫자) ---------------- */
.ft {
  position: absolute; left: 0; top: 0; font-weight: 900; white-space: nowrap;
  text-shadow: 0 2px 0 #000, 0 0 4px #000; will-change: transform, opacity; font-size: 18px;
}
.ft.normal { color: #fff; }
.ft.skill { color: #ffb34a; font-size: 20px; }
.ft.crit { color: #ffe23a; font-size: 26px; }
.ft.crit::after { content: '!'; }
.ft.taken { color: #ff5a5a; font-size: 18px; }
.ft.heal { color: #6aff8a; font-size: 16px; }
.ft.gold { color: var(--gold); font-size: 15px; }

/* ---------------- HUD 공통 ---------------- */
#hud { position: absolute; inset: 0; pointer-events: none; }
#hud > * { pointer-events: auto; }
.bar { position: relative; height: 14px; background: rgba(0,0,0,0.55); border-radius: 7px; overflow: hidden; border: 1px solid rgba(255,255,255,0.15); }
.bar .fill { position: absolute; inset: 0; transform-origin: left; transition: transform 0.12s linear; }
.bar span { position: absolute; inset: 0; font-size: 10px; line-height: 13px; text-align: center; font-weight: 700; text-shadow: 0 1px 1px #000; }
.bar.hp .fill { background: linear-gradient(#6ae88a, #2fae4f); }
.bar.mp .fill { background: linear-gradient(#6aaaff, #2f6ad9); }
.bar.res { height: 11px; margin-top: 2px; }
.bar.res .fill { background: linear-gradient(90deg, #ff9a3a, #ff4a2a); }
.bar.res span { font-size: 9px; }
.bar.res.full { border-color: #ffb04a; box-shadow: 0 0 10px rgba(255,120,40,0.9); animation: furyPulse 0.7s ease-in-out infinite alternate; }
@keyframes furyPulse { to { box-shadow: 0 0 18px rgba(255,90,30,1); } }
.form-tag { font-size: 11px; font-weight: 900; padding: 0 6px; border-radius: 8px; background: linear-gradient(90deg, #ff7a2a, #c83a6a); color: #fff; }
.skill-btn.ready-glow { border-color: #ff9a3a !important; animation: readyGlow 0.7s ease-in-out infinite alternate; }
@keyframes readyGlow { from { box-shadow: 0 0 8px rgba(255,140,50,0.7); } to { box-shadow: 0 0 22px rgba(255,90,30,1); } }
.bar .shield { position: absolute; top: 0; bottom: 0; left: 0; background: rgba(255,255,255,0.75); transform-origin: left; }

.hud-tl {
  position: absolute; top: 10px; left: calc(10px + var(--safe-l)); display: flex; gap: 8px; align-items: flex-start;
  background: linear-gradient(90deg, rgba(10,14,26,0.75), rgba(10,14,26,0)); padding: 6px 30px 6px 6px; border-radius: 12px;
}
.portrait { width: 58px; height: 58px; border-radius: 50%; overflow: hidden; border: 2px solid var(--gold); flex: none; background: #223; }
.portrait-img, .portrait-fallback { width: 100%; height: 100%; object-fit: cover; display: flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 900; }
.hud-info { width: clamp(150px, 22vw, 230px); display: flex; flex-direction: column; gap: 4px; }
.hud-name { font-size: 13px; font-weight: 800; text-shadow: 0 1px 2px #000; }
.hud-name .lv { color: var(--gold); }
.buffs { display: flex; gap: 4px; flex-wrap: wrap; min-height: 20px; }
.buff {
  position: relative; width: 22px; height: 22px; border-radius: 5px; font-size: 10px; font-weight: 900;
  display: flex; align-items: center; justify-content: center; border: 1px solid rgba(255,255,255,0.5); color: #111;
}
.buff i { position: absolute; bottom: -2px; right: -3px; font-style: normal; font-size: 9px; color: #fff; text-shadow: 0 0 2px #000; }

.hud-tc { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 5px; width: min(38vw, 420px); }
.zone-name { background: rgba(10,14,26,0.75); border: 1px solid var(--line); padding: 4px 14px; border-radius: 20px; font-size: 13px; font-weight: 800; }
.gauge { position: relative; width: 70%; height: 10px; background: rgba(0,0,0,0.55); border-radius: 5px; overflow: hidden; border: 1px solid rgba(255,120,80,0.5); }
.gauge .fill { position: absolute; inset: 0; background: linear-gradient(90deg, #ff8a3a, #ff3a3a); transform-origin: left; }
.gauge span { position: absolute; inset: 0; font-size: 8px; line-height: 9px; text-align: center; font-weight: 800; }
.summon-btn {
  background: linear-gradient(#ff6a4a, #c8302f); padding: 6px 16px; border-radius: 20px; font-weight: 900; font-size: 14px;
  box-shadow: 0 0 16px rgba(255,80,60,0.8); animation: pulse 1s infinite alternate;
}
@keyframes pulse { to { transform: scale(1.08); } }
.boss-bar { width: 100%; text-align: center; }
.boss-name { font-weight: 900; font-size: 15px; color: #ffb0a0; text-shadow: 0 2px 2px #000; }
.bar.boss { height: 18px; border-color: rgba(255,90,70,0.6); }
.bar.boss .fill { background: linear-gradient(#ff6a5a, #b8201f); }
.bar.boss span { font-size: 11px; line-height: 17px; }
.boss-skill { min-height: 20px; font-size: 14px; font-weight: 900; color: #ffe27a; text-shadow: 0 2px 2px #000; opacity: 0; transition: opacity 0.2s; }
.boss-skill.show { opacity: 1; }

.hud-tr { position: absolute; top: 10px; right: calc(10px + var(--safe-r)); display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.gold { background: rgba(10,14,26,0.75); border: 1px solid var(--line); padding: 4px 12px 4px 6px; border-radius: 20px; font-weight: 900; color: var(--gold); display: flex; align-items: center; gap: 6px; font-size: 14px; }
.coin { width: 16px; height: 16px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff3a0, #e0a800); box-shadow: 0 0 4px #ffcf3a; }
.menu-btns { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; max-width: 60vw; }
.menu-btns button {
  position: relative; width: 40px; height: 40px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); font-size: 18px;
}
.badge { position: absolute; top: -4px; right: -4px; min-width: 16px; height: 16px; padding: 0 3px; border-radius: 8px; background: var(--danger); font-size: 10px; font-style: normal; font-weight: 900; line-height: 16px; }

/* ---------------- 대시 버튼 ---------------- */
.dash-btn {
  position: absolute; right: calc(var(--btn) * 0.05); bottom: calc(var(--btn) * 1.72); width: calc(var(--btn) * 0.82); height: calc(var(--btn) * 0.82);
  border-radius: 50%; background: radial-gradient(circle at 40% 35%, #bff3ff, #2f8ad9); border: 2px solid rgba(255,255,255,0.7);
  box-shadow: 0 3px 8px rgba(0,0,0,0.5); overflow: visible;
}
.dash-btn .dash-icon { font-size: calc(var(--btn) * 0.42); font-weight: 900; line-height: 1; color: #0d2a4a; }
.dash-btn .dash-label { position: absolute; bottom: -7px; left: 50%; transform: translateX(-50%); font-size: 9px; font-weight: 900; background: #000a; padding: 0 4px; border-radius: 5px; }
.dash-btn .cd { position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(rgba(0,0,0,0.7) var(--p, 0%), transparent 0); pointer-events: none; }
.dash-btn.pressed { transform: scale(0.9); }

/* ---------------- 오브젝트 타이머 · 보스 등장 알림 ---------------- */
.objectives { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.obj-chip { background: rgba(10,14,26,0.75); border: 1px solid var(--line); border-radius: 12px; padding: 2px 8px; font-size: 11px; font-weight: 800; white-space: nowrap; }
.obj-chip.alive { border-color: #ffd040; color: #ffd040; animation: pulse 0.8s infinite alternate; }
.boss-head { display: flex; align-items: center; gap: 8px; }
.boss-main { flex: 1; min-width: 0; }
.boss-portrait { width: 40px; height: 40px; border-radius: 50%; overflow: hidden; border: 2px solid #ff8a7a; flex: none; background: #311; }
.boss-portrait:empty { display: none; }
#announce {
  position: absolute; top: 22%; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 14px; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(30,10,30,0.88) 15%, rgba(30,10,30,0.88) 85%, transparent); padding: 10px 50px;
  animation: announce 3.2s forwards;
}
.announce-portrait { width: 64px; height: 64px; border-radius: 50%; overflow: hidden; border: 3px solid #ffd040; flex: none; }
.announce-portrait:empty { display: none; }
.announce-title { font-size: 24px; font-weight: 900; color: #ffd040; text-shadow: 0 2px 6px #000; white-space: nowrap; }
.announce-sub { font-size: 13px; color: #e8d8ff; white-space: nowrap; }
@keyframes announce { 0% { opacity: 0; transform: translateX(-50%) scale(1.2); } 8%, 80% { opacity: 1; transform: translateX(-50%) scale(1); } 100% { opacity: 0; } }
.ft.dodge { color: #9fe8ff; font-size: 22px; font-style: italic; }

/* ---------------- 배경음악 파일 ---------------- */
.file-btn { display: inline-flex; align-items: center; cursor: pointer; }
.music-list { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.music-row { display: grid; grid-template-columns: 120px 1fr auto; gap: 10px; align-items: center; padding: 6px 8px; border-radius: 8px; background: rgba(0,0,0,0.25); font-size: 13px; }
.music-slot { font-weight: 800; }
.music-status { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.music-on { color: #6aff8a; }
.music-actions { display: flex; gap: 6px; }
.music-actions .btn { padding: 4px 10px; font-size: 12px; }
@media (max-width: 520px) { .music-row { grid-template-columns: 1fr auto; } .music-status { grid-column: 1 / -1; grid-row: 2; } }
.select-music { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; }
.share-btn { background: linear-gradient(#ffe24a, #f2c400); color: #3a2a00; }
.share-result { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 13px; color: #c8f0d0; text-align: center; max-width: min(520px, 100%); }
.share-result input { width: min(480px, 100%); padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: rgba(0,0,0,0.4); color: var(--text); font-size: 13px; }

/* ---------------- 확인 창 ---------------- */
.dialog-backdrop { position: absolute; inset: 0; z-index: 50; background: rgba(0,0,0,0.55); display: flex; align-items: center; justify-content: center; padding: 16px; }
.dialog { width: min(360px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px; box-shadow: 0 20px 60px rgba(0,0,0,0.6); }
.dialog-msg { margin: 0 0 16px; line-height: 1.5; font-size: 14px; }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; }
.dialog-actions .btn { padding: 9px 16px; }
.btn:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------------- 세로 화면 안내 (휴대폰) ---------------- */
#rotate-hint { display: none; }
@media (orientation: portrait) and (pointer: coarse) {
  #rotate-hint:not(.dismissed) {
    display: flex; position: absolute; inset: 0; z-index: 60; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
    background: rgba(8,12,22,0.94); text-align: center; padding: 24px;
  }
}
#rotate-hint .phone { width: 44px; height: 74px; border: 3px solid var(--accent); border-radius: 9px; animation: rotatePhone 1.8s ease-in-out infinite; }
@keyframes rotatePhone { 0%, 25% { transform: rotate(0); } 60%, 100% { transform: rotate(-90deg); } }
#rotate-hint p { margin: 0; font-size: 15px; line-height: 1.5; }
@media (prefers-reduced-motion: reduce) { #rotate-hint .phone { animation: none; transform: rotate(-90deg); } }

/* ---------------- 콤보 ---------------- */
#combo {
  position: absolute; right: calc(var(--btn) * 5.2 + 20px); top: 34%; pointer-events: none; text-align: right;
  --c: #ffffff; transform-origin: right center;
}
#combo.ending { animation: comboEnd 0.5s forwards; }
@keyframes comboEnd { to { opacity: 0; transform: translateX(20px) scale(0.8); } }
.combo-num {
  font-size: clamp(40px, 9vmin, 72px); font-weight: 900; font-style: italic; line-height: 0.9; color: var(--c); letter-spacing: -2px;
  text-shadow: 0 3px 0 rgba(0,0,0,0.6), 0 0 18px var(--c), 0 0 4px #000;
}
.combo-num.pop { animation: comboPop 0.18s ease-out; }
.combo-num.finisher { animation: comboFinisher 0.32s ease-out; }
@keyframes comboPop { 0% { transform: scale(1.45); } 100% { transform: scale(1); } }
@keyframes comboFinisher { 0% { transform: scale(1.9) rotate(-6deg); filter: brightness(2.5); } 60% { transform: scale(0.95) rotate(2deg); } 100% { transform: scale(1); filter: none; } }
.combo-label { font-size: 14px; font-weight: 900; font-style: italic; letter-spacing: 4px; color: var(--c); text-shadow: 0 2px 2px #000; margin-top: 2px; }
.combo-timer { width: 110px; height: 4px; margin: 4px 0 0 auto; background: rgba(0,0,0,0.5); border-radius: 2px; overflow: hidden; }
.combo-timer i { display: block; height: 100%; background: var(--c); transform-origin: right; }
.combo-bonus { font-size: 11px; font-weight: 800; color: #ffe27a; text-shadow: 0 1px 2px #000; margin-top: 3px; min-height: 14px; }
#combo-milestone {
  position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%); pointer-events: none; white-space: nowrap; text-align: center;
  font-size: clamp(30px, 7vmin, 56px); font-weight: 900; font-style: italic; color: var(--c, #ffe27a);
  text-shadow: 0 4px 0 rgba(0,0,0,0.6), 0 0 24px var(--c, #ffe27a); animation: milestone 1.6s forwards;
}
#combo-milestone small { display: block; font-size: 0.42em; letter-spacing: 6px; color: #fff; }
@keyframes milestone { 0% { opacity: 0; transform: translate(-50%, -50%) scale(2.2); } 12% { opacity: 1; transform: translate(-50%, -50%) scale(0.95); } 20% { transform: translate(-50%, -50%) scale(1); } 75% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -70%) scale(1.05); } }
#combo-flash { position: absolute; inset: 0; pointer-events: none; opacity: 0; background: radial-gradient(ellipse at center, transparent 40%, var(--c, #ffe27a) 140%); }
@media (orientation: portrait) { #combo { right: 16px; top: 46%; } }
@media (max-height: 420px) { #combo { top: 28%; } }

/* ---------------- 미니맵 ---------------- */
.minimap-wrap {
  position: relative; width: clamp(96px, 20vmin, 150px); aspect-ratio: 1; border-radius: 12px; overflow: hidden;
  border: 2px solid rgba(255,255,255,0.35); box-shadow: 0 4px 12px rgba(0,0,0,0.5); cursor: pointer; background: rgba(10,14,26,0.7);
}
#minimap { width: 100%; height: 100%; display: block; }
.minimap-coord { position: absolute; left: 0; right: 0; bottom: 0; font-size: 9px; text-align: center; background: rgba(0,0,0,0.5); padding: 1px 0; font-weight: 700; }

/* ---------------- 퀘스트 추적기 ---------------- */
.quest-tracker { position: absolute; top: 112px; left: calc(10px + var(--safe-l)); width: clamp(170px, 24vw, 240px); display: flex; flex-direction: column; gap: 6px; z-index: 2; }
.qt-item {
  background: linear-gradient(90deg, rgba(10,14,26,0.82), rgba(10,14,26,0.45)); border-left: 3px solid var(--gold); border-radius: 8px;
  padding: 5px 8px; font-size: 11px; cursor: pointer; text-align: left; width: 100%;
}
.qt-item.bounty { border-left-color: var(--accent); }
.qt-item .qt-head { display: flex; justify-content: space-between; gap: 6px; font-weight: 800; font-size: 12px; }
.qt-item .qt-kind { color: var(--gold); font-size: 10px; }
.qt-item.bounty .qt-kind { color: var(--accent); }
.qt-item .qt-desc { color: #c8d0e8; margin-top: 2px; }
.qt-item .qt-bar { height: 4px; background: rgba(255,255,255,0.12); border-radius: 2px; margin-top: 4px; overflow: hidden; }
.qt-item .qt-bar i { display: block; height: 100%; background: var(--gold); }
.qt-item.bounty .qt-bar i { background: var(--accent); }
.qt-item.done { box-shadow: 0 0 0 1px var(--gold), 0 0 14px rgba(255,207,58,0.6); animation: pulse 0.8s infinite alternate; }
.qt-item.done .qt-desc { color: var(--gold); font-weight: 800; }

/* 퀘스트 패널 */
.quest-list { display: flex; flex-direction: column; gap: 6px; }
.quest-row { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); }
.quest-row.past { opacity: 0.5; }
.quest-row.current { border-color: var(--gold); }
.quest-row.future { opacity: 0.6; }
.quest-row .q-no { width: 28px; text-align: center; font-weight: 900; color: var(--muted); }
.quest-row .q-info { flex: 1; min-width: 0; }
.quest-row .q-title { font-weight: 800; }
.quest-row .q-reward { font-size: 11px; color: var(--gold); }

/* 피격 붉은 테두리 */
#hit-vignette { position: absolute; inset: 0; pointer-events: none; opacity: 0; background: radial-gradient(ellipse at center, transparent 55%, rgba(255,0,0,0.55) 100%); }

/* 데미지 숫자 강화: 치명타는 흔들리며 등장 */
.ft.crit { animation: critPop 0.25s ease-out; }
@keyframes critPop { 0% { filter: brightness(2.5); } 100% { filter: none; } }

/* ---------------- 조이스틱 ---------------- */
.joy-zone { position: absolute; left: 0; bottom: 0; width: 45%; height: 60%; }
.joy-base {
  position: absolute; left: calc(40px + var(--safe-l)); bottom: calc(40px + var(--safe-b)); width: 130px; height: 130px; border-radius: 50%;
  background: rgba(255,255,255,0.08); border: 2px solid rgba(255,255,255,0.22); transition: opacity 0.2s; opacity: 0.6;
}
.joy-base.active { opacity: 1; transition: none; }
.joy-knob { position: absolute; left: 50%; top: 50%; width: 58px; height: 58px; margin: -29px 0 0 -29px; border-radius: 50%; background: rgba(255,255,255,0.35); border: 2px solid rgba(255,255,255,0.5); }

/* ---------------- 전투 버튼 ---------------- */
.hud-br { position: absolute; right: calc(16px + var(--safe-r)); bottom: calc(24px + var(--safe-b)); width: calc(var(--btn) * 4.4); height: calc(var(--btn) * 3.6); }
.attack-btn {
  position: absolute; right: 0; bottom: 0; width: calc(var(--btn) * 1.6); height: calc(var(--btn) * 1.6); border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #ffdf8a, #d98a1f); border: 3px solid rgba(255,255,255,0.6); font-size: calc(var(--btn) * 0.7);
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}
.attack-btn.pressed { transform: scale(0.92); filter: brightness(1.2); }
.skill-wheel { position: absolute; inset: 0; pointer-events: none; }
.skill-btn {
  position: absolute; width: var(--btn); height: var(--btn); border-radius: 50%; pointer-events: auto; overflow: visible;
  background: var(--panel-2); border: 2px solid rgba(255,255,255,0.45); box-shadow: 0 3px 8px rgba(0,0,0,0.5);
}
.skill-btn .icon { position: absolute; inset: 3px; border-radius: 50%; overflow: hidden; display: flex; }
.icon-img { width: 100%; height: 100%; object-fit: cover; }
.icon-fallback { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 15px; color: #fff; text-shadow: 0 1px 2px #000; border-radius: inherit; }
.skill-btn .cd { position: absolute; inset: 3px; border-radius: 50%; background: conic-gradient(rgba(0,0,0,0.72) var(--p, 0%), transparent 0); pointer-events: none; }
.skill-btn .cd-text { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 16px; text-shadow: 0 1px 3px #000; pointer-events: none; }
.skill-btn .slot { position: absolute; bottom: -6px; left: 50%; transform: translateX(-50%); font-size: 10px; font-weight: 900; background: #000a; padding: 0 5px; border-radius: 6px; }
.skill-btn .pips { position: absolute; top: -7px; left: 50%; transform: translateX(-50%); display: flex; gap: 2px; }
.skill-btn .pips i { width: 6px; height: 6px; border-radius: 2px; background: #333a; border: 1px solid #fff6; }
.skill-btn .pips i.on { background: var(--gold); }
.skill-btn.locked { filter: grayscale(1) brightness(0.55); }
.skill-btn.nomana .icon { filter: saturate(0.3) brightness(0.7) hue-rotate(180deg); }
.skill-btn .up {
  position: absolute; top: -14px; right: -12px; width: 24px; height: 24px; border-radius: 50%; background: linear-gradient(#ffe27a, #e0a800);
  color: #3a2a00; font-weight: 900; font-size: 18px; line-height: 22px; border: 2px solid #fff; pointer-events: auto; animation: pulse 0.7s infinite alternate;
}
.side-btns { position: absolute; left: calc(var(--btn) * -1.25); bottom: 0; display: flex; flex-direction: column; gap: 8px; }
.auto-btn, .potion-btn {
  width: calc(var(--btn) * 0.95); height: calc(var(--btn) * 0.95); border-radius: 14px; background: var(--panel); border: 2px solid var(--line);
  font-weight: 900; font-size: 12px; position: relative;
}
.auto-btn.on { background: linear-gradient(#4ad1ff, #1f7ad9); border-color: #fff; box-shadow: 0 0 12px #4ad1ff; animation: pulse 1.2s infinite alternate; }
.potion-btn b { position: absolute; bottom: 2px; right: 6px; font-size: 11px; }
.wave-btn {
  position: relative; width: calc(var(--btn) * 0.95); height: calc(var(--btn) * 0.95); border-radius: 14px; overflow: hidden;
  background: linear-gradient(#ff6a4a, #a8202a); border: 2px solid rgba(255,255,255,0.6); font-weight: 900; font-size: 11px; line-height: 1.1;
}
.wave-btn .cd { position: absolute; inset: 0; background: conic-gradient(rgba(0,0,0,0.7) var(--p, 0%), transparent 0); pointer-events: none; }
.wave-btn .cd-num { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 15px; text-shadow: 0 1px 3px #000; pointer-events: none; }
.pot { display: block; width: 18px; height: 24px; margin: 0 auto; border-radius: 6px 6px 9px 9px; border: 2px solid #fff8; }
.pot.hp { background: linear-gradient(#ff7a8a, #c8203a); }
.pot.mp { background: linear-gradient(#7ab0ff, #2050c8); }

.exp-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 8px; background: rgba(0,0,0,0.6); }
.exp-bar .fill { position: absolute; inset: 0; background: linear-gradient(90deg, #ffe27a, #ffb83a); transform-origin: left; }
.exp-bar span { position: absolute; right: 8px; bottom: 9px; font-size: 10px; font-weight: 800; text-shadow: 0 1px 2px #000; }

#toast-area { position: absolute; top: 34%; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
.toast { background: rgba(10,14,26,0.85); border: 1px solid var(--line); padding: 6px 16px; border-radius: 18px; font-weight: 800; font-size: 14px; animation: toast 2.2s forwards; white-space: nowrap; }
.toast.level { color: var(--gold); font-size: 22px; border-color: var(--gold); }
.toast.boss { color: #ff8a7a; font-size: 18px; border-color: #ff5a4a; }
.toast.buff { color: #8fd3ff; }
.toast.gold { color: var(--gold); }
.toast.zone { font-size: 24px; background: none; border: none; text-shadow: 0 2px 6px #000; }
.toast.quest { color: #ffe27a; border-color: #ffe27a; font-size: 17px; background: rgba(40,30,0,0.85); }
@keyframes toast { 0% { opacity: 0; transform: translateY(10px); } 10%, 75% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-14px); } }

#death-screen { position: absolute; inset: 0; background: rgba(40,0,0,0.45); display: flex; align-items: center; justify-content: center; pointer-events: none; }
.death-box { text-align: center; text-shadow: 0 2px 6px #000; }
.death-box h2 { font-size: 34px; margin: 0 0 8px; color: #ff8a7a; }

/* ---------------- 메뉴 패널 ---------------- */
#menu { position: absolute; inset: 0; z-index: 20; background: rgba(0,0,0,0.32); display: flex; align-items: center; justify-content: center; padding: 12px; }
.menu-panel {
  position: relative; width: min(940px, 100%); height: min(600px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}
.menu-tabs { display: flex; gap: 4px; padding: 8px 56px 0 8px; border-bottom: 1px solid var(--line); overflow-x: auto; flex: none; }
.menu-tabs button { padding: 8px 14px; border-radius: 10px 10px 0 0; color: var(--muted); font-weight: 800; white-space: nowrap; position: relative; }
.menu-tabs button.active { background: var(--panel-2); color: var(--text); }
.menu-close { position: absolute; top: 6px; right: 8px; width: 38px; height: 38px; border-radius: 10px; background: var(--panel-2); font-size: 18px; }
.menu-body { flex: 1; overflow: auto; padding: 14px; touch-action: pan-y; }
.menu-body h3 { margin: 0 0 10px; font-size: 15px; }
.muted { color: var(--muted); font-size: 12px; }
.row { display: flex; gap: 14px; flex-wrap: wrap; }
.col { flex: 1; min-width: 240px; }
.card { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.btn { background: linear-gradient(#4a7aff, #2f4fc8); padding: 6px 12px; border-radius: 8px; font-weight: 800; font-size: 13px; }
.btn.gold { background: linear-gradient(#ffd84a, #d99a1f); color: #2a1a00; }
.btn.red { background: linear-gradient(#ff6a5a, #c8302f); }
.btn.ghost { background: rgba(255,255,255,0.08); border: 1px solid var(--line); }
.btn:disabled { filter: grayscale(1) brightness(0.6); cursor: not-allowed; }

/* 능력치 표 */
.stat-grid { display: grid; grid-template-columns: 1fr auto; gap: 4px 14px; font-size: 13px; }
.stat-grid b { text-align: right; }

/* 가방 (칸 제한 없음 → 스크롤) */
.inv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 8px; max-height: 260px; overflow-y: auto; padding-right: 4px; }
.inv-slot.selected { border-color: var(--gold) !important; box-shadow: 0 0 0 1px var(--gold) inset; }
.inv-slot .item-icon { position: relative; }
.inv-slot .plus, .item-icon .plus { position: absolute; right: -4px; top: -4px; font-style: normal; font-size: 10px; font-weight: 900; background: var(--gold); color: #2a1a00; border-radius: 6px; padding: 0 4px; }
.item-detail { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
.passive-line { font-size: 11px; color: #9fd8ff; margin-top: 2px; }
.inv-slot { aspect-ratio: 1; border-radius: 10px; background: rgba(0,0,0,0.35); border: 1px dashed var(--line); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 4px; font-size: 11px; text-align: center; }
.inv-slot.filled { border-style: solid; cursor: pointer; }
.inv-slot .item-icon { width: 60%; aspect-ratio: 1; }

/* 상점 */
.shop-tabs { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.shop-tabs button { padding: 5px 12px; border-radius: 16px; background: rgba(255,255,255,0.06); font-weight: 700; font-size: 13px; }
.shop-tabs button.active { background: var(--accent); color: #0d1220; }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.shop-item { display: flex; gap: 10px; align-items: center; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
.shop-item .item-icon { width: 44px; height: 44px; flex: none; border-radius: 8px; overflow: hidden; }
.shop-item .info { flex: 1; min-width: 0; }
.shop-item .name { font-weight: 800; font-size: 13px; }
.shop-item .desc { font-size: 11px; color: var(--muted); }
.shop-item .from { font-size: 10px; color: #b8c8ff; }
.shop-item .price { color: var(--gold); font-weight: 900; font-size: 13px; }
.tier-1 { border-left: 3px solid #9aa6c4; }
.tier-2 { border-left: 3px solid #4aa8ff; }
.tier-3 { border-left: 3px solid #ff9a3c; }
.tier-0 { border-left: 3px solid #6aff8a; }
.tier-4 { border-left: 3px solid #ff4a5a; }
.inv-slot.tier-4 { background: radial-gradient(circle at 50% 35%, rgba(255,90,60,0.28), rgba(0,0,0,0.35) 70%); border-color: rgba(255,120,80,0.6); }

/* 신화 아이템 */
.mythic-name {
  font-weight: 900; background: linear-gradient(90deg, #ffe08a, #ff7a4a 45%, #ff3a6a 75%, #ffe08a);
  background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: mythicShine 3s linear infinite;
}
@keyframes mythicShine { to { background-position: -200% 0; } }
.item-icon.mythic-icon { box-shadow: 0 0 0 2px #ffb84a, 0 0 14px rgba(255,110,60,0.9); border-radius: 8px; animation: mythicPulse 1.8s ease-in-out infinite alternate; }
@keyframes mythicPulse { to { box-shadow: 0 0 0 2px #ffe08a, 0 0 22px rgba(255,80,60,1); } }

/* 히든 아이템 (보스 전리품 · 무지개) */
.tier-5 { border-left: 3px solid #b88aff; }
.inv-slot.tier-5 { background: radial-gradient(circle at 50% 35%, rgba(184,138,255,0.3), rgba(0,0,0,0.35) 70%); border: 1px solid rgba(220,190,255,0.7); }
.hidden-name {
  font-weight: 900; background: linear-gradient(90deg, #ff5a6a, #ffb84a, #fff27a, #7aff8a, #6ad8ff, #b88aff, #ff5a6a);
  background-size: 300% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: mythicShine 2.4s linear infinite;
}
.item-icon.hidden-icon { border-radius: 8px; box-shadow: 0 0 0 2px #fff, 0 0 16px rgba(184,138,255,0.95); animation: hiddenGlow 2.4s linear infinite; }
@keyframes hiddenGlow {
  0% { box-shadow: 0 0 0 2px #ff9aa8, 0 0 16px rgba(255,90,106,0.9); }
  33% { box-shadow: 0 0 0 2px #fff27a, 0 0 18px rgba(255,242,122,0.9); }
  66% { box-shadow: 0 0 0 2px #8af0ff, 0 0 18px rgba(106,216,255,0.9); }
  100% { box-shadow: 0 0 0 2px #ff9aa8, 0 0 16px rgba(255,90,106,0.9); }
}
.hidden-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 6px; }
.hidden-card { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 4px; border-radius: 10px; background: rgba(0,0,0,0.3); border: 1px dashed var(--line); font-size: 10px; text-align: center; color: var(--muted); }
.hidden-card .item-icon { width: 44px; height: 44px; overflow: hidden; }
.hidden-card:not(.found) .item-icon { animation: none; box-shadow: none; filter: grayscale(1) brightness(0.6); }
.hidden-card.found { border: 1px solid rgba(220,190,255,0.6); color: #f0e8ff; }
.hidden-unknown { background: #1a1a2a; font-size: 22px; color: #8a8aa8; }
.shop-tabs button.tab-mythic { color: #ffb08a; }
.shop-tabs button.tab-enhance { color: #ffe08a; }
.shop-tabs button.tab-mythic.active { background: linear-gradient(90deg, #ff9a4a, #ff3a6a); color: #fff; }
.shop-tabs button.tab-enhance.active { background: linear-gradient(90deg, #ffe08a, #d99a1f); color: #2a1a00; }
.mythic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 10px; }
.mythic-card {
  position: relative; display: flex; flex-direction: column; gap: 6px; padding: 12px; border-radius: 14px;
  background: linear-gradient(160deg, rgba(90,30,30,0.55), rgba(24,20,40,0.95) 60%); border: 1px solid rgba(255,140,90,0.35);
}
.mythic-card.ready { border-color: #ffb84a; box-shadow: 0 0 18px rgba(255,140,60,0.45), inset 0 0 20px rgba(255,120,60,0.15); }
.mythic-head { display: flex; gap: 10px; align-items: center; }
.mythic-head .item-icon { width: 52px; height: 52px; flex: none; overflow: hidden; }
.mythic-head .mythic-name { font-size: 15px; }
.mythic-card .desc { font-size: 12px; color: #ffe6c8; }
.mythic-card .lore { font-size: 11px; color: var(--muted); font-style: italic; }
.recipe { display: flex; align-items: stretch; gap: 4px; flex-wrap: wrap; margin-top: 2px; }
.recipe .mat { flex: 1; min-width: 74px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px; border-radius: 10px; background: rgba(0,0,0,0.35); border: 1px dashed rgba(255,255,255,0.18); font-size: 10px; text-align: center; cursor: pointer; }
.recipe .mat .item-icon { width: 34px; height: 34px; position: relative; }
.recipe .mat b { font-size: 10px; color: var(--muted); }
.recipe .mat.have { border: 1px solid #6aff8a; cursor: default; }
.recipe .mat.have b { color: #6aff8a; }
.recipe .mat.fee { cursor: default; justify-content: center; }
.recipe .mat.fee b { color: var(--gold); font-size: 12px; }
.recipe .mat-plus { align-self: center; color: var(--muted); font-weight: 900; }
.btn.mythic-btn { background: linear-gradient(90deg, #ff9a4a, #ff3a6a); color: #fff; padding: 8px; font-size: 14px; text-shadow: 0 1px 2px rgba(0,0,0,0.5); }
.btn.mythic-btn:not(:disabled) { animation: mythicPulse 1.4s ease-in-out infinite alternate; }

/* 강화 */
.stars { display: flex; align-items: center; gap: 1px; font-size: 13px; line-height: 1; margin: 3px 0; flex-wrap: wrap; }
.star { color: rgba(255,255,255,0.18); }
.star.on { text-shadow: 0 0 6px currentColor; }
.star-gap { width: 6px; }
.enh-wrap { display: grid; grid-template-columns: minmax(170px, 0.8fr) 1.4fr; gap: 10px; }
.enh-list { display: flex; flex-direction: column; gap: 5px; max-height: 420px; overflow-y: auto; padding-right: 4px; }
.enh-row { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); cursor: pointer; font-size: 12px; }
.enh-row .item-icon { width: 30px; height: 30px; flex: none; position: relative; }
.enh-row span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.enh-row.selected { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }
.enh-panel { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 14px; background: radial-gradient(circle at 30% 0%, rgba(255,210,90,0.12), var(--panel-2) 60%); border: 1px solid var(--line); overflow: hidden; }
.enh-panel.plus-1 { border-color: rgba(90,200,255,0.6); }
.enh-panel.plus-2 { border-color: rgba(208,122,255,0.7); box-shadow: inset 0 0 24px rgba(208,122,255,0.15); }
.enh-panel.plus-3 { border-color: #ffd23a; box-shadow: inset 0 0 30px rgba(255,210,58,0.25), 0 0 16px rgba(255,210,58,0.35); }
.enh-item { display: flex; gap: 12px; align-items: center; }
.enh-item .item-icon { width: 64px; height: 64px; flex: none; position: relative; border-radius: 10px; }
.enh-item .item-icon .plus { font-size: 12px; }
.enh-name { font-weight: 900; font-size: 15px; }
.enh-item.hammering .item-icon { animation: hammer 0.16s ease-in-out infinite alternate; }
.enh-item.hammering .item-icon::after { content: '✦'; position: absolute; inset: -10px; display: grid; place-items: center; color: #fff6c8; font-size: 34px; text-shadow: 0 0 12px #ffd23a; animation: sparkle 0.32s linear infinite; pointer-events: none; }
@keyframes hammer { from { transform: rotate(-8deg) scale(1); } to { transform: rotate(8deg) scale(1.08); filter: brightness(1.5); } }
@keyframes sparkle { from { opacity: 1; transform: scale(0.6) rotate(0deg); } to { opacity: 0; transform: scale(1.4) rotate(90deg); } }
.enh-stats em { font-style: normal; color: #6aff8a; }
.enh-stats .arrow { font-style: normal; color: var(--muted); }
.milestone { font-size: 12px; font-weight: 800; color: #ffd23a; }
.enh-odds { display: grid; gap: 4px; font-size: 13px; padding: 8px 10px; border-radius: 10px; background: rgba(0,0,0,0.3); }
.enh-odds div { display: flex; justify-content: space-between; gap: 10px; }
.enh-odds span { color: var(--muted); }
.enh-odds b.chance { color: #ff9a4a; animation: mythicPulse 0.8s infinite alternate; }
.enh-btn { padding: 10px; font-size: 15px; }
.enh-max { text-align: center; font-weight: 900; color: #ffd23a; padding: 10px; text-shadow: 0 0 10px rgba(255,210,58,0.8); }
.enh-result {
  position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  background: rgba(10,12,24,0.78); pointer-events: none; animation: enhPop 1.8s ease-out forwards;
}
.enh-result b { font-size: 30px; font-weight: 900; letter-spacing: 2px; }
.enh-result span { font-size: 16px; font-weight: 800; }
.enh-result em { font-style: normal; color: #ff9a4a; font-weight: 800; }
.enh-result.success b { color: #ffd23a; text-shadow: 0 0 18px rgba(255,210,58,0.9); }
.enh-result.success { background: radial-gradient(circle, rgba(255,210,58,0.25), rgba(10,12,24,0.8) 70%); }
.enh-result.fail b { color: #9aa6c4; }
.enh-result.drop b { color: #ff6a5a; }
@keyframes enhPop { 0% { opacity: 0; transform: scale(1.3); } 12% { opacity: 1; transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; } }
@media (max-width: 640px) { .enh-wrap { grid-template-columns: 1fr; } .enh-list { max-height: 150px; } }

/* ---------------- 2대2 팀전 ---------------- */
.pvp-open-btn { font-size: 14px; padding: 8px 16px; }
#pvp-lobby { position: absolute; inset: 0; z-index: 70; background: rgba(5,8,16,0.72); display: flex; align-items: center; justify-content: center; padding: 12px; }
.pvp-panel { position: relative; width: min(860px, 100%); max-height: 100%; overflow-y: auto; background: var(--panel); border: 1px solid rgba(255,210,58,0.4); border-radius: 16px; padding: 16px; box-shadow: 0 20px 60px rgba(0,0,0,0.6); touch-action: pan-y; }
.pvp-panel h2 { margin: 0 0 12px; font-size: 20px; color: var(--gold); }
.pvp-wait { text-align: center; color: var(--muted); padding: 30px 0; }
.pvp-note { background: rgba(255,120,80,0.1); border: 1px solid rgba(255,140,90,0.4); border-radius: 12px; padding: 12px; font-size: 13px; line-height: 1.6; }
.pvp-note p { margin: 6px 0 0; color: #e8d8d0; }
.pvp-field { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 13px; margin-bottom: 12px; }
.pvp-field input, .pvp-join input { background: rgba(0,0,0,0.4); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 7px 10px; font: inherit; font-size: 14px; user-select: text; -webkit-user-select: text; }
.pvp-menu { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.pvp-big { padding: 10px 22px; font-size: 16px; }
.pvp-join { display: flex; gap: 6px; }
.pvp-join input { width: 110px; text-transform: uppercase; letter-spacing: 3px; font-weight: 900; }
.pvp-msg { color: #ffd27a; font-size: 13px; margin: 6px 0; }
.pvp-code-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; font-size: 14px; }
.pvp-code { font-size: 24px; letter-spacing: 5px; color: var(--gold); margin-left: 6px; }
.pvp-teams { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.pvp-team-col { border-radius: 12px; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.pvp-team-col h4 { margin: 0 0 2px; font-size: 14px; }
.pvp-team-col.blue { background: rgba(60,140,255,0.12); border: 1px solid rgba(90,170,255,0.5); }
.pvp-team-col.blue h4 { color: #8fd3ff; }
.pvp-team-col.red { background: rgba(255,80,70,0.12); border: 1px solid rgba(255,110,100,0.5); }
.pvp-team-col.red h4 { color: #ff9a8a; }
.pvp-player { display: flex; align-items: center; gap: 8px; padding: 6px; border-radius: 10px; background: rgba(0,0,0,0.3); min-height: 48px; font-size: 12px; }
.pvp-player.me { box-shadow: 0 0 0 1px var(--gold) inset; }
.pvp-player.empty { justify-content: center; color: var(--muted); border: 1px dashed var(--line); background: none; }
.pvp-pic { width: 38px; height: 38px; border-radius: 50%; overflow: hidden; flex: none; position: relative; display: block; }
.pvp-pinfo { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pvp-pinfo span { color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pvp-ready { font-size: 11px; padding: 2px 8px; border-radius: 10px; background: rgba(255,255,255,0.08); color: var(--muted); }
.pvp-ready.on { background: #3aa85a; color: #fff; }
.pvp-player.bot { background: rgba(255,255,255,0.04); border: 1px dashed rgba(255,255,255,0.18); }
.pvp-bot-del { width: 26px; height: 26px; border-radius: 8px; background: rgba(255,90,80,0.25); font-weight: 900; flex: none; }
.pvp-bot-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.pvp-team-pick { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
.btn.blue-on { background: linear-gradient(#5aaaff, #2f6ad9); }
.btn.red-on { background: linear-gradient(#ff7a6a, #c8302f); }
.pvp-start { margin-left: auto; padding: 8px 20px; font-size: 15px; }
.pvp-hero-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 6px; }
.pvp-hero { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 2px; border-radius: 10px; background: rgba(0,0,0,0.3); border: 1px solid var(--line); font-size: 11px; font-weight: 700; }
.pvp-hero .pvp-pic { width: 46px; height: 46px; }
.pvp-hero.on { border-color: var(--gold); box-shadow: 0 0 10px rgba(255,210,58,0.6); background: rgba(255,210,58,0.12); }
#pvp-score { position: absolute; top: calc(8px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); z-index: 15; display: flex; align-items: center; gap: 10px; padding: 4px 14px; border-radius: 20px; background: rgba(8,12,24,0.8); border: 1px solid var(--line); font-weight: 900; pointer-events: none; }
#pvp-score .blue { color: #6ab8ff; font-size: 22px; }
#pvp-score .red { color: #ff7a6a; font-size: 22px; }
#pvp-score .cb::after { content: '🔥'; font-size: 13px; margin-left: 2px; }
#pvp-score .cb { text-shadow: 0 0 10px rgba(255,140,60,0.9); }
.pvp-timer { font-size: 14px; color: var(--text); min-width: 44px; text-align: center; }
.pvp-team { font-size: 11px; padding: 2px 8px; border-radius: 10px; }
.pvp-team.blue { background: #2f6ad9; }
.pvp-team.red { background: #c8302f; }
#hud.pvp .quest-tracker, #hud.pvp #hud-gauge, #hud.pvp #hud-summon, #hud.pvp #hud-objectives, #hud.pvp #btn-wave, #hud.pvp .zone-name { display: none !important; }
#pvp-countdown { position: absolute; inset: 0; z-index: 75; display: flex; align-items: center; justify-content: center; font-size: 120px; font-weight: 900; color: var(--gold); text-shadow: 0 0 30px rgba(255,180,40,0.8); background: rgba(0,0,0,0.35); pointer-events: none; }
#pvp-result { position: absolute; inset: 0; z-index: 75; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.6); }
.pvp-result-box { text-align: center; padding: 24px 40px; border-radius: 18px; background: var(--panel); border: 2px solid var(--line); }
.pvp-result-box h2 { margin: 0; font-size: 54px; }
.pvp-result-box.win { border-color: var(--gold); box-shadow: 0 0 40px rgba(255,210,58,0.5); }
.pvp-result-box.win h2 { color: var(--gold); }
.pvp-result-box.lose h2 { color: #9aa6c4; }
.pvp-final { font-size: 24px; font-weight: 900; margin-top: 6px; }
.pvp-final .blue { color: #6ab8ff; }
.pvp-final .red { color: #ff7a6a; }
@media (max-width: 640px) { .pvp-teams { grid-template-columns: 1fr; } }

.pvp-panel h2 small { font-size: 12px; color: var(--muted); font-weight: 600; margin-left: 6px; }
.warn { color: #ffb070; }

/* 협동 레이드 */
.coop-open-btn { background: linear-gradient(180deg, #e8a050, #b8642a); color: #fff; border-color: #ffc07a; }
#coop-lobby { position: absolute; inset: 0; z-index: 70; background: rgba(12,6,4,0.75); display: flex; align-items: center; justify-content: center; padding: 12px; }
.coop-panel { border-color: rgba(255,150,80,0.5); }
.coop-panel h2 small { font-size: 12px; color: var(--muted); font-weight: 600; margin-left: 6px; }
.coop-party-box { display: flex; flex-direction: column; gap: 6px; padding: 8px; border-radius: 12px; background: rgba(255,140,60,0.08); border: 1px solid rgba(255,150,80,0.4); margin-bottom: 10px; }
.coop-party-box h4 { margin: 0 0 2px; font-size: 14px; color: #ffc08a; }
.coop-boss-card { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 12px; background: rgba(0,0,0,0.3); border: 1px solid rgba(255,150,80,0.35); margin: 8px 0; }
.coop-boss-card > .portrait-crop, .coop-boss-card > img, .coop-boss-card > .portrait-fallback { width: 64px; height: 64px; border-radius: 50%; flex: none; position: relative; overflow: hidden; display: block; }
.coop-boss-card div { display: flex; flex-direction: column; }
.coop-boss-card b { color: #ffc08a; font-size: 16px; }
.coop-boss-card span { color: var(--muted); font-size: 12px; }
#coop-hud { position: absolute; z-index: 14; left: calc(10px + env(safe-area-inset-left, 0px)); top: calc(118px + env(safe-area-inset-top, 0px)); width: 230px; display: flex; flex-direction: column; gap: 6px; pointer-events: none; font-size: 12px; }
.coop-phase { padding: 6px 9px; border-radius: 10px; background: rgba(20,10,6,0.78); border: 1px solid rgba(255,150,80,0.45); line-height: 1.45; }
.coop-phase b { color: #ffc08a; }
.coop-phase small { color: var(--muted); }
.coop-prog { display: block; height: 6px; margin: 4px 0 2px; border-radius: 3px; background: rgba(255,255,255,0.12); overflow: hidden; }
.coop-prog i { display: block; height: 100%; background: linear-gradient(90deg, #ffb050, #ffe27a); }
.coop-party { display: flex; flex-direction: column; gap: 4px; }
.coop-row { display: flex; align-items: center; gap: 6px; padding: 3px 6px; border-radius: 9px; background: rgba(8,12,24,0.72); border: 1px solid var(--line); }
.coop-row.me { border-color: rgba(255,210,58,0.6); }
.coop-row.dead { opacity: 0.55; }
.coop-pic { width: 26px; height: 26px; border-radius: 50%; overflow: hidden; flex: none; position: relative; display: block; }
.coop-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.coop-nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 800; }
.coop-nm small { color: #ffd27a; font-weight: 700; }
.coop-hp { display: block; height: 5px; border-radius: 3px; background: rgba(255,255,255,0.12); overflow: hidden; }
.coop-hp i { display: block; height: 100%; background: #5ad17a; transform-origin: left; }
.coop-ready-btn { pointer-events: auto; display: block; width: 100%; margin: 6px 0 4px; padding: 7px 10px; border-radius: 9px; font-weight: 900; font-size: 14px; color: #fff; background: linear-gradient(180deg, #e8a050, #b8642a); border: 1px solid #ffc07a; cursor: pointer; }
.coop-ready-btn.on { background: linear-gradient(180deg, #4ab86a, #2a8a4a); border-color: #8affb0; }
.coop-phase small { display: block; }
#hud.coop .quest-tracker, #hud.coop #hud-gauge, #hud.coop #hud-summon, #hud.coop #hud-objectives, #hud.coop #btn-wave { display: none !important; }
#coop-result { position: absolute; inset: 0; z-index: 75; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.62); padding: 12px; }
.coop-res { max-width: 520px; width: 100%; }
.coop-res h2 { font-size: 44px; }
.coop-res-pic { width: 96px; height: 96px; border-radius: 50%; overflow: hidden; margin: 0 auto 6px; position: relative; border: 2px solid var(--gold); }
.coop-res-pic > * { width: 100%; height: 100%; display: block; position: relative; }
.coop-res-list { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; text-align: left; }
.coop-res-row { display: grid; grid-template-columns: 38px 1fr auto auto; gap: 10px; align-items: center; padding: 4px 8px; border-radius: 10px; background: rgba(0,0,0,0.3); font-size: 13px; }
.coop-res-row span { color: var(--muted); }
.coop-rec-note { color: #ffd27a; font-size: 13px; margin: 6px 0 0; }
.coop-records { padding: 8px 10px; border-radius: 12px; background: rgba(255,210,58,0.07); border: 1px solid rgba(255,210,58,0.3); margin: 8px 0; font-size: 13px; }
.coop-records h4 { margin: 0 0 6px; color: var(--gold); font-size: 14px; }
.coop-records h4 small { color: var(--muted); font-weight: 600; font-size: 11px; margin-left: 4px; }
.coop-rec-row { display: grid; grid-template-columns: 22px 64px 1fr; gap: 8px; align-items: center; padding: 3px 0; border-bottom: 1px solid rgba(255,255,255,0.06); }
.coop-rec-row b { color: var(--gold); text-align: center; }
.coop-rec-row .t { font-weight: 900; font-variant-numeric: tabular-nums; }
.coop-rec-row .p { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 700px), (max-height: 480px) {
  #coop-hud { width: 170px; top: calc(96px + env(safe-area-inset-top, 0px)); font-size: 11px; }
  .coop-pic { width: 20px; height: 20px; }
}

/* 레벨 보스 */
#stage-hud { position: absolute; z-index: 14; left: calc(10px + env(safe-area-inset-left, 0px)); top: calc(118px + env(safe-area-inset-top, 0px)); width: 240px; padding: 8px 10px; border-radius: 12px; background: rgba(24,10,8,0.8); border: 1px solid rgba(255,120,80,0.5); font-size: 12px; line-height: 1.45; }
.stage-title { font-weight: 900; color: #ffb08a; margin-bottom: 3px; }
.stage-tip { color: #e8d8d0; }
.stage-quit { margin-top: 6px; width: 100%; padding: 5px; font-size: 12px; }
#hud.stage .quest-tracker, #hud.stage #hud-gauge, #hud.stage #hud-summon, #hud.stage #hud-objectives, #hud.stage #btn-wave { display: none !important; }
#stage-result { position: absolute; inset: 0; z-index: 75; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.6); padding: 12px; }
.stage-res { max-width: 480px; }
.stage-res h2 { font-size: 40px; }
.stage-reward { color: #ffd27a; font-size: 14px; }
.stage-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.stage-card { display: flex; flex-direction: column; gap: 4px; padding: 8px 10px; border-radius: 10px; background: rgba(0,0,0,0.3); border: 1px solid var(--line); font-size: 12px; }
.stage-card b { color: #ffb08a; font-size: 13px; }
.stage-card span { color: var(--muted); min-height: 32px; }
.stage-card.done { border-color: rgba(120,220,140,0.5); }
.stage-card.open { border-color: rgba(255,160,90,0.7); box-shadow: 0 0 10px rgba(255,140,60,0.25); }
.stage-card.locked { opacity: 0.6; }
@media (max-width: 700px), (max-height: 480px) { #stage-hud { width: 180px; top: calc(96px + env(safe-area-inset-top, 0px)); font-size: 11px; } }

/* 이스터 에그 */
.egg-card { margin-bottom: 12px; border-color: rgba(255,210,58,0.35); }
.egg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.egg { display: flex; flex-direction: column; gap: 2px; padding: 6px 8px; border-radius: 10px; background: rgba(0,0,0,0.3); border: 1px dashed var(--line); font-size: 12px; }
.egg span { font-size: 10px; color: var(--muted); }
.egg.found { border: 1px solid rgba(255,210,58,0.6); background: rgba(255,210,58,0.08); }
.egg.found b { color: var(--gold); }

/* 스킬 패널 */
.skill-row { display: flex; gap: 12px; align-items: center; background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin-bottom: 8px; }
.skill-row .big-icon { width: 54px; height: 54px; flex: none; border-radius: 12px; overflow: hidden; }
.skill-row .info { flex: 1; min-width: 0; }
.skill-row .name { font-weight: 900; }
.skill-row .meta { font-size: 11px; color: var(--accent); margin-top: 2px; }
.skill-row .desc { font-size: 12px; color: var(--muted); margin-top: 2px; }
.lvl-pips { display: flex; gap: 3px; margin-top: 4px; }
.lvl-pips i { width: 16px; height: 6px; border-radius: 3px; background: rgba(255,255,255,0.15); }
.lvl-pips i.on { background: var(--gold); }
.toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; cursor: pointer; }
.toggle input { width: 18px; height: 18px; }

/* 전직 */
.job-card { margin-bottom: 10px; border-color: rgba(255,210,122,0.5); background: linear-gradient(135deg, rgba(80,60,20,0.35), var(--panel-2)); display: flex; flex-direction: column; gap: 8px; }
.job-steps { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 12px; }
.job-step { padding: 3px 8px; border-radius: 12px; background: rgba(0,0,0,0.3); color: var(--muted); }
.job-step.done { color: #c8f0d0; }
.job-step.now { background: var(--gold); color: #2a1a00; font-weight: 900; }
.job-step small { opacity: 0.75; }
.job-arrow { color: var(--muted); }
.job-next { font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
.job-skills { display: flex; flex-wrap: wrap; gap: 6px; }
.job-skills span { font-size: 11px; padding: 2px 8px; border-radius: 10px; background: rgba(255,210,122,0.15); color: #ffe6a8; }
.job-btn { align-self: flex-start; padding: 8px 18px; font-size: 14px; }
.job-badge { font-size: 10px; padding: 1px 6px; border-radius: 8px; background: rgba(255,210,122,0.2); color: #ffe6a8; }
.job-badge.tier2 { background: linear-gradient(90deg, #ffd27a, #ff9a4a); color: #2a1a00; }
.job-title { font-size: 11px; font-weight: 800; color: #9fe8ff; }
.job-title.tier2 { color: #ffd27a; text-shadow: 0 0 6px rgba(255,210,122,0.8); }
.skill-btn.job1 { border-color: #9fe8ff; box-shadow: 0 0 10px rgba(159,232,255,0.6), 0 3px 8px rgba(0,0,0,0.5); }
.skill-btn.job2 { border-color: #ffd27a; box-shadow: 0 0 14px rgba(255,210,122,0.85), 0 3px 8px rgba(0,0,0,0.5); animation: jobGlow 1.6s infinite alternate; }
@keyframes jobGlow { to { box-shadow: 0 0 22px rgba(255,210,122,1), 0 3px 8px rgba(0,0,0,0.5); } }

/* ---------------- 초궁극기 ---------------- */
@property --sa { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
.skill-btn.super-btn {
  right: calc(var(--btn) * 2.7); bottom: calc(var(--btn) * 2.7); width: calc(var(--btn) * 1.1); height: calc(var(--btn) * 1.1);
  border: 3px solid transparent;
  background: linear-gradient(#141a2a, #141a2a) padding-box, conic-gradient(from var(--sa), #ff5a6a, #ffb84a, #fff27a, #7aff8a, #6ad8ff, #b88aff, #ff5a6a) border-box;
  animation: superSpin 3s linear infinite;
}
.skill-btn.super-btn .slot { background: linear-gradient(90deg, #7a3aff, #ff5ad0); white-space: nowrap; }
.skill-btn.super-btn .pips i.on { background: linear-gradient(#fff27a, #ff9af0); }
.skill-btn.super-btn.ready { box-shadow: 0 0 16px rgba(216,160,255,0.95), 0 0 30px rgba(255,210,122,0.6); animation: superSpin 1.2s linear infinite, superPulse 0.8s ease-in-out infinite alternate; }
.skill-btn.super-btn.locked { filter: grayscale(0.7) brightness(0.6); animation: none; }
@keyframes superSpin { to { --sa: 360deg; } }
@keyframes superPulse { to { transform: scale(1.07); } }

#screen-flash { position: absolute; inset: 0; pointer-events: none; opacity: 0; mix-blend-mode: screen; z-index: 6; }
#super-cutin { position: absolute; inset: 0; pointer-events: none; z-index: 7; overflow: hidden; }
#super-cutin.hidden { display: none; }
#super-cutin::before { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse at center, transparent 30%, rgba(0,0,0,0.65) 100%); animation: scFade 1.5s ease-out forwards; }
.sc-band {
  position: absolute; left: -10%; right: -10%; top: 34%; height: min(150px, 24vh); transform: skewY(-7deg);
  background: linear-gradient(90deg, rgba(0,0,0,0.85), color-mix(in srgb, var(--c) 45%, #000) 45%, rgba(0,0,0,0.85));
  border-top: 3px solid var(--c); border-bottom: 3px solid var(--c2);
  box-shadow: 0 0 30px var(--c), inset 0 0 40px rgba(0,0,0,0.6);
  display: flex; align-items: center; gap: 4vw; padding-left: 18%;
  animation: scBand 1.5s cubic-bezier(.2,.8,.2,1) forwards;
}
.sc-lines { position: absolute; inset: 0; opacity: 0.45; background: repeating-linear-gradient(90deg, transparent 0 22px, rgba(255,255,255,0.35) 22px 24px, transparent 24px 60px); animation: scLines 0.35s linear infinite; }
.sc-portrait {
  position: relative; width: min(190px, 30vh); height: min(190px, 30vh); flex: none; border-radius: 50%; overflow: hidden; transform: skewY(7deg);
  border: 4px solid #fff; box-shadow: 0 0 0 4px var(--c), 0 0 40px var(--c2); background: #111; animation: scPortrait 1.5s ease-out forwards;
}
.sc-text { position: relative; transform: skewY(7deg); display: flex; flex-direction: column; animation: scText 1.5s ease-out forwards; }
.sc-text small { font-size: clamp(12px, 2.2vmin, 18px); font-weight: 900; letter-spacing: 3px; color: var(--c2); text-shadow: 0 0 8px #000; }
.sc-text b {
  font-size: clamp(28px, 7vmin, 64px); font-weight: 900; line-height: 1.05; letter-spacing: 2px;
  background: linear-gradient(180deg, #fff 20%, var(--c2) 55%, var(--c) 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 10px var(--c)) drop-shadow(0 3px 0 #000);
}
@keyframes scBand { 0% { transform: skewY(-7deg) translateX(110%); } 18% { transform: skewY(-7deg) translateX(0); } 78% { transform: skewY(-7deg) translateX(-3%); opacity: 1; } 100% { transform: skewY(-7deg) translateX(-120%); opacity: 0; } }
@keyframes scPortrait { 0%, 10% { transform: skewY(7deg) scale(1.4); } 30% { transform: skewY(7deg) scale(1); } }
@keyframes scText { 0%, 14% { opacity: 0; transform: skewY(7deg) translateX(60px); } 32% { opacity: 1; transform: skewY(7deg) translateX(0); } 80% { transform: skewY(7deg) translateX(-14px); } }
@keyframes scLines { to { background-position: -60px 0; } }
@keyframes scFade { 0% { opacity: 0; } 12% { opacity: 1; } 75% { opacity: 1; } 100% { opacity: 0; } }
@media (max-height: 480px) { .sc-band { height: 30vh; top: 30%; } .sc-portrait { width: 34vh; height: 34vh; } }

/* 스킬 창의 초궁극기 카드 */
.super-row {
  border: 2px solid transparent; position: relative;
  background: linear-gradient(120deg, color-mix(in srgb, var(--c) 18%, var(--panel-2)), var(--panel-2) 60%) padding-box,
    conic-gradient(from var(--sa), #ff5a6a, #ffb84a, #fff27a, #7aff8a, #6ad8ff, #b88aff, #ff5a6a) border-box;
  animation: superSpin 4s linear infinite;
}
.super-row.locked { filter: grayscale(0.6); opacity: 0.8; animation: none; }
.super-row .super-icon { border-radius: 50%; border: 2px solid var(--c2); box-shadow: 0 0 12px var(--c); }
.super-row .lvl-pips i.on { background: linear-gradient(90deg, #fff27a, #ff9af0); }
.super-row .meta { color: var(--c2); }
.super-badge { font-size: 10px; padding: 1px 7px; border-radius: 8px; color: #fff; background: linear-gradient(90deg, #7a3aff, #ff5ad0); vertical-align: middle; }
.btn.super { background: linear-gradient(135deg, #8a4aff, #ff5ad0); color: #fff; border-color: #fff8; font-weight: 900; }
.btn.super:disabled { filter: grayscale(0.7); opacity: 0.6; }

/* 패시브 특성 (Lv.50~) */
.passive-card { margin: 10px 0; border-color: rgba(122,255,216,0.45); background: linear-gradient(135deg, rgba(20,60,56,0.45), var(--panel-2)); }
.passive-card.locked { filter: grayscale(0.55); opacity: 0.8; }
.passive-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.passive-head h3 { margin: 0; }
.passive-lock { margin: 0 0 8px; }
.passive-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.ps-node { display: flex; gap: 8px; align-items: center; padding: 8px; border-radius: 10px; background: rgba(0,0,0,0.28); border: 1px solid var(--line); }
.ps-node.learned { border-color: var(--pc); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--pc) 40%, transparent); }
.ps-node.maxed { background: color-mix(in srgb, var(--pc) 14%, rgba(0,0,0,0.3)); }
.ps-icon { width: 38px; height: 38px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 18px; background: color-mix(in srgb, var(--pc) 30%, #10141e); border: 2px solid var(--pc); }
.ps-info { flex: 1; min-width: 0; }
.ps-name { font-weight: 900; font-size: 13px; }
.ps-pips { display: flex; gap: 3px; margin: 3px 0; }
.ps-pips i { width: 14px; height: 5px; border-radius: 3px; background: rgba(255,255,255,0.15); }
.ps-desc { font-size: 11px; }
.ps-next { font-size: 10px; }
.ps-btn { flex: none; width: 34px; height: 34px; padding: 0; font-size: 18px; font-weight: 900; border-radius: 50%; background: linear-gradient(135deg, #2ad8a8, #3a8aff); color: #fff; }
.ps-btn:disabled { filter: grayscale(1); opacity: 0.45; }

/* ---------------- 3차 · 4차 전직 · 초초궁극기 · 초월스킬 ---------------- */
.skill-btn.hyper-btn, .skill-btn.trans-btn { width: calc(var(--btn) * 1.1); height: calc(var(--btn) * 1.1); border: 3px solid transparent; }
.skill-btn.hyper-btn { right: calc(var(--btn) * 1.5); bottom: calc(var(--btn) * 3.45);
  background: linear-gradient(#1a1030, #1a1030) padding-box, conic-gradient(from var(--sa), #8a3aff, #ffd27a, #ff5ad0, #8a3aff) border-box; animation: superSpin 2.4s linear infinite; }
.skill-btn.trans-btn { right: calc(var(--btn) * 3.55); bottom: calc(var(--btn) * 1.47);
  background: linear-gradient(#20222e, #20222e) padding-box, conic-gradient(from var(--sa), #ffffff, #fff2a8, #9af0ff, #ffffff, #ffd0f8, #ffffff) border-box; animation: superSpin 2s linear infinite; }
.skill-btn.hyper-btn .slot { background: linear-gradient(90deg, #6a2aff, #ffb84a); white-space: nowrap; }
.skill-btn.trans-btn .slot { background: linear-gradient(90deg, #ffffff, #fff2a8); color: #3a2a10; white-space: nowrap; }
.skill-btn.hyper-btn.ready { box-shadow: 0 0 18px rgba(170,90,255,0.95), 0 0 34px rgba(255,210,122,0.6); animation: superSpin 1s linear infinite, superPulse 0.7s ease-in-out infinite alternate; }
.skill-btn.trans-btn.ready { box-shadow: 0 0 18px rgba(255,255,255,0.95), 0 0 34px rgba(255,242,168,0.7); animation: superSpin 0.9s linear infinite, superPulse 0.7s ease-in-out infinite alternate; }
.skill-btn.trans-btn.active { box-shadow: 0 0 26px #fff, 0 0 44px #fff2a8; filter: brightness(1.3); }
.skill-btn.trans-btn.active .cd-text { color: #fff2a8; }

/* 컷인 변형: 초초궁극기(보라 · 금빛 두 줄) · 초월(흰빛 · 무지개) */
#super-cutin.hyper .sc-band { background: linear-gradient(90deg, rgba(20,0,40,0.9), color-mix(in srgb, #8a3aff 55%, #000) 40%, color-mix(in srgb, var(--c) 40%, #000) 60%, rgba(20,0,40,0.9));
  border-top: 4px solid #ffd27a; border-bottom: 4px solid #b06aff; box-shadow: 0 0 40px #8a3aff, 0 0 80px rgba(255,210,122,0.5), inset 0 0 40px rgba(0,0,0,0.6); }
#super-cutin.hyper .sc-portrait { box-shadow: 0 0 0 4px #b06aff, 0 0 0 8px #ffd27a, 0 0 50px #b06aff; }
#super-cutin.hyper .sc-text small { color: #ffd27a; }
#super-cutin.hyper .sc-text b { background-image: linear-gradient(180deg, #fff 15%, #ffd27a 50%, #b06aff 100%); filter: drop-shadow(0 0 14px #8a3aff) drop-shadow(0 3px 0 #000); }
#super-cutin.hyper::after, #super-cutin.trans::after { content: ''; position: absolute; inset: 0; pointer-events: none; animation: scFade 1.6s ease-out forwards;
  background: repeating-conic-gradient(from 0deg at 50% 50%, rgba(255,255,255,0.10) 0deg 4deg, transparent 4deg 14deg); mix-blend-mode: screen; }
#super-cutin.trans .sc-band { background: linear-gradient(90deg, rgba(40,40,60,0.85), rgba(255,250,235,0.55) 45%, rgba(40,40,60,0.85));
  border-top: 4px solid #fff; border-bottom: 4px solid #fff2a8; box-shadow: 0 0 50px #fff, 0 0 90px rgba(255,242,168,0.7); }
#super-cutin.trans .sc-portrait { box-shadow: 0 0 0 4px #fff2a8, 0 0 60px #fff; }
#super-cutin.trans .sc-text small { color: #fff; text-shadow: 0 0 8px #000, 0 0 12px #000; }
#super-cutin.trans .sc-text b { background-image: linear-gradient(90deg, #ff9aa8, #ffe08a, #fff, #9af0ff, #d8a0ff); filter: drop-shadow(0 0 12px #fff) drop-shadow(0 3px 0 #000); }

.super-badge.hyper { background: linear-gradient(90deg, #6a2aff, #ffb84a); }
.super-badge.trans { background: linear-gradient(90deg, #fff, #fff2a8, #9af0ff); color: #3a2a10; }
.super-row.hyper.learned { background: linear-gradient(120deg, rgba(138,58,255,0.28), transparent 60%) padding-box, linear-gradient(var(--panel-2), var(--panel-2)) padding-box, conic-gradient(from var(--sa), #8a3aff, #ffd27a, #ff5ad0, #8a3aff) border-box; }
.super-row.trans.learned { background: linear-gradient(120deg, rgba(255,242,168,0.18), transparent 60%) padding-box, linear-gradient(var(--panel-2), var(--panel-2)) padding-box, conic-gradient(from var(--sa), #fff, #fff2a8, #9af0ff, #ffd0f8, #fff) border-box; }
.job-unlock { font-size: 12px; font-weight: 800; }
.job-unlock.hyper { color: #d8a0ff; }
.job-unlock.trans { color: #fff2a8; text-shadow: 0 0 6px rgba(255,242,168,0.7); }

.job-badge.tier3 { background: linear-gradient(90deg, #b06aff, #ffd27a); color: #1a0a2a; }
.job-badge.tier4 { background: linear-gradient(90deg, #ff9aa8, #ffe08a, #fff, #9af0ff, #d8a0ff); color: #2a1a10; }
.job-title.tier3 { color: #d8a0ff; text-shadow: 0 0 6px rgba(176,106,255,0.9); }
.job-title.tier4 { background: linear-gradient(90deg, #ff9aa8, #ffe08a, #fff, #9af0ff, #d8a0ff); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 4px rgba(255,255,255,0.7)); }
.skill-btn.job3 { border-color: #c88aff; box-shadow: 0 0 16px rgba(200,138,255,0.9), 0 3px 8px rgba(0,0,0,0.5); animation: job3Glow 1.4s infinite alternate; }
.skill-btn.job4 { border: 2px solid transparent; background: linear-gradient(var(--panel-2), var(--panel-2)) padding-box, conic-gradient(from var(--sa), #ff9aa8, #ffe08a, #fff, #9af0ff, #d8a0ff, #ff9aa8) border-box;
  box-shadow: 0 0 18px rgba(255,255,255,0.75), 0 3px 8px rgba(0,0,0,0.5); animation: superSpin 3s linear infinite; }
@keyframes job3Glow { to { box-shadow: 0 0 24px rgba(200,138,255,1), 0 0 10px rgba(255,210,122,0.7), 0 3px 8px rgba(0,0,0,0.5); } }

/* 5차 · 마지막 전직: 신성한 금빛 + 진홍 */
.job-badge.tier5 { background: linear-gradient(90deg, #ff4a6a, #ffd23a, #fff6d8, #ffd23a, #ff4a6a); color: #3a0a10; box-shadow: 0 0 8px rgba(255,210,58,0.8); }
.job-title.tier5 { background: linear-gradient(90deg, #ff4a6a, #ffd23a, #fff6d8, #ff9ae8); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 5px rgba(255,210,58,0.9)); font-weight: 900; }
.skill-btn.job5 { border: 3px solid transparent; background: linear-gradient(var(--panel-2), var(--panel-2)) padding-box, conic-gradient(from var(--sa), #ff4a6a, #ffd23a, #fff6d8, #9af0ff, #ff9ae8, #ffd23a, #ff4a6a) border-box;
  box-shadow: 0 0 20px rgba(255,210,58,0.9), 0 0 34px rgba(255,74,106,0.5), 0 3px 8px rgba(0,0,0,0.5); animation: superSpin 2.2s linear infinite, job5Glow 1.2s ease-in-out infinite alternate; }
@keyframes job5Glow { to { box-shadow: 0 0 28px rgba(255,230,140,1), 0 0 46px rgba(255,74,106,0.75), 0 3px 8px rgba(0,0,0,0.5); } }
.job-step.final { border: 1px solid rgba(255,210,58,0.6); }
.job-step.final.now { background: linear-gradient(90deg, #ff4a6a, #ffd23a); color: #2a0a10; }
.job-unlock.final { color: #ffd23a; text-shadow: 0 0 6px rgba(255,74,106,0.8); }

/* 펫 */
.pet-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }

/* 동료 영웅 (Lv.50~) */
.comp-top { border-color: rgba(154,255,216,0.5); background: linear-gradient(135deg, rgba(30,70,60,0.45), var(--panel-2)); }
.comp-status { display: flex; gap: 12px; align-items: center; }
.comp-name { font-weight: 900; font-size: 15px; }
.comp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.comp-card { display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); }
.comp-card.on { border-color: #9affd8; box-shadow: 0 0 0 1px #9affd8 inset, 0 0 12px rgba(154,255,216,0.35); }
.comp-card.self { opacity: 0.55; }
.comp-card .btn { flex: none; padding: 6px 10px; font-size: 12px; }
.comp-self { flex: none; font-size: 12px; padding: 0 6px; }
.comp-portrait { width: 44px; height: 44px; flex: none; border-radius: 50%; overflow: hidden; border: 2px solid #9affd8; background: #111; }
.comp-portrait.big { width: 64px; height: 64px; }
.comp-info { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 12px; }
.comp-info b { font-size: 14px; }
.comp-info .muted { font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pet-card { display: flex; flex-direction: column; gap: 6px; padding: 10px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); }
.pet-card.active { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }
.pet-head { display: flex; align-items: center; gap: 10px; }
.pet-icon { width: 58px; height: 58px; border-radius: 50%; flex: none; overflow: hidden; border: 2px solid; background: #1a2238; }
.pet-icon i { display: block; width: 100%; height: 100%; background-size: 175%; background-position: 50% 40%; background-repeat: no-repeat; }
.pet-stats { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; font-size: 12px; }
.pet-stats b { text-align: right; }

/* 특성 */
.talent-trees { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; }
.tree { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.tree h4 { margin: 0 0 2px; }
.tier { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--line); }
.tier.locked { opacity: 0.45; }
.tier .req { font-size: 10px; color: var(--muted); margin-bottom: 6px; }
.talent { display: flex; align-items: center; gap: 8px; padding: 6px; border-radius: 8px; background: rgba(0,0,0,0.25); margin-bottom: 6px; cursor: pointer; border: 1px solid transparent; }
.talent.can { border-color: var(--gold); }
.talent.maxed { background: rgba(255,207,58,0.12); }
.talent .t-icon { width: 34px; height: 34px; flex: none; border-radius: 8px; overflow: hidden; }
.talent .t-name { font-weight: 800; font-size: 13px; }
.talent .t-desc { font-size: 11px; color: var(--muted); }
.talent .t-rank { margin-left: auto; font-weight: 900; font-size: 12px; }
.talent.keystone .t-icon { border-radius: 50%; }

/* 지도 */
.zone-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.zone-card { border-radius: 12px; padding: 12px; border: 1px solid var(--line); background: var(--panel-2); }
.zone-card.current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.zone-card .swatch { height: 46px; border-radius: 8px; margin-bottom: 8px; }
.zone-card h4 { margin: 0; }

/* ---------------- 캐릭터 선택 ---------------- */
#select-screen {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 14px; padding: 16px;
  background: radial-gradient(ellipse at 50% 30%, #23325a 0%, #0d1220 70%); overflow: auto;
}
/* 내용이 화면보다 길 때 위쪽이 잘리지 않도록 (가운데 정렬 + 스크롤) */
#select-screen > :first-child { margin-top: auto; }
#select-screen > :last-child { margin-bottom: auto; }
.select-title { text-align: center; }
.select-title h1 { margin: 0; font-size: clamp(32px, 6vw, 56px); letter-spacing: 6px; background: linear-gradient(#fff3c0, #e0a83a); -webkit-background-clip: text; background-clip: text; color: transparent; }
.select-title p { margin: 4px 0 0; color: var(--muted); }
.hero-cards { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.hero-card {
  width: min(215px, 44vw); background: var(--panel); border: 2px solid var(--line); border-radius: 16px; padding: 12px; display: flex; flex-direction: column; gap: 6px;
  transition: transform 0.15s, border-color 0.15s;
}
.hero-card:hover { transform: translateY(-4px); border-color: var(--gold); }
.hero-card .hero-portrait { width: 84px; height: 84px; margin: 0 auto; border-radius: 50%; overflow: hidden; border: 3px solid var(--gold); }
.hero-art { margin: -12px -12px 0; height: 150px; overflow: hidden; border-radius: 12px 12px 0 0; position: relative; }
.hero-art::after { content: ''; position: absolute; inset: 0; background: linear-gradient(transparent 55%, var(--panel)); }
.hero-art-img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s; }
.hero-card:hover .hero-art-img { transform: scale(1.06); }
.portrait-crop { position: relative; display: block; width: 100%; height: 100%; overflow: hidden; }
.portrait-crop img { position: absolute; max-width: none; }
@media (max-height: 520px) {
  .hero-art { height: 100px; }
  .hero-card .desc, .hero-card .mini-stats { display: none; }
  .hero-card .hero-portrait { width: 64px; height: 64px; }
}
.hero-card h3 { margin: 0; text-align: center; }
.hero-card .title { text-align: center; color: var(--accent); font-size: 12px; }
.hero-card .role { text-align: center; font-size: 12px; color: var(--muted); }
.hero-card .desc { font-size: 11.5px; color: #c8d0e8; min-height: 0; line-height: 1.45; }
.hero-card .save-info { font-size: 12px; text-align: center; color: var(--gold); min-height: 16px; }
.hero-card .actions { display: flex; gap: 6px; }
.hero-card .actions .btn { flex: 1; padding: 9px; }
.mini-stats { display: grid; grid-template-columns: auto 1fr; gap: 3px 8px; font-size: 11px; align-items: center; }
.mini-stats .meter { height: 6px; background: rgba(255,255,255,0.1); border-radius: 3px; overflow: hidden; }
.mini-stats .meter i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.select-hint { font-size: 12px; color: var(--muted); text-align: center; }

/* 계정 표시줄 (온라인 서버 저장) */
.account-bar {
  display: flex; flex-direction: column; align-items: center; gap: 8px; max-width: min(640px, 100%);
  padding: 10px 14px; border-radius: 12px; background: rgba(0,0,0,0.28); border: 1px solid var(--line); font-size: 13px; text-align: center;
}
.account-bar[hidden] { display: none; }
.account-bar.nudge { animation: acctNudge 0.9s ease-out; }
@keyframes acctNudge { 0%, 40% { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(255,216,74,0.35); } 100% { box-shadow: none; } }
.acct-line { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; }
.acct-line .btn { padding: 4px 10px; font-size: 12px; }
.acct-sub { font-size: 12px; color: var(--muted); }
.acct-btns { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.acct-btns .btn { padding: 7px 12px; }
.acct-email { display: flex; gap: 6px; width: min(420px, 100%); }
.acct-email input { flex: 1; min-width: 0; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--line); background: rgba(0,0,0,0.4); color: var(--text); font-size: 13px; }
.acct-msg { font-size: 12px; color: #c8f0d0; }
.acct-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--muted); }
.acct-dot.ok { background: #5ad87a; }
.acct-dot.bad { background: #ff6a5a; }
.acct-dot.wait { background: var(--gold); animation: acctBlink 0.8s ease-in-out infinite alternate; }
@keyframes acctBlink { to { opacity: 0.3; } }

/* ---------------- 세로 화면 / 작은 화면 ---------------- */
@media (orientation: portrait) {
  .hud-tc { top: 120px; width: 80vw; }
  .quest-tracker { top: 200px; }
  .hud-tr .menu-btns { max-width: 46vw; }
}
@media (max-height: 420px) {
  .portrait { width: 44px; height: 44px; }
  .minimap-wrap { width: 76px; }
  .quest-tracker { top: 106px; width: 180px; }
  .menu-btns { gap: 3px; max-width: 66vw; flex-wrap: nowrap; }
  .menu-btns button { width: 28px; height: 28px; font-size: 13px; border-radius: 8px; }
  .hud-tc { width: min(33vw, 420px); }
  .qt-item .qt-desc { display: none; }
  .joy-base { width: 110px; height: 110px; left: calc(24px + var(--safe-l)); bottom: calc(24px + var(--safe-b)); }
}

/* 보조 주문 (Z · X) · 귀환 (R) — systems/spells.js */
.spell-btns { position: absolute; left: calc(var(--btn) * -2.3); bottom: 0; display: flex; flex-direction: column; gap: 8px; }
.spell-btn {
  position: relative; width: calc(var(--btn) * 0.85); height: calc(var(--btn) * 0.85); border-radius: 50%; overflow: hidden; pointer-events: auto;
  background: radial-gradient(circle at 40% 35%, rgba(255,255,255,0.12), rgba(10,16,30,0.85)); border: 2px solid var(--sp, var(--line)); color: #fff;
  box-shadow: 0 0 8px color-mix(in srgb, var(--sp, #fff) 40%, transparent);
}
.spell-btn .sp-icon { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: calc(var(--btn) * 0.38); color: var(--sp, #fff); text-shadow: 0 0 6px var(--sp, #fff); }
.spell-btn .cd { position: absolute; inset: 0; background: conic-gradient(rgba(0,0,0,0.72) var(--p, 0%), transparent 0); pointer-events: none; }
.spell-btn .cd-num { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 14px; text-shadow: 0 1px 3px #000; pointer-events: none; }
.spell-btn .key { position: absolute; bottom: 1px; right: 0; left: 0; text-align: center; font-size: 9px; opacity: 0.8; pointer-events: none; }
.recall-btn { --sp: #6ad8ff; }
.recall-btn.on { animation: pulse 0.8s infinite alternate; box-shadow: 0 0 14px #6ad8ff; }
#recall-bar { position: absolute; left: 50%; bottom: 24%; transform: translateX(-50%); width: min(260px, 60vw); height: 18px; border-radius: 9px; overflow: hidden;
  background: rgba(5,12,24,0.7); border: 1px solid #6ad8ff; pointer-events: none; }
#recall-bar .fill { position: absolute; inset: 0; transform-origin: left; background: linear-gradient(90deg, #2a6ad8, #9fe8ff); }
#recall-bar span { position: absolute; inset: 0; text-align: center; font-size: 11px; line-height: 18px; text-shadow: 0 1px 2px #000; }
/* 스킬(K) 창 · 보조 주문 고르기 */
.spell-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; margin-top: 8px; }
.spell-card { border: 1px solid var(--line); border-left: 4px solid var(--sp); border-radius: 10px; padding: 8px 10px; background: rgba(255,255,255,0.03); }
.spell-card.on { background: color-mix(in srgb, var(--sp) 14%, transparent); }
.spell-card .sc-head { display: flex; align-items: center; gap: 6px; font-weight: 700; }
.spell-card .sc-head i { font-style: normal; color: var(--sp); font-size: 18px; width: 22px; text-align: center; }
.spell-card .sc-desc { font-size: 12px; opacity: 0.85; margin: 4px 0 6px; line-height: 1.45; }
.spell-card .sc-btns { display: flex; gap: 6px; }
.spell-card .sc-btns .btn { padding: 4px 10px; font-size: 12px; }
