:root {
  --page-bg: #19191d;
  --card-bg: #323338;
  --text: #f2f4ff;
  --muted: #c4c7d5;
  --accent: #2f64d1;
  --accent-strong: #1f4fb4;
  --win: #6d8cff;
  --danger: #ef4444;
  --shadow: rgba(0, 0, 0, 0.26);
}

body.light-theme {
  --page-bg: #ededee;
  --card-bg: #f8f8f8;
  --text: #0b145d;
  --muted: #4b5563;
  --accent: #ef4444;
  --accent-strong: #dc2626;
  --win: #ef4444;
  --danger: #ef4444;
  --shadow: rgba(15, 23, 42, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  font-family: Arial, sans-serif;
  background: var(--page-bg);
  color: var(--text);
  transition: background 0.2s ease, color 0.2s ease;
}

.rps-shell {
  width: min(96vw, 820px);
}

.rps-card {
  position: relative;
  min-height: 560px;
  padding: 24px 28px 22px;
  border-radius: 18px;
  background: var(--card-bg);
  box-shadow: 0 18px 36px var(--shadow);
}

.theme-toggle {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  font-size: 1.6rem;
  cursor: pointer;
}

.start-section {
  min-height: 460px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
}

.start-section h1 {
  margin: 0;
  font-size: clamp(1.7rem, 3vw, 2.35rem);
  line-height: 1.1;
}

.play-btn {
  min-width: 120px;
  padding: 16px 24px;
  border: none;
  border-radius: 10px;
  background: var(--danger);
  color: white;
  font-size: 1.15rem;
  font-weight: 800;
  cursor: pointer;
}

.game-section {
  text-align: center;
}

.game-section[hidden] {
  display: none !important;
}

.game-title {
  margin: 0;
  font-size: clamp(1.5rem, 2.2vw, 2rem);
  text-align: left;
}

.reset-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 14px auto 18px;
  padding: 10px 18px;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: white;
  font-weight: 800;
  cursor: pointer;
}

.reset-btn[hidden] {
  display: none !important;
}

.scoreboard {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 8px;
}

.score-item {
  flex: 1;
  text-align: left;
}

.score-item:last-child {
  text-align: right;
}

.score-item span {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
}

.score-item strong {
  display: block;
  margin-top: 6px;
  font-size: 2rem;
  color: var(--text);
}

.result-text {
  min-height: 48px;
  margin: 12px 0 16px;
  font-size: clamp(1.35rem, 2.4vw, 2rem);
  color: var(--win);
}

.result-text.player {
  color: var(--win);
}

.result-text.computer {
  color: var(--win);
}

.result-text.draw {
  color: var(--text);
}

.result-text.match-win {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 18px;
  border-radius: 12px;
  background: #22c55e;
  color: #052e16;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.18);
}

.battle-area {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  margin: 10px 0 18px;
}

.move-box {
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.move-icon {
  font-size: 4rem;
}

.vs-text {
  font-weight: 800;
}

.helper-text {
  margin: 0 0 14px;
  color: var(--muted);
}

.choices {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}

.choice-btn,
.home-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 120px;
  padding: 12px 18px;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: white;
  text-decoration: none;
  font-weight: 800;
  cursor: pointer;
}

.choice-btn:hover,
.play-btn:hover,
.home-link:hover,
.reset-btn:hover,
.theme-toggle:hover {
  filter: brightness(1.04);
}

.choice-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.home-link {
  margin-top: 22px;
  background: transparent;
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

@media (max-width: 700px) {
  .rps-card {
    min-height: auto;
    padding: 20px 16px;
  }

  .start-section {
    min-height: 380px;
    flex-direction: column;
    text-align: center;
  }

  .game-title {
    text-align: center;
    padding-right: 40px;
  }

  .scoreboard {
    flex-direction: column;
    align-items: center;
  }

  .score-item,
  .score-item:last-child {
    text-align: center;
  }

  .battle-area {
    gap: 12px;
  }

  .move-box {
    width: 84px;
    height: 84px;
  }

  .move-icon {
    font-size: 3rem;
  }
}
