:root {
  color-scheme: dark;
  --bg:
    radial-gradient(1200px 560px at 50% 0%, rgba(62, 97, 130, 0.28), transparent 60%),
    repeating-linear-gradient(
      90deg,
      rgba(56, 189, 248, 0.06) 0,
      rgba(56, 189, 248, 0.06) 120px,
      rgba(15, 23, 42, 0.82) 120px,
      rgba(15, 23, 42, 0.82) 240px
    ),
    linear-gradient(180deg, #0a1218, #0b1218 60%, #0a1117);
  --card: rgba(10, 16, 22, 0.86);
  --surface: rgba(24, 31, 41, 0.86);
  --surface-strong: rgba(30, 38, 50, 0.9);
  --border: rgba(71, 85, 105, 0.42);
  --accent: #2db5ff;
  --accent-soft: rgba(45, 181, 255, 0.17);
  --text: #d6d7d9;
  --muted: #a5a9ae;
}

body[data-theme="light"] {
  color-scheme: light;
  --bg: radial-gradient(circle at top, #e0f2fe, #dbeafe 52%, #e2e8f0 100%);
  --card: rgba(255, 255, 255, 0.88);
  --surface: rgba(241, 245, 249, 0.92);
  --surface-strong: rgba(226, 232, 240, 0.95);
  --border: rgba(100, 116, 139, 0.25);
  --accent: #0ea5e9;
  --accent-soft: rgba(14, 165, 233, 0.14);
  --text: #0f172a;
  --muted: #475569;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0.75rem;
  overflow-y: auto;
}

.app {
  width: min(920px, 100%);
  max-height: calc(100dvh - 1.5rem);
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 1.25rem;
  box-shadow: 0 20px 60px rgba(2, 6, 23, 0.4);
  backdrop-filter: blur(12px);
  overflow-y: auto;
}

.app__header {
  text-align: center;
  margin-bottom: 0.8rem;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent);
  font-weight: 700;
  font-size: 0.75rem;
}

h1 {
  margin: 0.35rem 0;
  font-size: clamp(1.45rem, 4vw, 2.4rem);
}

.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

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

.score-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.6rem;
  text-align: center;
}

.score-card h2 {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.score {
  margin: 0.2rem 0 0;
  font-size: 1.55rem;
  font-weight: 800;
}

.controls {
  margin-top: 0.75rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.control-group {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
}

.control-label {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.9rem;
}

select,
.theme-toggle {
  background: var(--surface-strong);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 0.4rem 0.65rem;
  font-weight: 700;
}

.theme-toggle {
  cursor: pointer;
}

.status {
  text-align: center;
  margin: 0.75rem 0;
  padding: 0.75rem;
  border-radius: 12px;
  background: var(--accent-soft);
  border: 1px solid color-mix(in oklab, var(--accent), #475569 40%);
}

.status__line,
.status__subline {
  margin: 0.2rem;
}

.status__line {
  font-weight: 700;
}

.status--win {
  border-color: rgba(34, 197, 94, 0.6);
  background: rgba(34, 197, 94, 0.15);
}

.status--lose {
  border-color: rgba(239, 68, 68, 0.6);
  background: rgba(239, 68, 68, 0.15);
}

.status--draw {
  border-color: rgba(148, 163, 184, 0.6);
  background: rgba(148, 163, 184, 0.15);
}

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

.choice,
.restart {
  border: 0;
  cursor: pointer;
  border-radius: 12px;
  padding: 0.85rem 0.6rem;
  font-weight: 700;
  transition: transform 0.18s ease, filter 0.2s ease;
}

.choice {
  display: grid;
  gap: 0.25rem;
  place-items: center;
  color: white;
  font-size: 1.45rem;
}

.choice span {
  font-size: 0.87rem;
}

.choice--rock { background: linear-gradient(140deg, #312dc4, #2520a5); }
.choice--paper { background: linear-gradient(140deg, #1f9fe3, #0f7db8); }
.choice--scissors { background: linear-gradient(140deg, #dd1748, #b10939); }

.choice:hover,
.restart:hover,
.theme-toggle:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

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

.history-wrap {
  margin-top: 0.75rem;
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.history-wrap h2 {
  margin: 0 0 0.45rem;
  font-size: 0.96rem;
}

.history-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.45rem;
  overflow: auto;
}

.history-list li {
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.45rem 0.6rem;
  font-size: 0.85rem;
}

.restart {
  margin-top: 0.75rem;
  width: 100%;
  background: linear-gradient(140deg, #22c55e, #15803d);
  color: white;
  display: none;
}

@media (max-width: 700px) {
  body {
    padding: 0.35rem;
  }

  .app {
    max-height: calc(100dvh - 0.7rem);
    border-radius: 16px;
    padding: 0.75rem;
  }

  .subtitle {
    font-size: 0.82rem;
  }

  .controls {
    grid-template-columns: 1fr;
    gap: 0.45rem;
  }

  .buttons {
    position: sticky;
    bottom: 0;
    background: color-mix(in oklab, var(--card), transparent 10%);
    padding-top: 0.35rem;
  }

  .history-wrap {
    margin-top: 0.55rem;
  }
}

@media (orientation: landscape) and (max-height: 560px) {
  body {
    align-items: flex-start;
    padding: 0.35rem;
  }

  .app {
    max-height: none;
    overflow: visible;
  }
}
