/* ==================================================================
   COLOR MEMORY — Casino Online 1vs1
   Sistema visual premium (estilo Crown Sequence) adaptado a colores.
   Responsive: desktop-first con adaptación a tablet y móvil.
   ================================================================== */

:root {
  --gold: #ffd76a;
  --gold-deep: #e8a013;
  --gold-soft: #ffe9a8;
  --ink: #07060e;
  --paper: #f3ead8;
  --muted: #b9a98a;
  --dim: #8d8168;
  --c-blue: #3b82f6;
  --c-red: #ef4444;
  --c-yellow: #facc15;
  --c-green: #22c55e;
  --c-purple: #a855f7;
}

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

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

body {
  background: var(--ink);
  color: var(--paper);
  font-family: 'Outfit', system-ui, sans-serif;
  overflow: hidden; /* pantalla completa: sin scroll del navegador */
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.font-display, .logo-title, .room-code-big, .result-money, .pot-v, .stat-v, h2 { font-family: 'Cinzel', serif; }

/* ---------- textos premium ---------- */
.gold-text {
  background: linear-gradient(180deg, #fff6d8 0%, #ffd76a 38%, #c9861a 72%, #ffe9a8 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.shimmer-text {
  background: linear-gradient(100deg, #c9861a 20%, #fff6d8 40%, #ffd76a 50%, #c9861a 65%);
  background-size: 220% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: kf-shimmer 3.2s linear infinite;
}

/* ---------- fondo de escenario ---------- */
.stage-bg {
  background:
    linear-gradient(180deg, rgba(7,6,14,0.62) 0%, rgba(7,6,14,0.40) 38%, rgba(7,6,14,0.84) 100%),
    url('assets/bg-wide.jpg') center / cover no-repeat fixed,
    #07060e;
}
.vignette::after {
  content: '';
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(115% 100% at 50% 45%, rgba(0,0,0,0) 52%, rgba(0,0,0,0.58) 100%);
}

/* polvo dorado ambiental */
.ambient-dust { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.ambient-dust span {
  position: absolute; border-radius: 50%;
  width: 3px; height: 3px; background: #ffd76a; opacity: 0;
  animation: kf-drift linear infinite;
}

/* ---------- canvas FX global ---------- */
.fx-canvas { position: fixed; inset: 0; z-index: 90; pointer-events: none; width: 100%; height: 100%; }

/* ---------- pantallas ---------- */
.screen { display: none; }
.screen.active { display: block; }
.screen-inner {
  position: relative;
  height: 100dvh;
  overflow: hidden;
  display: flex; flex-direction: column;
  padding: clamp(12px, 2vw, 28px) clamp(14px, 3vw, 44px);
}
.screen-inner.center { align-items: center; justify-content: center; text-align: center; }

/* ---------- paneles y botones ---------- */
.panel {
  background: linear-gradient(160deg, rgba(38,32,66,0.72), rgba(14,12,28,0.85));
  border: 1px solid rgba(255,215,106,0.16);
  box-shadow: 0 18px 40px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.06);
  backdrop-filter: blur(10px);
  border-radius: 18px;
}
.btn-gold {
  background: linear-gradient(180deg, #ffe9a8 0%, #f6b73c 45%, #c9861a 100%);
  color: #3a2503; border: 0; cursor: pointer; border-radius: 14px;
  font-family: 'Cinzel', serif; font-weight: 900; letter-spacing: 0.06em;
  box-shadow: 0 6px 18px rgba(232,160,19,0.35), inset 0 1px 0 rgba(255,255,255,0.65), inset 0 -2px 0 rgba(120,70,5,0.45);
  transition: transform .12s ease, box-shadow .2s ease, filter .2s ease;
}
.btn-gold:hover { filter: brightness(1.06); box-shadow: 0 8px 26px rgba(232,160,19,0.5), inset 0 1px 0 rgba(255,255,255,0.65), inset 0 -2px 0 rgba(120,70,5,0.45); }
.btn-gold:active { transform: translateY(2px) scale(0.98); }
.btn-block { display: block; width: 100%; padding: 13px 18px; font-size: 15px; }
.btn-ghost {
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.14);
  color: #d8ccb2; border-radius: 12px; cursor: pointer;
  transition: background .15s ease, transform .12s ease;
}
.btn-ghost:hover { background: rgba(255,255,255,0.1); }
.btn-ghost:active { transform: scale(0.97); }
.btn-icon { width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }

.txt-input {
  width: 100%; padding: 12px 14px; border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.15); background: rgba(0,0,0,0.4);
  color: var(--gold-soft); font-family: 'Outfit', sans-serif; font-weight: 700; font-size: 15px;
  outline: none; text-align: center;
}
.txt-input:focus { border-color: rgba(255,215,106,0.6); }
.txt-input::placeholder { color: #5c543f; }

.lbl { display: block; font-size: 11px; font-weight: 800; letter-spacing: 0.18em; color: var(--muted); margin-bottom: 8px; }

/* ---------- orbes de color (logo) ---------- */
.logo-orbs { display: flex; gap: 8px; justify-content: center; margin-bottom: 10px; }
.orb { width: 20px; height: 20px; border-radius: 50%; display: inline-block; }
.o-blue   { background: radial-gradient(circle at 32% 28%, #bcd7ff, var(--c-blue) 60%, #17265e); box-shadow: 0 0 16px rgba(59,130,246,0.75); }
.o-red    { background: radial-gradient(circle at 32% 28%, #ffc4c4, var(--c-red) 60%, #6e1414); box-shadow: 0 0 16px rgba(239,68,68,0.75); }
.o-yellow { background: radial-gradient(circle at 32% 28%, #fff3b0, var(--c-yellow) 60%, #7a5b06); box-shadow: 0 0 16px rgba(250,204,21,0.75); }
.o-green  { background: radial-gradient(circle at 32% 28%, #b6f5cd, var(--c-green) 60%, #0b5a2b); box-shadow: 0 0 16px rgba(34,197,94,0.75); }
.o-purple { background: radial-gradient(circle at 32% 28%, #e6c8ff, var(--c-purple) 60%, #4c1d95); box-shadow: 0 0 16px rgba(168,85,247,0.75); }
.anim-orbs .orb { animation: kf-orb-bob 3.4s ease-in-out infinite; }
.anim-orbs .orb:nth-child(2) { animation-delay: .25s; }
.anim-orbs .orb:nth-child(3) { animation-delay: .5s; }
.anim-orbs .orb:nth-child(4) { animation-delay: .75s; }
.anim-orbs .orb:nth-child(5) { animation-delay: 1s; }
@keyframes kf-orb-bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }

.logo-title {
  margin: 0; text-align: center; font-weight: 900;
  font-size: clamp(40px, 6.5vw, 74px); line-height: 0.98; letter-spacing: 0.04em;
}
.logo-tag {
  margin: 10px 0 0; text-align: center;
  font-size: clamp(10px, 1.2vw, 13px); font-weight: 700; letter-spacing: 0.22em; color: var(--muted);
}

/* ==================================================================
   LOGIN
   ================================================================== */
#screen-login .screen-inner { align-items: center; justify-content: center; }
.login-wrap { position: relative; z-index: 2; width: min(420px, 92vw); display: flex; flex-direction: column; gap: 22px; }
.login-panel { padding: 22px; }
.login-panel .txt-input { margin-bottom: 14px; }
.login-note { margin: 12px 0 0; text-align: center; font-size: 11px; color: var(--dim); line-height: 1.5; }
.login-note b { color: var(--gold-soft); }

/* ==================================================================
   LOBBY
   ================================================================== */
.lobby-topbar {
  position: relative; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.badge-pvp {
  border-radius: 999px; background: rgba(0,0,0,0.4); padding: 6px 12px;
  font-size: 10px; font-weight: 800; letter-spacing: 0.2em; color: var(--muted);
}
.topbar-right { display: flex; align-items: center; gap: 8px; }
.credits-chip {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 999px; padding: 8px 14px;
  background: linear-gradient(180deg, rgba(80,58,14,0.5), rgba(30,22,8,0.65));
  border: 1px solid rgba(255,215,106,0.35);
  color: var(--gold-soft); font-size: 14px; font-weight: 800;
}
.credits-chip i { color: var(--gold); }

.lobby-body {
  position: relative; z-index: 2; flex: 1; min-height: 0;
  display: flex; align-items: center; justify-content: center;
  gap: clamp(24px, 5vw, 72px);
  padding: 18px 0;
  /* seguridad en pantallas muy bajas: scroll interno sin barra visible */
  overflow-y: auto; scrollbar-width: none;
}
.lobby-body::-webkit-scrollbar { display: none; }
.lobby-hero { display: flex; flex-direction: column; align-items: center; }
.lobby-hero .orb { width: 26px; height: 26px; }

.lobby-side { width: min(430px, 94vw); display: flex; flex-direction: column; gap: 14px; }

.bet-panel { padding: 14px 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; }
.panel-lbl { font-size: 10px; font-weight: 800; letter-spacing: 0.18em; color: var(--muted); }
.panel-sub { font-size: 10px; font-weight: 600; color: var(--dim); }

.bet-grid { margin-top: 10px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.chip-bet {
  border-radius: 10px; border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.05); color: #e8dcc0;
  padding: 10px 0; font-size: 13px; font-weight: 800; cursor: pointer;
  transition: all .15s ease; font-family: 'Outfit', sans-serif;
}
.chip-bet:hover { border-color: rgba(255,215,106,0.5); }
.chip-bet.on {
  background: linear-gradient(180deg, #ffe9a8, #e8a013);
  color: #3a2503; border-color: #ffe9a8;
  box-shadow: 0 4px 14px rgba(232,160,19,0.45);
  transform: scale(1.06);
}

/* apuesta manual (otro valor) */
.custom-bet-row { margin-top: 10px; display: flex; align-items: center; gap: 10px; }
.custom-bet-lbl { font-size: 9px; font-weight: 800; letter-spacing: 0.16em; color: var(--muted); white-space: nowrap; }
.custom-bet-box {
  flex: 1; display: flex; align-items: center; gap: 6px;
  border: 1px solid rgba(255,255,255,0.15); background: rgba(0,0,0,0.4);
  border-radius: 12px; padding: 0 12px;
  transition: border-color .15s ease;
}
.custom-bet-box:focus-within { border-color: rgba(255,215,106,0.6); }
.custom-bet-sign { color: var(--gold); font-weight: 900; font-size: 14px; }
#input-custom-bet {
  flex: 1; min-width: 0; padding: 10px 0;
  background: none; border: 0; outline: none;
  color: var(--gold-soft); font-family: 'Outfit', sans-serif; font-weight: 800; font-size: 15px;
}
#input-custom-bet::placeholder { color: #5c543f; font-weight: 600; }
#input-custom-bet::-webkit-outer-spin-button, #input-custom-bet::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
#input-custom-bet[type=number] { -moz-appearance: textfield; appearance: textfield; }

.pot-grid { margin-top: 10px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; border-radius: 12px; background: rgba(0,0,0,0.3); padding: 10px 6px; }
.pot-cell { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.pot-ic { height: 22px; display: flex; align-items: center; color: var(--gold); font-size: 15px; }
.pot-pct { font-weight: 900; color: var(--dim); }
.pot-l { font-size: 8px; font-weight: 700; letter-spacing: 0.1em; color: var(--dim); text-align: center; }
.pot-v { font-size: 14px; font-weight: 700; color: var(--gold-soft); }

.modes { display: flex; flex-direction: column; gap: 10px; }
.mode-btn {
  display: flex; align-items: center; gap: 14px; padding: 15px 16px;
  cursor: pointer; text-align: left; color: var(--paper);
  transition: transform .15s ease, border-color .2s ease, box-shadow .25s ease;
}
.mode-btn:hover { transform: translateY(-2px); border-color: rgba(255,215,106,0.55); box-shadow: 0 10px 30px rgba(232,160,19,0.18); }
.mode-btn:active { transform: translateY(0) scale(0.98); }
.mode-ic {
  width: 46px; height: 46px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: 12px; background: rgba(255,215,106,0.1);
  font-size: 20px; color: var(--gold);
}
.mode-tx { flex: 1; display: flex; flex-direction: column; }
.mode-t1 { font-family: 'Cinzel', serif; font-size: 15px; font-weight: 900; letter-spacing: 0.04em; color: var(--gold-soft); }
.mode-t2 { font-size: 11px; color: var(--muted); margin-top: 2px; }
.mode-arrow { color: var(--gold); }

.join-panel { padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.join-row { display: flex; gap: 8px; }
.code-input {
  flex: 1; min-width: 0;
  font-family: 'Cinzel', serif; font-size: 17px; font-weight: 900; letter-spacing: 0.3em;
  text-transform: uppercase;
}
.btn-join { padding: 0 18px; font-weight: 800; font-size: 13px; color: var(--gold-soft); white-space: nowrap; }

.lobby-foot {
  position: relative; z-index: 2; margin: 0; padding-top: 10px;
  text-align: center; font-size: 10px; letter-spacing: 0.12em; color: #5c543f;
}

/* ==================================================================
   SALA DE ESPERA
   ================================================================== */
.wait-lbl { font-size: 11px; font-weight: 800; letter-spacing: 0.22em; color: var(--muted); margin: 0 0 12px; }
.code-card { padding: 20px 34px; }
.room-code-big {
  font-size: clamp(34px, 5vw, 46px); font-weight: 900; letter-spacing: 0.28em; color: var(--gold-soft);
  text-shadow: 0 0 24px rgba(255,190,60,0.4);
}
.wait-copy { max-width: 320px; margin-top: 18px; }
.wait-copy + .wait-copy { margin-top: 10px; }
.wait-link { margin: 12px 0 0; max-width: 420px; font-size: 11px; color: var(--dim); word-break: break-all; }
.wait-status { margin-top: 22px; display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; color: #e8dcc0; }
.wait-status b { color: var(--gold-soft); }
.spin-slow {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(255,215,106,0.3); border-top-color: var(--gold);
  animation: kf-spin 1.2s linear infinite; display: inline-block;
}
.wait-cancel { margin-top: 26px; padding: 11px 22px; font-size: 13px; font-weight: 700; }

/* ==================================================================
   JUEGO
   ================================================================== */
#screen-game .screen-inner {
  gap: clamp(10px, 1.5vh, 16px);
  max-width: none;
  margin: 0;
  width: 100vw;
  min-height: 100dvh;
  padding-left: clamp(14px, 2.6vw, 44px);
  padding-right: clamp(14px, 2.6vw, 44px);
}

/* En pantallas anchas el chat es columna lateral del layout (siempre visible) */
@media (min-width: 1025px) {
  #screen-game .screen-inner {
    display: grid;
    max-width: none;
    width: 100vw;
    grid-template-columns: minmax(0, 1fr) clamp(320px, 22vw, 380px);
    grid-template-rows: auto auto auto minmax(0, 1fr) auto;
    align-content: stretch;
    column-gap: clamp(16px, 2vw, 30px);
  }
  #screen-game .game-topbar,
  #screen-game .players-row,
  #screen-game .round-row,
  #screen-game .machine,
  #screen-game .board-zone { grid-column: 1; min-width: 0; }
  #screen-game .machine { justify-self: center; width: min(760px, 100%); }
  #screen-game .pad { width: clamp(68px, 6.4vw, 108px); height: clamp(68px, 6.4vw, 108px); }
  #screen-game .md-pad { width: clamp(58px, 5vw, 84px); height: clamp(58px, 5vw, 84px); }
  #screen-game .chat-panel {
    grid-column: 2; grid-row: 1 / -1;
    position: static; width: auto; height: 100%; min-height: 0;
    display: flex; flex-direction: column; padding: 12px;
  }
}

.game-topbar { position: relative; z-index: 5; display: flex; align-items: center; gap: 12px; }
.stats-bar { flex: 1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 8px 12px; }
.stat-cell { display: flex; align-items: center; justify-content: center; gap: 8px; }
.stat-ic { color: var(--gold); font-size: 16px; }
.stat-cell > div { display: flex; flex-direction: column; }
.stat-l { font-size: 8px; font-weight: 700; letter-spacing: 0.14em; color: var(--muted); }
.stat-v { font-size: 16px; font-weight: 700; line-height: 1.1; }

.players-row { position: relative; z-index: 2; display: flex; align-items: center; gap: 10px; }
.player-panel {
  flex: 1; display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  transition: all .3s ease; border-radius: 16px;
}
.player-panel.active-turn { animation: kf-turn-glow 1.4s ease-in-out infinite; border-color: var(--gold); }
.player-panel.eliminated { opacity: 0.45; filter: grayscale(0.7); }
.avatar {
  width: 46px; height: 46px; flex-shrink: 0; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 19px; color: #fff;
  background: radial-gradient(circle at 35% 30%, #2a2f4e, #0a0c18);
}
.av-blue { box-shadow: inset 0 0 0 2.5px #3fa9f5, 0 0 14px rgba(63,169,245,0.5); }
.av-pink { box-shadow: inset 0 0 0 2.5px #ff4d5e, 0 0 14px rgba(255,77,94,0.5); }
.av-bot  { box-shadow: inset 0 0 0 2.5px #a855f7, 0 0 14px rgba(168,85,247,0.55); }
.pp-info { min-width: 0; flex: 1; }
.pp-info.right { text-align: right; }
.pp-name-row { display: flex; align-items: center; gap: 7px; font-size: 13px; }
.pp-info.right .pp-name-row { justify-content: flex-end; }
.pp-tag {
  border-radius: 999px; padding: 2px 7px;
  font-size: 8px; font-weight: 800; letter-spacing: 0.12em;
  background: var(--gold); color: #3a2503;
}
.pp-dots { margin-top: 5px; display: flex; gap: 3px; flex-wrap: wrap; }
.pp-info.right .pp-dots { justify-content: flex-end; }
.pp-dots i {
  width: 9px; height: 9px; border-radius: 50%; display: inline-block;
  background: rgba(255,255,255,0.06); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.14);
}
.pp-dots i.on { background: var(--gold); box-shadow: 0 0 6px rgba(255,215,106,0.7); }
.vs-badge {
  font-family: 'Cinzel', serif; font-weight: 900; font-size: 18px;
  background: linear-gradient(180deg, #fff 0%, #ffd76a 50%, #c9861a 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 10px rgba(255,190,60,0.4));
}

.round-row { position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; padding: 8px 16px; border-radius: 16px; }
.round-info { display: flex; align-items: baseline; gap: 14px; }
.round-lbl { font-family: 'Cinzel', serif; font-weight: 900; font-size: 17px; color: var(--gold-soft); letter-spacing: 0.08em; }
.seq-lbl { font-size: 11px; font-weight: 700; letter-spacing: 0.14em; color: var(--muted); }
.turn-ring { position: relative; width: 64px; height: 64px; flex-shrink: 0; }
.turn-ring svg { transform: rotate(-90deg); display: block; }
.turn-ring.danger { animation: kf-timer-danger .5s ease-in-out infinite; }
.turn-ring-num {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-family: 'Cinzel', serif; font-size: 20px; font-weight: 900; color: #bfe2ff;
  text-shadow: 0 2px 8px rgba(0,0,0,0.7);
}
.turn-ring.danger .turn-ring-num { color: #ff4d5e; }

/* ---------- Máquina estilo dispositivo físico ---------- */
.machine {
  position: relative; z-index: 2;
  width: min(680px, 100%);
  margin: 4px auto 0;
  padding: 26px 30px 22px;
  border-radius: 34px;
  background: linear-gradient(165deg, #262e47 0%, #1a2033 45%, #10152a 100%);
  box-shadow:
    0 24px 50px rgba(0,0,0,0.6),
    inset 0 2px 0 rgba(255,255,255,0.10),
    inset 0 -3px 0 rgba(0,0,0,0.5),
    inset 0 0 0 1.5px rgba(255,215,106,0.14);
}
.machine::after {
  content: ''; position: absolute; inset: 0; border-radius: 34px; pointer-events: none;
  background: linear-gradient(115deg, rgba(255,255,255,0.09) 0%, rgba(255,255,255,0.02) 28%, transparent 45%);
}
.machine-screws i {
  position: absolute; width: 12px; height: 12px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #8a93b5, #3a4160 65%, #181d33);
  box-shadow: inset 0 1px 2px rgba(255,255,255,0.4), inset 0 -1px 2px rgba(0,0,0,0.7);
}
.machine-screws i::after {
  content: ''; position: absolute; left: 1.5px; right: 1.5px; top: 50%; height: 1.6px;
  background: rgba(0,0,0,0.55); transform: translateY(-50%) rotate(38deg);
}
.machine-screws i:nth-child(1) { top: 10px; left: 10px; }
.machine-screws i:nth-child(2) { top: 10px; right: 10px; }
.machine-screws i:nth-child(3) { bottom: 10px; left: 10px; }
.machine-screws i:nth-child(4) { bottom: 10px; right: 10px; }

.machine-top { display: flex; justify-content: center; gap: 16px; margin-bottom: 12px; }
.machine-btn {
  width: 34px; height: 12px; border-radius: 999px;
  background: linear-gradient(180deg, #3d4568, #232942);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18), inset 0 -2px 3px rgba(0,0,0,0.55), 0 2px 4px rgba(0,0,0,0.4);
}

.machine-banner {
  margin: 0 auto 14px; width: fit-content; max-width: 100%;
  padding: 8px 20px; border-radius: 999px;
  font-family: 'Cinzel', serif; font-weight: 900; font-size: clamp(11px, 1.4vw, 14px); letter-spacing: 0.1em;
  text-align: center; color: var(--gold-soft);
  background: linear-gradient(180deg, rgba(0,0,0,0.55), rgba(10,8,20,0.75));
  box-shadow: inset 0 0 0 1.5px rgba(255,215,106,0.35), 0 0 18px rgba(255,190,60,0.18);
}
.machine-banner.your-turn {
  color: #7dffa8;
  box-shadow: inset 0 0 0 1.5px rgba(125,255,168,0.6), 0 0 22px rgba(125,255,168,0.3);
  animation: kf-glow-green 1.2s ease-in-out infinite;
}
.machine-banner.wait-turn { color: #ff8ba0; box-shadow: inset 0 0 0 1.5px rgba(255,93,126,0.45), 0 0 18px rgba(255,93,126,0.2); }

.machine-display {
  display: flex; justify-content: center; gap: clamp(12px, 2.4vw, 22px);
  padding: 18px 16px; border-radius: 22px;
  background: linear-gradient(180deg, #05070f 0%, #0a0e1d 100%);
  box-shadow: inset 0 4px 14px rgba(0,0,0,0.85), inset 0 0 0 1.5px rgba(255,255,255,0.05), 0 1px 0 rgba(255,255,255,0.06);
}
.md-pad {
  position: relative;
  width: clamp(48px, 7vw, 68px); height: clamp(48px, 7vw, 68px);
  border-radius: 50%;
  background: radial-gradient(circle at 34% 28%, #39406b 0%, #1b2038 55%, #0c1022 100%);
  box-shadow:
    inset 0 3px 6px rgba(255,255,255,0.08),
    inset 0 -5px 8px rgba(0,0,0,0.6),
    0 3px 8px rgba(0,0,0,0.5);
  transition: transform .1s ease;
}
.md-led {
  position: absolute; inset: 16%;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 30%, #454e7d, #20263f 70%);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.6);
  transition: all .08s ease;
}
.md-pad.lit-0 .md-led { background: radial-gradient(circle at 38% 30%, #fff 0%, #93c5fd 22%, #3b82f6 60%, #1d4ed8 100%); box-shadow: 0 0 26px 7px rgba(59,130,246,0.75), inset 0 0 10px rgba(255,255,255,0.55); }
.md-pad.lit-1 .md-led { background: radial-gradient(circle at 38% 30%, #fff 0%, #fca5a5 22%, #ef4444 60%, #b91c1c 100%); box-shadow: 0 0 26px 7px rgba(239,68,68,0.75), inset 0 0 10px rgba(255,255,255,0.55); }
.md-pad.lit-2 .md-led { background: radial-gradient(circle at 38% 30%, #fff 0%, #fde68a 22%, #facc15 60%, #a16207 100%); box-shadow: 0 0 26px 7px rgba(250,204,21,0.75), inset 0 0 10px rgba(255,255,255,0.55); }
.md-pad.lit-3 .md-led { background: radial-gradient(circle at 38% 30%, #fff 0%, #86efac 22%, #22c55e 60%, #15803d 100%); box-shadow: 0 0 26px 7px rgba(34,197,94,0.75), inset 0 0 10px rgba(255,255,255,0.55); }
.md-pad.lit-4 .md-led { background: radial-gradient(circle at 38% 30%, #fff 0%, #d8b4fe 22%, #a855f7 60%, #7e22ce 100%); box-shadow: 0 0 26px 7px rgba(168,85,247,0.75), inset 0 0 10px rgba(255,255,255,0.55); }
.md-pad[class*="lit-"] { transform: scale(1.06); }

.machine-step {
  min-height: 20px; margin-top: 10px;
  text-align: center; font-size: 11px; font-weight: 700; letter-spacing: 0.2em; color: var(--muted);
}
.machine-grill { display: flex; justify-content: center; gap: 7px; margin-top: 4px; }
.machine-grill i {
  width: 26px; height: 4px; border-radius: 999px;
  background: rgba(0,0,0,0.5); box-shadow: inset 0 1px 2px rgba(0,0,0,0.8), 0 1px 0 rgba(255,255,255,0.05);
}

/* ---------- Tablero pop-it del jugador ---------- */
.board-zone { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 12px; padding-bottom: 8px; }
.turn-badge {
  padding: 6px 18px; border-radius: 999px;
  font-family: 'Cinzel', serif; font-size: 13px; font-weight: 900; letter-spacing: 0.14em;
  background: rgba(0,0,0,0.45); color: var(--muted);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.1);
}
.turn-badge.on {
  color: #06283f; background: linear-gradient(180deg, #bfe2ff, #3fa9f5);
  box-shadow: 0 0 22px rgba(63,169,245,0.55);
  animation: kf-turn-pulse 1.2s ease-in-out infinite;
}
.turn-badge.other { color: var(--muted); }

.popit {
  display: flex; justify-content: center; gap: clamp(12px, 2.6vw, 24px);
  padding: 20px 24px; border-radius: 34px;
  background: linear-gradient(165deg, #232942 0%, #171c30 50%, #0f1426 100%);
  box-shadow:
    0 18px 40px rgba(0,0,0,0.55),
    inset 0 2px 0 rgba(255,255,255,0.08),
    inset 0 0 0 1.5px rgba(255,215,106,0.12);
}
.pad {
  position: relative;
  width: clamp(56px, 8vw, 84px); height: clamp(56px, 8vw, 84px);
  border: 0; border-radius: 50%; cursor: pointer;
  transition: transform .08s ease, filter .12s ease;
}
.pad::after {
  content: ''; position: absolute; left: 18%; top: 10%; width: 38%; height: 26%;
  border-radius: 50%; background: rgba(255,255,255,0.5); filter: blur(3px);
  transform: rotate(-18deg);
}
.pad:disabled { cursor: not-allowed; filter: brightness(0.75) saturate(0.8); }
.pad:not(:disabled):hover { transform: translateY(-3px); }
.pad.pressed, .pad:not(:disabled):active { transform: scale(0.92); }

.pad-blue   { background: radial-gradient(circle at 35% 30%, #93c5fd 0%, #3b82f6 55%, #1e3a8a 100%); box-shadow: inset 0 -7px 12px rgba(0,0,0,0.42), inset 0 4px 8px rgba(255,255,255,0.35), 0 7px 16px rgba(0,0,0,0.5), 0 0 14px rgba(59,130,246,0.3); }
.pad-red    { background: radial-gradient(circle at 35% 30%, #fca5a5 0%, #ef4444 55%, #7f1d1d 100%); box-shadow: inset 0 -7px 12px rgba(0,0,0,0.42), inset 0 4px 8px rgba(255,255,255,0.35), 0 7px 16px rgba(0,0,0,0.5), 0 0 14px rgba(239,68,68,0.3); }
.pad-yellow { background: radial-gradient(circle at 35% 30%, #fde68a 0%, #facc15 55%, #713f12 100%); box-shadow: inset 0 -7px 12px rgba(0,0,0,0.42), inset 0 4px 8px rgba(255,255,255,0.35), 0 7px 16px rgba(0,0,0,0.5), 0 0 14px rgba(250,204,21,0.3); }
.pad-green  { background: radial-gradient(circle at 35% 30%, #86efac 0%, #22c55e 55%, #14532d 100%); box-shadow: inset 0 -7px 12px rgba(0,0,0,0.42), inset 0 4px 8px rgba(255,255,255,0.35), 0 7px 16px rgba(0,0,0,0.5), 0 0 14px rgba(34,197,94,0.3); }
.pad-purple { background: radial-gradient(circle at 35% 30%, #d8b4fe 0%, #a855f7 55%, #581c87 100%); box-shadow: inset 0 -7px 12px rgba(0,0,0,0.42), inset 0 4px 8px rgba(255,255,255,0.35), 0 7px 16px rgba(0,0,0,0.5), 0 0 14px rgba(168,85,247,0.3); }

.pad.flash-0 { animation: kf-pad-flash .28s ease; filter: brightness(1.7); box-shadow: 0 0 34px 10px rgba(59,130,246,0.85), inset 0 4px 8px rgba(255,255,255,0.5); }
.pad.flash-1 { animation: kf-pad-flash .28s ease; filter: brightness(1.7); box-shadow: 0 0 34px 10px rgba(239,68,68,0.85), inset 0 4px 8px rgba(255,255,255,0.5); }
.pad.flash-2 { animation: kf-pad-flash .28s ease; filter: brightness(1.7); box-shadow: 0 0 34px 10px rgba(250,204,21,0.85), inset 0 4px 8px rgba(255,255,255,0.5); }
.pad.flash-3 { animation: kf-pad-flash .28s ease; filter: brightness(1.7); box-shadow: 0 0 34px 10px rgba(34,197,94,0.85), inset 0 4px 8px rgba(255,255,255,0.5); }
.pad.flash-4 { animation: kf-pad-flash .28s ease; filter: brightness(1.7); box-shadow: 0 0 34px 10px rgba(168,85,247,0.85), inset 0 4px 8px rgba(255,255,255,0.5); }

.progress-dots { display: flex; gap: 7px; min-height: 12px; }
.progress-dots span {
  width: 11px; height: 11px; border-radius: 50%;
  background: rgba(255,255,255,0.08); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.16);
}
.progress-dots span.hit { background: var(--gold); box-shadow: 0 0 9px rgba(255,215,106,0.8); }
.progress-dots span.current { background: #3fa9f5; box-shadow: 0 0 9px rgba(63,169,245,0.8); animation: kf-turn-pulse 1s ease-in-out infinite; }

/* ---------- Chat interno de la partida ---------- */
.chat-panel {
  position: fixed; right: 18px; top: 96px; bottom: 18px; z-index: 40;
  width: 300px; display: flex; flex-direction: column; padding: 12px;
}
.chat-empty {
  margin: auto; text-align: center; font-size: 11px; color: var(--dim);
  line-height: 1.6; padding: 12px;
}
.chat-head {
  display: flex; align-items: center; gap: 8px; padding-bottom: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  font-family: 'Cinzel', serif; font-size: 12px; font-weight: 900;
  letter-spacing: 0.14em; color: var(--gold-soft);
}
.chat-hint {
  margin-left: auto; font-family: 'Outfit', sans-serif;
  font-size: 8px; font-weight: 600; letter-spacing: 0.08em;
  color: var(--dim); text-transform: uppercase;
}
.chat-msgs {
  flex: 1; min-height: 0; overflow-y: auto;
  display: flex; flex-direction: column; gap: 6px; padding: 10px 2px;
  scrollbar-width: thin; scrollbar-color: rgba(255,215,106,0.3) transparent;
}
.chat-msg {
  max-width: 86%; padding: 7px 10px; border-radius: 12px;
  font-size: 12.5px; line-height: 1.35; word-break: break-word;
  animation: kf-fade-up .25s ease both;
}
.chat-msg .chat-name {
  display: block; font-size: 8.5px; font-weight: 800;
  letter-spacing: 0.1em; text-transform: uppercase; opacity: 0.7; margin-bottom: 2px;
}
.chat-msg.mine {
  align-self: flex-end; border-bottom-right-radius: 4px;
  background: linear-gradient(180deg, rgba(255,215,106,0.24), rgba(232,160,19,0.15));
  border: 1px solid rgba(255,215,106,0.4); color: var(--gold-soft);
}
.chat-msg.theirs {
  align-self: flex-start; border-bottom-left-radius: 4px;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12); color: #e8dcc0;
}
.chat-msg.system {
  align-self: center; max-width: 94%; text-align: center;
  background: rgba(59,130,246,0.12); border: 1px solid rgba(147,197,253,0.25); color: #bfdbfe;
}
.chat-emoji-row { display: flex; gap: 4px; padding: 6px 0; }
.chat-emoji-row button {
  flex: 1; padding: 5px 0; border-radius: 8px; font-size: 15px; cursor: pointer;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
  transition: transform .1s ease, background .15s ease;
}
.chat-emoji-row button:hover { background: rgba(255,215,106,0.14); transform: scale(1.12); }
.chat-input-row { display: flex; gap: 6px; }
.chat-input-row .txt-input { text-align: left; padding: 10px 12px; font-size: 13px; }
.chat-send {
  width: 42px; flex-shrink: 0; border-radius: 12px; font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center;
}

/* ==================================================================
   OVERLAY RESULTADO
   ================================================================== */
.overlay {
  position: fixed; inset: 0; z-index: 80;
  display: none; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.62); backdrop-filter: blur(6px); padding: 18px;
}
.overlay.show { display: flex; }
.result-card { width: min(400px, 94vw); padding: 26px 24px; text-align: center; border-color: rgba(255,215,106,0.4); }
.result-orbs { display: flex; justify-content: center; gap: 8px; margin-bottom: 8px; }
.result-card h2 { margin: 4px 0 2px; font-size: 32px; font-weight: 900; letter-spacing: 0.05em; }
.result-card.lose h2 { color: #b9a98a; background: none; -webkit-background-clip: initial; }
.result-card p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.result-money { margin: 14px 0 4px; font-size: 38px; font-weight: 900; }
.result-money.neg { background: none; -webkit-background-clip: initial; color: #ff5d7e; }
.result-detail { margin: 10px 0 18px; font-size: 11px; color: var(--dim); line-height: 1.7; }
.result-detail b { color: var(--gold-soft); }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 26px; z-index: 100;
  transform: translateX(-50%) translateY(18px);
  padding: 12px 22px; border-radius: 999px;
  background: rgba(14,12,28,0.92); border: 1px solid rgba(255,215,106,0.35);
  color: var(--gold-soft); font-size: 13px; font-weight: 700;
  opacity: 0; pointer-events: none; transition: all .25s ease;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { border-color: rgba(255,93,126,0.6); color: #ffb3c1; }
.toast.success { border-color: rgba(125,255,168,0.5); color: #b6f5cd; }

/* ==================================================================
   KEYFRAMES
   ================================================================== */
@keyframes kf-shimmer { 0% { background-position: 120% 0; } 100% { background-position: -120% 0; } }
@keyframes kf-drift {
  0% { transform: translateY(0); opacity: 0; }
  12% { opacity: 0.7; }
  88% { opacity: 0.5; }
  100% { transform: translateY(-110vh); opacity: 0; }
}
@keyframes kf-spin { to { transform: rotate(360deg); } }
@keyframes kf-zoom-in { 0% { opacity: 0; transform: scale(0.82); } 100% { opacity: 1; transform: scale(1); } }
.anim-zoom { animation: kf-zoom-in .4s cubic-bezier(.3,1.3,.5,1) both; }
@keyframes kf-fade-up { 0% { opacity: 0; transform: translateY(16px); } 100% { opacity: 1; transform: translateY(0); } }
.anim-fade-up { animation: kf-fade-up .45s ease both; }
@keyframes kf-turn-glow {
  0%,100% { box-shadow: 0 0 0 1.5px rgba(255,215,106,0.55), 0 0 16px rgba(255,190,60,0.3); }
  50% { box-shadow: 0 0 0 2px rgba(255,215,106,0.95), 0 0 30px rgba(255,190,60,0.55); }
}
@keyframes kf-turn-pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.12); } }
@keyframes kf-timer-danger { 0%,100% { opacity: 1; } 50% { opacity: 0.45; } }
@keyframes kf-pad-flash { 0% { transform: scale(1); } 40% { transform: scale(1.09); } 100% { transform: scale(1); } }
@keyframes kf-glow-green {
  0%,100% { box-shadow: inset 0 0 0 1.5px rgba(125,255,168,0.6), 0 0 16px rgba(125,255,168,0.22); }
  50% { box-shadow: inset 0 0 0 1.5px rgba(125,255,168,0.9), 0 0 30px rgba(125,255,168,0.45); }
}

/* ==================================================================
   RESPONSIVE
   ================================================================== */

/* Tablet y pantallas medianas */
@media (max-width: 900px) {
  .lobby-body { flex-direction: column; gap: 20px; justify-content: flex-start; padding-top: 26px; }
  .lobby-hero .logo-title { font-size: clamp(34px, 8vw, 52px); }
  .lobby-hero .orb { width: 18px; height: 18px; }
  .lobby-side { width: min(480px, 100%); }
  .screen-inner.center { padding: 16px; }
}

/* Móvil */
@media (max-width: 560px) {
  .screen-inner { padding: 12px 12px 16px; }
  .bet-grid { grid-template-columns: repeat(4, 1fr); }
  .game-topbar { flex-wrap: wrap; }
  .stats-bar { order: 3; flex-basis: 100%; }
  .players-row { gap: 6px; }
  .player-panel { padding: 8px 10px; gap: 8px; }
  .avatar { width: 38px; height: 38px; font-size: 15px; }
  .vs-badge { font-size: 14px; }
  .machine { padding: 22px 16px 16px; border-radius: 26px; }
  .popit { padding: 14px 14px; border-radius: 26px; gap: 10px; }
  .round-row { padding: 6px 12px; }
  .round-lbl { font-size: 14px; }
  .turn-ring { width: 52px; height: 52px; }
  .turn-ring svg { width: 52px; height: 52px; }
  .result-card h2 { font-size: 26px; }
}

/* Pantallas muy anchas: mantener el juego a pantalla completa y dar más aire al tablero */
@media (min-width: 1400px) {
  #screen-game .screen-inner { grid-template-columns: minmax(0, 1fr) clamp(340px, 21vw, 400px); }
  #screen-game .machine { width: min(820px, 100%); }
}

/* Altura baja (landscape móvil): compactar */
@media (max-height: 640px) {
  .machine { padding: 16px 20px 12px; }
  .machine-display { padding: 12px; }
  .popit { padding: 12px 16px; }
  .board-zone { gap: 8px; }
}

/* Chat en tablet/móvil: barra flotante plegable (tocar cabecera) */
@media (max-width: 1024px) {
  .chat-panel {
    top: auto; left: 10px; right: 10px; bottom: 10px; width: auto;
    max-height: 44px; overflow: hidden; transition: max-height .3s ease;
  }
  .chat-panel.open { max-height: min(62dvh, 420px); }
  .chat-head { cursor: pointer; }
  .chat-head::after { content: '▴'; color: var(--dim); font-size: 11px; }
  .chat-panel.open .chat-head::after { content: '▾'; }
  #screen-game .screen-inner { padding-bottom: 56px; }
}

/* Altura limitada: compactar el juego para que quepa sin scroll */
@media (max-height: 780px) {
  #screen-game .screen-inner { gap: 8px; }
  .machine { padding: 14px 20px 10px; }
  .machine-top { margin-bottom: 8px; }
  .machine-banner { margin-bottom: 8px; padding: 5px 14px; }
  .machine-display { padding: 10px 12px; }
  .md-pad { width: 46px; height: 46px; }
  .machine-step { margin-top: 6px; min-height: 16px; }
  .popit { padding: 12px 16px; }
  .pad { width: 54px; height: 54px; }
  .player-panel { padding: 6px 10px; }
  .avatar { width: 34px; height: 34px; font-size: 14px; }
  .turn-ring, .turn-ring svg { width: 48px; height: 48px; }
  .round-row { padding: 5px 12px; }
}
@media (max-height: 720px) {
  .lobby-hero .logo-title { font-size: clamp(30px, 4.5vw, 44px); }
  .lobby-body { gap: 20px; }
}
