:root {
    --bg: #0d0909;
    --bg-card: #1a0f0f;
    --bg-input: #0d0909;
    --border: #2a1515;
    --border-light: rgba(42,21,21,0.5);
    --primary: #c62828;
    --primary-hover: #e53935;
    --accent: #ff5252;
    --text: #d4c0c0;
    --text-muted: #807070;
    --text-bright: #f0e0e0;
    --danger: #b71c1c;
    --green: #2e7d32;
    --gold: #ffd700;
    --silver: #c0c0c0;
    --bronze: #cd7f32;
}

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

* { cursor: default; }

a, button, [role="button"], select, label, input[type="checkbox"], input[type="radio"], summary, [onclick] {
    cursor: pointer;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), textarea, [contenteditable="true"] {
    cursor: text;
}

button:disabled, select:disabled, input:disabled, [disabled] {
    cursor: not-allowed;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

header {
    background: linear-gradient(135deg, #1a0f0f 0%, #0d0909 100%);
    border-bottom: 2px solid var(--primary);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

header h1, .app-header h1 {
    color: var(--primary);
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 1px;
}

header h1 span, .app-header h1 span {
    color: var(--text-bright);
    font-weight: 300;
}

header a {
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
}

header a:hover { color: var(--accent); }

.app-header {
    background: linear-gradient(135deg, #1a0f0f 0%, #0d0909 100%);
    border-bottom: 2px solid var(--primary);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

.app-header .brand { display:flex; align-items:center; gap:16px; }

.app-header .brand a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13px;
    transition: color 0.2s;
}

.app-header .brand a:hover { color: var(--accent); }

.lang-switch {
    position: relative;
    display: inline-block;
}

.lang-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 4px 6px;
    border-radius: 3px;
    opacity: 0.45;
    filter: grayscale(100%);
    transition: all 0.2s;
}

.lang-btn:hover { opacity: 0.8; filter: grayscale(20%); }

.lang-btn.active {
    opacity: 1;
    filter: none;
    background: var(--bg-card);
    box-shadow: 0 0 0 1px var(--primary);
}

/* LANG switcher: a single "LANG" button with a dropdown of native names. */
.lang-toggle {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    padding: 5px 11px;
    border-radius: 4px;
    cursor: pointer;
    transition: border-color .15s, color .15s;
}
.lang-toggle:hover { border-color: var(--primary); color: var(--accent); }
.lang-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 100;
    display: none;
    flex-direction: column;
    min-width: 150px;
    max-height: 60vh;
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}
.lang-menu.open { display: flex; }
.lang-item {
    background: transparent;
    border: none;
    text-align: left;
    padding: 8px 14px;
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
    white-space: nowrap;
}
.lang-item:hover { background: rgba(198, 40, 40, 0.12); color: var(--text-bright); }
.lang-item.active { color: var(--accent); font-weight: 700; }

/* Feedback form */
.feedback-form {
    max-width: 620px;
    margin-top: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.feedback-form .form-group { display: flex; flex-direction: column; gap: 6px; margin: 0; }
.feedback-form label { font-size: 13px; color: var(--text-muted); }
.feedback-form input[type="email"],
.feedback-form textarea {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    padding: 10px 12px;
    font-size: 14px;
    font-family: inherit;
    width: 100%;
}
.feedback-form textarea { resize: vertical; min-height: 120px; }
.feedback-form input[type="file"] { color: var(--text-muted); font-size: 13px; }
.feedback-submit {
    align-self: flex-start;
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 10px 24px;
    cursor: pointer;
}
.feedback-submit:disabled { opacity: 0.6; cursor: default; }
.feedback-status { font-size: 13px; min-height: 18px; margin: 0; }
.feedback-status.ok { color: var(--green); }
.feedback-status.err { color: var(--accent); }

.app-nav {
    display: flex;
    gap: 4px;
}

.app-nav button {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 8px 18px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
}

.app-nav button:hover { border-color: var(--primary); color: var(--accent); }

.app-nav button.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}

.page { display: none; }
.page.active { display: block; }

.stats-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    align-items: start;
}

.stats-layout.has-friends {
    grid-template-columns: 220px 1fr;
}

.stats-main { min-width: 0; }

.back-to-me-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    background: var(--bg-card);
    border: 1px solid var(--accent);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 20px;
    font-size: 13px;
    color: var(--text);
}

.back-to-me-banner .btn-sm {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 8px 14px;
    cursor: pointer;
}
.back-banner-text { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.back-banner-player {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-weight: 700;
    color: var(--text-bright);
}
.back-banner-player img {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border);
}

.friends-col {
    min-width: 0;
    align-self: stretch;
}

.friends-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    position: sticky;
    top: 16px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
}

.friends-panel h3 {
    color: var(--accent);
    font-size: 15px;
    margin: 0 0 12px;
}

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

.friend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s;
    user-select: none;
    border: 1px solid transparent;
}

.friend-item,
.friend-item * {
    cursor: pointer;
}

.friend-item:hover { background: var(--bg-input); }

.friend-item.active {
    background: linear-gradient(135deg, rgba(198, 40, 40, 0.28), rgba(198, 40, 40, 0.10));
    border: 1px solid var(--accent);
    box-shadow: inset 3px 0 0 var(--accent);
}

.friend-item.active .friend-name { color: var(--accent); }

.friend-item img,
.friend-item .friend-avatar-fallback {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid var(--border);
    flex-shrink: 0;
}

.friend-item .friend-avatar-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-input);
    font-size: 10px;
    color: var(--text-muted);
}

.friend-item .friend-meta { min-width: 0; }

.friend-item .friend-name {
    font-size: 13px;
    color: var(--text-bright);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.friend-item .friend-elo {
    font-size: 11px;
    color: var(--text-muted);
}

.friends-empty {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}

.group-block {
    margin-bottom: 14px;
}

.group-block:last-child { margin-bottom: 0; }

.group-block-name {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--accent);
    padding: 0 4px 6px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 6px;
}

@media (max-width: 820px) {
    .stats-layout,
    .stats-layout.has-friends { grid-template-columns: 1fr; }
    .friends-col { align-self: auto; }
    .friends-panel { position: static; max-height: none; }
}

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

.card h2 {
    color: var(--accent);
    font-size: 18px;
    margin-bottom: 16px;
}

.card h3 {
    color: var(--text-bright);
    font-size: 15px;
    margin-bottom: 10px;
}

.section-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 16px 0 10px;
    opacity: .6;
}

.section-note {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.55;
    margin: 0;
}

.form-group { margin-bottom: 12px; }

.form-group label {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

input, select {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

input:focus, select:focus { border-color: var(--primary); }

button {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

button:hover { background: var(--primary-hover); }

button:disabled { opacity: 0.4; cursor: not-allowed; }

button.secondary {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

button.secondary:hover { border-color: var(--primary); color: var(--accent); }

button.danger { background: var(--danger); }
button.danger:hover { background: #e53935; }

.btn-sm { padding: 6px 12px; font-size: 12px; }

.metric-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.metric-tabs .metric-tab { flex: 0 0 auto; }

table { width: 100%; border-collapse: collapse; }

th, td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

th {
    color: var(--accent);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Keep the parameter name column visible while the table scrolls sideways */
.results-table-wrap table th:first-child,
.results-table-wrap table td:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
}

.results-table-wrap table thead th:first-child {
    z-index: 3;
}

.results-table-wrap th {
    white-space: nowrap;
}

tr:hover td { background: rgba(198,40,40,0.05); }

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.badge-elo {
    background: var(--primary);
    color: #fff;
}

.player-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.player-header img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--primary);
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

.empty-state p { margin-bottom: 8px; }

/* ========== LOADING ========== */

.loading-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 60px 20px;
    text-align: center;
}

.loading-wrap .spinner {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 4px solid rgba(255, 82, 82, 0.15);
    border-top-color: var(--accent);
    animation: histats-spin 0.9s linear infinite;
}

.loading-wrap .spinner-inner {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 3px solid rgba(198, 40, 40, 0.15);
    border-bottom-color: var(--primary);
    animation: histats-spin 1.3s linear infinite reverse;
}

.loading-wrap .loading-label {
    color: var(--text-muted);
    font-size: 14px;
}

.loading-wrap .loading-note {
    color: var(--text-muted);
    opacity: .7;
    font-size: 12px;
    margin-top: 6px;
}

.loading-wrap .loading-dots::after {
    content: '';
    animation: histats-dots 1.4s steps(4, end) infinite;
}

.loading-wrap .loading-wait {
    max-width: 340px;
    padding: 12px 18px;
    border-radius: 12px;
    border: 1px solid rgba(255, 82, 82, 0.25);
    background: linear-gradient(135deg, rgba(198, 40, 40, 0.12) 0%, rgba(198, 40, 40, 0.05) 100%);
    color: var(--text);
    font-size: 13px;
    line-height: 1.55;
    animation: histats-wait-in 0.5s ease both, histats-wait-pulse 2.4s ease-in-out infinite 0.6s;
}

.loading-wrap .loading-wait-title {
    color: var(--accent);
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 2px;
}

@keyframes histats-wait-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes histats-wait-pulse {
    0%, 100% { border-color: rgba(255, 82, 82, 0.25); }
    50% { border-color: rgba(255, 82, 82, 0.7); }
}

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

@keyframes histats-dots {
    0% { content: ''; }
    25% { content: '.'; }
    50% { content: '..'; }
    75% { content: '...'; }
    100% { content: ''; }
}

/* ========== LANDING PAGE ========== */

.landing-hero {
    text-align: center;
    padding: 80px 24px 60px;
    background: radial-gradient(ellipse at center top, rgba(198,40,40,0.08) 0%, transparent 60%);
}

.landing-hero h1 {
    font-size: 48px;
    font-weight: 800;
    color: var(--text-bright);
    margin-bottom: 16px;
}

.landing-hero h1 span { color: var(--accent); }

.landing-hero p {
    font-size: 18px;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto 32px;
    line-height: 1.6;
}

.landing-hero .btn-cta {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    padding: 14px 40px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 700;
    text-decoration: none;
    transition: transform 0.2s, box-shadow 0.2s;
}

.landing-hero .btn-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(198,40,40,0.4);
}

.btn-bot {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, #2AABEE 0%, #229ED9 100%);
    color: #fff;
    padding: 14px 32px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 16px rgba(42,171,238,0.3);
}

.btn-bot:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(42,171,238,0.5);
}

.btn-bot svg {
    width: 22px;
    height: 22px;
}

.landing-section {
    padding: 60px 24px;
    max-width: 1100px;
    margin: 0 auto;
}

.landing-section:nth-child(even) {
    background: rgba(198,40,40,0.02);
    border-top: 1px solid rgba(198,40,40,0.06);
    border-bottom: 1px solid rgba(198,40,40,0.06);
}

.landing-section .content {
    display: flex;
    align-items: center;
    gap: 60px;
}

.landing-section .content.reverse { flex-direction: row-reverse; }

.landing-section .text { flex: 1; }

.landing-section .text h2 {
    font-size: 28px;
    color: var(--text-bright);
    margin-bottom: 12px;
}

.landing-section .text h2 span { color: var(--accent); }

.landing-section .text p {
    font-size: 15px;
    color: var(--text-muted);
    line-height: 1.7;
    margin-bottom: 16px;
    text-align: justify;
    text-justify: inter-word;
}

.landing-section .text .step {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 4px;
    margin-bottom: 8px;
}

.zone-poor { color: #a83232; font-weight: 600; }
.zone-bad { color: var(--danger); font-weight: 600; }
.zone-awesome { color: var(--gold); font-weight: 600; }
.hl { color: var(--gold); font-weight: 700; }

/* CSS illustrations */
.illustration { flex: 1; min-width: 300px; }

.illu-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.illu-card .illu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.illu-card .illu-header .title {
    color: var(--accent);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.illu-card .illu-header .badge {
    background: var(--border);
    color: var(--text-muted);
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 12px;
}

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

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

.illu-row .label { color: var(--text-muted); }

.illu-row .value {
    color: var(--text-bright);
    font-weight: 600;
    text-align: right;
    min-width: 60px;
}

.illu-row .value.good { color: var(--green); }

.illu-row .bar-wrap {
    flex: 1;
    max-width: 140px;
    margin-left: 16px;
}

.illu-bar {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}

.illu-bar .fill {
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
}

.illu-perf-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    align-items: center;
}

.illu-perf-bars .illu-row { font-size: 12px; }

.illu-perf-bars .illu-row .value { font-size: 12px; min-width: 44px; }

.illu-perf-bars .bar-wrap { max-width: none; margin-left: 12px; }

.illu-perf-radar svg {
    display: block;
    width: 100%;
    max-width: 230px;
    margin: 0 auto;
}

.illi-ring {
    fill: none;
    stroke: var(--text-muted);
    stroke-width: 1;
    opacity: 0.5;
}

.illi-spoke {
    stroke: var(--text-muted);
    stroke-width: 1;
    opacity: 0.35;
}

.illi-shape {
    fill: var(--accent);
    fill-opacity: 0.15;
    stroke: var(--accent);
    stroke-width: 2;
}

.illi-dot {
    fill: var(--accent);
    stroke: rgba(255, 255, 255, 0.85);
    stroke-width: 0.8;
}

.illi-label {
    font-size: 8px;
    fill: var(--text-muted);
    font-weight: 600;
}

.illu-legend {
    margin-top: 14px;
    padding-top: 10px;
    border-top: 1px solid var(--border-light);
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 0.3px;
}

.illu-avatars {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: center;
    padding: 16px 0;
}

.illu-avatar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.illu-avatar .av-box {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    color: var(--text-muted);
    background: var(--bg-input);
    text-align: center;
    line-height: 1.2;
    overflow: hidden;
}

.illu-avatar .av-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.illu-avatar .name { font-size: 11px; color: var(--text-muted); }

.illu-avatar .elo {
    font-size: 10px;
    color: var(--accent);
    font-weight: 700;
}

.illu-compare-table { width: 100%; }

.illu-compare-table th {
    font-size: 11px;
    padding: 8px 10px;
    text-align: center;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}

.illu-compare-table th:first-child { text-align: left; }

.illu-compare-table td {
    font-size: 13px;
    padding: 8px 10px;
    text-align: center;
    border-bottom: 1px solid var(--border-light);
    color: var(--text);
}

.illu-compare-table td:first-child {
    text-align: left;
    color: var(--text-muted);
    font-weight: 500;
}

.illu-compare-table .highlight { background: rgba(198,40,40,0.08); }

.illu-compare-table .best {
    color: var(--green);
    font-weight: 700;
}

.illu-podium {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 24px;
    padding: 24px 0 16px;
}

.illu-podium-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.illu-podium-item .medal { font-size: 32px; }

.illu-podium-item .bar {
    width: 64px;
    border-radius: 6px 6px 0 0;
}

.illu-podium-item .bar.gold { height: 90px; background: linear-gradient(180deg, var(--gold), #b8860b); }
.illu-podium-item .bar.silver { height: 70px; background: linear-gradient(180deg, var(--silver), #808080); }
.illu-podium-item .bar.bronze { height: 50px; background: linear-gradient(180deg, var(--bronze), #8b4513); }

.illu-podium-item .p-name { font-size: 12px; color: var(--text); font-weight: 600; }
.illu-podium-item .p-val { font-size: 12px; color: var(--accent); font-weight: 700; }

.landing-cta {
    text-align: center;
    padding: 80px 24px;
}

.landing-cta h2 { font-size: 32px; color: var(--text-bright); margin-bottom: 16px; }

.landing-cta p { color: var(--text-muted); margin-bottom: 32px; font-size: 16px; }

.landing-cta .btn-cta {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    padding: 16px 48px;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 700;
    text-decoration: none;
    transition: transform 0.2s, box-shadow 0.2s;
}

.landing-cta .btn-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(198,40,40,0.4);
}

footer.landing-footer {
    text-align: center;
    padding: 32px 24px;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 13px;
}

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

.site-footer .powered {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 8px;
    font-size: 13px;
}

.site-footer .powered svg { flex-shrink: 0; }

.site-footer .powered img.powered-logo {
    flex-shrink: 0;
    height: 33px;
    width: auto;
    border-radius: 4px;
}

.site-footer a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
}

.site-footer a:hover { color: var(--accent); }

/* ========== STATS CARD (like landing page) ========== */

.stats-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.stats-card .stats-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.stats-card .stats-card-header .title {
    color: var(--accent);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stats-card .stats-card-header .stats-card-subtitle {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 500;
    text-align: right;
}
.stats-card .stats-card-header .stats-card-subtitle-compare {
    color: var(--text-muted);
    opacity: .75;
    font-size: 11px;
}
.stat-delta {
    font-size: 10px;
    font-weight: 700;
    margin-left: 5px;
    white-space: nowrap;
    vertical-align: middle;
}
.stat-delta.up { color: var(--green); }
.stat-delta.down { color: var(--danger); }

/* ========== DEMO APP SPECIFIC ========== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.stat-box {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    text-align: center;
}

.stat-box .stat-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-bright);
}

.stat-box .stat-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.stat-box .stat-value.good { color: var(--green); }
.stat-box .stat-value.warn { color: var(--accent); }

.stats-rows {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 20px;
}

.perf-split {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 0;
    align-items: center;
}

.perf-split .stats-rows {
    margin-bottom: 0;
    padding-right: 32px;
}

.perf-split .radar-wrap {
    padding-left: 36px;
    border-left: 1px solid var(--border-light);
}

.radar-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
}

.radar-wrap .radar-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 100%;
    position: relative;
}

.radar-wrap .radar {
    width: 100%;
    height: auto;
    display: block;
}

.radar-caption {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-muted);
    opacity: 0.8;
    text-align: center;
    width: 100%;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border-light);
}

.radar-caption-center {
    margin-top: 10px;
    width: auto;
    padding: 3px 10px;
    border-top: none;
    border-radius: 4px;
    background: var(--bg-card);
    white-space: nowrap;
    font-size: 11px;
    opacity: 0.9;
}

.radar-ring {
    fill: none;
    stroke: var(--text-muted);
    stroke-width: 1;
    opacity: 0.55;
}

.radar-ring-outer { stroke: var(--text-muted); opacity: 0.9; }

.radar-spoke {
    stroke: var(--text-muted);
    stroke-width: 1;
    opacity: 0.45;
}

.radar-shape {
    fill: var(--accent);
    fill-opacity: 0.14;
    stroke: var(--accent);
    stroke-width: 2.5;
    stroke-linejoin: round;
}

.radar-dot {
    stroke: rgba(255, 255, 255, 0.85);
    stroke-width: 1;
}

.radar-label {
    font-size: 8px;
    font-weight: 600;
    fill: var(--text-muted);
    letter-spacing: 0.3px;
}

.radar-value {
    font-size: 5.5px;
    font-weight: 700;
    fill: var(--text-bright);
    letter-spacing: 0;
    paint-order: stroke;
    stroke: var(--bg-card);
    stroke-width: 2px;
}

.stat-row {
    display: grid;
    grid-template-columns: 110px 1fr 94px;
    align-items: center;
    gap: 12px;
}

.stat-row-label {
    font-size: 12px;
    color: var(--text-muted);
    text-align: left;
}

.stat-row-hint {
    font-size: 8px;
    color: var(--text-muted);
    opacity: .7;
    line-height: 1.3;
    margin-top: 1px;
}

.rating-ast {
    position: relative;
    vertical-align: super;
    font-size: 1.05em;
    font-weight: 700;
    color: var(--accent);
    cursor: help;
    margin-left: 2px;
    line-height: 0;
}
.rating-ast::after {
    content: attr(data-tip);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 8px);
    transform: translateX(-50%);
    width: max-content;
    max-width: 260px;
    padding: 7px 10px;
    border-radius: 8px;
    background: #111;
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 11px;
    font-weight: 400;
    line-height: 1.4;
    white-space: normal;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
    opacity: 0;
    visibility: hidden;
    transition: opacity .15s ease, visibility .15s ease;
    z-index: 20;
    pointer-events: none;
}
.rating-ast:hover::after {
    opacity: 1;
    visibility: visible;
}

.metric-tip {
    position: relative;
    cursor: help;
}
.metric-tip::after {
    content: attr(data-tip);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 8px);
    transform: translateX(-50%);
    width: max-content;
    max-width: 260px;
    padding: 7px 10px;
    border-radius: 8px;
    background: #111;
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 11px;
    font-weight: 400;
    line-height: 1.4;
    white-space: normal;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
    opacity: 0;
    visibility: hidden;
    transition: opacity .15s ease, visibility .15s ease;
    z-index: 20;
    pointer-events: none;
}
.metric-tip:hover::after {
    opacity: 1;
    visibility: visible;
}

.stat-row-value {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-bright);
    text-align: right;
    white-space: nowrap;
}

.stat-row-value.good { color: var(--green); }

.rating-bar {
    flex: 1;
    min-width: 140px;
    position: relative;
}

.rating-track {
    position: relative;
    height: 16px;
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    background: var(--bg-input);
}

.rating-zone {
    height: 100%;
    opacity: 0.25;
}

.rating-fill {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    border-radius: 4px;
    transition: width .3s ease;
}

.rating-tick {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: rgba(255, 255, 255, 0.75);
    z-index: 2;
}

.rating-caption {
    position: absolute;
    top: 100%;
    margin-top: 3px;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    line-height: 1;
    opacity: 0.85;
    pointer-events: none;
    white-space: nowrap;
    z-index: 3;
}

.stat-plain-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 2px;
    border-bottom: 1px solid var(--border-light);
}

.stat-plain-row .stat-row-label { font-size: 13px; }
.stat-plain-row .stat-row-value { font-size: 16px; font-weight: 800; color: var(--text-bright); }

.clutch-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.clutch-col {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 16px;
}

.clutch-col .stat-plain-row:last-child { border-bottom: none; }

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

.player-hero {
    position: relative;
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 24px;
}

.player-hero img {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 3px solid var(--primary);
}

.player-hero .info h2 { color: var(--text-bright); font-size: 22px; margin-bottom: 4px; }
.player-hero .info .hero-period { color: var(--text-muted); font-size: 12px; margin-bottom: 4px; }
.player-hero .info .sub { color: var(--text-muted); font-size: 13px; }
.player-hero .info .sub img { width:20px; height:15px; border:none; outline:none; vertical-align:middle; margin-right:3px; }

.level-badge {
    display:inline-block;
    width:22px;height:22px;
    line-height:22px;
    text-align:center;
    border-radius:50%;
    font-size:11px;
    font-weight:700;
    color:#fff;
    vertical-align:middle;
}
.level-1  { background:#6d4c2e; }
.level-2  { background:#8d5e3c; }
.level-3  { background:#b8860b; }
.level-4  { background:#6b6b6b; }
.level-5  { background:#8a8a8a; }
.level-6  { background:#a8a8a8; }
.level-7  { background:#d4a017; }
.level-8  { background:#e8b800; }
.level-9  { background:#c69400; }
.level-10 { background:linear-gradient(135deg,#ff4500,#ff6347);box-shadow:0 0 6px rgba(255,69,0,0.6); }

.level-badge-img {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    vertical-align: middle;
    margin-left: 4px;
}
.player-hero .info .sub img.level-badge-img {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    vertical-align: middle;
    margin-left: 4px;
    margin-right: 0;
}

.group-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

.group-card .group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.group-card .group-header h3 { color: var(--accent); font-size: 16px; margin: 0; }

.group-card .group-name-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.group-avg-elo {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.3px;
    padding: 3px 9px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 999px;
    white-space: nowrap;
}

.group-avg-elo b { color: var(--accent); font-weight: 700; }

.group-members {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.group-member {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 12px;
}

.group-member img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--primary);
}

.group-member .no-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 7px;
    color: var(--text-muted);
    background: var(--bg);
    text-align: center;
    line-height: 1.1;
}

.group-member .g-name { font-size: 13px; color: var(--text); font-weight: 600; }
.group-member .g-elo { font-size: 11px; color: var(--accent); }

.results-podium {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 16px;
    padding: 32px 0 24px;
    flex-wrap: wrap;
}

.results-period {
    display: inline-block;
    margin-left: 12px;
    padding: 3px 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 999px;
    vertical-align: middle;
}

.results-podium-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.results-podium-item .medal { font-size: 28px; }

.results-podium-item .bar {
    width: 80px;
    border-radius: 6px 6px 0 0;
    transition: height 0.4s;
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 8px;
    font-size: 14px;
    font-weight: 800;
    color: #fff;
}

.results-podium-item .bar.gold { background: linear-gradient(180deg, var(--gold), #b8860b); }
.results-podium-item .bar.silver { background: linear-gradient(180deg, var(--silver), #606060); }
.results-podium-item .bar.bronze { background: linear-gradient(180deg, var(--bronze), #8b4513); }
.results-podium-item .bar.plain { background: linear-gradient(180deg, var(--accent), rgba(0,0,0,.55)); }

.results-podium-item .p-rank { font-size: 14px; font-weight: 700; color: var(--text-muted); }

.results-podium-item .p-name { font-size: 13px; color: var(--text); font-weight: 600; }

.compare-controls {
    display: flex;
    gap: 12px;
    align-items: end;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.compare-controls .form-group { margin: 0; min-width: 180px; }

.results-hint { margin-top: 4px; }

.coop-check {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    cursor: pointer;
    user-select: none;
    font-size: 13px;
    color: var(--text);
    white-space: nowrap;
}

.coop-check input[type="checkbox"] {
    width: auto;
    margin: 0;
    accent-color: var(--primary);
}

.coop-hint { margin-top: 8px; }

.groups-hint { margin-top: 16px; }

.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 1000;
}

.modal-box {
    background: var(--bg-card);
    max-width: 420px;
    margin: 80px auto;
    padding: 24px;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.modal-box h2 { color: var(--accent); margin-bottom: 16px; }

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

@media (max-width: 768px) {
    header, .app-header { flex-direction: column; gap: 12px; }
    nav, .app-nav { flex-wrap: wrap; justify-content: center; }
    table { font-size: 12px; }
    th, td { padding: 6px 8px; }
    .landing-hero h1 { font-size: 32px; }
    .landing-section .content, .landing-section .content.reverse { flex-direction: column; gap: 32px; }
    .illustration { min-width: auto; width: 100%; }
    .illu-perf-split { grid-template-columns: 1fr; }
    .illu-podium { gap: 12px; }
    .illu-podium-item .bar { width: 48px; }
    .stats-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
    .stat-row { grid-template-columns: 100px 1fr 80px; gap: 8px; }
    .stat-row-hint { display: block; font-size: 8px; }
    .perf-split { grid-template-columns: 1fr; }
    .perf-split .stats-rows { padding-right: 0; }
    .perf-split .radar-wrap { padding-left: 0; border-left: none; }
    .rating-bar { min-width: 0; }
    .compare-controls { flex-direction: column; align-items: stretch; }
    .compare-controls .form-group { min-width: auto; width: 100%; }
    .results-podium .bar { width: 60px; }
    .results-table-wrap {
        margin: 0 -24px;
        padding: 0;
        border-left: none;
        border-right: none;
        border-radius: 0;
    }
    .results-table-wrap h2 {
        padding: 20px 20px 16px;
        margin-bottom: 0;
    }
}

/* ========== PRIVACY PAGE ========== */

.privacy-page {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 24px;
}

.privacy-page h1 {
    font-size: 32px;
    color: var(--text-bright);
    margin-bottom: 8px;
}

.privacy-page .updated {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 32px;
}

.privacy-page h2 {
    font-size: 20px;
    color: var(--accent);
    margin: 28px 0 12px;
}

.privacy-page p {
    font-size: 14px;
    line-height: 1.8;
    color: var(--text);
    margin-bottom: 12px;
}

.privacy-page ul {
    margin: 8px 0 16px 20px;
    list-style: disc;
}

.privacy-page li {
    font-size: 14px;
    line-height: 1.7;
    color: var(--text);
    margin-bottom: 4px;
}

.privacy-page .back-link {
    display: inline-block;
    margin-bottom: 24px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
}

.privacy-page .back-link:hover { color: var(--accent); }

/* Rate-limit toast */
.rate-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    background: rgba(18, 18, 22, .94);
    color: #fff;
    padding: 14px 22px;
    border-radius: 10px;
    font-size: 14px;
    border: 1px solid rgba(255, 215, 0, .45);
    box-shadow: 0 10px 34px rgba(0, 0, 0, .5);
    max-width: 92vw;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease, transform .2s ease;
    white-space: nowrap;
}

.rate-toast.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

@media (max-width: 600px) {
    .rate-toast { white-space: normal; }
}

/* ==================== RECORDS TAB ==================== */
.records-header-card {
    background: linear-gradient(135deg, rgba(198,40,40,0.18) 0%, rgba(26,15,15,0.6) 60%);
    border: 1px solid var(--border);
}
.records-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.records-header-row h2 {
    margin-bottom: 4px;
    font-size: 22px;
    background: linear-gradient(90deg, var(--accent), #ffb74d);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.records-refresh-badge {
    font-size: 12px;
    font-weight: 600;
    color: var(--gold);
    background: rgba(255, 215, 0, 0.08);
    border: 1px solid rgba(255, 215, 0, 0.25);
    border-radius: 999px;
    padding: 6px 14px;
    white-space: nowrap;
}
.records-controls { margin: 16px 0 0; }
.records-controls .form-group { min-width: 160px; }
.records-hint { margin-top: 8px; }
.records-building {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 48px 20px;
    text-align: center;
}
.records-building-title { font-size: 16px; color: var(--text-bright); font-weight: 700; }
.records-progress {
    width: min(420px, 90%);
    height: 8px;
    border-radius: 999px;
    background: var(--bg-input);
    overflow: hidden;
}
.records-progress-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    transition: width .4s ease;
}
.records-progress-text { font-size: 13px; color: var(--text-muted); }

.record-card { padding: 18px 20px; }
.record-title {
    font-size: 15px;
    color: var(--text-bright);
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
    letter-spacing: .3px;
}
.record-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}
.record-col { min-width: 0; }
.record-col-head {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 10px;
}
.record-col-head.best { color: #4caf50; }
.record-col-head.worst { color: #f44336; }

.record-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    border-radius: 10px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    margin-bottom: 8px;
    transition: transform .12s ease, border-color .12s ease;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}
.record-item,
.record-item * {
    cursor: pointer;
}
.record-item:hover { transform: translateX(3px); border-color: var(--accent); }
.record-item-gold {
    border-color: rgba(255, 215, 0, 0.4);
    background: linear-gradient(135deg, rgba(255,215,0,0.08), var(--bg-input));
}
.record-thumb {
    position: relative;
    width: 84px;
    height: 50px;
    flex-shrink: 0;
    border-radius: 8px;
    background-size: cover;
    background-position: center;
    overflow: hidden;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06);
}
.record-thumb::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0.15), rgba(0,0,0,0.55));
}
.record-rank {
    position: absolute;
    top: 3px;
    left: 5px;
    z-index: 2;
    font-size: 13px;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0,0,0,.9);
}
.record-result {
    position: absolute;
    bottom: 3px;
    right: 5px;
    z-index: 2;
    font-size: 8px;
    font-weight: 800;
    letter-spacing: .5px;
    padding: 1px 5px;
    border-radius: 4px;
}
.record-result.win { background: rgba(76,175,80,.85); color: #fff; }
.record-result.loss { background: rgba(244,67,54,.85); color: #fff; }
.record-body { min-width: 0; flex: 1; }
.record-value {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-bright);
    line-height: 1.1;
}
.record-meta {
    display: flex;
    gap: 8px;
    align-items: center;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}
.record-map { font-weight: 700; color: var(--accent); }
.record-score { color: var(--text); }
.record-supp {
    display: flex;
    gap: 6px;
    align-items: center;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-bright);
    margin-top: 2px;
}
.record-supp span { color: var(--text-muted); font-weight: 600; }
.record-duration {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-bright);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0 5px;
}
.record-holders {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 6px;
    margin-top: 5px;
}
.record-holder {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 1px 7px 1px 1px;
    max-width: 100%;
}
.record-holder-avatar {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.record-holder-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 7px;
    font-weight: 800;
    background: var(--bg-input);
    color: var(--text-muted);
}
.record-holder-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 90px;
}
.records-scope-note {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 12px;
}
.records-scope-note strong { color: var(--accent); }
.record-date { font-size: 10px; color: var(--text-muted); opacity: .7; margin-top: 1px; }
.record-empty {
    font-size: 12px;
    color: var(--text-muted);
    padding: 10px;
    text-align: center;
}

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

.records-toggle {
    display: inline-flex;
    gap: 3px;
    padding: 3px;
    margin-bottom: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 999px;
}
.records-toggle-btn {
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 999px;
    cursor: pointer;
    transition: background .15s, color .15s;
}
.records-toggle-btn:hover { color: var(--text-bright); }
.records-toggle-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
}
.records-heading-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 2px;
}
.records-heading-row .records-toggle {
    margin-bottom: 0;
}
.records-mode-row {
    display: flex;
    justify-content: flex-start;
    margin: 4px 0 2px;
}
.records-mode-row .records-toggle {
    margin-bottom: 0;
}
#recordsContent {
    transition: opacity .18s ease;
}
.records-mode-hint {
    margin-top: 10px;
    line-height: 1.5;
}
.records-mode-hint + .records-mode-hint {
    margin-top: 0;
}
.record-grid.single { grid-template-columns: 1fr; }

.records-building-note {
    font-size: 13px;
    color: var(--text-muted);
    max-width: 420px;
    line-height: 1.5;
}

/* ===== Composite Rating (main parameter) ===== */
.main-rating-wrap {
    margin-bottom: 16px;
    padding: 12px 14px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.015));
    border: 1px solid var(--accent);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}
.main-rating-wrap .stat-row-label {
    font-weight: 800;
    letter-spacing: .5px;
    color: var(--accent);
}
.main-rating-wrap .stat-row-value {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-bright);
}

tr.main-param-row td {
    background: rgba(255, 255, 255, 0.045);
    font-size: 15px;
}
tr.main-param-row td:first-child strong {
    color: var(--accent);
    font-size: 15px;
}

/* ===== Premium profile hero ===== */
.player-hero.premium {
    position: relative;
    z-index: 2;
    align-items: stretch;
    gap: 24px;
    padding: 0;
    margin-bottom: 0;
    border-radius: 0;
    background: linear-gradient(135deg, rgba(198, 40, 40, 0.16), rgba(26, 15, 15, 0.55));
    border: 1px solid rgba(255, 215, 0, 0.28);
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}
.stats-sections { margin-top: 16px; }
.player-hero.premium::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(135deg, rgba(255, 215, 0, 0.06) 0 1px, transparent 1px 13px),
        repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 13px),
        radial-gradient(circle at top right, rgba(255, 215, 0, 0.10), transparent 60%);
    pointer-events: none;
}
.player-hero.premium .info h2 { font-size: 24px; }
.premium-photo-wrap {
    position: relative;
    flex-shrink: 0;
    align-self: stretch;
    width: 155px;
    min-height: 165px;
    border-radius: 0;
    border-right: 1px solid rgba(255, 215, 0, 0.5);
    overflow: hidden;
}
.player-hero.premium .premium-photo {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    border: none;
    border-radius: 0;
    opacity: 0;
    transition: opacity .6s ease;
    -webkit-mask-image: linear-gradient(to bottom, #000 86%, transparent 100%);
    mask-image: linear-gradient(to bottom, #000 86%, transparent 100%);
}
.player-hero.premium .premium-photo.loaded {
    opacity: 1;
}
.premium-badges {
    position: absolute;
    top: 8px;
    left: 8px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    z-index: 2;
}
.player-hero .premium-faceit-link {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.30);
    border: 1px solid rgba(255, 255, 255, 0.12);
    cursor: pointer;
    transition: background .15s ease;
}
.player-hero .premium-faceit-link:hover {
    background: #000;
}
.player-hero .premium-faceit-link img {
    width: 20px;
    height: 20px;
    object-fit: contain;
    border: none;
    border-radius: 0;
    cursor: pointer;
}
.player-hero.premium .premium-flag {
    width: 22.5px;
    height: 15px;
    object-fit: cover;
    border: none;
    border-radius: 0;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}
.player-hero.premium .premium-team-logo {
    width: 22.5px;
    height: 15px;
    object-fit: contain;
    border: none;
    border-radius: 0;
}
.premium-info {
    position: relative;
    min-width: 0;
    width: fit-content;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 12px 18px 12px 22px;
}
.premium-realname {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 6px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(255, 215, 0, 0.20);
}
.premium-rows {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 6px;
}
.premium-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    padding-bottom: 5px;
    border-bottom: 1px solid rgba(255, 215, 0, 0.20);
}
.player-hero.premium .premium-info .sub {
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(255, 215, 0, 0.20);
}
.premium-row-label {
    min-width: 74px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .8px;
    text-transform: uppercase;
    color: var(--text-muted);
}
.premium-row-value {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    color: var(--text-bright);
}
.player-hero.premium .premium-team-mini {
    width: 22.5px;
    height: 15px;
    object-fit: contain;
    border: none;
    border-radius: 0;
}
@media (max-width: 560px) {
    .player-hero.premium { gap: 12px; }
    .premium-photo-wrap { width: 104px; min-height: 107px; }
    .player-hero.premium .info h2 { font-size: 16px; }
    .premium-realname { font-size: 11px; margin-bottom: 3px; padding-bottom: 3px; }
    .premium-rows { gap: 2px; margin-bottom: 3px; }
    .premium-row { font-size: 11px; padding-bottom: 3px; }
    .premium-row-label { min-width: 56px; font-size: 8px; }
    .premium-info { padding: 6px 8px 6px 12px; }
    .player-hero.premium .info .sub { font-size: 11px; padding-bottom: 3px; }
    .premium-badges { transform: scale(.67); transform-origin: top left; }
    .player-hero .premium-faceit-link { top: 6px; right: 6px; width: 26px; height: 26px; }
    .player-hero .premium-faceit-link img { width: 16px; height: 16px; }
    .premium-achievements { padding: 4px 8px; gap: 6px; }
    .achievement { width: 32px; height: 32px; padding: 2px; }
    .achievement-place, .achievement-year { font-size: 8px; }
}

/* ===== Premium: performance tabs ===== */
.perf-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border);
}
.perf-tab {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 8px 4px;
    margin-bottom: -1px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    transition: color .15s ease, border-color .15s ease;
}
.perf-tab:hover { color: var(--text-bright); }
.perf-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.perf-pane { animation: perfPaneIn .25s ease; }
@keyframes perfPaneIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ===== Team MVP (by year) ===== */
.mvp-year-block {
    margin-bottom: 16px;
    padding: 14px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.22);
    border: 1px solid var(--border);
}
.mvp-year-block:last-child { margin-bottom: 0; }
.mvp-year-head {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.mvp-year-num {
    font-size: 20px;
    font-weight: 900;
    letter-spacing: 1px;
    color: var(--accent);
}
.mvp-chip-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.mvp-chip-grid-wide { margin-bottom: 8px; }
.mvp-chip {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 96px;
    padding: 6px 10px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
}
.mvp-chip-label {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-muted);
}
.mvp-chip-value { display: flex; align-items: center; gap: 6px; min-width: 0; }
.mvp-chip-avatar {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    object-fit: cover;
    object-position: center top;
    flex-shrink: 0;
}
.mvp-chip-avatar-q {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-input);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 800;
}
.mvp-chip-name {
    font-size: 13px;
    font-weight: 800;
    color: var(--text-bright);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.mvp-chip-empty .mvp-chip-name { color: var(--text-muted); }
.mvp-chip-mine {
    background-image: repeating-linear-gradient(45deg, rgba(255, 215, 0, 0.16) 0 5px, transparent 5px 10px);
    border-color: rgba(255, 215, 0, 0.55);
}
.mvp-chip-year {
    border-color: rgba(255, 215, 0, 0.4);
    background: rgba(255, 215, 0, 0.06);
}
.mvp-chip-grid-months {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}
.mvp-chip-grid-months .mvp-chip { min-width: 0; padding: 5px 8px; }
.mvp-chip-grid-months .mvp-chip-name { font-size: 12px; }
@media (max-width: 720px) {
    .mvp-chip-grid-months { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 560px) {
    .mvp-chip { min-width: 0; padding: 5px 8px; }
    .mvp-chip-label { font-size: 8px; }
    .mvp-chip-name { font-size: 11px; }
    .mvp-chip-grid-months .mvp-chip-name { font-size: 10px; }
    .mvp-chip-avatar { width: 15px; height: 15px; }
    .mvp-year-num { font-size: 17px; }
}

/* ===== Premium achievements ===== */
.premium-achievements {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
    padding: 5px 10px;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.06), rgba(0, 0, 0, 0.25));
    border: 1px solid rgba(255, 215, 0, 0.18);
    border-top: none;
}
.premium-achievements:empty { display: none; }
.achievement {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 2px;
    border-radius: 7px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border);
}
.achievement img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}
.achievement-place,
.achievement-year {
    position: absolute;
    font-size: 10px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: .2px;
    color: var(--text-muted);
}
.achievement-place { top: 3px; left: 4px; }
.achievement-year { bottom: 3px; right: 4px; }
.achievement.place-1 { border-color: rgba(255, 215, 0, 0.5); }
.achievement.place-1 .achievement-place,
.achievement.place-1 .achievement-year { color: #ffd700; }
.achievement.place-2 { border-color: rgba(207, 212, 216, 0.5); }
.achievement.place-2 .achievement-place,
.achievement.place-2 .achievement-year { color: #cfd4d8; }
.achievement.place-3 { border-color: rgba(205, 127, 50, 0.5); }
.achievement.place-3 .achievement-place,
.achievement.place-3 .achievement-year { color: #cd7f32; }

/* ===== Map win rate (Records) ===== */
.map-winrate-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
}
.map-winrate-item { min-width: 0; }
.map-winrate-thumb {
    position: relative;
    height: 70px;
    border-radius: 8px;
    background-size: cover;
    background-position: center;
    overflow: hidden;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}
.map-winrate-thumb::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.15), rgba(0, 0, 0, 0.6));
}
.map-winrate-item.overall { grid-column: span 2; }
.map-winrate-item.overall .map-winrate-thumb {
    box-shadow: inset 0 0 0 2px var(--accent);
}
.map-winrate-item.overall .map-winrate-name { color: #ffd700; }
.map-winrate-mosaic { background: #000; }
.mosaic-grid {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: 1fr;
}
.mosaic-grid span {
    background-size: cover;
    background-position: center;
}
.map-winrate-pct {
    position: absolute;
    bottom: 5px;
    right: 7px;
    z-index: 2;
    font-size: 18px;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}
.map-winrate-name {
    margin-top: 6px;
    font-size: 12px;
    font-weight: 800;
    color: var(--accent);
    text-align: center;
}
.map-winrate-sub {
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
}

/* ===== Big clutches (1v3/1v4/1v5 wins) ===== */
.clutch-big {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 14px;
}
.clutch-big-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px;
    border-radius: 10px;
    background: rgba(255, 215, 0, 0.06);
    border: 1px solid rgba(255, 215, 0, 0.2);
}
.clutch-big-value {
    font-size: 26px;
    font-weight: 900;
    line-height: 1;
    color: #ffd700;
}
.clutch-big-label {
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
}
.clutch-big-sub {
    font-size: 10px;
    color: var(--text-muted);
    opacity: .75;
    text-align: center;
}

/* ===== Compact period selector inside the premium "Показатели" tab ===== */
.perf-pane #statsPeriodCard {
    background: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 0 14px !important;
    box-shadow: none !important;
}
.perf-pane #statsPeriodCard .section-divider,
.perf-pane #statsPeriodCard .section-note { display: none !important; }
.perf-pane #statsPeriodCard .form-group { min-width: 108px !important; }
.perf-pane #statsPeriodCard select,
.perf-pane #statsPeriodCard input { width: auto !important; }
.perf-pane #statsPeriodCard #statsLoadBtn { padding: 6px 14px !important; }
.perf-pane #statsPeriodCard select {
    height: 30px;
    padding: 0 8px;
    font-size: 12px;
    line-height: 28px;
}
.perf-pane #statsPeriodCard .form-group { min-width: 92px !important; }
.perf-pane #statsPeriodCard input[type="date"] {
    height: 30px;
    padding: 0 8px;
    font-size: 12px;
    width: 132px;
}
.perf-pane #statsPeriodCard #statsCustomDates .form-group,
.perf-pane #statsPeriodCard #statsCalMonth .form-group,
.perf-pane #statsPeriodCard #statsCalSeason .form-group,
.perf-pane #statsPeriodCard #statsCalYear .form-group {
    min-width: 0 !important;
}
.perf-pane #statsPeriodCard .form-group label {
    font-size: 11px;
}

/* ==================== MATCHES ==================== */
.sub-tabs {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    margin-bottom: 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 999px;
}
.sub-tab {
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    padding: 8px 18px;
    border-radius: 999px;
    cursor: pointer;
    transition: background .15s, color .15s;
}
.sub-tab:hover { color: var(--text-bright); }
.sub-tab.active {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
}
.matches-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 16px;
}
.match-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 4px solid var(--session-color, var(--border));
    border-radius: 8px;
    overflow: hidden;
    overflow: clip;
}
.matches-more {
    display: flex;
    justify-content: center;
    margin-top: 16px;
}
.matches-more button {
    padding: 10px 28px;
    cursor: pointer;
}
.match-row {
    position: relative;
    display: grid;
    grid-template-columns: 110px 1fr 110px;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    transition: background 0.15s;
}
.match-row:hover { background: rgba(198,40,40,0.08); }
.match-comment {
    display: block;
    margin-bottom: 2px;
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0.3px;
    white-space: nowrap;
    pointer-events: none;
    text-shadow:
        -1px -1px 0 #000,
        1px -1px 0 #000,
        -1px 1px 0 #000,
        1px 1px 0 #000;
}
.match-side { text-align: center; }
.match-score {
    font-size: 26px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}
.match-score.win { color: var(--green); }
.match-score.loss { color: var(--danger); }
.match-mid {
    position: relative;
    text-align: center;
    min-width: 0;
    border-radius: 8px;
    overflow: hidden;
    background-size: cover;
    background-position: center;
    background-color: #000;
}
.match-mid::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(45deg,
            rgba(255,255,255,0.04) 0,
            rgba(255,255,255,0.04) 1px,
            transparent 1px,
            transparent 6px),
        linear-gradient(180deg, rgba(0,0,0,0.19), rgba(0,0,0,0.41));
}
.match-mid-content {
    position: relative;
    z-index: 1;
    padding: 10px 14px;
    text-shadow:
        -1px -1px 0 rgba(0,0,0,0.95),
        1px -1px 0 rgba(0,0,0,0.95),
        -1px 1px 0 rgba(0,0,0,0.95),
        1px 1px 0 rgba(0,0,0,0.95),
        0 2px 4px rgba(0,0,0,0.9);
}
.match-map-name {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    text-transform: capitalize;
    letter-spacing: 0.3px;
}
.match-map-name.win { color: #4caf50; }
.match-map-name.loss { color: #ff5252; }
.match-players {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 5px;
}
.match-mid .match-player { color: rgba(255,255,255,0.9); }
.match-mid .match-player.is-member { color: var(--accent); }
.match-player {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.match-avatar {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    vertical-align: middle;
    box-shadow: 0 0 0 1px rgba(255,255,255,0.6), 0 0 0 2px rgba(0,0,0,0.7);
}
.match-team-name {
    display: block;
    margin-bottom: 4px;
    font-size: 10px;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 0.3px;
    opacity: 0.9;
    overflow-wrap: anywhere;
    line-height: 1.15;
}
.match-player.is-member {
    color: var(--accent);
    font-weight: 600;
}
.match-meta {
    margin-top: 5px;
    font-size: 11px;
    color: rgba(255,255,255,0.85);
}
.match-detail {
    border-top: 1px solid var(--border);
    background: rgba(0,0,0,0.25);
}
.match-detail-inner { padding: 8px 20px 14px; overflow-x: auto; }
.match-stats-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
}
.match-stats-table th {
    text-align: right;
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 700;
    padding: 8px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    border-bottom: 1px solid var(--border);
}
.match-stats-table td {
    text-align: right;
    padding: 7px 8px;
    font-variant-numeric: tabular-nums;
    color: var(--text);
    white-space: nowrap;
}
.match-stats-table th:first-child,
.match-stats-table td:first-child { text-align: left; }
.match-stats-table th:first-child,
.match-stats-table td:first-child {
    position: -webkit-sticky;
    position: sticky;
    left: 0;
    z-index: 2;
    background: #150c0c;
    box-shadow: 2px 0 4px rgba(0,0,0,0.45);
}
/* Touch fallback: pin the first column via JS (transform) instead of sticky. */
.touch-sticky .match-stats-table th:first-child,
.touch-sticky .match-stats-table td:first-child {
    position: relative;
    left: auto;
    will-change: transform;
}
.match-stats-table th:first-child { z-index: 3; }
.match-stats-table tbody tr:hover td:first-child { background: #251010; }
.match-stats-table tbody tr.is-self td:first-child {
    background: #341616;
    box-shadow: inset 3px 0 0 var(--accent), 2px 0 4px rgba(0,0,0,0.45);
}
.match-stats-table .md-name { color: var(--text-bright); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.match-stats-table tbody tr:nth-child(even) { background: rgba(255,255,255,0.02); }
.match-stats-table tbody tr:hover { background: rgba(198,40,40,0.08); }
.match-stats-table tbody tr.is-self td { background: rgba(255,82,82,0.14); }
.match-stats-table tbody tr.is-self .md-name { color: var(--accent); }

@media (max-width: 640px) {
    .match-row { grid-template-columns: 64px 1fr 64px; padding: 12px; gap: 8px; }
    .match-score { font-size: 21px; }
    .match-player { font-size: 10px; }
    .match-team-name { font-size: 9px; }
}

/* ==================== Telegram bot chat mockup (landing) ==================== */
.tg-chat {
    width: 100%;
    max-width: 380px;
    margin: 0 auto;
    zoom: 0.9;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.tg-chat-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: rgba(198,40,40,0.10);
    border-bottom: 1px solid var(--border);
}
.tg-chat-header .tg-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    font-size: 17px;
    flex-shrink: 0;
    overflow: hidden;
}
.tg-chat-header .tg-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.tg-chat-header .tg-name { font-size: 13px; font-weight: 700; color: var(--text-bright); }
.tg-chat-header .tg-status { font-size: 10px; color: var(--text-muted); }
.tg-chat-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    background:
        repeating-linear-gradient(45deg,
            rgba(255,255,255,0.012) 0,
            rgba(255,255,255,0.012) 1px,
            transparent 1px,
            transparent 8px);
}
.tg-msg { display: flex; }
.tg-bubble {
    max-width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 12px 12px 12px 4px;
    padding: 9px 11px;
    font-size: 11.5px;
    line-height: 1.55;
    color: var(--text);
}
.tg-bubble b { color: var(--text-bright); }
.tg-bubble code { color: var(--accent); font-size: 11px; }
.tg-kb { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.tg-kb span {
    display: block;
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    color: var(--accent);
    background: rgba(198,40,40,0.10);
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 4px 6px;
}
.tg-notif-score { font-size: 18px; font-weight: 800; line-height: 1.1; margin: 1px 0 2px; }
.tg-notif-score .w { color: var(--green); }
.tg-notif-score .l { color: var(--danger); }
.tg-sep { border: none; border-top: 1px solid var(--border); margin: 6px 0; }
.tg-radar { display: block; width: 150px; margin: 6px auto 0; }
.tg-radar-ring { fill: none; stroke: #888; stroke-width: 1; opacity: .45; }
.tg-radar-spoke { stroke: #888; stroke-width: 1; opacity: .35; }
.tg-radar-shape { fill: rgba(255,82,82,0.14); stroke: var(--accent); stroke-width: 2; }

/* Fixed Telegram-bot invite window, visible on every app page. */
.bot-widget {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 70;
    width: 250px;
}
.bot-widget .tg-chat { max-width: none; margin: 0; }
.bot-widget .tg-chat-body { padding: 12px; }
.bot-widget-head { flex: 1; min-width: 0; }
.bot-widget-head .tg-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bot-widget-min {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    line-height: 1;
    padding: 0 4px;
    cursor: pointer;
    transition: color .15s;
}
.bot-widget-min:hover { color: var(--text-bright); }
.bot-widget-btn {
    display: block;
    text-align: center;
    background: var(--primary);
    color: #fff;
    text-decoration: none;
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    transition: background .15s;
}
.bot-widget-btn:hover { background: var(--accent); }
.bot-widget-toggle {
    display: none;
    width: 52px;
    height: 52px;
    padding: 0;
    border-radius: 50%;
    border: 2px solid var(--primary);
    overflow: hidden;
    cursor: pointer;
    background: var(--bg-card);
    box-shadow: 0 6px 20px rgba(0,0,0,0.45);
}
.bot-widget-toggle img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bot-widget.collapsed .tg-chat { display: none; }
.bot-widget.collapsed .bot-widget-toggle { display: block; }

@media (max-width: 640px) {
    .bot-widget { width: 210px; right: 10px; bottom: 10px; }
}

/* Referral program */
.referral-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 8px;
}
.referral-select {
    width: auto;
    max-width: 220px;
    height: 30px;
    padding: 0 12px;
    font-size: 12px;
}
.referral-row .btn-sm {
    height: 30px;
    padding: 0 14px;
    display: inline-flex;
    align-items: center;
}
.referral-copy-wrap {
    position: relative;
    display: inline-flex;
}
.referral-tooltip {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    white-space: nowrap;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 11px;
    padding: 5px 8px;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s;
    pointer-events: none;
    z-index: 5;
}
.referral-copy-wrap.no-groups:hover .referral-tooltip {
    opacity: 1;
    visibility: visible;
}
.referral-count {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
}

/* Profile pages (/players/{nickname}): guests see the profile only. */
body.guest .app-nav { display: none !important; }
body.guest #statsPeriodCard { display: none !important; }

/* Player hero: groups row */
.hero-groups { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.hero-groups a { color: var(--accent); text-decoration: none; }
.hero-groups a:hover { text-decoration: underline; }
.premium-team-link { color: inherit; text-decoration: none; }
.premium-team-link:hover { color: var(--accent); text-decoration: underline; }

/* Group profile page (/groups/{name}) */
.group-hero {
    display: flex;
    align-items: center;
    gap: 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}
.group-hero-logo,
.group-hero-logo-fallback {
    width: 84px;
    height: 84px;
    border-radius: 14px;
    object-fit: cover;
    border: 2px solid var(--primary);
    background: var(--bg-input);
    flex-shrink: 0;
}
.group-hero-logo-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 800;
    color: var(--accent);
}
.group-hero-info h2 { margin: 0 0 6px; color: var(--text-bright); }
.group-hero-info .sub { font-size: 14px; color: var(--text-muted); }
.group-hero-info .sub b { color: var(--text-bright); }
.group-link { color: inherit; text-decoration: none; }
.group-link:hover { color: var(--accent); }
.group-edit {
    margin: 12px 0;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-input);
}
.group-logo-hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.group-controls {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    justify-content: flex-end;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

/* Compare two players page (/compare) */
.compare-wrap { max-width: 1000px; margin: 0 auto; padding: 24px; }
.compare-wrap h1 { font-size: 26px; color: var(--text-bright); margin: 0 0 10px; }
.compare-intro { color: var(--text-muted); font-size: 14px; margin: 0 0 20px; line-height: 1.6; }
.compare-form {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: flex-end;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
}
.compare-field { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 200px; }
.compare-field label { font-size: 12px; color: var(--text-muted); }
.compare-vs { font-weight: 800; color: var(--accent); padding-bottom: 12px; }
.compare-period { flex: 0 0 170px; min-width: 150px; }
.compare-sub { display: flex; gap: 14px; align-items: flex-end; }
.compare-sub .compare-field { flex: 0 0 auto; min-width: 120px; }
.compare-form .btn-cta { border: none; cursor: pointer; }
.compare-table { width: 100%; border-collapse: collapse; margin-top: 22px; }
.compare-table th { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: center; }
.compare-table td { padding: 10px 12px 20px; border-bottom: 1px solid var(--border); text-align: center; }
.compare-table th:first-child,
.compare-table td:first-child { text-align: left; color: var(--text-muted); font-size: 13px; }
.cmp-note { font-size: 11px; opacity: 0.8; }
.cmp-player { vertical-align: top; }

/* Landing "demo version" badge on the compare button */
.compare-demo-wrap { position: relative; display: inline-flex; }
.demo-badge {
    position: absolute;
    top: -9px;
    right: -6px;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--accent);
    background: var(--bg);
    border: 1px solid var(--accent);
    border-radius: 4px;
    padding: 1px 5px;
    pointer-events: none;
}

/* Suggested pro players dropdown */
.cmp-suggest {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    z-index: 30;
    overflow: hidden;
    display: none;
}
.cmp-suggest.open { display: block; }
.cmp-suggest-title { font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); padding: 8px 12px 4px; }
.cmp-suggest-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text);
}
.cmp-suggest-item:hover { background: var(--bg-input); }
.cmp-suggest-item .nick { font-weight: 600; color: var(--text-bright); }
.cmp-suggest-item .elo { font-size: 12px; color: var(--accent); }

/* Spider chart (both players overlaid) */
.cmp-radar-card { display: flex; flex-direction: column; align-items: center; margin-top: 26px; }
.cmp-radar { width: 380px; max-width: 100%; }
.cmp-radar-legend { display: flex; justify-content: center; gap: 20px; margin-top: 6px; font-size: 13px; color: var(--text); }
.cmp-radar-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; }

/* ===== Profile compare ("Сравнение" arrow) ===== */
.stats-card.perf-card { position: relative; }
.cmp-tab {
    position: absolute;
    right: -1px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 16px 7px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-left: none;
    border-radius: 0 10px 10px 0;
    color: var(--accent);
    cursor: pointer;
    z-index: 7;
    transition: background 0.15s, color 0.15s, right 0.25s ease;
}
.cmp-tab:hover { background: var(--primary); color: #fff; }
/* Active (panel open / comparing): keep it clearly highlighted. */
.cmp-tab.open {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(198, 40, 40, 0.28), 0 6px 20px rgba(198, 40, 40, 0.5);
}
/* Comparison loaded (split view): push the tab clear of the card so it no
   longer overlaps the player-2 column. */
.cmp-tab.active { right: -24px; }
.cmp-tab-arrow { font-size: 18px; font-weight: 900; line-height: 1; }
.cmp-tab-label {
    writing-mode: vertical-rl;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* Compare input panel: slides OUT from the compare tab (right edge of the
   card) so the section content stays exactly as it was. */
.cmp-panel-wrap {
    position: absolute;
    top: 50%;
    right: 0;
    width: 268px;
    max-width: calc(100vw - 32px);
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 14px 44px rgba(0, 0, 0, 0.6);
    z-index: 6;
    --cmp-shift: calc(100% + 14px);
    transform: translateY(-50%) translateX(var(--cmp-shift));
    animation: cmpSlideOut 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
/* Start already clear of the card (never visible over the content) and slide
   the last bit outward, so the collapse tab stays reachable. */
@keyframes cmpSlideOut {
    from { opacity: 0; transform: translateY(-50%) translateX(100%); }
    to { opacity: 1; transform: translateY(-50%) translateX(var(--cmp-shift)); }
}
@media (max-width: 1600px) {
    /* Not enough room outside — overlay it just inside the right edge. */
    .cmp-panel-wrap { --cmp-shift: 0px; animation-name: cmpSlideIn; }
}
@keyframes cmpSlideIn {
    from { opacity: 0; transform: translateY(-50%) translateX(40px); }
    to { opacity: 1; transform: translateY(-50%) translateX(0); }
}
.cmp-panel-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent);
    margin-bottom: 10px;
}
.cmp-panel-close {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    color: var(--text-muted);
    font-size: 20px;
    line-height: 1;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.cmp-panel-close:hover { color: #fff; background: var(--primary); }
.cmp-panel-input { display: flex; gap: 8px; }
.cmp-panel-input input { flex: 1; min-width: 0; }
.cmp-panel-player { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.cmp-panel-player img { width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--primary); object-fit: cover; }
.cmp-panel-nick { font-weight: 700; color: var(--text-bright); }
.cmp-panel-elo { font-size: 12px; color: var(--text-muted); }
.cmp-panel-hint { font-size: 11px; color: var(--text-muted); margin-top: 10px; line-height: 1.5; }

/* ===== Mobile compare: compact rows (one label, both players) ===== */
.cmp-m { display: flex; flex-direction: column; margin-top: 8px; }
.cmp-m-row {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.cmp-m-label {
    font-size: 10px;
    line-height: 1.1;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
}
.cmp-m-cols { display: grid; grid-template-columns: 1fr 1fr; align-items: center; }
.cmp-m-cell { display: flex; align-items: center; justify-content: center; gap: 7px; min-width: 0; padding-right: 10px; }
.cmp-m-cell-p2 { border-left: 1px dashed rgba(255, 255, 255, 0.18); padding-left: 10px; padding-right: 0; }
.cmp-m-bar { flex: 1; min-width: 24px; height: 7px; background: rgba(255, 255, 255, 0.09); border-radius: 4px; overflow: hidden; }
.cmp-m-bar i { display: block; height: 100%; border-radius: 4px; }
.cmp-m-val { font-size: 13px; font-weight: 700; color: var(--text-bright); min-width: 34px; text-align: center; }
/* Clutches: separate 1v1 / 1v2 / 1v3+ groups, values centred */
.cmp-m-clutches .cmp-m-group { margin-bottom: 14px; }
.cmp-m-clutches .cmp-m-group:last-child { margin-bottom: 0; }
.cmp-m-group-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 2px 0 5px;
    margin-bottom: 2px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}
.cmp-m-clutch .cmp-m-val { text-align: center; }
.cmp-m-clutch .cmp-m-cell { justify-content: center; padding-right: 0; }

@media (max-width: 768px) {
    /* Compare tab sits flush at the bottom edge of "Показатели" */
    .cmp-tab {
        position: static;
        margin: 34px auto 0;
        flex-direction: row;
        gap: 8px;
        padding: 9px 20px;
        border: 1px solid var(--border);
        border-radius: 8px;
        width: fit-content;
        font-size: 12px;
    }
    .cmp-tab-label { writing-mode: horizontal-tb; }
    .cmp-tab-arrow { transform: rotate(90deg); }
    .cmp-tab.active { right: auto; }

    /* Panel is added as a subsection right under the button (not an overlay). */
    .cmp-panel-wrap {
        position: static;
        width: auto;
        max-width: none;
        transform: none;
        margin-top: 10px;
        border-radius: 10px;
        animation: cmpSlideDown 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    }
    @keyframes cmpSlideDown {
        from { opacity: 0; transform: translateY(-8px); }
        to { opacity: 1; transform: translateY(0); }
    }

    /* Tighter header so the compact metrics fit */
    .cmp-header { padding: 6px 0; margin-bottom: 4px; }
    .cmp-header-p1 img, .cmp-header-p2 img { width: 26px; height: 26px; }
    .cmp-header-name { font-size: 12px; }
    .cmp-header-elo { font-size: 10px; }
    .cmp-radar-bottom { margin-top: 14px; padding-top: 12px; }
    .cmp-radar-bottom .radar { width: 100%; }
}

/* Player header (both avatars + names above metrics) */
.cmp-header {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    padding: 10px 0;
    margin-bottom: 6px;
    border-bottom: 1px solid var(--border-light);
}
.cmp-header-p1,
.cmp-header-p2 {
    display: flex;
    align-items: center;
    gap: 10px;
}
.cmp-header-p2 {
    padding-left: 16px;
    border-left: 2px dashed rgba(255, 255, 255, 0.18);
    background: rgba(0, 0, 0, 0.1);
    border-radius: 0 6px 6px 0;
}
.cmp-header-p1 img,
.cmp-header-p2 img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border); }
.cmp-header-name { font-weight: 700; font-size: 14px; color: var(--text-bright); }
.cmp-header-elo { font-size: 11px; color: var(--text-muted); }

/* ===== Split-view compare: two full columns with dashed divider ===== */
.cmp-split-view {
    display: grid;
    grid-template-columns: 1fr 2px 1fr;
    gap: 0;
    animation: cmpSplitIn 0.45s ease;
}
.cmp-split-divider {
    border-left: 2px dashed rgba(255, 255, 255, 0.18);
    min-height: 100%;
}
.cmp-split-p1 { padding-right: 16px; }
.cmp-split-p2 {
    background: rgba(0, 0, 0, 0.08);
    padding-left: 16px;
    border-radius: 0 8px 8px 0;
}
@keyframes cmpSplitIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Metric rows in compare mode — 5-column grid with dashed divider */
.stat-row.cmp { grid-template-columns: 110px minmax(0, 1fr) 55px minmax(0, 1fr) 55px; }
.main-rating-wrap .stat-row.cmp { grid-template-columns: 110px minmax(0, 1fr) 55px minmax(0, 1fr) 55px; }

/* P2 bar: dashed left border + darker bg */
.stat-row.cmp .cmp-bar {
    border-left: 2px dashed rgba(255, 255, 255, 0.18);
    padding-left: 12px;
    margin-left: 0;
    border-radius: 0 4px 4px 0;
    background: rgba(0, 0, 0, 0.12);
}
.stat-row.cmp .cmp-value {
    background: rgba(0, 0, 0, 0.12);
    border-radius: 0 4px 4px 0;
    padding-right: 6px;
}
.cmp-value { color: var(--accent) !important; }

/* Plain rows: dashed left border on p2 value */
.stat-plain-row.cmp { display: grid; grid-template-columns: 1fr 70px 70px; gap: 0; align-items: stretch; }
.stat-plain-row.cmp .stat-row-label { padding: 8px 2px; }
.stat-plain-row.cmp .stat-row-value { padding: 8px 8px; }
.stat-plain-row.cmp .cmp-value {
    text-align: right;
    background: rgba(0, 0, 0, 0.12);
    border-left: 2px dashed rgba(255, 255, 255, 0.18);
    border-radius: 0 4px 4px 0;
}

/* Box rows */
.stat-box.cmp { display: flex; flex-direction: column; gap: 4px; }
.stat-box.cmp .stat-value { font-size: 22px; }
.stat-box.cmp .cmp-value {
    color: var(--accent);
    background: rgba(0, 0, 0, 0.12);
    border-radius: 6px;
    padding: 4px 0;
    margin-top: 2px;
}
.clutch-big-item .cmp-value { color: var(--accent); }

/* Slide-in animation for p2 elements */
@keyframes cmpFadeSlide {
    from { opacity: 0; transform: translateX(16px); }
    to { opacity: 1; transform: translateX(0); }
}
.stat-row.cmp .cmp-bar,
.stat-row.cmp .cmp-value,
.stat-plain-row.cmp .cmp-value,
.stat-box.cmp .cmp-value,
.clutch-big-item .cmp-value {
    animation: cmpFadeSlide 0.4s ease both;
}

/* Overlaid spider chart at the bottom of the Performance card */
.cmp-radar-bottom {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: center;
}
.cmp-radar-bottom .radar { width: 420px; max-width: 100%; }

.cmp-avatar { width: 56px; height: 56px; border-radius: 50%; border: 2px solid var(--primary); object-fit: cover; display: block; margin: 0 auto 6px; }
.cmp-avatar-fallback { display: flex; align-items: center; justify-content: center; font-weight: 800; color: var(--accent); background: var(--bg-input); }
.cmp-nick { font-size: 15px; font-weight: 700; }
.cmp-nick a { color: var(--text-bright); text-decoration: none; }
.cmp-nick a:hover { color: var(--accent); }
.cmp-sub { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; justify-content: center; gap: 4px; margin-top: 3px; }
.cmp-flag { width: 16px; height: 12px; border-radius: 2px; }
.cmp-level { height: 16px; }
.compare-table th:nth-child(3),
.compare-table td:nth-child(3) { border-left: 1px dashed var(--border); }
.cmp-cell { display: flex; align-items: center; gap: 10px; justify-content: center; }
.cmp-bar { width: 150px; flex-shrink: 0; position: relative; }
.cmp-bar .rating-track { height: 12px; }
.cmp-bar .rating-caption { top: 100%; }
.cmp-val { font-size: 15px; font-weight: 700; color: var(--text-bright); min-width: 58px; text-align: right; }
.cmp-better { color: var(--green); }

/* ===== /compare — mobile ===== */
@media (max-width: 768px) {
    .compare-wrap { padding: 12px 12px 40px; }
    .compare-wrap h1 { font-size: 20px; }
    .compare-intro { font-size: 13px; }
    .compare-form { flex-direction: column; align-items: stretch; gap: 12px; padding: 14px; }
    .compare-field { min-width: 0; }
    .compare-vs { display: none; }
    .compare-period { flex: 1 1 auto; }
    .compare-sub { flex-wrap: wrap; gap: 10px; }
    .compare-sub .compare-field { flex: 1 1 40%; min-width: 0; }
    .compare-form .btn-cta { width: 100%; }

    .compare-table { margin-top: 16px; table-layout: fixed; }
    .compare-table th, .compare-table td { padding: 7px 4px 14px; }
    .compare-table th:first-child,
    .compare-table td:first-child {
        font-size: 10px;
        line-height: 1.15;
        width: 30%;
        padding-right: 4px;
    }
    .compare-table th:nth-child(2),
    .compare-table td:nth-child(2),
    .compare-table th:nth-child(3),
    .compare-table td:nth-child(3) { width: 35%; }
    .cmp-cell { flex-direction: column; gap: 5px; }
    .cmp-bar { width: 100%; max-width: 92px; }
    .cmp-bar .rating-track { height: 9px; }
    .cmp-bar .rating-caption { font-size: 9px; }
    .cmp-val { font-size: 12px; min-width: 0; text-align: center; }
    .cmp-avatar { width: 40px; height: 40px; }
    .cmp-nick { font-size: 12px; }
    .cmp-sub { font-size: 10px; }
    .cmp-radar-card { margin-top: 14px; }
    .cmp-radar { width: 100%; }
    .cmp-radar-legend { font-size: 12px; gap: 14px; }
}
/* In the profile compare, colour the better value green (overrides the p2 red). */
.cmp-value.cmp-better,
.stat-row-value.cmp-better,
.stat-value.cmp-better,
.cmp-m-val.cmp-better { color: var(--green) !important; }
.compare-table tr.cmp-section td {
    padding-top: 22px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
    text-align: left;
}
.compare-note { font-size: 12px; color: var(--text-muted); margin-top: 16px; }
.group-logo-preview {
    width: 72px;
    height: 72px;
    border-radius: 10px;
    object-fit: cover;
    border: 2px solid var(--primary);
    display: block;
    margin-bottom: 8px;
}

/* Logo crop modal */
.crop-modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.crop-dialog {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    max-width: 360px;
    width: 100%;
    text-align: center;
}
.crop-dialog h3 { color: var(--accent); margin: 0 0 14px; font-size: 16px; }
.crop-viewport {
    position: relative;
    width: 300px;
    height: 300px;
    margin: 0 auto;
    overflow: hidden;
    background: #000;
    border-radius: 8px;
    touch-action: none;
    cursor: grab;
}
.crop-viewport:active { cursor: grabbing; }
.crop-viewport img {
    position: absolute;
    left: 0;
    top: 0;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
}
.crop-grid {
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: 8px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
    background:
        linear-gradient(rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.18)) center / 1px 100% no-repeat,
        linear-gradient(rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.18)) center / 100% 1px no-repeat;
}
.crop-controls { display: flex; align-items: center; gap: 10px; margin: 14px 0 6px; }
.crop-controls label { font-size: 12px; color: var(--text-muted); }
.crop-controls input[type=range] { flex: 1; }
.crop-hint { font-size: 11px; color: var(--text-muted); margin-bottom: 14px; }
.crop-actions { display: flex; gap: 8px; justify-content: center; }
