@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;600;700;900&family=Teko:wght@500;600;700&display=swap');

:root {
    --arg-blue: #38b6ff;
    --bg-dark: #050507;
    --danger: #ff3b3b;
    --success: #00ff88;
    --warning: #ffb700;
    --glass-bg: rgba(20, 20, 25, 0.8);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shine: rgba(255, 255, 255, 0.05);
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Montserrat', sans-serif;
    background-color: var(--bg-dark);
    background-image:
        radial-gradient(circle at 15% 50%, rgba(56, 182, 255, 0.08) 0%, transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(255, 59, 59, 0.08) 0%, transparent 25%);
    color: #fff;
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
    user-select: none;
    margin: 0;
    padding: 0;
}

.font-teko {
    font-family: 'Teko', sans-serif;
}

/* Animations & Screen Logic */
.screen {
    opacity: 0;
    pointer-events: none;
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    transform: scale(0.95) translateY(20px);
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    flex-direction: column;
}

.screen.active {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1) translateY(0);
    position: relative;
    z-index: 10;
}

/* Glassmorphism */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border: 1px solid var(--glass-border);
    box-shadow:
        0 20px 50px rgba(0, 0, 0, 0.5),
        inset 0 0 0 1px var(--glass-shine);
}

.glass-panel {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 1rem;
}

/* UI Elements */
.menu-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 0.2s;
    gap: 0.75rem;
    min-height: 72px;
}

.menu-row:last-child {
    border-bottom: none;
}

.menu-row:active {
    background: rgba(255, 255, 255, 0.05);
}

.menu-row > div:first-child {
    flex: 1;
    min-width: 0;
}

.menu-row select {
    flex-shrink: 0;
    min-width: 60px;
    padding: 0.5rem;
}

/* Checkboxes */
.pack-checkbox {
    width: 24px;
    height: 24px;
    border-radius: 8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    appearance: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    background: rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.pack-checkbox:checked {
    background: var(--arg-blue);
    border-color: var(--arg-blue);
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(56, 182, 255, 0.4);
}

.pack-checkbox:checked::after {
    content: '✓';
    position: absolute;
    color: #000;
    font-size: 16px;
    font-weight: 900;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

/* Inputs & Selects */
select {
    background: transparent !important;
    color: var(--arg-blue) !important;
    font-weight: 800;
    border: none !important;
    appearance: none;
    text-align: right;
    font-size: 1rem;
    cursor: pointer;
}

input[type="text"]::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

/* Scrollbar */
.custom-scroll::-webkit-scrollbar {
    width: 4px;
}

.custom-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.custom-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

/* Utilities */
.text-glow {
    text-shadow: 0 0 20px rgba(56, 182, 255, 0.5);
}

.danger-glow {
    text-shadow: 0 0 20px rgba(255, 59, 59, 0.5);
}

.btn-primary {
    background: white;
    color: black;
    font-family: 'Teko', sans-serif;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.05em;
    transition: all 0.2s;
    box-shadow: 0 5px 20px rgba(255, 255, 255, 0.15);
}

.btn-primary:active {
    transform: scale(0.96);
    box-shadow: 0 2px 10px rgba(255, 255, 255, 0.1);
}

/* Animations */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes pulse-red {

    0%,
    100% {
        box-shadow: 0 0 0 rgba(255, 59, 59, 0);
    }

    50% {
        box-shadow: 0 0 20px rgba(255, 59, 59, 0.15);
    }
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

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

/* Asegurar que los íconos sean visibles */
i[data-lucide] {
    flex-shrink: 0;
    display: inline-block;
}

/* Mobile Changes */
@media (max-width: 640px) {
    body {
        padding: 0.5rem;
        overflow: hidden !important;
        height: 100dvh !important;
    }

    main {
        max-width: 100% !important;
        height: calc(100dvh - 1rem) !important;
        max-height: calc(100dvh - 1rem) !important;
        position: relative !important;
        overflow: hidden !important;
    }

    .screen {
        border-radius: 1.5rem !important;
        overflow: hidden !important;
        height: 100% !important;
        max-height: calc(100dvh - 1rem) !important;
    }

    .screen.active {
        position: relative !important;
    }

    /* Header más compacto */
    .screen .p-10 {
        padding: 1.25rem !important;
        padding-bottom: 0.75rem !important;
    }

    .screen .pb-6 {
        padding-bottom: 0.75rem !important;
    }

    /* Títulos más pequeños en móvil */
    h1.text-6xl,
    h1.md\:text-8xl {
        font-size: 2.5rem !important;
        line-height: 1.1 !important;
    }

    h2.text-6xl,
    h2.md\:text-8xl,
    h2.md\:text-7xl {
        font-size: 3rem !important;
        word-wrap: break-word !important;
        line-height: 1.1 !important;
    }

    h2.text-7xl,
    h2.md\:text-9xl {
        font-size: 3.5rem !important;
        word-wrap: break-word !important;
        line-height: 1.1 !important;
    }

    h2, h3 {
        max-width: 100% !important;
        overflow-wrap: break-word !important;
        hyphens: auto !important;
    }

    /* Contenedor de scroll con más espacio - SOLO el contenedor interno debe hacer scroll */
    .flex-1.overflow-y-auto.custom-scroll {
        overflow-y: auto !important;
        height: auto !important;
        max-height: 100% !important;
        padding-left: 1rem !important;
        padding-right: 1rem !important;
        padding-bottom: 1.5rem !important;
        -webkit-overflow-scrolling: touch !important;
    }

    /* Espaciado adicional al final para que el botón no quede tapado */
    .flex-1.overflow-y-auto.custom-scroll > *:last-child {
        margin-bottom: 2rem !important;
    }

    /* Asegurar que el botón de iniciar misión se vea completo */
    .space-y-6 button:last-child,
    button.text-4xl {
        font-size: 1.25rem !important;
        padding: 1rem 1.25rem !important;
        line-height: 1.3 !important;
    }

    /* Input de nombre más compacto */
    #name-input {
        padding: 0.875rem !important;
        padding-right: 3.5rem !important;
        font-size: 0.9rem !important;
    }

    #name-input + button {
        right: 0.5rem !important;
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    /* Tags más pequeñas */
    #tags-container {
        gap: 0.5rem !important;
        min-height: 32px !important;
    }

    /* Glass panels más espaciados */
    .glass-panel {
        border-radius: 1rem !important;
        margin-bottom: 1rem !important;
    }

    /* Headers de paneles */
    .glass-panel > div:first-child {
        padding: 0.75rem 1rem !important;
    }

    /* Menu rows mejorados para móvil */
    .menu-row {
        padding: 1rem 0.875rem !important;
        min-height: 68px !important;
        gap: 0.5rem !important;
    }

    /* Iconos de roles más pequeños */
    .menu-row .w-10.h-10 {
        width: 2.25rem !important;
        height: 2.25rem !important;
        flex-shrink: 0;
    }

    .menu-row .w-5.h-5 {
        width: 1.125rem !important;
        height: 1.125rem !important;
    }

    .menu-row .w-4.h-4 {
        width: 1rem !important;
        height: 1rem !important;
    }

    /* Textos en menu rows */
    .menu-row .text-sm {
        font-size: 0.8rem !important;
    }

    .menu-row .text-\[10px\] {
        font-size: 0.625rem !important;
    }

    /* Selects más legibles */
    .menu-row select {
        font-size: 0.875rem !important;
        min-width: 50px !important;
        padding: 0.25rem 0.5rem !important;
    }

    /* Checkboxes de packs */
    .pack-checkbox {
        width: 20px !important;
        height: 20px !important;
        flex-shrink: 0;
    }

    .pack-checkbox:checked::after {
        font-size: 14px !important;
    }

    /* Botones principales */
    button.py-6 {
        padding: 1rem 1.5rem !important;
        min-height: 56px !important;
        font-size: 1.25rem !important;
        line-height: 1.3 !important;
        white-space: nowrap !important;
    }

    .rounded-3xl {
        border-radius: 1.25rem !important;
    }

    /* Pantalla de roles */
    #screen-roles .flex-1 {
        padding: 1rem !important;
    }

    #screen-roles .w-64.h-64 {
        width: 12rem !important;
        height: 12rem !important;
    }

    #screen-roles .w-24.h-24 {
        width: 5rem !important;
        height: 5rem !important;
    }

    /* Timer de debate */
    #debate-timer {
        font-size: 4rem !important;
    }

    .aspect-square {
        max-width: 280px !important;
    }

    /* Pantalla de votación */
    #screen-secret-vote .p-8 {
        padding: 1.5rem !important;
    }

    #voter-options {
        gap: 0.75rem !important;
    }

    #voter-options button {
        font-size: 0.9rem !important;
        padding: 1rem !important;
        word-wrap: break-word !important;
        white-space: normal !important;
        text-align: center !important;
    }

    /* Pantalla final */
    #screen-end .p-8 {
        padding: 1.5rem !important;
    }

    #screen-end .pt-8 {
        padding-top: 1.5rem !important;
    }

    #screen-end button {
        padding: 1rem 1.5rem !important;
        font-size: 0.875rem !important;
    }

    /* Loading overlay */
    #loading-overlay .w-24.h-24 {
        width: 5rem !important;
        height: 5rem !important;
    }

    #loading-overlay p {
        font-size: 2rem !important;
        padding: 0 1rem;
    }

    /* Kill overlay */
    #kill-overlay h2 {
        font-size: 3.5rem !important;
        line-height: 1.1 !important;
    }

    #kill-overlay p {
        font-size: 0.875rem !important;
        letter-spacing: 0.2em !important;
        margin-bottom: 2rem !important;
    }

    #kill-overlay button {
        padding: 0.875rem 2rem !important;
        font-size: 0.875rem !important;
        min-width: 200px !important;
        white-space: nowrap !important;
    }

    #kill-overlay .p-8 {
        padding: 2rem 1.5rem !important;
    }

    /* Espaciado entre secciones */
    .space-y-6 > * + * {
        margin-top: 1rem !important;
    }

    .space-y-4 > * + * {
        margin-top: 0.75rem !important;
    }

    /* Mejorar área táctil de botones */
    button {
        min-height: 48px !important;
        position: relative;
        z-index: 1;
        padding: 0.875rem 1rem !important;
        font-size: inherit !important;
    }

    button span {
        display: block;
        width: 100%;
    }

    /* Input container */
    .relative.group {
        display: flex;
        align-items: stretch;
    }

    /* Asegurar que todo sea scrolleable */
    body {
        overscroll-behavior: none !important;
    }

    main {
        overflow: hidden !important;
    }

    .custom-scroll {
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        overscroll-behavior: contain !important;
    }

    /* Pantallas de roles y debate que NO deben scrollear */
    #screen-roles,
    #screen-debate {
        overflow: hidden !important;
    }

    #screen-roles > *,
    #screen-debate > * {
        overflow: visible !important;
    }

    /* Role result screen */
    #role-result .p-8 {
        padding: 1.5rem !important;
    }

    #role-result h3 {
        font-size: 3rem !important;
        line-height: 1.1 !important;
    }

    #role-result #res-word {
        font-size: 1.5rem !important;
        word-wrap: break-word !important;
        word-break: break-word !important;
        hyphens: auto !important;
        overflow-wrap: break-word !important;
        line-height: 1.2 !important;
    }

    #role-box {
        padding: 1.25rem !important;
        overflow: hidden !important;
    }

    #role-box p {
        max-width: 100% !important;
        overflow-wrap: break-word !important;
    }

    #role-result button {
        padding: 1rem 1.5rem !important;
        font-size: 0.875rem !important;
        letter-spacing: 0.1em !important;
    }

    /* Texto más pequeño en general */
    .text-xs {
        font-size: 0.65rem !important;
    }

    .text-sm {
        font-size: 0.8rem !important;
    }

    /* Ajustes finales de padding */
    .px-8 {
        padding-left: 1.25rem !important;
        padding-right: 1.25rem !important;
    }

    .py-8 {
        padding-top: 1.5rem !important;
        padding-bottom: 1.5rem !important;
    }

    .p-6 {
        padding: 1.25rem !important;
    }

    .mb-8 {
        margin-bottom: 1.5rem !important;
    }

    .mb-10 {
        margin-bottom: 2rem !important;
    }

    .mb-12 {
        margin-bottom: 2.5rem !important;
    }

    
}