:root {
  --bg: #0c0820;
  --you: #38e8ff;
  --cpu: #ff5edb;
  --glass: rgba(255, 255, 255, 0.07);
  --glass-border: rgba(255, 255, 255, 0.16);
  --text: #f3eefe;
  --muted: rgba(243, 238, 254, 0.62);
  --font: "Trebuchet MS", "Segoe UI", system-ui, -apple-system, sans-serif;
}

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

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  user-select: none;
  -webkit-user-select: none;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

/* ---------- Loader ---------- */
.loader {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 40%, #2a1457, #0c0820 70%);
  transition: opacity 0.7s ease, visibility 0.7s ease;
}
.loader.hidden { opacity: 0; visibility: hidden; }
.loader__spinner {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--you);
  border-right-color: var(--cpu);
  animation: spin 0.9s linear infinite;
}
.loader__text { color: var(--muted); letter-spacing: 0.06em; font-size: 14px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- UI overlay ---------- */
.ui {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(14px, 3vw, 30px);
}
.ui button { pointer-events: auto; }
.ui__top, .ui__bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.ui__top { align-items: stretch; }

/* glass surface helper */
.topbar, .scoreboard, .status, .chip, .btn, .choice {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 16px;
  border-radius: 20px;
}
.brand__title {
  margin: 0;
  font-size: clamp(20px, 5vw, 30px);
  font-weight: 800;
  letter-spacing: 0.04em;
  background: linear-gradient(100deg, var(--you), #b388ff 50%, var(--cpu));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 14px rgba(120, 90, 255, 0.35));
}
.brand__title span { -webkit-text-fill-color: var(--text); opacity: 0.85; }
.brand__sub { margin: 2px 0 0; font-size: 12px; color: var(--muted); letter-spacing: 0.18em; text-transform: uppercase; }

.topbar__actions { display: flex; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 13px;
  border-radius: 14px;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease;
}
.chip:hover { transform: translateY(-2px); background: rgba(255, 255, 255, 0.13); }
.chip:active { transform: translateY(0) scale(0.97); }

/* scoreboard sits right under the topbar, keeping the stage clear */
.scoreboard {
  align-self: center;
  display: flex;
  gap: clamp(14px, 6vw, 46px);
  padding: 8px clamp(18px, 5vw, 34px);
  border-radius: 18px;
}
.score { display: flex; flex-direction: column; align-items: center; min-width: 56px; }
.score__tag { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.score__val { font-size: clamp(20px, 5vw, 30px); font-weight: 800; line-height: 1.05; }
.score--you .score__val { color: var(--you); text-shadow: 0 0 18px rgba(56, 232, 255, 0.5); }
.score--cpu .score__val { color: var(--cpu); text-shadow: 0 0 18px rgba(255, 94, 219, 0.5); }
.score--draw .score__val { color: var(--text); opacity: 0.8; }

.status {
  align-self: center;
  padding: 10px 22px;
  border-radius: 999px;
  font-size: clamp(14px, 4vw, 17px);
  letter-spacing: 0.02em;
  transition: transform 0.2s ease;
}
.status b { color: var(--text); }
.status--win { color: var(--you); border-color: rgba(56, 232, 255, 0.4); }
.status--lose { color: var(--cpu); border-color: rgba(255, 94, 219, 0.4); }
.status.pop { transform: scale(1.08); }
.status .vs { font-size: 1.15em; }
.status .vs i { font-style: normal; font-size: 0.75em; color: var(--muted); }

/* ---------- choice buttons ---------- */
.choices {
  display: flex;
  gap: clamp(10px, 3vw, 18px);
  transition: opacity 0.25s ease;
}
.choices--locked { opacity: 0.55; }
.choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px clamp(18px, 5vw, 30px) 10px;
  border-radius: 20px;
  color: var(--text);
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease;
}
.choice:hover:not(:disabled) {
  transform: translateY(-4px);
  background: rgba(255, 255, 255, 0.13);
  border-color: rgba(56, 232, 255, 0.45);
}
.choice:active:not(:disabled) { transform: translateY(0) scale(0.95); }
.choice:disabled { cursor: default; }
.choice__emoji {
  font-size: clamp(30px, 8vw, 42px);
  line-height: 1;
  filter: drop-shadow(0 4px 14px rgba(0, 0, 0, 0.45));
}
.choice__label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.btn {
  padding: 12px 22px;
  border-radius: 14px;
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease;
}
.btn:hover { transform: translateY(-2px); background: rgba(255, 255, 255, 0.14); }
.btn:active { transform: translateY(0) scale(0.97); }
.btn--ghost { background: transparent; box-shadow: none; border-color: rgba(255, 255, 255, 0.12); color: var(--muted); }
.btn--ghost:hover { color: var(--text); }

.hint {
  position: absolute;
  bottom: 6px;
  left: 0; right: 0;
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  opacity: 0.55;
  margin: 0;
  pointer-events: none;
}

@media (max-width: 480px) {
  .brand__sub { display: none; }
  .hint { display: none; }
  .btn--ghost { padding: 8px 16px; font-size: 13px; }
}
