:root {
  --bg: #111b19;
  --panel: #1b2622;
  --border: #354038;
  --text: #e9eee0;
  --muted: #a4b1a3;
  --lime: #d0ed9b;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font:
    14px/1.6 Arial,
    sans-serif;
}
a {
  color: inherit;
  text-decoration: none;
}
button {
  font: inherit;
  cursor: pointer;
  color: inherit;
}
button,
a {
  touch-action: manipulation;
}
button:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 4px;
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
button {
  border: 1px solid var(--border);
  background: transparent;
  border-radius: 8px;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1,
h2,
h3 {
  line-height: 1.06;
  letter-spacing: -1.5px;
}
em {
  font-family: Georgia, serif;
  font-weight: 400;
  color: var(--lime);
}
.topbar {
  padding: 19px 4%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  gap: 20px;
}
.brand {
  display: flex;
  gap: 13px;
  align-items: center;
}
.brand > b {
  font-size: 29px;
  letter-spacing: -3px;
  color: var(--bg);
  background: var(--lime);
  padding: 0 12px 3px;
  border-radius: 12px;
}
.brand > span {
  font-size: 10px;
  letter-spacing: 1.3px;
}
.brand small {
  display: block;
  font-size: 7px;
  letter-spacing: 1.5px;
  color: var(--muted);
}
nav {
  display: flex;
  gap: 20px;
  align-items: center;
  font-size: 11px;
}
nav button {
  padding: 8px 13px;
}
main {
  max-width: 1500px;
  margin: auto;
  padding: 35px 4%;
}
.heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 30px;
}
.eyebrow {
  font: 9px/1.6 monospace;
  letter-spacing: 1.7px;
  color: var(--muted);
  margin-bottom: 14px;
}
h1 {
  font-size: clamp(43px, 5vw, 68px);
  font-weight: 500;
}
.heading > p {
  font-size: 12px;
  color: var(--muted);
  text-align: right;
}
.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 20px;
}
.arena {
  height: 590px;
  position: relative;
  background: #172521;
  border: 1px solid #46513f;
  border-radius: 16px;
  overflow: hidden;
}
#viewport {
  position: absolute;
  inset: 0;
  touch-action: none;
}
canvas {
  display: block;
  width: 100%;
  height: 100%;
}
.hud {
  position: absolute;
  top: 22px;
  left: 22px;
  right: 22px;
  display: flex;
  justify-content: space-between;
  gap: 25px;
  pointer-events: none;
}
.health {
  width: 200px;
}
.health > span {
  display: flex;
  justify-content: space-between;
  font: 8px monospace;
  letter-spacing: 1px;
}
.health-track {
  height: 5px;
  background: #445040;
  margin-top: 10px;
  border-radius: 3px;
  overflow: hidden;
}
.health-track i {
  display: block;
  background: var(--lime);
  height: 100%;
  width: 100%;
  transition: width 0.15s;
}
.wave-stat {
  text-align: right;
  font: 9px monospace;
  letter-spacing: 1px;
}
.wave-stat b {
  display: block;
  font-size: 27px;
  font-weight: 400;
  margin-top: 7px;
  letter-spacing: 2px;
}
.arena-label {
  position: absolute;
  left: 22px;
  bottom: 20px;
  font: 8px monospace;
  letter-spacing: 1.2px;
  pointer-events: none;
}
.arena-label i {
  display: inline-block;
  background: var(--lime);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  margin-right: 7px;
}
#pause {
  position: absolute;
  bottom: 13px;
  right: 17px;
  background: #15231bdd;
  width: 40px;
  height: 40px;
}
.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: #0c171a45;
  backdrop-filter: blur(4px);
  z-index: 3;
  padding: 25px;
}
.overlay[hidden] {
  display: none;
}
.overlay-card {
  text-align: center;
  max-width: 395px;
  padding: 30px 20px;
  background: #13221eee;
  border: 1px solid #6a7d5355;
  border-radius: 18px;
  box-shadow: 0 25px 80px #0004;
}
.overlay h2 {
  font-size: 43px;
  font-weight: 500;
}
.overlay-card > p:not(.eyebrow) {
  font-size: 12px;
  color: #b9c6b4;
  margin: 20px 0;
}
.intro-pills {
  display: flex;
  justify-content: center;
  gap: 8px;
  font-size: 9px;
  margin-bottom: 22px;
}
.intro-pills span {
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 15px;
}
.primary {
  background: var(--lime);
  color: #172017;
  border: 0;
  padding: 13px 28px;
  border-radius: 25px;
  min-width: 180px;
  font-weight: 600;
}
.primary:hover {
  background: #e1ffb5;
}
.skip-game {
  display: block;
  font-size: 10px;
  color: var(--muted);
  margin-top: 18px;
}
.loadout {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 23px;
  background: #1a2520;
}
.loadout-title {
  display: flex;
  justify-content: space-between;
  font: 8px monospace;
  letter-spacing: 1.2px;
  color: var(--muted);
  margin-bottom: 22px;
}
.loadout h2 {
  font-size: 26px;
  font-weight: 500;
  margin-bottom: 24px;
}
.ability {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  padding: 13px 10px;
  margin-bottom: 9px;
  transition: background 0.2s;
}
.ability.selected {
  background: #d0ed9b0c;
  border-color: #8caa62;
}
.ability-icon {
  background: #304032;
  color: var(--lime);
  width: 34px;
  height: 38px;
  border-radius: 8px;
  text-align: center;
  line-height: 38px;
  font-size: 24px;
}
.ability strong {
  display: block;
  font-size: 12px;
  font-weight: 500;
}
.ability small {
  display: block;
  font-size: 8px;
  color: var(--muted);
}
.ability-number {
  margin-left: auto;
  color: #86917c;
  font: 8px monospace;
}
.cooldown {
  display: block;
  font: 7px monospace;
  color: var(--lime);
  margin-top: 6px;
}
.skill-detail {
  margin-top: 23px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.skill-detail .eyebrow {
  font-size: 7px;
}
.skill-detail h3 {
  font-size: 17px;
  letter-spacing: -0.5px;
  margin: 10px 0;
}
.skill-detail p {
  font-size: 11px;
  color: var(--muted);
}
.skill-detail a {
  display: inline-block;
  margin-top: 13px;
  font-size: 10px;
  color: var(--lime);
}
.best {
  display: flex;
  justify-content: space-between;
  margin-top: 20px;
  font: 8px monospace;
  color: var(--muted);
}
.best b {
  color: var(--lime);
}
.bottom-bar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  font-size: 9px;
  color: var(--muted);
  padding: 20px 0;
}
.bottom-bar > span:last-child {
  font: 7px monospace;
  letter-spacing: 1px;
}
kbd {
  font: 8px monospace;
  border: 1px solid var(--border);
  padding: 3px 5px;
  border-radius: 3px;
  margin-right: 2px;
}
.field-notes {
  margin-top: 32px;
  padding-top: 30px;
  border-top: 1px solid var(--border);
}
.field-notes > div {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 45px;
}
.field-notes article > span {
  font: 8px monospace;
  color: var(--lime);
}
.field-notes h3 {
  font-size: 20px;
  font-weight: 500;
  margin: 14px 0;
}
.field-notes article p {
  font-size: 12px;
  color: var(--muted);
  max-width: 340px;
}
footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid var(--border);
  margin-top: 40px;
  padding: 25px 0 0;
  font-size: 10px;
  color: var(--muted);
}
.touch-controls {
  display: none;
}
dialog {
  background: var(--panel);
  color: var(--text);
  border: 1px solid #637d4d;
  border-radius: 18px;
  padding: 35px;
  width: min(520px, 90%);
  max-height: 85dvh;
}
dialog::backdrop {
  background: #000a;
  backdrop-filter: blur(5px);
}
dialog h2 {
  font-size: 32px;
  margin: 20px 0;
}
dialog p,
dialog li {
  font-size: 13px;
  color: var(--muted);
}
dialog ul {
  padding-left: 20px;
}
dialog li {
  margin: 12px 0;
}
#close-help {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 35px;
  height: 35px;
  font-size: 23px;
}
.skip-link {
  position: fixed;
  top: -100px;
  left: 20px;
  z-index: 10;
  background: var(--lime);
  color: var(--bg);
  padding: 12px;
}
.skip-link:focus {
  top: 10px;
}
.no-script {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--lime);
  color: #111;
  padding: 20px;
  z-index: 10;
}
@media (pointer: coarse), (max-width: 760px) {
  .touch-controls {
    display: flex;
    position: absolute;
    bottom: 48px;
    left: 15px;
    right: 15px;
    justify-content: space-between;
    align-items: flex-end;
    pointer-events: none;
  }
  .touch-controls button {
    pointer-events: auto;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    background: #15251fe8;
    border-color: #83986b70;
    width: 44px;
    height: 44px;
    font-size: 19px;
  }
  .touch-controls button:active {
    background: #597246;
  }
  .dpad {
    display: grid;
    grid-template-columns: repeat(3, 44px);
    gap: 3px;
  }
  .dpad button:first-child {
    grid-column: 2;
  }
  .dpad button:nth-child(2) {
    grid-column: 1;
  }
  .touch-actions {
    display: flex;
    gap: 5px;
  }
  .touch-actions button {
    border-radius: 50%;
    width: 49px;
    height: 49px;
    font-size: 19px;
  }
  .touch-actions small {
    display: block;
    font: 6px monospace;
  }
  .touch-actions button:last-child {
    width: 58px;
    height: 58px;
    background: #b8d989;
    color: #15231b;
  }
  .desktop-hint {
    display: none;
  }
}
@media (max-width: 1050px) {
  .game-layout {
    grid-template-columns: minmax(0, 1fr) 260px;
    gap: 14px;
  }
  .loadout {
    padding: 18px;
  }
  .arena {
    height: 610px;
  }
  .bottom-bar > span:last-child {
    display: none;
  }
}
@media (max-width: 760px) {
  .topbar {
    padding: 13px 4%;
    gap: 10px;
  }
  .brand > span {
    display: none;
  }
  nav {
    gap: 9px;
    font-size: 10px;
  }
  nav button {
    padding: 8px;
  }
  main {
    padding-top: 27px;
  }
  .heading {
    margin-bottom: 24px;
  }
  .heading > p {
    display: none;
  }
  .heading .eyebrow {
    font-size: 8px;
  }
  .game-layout {
    grid-template-columns: 1fr;
  }
  .arena {
    height: 560px;
    max-height: 78svh;
    min-height: 430px;
  }
  .hud {
    left: 16px;
    right: 16px;
    top: 17px;
  }
  .health {
    width: 145px;
  }
  .overlay {
    padding: 15px;
  }
  .overlay-card {
    padding: 25px 18px;
  }
  .overlay h2 {
    font-size: 36px;
  }
  .overlay-card > p:not(.eyebrow) {
    margin: 14px 0;
  }
  .overlay .eyebrow {
    font-size: 7px;
  }
  .intro-pills {
    margin-bottom: 15px;
  }
  .loadout {
    padding: 23px;
  }
  .loadout h2 br {
    display: none;
  }
  .ability {
    padding: 14px;
  }
  .ability small {
    font-size: 10px;
  }
  .ability strong {
    font-size: 14px;
  }
  .cooldown {
    font-size: 9px;
  }
  .skill-detail p {
    font-size: 13px;
  }
  .field-notes > div {
    grid-template-columns: 1fr;
    gap: 28px;
  }
  .field-notes {
    margin-top: 15px;
  }
  .bottom-bar {
    padding: 15px 0;
  }
  .field-notes article p {
    max-width: none;
  }
  footer {
    flex-wrap: wrap;
  }
  .arena-label {
    font-size: 7px;
    left: 15px;
  }
  .touch-controls {
    left: 10px;
    right: 10px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}

/* Keep the arena and both touch pads together on landscape phones. */
@media (pointer: coarse) and (max-height: 500px) {
  .game-layout {
    grid-template-columns: 1fr;
  }
  .arena {
    height: 88svh;
    min-height: 300px;
    max-height: none;
  }
  .heading {
    margin-bottom: 20px;
  }
  .overlay-card {
    max-width: 530px;
    padding: 16px 24px;
  }
  .overlay h2 {
    font-size: 28px;
  }
  .overlay-card > p:not(.eyebrow) {
    margin: 10px 0;
  }
  .intro-pills {
    display: none;
  }
  .skip-game {
    margin-top: 10px;
  }
}
