:root {
  color-scheme: dark;
  --outside: #04090c;
  --field: #0c191e;
  --grid: #17292e;
  --panel: #10232bef;
  --border: #34515a;
  --ink: #effff7;
  --muted: #93aeb3;
  --mint: #69f6bc;
  --coral: #ff856d;
  --gold: #f5d666;
  --ice: #69d9f4;
  --pink: #ee87c3;
  --lime: #bee86b;
  --shadow: 0 20px 80px #0009;
  font-family: "Trebuchet MS", Arial, sans-serif;
  background: var(--outside);
  color: var(--ink);
}
* {
  box-sizing: border-box;
  letter-spacing: 0;
}
html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}
button,
input,
a {
  -webkit-tap-highlight-color: transparent;
}
button,
input {
  font: inherit;
}
button,
a {
  touch-action: manipulation;
}
button {
  cursor: pointer;
  color: var(--ink);
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 6px;
}
button:hover {
  border-color: var(--mint);
}
button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--mint);
  outline-offset: 3px;
}
[hidden] {
  display: none !important;
}
header {
  height: calc(60px + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) max(18px, env(safe-area-inset-right, 0px)) 0
    max(18px, env(safe-area-inset-left, 0px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--outside);
  border-bottom: 1px solid var(--border);
}
.brand {
  font-weight: 900;
  font-size: 20px;
  white-space: nowrap;
}
.brand span {
  color: var(--mint);
}
.brand small {
  display: block;
  font-size: 9px;
  font-weight: 600;
  color: var(--muted);
  margin-top: 2px;
}
.tools {
  display: flex;
  align-items: center;
  gap: 7px;
}
.tools button {
  width: 34px;
  height: 34px;
  font-size: 18px;
}
.tools a {
  color: var(--ink);
  text-decoration: none;
  font-size: 12px;
  margin-right: 8px;
  font-weight: 700;
}
main {
  position: relative;
  height: calc(100dvh - 60px - env(safe-area-inset-top, 0px));
  overflow: hidden;
}
#arena {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}
.hud {
  position: absolute;
  left: max(18px, env(safe-area-inset-left, 0px));
  top: 20px;
  pointer-events: none;
}
.eyebrow {
  font-size: 9px;
  color: var(--muted);
  text-transform: uppercase;
  font-weight: 700;
}
.hud h1 {
  font-size: 25px;
  margin: 5px 0 16px;
  font-weight: 900;
}
.stats {
  display: flex;
  gap: 22px;
}
.stats b {
  display: block;
  font-size: 21px;
  color: var(--mint);
  font-variant-numeric: tabular-nums;
}
.stats small {
  font-size: 9px;
  color: var(--muted);
}
#rain {
  margin-top: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  border-left: 2px solid var(--coral);
  background: var(--panel);
  padding: 7px 9px;
  color: var(--coral);
}
#rainTime {
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.board {
  position: absolute;
  right: max(18px, env(safe-area-inset-right, 0px));
  top: 20px;
  width: 194px;
  padding: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  pointer-events: none;
}
.board h2 {
  font-size: 10px;
  margin: 0 0 9px;
  color: var(--muted);
}
.rank {
  font-size: 11px;
  display: flex;
  justify-content: space-between;
  gap: 6px;
  line-height: 1.85;
  color: var(--muted);
}
.rank span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.rank b {
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.rank.me,
.rank.me b {
  color: var(--mint);
}
.map {
  position: absolute;
  right: max(20px, env(safe-area-inset-right, 0px));
  bottom: calc(130px + env(safe-area-inset-bottom, 0px));
  width: 120px;
  height: 120px;
  pointer-events: none;
}
#minimap {
  width: 120px;
  height: 120px;
}
.map small {
  position: absolute;
  bottom: -8px;
  width: 100%;
  text-align: center;
  font-size: 9px;
  color: var(--muted);
}
#boost {
  position: absolute;
  right: max(28px, env(safe-area-inset-right, 0px));
  bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: 2px solid var(--mint);
  background: var(--panel);
  font-weight: 800;
  font-size: 11px;
  touch-action: none;
  user-select: none;
}
#boost span {
  display: block;
  font-size: 25px;
}
#boost.held {
  background: var(--mint);
  color: var(--field);
}
.hint {
  position: absolute;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  left: max(18px, env(safe-area-inset-left, 0px));
  font-size: 11px;
  color: var(--muted);
  pointer-events: none;
}
#joystick {
  display: none;
  position: absolute;
  left: max(25px, env(safe-area-inset-left, 0px));
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  width: 94px;
  height: 94px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--panel);
  pointer-events: none;
}
#joystick i {
  position: absolute;
  left: 31px;
  top: 31px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--mint);
  opacity: 0.45;
  transform: translate(var(--jx, 0px), var(--jy, 0px));
}
#overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--panel);
  background: color-mix(in srgb, var(--outside) 78%, transparent);
  padding: 18px;
  overflow: auto;
}
.dialog {
  width: 450px;
  max-width: 100%;
  margin: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  padding: 30px;
  box-shadow: var(--shadow);
}
.overline {
  color: var(--coral);
  font-size: 10px;
  font-weight: 800;
}
.dialog h2 {
  font-size: 38px;
  line-height: 1.05;
  margin: 14px 0;
  color: var(--ink);
  font-weight: 900;
}
.dialog h2 span {
  color: var(--mint);
}
.dialog p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}
.rules {
  list-style: none;
  padding: 0;
  margin: 22px 0;
  font-size: 13px;
  line-height: 1.6;
  display: grid;
  gap: 9px;
}
.rules li {
  display: flex;
  gap: 10px;
}
.rules strong {
  color: var(--mint);
  font-size: 16px;
  min-width: 17px;
}
.rules small {
  display: block;
  color: var(--muted);
  font-size: 11px;
}
#nameField {
  display: block;
  margin: 16px 0;
}
#nameField span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 6px;
}
input {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--outside);
  color: var(--ink);
  padding: 12px;
  border-radius: 6px;
  font-size: 16px;
}
#enter {
  width: 100%;
  padding: 14px;
  border: 0;
  background: var(--mint);
  color: var(--field);
  font-weight: 900;
  font-size: 15px;
}
.fine {
  font-size: 10px !important;
  margin-bottom: 0;
  text-align: center;
}
#result {
  border-left: 2px solid var(--coral);
  padding-left: 12px;
}
@media (pointer: coarse) {
  #joystick {
    display: block;
  }
  .hint {
    bottom: calc(129px + env(safe-area-inset-bottom, 0px));
    max-width: 48%;
    font-size: 10px;
  }
}
@media (max-width: 650px) {
  header {
    padding-left: 12px;
    padding-right: 12px;
  }
  .brand {
    font-size: 15px;
  }
  .tools {
    gap: 5px;
  }
  .tools a {
    font-size: 11px;
    margin-right: 3px;
  }
  .tools button {
    width: 29px;
    height: 31px;
  }
  .hud {
    left: 12px;
    top: 12px;
  }
  .hud h1 {
    font-size: 20px;
    margin: 4px 0 10px;
  }
  .stats {
    gap: 12px;
  }
  .stats b {
    font-size: 17px;
  }
  .stats small {
    font-size: 8px;
  }
  .board {
    right: 10px;
    top: 12px;
    width: 145px;
    padding: 8px;
  }
  .rank {
    font-size: 9px;
    line-height: 1.7;
  }
  .board h2 {
    font-size: 9px;
  }
  .stats .best-stat {
    display: none;
  }
  .map {
    right: 12px;
    width: 100px;
    height: 100px;
    bottom: calc(118px + env(safe-area-inset-bottom, 0px));
  }
  #minimap {
    width: 100px;
    height: 100px;
  }
  #boost {
    right: 20px;
    width: 78px;
    height: 78px;
  }
  .dialog {
    padding: 24px;
  }
  .dialog h2 {
    font-size: 32px;
  }
  #rain {
    font-size: 9px;
    margin-top: 11px;
  }
}
@media (max-height: 500px) {
  header {
    height: calc(48px + env(safe-area-inset-top, 0px));
  }
  main {
    height: calc(100dvh - 48px - env(safe-area-inset-top, 0px));
  }
  .hud {
    top: 10px;
  }
  .hud h1 {
    display: none;
  }
  .stats {
    margin-top: 8px;
  }
  .board {
    top: 10px;
  }
  .board .rank:nth-child(n + 6) {
    display: none;
  }
  .map {
    bottom: calc(100px + env(safe-area-inset-bottom, 0px));
    width: 70px;
    height: 70px;
  }
  #minimap {
    width: 70px;
    height: 70px;
  }
  #boost {
    height: 68px;
    width: 68px;
    bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  }
  #joystick {
    height: 76px;
    width: 76px;
    bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  }
  #joystick i {
    top: 23px;
    left: 23px;
  }
  .hint {
    display: none;
  }
  #overlay {
    padding: 12px;
  }
  .dialog {
    padding: 18px;
  }
  .dialog h2 {
    font-size: 26px;
    margin: 8px 0;
  }
  .rules {
    margin: 12px 0;
    gap: 5px;
    font-size: 12px;
  }
  .rules small {
    display: none;
  }
  #nameField {
    margin: 10px 0;
  }
  .dialog p {
    margin: 8px 0;
  }
  .fine {
    display: none;
  }
  input {
    padding: 8px;
  }
  #enter {
    padding: 11px;
  }
}
