:root {
  color-scheme: light;
  font-family: "Trebuchet MS", "Arial Rounded MT Bold", system-ui, sans-serif;
  color: #214258;
  background: #d9f3f6;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
button, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible {
  outline: 3px solid #ffad37;
  outline-offset: 3px;
}
[hidden] { display: none !important; }

.app { position: relative; width: 100vw; height: 100vh; height: 100dvh; overflow: hidden; }
#arena { display: block; width: 100%; height: 100%; background: #e8f9fa; touch-action: none; }
.vignette {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle at center, transparent 34%, rgba(42,130,158,.09) 100%);
}

.overlay {
  position: absolute; inset: 0; z-index: 4;
  display: flex; align-items: center; justify-content: center;
  padding: 20px; overflow-y: auto;
  background: rgba(214, 244, 249, .25);
  backdrop-filter: blur(2px);
}
.menu-card {
  width: min(100%, 520px);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  padding: 17px 26px 22px;
  border: 2px solid #9cd8e3;
  border-radius: 22px;
  background: rgba(255,255,255,.96);
  box-shadow: 0 5px 0 #8bc9d7, 0 25px 70px rgba(26,91,117,.25);
  scrollbar-width: thin;
}
.brand { display: flex; align-items: center; justify-content: center; gap: 4px; margin: -8px 0 -10px; }
.brand-spinner { width: 76px; height: 76px; flex: 0 0 auto; }
.brand h1 {
  margin: 0;
  color: #24b5cd;
  font-size: clamp(2rem, 5vw, 3.15rem);
  line-height: 1;
  font-weight: 1000;
  letter-spacing: -.06em;
  text-shadow: 0 3px 0 #c8f1f3;
}
.brand h1 span { color: #ffba42; }
.menu-tagline {
  margin: 4px 0 18px;
  color: #60899c;
  font-size: .97rem;
  font-weight: 800;
  text-align: center;
}
.name-row label, .selector-heading {
  color: #4e7d91;
  font-size: .83rem;
  font-weight: 900;
  letter-spacing: .09em;
}
.name-row { display: grid; gap: 8px; }
.name-row input {
  width: 100%; height: 48px; padding: 0 15px;
  border: 2px solid #c3e4ea; border-radius: 11px;
  color: #294d62; background: #f7fdfe;
  font-size: 1rem; font-weight: 800;
}
.name-row input:hover { border-color: #84cfdd; }
.menu-level { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 17px; color: #296b83; font-size: .9rem; }
.menu-level span { color: #6a91a0; font-size: .83rem; font-weight: 800; }
.menu-progress { height: 9px; overflow: hidden; margin-top: 7px; border-radius: 8px; background: #d7edf0; }
.menu-progress div { width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg,#27c9bd,#22b5ed); }
.reset-button {
  display: block; margin: 7px 0 0 auto; padding: 5px 0;
  border: 0; background: transparent; color: #597d8e;
  font: 800 .88rem "Trebuchet MS",sans-serif; text-decoration: underline;
  cursor: pointer;
}
.reset-button:hover, .reset-button:focus-visible { color: #b6495b; }
.selector-heading {
  display: flex; justify-content: space-between; align-items: center;
  margin: 20px 0 9px;
}
.selector-heading span:last-child {
  color: #15a4bd; font-size: .77rem; letter-spacing: .02em;
}
.spinner-list {
  display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 8px;
  max-height: 198px; overflow-y: auto; padding: 2px 5px 3px 2px;
  scrollbar-color: #a4d7e0 transparent; scrollbar-width: thin;
}
.skin-card {
  min-width: 0; min-height: 91px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  position: relative; gap: 1px; padding: 6px 2px 7px;
  border: 2px solid #e0eef2; border-radius: 12px;
  color: #44677a; background: #f6fbfc;
  transition: transform .14s, border-color .14s, background .14s;
}
.skin-card:not(:disabled):hover { transform: translateY(-2px); border-color: #8dd4e2; }
.skin-card.selected { border-color: #19b7d1; background: #dff8fc; box-shadow: inset 0 0 0 1px #19b7d1; }
.skin-card.locked { color: #8299a2; background: #eef2f3; cursor: not-allowed; }
.skin-card.locked canvas { filter: grayscale(1); opacity: .32; }
.skin-card.locked::after { content: "🔒"; position: absolute; top: 7px; left: 7px; font-size: .9rem; }
.skin-card canvas { display: block; width: 49px; height: 49px; }
.skin-card strong { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .76rem; }
.skin-card small {
  position: absolute; top: 4px; right: 5px; color: #7597a6;
  font: 900 .65rem/1 "Trebuchet MS",sans-serif;
}
.selection-note {
  min-height: 24px; margin: 9px 0 11px;
  color: #597c8e; font-size: .84rem; line-height: 1.4; text-align: center;
}
.play-button {
  width: 100%; min-height: 55px; display: flex; align-items: center; justify-content: center; gap: 18px;
  border: 0; border-radius: 12px; color: #fff;
  background: linear-gradient(180deg,#37cb96,#13af79);
  box-shadow: 0 5px 0 #0c9363, 0 8px 15px rgba(19,175,121,.22);
  font-size: 1.22rem; font-weight: 1000; letter-spacing: .08em;
  transition: transform .12s, box-shadow .12s, filter .12s;
}
.play-button:hover { filter: brightness(1.045); transform: translateY(-2px); box-shadow: 0 7px 0 #0c9363, 0 10px 15px rgba(19,175,121,.22); }
.play-button:active { transform: translateY(4px); box-shadow: 0 1px 0 #0c9363; }
.play-button span { font-size: 1.05rem; }
.menu-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.menu-actions .play-button { min-width: 0; gap: 6px; }
.join-button { background: linear-gradient(180deg,#36b9db,#218ab4); box-shadow: 0 5px 0 #1b7395, 0 8px 15px rgba(34,133,175,.2); }
.join-button:hover { box-shadow: 0 7px 0 #1b7395, 0 10px 15px rgba(34,133,175,.2); }
.join-button:active { box-shadow: 0 1px 0 #1b7395; }
.join-panel { margin-top: 15px; }
.join-panel label { display: block; margin-bottom: 7px; color: #4e7d91; font-size: .86rem; font-weight: 800; }
.join-row { display: flex; gap: 7px; }
.join-row input { min-width: 0; flex: 1; height: 42px; padding: 0 9px; border: 2px solid #c3e4ea; border-radius: 9px; }
.join-row button { border: 0; border-radius: 9px; padding: 0 12px; color: #fff; background: #218ab4; font-size: .84rem; font-weight: 900; }
.connection-message { min-height: 18px; margin: 9px 0 0; color: #a24848; font-size: .85rem; font-weight: 700; }
.online-counts { display: flex; justify-content: space-between; gap: 8px; margin-top: 5px; color: #537e91; font-size: .83rem; font-weight: 800; }
.discord-link { display: block; width: fit-content; margin: 10px auto 0; color: #4a62ad; font-size: .88rem; font-weight: 800; text-decoration: underline; }
.hud { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.hud button { pointer-events: auto; }
.hud a { pointer-events: auto; }
.leaderboard, .rpm-panel { position: absolute; }
.rpm-panel { right: 20px; bottom: 20px; width: 220px; height: 60px; }
.rpm-panel canvas { display: block; width: 100%; height: 100%; }
.rpm-row {
  position: absolute; right: 3px; bottom: 4px;
  display: flex; align-items: baseline; gap: 5px;
  color: #182934; text-shadow: 0 1px 2px rgba(255,255,255,.95);
}
.rpm-row strong { font-size: 1.75rem; line-height: 1; font-weight: 900; letter-spacing: -.05em; }
.rpm-row span { font-size: .83rem; font-weight: 800; }
.leaderboard { top: 18px; right: 18px; width: 300px; color: #253640; }
.board-columns, .leaderboard li {
  display: grid; grid-template-columns: 29px minmax(0,1fr) 70px 36px;
  align-items: center; gap: 6px; padding: 5px 6px;
}
.board-columns { color: #35434c; font-size: .69rem; font-weight: 700; }
.board-columns span:nth-child(n+3), .board-rpm, .board-kills { text-align: right; }
.leaderboard ol { list-style: none; display: grid; gap: 2px; margin: 0; padding: 0; }
.leaderboard li { color: #26343c; font-size: .78rem; font-weight: 700; }
.leaderboard li.you, .leaderboard li.you .board-place { color: #2674b5; }
.board-place { color: #5f6b72; }
.board-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-rpm, .board-kills { font-variant-numeric: tabular-nums; }
.map-stack { position: absolute; left: 20px; bottom: 20px; display: grid; gap: 20px; width: 140px; }
.lobby-placeholder {
  width: 100%; min-height: 30px; padding: 4px 6px; border: 0; border-radius: 3px;
  color: #fff; background: rgba(109,114,120,.65); font-size: .76rem; font-weight: 800;
}
.lobby-placeholder:hover { background: rgba(44,122,160,.85); }
.arena-share-url { width: fit-content; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #175e84; font-size: .78rem; font-weight: 900; text-decoration: underline; }
.arena-feedback { width: min(245px,calc(100vw - 30px)); margin: 0; padding: 7px 9px; border-radius: 5px; color: #20465a; background: rgba(255,255,255,.93); font-size: .78rem; font-weight: 800; line-height: 1.3; }
.minimap {
  position: relative; width: 140px; aspect-ratio: 1;
  overflow: hidden; border-radius: 3px;
  background: rgba(113,130,143,.24);
}
.minimap canvas { display: block; width: 100%; height: 100%; }

.dialog-layer { background: rgba(33,95,117,.31); backdrop-filter: blur(4px); }
.dialog-card {
  width: min(100%, 370px); padding: 27px 25px 25px;
  border: 2px solid #a8dce4; border-radius: 18px;
  background: #fff; box-shadow: 0 7px 0 #91cad5, 0 25px 65px rgba(23,81,107,.25);
  text-align: center;
}
.dialog-card h2 { margin: 0; color: #1aa9c0; font-size: 2.15rem; letter-spacing: .02em; }
.dialog-card p { margin: 8px 0 24px; color: #658899; line-height: 1.4; }
.dialog-card .play-button { margin-top: 17px; font-size: 1rem; }
.secondary-button {
  margin-top: 14px; padding: 8px 15px; border: 0; background: transparent;
  color: #7398a7; font-weight: 800; font-size: .9rem;
}
.secondary-button:hover { color: #1aa9c0; }
.death-icon { margin-bottom: 4px; color: #ffb54b; font-size: 2.5rem; }
.dialog-card .level-result { margin: -10px 0 14px; color: #159fba; font-size: 1.4rem; font-weight: 900; }
.result-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 8px; }
.result-grid div { display: grid; gap: 4px; padding: 11px 3px; background: transparent; }
.result-grid strong { color: #209fba; font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.result-grid span { color: #7897a5; font-size: .67rem; font-weight: 900; }
.dialog-card .next-level { margin: 0; font-size: .85rem; font-weight: 800; }
.dialog-card .unlock-message { margin: 12px 0 -3px; color: #0eab79; font-weight: 900; }

@media (max-width: 720px) {
  .menu-card { max-height: calc(100dvh - 20px); padding: 12px 16px 18px; }
  .brand-spinner { width: 64px; height: 64px; }
  .brand h1 { font-size: clamp(1.65rem, 7vw, 2.4rem); }
  .menu-tagline { margin-bottom: 12px; }
  .selector-heading { margin-top: 14px; }
  .rpm-panel { right: 10px; bottom: 10px; width: 145px; height: 42px; }
  .rpm-row strong { font-size: 1.4rem; }
  .leaderboard { top: 10px; right: 10px; width: min(255px, calc(100vw - 20px)); }
  .board-columns, .leaderboard li { grid-template-columns: 23px minmax(0,1fr) 57px 31px; gap: 4px; padding: 3px 2px; }
  .leaderboard li { font-size: .67rem; }
  .board-columns { font-size: .56rem; }
  .map-stack { left: 10px; bottom: 10px; width: 112px; gap: 6px; }
  .minimap { width: 112px; }
  .lobby-placeholder { min-height: 25px; font-size: .65rem; }
}
@media (max-width: 420px) {
  .spinner-list { grid-template-columns: repeat(4,minmax(0,1fr)); gap: 5px; }
  .skin-card { min-height: 80px; padding: 4px 1px; }
  .skin-card canvas { width: 40px; height: 40px; }
  .skin-card strong { font-size: .64rem; }
  .leaderboard { width: min(235px, calc(100vw - 20px)); }
  .board-rpm { font-size: .61rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
