/* =========================================
   VARIABLES Y CONFIGURACIÓN CORE
   ========================================= */
:root {
    --bg-dark: #0f172a;
    --bg-darker: #020617;
    --accent-blue: #38bdf8;
    --accent-pink: #f43f5e;
    --accent-green: #10b981;
    --accent-amber: #f59e0b;

    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-shimmer: rgba(255, 255, 255, 0.12);

    --font-main: 'Inter', system-ui, -apple-system, sans-serif;
    --transition-smooth: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

/* Reset y Base */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

body {
    background-color: var(--bg-dark);
    color: #f8fafc;
    font-family: var(--font-main);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    display: flex;
    justify-content: center;
}

/* Fondo con Gradiente Dinámico */
.bg-glow {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 10% 10%, rgba(56, 189, 248, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 90% 90%, rgba(244, 63, 94, 0.05) 0%, transparent 50%),
        var(--bg-dark);
    z-index: -1;
}

/* =========================================
   SISTEMA DE PANTALLAS (SPA)
   ========================================= */
#app-container {
    width: 100%;
    max-width: 500px;
    /* Limite para tablets, perfecto en móvil */
    height: 100%;
    position: relative;
}

.screen {
    position: absolute;
    inset: 0;
    display: none;
    flex-direction: column;
    padding: 24px;
    background: transparent;
    z-index: 10;
}

.screen.active {
    display: flex;
    animation: screenEnter 0.6s var(--transition-smooth);
}

@keyframes screenEnter {
    from {
        opacity: 0;
        transform: scale(1.05);
        filter: blur(10px);
    }

    to {
        opacity: 1;
        transform: scale(1);
        filter: blur(0);
    }
}

/* =========================================
   TIPOGRAFÍA Y LOGO
   ========================================= */
.hero-section {
    margin-top: 15vh;
    text-align: center;
}

.logo-badge {
    display: inline-block;
    padding: 4px 12px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 100px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 1rem;
    color: var(--accent-blue);
}

.logo-text {
    font-size: 4rem;
    font-weight: 900;
    line-height: 0.9;
    letter-spacing: -3px;
    margin-bottom: 0.5rem;
}

.accent-text {
    color: var(--accent-blue);
    background: linear-gradient(to right, var(--accent-blue), #60a5fa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 10px rgba(56, 189, 248, 0.3));
}

.tagline {
    color: #94a3b8;
    font-size: 1.1rem;
}

/* =========================================
   BOTONES PREMIUM
   ========================================= */
.actions-stack {
    margin-top: auto;
    margin-bottom: 10vh;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.btn-main {
    position: relative;
    border: none;
    padding: 18px;
    border-radius: 20px;
    font-size: 1.1rem;
    font-weight: 700;
    color: white;
    cursor: pointer;
    overflow: hidden;
    transition: var(--transition-smooth);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
}

.btn-main.primary {
    background: linear-gradient(135deg, var(--accent-blue) 0%, #0284c7 100%);
    box-shadow: 0 10px 30px -10px rgba(56, 189, 248, 0.5);
    border: none;
}

.btn-main.accent {
    background: linear-gradient(135deg, var(--accent-green) 0%, #059669 100%);
    box-shadow: 0 10px 30px -10px rgba(16, 185, 129, 0.5);
    border: none;
}

.btn-main.danger {
    background: linear-gradient(135deg, var(--accent-pink) 0%, #be123c 100%);
    box-shadow: 0 10px 30px -10px rgba(244, 63, 94, 0.5);
    border: none;
}

.btn-main:active {
    transform: scale(0.96);
}

/* =========================================
   REGISTRO Y CÁMARA
   ========================================= */
.camera-container {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    overflow: hidden;
    /* <--- AÑADE ESTA LÍNEA */
    background: #000;
    position: relative;
    border: 4px solid var(--accent-blue);
    margin-bottom: 20px;
}

.camera-wrapper {
    margin: 2rem 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.camera-ring {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    position: relative;
    border: 2px solid var(--glass-border);
    padding: 8px;
    background: var(--bg-darker);
}

#camera-feed,
#photo-preview {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.btn-shutter {
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: white;
    color: black;
    border: none;
    font-size: 1.2rem;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    font-size: 0.8rem;
    color: #64748b;
    margin-bottom: 8px;
    margin-left: 4px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

input {
    width: 100%;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 16px;
    border-radius: 16px;
    color: white;
    font-size: 1.1rem;
    transition: var(--transition-smooth);
}

input:focus {
    outline: none;
    border-color: var(--accent-blue);
    background: rgba(255, 255, 255, 0.06);
}

/* =========================================
   LOBBY Y GRIDS MODERNO
   ========================================= */
.lobby-info-card {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 24px;
    text-align: center;
    margin-bottom: 30px;
}

#lobby-code {
    font-size: 3.5rem;
    font-weight: 900;
    letter-spacing: 8px;
    color: var(--accent-blue);
    margin: 8px 0;
}

.players-grid-modern {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.player-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.player-card img {
    width: 70px;
    height: 70px;
    border-radius: 22px;
    object-fit: cover;
    border: 2px solid var(--glass-border);
}

.player-card .name {
    font-size: 0.8rem;
    font-weight: 600;
}

/* =========================================
   EL SISTEMA DE PERSIANA (SHUTTER)
   ========================================= */
.blind-system {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 80vh;
    z-index: 1000;
    transform: translateY(82%);
    /* Solo asoma el asa */
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Al abrir se desliza hacia arriba */
.blind-system.open {
    transform: translateY(18%);
}

.blind-surface {
    height: 100%;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(40px) saturate(180%);
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 40px 40px 0 0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 -20px 50px rgba(0, 0, 0, 0.5);
}

.grab-handle {
    width: 60px;
    height: 5px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 100px;
    margin-bottom: 40px;
}

.blind-idle-content i {
    font-size: 3rem;
    color: var(--accent-blue);
    opacity: 0.5;
    margin-bottom: 1rem;
    display: block;
}

.secret-word {
    font-size: 3rem;
    font-weight: 900;
    color: var(--accent-blue);
    text-align: center;
    margin: 20px 0;
}

/* =========================================
   CONFIGURACIÓN HOST (TOGGLES)
   ========================================= */
.config-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--glass-bg);
    padding: 16px;
    border-radius: 20px;
    margin-bottom: 24px;
}

.config-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: #334155;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--accent-blue);
}

input:checked+.slider:before {
    transform: translateX(22px);
}

/* =========================================
   MISC & UTILS
   ========================================= */
.pulse {
    animation: pulseGlow 2s infinite;
}

@keyframes pulseGlow {
    0% {
        box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.4);
    }

    70% {
        box-shadow: 0 0 0 15px rgba(56, 189, 248, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(56, 189, 248, 0);
    }
}

#toast-container {
    position: fixed;
    top: 30px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 9999;
}

.toast {
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    padding: 12px 24px;
    border-radius: 100px;
    font-size: 0.9rem;
    margin-bottom: 10px;
    border: 1px solid var(--glass-border);
    animation: toastEnter 0.3s ease-out;
}

@keyframes toastEnter {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========================================
   UTILIDADES FALTANTES
   ========================================= */
.hidden {
    display: none !important;
}

.screen-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    padding-top: 10px;
}

/* =========================================
   CONFIGURACIÓN HOST (MEJORADA)
   ========================================= */
.config-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
}

.config-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.impostor-selector {
    display: flex;
    gap: 8px;
    background: rgba(0, 0, 0, 0.2);
    padding: 4px;
    border-radius: 12px;
}

.selector-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
}

.selector-btn.active {
    background: var(--accent-blue);
    color: white;
    box-shadow: 0 2px 8px rgba(56, 189, 248, 0.4);
}

.selector-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* =========================================
   GAME SCREEN FIXES
   ========================================= */
.game-header-bar {
    display: flex;
    justify-content: center;
    margin-top: 40px;
}

.current-turn-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    padding: 16px 32px;
    border-radius: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.turn-avatar {
    width: 120px;
    /* Reduced to fix huge image issue */
    height: 120px;
    border-radius: 50%;
    overflow: hidden;
    border: 4px solid var(--accent-blue);
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.3);
}

.turn-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.turn-text {
    text-align: center;
}

.turn-text .label {
    display: block;
    font-size: 0.75rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.turn-text .name {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
}