/* ============================================================
   FT SEARCH — Mini App
   Design system: Cyberpunk / HUD, dark-only, theme-switchable accent
   ============================================================ */

/* ---------- Design tokens ---------- */
:root {
    /* Surfaces (dark cyber base) */
    --bg-0: #07080d;
    --bg-1: #0b0d15;
    --surface-1: rgba(22, 25, 38, 0.72);
    --surface-2: rgba(30, 34, 52, 0.85);
    --surface-solid: #12141f;
    --panel-border: rgba(255, 255, 255, 0.08);
    --panel-border-strong: rgba(255, 255, 255, 0.14);

    /* Text */
    --text-main: #f2f4f8;
    --text-soft: #c3c9d6;
    --text-muted: #8a92a6;
    --text-faint: #5b6273;

    /* Accent (overridden per theme) */
    --primary-color: #31e27b;
    --primary-strong: #21c968;
    --primary-glow: rgba(49, 226, 123, 0.35);
    --primary-soft: rgba(49, 226, 123, 0.14);
    --accent-color: #38bdf8;
    --accent-glow: rgba(56, 189, 248, 0.25);
    --on-primary: #04120a;

    --danger-color: #fb3b4e;
    --danger-soft: rgba(251, 59, 78, 0.15);
    --online-color: #31e27b;

    /* Radii */
    --radius-xl: 22px;
    --radius-lg: 18px;
    --radius-md: 13px;
    --radius-sm: 9px;

    /* Spacing scale (4/8 rhythm) */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;

    /* Shadows / elevation */
    --shadow-1: 0 2px 12px rgba(0, 0, 0, 0.30);
    --shadow-2: 0 10px 34px rgba(0, 0, 0, 0.45);
    --shadow-glow: 0 0 0 1px var(--primary-soft), 0 8px 30px var(--primary-glow);

    /* Fonts */
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-display: 'Orbitron', var(--font-sans);
    --font-mono: 'JetBrains Mono', ui-monospace, monospace;

    --nav-h: 66px;
}

/* ---------- Theme accents ---------- */
.theme-green {
    --primary-color: #31e27b; --primary-strong: #21c968;
    --primary-glow: rgba(49, 226, 123, 0.35); --primary-soft: rgba(49, 226, 123, 0.14);
    --accent-color: #38bdf8; --accent-glow: rgba(56, 189, 248, 0.28);
    --on-primary: #04120a; --online-color: #31e27b;
}
.theme-blue {
    --primary-color: #38bdf8; --primary-strong: #1ea5e6;
    --primary-glow: rgba(56, 189, 248, 0.38); --primary-soft: rgba(56, 189, 248, 0.15);
    --accent-color: #a78bfa; --accent-glow: rgba(167, 139, 250, 0.28);
    --on-primary: #04121b; --online-color: #38bdf8;
}
.theme-gold {
    --primary-color: #f5b301; --primary-strong: #e0a300;
    --primary-glow: rgba(245, 179, 1, 0.35); --primary-soft: rgba(245, 179, 1, 0.14);
    --accent-color: #fb923c; --accent-glow: rgba(251, 146, 60, 0.28);
    --on-primary: #1a1200; --online-color: #f5b301;
}
.theme-red {
    --primary-color: #fb3b4e; --primary-strong: #e21f34;
    --primary-glow: rgba(251, 59, 78, 0.38); --primary-soft: rgba(251, 59, 78, 0.15);
    --accent-color: #fb7185; --accent-glow: rgba(251, 113, 133, 0.28);
    --on-primary: #1c0306; --online-color: #fb7185;
}
.theme-purple {
    --primary-color: #a78bfa; --primary-strong: #8b5cf6;
    --primary-glow: rgba(167, 139, 250, 0.4); --primary-soft: rgba(167, 139, 250, 0.16);
    --accent-color: #f472b6; --accent-glow: rgba(244, 114, 182, 0.28);
    --on-primary: #120522; --online-color: #a78bfa;
}
.theme-dark {
    --primary-color: #94a3b8; --primary-strong: #7c8aa0;
    --primary-glow: rgba(148, 163, 184, 0.3); --primary-soft: rgba(148, 163, 184, 0.14);
    --accent-color: #cbd5e1; --accent-glow: rgba(203, 213, 225, 0.22);
    --on-primary: #0b0e14; --online-color: #94a3b8;
}

/* Telegram theme integration (keep bg but respect user pref subtly) */
body.tg-theme { --bg-0: var(--tg-theme-bg-color, #07080d); }

/* ---------- Reset ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html { -webkit-text-size-adjust: 100%; }

body {
    background-color: var(--bg-0);
    color: var(--text-main);
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.5;
    overflow-x: hidden;
    min-height: 100dvh;
    -webkit-font-smoothing: antialiased;
}

/* ---------- Background HUD layers ---------- */
.bg-grid {
    position: fixed; inset: 0; z-index: -2; pointer-events: none;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: radial-gradient(ellipse 90% 60% at 50% 0%, #000 30%, transparent 80%);
    -webkit-mask-image: radial-gradient(ellipse 90% 60% at 50% 0%, #000 30%, transparent 80%);
}
.bg-glow {
    position: fixed; inset: 0; z-index: -3; pointer-events: none;
    background:
        radial-gradient(60% 45% at 50% -8%, var(--primary-glow), transparent 70%),
        radial-gradient(50% 40% at 100% 0%, var(--accent-glow), transparent 70%),
        var(--bg-0);
    opacity: 0.9;
    transition: background 0.5s ease;
}

/* ---------- Layout ---------- */
.app-container {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    padding: calc(env(safe-area-inset-top) + 14px) 16px calc(var(--nav-h) + env(safe-area-inset-bottom) + 20px);
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
}

/* Glass panel helper */
.glass-panel {
    background: var(--surface-1);
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-1);
}

/* ---------- Header ---------- */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-4);
    gap: var(--space-2);
}
.logo-area { display: flex; align-items: center; gap: 11px; min-width: 0; }
.logo-mark {
    width: 40px; height: 40px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    border-radius: 12px;
    background: linear-gradient(145deg, var(--primary-soft), transparent);
    border: 1px solid var(--panel-border-strong);
    box-shadow: inset 0 0 12px var(--primary-soft);
}
.pulse-icon {
    font-size: 18px;
    color: var(--primary-color);
    filter: drop-shadow(0 0 6px var(--primary-glow));
    animation: icon-pulse 2.4s infinite ease-in-out;
}
.logo-text { min-width: 0; }
.logo-text h1 {
    font-family: var(--font-display);
    font-size: 17px;
    font-weight: 800;
    letter-spacing: 1px;
    line-height: 1.1;
    color: var(--text-main);
    text-shadow: 0 0 14px var(--primary-glow);
}
.logo-text .subtitle {
    font-size: 9.5px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-muted);
    font-weight: 600;
}

.header-right-area { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.icon-btn {
    background: var(--surface-1);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-soft);
    font-size: 15px;
    cursor: pointer;
    transition: transform .15s ease, border-color .2s ease, color .2s ease, box-shadow .2s ease;
}
.icon-btn:hover, .icon-btn.active {
    border-color: var(--primary-color);
    color: var(--primary-color);
    box-shadow: 0 0 12px var(--primary-glow);
}
.icon-btn:active { transform: scale(0.92); }
.icon-btn:hover i { transform: rotate(45deg); }
.icon-btn i { transition: transform .3s ease; }

/* User badge (profile shortcut) */
.user-badge {
    display: flex; align-items: center; gap: 7px;
    height: 40px; padding: 0 14px;
    background: var(--surface-1);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    cursor: pointer;
    white-space: nowrap;
    transition: border-color .2s ease, color .2s ease, box-shadow .2s ease;
}
.user-badge i { font-size: 13px; color: var(--primary-color); }
.user-badge span { font-size: 13px; font-weight: 600; }
.user-badge:hover, .user-badge:focus-visible {
    border-color: var(--primary-color); color: var(--primary-color);
    box-shadow: 0 0 12px var(--primary-glow); outline: none;
}
.user-badge-skeleton {
    width: 92px; height: 40px;
    background: var(--surface-1);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    animation: pulse-skeleton 1.5s infinite;
}

/* ---------- Profile summary card ---------- */
.profile-summary-card { padding: var(--space-4); margin-bottom: var(--space-4); }
.profile-header { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-3); }
.avatar-container {
    width: 48px; height: 48px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    border-radius: 14px; overflow: hidden;
    border: 1px solid var(--panel-border-strong);
    background: var(--surface-2);
    box-shadow: inset 0 0 12px rgba(0,0,0,.4);
}
.avatar-container img { width: 100%; height: 100%; object-fit: cover; display: block; }
.profile-info { min-width: 0; }
.profile-info h3, .pf-name-block h3 {
    font-size: 16px; font-weight: 700; font-family: var(--font-display);
    letter-spacing: .3px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.mc-nick {
    font-family: var(--font-mono);
    font-size: 11px; font-weight: 600;
    color: var(--primary-color);
    background: var(--primary-soft);
    border: 1px solid var(--primary-soft);
    padding: 1px 7px; border-radius: 6px;
}

/* Tariff tag */
.tariff-tag {
    display: inline-flex; align-items: center;
    font-size: 11px; font-weight: 700; letter-spacing: .3px;
    padding: 3px 10px; border-radius: 20px; white-space: nowrap;
    background: rgba(255,255,255,.06); border: 1px solid var(--panel-border);
    color: var(--text-soft);
    margin-top: 4px;
}
.tariff-tag.free { color: #31e27b; border-color: rgba(49,226,123,.4); background: rgba(49,226,123,.1); }
.tariff-tag.advanced { color: #38bdf8; border-color: rgba(56,189,248,.4); background: rgba(56,189,248,.1); }
.tariff-tag.premium { color: #f5b301; border-color: rgba(245,179,1,.4); background: rgba(245,179,1,.12); }

/* Limit / progress */
.limit-status { margin-top: 4px; }
.limit-labels { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-muted); margin-bottom: 7px; }
.limit-labels .mono { color: var(--text-soft); }
.progress-bar-container {
    width: 100%; height: 7px; border-radius: 20px;
    background: rgba(255,255,255,.07); overflow: hidden;
}
.progress-bar {
    height: 100%; border-radius: 20px;
    background: linear-gradient(90deg, var(--primary-strong), var(--primary-color));
    box-shadow: 0 0 10px var(--primary-glow);
    transition: width .6s cubic-bezier(.22,1,.36,1);
}

/* ---------- Search form ---------- */
.search-form-card { padding: var(--space-4); margin-bottom: var(--space-4); }
.form-group { margin-bottom: var(--space-4); }
.form-group:last-of-type { margin-bottom: var(--space-3); }
.form-group > label {
    display: block; font-size: 11px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 1.2px;
    color: var(--text-muted); margin-bottom: 9px;
}

.input-wrapper { position: relative; display: flex; align-items: center; }
.input-icon {
    position: absolute; left: 14px; color: var(--text-faint);
    font-size: 14px; pointer-events: none; transition: color .2s ease;
}
.input-wrapper input {
    width: 100%; height: 48px;
    background: var(--surface-solid);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-family: var(--font-sans); font-size: 15px;
    padding: 0 42px 0 40px;
    transition: border-color .2s ease, box-shadow .2s ease;
    outline: none;
}
.input-wrapper input::placeholder { color: var(--text-faint); }
.input-wrapper input:focus { border-color: var(--primary-color); box-shadow: 0 0 0 3px var(--primary-soft); }
.input-wrapper input:focus + .clear-btn, .input-wrapper:focus-within .input-icon { color: var(--primary-color); }
.clear-btn {
    position: absolute; right: 8px;
    width: 30px; height: 30px; border-radius: 8px;
    background: transparent; border: none; color: var(--text-faint);
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: color .2s ease, background .2s ease;
}
.clear-btn:hover { color: var(--text-main); background: rgba(255,255,255,.06); }

/* Segmented period selector */
.period-selector {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
    background: var(--surface-solid); border: 1px solid var(--panel-border);
    border-radius: var(--radius-md); padding: 5px;
}
.period-btn {
    height: 38px; border: none; border-radius: 9px;
    background: transparent; color: var(--text-muted);
    font-family: var(--font-sans); font-size: 13px; font-weight: 600;
    cursor: pointer; transition: all .2s ease;
}
.period-btn:hover { color: var(--text-soft); }
.period-btn.active {
    background: var(--primary-color); color: var(--on-primary);
    font-weight: 700;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    font-family: var(--font-sans); font-weight: 700; font-size: 14px;
    border: none; border-radius: var(--radius-md); cursor: pointer;
    padding: 0 18px; height: 48px;
    transition: transform .12s ease, box-shadow .2s ease, filter .2s ease, background .2s ease;
    outline: none;
}
.btn:focus-visible { box-shadow: 0 0 0 3px var(--primary-soft); }
.btn-block { width: 100%; }
.btn-sm { height: 44px; min-width: 44px; padding: 0 14px; font-size: 13px; }
.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-strong));
    color: var(--on-primary);
    box-shadow: 0 6px 20px var(--primary-glow);
}
.btn-primary:hover { filter: brightness(1.06); box-shadow: 0 8px 26px var(--primary-glow); }
.btn-primary:active { transform: scale(.98); }
.btn-primary:disabled { opacity: .55; filter: grayscale(.3); cursor: default; box-shadow: none; }
.btn-secondary {
    background: var(--surface-2); color: var(--text-soft);
    border: 1px solid var(--panel-border-strong);
}
.btn-secondary:hover { border-color: var(--primary-color); color: var(--primary-color); }
.spinner { font-size: 15px; }

/* ---------- Pinned players ---------- */
.pinned-players-area { padding: var(--space-4); margin-bottom: var(--space-4); }
.pinned-header {
    font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 1.2px;
    color: var(--text-muted); margin-bottom: var(--space-3);
}
.pinned-list { display: flex; flex-wrap: wrap; gap: 8px; }
.pinned-tag {
    display: inline-flex; align-items: center; gap: 7px;
    height: 36px; padding: 0 10px 0 12px;
    background: var(--surface-2); border: 1px solid var(--panel-border);
    border-radius: 10px; font-size: 13px; font-weight: 600; color: var(--text-soft);
    cursor: pointer; transition: border-color .2s ease, transform .12s ease, box-shadow .2s ease;
    max-width: 100%;
}
.pinned-tag:hover { border-color: var(--primary-color); box-shadow: 0 0 10px var(--primary-glow); }
.pinned-tag:active { transform: scale(.96); }
.pinned-tag > span:not(.pinned-dot):not(.pinned-tag-unpin) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pinned-dot {
    width: 8px; height: 8px; border-radius: 50%; background: var(--text-faint); flex-shrink: 0;
}
.pinned-dot.online { background: var(--online-color); box-shadow: 0 0 8px var(--online-color); animation: soft-pulse 1.8s infinite; }
.pinned-watch-ico { color: var(--accent-color); font-size: 11px; }
.pinned-tag-unpin {
    display: flex; align-items: center; justify-content: center;
    width: 22px; height: 22px; border-radius: 7px; color: var(--text-faint);
    transition: color .2s ease, background .2s ease;
}
.pinned-tag-unpin:hover { color: var(--danger-color); background: var(--danger-soft); }

/* ---------- Results ---------- */
.results-area { margin-bottom: var(--space-3); }
.results-header { display: flex; align-items: center; gap: 10px; margin-bottom: var(--space-3); }
.results-header h2 { font-family: var(--font-display); font-size: 15px; font-weight: 700; letter-spacing: .5px; }
.badge {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 26px; height: 22px; padding: 0 8px; border-radius: 20px;
    background: var(--primary-soft); color: var(--primary-color);
    font-size: 12px; font-weight: 700; border: 1px solid var(--primary-soft);
}
.results-sort {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    margin-bottom: var(--space-3); font-size: 12px;
}
.sort-label { color: var(--text-muted); margin-right: 2px; }
.sort-btn {
    height: 30px; padding: 0 12px; border-radius: 8px;
    background: var(--surface-1); border: 1px solid var(--panel-border);
    color: var(--text-muted); font-size: 12px; font-weight: 600; cursor: pointer;
    transition: all .2s ease;
}
.sort-btn.active { color: var(--primary-color); border-color: var(--primary-color); background: var(--primary-soft); }

.results-list { display: flex; flex-direction: column; gap: 10px; }

.player-card {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 13px 14px;
    background: var(--surface-1); border: 1px solid var(--panel-border);
    border-radius: var(--radius-md); cursor: pointer;
    transition: border-color .2s ease, transform .12s ease, box-shadow .2s ease, background .2s ease;
    animation: card-in .4s cubic-bezier(.22,1,.36,1) both;
    animation-delay: calc(var(--i, 0) * 42ms);
}
.player-card:hover { border-color: var(--primary-color); box-shadow: 0 0 0 1px var(--primary-soft), var(--shadow-1); transform: translateY(-1px); }
.player-card:active { transform: scale(.99); }
.player-card-info { display: flex; align-items: center; gap: 12px; min-width: 0; }
.player-avatar-mini {
    width: 42px; height: 42px; flex-shrink: 0; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    background: var(--surface-2); border: 1px solid var(--panel-border);
    color: var(--text-muted); font-size: 16px;
}
.player-avatar-mini.online {
    color: var(--online-color); border-color: var(--online-color);
    box-shadow: 0 0 12px var(--primary-glow); background: var(--primary-soft);
}
.player-name-container { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.player-name-lbl { font-size: 15px; font-weight: 700; letter-spacing: .2px; overflow: hidden; text-overflow: ellipsis; }
.player-entries-tag { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.player-card-arrow { color: var(--text-faint); font-size: 13px; flex-shrink: 0; transition: transform .2s ease, color .2s ease; }
.player-card:hover .player-card-arrow { color: var(--primary-color); transform: translateX(3px); }

/* Online status badge */
.online-status-badge {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 10.5px; font-weight: 700; letter-spacing: .2px;
    padding: 2px 8px; border-radius: 20px; white-space: nowrap;
}
.online-status-badge.online { color: var(--online-color); background: var(--primary-soft); border: 1px solid var(--primary-soft); }
.online-status-badge.offline { color: var(--text-faint); background: rgba(255,255,255,.05); border: 1px solid var(--panel-border); }
.pulse-dot {
    width: 6px; height: 6px; border-radius: 50%; background: var(--online-color);
    box-shadow: 0 0 6px var(--online-color); animation: soft-pulse 1.6s infinite;
}

.results-capped-hint {
    margin-top: 12px; padding: 10px 12px; border-radius: var(--radius-sm);
    background: var(--surface-1); border: 1px dashed var(--panel-border-strong);
    font-size: 12px; color: var(--text-muted); line-height: 1.4;
}

/* ---------- Empty state ---------- */
.empty-state {
    display: flex; flex-direction: column; align-items: center; text-align: center;
    padding: 40px 24px; color: var(--text-muted);
}
.empty-state .fade-icon, .empty-state i {
    font-size: 42px; margin-bottom: 16px; color: var(--text-faint);
    opacity: .8; animation: float-fade 3s infinite ease-in-out;
}
.empty-state p { max-width: 280px; font-size: 13.5px; line-height: 1.6; }

/* ---------- Skeletons ---------- */
.skeleton-card {
    height: 68px; border-radius: var(--radius-md);
    background: linear-gradient(100deg, var(--surface-1) 30%, rgba(255,255,255,.06) 50%, var(--surface-1) 70%);
    background-size: 200% 100%;
    animation: shimmer 1.3s infinite linear;
    border: 1px solid var(--panel-border);
}

/* ---------- Bottom navigation ---------- */
.tab-navigation {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    display: flex; justify-content: center; gap: 2px;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, rgba(11,13,21,.7), rgba(7,8,13,.94));
    backdrop-filter: blur(20px) saturate(140%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
    border-top: 1px solid var(--panel-border);
}
.tab-btn {
    flex: 1; max-width: 96px;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    min-height: 50px; padding: 6px 4px;
    background: transparent; border: none; border-radius: 12px;
    color: var(--text-faint); cursor: pointer;
    transition: color .2s ease, background .2s ease;
    position: relative;
}
.tab-btn i { font-size: 17px; transition: transform .2s ease; }
.tab-btn span { font-size: 10px; font-weight: 600; letter-spacing: .2px; }
.tab-btn:active i { transform: scale(.85); }
.tab-btn.active { color: var(--primary-color); }
.tab-btn.active::before {
    content: ""; position: absolute; top: 0; width: 26px; height: 3px; border-radius: 3px;
    background: var(--primary-color); box-shadow: 0 0 10px var(--primary-glow);
}

/* ---------- Tabs ---------- */
.tab-content { flex: 1; }
.tab-pane { display: none; animation: pane-in .32s ease; }
.tab-pane.active { display: block; }

/* ---------- Profile tab ---------- */
.profile-page-card { padding: var(--space-4); margin-bottom: var(--space-4); }
.profile-page-header { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-4); }
.pf-name-block { flex: 1; min-width: 0; }
.pf-id { display: block; font-size: 11px; color: var(--text-muted); margin-top: 3px; }
.pf-stats-grid {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: var(--space-4);
}
.pf-stat {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 12px 4px; border-radius: var(--radius-sm);
    background: var(--surface-solid); border: 1px solid var(--panel-border);
}
.pf-stat-num { font-size: 18px; font-weight: 700; color: var(--primary-color); }
.pf-stat-lbl { font-size: 9.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); text-align: center; }
.pf-meta {
    display: flex; flex-direction: column; gap: 6px; margin: var(--space-4) 0;
    font-size: 12.5px; color: var(--text-muted);
}
.pf-meta b { color: var(--text-soft); font-weight: 600; }
.pf-watch-card { padding: var(--space-4); }
.pf-watch-card h3, .settings-card h3, .help-card h3 {
    font-family: var(--font-display); font-size: 14px; font-weight: 700; letter-spacing: .4px;
    margin-bottom: 6px; display: flex; align-items: center;
}

/* ---------- Stats tab ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-3); }
.stats-card {
    padding: 20px 16px; display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
    position: relative; overflow: hidden;
}
.stats-card-icon {
    font-size: 20px; color: var(--primary-color);
    filter: drop-shadow(0 0 8px var(--primary-glow)); margin-bottom: 6px;
}
.stats-value { font-size: 26px; font-weight: 700; color: var(--text-main); letter-spacing: .5px; }
.stats-label { font-size: 12px; color: var(--text-muted); }

/* ---------- Settings ---------- */
.settings-card { padding: var(--space-4); margin-bottom: var(--space-4); }
.settings-desc { font-size: 12.5px; color: var(--text-muted); margin-bottom: var(--space-3); line-height: 1.5; }
.nickname-setting-row { display: flex; gap: 8px; }
.nickname-setting-row .input-wrapper { flex: 1; }

.theme-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.theme-btn-card {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    padding: 14px 6px; border-radius: var(--radius-md);
    background: var(--surface-solid); border: 1px solid var(--panel-border);
    cursor: pointer; transition: border-color .2s ease, transform .12s ease, box-shadow .2s ease;
}
.theme-btn-card:active { transform: scale(.96); }
.theme-swatch {
    width: 26px; height: 26px; border-radius: 50%;
    background: var(--sw, #fff); box-shadow: 0 0 12px -2px var(--sw, #fff);
    border: 2px solid rgba(255,255,255,.15);
}
.theme-name { font-size: 11.5px; font-weight: 600; color: var(--text-soft); }
.theme-btn-card.active { border-color: var(--sw); box-shadow: 0 0 0 1px var(--sw), 0 0 14px -2px var(--sw); }
.theme-btn-card.active .theme-name { color: var(--text-main); }

.setting-toggle-row, .setting-action-row {
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    padding: 12px 0; border-top: 1px solid var(--panel-border);
}
.settings-card > .setting-toggle-row:first-of-type,
.settings-card > .setting-action-row:first-of-type { border-top: none; padding-top: 4px; }
.setting-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.setting-title { font-size: 13.5px; font-weight: 600; color: var(--text-main); }
.setting-subtitle { font-size: 11.5px; color: var(--text-muted); line-height: 1.4; }

/* Toggle switch */
.switch { position: relative; display: inline-block; width: 46px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute; inset: 0; cursor: pointer; border-radius: 26px;
    background: var(--surface-2); border: 1px solid var(--panel-border);
    transition: background .25s ease, border-color .25s ease;
}
.slider::before {
    content: ""; position: absolute; height: 18px; width: 18px; left: 3px; top: 3px;
    border-radius: 50%; background: var(--text-muted); transition: transform .25s ease, background .25s ease;
}
.switch input:checked + .slider { background: var(--primary-soft); border-color: var(--primary-color); }
.switch input:checked + .slider::before { transform: translateX(20px); background: var(--primary-color); box-shadow: 0 0 8px var(--primary-glow); }
.switch input:focus-visible + .slider { box-shadow: 0 0 0 3px var(--primary-soft); }

/* ---------- Help ---------- */
.help-card { padding: var(--space-4); margin-bottom: var(--space-4); }
.help-card h3 { margin-bottom: var(--space-3); }
.help-step { display: flex; align-items: flex-start; gap: 12px; padding: 8px 0; }
.step-num {
    flex-shrink: 0; width: 26px; height: 26px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    background: var(--primary-soft); color: var(--primary-color);
    font-size: 13px; font-weight: 700; border: 1px solid var(--primary-soft);
}
.help-step p { font-size: 13px; color: var(--text-soft); line-height: 1.5; padding-top: 3px; }
.tariff-row { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-top: 1px solid var(--panel-border); }
.tariff-row:first-of-type { border-top: none; }
.tariff-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; box-shadow: 0 0 8px -1px currentColor; }
.tariff-desc { display: flex; flex-direction: column; gap: 2px; }
.tariff-desc strong { font-size: 13.5px; font-weight: 700; color: var(--text-main); }
.tariff-desc span { font-size: 12px; color: var(--text-muted); }

/* ---------- Modal ---------- */
.modal-overlay {
    position: fixed; inset: 0; z-index: 100;
    display: flex; align-items: flex-end; justify-content: center;
    background: rgba(4, 5, 10, 0.72);
    backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
    padding: 0; animation: fade-in .25s ease;
}
.modal-content {
    width: 100%; max-width: 480px; max-height: 92dvh;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    background: var(--surface-solid);
    border: 1px solid var(--panel-border-strong); border-bottom: none;
    display: flex; flex-direction: column; overflow: hidden;
}
.animate-slide-up { animation: slide-up .34s cubic-bezier(.22,1,.36,1); }
.modal-header {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 16px 16px 12px; border-bottom: 1px solid var(--panel-border);
}
.modal-title-area { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.modal-title-area h2 { font-family: var(--font-display); font-size: 16px; font-weight: 700; letter-spacing: .3px; }
.modal-pin-btn {
    width: 34px; height: 34px; border-radius: 9px;
    background: var(--surface-2); border: 1px solid var(--panel-border);
    color: var(--text-muted); cursor: pointer; font-size: 14px;
    display: flex; align-items: center; justify-content: center; transition: all .2s ease;
}
.modal-pin-btn:hover { color: var(--primary-color); border-color: var(--primary-color); }
.modal-pin-btn.pinned { color: #f5b301; border-color: rgba(245,179,1,.5); background: rgba(245,179,1,.12); }
.modal-watch-btn.watching { color: var(--accent-color); border-color: var(--accent-color); background: var(--accent-glow); }
.modal-close-btn {
    width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
    background: var(--surface-2); border: 1px solid var(--panel-border);
    color: var(--text-soft); cursor: pointer; font-size: 15px;
    display: flex; align-items: center; justify-content: center; transition: all .2s ease;
}
.modal-close-btn:hover { color: var(--danger-color); border-color: var(--danger-color); }
.modal-online-badge {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 20px;
}
.modal-online-badge.online { color: var(--online-color); background: var(--primary-soft); }
.modal-online-badge.offline { color: var(--text-faint); background: rgba(255,255,255,.05); }
.modal-lastseen { font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); }

.modal-body { padding: 16px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.player-stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: var(--space-4); }
.player-stat-box {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 14px 8px; border-radius: var(--radius-md);
    background: var(--surface-1); border: 1px solid var(--panel-border);
}
.stat-num { font-size: 22px; font-weight: 700; }
.stat-lbl { font-size: 10.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); text-align: center; }

/* Charts */
.charts-section { display: flex; flex-direction: column; gap: var(--space-3); margin-bottom: var(--space-4); }
.chart-container {
    padding: 14px; border-radius: var(--radius-md);
    background: var(--surface-1); border: 1px solid var(--panel-border);
}
.chart-title {
    display: flex; align-items: center; gap: 7px;
    font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .8px;
    color: var(--text-muted); margin-bottom: 12px;
}
.chart-title i { color: var(--primary-color); }
.chart-wrapper { position: relative; height: 130px; }

/* Activities / movements */
.activities-header {
    display: flex; align-items: center; gap: 8px; margin-bottom: var(--space-3);
    font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted);
}
.activities-header i { color: var(--primary-color); }
.activities-list { display: flex; flex-direction: column; gap: 8px; }
.activity-item {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 12px 13px; border-radius: var(--radius-md);
    background: var(--surface-1); border: 1px solid var(--panel-border);
    border-left: 3px solid var(--primary-color);
}
.activity-item.compact { padding: 8px 11px; }
.movement-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.activity-srv { font-size: 13px; font-weight: 600; color: var(--text-main); }
.movement-time { font-size: 11.5px; color: var(--text-muted); font-family: var(--font-mono); }
.movement-duration {
    font-size: 11.5px; font-weight: 600; color: var(--primary-color); white-space: nowrap;
    background: var(--primary-soft); padding: 4px 9px; border-radius: 8px; font-family: var(--font-mono);
}
.activity-item.compact .activity-srv { font-size: 12px; }
.activity-item.compact .movement-time { font-size: 10.5px; }

/* ---------- No-user screen ---------- */
.no-user-container {
    min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px;
}
.no-user-card { max-width: 340px; padding: 32px 24px; text-align: center; }
.no-user-icon { font-size: 44px; color: var(--danger-color); margin-bottom: 18px; }
.no-user-title { font-family: var(--font-display); font-size: 19px; margin-bottom: 10px; }
.no-user-text { font-size: 13.5px; color: var(--text-muted); line-height: 1.6; }

/* ---------- Utilities ---------- */
.hidden { display: none !important; }
.text-primary { color: var(--primary-color); }
.text-danger { color: var(--danger-color); }
.icon-gap { margin-right: 6px; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.bump { animation: bump .45s cubic-bezier(.22,1.4,.5,1); }

/* Monogram avatar (self-hosted, no external image) */
.avatar-monogram {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    /* Inter (а не Orbitron): покрывает латиницу И кириллицу, ники бывают любые.
       line-height:1 + flex-центрирование держит символ по центру при любом шрифте-фолбэке. */
    font-family: var(--font-sans); font-weight: 800; font-size: 17px; line-height: 1;
    letter-spacing: .3px; text-align: center; overflow: hidden;
    color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.45);
    background: linear-gradient(135deg, var(--primary-strong), var(--primary-color));
}

/* ---------- Animations ---------- */
@keyframes icon-pulse { 0%,100% { opacity: 1; } 50% { opacity: .55; } }
@keyframes soft-pulse { 0%,100% { opacity: 1; } 50% { opacity: .4; } }
@keyframes pulse-skeleton { 0%,100% { opacity: 1; } 50% { opacity: .5; } }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@keyframes card-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pane-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes float-fade { 0%,100% { transform: translateY(0); opacity: .8; } 50% { transform: translateY(-6px); opacity: 1; } }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.18); color: var(--primary-color); } 100% { transform: scale(1); } }

/* ---------- Accessibility ---------- */
:focus-visible { outline: none; }
a:focus-visible, button:focus-visible, input:focus-visible, [tabindex]:focus-visible {
    box-shadow: 0 0 0 3px var(--primary-soft); border-radius: 8px;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
    .player-card { animation: none; }
}

/* Small phones */
@media (max-width: 360px) {
    body { font-size: 14px; }
    .tab-btn span { font-size: 9px; }
    .pf-stat-num { font-size: 16px; }
    .stats-value { font-size: 22px; }
}

/* ============================================================
   DESIGN SKINS  (independent of accent theme)
   Applied via body.design-<id>. Override structural tokens only.
   ============================================================ */

/* ---- Cyber-HUD (base / default) ---- */
/* design-cyber uses the root tokens as-is; no overrides needed. */

/* ---- Minimal: flat, professional, no glow/grid ---- */
body.design-minimal {
    --bg-0: #0f1117;
    --surface-1: #171922; --surface-2: #1e2130; --surface-solid: #121420;
    --panel-border: rgba(255,255,255,.07); --panel-border-strong: rgba(255,255,255,.12);
    --radius-xl: 16px; --radius-lg: 13px; --radius-md: 10px; --radius-sm: 7px;
    --shadow-1: 0 1px 2px rgba(0,0,0,.25); --shadow-2: 0 6px 18px rgba(0,0,0,.35);
}
body.design-minimal .bg-grid { display: none; }
body.design-minimal .bg-glow { opacity: .35; }
body.design-minimal .glass-panel { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--surface-1); }
body.design-minimal .tab-navigation { backdrop-filter: none; -webkit-backdrop-filter: none; background: #0c0e15; }
body.design-minimal .logo-text h1 { text-shadow: none; }
body.design-minimal .logo-mark { box-shadow: none; }
body.design-minimal .btn-primary { box-shadow: none; }
body.design-minimal .progress-bar { box-shadow: none; }
body.design-minimal .tab-btn.active::before { box-shadow: none; }

/* ---- Aurora: soft, rounded, colourful blur ---- */
body.design-aurora {
    --bg-0: #0a0a16;
    --surface-1: rgba(30, 27, 55, 0.55); --surface-2: rgba(42, 38, 72, 0.75); --surface-solid: #17142a;
    --panel-border: rgba(255,255,255,.10); --panel-border-strong: rgba(255,255,255,.18);
    --radius-xl: 28px; --radius-lg: 24px; --radius-md: 18px; --radius-sm: 14px;
    --shadow-2: 0 16px 50px rgba(0,0,0,.5);
}
body.design-aurora .bg-grid { display: none; }
body.design-aurora .bg-glow {
    opacity: 1;
    background:
        radial-gradient(50% 40% at 15% 0%, var(--primary-glow), transparent 70%),
        radial-gradient(50% 40% at 85% 5%, var(--accent-glow), transparent 70%),
        radial-gradient(60% 50% at 50% 100%, rgba(167,139,250,.18), transparent 70%),
        var(--bg-0);
}
body.design-aurora .glass-panel { backdrop-filter: blur(30px) saturate(160%); -webkit-backdrop-filter: blur(30px) saturate(160%); }
body.design-aurora .btn, body.design-aurora .period-selector, body.design-aurora .input-wrapper input { border-radius: 999px; }
body.design-aurora .pinned-tag, body.design-aurora .badge, body.design-aurora .online-status-badge { border-radius: 999px; }

/* ---- Midnight: OLED pure-black, high contrast, sharp ---- */
body.design-midnight {
    --bg-0: #000000;
    --surface-1: #0a0a0c; --surface-2: #131316; --surface-solid: #060608;
    --panel-border: rgba(255,255,255,.10); --panel-border-strong: rgba(255,255,255,.18);
    --text-main: #ffffff; --text-soft: #d4d8e0;
    --radius-xl: 14px; --radius-lg: 12px; --radius-md: 9px; --radius-sm: 6px;
    --shadow-1: none; --shadow-2: 0 8px 30px rgba(0,0,0,.7);
}
body.design-midnight .bg-grid { opacity: .5; }
body.design-midnight .bg-glow { opacity: .55; }
body.design-midnight .glass-panel { backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
body.design-midnight .tab-navigation { background: #000; }

/* ---- Terminal: monospace CRT, sharp corners, scanlines ---- */
body.design-terminal {
    --font-sans: 'JetBrains Mono', ui-monospace, monospace;
    --font-display: 'JetBrains Mono', ui-monospace, monospace;
    --bg-0: #050806;
    --surface-1: rgba(10, 20, 14, 0.7); --surface-2: rgba(14, 26, 18, 0.85); --surface-solid: #08120b;
    --panel-border: rgba(120, 255, 170, 0.14); --panel-border-strong: rgba(120,255,170,.28);
    --radius-xl: 5px; --radius-lg: 5px; --radius-md: 4px; --radius-sm: 3px;
}
body.design-terminal .logo-text h1,
body.design-terminal .modal-title-area h2,
body.design-terminal .results-header h2 { letter-spacing: 1px; }
body.design-terminal .form-group > label,
body.design-terminal .pinned-header { letter-spacing: 1.5px; }
body.design-terminal .bg-grid {
    background-image:
        linear-gradient(var(--primary-soft) 1px, transparent 1px),
        linear-gradient(90deg, var(--primary-soft) 1px, transparent 1px);
    background-size: 28px 28px; opacity: .5;
}
/* CRT scanlines */
body.design-terminal::after {
    content: ""; position: fixed; inset: 0; z-index: 999; pointer-events: none;
    background: repeating-linear-gradient(180deg, rgba(0,0,0,0) 0, rgba(0,0,0,0) 2px, rgba(0,0,0,.16) 3px);
    mix-blend-mode: multiply;
}
@media (prefers-reduced-motion: reduce) { body.design-terminal::after { display: none; } }

/* ============================================================
   DESIGN PICKER  (settings)
   ============================================================ */
.design-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.design-btn-card {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    padding: 10px 7px; border-radius: var(--radius-md);
    background: var(--surface-solid); border: 1px solid var(--panel-border);
    cursor: pointer; transition: border-color .2s ease, transform .12s ease, box-shadow .2s ease;
}
.design-btn-card:active { transform: scale(.96); }
.design-btn-card.active { border-color: var(--primary-color); box-shadow: 0 0 0 1px var(--primary-soft), 0 0 14px -3px var(--primary-glow); }
.design-name { font-size: 11px; font-weight: 600; color: var(--text-soft); }
.design-btn-card.active .design-name { color: var(--text-main); }
.design-preview {
    width: 100%; height: 44px; border-radius: 8px; overflow: hidden; position: relative;
    display: flex; flex-direction: column; justify-content: center; gap: 5px; padding: 9px;
    border: 1px solid rgba(255,255,255,.08);
}
.dp-bar { height: 5px; border-radius: 3px; background: currentColor; width: 78%; opacity: .95; }
.dp-bar.short { width: 48%; opacity: .5; }
/* Skin thumbnails */
.design-preview-cyber {
    color: #31e27b; background:
        linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px) 0 0/10px 10px,
        radial-gradient(60% 80% at 50% 0%, rgba(49,226,123,.25), transparent), #0b0d15;
}
.design-preview-minimal { color: #9aa4b8; background: #171922; }
.design-preview-aurora {
    color: #f472b6;
    background: radial-gradient(70% 90% at 20% 0%, rgba(167,139,250,.6), transparent), radial-gradient(70% 90% at 90% 100%, rgba(56,189,248,.5), transparent), #17142a;
}
.design-preview-aurora .dp-bar { border-radius: 999px; }
.design-preview-midnight { color: #ffffff; background: #000; }
.design-preview-terminal {
    color: #5bffa6; font-family: var(--font-mono); background:
        repeating-linear-gradient(180deg, transparent 0 3px, rgba(0,0,0,.35) 4px),
        linear-gradient(#5bffa622 1px, transparent 1px) 0 0/9px 9px, #08120b;
    border-radius: 3px;
}
.design-preview-terminal .dp-bar { border-radius: 1px; }
