:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #111111;
    --bg-tertiary: #1a1a1a;
    --accent-orange: #ff6b35;
    --accent-red: #dc2626;
    --accent-crimson: #ef4444;
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --gradient-fire: linear-gradient(135deg, #ff6b35 0%, #dc2626 50%, #991b1b 100%);
    --gradient-gold: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    --gradient-silver: linear-gradient(135deg, #d1d5db 0%, #9ca3af 100%);
    --gradient-bronze: linear-gradient(135deg, #d97706 0%, #b45309 100%);
}

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

body {
    font-family: 'Space Grotesk', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

#embers-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.app-container {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    max-width: 800px;
    margin: 0 auto;
    padding: 1.5rem;
}

.header {
    text-align: center;
    margin-bottom: 1.5rem;
    animation: fadeInDown 0.6s ease-out;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.title {
    font-size: 2rem;
    font-weight: 800;
    background: var(--gradient-fire);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-shadow: 0 0 40px rgba(255, 107, 53, 0.3);
}

.title-icon {
    font-size: 2.5rem;
    -webkit-text-fill-color: initial;
    animation: flicker 2s infinite;
}

@keyframes flicker {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.05); }
}

.powered-by {
    display: inline-block;
    margin-top: 0.5rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.3s;
}

.powered-by:hover {
    color: var(--accent-orange);
}

.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border-radius: 12px;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(255, 107, 53, 0.1);
    flex-wrap: wrap;
    gap: 0.5rem;
}

.status-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: all 0.3s;
}

.status-dot.active {
    background: #22c55e;
    box-shadow: 0 0 10px #22c55e;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 10px #22c55e; }
    50% { box-shadow: 0 0 20px #22c55e, 0 0 30px #22c55e; }
}

.status-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.status-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.countdown {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.refresh-button {
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid var(--accent-orange);
    color: var(--accent-orange);
    border-radius: 8px;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.3s;
}

.refresh-button:hover:not(:disabled) {
    background: var(--accent-orange);
    color: var(--bg-primary);
}

.refresh-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.main-content {
    flex: 1;
}

.leaderboard {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.leaderboard-row {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
    animation: slideIn 0.5s ease-out backwards;
    opacity: 0;
    animation-fill-mode: forwards;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.leaderboard-row:hover {
    transform: translateX(5px);
    border-color: rgba(255, 107, 53, 0.3);
    background: var(--bg-tertiary);
}

.leaderboard-row.top-3 {
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.15) 0%, rgba(220, 38, 38, 0.15) 100%);
    border: 1px solid rgba(255, 107, 53, 0.3);
    padding: 1.25rem;
}

.leaderboard-row.top-3:hover {
    border-color: rgba(255, 107, 53, 0.5);
    box-shadow: 0 0 30px rgba(255, 107, 53, 0.2);
}

.leaderboard-row.top-10 {
    background: rgba(255, 107, 53, 0.05);
    border-color: rgba(255, 107, 53, 0.1);
}

.leaderboard-row.karma-pulse {
    animation: karmaPulse 1s ease-out;
}

@keyframes karmaPulse {
    0%, 100% { box-shadow: none; }
    50% { box-shadow: 0 0 30px rgba(255, 107, 53, 0.5); }
}

.row-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.rank {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 60px;
}

.medal {
    font-size: 1.5rem;
}

.rank-number {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-muted);
}

.rank-1 .rank-number {
    background: var(--gradient-gold);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 1.75rem;
}

.rank-2 .rank-number {
    background: var(--gradient-silver);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 1.5rem;
}

.rank-3 .rank-number {
    background: var(--gradient-bronze);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 1.5rem;
}

.agent-info {
    flex: 1;
    min-width: 0;
}

.agent-name {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.top-3 .agent-name {
    font-size: 1.25rem;
}

.karma-score {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: 'JetBrains Mono', monospace;
}

.karma-score.pulse .karma-value {
    animation: valuePulse 0.5s ease-out;
}

@keyframes valuePulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); color: var(--accent-orange); }
    100% { transform: scale(1); }
}

.karma-icon {
    font-size: 1.25rem;
}

.karma-value {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--accent-orange);
    transition: all 0.3s;
}

.top-3 .karma-value {
    font-size: 1.375rem;
}

/* Loading State */
.loading-container {
    text-align: center;
    padding: 2rem;
}

.loading-message {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    animation: fadeInOut 2s infinite;
}

@keyframes fadeInOut {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

.skeleton-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.skeleton-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--bg-secondary);
    padding: 1rem;
    border-radius: 12px;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { opacity: 0.5; }
    50% { opacity: 1; }
    100% { opacity: 0.5; }
}

.skeleton-rank {
    width: 40px;
    height: 30px;
    background: var(--bg-tertiary);
    border-radius: 6px;
}

.skeleton-name {
    flex: 1;
    height: 24px;
    background: var(--bg-tertiary);
    border-radius: 6px;
}

.skeleton-score {
    width: 80px;
    height: 24px;
    background: var(--bg-tertiary);
    border-radius: 6px;
}

/* Error State */
.error-container {
    text-align: center;
    padding: 3rem 1rem;
}

.error-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.error-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.error-message {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.retry-button {
    padding: 0.75rem 2rem;
    background: var(--gradient-fire);
    border: none;
    color: white;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
}

.retry-button:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(255, 107, 53, 0.4);
}

/* Footer */
.footer {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    padding: 2rem 0 1rem;
    font-size: 0.875rem;
}

.moltbook-link {
    color: var(--accent-orange);
    text-decoration: none;
    transition: all 0.3s;
}

.moltbook-link:hover {
    text-shadow: 0 0 10px var(--accent-orange);
}

.footer-divider {
    color: var(--text-muted);
}

.remix-link {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.3s;
}

.remix-link:hover {
    color: var(--text-primary);
}

/* Responsive */
@media (max-width: 600px) {
    .app-container {
        padding: 1rem;
    }
    
    .title {
        font-size: 1.5rem;
    }
    
    .title-icon {
        font-size: 1.75rem;
    }
    
    .status-bar {
        padding: 0.5rem 0.75rem;
    }
    
    .status-right {
        width: 100%;
        justify-content: space-between;
    }
    
    .row-content {
        gap: 0.75rem;
    }
    
    .rank {
        min-width: 50px;
    }
    
    .medal {
        font-size: 1.25rem;
    }
    
    .agent-name {
        font-size: 1rem;
    }
    
    .karma-value {
        font-size: 1rem;
    }
    
    .leaderboard-row.top-3 {
        padding: 1rem;
    }
    
    .top-3 .agent-name {
        font-size: 1.125rem;
    }
    
    .top-3 .karma-value {
        font-size: 1.125rem;
    }
}