/* ===================================================================
   PlanetaRanked Replay Site — Cobblemon dark gray theme
   =================================================================== */

:root {
    --bg:           #15181c;
    --surface:      #1d2026;
    --surface-2:    #262a31;
    --surface-3:    #2e333b;
    --border:       #2c3038;
    --border-2:     #3a3f48;
    --text:         #e1e3e6;
    --text-muted:   #8a8f96;
    --text-faint:   #5d6168;
    --accent:       #a8b3c1;
    --accent-strong:#d0d7e0;
    --success:      #6ec07d;
    --danger:       #d96b6b;
    --warning:      #d9b86b;
    --radius:       6px;
    --radius-lg:    10px;
    --shadow:       0 2px 6px rgba(0,0,0,0.4);
    --shadow-lg:    0 8px 24px rgba(0,0,0,0.5);
    --transition:   0.15s ease;
    --font:         -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono:    "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--accent-strong);
    text-decoration: none;
    transition: color var(--transition);
}
a:hover { color: var(--text); }

/* ------------ Layout ------------ */
.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 18px 0;
}
.site-header .brand {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    gap: 14px;
}
.site-header .brand img {
    height: 38px;
    width: auto;
    display: block;
}
.site-header .brand .title {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: 0.2px;
    color: var(--text);
}
.site-header .brand .subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}

.container {
    max-width: 1100px;
    margin: 32px auto;
    padding: 0 24px;
}

.container--narrow {
    max-width: 520px;
}

.site-footer {
    text-align: center;
    padding: 28px 16px;
    color: var(--text-faint);
    font-size: 12px;
    border-top: 1px solid var(--border);
    margin-top: 60px;
}

/* ------------ Cards & panels ------------ */
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow);
}

.panel-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

.panel-subtitle {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 22px;
}

/* ------------ Forms ------------ */
.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.field label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

.input {
    background: var(--surface-2);
    border: 1px solid var(--border-2);
    color: var(--text);
    padding: 11px 14px;
    border-radius: var(--radius);
    font-family: var(--font-mono);
    font-size: 13px;
    transition: border-color var(--transition), background var(--transition);
    width: 100%;
}
.input:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--surface-3);
}
.input::placeholder { color: var(--text-faint); }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 11px 18px;
    border-radius: var(--radius);
    border: 1px solid var(--border-2);
    background: var(--surface-2);
    color: var(--text);
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition);
    text-decoration: none;
}
.btn:hover {
    background: var(--surface-3);
    border-color: var(--accent);
    color: var(--text);
}
.btn-primary {
    background: var(--surface-3);
    border-color: var(--accent);
}
.btn-block { width: 100%; }

/* ------------ Replay list ------------ */
.replay-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.replay-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    text-decoration: none;
    color: inherit;
    transition: border-color var(--transition), background var(--transition);
}
.replay-card:hover {
    border-color: var(--border-2);
    background: var(--surface-2);
}
.replay-card .matchup {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}
.replay-card .matchup .vs {
    color: var(--text-faint);
    margin: 0 10px;
    font-weight: 400;
}
.replay-card .meta {
    display: flex;
    gap: 18px;
    align-items: center;
    color: var(--text-muted);
    font-size: 12px;
}
.replay-card .badge {
    background: var(--surface-2);
    border: 1px solid var(--border-2);
    padding: 3px 9px;
    border-radius: 4px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-muted);
}
.replay-card .winner-name {
    color: var(--success);
    font-weight: 500;
}

/* ------------ Match info bar (replay page) ------------ */
.match-info {
    display: flex;
    flex-wrap: wrap;
    gap: 36px;
    padding: 20px 28px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 16px;
}
.match-info .info-item .label {
    font-size: 11px;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 4px;
}
.match-info .info-item .value {
    color: var(--text);
    font-weight: 600;
    font-size: 14px;
}
.match-info .info-item .value.winner { color: var(--success); }
.match-info .info-item .value.format { color: var(--accent-strong); }

/* ------------ Empty / error states ------------ */
.empty-state, .error-state {
    text-align: center;
    padding: 60px 30px;
    color: var(--text-muted);
}
.empty-state h2, .error-state h2 {
    font-size: 18px;
    color: var(--text);
    font-weight: 600;
    margin-bottom: 8px;
}
.empty-state p, .error-state p { font-size: 14px; }
.error-state { color: var(--danger); }
.error-state h2 { color: var(--danger); }

/* ------------ Cookie consent banner ------------ */
.cookie-consent {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 32px);
    max-width: 600px;
    background: var(--surface);
    border: 1px solid var(--border-2);
    border-radius: var(--radius-lg);
    padding: 18px 22px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    box-shadow: var(--shadow-lg);
    z-index: 9999;
    opacity: 0;
    transform: translate(-50%, 20px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}
.cookie-consent.visible {
    opacity: 1;
    transform: translate(-50%, 0);
}
.cookie-consent .text {
    color: var(--text);
    font-size: 13px;
    line-height: 1.55;
}
.cookie-consent .text strong { color: var(--accent-strong); font-weight: 600; }
.cookie-consent .actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}
.cookie-consent .actions .btn { padding: 8px 16px; font-size: 13px; }

@media (max-width: 480px) {
    .cookie-consent .actions { flex-direction: column-reverse; }
    .cookie-consent .actions .btn { width: 100%; }
}

/* ------------ Replay viewer wrapper ------------ */
.replay-wrapper {
    max-width: 1180px;
    margin: 0 auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

/* ------------ Misc utilities ------------ */
.muted     { color: var(--text-muted); }
.faint     { color: var(--text-faint); }
.mono      { font-family: var(--font-mono); }
.mt-12     { margin-top: 12px; }
.mt-16     { margin-top: 16px; }
.mt-24     { margin-top: 24px; }
.center    { text-align: center; }

@media (max-width: 640px) {
    .replay-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .replay-card .meta { flex-wrap: wrap; }
    .match-info { gap: 22px; padding: 18px 20px; }
    .panel { padding: 22px; }
}

/* ------------ Site nav (header links) ------------ */
.site-nav {
    margin-left: auto;
    display: flex;
    gap: 18px;
}
.site-nav a {
    font-size: 14px;
    color: var(--text-muted);
    padding: 6px 2px;
    border-bottom: 2px solid transparent;
}
.site-nav a:hover { color: var(--text); }
.site-nav a.active {
    color: var(--text);
    border-bottom-color: var(--accent);
}

/* ------------ Leaderboard ------------ */
.lb-panel { padding: 0; overflow: hidden; }
.lb-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 22px 26px 18px;
    border-bottom: 1px solid var(--border);
}
.lb-live {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    white-space: nowrap;
}
.lb-live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    animation: lb-pulse 2s ease-in-out infinite;
}
@keyframes lb-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.35; }
}

.lb-table-wrap { overflow-x: auto; }
.lb-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.lb-table th {
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-faint);
    padding: 12px 16px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.lb-table td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    white-space: nowrap;
}
.lb-table tbody tr:last-child td { border-bottom: none; }
.lb-table tbody tr { transition: background var(--transition); }
.lb-table tbody tr:hover { background: var(--surface-2); }

.lb-pos {
    width: 48px;
    text-align: center;
    font-family: var(--font-mono);
    color: var(--text-muted);
}
.lb-top .lb-pos { font-weight: 700; }
.lb-top-1 .lb-pos { color: #ffd700; }
.lb-top-2 .lb-pos { color: #c0c0c0; }
.lb-top-3 .lb-pos { color: #cd7f32; }
.lb-top-1 { background: rgba(255, 215, 0, 0.045); }
.lb-top-2 { background: rgba(192, 192, 192, 0.04); }
.lb-top-3 { background: rgba(205, 127, 50, 0.04); }

.lb-player {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}
.lb-head {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    image-rendering: pixelated;
    flex-shrink: 0;
}
.lb-rank {
    display: table-cell;
}
.lb-rank-img {
    width: 26px;
    height: 26px;
    vertical-align: middle;
    margin-right: 8px;
    object-fit: contain;
}
.lb-rank-icon {
    font-size: 16px;
    margin-right: 8px;
    vertical-align: middle;
}
.lb-num { text-align: right; font-family: var(--font-mono); }
.lb-elo { font-weight: 700; color: var(--accent-strong); }
.lb-wins { color: var(--success); }
.lb-losses { color: var(--danger); }

@media (max-width: 640px) {
    .lb-header { padding: 18px 16px 14px; }
    .lb-table th, .lb-table td { padding: 8px 10px; }
    .lb-rank-img, .lb-rank-icon { display: none !important; }
}
