.rps-body .rps-game-panel {
  position: relative;
  overflow: hidden;
}

.choice-picker {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  border: 0;
}

.choice-picker legend {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.choice-picker input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.choice-tile {
  display: grid;
  align-content: center;
  gap: 0.18rem;
  min-height: 3.6rem;
  padding: 0.55rem;
  border: 1px solid #335368;
  border-radius: 0.45rem;
  background: #0d202b;
  color: #dcecf4;
  cursor: pointer;
}

.choice-tile strong,
.choice-tile small {
  display: block;
  overflow-wrap: anywhere;
}

.choice-tile strong {
  font-size: 0.92rem;
  font-weight: 950;
}

.choice-tile small {
  color: #adc7d4;
  font-size: 0.65rem;
  font-weight: 800;
}

.choice-picker input:focus-visible + .choice-tile {
  outline: 3px solid rgba(111, 194, 255, 0.8);
  outline-offset: 2px;
}

.choice-picker input:checked + .choice-tile.rock {
  border-color: #aab6c3;
  background: #31424f;
  color: #ffffff;
}

.choice-picker input:checked + .choice-tile.paper {
  border-color: #1fd6a2;
  background: #104b42;
  color: #ecfff9;
}

.choice-picker input:checked + .choice-tile.scissors {
  border-color: #ffb02e;
  background: #4d3410;
  color: #fff5df;
}

.profit-card {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem;
  border-radius: 0.45rem;
  background: #142f3d;
}

.profit-card span {
  color: #bdd2de;
}

.rps-stage-surface {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 1rem;
  min-height: 31rem;
  overflow: hidden;
  border-radius: 0.45rem;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    #061b25;
  background-size: 4.5rem 4.5rem;
}

.rps-matchup {
  display: grid;
  grid-template-columns: minmax(7rem, 10rem) auto minmax(7rem, 10rem);
  align-items: center;
  gap: 1rem;
  width: min(32rem, calc(100% - 2rem));
}

.versus {
  display: grid;
  place-items: center;
  width: 2.5rem;
  aspect-ratio: 1;
  border-radius: 999px;
  background: #173544;
  color: #dcecf4;
  font-size: 0.78rem;
  font-weight: 950;
  text-transform: uppercase;
}

.rps-hand {
  position: relative;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 0.35rem;
  min-height: 10rem;
  padding: 1rem;
  border: 0.14rem solid #335368;
  border-radius: 0.55rem;
  background: #17313f;
  box-shadow: 0 1rem 2rem rgba(0, 0, 0, 0.28);
}

.rps-hand.player {
  border-color: #1fd6a2;
}

.rps-hand.opponent {
  border-color: #80a4b8;
}

.rps-hand.win {
  border-color: #16e06f;
  box-shadow: 0 0 0 0.18rem rgba(22, 224, 111, 0.25);
}

.rps-hand.draw {
  border-color: #ffb02e;
  box-shadow: 0 0 0 0.18rem rgba(255, 176, 46, 0.22);
}

.rps-hand.loss {
  border-color: #ff2d59;
  box-shadow: 0 0 0 0.18rem rgba(255, 45, 89, 0.2);
}

.hand-owner {
  color: #a9c1cc;
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.rps-hand strong {
  color: #ffffff;
  font-size: 1.2rem;
  line-height: 1.1;
}

.hand-code {
  display: grid;
  place-items: center;
  width: 4.2rem;
  aspect-ratio: 1;
  border-radius: 0.6rem;
  background: #203b4a;
  color: #ffffff;
  font-size: 1.35rem;
  font-weight: 950;
  letter-spacing: 0;
}

.rps-hand.rock .hand-code {
  background: #647684;
  color: #08121a;
}

.rps-hand.paper .hand-code {
  background: #1fd6a2;
  color: #031f18;
}

.rps-hand.scissors .hand-code {
  background: #ffb02e;
  color: #251500;
}

.rps-hand.waiting .hand-code {
  background: #2d4555;
  color: #b9d0da;
}

.rps-status {
  display: grid;
  justify-items: center;
  gap: 0.25rem;
  text-align: center;
  width: min(34rem, calc(100% - 2rem));
}

.rps-status strong {
  color: #ffffff;
  font-size: 2.2rem;
  line-height: 1;
}

.rps-status span {
  color: #bad0db;
  font-weight: 850;
}

.rps-round-history {
  display: grid;
  grid-template-columns: repeat(20, 1fr);
  gap: 0.32rem;
  width: min(36rem, calc(100% - 2rem));
  padding: 0.55rem;
  border-radius: 0.45rem;
  background: #0d2532;
}

.rps-round-slot {
  display: grid;
  place-items: center;
  min-width: 0;
  aspect-ratio: 1;
  border-radius: 0.22rem;
  background: #17313f;
  color: #9cb9c7;
  font-size: 0.65rem;
  font-weight: 950;
}

.rps-round-slot.win {
  background: #16e06f;
  color: #03150b;
}

.rps-round-slot.draw {
  background: #ffb02e;
  color: #251500;
}

.rps-round-slot.loss {
  background: #ff2d59;
  color: #ffffff;
}

.rps-auto-mode .rps-matchup,
.rps-auto-mode .rps-status,
.rps-auto-mode .rps-round-history {
  display: none;
}

.rps-auto-mode .rps-stage-surface {
  align-content: center;
  gap: 1.25rem;
}

.rps-auto-plan-board[hidden],
.auto-plan-summary[hidden] {
  display: none;
}

.rps-auto-plan-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(4.8rem, 5.7rem));
  justify-content: center;
  align-items: center;
  gap: 1.55rem 1rem;
  width: min(42rem, calc(100% - 2rem));
  margin-block: 1rem 0.25rem;
}

.rps-plan-choice {
  position: relative;
  display: grid;
  place-items: center;
  width: 5.7rem;
  aspect-ratio: 1;
  border: 0.12rem solid #335368;
  border-radius: 0.5rem;
  background: #294555;
  color: #ffffff;
  cursor: pointer;
  transition: border-color 0.16s ease, transform 0.16s ease;
}

.rps-plan-choice:hover:not(:disabled) {
  border-color: #7eb9d4;
  transform: translateY(-0.08rem);
}

.rps-plan-choice:focus-visible {
  outline: 3px solid rgba(111, 194, 255, 0.8);
  outline-offset: 2px;
}

.rps-plan-choice:disabled {
  cursor: default;
}

.rps-plan-badge {
  position: absolute;
  top: -0.78rem;
  right: 0.14rem;
  z-index: 2;
  display: grid;
  place-items: center;
  min-width: 1.6rem;
  height: 1rem;
  padding-inline: 0.35rem;
  border-radius: 999px;
  background: #435b6d;
  color: #f0f7fb;
  font-size: 0.67rem;
  font-weight: 950;
  line-height: 1;
}

.rps-plan-code,
.rps-plan-result {
  display: grid;
  place-items: center;
  border-radius: 0.45rem;
  font-weight: 950;
}

.rps-plan-code {
  width: 3.9rem;
  aspect-ratio: 1;
  font-size: 1.2rem;
}

.rps-plan-choice.rock .rps-plan-code,
.rps-plan-result.rock {
  background: #647684;
  color: #08121a;
}

.rps-plan-choice.paper .rps-plan-code,
.rps-plan-result.paper {
  background: #1fd6a2;
  color: #031f18;
}

.rps-plan-choice.scissors .rps-plan-code,
.rps-plan-result.scissors {
  background: #ffb02e;
  color: #251500;
}

.rps-plan-choice.revealed {
  border-width: 0.18rem;
}

.rps-plan-choice.revealed .rps-plan-code {
  position: absolute;
  top: 0.35rem;
  left: 0.35rem;
  width: 2.2rem;
  opacity: 0.76;
  font-size: 0.78rem;
}

.rps-plan-result {
  position: absolute;
  right: 0.08rem;
  bottom: 0.08rem;
  width: 4rem;
  aspect-ratio: 1;
  font-size: 1rem;
}

.rps-plan-choice.win {
  border-color: #16e06f;
}

.rps-plan-choice.draw {
  border-color: #ffb02e;
}

.rps-plan-choice.loss {
  border-color: #ff2d59;
}

.rps-plan-choice.win .rps-plan-badge {
  background: #16e06f;
  color: #03150b;
}

.rps-plan-choice.draw .rps-plan-badge {
  background: #ffb02e;
  color: #251500;
}

.rps-plan-choice.loss .rps-plan-badge {
  background: #ff2d59;
  color: #ffffff;
}

.auto-plan-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  width: min(42rem, calc(100% - 2rem));
  padding: 0.8rem;
  border-radius: 0.45rem;
  background: #173544;
}

.auto-plan-summary > div {
  display: grid;
  gap: 0.4rem;
}

.auto-plan-summary > div > strong {
  display: block;
  min-height: 2.5rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid #335368;
  border-radius: 0.35rem;
  background: #09202b;
  color: #f8fbff;
  font-size: 0.9rem;
}

.rps-recent-results .recent-chip.win {
  background: #16e06f;
  color: #03150b;
}

.rps-recent-results .recent-chip.draw {
  background: #ffb02e;
  color: #251500;
}

.rps-recent-results .recent-chip.loss {
  background: #ff2d59;
  color: #ffffff;
}

@media (max-width: 780px) {
  .choice-picker {
    grid-template-columns: 1fr;
  }

  .choice-tile {
    min-height: 3rem;
  }

  .rps-stage-surface {
    min-height: 27rem;
  }

  .rps-matchup {
    grid-template-columns: 1fr;
    justify-items: center;
    width: min(22rem, calc(100% - 2rem));
  }

  .versus {
    width: 2rem;
  }

  .rps-hand {
    width: 100%;
    min-height: 7.4rem;
  }

  .hand-code {
    width: 3.2rem;
    font-size: 1rem;
  }

  .rps-round-history {
    gap: 0.22rem;
  }

  .rps-round-slot {
    font-size: 0.52rem;
  }

  .rps-auto-plan-board {
    grid-template-columns: repeat(auto-fit, minmax(4.3rem, 4.8rem));
    gap: 1.35rem 0.75rem;
  }

  .rps-plan-choice {
    width: 4.8rem;
  }

  .rps-plan-code {
    width: 3.35rem;
  }

  .rps-plan-result {
    width: 3.35rem;
  }

  .auto-plan-summary {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rps-plan-choice,
  .rps-hand {
    transition: none;
  }
}
