:root {
  color-scheme: dark;
  font-family: Inter, ui-rounded, 'SF Pro Rounded', system-ui, sans-serif;
  background: #090d21;
  color: #f8f7ff;
  --ink: #f8f7ff;
  --muted: #aeb7d7;
  --panel: rgb(19 26 56 / 92%);
  --line: #334170;
  --accent: #72ecff;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
}

body {
  min-height: 100vh;
  padding: max(12px, env(safe-area-inset-top))
    max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom))
    max(12px, env(safe-area-inset-left));
  background:
    radial-gradient(circle at 12% 0%, rgb(89 66 190 / 30%), transparent 33rem),
    radial-gradient(
      circle at 90% 20%,
      rgb(25 195 215 / 20%),
      transparent 34rem
    ),
    #090d21;
}

button {
  font: inherit;
}

#app {
  width: min(100%, 1080px);
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(1.5rem, 5vw, 2.35rem);
  line-height: 1;
}

.scorebox {
  min-width: 92px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  text-align: right;
}

.scorebox span {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.scorebox strong {
  font-size: 1.25rem;
}

.arena-shell {
  position: relative;
  overflow: hidden;
  border: 1px solid #42528a;
  border-radius: 20px;
  background: #11193b;
  box-shadow: 0 24px 70px rgb(0 0 0 / 35%);
}

#arena {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
}

.screen {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  padding: clamp(16px, 4vw, 40px);
  background: linear-gradient(180deg, rgb(9 13 33 / 64%), rgb(9 13 33 / 92%));
  text-align: center;
}

.screen[hidden] {
  display: none;
}

.screen h2 {
  margin: 0;
  font-size: clamp(1.55rem, 5vw, 2.8rem);
}

.screen > p {
  max-width: 54ch;
  margin: 9px 0 18px;
  color: #cbd3ed;
  line-height: 1.45;
}

.starter-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  width: min(100%, 760px);
}

.starter,
.action,
.primary {
  min-height: 52px;
  border: 1px solid #4a5a91;
  border-radius: 14px;
  background: linear-gradient(180deg, #263367, #192450);
  color: var(--ink);
  cursor: pointer;
  touch-action: manipulation;
}

.starter {
  min-height: 126px;
  padding: 12px 8px;
}

.starter:hover,
.starter:focus-visible,
.action:hover,
.action:focus-visible,
.primary:hover,
.primary:focus-visible {
  border-color: var(--accent);
  outline: 3px solid rgb(114 236 255 / 24%);
  outline-offset: 1px;
}

.starter strong,
.starter span,
.action strong,
.action span {
  display: block;
}

.starter strong {
  margin-top: 6px;
  font-size: 1rem;
}

.starter span,
.action span {
  margin-top: 3px;
  color: #bdc7e8;
  font-size: 0.72rem;
}

.starter-mark {
  width: 42px;
  height: 42px;
  margin: 0 auto;
  border: 5px solid currentColor;
  border-radius: 14px 48% 40% 52%;
  transform: rotate(12deg);
}

.primary {
  min-width: 190px;
  padding: 0 20px;
  font-weight: 900;
}

.controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.controls:empty {
  display: none;
}

.action {
  min-height: 70px;
  padding: 9px;
}

.action strong {
  font-size: 0.98rem;
}

.action kbd {
  display: inline-grid;
  min-width: 21px;
  height: 21px;
  margin-right: 5px;
  place-items: center;
  border: 1px solid #6575aa;
  border-radius: 5px;
  background: #0e1639;
  color: #dce4ff;
  font: 800 0.7rem/1 inherit;
}

.action:disabled {
  cursor: wait;
  filter: saturate(0.35);
  opacity: 0.58;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 4px 0;
  color: var(--muted);
  font-size: 0.78rem;
}

#status {
  color: #e4e8f7;
}

@media (max-width: 620px) {
  body {
    padding: max(10px, env(safe-area-inset-top))
      max(10px, env(safe-area-inset-right))
      max(10px, env(safe-area-inset-bottom))
      max(10px, env(safe-area-inset-left));
  }

  .arena-shell {
    border-radius: 15px;
  }

  .screen {
    position: relative;
    min-height: 330px;
  }

  .screen[hidden] {
    display: none;
  }

  #arena {
    aspect-ratio: 4 / 3;
  }

  .starter-grid {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .starter {
    display: grid;
    grid-template-columns: 46px 1fr;
    grid-template-rows: auto auto;
    min-height: 64px;
    padding: 8px 12px;
    text-align: left;
  }

  .starter-mark {
    grid-row: 1 / 3;
    align-self: center;
    width: 35px;
    height: 35px;
    margin: 0;
  }

  .starter strong {
    align-self: end;
    margin: 0;
  }

  .starter span {
    align-self: start;
  }

  .controls {
    position: sticky;
    bottom: max(8px, env(safe-area-inset-bottom));
    z-index: 4;
    gap: 7px;
  }

  .action {
    min-height: 82px;
    padding: 8px 5px;
  }

  .action span {
    font-size: 0.65rem;
    line-height: 1.25;
  }

  .action kbd {
    display: none;
  }

  .footer {
    display: block;
    min-height: 46px;
    font-size: 0.72rem;
  }

  .footer span {
    display: block;
  }

  .footer span + span {
    margin-top: 3px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
