:root {
  --bg: #08111f;
  --panel: rgba(10, 18, 34, 0.88);
  --panel-border: rgba(135, 198, 255, 0.2);
  --text: #eef7ff;
  --muted: #9eb5d2;
  --good: #89ff9a;
  --warn: #ffcf7a;
  --danger: #ff668f;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--text);
  font-family: "Outfit", sans-serif;
  background:
    radial-gradient(circle at top, rgba(137, 255, 154, 0.15), transparent 24%),
    radial-gradient(circle at bottom right, rgba(98, 158, 255, 0.12), transparent 30%),
    linear-gradient(160deg, #030712 0%, #09111f 45%, #102547 100%);
}

button { font: inherit; cursor: pointer; border: 0; }
input { font: inherit; }
.app-shell { width: min(1200px, calc(100% - 32px)); margin: 0 auto; padding: 28px 0 36px; }
.hero { display: flex; gap: 24px; justify-content: space-between; align-items: end; margin-bottom: 22px; }
.eyebrow, .stat-label, .side-label, .hero-card-label, .overlay-kicker {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  color: var(--muted);
}
.eyebrow span, .character-picked { color: var(--good); }
h1, h2, h3 { font-family: "Chakra Petch", sans-serif; margin: 0; }
h1 { margin-top: 8px; font-size: clamp(2.8rem, 6vw, 4.4rem); line-height: 0.95; }
.subtitle { max-width: 700px; color: #d9e8f8; font-size: 1.04rem; line-height: 1.55; margin-top: 14px; }

.panel, .hero-card, .overlay-card, .upgrade-card, .character-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.hero-card { min-width: 220px; padding: 18px; }
.hero-card p { margin: 7px 0; }
.top-auth-panel {
  margin-bottom: 20px;
  padding: 18px 20px;
  border-color: rgba(137,255,154,0.35);
  background:
    linear-gradient(135deg, rgba(137,255,154,0.08), rgba(110,200,255,0.08)),
    var(--panel);
}
.account-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.account-banner h2,
.account-banner p { margin: 0; }
.account-banner-text { margin-top: 8px; color: #d9e8f8; }
.account-banner-badge {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(137,255,154,0.12);
  border: 1px solid rgba(137,255,154,0.4);
  color: var(--good);
  font-weight: 800;
  white-space: nowrap;
}
.game-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 20px; }
.game-panel { padding: 18px; }
.side-panel { padding: 22px 20px; }
.side-panel section + section { margin-top: 24px; padding-top: 24px; border-top: 1px solid rgba(255,255,255,0.08); }
.side-panel p, .loadout-list { color: #d9e8f8; line-height: 1.55; }
.loadout-list { margin: 12px 0 0; padding-left: 18px; }

.hud { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) auto; gap: 12px; margin-bottom: 14px; align-items: start; }
.stat { padding: 12px 14px; border-radius: 18px; background: rgba(255,255,255,0.04); }
.stat strong { display: block; margin-top: 6px; font-size: 1.45rem; }
.hud-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  justify-self: end;
}
.hud-icon-row {
  display: grid;
  grid-template-columns: repeat(3, 56px);
  gap: 12px;
  justify-content: end;
}
.fullscreen-button {
  padding: 0 18px;
  border-radius: 18px;
  color: var(--text);
  background: linear-gradient(135deg, rgba(137,255,154,0.22), rgba(98,158,255,0.25));
  border: 1px solid rgba(137,255,154,0.35);
  font-weight: 700;
}
.icon-button {
  width: 56px;
  min-width: 56px;
  height: 52px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.icon-button.active {
  border-color: rgba(137,255,154,0.7);
  box-shadow: inset 0 0 0 1px rgba(137,255,154,0.18);
}
.danger-button {
  background: linear-gradient(135deg, rgba(255,102,143,0.3), rgba(255,207,122,0.18));
  border-color: rgba(255,102,143,0.45);
}
.end-run-button {
  width: 100%;
  min-width: 0;
  padding: 0 16px;
  gap: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.hud-icon {
  position: relative;
  display: inline-block;
  width: 20px;
  height: 20px;
}
.hud-icon-volume::before,
.hud-icon-volume::after,
.hud-icon-volume-muted::before,
.hud-icon-volume-muted::after,
.hud-icon-pause::before,
.hud-icon-pause::after,
.hud-icon-play::before,
.hud-icon-play::after,
.hud-icon-fullscreen::before,
.hud-icon-fullscreen::after,
.hud-icon-end::before,
.hud-icon-end::after {
  content: "";
  position: absolute;
}
.hud-icon-volume::before {
  left: 1px;
  top: 5px;
  width: 8px;
  height: 10px;
  background: #eef7ff;
  clip-path: polygon(0 25%, 50% 25%, 100% 0, 100% 100%, 50% 75%, 0 75%);
}
.hud-icon-volume::after {
  right: 1px;
  top: 4px;
  width: 7px;
  height: 11px;
  border: 2px solid #eef7ff;
  border-left: 0;
  border-radius: 0 10px 10px 0;
}
.hud-icon-volume-muted::before {
  left: 1px;
  top: 5px;
  width: 8px;
  height: 10px;
  background: #eef7ff;
  clip-path: polygon(0 25%, 50% 25%, 100% 0, 100% 100%, 50% 75%, 0 75%);
}
.hud-icon-volume-muted::after {
  left: 9px;
  top: 1px;
  width: 2px;
  height: 18px;
  background: #ff668f;
  transform: rotate(45deg);
  box-shadow: 0 0 0 1px rgba(8,17,31,0.3);
}
.icon-button.muted .hud-icon::before,
.icon-button.muted .hud-icon::after {
  opacity: 1;
}
.hud-icon-pause::before {
  left: 3px;
  top: 2px;
  width: 4px;
  height: 16px;
  background: #eef7ff;
}
.hud-icon-pause::after {
  right: 3px;
  top: 2px;
  width: 4px;
  height: 16px;
  background: #eef7ff;
}
.hud-icon-play::before {
  left: 5px;
  top: 2px;
  width: 0;
  height: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 12px solid #eef7ff;
}
.hud-icon-play::after {
  display: none;
}
.hud-icon-fullscreen::before {
  inset: 0;
  background:
    linear-gradient(#eef7ff, #eef7ff) left top / 7px 2px no-repeat,
    linear-gradient(#eef7ff, #eef7ff) left top / 2px 7px no-repeat,
    linear-gradient(#eef7ff, #eef7ff) right top / 7px 2px no-repeat,
    linear-gradient(#eef7ff, #eef7ff) right top / 2px 7px no-repeat,
    linear-gradient(#eef7ff, #eef7ff) left bottom / 7px 2px no-repeat,
    linear-gradient(#eef7ff, #eef7ff) left bottom / 2px 7px no-repeat,
    linear-gradient(#eef7ff, #eef7ff) right bottom / 7px 2px no-repeat,
    linear-gradient(#eef7ff, #eef7ff) right bottom / 2px 7px no-repeat;
}
.hud-icon-fullscreen::after {
  inset: 5px;
  border: 1px solid rgba(238, 247, 255, 0.2);
  border-radius: 2px;
}
.icon-button.active .hud-icon-fullscreen::before {
  background:
    linear-gradient(#eef7ff, #eef7ff) left 4px top 4px / 7px 2px no-repeat,
    linear-gradient(#eef7ff, #eef7ff) left 4px top 4px / 2px 7px no-repeat,
    linear-gradient(#eef7ff, #eef7ff) right 4px top 4px / 7px 2px no-repeat,
    linear-gradient(#eef7ff, #eef7ff) right 4px top 4px / 2px 7px no-repeat,
    linear-gradient(#eef7ff, #eef7ff) left 4px bottom 4px / 7px 2px no-repeat,
    linear-gradient(#eef7ff, #eef7ff) left 4px bottom 4px / 2px 7px no-repeat,
    linear-gradient(#eef7ff, #eef7ff) right 4px bottom 4px / 7px 2px no-repeat,
    linear-gradient(#eef7ff, #eef7ff) right 4px bottom 4px / 2px 7px no-repeat;
}
.icon-button.active .hud-icon-fullscreen::after {
  inset: 2px;
  border-color: rgba(238, 247, 255, 0.3);
}
.hud-icon-end::before,
.hud-icon-end::after {
  left: 9px;
  top: 1px;
  width: 2px;
  height: 18px;
  background: #eef7ff;
}
.hud-icon-end::before { transform: rotate(45deg); }
.hud-icon-end::after { transform: rotate(-45deg); }

.canvas-wrap {
  position: relative;
  overflow: hidden;
  border-radius: 24px;
  background: #020611;
  border: 1px solid rgba(255,255,255,0.08);
}

canvas { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; }
.block-toggle {
  position: absolute;
  right: 18px;
  bottom: 18px;
  padding: 12px 16px;
  border-radius: 16px;
  color: var(--text);
  background: linear-gradient(135deg, rgba(255,207,122,0.22), rgba(255,102,143,0.2));
  border: 1px solid rgba(255,207,122,0.4);
  font-weight: 700;
  z-index: 3;
}
.block-timer {
  position: absolute;
  right: 18px;
  bottom: 72px;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(8, 17, 31, 0.84);
  border: 1px solid rgba(255,207,122,0.5);
  color: #ffcf7a;
  font-weight: 700;
  z-index: 3;
}
.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(1, 5, 15, 0.62);
}
.hidden { display: none; }
.overlay-card { width: min(100%, 430px); padding: 28px; text-align: center; }
.overlay-card.wide { width: min(100%, 840px); }
.overlay-card.start-card {
  width: min(100%, 1120px);
  min-height: calc(100% - 12px);
  height: calc(100% - 12px);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding-top: 40px;
}
.overlay-card p { line-height: 1.55; }
.overlay-card button {
  margin-top: 12px;
  padding: 14px 22px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--good), #6ec8ff);
  color: #071118;
  font-weight: 800;
}

.character-grid, .upgrade-grid { display: grid; gap: 14px; margin-top: 18px; }
.character-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.upgrade-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.character-card, .upgrade-card { padding: 18px; text-align: left; transition: transform 160ms ease, border-color 160ms ease; }
.character-card.active, .upgrade-card:hover {
  border-color: rgba(137,255,154,0.65);
  background: rgba(16, 32, 52, 0.98);
  transform: translateY(-3px);
}
.character-card h4, .upgrade-card h4 { margin: 8px 0 6px; font-size: 1.08rem; }
.character-card p, .upgrade-card p { margin: 0; color: #d9e8f8; }
.character-picked { margin: 10px 0 0; font-weight: 700; }
.auth-tabs { display: flex; gap: 10px; flex-wrap: wrap; }
.auth-tab,
.auth-action {
  margin-top: 0;
  padding: 12px 18px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  color: var(--text);
  border: 1px solid rgba(135, 198, 255, 0.24);
  font-weight: 700;
}
.auth-tab.active {
  background: rgba(137,255,154,0.14);
  border-color: rgba(137,255,154,0.55);
}
.auth-form { margin-top: 16px; }
.auth-grid { display: grid; gap: 12px; }
.auth-grid.one { grid-template-columns: 1fr; }
.auth-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.auth-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.auth-form label span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.9rem;
}
.auth-form input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(135, 198, 255, 0.22);
  background: rgba(255,255,255,0.04);
  color: var(--text);
}
.auth-inline-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 14px;
  flex-wrap: wrap;
}
.auth-link-button,
.auth-action.secondary {
  background: transparent;
  color: #d9e8f8;
  border: 1px solid rgba(255,255,255,0.14);
  padding: 12px 18px;
  border-radius: 999px;
}
.auth-message { margin: 14px 0 0; color: #d9e8f8; }
.auth-message.good { color: var(--good); }
.auth-message.bad { color: #ff9db6; }
.account-summary {
  margin-top: 16px;
  padding: 16px 18px;
  border-radius: 18px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  background: rgba(255,255,255,0.05);
}
.equipment-panel {
  margin-top: 14px;
  padding: 14px;
  border-radius: 22px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
}
.equipment-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}
.equipment-header p:last-child {
  margin: 0;
  color: #d9e8f8;
}
.equipment-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}
.touch-pad {
  display: flex;
  justify-content: flex-start;
}
.touch-pad-screen {
  position: absolute;
  left: 18px;
  bottom: 18px;
  z-index: 3;
  padding: 8px;
  border-radius: 16px;
  background: rgba(8, 17, 31, 0.72);
  border: 1px solid rgba(135, 198, 255, 0.18);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(8px);
}
.touch-pad-grid {
  display: grid;
  grid-template-columns: repeat(3, 34px);
  grid-template-rows: repeat(3, 34px);
  gap: 5px;
}
.touch-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: rgba(238, 247, 255, 0.92);
  background: rgba(18, 28, 48, 0.82);
  border: 1px solid rgba(135, 198, 255, 0.18);
  font-size: 0.88rem;
  font-weight: 800;
  backdrop-filter: blur(8px);
}
.touch-pad-spacer {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(255,255,255,0.03);
}
.touch-arrow:hover,
.touch-arrow.active-touch {
  background: rgba(137,255,154,0.14);
  border-color: rgba(137,255,154,0.5);
}
.touch-dash {
  background: linear-gradient(135deg, rgba(255,207,122,0.24), rgba(255,102,143,0.18));
  border-color: rgba(255,207,122,0.4);
  color: #ffcf7a;
}
.equipment-card {
  padding: 14px;
  border-radius: 18px;
  color: var(--text);
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(135, 198, 255, 0.18);
  text-align: left;
}
.equipment-card.active {
  border-color: rgba(137,255,154,0.65);
  background: rgba(137,255,154,0.12);
}
.equipment-card strong,
.equipment-card span {
  display: block;
}
.equipment-card span {
  margin-top: 6px;
  color: #d9e8f8;
  font-size: 0.92rem;
}
.equipment-icon {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-bottom: 8px;
  border-radius: 10px;
  background: rgba(255,255,255,0.08);
}
.equipment-icon-none::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: #d9e8f8;
}
.equipment-icon-magnet::before,
.equipment-icon-magnet::after {
  content: "";
  position: absolute;
  top: 8px;
  width: 7px;
  height: 16px;
  border: 3px solid #ffcf7a;
  border-top: 0;
}
.equipment-icon-magnet::before {
  left: 7px;
  border-right: 0;
  border-bottom-left-radius: 8px;
}
.equipment-icon-magnet::after {
  right: 7px;
  border-left: 0;
  border-bottom-right-radius: 8px;
}
.equipment-icon-slingshot::before,
.equipment-icon-slingshot::after {
  content: "";
  position: absolute;
  background: #d9e8f8;
}
.equipment-icon-slingshot::before {
  width: 4px;
  height: 18px;
  left: 10px;
  top: 7px;
  transform: rotate(-20deg);
}
.equipment-icon-slingshot::after {
  width: 4px;
  height: 18px;
  right: 10px;
  top: 7px;
  transform: rotate(20deg);
}
.equipment-icon-gun::before,
.equipment-icon-gun::after {
  content: "";
  position: absolute;
  background: #d9e8f8;
}
.equipment-icon-gun::before {
  width: 18px;
  height: 6px;
  left: 8px;
  top: 10px;
}
.equipment-icon-gun::after {
  width: 8px;
  height: 10px;
  left: 12px;
  top: 16px;
}
.equipment-icon-block::before {
  content: "";
  width: 16px;
  height: 16px;
  border: 3px solid #ffcf7a;
}
.avatar-shop {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}
.avatar-card {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(135, 198, 255, 0.18);
}
.avatar-card.owned { border-color: rgba(137,255,154,0.4); }
.avatar-card.selected { background: rgba(137,255,154,0.1); }
.avatar-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}
.avatar-card h4,
.avatar-card p { margin: 0; }
.avatar-price {
  color: #d9e8f8;
  font-size: 0.9rem;
  margin-top: 6px;
}
.avatar-preview {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 2px solid rgba(255,255,255,0.45);
}
.avatar-card button {
  margin-top: 12px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255,255,255,0.08);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.14);
}
.avatar-card button:disabled { opacity: 0.6; cursor: default; }
.blog-section {
  margin-top: 22px;
  padding: 24px;
}
.blog-section h2 {
  margin-top: 8px;
}
.blog-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}
.blog-card {
  padding: 18px;
  border-radius: 20px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
}
.blog-card h4,
.blog-card p { margin: 0; }
.blog-card p {
  margin-top: 8px;
  color: #d9e8f8;
  line-height: 1.65;
}
.blog-notes {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.blog-notes p {
  margin: 0 0 12px;
  color: #d9e8f8;
  line-height: 1.65;
}

:fullscreen .app-shell { width: 100%; max-width: none; min-height: 100vh; padding: 12px; }
:fullscreen .game-layout { grid-template-columns: minmax(0, 1fr) 300px; min-height: calc(100vh - 24px); }
:fullscreen .game-panel { display: flex; flex-direction: column; }
:fullscreen .canvas-wrap { flex: 1; min-height: 0; }
:fullscreen canvas { width: 100%; height: 100%; aspect-ratio: auto; }

@media (max-width: 980px) {
  .hero, .game-layout, .account-banner { display: grid; grid-template-columns: 1fr; }
  .hud { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .character-grid, .upgrade-grid, .equipment-grid, .blog-grid { grid-template-columns: 1fr; }
  .hud { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hud-actions {
    grid-column: 1 / -1;
    justify-self: stretch;
  }
  .hud-icon-row {
    justify-content: start;
  }
  .auth-grid.two,
  .auth-grid.three { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .app-shell { width: min(100% - 20px, 1200px); padding-top: 18px; }
  .game-panel, .side-panel { padding: 14px; }
}
