:root {
    --bg-dark: #0f172a;
    --accent-primary: #facc15;
    /* Electric Yellow */
    --accent-secondary: #a855f7;
    /* Vibrant Purple */
    --accent-tertiary: #ec4899;
    /* Neon Pink */
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --card-radius: 24px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    overflow-x: hidden;
    min-height: 100vh;
}

.bg-glow {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at 30% 30%, rgba(168, 85, 247, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 70% 70%, rgba(236, 72, 153, 0.15) 0%, transparent 50%);
    z-index: -1;
}

.hidden {
    display: none !important;
}

.portal-link-box {
    margin-top: 2rem;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 1.5rem;
}

.btn-more-games {
    display: inline-block;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 700;
    transition: 0.3s;
    opacity: 0.6;
}

.btn-more-games:hover {
    opacity: 1;
    color: var(--accent-secondary);
    transform: translateY(-2px);
}

.container {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.screen {
    display: none;
    flex-direction: column;
    gap: 2rem;
    animation: fadeIn 0.3s ease-out;
}

.screen.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Headers */
header {
    text-align: center;
}

.logo {
    font-size: 2.5rem;
    font-weight: 900;
}

.logo span {
    color: var(--accent-primary);
}

.subtitle {
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Config Card */
.config-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--card-radius);
    padding: 1.5rem;
    backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.setting-item label {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-muted);
}

input[type="range"] {
    accent-color: var(--accent-primary);
}

/* Mode Grid */
.mode-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.8rem;
}

.btn-mode {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    padding: 1rem 0.5rem;
    border-radius: 16px;
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.btn-mode.active {
    background: var(--accent-secondary);
    color: white;
    border-color: var(--accent-secondary);
    box-shadow: 0 5px 15px rgba(168, 85, 247, 0.3);
}

/* Players Section */
.players-section h3 {
    margin-bottom: 1rem;
}

.add-player-box {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.add-player-box input {
    flex-grow: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    padding: 1rem;
    border-radius: 12px;
    color: white;
    font-weight: 600;
}

#btn-add-player {
    width: 50px;
    background: var(--accent-secondary);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
}

.players-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.8rem;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 0.5rem;
    align-content: start;
}

.player-tag {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    padding: 0.8rem 1rem;
    border-radius: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    animation: scaleIn 0.2s ease-out;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.btn-delete {
    background: transparent;
    border: none;
    color: var(--accent-tertiary);
    font-size: 1.2rem;
    cursor: pointer;
    line-height: 1;
}

/* Buttons */
.btn {
    padding: 1.2rem;
    border-radius: 20px;
    border: none;
    font-weight: 900;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
}

.btn-primary {
    background: var(--accent-primary);
    color: #000;
    box-shadow: 0 10px 30px rgba(250, 204, 21, 0.2);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #475569;
}

.btn-secondary {
    background: var(--accent-secondary);
    color: white;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--glass-border);
    color: white;
}

.btn:active {
    transform: scale(0.95);
}

/* Pass Screen */
#screen-pass {
    text-align: center;
    justify-content: center;
    min-height: 80vh;
}

.pass-info p {
    font-size: 1.2rem;
    color: var(--text-muted);
}

.pass-info h2 {
    font-size: 3.5rem;
    font-weight: 900;
    color: var(--accent-primary);
    margin: 1rem 0;
}

.security-msg {
    font-size: 0.9rem;
    color: var(--accent-tertiary);
    background: rgba(236, 72, 153, 0.1);
    padding: 0.8rem;
    border-radius: 12px;
    margin-bottom: 2rem;
}

/* Reveal Screen */
#screen-reveal {
    justify-content: center;
    min-height: 80vh;
    text-align: center;
}

.reveal-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2rem;
}

.role-card {
    width: 100%;
    aspect-ratio: 1/1;
    max-width: 300px;
    background: var(--glass-bg);
    border: 2px dashed var(--glass-border);
    border-radius: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    -webkit-user-select: none;
}

.role-card.pressing {
    border-style: solid;
    border-color: var(--accent-primary);
    background: rgba(250, 204, 21, 0.05);
    transform: scale(1.05);
}

.role-visible {
    display: none;
}

.role-card.pressing .role-hidden {
    display: none;
}

.role-card.pressing .role-visible {
    display: block;
}

.role-hidden {
    font-size: 5rem;
}

.role-label-text {
    font-size: 0.9rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--accent-secondary);
}

#secret-word {
    font-size: 2.5rem;
    font-weight: 900;
}

.role-card.is-impostor #secret-word {
    color: var(--accent-tertiary);
}

.instruction {
    font-weight: 700;
    color: var(--text-muted);
}

.release-msg {
    font-size: 0.8rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.role-card.pressing+.release-msg {
    opacity: 1;
}

.hidden {
    display: none;
}

/* Results Screen */
.turn-order-list {
    background: var(--glass-bg);
    border-radius: var(--card-radius);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.turn-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    font-weight: 700;
}

.turn-number {
    width: 30px;
    height: 30px;
    background: var(--accent-secondary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

.footer-msg {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.6;
}

.final-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Group Management */
.group-management {
    margin-bottom: 1rem;
}

.group-actions {
    display: flex;
    gap: 0.5rem;
}

#group-select {
    flex-grow: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    color: white;
    padding: 0.8rem;
    border-radius: 12px;
    font-size: 0.9rem;
}

.btn-small {
    padding: 0.6rem 1rem;
    background: var(--accent-secondary);
    border: none;
    border-radius: 10px;
    color: white;
    font-weight: 700;
    cursor: pointer;
}

.btn-icon-danger {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #ef4444;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* Score Actions */
.score-actions {
    margin-top: 1rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 20px;
    text-align: center;
}

.winner-label {
    font-weight: 900;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 1px;
    margin-bottom: 1rem;
    color: var(--accent-primary);
}

.winner-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.btn-win {
    padding: 1rem;
    border: none;
    border-radius: 16px;
    font-weight: 800;
    color: white;
    cursor: pointer;
    transition: transform 0.2s;
}

.btn-success {
    background: #22c55e;
}

.btn-danger {
    background: #ef4444;
}

.btn-win:active {
    transform: scale(0.95);
}

.btn-ranking-link {
    background: transparent;
    border: none;
    color: var(--accent-primary);
    font-weight: 700;
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.9rem;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.modal.active {
    display: flex;
}

.modal-content {
    width: 100%;
    max-width: 400px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.btn-close {
    background: transparent;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
}

.ranking-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.score-inputs {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
}

.score-field {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.score-field input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 0.6rem;
    color: white;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    text-align: center;
}

.reward-badge {
    font-size: 0.85rem;
    color: #ff4757;
    /* Un rojo vibrante */
    font-weight: 900;
    margin-left: 0.5rem;
    animation: bounceIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes bounceIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    60% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.ranking-name-box {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-title-box {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.group-stats-badges {
    display: flex;
    gap: 0.5rem;
}

.badge-stat {
    font-size: 0.7rem;
    padding: 0.2rem 0.6rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    font-weight: 700;
    color: var(--text-muted);
}

.ranking-header {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    font-weight: 900;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid var(--glass-border);
    margin-bottom: 0.5rem;
}

.ranking-cols {
    display: flex;
    gap: 1rem;
}

.ranking-item {
    display: flex;
    justify-content: space-between;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.ranking-data {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.ranking-pts {
    color: var(--accent-primary);
    width: 30px;
    text-align: right;
}

.ranking-vic {
    color: var(--accent-secondary);
    width: 30px;
    text-align: right;
}

/* Inline Ranking Styles */
.inline-ranking {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 1rem;
    margin-top: 1rem;
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.inline-ranking .ranking-header {
    margin-bottom: 1rem;
}

.inline-ranking .ranking-item {
    background: rgba(255, 255, 255, 0.03);
    padding: 0.8rem;
}

/* Setup Ranking (Home) Styles */
.setup-ranking {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    border: 1px dashed var(--glass-border);
}

.ranking-list.compact {
    max-height: 150px;
    overflow-y: auto;
    gap: 0.2rem;
}

.ranking-list.compact .ranking-item {
    padding: 0.5rem 0.8rem;
    font-size: 0.85rem;
    background: transparent;
    border-radius: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 0;
}

.btn-text-danger {
    background: transparent;
    border: none;
    color: var(--accent-danger);
    font-family: 'Outfit', sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: 0.8rem;
    padding: 0.5rem;
    width: 100%;
    text-align: center;
    opacity: 0.7;
    transition: 0.3s;
}

.btn-text-danger:hover {
    opacity: 1;
    text-decoration: underline;
}

.ranking-divider {
    border: none;
    border-top: 1px solid var(--glass-border);
    margin: 1.5rem 0;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 10px;
}