/* ================================
   RESET Y VARIABLES
================================ */

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

:root {
    /* Colores de fondo */
    --bg-primary: #36393f;
    --bg-secondary: #2f3136;
    --bg-tertiary: #202225;
    --bg-dark: #1a1a1a;
    --bg-darker: #1f1f1f;
    --bg-light: #40444b;
    --bg-lighter: #4f545c;

    /* Colores de texto */
    --text-color: #dcddde;
    --text-muted: #b9bbbe;
    --text-light: #ccc;
    --text-dark: #555;
    --text-white: #ffffff;
    --text-black: #000000;

    /* Colores de acento */
    --accent-blue: #5865f2;
    --accent-blue-light: #7289da;
    --accent-blue-lighter: #6ab0ff;
    --options-color: #299d9f;
    --options-light: #4ea5c0;
    --mode-color: #7d0585;
    --mode-light: #cc62d3;
    --success-green: #57f287;
    --success-green-light: #4de67f;
    --success-green-bright: #00ff6a;
    --danger-red: #f04747;
    --danger-red-dark: #c0392b;
    --danger-red-bright: #ec1947;
    --danger-red-bright-hover: #ed345c;
    --warning-orange: #faa61a;
    --warning-yellow: #f39c12;
    --gold: #e1b12c;
    --gold-light: #f6e58d;
    --gold-lighter: #f8eec3;

    /* Colores gradientes */
    --gradient-dark: linear-gradient(135deg, #2c3e50, #1a1a1a);

    /* Sombras */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 10px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 20px rgba(0, 0, 0, 0.6);
    --shadow-xl: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-blue: 0 4px 10px rgba(88, 101, 242, 0.6);
    --shadow-gold: 0 0 18px rgba(255, 215, 0, 0.4);
    --shadow-gold-strong: 0 0 30px var(--warning-orange);

    /* Transiciones */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease-in-out;

    /* Bordes */
    --border-radius-sm: 4px;
    --border-radius-md: 6px;
    --border-radius-lg: 8px;
    --border-radius-xl: 10px;
    --border-radius-xxl: 12px;
    --border-radius-round: 20px;

    /* Espaciado */
    --spacing-xs: 5px;
    --spacing-sm: 10px;
    --spacing-md: 15px;
    --spacing-lg: 20px;
    --spacing-xl: 25px;
    --spacing-xxl: 30px;
}

/* ================================
   BASE Y TIPOGRAFÍA
================================ */

body {
    font-family: 'Arial', sans-serif;
    background: var(--bg-tertiary);
    min-height: 100vh;
    color: var(--text-color);
    overflow-x: hidden;
}

textarea,
.textarea {
    field-sizing: content;
}

/* ================================
   SCROLLBAR
================================ */

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

::-webkit-scrollbar-thumb {
    background-color: var(--accent-blue);
    border-radius: var(--border-radius-md);
}

::-webkit-scrollbar-track {
    background-color: var(--bg-tertiary);
}

/* ================================
   LAYOUT PRINCIPAL
================================ */

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--spacing-lg);
}

/* ================================
   HEADER
================================ */

.header {
    text-align: center;
    padding: var(--spacing-xxl) var(--spacing-lg);
    background: var(--bg-secondary);
    border-radius: var(--border-radius-xxl);
    margin-bottom: var(--spacing-xxl);
    box-shadow: var(--shadow-md);
}

.header h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    color: var(--accent-blue);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    letter-spacing: 4px;
    margin-bottom: var(--spacing-sm);
}

.header p {
    font-size: clamp(0.9rem, 2vw, 1.1rem);
    color: var(--text-color);
}

/* ================================
   BOTONES BASE
================================ */

.btn,
.mode-btn,
.tab-btn,
.action-btn,
.add-category-btn,
.add-question-btn {
    padding: clamp(8px, 2vw, 12px) clamp(15px, 3vw, 25px);
    border: none;
    border-radius: var(--border-radius-lg);
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition-normal);
    box-shadow: var(--shadow-sm);
    font-size: clamp(0.9rem, 1.5vw, 1rem);
}

.btn {
    background: var(--success-green);
    color: var(--bg-tertiary);
}

.btn:hover {
    background: var(--success-green-light);
}

.btn.danger,
.btn-danger,
.btn-final-cancel {
    background: var(--danger-red);
    color: var(--text-white);
}

.btn.danger:hover,
.btn-danger:hover,
.btn-final-cancel:hover {
    background: var(--danger-red-dark);
}

.btn-save,
.btn-final-save {
    background: var(--success-green);
    color: var(--bg-tertiary);
}

.btn-save:hover,
.btn-final-save:hover {
    background: var(--success-green-light);
}

/* ================================
   CONTROLES DE MODO
================================ */

.mode-controls-panel {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.mode-btn {
    background: var(--bg-primary);
    color: var(--text-color);
    font-size: clamp(0.9rem, 2vw, 1.1rem);
}

.mode-btn:hover {
    background: var(--bg-light);
}

.mode-btn.active {
    background: var(--accent-blue);
    color: var(--text-white);
    box-shadow: var(--shadow-blue);
}

/* ================================
   TABS / PESTAÑAS
================================ */

.tabs-container {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
    margin: var(--spacing-lg) 0;
    background: var(--bg-primary);
    padding: var(--spacing-sm);
    border-radius: var(--border-radius-lg);
}

.tab-btn {
    padding: var(--spacing-sm) var(--spacing-lg);
    background: var(--bg-secondary);
    color: var(--text-color);
}

.tab-btn:hover {
    background: var(--bg-primary);
}

.tab-btn.active {
    background: var(--options-color);
    color: var(--text-white);
    box-shadow: 0 2px 5px rgba(88, 101, 242, 0.4);
}

/* ================================
   INFORMACIÓN CONTEXTUAL
================================ */

.edit-info,
.current-round-info {
    text-align: center;
    margin-bottom: var(--spacing-md);
    padding: 0 var(--spacing-sm);
}

.edit-info {
    color: var(--text-muted);
}

.current-round-info {
    margin-top: var(--spacing-lg);
    color: var(--options-color);
    font-weight: bold;
}

/* ================================
   SCOREBOARD
================================ */

.scoreboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 270px), 1fr));
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-xxl);
}

.player-card {
    background: var(--bg-secondary);
    padding: var(--spacing-lg);
    border-radius: var(--border-radius-xxl);
    box-shadow: var(--shadow-md);
}

.player-card h3 {
    color: var(--accent-blue);
    font-size: clamp(1.1rem, 2vw, 1.3rem);
    margin-bottom: var(--spacing-sm);
    word-break: break-word;
}

.player-card .score {
    font-size: clamp(2rem, 4vw, 2.5rem);
    font-weight: bold;
    color: var(--success-green);
}

.player-card .controls {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-md);
}

.player-card button {
    padding: var(--spacing-sm);
    background: var(--bg-primary);
    color: var(--text-color);
    border: 1px solid var(--accent-blue);
    border-radius: var(--border-radius-md);
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition-normal);
}

.player-card button:hover {
    background: var(--bg-light);
    border-color: var(--success-green);
}

.team-member {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 110px;
}

.team-members-row {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 10px 0;
}

.team-member-avatar {
    width: 100px;
    height: 100px;
    margin: 10px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid;
    background: #2c2f33;
}

.team-member-avatar {
    margin-left: -10px;
}

.team-member-avatar:first-child {
    margin-left: 0;
}

/* ================================
   SELECCIÓN DE JUGADORES (EQUIPOS)
================================ */

.player-selection-grid {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
    padding: var(--spacing-xs);
}

.player-selection-item {
    display: inline-block;
    cursor: pointer;
}

.hidden-checkbox {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.player-badge {
    display: flex;
    align-items: center;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--border-radius-round);
    background-color: var(--bg-secondary);
    color: var(--text-light);
    border: 2px solid var(--text-dark);
    font-weight: bold;
    transition: var(--transition-fast);
    user-select: none;
    font-size: clamp(0.8rem, 1.5vw, 1rem);
}

.player-selection-item:hover .player-badge {
    background-color: var(--bg-lighter);
    border-color: #999;
}

.hidden-checkbox:checked+.player-badge {
    background-color: var(--player-color);
    color: var(--bg-tertiary);
    border-color: var(--player-color);
    box-shadow: 0 0 10px var(--player-color);
    transform: scale(1.05);
}

/* ================================
   DROPDOWN MENU
================================ */

.controls-panel {
    text-align: center;
    margin-bottom: var(--spacing-xl);
}

.dropdown {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.dropdown-toggle {
    padding: clamp(10px, 2vw, 12px) clamp(20px, 3vw, 25px);
    border: none;
    border-radius: var(--border-radius-lg);
    background: var(--options-color);
    color: var(--text-white);
    font-size: clamp(0.9rem, 2vw, 1.1rem);
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition-normal);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.4);
}

.dropdown-toggle:hover {
    background: var(--options-light);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    min-width: 220px;
    max-width: 90vw;
    background: var(--bg-secondary);
    border: 1px solid var(--bg-primary);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    padding: var(--spacing-sm) 0;
    margin-top: var(--spacing-sm);
    display: none;
}

.dropdown-menu.open {
    display: block;
}

.dropdown-menu button {
    width: 100%;
    text-align: left;
    padding: var(--spacing-sm) var(--spacing-lg);
    background: none;
    border: none;
    color: var(--text-color);
    font-size: clamp(0.9rem, 1.5vw, 1rem);
    cursor: pointer;
    transition: var(--transition-fast);
}

.dropdown-menu button:hover {
    background: var(--bg-primary);
    color: var(--text-white);
}

/* ================================
   TABLERO DE JUEGO
================================ */

.board {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
    gap: clamp(8px, 2vw, 15px);
    width: 100%;
    background: var(--bg-secondary);
    padding: clamp(10px, 2vw, 15px);
    border-radius: var(--border-radius-xxl);
}

.column {
    display: flex;
    flex-direction: column;
    gap: clamp(8px, 2vw, 12px);
}

.category {
    background: var(--accent-blue);
    color: var(--text-white);
    text-align: center;
    padding: clamp(10px, 2vw, 15px) var(--spacing-sm);
    font-size: clamp(1rem, 2vw, 1.2rem);
    font-weight: bold;
    border-radius: var(--border-radius-lg);
    text-transform: uppercase;
    box-shadow: var(--shadow-sm);
    word-break: break-word;
}

.cell {
    background: var(--bg-primary);
    color: var(--success-green);
    text-align: center;
    padding: clamp(15px, 3vw, 25px) var(--spacing-sm);
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: bolder;
    border-radius: var(--border-radius-lg);
    cursor: pointer;
    transition: var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.cell:hover {
    background: var(--bg-light);
    transform: scale(1.02);
}

.cell.used {
    background: var(--bg-secondary);
    color: var(--text-color);
    text-decoration: line-through;
    opacity: 0.6;
    cursor: default;
}

/* ================================
   PREGUNTA FINAL (TILE)
================================ */

.final-question-tile {
    grid-column: 1 / -1;
    width: 100%;
    height: clamp(120px, 20vw, 140px);
    background: var(--bg-darker);
    border: 3px solid #3a3a3a;
    border-radius: var(--border-radius-xl);
    margin: var(--spacing-lg) auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: var(--transition-fast);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.4);
    text-align: center;
    user-select: none;
    padding: var(--spacing-sm);
}

.final-question-tile.used {
    background: var(--bg-primary);
    border-color: var(--bg-dark);
    opacity: 0.6;
    pointer-events: none;
    cursor: default;
    transform: none;
    box-shadow: none !important;
}

.final-question-tile.used .final-title {
    text-decoration: line-through;
    color: var(--text-muted);
}

.final-question-tile.used .final-value {
    text-decoration: line-through;
    color: var(--text-muted);
}

.final-question-tile:hover {
    background: #262626;
    transform: translateY(-4px);
    box-shadow: 0 0 18px rgba(0, 0, 0, 0.6);
}

.final-title {
    font-size: clamp(16px, 3vw, 20px);
    font-weight: bold;
    color: var(--accent-blue-lighter);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.final-value {
    font-size: clamp(24px, 5vw, 32px);
    font-weight: bold;
    color: var(--success-green-bright);
    margin-top: var(--spacing-sm);
}

/* ================================
   PREGUNTA FINAL (WIDE - EN BOARD)
================================ */

.final-question-wide {
    grid-column: 1 / -1;
    background: var(--gradient-dark);
    border-radius: var(--border-radius-xxl);
    padding: clamp(15px, 3vw, 20px);
    margin-top: var(--spacing-lg);
    box-shadow: var(--shadow-gold);
    animation: glowBorder 3s infinite ease-in-out;
}

.final-question-wide.used {
    border: 5px solid var(--success-green) !important;
    box-shadow: 0 0 20px 5px rgba(39, 174, 96, 0.8),
        inset 0 0 10px 2px rgba(39, 174, 96, 0.5);
    background: #333333;
    opacity: 0.9;
}

.final-question-wide.used .final-header {
    color: var(--success-green);
    text-shadow: 0 0 10px rgba(39, 174, 96, 0.8);
}

.final-question-tile.used {
    background: #2c3e50;
    cursor: default;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.7);
    opacity: 0.7;
}

.final-question-tile.used .final-title,
.final-question-tile.used .final-value {
    color: var(--success-green) !important;
}

@keyframes glowBorder {

    0%,
    100% {
        box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
    }

    50% {
        box-shadow: 0 0 18px rgba(255, 215, 0, 0.7);
    }
}

.final-header {
    font-size: clamp(1.2rem, 3vw, 1.5rem);
    font-weight: bold;
    color: var(--gold-light);
    margin-bottom: var(--spacing-md);
    text-align: center;
}

.final-body {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    align-items: center;
}

.final-question-preview {
    font-size: clamp(1rem, 2vw, 1.2rem);
    color: var(--text-color);
    text-align: center;
    line-height: 1.6;
}

.final-meta {
    font-size: clamp(1.1rem, 2vw, 1.3rem);
    font-weight: bold;
    color: var(--success-green);
}

.final-body button {
    padding: clamp(10px, 2vw, 12px) clamp(20px, 3vw, 30px);
    background: var(--accent-blue);
    color: var(--text-white);
    border: none;
    border-radius: var(--border-radius-lg);
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition-normal);
    font-size: clamp(0.9rem, 1.5vw, 1rem);
}

.final-body button:hover:not(:disabled) {
    background: var(--accent-blue-light);
}

.final-body button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ================================
   MODALES BASE
================================ */

.modal,
.editor-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    overflow: auto;
    backdrop-filter: blur(5px);
}

.modal.active,
.editor-modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: var(--spacing-sm);
}

/* ================================
   MODAL DE PREGUNTA
================================ */

.modal-content {
    display: flex;
    gap: 25px;
    align-items: stretch;
    /* Vuelve a stretch para altura completa */
    height: 100%;
    background: var(--bg-secondary);
    margin: auto;
    padding: clamp(15px, 3vw, 30px);
    border-radius: var(--border-radius-xxl);
    width: min(1500px, 95%);
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-content h2 {
    color: var(--accent-blue);
    text-align: center;
    margin-bottom: var(--spacing-sm);
    font-size: clamp(1.3rem, 3vw, 1.8rem);
}

.modal-content .value {
    color: var(--success-green);
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: bold;
    text-align: center;
    margin-bottom: var(--spacing-lg);
}

.modal-content .question {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    font-size: clamp(1.2rem, 2.5vw, 1.5rem);
    line-height: 1.6;
    /* margin-bottom: var(--spacing-xxl); */
    padding: var(--spacing-md);
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    color: var(--text-color);
}

.modal-content .answer {
    font-size: clamp(1.5rem, 3vw, 2.2rem);
    font-weight: 900;
    color: var(--text-color);
    text-align: center;
    opacity: 0;
    transition: var(--transition-slow);
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5);
    background: var(--bg-primary);
    border-radius: var(--border-radius-xxl);
    padding: clamp(15px, 3vw, 25px) clamp(20px, 4vw, 30px);
    /* margin: var(--spacing-xxl) 0 var(--spacing-xl); */
    border: 3px solid var(--warning-orange);
    display: block;
    line-height: 1.3;
    animation: pulse-glow 2s infinite ease-in-out;
}

.modal-content .answer.show {
    opacity: 1;
    color: var(--text-white);
    background: var(--warning-orange);
    border-color: var(--text-white);
    box-shadow: var(--shadow-gold-strong);
    animation: none;
}

@keyframes pulse-glow {

    0%,
    100% {
        box-shadow: 0 0 10px rgba(250, 166, 26, 0.2);
    }

    50% {
        box-shadow: 0 0 25px rgba(250, 166, 26, 0.6);
    }
}

/* ================================
   PRESENTADORA EN MODAL - FULL HEIGHT
================================ */

.presenter-container {
    flex: 0 0 400px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100%;
    align-self: stretch;
    position: sticky;
    top: 0;
    overflow: hidden;
    z-index: 10;
}

.presenter-img {
    width: 100%;
    max-width: 380px;
    height: 100%;
    object-fit: contain;
    border-radius: 20px;
    position: relative;
    z-index: 1;
    background: linear-gradient(180deg,
            rgba(255, 255, 255, 0.98) 0%,
            rgba(255, 255, 255, 1) 100%);
    padding: 15px;
}

/* .presenter-img:hover {
    transform: scale(1.05) translateY(-8px) rotate(1deg);
    border-color: rgba(236, 72, 153, 0.5);
    box-shadow:
        0 35px 80px rgba(0, 0, 0, 0.5),
        0 0 70px rgba(236, 72, 153, 0.5),
        inset 0 2px 15px rgba(255, 255, 255, 0.6),
        inset 0 -2px 15px rgba(236, 72, 153, 0.2);
    filter:
        drop-shadow(0 15px 40px rgba(236, 72, 153, 0.4)) brightness(1.05);
} */

@keyframes slideInPresenter {
    from {
        opacity: 0;
        transform: translateX(-50px) scale(0.9);
    }

    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

.presenter-img {
    animation: slideInPresenter 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* ================================
   MODAL MAIN - CON SCROLL
================================ */

.modal-main {
    flex: 1;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: relative;
    overflow: visible;
}

/* ================================
   RESPONSIVE
================================ */

@media (max-width: 1200px) {
    .presenter-container {
        flex: 0 0 350px;
        padding: 25px;
    }

    .presenter-img {
        max-width: 320px;
    }
}

@media (max-width: 968px) {
    .modal-content {
        flex-direction: column !important;
        gap: 25px;
    }

    .presenter-container {
        position: relative;
        flex: 0 0 auto;
        min-height: auto;
        max-height: 420px;
        width: 100%;
        padding: 20px;
    }

    .presenter-img {
        height: auto;
        max-height: 380px;
        max-width: 100%;
        width: auto;
    }
}

@media (max-width: 640px) {
    .presenter-container {
        max-height: 350px;
        padding: 15px;
        border-radius: 20px;
    }

    .presenter-img {
        max-height: 320px;
        padding: 10px;
        border-radius: 15px;
    }
}

/* ================================
   BOTONES EN MODAL
================================ */

.buttons-top {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
}

/* --- ESTILOS PARA AVATAR --- */

.player-info {
    background: var(--bg-primary);
    padding: var(--spacing-md);
    border-radius: var(--border-radius-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: var(--spacing-sm);
    box-shadow: var(--shadow-md);
    border-top: 5px solid transparent;
}

.player-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--text-color);
}

.scoreboard-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 10px;
}

.scorable-header {
    display: flex;
    align-items: center;
}

.player-name {
    font-weight: bold;
    font-size: clamp(1rem, 2vw, 1.1rem);
    word-break: break-word;
}

.player-score {
    font-size: clamp(1.2rem, 3vw, 1.5rem);
    font-weight: 900;
}

.players-area {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
    gap: var(--spacing-md);
    padding-top: var(--spacing-lg);
    padding-bottom: var(--spacing-lg);
    border-top: 1px solid var(--bg-primary);
}

.player-btn-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.player-add,
.player-deduct {
    padding: var(--spacing-sm) var(--spacing-md);
    border: none;
    border-radius: var(--border-radius-md);
    font-weight: bold;
    cursor: pointer;
    transition: opacity var(--transition-fast);
    font-size: clamp(0.85rem, 1.5vw, 1rem);
}

.player-add:hover,
.player-deduct:hover {
    opacity: 0.8;
}

.player-deduct {
    background: var(--danger-red) !important;
    color: var(--text-white);
}

/* ================================
   ROULETTE
================================ */

.roulette-container {
    margin: 20px auto;
    text-align: center;
}

.roulette-wheel {
    width: 400px;
    height: 400px;
    border-radius: 50%;
    border: 6px solid #fff;
    margin: 0 auto 10px;
    position: relative;

    transition: transform 6s ease-out; /* ⬅ más tiempo, sin rebote */
    background: #2c2f33;
}

.roulette-label {
    position: absolute;
    left: 50%;
    top: 50%;
    transform-origin: center;
    font-size: 0.85rem;
    font-weight: 700;
    color: white;
    white-space: nowrap;
    pointer-events: none;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.8);
    transform-origin: 0 50%;
}

.roulette-slice {
    position: absolute;
    width: 50%;
    height: 50%;
    transform-origin: 100% 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 0.8rem;
    text-align: center;
}

.roulette-pointer {
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-top: 20px solid red;
    margin: 0 auto 10px;
}

.roulette-pointer {
    animation: pointerIdle 1.2s ease-in-out infinite;
}

.roulette-pointer.hit {
    animation: pointerHit 0.25s ease-out;
}

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

@keyframes pointerHit {
    0% { transform: rotate(0deg); }
    50% { transform: rotate(-18deg); }
    100% { transform: rotate(0deg); }
}


.roulette-btn {
    padding: 10px 18px;
    margin-top: 10px;
    font-weight: bold;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    background: var(--accent-blue);
    color: white;
}

.roulette-wrapper.hidden {
    display: none;
}

.roulette-wrapper {
    margin-top: 15px;
    animation: fadeIn 0.3s ease;
}

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

/* ================================
   OPCIONES MÚLTIPLES
================================ */

.multiple-choice-container {
    padding: clamp(15px, 3vw, 25px);
    border: 2px solid var(--accent-blue);
    border-radius: var(--border-radius-xl);
    /* margin-top: var(--spacing-lg); */
    display: none;
    background-color: var(--bg-primary);
    box-shadow: var(--shadow-md);
    text-align: center;
}

.multiple-choice-container.show {
    display: block;
}

.multiple-choice-container h3 {
    color: var(--warning-orange);
    margin-bottom: var(--spacing-md);
    font-size: clamp(1.2rem, 2.5vw, 1.5rem);
}

.multiple-choice-grid {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    align-items: center;
    width: 100%;
}

.choice-item {
    background: var(--bg-secondary);
    color: var(--text-color);
    padding: clamp(10px, 2vw, 15px);
    border-radius: var(--border-radius-lg);
    width: min(100%, 550px);
    text-align: left;
    font-size: clamp(1rem, 2vw, 1.1em);
    transition: background 0.2s, transform 0.2s;
    border: 1px solid var(--bg-lighter);
    line-height: 1.4;
    font-weight: 500;
}

.choice-label {
    background: var(--accent-blue);
    color: var(--text-white);
    padding: 4px 8px;
    border-radius: var(--border-radius-sm);
    margin-right: 10px;
    font-weight: bold;
    display: inline-block;
    min-width: 25px;
    text-align: center;
}

.choice-item.typing-active {
    opacity: 0;
    transform: translateY(10px);
}

.choice-item.typing-visible {
    opacity: 1;
    transform: translateY(0);
}

/* ================================
   SPOILER MEDIA
================================ */

.spoiler-container {
    position: relative;
    display: inline-block;
    cursor: pointer;
    margin-top: var(--spacing-sm);
    border-radius: var(--border-radius-sm);
    overflow: hidden;
    max-width: 100%;
}

.spoiler-label {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-primary);
    color: var(--text-white);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: clamp(1rem, 2vw, 1.2rem);
    font-weight: bold;
    z-index: 10;
    transition: opacity var(--transition-normal);
}

.spoiler-container.revealed .spoiler-label {
    opacity: 0;
    pointer-events: none;
}

.spoiler-content {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: var(--spacing-sm);
}

.spoiler-content-media {
    max-width: 100%;
    max-height: 60vh;
    width: auto;
    height: auto;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    display: block;
}

/* ================================
   EDITOR DE CONTENIDO
================================ */

.editor-content {
    background: var(--bg-secondary);
    padding: clamp(15px, 3vw, 30px);
    border-radius: var(--border-radius-xxl);
    width: min(1200px, 95%);
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.editor-content h2 {
    color: var(--accent-blue);
    text-align: center;
    margin-bottom: var(--spacing-lg);
    border-bottom: 2px solid var(--bg-primary);
    padding-bottom: var(--spacing-sm);
    font-size: clamp(1.3rem, 3vw, 1.8rem);
}

#categoriesEditor {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xxl);
}

/* ================================
   EDITOR DE CATEGORÍAS
================================ */

.category-editor {
    background: var(--bg-primary);
    padding: clamp(15px, 2vw, 20px);
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--accent-blue);
}

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

.category-header input[type="text"] {
    flex: 1;
    min-width: 200px;
    font-size: clamp(1.2rem, 2.5vw, 1.5rem);
    font-weight: bold;
    padding: var(--spacing-sm);
    background: var(--bg-secondary);
    color: var(--text-color);
    border: 1px solid var(--bg-primary);
    border-radius: var(--border-radius-sm);
}

.category-header button {
    background: var(--danger-red);
    color: var(--text-white);
    padding: var(--spacing-sm) var(--spacing-md);
    border: none;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: var(--transition-fast);
}

.category-header button:hover {
    background: var(--danger-red-dark);
}

/* ================================
   EDITOR DE PREGUNTAS
================================ */

.question-item {
    background: var(--bg-light);
    padding: var(--spacing-md);
    border-radius: var(--border-radius-md);
    margin-bottom: var(--spacing-md);
    border-left: 5px solid var(--accent-blue);
}

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

.question-header h4 {
    color: var(--text-color);
    font-size: clamp(1rem, 2vw, 1.1rem);
}

.question-item label {
    display: block;
    margin-top: var(--spacing-sm);
    margin-bottom: var(--spacing-xs);
    font-weight: bold;
    color: var(--success-green);
    font-size: clamp(0.9rem, 1.5vw, 1rem);
}

.question-item input[type="number"],
.question-item textarea {
    width: 100%;
    padding: var(--spacing-sm);
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--bg-primary);
    background: var(--bg-secondary);
    color: var(--text-color);
    resize: vertical;
    font-size: clamp(0.9rem, 1.5vw, 1rem);
}

/* ================================
   BOTONES DE AGREGAR
================================ */

.add-category-btn,
.add-question-btn {
    width: 100%;
    padding: clamp(10px, 2vw, 12px);
    margin-bottom: var(--spacing-md);
}

.add-category-btn {
    background: var(--accent-blue);
    color: var(--text-white);
}

.add-category-btn:hover {
    background: var(--accent-blue-light);
}

.add-question-btn {
    background: var(--bg-secondary);
    color: var(--accent-blue);
    border: 1px dashed var(--accent-blue);
}

.add-question-btn:hover {
    background: var(--bg-primary);
}

/* ================================
   ACCIONES DEL EDITOR
================================ */

.actions-list {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.action-btn {
    background: var(--mode-color);
    color: var(--text-white);
    font-size: clamp(0.9rem, 1.5vw, 1.05rem);
}

.action-btn:hover {
    background: var(--mode-light);
    transform: translateY(-2px);
}

.editor-actions,
.final-editor-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: var(--spacing-lg);
    margin-top: var(--spacing-xl);
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--bg-primary);
}

.final-editor-actions {
    justify-content: flex-end;
}

.btn-final-save,
.btn-final-cancel {
    padding: var(--spacing-sm) var(--spacing-lg);
    font-weight: bold;
    border-radius: var(--border-radius-md);
    cursor: pointer;
    border: none;
    transition: var(--transition-fast);
}

/* ================================
   SECCIÓN MULTIMEDIA
================================ */

.media-section {
    margin-top: var(--spacing-md);
    padding-top: var(--spacing-sm);
    border-top: 1px solid var(--bg-primary);
}

.media-section label {
    font-size: clamp(0.85rem, 1.5vw, 0.95rem);
}

.media-section input[type="file"] {
    width: 100%;
    padding: var(--spacing-sm);
    margin-top: var(--spacing-xs);
}

.media-preview {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-sm);
    padding: var(--spacing-sm);
    border: 1px solid var(--accent-blue);
    border-radius: var(--border-radius-sm);
}

.media-preview img,
.media-preview video,
.media-preview audio {
    max-width: 100%;
    height: auto;
    border-radius: var(--border-radius-sm);
}

.media-preview button {
    background: var(--danger-red);
    color: var(--text-white);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--border-radius-sm);
    border: none;
    cursor: pointer;
    transition: var(--transition-fast);
}

.media-preview button:hover {
    background: var(--danger-red-dark);
}

/* ================================
   EDITOR DE PREGUNTA FINAL
================================ */

.final-question-editor,
.final-question {
    margin-top: var(--spacing-xxl);
    background: var(--bg-primary);
    padding: clamp(15px, 3vw, 25px);
    border-radius: var(--border-radius-xxl);
    border: 1px solid var(--accent-blue);
    box-shadow: var(--shadow-xl);
    position: relative;
}

.final-question-editor h3,
.final-question h3 {
    color: var(--accent-blue);
    font-size: clamp(1.3rem, 3vw, 1.8rem);
    text-align: center;
    margin-bottom: var(--spacing-lg);
    letter-spacing: 1px;
}

.final-question {
    background: var(--gradient-dark);
    border: 3px solid var(--gold);
    animation: glowBorder 3s infinite ease-in-out;
}

.final-question .question-header h3 {
    font-size: clamp(1.2rem, 2.5vw, 1.5rem);
    color: var(--gold-light);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}

.final-question .question-header h3::before {
    content: "🎯";
    font-size: clamp(1.5rem, 3vw, 1.8rem);
}

.final-question label {
    color: var(--gold-lighter) !important;
}

.final-question input,
.final-question textarea {
    border: 2px solid var(--gold) !important;
    background: var(--bg-darker);
    color: var(--gold-light);
    font-weight: bold;
}

.final-question .media-section {
    border: 2px dashed var(--gold);
    background: rgba(255, 215, 0, 0.05);
}

.final-question .media-preview button {
    background-color: var(--gold) !important;
    color: var(--text-black) !important;
}

.final-editor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
    gap: clamp(15px, 3vw, 25px);
}

.final-field {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.final-field label {
    font-weight: bold;
    font-size: clamp(0.9rem, 1.5vw, 1rem);
    color: var(--success-green);
}

.final-field textarea,
.final-field input {
    background: var(--bg-secondary);
    border: 1px solid var(--bg-primary);
    padding: clamp(8px, 2vw, 12px);
    border-radius: var(--border-radius-md);
    color: var(--text-color);
    font-size: clamp(0.9rem, 1.5vw, 1rem);
    resize: vertical;
    transition: border var(--transition-fast);
}

.final-field textarea:focus,
.final-field input:focus {
    border-color: var(--accent-blue);
    outline: none;
}

/* Preview de pregunta final */
.final-preview-box {
    background: var(--bg-secondary);
    border: 1px solid var(--accent-blue);
    border-radius: var(--border-radius-lg);
    padding: clamp(15px, 2vw, 20px);
    color: var(--text-color);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
    min-height: 180px;
}

.final-preview-title {
    font-size: clamp(1rem, 2vw, 1.1rem);
    font-weight: bold;
    color: var(--warning-orange);
    margin-bottom: var(--spacing-sm);
    text-transform: uppercase;
}

.final-preview-content {
    font-size: clamp(1.1rem, 2vw, 1.3rem);
    line-height: 1.6;
    white-space: pre-wrap;
}

/* ================================
   ANIMACIONES
================================ */

.money-anim-container {
    pointer-events: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 0;
    overflow: visible;
    z-index: 9999;
}

.money-anim-item {
    position: fixed;
    top: -10vh;
    font-size: clamp(10rem, 3vw, 10rem);
    will-change: transform, opacity;
    animation: fall 2.2s linear forwards;
}

.money-anim-container.fade-out {
    opacity: 0;
    transition: opacity 0.5s;
}

@keyframes fall {
    to {
        transform: translateY(120vh) rotate(720deg);
        opacity: 0;
    }
}

/* ================================
   UTILIDADES
================================ */

.empty {
    text-align: center;
    color: var(--text-muted);
    padding: var(--spacing-lg);
    font-style: italic;
}

.point-value-display {
    font-weight: bold;
}

.modal-points {
    color: var(--warning-yellow);
}

/* ================================
   SWEETALERT2 OVERRIDE
================================ */

.swal2-container {
    z-index: 99999 !important;
}

.swal2-popup {
    font-size: clamp(0.9rem, 1.5vw, 1rem) !important;
}

/* ================================
   MÚSICA BUTTON
================================ */

#musicBtn {
    background-color: var(--danger-red-bright);
    color: var(--text-white);
    font-weight: bold;
    border-radius: var(--border-radius-lg);
    transition: var(--transition-fast);
    padding: var(--spacing-sm) var(--spacing-md);
    border: none;
    cursor: pointer;
}

#musicBtn:hover {
    background-color: var(--danger-red-bright-hover);
}

/* ================================
   RESPONSIVE - TABLETS Y MÓVILES
================================ */

@media (max-width: 1024px) {
    .header h1 {
        letter-spacing: 2px;
    }

    .board {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    }

    .modal-content,
    .editor-content {
        width: 95%;
    }
}

@media (max-width: 768px) {
    .container {
        padding: var(--spacing-sm);
    }

    .header {
        padding: var(--spacing-lg) var(--spacing-sm);
        margin-bottom: var(--spacing-lg);
    }

    .mode-controls-panel {
        flex-direction: column;
    }

    .mode-btn {
        width: 100%;
    }

    .scoreboard {
        grid-template-columns: 1fr;
    }

    .player-card .controls {
        flex-direction: row;
    }

    .board {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: var(--spacing-sm);
    }

    .category {
        font-size: 0.9rem;
        padding: var(--spacing-sm);
    }

    .cell {
        padding: var(--spacing-md) var(--spacing-xs);
        font-size: 1.5rem;
    }

    .modal-content {
        padding: var(--spacing-md);
        width: 95%;
    }

    .modal-content .question {
        font-size: 1.1rem;
    }

    .modal-content .answer {
        font-size: 1.3rem;
    }

    .players-area {
        grid-template-columns: 1fr;
    }

    .dropdown-menu {
        min-width: 180px;
    }

    .editor-content {
        width: 95%;
        padding: var(--spacing-md);
    }

    .category-header {
        flex-direction: column;
        align-items: stretch;
    }

    .category-header input[type="text"] {
        min-width: 100%;
    }

    .category-header button {
        width: 100%;
    }

    .final-editor-grid {
        grid-template-columns: 1fr;
    }

    .editor-actions {
        flex-direction: column;
    }

    .editor-actions button {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.8rem;
        letter-spacing: 1px;
    }

    .tabs-container {
        flex-direction: column;
    }

    .tab-btn {
        width: 100%;
    }

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

    .final-question-tile {
        width: 90%;
    }

    .buttons-top {
        flex-direction: column;
    }

    .buttons-top button {
        width: 100%;
    }

    .actions-list {
        flex-direction: column;
    }

    .action-btn {
        width: 100%;
    }
}

/* ================================
   LANDSCAPE MÓVIL
================================ */

@media (max-height: 600px) and (orientation: landscape) {

    .modal-content,
    .editor-content {
        max-height: 85vh;
        padding: var(--spacing-sm);
    }

    .header {
        padding: var(--spacing-md) var(--spacing-sm);
        margin-bottom: var(--spacing-md);
    }

    .header h1 {
        font-size: 2rem;
    }
}

/* ================================
   INTRO DE LA APLICACIÓN
================================ */

#introScreen {
    position: fixed;
    inset: 0;
    background: #000;
    z-index: 9999;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.intro-title {
    font-size: 4rem;
    color: white;
    text-shadow: 3px 3px 0px black;
    opacity: 0;
    animation: fadeInTitle 2s 1s forwards;
    position: relative;
    z-index: 10;
}

.curtain {
    position: absolute;
    width: 50%;
    height: 100%;
    top: 0;
    background: linear-gradient(to right,
            #b62a17 0%,
            #b62a17 6%,
            #6d0019 10%,
            #b62a17 14%,
            #b62a17 20%,
            #6d0019 24%,
            #b62a17 28%,
            #b62a17 34%,
            #6d0019 38%,
            #b62a17 42%,
            #b62a17 48%,
            #6d0019 52%,
            #b62a17 56%,
            #b62a17 62%,
            #6d0019 66%,
            #b62a17 70%,
            #b62a17 76%,
            #6d0019 80%,
            #b62a17 84%,
            #b62a17 90%,
            #6d0019 94%,
            #b62a17 98%);
}

.curtain-left {
    left: 0;
    animation: openLeft 3s 1.5s forwards;
}

.curtain-right {
    right: 0;
    animation: openRight 3s 1.5s forwards;
}

@keyframes openLeft {
    100% {
        transform: translateX(-100%);
    }
}

@keyframes openRight {
    100% {
        transform: translateX(100%);
    }
}

@keyframes fadeInTitle {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes hideIntro {
    100% {
        opacity: 0;
        pointer-events: none;
    }
}
