:root {
    --bg-main: #0c0f17;
    --bg-surface: #141926;
    --bg-card: rgba(26, 33, 48, 0.7);
    --border-color: rgba(245, 158, 11, 0.2);
    --border-glow: rgba(245, 158, 11, 0.4);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-gold: #f59e0b;
    --accent-red: #ef4444;
    --accent-green: #10b981;
    --font-heading: 'Cinzel', serif;
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-sans);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(245, 158, 11, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(239, 68, 68, 0.04) 0%, transparent 40%);
}

.navbar {
    background: rgba(12, 15, 23, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 50;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.brand-icon {
    font-size: 1.5rem;
    filter: drop-shadow(0 0 8px rgba(245, 158, 11, 0.6));
}

.brand-title {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--accent-gold);
    text-transform: uppercase;
}

.user-badge {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid var(--border-color);
    padding: 0.4rem 1rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    color: var(--accent-gold);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.live-dot {
    width: 8px;
    height: 8px;
    background: var(--accent-green);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--accent-green);
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.85); }
}

.container {
    max-width: 1280px;
    margin: 2rem auto;
    padding: 0 1.5rem;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.grid-hero {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 900px) {
    .grid-hero {
        grid-template-columns: 1fr;
    }
}

.card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.75rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent-gold), transparent);
}

.card-title {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    color: var(--accent-gold);
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.death-counter-display {
    text-align: center;
    padding: 1rem 0;
}

.death-number {
    font-size: 5.5rem;
    font-weight: 800;
    font-family: var(--font-heading);
    color: #ff4d4d;
    text-shadow: 0 0 25px rgba(239, 68, 68, 0.4), 0 0 50px rgba(239, 68, 68, 0.2);
    transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    line-height: 1;
}

.death-number.bump {
    transform: scale(1.15);
    color: #ff1a1a;
    text-shadow: 0 0 35px rgba(255, 0, 0, 0.8);
}

.death-label {
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

.active-run-meta {
    margin-top: 1.5rem;
    background: rgba(0, 0, 0, 0.3);
    padding: 1rem;
    border-radius: 8px;
    display: flex;
    justify-content: space-around;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

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

.meta-item span {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.meta-item strong {
    font-size: 1rem;
    color: var(--text-primary);
}

.controls-row {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.btn {
    padding: 0.65rem 1.25rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, #d97706, #b45309);
    color: white;
    box-shadow: 0 4px 14px rgba(217, 119, 6, 0.35);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.45);
    transform: translateY(-1px);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.3);
    color: white;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

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

.obs-link-box {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
    padding: 0.85rem 1rem;
    border-radius: 8px;
    font-family: monospace;
    font-size: 0.9rem;
    color: var(--accent-gold);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    word-break: break-all;
}

.obs-preview-frame {
    width: 100%;
    height: 180px;
    border: 1px dashed rgba(245, 158, 11, 0.3);
    border-radius: 8px;
    margin-top: 1rem;
    background: #000;
}

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

th, td {
    padding: 0.85rem 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

th {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
}

td {
    font-size: 0.875rem;
}

.badge {
    padding: 0.25rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-active {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-inactive {
    background: rgba(148, 163, 184, 0.15);
    color: #94a3b8;
}

.events-list {
    max-height: 260px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.event-row {
    background: rgba(0, 0, 0, 0.2);
    padding: 0.65rem 0.85rem;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    border-left: 3px solid var(--accent-red);
}

.input-field {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    padding: 0.65rem 0.85rem;
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

.input-field:focus {
    outline: none;
    border-color: var(--accent-gold);
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.3);
}

/* --- STATS SUMMARY BAR & CARDS --- */
.stats-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
}

.stat-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.stat-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 3px;
    background: var(--accent-gold);
}

.stat-box.danger::before {
    background: var(--accent-red);
}

.stat-icon {
    font-size: 2.25rem;
    line-height: 1;
    filter: drop-shadow(0 0 10px rgba(245, 158, 11, 0.4));
}

.stat-details {
    display: flex;
    flex-direction: column;
}

.stat-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
    font-weight: 600;
}

.stat-val {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.1;
    margin-top: 0.2rem;
}

.stat-sub {
    font-size: 0.8rem;
    color: var(--accent-gold);
    margin-top: 0.15rem;
}

/* --- GAME BREAKDOWN TILES --- */
.game-tiles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.game-tile {
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.game-tile:hover {
    transform: translateY(-2px);
    border-color: var(--accent-gold);
}

.game-tile-title {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.game-tile-deaths {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    color: var(--accent-red);
    font-weight: 700;
}

.game-tile-top {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.35rem;
}

/* --- LEADERBOARD BARS --- */
.rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    font-weight: 800;
    font-size: 0.8rem;
}
.rank-1 { background: #ffd700; color: #000; box-shadow: 0 0 10px rgba(255, 215, 0, 0.5); }
.rank-2 { background: #c0c0c0; color: #000; }
.rank-3 { background: #cd7f32; color: #fff; }
.rank-other { background: rgba(255, 255, 255, 0.1); color: var(--text-secondary); }

/* --- TOAST NOTIFICATION SYSTEM --- */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 380px;
    pointer-events: none;
}

.toast {
    background: #141926;
    color: var(--text-primary);
    border-radius: 10px;
    padding: 0.9rem 1.25rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
    border-left: 4px solid var(--accent-gold);
    display: flex;
    align-items: center;
    gap: 0.85rem;
    font-size: 0.875rem;
    pointer-events: auto;
    animation: toast-in 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transition: all 0.25s ease;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.toast.toast-success {
    border-left-color: var(--accent-green);
}
.toast.toast-error {
    border-left-color: var(--accent-red);
}
.toast.toast-info {
    border-left-color: #3b82f6;
}

.toast-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.toast-message {
    flex-grow: 1;
    line-height: 1.35;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0 0.25rem;
    line-height: 1;
}

.toast-close:hover {
    color: #fff;
}

.toast.toast-out {
    opacity: 0;
    transform: translateX(100%);
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* --- CUSTOM CONFIRM MODAL --- */
.confirm-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.confirm-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

.confirm-box {
    background: var(--bg-surface);
    border: 1px solid var(--border-glow);
    border-radius: 12px;
    padding: 1.75rem;
    width: 440px;
    max-width: 90vw;
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.8);
    transform: scale(0.95);
    transition: transform 0.2s ease;
    text-align: left;
}

.confirm-backdrop.active .confirm-box {
    transform: scale(1);
}

.confirm-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
}

.confirm-icon {
    font-size: 1.6rem;
}

.confirm-title {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    color: var(--text-primary);
    font-weight: 700;
}

.confirm-body {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 1.5rem;
}

.confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

