/* ============================================
   Variables CSS - Colores y Temas
   ============================================ */

:root {
    /* Colores principales - Modo Claro */
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;

    --success-color: #10b981;
    --success-dark: #059669;

    --danger-color: #ef4444;
    --danger-dark: #dc2626;

    --warning-color: #f59e0b;
    --warning-dark: #d97706;

    /* Backgrounds */
    --bg-primary: #ffffff;
    --bg-secondary: #f3f4f6;
    --bg-tertiary: #e5e7eb;

    /* Text colors */
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --text-inverse: #ffffff;

    /* Borders */
    --border-color: #d1d5db;
    --border-radius: 12px;
    --border-radius-lg: 16px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);

    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;

    /* Navigation */
    --nav-height: 70px;
    --header-height: 60px;
}

/* Modo Oscuro */
body.dark-mode {
    --bg-primary: #1f2937;
    --bg-secondary: #111827;
    --bg-tertiary: #374151;

    --text-primary: #f9fafb;
    --text-secondary: #9ca3af;

    --border-color: #374151;
}

/* ============================================
   Reset y Base
   ============================================ */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* ============================================
   Estructura Principal
   ============================================ */

.app-container {
    max-width: 600px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-primary);
    transition: background-color 0.3s ease;
}

.app-header {
    height: var(--header-height);
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: var(--text-inverse);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 100;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

.header-descobreix-logo {
    height: 32px;
    width: auto;
    filter: brightness(0) invert(1);
}

.header-logo {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 40px;
    cursor: pointer;
}

.header-buttons {
    display: flex;
    gap: var(--spacing-sm);
    align-items: center;
}

.header-icon-btn {
    background: transparent;
    border: none;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.header-icon-btn:hover {
    transform: scale(1.1);
}

.header-icon-btn:active {
    transform: scale(0.95);
}

.header-icon-btn img {
    width: 28px;
    height: 28px;
    filter: brightness(0) invert(1);
}

.header-logo-section {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.header-subtitle {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-inverse);
    opacity: 0.9;
}

@media (max-width: 480px) {
    .header-subtitle {
        font-size: 0.75rem;
    }
}

.main-content {
    flex: 1;
    padding-bottom: calc(var(--nav-height) + 16px);
    position: relative;
}

/* ============================================
   Navegación Inferior
   ============================================ */

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: var(--nav-height);
    background-color: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
    z-index: 1000;
    transition: background-color 0.3s ease;
}

.nav-content {
    display: flex;
    justify-content: space-around;
    align-items: center;
    width: 100%;
    max-width: 800px;
    height: 100%;
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px;
    border: none;
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.75rem;
}

.nav-item:hover {
    background-color: var(--bg-secondary);
}

.nav-item.active {
    color: var(--primary-color);
}

.nav-icon {
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-icon img {
    width: 24px;
    height: 24px;
    filter: opacity(0.6);
    transition: all 0.3s ease;
}

.nav-item.active .nav-icon img {
    filter: opacity(1) brightness(0) saturate(100%) invert(44%) sepia(96%) saturate(2660%) hue-rotate(226deg) brightness(99%) contrast(93%);
}

/* Modo Oscuro - Iconos de navegación blancos */
body.dark-mode .nav-icon img {
    filter: brightness(0) invert(1) opacity(0.7);
}

body.dark-mode .nav-item.active .nav-icon img {
    filter: brightness(0) invert(1) opacity(1);
}

.nav-label {
    font-size: 0.7rem;
    font-weight: 500;
}

/* ============================================
   Pantallas y Transiciones
   ============================================ */

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

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

.screen-content h2 {
    font-size: 1.75rem;
    margin-bottom: var(--spacing-lg);
    color: var(--text-primary);
}

/* ============================================
   Pantalla de Inicio
   ============================================ */

#screen-home {
    background: linear-gradient(135deg, #313c6e 0%, #1b1924 50%, #252525 100%);
}

.home-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100%;
    height: 100%;
    padding: var(--spacing-xl);
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
    color: white;
}

.logo {
    margin-bottom: var(--spacing-xl);
}

.logo-icon {
    font-size: 5rem;
    margin-bottom: var(--spacing-md);
    animation: float 3s ease-in-out infinite;
}

.logo-icon-svg {
    width: 120px;
    height: 120px;
    margin-bottom: var(--spacing-md);
    animation: float 3s ease-in-out infinite;
    filter: brightness(0) invert(1);
}

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

.logo h2 {
    font-size: 2rem;
    color: white;
    margin-bottom: var(--spacing-sm);
}

.subtitle {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
}

.home-links {
    margin-top: var(--spacing-xl);
}

.link-external {
    color: white;
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0.9;
}

.link-external:hover {
    opacity: 1;
    text-decoration: underline;
}

.donate-icon {
    width: 20px;
    height: 20px;
    filter: brightness(0) invert(1);
    transition: transform 0.2s ease;
}

.link-external:hover .donate-icon {
    transform: scale(1.1);
}

/* ============================================
   Home Screen Redesign
   ============================================ */

.home-container-new {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    height: 100%;
    padding: var(--spacing-lg);
    color: white;
    max-width: 600px;
    margin: 0 auto;
}

/* Header con iconos */
.home-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-xl);
}

.home-icon-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
}

.home-icon-btn img {
    width: 24px;
    height: 24px;
    filter: brightness(0) invert(1);
}

.home-icon-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.home-icon-btn:active {
    transform: scale(0.95);
}

/* Logo section */
.home-logo-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    margin-bottom: var(--spacing-xl);
}

.home-logo-circle {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--spacing-lg);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: float 3s ease-in-out infinite;
}

.home-logo-svg {
    width: 140px;
    height: 140px;
}

.home-title {
    font-size: clamp(1.5rem, 5vw, 2rem);
    font-weight: 900;
    letter-spacing: 1px;
    margin-bottom: var(--spacing-sm);
    color: white;
}

.home-subtitle {
    font-size: clamp(1rem, 3vw, 1.2rem);
    color: rgba(255, 255, 255, 0.8);
    font-weight: 300;
}

/* Botones de acción */
.home-buttons {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    width: 100%;
}

.btn-home {
    width: 100%;
    padding: 18px 32px;
    border-radius: 20px;
    font-size: 1.1rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    font-family: inherit;
}

.btn-home:active {
    transform: scale(0.98);
}

.btn-home-primary {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
}

.btn-home-primary:hover {
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
    transform: translateY(-2px);
}

.btn-home-secondary {
    background: white;
    color: #6366f1;
}

.btn-home-secondary:hover {
    box-shadow: 0 8px 20px rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

/* Tarjeta de apoyo */
.home-support-card {
    background: rgba(99, 102, 241, 0.2);
    border: 2px solid rgba(99, 102, 241, 0.3);
    border-radius: 20px;
    padding: var(--spacing-lg);
    backdrop-filter: blur(10px);
}

.support-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
}

.support-text {
    flex: 1;
    text-align: left;
}

.support-question {
    font-size: 0.95rem;
    color: white;
    margin-bottom: var(--spacing-xs);
    font-weight: 500;
}

.support-link {
    color: white;
    text-decoration: underline;
    font-weight: 700;
    font-size: 1rem;
    transition: opacity 0.2s ease;
}

.support-link:hover {
    opacity: 0.8;
}

.support-icon {
    width: 50px;
    height: 50px;
    filter: brightness(0) invert(1);
    flex-shrink: 0;
}

.support-description {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.4;
    text-align: left;
    margin: 0;
}

/* Footer */
.home-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-lg);
    padding-top: var(--spacing-md);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.footer-icon {
    width: 20px;
    height: 20px;
    filter: brightness(0) invert(1);
}

.footer-text {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    margin: 0;
}

.footer-link {
    color: white;
    font-weight: 700;
    text-decoration: none;
    margin-left: 4px;
    transition: opacity 0.2s ease;
}

.footer-link:hover {
    opacity: 0.8;
    text-decoration: underline;
}

/* ============================================
   Botones
   ============================================ */

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
    font-family: inherit;
}

.btn:active {
    transform: scale(0.98);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--text-inverse);
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--primary-dark);
    box-shadow: var(--shadow-md);
}

.btn-success {
    background-color: var(--success-color);
    color: var(--text-inverse);
}

.btn-success:hover:not(:disabled) {
    background-color: var(--success-dark);
    box-shadow: var(--shadow-md);
}

.btn-danger {
    background-color: var(--danger-color);
    color: var(--text-inverse);
}

.btn-danger:hover:not(:disabled) {
    background-color: var(--danger-dark);
}

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

.btn-secondary:hover:not(:disabled) {
    background-color: var(--border-color);
}

.btn-large {
    width: 100%;
    padding: 16px 24px;
    font-size: 1.1rem;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.85rem;
}

/* ============================================
   Formularios
   ============================================ */

input[type="text"],
.select-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-family: inherit;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: border-color 0.2s ease;
}

input[type="text"]:focus,
.select-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.add-player-form {
    display: flex;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-lg);
}

.add-player-form input {
    flex: 1;
}

/* Toggle Switch */
.toggle-container {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    margin: var(--spacing-md) 0;
    cursor: pointer;
    user-select: none;
}

.toggle-container input[type="checkbox"] {
    display: none;
}

.toggle-slider {
    position: relative;
    width: 50px;
    height: 26px;
    background-color: var(--danger-color);
    border-radius: 13px;
    transition: all 0.3s ease;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background-color: white;
    top: 2px;
    left: 2px;
    transition: transform 0.3s ease;
}

.toggle-container input[type="checkbox"]:checked + .toggle-slider {
    background-color: var(--success-color);
}

.toggle-container input[type="checkbox"]:checked + .toggle-slider::before {
    transform: translateX(24px);
}

.toggle-label {
    color: var(--text-primary);
    font-weight: 500;
}

/* Toggle inline - texto a la izquierda, toggle a la derecha */
.toggle-inline {
    justify-content: space-between;
}

.toggle-inline .toggle-label {
    order: 1;
}

.toggle-inline input[type="checkbox"] {
    order: 2;
}

.toggle-inline .toggle-slider {
    order: 3;
}

/* ============================================
   Lista de Jugadores
   ============================================ */

.players-list {
    margin-bottom: var(--spacing-lg);
    min-height: 60px;
}

.player-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md);
    background-color: var(--bg-secondary);
    border-radius: var(--border-radius);
    margin-bottom: var(--spacing-sm);
    animation: slideIn 0.3s ease;
    cursor: move;
    cursor: grab;
    transition: all 0.2s ease;
}

.player-item:active {
    cursor: grabbing;
}

.player-item.dragging {
    opacity: 0.5;
    transform: scale(0.95);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.player-item.drag-over {
    border: 2px dashed var(--primary-color);
    background-color: var(--bg-tertiary);
    transform: scale(1.02);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.drag-handle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-right: var(--spacing-sm);
    cursor: grab;
    user-select: none;
}

.player-item:active .drag-handle {
    cursor: grabbing;
}

.player-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    flex: 1;
}

.player-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: var(--text-inverse);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.player-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.empty-state {
    text-align: center;
    color: var(--text-secondary);
    padding: var(--spacing-xl);
    font-style: italic;
}

/* ============================================
   Configuración de Impostores
   ============================================ */

.impostor-config {
    background-color: var(--bg-secondary);
    padding: var(--spacing-lg);
    border-radius: var(--border-radius);
    margin-bottom: var(--spacing-lg);
}

.impostor-config label {
    display: block;
    margin-bottom: var(--spacing-sm);
    font-weight: 600;
    color: var(--text-primary);
}

.impostor-config .select-input {
    margin-bottom: var(--spacing-md);
}

/* ============================================
   Configuración - Temas
   ============================================ */

.config-section {
    margin-bottom: var(--spacing-xl);
}

.config-section h3 {
    font-size: 1.25rem;
    margin-bottom: var(--spacing-md);
    color: var(--text-primary);
}

.themes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: var(--spacing-md);
}

.theme-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md);
    background-color: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 100px;
}

.theme-button:hover {
    border-color: var(--primary-color);
    background-color: var(--bg-tertiary);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.theme-button.selected {
    border-color: var(--primary-color);
    background-color: var(--primary-color);
    color: var(--text-inverse);
}

.theme-button.selected .theme-icon {
    filter: brightness(0) invert(1);
}

.theme-icon {
    width: 32px;
    height: 32px;
    transition: filter 0.3s ease;
}

.theme-label {
    font-weight: 500;
    text-align: center;
    font-size: 0.9rem;
}

/* ============================================
   Pantalla de Juego
   ============================================ */

.game-content {
    min-height: calc(100vh - var(--header-height) - var(--nav-height) - 48px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.game-state {
    width: 100%;
}

.info-box {
    padding: var(--spacing-lg);
    border-radius: var(--border-radius);
    background-color: var(--bg-secondary);
    border-left: 4px solid var(--primary-color);
    margin-bottom: var(--spacing-lg);
}

.info-box.success {
    background-color: rgba(16, 185, 129, 0.1);
    border-left-color: var(--success-color);
}

.info-box.warning {
    background-color: rgba(245, 158, 11, 0.1);
    border-left-color: var(--warning-color);
}

.info-box h2 {
    font-size: 1.5rem;
    margin-bottom: var(--spacing-sm);
    color: var(--text-primary);
}

.info-box p {
    color: var(--text-secondary);
    margin: 0;
}

/* Impostors Remaining Box */
.impostors-remaining-box {
    padding: var(--spacing-md);
    border-radius: var(--border-radius);
    background-color: var(--bg-secondary);
    border: 2px solid var(--danger-color);
    margin-bottom: var(--spacing-lg);
    text-align: center;
}

.impostors-remaining-box p {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.impostors-remaining-box strong {
    color: var(--danger-color);
}

#impostors-remaining-count {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--danger-color);
}

/* Revelación de Roles - Sistema de Tarjeta que Retorna */
.reveal-container-new {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-xl);
    min-height: 60vh;
}

.cards-stack {
    position: relative;
    width: 100%;
    max-width: 400px;
    height: 450px;
    margin-bottom: var(--spacing-xl);
}

/* Tarjeta de Fondo (Rol Revelado) */
.role-card-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-xl);
    overflow: hidden;
}

.role-card-background.civilian {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.role-card-background.impostor {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.role-content {
    text-align: center;
    color: white;
    width: 100%;
    max-width: 100%;
    padding-top: var(--spacing-md);
}

.role-type-large {
    font-size: clamp(1.5rem, 3.5vw, 1.9rem);
    font-weight: 700;
    margin-bottom: var(--spacing-xs);
    text-transform: uppercase;
    line-height: 1.2;
}

.role-theme-small {
    font-size: clamp(0.85rem, 2vw, 1rem);
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: var(--spacing-sm);
}

.role-word-display {
    font-size: clamp(1.5rem, 4vw, 1.8rem);
    font-weight: 700;
    padding: var(--spacing-sm) var(--spacing-md);
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--border-radius);
    backdrop-filter: blur(10px);
    margin-top: var(--spacing-xs);
    word-wrap: break-word;
    max-width: 100%;
}

/* Tarjeta Superior Deslizable */
.swipe-card-top {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    border-radius: 20px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
    cursor: grab;
    touch-action: none;
    user-select: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-around;
    padding: var(--spacing-xl);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 10;
    overflow: hidden;
}

.swipe-card-top.grabbing {
    cursor: grabbing;
    transition: none;
}

.swipe-card-top.returning {
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.card-logo {
    width: 100px;
    height: 100px;
}

.reveal-logo {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
}

.card-player-name {
    text-align: center;
}

.card-player-name h1 {
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.card-instruction {
    text-align: center;
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-md);
}

.card-instruction p {
    font-size: 1.1rem;
    margin: 0;
    opacity: 0.9;
}

.swipe-arrow {
    width: 50px;
    height: 50px;
    animation: bounceArrow 1.5s ease-in-out infinite;
}

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

.swipe-arrow svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

/* Game Info */
.game-info {
    background-color: var(--bg-secondary);
    padding: var(--spacing-lg);
    border-radius: var(--border-radius);
}

.game-info p {
    margin-bottom: var(--spacing-sm);
    font-size: 1rem;
}

/* Victory Screen */
.victory-card-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 600px;
    padding: var(--spacing-xl);
}

.victory-card {
    position: relative;
    z-index: 10;
    background: var(--bg-primary);
    border-radius: 24px;
    padding: var(--spacing-lg);
    max-width: 500px;
    width: 100%;
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    animation: victorySlideIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

@keyframes victorySlideIn {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(50px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.victory-icon {
    width: clamp(80px, 20vw, 120px);
    height: clamp(80px, 20vw, 120px);
    margin: 0 auto var(--spacing-md);
    animation: victoryIconPulse 2s ease-in-out infinite;
}

.victory-icon svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 4px 12px currentColor);
}

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

.victory-title-section {
    text-align: center;
    margin-bottom: var(--spacing-lg);
    padding: 0 var(--spacing-sm);
}

.victory-title {
    font-size: clamp(1.8rem, 5vw, 2.5rem);
    font-weight: 800;
    margin-bottom: var(--spacing-sm);
    text-transform: uppercase;
    letter-spacing: 1px;
    animation: victoryTitleGlow 2s ease-in-out infinite;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

.victory-title.civilians-win {
    color: var(--success-color);
    text-shadow: 0 0 20px rgba(16, 185, 129, 0.5);
}

.victory-title.impostors-win {
    color: var(--danger-color);
    text-shadow: 0 0 20px rgba(239, 68, 68, 0.5);
}

@keyframes victoryTitleGlow {
    0%, 100% {
        filter: brightness(1);
    }
    50% {
        filter: brightness(1.2);
    }
}

.victory-subtitle {
    font-size: clamp(0.7rem, 2vw, 0.9rem);
    text-transform: uppercase;
    letter-spacing: 2px;
    opacity: 0.6;
    font-weight: 600;
}

.victory-info-card {
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 16px;
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.victory-detail {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.victory-detail:last-child {
    border-bottom: none;
}

.detail-label {
    font-size: clamp(0.7rem, 2vw, 0.85rem);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.7;
    font-weight: 600;
    flex-shrink: 0;
    min-width: 80px;
}

.detail-value {
    font-size: clamp(0.9rem, 2.5vw, 1.1rem);
    font-weight: 700;
    color: var(--accent-color);
    text-align: right;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    flex: 1;
}

.victory-btn {
    width: 100%;
    padding: var(--spacing-lg) !important;
    font-size: 1.1rem !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    letter-spacing: 2px;
    transition: all 0.3s ease;
}

.victory-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
}

/* Confetti Animation */
.confetti-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    z-index: 5;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background: var(--accent-color);
    top: -10px;
    opacity: 0;
    animation: confettiFall linear forwards;
}

@keyframes confettiFall {
    0% {
        opacity: 1;
        transform: translateY(0) rotate(0deg);
    }
    100% {
        opacity: 0;
        transform: translateY(100vh) rotate(720deg);
    }
}

/* ============================================
   Votación - Diseño Moderno
   ============================================ */

.voting-screen-modern {
    max-width: 600px;
    margin: 0 auto;
}

.voting-header {
    text-align: center;
    margin-bottom: var(--spacing-xl);
    animation: votingHeaderSlide 0.6s ease-out;
}

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

.voting-icon {
    font-size: 3.5rem;
    margin-bottom: var(--spacing-sm);
    animation: votingIconBounce 2s ease-in-out infinite;
}

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

.voting-header h2 {
    margin: 0;
    font-size: 2rem;
}

.voting-instructions-card {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(139, 92, 246, 0.15) 100%);
    border: 2px solid rgba(99, 102, 241, 0.3);
    border-radius: 16px;
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    animation: cardFadeIn 0.6s ease-out 0.1s both;
}

@keyframes cardFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.instruction-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.voting-instructions-card p {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--text-primary);
}

.impostors-counter-card {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    border-radius: 20px;
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
    box-shadow: 0 10px 30px rgba(239, 68, 68, 0.4);
    animation: cardFadeIn 0.6s ease-out 0.2s both;
}

.counter-label {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    color: white;
    font-size: 0.95rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: var(--spacing-sm);
    opacity: 0.9;
}

.counter-icon {
    font-size: 1.3rem;
}

.counter-value {
    color: white;
    font-size: 3rem;
    font-weight: 900;
    text-align: center;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    animation: counterPulse 2s ease-in-out infinite;
}

@keyframes counterPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.voting-list-modern {
    display: grid;
    gap: var(--spacing-md);
    margin-top: var(--spacing-lg);
}

.vote-item {
    background: var(--bg-secondary);
    border: 2px solid rgba(99, 102, 241, 0.2);
    border-radius: 16px;
    padding: var(--spacing-md);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.3s ease;
    animation: voteItemSlide 0.4s ease-out both;
    animation-delay: calc(var(--item-index, 0) * 0.05s);
}

@keyframes voteItemSlide {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.vote-item:hover {
    transform: translateX(4px);
    border-color: rgba(99, 102, 241, 0.5);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.vote-item.eliminated {
    opacity: 0.5;
    background: var(--bg-primary);
    border-color: rgba(255, 255, 255, 0.1);
}

.vote-item.eliminated:hover {
    transform: none;
    box-shadow: none;
}

.vote-item-player {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    flex: 1;
}

.player-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.vote-item.eliminated .player-avatar {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
}

.player-info {
    flex: 1;
}

.player-info strong {
    display: block;
    font-size: 1.1rem;
    margin-bottom: 2px;
}

.eliminated-badge {
    padding: 6px 14px;
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
    color: white;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background-color: var(--bg-primary);
    padding: var(--spacing-xl);
    border-radius: var(--border-radius-lg);
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: var(--shadow-lg);
    animation: scaleIn 0.3s ease;
}

.modal-content h2 {
    font-size: 2rem;
    margin-bottom: var(--spacing-md);
}

/* Adult Content Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 2999;
    display: none;
    animation: fadeIn 0.3s ease;
}

.modal-overlay.active {
    display: block;
}

.adult-modal {
    display: none;
    z-index: 3000;
}

.adult-modal.active {
    display: flex;
}

.adult-modal .modal-content {
    max-width: 500px;
    border: 3px solid var(--danger-color);
}

.adult-modal h2 {
    color: var(--danger-color);
    font-size: 1.5rem;
    margin-bottom: var(--spacing-md);
}

.modal-warning {
    font-size: 3rem;
    margin: var(--spacing-md) 0;
    animation: pulse 2s ease-in-out infinite;
}

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

.modal-text {
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: var(--spacing-md);
    color: var(--text-primary);
}

.modal-buttons {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    margin-top: var(--spacing-lg);
}

.modal-buttons .btn {
    width: 100%;
    font-size: 1rem;
    padding: var(--spacing-md);
}

/* ============================================
   Historial
   ============================================ */

.history-content {
    padding: var(--spacing-md);
}

.current-round,
.eliminated-players {
    margin-bottom: var(--spacing-xl);
}

.current-round h3,
.eliminated-players h3 {
    font-size: 1.25rem;
    margin-bottom: var(--spacing-md);
    color: var(--primary-color);
}

#current-round-data,
#eliminated-list {
    background-color: var(--bg-secondary);
    padding: var(--spacing-lg);
    border-radius: var(--border-radius);
}

.eliminated-item {
    padding: var(--spacing-md);
    background-color: var(--bg-tertiary);
    border-radius: var(--border-radius);
    margin-bottom: var(--spacing-sm);
}

.eliminated-item strong {
    color: var(--danger-color);
}

/* ============================================
   Podio de Estadísticas Totales
   ============================================ */

.total-stats-section {
    margin-bottom: var(--spacing-xl);
}

.stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
    gap: var(--spacing-md);
}

.stats-header h3 {
    font-size: 1.25rem;
    margin: 0;
    color: var(--primary-color);
    flex: 1;
}

.btn-small {
    padding: 8px 16px !important;
    font-size: 0.9rem !important;
    display: flex;
    align-items: center;
    gap: 6px;
}

.total-stats-section h3 {
    font-size: 1.25rem;
    margin-bottom: var(--spacing-md);
    color: var(--primary-color);
}

#stats-podium {
    background-color: var(--bg-secondary);
    padding: var(--spacing-lg);
    border-radius: var(--border-radius);
}

.stats-ranking-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.stats-ranking-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background-color: var(--bg-tertiary);
    border-radius: var(--border-radius);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stats-ranking-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.stats-ranking-item.top-three {
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
    border: 2px solid var(--primary-color);
}

.ranking-position {
    font-size: 1.5rem;
    font-weight: bold;
    min-width: 50px;
    text-align: center;
    color: var(--primary-color);
}

.ranking-player-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.ranking-player-name {
    font-weight: bold;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.ranking-stats-detail {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-md);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.ranking-stats-detail span {
    display: inline-flex;
    align-items: center;
}

.ranking-score {
    font-weight: bold;
    font-size: 1.2rem;
    color: var(--success-color);
    min-width: 80px;
    text-align: right;
}

/* Medallas especiales para top 3 */
.stats-ranking-item:nth-child(1) .ranking-position {
    color: #FFD700; /* Oro */
}

.stats-ranking-item:nth-child(2) .ranking-position {
    color: #C0C0C0; /* Plata */
}

.stats-ranking-item:nth-child(3) .ranking-position {
    color: #CD7F32; /* Bronce */
}

/* Responsive para pantallas pequeñas */
@media (max-width: 480px) {
    .ranking-stats-detail {
        flex-direction: column;
        gap: var(--spacing-xs);
    }

    .ranking-score {
        min-width: 60px;
        font-size: 1rem;
    }

    .ranking-position {
        min-width: 40px;
        font-size: 1.2rem;
    }
}

/* ============================================
   Responsive - Tablets y Desktop
   ============================================ */

@media (min-width: 768px) {
    .app-header h1 {
        font-size: 1.5rem;
    }

    .themes-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .nav-label {
        font-size: 0.8rem;
    }
}

/* ============================================
   Resultados Finales - Podio y Rankings
   ============================================ */

.podium-container {
    margin-bottom: var(--spacing-xl);
}

.podium-container h3 {
    text-align: center;
    font-size: 1.5rem;
    margin-bottom: var(--spacing-lg);
    color: var(--primary-color);
}

.podium {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-xl);
    padding: 0 var(--spacing-md);
}

.podium-place {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: transform 0.3s ease;
}

.podium-place:hover {
    transform: translateY(-5px);
}

.podium-rank {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: var(--spacing-sm);
    color: var(--text-inverse);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.podium-player {
    padding: var(--spacing-md);
    border-radius: var(--border-radius);
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--text-inverse);
    word-break: break-word;
}

.podium-place.first {
    order: 2;
}

.podium-place.first .podium-rank {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    width: 60px;
    height: 60px;
    font-size: 1.8rem;
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.4);
}

.podium-place.first .podium-player {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    min-width: 140px;
    min-height: 120px;
    font-size: 1.2rem;
    box-shadow: var(--shadow-lg);
}

.podium-place.second {
    order: 1;
}

.podium-place.second .podium-rank {
    background: linear-gradient(135deg, #c0c0c0, #e8e8e8);
    box-shadow: 0 4px 12px rgba(192, 192, 192, 0.4);
}

.podium-place.second .podium-player {
    background: linear-gradient(135deg, #c0c0c0, #e8e8e8);
    min-width: 120px;
    min-height: 90px;
    font-size: 1.05rem;
    box-shadow: var(--shadow-md);
}

.podium-place.third {
    order: 3;
}

.podium-place.third .podium-rank {
    background: linear-gradient(135deg, #cd7f32, #e6a157);
    box-shadow: 0 4px 12px rgba(205, 127, 50, 0.4);
}

.podium-place.third .podium-player {
    background: linear-gradient(135deg, #cd7f32, #e6a157);
    min-width: 120px;
    min-height: 70px;
    font-size: 1rem;
    box-shadow: var(--shadow-md);
}

.rankings-list {
    margin-bottom: var(--spacing-xl);
}

.rankings-list h3 {
    font-size: 1.25rem;
    margin-bottom: var(--spacing-md);
    color: var(--primary-color);
}

#rankings-content {
    background-color: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: var(--spacing-md);
}

.ranking-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background-color: var(--bg-primary);
    border-radius: var(--border-radius);
    margin-bottom: var(--spacing-sm);
    transition: transform 0.2s ease;
}

.ranking-item:hover {
    transform: translateX(5px);
}

.ranking-position {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-color);
    min-width: 40px;
    text-align: center;
}

.ranking-name {
    flex: 1;
    font-weight: 500;
    color: var(--text-primary);
}

.ranking-players-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.ranking-player-name {
    color: var(--text-primary);
    font-weight: 500;
}

/* ============================================
   Checkbox Normal - Número Aleatorio
   ============================================ */

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0;
    cursor: pointer;
    user-select: none;
    font-weight: 500;
    color: var(--text-primary);
}

.checkbox-input {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

/* ============================================
   Configuración Mejorada
   ============================================ */

.config-descobreix-logo {
    width: 120px;
    height: auto;
    margin-bottom: var(--spacing-lg);
    display: block;
}

.config-subsection {
    margin-top: var(--spacing-lg);
}

.config-subsection h4 {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
    font-weight: 600;
}

/* Selector de Idioma con Banderas */
.language-selector-custom {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.language-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background-color: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    color: var(--text-primary);
}

.language-option:hover {
    border-color: var(--primary-color);
    background-color: var(--bg-tertiary);
    transform: translateX(5px);
}

.language-option.active {
    border-color: var(--primary-color);
    background-color: var(--primary-color);
    color: var(--text-inverse);
}

.flag-icon {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    object-fit: cover;
}

/* Botones Legales */
.legal-buttons {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.btn-legal {
    width: 100%;
    text-align: left;
    justify-content: flex-start;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-legal:hover {
    transform: translateX(5px);
    background-color: var(--primary-color);
    color: var(--text-inverse);
}

/* ============================================
   Pantallas de Contenido - Pantalla Completa
   ============================================ */

.screen {
    display: none;
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: var(--nav-height);
    background-color: var(--bg-primary);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    z-index: 10;
}

.screen.active {
    display: block;
}

.screen-content {
    max-width: 800px;
    margin: 0 auto;
    padding: var(--spacing-lg) var(--spacing-md);
    min-height: calc(100vh - var(--header-height) - var(--nav-height));
}

/* ============================================
   Pantalla de Ayuda
   ============================================ */

.help-content {
    max-width: 800px;
    margin: 0 auto;
    position: relative;
}

/* Header con iconos de navegación en help */
.help-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-xl);
    padding-top: var(--spacing-md);
}

.help-icon-btn {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
}

.help-icon-btn img {
    width: 24px;
    height: 24px;
    filter: brightness(0) saturate(100%) invert(45%) sepia(84%) saturate(2633%) hue-rotate(227deg) brightness(99%) contrast(92%);
}

.help-icon-btn:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    transform: scale(1.05);
}

.help-icon-btn:hover img {
    filter: brightness(0) invert(1);
}

.help-icon-btn:active {
    transform: scale(0.95);
}

.help-content h2 {
    color: var(--primary-color);
    font-size: 1.8rem;
    margin-bottom: var(--spacing-xl);
    text-align: center;
}

.help-section {
    background-color: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    box-shadow: var(--shadow-sm);
}

.help-section h3 {
    color: var(--primary-color);
    font-size: 1.3rem;
    margin-bottom: var(--spacing-md);
}

.help-section p {
    line-height: 1.6;
    color: var(--text-primary);
    margin-bottom: var(--spacing-md);
}

.help-section ol,
.help-section ul {
    margin: var(--spacing-md) 0;
    padding-left: var(--spacing-xl);
    color: var(--text-primary);
}

.help-section li {
    margin-bottom: var(--spacing-sm);
    line-height: 1.6;
}

.help-section ol li {
    list-style-type: decimal;
}

.help-section ul li {
    list-style-type: disc;
}

/* ============================================
   Pantallas Legales
   ============================================ */

.legal-screen {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-primary);
    z-index: 1000;
    overflow-y: auto;
}

.legal-screen.active {
    display: block;
}

.legal-content {
    max-width: 800px;
    margin: 0 auto;
    padding: var(--spacing-xl) var(--spacing-md);
    padding-top: 80px;
    position: relative;
}

.close-legal-btn {
    position: fixed;
    top: 80px;
    right: var(--spacing-md);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: var(--danger-color);
    color: var(--text-inverse);
    border: none;
    font-size: 2rem;
    font-weight: 300;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
    z-index: 1001;
}

.close-legal-btn:hover {
    transform: scale(1.1) rotate(90deg);
    box-shadow: var(--shadow-lg);
}

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

.legal-content h2 {
    color: var(--primary-color);
    font-size: 1.8rem;
    margin-bottom: var(--spacing-xl);
    text-align: center;
}

.legal-text {
    line-height: 1.8;
    color: var(--text-primary);
}

.legal-text h3 {
    color: var(--primary-color);
    font-size: 1.3rem;
    margin-top: var(--spacing-xl);
    margin-bottom: var(--spacing-md);
}

.legal-text p {
    margin-bottom: var(--spacing-md);
    text-align: justify;
}

.legal-text ul {
    margin: var(--spacing-md) 0;
    padding-left: var(--spacing-xl);
}

.legal-text li {
    margin-bottom: var(--spacing-sm);
    line-height: 1.6;
}

.legal-update {
    margin-top: var(--spacing-xl);
    padding-top: var(--spacing-lg);
    border-top: 2px solid var(--border-color);
    font-style: italic;
    color: var(--text-secondary);
    text-align: center;
}

/* ============================================
   Modal de Error
   ============================================ */

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    padding: var(--spacing-xl);
    max-width: 400px;
    width: 90%;
    box-shadow: var(--shadow-lg);
    text-align: center;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.error-modal h3 {
    color: var(--danger-color);
    font-size: 1.5rem;
    margin-bottom: var(--spacing-md);
}

.error-modal p {
    color: var(--text-primary);
    line-height: 1.6;
    margin-bottom: var(--spacing-lg);
}

.error-modal .btn {
    width: 100%;
}

/* Success Modal */
.success-modal h3 {
    color: var(--success-color);
    font-size: 1.5rem;
    margin-bottom: var(--spacing-md);
}

.success-modal p {
    color: var(--text-primary);
    line-height: 1.6;
    margin-bottom: var(--spacing-lg);
}

.success-modal .btn {
    width: 100%;
}

/* Confirm Modal */
.confirm-modal h3 {
    color: var(--text-primary);
    font-size: 1.3rem;
    margin-bottom: var(--spacing-md);
    font-weight: 600;
}

.confirm-modal p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: var(--spacing-xl);
}

.modal-buttons {
    display: flex;
    gap: var(--spacing-md);
    width: 100%;
}

.modal-buttons .btn {
    flex: 1;
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

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

@media (max-width: 768px) {
    .close-legal-btn {
        top: 70px;
        right: var(--spacing-sm);
        width: 40px;
        height: 40px;
        font-size: 1.5rem;
    }

    .legal-content {
        padding-top: 60px;
    }

    .legal-text {
        text-align: left;
    }

    .legal-text p {
        text-align: left;
    }
}

/* ============================================
   Utilidades
   ============================================ */

.text-center {
    text-align: center;
}

.mt-1 { margin-top: var(--spacing-sm); }
.mt-2 { margin-top: var(--spacing-md); }
.mt-3 { margin-top: var(--spacing-lg); }

.mb-1 { margin-bottom: var(--spacing-sm); }
.mb-2 { margin-bottom: var(--spacing-md); }
.mb-3 { margin-bottom: var(--spacing-lg); }

/* ============================================
   Vote Result Modal - Estilo Fiesta
   ============================================ */

.vote-result-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    z-index: 3000;
    align-items: center;
    justify-content: center;
    animation: voteOverlayFadeIn 0.3s ease;
}

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

.vote-result-card {
    position: relative;
    background: white;
    border-radius: 32px;
    padding: var(--spacing-xl);
    max-width: 450px;
    width: 90%;
    border: 4px solid #6366f1;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.3);
    animation: voteCardBounceIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    overflow: visible;
}

@keyframes voteCardBounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3) rotate(-10deg);
    }
    50% {
        transform: scale(1.05) rotate(2deg);
    }
    70% {
        transform: scale(0.95) rotate(-1deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

.vote-result-icon {
    text-align: center;
    margin-bottom: var(--spacing-lg);
}

.icon-circle {
    width: 140px;
    height: 140px;
    margin: 0 auto;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    animation: iconPulseGlow 2s ease-in-out infinite;
    position: relative;
}

@keyframes iconPulseGlow {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
    }
}

.vote-icon-svg {
    width: 110px;
    height: 110px;
    display: block;
    animation: iconSpin 0.8s ease-out;
}

@keyframes iconSpin {
    0% {
        transform: rotate(0deg) scale(0);
    }
    60% {
        transform: rotate(360deg) scale(1.2);
    }
    100% {
        transform: rotate(360deg) scale(1);
    }
}

#vote-result-emoji {
    font-size: 4.5rem;
    display: block;
    animation: emojiSpin 0.8s ease-out;
}

@keyframes emojiSpin {
    0% {
        transform: rotate(0deg) scale(0);
    }
    60% {
        transform: rotate(360deg) scale(1.2);
    }
    100% {
        transform: rotate(360deg) scale(1);
    }
}

.vote-result-player {
    text-align: center;
    margin-bottom: var(--spacing-xl);
    padding-bottom: var(--spacing-lg);
    border-bottom: 4px solid #6366f1;
}

.player-label {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: #6b7280;
    margin-bottom: var(--spacing-sm);
    font-weight: 600;
}

.player-name {
    font-size: clamp(1rem, 3vw, 2rem);
    font-weight: 900;
    color: #1f2937;
    margin: 0;
    animation: playerNameSlide 0.6s ease-out 0.2s both;
}

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

.vote-result-role {
    text-align: center;
    animation: roleReveal 0.8s ease-out 0.4s both;
}

@keyframes roleReveal {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.role-reveal-text {
    font-size: 1.2rem;
    text-transform: uppercase;
    letter-spacing: 4px;
    color: #6b7280;
    margin-bottom: var(--spacing-md);
    font-weight: 700;
}

.role-type {
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 3px;
    padding: var(--spacing-lg) var(--spacing-xl);
    border-radius: 20px;
    margin-top: var(--spacing-md);
    position: relative;
    animation: roleTypeGlow 2s ease-in-out infinite;
}

.role-type.impostor {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    box-shadow:
        0 10px 40px rgba(239, 68, 68, 0.6),
        inset 0 0 20px rgba(255, 255, 255, 0.1);
}

.role-type.civilian {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow:
        0 10px 40px rgba(16, 185, 129, 0.6),
        inset 0 0 20px rgba(255, 255, 255, 0.1);
}

@keyframes roleTypeGlow {
    0%, 100% {
        filter: brightness(1);
        transform: scale(1);
    }
    50% {
        filter: brightness(1.15);
        transform: scale(1.02);
    }
}

/* Partículas decorativas */
.vote-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    border-radius: 32px;
}

.vote-particle {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    opacity: 0;
    animation: particleFly 3s ease-out forwards;
}

@keyframes particleFly {
    0% {
        opacity: 1;
        transform: translate(0, 0) scale(0);
    }
    50% {
        opacity: 0.8;
    }
    100% {
        opacity: 0;
        transform: translate(var(--tx), var(--ty)) scale(1);
    }
}

/* ============================================
   Ocultar navegación en home y help
   ============================================ */

/* Ocultar header y bottom-nav cuando estamos en home o help */
body.hide-navigation .app-header,
body.hide-navigation .bottom-nav {
    display: none !important;
}

/* Ajustar el body para eliminar cualquier margen */
body.hide-navigation {
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    height: 100vh !important;
}

/* Ajustar el app-container para que ocupe todo desde arriba */
body.hide-navigation .app-container {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    max-width: 600px !important;
    margin: 0 auto !important;
    height: 100vh !important;
    overflow: hidden !important;
}

/* Ajustar el padding del main-content cuando no hay navegación */
body.hide-navigation .main-content {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    height: 100vh !important;
    overflow-y: auto !important;
}

/* Asegurar que las pantallas home y help ocupen todo el espacio y permitan scroll */
body.hide-navigation #screen-home,
body.hide-navigation #screen-help {
    min-height: 100vh !important;
    height: auto !important;
    overflow-y: auto !important;
    padding: 0 !important;
    margin: 0 !important;
}
