:root {
  --bg-1: #0f0c29;
  --bg-2: #302b63;
  --bg-3: #24243e;
  --accent: #ff6a3d;
  --accent-2: #ffb800;
  --win: #38d996;
  --lose: #ff5470;
  --draw: #ffd166;
  --card: rgba(255, 255, 255, 0.06);
  --card-border: rgba(255, 255, 255, 0.12);
  --text: #f4f2ff;
  --text-dim: rgba(244, 242, 255, 0.65);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  background: linear-gradient(160deg, var(--bg-1), var(--bg-2) 55%, var(--bg-3));
  color: var(--text);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px 40px;
  overflow-x: hidden;
  position: relative;
}

.bg-orbs {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.bg-orbs span {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.35;
}
.bg-orbs span:nth-child(1) {
  width: 320px; height: 320px;
  background: var(--accent);
  top: -80px; left: -80px;
  animation: float1 14s ease-in-out infinite;
}
.bg-orbs span:nth-child(2) {
  width: 260px; height: 260px;
  background: var(--accent-2);
  bottom: -60px; right: -40px;
  animation: float2 16s ease-in-out infinite;
}
.bg-orbs span:nth-child(3) {
  width: 200px; height: 200px;
  background: #6a5cff;
  top: 40%; right: 20%;
  animation: float1 20s ease-in-out infinite reverse;
}
@keyframes float1 {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(40px, 30px); }
}
@keyframes float2 {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-30px, -40px); }
}

.app {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 560px;
  background: rgba(20, 16, 46, 0.55);
  border: 1px solid var(--card-border);
  border-radius: 24px;
  padding: 28px 24px 32px;
  backdrop-filter: blur(18px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

.app__header {
  text-align: center;
  margin-bottom: 20px;
}
.app__header h1 {
  font-size: clamp(1.3rem, 4vw, 1.9rem);
  margin: 0 0 6px;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.app__header .dot {
  color: var(--accent-2);
  padding: 0 2px;
}
.subtitle {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.95rem;
}

.score {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin: 18px 0 8px;
  position: relative;
}
.score__box {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 84px;
  padding: 10px 18px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 14px;
}
.score__label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
}
.score__value {
  font-size: 1.8rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.score__sep {
  font-size: 1.4rem;
  color: var(--text-dim);
  font-weight: 300;
}
.reset-btn {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--card-border);
  background: var(--card);
  color: var(--text);
  font-size: 1.1rem;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}
.reset-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  transform: translateY(-50%) rotate(-90deg);
}

.arena {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin: 22px 0 6px;
}
.arena__side {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.arena__caption {
  font-size: 0.8rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.arena__vs {
  font-weight: 800;
  color: var(--text-dim);
  font-size: 0.85rem;
}
.hand {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.6rem;
  background: var(--card);
  border: 2px solid var(--card-border);
  transition: transform 0.15s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.hand.shake {
  animation: shake 0.6s ease;
}
.hand.reveal {
  animation: pop 0.35s ease;
}
.hand.win {
  border-color: var(--win);
  box-shadow: 0 0 24px rgba(56, 217, 150, 0.45);
}
.hand.lose {
  border-color: var(--lose);
  box-shadow: 0 0 24px rgba(255, 84, 112, 0.4);
  opacity: 0.75;
}
.hand.draw {
  border-color: var(--draw);
  box-shadow: 0 0 24px rgba(255, 209, 102, 0.4);
}
@keyframes shake {
  0%, 100% { transform: rotate(0deg); }
  20% { transform: rotate(-12deg); }
  40% { transform: rotate(10deg); }
  60% { transform: rotate(-10deg); }
  80% { transform: rotate(8deg); }
}
@keyframes pop {
  0% { transform: scale(0.6); }
  60% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

.result {
  text-align: center;
  min-height: 1.6em;
  font-size: 1.05rem;
  font-weight: 600;
  margin: 14px 0 22px;
  transition: color 0.2s ease;
}
.result.win { color: var(--win); }
.result.lose { color: var(--lose); }
.result.draw { color: var(--draw); }

.choices {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 26px;
}
.choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 8px;
  border-radius: 16px;
  border: 1px solid var(--card-border);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease;
}
.choice:hover {
  transform: translateY(-3px);
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 106, 61, 0.6);
}
.choice:active {
  transform: translateY(0) scale(0.96);
}
.choice:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}
.choice__emoji {
  font-size: 2rem;
}
.choice__label {
  font-size: 0.8rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.history h2 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  margin: 0 0 10px;
  text-align: center;
}
.history__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 160px;
  overflow-y: auto;
}
.history__list:empty::after {
  content: "Brak rozegranych rund";
  display: block;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.85rem;
  padding: 8px 0;
}
.history__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.85rem;
}
.history__item .badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
}
.history__item .badge--win { background: rgba(56, 217, 150, 0.2); color: var(--win); }
.history__item .badge--lose { background: rgba(255, 84, 112, 0.2); color: var(--lose); }
.history__item .badge--draw { background: rgba(255, 209, 102, 0.2); color: var(--draw); }

.app__footer {
  text-align: center;
  margin-top: 24px;
  color: var(--text-dim);
  font-size: 0.75rem;
  letter-spacing: 0.5px;
}

@media (max-width: 420px) {
  .app { padding: 22px 16px 26px; }
  .hand { width: 78px; height: 78px; font-size: 2.1rem; }
  .choice__emoji { font-size: 1.7rem; }
}
