/* =========================================================
   탑의 사냥꾼 V2 - 기본 / 메인 화면 스타일
   1편의 분위기(어두운 보라 · 고딕 판타지)는 잇되, V2 만의 모양으로:
   명조 + Cinzel 제목, 모서리를 깎은 프레임, 금빛 장식선, 다이아몬드 장식
   ========================================================= */
:root {
  --bg: #0b0714;
  --surface: rgba(20, 13, 34, 0.86);
  --surface-2: rgba(32, 22, 54, 0.92);
  --surface-3: rgba(46, 32, 76, 0.94);
  --well: rgba(12, 8, 22, 0.62);
  --line: rgba(190, 150, 255, 0.22);
  --line-strong: rgba(205, 168, 255, 0.5);
  --ink: #ece6fa;
  --ink-dim: #a397c2;
  --ink-faint: #6c6290;
  --violet: #9b5cff;
  --violet-hi: #c8a2ff;
  --violet-deep: #5b21b6;
  --gold: #d9b26a;
  --gold-hi: #f3d79b;
  --gold-line: rgba(217, 178, 106, 0.55);
  --coin: #f2c14e;
  --good: #63d6a0;
  --bad: #ff6b81;
  --sky: #8fc8ff;
  --shell: 480px;
  --font: 'IBM Plex Sans KR', -apple-system, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  --font-title: 'Nanum Myeongjo', 'AppleMyungjo', serif;
  --font-latin: 'Cinzel', 'Nanum Myeongjo', serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --cut: 10px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%;
  background: var(--bg); color: var(--ink);
  font-family: var(--font); font-size: 15px;
  font-variant-numeric: tabular-nums;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}
input, textarea { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }
body { overflow: hidden; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; padding: 0; touch-action: manipulation; transition: transform 0.08s ease, filter 0.15s ease, opacity 0.15s; }
button:active:not(:disabled) { transform: scale(0.97); }
button:disabled { opacity: 0.4; cursor: not-allowed; }
.hidden { display: none !important; }
em { font-style: normal; }
.latin { font-family: var(--font-latin); }
.muted { color: var(--ink-dim); }
.dim { color: var(--ink-faint); }
.spacer { flex: 1; }
.stars { color: var(--gold-hi); letter-spacing: -1px; font-size: 11px; white-space: nowrap; }
.ic { width: 22px; height: 22px; flex: none; }
/* 이모지 아이콘을 보라 톤으로 */
.tint { filter: grayscale(1) brightness(1.5) sepia(1) hue-rotate(225deg) saturate(3); }

/* ---------- 배경 ----------
   img/bg/main.(webp|png|jpg) 가 있으면 그 그림, 없으면 아래 그라디언트 분위기만 보인다. */
.bg-layer {
  position: fixed; inset: 0; z-index: 0; overflow: hidden;
  background:
    radial-gradient(55% 38% at 50% 6%, rgba(155, 92, 255, 0.26), transparent 70%),
    radial-gradient(90% 45% at 50% 108%, rgba(120, 56, 200, 0.32), transparent 70%),
    radial-gradient(1.3px 1.3px at 14% 16%, rgba(255, 255, 255, 0.75), transparent 60%),
    radial-gradient(1px 1px at 32% 8%, rgba(255, 255, 255, 0.55), transparent 60%),
    radial-gradient(1.4px 1.4px at 71% 13%, rgba(255, 255, 255, 0.7), transparent 60%),
    radial-gradient(1px 1px at 86% 27%, rgba(255, 255, 255, 0.5), transparent 60%),
    radial-gradient(1.2px 1.2px at 58% 30%, rgba(255, 255, 255, 0.45), transparent 60%),
    radial-gradient(1px 1px at 9% 39%, rgba(255, 255, 255, 0.4), transparent 60%),
    radial-gradient(1px 1px at 92% 6%, rgba(255, 255, 255, 0.6), transparent 60%),
    linear-gradient(180deg, #140b26 0%, #0c0717 55%, #07040d 100%);
}
.bg-img { position: absolute; inset: 0; background: var(--bg-main, none) center / cover no-repeat; }
.bg-layer.in-battle .bg-img { background-image: var(--bg-battle, var(--bg-main, none)); }
.bg-fx {
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(11, 7, 20, 0.7) 0%, rgba(11, 7, 20, 0.12) 22%, rgba(11, 7, 20, 0.1) 60%, rgba(11, 7, 20, 0.92) 100%),
    radial-gradient(120% 80% at 50% 50%, transparent 55%, rgba(5, 3, 10, 0.75) 100%);
  transition: background-color 0.25s;
}
.bg-layer.dim .bg-fx, .bg-layer.in-battle .bg-fx { background-color: rgba(9, 6, 16, 0.62); }

#app {
  position: relative; z-index: 1;
  width: 100%; max-width: var(--shell);
  height: 100vh; height: 100dvh;
  margin: 0 auto; overflow: hidden;
}
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; }

/* ---------- 깎은 모서리 프레임 ---------- */
.frame { position: relative; isolation: isolate; padding: 14px; --frame-line: var(--line); --frame-fill: var(--surface); }
.frame::before, .frame::after { content: ''; position: absolute; z-index: -1; pointer-events: none; }
.frame::before {
  inset: 0; background: var(--frame-line);
  clip-path: polygon(var(--cut) 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, var(--cut) 100%, 0 calc(100% - var(--cut)), 0 var(--cut));
}
.frame::after {
  inset: 1px; background: var(--frame-fill);
  clip-path: polygon(var(--cut) 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, var(--cut) 100%, 0 calc(100% - var(--cut)), 0 var(--cut));
}
.frame.gold { --frame-line: linear-gradient(135deg, var(--gold-line), rgba(155, 92, 255, 0.35) 45%, var(--gold-line)); }
.frame.strong { --frame-line: var(--line-strong); }
.gem { position: absolute; left: 50%; top: -4px; width: 8px; height: 8px; transform: translateX(-50%) rotate(45deg); background: var(--gold); box-shadow: 0 0 8px rgba(217, 178, 106, 0.7); z-index: 2; }

/* ---------- 버튼 ---------- */
.btn, .btn-ghost {
  --cut: 8px;
  position: relative; isolation: isolate;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; min-height: 46px; padding: 10px 14px;
  font-size: 14px; font-weight: 700; letter-spacing: 0.3px;
}
.btn {
  color: #fff;
  background: linear-gradient(180deg, #a26bff 0%, #7434e6 55%, #5a21c2 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), inset 0 -2px 0 rgba(0, 0, 0, 0.2);
  clip-path: polygon(var(--cut) 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, var(--cut) 100%, 0 calc(100% - var(--cut)), 0 var(--cut));
}
.btn-ghost { color: var(--ink); }
.btn-ghost::before, .btn-ghost::after { content: ''; position: absolute; z-index: -1; pointer-events: none; }
.btn-ghost::before {
  inset: 0; background: var(--line-strong);
  clip-path: polygon(var(--cut) 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, var(--cut) 100%, 0 calc(100% - var(--cut)), 0 var(--cut));
}
.btn-ghost::after {
  inset: 1px; background: var(--surface-2);
  clip-path: polygon(var(--cut) 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, var(--cut) 100%, 0 calc(100% - var(--cut)), 0 var(--cut));
}
.btn-ghost.on::after { background: linear-gradient(180deg, rgba(155, 92, 255, 0.45), rgba(91, 33, 182, 0.4)); }
.btn-sm, .btn-ghost.sm { --cut: 6px; width: auto; min-height: 34px; padding: 6px 12px; font-size: 12px; }
.btn-gold { background: linear-gradient(180deg, #f3d79b, #c3954a); color: #2a1a05; }
.btn-danger { background: linear-gradient(180deg, #ff8094, #c4304f); }

/* ---------- 제목 / 텍스트 ---------- */
.page-title { display: flex; flex-direction: column; align-items: center; gap: 4px; margin: 18px 0 8px; text-align: center; }
.page-title .eyebrow { font-family: var(--font-latin); font-size: 11px; letter-spacing: 4px; color: var(--gold); }
.page-title h2 { margin: 0; font-family: var(--font-title); font-weight: 800; font-size: 28px; color: #fff; text-shadow: 0 0 18px rgba(155, 92, 255, 0.5); }
.page-title .rule { display: flex; align-items: center; gap: 8px; width: 160px; margin-top: 4px; }
.page-title .rule::before, .page-title .rule::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--gold-line)); }
.page-title .rule::after { background: linear-gradient(270deg, transparent, var(--gold-line)); }
.page-title .rule i { width: 6px; height: 6px; transform: rotate(45deg); background: var(--gold); }
.page-desc { text-align: center; color: var(--ink-dim); font-size: 13px; line-height: 1.75; margin: 0 0 16px; }
.note { text-align: center; font-size: 11.5px; color: var(--ink-faint); line-height: 1.7; margin-top: 14px; }
.empty { text-align: center; color: var(--ink-dim); font-size: 13px; padding: 24px 0; }
.placeholder { padding: 40px 16px; text-align: center; color: var(--ink-dim); font-size: 13px; line-height: 1.7; }
.err { background: rgba(255, 107, 129, 0.12); border-left: 3px solid var(--bad); color: #ffc2cc; font-size: 13px; padding: 10px 12px; margin: 0 0 12px; }
.err:empty { display: none; }
.banner { text-align: center; font-size: 12.5px; padding: 10px 12px; margin-bottom: 12px; background: rgba(155, 92, 255, 0.1); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--violet-hi); }
.banner.gold { background: rgba(217, 178, 106, 0.08); border-color: var(--gold-line); color: var(--gold-hi); }
.banner.violet { color: var(--violet-hi); }

/* ---------- 일러스트 슬롯 (그림이 없으면 빈 틀) ---------- */
.art {
  position: relative; display: flex; align-items: center; justify-content: center; overflow: hidden;
  background: radial-gradient(circle at 50% 35%, rgba(70, 44, 120, 0.55), rgba(10, 6, 20, 0.75));
  border: 1px solid var(--line-strong);
}
.art > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 15%; }
.art.contain > img { object-fit: contain; object-position: 50% 50%; }
.art-ph { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--ink-faint); pointer-events: none; }
.art-ph svg { width: 44%; max-width: 72px; height: auto; opacity: 0.5; }
.art-ph span { font-family: var(--font-latin); font-size: 9.5px; letter-spacing: 2px; }
.art.has-img .art-ph { display: none; }

/* ---------- 로딩 ---------- */
.boot { align-items: center; justify-content: center; gap: 18px; }
.load-dots { display: flex; justify-content: center; gap: 10px; }
.load-dots i { width: 8px; height: 8px; transform: rotate(45deg); background: var(--violet); animation: loadPulse 1.1s ease-in-out infinite; }
.load-dots i:nth-child(2) { animation-delay: 0.16s; }
.load-dots i:nth-child(3) { animation-delay: 0.32s; }
@keyframes loadPulse { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }

/* ---------- 로고 / 로그인 ---------- */
.logo { text-align: center; }
.logo .eyebrow { font-family: var(--font-latin); font-size: 11px; letter-spacing: 5px; color: var(--gold); }
.logo h1, .logo .title {
  margin: 6px 0 0; font-family: var(--font-title); font-weight: 800; font-size: 40px; letter-spacing: 2px; color: #fff;
  text-shadow: 0 2px 2px rgba(0, 0, 0, 0.8), 0 0 26px rgba(155, 92, 255, 0.65);
}
.logo .rule { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 10px auto 0; width: 200px; }
.logo .rule::before, .logo .rule::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--gold-line)); }
.logo .rule::after { background: linear-gradient(270deg, transparent, var(--gold-line)); }
.logo .rule span { font-family: var(--font-latin); font-size: 12px; color: var(--gold-hi); letter-spacing: 3px; }
.auth { overflow-y: auto; padding: calc(var(--safe-top) + 48px) 18px calc(var(--safe-bottom) + 24px); }
.auth .logo { margin-bottom: 26px; }
.auth-sub { text-align: center; color: var(--ink-dim); font-size: 13px; margin: 10px 0 0; }
.auth-form { --cut: 14px; padding: 18px 16px 16px; }
.tabs { display: flex; margin: -2px 0 16px; border-bottom: 1px solid var(--line); }
.tab-btn { flex: 1; min-height: 42px; font-size: 14px; font-weight: 700; color: var(--ink-faint); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab-btn.active { color: var(--ink); border-bottom-color: var(--violet-hi); text-shadow: 0 0 12px rgba(155, 92, 255, 0.6); }
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 12px; color: var(--ink-dim); margin-bottom: 6px; letter-spacing: 0.5px; }
.field input {
  width: 100%; padding: 12px 13px; color: var(--ink);
  background: var(--well); border: 1px solid var(--line); border-radius: 2px;
  font-size: 16px; /* iOS 는 16px 미만이면 확대됨 */
  outline: none;
}
.field input:focus { border-color: var(--violet-hi); box-shadow: 0 0 0 3px rgba(155, 92, 255, 0.16); }
.hint { margin: -4px 0 12px; color: var(--ink-faint); font-size: 11.5px; }

/* ---------- 게임 화면 ---------- */
.game { padding: calc(var(--safe-top) + 10px) 14px 0; }

/* 상단 HUD: 레벨(다이아몬드) + 경험치 + 골드 */
.hud { flex: none; display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.lv-gem {
  position: relative; flex: none; width: 46px; height: 46px; margin: 2px 4px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.lv-gem::before {
  content: ''; position: absolute; inset: 5px; transform: rotate(45deg);
  background: linear-gradient(135deg, #3b2468, #1a1030); border: 1px solid var(--gold-line);
  box-shadow: 0 0 12px rgba(155, 92, 255, 0.45);
}
.lv-gem span { position: relative; line-height: 1; }
.lv-label { font-family: var(--font-latin); font-size: 8.5px; color: var(--gold); letter-spacing: 1px; }
.lv-num { font-family: var(--font-latin); font-weight: 700; font-size: 16px; color: #fff; }
.exp-wrap { flex: 1; min-width: 0; }
.exp-track { height: 4px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.exp-track i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--violet-deep), var(--violet-hi)); box-shadow: 0 0 6px var(--violet); transition: width 0.4s; }
.exp-label { display: block; margin-top: 4px; font-size: 10px; color: var(--ink-faint); letter-spacing: 1px; font-family: var(--font-latin); }
.gold-pill {
  flex: none; display: flex; align-items: center; gap: 7px;
  padding: 6px 14px 6px 8px; border-radius: 999px;
  background: rgba(12, 8, 22, 0.75); border: 1px solid var(--gold-line);
  font-size: 15px; font-weight: 700; color: var(--gold-hi);
}
.coin {
  width: 20px; height: 20px; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 35% 30%, #fff1c2, var(--coin) 55%, #a8751c);
  box-shadow: 0 0 8px rgba(242, 193, 78, 0.45);
}

.stage { position: relative; flex: 1; min-height: 0; }
.view { position: absolute; inset: 0; display: none; flex-direction: column; }
.view.active { display: flex; }
.view.scroll { overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: 16px; }

/* 프로필 카드 */
.profile { --cut: 14px; display: flex; align-items: center; gap: 14px; padding: 12px 14px; }
.portrait-slot { flex: none; }
.portrait { width: 62px; height: 78px; border-radius: 31px 31px 4px 4px; border-color: var(--gold-line); }
.portrait .art-ph span { display: none; }
.pf-info { flex: 1; min-width: 0; }
.pf-top { display: flex; align-items: baseline; gap: 8px; }
.pf-nick { min-width: 0; font-family: var(--font-title); font-weight: 800; font-size: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf-lv { flex: none; font-family: var(--font-latin); font-size: 12px; color: var(--violet-hi); }
.pf-job { margin: 2px 0 7px; font-size: 12px; color: var(--ink-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gauge { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.g-label { width: 20px; flex: none; font-family: var(--font-latin); font-size: 9.5px; font-weight: 700; color: var(--ink-faint); letter-spacing: 1px; }
.g-track { flex: 1; height: 7px; background: rgba(0, 0, 0, 0.45); border: 1px solid rgba(255, 255, 255, 0.06); overflow: hidden; }
.g-track i { display: block; height: 100%; width: 100%; transition: width 0.35s ease; }
.gauge.hp .g-track i, .bar-fill.hp { background: linear-gradient(90deg, #a8243f, #ff6b81); }
.gauge.mp .g-track i, .bar-fill.mp { background: linear-gradient(90deg, #2f5fd6, #8fb4ff); }
.g-num { flex: none; min-width: 64px; text-align: right; font-size: 10.5px; color: var(--ink-dim); }

/* 가운데: 우측 세로 버튼 (원형 오브) */
.home-mid { position: relative; flex: 1; min-height: 0; }
.orbs { position: absolute; top: 14px; right: 2px; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.orb { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; width: 66px; }
.orb-ring {
  width: 52px; height: 52px; border-radius: 50%;
  display: grid; place-items: center; color: var(--violet-hi);
  background: radial-gradient(circle at 50% 30%, rgba(80, 50, 140, 0.95), rgba(18, 11, 32, 0.95));
  border: 1px solid var(--line-strong);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5), inset 0 0 0 3px rgba(11, 7, 20, 0.6), inset 0 0 0 4px rgba(200, 162, 255, 0.18);
}
.orb-label { font-size: 11px; font-weight: 700; color: var(--ink); text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9); }
.orb.hot .orb-ring { border-color: var(--gold-line); color: var(--gold-hi); box-shadow: 0 0 18px rgba(217, 178, 106, 0.35), inset 0 0 0 3px rgba(11, 7, 20, 0.6), inset 0 0 0 4px rgba(243, 215, 155, 0.25); }
.badge-new {
  position: absolute; top: -4px; right: 2px; padding: 1px 5px;
  background: var(--gold); color: #2a1a05; font-style: normal; font-size: 8.5px; font-weight: 800; letter-spacing: 0.5px;
  font-family: var(--font-latin);
}

/* 입장 */
.enter-zone { flex: none; display: flex; flex-direction: column; align-items: center; padding: 0 0 30px; }
.floor-tag { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--ink-dim); margin-bottom: 8px; letter-spacing: 0.5px; }
.floor-tag::before, .floor-tag::after { content: ''; width: 28px; height: 1px; background: var(--gold-line); }
.floor-tag b { color: var(--gold-hi); font-family: var(--font-latin); }
.enter {
  --cut: 14px;
  position: relative; isolation: isolate;
  width: 100%; max-width: 310px; min-height: 76px; padding: 8px 18px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: #fff;
  filter: drop-shadow(0 0 18px rgba(155, 92, 255, 0.45));
}
.enter::before, .enter::after {
  content: ''; position: absolute; z-index: -1;
  clip-path: polygon(var(--cut) 0, calc(100% - var(--cut)) 0, 100% 50%, calc(100% - var(--cut)) 100%, var(--cut) 100%, 0 50%);
}
.enter::before { inset: 0; background: linear-gradient(180deg, var(--gold-hi), var(--gold) 50%, #8a6328); }
.enter::after { inset: 2px; background: linear-gradient(180deg, #9a62ff 0%, #6a2fd8 55%, #4a1aa6 100%); }
.enter-main { font-family: var(--font-title); font-weight: 800; font-size: 26px; letter-spacing: 6px; line-height: 1.1; text-shadow: 0 2px 4px rgba(0, 0, 0, 0.45); }
.enter-sub { max-width: 100%; font-size: 11.5px; font-weight: 700; color: #eadcff; letter-spacing: 0.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.enter-sub .latin { letter-spacing: 1.5px; }
.enter.boss { filter: drop-shadow(0 0 18px rgba(255, 107, 129, 0.5)); }
.enter.boss::after { background: linear-gradient(180deg, #e0567a 0%, #a8243f 55%, #6e1430 100%); }
.boss-tag { display: inline-block; margin-right: 4px; padding: 0 5px; background: rgba(0, 0, 0, 0.4); color: var(--gold-hi); font-family: var(--font-latin); font-size: 10px; letter-spacing: 1px; }

/* 하단 탭: 이어진 바 + 가운데 솟은 다이아몬드 */
.tabbar {
  flex: none; position: relative;
  display: grid; grid-template-columns: repeat(5, 1fr);
  margin: 0 -14px; padding: 6px 6px calc(var(--safe-bottom) + 6px);
  background: linear-gradient(180deg, rgba(20, 13, 34, 0.94), rgba(10, 6, 18, 0.98));
  border-top: 1px solid var(--gold-line);
}
.tabbar::before { content: ''; position: absolute; left: 0; right: 0; top: 2px; height: 1px; background: var(--line); }
.tab {
  position: relative; min-height: 54px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--ink-faint); font-size: 11.5px; font-weight: 700;
}
.tab .ic { width: 22px; height: 22px; }
.tab.active { color: var(--ink); }
.tab.active .ic { color: var(--violet-hi); filter: drop-shadow(0 0 6px rgba(155, 92, 255, 0.8)); }
.tab:not(.tab-center).active::before { content: ''; position: absolute; top: -7px; left: 50%; width: 7px; height: 7px; transform: translateX(-50%) rotate(45deg); background: var(--violet-hi); box-shadow: 0 0 8px var(--violet); }
.tab-gem {
  position: relative; width: 50px; height: 50px; margin-top: -24px; margin-bottom: 2px;
  display: grid; place-items: center; color: var(--ink-dim);
}
.tab-gem::before {
  content: ''; position: absolute; inset: 7px; transform: rotate(45deg);
  background: linear-gradient(135deg, #3b2468, #160d28); border: 1px solid var(--gold-line);
  box-shadow: 0 0 0 4px rgba(10, 6, 18, 0.95), 0 4px 12px rgba(0, 0, 0, 0.6);
}
.tab-gem .ic { position: relative; width: 22px; height: 22px; }
.tab-center.active .tab-gem::before { background: linear-gradient(135deg, #8b4dff, #4a1aa6); box-shadow: 0 0 0 4px rgba(10, 6, 18, 0.95), 0 0 18px rgba(155, 92, 255, 0.7); }
.tab-center.active .tab-gem { color: #fff; }
.nav-dot { position: absolute; top: 6px; right: calc(50% - 18px); width: 7px; height: 7px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 6px var(--gold); }

/* ---------- 목록 ---------- */
.sitem {
  display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
  padding: 9px 11px; margin-bottom: 7px; color: var(--ink);
  background: var(--well); border: 1px solid var(--line); border-left: 2px solid var(--line-strong);
}
.sitem:active:not(:disabled) { background: rgba(155, 92, 255, 0.14); }
.sitem .thumb { width: 40px; height: 40px; flex: none; display: flex; align-items: center; justify-content: center; font-size: 20px; background: rgba(10, 6, 20, 0.6); border: 1px solid var(--line); overflow: hidden; }
.si-body { flex: 1; min-width: 0; }
.si-name { font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.si-desc { display: block; font-size: 11.5px; color: var(--ink-dim); margin-top: 2px; line-height: 1.5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.si-right { flex: none; text-align: right; font-size: 12.5px; font-weight: 700; }
.si-own { font-size: 10.5px; font-weight: 700; color: var(--violet-hi); background: rgba(155, 92, 255, 0.16); padding: 1px 8px; }
.thumb .art { width: 100%; height: 100%; border: none; background: transparent; }
.thumb .art-ph span { display: none; }
.thumb .ic { width: 20px; height: 20px; color: var(--violet-hi); }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.05); font-size: 14px; }
.row:last-child { border-bottom: none; }
.row b { color: var(--gold-hi); }
.drawer-item {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 14px 14px; margin-bottom: 8px; color: var(--ink); font-size: 15px; font-weight: 700;
  background: var(--well); border: 1px solid var(--line); border-left: 2px solid var(--gold-line);
}
.drawer-item .ic { color: var(--violet-hi); }
.drawer-item small { margin-left: auto; font-size: 11.5px; font-weight: 500; color: var(--ink-dim); }

/* ---------- 바텀시트 ---------- */
.overlay {
  position: absolute; inset: 0; z-index: 50;
  background: rgba(6, 3, 12, 0.76);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fadeIn 0.15s ease-out;
}
.overlay.centered { align-items: center; padding: 16px; }
.sheet {
  position: relative; width: 100%; max-height: 86%;
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, #1c1230, #110a1e);
  border-top: 1px solid var(--gold-line);
  padding-bottom: var(--safe-bottom);
  animation: sheetUp 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.1);
}
.sheet::before { content: ''; position: absolute; left: 50%; top: -5px; width: 9px; height: 9px; transform: translateX(-50%) rotate(45deg); background: var(--gold); box-shadow: 0 0 10px rgba(217, 178, 106, 0.7); }
.overlay.centered .sheet {
  --cut: 16px; max-width: 420px; padding-bottom: 0; border-top: none;
  clip-path: polygon(var(--cut) 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, var(--cut) 100%, 0 calc(100% - var(--cut)), 0 var(--cut));
  box-shadow: inset 0 0 0 1px var(--line-strong);
}
.overlay.centered .sheet::before { top: 8px; }
.sheet-head { flex: none; position: relative; padding: 20px 48px 2px; }
.sheet-head h3 { margin: 0; text-align: center; font-family: var(--font-title); font-weight: 800; font-size: 20px; color: #fff; text-shadow: 0 0 14px rgba(155, 92, 255, 0.5); }
.sheet-x { position: absolute; top: 12px; right: 10px; color: var(--ink-dim); font-size: 20px; padding: 6px 10px; }
.sheet-body { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 16px 16px; -webkit-overflow-scrolling: touch; }
.sheet-foot { flex: none; display: flex; gap: 8px; padding: 4px 16px 16px; }
.sheet-foot > * { flex: 1; }
@keyframes sheetUp { from { transform: translateY(40px); opacity: 0; } }
@keyframes fadeIn { from { opacity: 0; } }

/* ---------- 토스트 ---------- */
#toast-root { position: absolute; left: 0; right: 0; top: calc(var(--safe-top) + 64px); z-index: 100; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
.toast {
  max-width: 88%; padding: 10px 16px;
  background: rgba(16, 10, 28, 0.96); border: 1px solid var(--line-strong); border-left: 3px solid var(--violet-hi);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5); font-size: 13.5px; font-weight: 600;
  animation: toastIn 0.2s ease-out;
}
.toast.error { border-left-color: var(--bad); color: #ffc2cc; }
.toast.good { border-left-color: var(--good); color: #cdf5e1; }
.toast.out { opacity: 0; transform: translateY(-8px); transition: 0.25s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } }

/* ---------- 태블릿 (아이패드 세로) ---------- */
@media (min-width: 700px) {
  :root { --shell: 600px; }
  html, body { font-size: 16px; }
  .lv-gem { width: 54px; height: 54px; }
  .lv-num { font-size: 19px; }
  .gold-pill { font-size: 17px; padding: 7px 16px 7px 9px; }
  .portrait { width: 76px; height: 96px; border-radius: 38px 38px 4px 4px; }
  .pf-nick { font-size: 22px; }
  .pf-job { font-size: 13px; }
  .g-track { height: 9px; }
  .g-num { font-size: 12px; min-width: 76px; }
  .orb { width: 78px; }
  .orb-ring { width: 62px; height: 62px; }
  .orb-ring .ic { width: 26px; height: 26px; }
  .orb-label { font-size: 12.5px; }
  .enter { max-width: 360px; min-height: 88px; }
  .enter-main { font-size: 30px; }
  .enter-sub { font-size: 13px; }
  .tab { min-height: 60px; font-size: 13px; }
  .tab .ic { width: 25px; height: 25px; }
}
@media (max-height: 640px) {
  .hud { margin-bottom: 6px; }
  .profile { padding: 9px 12px; }
  .portrait { width: 50px; height: 62px; }
  .orbs { gap: 8px; top: 8px; }
  .orb-ring { width: 44px; height: 44px; }
  .enter { min-height: 64px; }
}
