*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --ink: #eef3f8;
  --muted: rgba(238, 243, 248, 0.58);
  --you: #4cc9f0;
  --you-deep: #0077b6;
  --cpu: #ff6b4a;
  --cpu-deep: #c1121f;
  --gold: #ffd60a;
  --panel: rgba(12, 24, 36, 0.72);
  --line: rgba(255, 255, 255, 0.12);
  --serif: "Instrument Serif", Georgia, serif;
  --sans: "Outfit", system-ui, sans-serif;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  color: var(--ink);
  font-family: var(--sans);
  background:
    radial-gradient(ellipse 70% 45% at 50% -5%, rgba(0, 119, 182, 0.35), transparent 50%),
    radial-gradient(ellipse 40% 30% at 100% 100%, rgba(193, 18, 31, 0.2), transparent),
    linear-gradient(165deg, #0d1b2a, #061018 60%, #0a1218);
}

.app {
  max-width: 62rem;
  margin: 0 auto;
  padding: 0.9rem 1rem 1.4rem;
  display: grid;
  gap: 0.7rem;
  min-height: 100dvh;
}

.header {
  text-align: center;
}

.back {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.82rem;
}

.back:hover {
  color: var(--ink);
}

.header h1 {
  margin: 0.2rem 0 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.9rem, 4.5vw, 2.5rem);
  line-height: 1;
}

.header p {
  margin: 0.3rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.hud {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0.55rem;
  align-items: center;
}

.card {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 0.65rem;
  border-radius: 0.9rem;
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(10px);
  min-width: 0;
}

.cpu-card {
  justify-content: flex-end;
}

.kit {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 0.45rem;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.95rem;
  flex-shrink: 0;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.18);
}

.kit-you {
  background: linear-gradient(145deg, #4cc9f0, #0077b6);
  color: #041018;
}

.kit-cpu {
  background: linear-gradient(145deg, #ff6b4a, #c1121f);
  color: #fff;
}

.card-body {
  min-width: 0;
  flex: 1;
}

.card-body.right {
  text-align: right;
}

.name {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.bars {
  display: grid;
  gap: 0.2rem;
}

.bar {
  height: 0.28rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  width: 100%;
  border-radius: inherit;
  transition: width 0.1s linear;
}

.stamina {
  background: linear-gradient(90deg, #00bbf9, #80ed99);
}

.cpu-stamina {
  background: linear-gradient(90deg, #ff6b4a, #ffd60a);
  margin-left: auto;
}

.score {
  font-size: 1.65rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.you-card .score {
  color: var(--you);
}

.cpu-card .score {
  color: var(--cpu);
}

.mid {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  min-width: 7.5rem;
}

.clock {
  font-size: 0.95rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

.banner {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
  white-space: nowrap;
}

.power {
  width: 7rem;
  height: 0.35rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
  margin-top: 0.15rem;
}

.power-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--gold), #fff);
  box-shadow: 0 0 12px rgba(255, 214, 10, 0.5);
}

.field-wrap {
  position: relative;
  border-radius: 1rem;
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow:
    0 0 0 1px rgba(76, 201, 240, 0.08),
    0 24px 60px rgba(0, 0, 0, 0.45);
  background: #0b3d2e;
  aspect-ratio: 960 / 540;
}

#field {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.modal {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 0.35rem;
  padding: 1.4rem;
  text-align: center;
  background: rgba(4, 12, 20, 0.82);
  backdrop-filter: blur(8px);
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.modal.hide {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.modal-kicker {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 600;
}

.modal-title {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.8rem, 4vw, 2.5rem);
}

.modal-copy {
  margin: 0.2rem auto 0.5rem;
  max-width: 26rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.features {
  list-style: none;
  margin: 0 0 0.85rem;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
}

.features li {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
}

.play {
  justify-self: center;
  border: 0;
  cursor: pointer;
  font: 700 1rem var(--sans);
  color: #0a1218;
  background: var(--gold);
  padding: 0.75rem 1.6rem;
  border-radius: 999px;
  box-shadow: 0 0 32px rgba(255, 214, 10, 0.35);
}

.play:active {
  transform: scale(0.97);
}

.touch {
  display: none;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  user-select: none;
}

.stick {
  width: 6.6rem;
  height: 6.6rem;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  position: relative;
  touch-action: none;
}

.knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 2.4rem;
  height: 2.4rem;
  margin: -1.2rem;
  border-radius: 50%;
  background: rgba(76, 201, 240, 0.35);
  border: 1px solid rgba(76, 201, 240, 0.5);
  pointer-events: none;
}

.touch-actions {
  display: flex;
  gap: 0.55rem;
  align-items: center;
}

.act {
  border-radius: 50%;
  border: 1px solid var(--line);
  color: var(--ink);
  font: 700 0.8rem var(--sans);
  cursor: pointer;
  touch-action: none;
}

.sprint {
  width: 4.2rem;
  height: 4.2rem;
  background: rgba(128, 237, 153, 0.2);
  border-color: rgba(128, 237, 153, 0.4);
}

.boot {
  width: 5.2rem;
  height: 5.2rem;
  background: linear-gradient(160deg, rgba(76, 201, 240, 0.45), rgba(0, 119, 182, 0.55));
  border-color: rgba(76, 201, 240, 0.45);
}

.act.on,
.act:active {
  filter: brightness(1.15);
}

.hint {
  margin: 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
}

kbd {
  display: inline-block;
  padding: 0.08rem 0.35rem;
  border: 1px solid var(--line);
  border-radius: 0.25rem;
  background: rgba(255, 255, 255, 0.06);
  font: 500 0.72rem var(--sans);
}

.play.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: none;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  justify-content: center;
  margin-top: 0.35rem;
}

.locker {
  position: absolute;
  inset: 0;
  overflow: auto;
  padding: 1rem 1.1rem 1.25rem;
  background: rgba(4, 12, 20, 0.88);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.locker.hide {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.locker-title {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.5rem, 3.5vw, 2rem);
  text-align: center;
}

.pick-block h3 {
  margin: 0 0 0.45rem;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.pick-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.45rem;
}

.pick-head h3 {
  margin: 0;
}

.seg {
  display: inline-flex;
  padding: 0.15rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
}

.seg-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: 600 0.75rem var(--sans);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  cursor: pointer;
}

.seg-btn.active {
  background: var(--gold);
  color: #0a1218;
}

.pick-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
}

.grid.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.choice {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink);
  border-radius: 0.75rem;
  padding: 0.55rem 0.4rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  font: 600 0.72rem var(--sans);
  text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.choice:hover {
  background: rgba(255, 255, 255, 0.09);
}

.choice.selected {
  border-color: var(--gold);
  background: rgba(255, 214, 10, 0.12);
  box-shadow: 0 0 0 1px rgba(255, 214, 10, 0.25);
}

.choice-swatch {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  position: relative;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.15);
}

.choice-swatch.ball {
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
}

.choice-swatch.cele {
  border-radius: 0.55rem;
  display: grid;
  place-items: center;
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.locker .play {
  margin: 0.25rem auto 0;
  width: fit-content;
}

@media (max-width: 48rem) {
  .touch {
    display: flex;
  }

  .desktop-only {
    display: none;
  }

  .name {
    display: none;
  }

  .pick-row {
    grid-template-columns: 1fr;
  }

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

  .locker {
    padding: 0.75rem;
  }

  .app {
    padding-bottom: max(1.2rem, env(safe-area-inset-bottom));
  }
}

@media (prefers-reduced-motion: reduce) {
  .modal,
  .locker,
  .bar-fill,
  .play,
  .choice {
    transition: none;
  }
}

