: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: max(10px, env(safe-area-inset-right));
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  pointer-events: 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: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  width: min(460px, calc(100vw - 20px));
  transform: translateX(-50%);
  display: grid;
  gap: 12px;
  max-height: min(82dvh, 720px);
  overflow: auto;
  padding: 16px;
  background: var(--panel);
}

.panel.hidden {
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 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;
}

.pulsoMiniLogo {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  box-shadow: 0 0 24px rgba(255, 61, 127, 0.32);
}

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

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

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.tab {
  min-height: 38px;
  padding: 0 8px;
  font-size: 12px;
}

.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,
.arenaGrid {
  display: grid;
  gap: 8px;
}

.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 {
  grid-column: 1 / -1;
  font-size: 18px;
}

.arenaCard {
  grid-template-columns: 42px minmax(0, 1fr) auto;
}

.arenaGlow {
  width: 34px;
  height: 34px;
  border-radius: 50%;
}

.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;
}

.shopSection {
  display: grid;
  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 {
  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(76px, 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;
}

.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;
}

@media (min-width: 720px) {
  #game {
    width: min(430px, 100vw);
    height: min(860px, 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(78dvh, 600px);
    padding: 12px;
  }

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

  button {
    min-height: 44px;
  }

  .tabs {
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
  }

  .tab {
    min-height: 36px;
    padding: 0 5px;
    font-size: 11px;
  }

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