:root {
    --bg: #050505;
    --surface: rgba(13, 13, 15, 0.88);
    --surface-strong: rgba(18, 18, 21, 0.96);
    --border-soft: rgba(255, 45, 45, 0.32);
    --border-accent: rgba(255, 66, 66, 0.72);
    --accent: #ff2525;
    --accent-dark: #8d0000;
    --copy: #f6f2f2;
    --copy-muted: #b9abab;
    --success: #72ff99;
    --warning: #ff7373;
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--copy);
    font-family: "Inter", Arial, sans-serif;
    background:
        radial-gradient(circle at 18% 8%, rgba(255, 0, 0, 0.22), transparent 30rem),
        radial-gradient(circle at 82% 0%, rgba(255, 255, 255, 0.06), transparent 18rem),
        linear-gradient(135deg, #050505 0%, #110101 44%, #050505 100%);
}

body::before {
    position: fixed;
    inset: 0;
    z-index: -3;
    pointer-events: none;
    content: "";
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
    background-size: 56px 56px;
    mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.85), transparent 82%);
}

.storm-bg {
    position: fixed;
    inset: 0;
    z-index: -2;
    overflow: hidden;
    pointer-events: none;
}

.bolt {
    position: absolute;
    width: 2px;
    height: 120px;
    background: linear-gradient(to bottom, transparent, rgba(255, 60, 60, 0.8), transparent);
    opacity: 0.35;
    animation: flicker 6s infinite ease-in-out;
}

.bolt-1 { top: 12%; left: 18%; animation-delay: 0s; }
.bolt-2 { top: 8%; right: 22%; animation-delay: 2.4s; }

@keyframes flicker {
    0%, 100% { opacity: 0.1; transform: scaleY(0.8); }
    45% { opacity: 0.45; transform: scaleY(1); }
    50% { opacity: 0.15; }
}

.topbar,
.page,
.footer {
    width: min(1100px, calc(100% - 2rem));
    margin-inline: auto;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.5rem 0 1rem;
}

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

.brand-mark {
    display: grid;
    place-items: center;
    width: 3rem;
    height: 3rem;
    border: 1px solid var(--border-accent);
    border-radius: 0.9rem;
    background: rgba(255, 37, 37, 0.12);
    color: var(--accent);
    font-weight: 900;
    font-size: 1.35rem;
}

.brand h1,
.search-panel h2 {
    margin: 0;
    font-size: clamp(1.4rem, 2vw, 2rem);
}

.brand-kicker,
.eyebrow {
    margin: 0 0 0.15rem;
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.top-links {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.top-links a {
    color: var(--copy-muted);
    text-decoration: none;
    font-weight: 600;
}

.top-links a:hover {
    color: var(--copy);
}

.server-pill {
    padding: 0.45rem 0.8rem;
    border: 1px solid var(--border-soft);
    border-radius: 999px;
    background: var(--surface);
    color: var(--copy-muted);
    font-size: 0.85rem;
}

.page {
    padding-bottom: 3rem;
}

.search-panel,
.player-card,
.stats-card,
.empty-state {
    border: 1px solid var(--border-soft);
    border-radius: 1.2rem;
    background: var(--surface);
    backdrop-filter: blur(10px);
}

.search-panel {
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.lead,
.muted,
.footer p,
.empty-state p {
    color: var(--copy-muted);
}

.lead {
    margin: 0.5rem 0 1.25rem;
    max-width: 42rem;
}

.search-form {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.search-form input {
    flex: 1 1 220px;
    min-width: 0;
    padding: 0.95rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0.85rem;
    background: rgba(0, 0, 0, 0.35);
    color: var(--copy);
}

.search-form input:focus {
    outline: none;
    border-color: var(--border-accent);
    box-shadow: 0 0 0 3px rgba(255, 37, 37, 0.15);
}

.search-form button,
#search-btn {
    padding: 0.95rem 1.25rem;
    border: none;
    border-radius: 0.85rem;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: white;
    font-weight: 700;
    cursor: pointer;
}

.search-form button:disabled {
    opacity: 0.65;
    cursor: wait;
}

.form-error {
    margin: 0.85rem 0 0;
    color: var(--warning);
    font-weight: 600;
}

.results {
    display: grid;
    gap: 1rem;
}

.player-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
}

.player-card img {
    flex: 0 0 96px;
    width: 96px;
    height: 96px;
    border-radius: 1rem;
    border: 2px solid var(--border-soft);
    image-rendering: pixelated;
    background: rgba(255, 255, 255, 0.04);
    object-fit: cover;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.85rem;
}

.summary-item {
    padding: 1rem;
    border: 1px solid var(--border-soft);
    border-radius: 1rem;
    background: var(--surface-strong);
}

.summary-item span {
    display: block;
    color: var(--copy-muted);
    font-size: 0.82rem;
    margin-bottom: 0.35rem;
}

.summary-item strong {
    font-size: 1.25rem;
}

.stats-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
}

.stats-card {
    padding: 1rem 1rem 0.5rem;
}

.stats-card h3 {
    margin: 0 0 0.75rem;
    font-size: 1rem;
}

.stat-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.stat-list li {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.55rem 0;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 0.92rem;
}

.stat-list li span:last-child {
    color: var(--success);
    font-weight: 700;
}

.stat-list .empty-row {
    color: var(--copy-muted);
    justify-content: center;
    border-top: none;
}

.empty-state {
    padding: 2rem;
    text-align: center;
}

.footer {
    padding: 1rem 0 2rem;
    text-align: center;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 720px) {
    .topbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .player-card {
        flex-direction: column;
        text-align: center;
    }
}
