html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: #111;
  color: #f5f5f5;
  font-family: Arial, sans-serif;
  overflow: hidden;
  touch-action: none;
}

* { box-sizing: border-box; }

:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

#stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
  width: 100vw;
  height: 100dvh;
  height: 100vh;
}

#game {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  background: #151515;
  cursor: crosshair;
}

#gameFx {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: block;
  width: 100%;
  height: 100%;
  background: transparent;
  pointer-events: none;
}

#threeLayer {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

#threeLayer canvas {
  display: block;
  width: 100%;
  height: 100%;
}

#hud {
  position: fixed;
  top: calc(var(--safe-top) + 12px);
  left: calc(var(--safe-left) + 12px);
  z-index: 20;
  background: rgba(0,0,0,0.48);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 12px;
  padding: 10px 12px;
  line-height: 1.45;
  min-width: 300px;
  display: none;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

#topbar {
  position: fixed;
  top: calc(var(--safe-top) + 12px);
  right: calc(var(--safe-right) + 12px);
  z-index: 21;
  display: none;
  gap: 8px;
  align-items: center;
}

#menuPanel {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.94);
  z-index: 60;
  width: min(540px, calc(100vw - 36px - var(--safe-left) - var(--safe-right)));
  max-height: calc(100dvh - 44px - var(--safe-top) - var(--safe-bottom));
  overflow: auto;
  display: none;
  padding: 18px;
  border-radius: 22px;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 208, 120, 0.12), rgba(255, 208, 120, 0) 42%),
    linear-gradient(180deg, rgba(38, 29, 22, 0.97), rgba(15, 12, 14, 0.98) 52%, rgba(10, 9, 12, 0.99));
  border: 1px solid rgba(230, 192, 122, 0.34);
  box-shadow:
    0 30px 90px rgba(0, 0, 0, 0.62),
    0 0 0 1px rgba(255, 224, 160, 0.06),
    inset 0 1px 0 rgba(255, 241, 212, 0.14),
    inset 0 0 0 1px rgba(110, 76, 34, 0.38);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.18s ease,
    transform 0.18s ease,
    box-shadow 0.18s ease;
}

#menuPanel .tabBtn {
  position: relative;
  overflow: hidden;
}

#menuPanel .tabBtn::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 10px;
  border: 1px solid rgba(255, 220, 165, 0.08);
  pointer-events: none;
}
  
  
#menuPanel.open {
  display: block;
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

body.menuVisible::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 55;
  background:
    radial-gradient(circle at center, rgba(0,0,0,0.16), rgba(0,0,0,0.70)),
    linear-gradient(180deg, rgba(14,10,10,0.34), rgba(5,5,8,0.78));
  backdrop-filter: blur(4px) saturate(0.9);
  -webkit-backdrop-filter: blur(4px) saturate(0.9);
  pointer-events: auto;
}

/* ── RPG Menu Action Buttons ─────────────────────────────── */
.menuActionList {
  gap: 12px !important;
}

.menuActionBtn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: flex-start;
  text-align: left;
  padding: 0 16px 0 12px !important;
  min-height: 54px !important;
  overflow: hidden;
  isolation: isolate;
  border-radius: 14px;
}

.menuActionBtn::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 0;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.06), rgba(255,255,255,0) 26%),
    linear-gradient(180deg, rgba(255,220,160,0.05), rgba(0,0,0,0.08));
}

.menuActionBtn::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 11px;
  pointer-events: none;
  z-index: 0;
  border: 1px solid rgba(255, 214, 148, 0.10);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.05),
    inset 0 0 0 1px rgba(0,0,0,0.22);
}

.menuBtnBadge,
.menuBtnLabel {
  position: relative;
  z-index: 1;
}

.menuBtnBadge {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  line-height: 1;
  color: #ffe7bc;
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 217, 152, 0.24), rgba(255, 217, 152, 0.04) 55%),
    linear-gradient(180deg, rgba(92, 63, 28, 0.98), rgba(44, 29, 14, 0.98));
  border: 1px solid rgba(239, 196, 119, 0.24);
  box-shadow:
    0 4px 10px rgba(0,0,0,0.24),
    inset 0 1px 0 rgba(255,240,208,0.10);
  text-shadow:
    0 1px 0 rgba(0,0,0,0.7),
    0 0 8px rgba(255,190,90,0.18);
}

.menuBtnLabel {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.menuActionBtn:hover .menuBtnBadge {
  transform: translateY(-1px) scale(1.04);
  box-shadow:
    0 6px 14px rgba(0,0,0,0.30),
    0 0 12px rgba(255,186,77,0.10),
    inset 0 1px 0 rgba(255,240,208,0.12);
}

.menuActionBtn.dangerBtn {
  border-color: rgba(190, 76, 62, 0.34) !important;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 112, 92, 0.14), rgba(255, 112, 92, 0) 42%),
    linear-gradient(180deg, rgba(86, 28, 24, 0.98), rgba(42, 16, 14, 0.99)) !important;
  color: #ffd9d0 !important;
  box-shadow:
    0 12px 24px rgba(0,0,0,0.30),
    0 0 20px rgba(180, 48, 36, 0.10),
    inset 0 1px 0 rgba(255, 212, 208, 0.08) !important;
}

.menuActionBtn.dangerBtn::after {
  border-color: rgba(255, 154, 140, 0.14);
}

.menuActionBtn.dangerBtn .menuBtnBadge {
  color: #ffe0da;
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 158, 136, 0.24), rgba(255, 158, 136, 0.04) 55%),
    linear-gradient(180deg, rgba(122, 45, 38, 0.98), rgba(62, 20, 17, 0.98));
  border-color: rgba(238, 119, 102, 0.26);
  text-shadow:
    0 1px 0 rgba(0,0,0,0.72),
    0 0 10px rgba(255,110,90,0.16);
}

.menuActionBtn.dangerBtn:hover {
  filter: brightness(1.08) !important;
  box-shadow:
    0 14px 30px rgba(0,0,0,0.34),
    0 0 24px rgba(200, 58, 44, 0.14),
    inset 0 1px 0 rgba(255, 212, 208, 0.10) !important;
}

.menuTitle {
  position: relative;
  text-align: center;
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #f6e7c0;
  margin: 2px 0 16px;
  padding: 0 56px;
  text-shadow:
    0 2px 0 rgba(0,0,0,0.7),
    0 0 16px rgba(255, 186, 78, 0.18);
}

.menuTitle::before,
.menuTitle::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 72px;
  height: 2px;
  transform: translateY(-50%);
  background: linear-gradient(90deg, rgba(255, 201, 110, 0), rgba(255, 201, 110, 0.9), rgba(255, 201, 110, 0));
  box-shadow: 0 0 10px rgba(255, 180, 82, 0.2);
}

.menuTitle::before { left: 0; }
.menuTitle::after  { right: 0; }

#menuTabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

#menuPanel .tabBtn {
  min-height: 42px;
  border-radius: 14px;
  border: 1px solid rgba(218, 180, 112, 0.18);
  background:
    linear-gradient(180deg, rgba(63, 48, 36, 0.95), rgba(29, 23, 20, 0.98));
  color: #d8cab0;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.06),
    0 8px 18px rgba(0,0,0,0.18);
}

#menuPanel .tabBtn:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

#menuPanel .tabBtn.active {
  color: #fff4d5;
  border-color: rgba(245, 203, 129, 0.42);
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 199, 107, 0.22), rgba(255, 199, 107, 0) 60%),
    linear-gradient(180deg, rgba(114, 75, 28, 0.98), rgba(58, 36, 16, 0.98));
  box-shadow:
    0 0 22px rgba(255, 177, 70, 0.14),
    inset 0 1px 0 rgba(255, 245, 220, 0.14);
}

#menuPanel .menuPage {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.015));
  border: 1px solid rgba(216, 178, 109, 0.10);
  border-radius: 16px;
  padding: 14px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

#menuPanel .row[style*="flex-direction: column"] {
  gap: 12px !important;
}

#menuPanel button {
  min-height: 46px;
  border-radius: 14px;
  border: 1px solid rgba(221, 183, 114, 0.20);
  background:
    linear-gradient(180deg, rgba(121, 78, 31, 0.96), rgba(72, 43, 17, 0.98));
  color: #f8edd0;
  font-weight: 800;
  letter-spacing: 0.02em;
  box-shadow:
    0 10px 22px rgba(0,0,0,0.26),
    inset 0 1px 0 rgba(255,244,219,0.11);
  transition:
    transform 0.12s ease,
    filter 0.12s ease,
    box-shadow 0.12s ease,
    border-color 0.12s ease;
}

#menuPanel button:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
  box-shadow:
    0 14px 28px rgba(0,0,0,0.34),
    0 0 18px rgba(255, 177, 71, 0.08),
    inset 0 1px 0 rgba(255,244,219,0.14);
}

#menuPanel button:active {
  transform: translateY(1px) scale(0.995);
}

#menuPanel button.secondary {
  background:
    linear-gradient(180deg, rgba(55, 46, 41, 0.96), rgba(24, 20, 20, 0.98));
  color: #e7dcc4;
}

#menuPanel .hint {
  color: rgba(236, 224, 203, 0.72);
}

#menuPanel .sectionTitle {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #ecd7ac;
  margin: 20px 0 10px;
}

#menuPanel input[type="range"] {
  accent-color: #d59a44;
}

#menuPanel .tag {
  background: rgba(255, 209, 122, 0.10);
  border: 1px solid rgba(255, 209, 122, 0.16);
  color: #f2dfbf;
}

#menuTabs,
#lobbyTabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 180px));
  gap: 10px;
  margin: 14px 0 14px;
}

#lobbyTabs .tabBtn {
  min-height: 42px;
  border-radius: 14px;
  border: 1px solid rgba(218, 180, 112, 0.18);
  background:
    linear-gradient(180deg, rgba(63, 48, 36, 0.95), rgba(29, 23, 20, 0.98));
  color: #d8cab0;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.06),
    0 8px 18px rgba(0,0,0,0.18);
}

#lobbyTabs .tabBtn.active {
  color: #fff4d5;
  border-color: rgba(245, 203, 129, 0.42);
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 199, 107, 0.22), rgba(255, 199, 107, 0) 60%),
    linear-gradient(180deg, rgba(114, 75, 28, 0.98), rgba(58, 36, 16, 0.98));
  box-shadow:
    0 0 22px rgba(255, 177, 70, 0.14),
    inset 0 1px 0 rgba(255, 245, 220, 0.14);
}

.tabBtn.active { background: #2e6cff; }
.menuPage, .lobbyPage { display: none; }
.menuPage.active, .lobbyPage.active { display: block; }

#overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow: auto;
  padding:
    calc(var(--safe-top) + 20px)
    calc(var(--safe-right) + 12px)
    calc(var(--safe-bottom) + 20px)
    calc(var(--safe-left) + 12px);

  background:
    radial-gradient(circle at 50% -10%, rgba(255, 191, 94, 0.10), rgba(255, 191, 94, 0) 30%),
    radial-gradient(circle at center, rgba(66, 45, 28, 0.18), rgba(0,0,0,0.76)),
    linear-gradient(180deg, rgba(14,10,10,0.82), rgba(6,6,9,0.92));
}

.panel {
  width: min(1120px, calc(100vw - 24px - var(--safe-left) - var(--safe-right)));
  position: relative;
  margin: 0 auto;
  padding: 26px;
  border-radius: 24px;

  background:
    radial-gradient(circle at 50% 0%, rgba(255, 208, 120, 0.10), rgba(255, 208, 120, 0) 38%),
    linear-gradient(180deg, rgba(31, 24, 20, 0.96), rgba(15, 13, 15, 0.98) 58%, rgba(10, 10, 13, 0.99));

  border: 1px solid rgba(223, 185, 116, 0.26);

  box-shadow:
    0 24px 70px rgba(0,0,0,0.42),
    0 0 0 1px rgba(255, 227, 171, 0.05),
    inset 0 1px 0 rgba(255, 241, 212, 0.10),
    inset 0 0 0 1px rgba(110, 76, 34, 0.30);
}

.panel::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 18px;
  pointer-events: none;
  border: 1px solid rgba(255, 214, 148, 0.08);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.03),
    inset 0 0 0 1px rgba(0,0,0,0.18);
}

#lobbyMenuBtn {
  position: absolute;
  top: 18px;
  right: 18px;
}

.grid {
  display: grid;
  grid-template-columns: 1.35fr 0.65fr;
  gap: 20px;
}

.twoCol {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.title {
  font-size: 34px;
  font-weight: 700;
  margin-bottom: 8px;
}

.subtle {
  color: #d3c6b2;
  font-size: 14px;
  line-height: 1.5;
}

.sectionTitle {
  font-size: 18px;
  font-weight: 700;
  margin: 20px 0 10px;
}

.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

button {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(121, 78, 31, 0.96), rgba(72, 43, 17, 0.98));
  color: #f8edd0;
  border: 1px solid rgba(221, 183, 114, 0.20);
  border-radius: 14px;
  padding: 11px 16px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow:
    0 10px 22px rgba(0,0,0,0.26),
    inset 0 1px 0 rgba(255,244,219,0.11);
  transition:
    transform 0.12s ease,
    filter 0.12s ease,
    box-shadow 0.12s ease;
}

button::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 10px;
  pointer-events: none;
  border: 1px solid rgba(255, 217, 150, 0.08);
}

button:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
}

button.secondary {
  background:
    linear-gradient(180deg, rgba(55, 46, 41, 0.96), rgba(24, 20, 20, 0.98));
  color: #e7dcc4;
}

input[type="text"] {
  width: min(320px, 100%);
  background: #0f0f13;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 15px;
  outline: none;
}

.leaderboard,
.previewPanel,
.inventoryPanel,
.storePanel {
  position: relative;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02)),
    linear-gradient(180deg, rgba(39, 30, 25, 0.82), rgba(20, 17, 18, 0.90));
  border: 1px solid rgba(219, 180, 110, 0.14);
  border-radius: 18px;
  padding: 15px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.04),
    0 10px 24px rgba(0,0,0,0.18);
}

.leaderboard::before,
.previewPanel::before,
.inventoryPanel::before,
.storePanel::before {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 13px;
  pointer-events: none;
  border: 1px solid rgba(255, 217, 150, 0.06);
}

.leaderboard { min-height: 160px; }

.lbRow,
.storeRow,
.bindRow {
  display: grid;
  gap: 10px;
  padding: 11px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  align-items: center;
  background: linear-gradient(180deg, rgba(255,255,255,0.015), rgba(255,255,255,0));
  border-radius: 12px;
}

.lbRow:hover,
.storeRow:hover,
.bindRow:hover {
  background: linear-gradient(180deg, rgba(255, 211, 129, 0.04), rgba(255,255,255,0.01));
}

.tag {
  display: inline-block;
  background: rgba(255,255,255,0.08);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  color: #ddd;
}

.hint { color: #cfcfcf; font-size: 13px; }
.warn { color: #ff9c6b; }
.bindBtn.waiting { background: #a96912; }
.musicToggleOn { background: #136c3d; }
.musicToggleOff { background: #6c1d13; }

#previewViewport {
  position: relative;
  width: 100%;
  height: 560px;
  min-height: 560px;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid rgba(226, 186, 116, 0.16);
  background:
    radial-gradient(circle at 50% 24%, rgba(101, 76, 52, 0.34), rgba(24, 20, 24, 0.96) 68%),
    linear-gradient(180deg, rgba(30, 26, 29, 0.96), rgba(12, 11, 14, 0.98));
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.05),
    inset 0 -36px 50px rgba(0,0,0,0.26),
    0 12px 26px rgba(0,0,0,0.22);
}

#previewCanvas {
  width: 100%;
  height: 100%;
  display: block;
  background: transparent;
}

#previewThreeLayer {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: auto;
}

#previewThreeLayer canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.inventoryGrid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 10px;
}

.inventoryCard {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 10px;
}

.inventoryTitle {
  font-size: 13px;
  color: #cfcfcf;
  margin-bottom: 6px;
}

.inventoryItemRow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.miniBtn {
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 10px;
}

.colorChoice {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.2);
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease;
}

.colorChoice:hover { transform: scale(1.06); }

.colorChoice.selected {
  border-color: #fff;
  box-shadow: 0 0 0 4px rgba(255,255,255,0.12);
}

/* ── Mobile Controls ───────────────────────────────────────── */
#mobileControls {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 22;
  display: none;
  justify-content: space-between;
  align-items: flex-end;
  padding:
    14px
    calc(var(--safe-right) + 14px)
    calc(var(--safe-bottom) + 16px)
    calc(var(--safe-left) + 14px);
  pointer-events: none;
}

#mobileControls.show { display: flex; }

.mobileSide {
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: auto;
  align-items: center;
}

.mobileJoystick {
  width: 132px;
  height: 132px;
  border-radius: 50%;
  background: rgba(20,20,28,0.62);
  border: 1px solid rgba(255,255,255,0.16);
  position: relative;
  touch-action: none;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.mobileJoystickBase {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06);
}

.mobileJoystickThumb {
  position: absolute;
  width: 52px;
  height: 52px;
  left: 40px;
  top: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.22);
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
  transform: translate(0px,0px);
}

#moveJoystickThumb { background: rgba(46,108,255,0.92); }

.mobileActions {
  position: relative;
  width: 196px;
  height: 196px;
  pointer-events: auto;
}

/* ── Shared spell icon/image layer ─────────────────────────── */
.spellIcon {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  filter: saturate(1.08) contrast(1.06);
}

/* Hide old emoji placeholders once icons are used */
.deskSpellIcon,
.mobileBtnIcon {
  opacity: 0;
  pointer-events: none;
}

/* ── Mobile spell buttons AAA ──────────────────────────────── */
.mobileBtn {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  background: rgba(20,20,28,0.82);
  border: 1px solid rgba(255,255,255,0.18);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 0;
  position: absolute;
  overflow: hidden;
  isolation: isolate;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 10px 28px rgba(0,0,0,0.34),
    inset 0 1px 0 rgba(255,255,255,0.10);
  transition:
    transform 0.12s ease,
    filter 0.12s ease,
    box-shadow 0.12s ease,
    border-color 0.12s ease;
}

.mobileBtn::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    radial-gradient(circle at 30% 24%, rgba(255,255,255,0.18), rgba(255,255,255,0) 38%),
    linear-gradient(to bottom, rgba(255,255,255,0.04), rgba(0,0,0,0.18));
  pointer-events: none;
  z-index: 2;
}

.mobileBtn::after {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: inherit;
  border: 1px solid rgba(255,255,255,0.08);
  pointer-events: none;
  z-index: 2;
}

.mobileBtn.big {
  width: 72px;
  height: 72px;
  border-radius: 999px;
}

.mobileBtn.mainSkill {
  width: 86px;
  height: 86px;
  border-radius: 999px;
  background: radial-gradient(circle at 35% 30%, rgba(255,170,80,0.98), rgba(255,95,35,0.96));
  border: 1px solid rgba(255,220,180,0.34);
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.06),
    0 0 24px rgba(255,120,50,0.22),
    0 12px 28px rgba(0,0,0,0.36);
}

.mobileBtn.subSkill {
  background: linear-gradient(180deg, rgba(34,36,44,0.95), rgba(16,18,25,0.95));
  border: 1px solid rgba(255,255,255,0.16);
}

.mobileBtn:hover,
.mobileBtn:active {
  transform: translateY(-1px) scale(1.03);
}

.mobileBtn.aiming {
  transform: scale(1.08);
  background: rgba(255,120,60,0.95);
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.08),
    0 0 22px rgba(255,140,70,0.35),
    0 14px 30px rgba(0,0,0,0.40);
}

.mobileBtn .spellIcon {
  z-index: 1;
}

#mobileFireBtn     { left: 55px; top: 55px; }
#mobileHookBtn     { left: 118px; top: 8px; }
#mobileTeleportBtn { left: 118px; top: 118px; }
#mobileShieldBtn   { left: 8px; top: 8px; }
#mobileChargeBtn   { left: 8px; top: 118px; }
#mobileShockBtn    { left: 55px; top: 140px; }
#mobileGustBtn     { left: 134px; top: 55px; }
#mobileWallBtn     { left: -2px; top: 55px; }
#mobileRewindBtn   { left: 55px; top: -2px; }

.mobileDragArrow {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 44px;
  height: 4px;
  background: rgba(255,220,180,0.95);
  border-radius: 999px;
  transform-origin: 0 50%;
  pointer-events: none;
  display: none;
  box-shadow: 0 0 10px rgba(255,170,100,0.45);
  z-index: 6;
}

.mobileDragArrow::after {
  content: "";
  position: absolute;
  right: -2px;
  top: 50%;
  width: 12px;
  height: 12px;
  border-top: 4px solid rgba(255,220,180,0.95);
  border-right: 4px solid rgba(255,220,180,0.95);
  transform: translateY(-50%) rotate(45deg);
  box-sizing: border-box;
}

.mobileBtnCooldown {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: inherit;
  background:
    linear-gradient(to bottom, rgba(10,12,16,0.62), rgba(8,10,14,0.82));
  color: #fff;
  font-size: 24px;
  font-weight: 900;
  text-shadow:
    -1px -1px 0 rgba(0,0,0,0.95),
     1px -1px 0 rgba(0,0,0,0.95),
    -1px  1px 0 rgba(0,0,0,0.95),
     1px  1px 0 rgba(0,0,0,0.95),
     0 0 10px rgba(0,0,0,0.9);
  pointer-events: none;
}

.mobileBtn.onCooldown .mobileBtnCooldown { display: flex; }

.mobileBtn.onCooldown .spellIcon {
  filter: grayscale(0.88) brightness(0.58) saturate(0.7);
}

.mobileBtnIcon {
  font-size: 28px;
  line-height: 1;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.35));
}

.mobileBtnIcon.small { font-size: 24px; }

.mobileBtnText {
  position: absolute;
  left: 50%;
  bottom: -19px;
  transform: translateX(-50%);
  z-index: 4;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: #fff;
  white-space: nowrap;
  pointer-events: none;
  text-shadow:
    -1px -1px 0 rgba(0,0,0,0.98),
     1px -1px 0 rgba(0,0,0,0.98),
    -1px  1px 0 rgba(0,0,0,0.98),
     1px  1px 0 rgba(0,0,0,0.98),
     0 0 8px rgba(0,0,0,0.92);
}

.mobileLabel {
  font-size: 12px;
  color: rgba(255,255,255,0.7);
  margin-top: -4px;
}

@media (max-width: 700px) {
  #menuPanel {
    width: min(94vw, 540px);
    padding: 14px;
    border-radius: 18px;
  }

  .menuTitle {
    font-size: 22px;
    padding: 0 34px;
  }

  .menuTitle::before,
  .menuTitle::after {
    width: 34px;
  }

  #menuTabs {
    grid-template-columns: 1fr;
  }
}

/* ── Desktop spell bar AAA ─────────────────────────────────── */
#desktopSpellBar {
  position: fixed;
  bottom: calc(var(--safe-bottom) + 18px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  gap: 12px;
  align-items: flex-end;
  padding: 10px 14px;
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(22,24,32,0.72), rgba(10,12,18,0.62));
  border: 1px solid rgba(255,255,255,0.10);
  box-shadow:
    0 12px 36px rgba(0,0,0,0.32),
    inset 0 1px 0 rgba(255,255,255,0.05);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.deskSpell.readyFlash,
.mobileBtn.readyFlash {
  animation: cooldownReadyFlash 0.42s ease;
}

@keyframes cooldownReadyFlash {
  0% {
    box-shadow: 0 0 0 rgba(255,255,255,0);
    transform: scale(1);
  }
  35% {
    box-shadow: 0 0 18px rgba(255,255,255,0.75);
    transform: scale(1.08);
  }
  100% {
    box-shadow: 0 0 0 rgba(255,255,255,0);
    transform: scale(1);
  }
}

.deskSpell {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 18px;
  overflow: hidden;
  isolation: isolate;
  background: linear-gradient(180deg, rgba(30,32,40,0.96), rgba(16,18,25,0.96));
  border: 1px solid rgba(255,255,255,0.14);
  box-shadow:
    0 10px 24px rgba(0,0,0,0.28),
    inset 0 1px 0 rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  transition:
    transform 0.12s ease,
    filter 0.12s ease,
    box-shadow 0.12s ease,
    border-color 0.12s ease;
}

.deskSpell::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    radial-gradient(circle at 30% 22%, rgba(255,255,255,0.16), rgba(255,255,255,0) 34%),
    linear-gradient(to bottom, rgba(255,255,255,0.03), rgba(0,0,0,0.16));
  pointer-events: none;
  z-index: 2;
}

.deskSpell::after {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: inherit;
  border: 1px solid rgba(255,255,255,0.06);
  pointer-events: none;
  z-index: 2;
}

.deskSpell:hover {
  transform: translateY(-2px);
  box-shadow:
    0 14px 28px rgba(0,0,0,0.34),
    inset 0 1px 0 rgba(255,255,255,0.10);
}

.deskSpell .spellIcon {
  z-index: 1;
  border-radius: 18px;
}

.deskSpell.onCooldown .spellIcon {
  filter: grayscale(0.88) brightness(0.56) saturate(0.68);
}

.deskSpellCooldown {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: inherit;
  background:
    linear-gradient(to bottom, rgba(8,10,14,0.58), rgba(7,9,12,0.84));
  color: #fff;
  font-size: 24px;
  font-weight: 900;
  text-shadow:
    -1px -1px 0 rgba(0,0,0,0.95),
     1px -1px 0 rgba(0,0,0,0.95),
    -1px  1px 0 rgba(0,0,0,0.95),
     1px  1px 0 rgba(0,0,0,0.95),
     0 0 10px rgba(0,0,0,0.9);
  pointer-events: none;
}

.deskSpell.onCooldown .deskSpellCooldown { display: flex; }

.deskSpellLabel {
  position: absolute;
  left: 50%;
  bottom: 6px;
  transform: translateX(-50%);
  z-index: 4;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
  color: #fff;
  text-shadow:
    -1px -1px 0 rgba(0,0,0,0.98),
     1px -1px 0 rgba(0,0,0,0.98),
    -1px  1px 0 rgba(0,0,0,0.98),
     1px  1px 0 rgba(0,0,0,0.98),
     0 0 8px rgba(0,0,0,0.92);
  pointer-events: none;
}

.deskSpellKey {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 4;
  min-width: 18px;
  padding: 3px 6px;
  border-radius: 999px;
  background: rgba(0,0,0,0.46);
  border: 1px solid rgba(255,255,255,0.12);
  font-size: 9px;
  font-weight: 900;
  line-height: 1;
  color: rgba(255,255,255,0.94);
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
  letter-spacing: 0.02em;
  pointer-events: none;
}

/* ── Per-spell color identity ──────────────────────────────── */
#dspell-fire,
#mobileFireBtn {
  box-shadow:
    0 0 0 1px rgba(255,180,110,0.08),
    0 0 18px rgba(255,120,40,0.16),
    0 10px 24px rgba(0,0,0,0.28);
}

#dspell-hook,
#mobileHookBtn {
  box-shadow:
    0 0 0 1px rgba(230,240,255,0.08),
    0 0 16px rgba(185,215,255,0.14),
    0 10px 24px rgba(0,0,0,0.28);
}

#dspell-blink,
#mobileTeleportBtn {
  box-shadow:
    0 0 0 1px rgba(255,120,245,0.08),
    0 0 18px rgba(234,70,255,0.18),
    0 10px 24px rgba(0,0,0,0.28);
}

#dspell-shield,
#mobileShieldBtn {
  box-shadow:
    0 0 0 1px rgba(140,210,255,0.08),
    0 0 18px rgba(90,180,255,0.16),
    0 10px 24px rgba(0,0,0,0.28);
}

#dspell-charge,
#mobileChargeBtn {
  box-shadow:
    0 0 0 1px rgba(190,145,255,0.08),
    0 0 18px rgba(170,110,255,0.18),
    0 10px 24px rgba(0,0,0,0.28);
}

#dspell-shock,
#mobileShockBtn {
  box-shadow:
    0 0 0 1px rgba(255,205,120,0.08),
    0 0 18px rgba(255,180,75,0.18),
    0 10px 24px rgba(0,0,0,0.28);
}

#dspell-gust,
#mobileGustBtn {
  box-shadow:
    0 0 0 1px rgba(130,240,255,0.08),
    0 0 18px rgba(90,220,255,0.18),
    0 10px 24px rgba(0,0,0,0.28);
}

#dspell-wall,
#mobileWallBtn {
  box-shadow:
    0 0 0 1px rgba(130,180,255,0.08),
    0 0 18px rgba(90,140,255,0.16),
    0 10px 24px rgba(0,0,0,0.28);
}

#dspell-rewind,
#mobileRewindBtn {
  box-shadow:
    0 0 0 1px rgba(205,145,255,0.08),
    0 0 18px rgba(185,110,255,0.18),
    0 10px 24px rgba(0,0,0,0.28);
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 980px) {
  .grid,
  .twoCol {
    grid-template-columns: 1fr;
  }

  .panel {
    padding: 18px;
    width: min(100vw - 20px - var(--safe-left) - var(--safe-right), 1120px);
  }

.title {
  font-size: 36px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #f5e6bf;
  margin-bottom: 10px;
  text-shadow:
    0 2px 0 rgba(0,0,0,0.7),
    0 0 14px rgba(255, 184, 72, 0.14);
}

  #lobbyMenuBtn {
    position: static;
    margin-bottom: 12px;
  }
}

@media (pointer: coarse), (max-width: 900px) {
  #hud {
    min-width: 0;
    max-width: calc(100vw - 24px - var(--safe-left) - var(--safe-right));
    font-size: 13px;
  }

  #topbar {
    top: calc(var(--safe-top) + 10px);
    right: calc(var(--safe-right) + 10px);
  }

  #menuPanel {
    right: calc(var(--safe-right) + 10px);
    left: calc(var(--safe-left) + 10px);
    top: calc(var(--safe-top) + 54px);
    min-width: 0;
  }

  #previewViewport {
    height: 320px;
    min-height: 320px;
  }

  #previewCanvas {
    height: 100%;
  }

  .mobileJoystick {
    width: 118px;
    height: 118px;
  }

  .mobileJoystickThumb {
    width: 46px;
    height: 46px;
    left: 36px;
    top: 36px;
  }

  .mobileActions {
    width: 204px;
    height: 196px;
  }

  #mobileFireBtn     { left: 48px; top: 48px; }
  #mobileHookBtn     { left: 108px; top: 4px; }
  #mobileTeleportBtn { left: 108px; top: 108px; }
  #mobileShieldBtn   { left: 4px; top: 4px; }
  #mobileChargeBtn   { left: 4px; top: 108px; }
  #mobileShockBtn    { left: 48px; top: 128px; }
  #mobileGustBtn     { left: 112px; top: 48px; }
  #mobileWallBtn     { left: 0px; top: 48px; }
  #mobileRewindBtn   { left: 48px; top: 0px; }

  .mobileBtn.big {
    width: 64px;
    height: 64px;
  }

  .mobileBtn.mainSkill {
    width: 78px;
    height: 78px;
  }

  .mobileBtnIcon {
    font-size: 24px;
  }

  .mobileBtnIcon.small {
    font-size: 20px;
  }

  .mobileBtnText {
    font-size: 10px;
    bottom: -16px;
  }

  .mobileLabel {
    font-size: 11px;
  }
}
/* ── Premium Spell Tooltip ─────────────────────────────────── */
.spellTooltip {
  position: fixed;
  z-index: 1000;
  min-width: 210px;
  max-width: 260px;
  padding: 12px 14px;
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(28,32,42,0.96), rgba(14,16,24,0.96));
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow:
    0 16px 40px rgba(0,0,0,0.42),
    0 0 24px rgba(90,140,255,0.08),
    inset 0 1px 0 rgba(255,255,255,0.08);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  pointer-events: none;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.spellTooltip.hidden {
  opacity: 0;
  transform: translateY(4px);
}

.spellTooltipName {
  font-size: 14px;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 4px;
  letter-spacing: 0.02em;
}

.spellTooltipDesc {
  font-size: 12px;
  color: rgba(255,255,255,0.84);
  margin-bottom: 6px;
  line-height: 1.35;
}

.spellTooltipStats {
  font-size: 11px;
  font-weight: 700;
  color: #9fd0ff;
  letter-spacing: 0.02em;
}

/* ============================================================
   AAA LOBBY OVERRIDE
   ============================================================ */

#overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: stretch;
  justify-content: center;
  overflow: auto;
  padding:
    calc(var(--safe-top) + 18px)
    calc(var(--safe-right) + 18px)
    calc(var(--safe-bottom) + 18px)
    calc(var(--safe-left) + 18px);
  background:
    radial-gradient(circle at center, rgba(0, 0, 0, 0.20), rgba(0, 0, 0, 0.74)),
    linear-gradient(180deg, rgba(10, 7, 8, 0.18), rgba(10, 7, 8, 0.56)),
    url('docs/art/Lobby/BG.jpeg') center center / cover no-repeat;
}

.panel.lobbyShell {
  width: min(1450px, calc(100vw - 36px - var(--safe-left) - var(--safe-right)));
  min-height: calc(100dvh - 36px - var(--safe-top) - var(--safe-bottom));
  margin: 0 auto;
  padding: 18px 18px 22px;
  border: 0;
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(14, 10, 10, 0.38), rgba(7, 7, 10, 0.52));
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.panel.lobbyShell::before {
  display: none;
}

.lobbyTopBar {
  display: grid;
  grid-template-columns: 180px 1fr 220px;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.lobbyMenuBtn {
  justify-self: start;
  min-width: 112px;
}

.lobbyBrandWrap {
  text-align: center;
}

.lobbyBrandEyebrow {
  color: rgba(244, 219, 174, 0.68);
  font-size: 12px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.lobbyBrand {
  font-size: clamp(28px, 3vw, 52px);
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #f7e8c5;
  text-shadow:
    0 2px 0 rgba(0,0,0,0.72),
    0 0 24px rgba(255, 176, 72, 0.16);
}

.lobbyTopRight {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.topCurrencyCard {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(28, 21, 18, 0.82), rgba(12, 10, 11, 0.92));
  border: 1px solid rgba(235, 190, 113, 0.16);
  box-shadow:
    0 10px 24px rgba(0, 0, 0, 0.24),
    inset 0 1px 0 rgba(255, 245, 220, 0.06);
  color: #f3e7cf;
  font-weight: 800;
  font-size: 16px;
}

.currencyIcon {
  width: 22px;
  height: 22px;
  object-fit: contain;
  display: block;
}

.lobbyMainGrid {
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(540px, 1fr) minmax(270px, 320px);
  gap: 20px;
  align-items: stretch;
}

.lobbySide,
.heroStage,
.storePanel {
  min-width: 0;
}

.framedPanel {
  position: relative;
  border: 64px solid transparent;
  border-image-source: url('docs/art/Lobby/Frame.png');
  border-image-slice: 64;
  border-image-repeat: stretch;
  background:
    linear-gradient(180deg, rgba(13, 9, 10, 0.70), rgba(8, 8, 11, 0.82));
  box-shadow:
    0 18px 48px rgba(0, 0, 0, 0.28),
    inset 0 0 36px rgba(255, 168, 66, 0.05);
  min-height: 0;
}

.sidePanelInner {
  margin: -28px;
  padding: 6px 2px 2px;
}

.sectionTitle {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #f1dfb6;
  text-transform: uppercase;
  margin: 18px 0 10px;
}

.sectionCompact {
  margin-top: 0;
}

#nameInput {
  width: 100%;
  max-width: none;
  background:
    linear-gradient(180deg, rgba(8, 10, 18, 0.88), rgba(5, 7, 12, 0.94));
  color: #fff;
  border: 1px solid rgba(255, 218, 158, 0.12);
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 16px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.04),
    0 8px 18px rgba(0,0,0,0.18);
}

.colorRowAaa {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
}

.colorChoice {
  position: relative;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.18);
  cursor: pointer;
  transition:
    transform 0.14s ease,
    border-color 0.14s ease,
    box-shadow 0.14s ease,
    filter 0.14s ease;
  box-shadow:
    0 10px 18px rgba(0,0,0,0.28),
    inset 0 2px 4px rgba(255,255,255,0.22);
}

.colorChoice::before {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.16);
  pointer-events: none;
}

.colorChoice:hover {
  transform: translateY(-2px) scale(1.06);
  filter: brightness(1.06);
}

.colorChoice.selected {
  border-color: rgba(255,255,255,0.95);
  box-shadow:
    0 0 0 4px rgba(255,255,255,0.12),
    0 0 24px rgba(255, 188, 106, 0.18),
    0 10px 18px rgba(0,0,0,0.28),
    inset 0 2px 4px rgba(255,255,255,0.22);
}

.lobbyCenter {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.heroStage {
  padding-bottom: 18px;
}

.heroStageHeader {
  margin: -26px -28px 10px;
  padding: 0 2px;
}

.heroOverline {
  color: rgba(244, 221, 183, 0.62);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  margin-bottom: 4px;
}

.heroTitle {
  color: #f8ebd2;
  font-size: 34px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-shadow:
    0 2px 0 rgba(0,0,0,0.72),
    0 0 18px rgba(255, 176, 72, 0.12);
}

.heroViewport {
  position: relative;
  width: 100%;
  height: 500px;
  border-radius: 22px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 22%, rgba(95, 74, 51, 0.30), rgba(18, 15, 20, 0.94) 62%),
    linear-gradient(180deg, rgba(26, 20, 22, 0.92), rgba(10, 10, 14, 0.98));
  border: 1px solid rgba(255, 214, 148, 0.08);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.05),
    inset 0 -36px 50px rgba(0,0,0,0.26),
    0 12px 30px rgba(0,0,0,0.22);
}

#previewCanvas {
  width: 100%;
  height: 100%;
  display: block;
  background: transparent;
}

#previewThreeLayer {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: auto;
}

#previewThreeLayer canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.heroParticles {
  position: absolute;
  inset: -10%;
  pointer-events: none;
  mix-blend-mode: screen;
  opacity: 0.18;
  z-index: 1;
}

.heroParticlesOrange {
  background: url('docs/art/Lobby/Orange.png') center / 220px auto repeat;
  animation: lobbyOrangeDrift 18s linear infinite;
}

.heroParticlesPurple {
  background: url('docs/art/Lobby/Purple.png') center / 260px auto repeat;
  animation: lobbyPurpleDrift 24s linear infinite;
}

.heroBottomGlow {
  position: absolute;
  left: 50%;
  bottom: 20px;
  width: 320px;
  height: 64px;
  transform: translateX(-50%);
  border-radius: 50%;
  background:
    radial-gradient(circle at center,
      rgba(130, 88, 255, 0.20) 0%,
      rgba(255, 149, 76, 0.16) 34%,
      rgba(255, 149, 76, 0) 72%);
  pointer-events: none;
  z-index: 1;
  filter: blur(10px);
}

.heroHint {
  margin-top: 10px;
  color: rgba(242, 227, 203, 0.72);
  font-size: 13px;
}

.ctaWrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.enterArenaBtn {
  position: relative;
  width: min(420px, 100%);
  height: 96px;
  border: none;
  border-radius: 0;
  background: url('docs/art/Lobby/Button.png') center center / 100% 100% no-repeat;
  box-shadow:
    0 12px 30px rgba(0,0,0,0.28),
    0 0 24px rgba(255, 157, 66, 0.12);
  padding: 0;
}

.enterArenaBtn::after {
  display: none;
}

.enterArenaBtn:hover {
  transform: translateY(-1px) scale(1.015);
  filter: brightness(1.05);
}

.enterArenaBtn:active {
  transform: translateY(1px) scale(0.995);
}

.enterArenaText {
  display: inline-block;
  font-size: clamp(24px, 2vw, 34px);
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fbf1dc;
  text-shadow:
    0 2px 0 rgba(0,0,0,0.76),
    0 0 14px rgba(255, 183, 84, 0.14);
}

.rewardRow {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.rewardRow .tag {
  background: rgba(8, 10, 14, 0.56);
  border: 1px solid rgba(255, 209, 122, 0.12);
  color: #e7dac0;
}

.aaaTabs {
  justify-content: center;
}

#lobbyTabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(140px, 180px));
  gap: 10px;
  margin: 2px auto 0;
  justify-content: center;
}

#lobbyPlay {
  display: none;
}

#lobbyStore.active {
  display: block;
}

.storeCurrencyLine {
  color: #f5e6c7;
  font-weight: 800;
  margin-bottom: 8px;
}

.storeHint {
  margin-bottom: 12px;
}

.leaderboardPanelAaa #leaderboardList {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.aaaLbRow {
  display: grid;
  grid-template-columns: 58px 1fr;
  align-items: center;
  gap: 12px;
  min-height: 68px;
  padding: 12px 12px;
  border-radius: 16px;
  border: 1px solid rgba(255, 214, 148, 0.08);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01)),
    linear-gradient(180deg, rgba(36, 27, 24, 0.78), rgba(14, 12, 14, 0.86));
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.04),
    0 8px 18px rgba(0,0,0,0.14);
}

.rankBadge {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background-image: url('docs/art/Lobby/Ranks.png');
  background-repeat: no-repeat;
  background-size: 138px 46px;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.28));
}

.rankGold {
  background-position: 0 0;
}

.rankSilver {
  background-position: -46px 0;
}

.rankBronze {
  background-position: -92px 0;
}

.rankDefault {
  background:
    linear-gradient(180deg, rgba(90, 70, 52, 0.92), rgba(46, 34, 26, 0.96));
  border: 1px solid rgba(255,255,255,0.10);
  position: relative;
}

.rankDefault::before {
  content: attr(data-rank);
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #f1dfb6;
  font-weight: 900;
  font-size: 16px;
}

.lbMeta {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.lbName {
  color: #fff2d7;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.1;
}

.lbPoints {
  color: rgba(242, 226, 198, 0.76);
  font-size: 14px;
  font-weight: 700;
}

.inventoryGrid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 10px;
}

.inventoryCard {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.035), rgba(255,255,255,0.01)),
    linear-gradient(180deg, rgba(36, 27, 24, 0.76), rgba(14, 12, 14, 0.84));
  border: 1px solid rgba(255, 214, 148, 0.08);
  border-radius: 14px;
  padding: 12px;
}

.inventoryTitle {
  font-size: 13px;
  color: #d9c8a6;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.inventoryItemRow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.inventoryItemRow:last-child {
  border-bottom: 0;
}

.miniBtn {
  min-height: 34px;
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 10px;
}

.storeRow,
.bindRow,
.lbRow {
  border-radius: 14px;
}

.storeRow {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 12px 12px;
  align-items: center;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
  border: 1px solid rgba(255,255,255,0.04);
  margin-bottom: 10px;
}

@keyframes lobbyOrangeDrift {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(0, -40px, 0); }
}

@keyframes lobbyPurpleDrift {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(0, -28px, 0); }
}

@media (max-width: 1180px) {
  .lobbyMainGrid {
    grid-template-columns: 1fr;
  }

  .lobbyRight {
    order: 3;
  }

  .lobbyCenter {
    order: 1;
  }

  .lobbyLeft {
    order: 2;
  }

  .heroViewport {
    height: 430px;
  }
}

@media (max-width: 760px) {
  .lobbyTopBar {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 12px;
  }

  .lobbyMenuBtn {
    justify-self: center;
  }

  .heroViewport {
    height: 340px;
  }

  .enterArenaBtn {
    height: 82px;
  }

  .framedPanel {
    border-width: 44px;
    border-image-slice: 44;
  }

  .sidePanelInner {
    margin: -16px;
  }
}
