/* web_domino.css - Adomino High Fidelity */
:root {
    --bg-deep: #0F172A;
    --panel-dark: #1E293B;
    --mdo-red: #D32F2F;
    --tu-blue: #1976D2;
    --gold: #FFD600;
    --cyan: #00E5FF;
    --neon-green: #39FF14;
    --tile-white: #FFFFFF;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
    background-color: var(--bg-deep);
    margin: 0; font-family: 'Inter', system-ui, sans-serif;
    color: white; overflow: hidden;
    height: 100vh;   /* respaldo para navegadores viejos */
    height: 100dvh;  /* alto real visible en celular (descuenta la barra del navegador) */
}

#main-screen {
    width: 100%; height: 100%; position: relative;
    display: flex; flex-direction: column;
}

/* Decoración circular de fondo */
.bg-decoration {
    position: absolute; border-radius: 50%;
    background-color: rgba(30, 41, 59, 0.15); filter: blur(60px); z-index: -1;
}
.circle-top { width: 400px; height: 400px; top: -100px; left: -100px; }
.circle-bottom { width: 300px; height: 300px; bottom: -50px; right: -50px; }

#game-container {
    display: flex; flex-direction: column; height: 100%; padding: 10px;
}

/* Marcadores */
.game-header { display: flex; flex-direction: column; gap: 5px; }
.top-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.score-card {
    background: var(--panel-dark); padding: 8px 18px; border-radius: 16px;
    border: 2px solid rgba(255,255,255,0.25); display: flex; align-items: center; gap: 8px;
    min-width: 70px;
}
.score-card.mdo { background-color: var(--mdo-red); }
.score-card.tu { background-color: var(--tu-blue); }
.score-card .points { font-size: 26px; font-weight: 900; line-height: 1; }
.score-card .player-label { font-size: 12px; font-weight: 800; text-transform: uppercase; }

.difficulty-toggle {
    display: flex; background: rgba(255,255,255,0.1); border-radius: 20px; padding: 2px;
}
.mode-btn {
    width: 34px; height: 30px; display: flex; align-items: center; justify-content: center;
    border-radius: 15px; font-weight: 800; cursor: pointer;
}
.mode-btn.active { background: white; color: black; }
#mode-e.active { background: var(--mdo-red); color: white; }

/* Fila de menú: botón MENÚ + dificultad actual */
.menu-row {
    display: flex; align-items: center; gap: 12px; margin-top: 4px;
}
.menu-btn-container { position: relative; display: inline-flex; }
#btn-menu {
    background: #22c55e; color: #000; border: 2px solid rgba(255,255,255,0.35);
    border-radius: 20px; padding: 8px 20px; font-weight: 900; font-size: 13px;
    letter-spacing: .5px; cursor: pointer;
}
#btn-salir {
    background: var(--mdo-red); color: #fff; border: 2px solid rgba(255,255,255,0.35);
    border-radius: 20px; padding: 8px 18px; font-weight: 900; font-size: 13px;
    letter-spacing: .5px; cursor: pointer;
}
#projection-badge {
    position: absolute; top: -6px; right: -6px; background: var(--gold); color: black;
    font-size: 10px; font-weight: 900; border-radius: 50%; width: 18px; height: 18px;
    display: flex; align-items: center; justify-content: center;
}
#current-difficulty { color: var(--mdo-red); font-weight: 800; font-size: 15px; letter-spacing: .5px; }
.spacer { flex: 1; }

/* Área de mano de la IA: necesita posición relativa para el overlay ¿POR DÓNDE? */
#ai-hand-area { position: relative; margin-top: 10px; min-height: 46px; }
.mini-tiles-row { display: flex; gap: 4px; flex-wrap: wrap; }

/* Overlay Animado ¿Por dónde? */
#side-selector-overlay {
    position: absolute; inset: 0; z-index: 10; border-radius: 12px;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 10px; border: 2px solid var(--neon-green);
    animation: sidePulse 2s infinite alternate ease-in-out;
}

@keyframes sidePulse {
    0% { background-color: #0F172A; border-color: rgba(57, 255, 20, 0.4); transform: scale(1); }
    100% { background-color: #065F46; border-color: var(--neon-green); transform: scale(1.02); }
}

.prompt-text { font-weight: 800; font-size: 13px; letter-spacing: .5px; }
.side-btn-group { display: flex; gap: 8px; }
.side-btn {
    border: none; padding: 6px 15px; border-radius: 8px; font-weight: 900; cursor: pointer;
}
.side-btn.yellow { background-color: var(--gold); }
.side-btn.cyan { background-color: var(--cyan); }

/* Ficha boca abajo del oponente (mdo) */
.tile-visual.face-down {
    background: white; border: 1.5px solid var(--mdo-red); border-radius: 5px;
}

/* Tablero */
#board-surface {
    flex: 1; min-height: 0; /* permite encoger para que el pie (PILA/CARGAR) nunca quede fuera de pantalla */
    margin: 10px 0; background-color: var(--panel-dark);
    border-radius: 20px; border: 2px solid rgba(255,255,255,0.1);
    overflow: hidden; display: flex; align-items: center; justify-content: center;
}

#board-scroll-area { width: 100%; height: 100%; overflow: auto; padding: 10px; }
/* align-content: flex-start → las filas se apilan desde arriba y hacen scroll,
   en vez de encimarse cuando pasan a una segunda línea. */
.domino-board { display: flex; flex-wrap: wrap; justify-content: center; align-content: flex-start; align-items: center; gap: 4px 4px; }

/* Barra de Estado */
.status-bar {
    border-radius: 25px; padding: 4px; transition: background 0.3s;
}
.status-bar.thinking { background-color: #B71C1C; }
.status-bar.your-turn { background-color: #1B5E20; }

.status-content {
    display: flex; align-items: center; justify-content: center; gap: 10px;
}

.mini-info-box {
    background: white; border-radius: 9px; padding: 3px 9px;
    display: flex; flex-direction: column; align-items: center;
}
.mini-info-box.red-border { border: 2px solid var(--mdo-red); color: var(--mdo-red); }
.mini-info-box.blue-border { border: 2px solid var(--tu-blue); color: var(--tu-blue); }
.mini-info-box .label { font-size: 10px; font-weight: 800; }
.mini-info-box .last-tile { font-size: 18px; font-weight: 900; line-height: 1.05; }

.end-bubble {
    width: 35px; height: 24px; border-radius: 4px; display: flex;
    align-items: center; justify-content: center; color: black; font-weight: 900;
    transition: transform .15s;
}
.end-bubble.left { background: var(--gold); }
.end-bubble.right { background: var(--cyan); }

/* ¿POR DÓNDE?: extremos clicables y llamativos (el usuario toca el lado a jugar) */
.end-bubble.pick {
    cursor: pointer; width: 48px; height: 34px; border-radius: 8px;
    border: 2px solid #fff; font-size: 18px;
    animation: endPick .6s infinite alternate ease-in-out;
}
@keyframes endPick {
    0%   { transform: scale(1);    box-shadow: 0 0 0 0 rgba(255,255,255,.55); }
    100% { transform: scale(1.18); box-shadow: 0 0 16px 5px rgba(255,255,255,.85); }
}
/* Fichas de los extremos del tablero resaltadas y clicables (estilo viv_domino) */
.tile-visual.board-tile.pick-end {
    cursor: pointer; position: relative; z-index: 5;
    box-shadow: 0 0 0 3px var(--gold), 0 0 16px 5px rgba(255,214,0,.85);
    animation: pickScale .6s infinite alternate ease-in-out;
}
@keyframes pickScale {
    0%   { transform: scale(1); }
    100% { transform: scale(1.12); }
}

/* Fichas — dobles en vertical (por defecto), el resto acostadas (horizontal) */
.tile-visual {
    background: white; border-radius: 6px; border: 1.5px solid #666;
    display: flex; flex-direction: column; cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,.3);
}
.tile-visual.horizontal { flex-direction: row; }

.tile-visual.hand-tile { width: 46px; height: 82px; }
/* Fichas del tablero: tamaño escalable con --bs (lo ajusta fitBoard() en el JS
   para que TODAS las fichas jugadas quepan dentro del cuadro). --bs = 1 por defecto. */
.domino-board { --bs: 1; }
.tile-visual.board-tile { width: calc(40px * var(--bs)); height: calc(72px * var(--bs)); }
.tile-visual.board-tile.horizontal { width: calc(72px * var(--bs)); height: calc(40px * var(--bs)); }
/* Puntos, relleno y divisor de la ficha también escalan para que se vean proporcionados */
.tile-visual.board-tile .half { padding: calc(6px * var(--bs)); }
.tile-visual.board-tile .pip { width: calc(8px * var(--bs)); height: calc(8px * var(--bs)); }
.tile-visual.board-tile .divider { margin: 0 calc(6px * var(--bs)); }
.tile-visual.board-tile.horizontal .divider { margin: calc(6px * var(--bs)) 0; }

/* Mitades de la ficha, separadas por un divisor */
.tile-visual .half {
    flex: 1; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr);
    align-items: center; justify-items: center; padding: 6px;
}
/* Doble (vertical): divisor horizontal entre mitad de arriba y de abajo */
.tile-visual .divider { height: 1.5px; background: #ccc; margin: 0 6px; }
/* No-doble (horizontal): divisor vertical entre mitad izquierda y derecha */
.tile-visual.horizontal .divider { height: auto; align-self: stretch; width: 1.5px; margin: 6px 0; }

/* Filas de manos: alineadas al centro para que dobles (altos) y no-dobles (anchos) compartan la misma línea media */
.player-tiles-row, .mini-tiles-row {
    display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; align-items: center;
}

/* Puntos (Pips) */
.pip { width: 8px; height: 8px; border-radius: 50%; }
.p1 { background: #C62828; } .p2 { background: #2E7D32; } .p3 { background: #1565C0; }
.p4 { background: #795548; } .p5 { background: #6A1B9A; } .p6 { background: #000; }

/* Acción */
.player-area { padding-top: 10px; }
.bottom-action-bar { display: flex; align-items: center; padding: 10px 0; }
.pile-status { background: #1E1E1E; padding: 8px 15px; border-radius: 10px; color: var(--gold); font-weight: 900; }
.action-btn {
    height: 42px; padding: 0 20px; border: none; border-radius: 10px;
    color: white; font-weight: 900; font-size: 15px; cursor: pointer;
}
.action-btn.red { background: var(--mdo-red); }
.action-btn.gold { background: var(--gold); color: black; }
.action-btn.gray { background: #616161; }
.hand-label { font-size: 11px; font-weight: 800; color: rgba(255,255,255,.6); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px; }
.hidden { display: none !important; }

/* Toast de anuncio (Bono salida / Bono no válido / Ronda ganada) */
.announcement-toast {
    position: fixed; top: 18%; left: 50%; transform: translateX(-50%);
    background: var(--panel-dark); border: 2px solid var(--gold); border-radius: 14px;
    padding: 16px 28px; z-index: 200; box-shadow: 0 8px 30px rgba(0,0,0,.5);
    text-align: center; max-width: 80vw;
}
.announcement-toast span {
    color: var(--gold); font-weight: 900; font-size: 16px; white-space: pre-line; line-height: 1.4;
}

/* Modales (resultado de mano / sugerencia de dificultad) */
.dialog-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 300;
    display: flex; align-items: center; justify-content: center; padding: 20px;
}
.dialog-box {
    background: var(--panel-dark); border-radius: 18px; border: 2px solid rgba(255,255,255,0.15);
    padding: 24px; max-width: 360px; width: 100%; text-align: center;
    box-shadow: 0 12px 40px rgba(0,0,0,.5);
}
.dialog-title { font-size: 20px; font-weight: 900; color: white; margin-bottom: 6px; }
.dialog-points { font-size: 28px; font-weight: 900; color: var(--gold); margin-bottom: 10px; }
.dialog-detail { font-size: 13px; color: rgba(255,255,255,.75); line-height: 1.6; white-space: pre-line; margin-bottom: 18px; }
.dialog-actions { display: flex; gap: 10px; justify-content: center; }
.dialog-btn {
    flex: 1; height: 44px; border: none; border-radius: 10px; font-weight: 900; font-size: 13px; cursor: pointer;
}
.dialog-btn.gold { background: var(--gold); color: black; }
.dialog-btn.red { background: var(--mdo-red); color: white; }
.dialog-btn.ghost { background: rgba(255,255,255,.08); color: white; border: 1px solid rgba(255,255,255,.2); }

/* ═══════════ PANTALLA DE ACCESO (login por usuario) ═══════════ */
#login-screen {
    position: fixed; inset: 0; z-index: 500;
    background: var(--bg-deep);
    display: flex; align-items: center; justify-content: center; padding: 20px;
}
.login-box {
    background: var(--panel-dark); border: 2px solid rgba(255,255,255,0.12);
    border-radius: 20px; padding: 24px; width: 100%; max-width: 360px;
    box-shadow: 0 12px 40px rgba(0,0,0,.5);
}
.login-title {
    font-size: 26px; font-weight: 900; color: var(--gold);
    text-align: center; letter-spacing: 1px; margin-bottom: 6px;
}
.login-sub { font-size: 14px; font-weight: 700; color: rgba(255,255,255,.8); text-align: center; margin: 8px 0 14px; }
.login-users { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; max-height: 46vh; overflow-y: auto; }
.login-user {
    display: flex; align-items: center; justify-content: space-between;
    background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.14);
    border-radius: 12px; padding: 12px 14px; cursor: pointer; color: white; text-align: left;
}
.login-user:hover { background: rgba(255,255,255,.12); }
.login-user .lu-name { font-weight: 800; font-size: 15px; }
.login-user .lu-date { font-size: 11px; color: rgba(255,255,255,.5); }
.login-input {
    width: 100%; height: 44px; margin-bottom: 10px; padding: 0 14px;
    border-radius: 10px; border: 1.5px solid rgba(255,255,255,.2);
    background: rgba(255,255,255,.06); color: white; font-size: 15px; font-weight: 700;
}
.login-input::placeholder { color: rgba(255,255,255,.4); font-weight: 500; }
.login-input:focus { outline: none; border-color: var(--gold); }
.login-actions { display: flex; gap: 10px; margin-top: 4px; }
.login-btn {
    flex: 1; height: 46px; border: none; border-radius: 10px;
    font-weight: 900; font-size: 14px; cursor: pointer;
}
.login-btn.gold { background: var(--gold); color: black; }
.login-btn.ghost { background: rgba(255,255,255,.08); color: white; border: 1px solid rgba(255,255,255,.2); }
#btn-nuevo-usuario { width: 100%; }
.login-error { color: #ff6b6b; font-size: 12px; font-weight: 700; text-align: center; min-height: 16px; margin-bottom: 6px; }

/* ═══════════ Encabezado compacto en celular (una sola línea) ═══════════ */
@media (max-width: 480px) {
    .top-row { gap: 5px; }
    .score-card { padding: 5px 9px; min-width: 0; gap: 4px; }
    .score-card .points { font-size: 20px; }
    .score-card .player-label { font-size: 10px; }
    #btn-menu, #btn-salir { padding: 6px 11px; font-size: 11px; border-radius: 16px; }
    .difficulty-toggle { padding: 2px; }
    .mode-btn { width: 26px; height: 26px; }
    #current-difficulty { font-size: 12px; }
}

/* ═══════════ MENÚ PRINCIPAL y modales del menú ═══════════ */
/* Botón cerrar circular rojo, arriba a la izquierda (Regla 10 de la guía) */
.modal-x {
    position: absolute; top: 12px; left: 12px; width: 30px; height: 30px;
    border-radius: 50%; background: #dc2626; color: #fff; border: none;
    font-size: 15px; font-weight: 900; line-height: 1; cursor: pointer;
    display: flex; align-items: center; justify-content: center; z-index: 2;
}

/* Panel del menú principal */
.menu-box {
    background: var(--panel-dark); border-radius: 18px; border: 2px solid rgba(255,255,255,0.12);
    padding: 20px; width: 100%; max-width: 420px; max-height: 88vh; overflow-y: auto;
    box-shadow: 0 12px 40px rgba(0,0,0,.5);
}
.menu-title { font-size: 22px; font-weight: 900; color: #fff; letter-spacing: .5px; margin-bottom: 14px; }
.menu-options { display: flex; flex-direction: column; gap: 10px; }
.menu-option {
    display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
    background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px; padding: 15px 16px; color: #fff; font-weight: 800; font-size: 15px; cursor: pointer;
}
.menu-option:hover { background: rgba(255,255,255,0.12); }
.menu-option .mo-icon { font-size: 20px; width: 24px; text-align: center; flex: 0 0 auto; }
.menu-footer { display: flex; justify-content: flex-end; margin-top: 14px; }
.menu-close { background: none; border: none; color: var(--gold); font-weight: 900; font-size: 15px; cursor: pointer; padding: 8px 12px; }

/* Resultados */
.res-box {
    position: relative; background: #FDFCF0; border-radius: 16px;
    padding: 20px 16px 16px; width: 100%; max-width: 460px; max-height: 86vh; overflow-y: auto;
    box-shadow: 0 12px 40px rgba(0,0,0,.5);
}
.res-title { font-size: 22px; font-weight: 900; color: #000; margin: 2px 0 12px 40px; }
.res-list { display: flex; flex-direction: column; gap: 10px; }
.res-item { background: #000; border: none; border-radius: 8px; padding: 14px 16px; cursor: pointer; text-align: left; width: 100%; }
.res-item .ri-label { color: var(--gold); font-weight: 800; font-size: 15px; text-decoration: underline; }
.res-empty { color: #555; font-style: italic; padding: 10px 2px; }
.res-detail-head { display: flex; align-items: center; gap: 12px; margin: 2px 0 12px 40px; }
.res-back { background: #dc2626; color: #fff; border: none; border-radius: 8px; padding: 6px 12px; font-weight: 900; font-size: 13px; cursor: pointer; }
.res-detail-title { font-size: 16px; font-weight: 900; color: #000; }
.res-events { display: block; }
/* Tabla de rondas: Hora · mdo · TU · % (estilo del reporte de Android) */
.res-table { width: 100%; border-collapse: collapse; font-family: monospace; }
.res-table th {
    text-align: right; color: #000; font-weight: 900; font-size: 13px;
    padding: 6px 8px; border-bottom: 2px solid rgba(0,0,0,.18);
}
.res-table th.c-hora, .res-table td.c-hora { text-align: left; }
.res-table td {
    text-align: right; color: #1a1a2e; font-weight: 700; font-size: 15px;
    padding: 7px 8px; border-bottom: 1px solid rgba(0,0,0,.08);
}
.res-table td.c-hora { font-weight: 800; }

/* Notas */
.notas-box {
    position: relative; background: var(--panel-dark); border-radius: 16px;
    padding: 20px 16px 16px; width: 100%; max-width: 460px; box-shadow: 0 12px 40px rgba(0,0,0,.5);
}
.notas-title { font-size: 20px; font-weight: 900; color: #fff; margin: 2px 0 12px 40px; }
.notas-input {
    width: 100%; min-height: 180px; resize: vertical; border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.2); background: rgba(255,255,255,0.06);
    color: #fff; padding: 12px; font-size: 14px; font-weight: 600; font-family: inherit;
}
.notas-input:focus { outline: none; border-color: var(--gold); }
.notas-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 12px; }

/* Ayuda */
.ayuda-box {
    position: relative; background: #fff; border-radius: 16px;
    padding: 20px 16px 16px; width: 100%; max-width: 460px; max-height: 86vh; overflow-y: auto;
    box-shadow: 0 12px 40px rgba(0,0,0,.5);
}
.ayuda-title { font-size: 20px; font-weight: 900; color: #000; margin: 2px 0 10px 40px; }
.ayuda-text { color: #1a1a2e; font-weight: 600; font-size: 14px; line-height: 1.6; white-space: pre-line; }

/* Video */
.video-box {
    position: relative; background: var(--panel-dark); border-radius: 16px;
    padding: 20px 16px 16px; width: 100%; max-width: 640px; box-shadow: 0 12px 40px rgba(0,0,0,.5);
}
.video-box video { width: 100%; border-radius: 12px; background: #000; }

@media (max-width: 480px) {
    .menu-title { font-size: 20px; }
    .menu-option { padding: 14px; font-size: 14px; }
    .res-title { font-size: 20px; }
    .notas-input { min-height: 150px; }
}

/* ═══════════ "JUICE" de videojuego (todo aditivo) ═══════════ */
/* Botón de sonido */
#btn-sound {
    background: rgba(255,255,255,.12); color:#fff; border:2px solid rgba(255,255,255,.3);
    border-radius:50%; width:36px; height:34px; font-size:15px; line-height:1; cursor:pointer;
}
#btn-sound.muted { opacity:.45; }

/* Carrera a 200 (barras de progreso con suspenso) */
.race-bars { position:relative; margin:8px 0 2px; padding:8px 12px 16px; background:rgba(0,0,0,.28); border:1px solid rgba(255,255,255,.08); border-radius:14px; }
.race-row { display:flex; align-items:center; gap:8px; margin:5px 0; }
.race-name { width:34px; font-size:12px; font-weight:900; text-align:right; }
.race-name.mdo { color:var(--mdo-red); }
.race-name.tu { color:#4aa3ff; }
.race-track { position:relative; flex:1; height:16px; background:rgba(255,255,255,.09); border-radius:10px; overflow:hidden; box-shadow:inset 0 1px 3px rgba(0,0,0,.5); }
.race-fill { position:absolute; left:0; top:0; bottom:0; width:0; border-radius:10px; transition:width .55s cubic-bezier(.2,1,.3,1); }
.race-fill.mdo { background:linear-gradient(90deg,#7f1d1d,#ef4444); }
.race-fill.tu  { background:linear-gradient(90deg,#1e40af,#3b82f6); }
.race-val { width:34px; font-size:14px; font-weight:900; color:#fff; text-align:left; }
.race-goal { position:absolute; right:12px; bottom:3px; font-size:9px; font-weight:800; letter-spacing:1px; color:var(--gold); opacity:.75; }
/* Tensión: alguien ≥160 pts */
.race-fill.danger { animation:raceDanger .55s infinite alternate ease-in-out; }
@keyframes raceDanger {
    0%   { filter:brightness(1); box-shadow:none; }
    100% { filter:brightness(1.45); box-shadow:0 0 12px 3px var(--gold); }
}

/* Racha de manos ganadas */
.streak-badge {
    position:absolute; top:-11px; right:12px;
    background:linear-gradient(135deg,#ff9800,#ff3d00); color:#fff; font-weight:900; font-size:12px;
    padding:4px 12px; border-radius:20px; letter-spacing:.5px;
    box-shadow:0 4px 14px rgba(255,61,0,.55); border:1px solid rgba(255,255,255,.45);
}
.streak-badge.pop { animation:streakPop .55s cubic-bezier(.2,1.5,.4,1); }
@keyframes streakPop { 0%{transform:scale(.3);opacity:0} 60%{transform:scale(1.25)} 100%{transform:scale(1);opacity:1} }

/* Caída de la ficha recién colocada */
.tile-visual.board-tile.drop-in { animation:tileDrop .4s cubic-bezier(.2,1.4,.35,1); }
@keyframes tileDrop {
    0%   { transform:translateY(-42px) rotate(-8deg) scale(.7); opacity:0; }
    70%  { transform:translateY(4px) rotate(2deg) scale(1.06); }
    100% { transform:translateY(0) rotate(0) scale(1); opacity:1; }
}

/* Puntos flotantes al ganar una mano */
.float-pts {
    position:fixed; z-index:450; font-size:34px; font-weight:900; pointer-events:none;
    text-shadow:0 2px 8px rgba(0,0,0,.6); animation:floatUp 1.25s ease-out forwards;
}
.float-pts.tu  { color:#4aa3ff; }
.float-pts.mdo { color:#ff6b6b; }
@keyframes floatUp {
    0%   { transform:translateY(0) scale(.5); opacity:0; }
    18%  { transform:translateY(-12px) scale(1.2); opacity:1; }
    100% { transform:translateY(-95px) scale(1); opacity:0; }
}

/* Mesa de fieltro verde (esencia del dominó) + brillo en fichas */
#board-surface {
    background: radial-gradient(ellipse at center, #14532d 0%, #0f3d22 55%, #0a2c17 100%);
    border: 2px solid #c49a5c;
    box-shadow: inset 0 0 45px rgba(0,0,0,.55), 0 8px 30px rgba(0,0,0,.45);
}
.tile-visual { background: linear-gradient(160deg,#ffffff 0%,#eef1f5 100%); }
.tile-visual.hand-tile { transition: transform .12s ease, box-shadow .12s ease; }
.tile-visual.hand-tile:hover { transform: translateY(-6px) scale(1.04); box-shadow:0 10px 20px rgba(0,0,0,.5); }
/* Círculos de fondo con leve movimiento */
.circle-top { animation: floatA 9s ease-in-out infinite alternate; }
.circle-bottom { animation: floatB 11s ease-in-out infinite alternate; }
@keyframes floatA { 0%{transform:translate(0,0)} 100%{transform:translate(30px,25px)} }
@keyframes floatB { 0%{transform:translate(0,0)} 100%{transform:translate(-25px,-20px)} }

/* ═══════════ Animación de RONDA GANADA ═══════════ */
#round-win-overlay {
    position: fixed; inset: 0; z-index: 400; overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    background: radial-gradient(circle at center, rgba(15,23,42,.55), rgba(0,0,0,.82));
}
.rw-card {
    position: relative; z-index: 2; text-align: center; padding: 26px 34px;
    background: linear-gradient(160deg, #1E293B, #0F172A);
    border: 3px solid var(--gold); border-radius: 22px;
    box-shadow: 0 20px 60px rgba(0,0,0,.6), 0 0 40px rgba(255,214,0,.35);
    animation: rwPop .5s cubic-bezier(.2,1.4,.4,1) both;
}
@keyframes rwPop {
    0%   { transform: scale(.4) rotate(-6deg); opacity: 0; }
    60%  { transform: scale(1.08) rotate(2deg); opacity: 1; }
    100% { transform: scale(1) rotate(0); opacity: 1; }
}
.rw-trophy { font-size: 68px; line-height: 1; animation: rwBounce 1s infinite ease-in-out; }
@keyframes rwBounce {
    0%,100% { transform: translateY(0) scale(1); }
    50%     { transform: translateY(-12px) scale(1.08); }
}
.rw-title { margin-top: 6px; font-size: 15px; font-weight: 800; letter-spacing: 2px; color: rgba(255,255,255,.75); text-transform: uppercase; }
.rw-winner {
    font-size: 40px; font-weight: 900; letter-spacing: 1px; margin: 2px 0 4px;
    background: linear-gradient(90deg, #FFD600, #FF9800, #FFD600);
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
    animation: rwShine 1.6s linear infinite; background-size: 200% auto;
}
@keyframes rwShine { to { background-position: 200% center; } }
.rw-score { font-size: 16px; font-weight: 800; color: var(--gold); }
/* Confeti */
.rw-confetti { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.rw-confetti i {
    position: absolute; top: -14px; width: 10px; height: 16px; border-radius: 2px; opacity: .95;
    animation: rwFall linear infinite;
}
@keyframes rwFall {
    0%   { transform: translateY(-10vh) rotate(0); }
    100% { transform: translateY(110vh) rotate(720deg); }
}
