:root {
  color-scheme: dark;
  --bg: #07070b;
  --panel: rgba(7, 7, 11, 0.78);
  --ink: #f7f4ea;
  --muted: #a7a3ad;
  --hot: #ff3d7f;
  --mint: #26f0bd;
  --gold: #ffd15c;
  --violet: #8c6cff;
  --line: rgba(255, 255, 255, 0.16);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  touch-action: none;
  user-select: none;
  overscroll-behavior: none;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  min-height: 48px;
  padding: 0 16px;
  color: #07070b;
  background: var(--mint);
  font-weight: 850;
  cursor: pointer;
}

button.secondary,
button.tab,
button.iconButton {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--line);
}

button.tab.active {
  color: #07070b;
  background: var(--gold);
}

input {
  min-height: 46px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.08);
  outline: none;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.shell {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: stretch;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 61, 127, 0.22), transparent 28%),
    radial-gradient(circle at 50% 78%, rgba(38, 240, 189, 0.16), transparent 30%),
    #07070b;
}

#game {
  width: 100vw;
  height: 100dvh;
  display: block;
}

.topbar {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  left: max(10px, env(safe-area-inset-left));
  right: auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  width: min(520px, calc(100vw - 118px));
  pointer-events: none;
}

body.in-match .topbar,
body.in-match .gameMenuToggle,
body.in-match .gameMenu {
  display: none;
}

.topbar div,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(7, 7, 11, 0.58);
  backdrop-filter: blur(16px);
}

.topbar div {
  min-width: 0;
  padding: 9px 10px;
}

.label {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0;
}

.topbar strong {
  display: block;
  overflow: hidden;
  font-size: 20px;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.panel {
  position: fixed;
  left: max(12px, env(safe-area-inset-left));
  right: max(12px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  width: auto;
  max-width: 860px;
  margin: 0 auto;
  display: grid;
  gap: 12px;
  max-height: min(58dvh, 560px);
  overflow: auto;
  padding: 16px;
  background: var(--panel);
}

.panel.hidden {
  pointer-events: none;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 140ms ease, transform 140ms ease;
}

.panel h1 {
  margin: 0;
  font-size: clamp(32px, 10vw, 44px);
  line-height: 0.95;
}

.panel p,
.panel small {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.panel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.lobbyHeader {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
}

.pulsoLogo {
  display: block;
  width: min(100%, 330px);
  height: auto;
}

.pulsoMiniMark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255,61,127,.9), rgba(140,108,255,.9) 52%, rgba(38,240,189,.9)),
    #07070b;
  box-shadow: 0 0 24px rgba(255, 61, 127, 0.32);
}

.pulsoMiniMark::before {
  content: "";
  display: block;
  width: 28px;
  height: 16px;
  margin: 13px 7px;
  border-top: 4px solid #f7f4ea;
  border-right: 4px solid #f7f4ea;
  transform: skewX(-24deg);
}

.panel header strong {
  display: block;
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.iconButton {
  min-height: 38px;
  padding: 0 12px;
}

.gameMenuToggle {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  right: max(10px, env(safe-area-inset-right));
  z-index: 40;
  min-width: 88px;
  box-shadow: 0 0 28px rgba(38, 240, 189, 0.25);
}

body.menu-open .gameMenuToggle {
  color: #07070b;
  background: var(--gold);
}

.gameMenu {
  position: fixed;
  top: max(68px, calc(env(safe-area-inset-top) + 68px));
  right: max(10px, env(safe-area-inset-right));
  z-index: 39;
  display: grid;
  gap: 8px;
  width: min(210px, calc(100vw - 20px));
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(7, 7, 11, 0.88);
  backdrop-filter: blur(16px);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.36);
}

.tab {
  min-height: 44px;
  justify-content: flex-start;
  padding: 0 12px;
  font-size: 13px;
  text-align: left;
}

.view {
  display: none;
  gap: 10px;
}

.view.active {
  display: grid;
}

.pulsoHero {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(38, 240, 189, 0.26);
  border-radius: 8px;
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 61, 127, 0.26), transparent 32%),
    radial-gradient(circle at 84% 80%, rgba(38, 240, 189, 0.18), transparent 34%),
    rgba(255, 255, 255, 0.07);
}

.pulsoHero strong {
  font-size: 20px;
}

.routeGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.arenaGrid {
  display: flex;
  gap: 12px;
  margin: 0 -4px;
  padding: 4px 4px 12px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
}

.routeCard,
.arenaCard {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 12px;
  align-items: center;
  min-height: 82px;
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04));
  color: var(--ink);
  text-align: left;
}

.routeCard.hot {
  border-color: rgba(255, 61, 127, 0.42);
  background:
    linear-gradient(135deg, rgba(255, 61, 127, 0.22), rgba(140, 108, 255, 0.12));
}

.routeCard span,
.arenaCard > span:first-child {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.routeCard strong {
  font-size: 18px;
}

.arenaCard {
  position: relative;
  grid-template-columns: 1fr;
  grid-template-rows: minmax(0, 1fr) auto auto;
  flex: 0 0 min(74vw, 260px);
  aspect-ratio: 1;
  align-items: end;
  padding: 12px;
  overflow: hidden;
  scroll-snap-align: center;
}

.arenaCard .pill {
  justify-self: start;
}

.arenaArt {
  position: absolute;
  inset: 10px;
  z-index: -1;
  border: 1px solid color-mix(in srgb, var(--arena-tone, var(--mint)) 62%, transparent);
  border-radius: 8px;
  background:
    linear-gradient(90deg, transparent 0 18%, color-mix(in srgb, var(--arena-tone, var(--mint)) 40%, transparent) 19% 21%, transparent 22% 48%, color-mix(in srgb, var(--arena-tone, var(--mint)) 50%, transparent) 49% 51%, transparent 52% 78%, color-mix(in srgb, var(--arena-tone, var(--mint)) 40%, transparent) 79% 81%, transparent 82%),
    radial-gradient(circle at 50% 74%, color-mix(in srgb, var(--arena-tone, var(--mint)) 64%, transparent), transparent 22%),
    rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 0 42px rgba(255,255,255,0.05), 0 18px 34px rgba(0,0,0,0.25);
}

.arenaArt.arena-storm {
  background:
    repeating-linear-gradient(105deg, transparent 0 18px, color-mix(in srgb, var(--arena-tone) 36%, transparent) 19px 22px),
    radial-gradient(circle at 70% 22%, rgba(70,167,255,0.52), transparent 24%),
    rgba(255, 255, 255, 0.05);
}

.arenaArt.arena-gold {
  background:
    linear-gradient(90deg, transparent 0 18%, rgba(255,209,92,0.42) 19% 21%, transparent 22% 48%, rgba(255,209,92,0.58) 49% 51%, transparent 52% 78%, rgba(255,209,92,0.42) 79% 81%, transparent 82%),
    linear-gradient(180deg, rgba(255,209,92,0.22), rgba(255,61,127,0.10)),
    rgba(255, 255, 255, 0.05);
}

.inviteBox {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.shopGrid,
.collection {
  display: grid;
  gap: 8px;
}

.shopNav,
.inventoryNav {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.inventoryNav {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.shopTab,
.inventoryTab {
  min-height: 42px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--line);
  font-size: 12px;
}

.shopTab.active,
.inventoryTab.active {
  color: #07070b;
  background: var(--gold);
}

.shopSection {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.shopSection h3 {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 14px;
  text-transform: uppercase;
  color: var(--gold);
}

.missionBox {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 209, 92, 0.34);
  border-radius: 8px;
  background: rgba(255, 209, 92, 0.08);
}

.creditBox {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid rgba(38, 240, 189, 0.3);
  border-radius: 8px;
  background: rgba(38, 240, 189, 0.07);
}

.creditBox strong {
  font-size: 14px;
}

.creditActions {
  display: grid;
  grid-template-columns: minmax(110px, 0.72fr) 1fr 1fr;
  gap: 6px;
}

.creditActions input,
.creditActions button {
  min-height: 42px;
  padding: 0 8px;
  font-size: 12px;
}

.missionBox strong,
.missionBox small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.missionBox small {
  color: var(--gold);
  font-weight: 850;
}

.shopItem,
.collectionItem,
.arenaCard {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
}

.miniAction {
  min-height: 34px;
  padding: 0 10px;
  color: #07070b;
  background: var(--gold);
  font-size: 12px;
}

.orbPreview {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  box-shadow: 0 0 18px currentColor;
}

.itemIcon {
  position: relative;
  width: 38px;
  height: 38px;
  display: block;
  color: var(--item-color, var(--gold));
  filter: drop-shadow(0 0 14px color-mix(in srgb, var(--item-color, var(--gold)) 70%, transparent));
}

.skinIcon {
  border: 3px solid var(--item-color);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, #07070b 0 28%, transparent 30%),
    var(--item-color);
}

.skin-disco {
  border-radius: 8px;
  transform: rotate(45deg);
  background: linear-gradient(135deg, var(--item-color), var(--item-color-2));
}

.skin-ghost {
  border-radius: 50% 50% 44% 44%;
  background: linear-gradient(180deg, #eefaff, rgba(217,247,255,0.28));
}

.skin-crown::before {
  content: "";
  position: absolute;
  inset: 7px 4px 11px;
  clip-path: polygon(0 100%, 0 42%, 22% 62%, 38% 12%, 50% 58%, 64% 12%, 80% 62%, 100% 42%, 100% 100%);
  background: var(--item-color);
}

.arenaIcon {
  border-radius: 8px;
  border: 2px solid var(--item-color);
  background:
    linear-gradient(90deg, transparent 0 22%, var(--item-color) 23% 27%, transparent 28% 48%, var(--item-color-2) 49% 53%, transparent 54% 74%, var(--item-color) 75% 79%, transparent 80%),
    rgba(255,255,255,0.08);
}

.armorIcon {
  clip-path: polygon(50% 0, 90% 16%, 82% 72%, 50% 100%, 18% 72%, 10% 16%);
  background: linear-gradient(145deg, var(--item-color), var(--item-color-2));
}

.magicIcon {
  border-radius: 8px 8px 50% 50%;
  background: linear-gradient(180deg, var(--item-color), var(--item-color-2));
}

.doubleIcon::before,
.tripleIcon::before {
  content: "2x";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #07070b;
  font-size: 13px;
  font-weight: 950;
}

.tripleIcon::before {
  content: "3x";
}

.ghostIcon {
  border-radius: 50%;
  background:
    radial-gradient(circle at 62% 42%, #07070b 0 28%, transparent 29%),
    linear-gradient(180deg, #effcff, #8c6cff);
}

.itemText strong,
.itemText span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.itemText span {
  color: var(--muted);
  font-size: 12px;
}

.pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 8px;
  color: var(--gold);
  font-size: 11px;
  font-weight: 850;
}

.powerButton {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(26px, env(safe-area-inset-bottom));
  width: 62px;
  height: 62px;
  min-height: 62px;
  border-radius: 50%;
  color: #07070b;
  background: var(--gold);
  box-shadow: 0 0 28px rgba(255, 209, 92, 0.65);
  font-size: 28px;
  pointer-events: auto;
}

.powerButton.hidden {
  display: none;
}

.powerButton.cooldown {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.12);
  box-shadow: none;
}

.itemDock {
  position: fixed;
  left: max(14px, env(safe-area-inset-left));
  bottom: max(24px, env(safe-area-inset-bottom));
  z-index: 35;
  display: grid;
  gap: 8px;
  pointer-events: auto;
}

.itemDock.hidden {
  display: none;
}

.itemDock button {
  display: grid;
  place-items: center;
  width: 58px;
  min-height: 58px;
  padding: 4px;
  border-radius: 50%;
  color: #07070b;
  background: var(--gold);
  box-shadow: 0 0 26px rgba(255, 209, 92, 0.48);
}

.itemDock strong {
  font-size: 17px;
  line-height: 1;
}

.itemDock span {
  font-size: 11px;
  font-weight: 900;
}

@media (min-width: 720px) {
  #game {
    width: 100vw;
    height: 100dvh;
    justify-self: center;
  }
}

@media (max-width: 380px), (max-height: 720px) {
  .topbar {
    top: max(8px, env(safe-area-inset-top));
    gap: 6px;
  }

  .topbar div {
    padding: 7px 8px;
  }

  .topbar strong {
    font-size: 17px;
  }

  .panel {
    bottom: max(10px, env(safe-area-inset-bottom));
    gap: 9px;
    max-height: min(64dvh, 600px);
    padding: 12px;
  }

  .panel p,
  .panel small {
    font-size: 12px;
  }

  button {
    min-height: 44px;
  }

  .tab {
    min-height: 36px;
    padding: 0 10px;
    font-size: 12px;
  }

  .gameMenu {
    width: min(190px, calc(100vw - 20px));
  }

  .routeGrid,
  .shopSection,
  .shopNav,
  .inventoryNav {
    grid-template-columns: 1fr;
  }

  .creditActions {
    grid-template-columns: 1fr;
  }
}
