/*
 * Multi-theme Design System
 * Centralized theme — all pages must use these variables and classes.
 * Do NOT hardcode colors in templates.
 * Themes: goodloss (default), oriana, ranked
 */

:root {
    /* Background */
    --bg-body: #1a2332;
    --bg-sidebar: #111a27;
    --bg-card: #1e2d3f;
    --bg-subtle: rgba(255,255,255,0.04);
    --bg-hover: rgba(255,255,255,0.05);

    /* Accent */
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --accent-subtle: rgba(59,130,246,0.1);
    --accent-light: #93c5fd;

    /* Text */
    --text-primary: #e2e8f0;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --text-white: #ffffff;

    /* Borders */
    --border: rgba(255,255,255,0.06);
    --border-light: rgba(255,255,255,0.1);

    /* Status */
    --success: #4ade80;
    --success-bg: rgba(34,197,94,0.15);
    --danger: #f87171;
    --danger-bg: rgba(239,68,68,0.15);
    --patreon-bg: rgba(236,72,153,0.15);

    /* Avatar */
    --avatar-from: #1e3a8a;
    --avatar-to: #3b82f6;

    /* Shadows */
    --shadow: 0 2px 10px rgba(0,0,0,0.3);
    --shadow-accent: 0 4px 12px rgba(59,130,246,0.3);

    /* Layout */
    --sidebar-width: 280px;
    --radius: 8px;
    --radius-sm: 6px;
    --radius-pill: 20px;
}

/* ─── Oriana theme ───
 * For now, `oriana` piggybacks on the `ranked` palette (see the combined
 * selector below). The two theme keys are kept distinct so the brands can
 * diverge visually later — just split the combined selector into separate
 * `[data-theme="ranked"]` and `[data-theme="oriana"]` blocks and tweak
 * whichever one needs to change.
 */

/* ─── Ranked theme ─── */

[data-theme="ranked"],
[data-theme="oriana"] {
    --bg-body: #292524;
    --bg-sidebar: #1c1917;
    --bg-card: #44403c;
    --bg-subtle: rgba(255,255,255,0.04);
    --bg-hover: rgba(255,255,255,0.05);

    --accent: #f59e0b;
    --accent-hover: #d97706;
    --accent-subtle: rgba(245,158,11,0.1);
    --accent-light: #fcd34d;

    --text-primary: #f5f5f4;
    --text-secondary: #e7e5e4;
    --text-muted: #d6d3d1;

    --avatar-from: #92400e;
    --avatar-to: #f59e0b;

    --shadow-accent: 0 4px 12px rgba(245,158,11,0.3);
}

/* ─── Reset ─── */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
}

/* ─── Sidebar ─── */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    box-shadow: var(--shadow);
    padding: 8px 6px 6px;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 4px 0 6px 12px;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 6px;
}

.sidebar-header a {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.sidebar-header h1 {
    color: var(--text-white);
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

[data-theme="ranked"] .sidebar-header h1 {
    font-size: 16px;
}

[data-theme="ranked"] .sidebar-header {
    padding-left: 4px;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
}

.sidebar-nav ul {
    list-style: none;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 12px;
    color: rgba(255,255,255,1);
    text-decoration: none;
    border-radius: var(--radius-sm);
    margin-bottom: 1px;
    transition: all 0.2s ease;
    font-size: 14px;
}

.sidebar-nav a svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.5;
}

.sidebar-nav a:hover {
    background: var(--bg-hover);
    color: var(--accent);
}

.sidebar-nav a .nav-logo {
    width: 18px;
    height: 18px;
    border-radius: 3px;
    object-fit: contain;
    flex-shrink: 0;
}

.sidebar-nav a.active {
    background: var(--accent-subtle);
    color: var(--accent);
}

/* ─── Sidebar nav groups (collapsible categories) ─── */

.nav-group {
    margin-bottom: 1px;
}

.nav-group-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 4px 12px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 1);
    cursor: pointer;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    text-align: left;
    transition: all 0.2s ease;
}

.nav-group-toggle:hover {
    background: var(--bg-hover);
    color: var(--accent);
}

.nav-group-toggle > svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.5;
}

.nav-group-label {
    flex: 1;
}

.nav-group-chevron {
    width: 14px !important;
    height: 14px !important;
    transition: transform 0.25s ease;
}

.nav-group.is-open .nav-group-chevron {
    transform: rotate(180deg);
}

.nav-group.is-open > .nav-group-toggle {
    color: var(--accent);
}

.nav-group-submenu {
    list-style: none;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.3s ease, opacity 0.2s ease, padding 0.2s ease;
    padding: 0 0 0 16px;
    margin: 0;
    border-left: 1px solid var(--bg-hover);
    margin-left: 20px;
}

.nav-group.is-open > .nav-group-submenu {
    max-height: 400px;
    opacity: 1;
    padding-top: 2px;
    padding-bottom: 2px;
}

.nav-group-submenu a {
    font-size: 13px;
    padding: 4px 10px;
}

.nav-group-submenu a svg,
.nav-group-submenu a .nav-logo {
    width: 16px;
    height: 16px;
}

/* ─── Sidebar footer / User ─── */

.sidebar-footer {
    padding-top: 6px;
    margin-top: auto;
}

.user-info {
    background: var(--bg-subtle);
    border-radius: var(--radius);
    padding: 6px 8px;
    margin-bottom: 4px;
}

.user-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding-bottom: 6px;
    margin-bottom: 6px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--avatar-from) 0%, var(--avatar-to) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-white);
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
}

.user-name {
    color: var(--text-white);
    font-weight: 600;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-role {
    display: inline-block;
    background: rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.9);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 8px;
    border-radius: 10px;
    margin-bottom: 10px;
    margin-left: 44px;
}

.user-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.user-actions a {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    background: rgba(59,130,246,0.15);
    color: var(--accent-light);
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.user-actions a:hover {
    background: rgba(59,130,246,0.25);
    color: var(--text-white);
}

.user-actions a svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.5;
}

/* ─── Buttons ─── */

.btn {
    display: inline-block;
    padding: 12px 20px;
    border-radius: var(--radius);
    text-decoration: none;
    font-weight: 500;
    text-align: center;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    font-size: 14px;
}

.btn-primary {
    background: var(--accent);
    color: var(--text-white);
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-accent);
}

.btn-secondary {
    background: var(--border);
    color: var(--accent-light);
    width: 100%;
}

.btn-secondary:hover {
    background: var(--border-light);
}

/* ─── Cards ─── */

.card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 30px;
    border: 1px solid var(--border);
    margin-bottom: 20px;
}

.card h1, .card h2 {
    color: var(--text-white);
    margin-bottom: 20px;
}

.card h2 {
    font-size: 20px;
}

.card p {
    color: var(--text-secondary);
}

.card strong {
    color: var(--accent);
}

/* ─── Info rows ─── */

.info-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.info-value {
    color: var(--text-primary);
    font-weight: 500;
}

/* ─── Status badges ─── */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 500;
}

.badge-success {
    background: var(--success-bg);
    color: var(--success);
}

.badge-muted {
    background: var(--bg-subtle);
    color: var(--text-muted);
}

/* ─── Link button (small) ─── */

.link-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: var(--text-white);
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
    transition: background 0.2s ease;
}

.link-btn:hover {
    background: var(--accent-hover);
}

/* ─── Alerts ─── */

.alert {
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.alert-info {
    background: var(--accent-subtle);
    border-left: 4px solid var(--accent);
    color: var(--accent-light);
}

.alert h2, .alert h3 {
    margin-bottom: 10px;
    color: var(--text-white);
}

/* ─── Main content ─── */

.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    padding: 30px;
    background: var(--bg-body);
}

.main-content.no-padding {
    padding: 0;
}

/* ─── Mobile ─── */

.menu-toggle {
    display: none;
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 998;
    background: var(--bg-sidebar);
    color: var(--text-white);
    border: none;
    padding: 12px 16px;
    border-radius: var(--radius);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

.overlay.active {
    display: block;
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding: 14px;
    }

    .menu-toggle {
        display: block;
    }

    .profile-header-ranks {
        width: 100%;
    }

    .profile-header-ranks .rank-card {
        flex: 1 1 100%;
        min-width: 0;
    }

    .player-subtabs .subtab-btn {
        flex: 1 1 auto;
        text-align: center;
    }

    .success-item {
        flex: 1 1 auto;
        max-width: none;
    }
}

/* ─── Linked accounts (specific) ─── */

.linked-account {
    display: flex;
    align-items: center;
    gap: 12px;
}

.linked-account .provider-name {
    font-weight: 600;
    color: var(--text-primary);
    min-width: 80px;
}

/* ─── SSO roles ─── */

.sso-roles {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* ─── My Services ─── */

.services-categories {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 16px 32px;
}

.services-category-block {
    max-width: 100%;
}

.services-category {
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 12px;
}

.services-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.service-card {
    flex: 0 0 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 24px 16px;
    border: 1px solid var(--border-light);
    border-radius: 12px;
    background: var(--bg-hover);
    text-decoration: none;
    transition: border-color 0.15s ease, transform 0.15s ease;
}

.service-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.service-card__logo {
    flex: 1 1 auto;
    width: 100%;
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.service-card__logo img {
    max-width: 64px;
    max-height: 64px;
    object-fit: contain;
}

/* Wide wordmark logos: let them span the full card width instead of
   being squeezed into the square 64x64 box (which makes them tiny). */
.service-card__logo--wide img {
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: none;
}

.service-card__name {
    font-weight: 600;
    color: var(--text-primary);
}

.uptime-callout,
.patreon-callout {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 24px;
    padding: 16px 20px;
    border: 1px solid var(--border-light);
    border-radius: 12px;
    background: var(--accent-subtle);
    text-decoration: none;
    transition: border-color 0.15s ease;
}

/* Pink when the visitor isn't a patron, green once they are. The patron
   rule comes after so it wins for an element carrying both classes. */
.patreon-callout {
    background: var(--patreon-bg);
}

.patreon-callout--patron {
    background: var(--success-bg);
}

.uptime-callout:hover,
.patreon-callout:hover {
    border-color: var(--accent);
}

.uptime-callout__logo,
.patreon-callout__logo {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.uptime-callout__logo img,
.patreon-callout__logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.uptime-callout__name,
.patreon-callout__name {
    font-weight: 600;
    color: var(--text-primary);
}

.uptime-callout__note,
.patreon-callout__note {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* On mobile, stack the categories full-width and show 2 cards per row. */
@media (max-width: 768px) {
    .services-category-block {
        width: 100%;
    }

    .services-grid {
        gap: 10px;
    }

    .service-card {
        flex: 0 0 calc(50% - 5px);
        padding: 16px 10px;
    }

    .service-card__logo {
        min-height: 48px;
    }

    .service-card__logo img {
        max-width: 48px;
        max-height: 48px;
    }

    .service-card__logo--wide img {
        max-width: 100%;
    }
}

/* ─── Player Profile ─── */

.profile-header {
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border);
    padding: 14px 20px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}

.profile-header-ranks {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

/* Compact rank cards in the header so they match the progress-block height
   (60px). The 3-line rank-info column is tightened with gap:0 + a tight
   line-height so the card stays at 60px regardless of text length. */
.profile-header-ranks .rank-card {
    height: 60px;
    padding: 6px 12px;
    gap: 10px;
    min-width: auto;
}

.profile-header-ranks .rank-card img {
    width: 36px;
    height: 36px;
}

.profile-header-ranks .rank-info {
    gap: 0;
    line-height: 1.15;
}

.profile-header-ranks .rank-tier {
    font-size: 13px;
}

.profile-header-ranks .rank-elo {
    font-size: 12px;
}

.profile-header-ranks .rank-details {
    font-size: 11px;
}

.profile-identity {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 200px;
}

.profile-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--avatar-from), var(--avatar-to));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-white);
    font-size: 22px;
    font-weight: 700;
    flex-shrink: 0;
    overflow: hidden;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.user-avatar {
    overflow: hidden;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.profile-name {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-white);
}

.profile-stats {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    flex: 1 1 auto;
    justify-content: flex-end;
}

.profile-stats .progress-block {
    max-width: 100%;
    width: 100%;
    flex: 1;
    min-width: 140px;
}

@media (max-width: 768px) {
    .profile-header {
        flex-direction: column;
        padding: 10px 12px;
        gap: 12px;
    }

    .profile-body {
        padding: 10px 12px;
    }

    .profile-stats {
        justify-content: flex-start;
        width: 100%;
        gap: 8px;
    }

    .profile-stats .progress-block {
        flex: 0 0 100%;
        min-width: 0;
    }

    .action-line {
        display: flex;
        flex: 1 1 auto;
        justify-content: center;
    }

    .game-info-grid .game-line,
    .game-info-grid .game-line.game-line-wide,
    .game-info-grid .game-line.game-line-narrow,
    .game-info-grid .progress-block,
    .game-info-grid .progress-block.progress-half,
    .game-info-grid .progress-block.progress-narrow {
        min-width: 0;
        max-width: none;
        flex: 1 1 auto;
    }
}

/* ─── Profile body (tabs + tab content card) ─── */

.profile-body {
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border);
    padding: 14px 20px;
    margin-bottom: 24px;
}

/* ─── Tabs ─── */

.tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0;
    overflow-x: auto;
}

.tab-btn {
    padding: 10px 18px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.tab-content {
    min-height: 200px;
}

/* ─── Player sub-tabs (mod/season filter) ─── */

.player-subtabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
}

.player-subtabs .subtab-btn {
    padding: 6px 14px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.player-subtabs .subtab-btn:hover {
    background: rgba(255,255,255,0.1);
    color: var(--text-primary);
}

.player-subtabs .subtab-btn.active {
    background: var(--accent-subtle);
    border-color: var(--accent);
    color: var(--accent);
}

.player-subtabs .subtab-season {
    opacity: 0.7;
    margin-left: 4px;
    font-size: 11px;
}

.subtab-content {
    min-height: 100px;
}

/* ─── Global stats grid (Games / Crew / Imp / Neutral) ─── */

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

/* ─── Game carousel cards ─── */

.game-card {
    border-radius: 10px;
    margin-bottom: 12px;
    overflow: hidden;
}

.game-card.win { background: rgba(34,197,94,0.13); border-left: 3px solid #22c55e; }
.game-card.loss { background: rgba(239,68,68,0.13); border-left: 3px solid #ef4444; }
.game-card.winner-crew { background: rgba(34,197,94,0.13); border-left: 3px solid #22c55e; }
.game-card.winner-imp { background: rgba(239,68,68,0.13); border-left: 3px solid #ef4444; }
.game-card.winner-neutral { background: rgba(168,85,247,0.13); border-left: 3px solid #a855f7; }

.carousel-menu {
    display: flex;
    gap: 2px;
    padding: 8px 12px;
    overflow-x: auto;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.carousel-menu button,
.carousel-menu a {
    padding: 6px 12px;
    background: rgba(255,255,255,0.1);
    border: none;
    border-radius: var(--radius-sm);
    color: rgba(255,255,255,0.7);
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
    text-decoration: none;
}

.carousel-menu button:hover,
.carousel-menu a:hover {
    background: rgba(255,255,255,0.2);
    color: var(--text-white);
}

.carousel-menu button.active {
    background: rgba(255,255,255,0.25);
    color: var(--text-white);
}

.carousel-viewport {
    overflow: hidden;
}

.carousel-track {
    display: flex;
    transition: transform 0.3s ease;
}

.carousel-page {
    min-width: 100%;
    padding: 16px 20px;
    font-size: 13px;
}

.game-info-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.game-line {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 200px;
    flex: 1 1 200px;
    padding: 10px 10px;
    background: rgba(255,255,255,0.03);
    border-radius: var(--radius-sm);
}

.game-info-grid .progress-block {
    min-width: 300px;
    max-width: 450px;
    flex: 1 1 300px;
    padding: 6px 10px;
    margin-bottom: 0;
}

.game-info-grid .progress-block.progress-half {
    min-width: 150px;
    max-width: 220px;
    flex: 0 1 200px;
}

.game-info-grid .progress-block.progress-narrow {
    min-width: 200px;
    max-width: 300px;
    flex: 1 1 200px;
}

.game-line.game-line-wide {
    min-width: 270px;
    flex: 1 1 270px;
}

.game-line.game-line-narrow {
    min-width: 130px;
    flex: 0 1 160px;
}

.game-info-grid .progress-header {
    margin-bottom: 3px;
}

.game-info-grid .progress-track {
    height: 14px;
}

.game-info-grid .progress-percent {
    font-size: 9px;
}

.game-line-label {
    font-weight: 600;
    color: rgba(255,255,255,0.9);
}

.game-line-value {
    color: rgba(255,255,255,0.7);
}

/* Progress bars */
.progress-block {
    min-width: 140px;
    max-width: 260px;
    background: rgba(255,255,255,0.03);
    border-radius: var(--radius);
    padding: 10px 12px;
    margin-bottom: 6px;
}

.progress-block.full {
    max-width: 100%;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 6px;
    font-size: 12px;
}

.progress-label {
    display: flex;
    align-items: center;
    gap: 5px;
    color: rgba(255,255,255,0.9);
    font-weight: 600;
}

.progress-label svg {
    flex-shrink: 0;
}

.progress-counts {
    color: rgba(255,255,255,0.5);
}

.progress-track {
    position: relative;
    width: 100%;
    height: 18px;
    background: rgba(255,255,255,0.1);
    border-radius: 9px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 9px;
    background: var(--accent);
    transition: width 0.4s ease;
}

.progress-fill.green { background: #22c55e; }
.progress-fill.red { background: #ef4444; }
.progress-fill.purple { background: #a855f7; }

.progress-percent {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-white);
    text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

/* Player list inside game */
.game-player {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 280px;
    padding: 2px 0;
    font-size: 13px;
}

.game-player a {
    text-decoration: underline;
    text-underline-offset: 2px;
}

.game-player .win-icon {
    display: inline-flex;
    color: #fbbf24;
}

.game-player .win-icon svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
    stroke: none;
}

.color-crew { color: #4ade80; }
.color-imp { color: #f87171; }
.color-neutral { color: #c084fc; }

/* Action line inside turn/meeting pages */
.action-line {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-sm);
    white-space: nowrap;
    font-size: 12px;
}

.action-line a {
    text-decoration: underline;
    text-underline-offset: 2px;
}

.actions-flow {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.actions-flow .arrow {
    color: rgba(255,255,255,0.4);
    font-weight: 700;
}

.game-tag {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.7);
}

.game-tag.ranked {
    background: rgba(59,130,246,0.2);
    color: var(--accent-light);
}

/* ─── Stats grid ─── */


/* ─── Stats grid ─── */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

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

.stats-column h3 {
    color: var(--text-white);
    font-size: 16px;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.stat-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-size: 13px;
}

.stat-line-label {
    color: var(--text-muted);
}

.stat-line-value {
    color: var(--text-primary);
    font-weight: 600;
}

/* ─── Roles grid ─── */

.roles-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

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

.roles-grid.two-cols {
    grid-template-columns: 1fr 1fr;
}

.roles-stacked-right {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

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

.roles-column h3 {
    color: var(--text-white);
    font-size: 16px;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.roles-column h3.crewmate { border-bottom-color: #22c55e; }
.roles-column h3.impostor { border-bottom-color: #ef4444; }
.roles-column h3.neutral { border-bottom-color: #a855f7; }

.role-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
}

.role-row:last-child {
    border-bottom: none;
}

.role-name {
    color: var(--text-primary);
    font-weight: 500;
}

.role-stats {
    color: var(--text-muted);
    font-size: 12px;
}

.role-winrate {
    font-weight: 600;
    color: var(--text-white);
    min-width: 40px;
    text-align: right;
}

/* ─── Ranks display ─── */

.ranks-list {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.rank-card {
    background: var(--bg-subtle);
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 220px;
}

.rank-card img {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

.rank-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.rank-tier {
    color: var(--text-white);
    font-weight: 600;
    font-size: 15px;
}

.rank-details {
    color: var(--text-muted);
    font-size: 12px;
}

.rank-elo {
    color: var(--accent-light);
    font-weight: 600;
    font-size: 13px;
}

/* ─── Successes display ─── */

.successes-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.success-item {
    background: var(--bg-subtle);
    border-radius: var(--radius);
    padding: 10px 14px;
    font-size: 13px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 200px;
    max-width: 320px;
}

.success-item img {
    width: 36px;
    height: 36px;
    object-fit: contain;
    flex-shrink: 0;
}

.success-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
}

.success-name {
    font-weight: 600;
    color: var(--text-white);
}

.success-desc {
    font-size: 11px;
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ─── Loader ─── */

.loader {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    display: none;
}

.loader.visible {
    display: block;
}

/* ─── Locale Switcher ─── */

.locale-switcher {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 6px 12px;
    justify-content: center;
    align-items: center;
}

.locale-link {
    display: inline-flex;
    border-radius: 4px;
    padding: 2px;
    transition: opacity 0.2s, transform 0.2s;
    opacity: 0.5;
    text-decoration: none;
}

.locale-link img {
    width: 24px;
    height: 16px;
    object-fit: cover;
    border-radius: 2px;
    display: block;
}

.locale-link:hover {
    opacity: 1;
    transform: scale(1.15);
}

.locale-link.active {
    opacity: 1;
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.locale-extra {
    display: none;
}

.locale-switcher.expanded .locale-extra {
    display: inline-flex;
}

.locale-expand {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 20px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: transparent;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s, background 0.2s;
    padding: 0;
}

.locale-expand:hover {
    opacity: 1;
    background: var(--bg-hover);
}

.locale-switcher.expanded .locale-expand {
    display: none;
}

/* ─── Sidebar Legal Links ─── */

.sidebar-legal {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2px 8px;
    padding: 4px 10px 2px;
    font-size: 9px;
    line-height: 1.3;
    text-align: center;
}

.sidebar-legal a {
    color: var(--text-muted);
    text-decoration: none;
    opacity: 0.8;
}

.sidebar-legal a:hover {
    color: var(--accent-light);
    opacity: 1;
    text-decoration: underline;
}

/* ─── Legal Pages ─── */

.legal-page {
    max-width: 900px;
    margin: 0 auto;
    line-height: 1.7;
}

.legal-page h1 {
    margin-top: 0;
}

.legal-page p {
    margin-bottom: 1em;
}

.legal-page .legal-back {
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
    margin-bottom: 1.2em;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9em;
}

.legal-page .legal-back:hover {
    color: var(--accent-light);
}

.legal-page .legal-back svg {
    width: 1.1em;
    height: 1.1em;
}

.legal-page h2 {
    margin-top: 1.8em;
    color: var(--accent-light);
}

.legal-page h3 {
    margin-top: 1.2em;
    color: var(--text-secondary);
    font-size: 1em;
}

.legal-page ul {
    padding-left: 1.4em;
}

.legal-page li {
    margin-bottom: 0.35em;
}

.legal-page a {
    color: var(--accent);
    text-decoration: underline;
}

.legal-page code {
    background: var(--bg-subtle);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}

.legal-updated {
    color: var(--text-muted);
    font-size: 0.9em;
    margin-top: -0.5em;
}

/* ─── Sidebar Credits ─── */

.sidebar-credits {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2px 16px 4px;
    font-size: 10px;
    color: var(--text-muted);
    opacity: 0.6;
    line-height: 1.35;
    text-align: center;
}

/* ─── Site Switcher ─── */

.site-switcher {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 0 0 6px;
    margin-bottom: 6px;
    border-bottom: 1px solid var(--border-light);
}

.site-switcher a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
    color: var(--text-muted);
}

.site-switcher a:hover {
    background: var(--bg-hover);
    color: var(--accent);
}

.site-switcher a img {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    object-fit: contain;
    flex-shrink: 0;
}

/* ─── Nav section label ─── */

.nav-section-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    padding: 12px 12px 4px;
    font-weight: 600;
}

/* ─── Homepage hero ─── */

.hero {
    text-align: center;
    padding: 60px 20px;
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border);
    margin-bottom: 30px;
}

.hero-logo {
    width: 80px;
    height: 80px;
    border-radius: 16px;
    object-fit: contain;
    margin-bottom: 16px;
}

.hero h1 {
    font-size: 36px;
    font-weight: 700;
    color: var(--text-white);
    margin-bottom: 8px;
}

.hero-subtitle {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.hero-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ─── Homepage feature grid ─── */

.features-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 30px;
}

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

.feature-card {
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border);
    padding: 24px;
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.feature-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.feature-icon {
    font-size: 28px;
    margin-bottom: 12px;
}

.feature-card h3 {
    color: var(--text-white);
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

.feature-card p {
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.5;
}

.feature-card ul {
    list-style: none;
    margin-top: 12px;
}

.feature-card ul li {
    color: var(--text-secondary);
    font-size: 14px;
    padding: 4px 0;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.feature-card ul li::before {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    margin-top: 7px;
    flex-shrink: 0;
}

/* ─── Homepage CTA ─── */

.cta-section {
    text-align: center;
    padding: 40px 20px;
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border);
}

.cta-section h2 {
    color: var(--text-white);
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
}

.cta-section p {
    color: var(--text-muted);
    margin-bottom: 20px;
}

/* ─── Teammates tab ─── */

.teammates-scope-title {
    margin: 24px 0 12px;
    font-size: 16px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-white);
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

.teammates-scope-title.crewmate {
    color: #22c55e;
    border-bottom-color: rgba(34, 197, 94, 0.3);
}

.teammates-scope-title.impostor {
    color: #ef4444;
    border-bottom-color: rgba(239, 68, 68, 0.3);
}

.teammates-sections {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 8px;
}

.teammates-section {
    flex: 1 1 320px;
    min-width: 0;
}

.teammates-section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: nowrap;
    min-width: 0;
}

.teammates-section-head h3 {
    margin: 0;
    color: var(--text-white);
    font-size: 15px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.teammates-section-sub {
    color: var(--text-muted);
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}

.teammates-section--wide {
    flex-basis: 100%;
}

.teammates-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.teammate-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 3px 10px 3px 3px;
    border-radius: 999px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    text-decoration: none;
    font-size: 13px;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.teammate-chip:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
}

.teammate-chip .teammate-avatar {
    width: 24px;
    height: 24px;
    font-size: 11px;
    grid-row: auto;
}

.teammate-chip-name {
    color: var(--text-white);
    font-weight: 600;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.teammate-chip-count {
    color: var(--text-muted);
    font-size: 11px;
    padding-left: 8px;
    border-left: 1px solid var(--border);
}

.teammates-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.teammates-list--inline {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
}

.teammates-list--inline .teammate-row {
    flex: 1 1 260px;
    max-width: 360px;
}

.teammate-row {
    display: grid;
    grid-template-columns: 32px 1fr;
    grid-template-rows: auto auto;
    align-items: center;
    gap: 2px 10px;
    padding: 6px 10px;
    border-radius: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    text-decoration: none;
    transition: background 0.15s ease, border-color 0.15s ease;
    min-width: 0;
}

.teammate-row:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
}

.teammate-avatar {
    grid-row: span 2;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--avatar-from), var(--avatar-to));
    color: var(--text-white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
    overflow: hidden;
}

.teammate-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.teammate-name {
    grid-column: 2;
    font-weight: 600;
    color: var(--text-white);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    font-size: 13px;
    line-height: 1.2;
}

.teammate-progress {
    grid-column: 2;
    min-width: 0;
}

.teammate-progress .progress-block {
    margin: 0;
    padding: 0;
    background: transparent;
    min-width: 0;
    max-width: none;
}

.teammate-progress .progress-header {
    margin-bottom: 4px;
}

.teammate-progress .progress-counts {
    font-size: 11px;
    margin-left: auto;
}

/* ─── Sidebar player search / autocomplete ─── */

.player-search {
    margin: 12px 0 0;
    padding-top: 0;
}

.player-search-input-wrap {
    position: relative;
}

.player-search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    stroke: var(--text-muted);
    fill: none;
    stroke-width: 1.8;
    pointer-events: none;
}

.player-search-input {
    width: 100%;
    padding: 8px 10px 8px 32px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.player-search-input::placeholder {
    color: var(--text-muted);
}

.player-search-input:focus {
    border-color: var(--accent);
    background: var(--bg-hover);
}

.player-search-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    z-index: 1000;
    overflow: hidden;
}

.player-search-dropdown[hidden] {
    display: none;
}

.player-search-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s ease, color 0.15s ease;
}

.player-search-item:last-child {
    border-bottom: none;
}

.player-search-item:hover,
.player-search-item.is-active {
    background: var(--bg-hover);
    color: var(--accent);
}

.player-search-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--avatar-from) 0%, var(--avatar-to) 100%);
    color: var(--text-white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
    overflow: hidden;
}

.player-search-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.player-search-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.player-search-empty {
    padding: 10px;
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
}

.player-search-history {
    margin-top: 8px;
}

.player-search-history[hidden] {
    display: none;
}

.player-search-history-header {
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    padding: 4px 10px;
}

.player-search-history-list {
    display: flex;
    flex-direction: column;
}

.player-search-history-item {
    border-bottom: none;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
}

.player-search-history-item .player-search-avatar {
    width: 20px;
    height: 20px;
    font-size: 11px;
}

/* ─── Condensed sidebar spacing (mobile) ───
 * Declared at the end of the file so these rules win over the base
 * definitions (.site-switcher, .locale-*, .sidebar-credits, .player-search*)
 * which live later in the source than the @media block at line ~497.
 */
@media (max-width: 768px) {
    .sidebar {
        padding: 6px 10px 8px;
    }

    .sidebar-header {
        padding: 2px 0 4px 8px;
        margin-bottom: 6px;
    }
    .sidebar-header h1 {
        font-size: 16px;
    }
    .sidebar-header a img {
        width: 26px !important;
        height: 26px !important;
    }

    .site-switcher {
        gap: 0;
        padding: 0 0 4px;
        margin-bottom: 4px;
    }
    .site-switcher a {
        padding: 5px 8px;
        font-size: 12px;
    }
    .site-switcher a img {
        width: 16px;
        height: 16px;
    }

    .sidebar-nav a {
        padding: 5px 8px;
        margin-bottom: 1px;
        font-size: 13px;
        gap: 8px;
    }
    .sidebar-nav a svg,
    .sidebar-nav a .nav-logo {
        width: 16px;
        height: 16px;
    }

    .player-search {
        margin-top: 4px;
        padding-top: 0;
    }
    .player-search-input {
        padding: 6px 10px 6px 30px;
        font-size: 12px;
    }
    .player-search-icon {
        width: 14px;
        height: 14px;
    }
    .player-search-history {
        margin-top: 4px;
    }
    .player-search-history-header {
        padding: 2px 8px;
    }
    .player-search-item {
        padding: 5px 8px;
        font-size: 12px;
    }
    .player-search-history-item {
        padding: 4px 8px;
    }
    .player-search-avatar {
        width: 20px;
        height: 20px;
        font-size: 11px;
    }
    .player-search-history-item .player-search-avatar {
        width: 18px;
        height: 18px;
        font-size: 10px;
    }

    .sidebar-footer {
        padding-top: 6px;
    }
    .user-info {
        padding: 8px;
        margin-bottom: 4px;
    }
    .user-header {
        gap: 8px;
        margin-bottom: 2px;
    }
    .user-avatar {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
    .user-name {
        font-size: 13px;
    }
    .user-role {
        font-size: 9px;
        padding: 1px 6px;
        margin-bottom: 6px;
        margin-left: 36px;
    }
    .user-actions {
        gap: 4px;
    }
    .user-actions a {
        padding: 6px 8px;
        font-size: 11px;
        gap: 4px;
    }
    .user-actions a svg {
        width: 12px;
        height: 12px;
    }

    .locale-switcher {
        padding: 6px 0;
        gap: 4px;
    }
    .locale-link img {
        width: 18px;
        height: 12px;
    }

    .sidebar-credits {
        padding: 4px 8px;
        font-size: 9px;
        line-height: 1.3;
    }
}

/* ─── Avatar editor (account page) ─── */

.avatar-editor {
    display: flex;
    gap: 24px;
    align-items: center;
    flex-wrap: wrap;
}

.avatar-preview {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--avatar-from), var(--avatar-to));
    border: 2px solid var(--border-light);
}

.avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.avatar-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-white);
    font-size: 48px;
    font-weight: 700;
}

.avatar-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 220px;
}

.avatar-hint {
    color: var(--text-muted);
    font-size: 13px;
    margin: 0;
}

.avatar-form label.btn {
    cursor: pointer;
    display: inline-block;
}

.avatar-form label.btn input[type="file"] {
    display: none;
}

/* ─── Legal hub ─── */

.legal-hub__english-only {
    margin-top: 8px;
    margin-bottom: 24px;
    font-size: 14px;
}

.legal-hub-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-top: 8px;
}

.legal-hub-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    border-radius: var(--radius);
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.2s ease;
}

.legal-hub-card:hover {
    background: var(--bg-hover);
    border-color: var(--border-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.legal-hub-card__icon {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: var(--accent-subtle);
    color: var(--accent);
}

.legal-hub-card__icon svg {
    width: 22px;
    height: 22px;
}

.legal-hub-card__title {
    font-weight: 500;
    font-size: 15px;
    color: var(--text-white);
}

/* ─── Cookie information banner ─── */

.cookie-banner {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9998;
    background: var(--bg-sidebar);
    border-top: 1px solid var(--border-light);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.35);
    padding: 14px 20px;
}

.cookie-banner[hidden] {
    display: none;
}

.cookie-banner__inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.cookie-banner__text {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
}

.cookie-banner__icon {
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    color: var(--accent);
    margin-top: 2px;
}

.cookie-banner__text a {
    color: var(--accent-light);
    text-decoration: underline;
}

.cookie-banner__text a:hover {
    color: var(--accent);
}

.cookie-banner__accept {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 10px 18px;
}

@media (max-width: 640px) {
    .cookie-banner {
        padding: 12px 14px;
    }

    .cookie-banner__inner {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .cookie-banner__accept {
        width: 100%;
    }
}

/* ─── Blog ─── */
.blog-header {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px 28px;
    margin: 0 0 24px;
}
.blog-header h1 {
    margin: 0 0 8px;
    font-size: 1.75rem;
}
.blog-header p {
    margin: 0;
    color: var(--text-muted);
}

.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.blog-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: transform .15s ease, border-color .15s ease;
}
.blog-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent, #3b82f6);
}

.blog-card-cover {
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: rgba(255,255,255,0.04);
    display: flex;
    align-items: center;
    justify-content: center;
}
.blog-card-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.blog-card-cover-placeholder svg {
    width: 48px;
    height: 48px;
    color: var(--text-muted);
}

.blog-card-body {
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    flex: 1;
}
.blog-card-title {
    margin: 0 0 8px;
    font-size: 1.15rem;
    line-height: 1.3;
}
.blog-card-excerpt {
    margin: 0 0 12px;
    color: var(--text-muted);
    font-size: 0.92rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.blog-card-meta {
    margin-top: auto;
    display: flex;
    gap: 12px;
    color: var(--text-muted);
    font-size: 0.82rem;
}

/* ─── Blog post (show) — full-width themed page ───
 * The article is rendered as two stacked full-bleed sections:
 *   .blog-post-hero  → themed gradient backdrop with the cover image,
 *                      title and meta (cover is constrained, hero is full-width)
 *   .blog-post-body  → themed wash background with the prose centered
 *                      inside `.blog-post-content` at a readable 760px
 * Theme backgrounds are switched via `[data-theme="…"]` on <body> so the
 * 3 sites get visually distinct article pages. Fallback (no data-theme
 * or `goodloss`) uses the blue/purple palette.
 */
.blog-post {
    width: 100%;
}

.blog-post-hero {
    position: relative;
    width: 100%;
    padding: 40px 24px 60px;
    background:
        radial-gradient(circle at 20% 20%, rgba(59, 130, 246, 0.22) 0%, transparent 55%),
        radial-gradient(circle at 80% 60%, rgba(168, 85, 247, 0.18) 0%, transparent 55%),
        linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
}
[data-theme="ranked"] .blog-post-hero {
    background:
        radial-gradient(circle at 20% 20%, rgba(245, 158, 11, 0.25) 0%, transparent 55%),
        radial-gradient(circle at 80% 60%, rgba(251, 146, 60, 0.20) 0%, transparent 55%),
        radial-gradient(circle at 50% 100%, rgba(234, 88, 12, 0.12) 0%, transparent 60%),
        linear-gradient(135deg, #0c0a09 0%, #1c1917 50%, #292524 100%);
}
[data-theme="oriana"] .blog-post-hero {
    background:
        radial-gradient(circle at 20% 20%, rgba(168, 85, 247, 0.25) 0%, transparent 55%),
        radial-gradient(circle at 80% 60%, rgba(236, 72, 153, 0.20) 0%, transparent 55%),
        radial-gradient(circle at 50% 100%, rgba(124, 58, 237, 0.12) 0%, transparent 60%),
        linear-gradient(135deg, #1a1025 0%, #2d1f3d 50%, #1a1025 100%);
}

.blog-post-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(180deg, transparent 70%, rgba(0,0,0,0.35) 100%);
}

.blog-post-hero-inner {
    position: relative;
    z-index: 1;
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 32px;
}

.blog-post-cover {
    flex: 0 0 240px;
    width: 240px;
    height: 160px;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0,0,0,0.45);
    background: rgba(0,0,0,0.2);
}
.blog-post-cover img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.blog-post-headline {
    flex: 1;
    min-width: 0;
}

.blog-post-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 14px;
}

.blog-post-title {
    font-size: 2.2rem;
    line-height: 1.15;
    margin: 0;
    color: #fff;
    letter-spacing: -0.5px;
    flex: 1;
    min-width: 0;
}

.blog-back {
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 0.9rem;
    white-space: nowrap;
    padding-top: 8px;
    flex-shrink: 0;
}
.blog-back:hover {
    color: #fff;
}

.blog-post-meta {
    display: flex;
    gap: 16px;
    color: rgba(255,255,255,0.65);
    font-size: 0.95rem;
}

.blog-post-body {
    position: relative;
    width: 100%;
    padding: 56px 24px 80px;
    background:
        linear-gradient(180deg, rgba(59, 130, 246, 0.04) 0%, transparent 200px),
        var(--bg-body);
}
[data-theme="ranked"] .blog-post-body {
    background:
        linear-gradient(180deg, rgba(245, 158, 11, 0.05) 0%, transparent 200px),
        var(--bg-body);
}
[data-theme="oriana"] .blog-post-body {
    background:
        linear-gradient(180deg, rgba(168, 85, 247, 0.06) 0%, transparent 200px),
        var(--bg-body);
}

.blog-post-content {
    max-width: 1280px;
    margin: 0 auto;
    line-height: 1.75;
    color: var(--text-secondary);
    font-size: 1.05rem;
}
.blog-post-content p { margin: 0 0 1em; }
.blog-post-content h2 { font-size: 1.6rem; margin: 1.8em 0 .6em; color: var(--text-primary); }
.blog-post-content h3 { font-size: 1.25rem; margin: 1.5em 0 .5em; color: var(--text-primary); }
.blog-post-content ul, .blog-post-content ol { margin: 0 0 1em 1.5em; }
.blog-post-content li { margin: 0 0 .4em; }
.blog-post-content blockquote { border-left: 3px solid var(--accent); padding-left: 14px; margin: 1em 0; color: var(--text-muted); }
.blog-post-content a { color: var(--accent); }
.blog-post-content img { max-width: 100%; height: auto; border-radius: 8px; margin: 1em 0; }
.blog-post-content pre { background: rgba(0,0,0,0.3); padding: 14px; border-radius: 8px; overflow-x: auto; }
.blog-post-content code { background: rgba(0,0,0,0.3); padding: 2px 5px; border-radius: 4px; font-size: 0.9em; }

@media (max-width: 860px) {
    .blog-post-hero-inner {
        flex-direction: column;
        align-items: stretch;
        text-align: left;
        gap: 20px;
    }
    .blog-post-cover {
        flex: 0 0 auto;
        width: 100%;
        max-width: 480px;
        height: auto;
        aspect-ratio: 16 / 10;
        margin: 0 auto;
    }
    .blog-post-title-row {
        flex-direction: column;
        gap: 10px;
    }
    .blog-back {
        padding-top: 0;
    }
}

@media (max-width: 640px) {
    .blog-post-hero { padding: 24px 16px 40px; }
    .blog-post-title { font-size: 1.7rem; }
    .blog-post-body { padding: 36px 16px 56px; }
    .blog-post-content { font-size: 1rem; }
}

/* ─── PWA install button (sidebar footer) ─── */
.pwa-install {
    margin: 0 0 12px;
}
.pwa-install-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 9px 12px;
    background: var(--accent-subtle);
    color: var(--accent-light);
    border: 1px solid rgba(59, 130, 246, 0.35);
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.pwa-install-btn:hover {
    background: var(--accent);
    color: var(--text-white);
    border-color: var(--accent);
}
.pwa-install-btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}
.pwa-ios-hint {
    margin: 8px 0 0;
    padding: 9px 11px;
    background: var(--bg-subtle);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 0.78rem;
    line-height: 1.45;
}
