:root {
    --bg-dark: #064e3b;
    --accent-primary: #bef264;
    --accent-secondary: #059669;
    --accent-tertiary: #fbbf24;
    --text-main: #f8fafc;
    --text-muted: #a7f3d0;
    --glass-bg: rgba(6, 78, 59, 0.8);
    --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(190, 242, 100, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 70% 70%, rgba(5, 150, 105, 0.2) 0%, transparent 50%);
    z-index: -1;
    pointer-events: none;
}

.container {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    min-height: 100vh;
}

.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);
    }
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

.logo {
    font-size: 2.5rem;
    font-weight: 900;
}

.logo span {
    color: var(--accent-primary);
}

input[type="text"],
input[type="number"],
select {
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid var(--glass-border);
    border-radius: 14px;
    padding: 0.8rem 1.2rem;
    font-size: 1rem;
    font-weight: 700;
    color: white;
    width: 100%;
    flex-grow: 1;
    min-width: 0;
    outline: none;
    transition: all 0.2s ease;
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus {
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--accent-primary);
    box-shadow: 0 0 15px rgba(190, 242, 100, 0.15);
}

/* Fix dropdown options visibility */
select option {
    background-color: #064e3b;
    /* Match deep emerald */
    color: white;
    padding: 10px;
}

input::placeholder {
    color: rgba(167, 243, 208, 0.4);
    /* Based on --text-muted */
}

.config-card {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--card-radius);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.group-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.btn-delete-group-icon {
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.2);
    color: #f87171;
    border-radius: 12px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.btn-delete-group-icon:hover {
    background: rgba(248, 113, 113, 0.2);
    transform: scale(1.05);
}

.btn-save-group-style {
    background: var(--accent-secondary);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 0 1.5rem;
    font-weight: 800;
    cursor: pointer;
    height: 48px;
    flex-shrink: 0;
    font-family: 'Outfit', sans-serif;
    transition: all 0.2s ease;
}

.btn-save-group-style:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
}

.players-section {
    margin-top: 2rem;
}

.players-section h3 {
    margin: 2rem 0 1rem;
    font-size: 1.2rem;
    color: var(--accent-primary);
}

.add-player-box {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    align-items: center;
}

#btn-add-player {
    width: 48px;
    height: 48px;
    background: var(--accent-primary);
    border: none;
    border-radius: 12px;
    color: #064e3b;
    font-size: 1.8rem;
    font-weight: 900;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Screen Pass Styles */
#screen-pass {
    text-align: center;
    justify-content: center;
    min-height: 70vh;
}

.pass-info p {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.pass-info h2 {
    font-size: 3.5rem;
    font-weight: 900;
    text-transform: uppercase;
    color: #fff;
    margin-bottom: 1rem;
}

.security-msg {
    margin: 1.5rem 0;
    padding: 1.2rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.players-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.8rem;
}

.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;
}

.btn-delete {
    background: none;
    border: none;
    color: #f87171;
    font-size: 1.2rem;
    cursor: pointer;
}

.btn {
    padding: 1.2rem;
    border-radius: 18px;
    border: none;
    font-weight: 900;
    font-size: 1.1rem;
    cursor: pointer;
    text-transform: uppercase;
}

.btn-primary {
    background: var(--accent-primary);
    color: #064e3b;
    box-shadow: 0 4px 15px rgba(190, 242, 100, 0.2);
    transition: all 0.2s ease;
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-primary:disabled {
    opacity: 0.5;
    background: #94a3b8;
    color: #475569;
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--accent-secondary);
    color: white;
}

.hidden {
    display: none !important;
}

/* Ranking Setup */
.ranking-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    font-weight: 900;
    color: var(--text-muted);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 0.5rem;
    margin: 1rem 0 0.5rem;
}

.ranking-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.ranking-item span:first-child {
    font-size: 1.25rem;
    font-weight: 800;
    color: white;
}

.ranking-data {
    display: flex;
    gap: 1.5rem;
}

.ranking-pts {
    color: var(--accent-primary);
    font-weight: 900;
    font-size: 1.2rem;
    min-width: 40px;
    text-align: center;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pts-gain {
    position: absolute;
    top: -5px;
    right: -12px;
    font-size: 0.75rem;
    color: #4ade80;
    font-weight: 900;
    animation: bounceIn 0.5s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

@keyframes bounceIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    70% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.btn-reset-ranking {
    background: none;
    border: none;
    color: #f87171;
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: underline;
    cursor: pointer;
    opacity: 0.8;
    margin-top: 1rem;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

/* 3D Pizarras Flip Style */
.pizarras-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.2rem;
    margin-top: 2rem;
    perspective: 1200px;
}

.pizarra-container {
    height: 140px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.pizarra-container.selected .pizarra-inner .pizarra-back {
    border-color: var(--accent-primary);
    box-shadow: 0 0 15px var(--accent-primary), 0 8px 25px rgba(0, 0, 0, 0.3);
    border-width: 4px;
}

.pizarra-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
}

.pizarra-container.revealed .pizarra-inner {
    transform: rotateY(180deg);
}

.pizarra-front,
.pizarra-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    border: 3px solid #ffffff;
}

.pizarra-front {
    background: #ffffff;
    color: #1e293b;
}

.pizarra-back {
    background: #ffffff;
    color: #059669;
    transform: rotateY(180deg);
    border-color: var(--accent-primary);
}

.impostor-highlight .pizarra-back {
    border-color: #ef4444 !important;
    background: #fef2f2 !important;
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.4);
}

.impostor-highlight .pizarra-owner,
.impostor-highlight .pizarra-bid-value,
.impostor-highlight .pizarra-secret-text {
    color: #b91c1c !important;
}

.pizarra-owner {
    font-size: 0.7rem;
    font-weight: 900;
    text-transform: uppercase;
    color: #64748b;
    margin-bottom: 0.4rem;
}

.pizarra-bid-value {
    font-size: 1.8rem;
    font-weight: 900;
    color: #1e293b;
}

.pizarra-secret-text {
    margin-top: 0.4rem;
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--accent-secondary);
    animation: slideUpFade 0.5s ease-out;
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.portal-link-box {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.btn-more-games {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 700;
}

.score-actions {
    margin-top: 2rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 20px;
    text-align: center;
}

.winner-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin: 1rem 0;
}

.btn-win {
    padding: 1rem;
    border: none;
    border-radius: 14px;
    font-weight: 800;
    color: white;
    cursor: pointer;
}

.btn-success {
    background: #059669;
}

.btn-danger {
    background: #fbbf24;
    color: #064e3b;
}

.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}