/* ═══════════════════════════════════════════════════════════
   RPS.css  —  Rock Paper Scissors Styles
   ═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=DM+Sans:wght@300;400;500;700&display=swap');

/* ── Reset & Variables ───────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg:      #0d0d0f;
  --surface: #15151a;
  --card:    #1c1c24;
  --accent:  #ff3c5f;
  --accent2: #ffcc00;
  --accent3: #00e5ff;
  --text:    #f0f0f0;
  --muted:   #555568;
  --win:     #00e5b0;
  --lose:    #ff3c5f;
  --draw:    #ffcc00;
}

/* ── Body & Background ───────────────────────────────────── */
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

/* Glow blobs */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 40% at 20% 20%, rgba(255,60,95,0.08)  0%, transparent 60%),
    radial-gradient(ellipse 50% 50% at 80% 80%, rgba(0,229,255,0.06)  0%, transparent 60%),
    radial-gradient(ellipse 40% 60% at 60% 10%, rgba(255,204,0,0.05)  0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* Grid lines */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
  z-index: 0;
}

/* ── Wrapper ─────────────────────────────────────────────── */
.game-wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 460px;
  padding: 20px;
}

/* ── Title ───────────────────────────────────────────────── */
.title-block {
  text-align: center;
  margin-bottom: 28px;
}

.title-block h1 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 3.2rem;
  letter-spacing: 0.06em;
  line-height: 1;
  background: linear-gradient(135deg, #fff 0%, #aaa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.title-block .subtitle {
  font-size: 0.72rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 4px;
}

/* ── Score Bar ───────────────────────────────────────────── */
.score-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--card);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 14px;
  padding: 14px 20px;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
}

.score-bar::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
}

.score-item { text-align: center; }

.score-label {
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}

.score-num {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 2.4rem;
  line-height: 1;
  letter-spacing: 0.04em;
  transition: transform 0.2s, color 0.3s;
}

.score-item.player   .score-num { color: var(--accent3); }
.score-item.computer .score-num { color: var(--accent); }
.score-item.draws    .score-num { color: var(--draw); font-size: 1.6rem; margin-top: 4px; }

.score-divider {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.6rem;
  color: var(--muted);
  letter-spacing: 0.1em;
}

/* ── Arena Card ──────────────────────────────────────────── */
.arena {
  background: var(--card);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 20px;
  padding: 24px;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
}

.arena::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
}

/* ── Hands Display ───────────────────────────────────────── */
.hands-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  min-height: 100px;
}

.hand-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.hand-emoji {
  font-size: 3.6rem;
  line-height: 1;
  filter: drop-shadow(0 0 20px rgba(0,0,0,0.5));
  display: block;
  min-height: 58px;
}

.hand-side.player .hand-emoji { transform: scaleX(-1); }

.hand-name {
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

.vs-badge {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.4rem;
  color: var(--muted);
  letter-spacing: 0.1em;
  flex-shrink: 0;
  padding: 0 12px;
}

/* ── Result Banner ───────────────────────────────────────── */
.result-banner {
  text-align: center;
  min-height: 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.result-text {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 2.2rem;
  letter-spacing: 0.08em;
  line-height: 1;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s, transform 0.3s;
}

.result-text.show  { opacity: 1; transform: translateY(0); }
.result-text.win   { color: var(--win); }
.result-text.lose  { color: var(--lose); }
.result-text.draw  { color: var(--draw); }

.result-detail {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 4px;
  opacity: 0;
  transition: opacity 0.4s 0.15s;
  min-height: 18px;
}

.result-detail.show { opacity: 1; }

/* ── Choice Buttons ──────────────────────────────────────── */
.choices {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 20px;
}

.choice-btn {
  flex: 1;
  aspect-ratio: 1;
  max-width: 110px;
  background: var(--surface);
  border: 1.5px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 2.4rem;
  transition: all 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
  color: white;
}

.choice-btn .choice-label {
  font-size: 0.62rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
  font-family: 'DM Sans', sans-serif;
  transition: color 0.2s;
}

.choice-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.2s;
  border-radius: inherit;
}

.choice-btn.rock::before     { background: radial-gradient(circle at center, rgba(255,60,95,0.15),  transparent 70%); }
.choice-btn.paper::before    { background: radial-gradient(circle at center, rgba(0,229,255,0.15),  transparent 70%); }
.choice-btn.scissors::before { background: radial-gradient(circle at center, rgba(255,204,0,0.15), transparent 70%); }

.choice-btn:hover               { transform: translateY(-4px) scale(1.04); border-color: rgba(255,255,255,0.25); }
.choice-btn:hover::before       { opacity: 1; }
.choice-btn:hover .choice-label { color: var(--text); }
.choice-btn:active              { transform: translateY(-1px) scale(0.98); }

.choice-btn.selected            { transform: translateY(-4px) scale(1.06); box-shadow: 0 8px 30px rgba(0,0,0,0.3); }
.choice-btn.selected::before    { opacity: 1; }
.choice-btn.rock.selected       { border-color: var(--accent);  box-shadow: 0 8px 24px rgba(255,60,95,0.25); }
.choice-btn.paper.selected      { border-color: var(--accent3); box-shadow: 0 8px 24px rgba(0,229,255,0.25); }
.choice-btn.scissors.selected   { border-color: var(--accent2); box-shadow: 0 8px 24px rgba(255,204,0,0.25); }

.choice-btn:disabled            { cursor: not-allowed; opacity: 0.5; transform: none !important; }

/* ── Timer ───────────────────────────────────────────────── */
.timer-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.timer-track {
  flex: 1;
  height: 3px;
  background: rgba(255,255,255,0.07);
  border-radius: 99px;
  overflow: hidden;
}

.timer-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent3), var(--accent));
  transition: width 1s linear, background 1s;
  width: 100%;
}

.timer-fill.urgent { background: linear-gradient(90deg, var(--accent), var(--lose)); }

.timer-num {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.1rem;
  letter-spacing: 0.1em;
  color: var(--muted);
  min-width: 28px;
  text-align: right;
  transition: color 0.3s;
}

.timer-num.urgent { color: var(--accent); }

/* ── Status Text ─────────────────────────────────────────── */
.status-text {
  text-align: center;
  font-size: 0.82rem;
  color: var(--muted);
  letter-spacing: 0.08em;
  min-height: 20px;
}

/* ── Play Again Button ───────────────────────────────────── */
.play-again-btn {
  width: 100%;
  padding: 14px;
  background: transparent;
  border: 1.5px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}

.play-again-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,60,95,0.1), rgba(0,229,255,0.1));
  opacity: 0;
  transition: opacity 0.2s;
}

.play-again-btn:hover         { border-color: rgba(255,255,255,0.3); transform: translateY(-2px); }
.play-again-btn:hover::before { opacity: 1; }
.play-again-btn:active        { transform: none; }

/* ── Streak Badge ────────────────────────────────────────── */
.streak-badge {
  position: absolute;
  top: 12px; right: 12px;
  background: rgba(255,204,0,0.15);
  border: 1px solid rgba(255,204,0,0.3);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: var(--accent2);
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.3s;
}

.streak-badge.show { opacity: 1; transform: scale(1); }

/* ── Animations ──────────────────────────────────────────── */
@keyframes bump {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.4); }
  100% { transform: scale(1); }
}
.score-num.bump { animation: bump 0.3s ease; }

@keyframes shake {
  0%, 100% { transform: scaleX(-1) translateX(0); }
  25%       { transform: scaleX(-1) translateX(-6px) rotate(-5deg); }
  75%       { transform: scaleX(-1) translateX(6px)  rotate(5deg); }
}

@keyframes shakeCPU {
  0%, 100% { transform: translateX(0); }
  25%       { transform: translateX(-6px) rotate(5deg); }
  75%       { transform: translateX(6px)  rotate(-5deg); }
}

@keyframes popIn {
  0%   { transform: scale(0.5); opacity: 0; }
  70%  { transform: scale(1.15); }
  100% { transform: scale(1);   opacity: 1; }
}

@keyframes popInFlip {
  0%   { transform: scaleX(-1) scale(0.5); opacity: 0; }
  70%  { transform: scaleX(-1) scale(1.15); }
  100% { transform: scaleX(-1) scale(1);   opacity: 1; }
}

.hand-emoji.shaking-p { animation: shake    0.4s ease infinite; }
.hand-emoji.shaking-c { animation: shakeCPU 0.4s ease infinite; }
.hand-emoji.pop       { animation: popIn     0.4s cubic-bezier(0.34, 1.56, 0.64, 1); }
.hand-side.player .hand-emoji.pop { animation: popInFlip 0.4s cubic-bezier(0.34, 1.56, 0.64, 1); }

/* ── Confetti Particles ──────────────────────────────────── */
.particle {
  position: fixed;
  pointer-events: none;
  z-index: 999;
  border-radius: 2px;
  animation: fallDown 1.2s ease-out forwards;
}

@keyframes fallDown {
  0%   { transform: translateY(-20px) rotate(0deg);   opacity: 1; }
  100% { transform: translateY(200px) rotate(720deg); opacity: 0; }
}