/* Estilos Profesionales para Pictionary Pro (Inspirado en Pinturillo 2) */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800;900&display=swap');

:root {
    --font-family: 'Poppins', system-ui, -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
    
    /* Variables - Modo Claro */
    --bg-body: #f0f4f9;
    --bg-header: rgba(255, 255, 255, 0.9);
    --bg-card: #ffffff;
    --bg-card-hover: #f8fafc;
    --bg-secondary: #f1f5f9;
    --border-color: #cbd5e1;
    --border-light: #e2e8f0;
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    
    --primary: #0284c7;
    --primary-hover: #0369a1;
    --primary-light: #e0f2fe;
    --accent-gold: #f59e0b;
    --success: #10b981;
    --danger: #ef4444;
    
    --chat-bg: #f8fafc;
    --chat-border: #e2e8f0;
    --chat-msg-self: #e0f2fe;
    --chat-correct-bg: #dcfce7;
    --chat-correct-border: #86efac;
    --chat-correct-text: #15803d;
    --chat-close-bg: #fef9c3;
    --chat-close-border: #fde047;
    --chat-close-text: #854d0e;
    
    --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.12);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-xl: 24px;
}

[data-theme="dark"] {
    --bg-body: #111827;
    --bg-header: rgba(30, 41, 59, 0.95);
    --bg-card: #1e293b;
    --bg-card-hover: #273548;
    --bg-secondary: #0f172a;
    --border-color: #334155;
    --border-light: #334155;
    
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    
    --primary: #38bdf8;
    --primary-hover: #0284c7;
    --primary-light: #082f49;
    --accent-gold: #fbbf24;
    --success: #34d399;
    --danger: #f87171;
    
    --chat-bg: #0f172a;
    --chat-border: #334155;
    --chat-msg-self: #1e3a8a;
    --chat-correct-bg: #064e3b;
    --chat-correct-border: #059669;
    --chat-correct-text: #a7f3d0;
    --chat-close-bg: #451a03;
    --chat-close-border: #b45309;
    --chat-close-text: #fef08a;
    
    --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.6);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-body);
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
}

/* ENCABEZADO SUPERIOR PROFESIONAL */
.app-header {
    background-color: var(--bg-header);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1.5px solid var(--border-color);
    padding: 8px 22px;
    height: 56px;
    min-height: 56px;
    max-height: 56px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    flex-shrink: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

.brand-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.12));
}

.brand-icon:hover {
    transform: scale(1.03);
}

.brand-title-wrap {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.brand-title-wrap h1 {
    font-size: 1.4rem;
    font-weight: 900;
    letter-spacing: -0.4px;
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.15;
    margin: 0;
}

[data-theme="dark"] .brand-title-wrap h1 {
    background: linear-gradient(135deg, #38bdf8 0%, #60a5fa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-title-wrap span {
    font-size: 0.74rem;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 0.3px;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Selector de Idioma Profesional con Banderas SVG */
.custom-lang-dropdown {
    position: relative;
    user-select: none;
}

.custom-lang-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 7px 12px;
    color: var(--text-primary);
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
    font-family: inherit;
}

.custom-lang-trigger:hover {
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.flag-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.flag-svg {
    width: 22px;
    height: 15px;
    border-radius: 2px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.25);
    display: inline-block;
    vertical-align: middle;
    object-fit: cover;
}

.dropdown-arrow {
    font-size: 0.75rem;
    color: var(--text-muted);
    transition: transform 0.2s ease;
    margin-left: 2px;
}

.custom-lang-dropdown.open .dropdown-arrow {
    transform: rotate(180deg);
}

.custom-lang-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    list-style: none;
    padding: 6px;
    min-width: 170px;
    display: none;
    flex-direction: column;
    gap: 2px;
    z-index: 1000;
    animation: fadeInScreen 0.15s ease-out;
}

.custom-lang-dropdown.open .custom-lang-menu {
    display: flex;
}

.custom-lang-menu li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--text-primary);
    transition: background 0.15s;
}

.custom-lang-menu li:hover {
    background-color: var(--primary-light);
    color: var(--primary);
}

.custom-lang-menu li.active {
    background-color: var(--primary-light);
    color: var(--primary);
    font-weight: 800;
}

.icon-button {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.icon-button:hover {
    color: var(--primary);
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* CONTENEDOR PRINCIPAL Y PANTALLAS */
.main-wrapper {
    max-width: 1360px;
    width: 95%;
    margin: 0 auto;
    padding: 16px 20px;
    min-height: calc(100vh - 56px);
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
}

.app-screen {
    display: none;
    width: 100%;
    animation: fadeInScreen 0.25s ease-out;
}

.app-screen.active {
    display: flex;
    flex-direction: column;
    width: 100%;
    flex: 1;
}

#lobbyScreen.active {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 1360px;
    margin: auto;
    padding: 10px 0;
    box-sizing: border-box;
}

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

/* LOBBY / SISTEMA DE SERVIDORES */
.lobby-layout {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 20px;
    width: 100%;
    max-width: 1360px;
    margin: 0 auto;
    align-items: stretch;
    height: 500px;
    box-sizing: border-box;
}

@media (max-height: 640px) and (min-width: 901px) {
    .lobby-layout {
        height: 460px;
    }
}

@media (max-width: 900px) {
    .lobby-layout {
        grid-template-columns: 1fr;
        max-width: 580px;
        height: auto;
    }
}

/* Tarjeta de Perfil Centrada, Equilibrada y Compacta */
.profile-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 22px 20px;
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 12px;
    width: 320px;
    min-width: 320px;
    max-width: 320px;
    box-sizing: border-box;
    height: 100%;
}

@media (max-width: 900px) {
    .profile-card {
        width: 100%;
        min-width: 100%;
        max-width: 100%;
        height: auto;
    }
}

.profile-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.profile-card-header i {
    font-size: 1.3rem;
    color: var(--primary);
}

.profile-card-header h3 {
    font-size: 1.15rem;
    font-weight: 700;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-label {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-input {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    outline: none;
    font-family: inherit;
}

.form-input:focus {
    border-color: var(--primary);
    background-color: var(--bg-card);
}

/* Selector de Avatar y Pestañas por Género - Rediseño Profesional */
.avatar-form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.avatar-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
    width: 100%;
    min-width: 0;
}

.selected-avatar-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 0.74rem;
    font-weight: 700;
    color: var(--primary);
    box-shadow: var(--shadow-sm);
    max-width: 105px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}

.selected-avatar-chip .chip-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--success);
    display: inline-block;
    flex-shrink: 0;
}

.avatar-gender-tabs {
    display: flex;
    width: 100%;
    background: var(--bg-secondary);
    padding: 3px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    gap: 3px;
    box-sizing: border-box;
}

.gender-tab-btn {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 700;
    padding: 6px 4px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    text-align: center;
    white-space: nowrap;
}

.gender-tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.gender-tab-btn.active {
    background: var(--bg-card);
    color: var(--primary);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.avatar-grid {
    display: grid;
    grid-template-columns: repeat(4, 52px);
    gap: 10px;
    padding: 6px 0;
    overflow-x: hidden;
    overflow-y: visible;
    width: 100%;
    box-sizing: border-box;
    justify-content: center;
    justify-items: center;
    min-height: 185px;
    align-content: start;
}

/* Botón de Avatar Ultra-Limpio sin textos apretados */
.avatar-choice-btn {
    position: relative;
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
    outline: none;
    user-select: none;
    width: 54px;
    height: 54px;
}

.avatar-choice-btn .illustrated-avatar-badge {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 3px solid transparent;
    transition: all 0.2s ease;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

.avatar-choice-btn:hover {
    transform: translateY(-3px) scale(1.08);
}

.avatar-choice-btn:hover .illustrated-avatar-badge {
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.25);
    border-color: var(--border-color);
}

/* Estado Seleccionado Elegante (Un solo círculo nítido sin doble aro) */
.avatar-choice-btn.active {
    transform: scale(1.06);
}

.avatar-choice-btn.active .illustrated-avatar-badge {
    border: 3.5px solid var(--primary);
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.45);
}

.avatar-check-badge {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 18px;
    height: 18px;
    background: var(--primary);
    color: #ffffff;
    border: 2px solid var(--bg-card);
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 0.62rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
    z-index: 2;
}

.avatar-choice-btn.active .avatar-check-badge {
    display: flex;
    animation: popCheck 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popCheck {
    0% { transform: scale(0); }
    80% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.illustrated-avatar-badge,
.avatar-badge-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}

.illustrated-avatar-badge.selector-size,
.avatar-badge-wrap.selector-size {
    width: 50px;
    height: 50px;
}

.illustrated-avatar-badge.panel-badge,
.avatar-badge-wrap.panel-badge {
    width: 36px;
    height: 36px;
}

.illustrated-avatar-badge.chat-badge,
.avatar-badge-wrap.chat-badge {
    width: 26px;
    height: 26px;
}

.illustrated-avatar-badge.sorteo-badge-lg,
.avatar-badge-wrap.sorteo-badge-lg {
    width: 80px;
    height: 80px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}

.illustrated-avatar-badge.podium-badge-lg,
.avatar-badge-wrap.podium-badge-lg {
    width: 70px;
    height: 70px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}

.illustrated-avatar-badge.podium-badge-md,
.avatar-badge-wrap.podium-badge-md {
    width: 54px;
    height: 54px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.illustrated-avatar-badge svg,
.avatar-badge-wrap svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* ========================================================= */
/* BOTONES DE ACCIÓN: HEROICO JUGAR, CREAR, ENTRAR, CANCELAR */
/* ========================================================= */

/* 1. Botón JUGAR AHORA - Profesional, Limpio y Prominente */
.btn-play-heroic {
    position: relative;
    background-color: var(--primary);
    color: #ffffff;
    font-weight: 800;
    font-size: 1.08rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    padding: 14px 22px;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12);
    transition: background-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
    font-family: inherit;
    width: 100%;
    box-sizing: border-box;
    user-select: none;
}

[data-theme="dark"] .btn-play-heroic {
    background-color: var(--primary);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    border: none;
}

.btn-play-heroic:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.16);
}

[data-theme="dark"] .btn-play-heroic:hover {
    background-color: var(--primary-hover);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}

.btn-play-heroic:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

.btn-play-heroic i {
    font-size: 1.15rem;
    color: #fde047;
    transition: transform 0.2s ease;
}

.btn-play-heroic:hover i {
    transform: scale(1.08);
}

/* 2. Botón Crear Mesa Privada */
.btn-create-room-action {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1.5px solid var(--border-color);
    font-weight: 700;
    padding: 12px 18px;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.2s ease;
    font-family: inherit;
    width: 100%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    box-sizing: border-box;
}

.btn-create-room-action i {
    color: var(--primary);
    font-size: 1.05rem;
    transition: transform 0.2s ease;
}

.btn-create-room-action:hover {
    background-color: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.btn-create-room-action:hover i {
    transform: scale(1.08);
}

.btn-create-room-action:active {
    transform: translateY(0);
}

/* 3. Botón Entrar a la Sala (En cada tarjeta) */
.btn-join-room {
    background-color: var(--primary);
    color: #ffffff;
    border: none;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
    transition: background-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
    font-family: inherit;
    text-decoration: none;
    letter-spacing: 0.2px;
}

.btn-join-room:hover:not(:disabled) {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.18);
}

.btn-join-room:active:not(:disabled) {
    transform: translateY(0);
}

.btn-join-room:disabled,
.btn-join-room.full {
    background: var(--bg-secondary);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    box-shadow: none;
    cursor: not-allowed;
    opacity: 0.75;
}

/* 4. Botones Cancelar (Modales) */
.btn-cancel-action {
    background: transparent;
    color: var(--text-secondary);
    border: 1.5px solid var(--border-color);
    font-weight: 700;
    padding: 11px 20px;
    border-radius: var(--radius-md);
    font-size: 0.92rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
    font-family: inherit;
}

.btn-cancel-action:hover {
    background-color: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.3);
    color: #ef4444;
    transform: translateY(-1px);
}

.btn-cancel-action:active {
    transform: translateY(0);
}

/* 5. Botones Primarios y Secundarios Generales */
.btn-primary-action {
    background-color: var(--primary);
    color: white;
    font-weight: 700;
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.98rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12);
    transition: background-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
    font-family: inherit;
}

.btn-primary-action:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.18);
}

.btn-primary-action:active {
    transform: translateY(0);
}

.btn-secondary-action {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border: 1.5px solid var(--border-color);
    font-weight: 700;
    padding: 12px 18px;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
    font-family: inherit;
}

.btn-secondary-action:hover {
    background-color: var(--border-color);
    border-color: var(--text-muted);
    transform: translateY(-1px);
}

/* COLUMNA DERECHA: NAVEGADOR DE SALAS / SERVIDORES */
.servers-section {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 18px 22px;
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    gap: 14px;
    height: 100%;
    min-width: 0;
    min-height: 0;
    box-sizing: border-box;
    overflow: hidden;
}

@media (max-width: 900px) {
    .servers-section {
        height: auto;
        overflow: visible;
    }
}

.servers-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding-bottom: 2px;
    flex-shrink: 0;
}

.servers-title-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.servers-title-wrap i {
    font-size: 1.25rem;
    color: var(--accent-gold);
}

.servers-title-wrap h2 {
    font-size: 1.2rem;
    font-weight: 800;
}

.servers-filters {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    max-width: 320px;
}

.search-input-wrap {
    position: relative;
    width: 100%;
}

.search-input-wrap i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.88rem;
}

.search-input {
    width: 100%;
    padding: 8px 14px 8px 34px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.88rem;
    outline: none;
    font-family: inherit;
    transition: border-color 0.2s ease;
}

.search-input:focus {
    border-color: var(--primary);
}

/* Grilla de Salas Compacta, Nítida, Scrollable Verticalmente y sin desborde horizontal */
.rooms-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    padding: 2px 4px 10px 2px;
    align-content: start;
    flex: 1;
    min-height: 0;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
    overflow-y: auto;
    overflow-x: hidden; /* Garantiza NUNCA mostrar scrollbar horizontal */
    scrollbar-width: thin;
    scrollbar-color: #94a3b8 var(--bg-secondary);
}

/* Scrollbar estilizada exclusiva para scroll vertical */
.rooms-grid::-webkit-scrollbar {
    width: 6px;
    height: 0px; /* Elimina cualquier scrollbar horizontal nativa */
}

.rooms-grid::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 4px;
}

.rooms-grid::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 4px;
}

.rooms-grid::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

@media (max-width: 1100px) {
    .rooms-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    .rooms-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Grilla de Salas cuando está vacía: Se convierte en Flex para estirar el cartel completamente hasta abajo */
.rooms-grid.is-empty,
.rooms-grid:has(.empty-rooms-state) {
    display: flex;
    flex-direction: column;
    flex: 1;
    height: 100%;
    min-height: 0;
    padding: 2px 2px 2px 2px;
    overflow: hidden;
}

/* Estado Vacío de Salas - Estirado completamente hasta abajo, Centrado y Equilibrado */
.empty-rooms-state {
    grid-column: 1 / -1;
    flex: 1;
    width: 100%;
    height: 100%;
    min-height: 340px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: var(--text-muted);
    padding: 30px 24px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 2px dashed var(--border-color);
    box-sizing: border-box;
    transition: all 0.2s ease;
    margin: 0;
}

.empty-rooms-state:hover {
    border-color: var(--primary);
}

.empty-rooms-icon {
    font-size: 3.4rem;
    margin-bottom: 16px;
    color: var(--primary);
    filter: drop-shadow(0 4px 10px rgba(2, 132, 199, 0.25));
    animation: floatGamepad 3s ease-in-out infinite;
}

@keyframes floatGamepad {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.empty-rooms-title {
    font-size: 1.18rem;
    color: var(--text-primary);
    font-weight: 700;
    margin-bottom: 8px;
}

.empty-rooms-desc {
    font-size: 0.92rem;
    color: var(--text-muted);
    max-width: 480px;
    line-height: 1.5;
}

/* Selector de Color de Nombre */
.nick-color-group {
    margin-top: 2px;
    margin-bottom: 4px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.nick-color-palette {
    display: flex;
    align-items: center;
    padding: 2px 0;
}

.nick-color-compact-row {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

/* Redondito con el color que se haya elegido */
.nick-color-chosen-swatch {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    border: 2.5px solid #ffffff;
    box-shadow: 0 0 10px rgba(2, 132, 199, 0.45), 0 2px 6px rgba(0, 0, 0, 0.25);
    transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.18s ease;
    padding: 0;
    outline: none;
    flex-shrink: 0;
    background-color: #0284c7;
}

.nick-color-chosen-swatch:hover {
    transform: scale(1.15);
    box-shadow: 0 0 14px rgba(2, 132, 199, 0.65), 0 4px 10px rgba(0, 0, 0, 0.35);
}

/* Botón píldora para elegir cualquier color personalizado */
.nick-color-picker-trigger {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-hover, rgba(2, 132, 199, 0.08));
    color: var(--text-main);
    border: 1.5px solid var(--border-color);
    border-radius: 9999px;
    padding: 6px 14px;
    font-size: 0.84rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.15s ease, box-shadow 0.18s ease;
    overflow: hidden;
    user-select: none;
}

.nick-color-picker-trigger i {
    color: var(--primary);
    font-size: 0.95rem;
}

.nick-color-picker-trigger:hover {
    border-color: var(--primary);
    background: rgba(2, 132, 199, 0.14);
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(2, 132, 199, 0.2);
}

.nick-color-native-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    border: none;
    padding: 0;
    margin: 0;
}

/* ============================================================= */
/* PARTÍCULAS Y PERSONALIZACIÓN AVANZADA DEL NOMBRE (RGB, ANIMACIONES, PARTÍCULAS) */
/* ============================================================================= */
.nick-compact-control-group {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin-bottom: 12px;
}

.btn-nick-style-modal-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    background: linear-gradient(135deg, rgba(2, 132, 199, 0.15), rgba(139, 92, 246, 0.15));
    border: 1px solid rgba(2, 132, 199, 0.35);
    border-radius: var(--radius-md);
    color: #38bdf8;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-nick-style-modal-trigger:hover {
    background: linear-gradient(135deg, rgba(2, 132, 199, 0.3), rgba(139, 92, 246, 0.3));
    border-color: #38bdf8;
    transform: translateY(-1px);
    box-shadow: 0 0 12px rgba(2, 132, 199, 0.3);
}

.nick-live-preview-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(15, 23, 42, 0.4);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 6px 12px;
    min-height: 38px;
}

.nick-preview-label {
    font-size: 0.76rem;
    color: var(--text-muted);
    font-weight: 600;
}

.nick-preview-display {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.03);
}

.nick-style-modal-card {
    background-color: var(--bg-card);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-xl);
    width: 530px;
    max-width: 95vw;
    height: 640px;
    max-height: 90vh;
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.55);
    animation: zoomIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    box-sizing: border-box;
    overflow: hidden;
    gap: 0;
    margin: auto !important;
}

@media (max-width: 580px) {
    .nick-style-modal-card {
        width: 96vw;
        height: 88vh;
        padding: 16px 18px;
    }
}

.nick-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.nick-modal-preview-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.7);
    border: 1.5px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 8px 16px;
    margin: 12px 0 10px 0;
    min-height: 68px;
    height: 68px;
    flex-shrink: 0;
    box-sizing: border-box;
    overflow: visible;
}

.nick-modal-preview-box .nick-preview-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 3px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.nick-modal-preview-display {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 800;
    height: 32px;
    position: relative;
    max-width: 100%;
}

.nick-modal-body {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 4px 6px 12px 0;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: #94a3b8 var(--bg-secondary);
}

.nick-modal-body::-webkit-scrollbar {
    width: 6px;
}

.nick-modal-body::-webkit-scrollbar-track {
    background: var(--bg-surface);
    border-radius: 4px;
}

.nick-modal-body::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 4px;
}

.nick-modal-body::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

.nick-modal-actions {
    padding-top: 14px;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
    margin-top: auto;
}

.input-name-particle-wrap {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.player-nick-particle-input {
    width: 100%;
    transition: text-shadow 0.25s ease, color 0.25s ease;
}

/* Contenedor que abraza el ancho exacto del texto dentro del input */
.input-particle-track {
    position: absolute;
    left: 14px;
    top: 0;
    bottom: 0;
    width: 70px;
    max-width: calc(100% - 28px);
    pointer-events: none;
    overflow: visible;
}

.input-particle-track .name-particle-spark.p-1,
.input-particle-track .name-particle-item.p-1 {
    top: 8px;
    left: -2px;
    animation-delay: 0s;
}

.input-particle-track .name-particle-spark.p-2,
.input-particle-track .name-particle-item.p-2 {
    bottom: 8px;
    left: 55%;
    animation-delay: 0.65s;
}

.input-particle-track .name-particle-spark.p-3,
.input-particle-track .name-particle-item.p-3 {
    top: 8px;
    right: -2px;
    left: auto;
    animation-delay: 1.3s;
}

/* Tabs de Color Sólido vs RGB */
.nick-styling-group {
    margin-bottom: 14px;
}

.nick-style-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
}

.nick-style-tab-btn {
    flex: 1;
    padding: 7px 10px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.nick-style-tab-btn:hover {
    background: var(--bg-card);
    color: var(--text-color);
}

.nick-style-tab-btn.active {
    background: rgba(2, 132, 199, 0.15);
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: 0 0 10px rgba(2, 132, 199, 0.25);
}

/* Configuración de Modo RGB */
.nick-rgb-config-wrap {
    background: rgba(15, 23, 42, 0.35);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.rgb-config-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.rgb-label-hint {
    font-size: 0.76rem;
    color: var(--text-muted);
    font-weight: 600;
}

.rgb-swatches-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.rgb-swatch-box {
    position: relative;
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.rgb-native-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.rgb-swatch-preview {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid #ffffff;
    box-shadow: 0 0 8px rgba(0,0,0,0.4);
    display: inline-block;
    transition: transform 0.18s ease;
}

.rgb-swatch-box:hover .rgb-swatch-preview {
    transform: scale(1.15);
}

.rgb-swatch-num {
    font-weight: 800;
    color: var(--text-muted);
    font-size: 0.72rem;
}

.rgb-presets-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    padding-top: 4px;
    border-top: 1px dashed rgba(255, 255, 255, 0.08);
}

.rgb-presets-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 600;
}

.rgb-presets-buttons {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 5px;
    width: 100%;
}

.btn-rgb-preset {
    padding: 5px 4px;
    font-size: 0.72rem;
    font-weight: 700;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
    width: 100%;
    box-sizing: border-box;
}

.btn-rgb-preset:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

/* Grillas Simétricas y Medidas de Partículas y Animaciones */
.particles-selector-grid,
.animation-selector-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 7px;
    width: 100%;
    box-sizing: border-box;
    padding: 1px;
}

@media (max-width: 480px) {
    .particles-selector-grid,
    .animation-selector-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.btn-chip-option {
    padding: 7px 6px;
    font-size: 0.76rem;
    font-weight: 700;
    border-radius: var(--radius-md);
    border: 1.5px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 100%;
    min-height: 38px;
    box-sizing: border-box;
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-chip-option:hover {
    background: var(--bg-card);
    color: var(--text-color);
    border-color: rgba(255, 255, 255, 0.25);
}

.btn-chip-option.active {
    background: rgba(2, 132, 199, 0.22);
    border-color: #38bdf8;
    color: #38bdf8;
    box-shadow: 0 0 10px rgba(2, 132, 199, 0.38);
    font-weight: 700; /* IMPORTANTE: Peso constante para que no cambie el ancho del texto ni salte a los costados */
}

/* Envoltorios de nombre con estilos */
.styled-player-name-wrap,
.player-info-name-wrap, 
.waiting-player-name-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    overflow: visible;
}

.styled-player-name,
.player-info-name, 
.waiting-player-name {
    position: relative;
    z-index: 1;
    font-weight: 700;
    display: inline-block;
    transition: text-shadow 0.25s ease, color 0.25s ease;
}

.chat-author-wrap {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
    margin-right: 4px;
}

.chat-author-wrap .name-particle-item {
    display: none; /* No saturar el flujo de mensajes del chat con partículas grandes */
}

/* Efecto de Texto RGB Animado */
.name-rgb-text {
    display: inline-block;
    filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.25));
}

/* 1. Modo RGB en palabras continuas (sin Wave ni Bounce) */
.name-rgb-text:not(.name-anim-wave):not(.name-anim-bounce) {
    background: linear-gradient(90deg, var(--rgb-c1, #f43f5e), var(--rgb-c2, #8b5cf6), var(--rgb-c3, #06b6d4), var(--rgb-c1, #f43f5e));
    background-size: 300% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: nameRgbFlow 3.2s linear infinite;
}

@keyframes nameRgbFlow {
    0% { background-position: 0% 50%; }
    100% { background-position: 300% 50%; }
}

/* ============================================================================= */
/* SISTEMAS DE PARTÍCULAS REALES: AURA MÍSTICA, CHISPAS, ASCUAS, POLVO, VÓRTICE  */
/* ============================================================================= */

/* 1. SISTEMA AURA MÍSTICA (Halo etéreo ceñido y destellos de energía, 100% pegado) */
.aura-particle-system {
    position: absolute;
    inset: -2px -5px;
    pointer-events: none;
    z-index: 2;
    border-radius: var(--radius-md);
    box-shadow: 0 0 8px var(--p-color, #38bdf8), inset 0 0 5px var(--p-color, #38bdf8);
    animation: auraPulseAnim 1.8s ease-in-out infinite alternate;
}

@keyframes auraPulseAnim {
    0% {
        box-shadow: 0 0 5px var(--p-color, #38bdf8), inset 0 0 3px var(--p-color, #38bdf8);
        opacity: 0.55;
    }
    100% {
        box-shadow: 0 0 14px var(--p-color, #38bdf8), 0 0 20px var(--p-color, #38bdf8), inset 0 0 7px var(--p-color, #38bdf8);
        opacity: 0.95;
    }
}

.aura-wisp {
    position: absolute;
    width: 3.5px;
    height: 3.5px;
    background: #ffffff;
    border-radius: 50%;
    box-shadow: 0 0 5px #ffffff, 0 0 9px var(--p-color, #38bdf8);
    animation: auraWispAnim 1.6s infinite ease-in-out;
}

.aura-wisp.w-1 { top: -2px; left: 18%; animation-delay: 0s; }
.aura-wisp.w-2 { bottom: -2px; left: 52%; animation-delay: 0.4s; }
.aura-wisp.w-3 { top: -2px; left: 82%; animation-delay: 0.8s; }
.aura-wisp.w-4 { top: 40%; right: -3px; animation-delay: 1.2s; }

@keyframes auraWispAnim {
    0%, 100% { transform: scale(0.4); opacity: 0.2; }
    50% { transform: scale(1.3); opacity: 1; filter: brightness(1.6); }
}

/* 2. SISTEMA CHISPAS DE PLASMA / NEÓN (Chispazo pegado a las letras) */
.sparks-particle-system {
    position: absolute;
    inset: -2px -4px;
    pointer-events: none;
    z-index: 2;
}

.spark-mote {
    position: absolute;
    width: 3.5px;
    height: 3.5px;
    background: #ffffff;
    border-radius: 50%;
    box-shadow: 0 0 5px #ffffff, 0 0 8px var(--p-color, #0284c7), 0 0 14px var(--p-color, #0284c7);
    animation: sparkMoteAnim 1.6s infinite ease-in-out;
}

.spark-mote.s-1 { top: -2px; left: 16%; animation-delay: 0s; }
.spark-mote.s-2 { bottom: -2px; left: 45%; animation-delay: 0.35s; }
.spark-mote.s-3 { top: -1px; left: 74%; animation-delay: 0.7s; }
.spark-mote.s-4 { bottom: -2px; right: 2px; animation-delay: 1.05s; }
.spark-mote.s-5 { top: 40%; left: -2px; animation-delay: 1.35s; }

@keyframes sparkMoteAnim {
    0%, 100% { transform: scale(0.3) translate(0, 0); opacity: 0.2; }
    30% { transform: scale(1.3) translate(1px, -1px); opacity: 1; filter: brightness(1.5); }
    60% { transform: scale(0.8) translate(-1px, 1px); opacity: 0.8; }
    80% { transform: scale(1.1) translate(0, 0); opacity: 0.9; }
}

/* 3. SISTEMA ASCUAS DE FUEGO / ENERGÍA */
.embers-particle-system {
    position: absolute;
    inset: 0 -2px;
    pointer-events: none;
    z-index: 2;
}

.ember-mote {
    position: absolute;
    width: 3px;
    height: 3.5px;
    background: radial-gradient(circle, #ffffff 20%, var(--p-color, #f97316) 70%, transparent 100%);
    border-radius: 50%;
    box-shadow: 0 0 5px var(--p-color, #f97316), 0 0 10px var(--p-color, #f97316);
    animation: emberFloat 1.8s infinite ease-out;
    bottom: -1px;
}

.ember-mote.e-1 { left: 18%; animation-delay: 0s; }
.ember-mote.e-2 { left: 48%; animation-delay: 0.5s; }
.ember-mote.e-3 { left: 78%; animation-delay: 1.0s; }
.ember-mote.e-4 { left: 95%; animation-delay: 1.4s; }

@keyframes emberFloat {
    0% { transform: translateY(0) scale(0.4); opacity: 0.2; }
    35% { transform: translateY(-4px) scale(1.1); opacity: 0.95; }
    70% { transform: translateY(-9px) scale(0.8); opacity: 0.6; }
    100% { transform: translateY(-14px) scale(0.2); opacity: 0; }
}

/* 4. SISTEMA POLVO CÓSMICO */
.stardust-particle-system {
    position: absolute;
    inset: -2px -4px;
    pointer-events: none;
    z-index: 2;
}

.star-flare {
    position: absolute;
    width: 5px;
    height: 5px;
    clip-path: polygon(50% 0%, 65% 35%, 100% 50%, 65% 65%, 50% 100%, 35% 65%, 0% 50%, 35% 35%);
    background: #ffffff;
    box-shadow: 0 0 6px var(--p-color, #a855f7), 0 0 10px var(--p-color, #a855f7);
    animation: starFlareShine 1.8s infinite ease-in-out;
}

.star-flare.sf-1 { top: -2px; left: 15%; animation-delay: 0s; }
.star-flare.sf-2 { bottom: -2px; left: 60%; animation-delay: 0.6s; }
.star-flare.sf-3 { top: -1px; right: -2px; animation-delay: 1.2s; }

@keyframes starFlareShine {
    0%, 100% { transform: scale(0.3) rotate(0deg); opacity: 0.2; }
    50% { transform: scale(1.25) rotate(90deg); opacity: 1; filter: drop-shadow(0 0 4px #fff); }
}

/* 5. SISTEMA VÓRTICE ORBITAL */
.vortex-particle-system {
    position: absolute;
    top: 50%;
    left: 50%;
    width: calc(100% + 8px);
    height: calc(100% + 4px);
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 2;
}

.vortex-ring {
    position: absolute;
    inset: 0;
    border-radius: 999px;
}

.vortex-ring.vr-1 {
    transform: scaleY(0.45);
    animation: vortexRotate1 2.8s linear infinite;
}

.vortex-ring.vr-2 {
    transform: scaleY(0.45) rotate(180deg);
    animation: vortexRotate2 3.4s linear infinite reverse;
}

.vortex-mote {
    position: absolute;
    top: 0;
    left: 50%;
    width: 3.5px;
    height: 3.5px;
    background: #ffffff;
    border-radius: 50%;
    box-shadow: 0 0 5px #ffffff, 0 0 10px var(--p-color, #06b6d4);
}

@keyframes vortexRotate1 {
    0% { transform: scaleY(0.45) rotate(0deg); }
    100% { transform: scaleY(0.45) rotate(360deg); }
}

@keyframes vortexRotate2 {
    0% { transform: scaleY(0.45) rotate(180deg); }
    100% { transform: scaleY(0.45) rotate(540deg); }
}

/* Fallback sutil de centelleo para compatibilidad */
.name-particle-item,
.name-particle-spark {
    position: absolute;
    pointer-events: none;
    z-index: 2;
    opacity: 0;
    animation: nameParticleSparkle 1.9s infinite ease-in-out;
}

.name-particle-item.spark-dot,
.name-particle-spark {
    width: 3.5px;
    height: 3.5px;
    border-radius: 50%;
    background: var(--primary, #0284c7);
    box-shadow: 0 0 6px var(--primary, #0284c7);
}

.name-particle-item.p-1,
.name-particle-spark.p-1 {
    top: -4px;
    left: 8%;
    animation-delay: 0s;
}

.name-particle-item.p-2,
.name-particle-spark.p-2 {
    bottom: -4px;
    left: 54%;
    animation-delay: 0.65s;
}

.name-particle-item.p-3,
.name-particle-spark.p-3 {
    top: -4px;
    right: -4px;
    animation-delay: 1.3s;
}

@keyframes nameParticleSparkle {
    0%, 100% {
        transform: translate(0, 0) scale(0.6);
        opacity: 0.15;
    }
    40% {
        transform: translate(1px, -1.5px) scale(1.15);
        opacity: 0.95;
    }
    75% {
        transform: translate(-1px, 1px) scale(0.8);
        opacity: 0.7;
    }
}

/* ============================================================= */
/* ANIMACIONES DE LETRAS DEL NOMBRE (TOTALMENTE FUNCIONALES)     */
/* ============================================================= */

.char-item {
    display: inline-block;
    will-change: transform;
}

/* 1. Ola (Wave) - Modo Color Sólido */
.styled-player-name:not(.name-rgb-text).name-anim-wave .char-item {
    display: inline-block;
    animation: letterWaveAnim 1.2s ease-in-out infinite;
    animation-delay: calc(var(--char-index, 0) * 0.12s);
}

/* 2. Rebote (Bounce) - Modo Color Sólido */
.styled-player-name:not(.name-rgb-text).name-anim-bounce .char-item {
    display: inline-block;
    animation: letterBounceAnim 1s ease-in-out infinite;
    animation-delay: calc(var(--char-index, 0) * 0.1s);
}

/* 3. Ola y Rebote en MODO RGB: Flujo continuo + arcoíris dinámico por letra */
.name-rgb-text.name-anim-wave .char-item,
.name-rgb-text.name-anim-bounce .char-item {
    background: linear-gradient(90deg, var(--rgb-c1, #f43f5e), var(--rgb-c2, #8b5cf6), var(--rgb-c3, #06b6d4), var(--rgb-c1, #f43f5e));
    background-size: 300% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
    will-change: transform, background-position;
}

.name-rgb-text.name-anim-wave .char-item {
    animation: letterWaveAnim 1.2s ease-in-out infinite, nameRgbFlow 3.2s linear infinite;
    animation-delay: calc(var(--char-index, 0) * 0.12s), calc(var(--char-index, 0) * -0.22s);
}

.name-rgb-text.name-anim-bounce .char-item {
    animation: letterBounceAnim 1s ease-in-out infinite, nameRgbFlow 3.2s linear infinite;
    animation-delay: calc(var(--char-index, 0) * 0.1s), calc(var(--char-index, 0) * -0.22s);
}

@keyframes letterWaveAnim {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-8px) scale(1.08);
    }
}

@keyframes letterBounceAnim {
    0%, 100% {
        transform: translateY(0) scale(1, 1);
    }
    35% {
        transform: translateY(-9px) scale(1.1, 1.15);
    }
    65% {
        transform: translateY(0) scale(1.04, 0.92);
    }
}

/* 4. Pulso (Pulse) - Latido suave */
.name-anim-pulse {
    display: inline-flex !important;
    animation: letterPulseAnim 1.3s ease-in-out infinite;
    transform-origin: center center;
}
.name-rgb-text.name-anim-pulse {
    animation: letterPulseAnim 1.3s ease-in-out infinite, nameRgbFlow 3.2s linear infinite;
}

@keyframes letterPulseAnim {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.12);
        filter: brightness(1.2);
    }
}

/* 5. Resplandor Neón (Glow) */
.name-anim-glow {
    display: inline-flex !important;
    animation: letterGlowAnim 1.4s ease-in-out infinite alternate;
}
.name-rgb-text.name-anim-glow {
    animation: letterGlowAnim 1.4s ease-in-out infinite alternate, nameRgbFlow 3.2s linear infinite;
}

@keyframes letterGlowAnim {
    0% {
        filter: drop-shadow(0 0 2px currentColor);
    }
    100% {
        filter: drop-shadow(0 0 10px currentColor) drop-shadow(0 0 18px currentColor) brightness(1.3);
    }
}

/* 6. Brillo (Shimmer) */
.name-anim-shimmer {
    display: inline-flex !important;
    animation: letterShimmerAnim 1.8s ease-in-out infinite;
}
.name-rgb-text.name-anim-shimmer {
    animation: letterShimmerAnim 1.8s ease-in-out infinite, nameRgbFlow 3.2s linear infinite;
}

@keyframes letterShimmerAnim {
    0%, 100% {
        filter: brightness(1);
        transform: scale(1);
    }
    50% {
        filter: brightness(1.65) drop-shadow(0 0 8px #ffffff);
        transform: scale(1.05);
    }
}

/* 7. Temblor / Glitch (Shake) */
.name-anim-shake {
    display: inline-flex !important;
    animation: letterShakeAnim 0.45s ease-in-out infinite;
}
.name-rgb-text.name-anim-shake {
    animation: letterShakeAnim 0.45s ease-in-out infinite, nameRgbFlow 3.2s linear infinite;
}

@keyframes letterShakeAnim {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    20% { transform: translate(-2px, 1.5px) rotate(-1deg); }
    40% { transform: translate(2px, -1.5px) rotate(1deg); }
    60% { transform: translate(-1.5px, -1px) rotate(-0.5deg); }
    80% { transform: translate(1.5px, 1px) rotate(0.5deg); }
}

/* Corona de Anfitrión / Creador: posición y tamaño fijos, sin neón difuso, con brillo metálico reluciente */
.player-crown-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    color: #f59e0b; /* Fallback estándar */
    background: linear-gradient(
        115deg,
        #d97706 0%,
        #f59e0b 22%,
        #fde047 38%,
        #ffffff 50%,
        #fef08a 62%,
        #f59e0b 78%,
        #b45309 100%
    );
    background-size: 260% 100%;
    background-position: -160% 0;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.45));
    animation: crownShineSweep 3.2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    transform: none !important; /* Totalmente fija: no se agranda ni se achica */
}

@keyframes crownShineSweep {
    0%, 20% {
        background-position: 160% 0;
    }
    60%, 100% {
        background-position: -160% 0;
    }
}


.room-card {
    background-color: var(--bg-card);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 7px;
    box-shadow: var(--shadow-sm);
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
    cursor: pointer;
    position: relative;
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
}

[data-theme="dark"] .room-card {
    border: 1.5px solid rgba(255, 255, 255, 0.12);
    background-color: #1e293b;
}

.room-card:hover {
    border-color: var(--primary) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}

.room-card.selected,
.room-card:active {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 2px var(--primary), 0 2px 8px rgba(0, 0, 0, 0.12) !important;
    background-color: var(--bg-card-hover);
}

.room-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
}

.room-name-wrap {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
    flex: 1;
    overflow: hidden;
}

.room-flag-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    flex-shrink: 0;
}

.room-flag-wrap .flag-svg {
    width: 20px;
    height: 14px;
    border-radius: 2.5px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.room-name-wrap h4 {
    font-size: 0.92rem;
    font-weight: 800;
    letter-spacing: -0.2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
}

.room-lock-icon {
    color: var(--accent-gold);
    font-size: 0.78rem;
    background: rgba(245, 158, 11, 0.12);
    padding: 2.5px;
    border-radius: 50%;
    flex-shrink: 0;
}

.room-badge {
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    padding: 2px 7px;
    border-radius: 999px;
    background-color: var(--primary-light);
    color: var(--primary);
    border: 1px solid var(--border-color);
    flex-shrink: 0;
}

.room-card-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px 10px;
    font-size: 0.76rem;
    color: var(--text-muted);
    font-weight: 600;
    margin: 0;
}

.room-card-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.room-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 7px;
    border-top: 1px solid var(--border-light);
    margin-top: auto;
    min-width: 0;
}

.players-badge {
    font-size: 0.76rem;
    font-weight: 700;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 5px;
}

.players-badge i {
    color: var(--primary);
}

/* ========================================================= */
/* PANTALLA DE JUEGO EN VIVO (ESTILO PINTURILLO 2)           */
/* ========================================================= */
body:has(#gameScreen.active),
body[data-screen="gameScreen"] {
    overflow: hidden;
}

body:has(#gameScreen.active) .main-wrapper,
body[data-screen="gameScreen"] .main-wrapper {
    padding: 8px 14px;
    height: calc(100vh - 56px);
    max-height: calc(100vh - 56px);
    min-height: 0;
    justify-content: stretch;
    overflow: hidden;
}

#gameScreen.active {
    height: 100%;
    max-height: 100%;
    min-height: 0;
    overflow: hidden;
}

.game-layout {
    display: grid;
    grid-template-columns: 235px 1fr 275px;
    gap: 8px;
    width: 100%;
    align-items: stretch;
    height: 100%;
    max-height: 100%;
    min-height: 0;
    overflow: hidden;
}

/* Columna Izquierda: Jugadores */
.players-panel {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
    min-height: 0;
}

.panel-header {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--bg-secondary);
    flex-shrink: 0;
}

.panel-header h4 {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.players-list-scroll {
    list-style: none;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

/* Scrollbar estilizada visible */
.players-list-scroll::-webkit-scrollbar,
.chat-messages-area::-webkit-scrollbar {
    width: 7px;
}

.players-list-scroll::-webkit-scrollbar-track,
.chat-messages-area::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 4px;
}

.players-list-scroll::-webkit-scrollbar-thumb,
.chat-messages-area::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 4px;
}

.players-list-scroll::-webkit-scrollbar-thumb:hover,
.chat-messages-area::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

.player-row {
    background-color: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    transition: all 0.2s ease;
}

.player-row.is-drawer {
    border-color: var(--primary);
    background-color: var(--primary-light);
    box-shadow: 0 0 0 1.5px rgba(2, 132, 199, 0.45);
}

.player-row.has-guessed {
    border-color: var(--success);
    background-color: var(--chat-correct-bg);
}

.player-score-line {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

.player-meta-tag {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    letter-spacing: 0.2px;
}

.player-meta-tag.tag-drawing {
    background: rgba(2, 132, 199, 0.18);
    color: var(--primary);
    border: 1px solid rgba(2, 132, 199, 0.35);
}

.player-meta-tag.tag-guessed {
    background: rgba(16, 185, 129, 0.18);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.35);
}

.badge-status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    font-size: 0.88rem;
}

.badge-status-pill.drawer-pill {
    background: transparent;
    border: none;
    box-shadow: none;
    width: auto;
    height: auto;
}

.badge-status-pill.guessed-pill {
    background: rgba(16, 185, 129, 0.18);
    color: var(--success);
    border: 1.5px solid rgba(16, 185, 129, 0.4);
}

.player-row-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
}

.player-rank {
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--text-muted);
    width: 14px;
    flex-shrink: 0;
}

.player-avatar-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.player-info-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.player-info-name {
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--text-primary);
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-score {
    font-size: 0.74rem;
    font-weight: 700;
    color: var(--primary);
    white-space: nowrap;
}

.player-status-icon {
    font-size: 0.95rem;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 4px;
}

.status-drawing {
    color: #0284c7;
    display: inline-block;
    transform-origin: 20% 85%;
    animation: brushDrawAnim 1.8s cubic-bezier(0.42, 0, 0.58, 1) infinite;
    font-size: 1.15rem;
    filter: drop-shadow(0 2px 5px rgba(2, 132, 199, 0.45));
}

@keyframes brushDrawAnim {
    0%, 100% {
        transform: rotate(0deg) translate(0, 0);
    }
    20% {
        transform: rotate(-14deg) translate(-2px, -2px);
    }
    40% {
        transform: rotate(8deg) translate(2px, 0px);
    }
    60% {
        transform: rotate(-10deg) translate(-1px, -2px);
    }
    80% {
        transform: rotate(5deg) translate(2px, -1px);
    }
}

.status-guessed {
    color: var(--success);
}

/* Columna Central: Pizarra de Dibujo y Top Bar */
.canvas-column {
    display: flex;
    flex-direction: column;
    gap: 6px;
    height: 100%;
    min-height: 0;
    min-width: 0;
    overflow: visible;
}

/* Barra Superior de la Partida */
.game-top-bar {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 8px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
    min-height: 52px;
    flex-shrink: 0;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-flag-badge {
    display: flex;
    align-items: center;
    line-height: 1;
}

.topbar-flag-badge .flag-svg {
    width: 18px;
    height: 12px;
    border-radius: 2px;
}

.round-pill {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.btn-share-room {
    background-color: #10b981;
    color: white;
    border: none;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
    transition: background-color 0.15s ease, transform 0.15s ease;
}

.btn-share-room:hover {
    background-color: #059669;
    transform: translateY(-1px);
}

/* Visualización elegante y equilibrada de la palabra secreta/guiones */
.word-hint-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    max-width: 54%;
    overflow: hidden;
    gap: 2px;
}

.word-blanks {
    font-family: var(--font-family);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 4px;
    color: var(--text-primary);
    line-height: 1;
    min-height: 28px;
}

.word-group {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.letter-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    font-size: 1.15rem;
    font-weight: 800;
    line-height: 1;
    transition: all 0.2s ease;
}

.letter-chip.blank {
    color: var(--text-muted);
    font-weight: 900;
    font-size: 1.25rem;
    min-width: 14px;
    letter-spacing: 0;
}

.letter-chip.revealed {
    color: #ffffff;
    background-color: var(--primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    border-radius: 6px;
    padding: 2px 6px;
    min-width: 22px;
    font-size: 0.95rem;
    font-weight: 900;
    animation: popLetter 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popLetter {
    0% { transform: scale(0.5); opacity: 0; }
    70% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

/* Espacio entre palabras: SEPARACIÓN LIMPIA SIN RENGLÓN NI RAYITAS */
.word-space-gap {
    display: inline-block;
    width: 16px;
    height: 1px;
    user-select: none;
}

.drawer-secret-word {
    font-size: 1.2rem;
    font-weight: 900;
    letter-spacing: 0.5px;
    color: var(--primary);
}

.drawer-secret-word.revealed-full {
    color: var(--accent-gold);
    animation: popLetter 0.4s ease;
}

.revealed-badge {
    color: var(--accent-gold);
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.word-category-hint {
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.category-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(2, 132, 199, 0.12);
    color: var(--primary);
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 700;
    border: 1px solid rgba(2, 132, 199, 0.25);
}

.letters-count-pill {
    font-size: 0.74rem;
    font-weight: 700;
    color: var(--text-muted);
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.timer-pill {
    background-color: #0f172a;
    color: white;
    padding: 4px 14px;
    border-radius: 999px;
    font-family: monospace;
    font-size: 1.1rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.timer-pill.urgent {
    background-color: var(--danger);
}

/* Botón de Salir de la Sala en Rojo Destacado */
#btnLeaveRoom,
.btn-leave-room-pill {
    background-color: #ef4444;
    border: 1px solid #dc2626;
    color: #ffffff !important;
    padding: 6px 14px;
    height: 36px;
    border-radius: 999px;
    font-size: 0.84rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.35);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    white-space: nowrap;
    text-decoration: none;
    outline: none;
    flex-shrink: 0;
}

#btnLeaveRoom i,
.btn-leave-room-pill i {
    color: #ffffff !important;
    font-size: 0.95rem;
    transition: transform 0.2s ease;
}

#btnLeaveRoom:hover,
.btn-leave-room-pill:hover {
    background-color: #dc2626;
    border-color: #b91c1c;
    color: #ffffff !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.5);
}

#btnLeaveRoom:hover i,
.btn-leave-room-pill:hover i {
    transform: translateX(-2px);
}

#btnLeaveRoom:active,
.btn-leave-room-pill:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(239, 68, 68, 0.3);
}

/* Área del Canvas Fija y Fluida */
.canvas-wrapper-outer {
    position: relative;
    background-color: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    flex: 1;
    min-height: 0;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

#drawingCanvas {
    aspect-ratio: 3 / 2;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    touch-action: none;
    background-color: #ffffff;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    border-radius: var(--radius-sm);
}

/* Overlays dentro del Canvas: Sala de Espera, Sorteo y Selección */
.in-canvas-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.86);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 50;
    animation: fadeInScreen 0.25s ease-out;
}

.overlay-card {
    background: var(--bg-card);
    border: 2px solid var(--primary);
    border-radius: var(--radius-xl);
    padding: 32px 28px;
    max-width: 500px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    animation: scaleModal 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.overlay-top-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 2px;
}

.overlay-flag-badge {
    display: flex;
    align-items: center;
    line-height: 1;
}

.overlay-flag-badge .flag-svg {
    width: 26px;
    height: 18px;
    border-radius: 3px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.overlay-mode-badge {
    background: var(--primary-light);
    color: var(--primary);
    border: 1px solid var(--border-color);
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.6px;
}

.sorteo-tag {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-gold);
    border: 1px solid rgba(245, 158, 11, 0.3);
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.8px;
}

.overlay-subtitle {
    color: var(--text-secondary);
    font-size: 0.94rem;
    line-height: 1.5;
    max-width: 420px;
}

.overlay-icon {
    font-size: 2.8rem;
    color: var(--primary);
}

.overlay-icon.spin-icon i {
    color: var(--primary);
}

.overlay-card h2 {
    font-size: 1.5rem;
    color: var(--primary);
    font-weight: 800;
}

.overlay-card p {
    color: var(--text-secondary);
    font-size: 0.92rem;
    line-height: 1.4;
}

.waiting-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: 10px;
    width: 100%;
}

.guest-waiting-notice {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.guest-badge-notice {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Caja de Jugadores en Sala de Espera */
.waiting-players-box {
    width: 100%;
    background: var(--bg-secondary);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 12px 14px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.waiting-players-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
    gap: 8px;
}

.waiting-players-title {
    font-size: 0.88rem;
    font-weight: 800;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.ready-summary-badge {
    font-size: 0.75rem;
    font-weight: 800;
    padding: 3px 9px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.ready-summary-badge.waiting {
    background: rgba(148, 163, 184, 0.18);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

.ready-summary-badge.pending {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-gold);
    border: 1px solid rgba(245, 158, 11, 0.35);
}

.ready-summary-badge.all-ready {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.35);
}

.waiting-players-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 180px;
    overflow-y: auto;
    padding-right: 2px;
}

.waiting-players-list::-webkit-scrollbar {
    width: 5px;
}

.waiting-players-list::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 4px;
}

.waiting-player-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.waiting-player-item.is-ready {
    border-color: rgba(16, 185, 129, 0.4);
    background: rgba(16, 185, 129, 0.06);
}

.waiting-player-item.not-ready {
    border-color: rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.04);
}

.waiting-player-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.waiting-player-name {
    font-size: 0.9rem;
    font-weight: 700;
}

.status-tag {
    font-size: 0.72rem;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.status-tag.tag-host {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-gold);
    border: 1px solid rgba(245, 158, 11, 0.35);
}

.status-tag.tag-ready {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.35);
}

.status-tag.tag-waiting {
    background: rgba(239, 68, 68, 0.12);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Aviso de Estado para el Anfitrión */
.host-ready-status-notice {
    width: 100%;
    padding: 8px 14px;
    border-radius: var(--radius-md);
    font-size: 0.84rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-sizing: border-box;
    text-align: center;
    line-height: 1.35;
    transition: all 0.2s ease;
}

.host-ready-status-notice.waiting {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
}

.host-ready-status-notice.pending {
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.35);
    color: var(--accent-gold);
}

.host-ready-status-notice.all-ready {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.35);
    color: var(--success);
}

/* Botón Comenzar Partida Bloqueado vs Habilitado */
.btn-start-game-waiting:disabled {
    background: var(--bg-secondary) !important;
    color: var(--text-muted) !important;
    border: 1.5px solid var(--border-color) !important;
    cursor: not-allowed !important;
    opacity: 0.6;
    box-shadow: none !important;
    transform: none !important;
}

.btn-start-game-waiting:not(:disabled) {
    background: var(--success) !important;
    color: #ffffff !important;
    cursor: pointer !important;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4) !important;
    animation: pulseReadyStart 2s infinite ease-in-out;
}

@keyframes pulseReadyStart {
    0%, 100% { transform: scale(1); box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4); }
    50% { transform: scale(1.03); box-shadow: 0 6px 20px rgba(16, 185, 129, 0.6); }
}

/* Botón Listo para Invitados */
.btn-ready-toggle {
    background-color: var(--success);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    padding: 10px 22px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.35);
    transition: all 0.2s ease;
}

.btn-ready-toggle:hover {
    background-color: #059669;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.45);
}

.btn-ready-toggle.is-ready {
    background-color: #475569;
    color: #ffffff;
    box-shadow: none;
}

.btn-ready-toggle.is-ready:hover {
    background-color: #ef4444;
}

/* Badge en la lista lateral de jugadores */
.player-ready-badge {
    font-size: 0.72rem;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.player-ready-badge.badge-host {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-gold);
}

.player-ready-badge.badge-ready {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.player-ready-badge.badge-not-ready {
    background: rgba(239, 68, 68, 0.12);
    color: var(--danger);
}

/* Sorteo de Turno Minimalista y Elegante (Sin Neón ni Rebotes) */
.sorteo-card-minimal,
.choosing-card-minimal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 32px 28px;
    max-width: 440px;
    width: 100%;
    text-align: center;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.sorteo-badge-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.8px;
    padding: 4px 12px;
    border-radius: 999px;
    text-transform: uppercase;
}

.sorteo-badge-pill.word-choice-badge {
    color: var(--primary);
    background-color: var(--primary-light);
    border-color: rgba(2, 132, 199, 0.25);
}

.sorteo-live-dot {
    width: 7px;
    height: 7px;
    background-color: var(--primary);
    border-radius: 50%;
    display: inline-block;
}

.sorteo-avatar-showcase {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    margin: 4px 0;
}

.sorteo-avatar-frame {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease;
}

.sorteo-title-minimal {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.3px;
    margin: 0;
}

.sorteo-subtitle-minimal {
    font-size: 0.86rem;
    color: var(--text-muted);
    font-weight: 500;
    margin: 0;
    line-height: 1.4;
}

/* Barra de Herramientas Inferior Rediseñada */
.pinturillo-toolbar {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 6px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    box-shadow: var(--shadow-sm);
    min-height: 46px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: visible !important; /* Permite mostrar el popover de colores hacia arriba */
    position: relative;
    z-index: 50;
}

.tools-group {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.tools-group.actions-group {
    flex-shrink: 0;
    margin-left: auto;
}

.fa-tool-btn {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.92rem;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.fa-tool-btn:hover {
    background-color: var(--border-color);
    color: var(--text-primary);
}

.fa-tool-btn.active {
    background-color: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
    box-shadow: none;
}

/* Selector de Grosores */
.sizes-group {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 0 4px;
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    flex-shrink: 0;
}

.size-btn {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.size-btn.active {
    border-color: var(--primary);
    background-color: var(--primary-light);
}

.size-btn .dot {
    background-color: var(--text-primary);
    border-radius: 50%;
}

/* SECCIÓN DE COLOR MINIMALISTA Y PROFESIONAL */
.color-picker-section {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 8px;
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    flex-shrink: 0;
    min-width: 0;
    overflow: visible !important;
    z-index: 60;
}

/* Botón Trigger para Abrir/Cerrar la Paleta */
.color-palette-trigger {
    background-color: var(--bg-secondary);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 4px 8px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 0.8rem;
    font-weight: 700;
    font-family: inherit;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    user-select: none;
    flex-shrink: 0;
    white-space: nowrap;
}

.color-palette-trigger:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.color-palette-trigger.active {
    border-color: var(--primary);
    background-color: var(--primary-light);
    color: var(--primary);
}

.color-trigger-chevron {
    font-size: 0.68rem;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.color-palette-trigger.active .color-trigger-chevron {
    transform: rotate(180deg);
}

.current-color-indicator {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background-color: #000000;
    border: 2px solid var(--bg-card);
    box-shadow: 0 0 0 1.5px var(--border-color), 0 2px 4px rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
    transition: transform 0.2s ease, background-color 0.15s ease;
}

/* Acceso Rápido de 4 Últimos Colores Usados en Barra */
.quick-color-swatches {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 2px 2px;
    flex-shrink: 0;
    min-width: 0;
}

.quick-color-swatches .color-box {
    width: 22px;
    height: 22px;
    min-width: 22px;
    border-width: 1.5px;
    flex-shrink: 0;
}

.quick-color-swatches .color-box:hover {
    transform: scale(1.15);
}

.quick-color-swatches .color-box.active {
    transform: none;
    box-shadow: 0 0 0 2px var(--bg-card), 0 0 0 3.5px var(--primary);
}

@media (max-width: 1280px) {
    .color-trigger-text {
        display: none;
    }
    .color-palette-trigger {
        padding: 4px 6px;
    }
}

/* Paleta / Popover Flotante de Colores */
.color-palette-popover {
    position: absolute;
    bottom: calc(100% + 12px);
    left: 0;
    background: var(--bg-card);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 16px 18px;
    width: 320px;
    max-width: min(340px, 92vw);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
    z-index: 9999;
    display: none;
    flex-direction: column;
    gap: 10px;
    box-sizing: border-box;
}

.color-palette-popover.open {
    display: flex !important;
    animation: popoverFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.color-palette-popover::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 45px;
    border-width: 8px;
    border-style: solid;
    border-color: var(--border-color) transparent transparent transparent;
}

@media (max-width: 860px) {
    .color-palette-popover {
        left: 50% !important;
        transform: translateX(-50%) !important;
        width: 300px;
    }
    .color-palette-popover::after {
        left: 50% !important;
        transform: translateX(-50%) !important;
    }
}

@keyframes popoverFadeIn {
    from { opacity: 0; transform: translateY(6px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.popover-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

.popover-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--text-primary);
}

.popover-title i {
    color: var(--primary);
    font-size: 1.05rem;
}

.btn-close-popover {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.15s ease;
}

.btn-close-popover:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.popover-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.popover-hint {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    line-height: 1.3;
}

.popover-color-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    justify-items: center;
    align-items: center;
}

.color-box {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid rgba(0, 0, 0, 0.15);
    transition: all 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.12);
    outline: none;
}

[data-theme="dark"] .color-box {
    border: 2px solid rgba(255, 255, 255, 0.25);
}

.color-box[data-color="#ffffff"] {
    border: 2px solid var(--border-color);
}

.color-box:hover {
    transform: scale(1.22);
    z-index: 5;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
    border-color: var(--text-primary);
}

.color-box.active {
    transform: scale(1.18);
    z-index: 6;
    border-color: var(--bg-card) !important;
    box-shadow: 0 0 0 2.5px var(--bg-card), 0 0 0 4.5px var(--primary);
}

/* Fila Libre / Selector Custom */
.popover-custom-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
}

.custom-color-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-secondary);
    cursor: pointer;
}

.custom-color-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    background: transparent;
    cursor: pointer;
    padding: 0;
    outline: none;
    -webkit-appearance: none;
}

.custom-color-circle::-webkit-color-swatch-wrapper {
    padding: 0;
}

.custom-color-circle::-webkit-color-swatch {
    border: none;
    border-radius: 50%;
}

.btn-apply-color {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    padding: 5px 12px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: inherit;
    transition: background-color 0.15s ease;
}

.btn-apply-color:hover {
    background: var(--primary-hover);
}

/* Barra de Adivinador (cuando NO te toca dibujar) */
.guesser-action-bar {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: var(--shadow-sm);
    min-height: 52px;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--primary);
    flex-shrink: 0;
}

.guesser-action-bar i {
    font-size: 1.2rem;
}

/* Columna Derecha: CHAT EN VIVO DE ALTURA FIJA Y SCROLL INTERNO */
.chat-panel {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
    min-height: 0;
}

.chat-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    flex-shrink: 0;
}

.btn-chat-invite {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background-color: var(--primary-light);
    color: var(--primary);
    border: 1px solid rgba(2, 132, 199, 0.25);
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.18s ease;
    font-family: inherit;
    line-height: 1;
}

.btn-chat-invite:hover {
    background-color: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.btn-chat-invite:active {
    transform: translateY(0);
}

.chat-messages-area {
    flex: 1;
    min-height: 0;
    max-height: 100%;
    padding: 10px;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 6px;
    background-color: var(--chat-bg);
    scroll-behavior: smooth;
}

.chat-msg {
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    line-height: 1.35;
    word-break: break-word;
    animation: fadeIn 0.15s ease-out;
}

.chat-msg.normal {
    background-color: var(--bg-card);
    border: 1px solid var(--chat-border);
    color: var(--text-primary);
}

.chat-msg.normal .author {
    font-weight: 700;
    color: var(--primary);
    margin-right: 4px;
}

.chat-msg.system {
    background-color: var(--bg-secondary);
    color: var(--text-muted);
    font-size: 0.8rem;
    font-style: italic;
    border-left: 3px solid var(--primary);
}

.chat-msg.correct {
    background-color: var(--chat-correct-bg);
    border: 1px solid var(--chat-correct-border);
    color: var(--chat-correct-text);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
}

.chat-msg.close {
    background-color: var(--chat-close-bg);
    border: 1px solid var(--chat-close-border);
    color: var(--chat-close-text);
    font-weight: 600;
    font-size: 0.82rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.chat-input-area {
    padding: 10px 12px;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-card);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    box-sizing: border-box;
}

.chat-input {
    flex: 1;
    min-width: 0;
    height: 42px;
    padding: 0 16px;
    background-color: var(--bg-secondary);
    border: 1.5px solid var(--border-color);
    border-radius: 999px;
    color: var(--text-primary);
    font-size: 0.92rem;
    outline: none;
    font-family: inherit;
    transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
    box-sizing: border-box;
}

.chat-input:focus {
    border-color: var(--primary);
    background-color: var(--bg-card);
    box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.12);
}

.chat-send-btn {
    width: 42px;
    height: 42px;
    min-width: 42px;
    min-height: 42px;
    aspect-ratio: 1;
    border-radius: 50%;
    background-color: var(--primary);
    color: #ffffff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
    transition: background-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
    padding: 0;
    box-sizing: border-box;
}

.chat-send-btn:hover {
    background-color: var(--primary-hover);
    transform: scale(1.06);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}

.chat-send-btn:active {
    transform: scale(0.95);
}

.chat-send-btn i {
    font-size: 0.95rem;
    margin-left: 1px;
    margin-bottom: 1px;
    transition: transform 0.15s ease;
}

.chat-send-btn:hover i {
    transform: translate(1px, -1px);
}

/* ========================================================= */
/* MODALES: SELECCIÓN DE 5 PALABRAS, CREAR SALA, PODIO       */
/* ========================================================= */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background-color: rgba(15, 23, 42, 0.78);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 2000;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Centrado perfecto y organizado de todas las tarjetas modales */
.word-selection-modal,
.create-room-modal,
.podium-modal,
.join-invite-card,
.avatar-customizer-card,
.nick-style-modal-card {
    margin: auto !important;
    max-height: 90vh;
    box-sizing: border-box;
}

/* Modal de Selección de 5 Palabras */
.word-selection-modal {
    background-color: var(--bg-card);
    border: 2px solid var(--primary);
    border-radius: var(--radius-xl);
    padding: 28px;
    max-width: 780px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    text-align: center;
    animation: scaleModal 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes scaleModal {
    from { transform: scale(0.85); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.word-selection-header {
    margin-bottom: 20px;
}

.word-selection-header h3 {
    font-size: 1.5rem;
    color: var(--primary);
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.selection-timer-bar {
    width: 100%;
    height: 8px;
    background-color: var(--bg-secondary);
    border-radius: 999px;
    overflow: hidden;
    margin: 12px 0 8px 0;
}

.selection-timer-fill {
    height: 100%;
    width: 100%;
    background-color: var(--accent-gold);
    transition: width 1s linear;
}

.five-words-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 14px;
    margin-top: 18px;
}

.word-choice-card {
    background-color: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px;
    text-align: left;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 8px;
    transition: all 0.2s ease;
}

.word-choice-card:hover {
    border-color: var(--primary);
    background-color: var(--primary-light);
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.word-choice-card .word-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.word-choice-card .category-badge {
    font-size: 0.74rem;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 999px;
    background-color: var(--bg-card);
    color: var(--primary);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 5px;
}

.word-choice-card .points-badge {
    font-size: 0.78rem;
    font-weight: 800;
    color: var(--accent-gold);
    background: rgba(245, 158, 11, 0.12);
    padding: 3px 8px;
    border-radius: 999px;
}

.word-choice-card h4 {
    font-size: 1.18rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 4px 0;
    letter-spacing: -0.2px;
}

.word-choice-card p {
    font-size: 0.83rem;
    color: var(--text-secondary);
    line-height: 1.35;
}

/* Modal de Crear Sala */
.create-room-modal {
    background-color: var(--bg-card);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 20px 24px;
    max-width: 490px;
    width: 100%;
    max-height: min(90vh, 640px);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    overflow: hidden;
    gap: 0;
}

.create-room-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.create-room-title-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.create-room-title-wrap h3 {
    font-size: 1.2rem;
    font-weight: 800;
    margin: 0;
}

.create-room-header i {
    font-size: 1.35rem;
    color: var(--primary);
}

.create-room-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px 6px 12px 0;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: #94a3b8 var(--bg-secondary);
}

.create-room-body::-webkit-scrollbar {
    width: 6px;
}

.create-room-body::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 4px;
}

.create-room-body::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 4px;
}

.create-room-body::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

.create-room-body .form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.create-room-body .form-label {
    font-size: 0.86rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.create-room-body .form-input {
    padding: 9px 12px;
    font-size: 0.92rem;
    border-radius: var(--radius-md);
}

.modal-actions {
    display: flex;
    align-items: stretch;
    gap: 12px;
    padding-top: 14px;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
    flex-shrink: 0;
    background: var(--bg-card);
    box-sizing: border-box;
}

.modal-actions button {
    flex: 1;
    padding: 11px 14px;
    font-size: 0.92rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1.25;
}

/* Modal Estilizado de Contraseña para Sala Privada */
.room-password-card {
    background-color: var(--bg-card);
    border: 2px solid var(--primary);
    border-radius: var(--radius-xl);
    padding: 26px 24px;
    max-width: 440px;
    width: 100%;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.45);
    display: flex;
    flex-direction: column;
    gap: 16px;
    animation: scaleModal 0.28s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.password-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.password-header-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.lock-icon-circle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(2, 132, 199, 0.12);
    border: 1.5px solid var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: var(--primary);
    flex-shrink: 0;
}

.password-header-title h3 {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.2;
}

.password-header-title p {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 600;
    margin: 2px 0 0 0;
}

.password-card-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.password-notice-text {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.4;
    margin: 0;
}

.password-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.password-field-icon {
    position: absolute;
    left: 14px;
    font-size: 0.95rem;
    color: var(--text-muted);
    pointer-events: none;
}

.password-input-wrap .password-input {
    padding-left: 40px;
    padding-right: 44px;
    font-size: 0.95rem;
    letter-spacing: 1px;
}

.btn-toggle-pwd {
    position: absolute;
    right: 10px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    border-radius: 50%;
    transition: color 0.15s ease;
}

.btn-toggle-pwd:hover {
    color: var(--primary);
}

.password-error-msg {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--danger);
    display: flex;
    align-items: center;
    gap: 6px;
    animation: shakeError 0.3s ease;
}

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

.password-card-footer {
    display: flex;
    gap: 10px;
    margin-top: 4px;
}

.password-card-footer button {
    flex: 1;
}

/* Modal de Podio Final */
.podium-modal {
    background-color: var(--bg-card);
    border: 3px solid var(--accent-gold);
    border-radius: var(--radius-xl);
    padding: 36px 24px;
    max-width: 580px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    text-align: center;
    animation: scaleModal 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.podium-modal h2 {
    font-size: 2rem;
    font-weight: 900;
    color: var(--accent-gold);
    margin-bottom: 6px;
}

.podium-visual {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 16px;
    margin: 36px 0 24px 0;
}

.podium-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    max-width: 140px;
}

.podium-slot.first { order: 2; }
.podium-slot.second { order: 1; }
.podium-slot.third { order: 3; }

.podium-avatar {
    font-size: 2.2rem;
    margin-bottom: 4px;
}

.podium-name {
    font-size: 0.95rem;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.podium-score {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
}

.podium-pedestal {
    width: 100%;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    font-weight: 900;
    color: white;
}

.podium-pedestal.gold {
    height: 130px;
    background: linear-gradient(180deg, #fbbf24, #d97706);
}

.podium-pedestal.silver {
    height: 95px;
    background: linear-gradient(180deg, #94a3b8, #64748b);
}

.podium-pedestal.bronze {
    height: 65px;
    background: linear-gradient(180deg, #d97706, #92400e);
}

/* Tabla completa de Posiciones en el Podio Final */
.podium-full-rankings {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    margin: 16px 0;
    max-height: 170px;
    overflow-y: auto;
    text-align: left;
}

.podium-full-rankings .rankings-title {
    font-size: 0.84rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.podium-full-rankings .rankings-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ranking-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    gap: 8px;
}

.ranking-item.first-place {
    border-color: var(--accent-gold);
    background: rgba(245, 158, 11, 0.08);
}

.ranking-item-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
}

.ranking-item-pos {
    font-size: 0.8rem;
    font-weight: 900;
    color: var(--text-muted);
    width: 22px;
    flex-shrink: 0;
}

.ranking-item.first-place .ranking-item-pos {
    color: var(--accent-gold);
}

.ranking-item-avatar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ranking-item-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ranking-item-score {
    font-size: 0.82rem;
    font-weight: 800;
    color: var(--primary);
    flex-shrink: 0;
}

/* Toast de Notificaciones */
.toast-notification {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #0f172a;
    color: white;
    padding: 12px 20px;
    border-radius: var(--radius-md);
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
    border: 1px solid var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 0.95rem;
    z-index: 3000;
    animation: toastSlideUp 0.3s ease-out;
}

@keyframes toastSlideUp {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Modal de Unirse por Enlace de Invitación */
.join-invite-card {
    background-color: var(--bg-card);
    border: 2px solid var(--primary);
    border-radius: var(--radius-xl);
    padding: 32px 24px;
    max-width: 460px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    text-align: center;
    animation: scaleModal 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.join-invite-icon {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 12px;
}

/* Selector de Idiomas con Banderas */
.select-lang {
    padding: 8px 14px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    outline: none;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--shadow-sm);
}

.select-lang option {
    background-color: var(--bg-card);
    color: var(--text-primary);
    font-size: 0.9rem;
    padding: 6px;
}


/* ========================================================= */
/* DISEÑO RESPONSIVO INTEGRAL: CELULARES Y TABLETS            */
/* ========================================================= */

@media (max-width: 1140px) {
    .game-layout {
        grid-template-columns: 180px 1fr 240px;
        gap: 8px;
    }

    .lobby-bottom-strip {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* TABLETS Y CELULARES (<= 900px) */
@media (max-width: 900px) {
    html, body {
        overflow-x: hidden;
        overflow-y: auto;
    }

    .main-wrapper {
        height: auto;
        min-height: calc(100vh - 56px);
        min-height: calc(100dvh - 56px);
        max-height: none;
        overflow-y: auto;
        padding: 8px 12px 24px 12px;
        width: 100%;
    }

    /* 1. Lobby en Celulares */
    #lobbyScreen.active {
        height: auto;
        max-height: none;
        overflow: visible;
        display: flex;
        flex-direction: column;
        gap: 14px;
        padding: 0;
    }

    .lobby-layout {
        display: flex;
        flex-direction: column;
        height: auto;
        max-height: none;
        overflow: visible;
        gap: 14px;
    }

    .profile-card {
        width: 100%;
        min-width: 0;
        max-width: 100%;
        height: auto;
        max-height: none;
        overflow: visible;
        padding: 16px 14px;
        border-radius: var(--radius-lg);
    }

    .servers-section {
        width: 100%;
        min-width: 0;
        max-width: 100%;
        height: auto;
        max-height: none;
        overflow: visible;
        padding: 16px 14px;
        border-radius: var(--radius-lg);
    }

    .rooms-grid {
        grid-template-columns: 1fr;
        max-height: 440px;
        overflow-y: auto;
        padding: 4px;
    }

    .lobby-bottom-strip {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        padding-bottom: 8px;
    }

    /* 2. Pantalla de Juego en Celulares - fija al viewport */
    #gameScreen.active {
        height: calc(100vh - 56px);
        height: calc(100dvh - 56px);
        max-height: calc(100vh - 56px);
        max-height: calc(100dvh - 56px);
        overflow: hidden;
    }

    .game-layout {
        display: flex;
        flex-direction: column;
        height: 100%;
        max-height: 100%;
        overflow: hidden;
        gap: 8px;
    }

    .canvas-column {
        order: 1;
        width: 100%;
        flex: 1;
        min-height: 0;
        overflow: hidden;
    }

    .game-top-bar {
        padding: 6px 10px;
        min-height: 48px;
    }

    .round-pill {
        font-size: 0.72rem;
        padding: 3px 8px;
    }

    .word-hint-wrap {
        max-width: 60%;
    }

    .letter-chip {
        font-size: 1rem;
    }

    .timer-pill {
        padding: 3px 10px;
        font-size: 0.95rem;
    }

    .canvas-wrapper-outer {
        width: 100%;
        aspect-ratio: 3 / 2;
        min-height: 180px;
        max-height: 45vh;
        border-radius: var(--radius-md);
    }

    .pinturillo-toolbar {
        flex-wrap: wrap;
        justify-content: center;
        gap: 6px;
        padding: 6px 8px;
        min-height: auto;
    }

    .sizes-group,
    .color-picker-section {
        border: none;
        padding: 0 4px;
    }

    .chat-panel {
        order: 2;
        width: 100%;
        height: 200px;
        min-height: 200px;
        max-height: 200px;
        flex-shrink: 0;
    }

    .players-panel {
        order: 3;
        width: 100%;
        height: 140px;
        min-height: 140px;
        max-height: 140px;
        flex-shrink: 0;
    }

    /* 3. Modales en Celulares */
    .modal-backdrop {
        padding: 10px;
    }

    .avatar-customizer-card {
        width: 100%;
        max-width: 100%;
        max-height: 94vh;
        border-radius: var(--radius-lg);
        margin: auto;
    }

    .customizer-body {
        grid-template-columns: 1fr;
        padding: 12px;
        gap: 12px;
    }

    .customizer-avatar-stage {
        padding: 8px;
    }

    .customizer-badge-lg {
        width: 85px !important;
        height: 85px !important;
    }

    .modal-avatar-grid {
        grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
        gap: 8px;
    }

    .create-room-modal {
        width: 100%;
        max-width: 100%;
        padding: 16px 14px;
        max-height: 92vh;
        border-radius: var(--radius-lg);
    }

    .podium-modal {
        width: 100%;
        max-width: 100%;
        padding: 22px 12px;
        border-radius: var(--radius-lg);
    }

    .word-selection-modal {
        width: 100%;
        max-width: 100%;
        padding: 18px 12px;
        border-radius: var(--radius-lg);
    }

    .five-words-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .join-invite-card {
        width: 100%;
        max-width: 100%;
        padding: 20px 14px;
        border-radius: var(--radius-lg);
    }
}

/* CELULARES PEQUEÑOS (<= 520px) */
@media (max-width: 520px) {
    .app-header {
        padding: 6px 10px;
        height: 52px;
        min-height: 52px;
    }

    .game-logo-svg {
        width: 32px;
        height: 32px;
    }

    .brand-title-wrap h1 {
        font-size: 1.12rem;
    }

    .brand-title-wrap span {
        display: none;
    }

    .header-controls {
        gap: 6px;
    }

    .custom-lang-trigger {
        padding: 5px 8px;
        font-size: 0.78rem;
    }

    .icon-button {
        width: 34px;
        height: 34px;
        font-size: 0.95rem;
    }

    .lobby-bottom-strip {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .btn-play-heroic {
        font-size: 1rem;
        padding: 13px 18px;
    }

    .word-choice-card h4 {
        font-size: 1.05rem;
    }
}

/* ========================================================= */
/* AVATARES VECTORIALES / FONTAWESOME CON GRADIENTES MODERNOS */
/* ========================================================= */
.custom-avatar-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.22);
    flex-shrink: 0;
    line-height: 1;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    user-select: none;
}

.custom-avatar-badge.choice-badge {
    width: 44px;
    height: 44px;
    font-size: 1.25rem;
}

.custom-avatar-badge.panel-badge {
    width: 32px;
    height: 32px;
    font-size: 0.92rem;
}

.custom-avatar-badge.sorteo-badge-lg {
    width: 72px;
    height: 72px;
    font-size: 2.2rem;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

.custom-avatar-badge.podium-badge-lg {
    width: 64px;
    height: 64px;
    font-size: 1.8rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.22);
}

.custom-avatar-badge.podium-badge-md {
    width: 50px;
    height: 50px;
    font-size: 1.35rem;
}

.player-avatar-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.sorteo-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 6px 0;
}

.podium-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 6px;
}

/* Brand Logo Vector Minimalist & Premium */
.game-logo-svg {
    width: 42px;
    height: 42px;
    display: block;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Confetti Canvas Fixed Overlay */
#confettiCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 99999;
    display: none;
}

/* ========================================================= */
/* SECCIÓN DE AVATAR INTERACTIVO EN PERFIL                   */
/* ========================================================= */
.profile-avatar-display-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    width: 100%;
}

.profile-avatar-showcase {
    position: relative;
    cursor: pointer;
    border-radius: 50%;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    outline: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.profile-avatar-showcase:hover {
    transform: scale(1.06);
}

.profile-avatar-large {
    width: 80px !important;
    height: 80px !important;
    border-radius: 50%;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
    border: 3px solid var(--border-color);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-avatar-showcase:hover .profile-avatar-large {
    border-color: var(--primary);
    box-shadow: 0 0 14px rgba(2, 132, 199, 0.45);
}

.profile-avatar-edit-overlay {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 26px;
    height: 26px;
    background: var(--primary);
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    border: 2px solid var(--bg-card);
    transition: transform 0.2s ease;
}

.profile-avatar-showcase:hover .profile-avatar-edit-overlay {
    transform: scale(1.15);
}

.profile-avatar-meta {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}

.profile-avatar-name {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--text-primary);
}

.btn-change-avatar-action {
    background: transparent;
    border: none;
    color: var(--primary);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    transition: all 0.18s ease;
    font-family: inherit;
}

.btn-change-avatar-action:hover {
    background: var(--primary-light);
}



/* ========================================================= */
/* MODAL PERSONALIZADOR Y GALERÍA DE AVATARES                */
/* Dimensiones fijas para evitar que salte o cambie de tamaño*/
/* ========================================================= */
.avatar-customizer-card {
    background-color: var(--bg-card);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-xl);
    width: 780px;
    max-width: 95vw;
    height: 590px;
    max-height: 90vh;
    min-height: 540px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.45);
    overflow: hidden;
    animation: zoomIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    box-sizing: border-box;
}

@media (max-width: 820px) {
    .avatar-customizer-card {
        width: 95vw;
        height: 88vh;
        min-height: 0;
    }
}

@media (max-height: 640px) {
    .avatar-customizer-card {
        height: 92vh;
        min-height: 0;
    }
}

.customizer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-card);
    flex-shrink: 0;
}

/* Botón Cerrar Modal Elegante */
.btn-close-modal {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background-color: var(--bg-secondary);
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    cursor: pointer;
    padding: 0;
    transition: all 0.18s ease;
    box-shadow: var(--shadow-sm);
    outline: none;
}

.btn-close-modal:hover {
    background-color: rgba(239, 68, 68, 0.12);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.35);
    transform: scale(1.05);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.btn-close-modal:active {
    transform: scale(0.95);
}

.customizer-title-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

.customizer-title-icon {
    font-size: 1.6rem;
    color: var(--primary);
}

.customizer-title-wrap h3 {
    font-size: 1.15rem;
    font-weight: 800;
    margin: 0;
    color: var(--text-primary);
}

.customizer-title-wrap p {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 2px 0 0 0;
}

/* Selector de Pestañas Principales: Galería vs Personalizador */
.customizer-tabs {
    display: flex;
    gap: 10px;
    padding: 12px 24px;
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.customizer-tab-btn {
    flex: 1;
    padding: 10px 16px;
    border-radius: var(--radius-md);
    border: 1.5px solid transparent;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.customizer-tab-btn:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.04);
}

.customizer-tab-btn.active {
    background-color: var(--bg-card);
    color: var(--primary);
    border-color: var(--border-color);
    box-shadow: var(--shadow-sm);
}

/* Vista 1: Galería de Personajes (Fija y con scroll interno) */
.customizer-gallery-panel {
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
    flex: 1;
    height: 100%;
    min-height: 0;
    box-sizing: border-box;
}

.customizer-gallery-panel .avatar-gender-tabs {
    flex-shrink: 0;
}

.modal-avatar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
    gap: 14px;
    padding: 4px;
    align-content: start;
    justify-items: center;
    flex: 1;
    min-height: 0;
    box-sizing: border-box;
}

/* Vista 2: Creador Interactivo de Avatar */
.customizer-body {
    display: grid;
    grid-template-columns: 210px 1fr;
    gap: 24px;
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
    height: 100%;
    min-height: 0;
    box-sizing: border-box;
}

.customizer-gallery-panel::-webkit-scrollbar,
.customizer-body::-webkit-scrollbar {
    width: 6px;
}

.customizer-gallery-panel::-webkit-scrollbar-track,
.customizer-body::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 4px;
}

.customizer-gallery-panel::-webkit-scrollbar-thumb,
.customizer-body::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 4px;
}

.customizer-gallery-panel::-webkit-scrollbar-thumb:hover,
.customizer-body::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

@media (max-width: 640px) {
    .customizer-body {
        grid-template-columns: 1fr;
        gap: 16px;
        padding: 14px;
    }
}

.customizer-preview-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.customizer-avatar-stage {
    padding: 20px 14px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1.5px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    box-sizing: border-box;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.15);
}

.customizer-badge-lg {
    width: 124px !important;
    height: 124px !important;
    border-radius: 50%;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
    border: 3.5px solid rgba(255, 255, 255, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-randomize {
    width: 100%;
    font-size: 0.9rem;
    font-weight: 700;
    padding: 10px 16px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.customizer-controls-col {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.custom-control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border-color);
}

.custom-control-group:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.control-label {
    font-size: 0.88rem;
    font-weight: 800;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.control-sublabel {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-top: 4px;
}

.custom-palette-row {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
}

.color-swatch-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    outline: none;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25);
}

.color-swatch-btn:hover {
    transform: scale(1.18);
}

.color-swatch-btn.active {
    transform: scale(1.18);
    border-color: var(--bg-card);
    box-shadow: 0 0 0 2.5px var(--bg-card), 0 0 0 4.5px var(--primary);
}

.custom-pill-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.custom-pill-btn {
    background: var(--bg-secondary);
    border: 1.5px solid var(--border-color);
    color: var(--text-secondary);
    padding: 7px 14px;
    border-radius: var(--radius-md);
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    user-select: none;
}

.custom-pill-btn i {
    font-size: 0.86rem;
    opacity: 0.85;
}

.custom-pill-btn:hover {
    color: var(--primary);
    border-color: var(--primary);
    background-color: var(--primary-light);
}

.custom-pill-btn.active {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.customizer-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-card);
    flex-shrink: 0;
    position: relative;
    z-index: 10;
}

