:root {
  --bg: #0f1115;
  --panel: #1b1f27;
  --panel-alt: #242b37;
  --text: #f5f7fa;
  --accent: #4f9cff;
  --accent-glow: 185 100% 60%;
  --win: #3ecf8e;
  --lose: #ff4d61;
  --draw: #ffc247;
  --focus: #ffe66d;
  --radius: 14px;
  --transition: 140ms ease;
  font-size: 16px;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Arial, sans-serif;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f7fb;
    --panel: #ffffff;
    --panel-alt: #eef2f7;
    --text: #1d232b;
  }
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  background: radial-gradient(circle at 40% 25%, #1d2330, var(--bg));
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  padding: 1.2rem clamp(1rem, 4vw, 2rem);
  text-align: center;
  background: linear-gradient(90deg, var(--panel) 0%, var(--panel-alt) 100%);
  box-shadow: 0 2px 8px -2px rgba(0,0,0,.4);
}

h1 {
  margin: 0;
  font-size: clamp(1.7rem, 4.5vw, 2.6rem);
  letter-spacing: 2px;
  background: linear-gradient(90deg, #75b7ff, #c7e6ff);
  -webkit-background-clip: text;
  color: transparent;
}

main {
  width: min(1100px, 100%);
  margin-inline: auto;
  padding: 1.2rem clamp(1rem, 4vw, 2rem) 3rem;
  display: grid;
  gap: 2rem;
}

.scoreboard {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  padding: 1rem 1.25rem;
  background: var(--panel);
  border-radius: var(--radius);
  align-items: center;
  justify-content: flex-start;
  box-shadow: 0 4px 16px -8px rgba(0,0,0,.5);
  position: relative;
}

.scoreboard > div {
  font-weight: 600;
  font-size: 1rem;
}

.scoreboard .you span {
  color: var(--win);
}
.scoreboard .cpu span {
  color: var(--lose);
}

.range-label {
  display: inline-block;
  margin-left: .5rem;
}

input[type=range] {
  width: 130px;
  cursor: pointer;
}

.arena {
  background: var(--panel);
  border-radius: var(--radius);
  padding: clamp(1rem, 2.7vw, 2rem);
  display: grid;
  gap: 1.25rem;
  box-shadow: 0 4px 16px -8px rgba(0,0,0,.5);
}

.choices {
  display: flex;
  gap: clamp(.75rem, 2vw, 1.5rem);
  flex-wrap: wrap;
  justify-content: center;
}

.choice {
  --size: clamp(110px, 22vw, 160px);
  width: var(--size);
  aspect-ratio: 1/1.05;
  border: none;
  border-radius: 22px;
  background: linear-gradient(160deg, var(--panel-alt), #2c3645);
  color: var(--text);
  font-size: 1rem;
  font-weight: 600;
  position: relative;
  display: grid;
  place-items: center;
  gap: .25rem;
  cursor: pointer;
  box-shadow: 0 3px 8px -3px rgba(0,0,0,.6), 0 0 0 0 rgba(255,255,255,0);
  transition: transform var(--transition), box-shadow var(--transition), background 400ms ease;
  isolation: isolate;
  padding: .5rem .75rem 1.25rem;
}

.choice .emoji {
  font-size: clamp(2.2rem, 6vw, 3.4rem);
  filter: drop-shadow(0 4px 6px rgba(0,0,0,.4));
  transition: transform 220ms ease;
}

.choice .label {
  font-size: .9rem;
  letter-spacing: .5px;
  opacity: .85;
}

.choice kbd {
  position: absolute;
  bottom: 6px;
  font-size: .65rem;
  background: rgba(255,255,255,.08);
  padding: 2px 6px 3px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,.15);
  font-weight: 500;
  letter-spacing: .5px;
}

.choice:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.choice:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 18px -6px rgba(0,0,0,.65), 0 0 0 2px rgba(255,255,255,.05);
}

.choice:active {
  transform: translateY(2px) scale(.96);
}

.choice:hover .emoji {
  transform: translateY(-4px) scale(1.05);
}

.status {
  display: grid;
  gap: 1rem;
  justify-items: center;
  text-align: center;
}

.last-result {
  min-height: 3.2rem;
  font-size: clamp(1.15rem, 2.2vw, 1.8rem);
  font-weight: 600;
  letter-spacing: 1px;
  background: linear-gradient(90deg, #ffffff, #a2c8ff);
  -webkit-background-clip: text;
  color: transparent;
  filter: drop-shadow(0 6px 14px rgba(0,0,0,.55));
  animation: fadeIn 300ms ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.selections {
  display: flex;
  gap: clamp(1.5rem, 4vw, 3.5rem);
  flex-wrap: wrap;
  font-size: .95rem;
  background: linear-gradient(145deg,#222b37,#1c222d);
  padding: .9rem 1.15rem;
  border-radius: 14px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.04), 0 4px 14px -8px rgba(0,0,0,.6);
}

.selections .pick {
  font-weight: 600;
  color: var(--accent);
  text-shadow: 0 2px 4px rgba(0,0,0,.5);
}

.controls {
  display: flex;
  gap: .8rem;
  flex-wrap: wrap;
  justify-content: center;
}

.controls button {
  padding: .75rem 1.1rem;
  border: none;
  border-radius: 12px;
  background: linear-gradient(160deg,#2d3745,#1f2732);
  color: var(--text);
  font-weight: 600;
  letter-spacing: .5px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: background 300ms ease, transform 120ms ease, box-shadow 160ms ease;
  box-shadow: 0 4px 10px -4px rgba(0,0,0,.6);
}

.controls button.secondary {
  background: linear-gradient(150deg,#29313d,#202832);
}

.controls button:hover:not(:disabled) {
  background: linear-gradient(160deg,#354154,#26303d);
  transform: translateY(-3px);
  box-shadow: 0 8px 16px -6px rgba(0,0,0,.7);
}

.controls button:active:not(:disabled) {
  transform: translateY(1px) scale(.97);
}

.controls button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.history {
  background: var(--panel);
  padding: 1rem 1.2rem 1.4rem;
  border-radius: var(--radius);
  box-shadow: 0 4px 16px -8px rgba(0,0,0,.5);
  max-height: 320px;
  overflow-y: auto;
}

.history h2 {
  margin-top: 0;
  font-size: 1.15rem;
  letter-spacing: .5px;
}

#historyList {
  margin: .6rem 0 0;
  padding-left: 1.2rem;
  display: grid;
  gap: .35rem;
  font-size: .85rem;
  list-style: decimal;
}

#historyList li {
  background: linear-gradient(130deg,#222b36,#1b212a);
  padding: .45rem .6rem;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  line-height: 1.3;
  border: 1px solid rgba(255,255,255,.04);
}

#historyList li.win { border-color: rgba(62,207,142,.35); }
#historyList li.lose { border-color: rgba(255,77,97,.35); }
#historyList li.draw { border-color: rgba(255,194,71,.35); }

.badge {
  font-size: .6rem;
  padding: .25rem .5rem .3rem;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
  background: #ffffff10;
}

.win-badge { background: linear-gradient(140deg,#29d37c,#49f3cb); color:#072b1a; }
.lose-badge { background: linear-gradient(140deg,#ff3f5d,#ff9ca9); color:#3b0410; }
.draw-badge { background: linear-gradient(140deg,#ffc247,#ffe08d); color:#422c01; }

footer {
  text-align: center;
  padding: 2rem 1rem 3rem;
  font-size: .85rem;
  opacity: .75;
  margin-top: auto;
}

.small { font-size: .75rem; opacity: .6; }

.win-text {
  background: linear-gradient(90deg,#3ecf8e,#8fffd0);
  -webkit-background-clip: text;
  color: transparent;
}

.lose-text {
  background: linear-gradient(90deg,#ff4d61,#ff97a3);
  -webkit-background-clip: text;
  color: transparent;
}

.draw-text {
  background: linear-gradient(90deg,#ffc247,#ffe39d);
  -webkit-background-clip: text;
  color: transparent;
}

.game-over {
  animation: pulse 1300ms ease-in-out infinite;
}

@keyframes pulse {
  0%,100% { filter: drop-shadow(0 0 6px rgba(255,255,255,.15)); }
  50% { filter: drop-shadow(0 0 22px rgba(255,255,255,.35)); }
}

::-webkit-scrollbar {
  width: 10px;
}
::-webkit-scrollbar-track {
  background: #12161d;
}
::-webkit-scrollbar-thumb {
  background: #2b313b;
  border-radius: 6px;
  border: 2px solid #12161d;
}
::-webkit-scrollbar-thumb:hover {
  background: #39424f;
}

@media (max-width: 720px) {
  main {
    padding-bottom: 5rem;
  }
  .selections {
    justify-content: center;
  }
  .scoreboard {
    justify-content: space-between;
  }
}