/* ============================================================
   도파민 서바이버 - 다크 시네마틱 스타일
   ============================================================ */

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

:root {
  --cyan: #4de3ff;
  --gold: #e8b74a;
  --red: #ff3b5c;
  --pink: #ff4d9d;
  --bg: #070910;
  --panel: rgba(10, 13, 24, 0.94);
  --line: rgba(120, 180, 230, 0.22);
}

html, body {
  width: 100%; height: 100%;
  height: 100dvh; /* 모바일 브라우저 UI 대응 */
  overflow: hidden;
  background: var(--bg);
  font-family: 'Segoe UI', 'Malgun Gothic', 'Apple SD Gothic Neo', sans-serif;
  touch-action: none;
  overscroll-behavior: none; /* 당겨서 새로고침/바운스 방지 */
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent; /* 모바일 탭 하이라이트 제거 */
  -webkit-text-size-adjust: 100%;
}

#game {
  position: fixed; inset: 0; display: block;
  touch-action: none;
}

.hidden { display: none !important; }

/* ============ HUD ============ */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }

#xpbar {
  position: absolute; top: 0; left: 0; right: 0; height: 10px;
  background: rgba(0,0,0,0.7);
  border-bottom: 1px solid var(--line);
}
#xpfill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #2a7a94, #4de3ff, #b06cff);
  background-size: 200% 100%;
  animation: xpshine 3s linear infinite;
  transition: width 0.15s;
}
@keyframes xpshine { 0% { background-position: 0 0; } 100% { background-position: 200% 0; } }

#lvbadge {
  position: absolute; top: 3px; left: 8px;
  font-size: clamp(9px, 1.3vmin, 12px); font-weight: 800; color: #b9cfdf;
  letter-spacing: 1.5px;
  text-shadow: 0 1px 3px #000;
}

#topbar {
  position: absolute; top: 16px; left: 0; right: 0;
  display: flex; justify-content: center; align-items: center; gap: 18px;
}
#timer {
  font-size: clamp(22px, 3.4vmin, 36px); font-weight: 200; color: #dfe9f5;
  text-shadow: 0 2px 12px rgba(0,0,0,0.9);
  letter-spacing: clamp(3px, 0.6vmin, 6px);
  font-variant-numeric: tabular-nums;
}
#topstats { position: absolute; right: 12px; top: 4px; display: flex; gap: 12px; }
#kills, #gemcount, #explore {
  font-size: clamp(12px, 1.7vmin, 15px); font-weight: 700; color: #aebdd0;
  text-shadow: 0 1px 4px #000;
  letter-spacing: 1px;
}
#explore { color: #9fd8ff; }

#seedTag {
  position: absolute; top: 56px; left: 10px;
  font-size: 9px; color: rgba(160,180,205,0.4);
  letter-spacing: 2px;
}

/* 보스 바 */
#bossbar {
  position: absolute; top: 56px; left: 50%; transform: translateX(-50%);
  width: min(580px, 74vw); text-align: center;
}
#bossname {
  font-size: clamp(12px, 1.7vmin, 16px); font-weight: 800; color: var(--red);
  text-shadow: 0 0 14px rgba(255,59,92,0.7);
  letter-spacing: 3px; margin-bottom: 3px;
}
#bosstrack {
  height: 8px; border-radius: 2px;
  background: rgba(0,0,0,0.7);
  border: 1px solid rgba(255,59,92,0.55);
  overflow: hidden;
}
#bossfill {
  height: 100%; width: 100%;
  background: linear-gradient(90deg, #8a0f28, #ff3b5c);
  transition: width 0.2s;
}

/* 미니맵 — 화면 크기에 비례 (내부 해상도는 JS에서 144으로 렌더) */
#minimap {
  position: absolute; top: 58px; right: 10px;
  width: clamp(112px, 15vmin, 168px); height: clamp(112px, 15vmin, 168px);
  border-radius: 3px;
  border: 1px solid var(--line);
  box-shadow: 0 2px 18px rgba(0,0,0,0.7);
  opacity: 0.85;
}

/* 하단 바 */
#bottombar {
  position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: clamp(8px, 1.2vmin, 14px);
  flex-wrap: wrap; justify-content: center;
  max-width: 98vw;
}
#weaponBar, #passiveBar { display: flex; gap: 4px; }
.slot {
  width: clamp(38px, 4.6vmin, 50px); height: clamp(42px, 5.2vmin, 56px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 3px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: clamp(14px, 2vmin, 19px);
}
.slot.passive { border-color: rgba(232,183,74,0.35); }
.slot b { display: flex; gap: 2px; margin-top: 2px; }
.slot i {
  width: 3.5px; height: 3.5px; border-radius: 1px;
  background: rgba(255,255,255,0.15);
}
.slot i.on { background: var(--cyan); box-shadow: 0 0 4px var(--cyan); }
.slot.passive i.on { background: var(--gold); box-shadow: 0 0 4px var(--gold); }
.slot.evolved {
  border-color: var(--gold);
  box-shadow: 0 0 12px rgba(232,183,74,0.5), inset 0 0 12px rgba(232,183,74,0.12);
}
.slot b.evo { font-size: 8px; color: var(--gold); letter-spacing: 1.5px; }

#hpbar {
  position: relative;
  width: min(340px, 40vw); height: clamp(16px, 2.2vmin, 22px);
  background: rgba(0,0,0,0.7);
  border: 1px solid var(--line);
  border-radius: 2px; overflow: hidden;
}
#hpfill {
  height: 100%; width: 100%;
  background: linear-gradient(90deg, #0f7a58, #2ee6a8);
  transition: width 0.15s;
}
#hpbar span {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: clamp(9px, 1.3vmin, 12px); font-weight: 800; color: #e8f0fa;
  text-shadow: 0 1px 2px #000;
  letter-spacing: 1px;
}

/* 도파민 러시 게이지 */
#ragebar {
  position: relative;
  width: min(340px, 40vw); height: clamp(11px, 1.6vmin, 15px);
  background: rgba(0,0,0,0.7);
  border: 1px solid rgba(255,77,157,0.4);
  border-radius: 2px; overflow: hidden;
}
#ragefill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #ff4d9d, #e8b74a, #4de3ff, #ff4d9d);
  background-size: 300% 100%;
  animation: xpshine 1.5s linear infinite;
  transition: width 0.1s;
}
#ragetext {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 8px; font-weight: 900; color: #e8dce8;
  text-shadow: 0 1px 2px #000; letter-spacing: 3px;
}
#ragebar.ready {
  border-color: var(--gold);
  box-shadow: 0 0 14px rgba(232,183,74,0.7);
  animation: ragePulse 0.6s ease-in-out infinite;
}
#ragebar.ready #ragetext { color: var(--gold); }
#ragebar.active {
  border-color: var(--pink);
  box-shadow: 0 0 20px rgba(255,77,157,0.9);
}
@keyframes ragePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* 러시 발동 버튼 */
#rageBtn {
  position: fixed; z-index: 30;
  right: 14px; bottom: 120px;
  width: clamp(56px, 7vmin, 72px); height: clamp(56px, 7vmin, 72px);
  border-radius: 50%;
  border: 2px solid var(--gold);
  background: rgba(232,183,74,0.14);
  font-size: clamp(22px, 3vmin, 30px); cursor: pointer;
  opacity: 0; pointer-events: none;
  transform: scale(0.5);
  transition: opacity 0.2s, transform 0.2s;
  touch-action: manipulation;
}
#rageBtn.ready {
  opacity: 1; pointer-events: auto;
  transform: scale(1);
  animation: rageBtnPulse 0.7s ease-in-out infinite;
}
@keyframes rageBtnPulse {
  0%, 100% { box-shadow: 0 0 14px rgba(232,183,74,0.6); transform: scale(1); }
  50% { box-shadow: 0 0 30px rgba(255,77,157,0.85); transform: scale(1.1); }
}

/* 러시 중 화면 효과 */
#rushfx {
  position: fixed; inset: 0; z-index: 15;
  pointer-events: none; opacity: 0;
  transition: opacity 0.25s;
}
body.rush #rushfx {
  opacity: 1;
  animation: rushBorder 0.35s linear infinite;
}
@keyframes rushBorder {
  0% { box-shadow: inset 0 0 80px rgba(255,77,157,0.5); }
  33% { box-shadow: inset 0 0 80px rgba(77,227,255,0.5); }
  66% { box-shadow: inset 0 0 80px rgba(232,183,74,0.5); }
  100% { box-shadow: inset 0 0 80px rgba(255,77,157,0.5); }
}
body.rush #game { filter: saturate(1.45) contrast(1.07); }

/* 상자 진화 슬롯 */
.ch-slot.evolve { border-color: var(--pink); box-shadow: 0 0 18px rgba(255,77,157,0.7); animation: ragePulse 0.5s infinite; }
.ch-slot.evolved {
  border-color: var(--gold);
  box-shadow: 0 0 34px rgba(232,183,74,0.9);
  animation: slotPop 0.3s cubic-bezier(0.2, 1.6, 0.4, 1);
}

/* 콤보 */
#combo {
  position: absolute; bottom: 76px; right: 14px;
  font-size: clamp(16px, 2.6vmin, 26px); font-weight: 900;
  color: var(--gold);
  text-shadow: 0 0 16px rgba(232,183,74,0.8), 0 2px 4px #000;
  letter-spacing: 2px;
  opacity: 0; transform: scale(0.6);
  transition: opacity 0.15s, transform 0.15s;
}
#combo.on { opacity: 1; transform: scale(1); }

/* 배너 */
#banner {
  position: absolute; top: 22%; left: 50%;
  transform: translateX(-50%);
  font-size: clamp(24px, 4.6vmin, 46px);
  font-weight: 900; white-space: nowrap;
  letter-spacing: 4px;
  text-shadow: 0 2px 12px rgba(0,0,0,0.9), 0 0 34px currentColor;
  opacity: 0; pointer-events: none;
}
#banner.show { animation: bannerPop 2.2s ease forwards; }
@keyframes bannerPop {
  0% { opacity: 0; transform: translateX(-50%) scale(0.4); filter: blur(6px); }
  12% { opacity: 1; transform: translateX(-50%) scale(1.06); filter: blur(0); }
  20% { transform: translateX(-50%) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) scale(1); }
}

/* 아이콘 버튼 */
.iconbtn {
  position: fixed; z-index: 30;
  width: clamp(36px, 4.6vmin, 46px); height: clamp(36px, 4.6vmin, 46px);
  border-radius: 3px;
  border: 1px solid var(--line);
  background: rgba(8,10,18,0.7);
  color: #c7d4e4; font-size: clamp(14px, 2vmin, 18px);
  cursor: pointer;
}
#muteBtn { bottom: 10px; right: 10px; }
#pauseBtn { bottom: 54px; right: 10px; }

/* 조이스틱 */
#joystick {
  position: fixed; z-index: 20;
  width: 110px; height: 110px;
  margin: -55px 0 0 -55px;
  border-radius: 50%;
  border: 1px solid rgba(200,220,240,0.25);
  background: rgba(255,255,255,0.04);
  display: none; pointer-events: none;
}
#joystick.on { display: block; }
#joystick div {
  position: absolute; left: 50%; top: 50%;
  width: 44px; height: 44px; margin: -22px 0 0 -22px;
  border-radius: 50%;
  background: rgba(200,220,240,0.25);
  border: 1px solid rgba(200,220,240,0.4);
}

/* ============ 오버레이 공통 ============ */
.overlay {
  position: fixed; inset: 0; z-index: 40;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, rgba(6,8,16,0.78), rgba(3,4,9,0.92));
  backdrop-filter: blur(5px);
  padding: 16px;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-top: 1px solid rgba(77,227,255,0.35);
  border-radius: 6px;
  padding: 26px 30px;
  text-align: center;
  box-shadow: 0 20px 70px rgba(0,0,0,0.85), 0 0 60px rgba(77,227,255,0.05);
  animation: panelIn 0.35s cubic-bezier(0.2, 1.2, 0.4, 1);
  max-width: min(92vw, 640px);
  max-height: 92vh;
  overflow-y: auto;
}
@keyframes panelIn {
  from { transform: scale(0.92) translateY(24px); opacity: 0; filter: blur(4px); }
  to { transform: scale(1) translateY(0); opacity: 1; filter: blur(0); }
}

/* 타이틀 */
.title-panel { padding: 34px 38px; background: linear-gradient(180deg, rgba(10,13,24,0.97), rgba(6,8,15,0.97)); }
.logo { font-size: clamp(34px, 7vw, 56px); font-weight: 900; line-height: 1.15; letter-spacing: 6px; }
.logo-dopa {
  background: linear-gradient(180deg, #f5f7fa 10%, #9fb8cc 50%, #4de3ff 85%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 18px rgba(77,227,255,0.45));
  animation: logoBreath 3s ease-in-out infinite;
}
@keyframes logoBreath {
  0%, 100% { filter: drop-shadow(0 0 14px rgba(77,227,255,0.35)); }
  50% { filter: drop-shadow(0 0 30px rgba(255,77,157,0.55)); }
}
.logo-surv { color: #dfe9f5; text-shadow: 0 2px 20px rgba(0,0,0,0.8); }
.tagline {
  color: rgba(170,190,212,0.6); font-size: 12px; margin: 12px 0 22px;
  letter-spacing: 4px; text-transform: uppercase;
}

.seed-row { display: flex; gap: 8px; justify-content: center; margin-bottom: 14px; }
#seedInput {
  width: 220px; padding: 9px 12px;
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 3px;
  color: #dfe9f5; font-size: 14px;
  letter-spacing: 1px;
  outline: none;
}
#seedInput:focus { border-color: var(--cyan); box-shadow: 0 0 10px rgba(77,227,255,0.25); }

.howto {
  margin-top: 20px;
  color: rgba(170,190,212,0.72);
  font-size: 12.5px; line-height: 2.1;
  letter-spacing: 0.5px;
}
.howto b { color: var(--cyan); font-weight: 700; }
.howto b.pink { color: var(--pink); }
.best { margin-top: 12px; color: var(--gold); font-weight: 700; font-size: 13px; letter-spacing: 1px; }

/* 버튼 */
.btn {
  display: block; width: 100%;
  margin: 8px 0; padding: 13px 22px;
  background: rgba(77,227,255,0.07);
  border: 1px solid rgba(77,227,255,0.5);
  border-radius: 3px;
  color: #e8f0fa; font-size: 15px; font-weight: 800;
  letter-spacing: 3px;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.2s, background 0.2s;
  font-family: inherit;
}
.btn:hover { background: rgba(77,227,255,0.16); transform: translateY(-1px); box-shadow: 0 4px 24px rgba(77,227,255,0.3); }
.btn:active { transform: translateY(0) scale(0.98); }
.btn.start {
  background: linear-gradient(90deg, rgba(255,77,157,0.25), rgba(77,227,255,0.25));
  border-color: transparent;
  outline: 1px solid rgba(255,77,157,0.6);
  font-size: 17px;
  animation: startGlow 2.2s ease-in-out infinite;
}
@keyframes startGlow {
  0%, 100% { box-shadow: 0 0 14px rgba(255,77,157,0.35); }
  50% { box-shadow: 0 0 34px rgba(77,227,255,0.5); }
}
.btn.danger { border-color: rgba(255,59,92,0.6); background: rgba(255,59,92,0.08); }
.btn.small { width: auto; display: inline-block; margin: 0; padding: 9px 13px; font-size: 15px; letter-spacing: 0; }

/* 레벨업 카드 */
.lu-head {
  font-size: 26px; font-weight: 900;
  color: var(--cyan);
  text-shadow: 0 0 26px rgba(77,227,255,0.7);
  letter-spacing: 5px;
  animation: logoBreath 2s infinite;
}
.lu-sub { color: rgba(170,190,212,0.55); font-size: 12px; margin: 8px 0 18px; letter-spacing: 2px; }
#lu-cards {
  display: flex; gap: 12px; justify-content: center;
  flex-wrap: wrap;
}
.lu-card {
  position: relative;
  width: 158px; min-height: 190px;
  padding: 18px 12px 14px;
  background: linear-gradient(180deg, rgba(18,24,42,0.97), rgba(10,13,24,0.97));
  border: 1px solid rgba(77,227,255,0.35);
  border-radius: 4px;
  color: #e8f0fa; cursor: pointer;
  font-family: inherit;
  transition: transform 0.14s, box-shadow 0.18s, border-color 0.18s;
  animation: cardIn 0.35s cubic-bezier(0.2, 1.3, 0.4, 1) backwards;
}
@keyframes cardIn {
  from { transform: translateY(40px) scale(0.75); opacity: 0; filter: blur(3px); }
  to { transform: translateY(0) scale(1); opacity: 1; filter: blur(0); }
}
.lu-card:hover {
  transform: translateY(-6px) scale(1.03);
  border-color: var(--gold);
  box-shadow: 0 12px 40px rgba(232,183,74,0.3);
}
.lu-card.new { border-color: rgba(255,77,157,0.65); }
.lu-card.core { border-color: rgba(155,93,229,0.7); box-shadow: 0 0 14px rgba(155,93,229,0.25); }
.lu-card.core .lu-badge { background: #9b5de5; color: #fff; box-shadow: 0 0 12px rgba(155,93,229,0.6); }
.lu-badge {
  position: absolute; top: -9px; left: 50%; transform: translateX(-50%);
  font-size: 9px; font-weight: 900;
  padding: 2px 10px; border-radius: 2px;
  background: var(--cyan); color: #04121a;
  letter-spacing: 2px;
  box-shadow: 0 0 12px rgba(77,227,255,0.6);
}
.lu-card.new .lu-badge { background: var(--pink); color: #fff; }
.lu-emoji { font-size: 40px; margin: 8px 0 10px; filter: drop-shadow(0 4px 10px rgba(0,0,0,0.6)); }
.lu-title { font-size: 13px; font-weight: 900; margin-bottom: 8px; letter-spacing: 0.5px; }
.lu-desc { font-size: 11px; color: rgba(200,214,230,0.7); line-height: 1.6; }
.lu-key {
  margin-top: 10px; font-size: 9px;
  color: rgba(200,214,230,0.3);
  letter-spacing: 2px;
}

/* 상자 */
.ch-panel { min-width: min(92vw, 480px); }
#ch-title {
  font-size: 24px; font-weight: 900;
  color: var(--gold);
  text-shadow: 0 0 24px rgba(232,183,74,0.7);
  letter-spacing: 4px;
}
.ch-sub { color: rgba(170,190,212,0.55); font-size: 12px; margin: 8px 0 20px; letter-spacing: 2px; }
#ch-slots {
  display: flex; gap: 12px; justify-content: center;
  flex-wrap: wrap; margin-bottom: 18px;
}
.ch-slot {
  width: 72px; height: 72px;
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(232,183,74,0.45);
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
}
.ch-slot.stopped {
  border-color: var(--gold);
  box-shadow: 0 0 22px rgba(232,183,74,0.5);
  animation: slotPop 0.3s cubic-bezier(0.2, 1.6, 0.4, 1);
}
@keyframes slotPop { 0% { transform: scale(1.25); } 100% { transform: scale(1); } }
.ch-spin { font-size: 38px; }
#ch-result { color: #dfe6f2; font-size: 13px; font-weight: 700; min-height: 20px; margin-bottom: 10px; letter-spacing: 0.5px; }

/* 게임 오버 */
.ov-title { font-size: 24px; font-weight: 900; margin-bottom: 14px; letter-spacing: 3px; }
#end-title {
  font-size: clamp(26px, 6vw, 38px); font-weight: 900;
  text-shadow: 0 0 30px currentColor;
  letter-spacing: 4px;
  margin-bottom: 8px;
}
#end-sub { color: rgba(170,190,212,0.7); font-size: 13px; margin-bottom: 16px; letter-spacing: 1px; }
#end-stats {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 8px 24px;
  margin: 0 auto 18px; max-width: 380px;
  text-align: left;
}
#end-stats div {
  display: flex; justify-content: space-between;
  font-size: 13px; color: rgba(170,190,212,0.75);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  padding: 5px 0;
}
#end-stats b { color: #e8f0fa; }
#end-stats b.gold { color: var(--gold); font-size: 15px; }

/* 품질 선택 세그먼트 */
.quality-row {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  margin-bottom: 14px; color: rgba(170,190,212,0.7); font-size: 12px; letter-spacing: 1px;
}
.q-label { font-weight: 800; }
.q-seg { display: flex; gap: 6px; }
.q-seg button {
  width: 44px; height: 36px; font-size: 17px; cursor: pointer;
  background: rgba(255,255,255,0.05); border: 1px solid var(--line); border-radius: 4px;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  touch-action: manipulation;
}
.q-seg button:hover { background: rgba(77,227,255,0.12); }
.q-seg button.sel { border-color: var(--gold); background: rgba(232,183,74,0.16); box-shadow: 0 0 10px rgba(232,183,74,0.35); }
.q-seg.small button { width: 40px; height: 32px; font-size: 15px; }
.q-auto { font-size: 10px; color: rgba(125,255,160,0.7); }
.pause-quality { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 12px; color: rgba(170,190,212,0.75); font-size: 12px; }
/* 조작법 안내: 1차 입력이 터치가 아닐 때(마우스 데스크탑, 터치스크린 노트북 포함)는
 * PC 안내만 표시. (pointer:coarse는 터치 노트북에서도 매칭되어 모바일 UI가 새던 문제 수정) */
.howto-mobile { display: none; }
.howto-tip { color: rgba(232,183,74,0.75); font-size: 11.5px; }
body.is-touch .howto-pc { display: none; }
body.is-touch .howto-mobile { display: block; }

/* 품질 버튼 (HUD) */
#qualityBtn { bottom: 98px; right: 10px; }

/* 전체화면 버튼 (HUD) */
#fsBtn { bottom: 142px; right: 10px; }
.iconbtn { touch-action: manipulation; }

/* 모바일 */
@media (max-width: 720px) {
  #timer { font-size: 20px; letter-spacing: 3px; }
  #minimap { width: 96px; height: 96px; top: calc(50px + env(safe-area-inset-top, 0px)); }
  #combo { bottom: 118px; right: 8px; font-size: 16px; }
  .slot { width: 36px; height: 40px; font-size: 14px; }
  #bottombar { bottom: calc(6px + env(safe-area-inset-bottom, 0px)); gap: 6px; max-width: 96vw; }
  .lu-card { width: min(138px, 28vw); min-height: 175px; }
  #end-stats { grid-template-columns: 1fr; }
  .title-panel { padding: 24px 20px; }
  #muteBtn { bottom: auto; top: calc(16px + env(safe-area-inset-top, 0px)); right: calc(10px + env(safe-area-inset-right, 0px)); }
  #pauseBtn { bottom: auto; top: calc(60px + env(safe-area-inset-top, 0px)); right: calc(10px + env(safe-area-inset-right, 0px)); }
  #qualityBtn { bottom: auto; top: calc(104px + env(safe-area-inset-top, 0px)); right: calc(10px + env(safe-area-inset-right, 0px)); }
  #fsBtn { bottom: auto; top: calc(148px + env(safe-area-inset-top, 0px)); right: calc(10px + env(safe-area-inset-right, 0px)); }
  #rageBtn {
    right: calc(10px + env(safe-area-inset-right, 0px));
    bottom: calc(150px + env(safe-area-inset-bottom, 0px));
    width: 68px; height: 68px; font-size: 28px;
    touch-action: manipulation;
  }
  #topstats { top: 38px; right: 58px; }
  #ragebar, #hpbar { width: 40vw; min-width: 140px; }
  .btn { min-height: 48px; } /* 터치 타깃 44px+ 확보 */
  .lu-card { min-height: 185px; padding: 20px 12px 16px; }
  #seedInput { font-size: 16px; } /* iOS 자동줌 방지 */
}

/* 태블릿 (721~1100px): 카드·퀘스트 폭만 조정 (HUD 크기는 vmin 스케일이 담당) */
@media (min-width: 721px) and (max-width: 1100px) {
  .lu-card { width: 168px; }
  #questPanel { max-width: 260px; }
  #rageBtn { right: 16px; bottom: 130px; }
}

/* 가로모드 소형폰: 하단바 겹침 방지 */
@media (max-height: 500px) and (orientation: landscape) {
  #bottombar { gap: 4px; bottom: 4px; }
  #ragebar, #hpbar { height: 12px; width: 30vw; }
  #hpbar { height: 14px; }
  #minimap { width: 80px; height: 80px; top: 46px; }
  #questPanel { top: 70px; min-width: 160px; padding: 5px 8px; }
  #combo { bottom: 90px; }
  #rageBtn { bottom: 96px; width: 56px; height: 56px; }
}

/* 퀘스트 패널 */
#questPanel {
  position: absolute; top: 96px; left: 10px;
  min-width: min(280px, 60vw); max-width: 320px;
  background: rgba(8, 11, 20, 0.82);
  border: 1px solid rgba(77, 227, 255, 0.35);
  border-left: 3px solid var(--cyan);
  border-radius: 3px;
  padding: 9px 12px;
  display: flex; align-items: center; gap: 8px;
  pointer-events: none;
}
#questPanel .qico, #questIcon { font-size: 17px; }
#questMain { display: flex; flex-direction: column; gap: 3px; flex: 1; }
#questText { font-size: clamp(11px, 1.5vmin, 13.5px); font-weight: 700; color: #dfe9f5; letter-spacing: 0.3px; text-align: left; line-height: 1.3; }
#questTrack { height: 5px; background: rgba(255,255,255,0.12); border-radius: 2px; overflow: hidden; }
#questBarFill { height: 100%; width: 0%; background: linear-gradient(90deg, #2a7a94, #4de3ff); transition: width 0.25s; }
#questProg { font-size: clamp(10px, 1.3vmin, 12px); color: #8fa8bd; font-weight: 700; text-align: left; }
#questCount { font-size: 9px; color: #7dffa0; font-weight: 800; letter-spacing: 1px; }

/* 황금 목적지 화살표 (화면 가장자리 길잡이) */
#goldArrow {
  position: absolute; left: 0; top: 0;
  transform: translate(-50%, -50%);
  display: flex; align-items: center; gap: 6px;
  font-weight: 900; color: var(--gold);
  text-shadow: 0 0 14px rgba(232,183,74,0.9), 0 1px 3px #000;
  pointer-events: none;
  animation: ragePulse 1s infinite;
}
#goldDir { display: inline-block; font-size: clamp(20px, 3vmin, 30px); }
#goldDist { font-size: clamp(11px, 1.6vmin, 14px); letter-spacing: 1px; }

/* 월드 이벤트 태그 */
#eventTag {
  position: absolute; top: 96px; right: 10px;
  font-size: clamp(11px, 1.6vmin, 14px); font-weight: 900; letter-spacing: 1px;
  text-shadow: 0 0 12px currentColor, 0 1px 3px #000;
  pointer-events: none;
  animation: ragePulse 1s infinite;
}
@media (max-width: 720px) {
  #questPanel { top: 84px; min-width: 180px; }
  #questText { font-size: 10.5px; }
  #eventTag { top: 128px; right: 8px; font-size: 11px; }
}

/* ============================================================
   🎰 카지노 도파민 시스템 — 잭팟 게이지 / 빅윈 / 리롤·밴시시 / 저주 / 칩 상점
   ============================================================ */

/* 도파민 잭팟 게이지 (보스바 아래, 항상 보이는 유혹) */
#jackpotWrap {
  position: absolute; top: 92px; left: 50%; transform: translateX(-50%);
  width: min(300px, 44vw);
  pointer-events: none;
}
#jackpotBar {
  position: relative; height: 9px;
  background: rgba(0,0,0,0.72);
  border: 1px solid rgba(255,210,63,0.45);
  border-radius: 5px; overflow: hidden;
}
#jackpotFill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #7a4a10, #e8b74a, #ffe9a8, #ffd23f);
  background-size: 200% 100%;
  animation: xpshine 1.8s linear infinite;
  transition: width 0.3s;
  box-shadow: 0 0 8px rgba(232,183,74,0.5);
}
#jackpotText {
  position: absolute; left: 50%; top: 0; transform: translateX(-50%);
  line-height: 9px; font-size: 9px; font-weight: 900;
  color: #fff3c4; text-shadow: 0 0 6px rgba(232,183,74,0.9), 0 1px 2px #000;
  letter-spacing: 1px; pointer-events: none;
}
#jackpotWrap.full #jackpotBar {
  border-color: #ffd23f;
  box-shadow: 0 0 18px rgba(255,210,63,0.8);
  animation: ragePulse 0.45s ease-in-out infinite;
}
#jackpotWrap.full #jackpotText { animation: ragePulse 0.45s infinite; }
@media (max-width: 720px) {
  #jackpotWrap { width: 46vw; top: calc(74px + env(safe-area-inset-top, 0px)); }
}

/* BIG WIN / MEGA WIN / EPIC WIN 세레머니 (풀스크린 티어) */
#bigwin {
  position: fixed; inset: 0; z-index: 45;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0.35), rgba(0,0,0,0) 65%);
}
#bigwin-tier {
  font-size: clamp(44px, 11vw, 110px); font-weight: 900; letter-spacing: 6px;
  background: linear-gradient(180deg, #fff3c4 10%, #ffd23f 45%, #e8842a 85%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 4px 26px rgba(255,210,63,0.85)) drop-shadow(0 2px 4px #000);
  animation: bigwinPop 0.5s cubic-bezier(0.2, 1.6, 0.4, 1) backwards;
}
#bigwin-amount {
  font-size: clamp(16px, 3.4vmin, 30px); font-weight: 900; color: #e8f0fa;
  text-shadow: 0 0 18px rgba(77,227,255,0.8), 0 2px 4px #000;
  letter-spacing: 2px; margin-top: 8px;
  animation: bigwinPop 0.5s 0.18s cubic-bezier(0.2, 1.6, 0.4, 1) backwards;
}
#bigwin.tier-mega #bigwin-tier {
  background: linear-gradient(180deg, #ffd9ec 10%, #ff4d9d 45%, #9b5de5 85%);
  -webkit-background-clip: text; background-clip: text;
  filter: drop-shadow(0 4px 30px rgba(255,77,157,0.9)) drop-shadow(0 2px 4px #000);
}
#bigwin.tier-epic #bigwin-tier {
  background: linear-gradient(180deg, #d6fff2 10%, #2ee6a8 40%, #4de3ff 80%);
  -webkit-background-clip: text; background-clip: text;
  filter: drop-shadow(0 4px 34px rgba(46,230,168,0.95)) drop-shadow(0 2px 4px #000);
}
@keyframes bigwinPop {
  0% { opacity: 0; transform: scale(0.3) rotate(-6deg); filter: blur(8px); }
  60% { opacity: 1; transform: scale(1.12) rotate(1deg); filter: blur(0); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}

/* 레벨업 리롤/밴시시 툴바 */
#lu-tools { display: flex; gap: 8px; justify-content: center; margin-top: 14px; }
#lu-tools .btn.small { min-width: 120px; }
#lu-tools .btn.small:disabled { opacity: 0.35; cursor: not-allowed; transform: none; box-shadow: none; }
.lu-tools-count {
  margin-top: 8px; font-size: 11px; color: rgba(232,183,74,0.75);
  letter-spacing: 1px; font-weight: 700;
}
.lu-card.banished { opacity: 0.25; filter: grayscale(1) blur(1px); pointer-events: none; transform: scale(0.92); }

/* 상자 스킬스톱 힌트 + 저주 선택 UI */
.ch-stop-hint { color: rgba(255,210,63,0.8); }
#ch-slots .ch-slot { cursor: pointer; }  /* 스킬스톱: 릴 탭 가능 */
.ch-slot.stopped { cursor: default; }
#ch-curse { display: flex; gap: 8px; justify-content: center; margin-top: 10px; flex-wrap: wrap; }
#ch-curse .btn.small { min-width: 150px; }
#ch-curse .btn.danger {
  border-color: rgba(155,93,229,0.8); background: rgba(155,93,229,0.12);
  animation: startGlow 1.6s ease-in-out infinite;
}

/* 사망 리캡 (near-miss 카드) */
.end-recap {
  margin: 0 auto 14px; max-width: 400px; text-align: left;
}
.end-recap .recap-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; margin-bottom: 4px;
  background: rgba(232,183,74,0.07);
  border-left: 3px solid rgba(232,183,74,0.7);
  border-radius: 0 3px 3px 0;
  font-size: 12.5px; color: #ffe9b8; letter-spacing: 0.3px;
}
.end-recap .recap-item b { color: #fff; }
.end-recap .recap-none {
  text-align: center; color: rgba(170,190,212,0.5); font-size: 12px; letter-spacing: 1px;
}

/* 칩 획득 표시 (엔드 화면) */
#end-chips {
  margin: 0 auto 14px; font-size: 15px; font-weight: 900; color: var(--gold);
  text-shadow: 0 0 14px rgba(232,183,74,0.7);
  letter-spacing: 1px;
}
#end-chips .chip-detail { font-size: 11px; color: rgba(232,183,74,0.6); font-weight: 700; margin-top: 3px; }

/* 칩 상점 */
.shop-panel { min-width: min(92vw, 560px); }
.shop-head {
  font-size: 26px; font-weight: 900; color: var(--gold);
  text-shadow: 0 0 26px rgba(232,183,74,0.7); letter-spacing: 4px;
}
.shop-sub { color: rgba(170,190,212,0.55); font-size: 12px; margin: 8px 0 16px; letter-spacing: 1.5px; }
#shop-chips {
  font-size: 17px; font-weight: 900; color: #fff3c4; margin-bottom: 14px;
  text-shadow: 0 0 12px rgba(232,183,74,0.6); letter-spacing: 1px;
}
#shop-items { display: flex; flex-direction: column; gap: 8px; }
.shop-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; text-align: left;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--line); border-radius: 4px;
  cursor: pointer; transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.shop-item:hover { background: rgba(232,183,74,0.08); border-color: var(--gold); transform: translateY(-1px); }
.shop-item:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.shop-item .si-emoji { font-size: 26px; width: 34px; text-align: center; }
.shop-item .si-info { flex: 1; }
.shop-item .si-name { font-size: 13.5px; font-weight: 900; color: #e8f0fa; letter-spacing: 0.5px; }
.shop-item .si-desc { font-size: 11px; color: rgba(200,214,230,0.65); margin-top: 2px; }
.shop-item .si-pips { display: flex; gap: 3px; margin-top: 5px; }
.shop-item .si-pips i { width: 14px; height: 4px; border-radius: 1px; background: rgba(255,255,255,0.12); }
.shop-item .si-pips i.on { background: var(--gold); box-shadow: 0 0 5px rgba(232,183,74,0.8); }
.shop-item .si-cost { font-size: 13px; font-weight: 900; color: var(--gold); white-space: nowrap; }
.shop-item.maxed .si-cost { color: #7dffa0; }

/* 타이틀 메타 로우 (오늘의 시드 / 칩 상점 / 출석) */
.meta-row { display: flex; gap: 8px; justify-content: center; align-items: center; margin-bottom: 14px; }
.streak-badge {
  font-size: 12px; font-weight: 900; color: #7dffa0;
  background: rgba(125,255,160,0.1);
  border: 1px solid rgba(125,255,160,0.4);
  border-radius: 3px; padding: 6px 10px; letter-spacing: 1px;
  animation: ragePulse 1.4s infinite;
}
