:root {
    --bg-color: #0f172a;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --primary-color: #10b981;
    /* Vibrant green */
    --primary-hover: #059669;
    --danger-color: #ef4444;
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --card-bg: #1e293b;
    --card-available: rgba(16, 185, 129, 0.15);
    --card-border-available: #10b981;
    --card-challengeable: rgba(59, 130, 246, 0.2);
    --card-border-challengeable: #3b82f6;
    --card-unchallengeable: rgba(255, 255, 255, 0.05);
    --card-border-unchallengeable: rgba(255, 255, 255, 0.1);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background: linear-gradient(135deg, var(--bg-color), #000000);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    background: -webkit-linear-gradient(45deg, #3b82f6, #10b981);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

main {
    width: 100%;
    max-width: 1000px;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Glassmorphism */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 20px;
    box-shadow: var(--glass-shadow);
}

/* Dashboard */
#dashboard {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    #dashboard {
        grid-template-columns: 1fr 1fr;
    }
}

h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.podium-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.podium-item {
    display: flex;
    align-items: center;
    background: var(--card-bg);
    padding: 12px;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
}

.podium-item span.rank {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin-right: 15px;
    font-weight: 800;
    color: #fff;
}

.rank-1 {
    background: linear-gradient(135deg, #ffd700, #b8860b);
}

.rank-2 {
    background: linear-gradient(135deg, #c0c0c0, #808080);
}

.rank-3 {
    background: linear-gradient(135deg, #cd7f32, #8b4513);
}

#matches-list {
    list-style: none;
}

#matches-list li {
    padding: 10px;
    border-bottom: 1px solid var(--glass-border);
    font-size: 0.95rem;
    display: flex;
    justify-content: space-between;
}

#matches-list li:last-child {
    border-bottom: none;
}

.score-text {
    font-weight: bold;
    color: #fff;
}

/* Pyramid */
.controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
    margin-bottom: 2rem;
    text-align: center;
}

.instruction {
    color: var(--text-secondary);
    font-size: 1rem;
}

.pyramid {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    width: 100%;
}

.pyramid-row {
    display: flex;
    justify-content: center;
    gap: 10px;
    width: 100%;
}

.player-card {
    background: var(--card-unchallengeable);
    border: 1px solid var(--card-border-unchallengeable);
    border-radius: 12px;
    padding: 15px 10px;
    text-align: center;
    width: 100px;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
    position: relative;
}

.delete-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 20px;
    height: 20px;
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid var(--danger-color);
    color: var(--danger-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
}

.player-card:hover .delete-btn {
    opacity: 1;
}

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

.edit-btn {
    position: absolute;
    top: 5px;
    left: 5px;
    width: 20px;
    height: 20px;
    background: rgba(59, 130, 246, 0.2);
    border: 1px solid #3b82f6;
    color: #3b82f6;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
}

.player-card:hover .edit-btn {
    opacity: 1;
}

.edit-btn:hover {
    background: #3b82f6;
    color: white;
}

@media (min-width: 600px) {
    .player-card {
        width: 120px;
        padding: 20px 15px;
    }
}

.player-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
}

.player-card .pos {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.player-card .name {
    font-weight: 600;
    font-size: 1rem;
    word-break: break-word;
}

/* Card States */
.player-card.selected {
    background: rgba(255, 255, 255, 0.15);
    border-color: #fff;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
}

.player-card.challengeable {
    background: var(--card-challengeable);
    border-color: var(--card-border-challengeable);
}

.player-card.challengeable:hover {
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.5);
}

/* Buttons */
.btn {
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.btn.primary {
    background: var(--primary-color);
    color: #fff;
}

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

.btn.primary:disabled {
    background: #475569;
    cursor: not-allowed;
    opacity: 0.7;
}

.btn.secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn.secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn.huge {
    font-size: 3rem;
    width: 100%;
    height: 100px;
    border-radius: 15px;
    margin-top: 10px;
}

.btn.small {
    width: 100%;
    margin-top: 10px;
    padding: 10px;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal.hidden {
    display: none;
}

.scoreboard-content {
    width: 95%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.scoreboard-content h2 {
    text-align: center;
    color: #fff;
    margin-bottom: 0;
}

.scoreboard {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.player-score {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--card-bg);
    padding: 20px;
    border-radius: 15px;
}

.player-score h3 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    text-align: center;
    min-height: 2.4rem;
}

.score-display {
    font-size: 5rem;
    font-weight: 800;
    line-height: 1;
    color: var(--primary-color);
}

.divider {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-secondary);
}

.modal-actions {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin-top: 20px;
}

.modal-actions .btn {
    flex: 1;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

.pyramid-row {
    animation: fadeIn 0.5s ease backwards;
}

/* Add Player Form */
.add-player-form {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    width: 100%;
    max-width: 400px;
}

.add-player-form input {
    flex: 1;
    padding: 10px 15px;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.2);
    color: #fff;
    font-size: 1rem;
    font-family: inherit;
    outline: none;
}

.add-player-form input:focus {
    border-color: var(--primary-color);
}