/* style.css */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700&display=swap');

:root {
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --primary: #3b82f6;
    /* Blue */
    --accent: #8b5cf6;
    /* Purple */
    --loser: #ef4444;
    /* Red */
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --glass-border: rgba(255, 255, 255, 0.1);
}

* {
    box_sizing: border_box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    background-image: radial-gradient(circle at top right, #1e1b4b, transparent), radial-gradient(circle at bottom left, #1e293b, transparent);
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
    min-height: 100vh;
    padding-bottom: 2rem;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 1rem;
}

/* Header & Nav */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0 2rem;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(to right, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-transform: uppercase;
    letter-spacing: 2px;
}

nav a {
    color: var(--text-muted);
    text-decoration: none;
    margin-left: 1rem;
    font-weight: 600;
    transition: color 0.3s;
}

nav a:hover {
    color: var(--text-main);
}

.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.5);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #b91c1c);
    color: white;
}

/* Cards */
.card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.card-header {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Record Holder */
.record-holder {
    text-align: center;
    padding: 2rem;
}

.crown {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.record-name {
    font-size: 2rem;
    font-weight: 800;
    color: #fbbf24;
    /* Gold */
}

.record-stat {
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* Leaderboard */
.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
}

.leaderboard-table th,
.leaderboard-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
    vertical-align: middle;
    /* Ensure vertical centering */
}

.leaderboard-table th {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 0.9rem;
}

.rank {
    font-weight: 700;
    color: var(--accent);
}

/* Game Groups & History */
.game-group {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--glass-border);
}

.game-group:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.game-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.game-group-date {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.game-count-badge {
    background: rgba(255, 255, 255, 0.05);
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.8rem;
    color: var(--text-muted);
    border: 1px solid var(--glass-border);
}

.game-group-items {
    /* No flex wrap needed for single row aggregation, usually */
    /* display: flex; flex-wrap: wrap; gap: 1.5rem; */
}

.game-item.daily-row {
    width: auto;
    max-width: 100%;
    margin: 0 auto;
    justify-content: center;
    /* Center the players if few */
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    display: flex;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.daily-player-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
}

.player-bubble {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    border: 1px solid var(--glass-border);
    position: relative;
    /* For badge positioning */
}

.player-bubble.loser {
    background: rgba(239, 68, 68, 0.2);
    border-color: var(--loser);
    color: var(--loser);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.2);
}

.loss-count-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: var(--loser);
    color: white;
    font-size: 0.75rem;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-color);
    font-weight: 700;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    z-index: 10;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
}

input[type="text"],
input[type="password"],
select {
    width: 100%;
    padding: 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.2);
    color: white;
    font-family: inherit;
}

input:focus {
    outline: none;
    border-color: var(--primary);
}

/* Checkbox/Radio */
.player-select-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.player-option {
    background: rgba(255, 255, 255, 0.05);
    padding: 0.75rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    cursor: pointer;
    border: 1px solid transparent;
}

.player-option:hover {
    background: rgba(255, 255, 255, 0.1);
}

.player-option input {
    margin-right: 0.5rem;
    width: auto;
}

/* Responsive */
@media (max-width: 600px) {
    .player-select-list {
        grid-template-columns: 1fr;
    }
}

.text-center {
    text-align: center;
}