﻿* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

:root {
    --bg-dark: #0a0d24;
    --bg-mid: #121b46;
    --panel-bg: rgba(8, 14, 38, 0.86);
    --panel-soft: #172452;
    --text-main: #f3f8ff;
    --text-soft: #b7c8f3;
    --brand-red: #ff2f46;
    --brand-red-dark: #d91d33;
    --brand-blue: #3ab5ff;
    --brand-blue-dark: #1f82d8;
    --danger: #ff4a58;
}

body {
    background: radial-gradient(circle at 10% 10%, #1b2d73 0%, var(--bg-dark) 55%),
        linear-gradient(150deg, var(--bg-mid) 0%, var(--bg-dark) 100%);
    color: var(--text-main);
    min-height: 100vh;
    padding: 20px;
}

.logo-bar {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.game-logo {
    width: 100%;
    max-width: 520px;
    height: auto;
    display: block;
    user-select: none;
    filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.35));
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background-color: var(--panel-bg);
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 12px 34px rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(58, 181, 255, 0.25);
}

h2 {
    margin-bottom: 20px;
    color: var(--brand-blue);
}

h3 {
    margin-bottom: 15px;
    color: #9dd6ff;
}

.screen {
    display: none;
    animation: fadeIn 0.5s ease;
}

.active {
    display: block;
}

.btn {
    background-color: var(--brand-blue);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 50px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.3s ease;
    display: inline-block;
    margin: 10px 5px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

.btn:hover {
    background-color: var(--brand-blue-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.3);
}

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

.btn-danger:hover {
    background-color: #dd3648;
}

.btn-success {
    background-color: var(--brand-red);
}

.btn-success:hover {
    background-color: var(--brand-red-dark);
}

.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: var(--text-soft);
}

input,
select {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: 2px solid #283666;
    background-color: #111a3f;
    color: var(--text-main);
    font-size: 16px;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--brand-blue);
}

.intro-text {
    font-size: 18px;
    color: #fbd4db;
    margin-bottom: 20px;
    text-align: center;
}

.menu-actions,
.step-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.rules-box {
    background-color: var(--panel-soft);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}

.rules-box p {
    margin-bottom: 10px;
    line-height: 1.5;
}

.rules-box p:last-child {
    margin-bottom: 0;
}

.player-list {
    background-color: var(--panel-soft);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 20px;
    max-height: 200px;
    overflow-y: auto;
}

.player-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #253560;
}

.player-item:last-child {
    border-bottom: none;
}

.category-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.category-option {
    flex: 1 1 calc(33.333% - 10px);
    min-width: 150px;
    background-color: #1b2958;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.category-option:hover {
    background-color: #213373;
    transform: scale(1.05);
}

.category-option.selected {
    background-color: var(--brand-red);
    box-shadow: 0 0 0 3px #9f1a2a;
}

.player-word {
    text-align: center;
    padding: 40px;
    background-color: var(--panel-soft);
    border-radius: 15px;
    margin: 30px 0;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.player-name {
    font-size: 24px;
    color: #ff9aa6;
    margin-bottom: 15px;
}

.word {
    font-size: 42px;
    font-weight: bold;
    color: #9edbff;
    margin: 20px 0;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.impostor-label {
    color: var(--brand-red);
    font-size: 28px;
    font-weight: bold;
    margin-top: 15px;
    text-transform: uppercase;
}

.custom-words-list {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 15px;
    max-height: 200px;
    overflow-y: auto;
    margin-top: 10px;
}

.custom-word-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

.custom-word-item:last-child {
    border-bottom: none;
}

.custom-word-item .word-pair {
    display: flex;
    gap: 15px;
    align-items: center;
}

.custom-word-item .word-main {
    font-weight: bold;
    color: #9edbff;
}

.custom-word-item .word-close {
    color: #ff9800;
    font-size: 14px;
}

.custom-word-item .word-close::before {
    content: '↔ ';
}

.saved-categories-list {
    margin-top: 15px;
}

.saved-category-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background-color: rgba(58, 181, 255, 0.1);
    border: 1px solid rgba(58, 181, 255, 0.3);
    border-radius: 8px;
    margin-bottom: 10px;
}

.saved-category-item:hover {
    background-color: rgba(58, 181, 255, 0.2);
}

.saved-category-item .category-name {
    font-weight: bold;
    color: var(--text-main);
}

.saved-category-item .word-count {
    font-size: 12px;
    color: var(--text-soft);
    margin-left: 10px;
}

.saved-category-item .category-actions {
    display: flex;
    gap: 8px;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
    margin: 0;
}

.close-word-label {
    color: #ff9800;
    font-size: 22px;
    font-weight: bold;
    margin-top: 15px;
    text-transform: uppercase;
}

.order-list {
    background-color: var(--panel-soft);
    border-radius: 10px;
    padding: 20px;
    margin: 20px 0;
}

.order-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid #253560;
    font-size: 18px;
}

.order-item:last-child {
    border-bottom: none;
}

.order-number {
    background-color: var(--brand-blue);
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-right: 15px;
    font-weight: bold;
    font-size: 16px;
}

.hidden-message {
    text-align: center;
    padding: 60px 20px;
    background-color: var(--panel-soft);
    border-radius: 15px;
    margin: 30px 0;
}

.hidden-message p {
    font-size: 20px;
    margin-bottom: 20px;
    color: #fbd4db;
}

.btn-info-small {
    background-color: #3ab5ff;
    color: white;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.btn-info-small:hover {
    background-color: #1f82d8;
    transform: scale(1.1);
}

/* Modal de información */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: var(--panel-bg);
    border: 1px solid rgba(58, 181, 255, 0.5);
    border-radius: 15px;
    padding: 25px;
    max-width: 500px;
    width: 90%;
    position: relative;
    animation: fadeIn 0.3s ease;
}

.modal-close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    right: 15px;
    top: 10px;
}

.modal-close:hover {
    color: #fff;
}

.modal-body {
    margin-top: 15px;
    line-height: 1.6;
    color: var(--text-soft);
}

.modal-body strong {
    color: var(--text-main);
}

.modal-body ul {
    margin-left: 20px;
    margin-top: 10px;
}

.modal-body li {
    margin-bottom: 8px;
}

/* Modal de categorías para móviles */
.mobile-category-modal .mobile-modal-content {
    max-width: 95%;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 15px;
}

.mobile-category-content {
    max-height: calc(90vh - 80px);
    overflow-y: auto;
}

/* En desktop, ocultar el botón de abrir modal móvil */
@media (min-width: 769px) {
    .mobile-only {
        display: none !important;
    }
}

/* En móviles, ajustar el modal */
@media (max-width: 768px) {
    .mobile-category-modal .mobile-modal-content {
        margin: 10px;
        padding: 15px;
        max-height: 95vh;
    }

    .mobile-category-content {
        max-height: calc(95vh - 70px);
    }

    /* Ocultar solo el contenido desktop en móviles, no el botón trigger */
    .desktop-category-content {
        display: none !important;
    }

    /* Mostrar botón para abrir modal en móviles */
    .mobile-category-trigger {
        display: block !important;
        margin: 15px 0;
        text-align: center;
    }

    /* Asegurar que customCategorySection sea visible cuando se necesite */
    #customCategorySection {
        display: block !important;
    }
}

/* Por defecto, ocultar el botón de trigger en desktop */
.mobile-category-trigger {
    display: none;
}

/* Botón para abrir categorías en móviles */
.btn-manage-categories {
    background-color: #3a5a9c;
    color: white;
    border: 2px dashed rgba(58, 181, 255, 0.5);
    padding: 15px 30px;
    font-size: 16px;
    width: 100%;
    max-width: 300px;
}

.btn-manage-categories:hover {
    background-color: #4a6aac;
    border-color: var(--brand-blue);
}

/* Ajustes para inputs en móvil */
@media (max-width: 768px) {
    #mobileNewWordNormal,
    #mobileNewWordClose {
        font-size: 16px; /* Prevenir zoom en iOS */
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    body {
        padding: 16px;
    }

    .logo-bar {
        margin-bottom: 16px;
    }

    .game-logo {
        max-width: 420px;
    }

    .container {
        padding: 20px;
    }

    .word {
        font-size: 32px;
    }

    .category-option {
        flex: 1 1 100%;
    }

    .menu-actions,
    .step-actions {
        flex-direction: column;
    }

    .menu-actions .btn,
    .step-actions .btn {
        width: 100%;
        margin: 5px 0;
    }
}
