/* ======================================================
   WORDLE MUNDIAL 2026 - ESTILO VIDEOJUEGO PROFESIONAL
   Optimizado para vertical / TikTok Live
   ====================================================== */

/* Fuente de banderas Twemoji para Chrome/Edge en Windows (y cualquier navegador
   que no renderice los emojis de banderas de países). El unicode-range garantiza
   que solo se use para los codepoints de banderas y no afecte al resto del texto. */
@font-face {
    font-family: "Twemoji Country Flags";
    unicode-range: U+1F1E6-1F1FF, U+1F3F4, U+E0062-E0063, U+E0065, U+E0067,
        U+E006C, U+E006E, U+E0073-E0074, U+E0077, U+E007F;
    src: url('https://cdn.jsdelivr.net/npm/country-flag-emoji-polyfill@0.1/dist/TwemojiCountryFlags.woff2') format('woff2');
    font-display: swap;
}

* {
    box-sizing: border-box;
}

/* Asegurar que botones, inputs, etc heredan la fuente (por defecto usan la del sistema) */
button, input, select, textarea {
    font-family: inherit;
}

/* Imágenes de banderas (Twemoji) */
.flag-img {
    display: inline-block;
    width: 1.3em;
    height: 1.3em;
    vertical-align: -0.25em;
    margin: 0 2px;
}

.flag-img.flag-inline {
    width: 1.1em;
    height: 1.1em;
}

.flag-img.flag-big {
    width: 1.5em;
    height: 1.5em;
    vertical-align: -0.3em;
}

:root {
    --color-primary: #00d4ff;
    --color-primary-dark: #0099cc;
    --color-accent: #ffd700;
    --color-success: #2ecc71;
    --color-danger: #e74c3c;
    --color-dark: #0a1929;
    --color-dark-2: #132f4c;
    --color-dark-3: #1e3a5f;
    --color-text: #ffffff;
    --color-text-dim: #b2bac2;
    --glass-bg: rgba(255, 255, 255, 0.08);
    --glass-border: rgba(255, 255, 255, 0.15);
    --shadow-glow: 0 0 20px rgba(0, 212, 255, 0.4);
    --shadow-deep: 0 10px 30px rgba(0, 0, 0, 0.5);
    --correct: #6aaa64;
    --present: #c9b458;
    --absent: #3a3a3c;
}

/* Fondo degradado estilo estadio de noche */
body {
    font-family: "Twemoji Country Flags", 'Inter', 'Segoe UI', 'Arial', sans-serif;
    background: linear-gradient(135deg, #0a1929 0%, #132f4c 50%, #0a1929 100%);
    background-attachment: fixed;
    color: var(--color-text);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    position: relative;
}

/* Textura de estadio con luces difusas */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 20% 20%, rgba(0, 212, 255, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(255, 215, 0, 0.06) 0%, transparent 50%),
        radial-gradient(circle at 50% 100%, rgba(46, 204, 113, 0.05) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}

/* Contenedor principal - mantiene layout vertical y compacto */
.app-shell {
    width: 100%;
    max-width: 460px;
    padding: 10px 12px;
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ======================================================
   CABECERA
   ====================================================== */
header {
    text-align: center;
    margin-bottom: 8px;
}

header h1 {
    font-size: 1.6em;
    font-weight: 900;
    letter-spacing: 1px;
    margin: 0;
    background: linear-gradient(135deg, #00d4ff 0%, #ffd700 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px rgba(0, 212, 255, 0.3);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.player-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: var(--color-accent);
    font-size: 0.78em;
    font-weight: 800;
}

.back-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 6px;
    color: var(--color-text-dim);
    font-size: 0.74em;
    font-weight: 800;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.back-link:hover {
    color: var(--color-primary);
}

.year-badge {
    background: linear-gradient(135deg, #ffd700, #ff9500);
    color: #0a1929;
    font-size: 0.55em;
    padding: 3px 10px;
    border-radius: 12px;
    font-weight: 900;
    -webkit-text-fill-color: #0a1929;
    letter-spacing: 1px;
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.4);
}

/* ======================================================
   PANTALLA DE NICKNAME
   ====================================================== */
#nickname-screen {
    width: 100%;
    text-align: center;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    padding: 22px 16px;
    border-radius: 16px;
    box-shadow: var(--shadow-deep);
    animation: fadeInUp 0.6s ease-out;
}

#nickname-screen h2 {
    margin: 0 0 8px 0;
    font-size: 1.25em;
    color: #fff;
}

.nickname-copy {
    margin: 0 auto 16px;
    max-width: 310px;
    color: var(--color-text-dim);
    font-size: 0.86em;
    line-height: 1.35;
}

.nickname-form {
    display: flex;
    gap: 8px;
    width: 100%;
}

#nickname-input {
    flex: 1;
    min-width: 0;
    height: 44px;
    border-radius: 10px;
    border: 1.5px solid rgba(255, 255, 255, 0.18);
    background: rgba(0, 0, 0, 0.28);
    color: #fff;
    padding: 0 12px;
    font-size: 1em;
    font-weight: 700;
    outline: none;
}

#nickname-input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.14);
}

#nickname-input::placeholder {
    color: rgba(255, 255, 255, 0.42);
}

#save-nickname-btn {
    height: 44px;
    padding: 0 18px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #00d4ff 0%, #2ecc71 100%);
    color: #0a1929;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.35);
}

.nickname-error {
    min-height: 18px;
    margin: 10px 0 0;
    color: #ff9d9d;
    font-size: 0.78em;
    font-weight: 700;
}

main {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%;
}

/* ======================================================
   PANTALLA DE SELECCIÓN DE EQUIPOS
   ====================================================== */
#team-selection-screen {
    text-align: center;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    padding: 16px 14px;
    border-radius: 16px;
    box-shadow: var(--shadow-deep);
    width: 100%;
    animation: fadeInUp 0.6s ease-out;
}

#team-selection-screen h2 {
    margin: 0 0 8px 0;
    font-size: 1.1em;
    font-weight: 700;
    color: var(--color-text);
    letter-spacing: 0.5px;
}

.champions-progress {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.15), rgba(255, 149, 0, 0.1));
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 10px;
    padding: 10px;
    margin: 0 0 12px 0;
    font-size: 0.85em;
    color: var(--color-accent);
}

/* Panel de progreso: grid con balones, mundiales, colección */
.progress-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-bottom: 10px;
}

.progress-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 6px 4px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.progress-icon {
    font-size: 1.3em;
    line-height: 1;
}

.progress-value {
    font-size: 1em;
    font-weight: 900;
    color: #fff;
    line-height: 1;
}

.progress-label {
    font-size: 0.65em;
    font-weight: 600;
    color: var(--color-text-dim);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.progress-actions {
    display: flex;
    gap: 6px;
    justify-content: center;
    flex-wrap: wrap;
}

.mini-btn {
    padding: 6px 8px;
    font-size: 0.72em;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.mini-btn:hover {
    background: rgba(0, 212, 255, 0.18);
    border-color: var(--color-primary);
    transform: translateY(-1px);
}

/* ======================================================
   MODALES DE PERFIL (stats, logros, tienda)
   ====================================================== */
.profile-modal {
    position: fixed;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 25, 41, 0.88);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    padding: 16px;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.profile-modal-content {
    background: linear-gradient(135deg, var(--color-dark-2), var(--color-dark));
    width: 100%;
    max-width: 420px;
    max-height: 85vh;
    border-radius: 14px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-deep);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.profile-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.15), rgba(255, 215, 0, 0.1));
    border-bottom: 1px solid var(--glass-border);
}

.profile-modal-header h2 {
    margin: 0;
    font-size: 1.15em;
    color: #fff;
    font-weight: 800;
}

.profile-modal-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-size: 0.9em;
    cursor: pointer;
    transition: all 0.2s;
}

.profile-modal-close:hover {
    background: var(--color-danger);
    transform: rotate(90deg);
}

.profile-modal-body {
    padding: 14px 16px;
    overflow-y: auto;
    flex: 1;
}

/* --- Estadísticas --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    margin-bottom: 12px;
}

.stat-item {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.stat-label {
    font-size: 0.72em;
    color: var(--color-text-dim);
    font-weight: 500;
}

.stat-value {
    font-size: 1.15em;
    font-weight: 800;
    color: var(--color-accent);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.history-row {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-left: 4px solid var(--color-text-dim);
    border-radius: 8px;
    padding: 9px 10px;
}

.history-row.history-win {
    border-left-color: var(--color-success);
}

.history-row.history-draw {
    border-left-color: var(--color-accent);
}

.history-row.history-loss {
    border-left-color: var(--color-danger);
}

.history-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-weight: 800;
}

.history-result {
    color: var(--color-accent);
    white-space: nowrap;
}

.history-title {
    min-width: 0;
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-meta,
.history-secret {
    margin-top: 4px;
    color: var(--color-text-dim);
    font-size: 0.72em;
    line-height: 1.25;
}

.history-secret {
    color: rgba(255, 255, 255, 0.72);
}

.history-empty {
    padding: 18px 12px;
    color: var(--color-text-dim);
    text-align: center;
    line-height: 1.35;
}

.ranking-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ranking-row {
    display: grid;
    grid-template-columns: 42px 1fr 72px 82px;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 9px 10px;
}

.ranking-row.current-player {
    border-color: rgba(255, 215, 0, 0.55);
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.12), rgba(0, 212, 255, 0.08));
}

.ranking-position {
    color: var(--color-accent);
    font-size: 1.05em;
    font-weight: 900;
}

.ranking-player {
    min-width: 0;
}

.ranking-name {
    color: #fff;
    font-size: 0.9em;
    font-weight: 900;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ranking-meta {
    margin-top: 2px;
    color: var(--color-text-dim);
    font-size: 0.7em;
}

.ranking-score {
    text-align: right;
}

.ranking-score strong {
    display: block;
    color: var(--color-accent);
    font-size: 0.9em;
}

.ranking-score span {
    display: block;
    color: var(--color-text-dim);
    font-size: 0.62em;
    text-transform: uppercase;
}

.stats-subtitle {
    font-size: 0.9em;
    color: var(--color-primary);
    margin: 16px 0 8px 0;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* --- Logros --- */
.achievements-header {
    text-align: center;
    color: var(--color-accent);
    font-size: 1em;
    margin-bottom: 12px;
    padding: 8px;
    background: rgba(255, 215, 0, 0.08);
    border-radius: 8px;
}

.achievements-header strong {
    color: #fff;
    font-size: 1.15em;
}

.achievement-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 10px;
    margin-bottom: 5px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    transition: all 0.2s;
}

.achievement-row.unlocked {
    background: linear-gradient(135deg, rgba(46, 204, 113, 0.1), rgba(255, 215, 0, 0.08));
    border-color: rgba(46, 204, 113, 0.3);
}

.achievement-row.locked {
    opacity: 0.6;
}

.achievement-icon {
    font-size: 1.6em;
    flex-shrink: 0;
    width: 36px;
    text-align: center;
}

.achievement-info {
    flex: 1;
    min-width: 0;
}

.achievement-name {
    font-weight: 800;
    color: #fff;
    font-size: 0.9em;
}

.achievement-desc {
    font-size: 0.72em;
    color: var(--color-text-dim);
    margin-top: 2px;
}

.achievement-reward {
    font-size: 0.85em;
    font-weight: 700;
    color: var(--color-accent);
    flex-shrink: 0;
}

.achievement-row.unlocked .achievement-reward {
    color: var(--color-success);
}

/* --- Tienda --- */
.shop-coin-display {
    text-align: center;
    font-size: 1em;
    color: var(--color-accent);
    padding: 10px;
    background: rgba(255, 215, 0, 0.1);
    border-radius: 10px;
    margin-bottom: 14px;
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.shop-coin-display strong {
    color: #fff;
    font-size: 1.25em;
}

.shop-category {
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin: 14px 0 8px 0;
    text-align: center;
    border-bottom: 1px solid currentColor;
    padding-bottom: 6px;
    font-weight: 800;
}

.shop-category-gold {
    color: #ffd700;
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.4);
}

.shop-category-purple {
    color: #b967ff;
    text-shadow: 0 0 8px rgba(185, 103, 255, 0.4);
}

.shop-category-blue {
    color: #4fc3f7;
    text-shadow: 0 0 8px rgba(79, 195, 247, 0.4);
}

.shop-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 4px;
}

.shop-item {
    background: rgba(255, 255, 255, 0.04);
    border: 1.5px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 8px 6px 10px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
}

/* Borde y glow por rareza */
.shop-item-gold {
    border-color: rgba(255, 215, 0, 0.4);
    box-shadow: inset 0 0 12px rgba(255, 215, 0, 0.08);
}

.shop-item-gold:hover {
    border-color: #ffd700;
    box-shadow: 0 0 14px rgba(255, 215, 0, 0.35);
}

.shop-item-purple {
    border-color: rgba(185, 103, 255, 0.4);
    box-shadow: inset 0 0 12px rgba(185, 103, 255, 0.08);
}

.shop-item-purple:hover {
    border-color: #b967ff;
    box-shadow: 0 0 14px rgba(185, 103, 255, 0.35);
}

.shop-item-blue {
    border-color: rgba(79, 195, 247, 0.4);
    box-shadow: inset 0 0 12px rgba(79, 195, 247, 0.08);
}

.shop-item-blue:hover {
    border-color: #4fc3f7;
    box-shadow: 0 0 14px rgba(79, 195, 247, 0.35);
}

.shop-item.owned {
    background: linear-gradient(135deg, rgba(46, 204, 113, 0.15), rgba(39, 174, 96, 0.1));
    border-color: var(--color-success) !important;
    box-shadow: 0 0 10px rgba(46, 204, 113, 0.3) !important;
}

/* Contenedor del icono de objeto: contiene la imagen Y el emoji fallback */
.shop-item-icon {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
}

.shop-item-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.shop-item-emoji-fallback {
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    font-size: 2.2em;
    line-height: 1;
}

/* Glow interno sutil del fondo del icono según rareza (solo cuando se usa fallback emoji) */
.shop-item-icon-gold {
    background: radial-gradient(circle, rgba(255, 215, 0, 0.15), rgba(0, 0, 0, 0.4));
}

.shop-item-icon-purple {
    background: radial-gradient(circle, rgba(185, 103, 255, 0.15), rgba(0, 0, 0, 0.4));
}

.shop-item-icon-blue {
    background: radial-gradient(circle, rgba(79, 195, 247, 0.15), rgba(0, 0, 0, 0.4));
}

.shop-item-name {
    font-size: 0.72em;
    font-weight: 700;
    color: #fff;
    min-height: 2.2em;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.15;
}

.shop-item-price {
    font-size: 0.72em;
    color: var(--color-accent);
    font-weight: 700;
}

.shop-item.owned .shop-item-price {
    color: var(--color-success);
}

.shop-buy-btn {
    width: 100%;
    padding: 5px 6px;
    font-size: 0.7em;
    font-weight: 700;
    border: none;
    border-radius: 6px;
    background: linear-gradient(135deg, #00d4ff, #0099cc);
    color: #0a1929;
    cursor: pointer;
    margin-top: 4px;
    transition: all 0.15s;
}

.shop-buy-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0, 212, 255, 0.4);
}

.shop-buy-btn:disabled {
    background: rgba(255, 255, 255, 0.1);
    color: var(--color-text-dim);
    cursor: not-allowed;
}

/* ======================================================
   TOAST DE LOGRO DESBLOQUEADO
   ====================================================== */
.achievement-toast {
    position: fixed;
    top: 30px;
    left: 50%;
    transform: translate(-50%, -120%);
    z-index: 5500;
    transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
}

.achievement-toast.show {
    transform: translate(-50%, 0);
}

.achievement-toast-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, #1e3a5f, #0a1929);
    border: 2px solid var(--color-accent);
    border-radius: 12px;
    padding: 10px 16px;
    box-shadow: 0 8px 28px rgba(255, 215, 0, 0.35), 0 0 20px rgba(255, 215, 0, 0.15);
    min-width: 260px;
    max-width: 90vw;
}

.achievement-toast-icon {
    font-size: 2em;
    flex-shrink: 0;
    filter: drop-shadow(0 0 6px rgba(255, 215, 0, 0.6));
}

.achievement-toast-text {
    flex: 1;
    min-width: 0;
}

.achievement-toast-label {
    font-size: 0.68em;
    color: var(--color-accent);
    font-weight: 800;
    letter-spacing: 0.5px;
}

.achievement-toast-name {
    font-size: 1em;
    font-weight: 800;
    color: #fff;
    margin: 2px 0;
}

.achievement-toast-reward {
    font-size: 0.72em;
    color: var(--color-accent);
    font-weight: 700;
}

/* ======================================================
   CROMOS DE LEYENDAS — ANIMACIÓN DE DESBLOQUEO
   ====================================================== */
.legend-unlock-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0);
    backdrop-filter: blur(0px);
    z-index: 6000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px;
    opacity: 0;
    transition: opacity 0.35s ease, backdrop-filter 0.35s ease;
    overflow: hidden;
}

.legend-unlock-overlay.show {
    opacity: 1;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
}

.legend-unlock-overlay.closing {
    opacity: 0;
}

.legend-unlock-rays {
    position: absolute;
    top: 50%; left: 50%;
    width: 800px;
    height: 800px;
    transform: translate(-50%, -50%) scale(0);
    border-radius: 50%;
    animation: legendRays 2s ease-out forwards;
    pointer-events: none;
}

@keyframes legendRays {
    0% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
    40% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1.3); opacity: 0.4; }
}

.legend-particle {
    position: absolute;
    top: 50%; left: 50%;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    box-shadow: 0 0 12px currentColor;
    transform: translate(-50%, -50%);
    animation: legendParticle 1.8s ease-out forwards;
    opacity: 0;
}

@keyframes legendParticle {
    0% { transform: translate(-50%, -50%) scale(0); opacity: 1; }
    100% { transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) scale(0.3); opacity: 0; }
}

.legend-unlock-label {
    font-size: 1.1em;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 0 20px currentColor;
    animation: legendLabelIn 0.6s ease-out both;
    animation-delay: 0.3s;
    position: relative;
    z-index: 2;
}

@keyframes legendLabelIn {
    0% { transform: translateY(-30px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

/* Tarjeta de cromo grande (centro de la pantalla) */
.legend-card {
    width: 240px;
    max-width: 80vw;
    aspect-ratio: 2/3;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--card-color-dark), #0a1929);
    border: 3px solid var(--card-color);
    box-shadow:
        0 0 40px var(--card-glow),
        0 0 80px var(--card-glow),
        inset 0 0 20px rgba(0, 0, 0, 0.5);
    position: relative;
    overflow: hidden;
    animation: legendCardIn 0.9s cubic-bezier(0.34, 1.56, 0.64, 1) both;
    animation-delay: 0.5s;
    transform: scale(0) rotateY(180deg);
    z-index: 2;
}

@keyframes legendCardIn {
    0% { transform: scale(0) rotateY(180deg); opacity: 0; }
    60% { transform: scale(1.1) rotateY(0deg); opacity: 1; }
    100% { transform: scale(1) rotateY(0deg); opacity: 1; }
}

/* Brillo animado en el borde del cromo */
.legend-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 30%,
        var(--card-color) 50%,
        transparent 70%
    );
    opacity: 0.4;
    animation: legendShine 3s ease-in-out infinite;
    animation-delay: 1.5s;
}

@keyframes legendShine {
    0%, 100% { transform: translateX(-100%); }
    50% { transform: translateX(100%); }
}

.legend-card-inner {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 14px 12px;
    color: white;
}

.legend-card-rarity-label {
    font-size: 0.65em;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--card-color);
    text-shadow: 0 0 8px var(--card-glow);
    margin-bottom: 8px;
}

.legend-card-image {
    flex: 1;
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.legend-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.legend-card-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--card-color-dark), rgba(0, 0, 0, 0.6));
}

.legend-card-initial {
    font-size: 5em;
    font-weight: 900;
    color: var(--card-color);
    text-shadow: 0 0 20px var(--card-glow);
}

.legend-card-name {
    font-size: 1.3em;
    font-weight: 900;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-top: 10px;
    color: #fff;
    text-shadow: 0 0 10px var(--card-glow);
}

.legend-card-flag-line {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    font-size: 0.75em;
    color: rgba(255, 255, 255, 0.8);
}

.legend-unlock-reward {
    font-size: 1.1em;
    font-weight: 900;
    animation: legendLabelIn 0.6s ease-out both;
    animation-delay: 1.2s;
    opacity: 0;
    animation-fill-mode: forwards;
    z-index: 2;
}

.legend-unlock-close {
    padding: 10px 24px;
    font-size: 1em;
    font-weight: 800;
    border: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    cursor: pointer;
    transition: all 0.2s;
    animation: legendLabelIn 0.6s ease-out both;
    animation-delay: 1.6s;
    opacity: 0;
    animation-fill-mode: forwards;
    z-index: 2;
}

.legend-unlock-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

/* ======================================================
   ÁLBUM DE LEYENDAS (modal)
   ====================================================== */
.legend-album-header {
    text-align: center;
    color: var(--color-accent);
    font-size: 1em;
    margin-bottom: 12px;
    padding: 10px;
    background: rgba(255, 215, 0, 0.08);
    border-radius: 8px;
}

.legend-album-header strong {
    color: #fff;
    font-size: 1.3em;
}

.legend-category-title {
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 16px 0 8px 0;
    text-align: center;
    text-shadow: 0 0 10px currentColor;
    font-weight: 800;
}

.legend-category-count {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85em;
    font-weight: 600;
    margin-left: 6px;
    text-shadow: none;
}

.legend-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 4px;
}

.legend-grid-card {
    aspect-ratio: 2/3;
    border-radius: 10px;
    border: 2px solid transparent;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.2s;
}

.legend-grid-card.unlocked {
    border-color: var(--card-color);
    box-shadow: 0 0 8px var(--card-glow), inset 0 0 10px rgba(0, 0, 0, 0.5);
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.2));
}

.legend-grid-card.unlocked:hover {
    transform: translateY(-3px);
    box-shadow: 0 0 16px var(--card-glow), 0 4px 12px rgba(0, 0, 0, 0.4);
}

.legend-grid-card.locked {
    border-color: rgba(255, 255, 255, 0.1);
    opacity: 0.55;
    filter: grayscale(1);
}

.legend-grid-img {
    flex: 1;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.35);
    overflow: hidden;
}

.legend-grid-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.legend-grid-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--card-color), rgba(0, 0, 0, 0.5));
}

.legend-grid-placeholder span {
    font-size: 2.3em;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 0 12px var(--card-glow);
}

.legend-grid-locked-icon {
    font-size: 2em;
    font-weight: 900;
    color: rgba(255, 255, 255, 0.3);
}

.legend-grid-name {
    padding: 5px 4px;
    text-align: center;
    font-size: 0.72em;
    font-weight: 800;
    color: #fff;
    background: rgba(0, 0, 0, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.legend-grid-card.locked .legend-grid-name {
    color: rgba(255, 255, 255, 0.4);
}

#team-list {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 5px;
    max-width: 100%;
    margin: 8px 0;
}

.team-choice {
    position: relative;
    background: rgba(255, 255, 255, 0.06);
    border: 1.5px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 5px 2px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--color-text);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    min-height: 48px;
    overflow: hidden;
}

.team-choice:hover {
    background: rgba(0, 212, 255, 0.15);
    border-color: var(--color-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 212, 255, 0.25);
}

.team-choice .team-flag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.team-choice .team-flag .flag-img {
    width: 22px;
    height: 22px;
    margin: 0;
    vertical-align: middle;
}

.team-choice .team-abbr {
    font-size: 0.65em;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--color-text-dim);
}

.team-choice.selected {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.3), rgba(0, 153, 204, 0.3));
    border-color: var(--color-primary);
    transform: scale(1.08);
    box-shadow: var(--shadow-glow);
}

.team-choice.selected .team-abbr {
    color: #fff;
}

/* Equipos ya conquistados (campeones guardados) */
.team-choice.conquered {
    background: linear-gradient(135deg, rgba(46, 204, 113, 0.3), rgba(39, 174, 96, 0.25));
    border-color: var(--color-success);
    box-shadow: 0 0 12px rgba(46, 204, 113, 0.4), inset 0 0 10px rgba(46, 204, 113, 0.1);
}

.team-choice.conquered .team-abbr {
    color: #a9f2c8;
    font-weight: 900;
}

.team-choice.conquered .champion-star {
    position: absolute;
    top: 1px;
    right: 2px;
    font-size: 0.7em;
    filter: drop-shadow(0 0 3px gold);
    animation: starPulse 2s ease-in-out infinite;
}

.team-choice.conquered.selected {
    background: linear-gradient(135deg, rgba(46, 204, 113, 0.5), rgba(0, 212, 255, 0.3));
    border-color: var(--color-accent);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

@keyframes starPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.85; }
}

.selection-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
    margin-top: 8px;
    flex-wrap: wrap;
}

#start-game-btn {
    padding: 10px 20px;
    font-size: 1em;
    font-weight: 700;
    cursor: pointer;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #00d4ff 0%, #2ecc71 100%);
    color: #0a1929;
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.4);
    min-width: 180px;
}

#start-game-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 212, 255, 0.6);
}

#start-game-btn:disabled {
    background: rgba(255, 255, 255, 0.1);
    color: var(--color-text-dim);
    cursor: not-allowed;
    box-shadow: none;
}

.secondary-btn {
    padding: 8px 12px;
    font-size: 0.85em;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--color-text-dim);
    transition: all 0.2s ease;
}

.secondary-btn:hover {
    background: rgba(231, 76, 60, 0.2);
    border-color: var(--color-danger);
    color: #fff;
}

.selection-hint {
    font-size: 0.75em;
    color: var(--color-text-dim);
    margin: 8px 0 0 0;
    font-style: italic;
}

/* ======================================================
   PANTALLA DE JUEGO - MATCH DISPLAY
   ====================================================== */
#match-display {
    font-size: 1em;
    font-weight: 700;
    color: var(--color-text);
    margin: 0 0 6px 0;
    text-align: center;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    padding: 8px 14px;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
    letter-spacing: 0.3px;
    width: 100%;
}

/* Banner persistente del evento activo (queda visible durante todo el partido) */
#event-banner {
    width: 100%;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.18), rgba(255, 149, 0, 0.14));
    border: 1px solid rgba(255, 215, 0, 0.45);
    border-radius: 10px;
    padding: 6px 10px;
    margin: 0 0 4px 0;
    text-align: center;
    line-height: 1.25;
    animation: eventBannerPulse 0.6s ease-out;
}

#event-banner .event-banner-title {
    display: block;
    font-size: 0.9em;
    font-weight: 800;
    color: var(--color-accent);
    letter-spacing: 0.3px;
}

#event-banner .event-banner-desc {
    display: block;
    font-size: 0.72em;
    color: #fff;
    opacity: 0.9;
    margin-top: 2px;
}

#event-banner .event-banner-extra {
    display: block;
    font-size: 0.8em;
    color: #fff;
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px dashed rgba(255, 215, 0, 0.4);
    animation: eventBannerPulse 0.5s ease-out;
}

#event-banner .event-banner-extra b {
    color: var(--color-accent);
    font-weight: 800;
}

@keyframes eventBannerPulse {
    0% { transform: scale(0.92); opacity: 0; }
    60% { transform: scale(1.02); }
    100% { transform: scale(1); opacity: 1; }
}

/* ======================================================
   CUADRÍCULA DE JUEGO (TILES)
   ====================================================== */
#game-grid {
    display: grid;
    grid-template-rows: repeat(6, 1fr);
    gap: 4px;
}

.grid-row {
    display: grid;
    gap: 4px;
}

.grid-tile {
    width: 48px;
    height: 48px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.04);
    border-radius: 6px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.6em;
    font-weight: 900;
    text-transform: uppercase;
    color: var(--color-text);
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.grid-tile:not(:empty) {
    border-color: rgba(255, 255, 255, 0.5);
    animation: tilePop 0.15s ease-out;
}

@keyframes tilePop {
    0% { transform: scale(0.8); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Colores de estado de las letras */
.correct {
    background: linear-gradient(135deg, #6aaa64 0%, #4d8a47 100%) !important;
    border-color: #6aaa64 !important;
    color: white !important;
    box-shadow: 0 4px 12px rgba(106, 170, 100, 0.4) !important;
    animation: tileFlip 0.5s ease !important;
}

.present {
    background: linear-gradient(135deg, #c9b458 0%, #a8943d 100%) !important;
    border-color: #c9b458 !important;
    color: white !important;
    box-shadow: 0 4px 12px rgba(201, 180, 88, 0.4) !important;
    animation: tileFlip 0.5s ease !important;
}

.absent {
    background: linear-gradient(135deg, #3a3a3c 0%, #2a2a2c 100%) !important;
    border-color: #3a3a3c !important;
    color: #b2bac2 !important;
    animation: tileFlip 0.5s ease !important;
}

@keyframes tileFlip {
    0% { transform: rotateX(0); }
    50% { transform: rotateX(90deg); }
    100% { transform: rotateX(0); }
}

/* ======================================================
   TECLADO
   ====================================================== */
#keyboard {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 100%;
    max-width: 460px;
    margin-top: 2px;
}

.keyboard-row {
    display: flex;
    justify-content: center;
    gap: 4px;
}

.key-btn {
    flex: 1;
    max-width: 40px;
    height: 46px;
    padding: 0;
    font-size: 0.95em;
    font-weight: 800;
    border-radius: 6px;
    border: none;
    background: linear-gradient(180deg, #4a5670 0%, #2d3650 100%);
    color: #fff;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.15s ease;
    box-shadow: 0 3px 0 #1a2138, 0 4px 6px rgba(0, 0, 0, 0.3);
    user-select: none;
}

.key-btn:hover {
    background: linear-gradient(180deg, #5a6680 0%, #3d4660 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 0 #1a2138, 0 5px 8px rgba(0, 0, 0, 0.3);
}

.key-btn:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 #1a2138, 0 2px 3px rgba(0, 0, 0, 0.3);
}

/* Teclas especiales (ENTER y ⌫) más anchas */
.key-btn[data-key="ENTER"],
.key-btn[data-key="⌫"] {
    max-width: 60px;
    font-size: 0.75em;
    background: linear-gradient(180deg, #00d4ff 0%, #0099cc 100%);
    box-shadow: 0 3px 0 #005577, 0 4px 6px rgba(0, 0, 0, 0.3);
}

.key-btn[data-key="ENTER"]:hover,
.key-btn[data-key="⌫"]:hover {
    background: linear-gradient(180deg, #1ae4ff 0%, #00aadd 100%);
}

/* Colores de estado en el teclado */
.key-btn.correct {
    background: linear-gradient(180deg, #6aaa64 0%, #4d8a47 100%) !important;
    box-shadow: 0 3px 0 #2d5a2a, 0 4px 6px rgba(0, 0, 0, 0.3) !important;
}

.key-btn.present {
    background: linear-gradient(180deg, #c9b458 0%, #a8943d 100%) !important;
    box-shadow: 0 3px 0 #6a5d20, 0 4px 6px rgba(0, 0, 0, 0.3) !important;
}

.key-btn.absent {
    background: linear-gradient(180deg, #3a3a3c 0%, #2a2a2c 100%) !important;
    color: #666 !important;
    box-shadow: 0 3px 0 #1a1a1c, 0 4px 6px rgba(0, 0, 0, 0.3) !important;
}

/* Tecla bloqueada por evento "bad_luck" (lesión del crack) */
.key-btn.blocked {
    background: linear-gradient(180deg, #6a1a1a 0%, #3e0a0a 100%) !important;
    color: rgba(255, 100, 100, 0.5) !important;
    box-shadow: 0 3px 0 #2a0505, 0 4px 6px rgba(0, 0, 0, 0.4) !important;
    position: relative;
    cursor: not-allowed;
}

.key-btn.blocked::after {
    content: '🔒';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.2em;
    opacity: 0.6;
}

/* Animación de shake cuando intentas usar una tecla bloqueada */
.key-btn.key-shake {
    animation: keyShake 0.35s ease-in-out;
}

@keyframes keyShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-4px); }
    40% { transform: translateX(4px); }
    60% { transform: translateX(-3px); }
    80% { transform: translateX(3px); }
}

/* ======================================================
   BOTONES DE ACCIÓN DEL JUEGO
   ====================================================== */
.game-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 4px;
}

#next-match-btn {
    padding: 10px 22px;
    font-size: 1em;
    font-weight: 700;
    cursor: pointer;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #00d4ff, #0099cc);
    color: #fff;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.4);
    transition: all 0.2s;
}

#next-match-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 212, 255, 0.6);
}

#toggle-groups-btn {
    padding: 8px 16px;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    background: var(--glass-bg);
    color: var(--color-text);
    backdrop-filter: blur(10px);
    transition: all 0.2s;
}

#toggle-groups-btn:hover {
    background: rgba(0, 212, 255, 0.15);
    border-color: var(--color-primary);
}

/* ======================================================
   MODAL DE RESULTADO
   ====================================================== */
#result-modal {
    position: fixed;
    top: 30%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, rgba(10, 25, 41, 0.95), rgba(19, 47, 76, 0.95));
    backdrop-filter: blur(20px);
    border: 2px solid var(--color-primary);
    color: white;
    padding: 20px 30px;
    border-radius: 16px;
    font-size: 1.3em;
    font-weight: 800;
    z-index: 1000;
    text-align: center;
    box-shadow: 0 0 40px rgba(0, 212, 255, 0.5), var(--shadow-deep);
    animation: fadeInOut 4s ease-in-out;
    max-width: 90%;
    line-height: 1.4;
}

#result-modal.hidden {
    display: none;
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.7); }
    15% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
    25% { transform: translate(-50%, -50%) scale(1); }
    80% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
}

/* ======================================================
   ELIMINATORIAS (BRACKET)
   ====================================================== */
#playoff-container {
    width: 100%;
    margin-top: 10px;
    text-align: center;
}

#playoff-container h2 {
    font-size: 1.3em;
    margin: 0 0 10px 0;
    background: linear-gradient(135deg, #ffd700, #ff9500);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.playoff-bracket {
    display: flex;
    justify-content: space-between;
    width: 100%;
    gap: 3px;
    overflow-x: auto;
    padding-bottom: 6px;
}

.playoff-round {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    flex: 1;
    min-width: 0;
}

.playoff-round h3 {
    font-size: 0.65em;
    color: var(--color-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 5px 0;
    padding: 0 2px;
    text-align: center;
    flex-shrink: 0;
}

.playoff-match {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    margin: 3px 1px;
    padding: 4px;
    font-size: 0.7em;
}

.playoff-match .team {
    padding: 3px 4px;
    display: flex;
    align-items: center;
    color: var(--color-text-dim);
    border-radius: 3px;
    margin: 1px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.playoff-match .team.winner {
    font-weight: 800;
    color: var(--color-accent);
    background: rgba(255, 215, 0, 0.12);
}

.playoff-match .team.player-team {
    background: rgba(0, 212, 255, 0.18);
    color: #fff;
    font-weight: 700;
    border-left: 3px solid var(--color-primary);
}

.playoff-match .team.player-team.winner {
    background: linear-gradient(90deg, rgba(255, 215, 0, 0.25), rgba(0, 212, 255, 0.25));
    color: #ffd700;
    border-left-color: var(--color-accent);
}

/* ======================================================
   VISTA DE GRUPOS
   ====================================================== */
#all-groups-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 25, 41, 0.88);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}

#all-groups-content {
    background: var(--color-dark-2);
    width: 100%;
    max-width: 380px;
    max-height: 70vh;
    overflow-y: auto;
    border-radius: 12px;
    padding: 10px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-deep);
}

#close-groups-btn {
    margin-top: 16px;
    padding: 10px 22px;
    font-size: 1em;
    font-weight: 700;
    cursor: pointer;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #00d4ff, #0099cc);
    color: white;
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.4);
    transition: all 0.2s;
}

#close-groups-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 212, 255, 0.6);
}

.group-accordion .group-header {
    background: linear-gradient(135deg, var(--color-dark-3), var(--color-dark-2));
    color: white;
    padding: 10px 14px;
    cursor: pointer;
    border-radius: 8px;
    margin-top: 6px;
    font-weight: 700;
    font-size: 0.9em;
    letter-spacing: 0.5px;
    transition: all 0.2s;
}

.group-accordion .group-header:hover {
    background: linear-gradient(135deg, #2d4a6f, var(--color-dark-3));
}

.group-accordion .group-header.player-group {
    background: linear-gradient(135deg, #0099cc, #00d4ff);
    box-shadow: 0 2px 10px rgba(0, 212, 255, 0.3);
}

.group-accordion .group-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.group-accordion table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8em;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 0 0 6px 6px;
    overflow: hidden;
}

.group-accordion th {
    background: #1e3a5f;
    color: white;
    padding: 6px 8px;
    text-align: left;
    font-size: 0.85em;
}

.group-accordion td {
    padding: 5px 8px;
    border-bottom: 1px solid #eee;
    color: #333;
}

.group-accordion tr:last-child td {
    border-bottom: none;
}

/* ======================================================
   BOTÓN RESTART
   ====================================================== */
#restart-btn {
    display: block;
    margin: 24px auto;
    padding: 12px 28px;
    font-size: 1.05em;
    font-weight: 800;
    cursor: pointer;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.4);
    transition: all 0.2s;
}

#restart-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.6);
}

/* ======================================================
   GUÍA DE RESULTADOS (3-0, 2-0, etc.)
   ====================================================== */
.game-attempt-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.score-guide {
    width: 40px;
    font-size: 1em;
    font-weight: 900;
    color: rgba(255, 255, 255, 0.25);
    text-align: right;
    transition: all 0.3s ease;
    font-family: 'Courier New', monospace;
    letter-spacing: -1px;
}

.score-guide.active {
    color: var(--color-accent);
    transform: scale(1.2);
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.score-guide.past {
    color: rgba(255, 255, 255, 0.15);
    transform: scale(0.9);
}

/* Indicador de penalti (balón de fútbol) */
.score-guide.penalty-guide {
    font-size: 1.1em;
    letter-spacing: 0;
    color: rgba(255, 255, 255, 0.35);
    filter: grayscale(0.6);
}

.score-guide.penalty-guide.active {
    color: var(--color-accent);
    filter: grayscale(0);
    transform: scale(1.3);
    text-shadow: 0 0 12px rgba(255, 215, 0, 0.6);
}

.score-guide.penalty-guide.past {
    filter: grayscale(0.3);
    opacity: 0.5;
}

/* ======================================================
   CONFETI (al ganar el mundial)
   ====================================================== */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5000;
    overflow: hidden;
}

.confetti-piece {
    position: absolute;
    top: -20px;
    width: 10px;
    height: 14px;
    opacity: 0;
    animation: confettiFall 4s linear forwards;
    border-radius: 2px;
}

@keyframes confettiFall {
    0% {
        opacity: 1;
        top: -20px;
        transform: rotate(0deg) translateX(0);
    }
    100% {
        opacity: 0.8;
        top: 110vh;
        transform: rotate(720deg) translateX(80px);
    }
}

/* ======================================================
   UTILIDADES Y ANIMACIONES
   ====================================================== */
.hidden {
    display: none !important;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Scrollbar personalizado */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 212, 255, 0.4);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 212, 255, 0.6);
}

/* ======================================================
   AJUSTES RESPONSIVE para pantallas pequeñas (TikTok Live)
   ====================================================== */
@media (max-width: 420px) {
    .app-shell {
        padding: 8px 8px;
    }
    header h1 {
        font-size: 1.4em;
    }
    .nickname-form {
        flex-direction: column;
    }
    #save-nickname-btn {
        width: 100%;
    }
    .ranking-row {
        grid-template-columns: 34px 1fr 62px;
    }
    .ranking-row .ranking-score:last-child {
        display: none;
    }
    .grid-tile {
        width: 44px;
        height: 44px;
        font-size: 1.4em;
    }
    .key-btn {
        height: 42px;
        font-size: 0.85em;
    }
    .key-btn[data-key="ENTER"],
    .key-btn[data-key="⌫"] {
        max-width: 54px;
        font-size: 0.7em;
    }
    #team-list {
        grid-template-columns: repeat(6, 1fr);
    }
    .team-choice {
        min-height: 42px;
    }
    .team-choice .team-flag {
        font-size: 1.1em;
    }
    .team-choice .team-abbr {
        font-size: 0.6em;
    }
}
