/* ═══════════════ RPS CLASH — Premium PVP ═══════════════ */
:root {
  --bg: #050816;
  --panel: rgba(10, 12, 30, 0.92);
  --panel-border: rgba(80, 60, 180, 0.25);
  --purple: #8b5cf6;
  --purple-light: #a78bfa;
  --gold: #f59e0b;
  --gold-light: #fbbf24;
  --green: #22c55e;
  --red: #ef4444;
  --text: #f1f5f9;
  --muted: rgba(148, 163, 184, 0.75);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Orbitron', 'Arial Black', sans-serif;
  overflow-x: hidden;
}

/* ── Fondos: lobby / arena (pantalla completa) ── */
#bg-image {
  position: fixed; inset: 0; z-index: 0;
  background: url('/games/rps-clash/static/images/bg_lobby.jpg') center/cover no-repeat;
  opacity: 1; pointer-events: none;
  transition: opacity 0.6s ease;
}
#bg-image.arena {
  background-image: url('/games/rps-clash/static/images/bg_arena.jpg');
}
#bg-overlay {
  position: fixed; inset: 0; z-index: 2;
  background: radial-gradient(ellipse at 50% 42%, rgba(10,6,30,0.15) 0%, rgba(5,8,22,0.66) 78%);
  pointer-events: none;
}
#app { position: relative; z-index: 10; min-height: 100vh; }

/* ── Layout pantalla PC ── */
.page-wrap {
  padding: 18px 22px 26px;
  max-width: 760px;
  margin: 0 auto;
  width: 100%;
}
.home-wrap { max-width: 1060px; }
.arena-wrap { max-width: 1150px; }

/* ── Home: dos columnas ── */
.home-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
  width: 100%;
}
.home-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
#home-right { gap: 10px; justify-content: center; }

/* ── Arena: juego + chat en dos columnas ── */
.arena-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: stretch;
  width: 100%;
}
.arena-grid > #arena { min-width: 0; }
#chat-area { min-width: 0; display: flex; flex-direction: column; }
#chat-area .chat-panel { flex: 1; display: flex; flex-direction: column; min-height: 0; }
#chat-area .chat-list { flex: 1; min-height: 100px; }

/* ── Paneles y botones ── */
.panel {
  background: var(--panel);
  border: 1.5px solid var(--panel-border);
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.55), inset 0 0 24px rgba(0,0,0,0.5);
  backdrop-filter: blur(6px);
}
.btn {
  font-family: 'Orbitron', sans-serif;
  font-weight: 900; letter-spacing: 2px;
  border-radius: 10px; cursor: pointer;
  border: none; transition: all 0.18s;
}
.btn:disabled { cursor: not-allowed; opacity: 0.45; }
.btn-gold {
  background: linear-gradient(135deg, #d97706, #f59e0b, #d97706);
  border: 1px solid #f59e0b; color: #1a0a00;
  box-shadow: 0 0 16px rgba(245,158,11,0.5);
}
.btn-gold:hover:not(:disabled) { transform: scale(1.02); box-shadow: 0 0 26px rgba(245,158,11,0.7); }
.btn-greenblue {
  background: linear-gradient(135deg, #059669, #10b981, #0891b2);
  border: 1px solid #10b981; color: #012;
  box-shadow: 0 0 16px rgba(16,185,129,0.5);
}
.btn-greenblue:hover:not(:disabled) { transform: scale(1.02); box-shadow: 0 0 26px rgba(16,185,129,0.7); }
.btn-purple {
  background: linear-gradient(135deg, #6d28d9, #8b5cf6, #6d28d9);
  border: 1px solid #8b5cf6; color: #fff;
  box-shadow: 0 0 14px rgba(139,92,246,0.45);
}
.btn-ghost {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(139,92,246,0.3);
  color: var(--purple-light);
}
.btn-ghost:hover:not(:disabled) { background: rgba(139,92,246,0.12); }

/* ── Radar (emparejamiento aleatorio, estilo referencia) ── */
.radar-wrap { position: relative; width: 190px; height: 190px; display:flex; align-items:center; justify-content:center; }
.radar-ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid rgba(34,197,94,0.65);
  animation: kfRadar 1.6s ease-out infinite;
}
.radar-ring.gold { border-color: rgba(245,158,11,0.65); }
@keyframes kfRadar {
  0%   { transform: scale(0.35); opacity: 0.9; }
  100% { transform: scale(1.9);  opacity: 0; }
}
.radar-core {
  width: 100px; height: 100px; border-radius: 50%;
  background: rgba(0,0,0,0.55);
  display: flex; align-items: center; justify-content: center;
  font-size: 46px;
  animation: kfGlowGreen 1.6s ease-in-out infinite;
}
.radar-core.gold { animation: kfGlowGold 1.6s ease-in-out infinite; }
@keyframes kfGlowGreen {
  0%,100% { box-shadow: 0 0 18px rgba(34,197,94,0.35), 0 0 46px rgba(34,197,94,0.12); }
  50%      { box-shadow: 0 0 30px rgba(34,197,94,0.7),  0 0 70px rgba(34,197,94,0.3); }
}
@keyframes kfGlowGold {
  0%,100% { box-shadow: 0 0 18px rgba(245,158,11,0.35), 0 0 46px rgba(245,158,11,0.12); }
  50%      { box-shadow: 0 0 30px rgba(245,158,11,0.7),  0 0 70px rgba(245,158,11,0.3); }
}

/* ── Animaciones utilitarias ── */
.anim-zoom { animation: kfZoom 0.4s cubic-bezier(.4,2,.55,.9) both; }
@keyframes kfZoom { from { transform: scale(0.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.anim-fade-up { animation: kfFadeUp 0.35s ease-out both; }
@keyframes kfFadeUp { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
.anim-spin-slow { animation: kfSpin 1.2s linear infinite; }
@keyframes kfSpin { to { transform: rotate(360deg); } }
.anim-pulse { animation: kfPulse 1s ease-in-out infinite alternate; }
@keyframes kfPulse { from { opacity: 0.55; } to { opacity: 1; } }
@keyframes kfShake {
  0%,100% { transform: translateX(0); } 20% { transform: translateX(-7px); }
  40% { transform: translateX(7px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); }
}
.shake { animation: kfShake 0.4s ease-out; }
@keyframes resultPop {
  0% { transform: scale(0.4); opacity: 0; } 60% { transform: scale(1.18); } 100% { transform: scale(1); opacity: 1; }
}
.result-pop { animation: resultPop 0.45s cubic-bezier(.4,2,.55,.9) both; }
@keyframes confettiFall {
  0% { transform: translateY(-10px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(300px) rotate(540deg); opacity: 0; }
}
@keyframes vsPulse {
  0%,100% { box-shadow: 0 0 18px rgba(139,92,246,0.5), 0 0 40px rgba(139,92,246,0.25); }
  50% { box-shadow: 0 0 30px rgba(139,92,246,0.7), 0 0 60px rgba(139,92,246,0.35); }
}
@keyframes spinBlur {
  0% { opacity: 0.3; transform: translateY(-4px) scaleY(0.92); }
  50% { opacity: 1; transform: translateY(0) scaleY(1); }
  100% { opacity: 0.3; transform: translateY(4px) scaleY(0.92); }
}
@keyframes stopPulse {
  from { box-shadow: 0 0 20px rgba(239,68,68,0.5); }
  to   { box-shadow: 0 0 40px rgba(239,68,68,0.9), 0 0 80px rgba(239,68,68,0.4); }
}
.code-letter { display:inline-block; animation: kfZoom 0.4s cubic-bezier(.4,2,.55,.9) both; }

/* ── Cartas de mano ── */
.hand-card {
  border-radius: 16px; border: 2px solid #6c3fd4;
  background: linear-gradient(160deg, rgba(18,14,45,0.98), rgba(8,6,22,0.98));
  overflow: hidden; position: relative;
  transition: transform 0.2s cubic-bezier(.4,2,.55,.9), border-color 0.35s, box-shadow 0.35s;
  box-shadow: 0 0 18px rgba(108,63,212,0.5), inset 0 0 16px rgba(0,0,0,0.6);
}
.hand-card.selectable { cursor: pointer; }
.hand-card.selectable:hover { transform: scale(1.07); }
.hand-card.selected { transform: scale(1.06); }
.hand-card img { width: 82%; height: 82%; object-fit: contain; }
.hand-card .spin-img { animation: spinBlur 0.12s steps(1) infinite; }
.hand-card .card-img-area {
  display:flex; align-items:center; justify-content:center; overflow:hidden; position:relative;
}
.hand-card .card-label {
  border-top: 1px solid rgba(139,92,246,0.27);
  padding: 6px 4px; text-align: center;
  background: linear-gradient(180deg, rgba(0,0,0,0.4), rgba(0,0,0,0.7));
  font-size: 10px; font-weight: 900; letter-spacing: 2px;
  color: var(--purple-light);
}
.hand-card.b-green { border-color: #22c55e; box-shadow: 0 0 18px rgba(34,197,94,0.4), inset 0 0 16px rgba(0,0,0,0.6); }
.hand-card.b-red   { border-color: #ef4444; box-shadow: 0 0 18px rgba(239,68,68,0.4), inset 0 0 16px rgba(0,0,0,0.6); }
.hand-card.b-green .card-label { color: var(--green); }
.hand-card.b-red   .card-label { color: var(--red); }
.hand-card.flipped .card-img-area img { transform: scaleX(-1); }

/* ── Avatares ── */
.avatar-circle {
  border-radius: 50%; border: 2px solid var(--purple);
  box-shadow: 0 0 12px rgba(139,92,246,0.55);
  overflow: hidden; background: rgba(30,15,70,0.9);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.avatar-circle img { width: 100%; height: 100%; object-fit: cover; }
.avatar-circle.g-green { border-color: var(--green); box-shadow: 0 0 12px rgba(34,197,94,0.55); }
.avatar-circle .avatar-initial {
  font-weight: 900; color: #fff; font-family: 'Orbitron', sans-serif;
}

/* ── Chips de apuesta ── */
.bet-chip {
  flex: 1; padding: 9px 0; border-radius: 7px;
  background: rgba(20,15,50,0.8);
  border: 1px solid rgba(139,92,246,0.25);
  color: rgba(200,180,255,0.6);
  font-family: 'Orbitron', sans-serif; font-size: 11px; font-weight: 700;
  cursor: pointer; transition: all .15s;
}
.bet-chip.on {
  background: linear-gradient(135deg, #d97706, #f59e0b, #d97706);
  border-color: #f59e0b; color: #1a0a00;
  box-shadow: 0 0 10px rgba(245,158,11,0.4);
}

/* ── Botones de modo (home) ── */
.mode-btn {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 14px; text-align: left;
  border-radius: 14px; cursor: pointer;
  background: var(--panel);
  border: 1.5px solid var(--panel-border);
  color: var(--text); transition: all .18s;
}
.mode-btn:hover { border-color: rgba(139,92,246,0.6); box-shadow: 0 0 18px rgba(139,92,246,0.25); transform: translateY(-1px); }
.mode-btn .chev { color: var(--gold); font-size: 18px; transition: transform .25s; }
.mode-btn .chev.open { transform: rotate(90deg); }
.mode-icon {
  width: 46px; height: 46px; border-radius: 12px; flex-shrink: 0;
  background: rgba(245,158,11,0.1); display: flex; align-items: center; justify-content: center; font-size: 22px;
}

/* ── Chat ── */
.chat-panel {
  border: 1px solid rgba(245,158,11,0.27);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(2,6,23,.82), rgba(2,6,23,.95));
  box-shadow: 0 0 20px rgba(245,158,11,0.09);
  padding: 12px;
}
.chat-list { height: 150px; overflow-y: auto; display: flex; flex-direction: column; gap: 7px; padding-right: 4px; margin-bottom: 9px; scrollbar-width: thin; }
.chat-msg { max-width: 88%; border-radius: 13px; padding: 7px 10px; font-size: 12px; line-height: 1.3; font-weight: 600; font-family: Arial, sans-serif; }
.chat-msg.me { align-self: flex-end; border: 1px solid rgba(245,158,11,0.2); background: rgba(245,158,11,0.12); color: #fef3c7; }
.chat-msg.rival { align-self: flex-start; border: 1px solid rgba(148,163,184,0.16); background: rgba(15,23,42,0.72); color: #e2e8f0; }
.chat-msg .who { display: block; font-size: 8px; opacity: 0.62; font-weight: 900; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 2px; font-family: 'Orbitron', sans-serif; }
.chat-input {
  flex: 1; min-width: 0; border: 1px solid rgba(245,158,11,0.2); border-radius: 12px;
  padding: 10px; background: rgba(0,0,0,0.35); color: #fff7d6; outline: none;
  font-weight: 600; font-size: 13px; font-family: Arial, sans-serif;
}
.emoji-btn {
  border: 1px solid rgba(245,158,11,0.18); border-radius: 10px;
  background: rgba(255,255,255,0.055); font-size: 17px; padding: 5px 8px; cursor: pointer;
  transition: transform .12s;
}
.emoji-btn:hover { transform: scale(1.2); }
.quick-note {
  border: 1px solid rgba(245,158,11,0.18); border-radius: 11px;
  background: rgba(255,255,255,0.055); color: #fde68a;
  padding: 7px 8px; font-size: 11px; font-weight: 900; cursor: pointer;
  font-family: 'Orbitron', sans-serif;
}

/* ── Inputs ── */
.code-input {
  width: 100%; padding: 13px 0;
  background: rgba(10,8,30,0.9); border: 2px solid rgba(245,158,11,0.35);
  border-radius: 10px; color: var(--gold);
  font-family: 'Orbitron', sans-serif; font-size: 24px; font-weight: 900;
  text-align: center; letter-spacing: 12px; outline: none; text-transform: uppercase;
}
.code-input:focus { border-color: rgba(245,158,11,0.7); }
.name-input {
  width: 100%; padding: 12px;
  background: rgba(10,8,30,0.9); border: 2px solid rgba(139,92,246,0.35);
  border-radius: 10px; color: #fff; font-family: 'Orbitron', sans-serif;
  font-size: 15px; text-align: center; outline: none;
}
.name-input:focus { border-color: rgba(139,92,246,0.75); }

/* ── Toast ── */
#toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
  z-index: 100; border-radius: 12px; background: rgba(0,0,0,0.88);
  padding: 11px 18px; font-size: 13px; font-weight: 700; color: #ffe9a8;
  box-shadow: 0 8px 30px rgba(0,0,0,0.6), inset 0 0 0 1px rgba(245,158,11,0.35);
  font-family: 'Orbitron', sans-serif;
}

/* ── Layout ── */
.screen { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 20px; max-width: 620px; margin: 0 auto; width: 100%; }
.screen.wide { max-width: 780px; }
.title-xs { font-size: 9px; letter-spacing: 3px; color: var(--muted); font-weight: 700; }
.spinner {
  display: inline-block; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(245,158,11,0.3); border-top-color: var(--gold);
  animation: kfSpin 1s linear infinite;
}
.dot-green {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  background: var(--green); box-shadow: 0 0 8px var(--green);
}
.hud-coin {
  display: flex; align-items: center; gap: 6px;
  background: rgba(15,10,40,0.85); border: 1px solid rgba(245,158,11,0.27);
  border-radius: 20px; padding: 6px 14px;
  box-shadow: 0 0 12px rgba(245,158,11,0.15);
}
.vs-circle {
  border-radius: 50%; flex-shrink: 0;
  border: 2.5px solid var(--purple);
  background: radial-gradient(circle, rgba(109,40,217,0.25), transparent);
  display: flex; align-items: center; justify-content: center;
  animation: vsPulse 2s ease-in-out infinite;
  font-weight: 900; color: var(--purple-light);
  text-shadow: 0 0 16px var(--purple);
}
.countdown-num { font-size: 22px; font-weight: 900; }
.stop-btn {
  padding: 14px 30px; border-radius: 12px;
  background: linear-gradient(135deg, #991b1b, #dc2626, #991b1b);
  border: 2px solid #ef4444; color: #fff;
  font-family: 'Orbitron', sans-serif; font-size: 14px; font-weight: 900; letter-spacing: 3px;
  cursor: pointer; animation: stopPulse 0.9s ease-in-out infinite alternate;
  transition: all 0.15s;
}
.stop-btn:hover { transform: scale(1.06); background: linear-gradient(135deg, #dc2626, #ef4444, #dc2626); }
.url-box {
  width: 100%; word-break: break-all; border-radius: 12px;
  background: rgba(0,0,0,0.4); padding: 10px 12px; text-align: center;
  font-size: 11px; color: #b0a284; font-family: monospace;
  border: 1px solid rgba(245,158,11,0.15);
}

@media (max-width: 420px) {
  .code-input { font-size: 19px; letter-spacing: 8px; }
}

/* ── PC: dos columnas ── */
@media (min-width: 900px) {
  .home-grid { grid-template-columns: 1.08fr 1fr; gap: 30px; align-items: center; }
  .arena-grid { grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr); }
  #chat-area .chat-list { height: auto; }
  .mode-btn { padding: 16px; }
}

/* ── PC: bloquear scroll — todo cabe en una pantalla ── */
@media (min-width: 900px) and (min-height: 600px) {
  html, body { height: 100%; overflow: hidden; }
  #app { height: 100vh; overflow: hidden; }
  .page-wrap {
    height: 100vh;
    display: flex; flex-direction: column;
    justify-content: center;
    justify-content: safe center;
    padding: 12px 28px 16px;
    overflow-y: auto; /* red de seguridad si algo excede la altura */
    scrollbar-width: none;
  }
  .page-wrap::-webkit-scrollbar { display: none; }
  .screen {
    height: 100vh; min-height: 0;
    justify-content: safe center;
    overflow-y: auto;
    scrollbar-width: none;
    padding: 14px 20px;
  }
  .screen::-webkit-scrollbar { display: none; }
}

/* Alturas justas en PC: compactar un poco más */
@media (min-width: 900px) and (min-height: 600px) and (max-height: 760px) {
  .page-wrap { padding: 8px 28px 10px; }
  .home-grid { gap: 22px; }
  .mode-btn { padding: 12px 14px; }
  .mode-icon { width: 40px; height: 40px; font-size: 19px; }
  #chat-area .chat-list { min-height: 70px; }
}
