:root {
    --bg: #0f0f13;
    --panel: #18181f;
    --panel-2: #23232e;
    --text: #f4f4f5;
    --muted: #a1a1aa;
    --accent: #f59e0b;
    --accent-2: #ec4899;
    --border: #3f3f46;
    --radius: 12px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: var(--panel);
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--accent);
    letter-spacing: -0.02em;
}

.user-pill {
    background: var(--panel-2);
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    margin-right: 0.75rem;
    font-size: 0.875rem;
}

main {
    max-width: 960px;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
}

.site-footer {
    text-align: center;
    padding: 2rem;
    color: var(--muted);
    border-top: 1px solid var(--border);
    font-size: 0.875rem;
}

.hero {
    text-align: center;
    margin-bottom: 2.5rem;
}

.hero h1 {
    font-size: 3rem;
    margin: 0;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.tagline {
    color: var(--muted);
    font-size: 1.125rem;
    margin-top: 0.5rem;
}

.fight-form {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.field {
    margin-bottom: 1rem;
}

.field label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.875rem;
    color: var(--muted);
}

.field input {
    width: 100%;
    padding: 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 1rem;
}

.field input:focus {
    outline: none;
    border-color: var(--accent);
}

.btn-primary,
.btn-secondary {
    border: none;
    border-radius: 8px;
    padding: 0.75rem 1.25rem;
    font-size: 1rem;
    cursor: pointer;
    font-weight: 600;
}

.btn-primary {
    background: var(--accent);
    color: #1a1a1a;
}

.btn-secondary {
    background: var(--panel-2);
    color: var(--text);
    border: 1px solid var(--border);
}

.oauth-alt {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.875rem;
    color: var(--muted);
}

.login-prompt {
    text-align: center;
    padding: 1.5rem;
}

.login-prompt p {
    margin: 0 0 1rem;
    color: var(--muted);
}

.login-prompt .btn-primary {
    display: inline-block;
}

.how-it-works {
    color: var(--muted);
}

.how-it-works h2 {
    color: var(--text);
}

.how-it-works li {
    margin-bottom: 0.5rem;
}

/* Analyze page */
.analyze {
    text-align: center;
    padding: 3rem 1rem;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 1.5rem auto;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Battle page */
.battle-header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1rem;
    align-items: start;
    margin-bottom: 2rem;
}

.fighter-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    text-align: center;
}

.fighter-card h2 {
    margin: 0.5rem 0 0;
    font-size: 1.25rem;
}

.display-name {
    margin: 0;
    color: var(--muted);
    font-size: 0.875rem;
}

.avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
}

.type-badge {
    display: inline-block;
    margin: 0.75rem 0;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.type-dunk { background: #ef4444; color: #fff; }
.type-meme { background: #a855f7; color: #fff; }
.type-thread { background: #d6d3d1; color: #451a03; }
.type-vibe { background: #4ade80; color: #14532d; }
.type-chaos { background: #171717; color: #84cc16; border: 1px solid #84cc16; }
.type-reply { background: #3b82f6; color: #fff; }

.summary {
    font-size: 0.875rem;
    color: var(--muted);
    font-style: italic;
    margin: 0 0 1rem;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    text-align: left;
}

.stat {
    background: var(--panel-2);
    border-radius: 6px;
    padding: 0.5rem;
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
}

.stat-name {
    color: var(--muted);
}

.stat-value {
    font-weight: 700;
}

.vs {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--accent);
}

.arena {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1rem;
    align-items: end;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

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

.hp-bar {
    height: 12px;
    background: var(--panel-2);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 0.5rem;
    border: 1px solid var(--border);
}

.hp-fill {
    height: 100%;
    background: linear-gradient(90deg, #22c55e, #86efac);
    transition: width 0.3s ease;
}

.hp-fill.low {
    background: linear-gradient(90deg, #ef4444, #fca5a5);
}

.hp-text {
    margin: 0 0 0.75rem;
    font-size: 0.875rem;
    color: var(--muted);
}

.sprite {
    width: 120px;
    height: 144px;
    margin: 0 auto;
    transition: transform 0.2s ease;
}

.sprite svg {
    width: 100%;
    height: 100%;
}

.sprite.lunge-left {
    transform: translateX(40px);
}

.sprite.lunge-right {
    transform: translateX(-40px);
}

.sprite.hit {
    animation: shake 0.3s ease;
}

.sprite.faint {
    transform: rotate(90deg) translateY(40px);
    opacity: 0.5;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    75% { transform: translateX(8px); }
}

.arena-center {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
}

.battle-log {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.5rem;
    max-height: 320px;
    overflow-y: auto;
}

.battle-log h3 {
    margin-top: 0;
}

.battle-log ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.battle-log li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
}

.battle-log li:last-child {
    border-bottom: none;
}

.type-code { background: #14b8a6; color: #020617; }
.type-art { background: #ec4899; color: #fff; }
.type-news { background: #64748b; color: #fff; }
.type-music { background: #8b5cf6; color: #fff; }

.user-nav {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.user-nav a {
    background: var(--panel-2);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.leaderboard,
.history {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
}

.leaderboard-table,
.history-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.leaderboard-table th,
.leaderboard-table td,
.history-table th,
.history-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.leaderboard-table th,
.history-table th {
    color: var(--muted);
    font-size: 0.875rem;
}

.result-win {
    color: #22c55e;
    font-weight: 700;
}

.result-loss {
    color: #ef4444;
    font-weight: 700;
}

.subtitle {
    color: var(--muted);
    margin-top: -0.5rem;
}
    color: var(--accent);
    font-weight: 700;
}

@media (max-width: 720px) {
    .battle-header {
        grid-template-columns: 1fr;
    }

    .vs {
        padding: 1rem 0;
    }

    .arena {
        grid-template-columns: 1fr;
        align-items: center;
    }

    .arena-center {
        flex-direction: row;
        justify-content: center;
        order: -1;
    }
}
