:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bg: #0b1017;
  --panel: #141b24;
  --panel-strong: #1c2632;
  --line: #8e6740;
  --text: #fff6df;
  --muted: #b8c0c2;
  --green: #6ff2b1;
  --cyan: #66ddff;
  --red: #ff5c5c;
  --amber: #ffc861;
  --gold: #f7d889;
  --jade: #42e7cc;
  --ember: #ff7042;
  --deep: #150b0b;
  --steel: #18242f;
  --ui-scale: 1;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at 13% 8%, rgba(255, 194, 93, 0.24), transparent 27%),
    radial-gradient(circle at 86% 14%, rgba(102, 221, 255, 0.11), transparent 24%),
    radial-gradient(circle at 50% 100%, rgba(255, 83, 46, 0.16), transparent 42%),
    linear-gradient(145deg, #120807 0%, #321813 48%, #070b10 100%);
  color: var(--text);
}

button {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  transition: transform 140ms ease, filter 140ms ease, box-shadow 180ms ease, background 180ms ease;
  will-change: transform;
}

button:active {
  transform: translateY(1px) scale(0.98);
}

.game-shell {
  width: 100vw;
  height: 100dvh;
  padding: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  position: relative;
}

.arena-panel {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 1480px;
  height: 900px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  transform: translate(-50%, -50%) scale(var(--ui-scale));
  transform-origin: center center;
  border: 1px solid rgba(255, 207, 126, 0.58);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 218, 138, 0.12), transparent 28%),
    linear-gradient(90deg, rgba(255, 112, 66, 0.1), transparent 18%, transparent 82%, rgba(102, 221, 255, 0.08)),
    rgba(27, 15, 15, 0.96);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    inset 0 0 42px rgba(255, 112, 66, 0.08),
    0 26px 80px rgba(0, 0, 0, 0.54);
}

.topbar {
  flex: 0 0 auto;
  min-height: 98px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: clamp(12px, 1.8vh, 18px) 22px;
  border-bottom: 1px solid rgba(247, 216, 137, 0.34);
  background:
    linear-gradient(90deg, rgba(255, 194, 107, 0.22), transparent 38%, rgba(102, 221, 255, 0.08)),
    linear-gradient(180deg, rgba(84, 39, 28, 0.82), rgba(16, 10, 12, 0.58));
  box-shadow: inset 0 -18px 34px rgba(0, 0, 0, 0.18);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(30px, 4vw, 54px);
  line-height: 0.95;
  letter-spacing: 0;
  color: var(--gold);
  text-shadow: 0 0 18px rgba(255, 200, 97, 0.44), 0 2px 0 rgba(0, 0, 0, 0.72);
}

#routeName {
  margin-top: 8px;
  color: #d4e8e4;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(92px, 1fr));
  gap: 8px;
  min-width: min(760px, 64vw);
}

.stat-grid div,
.loadout-card {
  border: 1px solid rgba(247, 216, 137, 0.24);
  background:
    linear-gradient(180deg, rgba(255, 230, 172, 0.08), transparent 42%),
    linear-gradient(135deg, rgba(102, 221, 255, 0.055), transparent 52%),
    #17222c;
  border-radius: 8px;
  padding: 12px;
  box-shadow: inset 0 0 18px rgba(102, 221, 255, 0.04), inset 0 2px 0 rgba(255, 244, 205, 0.05);
}

.loadout-card {
  display: grid;
  grid-template-columns: 46px 1fr;
  align-items: center;
  gap: 11px;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease, opacity 180ms ease;
}

.loadout-card:not(.locked):hover {
  transform: translateX(-2px);
  border-color: rgba(255, 225, 155, 0.46);
  box-shadow: inset 0 0 18px rgba(255, 205, 106, 0.08), 0 0 18px rgba(255, 200, 97, 0.14);
}

.stat-grid span,
.loadout-card span,
.xp-copy span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.stat-grid strong {
  display: block;
  margin-top: 6px;
  font-size: 23px;
  color: var(--gold);
}

.game-board {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr) 220px;
  min-height: 0;
  flex: 1 1 0;
  height: auto;
  background: var(--deep);
}

.xp-rail {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 12px;
  align-items: stretch;
  padding: 18px 14px;
  border-right: 1px solid rgba(247, 216, 137, 0.22);
  background:
    linear-gradient(180deg, rgba(255, 200, 97, 0.13), transparent 48%),
    linear-gradient(90deg, rgba(255, 112, 66, 0.09), transparent),
    #10131b;
}

.xp-track {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid rgba(247, 216, 137, 0.28);
  background: #070b10;
  box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.7), 0 0 14px rgba(66, 231, 204, 0.08);
}

.xp-fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0%;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.18), transparent 34%),
    linear-gradient(0deg, var(--jade), var(--gold));
  box-shadow: 0 0 20px rgba(66, 231, 204, 0.44);
  transition: height 180ms ease;
}

.xp-copy {
  text-align: center;
  font-size: 12px;
}

.xp-copy strong {
  display: block;
  margin-bottom: 3px;
}

canvas {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: block;
  background: #1b1110;
}

.loadout {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px;
  overflow-y: auto;
  border-left: 1px solid rgba(247, 216, 137, 0.22);
  background:
    linear-gradient(180deg, rgba(255, 200, 97, 0.08), transparent 38%),
    linear-gradient(90deg, rgba(255, 112, 66, 0.07), transparent),
    #0f151d;
}

.loadout-card strong {
  display: block;
  margin-top: 8px;
  font-size: 15px;
  line-height: 1.35;
}

.leaderboard-panel {
  border: 1px solid rgba(247, 216, 137, 0.22);
  border-radius: 8px;
  padding: 12px;
  background:
    linear-gradient(180deg, rgba(255, 200, 97, 0.12), transparent 48%),
    linear-gradient(135deg, rgba(102, 221, 255, 0.07), transparent),
    #111923;
  box-shadow: inset 0 0 18px rgba(102, 221, 255, 0.05);
}

.leaderboard-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.leaderboard-head span,
.player-name-label {
  color: var(--muted);
  font-size: 12px;
}

.leaderboard-head strong {
  color: var(--gold);
  font-size: 14px;
}

.player-name-input {
  width: 100%;
  height: 34px;
  margin: 5px 0 10px;
  border: 1px solid rgba(102, 221, 255, 0.25);
  border-radius: 8px;
  padding: 0 9px;
  color: var(--text);
  background: #0b121a;
  outline: none;
}

.player-name-input:focus {
  border-color: rgba(102, 221, 255, 0.58);
  box-shadow: 0 0 0 2px rgba(102, 221, 255, 0.12);
}

.leaderboard-list {
  margin: 0;
  padding-left: 22px;
  color: #f8e7bd;
  font-size: 12px;
  line-height: 1.45;
}

.leaderboard-list li {
  margin: 4px 0;
  padding-left: 2px;
}

.leaderboard-list span {
  color: var(--muted);
}

.skill-face,
.upgrade-icon {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  border: 1px solid rgba(255, 246, 223, 0.28);
  background:
    radial-gradient(circle at 50% 52%, var(--icon-glow, rgba(255, 214, 106, 0.42)), transparent 34%),
    radial-gradient(circle at 50% 50%, var(--icon-core, #3a1c18) 0 48%, rgba(255, 246, 223, 0.16) 49% 53%, transparent 54%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent),
    #14202c;
  position: relative;
  box-shadow:
    inset 0 0 18px rgba(0, 0, 0, 0.38),
    0 0 16px var(--icon-shadow, rgba(255, 200, 97, 0.18));
  flex: 0 0 auto;
}

.skill-manual,
.icon-manual {
  --icon-core: #4c2a16;
  --icon-glow: rgba(255, 214, 106, 0.7);
  --icon-shadow: rgba(255, 200, 97, 0.62);
}

.skill-wheel,
.icon-wheel {
  --icon-core: #123c64;
  --icon-glow: rgba(184, 244, 255, 0.82);
  --icon-shadow: rgba(102, 221, 255, 0.78);
}

.skill-stone,
.icon-stone {
  --icon-core: #483a31;
  --icon-glow: rgba(233, 206, 165, 0.54);
  --icon-shadow: rgba(247, 216, 137, 0.52);
}

.skill-compat,
.icon-compat {
  --icon-core: #174b70;
  --icon-glow: rgba(104, 216, 255, 0.82);
  --icon-shadow: rgba(102, 221, 255, 0.75);
}

.skill-regression,
.icon-regression {
  --icon-core: #34144e;
  --icon-glow: rgba(208, 91, 255, 0.66);
  --icon-shadow: rgba(212, 108, 255, 0.72);
}

.skill-security,
.icon-security {
  --icon-core: #103b2f;
  --icon-glow: rgba(111, 242, 177, 0.68);
  --icon-shadow: rgba(111, 242, 177, 0.58);
}

.skill-face::before,
.skill-face::after,
.upgrade-icon::before,
.upgrade-icon::after {
  content: "";
  position: absolute;
  display: block;
}

.skill-manual::before,
.icon-manual::before {
  width: 29px;
  height: 5px;
  left: 8px;
  top: 21px;
  border-radius: 2px;
  background: linear-gradient(90deg, #fff8c4, #ffb83f);
  transform: rotate(-30deg);
  box-shadow: 0 0 18px rgba(255, 213, 111, 0.95);
}

.skill-manual::after,
.icon-manual::after {
  right: 7px;
  top: 13px;
  border-left: 14px solid #fff0b8;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  transform: rotate(-30deg);
}

.skill-wheel::before,
.icon-wheel::before {
  width: 34px;
  height: 34px;
  left: 6px;
  top: 6px;
  border-radius: 50% 50% 50% 10%;
  background:
    radial-gradient(circle at 42% 42%, #ffffff 0 9%, transparent 10%),
    conic-gradient(from 0.08turn, #f5ffff, #9bf2ff, #2d86ff, #1854c8, #dffcff, #f5ffff);
  clip-path: polygon(50% 0, 68% 34%, 100% 50%, 68% 66%, 50% 100%, 32% 66%, 0 50%, 32% 34%);
  box-shadow: 0 0 22px rgba(102, 221, 255, 0.92);
}

.skill-wheel::after,
.icon-wheel::after {
  width: 38px;
  height: 6px;
  left: 4px;
  top: 20px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(235, 255, 255, 0.95), rgba(102, 221, 255, 0.4), transparent);
  transform: rotate(-28deg);
  box-shadow: 0 0 16px rgba(184, 244, 255, 0.72);
}

.skill-stone::before,
.icon-stone::before {
  width: 30px;
  height: 25px;
  left: 8px;
  top: 9px;
  clip-path: polygon(18% 18%, 64% 4%, 92% 38%, 76% 82%, 30% 94%, 6% 58%);
  background: linear-gradient(135deg, #f0dcc0, #887460);
  box-shadow: 0 0 14px rgba(247, 216, 137, 0.5);
}

.skill-stone::after,
.icon-stone::after {
  width: 34px;
  height: 5px;
  left: 6px;
  top: 34px;
  border-radius: 8px;
  background: linear-gradient(90deg, transparent, rgba(255, 224, 156, 0.95), transparent);
}

.skill-compat::before,
.icon-compat::before {
  inset: 6px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 58% 62%, #f5ffff 0 10%, transparent 11%),
    conic-gradient(from 0.08turn, #f4ffff, #86e9ff, #2e8bff, #1667ee, #bff8ff, #f4ffff);
  box-shadow: 0 0 22px rgba(102, 221, 255, 0.95);
}

.skill-compat::after,
.icon-compat::after {
  width: 38px;
  height: 38px;
  left: 4px;
  top: 4px;
  clip-path: polygon(50% 0, 58% 35%, 92% 18%, 65% 50%, 100% 58%, 64% 62%, 82% 94%, 50% 68%, 18% 94%, 36% 62%, 0 58%, 35% 50%, 8% 18%, 42% 35%);
  background: rgba(230, 255, 255, 0.92);
}

.skill-regression::before,
.icon-regression::before {
  width: 35px;
  height: 26px;
  left: 6px;
  top: 10px;
  clip-path: polygon(0 55%, 26% 30%, 42% 54%, 66% 8%, 54% 48%, 100% 34%, 68% 68%, 50% 48%, 30% 88%);
  background: linear-gradient(135deg, #f7dcff, #b23cff 55%, #ffcf5c);
  box-shadow: 0 0 18px rgba(212, 108, 255, 0.8);
}

.skill-regression::after,
.icon-regression::after {
  width: 10px;
  height: 10px;
  right: 7px;
  top: 8px;
  border-radius: 50%;
  background: #fff6df;
  box-shadow: 0 0 16px rgba(212, 108, 255, 0.72);
}

.skill-security::before,
.icon-security::before {
  width: 30px;
  height: 33px;
  left: 8px;
  top: 6px;
  clip-path: polygon(50% 0, 88% 14%, 82% 74%, 50% 100%, 18% 74%, 12% 14%);
  background: linear-gradient(180deg, #6ff2b1, #188f6a);
  box-shadow: 0 0 16px rgba(111, 242, 177, 0.5);
}

.skill-security::after,
.icon-security::after {
  width: 15px;
  height: 8px;
  left: 16px;
  top: 20px;
  border-left: 3px solid #07100d;
  border-bottom: 3px solid #07100d;
  transform: rotate(-45deg);
}

.loadout-card.locked {
  opacity: 0.52;
  filter: grayscale(0.35);
}

.controls {
  flex: 0 0 auto;
  min-height: 68px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 22px;
  border-top: 1px solid rgba(247, 216, 137, 0.22);
  background:
    linear-gradient(180deg, rgba(255, 218, 132, 0.08), transparent),
    rgba(10, 13, 18, 0.92);
}

.controls button {
  min-width: 118px;
  padding: 11px 16px;
  color: #1a1004;
  background: linear-gradient(180deg, #fff0b2, #f6bd44 58%, #c87922);
  font-weight: 800;
  box-shadow: 0 0 18px rgba(255, 200, 97, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.42);
}

#restartBtn {
  color: var(--text);
  background: linear-gradient(180deg, #33445a, #1c2632);
  box-shadow: none;
}

.speed-control {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 52px;
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(102, 221, 255, 0.22);
  border-radius: 8px;
  background: rgba(7, 11, 16, 0.74);
}

.controls .speed-btn {
  min-width: 0;
  height: 36px;
  padding: 0;
  color: #dce9ec;
  background: transparent;
  box-shadow: none;
}

.controls .speed-btn.active {
  color: #1a1004;
  background: linear-gradient(180deg, #66ddff, #42e7cc);
}

#statusText {
  color: #d5dde0;
  flex: 1;
}

.upgrade-dialog {
  width: min(880px, calc(100vw - 28px));
  border: 1px solid rgba(255, 218, 139, 0.55);
  border-radius: 8px;
  padding: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 225, 152, 0.22), transparent 34%),
    linear-gradient(180deg, rgba(54, 31, 25, 0.96), rgba(20, 14, 18, 0.96));
  box-shadow: 0 32px 90px rgba(0, 0, 0, 0.68), 0 0 54px rgba(255, 140, 74, 0.3);
  animation: dialogIn 180ms ease-out;
}

.upgrade-dialog::backdrop {
  background:
    radial-gradient(circle at 50% 100%, rgba(255, 165, 70, 0.26), transparent 35%),
    rgba(15, 9, 8, 0.8);
  backdrop-filter: blur(4px);
}

.upgrade-dialog form {
  padding: 20px;
}

.dialog-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 16px;
  text-align: center;
}

.dialog-head span {
  color: var(--gold);
  font-weight: 800;
  font-size: 12px;
  text-transform: uppercase;
}

.dialog-head h2 {
  font-size: 34px;
  color: #ffe6a6;
  text-shadow: 0 0 22px rgba(255, 194, 87, 0.55);
}

.ghost-button {
  padding: 10px 12px;
  color: var(--text);
  border: 1px solid rgba(102, 221, 255, 0.28);
  background: linear-gradient(180deg, #26384b, #172330);
}

.ghost-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.revive-dialog {
  width: min(560px, calc(100vw - 28px));
}

.revive-copy {
  color: #f7e6c0;
  line-height: 1.5;
  text-align: center;
  margin: 8px auto 20px;
  max-width: 420px;
}

.revive-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.revive-actions button {
  min-width: 150px;
  padding: 12px 16px;
}

.upgrade-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}

.upgrade-option {
  min-height: 280px;
  padding: 22px 18px;
  position: relative;
  overflow: hidden;
  color: var(--text);
  border: 2px solid rgba(154, 255, 255, 0.48);
  border-radius: 8px;
  text-align: center;
  background:
    radial-gradient(circle at 50% 22%, rgba(255, 255, 255, 0.5), transparent 22%),
    linear-gradient(180deg, rgba(232, 255, 255, 0.96), rgba(96, 212, 218, 0.76) 52%, rgba(38, 124, 137, 0.95));
  box-shadow:
    inset 0 0 24px rgba(255, 255, 255, 0.24),
    0 0 24px rgba(102, 221, 255, 0.38);
  animation: cardIn 220ms ease-out both;
  transition: border-color 170ms ease, transform 170ms ease, box-shadow 170ms ease, filter 170ms ease;
  will-change: transform;
}

.upgrade-option:nth-child(2) {
  animation-delay: 45ms;
}

.upgrade-option:nth-child(3) {
  animation-delay: 90ms;
}

.upgrade-option::before,
.upgrade-option::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.upgrade-option::before {
  inset: 8px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.36);
  box-shadow: inset 0 0 22px rgba(255, 255, 255, 0.26);
}

.upgrade-option::after {
  left: -20px;
  right: -20px;
  bottom: -34px;
  height: 110px;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 245, 190, 0.5), transparent 58%),
    linear-gradient(180deg, transparent, rgba(255, 212, 96, 0.2));
}

.upgrade-card-head {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.upgrade-card-head .upgrade-icon {
  width: 104px;
  height: 104px;
  border-radius: 50%;
  border-color: rgba(255, 241, 190, 0.72);
  background:
    radial-gradient(circle at 50% 46%, rgba(255, 255, 255, 0.52), transparent 22%),
    radial-gradient(circle at 50% 52%, var(--icon-glow), transparent 42%),
    radial-gradient(circle at 50% 50%, var(--icon-core) 0 48%, rgba(255, 246, 223, 0.42) 49% 53%, transparent 54%);
  box-shadow:
    inset 0 0 20px rgba(255, 231, 148, 0.28),
    0 0 30px var(--icon-shadow);
}

.upgrade-card-head .icon-manual::before {
  width: 66px;
  height: 9px;
  left: 19px;
  top: 49px;
}

.upgrade-card-head .icon-manual::after {
  right: 17px;
  top: 31px;
  border-left-width: 30px;
  border-top-width: 17px;
  border-bottom-width: 17px;
}

.upgrade-card-head .icon-wheel::before {
  inset: auto;
  width: 76px;
  height: 76px;
  left: 14px;
  top: 14px;
}

.upgrade-card-head .icon-wheel::after {
  width: 82px;
  height: 12px;
  left: 11px;
  top: 46px;
}

.upgrade-card-head .icon-stone::before {
  width: 66px;
  height: 56px;
  left: 19px;
  top: 22px;
}

.upgrade-card-head .icon-stone::after {
  width: 76px;
  height: 10px;
  left: 14px;
  top: 75px;
}

.upgrade-card-head .icon-compat::before {
  inset: 13px;
}

.upgrade-card-head .icon-compat::after {
  width: 82px;
  height: 82px;
  left: 11px;
  top: 11px;
}

.upgrade-card-head .icon-regression::before {
  width: 78px;
  height: 58px;
  left: 13px;
  top: 23px;
}

.upgrade-card-head .icon-regression::after {
  width: 22px;
  height: 22px;
  right: 17px;
  top: 20px;
}

.upgrade-card-head .icon-security::before {
  width: 62px;
  height: 70px;
  left: 21px;
  top: 16px;
}

.upgrade-card-head .icon-security::after {
  width: 32px;
  height: 17px;
  left: 36px;
  top: 45px;
  border-left-width: 7px;
  border-bottom-width: 7px;
}

.upgrade-option:hover {
  border-color: var(--gold);
  transform: translateY(-6px) scale(1.015);
  filter: brightness(1.04);
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.32), 0 0 28px rgba(255, 200, 97, 0.28);
}

@keyframes dialogIn {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.upgrade-option strong {
  position: relative;
  z-index: 1;
  display: block;
  font-size: 25px;
  color: #226e7a;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
}

.upgrade-option span {
  position: relative;
  z-index: 1;
  display: block;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.24);
  color: #fff8df;
  line-height: 1.45;
  font-weight: 800;
}

.upgrade-option small {
  display: block;
  margin: 0 auto 8px;
  padding: 4px 12px;
  width: fit-content;
  border-radius: 999px;
  color: #fff7df;
  background: rgba(40, 121, 133, 0.58);
  font-weight: 800;
  text-transform: uppercase;
}

.upgrade-option.upgrade-mid {
  border-color: rgba(236, 174, 255, 0.62);
  background:
    radial-gradient(circle at 50% 22%, rgba(255, 255, 255, 0.56), transparent 22%),
    linear-gradient(180deg, rgba(255, 248, 255, 0.98), rgba(204, 104, 237, 0.82) 52%, rgba(103, 38, 152, 0.98));
  box-shadow:
    inset 0 0 26px rgba(255, 255, 255, 0.28),
    0 0 30px rgba(208, 91, 255, 0.5);
}

.upgrade-option.upgrade-mid strong {
  color: #64207e;
}

.upgrade-option.upgrade-mid small {
  color: #fff7df;
  background: rgba(116, 38, 144, 0.62);
}

.upgrade-option.upgrade-high {
  border-color: rgba(255, 228, 150, 0.72);
  background:
    radial-gradient(circle at 50% 22%, rgba(255, 255, 255, 0.42), transparent 22%),
    linear-gradient(180deg, rgba(255, 251, 226, 0.95), rgba(232, 177, 91, 0.78) 52%, rgba(148, 82, 30, 0.95));
  box-shadow:
    inset 0 0 24px rgba(255, 255, 255, 0.22),
    0 0 30px rgba(255, 190, 84, 0.48);
}

.upgrade-option.upgrade-high strong {
  color: #7a4720;
}

.upgrade-option.upgrade-high small {
  color: #fff7df;
  background: rgba(146, 89, 34, 0.58);
}

@media (max-width: 960px) {
  body {
    overflow: auto;
  }

  .game-shell {
    height: auto;
    min-height: 100dvh;
    padding: 8px;
    overflow: visible;
  }

  .arena-panel {
    position: static;
    width: 100%;
    height: auto;
    transform: none;
  }

  .topbar,
  .controls {
    flex-direction: column;
    align-items: stretch;
  }

  .stat-grid {
    min-width: 0;
    grid-template-columns: repeat(2, 1fr);
  }

  .game-board {
    grid-template-columns: 64px minmax(0, 1fr);
    height: auto;
    min-height: 520px;
  }

  .loadout {
    grid-column: 1 / -1;
    border-left: 0;
    border-top: 1px solid var(--line);
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .loadout-card {
    min-width: 180px;
  }
}

@media (max-width: 720px) {
  .game-shell {
    padding: 8px;
  }

  .upgrade-options {
    grid-template-columns: 1fr;
  }

  canvas {
    min-height: 420px;
  }

  .game-board {
    min-height: 420px;
  }
}
