/* ============================================================
   Theme: Dark ⇄ Light — premium minimal + Mobile First
   ============================================================ */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

/* ============================================================
   THEME VARIABLES
   ============================================================ */

/* ==== DARK (по умолчанию) ==== */
:root,
[data-theme="dark"] {
    --bg:         #0d0f12;
    --bg-elev:    #12151a;
    --bg-panel:   #161a20;
    --bg-hover:   #1c2129;
    --bg-input:   #0f1216;

    --line:       rgba(255, 255, 255, .06);
    --line-2:     rgba(255, 255, 255, .10);
    --line-3:     rgba(255, 255, 255, .16);

    --text:       #e8ecef;
    --text-2:     #a8b2bd;
    --text-3:     #6b7480;
    --text-4:     #4a525c;

    --accent:       #10b981;
    --accent-2:     #059669;
    --accent-soft:  rgba(16, 185, 129, .10);
    --accent-line:  rgba(16, 185, 129, .35);
    --accent-glow:  rgba(16, 185, 129, .25);

    --success:  #10b981;
    --warning:  #f59e0b;
    --danger:   #ef4444;
    --info:     #3b82f6;

    --surface:       #161a20;
    --surface-2:     #12151a;
    --surface-3:     #1c2129;
    --surface-hover: #1c2129;

    --scrollbar:        #1c2129;
    --scrollbar-hover:  rgba(255,255,255,.16);

    --overlay-modal:   rgba(0, 0, 0, .88);
    --overlay-media:   rgba(0, 0, 0, .85);
    --overlay-spinner: rgba(13, 15, 18, .55);
    --backdrop-topbar: rgba(18, 21, 26, .85);

    --tooltip-bg:     #161a20;
    --tooltip-border: rgba(255,255,255,.1);
    --tooltip-text:   #ffffff;

    --spinner-glow:   rgba(16, 185, 129, .5);
    --point-border:   #0d0f12;

    --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
    --shadow:    0 4px 16px rgba(0,0,0,.5);
    --shadow-lg: 0 12px 40px rgba(0,0,0,.6);

    color-scheme: dark;
}

/* ==== LIGHT ==== */
[data-theme="light"] {
    --bg:         #f7f9fb;
    --bg-elev:    #ffffff;
    --bg-panel:   #ffffff;
    --bg-hover:   #eef2f6;
    --bg-input:   #ffffff;

    --line:       rgba(15, 23, 42, .07);
    --line-2:     rgba(15, 23, 42, .12);
    --line-3:     rgba(15, 23, 42, .20);

    --text:       #0f172a;
    --text-2:     #475569;
    --text-3:     #64748b;
    --text-4:     #94a3b8;

    --accent:       #059669;
    --accent-2:     #047857;
    --accent-soft:  rgba(5, 150, 105, .10);
    --accent-line:  rgba(5, 150, 105, .30);
    --accent-glow:  rgba(5, 150, 105, .20);

    --success:  #059669;
    --warning:  #d97706;
    --danger:   #dc2626;
    --info:     #2563eb;

    --surface:       #ffffff;
    --surface-2:     #f8fafc;
    --surface-3:     #f1f5f9;
    --surface-hover: #eef2f6;

    --scrollbar:        #cbd5e1;
    --scrollbar-hover:  #94a3b8;

    --overlay-modal:   rgba(15, 23, 42, .55);
    --overlay-media:   rgba(15, 23, 42, .55);
    --overlay-spinner: rgba(247, 249, 251, .7);
    --backdrop-topbar: rgba(255, 255, 255, .85);

    --tooltip-bg:     #ffffff;
    --tooltip-border: rgba(15, 23, 42, .1);
    --tooltip-text:   #0f172a;

    --spinner-glow:   rgba(5, 150, 105, .35);
    --point-border:   #ffffff;

    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
    --shadow:    0 2px 8px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .04);
    --shadow-lg: 0 12px 32px rgba(15, 23, 42, .10), 0 2px 8px rgba(15, 23, 42, .05);

    color-scheme: light;
}

/* ==== Общие (не зависят от темы) ==== */
:root {
    --radius:    6px;
    --radius-sm: 4px;
    --radius-lg: 10px;

    --transition: 200ms cubic-bezier(.4, 0, .2, 1);

    --topbar-h: 64px;
    --safe-top:    env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html, body { height: 100%; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI',
                 Roboto, 'Helvetica Neue', sans-serif;
    font-size: 14px;
    line-height: 1.6;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: 'cv11', 'ss01';
    overflow-x: hidden;
    transition: background-color .25s ease, color .25s ease;
}

body.nav-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition);
}
a:hover { color: var(--accent-2); }

.container {
    width: 100%;
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ============================================================
   SCROLLBAR — универсальный тонкий скроллбар
   ============================================================ */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar) transparent;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track { background: transparent; }

::-webkit-scrollbar-thumb {
    background: var(--scrollbar);
    border-radius: 8px;
    border: 2px solid transparent;
    background-clip: content-box;
    transition: background 0.2s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-hover);
    background-clip: content-box;
}

::-webkit-scrollbar-thumb:active {
    background: var(--accent);
    background-clip: content-box;
}

::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-button { display: none; width: 0; height: 0; }

@media (max-width: 768px) {
    ::-webkit-scrollbar { width: 6px; height: 6px; }
    ::-webkit-scrollbar-thumb { border: 1px solid transparent; background-clip: content-box; }
}

@media (hover: none) and (pointer: coarse) {
    ::-webkit-scrollbar { width: 0; height: 0; display: none; }
    * { scrollbar-width: none; }
}

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    background: var(--backdrop-topbar);
    padding-top: var(--safe-top);
    transition: background-color .25s ease, border-color .25s ease;
}

.topbar-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    height: var(--topbar-h);
    position: relative;
}

/* ==== BRAND ==== */
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -.2px;
    white-space: nowrap;
    transition: opacity var(--transition);
    flex-shrink: 0;
    min-height: 44px;
}
.brand:hover { color: var(--text); opacity: .85; }

.brand-mark {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-soft);
    border: 1px solid var(--accent-line);
    border-radius: var(--radius-sm);
    color: var(--accent);
    font-size: 13px;
    flex-shrink: 0;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text small {
    font-size: 10px;
    color: var(--text-3);
    font-weight: 500;
    letter-spacing: .5px;
    text-transform: uppercase;
}

/* ==== DESKTOP NAV ==== */
.mainnav {
    display: flex;
    gap: 2px;
    flex: 1;
    height: 100%;
    align-items: stretch;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px;
    color: var(--text-2);
    font-weight: 500;
    font-size: 13.5px;
    border-bottom: 2px solid transparent;
    transition: var(--transition);
    position: relative;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
}
.nav-link i {
    font-size: 13px;
    opacity: .7;
    transition: opacity var(--transition);
}
.nav-link:hover { color: var(--text); }
.nav-link:hover i { opacity: 1; }

.nav-link.active {
    color: var(--text);
    border-bottom-color: var(--accent);
}
.nav-link.active i {
    color: var(--accent);
    opacity: 1;
}

/* ==== PILL ==== */
.server-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--surface);
    border: 1px solid var(--line-2);
    border-radius: var(--radius);
    font-size: 12px;
    font-weight: 500;
    color: var(--text-3);
    letter-spacing: .2px;
    white-space: nowrap;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.server-pill .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-4);
    flex-shrink: 0;
}

.server-pill.online {
    color: var(--accent);
    border-color: var(--accent-line);
    background: var(--accent-soft);
}
.server-pill.online .dot {
    background: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
    animation: pulse-dot 2s infinite;
}
.server-pill.offline .dot { background: var(--danger); }

@keyframes pulse-dot {
    0%, 100% { box-shadow: 0 0 0 3px var(--accent-soft); }
    50%      { box-shadow: 0 0 0 5px var(--accent-soft); }
}

/* ==== THEME TOGGLE ==== */
.theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: var(--surface);
    border: 1px solid var(--line-2);
    color: var(--text-2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: var(--transition);
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}
.theme-toggle:hover {
    background: var(--surface-hover);
    border-color: var(--line-3);
    color: var(--accent);
}
.theme-toggle:active {
    transform: scale(.94);
}
.theme-toggle i {
    transition: transform 300ms cubic-bezier(.4, 0, .2, 1);
}
[data-theme="light"] .theme-toggle i {
    transform: rotate(180deg);
}

/* ==== HAMBURGER ==== */
.burger {
    display: none;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    background: var(--surface);
    border: 1px solid var(--line-2);
    color: var(--text-2);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: var(--transition);
    font-size: 15px;
    box-shadow: var(--shadow-sm);
}
.burger:hover { background: var(--surface-hover); color: var(--text); }

/* ============================================================
   MOBILE NAV DRAWER
   ============================================================ */
.mobile-nav {
    position: fixed;
    inset: 0;
    z-index: 150;
    pointer-events: none;
    visibility: hidden;
}
.mobile-nav.open {
    pointer-events: auto;
    visibility: visible;
}

.mobile-nav-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, .4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity .25s ease;
}
[data-theme="dark"] .mobile-nav-backdrop {
    background: rgba(0, 0, 0, .7);
}
.mobile-nav.open .mobile-nav-backdrop { opacity: 1; }

.mobile-nav-panel {
    position: absolute;
    top: 0;
    right: 0;
    width: min(340px, 85vw);
    height: 100%;
    background: var(--surface);
    border-left: 1px solid var(--line);
    transform: translateX(100%);
    transition: transform .3s cubic-bezier(.4, 0, .2, 1);
    display: flex;
    flex-direction: column;
    padding: calc(var(--safe-top) + 20px) 0 calc(var(--safe-bottom) + 20px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: -8px 0 32px rgba(15, 23, 42, .12);
}
.mobile-nav.open .mobile-nav-panel { transform: translateX(0); }

.mobile-nav-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px 20px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 8px;
}

.mobile-nav-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: .6px;
}

.mobile-nav-close {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: var(--surface);
    border: 1px solid var(--line-2);
    color: var(--text-2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: var(--transition);
}
.mobile-nav-close:hover,
.mobile-nav-close:active {
    background: var(--surface-hover);
    color: var(--text);
}

.mobile-nav-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    color: var(--text-2);
    font-size: 15px;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: var(--transition);
    min-height: 56px;
}
.mobile-nav-link i {
    font-size: 16px;
    width: 22px;
    text-align: center;
    color: var(--text-3);
    transition: var(--transition);
}
.mobile-nav-link:active {
    background: var(--surface-hover);
}
.mobile-nav-link.active {
    background: var(--accent-soft);
    border-left-color: var(--accent);
    color: var(--accent);
}
.mobile-nav-link.active i { color: var(--accent); }

.mobile-nav-info {
    margin: auto 20px 0;
    padding: 16px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    font-size: 12.5px;
    color: var(--text-3);
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.mobile-nav-info .row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}
.mobile-nav-info .row b { color: var(--text-2); font-weight: 500; }

/* ============================================================
   MAIN
   ============================================================ */
#app {
    flex: 1;
    padding-top: 32px;
    padding-bottom: 48px;
    animation: fadeUp .25s ease;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--line);
    gap: 16px;
    flex-wrap: wrap;
}

.page-title {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -.3px;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
}
.page-title i { color: var(--accent); font-size: 16px; }

.page-sub {
    font-size: 12.5px;
    color: var(--text-3);
    margin-top: 2px;
    font-weight: 400;
}

/* ============================================================
   GRID
   ============================================================ */
.grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr);
    gap: 20px;
    align-items: start;
}

/* ============================================================
   CARD
   ============================================================ */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color var(--transition), box-shadow var(--transition), background-color .25s ease;
    box-shadow: var(--shadow-sm);
}
.card:hover {
    border-color: var(--line-2);
    box-shadow: var(--shadow);
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--line);
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -.1px;
    gap: 12px;
    flex-wrap: wrap;
}

.card-head .head-left {
    display: flex;
    align-items: center;
    gap: 10px;
}
.card-head i {
    color: var(--accent);
    font-size: 13px;
    opacity: .9;
}

.card-body { padding: 0; }
.card-body.pad { padding: 18px; }

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    background: var(--accent-soft);
    color: var(--accent);
    border: 1px solid var(--accent-line);
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .1px;
    white-space: nowrap;
}

.badge.neutral {
    background: var(--surface-3);
    color: var(--text-3);
    border-color: var(--line-2);
}

/* ============================================================
   TABLE
   ============================================================ */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
    font-variant-numeric: tabular-nums;
}

thead th {
    text-align: left;
    padding: 11px 18px;
    background: var(--surface-2);
    color: var(--text-3);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .6px;
    border-bottom: 1px solid var(--line-2);
    white-space: nowrap;
}

thead th:first-child { padding-left: 22px; }
thead th:last-child  { padding-right: 22px; text-align: right; }

tbody td {
    padding: 12px 18px;
    border-bottom: 1px solid var(--line);
    color: var(--text-2);
    vertical-align: middle;
}
tbody td:first-child { padding-left: 22px; }
tbody td:last-child  { padding-right: 22px; text-align: right; }

tbody tr { transition: background var(--transition); }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: none; }

.rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: var(--radius-sm);
    background: var(--surface-3);
    color: var(--text-3);
    font-weight: 600;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}
.rank.gold   { background: rgba(245,158,11,.15); color: #f59e0b; border: 1px solid rgba(245,158,11,.3); }
.rank.silver { background: rgba(203,213,225,.15); color: #94a3b8; border: 1px solid rgba(203,213,225,.3); }
.rank.bronze { background: rgba(180,83,9,.15); color: #d97706; border: 1px solid rgba(180,83,9,.3); }
[data-theme="light"] .rank.gold   { background: #fef3c7; color: #b45309; border-color: #fde68a; }
[data-theme="light"] .rank.silver { background: #f1f5f9; color: #475569; border-color: #e2e8f0; }
[data-theme="light"] .rank.bronze { background: #ffedd5; color: #c2410c; border-color: #fed7aa; }

.pname {
    color: var(--text);
    font-weight: 500;
    letter-spacing: -.1px;
}

.ping-good { color: var(--accent); font-weight: 500; }
.ping-mid  { color: var(--warning); font-weight: 500; }
.ping-bad  { color: var(--danger); font-weight: 500; }

/* ============================================================
   BUTTON
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--surface);
    border: 1px solid var(--line-2);
    color: var(--text-2);
    border-radius: var(--radius-sm);
    font-size: 12.5px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    min-height: 36px;
    box-shadow: var(--shadow-sm);
}

.btn:hover:not(:disabled) {
    background: var(--surface-hover);
    border-color: var(--line-3);
    color: var(--text);
}

.btn:active:not(:disabled) { transform: translateY(1px); }

.btn.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
    box-shadow: 0 1px 3px var(--accent-glow);
}
.btn.primary:hover:not(:disabled) {
    background: var(--accent-2);
    border-color: var(--accent-2);
    color: #ffffff;
    box-shadow: 0 4px 12px var(--accent-glow);
}

.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn.loading i { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   SERVER INFO CARD
   ============================================================ */
.server-info img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
    border-bottom: 1px solid var(--line);
    background: var(--surface-3);
}

.info-list {
    list-style: none;
    padding: 6px 0;
}

.info-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 11px 18px;
    font-size: 13px;
    border-bottom: 1px solid var(--line);
    gap: 12px;
}
.info-list li:last-child { border-bottom: none; }

.info-list li span:first-child {
    color: var(--text-3);
    font-weight: 500;
    flex-shrink: 0;
}
.info-list li b {
    color: var(--text);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
}

.status-online  { color: var(--accent) !important; display: inline-flex; align-items: center; gap: 6px; }
.status-offline { color: var(--danger) !important; display: inline-flex; align-items: center; gap: 6px; }
.status-online::before,
.status-offline::before {
    content: '';
    width: 6px; height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.connect-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 0 18px 18px;
    padding: 14px;
    background: var(--accent);
    color: #ffffff;
    font-weight: 600;
    font-size: 13.5px;
    letter-spacing: -.1px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    border: 1px solid var(--accent);
    min-height: 48px;
    box-shadow: 0 1px 3px var(--accent-glow);
}
.connect-btn:hover,
.connect-btn:active {
    color: #ffffff;
    background: var(--accent-2);
    border-color: var(--accent-2);
    box-shadow: 0 4px 20px var(--accent-glow);
}
.connect-btn:active { transform: translateY(1px); }

/* ============================================================
   SCREENSHOTS
   ============================================================ */
.screens-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.screen-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}
.screen-card:hover {
    border-color: var(--line-2);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}
.screen-card:active { transform: translateY(0); }

.screen-card .thumb {
    position: relative;
    width: 100%;
    height: 190px;
    overflow: hidden;
    background: var(--surface-3);
}
.screen-card .thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform var(--transition);
}
.screen-card:hover .thumb img { transform: scale(1.03); }

.screen-card .info {
    padding: 12px 14px;
    border-top: 1px solid var(--line);
}
.screen-card .name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 4px;
}
.screen-card .meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11.5px;
    color: var(--text-3);
    font-variant-numeric: tabular-nums;
    gap: 8px;
}

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-top: 32px;
    flex-wrap: wrap;
}

.pagination button {
    min-width: 44px;
    height: 44px;
    padding: 0 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line-2);
    background: var(--surface);
    color: var(--text-2);
    cursor: pointer;
    font-weight: 500;
    font-size: 13px;
    font-family: inherit;
    transition: var(--transition);
    font-variant-numeric: tabular-nums;
    box-shadow: var(--shadow-sm);
}

.pagination button:hover:not(:disabled):not(.active) {
    background: var(--surface-hover);
    border-color: var(--line-3);
    color: var(--text);
}

.pagination button.active {
    background: var(--accent);
    color: #ffffff;
    border-color: var(--accent);
    font-weight: 600;
    box-shadow: 0 1px 3px var(--accent-glow);
}

.pagination button:disabled { opacity: .35; cursor: not-allowed; }

/* ============================================================
   STATS
   ============================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.stat-box {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px 20px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.stat-box:hover { border-color: var(--line-2); box-shadow: var(--shadow); }

.stat-box::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 2px; height: 100%;
    background: var(--accent);
    opacity: 0;
    transition: opacity var(--transition);
}
.stat-box:hover::before { opacity: 1; }

.stat-box .stat-label {
    font-size: 11px;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: .6px;
    font-weight: 600;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.stat-box .stat-label i { font-size: 11px; color: var(--accent); }

.stat-box .stat-value {
    font-size: 26px;
    font-weight: 600;
    color: var(--text);
    line-height: 1;
    letter-spacing: -.5px;
    font-variant-numeric: tabular-nums;
}

.stat-box .stat-hint {
    font-size: 11.5px;
    color: var(--text-4);
    margin-top: 6px;
}

.chart-wrap {
    position: relative;
    height: 280px;
    padding: 16px 12px 8px;
}

/* ============================================================
   LOADER / EMPTY
   ============================================================ */
.loader {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 100px 0;
    color: var(--accent);
    font-size: 22px;
    opacity: .7;
}

.empty {
    text-align: center;
    padding: 70px 20px;
    color: var(--text-3);
}
.empty i {
    font-size: 36px;
    display: block;
    margin-bottom: 12px;
    opacity: .5;
    color: var(--text-4);
}
.empty p {
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-3);
}

/* ============================================================
   MODAL
   ============================================================ */
.modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.modal.open { display: flex; animation: modalIn .2s ease; }

@keyframes modalIn { from { opacity: 0; } to { opacity: 1; } }

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: var(--overlay-modal);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.modal-body {
    position: relative;
    max-width: 92vw;
    max-height: 92vh;
    background: var(--surface);
    border: 1px solid var(--line-2);
    border-radius: var(--radius-lg);
    padding: 8px;
    z-index: 1;
    box-shadow: var(--shadow-lg);
    animation: modalZoom .25s cubic-bezier(.34, 1.3, .64, 1);
    touch-action: pan-y;
}

@keyframes modalZoom {
    from { transform: scale(.96); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

.modal-body img {
    display: block;
    max-width: 100%;
    max-height: 86vh;
    border-radius: var(--radius);
    user-select: none;
    -webkit-user-drag: none;
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: var(--surface);
    border: 1px solid var(--line-2);
    color: var(--text-2);
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 2;
    box-shadow: var(--shadow-sm);
}
.modal-close:hover,
.modal-close:active {
    background: var(--surface-hover);
    color: var(--text);
    border-color: var(--line-3);
}

/* ============================================================
   TOAST
   ============================================================ */
#toast {
    position: fixed;
    bottom: calc(20px + var(--safe-bottom));
    right: 20px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    max-width: calc(100vw - 40px);
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface);
    border: 1px solid var(--line-2);
    border-left: 3px solid var(--accent);
    color: var(--text);
    padding: 11px 16px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    font-size: 13px;
    font-weight: 500;
    max-width: 320px;
    animation: toastIn .25s ease;
    pointer-events: auto;
}

.toast.error { border-left-color: var(--danger); }
.toast i { color: var(--accent); font-size: 14px; flex-shrink: 0; }
.toast.error i { color: var(--danger); }

@keyframes toastIn {
    from { transform: translateX(110%); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
    border-top: 1px solid var(--line);
    background: var(--surface);
    padding: 18px 0 calc(18px + var(--safe-bottom));
    margin-top: auto;
}
.footer .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}
.footer p {
    font-size: 12px;
    color: var(--text-4);
    letter-spacing: .1px;
}
.footer .footer-right {
    font-size: 12px;
    color: var(--text-4);
    display: flex;
    align-items: center;
    gap: 8px;
}
.footer .footer-right .dot-sep {
    width: 3px; height: 3px;
    border-radius: 50%;
    background: var(--text-4);
}

::selection {
    background: var(--accent-soft);
    color: var(--accent);
}

/* ============================================================
   TABLET — 980px
   ============================================================ */
@media (max-width: 980px) {
    .grid { grid-template-columns: 1fr; }
    .chart-wrap { height: 240px; }
}

/* ============================================================
   MOBILE — 768px
   ============================================================ */
@media (max-width: 768px) {
    .container { padding: 0 16px; }

    .mainnav { display: none; }
    .burger { display: flex; }

    .topbar-inner {
        gap: 10px;
        height: 60px;
    }

    .brand { font-size: 14px; }
    .brand-mark { width: 26px; height: 26px; font-size: 12px; }
    .brand-text small { font-size: 9px; }

    .server-pill {
        padding: 5px 10px;
        font-size: 11px;
        margin-left: auto;
    }
    .server-pill #serverPillText {
        max-width: 90px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .theme-toggle {
        width: 38px;
        height: 38px;
        font-size: 13px;
    }

    #app {
        padding-top: 20px;
        padding-bottom: 32px;
    }

    .page-head {
        margin-bottom: 18px;
        padding-bottom: 14px;
    }

    .page-title { font-size: 17px; gap: 8px; }
    .page-title i { font-size: 14px; }
    .page-sub { font-size: 11.5px; }

    .card-head {
        padding: 12px 14px;
        font-size: 12.5px;
    }

    .card-body.pad { padding: 14px; }

    /* ==== ТАБЛИЦА → КАРТОЧКИ ==== */
    .table-wrap { overflow: visible; }

    table.responsive { display: block; font-size: 13px; }
    table.responsive thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
    }
    table.responsive tbody { display: block; }
    table.responsive tr {
        display: grid;
        grid-template-columns: auto 1fr auto;
        grid-template-areas:
            "rank  name   score"
            "stats stats  stats"
            "action action action";
        gap: 8px 12px;
        padding: 14px;
        border-bottom: 1px solid var(--line);
        background: var(--surface);
        align-items: center;
    }
    table.responsive tr:last-child { border-bottom: none; }
    table.responsive tr:hover { background: var(--surface); }

    table.responsive td {
        padding: 0;
        border: none;
        text-align: left;
        display: block;
    }
    table.responsive td:first-child,
    table.responsive td:last-child {
        padding: 0;
        text-align: left;
    }

    table.responsive td:nth-child(1) { grid-area: rank; }
    table.responsive td:nth-child(2) { grid-area: name; }
    table.responsive td:nth-child(3) { grid-area: score; text-align: right; }
    table.responsive td:nth-child(4),
    table.responsive td:nth-child(5),
    table.responsive td:nth-child(6) {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        font-size: 12px;
        color: var(--text-3);
        padding: 3px 8px;
        background: var(--surface-3);
        border-radius: var(--radius-sm);
        width: auto;
    }
    table.responsive td:nth-child(4)::before { content: 'K:'; color: var(--text-4); }
    table.responsive td:nth-child(5)::before { content: 'D:'; color: var(--text-4); }
    table.responsive td:nth-child(6)::before { content: 'Ping:'; color: var(--text-4); }

    table.responsive td:nth-child(7) {
        grid-area: action;
        display: block;
        margin-top: 4px;
    }
    table.responsive td:nth-child(7) .btn {
        width: 100%;
        min-height: 42px;
        font-size: 13px;
    }

    table.responsive tr {
        grid-template-columns: auto 1fr auto;
    }

    .screens-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .screen-card .thumb { height: 120px; }
    .screen-card .info { padding: 10px 12px; }
    .screen-card .name { font-size: 12px; }
    .screen-card .meta { font-size: 10.5px; }

    .pagination { gap: 3px; margin-top: 24px; }
    .pagination button {
        min-width: 40px;
        height: 40px;
        font-size: 12.5px;
        padding: 0 8px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    .stat-box { padding: 14px 16px; }
    .stat-box .stat-value { font-size: 22px; }
    .stat-box .stat-label { font-size: 10px; }

    .chart-wrap { height: 220px; padding: 12px 8px 4px; }

    .server-info img { height: 170px; }
    .info-list li { padding: 10px 14px; font-size: 12.5px; }
    .connect-btn {
        margin: 0 14px 14px;
        min-height: 46px;
        padding: 12px;
    }

    .modal { padding: 0; }
    .modal-body {
        max-width: 100vw;
        max-height: 100dvh;
        border-radius: 0;
        padding: 0;
        border: none;
        display: flex;
        align-items: center;
        justify-content: center;
        background: transparent;
        box-shadow: none;
    }
    .modal-body img {
        max-width: 100vw;
        max-height: 100dvh;
        border-radius: 0;
    }
    .modal-close {
        top: calc(12px + var(--safe-top));
        right: 12px;
        width: 44px;
        height: 44px;
    }

    #toast {
        bottom: calc(12px + var(--safe-bottom));
        right: 12px;
        left: 12px;
        max-width: none;
    }
    .toast {
        max-width: none;
        font-size: 12.5px;
        padding: 10px 14px;
    }

    .footer { padding: 16px 0 calc(16px + var(--safe-bottom)); }
    .footer .container { justify-content: center; text-align: center; }
    .footer-right { display: none; }

    .loader { padding: 60px 0; }
}

/* ============================================================
   SMALL MOBILE — 480px
   ============================================================ */
@media (max-width: 480px) {
    .container { padding: 0 12px; }

    .brand-text small { display: none; }
    .brand-text span { font-size: 13px; }

    .server-pill { padding: 4px 8px; font-size: 10.5px; }
    .server-pill #serverPillText { max-width: 70px; }

    .page-title { font-size: 16px; }

    .stats-grid { grid-template-columns: 1fr; }
    .stat-box { padding: 12px 14px; }
    .stat-box .stat-value { font-size: 20px; }

    .screens-grid { grid-template-columns: 1fr; }
    .screen-card .thumb { height: 180px; }

    .pagination button {
        min-width: 36px;
        height: 36px;
        font-size: 12px;
    }

    table.responsive tr {
        padding: 12px;
        gap: 6px 10px;
    }
    table.responsive td:nth-child(4),
    table.responsive td:nth-child(5),
    table.responsive td:nth-child(6) {
        font-size: 11px;
        padding: 2px 6px;
    }

    #toast {
        top: calc(70px + var(--safe-top));
        bottom: auto;
    }
    .toast { animation: toastIn .25s ease; }
}

/* ============================================================
   LANDSCAPE MOBILE
   ============================================================ */
@media (max-height: 500px) and (orientation: landscape) {
    .mobile-nav-panel {
        width: min(400px, 70vw);
    }
    .mobile-nav-link { min-height: 48px; padding: 12px 20px; }
    .chart-wrap { height: 200px; }
}

/* ============================================================
   HOVER — только для устройств с мышью
   ============================================================ */
@media (hover: none) {
    .card:hover { border-color: var(--line); box-shadow: var(--shadow-sm); }
    .screen-card:hover { transform: none; box-shadow: var(--shadow-sm); }
    .screen-card:hover .thumb img { transform: none; }
    .btn:hover:not(:disabled) { background: var(--surface); color: var(--text-2); border-color: var(--line-2); }
    .btn.primary:hover:not(:disabled) { background: var(--accent); color: #ffffff; border-color: var(--accent); }
    .nav-link:hover { color: var(--text-2); }
    .nav-link:hover i { opacity: .7; }
    .stat-box:hover::before { opacity: 0; }
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}

/* ============================================================
   CHARTS
   ============================================================ */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.charts-grid.full {
    grid-template-columns: 1fr;
}

.chart-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color var(--transition), box-shadow var(--transition), background-color .25s ease;
    box-shadow: var(--shadow-sm);
}
.chart-card:hover { border-color: var(--line-2); box-shadow: var(--shadow); }

.chart-card .card-head {
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
    background: var(--surface-2);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.chart-card .card-head h3 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
}
.chart-card .card-head h3 i {
    color: var(--accent);
    font-size: 13px;
    opacity: .9;
}

.chart-container {
    position: relative;
    height: 260px;
    padding: 16px;
}

.chart-container.tall {
    height: 340px;
}

.chart-container canvas {
    max-width: 100%;
}

.period-switch {
    display: inline-flex;
    gap: 2px;
    padding: 2px;
    background: var(--surface-3);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
}

.period-switch button {
    padding: 4px 10px;
    background: transparent;
    border: none;
    color: var(--text-3);
    font-size: 11.5px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border-radius: 3px;
    transition: var(--transition);
    letter-spacing: .2px;
}
.period-switch button:hover { color: var(--text); }
.period-switch button.active {
    background: var(--surface);
    color: var(--accent);
    box-shadow: var(--shadow-sm);
}

.chart-legend {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 0 16px 16px;
}

.chart-legend .row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12.5px;
    padding: 6px 0;
}
.chart-legend .row .dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex-shrink: 0;
}
.chart-legend .row .name {
    flex: 1;
    color: var(--text-2);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.chart-legend .row .val {
    color: var(--text-3);
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

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

.summary-box {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px 18px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.summary-box:hover { border-color: var(--line-2); box-shadow: var(--shadow); }

.summary-box::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 2px; height: 100%;
    background: var(--accent);
    opacity: 0;
    transition: opacity var(--transition);
}
.summary-box:hover::before { opacity: 1; }

.summary-box .lbl {
    font-size: 10.5px;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: .6px;
    font-weight: 600;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.summary-box .lbl i { font-size: 10px; color: var(--accent); }

.summary-box .val {
    font-size: 24px;
    font-weight: 600;
    color: var(--text);
    line-height: 1;
    letter-spacing: -.4px;
    font-variant-numeric: tabular-nums;
}

@media (max-width: 768px) {
    .charts-grid { grid-template-columns: 1fr; gap: 14px; }
    .chart-container { height: 220px; padding: 12px; }
    .chart-container.tall { height: 260px; }

    .chart-card .card-head { padding: 12px 14px; }
    .chart-card .card-head h3 { font-size: 12px; }

    .summary-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .summary-box { padding: 12px 14px; }
    .summary-box .val { font-size: 20px; }
    .summary-box .lbl { font-size: 10px; }

    .chart-legend { padding: 0 12px 12px; }
    .chart-legend .row { font-size: 12px; padding: 4px 0; }
}

@media (max-width: 480px) {
    .summary-grid { grid-template-columns: 1fr; }
    .period-switch button { padding: 4px 8px; font-size: 11px; }
}

/* ============================================================
   NEWS — главная + карточки
   ============================================================ */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.news-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
}

.news-card:hover {
    border-color: var(--line-2);
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.news-card .cover {
    width: 100%;
    height: 180px;
    overflow: hidden;
    background: var(--surface-3);
    position: relative;
}
.news-card .cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform var(--transition);
}
.news-card:hover .cover img { transform: scale(1.04); }

.news-card .cover-empty {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--surface-2), var(--surface-3));
    color: var(--accent);
    font-size: 36px;
    opacity: .5;
}

.news-card .body {
    padding: 16px 18px 18px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.news-card .meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 11.5px;
    color: var(--text-3);
    margin-bottom: 10px;
    flex-wrap: wrap;
}
.news-card .meta i { margin-right: 4px; opacity: .7; }

.news-card h3 {
    font-size: 15.5px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.35;
    margin-bottom: 10px;
    letter-spacing: -.2px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-card .excerpt {
    font-size: 13px;
    color: var(--text-2);
    line-height: 1.5;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 14px;
}

.news-card .footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--text-3);
    padding-top: 12px;
    border-top: 1px solid var(--line);
    margin-top: auto;
}
.news-card .footer .read-more {
    color: var(--accent);
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.news-card:hover .footer .read-more { color: var(--accent-2); }
.news-card .footer .read-more i { transition: transform var(--transition); }
.news-card:hover .footer .read-more i { transform: translateX(3px); }

.news-card .cats {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}
.news-card .cats .cat-mini {
    font-size: 10.5px;
    padding: 2px 8px;
    background: var(--accent-soft);
    color: var(--accent);
    border-radius: 999px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .3px;
}

/* ============================================================
   NEWS — детальная страница
   ============================================================ */
.news-detail {
    max-width: 820px;
    margin: 0 auto;
}

.news-detail .back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--surface);
    border: 1px solid var(--line-2);
    color: var(--text-2);
    border-radius: var(--radius-sm);
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 20px;
    font-family: inherit;
    text-decoration: none;
    box-shadow: var(--shadow-sm);
}
.news-detail .back-btn:hover {
    color: var(--text);
    border-color: var(--line-3);
    background: var(--surface-hover);
}

.news-detail .cover-lg {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    margin-bottom: 24px;
    display: block;
}

.news-detail h1 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -.5px;
    line-height: 1.25;
    color: var(--text);
    margin-bottom: 12px;
}

.news-detail .detail-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 12.5px;
    color: var(--text-3);
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--line);
    flex-wrap: wrap;
}
.news-detail .detail-meta i { color: var(--accent); margin-right: 5px; opacity: .8; }

.news-detail .news-content {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-2);
}
.news-detail .news-content p { margin-bottom: 16px; }
.news-detail .news-content h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text);
    margin: 28px 0 14px;
    letter-spacing: -.3px;
}
.news-detail .news-content h3 {
    font-size: 17px;
    font-weight: 600;
    color: var(--text);
    margin: 22px 0 10px;
}
.news-detail .news-content ul,
.news-detail .news-content ol {
    margin: 12px 0 16px 24px;
}
.news-detail .news-content li { margin-bottom: 6px; }
.news-detail .news-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
    margin: 16px 0;
}
.news-detail .news-content a { color: var(--accent); text-decoration: underline; text-decoration-color: var(--accent-line); }
.news-detail .news-content a:hover { text-decoration-color: var(--accent); }
.news-detail .news-content blockquote {
    border-left: 3px solid var(--accent);
    padding-left: 16px;
    margin: 16px 0;
    color: var(--text-3);
    font-style: italic;
}
.news-detail .news-content code {
    background: var(--surface-3);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 13px;
    color: var(--accent-2);
    font-family: 'SF Mono', Monaco, monospace;
}
.news-detail .news-content pre {
    background: var(--surface-2);
    padding: 14px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    overflow-x: auto;
    margin: 16px 0;
}
.news-detail .news-content pre code {
    background: none;
    padding: 0;
    color: var(--text-2);
}

/* ============================================================
   GALLERY
   ============================================================ */
.gallery-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    padding: 14px 18px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.gallery-toolbar .field {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 200px;
    position: relative;
}
.gallery-toolbar .field i {
    position: absolute;
    left: 12px;
    color: var(--text-3);
    font-size: 13px;
    pointer-events: none;
}
.gallery-toolbar input[type="text"] {
    width: 100%;
    padding: 9px 12px 9px 36px;
    background: var(--bg-input);
    border: 1px solid var(--line-2);
    color: var(--text);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    transition: var(--transition);
    outline: none;
}
.gallery-toolbar input[type="text"]:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.gallery-toolbar input[type="text"]::placeholder { color: var(--text-4); }

.gallery-toolbar select {
    padding: 9px 32px 9px 12px;
    background: var(--bg-input);
    border: 1px solid var(--line-2);
    color: var(--text);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%2364748b' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    transition: var(--transition);
}
.gallery-toolbar select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

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

.gallery-item {
    position: relative;
    aspect-ratio: 16 / 10;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface-3);
    border: 1px solid var(--line);
    cursor: pointer;
    transition: var(--transition);
    display: block;
    box-shadow: var(--shadow-sm);
}
.gallery-item:hover {
    border-color: var(--accent-line);
    transform: scale(1.01);
    box-shadow: var(--shadow);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform var(--transition);
}
.gallery-item:hover img { transform: scale(1.05); }

/* Оверлей галереи — всегда тёмный, чтобы текст читался */
.gallery-item .overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 40%, rgba(15, 23, 42, .85) 100%);
    opacity: 0;
    transition: opacity var(--transition);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 12px;
    color: #ffffff;
}
.gallery-item:hover .overlay { opacity: 1; }

.gallery-item .overlay .name {
    font-size: 12.5px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}
.gallery-item .overlay .info {
    font-size: 11px;
    color: rgba(255,255,255,.75);
    display: flex;
    align-items: center;
    gap: 10px;
}
.gallery-item .overlay .info span { display: inline-flex; align-items: center; gap: 4px; }

/* ============================================================
   ADMIN
   ============================================================ */
.admin-login {
    max-width: 400px;
    margin: 60px auto;
    padding: 32px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

.admin-login h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
}
.admin-login h2 i { color: var(--accent); }

.admin-login p {
    color: var(--text-3);
    font-size: 13px;
    margin-bottom: 24px;
}

.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: 12px;
    color: var(--text-3);
    margin-bottom: 6px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .5px;
}
.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-input);
    border: 1px solid var(--line-2);
    color: var(--text);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13.5px;
    transition: var(--transition);
    outline: none;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, .03);
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--accent);
    background: var(--bg-input);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--text-4); }
.form-group textarea {
    resize: vertical;
    min-height: 120px;
    line-height: 1.5;
}
.form-group textarea.tall { min-height: 260px; }
.form-group input[type="file"] {
    padding: 8px;
    cursor: pointer;
    font-size: 12.5px;
    box-shadow: none;
}

.admin-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
    flex-wrap: wrap;
}

.btn.lg { padding: 10px 20px; font-size: 13.5px; min-height: 42px; }
.btn.danger {
    background: var(--surface);
    border-color: rgba(220, 38, 38, .35);
    color: var(--danger);
}
.btn.danger:hover:not(:disabled) {
    background: var(--danger);
    border-color: var(--danger);
    color: #ffffff;
}

/* ============================================================
   ADMIN PANEL
   ============================================================ */
.admin-panel {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 20px;
    align-items: start;
}
@media (max-width: 860px) {
    .admin-panel { grid-template-columns: 1fr; }
}

.admin-tabs {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 8px;
    position: sticky;
    top: 88px;
    box-shadow: var(--shadow-sm);
}
@media (max-width: 860px) {
    .admin-tabs {
        flex-direction: row;
        overflow-x: auto;
        position: static;
    }
    .admin-tabs button { white-space: nowrap; }
}

.admin-tabs button {
    padding: 11px 14px;
    background: transparent;
    border: none;
    color: var(--text-2);
    font-size: 13.5px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    text-align: left;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
}
.admin-tabs button i { width: 18px; text-align: center; font-size: 13px; opacity: .7; }
.admin-tabs button:hover { background: var(--surface-hover); color: var(--text); }
.admin-tabs button.active {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
}
.admin-tabs button.active i { opacity: 1; color: var(--accent); }

.admin-content {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px;
    min-height: 400px;
    box-shadow: var(--shadow-sm);
}

.admin-content h2 {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    color: var(--text);
}
.admin-content h2 i { color: var(--accent); margin-right: 8px; }

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

.admin-list-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}
.admin-list-item:hover { border-color: var(--line-2); background: var(--surface); box-shadow: var(--shadow-sm); }

.admin-list-item .thumb {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    background: var(--surface-3);
    flex-shrink: 0;
}
.admin-list-item .thumb-empty {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-sm);
    background: var(--surface-3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-4);
    font-size: 20px;
    flex-shrink: 0;
}

.admin-list-item .info { flex: 1; min-width: 0; }
.admin-list-item .info h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.admin-list-item .info .meta {
    font-size: 11.5px;
    color: var(--text-3);
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.admin-list-item .info .meta .status-draft {
    color: var(--warning);
    font-weight: 600;
}
.admin-list-item .info .meta .status-pub {
    color: var(--accent);
    font-weight: 600;
}

.admin-list-item .actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

@media (max-width: 640px) {
    .admin-list-item { flex-wrap: wrap; }
    .admin-list-item .actions {
        width: 100%;
        justify-content: flex-end;
    }
}

.admin-form .row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
@media (max-width: 640px) {
    .admin-form .row { grid-template-columns: 1fr; }
}

.form-hint {
    font-size: 11.5px;
    color: var(--text-4);
    margin-top: 4px;
}

.admin-content code {
    background: var(--surface-3);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 12.5px;
    color: var(--accent-2);
}

/* ============================================================
   QUILL
   ============================================================ */
.quill-wrapper {
    background: var(--bg-input);
    border: 1px solid var(--line-2);
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: var(--transition);
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, .03);
}

.quill-wrapper:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.ql-toolbar.ql-snow {
    background: var(--surface-2);
    border: none;
    border-bottom: 1px solid var(--line);
    padding: 8px 10px;
    font-family: 'Inter', sans-serif;
}

.ql-toolbar.ql-snow .ql-formats {
    margin-right: 12px;
}

.ql-toolbar.ql-snow button {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    transition: background var(--transition);
}
.ql-toolbar.ql-snow button:hover {
    background: var(--surface-hover);
}
.ql-toolbar.ql-snow button.ql-active {
    background: var(--accent-soft);
}
.ql-toolbar.ql-snow button.ql-active .ql-stroke {
    stroke: var(--accent);
}
.ql-toolbar.ql-snow button.ql-active .ql-fill {
    fill: var(--accent);
}

.ql-toolbar.ql-snow .ql-stroke { stroke: var(--text-2); }
.ql-toolbar.ql-snow .ql-fill  { fill: var(--text-2); }
.ql-toolbar.ql-snow .ql-picker-label { color: var(--text-2); }
.ql-toolbar.ql-snow .ql-picker-label:hover { color: var(--text); }
.ql-toolbar.ql-snow .ql-picker-label:hover .ql-stroke { stroke: var(--text); }

.ql-toolbar.ql-snow .ql-picker.ql-expanded .ql-picker-label {
    color: var(--accent);
    border-color: var(--accent-line);
}
.ql-toolbar.ql-snow .ql-picker.ql-expanded .ql-picker-options {
    background: var(--surface);
    border: 1px solid var(--line-2);
    border-radius: 6px;
    box-shadow: var(--shadow-lg);
    padding: 6px;
    margin-top: 4px;
}
.ql-toolbar.ql-snow .ql-picker-item {
    color: var(--text-2);
    border-radius: 4px;
    padding: 6px 10px;
}
.ql-toolbar.ql-snow .ql-picker-item:hover {
    color: var(--text);
    background: var(--surface-hover);
}
.ql-toolbar.ql-snow .ql-picker-item.ql-selected {
    color: var(--accent);
    background: var(--accent-soft);
}

.ql-container.ql-snow {
    border: none;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    background: var(--bg-input);
}

.ql-editor {
    min-height: 320px;
    max-height: 600px;
    overflow-y: auto;
    padding: 16px 18px;
    color: var(--text);
    line-height: 1.6;
}

.ql-editor.ql-blank::before {
    color: var(--text-4);
    font-style: normal;
    left: 18px;
    right: 18px;
}

.ql-editor p,
.ql-editor h1,
.ql-editor h2,
.ql-editor h3,
.ql-editor li,
.ql-editor blockquote {
    color: var(--text);
}

.ql-editor h1 { font-size: 22px; margin: 16px 0 12px; font-weight: 700; letter-spacing: -.4px; }
.ql-editor h2 { font-size: 18px; margin: 14px 0 10px; font-weight: 600; }
.ql-editor h3 { font-size: 16px; margin: 12px 0 8px; font-weight: 600; }

.ql-editor a { color: var(--accent); }
.ql-editor a:hover { color: var(--accent-2); }

.ql-editor blockquote {
    border-left: 3px solid var(--accent);
    padding-left: 14px;
    margin: 12px 0;
    color: var(--text-3);
    font-style: italic;
}

.ql-editor code,
.ql-editor pre {
    background: var(--surface-3);
    border-radius: 4px;
    color: var(--accent-2);
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 13px;
}
.ql-editor pre {
    padding: 12px;
    border: 1px solid var(--line);
}

.ql-editor img {
    max-width: 100%;
    border-radius: 6px;
    margin: 10px 0;
}

.ql-editor ul, .ql-editor ol {
    padding-left: 24px;
}
.ql-editor li { margin-bottom: 4px; }

.ql-snow .ql-tooltip {
    background: var(--surface);
    border: 1px solid var(--line-2);
    border-radius: 6px;
    box-shadow: var(--shadow-lg);
    color: var(--text);
    padding: 8px 12px;
    z-index: 100;
}
.ql-snow .ql-tooltip input[type=text] {
    background: var(--bg-input);
    border: 1px solid var(--line-2);
    color: var(--text);
    padding: 6px 10px;
    border-radius: 4px;
    font-family: inherit;
    font-size: 13px;
    outline: none;
}
.ql-snow .ql-tooltip input[type=text]:focus {
    border-color: var(--accent);
}
.ql-snow .ql-tooltip a.ql-action,
.ql-snow .ql-tooltip a.ql-remove {
    color: var(--accent);
    font-weight: 500;
}
.ql-snow .ql-tooltip a.ql-action:hover,
.ql-snow .ql-tooltip a.ql-remove:hover {
    color: var(--accent-2);
}
.ql-snow .ql-tooltip.ql-editing a.ql-action::after {
    content: 'Сохранить';
}
.ql-snow .ql-tooltip[data-mode="link"]::before {
    content: 'Введите ссылку:';
    color: var(--text-3);
}

.rich-editor-container {
    margin-bottom: 16px;
}

.rich-editor-container .editor-label {
    display: block;
    font-size: 12px;
    color: var(--text-3);
    margin-bottom: 6px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .5px;
}

@media (max-width: 640px) {
    .ql-toolbar.ql-snow { padding: 6px 4px; }
    .ql-toolbar.ql-snow .ql-formats { margin-right: 6px; }
    .ql-toolbar.ql-snow button { width: 26px; height: 26px; }
    .ql-editor {
        min-height: 240px;
        padding: 12px 14px;
        font-size: 13.5px;
    }
    .ql-editor h1 { font-size: 19px; }
    .ql-editor h2 { font-size: 16px; }
    .ql-editor h3 { font-size: 15px; }
}

/* ============================================================
   CHIPS
   ============================================================ */
.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--surface-3);
    border: 1px solid var(--line-2);
    border-radius: 999px;
    font-size: 12px;
    color: var(--text-2);
    transition: var(--transition);
}

.chip.chip-accent {
    background: var(--accent-soft);
    border-color: var(--accent-line);
    color: var(--accent);
}

.chip i { font-size: 11px; opacity: .8; }

.chip-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--bg-input);
    border: 1px solid var(--line-2);
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-2);
    transition: var(--transition);
    user-select: none;
}
.chip-checkbox:hover {
    border-color: var(--line-3);
    color: var(--text);
}
.chip-checkbox input { display: none; }
.chip-checkbox .check-icon {
    width: 16px;
    height: 16px;
    border: 1.5px solid var(--line-3);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    background: var(--surface);
}
.chip-checkbox input:checked + .check-icon {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
}
.chip-checkbox input:checked + .check-icon::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 10px;
}
.chip-checkbox:has(input:checked) {
    background: var(--accent-soft);
    border-color: var(--accent-line);
    color: var(--accent);
}

/* ============================================================
   CATEGORIES CARD
   ============================================================ */
.cat-header {
    text-align: center;
    padding: 30px 20px 20px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 24px;
}
.cat-header .cat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--accent-soft);
    border: 1px solid var(--accent-line);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    font-size: 24px;
    margin: 0 auto 14px;
}
.cat-header h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 6px;
    letter-spacing: -.4px;
    color: var(--text);
}
.cat-header p {
    color: var(--text-3);
    font-size: 13.5px;
    max-width: 600px;
    margin: 0 auto;
}

.cat-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    background: var(--accent-soft);
    color: var(--accent);
    border: 1px solid var(--accent-line);
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
}
.cat-badge:hover {
    background: var(--accent);
    color: #ffffff;
}

/* ============================================================
   MENU ADMIN
   ============================================================ */
.menu-item-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 6px;
    cursor: grab;
    transition: var(--transition);
}
.menu-item-row:hover {
    border-color: var(--line-2);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}
.menu-item-row.dragging {
    opacity: .5;
    cursor: grabbing;
}
.menu-item-row .drag-handle {
    color: var(--text-4);
    cursor: grab;
    padding: 4px;
}
.menu-item-row .drag-handle:hover { color: var(--text-2); }

.menu-item-row .item-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-soft);
    border: 1px solid var(--accent-line);
    border-radius: 6px;
    color: var(--accent);
    font-size: 13px;
}

.menu-item-row .item-info { flex: 1; min-width: 0; }
.menu-item-row .item-info h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
}
.menu-item-row .item-info .meta {
    font-size: 11.5px;
    color: var(--text-3);
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.menu-item-row .item-info .type-badge {
    padding: 2px 6px;
    background: var(--surface-3);
    border-radius: 3px;
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: .3px;
    color: var(--text-3);
}
.menu-item-row .actions { display: flex; gap: 6px; }

.menu-item-row.menu-item-child {
    background: var(--surface);
    border-left: 3px solid var(--accent-line);
    position: relative;
}
.menu-item-row.menu-item-child::before {
    content: '';
    position: absolute;
    left: -14px;
    top: 50%;
    width: 12px;
    height: 1px;
    background: var(--line-3);
}
.menu-item-row.dragging {
    opacity: .4;
    box-shadow: var(--shadow);
    z-index: 10;
}

/* ============================================================
   ICON PICKER
   ============================================================ */
.icon-picker {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    gap: 6px;
    padding: 10px;
    background: var(--bg-input);
    border: 1px solid var(--line-2);
    border-radius: 6px;
    max-height: 200px;
    overflow-y: auto;
}
.icon-picker button {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--text-2);
    cursor: pointer;
    font-size: 15px;
    transition: var(--transition);
}
.icon-picker button:hover {
    background: var(--surface-hover);
    color: var(--text);
}
.icon-picker button.selected {
    background: var(--accent-soft);
    border-color: var(--accent-line);
    color: var(--accent);
}

@media (max-width: 640px) {
    .chip-checkbox { padding: 6px 10px; font-size: 12px; }
    .menu-item-row { flex-wrap: wrap; }
    .menu-item-row .actions { width: 100%; justify-content: flex-end; }
}

/* ============================================================
   SPINNER — двойное кольцо
   ============================================================ */
.spinner {
    position: fixed;
    inset: 0;
    z-index: 9998;
    display: none;
    align-items: center;
    justify-content: center;
    background: var(--overlay-spinner);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.spinner.active {
    display: flex;
    opacity: 1;
    pointer-events: auto;
}

.spinner-ring {
    width: 56px;
    height: 56px;
    position: relative;
}

.spinner-ring::before,
.spinner-ring::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 3px solid transparent;
}

.spinner-ring::before {
    border-top-color: var(--accent);
    border-right-color: var(--accent);
    animation: spinner-rotate 0.9s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    filter: drop-shadow(0 0 8px var(--spinner-glow));
}

.spinner-ring::after {
    inset: 8px;
    border-bottom-color: var(--accent-soft);
    border-left-color: var(--accent-soft);
    animation: spinner-rotate 1.4s cubic-bezier(0.4, 0, 0.2, 1) infinite reverse;
}

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

@media (max-width: 640px) {
    .spinner-ring { width: 48px; height: 48px; }
    .spinner-ring::after { inset: 7px; }
}

@media (prefers-reduced-motion: reduce) {
    .spinner-ring::before,
    .spinner-ring::after {
        animation-duration: 1.6s;
    }
}

/* ============================================================
   МЕДИАТЕКА
   ============================================================ */
.media-toolbar {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.media-toolbar .field {
    flex: 1;
    min-width: 200px;
    position: relative;
}
.media-toolbar .field i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-3);
    font-size: 13px;
    pointer-events: none;
}
.media-toolbar input[type="text"] {
    width: 100%;
    padding: 9px 12px 9px 36px;
    background: var(--bg-input);
    border: 1px solid var(--line-2);
    color: var(--text);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    outline: none;
    transition: var(--transition);
}
.media-toolbar input[type="text"]:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.media-toolbar select {
    padding: 9px 32px 9px 12px;
    background: var(--bg-input);
    border: 1px solid var(--line-2);
    color: var(--text);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    outline: none;
}

.media-dropzone {
    border: 2px dashed var(--line-2);
    border-radius: var(--radius);
    padding: 30px 20px;
    text-align: center;
    margin-bottom: 20px;
    cursor: pointer;
    transition: var(--transition);
    background: var(--surface);
}
.media-dropzone:hover,
.media-dropzone.drag-over {
    border-color: var(--accent);
    background: var(--accent-soft);
}
.media-dropzone i {
    font-size: 36px;
    color: var(--accent);
    opacity: .6;
    margin-bottom: 10px;
    display: block;
}
.media-dropzone p {
    font-size: 14px;
    color: var(--text-2);
    margin-bottom: 4px;
}
.media-dropzone p b { color: var(--text); }
.media-dropzone small {
    font-size: 12px;
    color: var(--text-4);
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
}

.media-item {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--transition);
    position: relative;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
}
.media-item:hover {
    border-color: var(--line-2);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}
.media-preview {
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-2);
    overflow: hidden;
}
.media-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.media-preview i {
    font-size: 44px;
    color: var(--accent);
    opacity: .5;
}
.media-info {
    padding: 10px 12px;
    flex: 1;
}
.media-name {
    font-size: 12.5px;
    color: var(--text);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 4px;
}
.media-meta {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-4);
}
.media-ext {
    text-transform: uppercase;
    font-weight: 600;
    color: var(--accent);
}
.media-actions {
    display: flex;
    gap: 4px;
    padding: 6px 10px;
    border-top: 1px solid var(--line);
    background: var(--surface-2);
}

.btn-mini {
    flex: 1;
    padding: 6px;
    background: var(--surface);
    border: 1px solid var(--line-2);
    color: var(--text-3);
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn-mini:hover {
    background: var(--surface-hover);
    color: var(--text);
    border-color: var(--line-3);
}
.btn-mini.btn-danger:hover {
    background: rgba(220, 38, 38, .10);
    color: var(--danger);
    border-color: rgba(220, 38, 38, .4);
}

.news-files-box {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: var(--bg-input);
    border: 1px solid var(--line-2);
    border-radius: var(--radius-sm);
    padding: 10px;
    min-height: 60px;
}
.news-file-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 4px;
    font-size: 13px;
}
.news-file-row > i:first-child {
    color: var(--accent);
    font-size: 14px;
}
.news-file-name {
    flex: 1;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.news-file-size {
    font-size: 11.5px;
    color: var(--text-4);
    font-variant-numeric: tabular-nums;
}
.news-file-row .btn-mini {
    flex: 0 0 28px;
    padding: 4px;
}

.news-attachments {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--line);
}
.news-attachments h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.news-attachments h3 i { color: var(--accent); }

.attachments-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.attachment-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    color: var(--text-2);
    transition: var(--transition);
    text-decoration: none;
    box-shadow: var(--shadow-sm);
}
.attachment-item:hover {
    border-color: var(--accent-line);
    background: var(--accent-soft);
    color: var(--text);
}
.attachment-item > i:first-child {
    color: var(--accent);
    font-size: 18px;
    width: 24px;
    text-align: center;
}
.attachment-info { flex: 1; min-width: 0; }
.attachment-name {
    font-size: 13.5px;
    color: var(--text);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.attachment-size {
    font-size: 11.5px;
    color: var(--text-4);
    margin-top: 2px;
}
.attachment-dl {
    color: var(--text-4);
    font-size: 14px;
    transition: var(--transition);
}
.attachment-item:hover .attachment-dl {
    color: var(--accent);
}

.media-picker-overlay {
    position: fixed;
    inset: 0;
    background: var(--overlay-media);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 5000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: fadeIn .2s;
}
.media-picker {
    background: var(--surface);
    border: 1px solid var(--line-2);
    border-radius: var(--radius-lg);
    max-width: 900px;
    width: 100%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    animation: modalZoom .25s;
}
.media-picker-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--line);
    background: var(--surface-2);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.media-picker-head h3 {
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
}
.media-picker-head h3 i { color: var(--accent); }
.media-picker-head .btn-mini { flex: 0 0 32px; padding: 6px 8px; }
.media-picker-body {
    padding: 16px;
    overflow-y: auto;
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}
.media-pick-item {
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 8px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}
.media-pick-item:hover {
    border-color: var(--accent-line);
    background: var(--accent-soft);
}
.media-pick-item.attaching {
    opacity: .6;
    pointer-events: none;
}
.media-pick-item.attached {
    border-color: var(--accent);
    background: var(--accent-soft);
}
.media-pick-preview {
    width: 100%;
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 6px;
    background: var(--surface);
    border-radius: 4px;
    overflow: hidden;
}
.media-pick-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.media-pick-preview i {
    font-size: 32px;
    color: var(--accent);
    opacity: .5;
}
.media-pick-name {
    font-size: 11.5px;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.media-pick-size {
    font-size: 10.5px;
    color: var(--text-4);
    margin-top: 2px;
}

@media (max-width: 640px) {
    .media-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
    .media-preview { height: 100px; }
    .media-picker-body { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
    .media-pick-preview { height: 70px; }
}

/* ============================================================
   ЧАТ-ЛОГИ (админка)
   ============================================================ */
.chat-stats { margin-bottom: 20px; }

.chat-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.chat-summary-item {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px 18px;
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.chat-summary-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--accent);
    line-height: 1;
    margin-bottom: 6px;
    font-variant-numeric: tabular-nums;
}

.chat-summary-label {
    font-size: 11px;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: .5px;
    font-weight: 600;
}

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

.chat-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow-sm);
}

.chat-panel h4 {
    font-size: 12px;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: .6px;
    font-weight: 600;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.chat-panel h4 i { color: var(--accent); font-size: 11px; }

.chat-top-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.chat-top-row {
    display: grid;
    grid-template-columns: 24px 1fr auto;
    gap: 10px;
    align-items: center;
    padding: 6px 8px;
    background: var(--surface-2);
    border-radius: 4px;
    font-size: 13px;
}

.chat-top-rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    background: var(--surface-3);
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-3);
}
.chat-top-rank.rank-1 { background: rgba(245,158,11,.15); color: #f59e0b; }
.chat-top-rank.rank-2 { background: rgba(203,213,225,.15); color: #94a3b8; }
.chat-top-rank.rank-3 { background: rgba(180,83,9,.15); color: #d97706; }
[data-theme="light"] .chat-top-rank.rank-1 { background: #fef3c7; color: #b45309; }
[data-theme="light"] .chat-top-rank.rank-2 { background: #f1f5f9; color: #475569; }
[data-theme="light"] .chat-top-rank.rank-3 { background: #ffedd5; color: #c2410c; }

.chat-top-name {
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-top-count {
    color: var(--accent);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.chat-day-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.chat-day-row {
    display: grid;
    grid-template-columns: 50px 1fr 40px;
    gap: 10px;
    align-items: center;
    font-size: 12px;
}

.chat-day-label {
    color: var(--text-3);
    font-variant-numeric: tabular-nums;
}

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

.chat-day-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    border-radius: 3px;
    transition: width .4s ease;
}

.chat-day-count {
    color: var(--text-2);
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.chat-toolbar {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.chat-toolbar .field {
    flex: 1;
    min-width: 200px;
    position: relative;
}
.chat-toolbar .field i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-3);
    font-size: 13px;
    pointer-events: none;
}
.chat-toolbar input[type="text"] {
    width: 100%;
    padding: 9px 12px 9px 36px;
    background: var(--bg-input);
    border: 1px solid var(--line-2);
    color: var(--text);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    outline: none;
    transition: var(--transition);
}
.chat-toolbar input[type="text"]:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.chat-toolbar select {
    padding: 9px 32px 9px 12px;
    background: var(--bg-input);
    border: 1px solid var(--line-2);
    color: var(--text);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    outline: none;
    max-width: 220px;
}

.chat-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 8px;
    max-height: 600px;
    overflow-y: auto;
}

.chat-message {
    display: grid;
    grid-template-columns: 40px 1fr auto;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    transition: background var(--transition);
    align-items: flex-start;
}
.chat-message:hover {
    background: var(--surface-2);
}

.chat-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 15px;
    flex-shrink: 0;
}

.chat-body { min-width: 0; flex: 1; }

.chat-head {
    display: flex;
    gap: 10px;
    align-items: baseline;
    margin-bottom: 4px;
    flex-wrap: wrap;
}

.chat-name {
    font-weight: 600;
    color: var(--text);
    font-size: 13px;
}

.chat-time {
    font-size: 11px;
    color: var(--text-4);
    font-variant-numeric: tabular-nums;
}

.chat-text {
    color: var(--text-2);
    font-size: 13.5px;
    line-height: 1.5;
    word-break: break-word;
}
.chat-text mark {
    background: var(--accent-soft);
    color: var(--accent);
    padding: 1px 3px;
    border-radius: 2px;
}

.chat-delete {
    flex: 0 0 28px;
    opacity: 0;
    transition: opacity var(--transition);
}
.chat-message:hover .chat-delete { opacity: 1; }

/* ============================================================
   ПУБЛИЧНЫЙ ЧАТ
   ============================================================ */
.chat-public-list {
    display: flex;
    flex-direction: column;
    padding: 8px;
    max-height: 500px;
    overflow-y: auto;
}

.chat-public-row {
    display: flex;
    gap: 12px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    align-items: flex-start;
}
.chat-public-row:last-child { border-bottom: none; }

.chat-public-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-soft);
    border: 1px solid var(--accent-line);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
}

.chat-public-body { flex: 1; min-width: 0; }

.chat-public-head {
    display: flex;
    gap: 10px;
    align-items: baseline;
    margin-bottom: 3px;
    flex-wrap: wrap;
}

.chat-public-name {
    font-weight: 600;
    color: var(--text);
    font-size: 13px;
}

.chat-public-time {
    font-size: 11px;
    color: var(--text-4);
}

.chat-public-text {
    color: var(--text-2);
    font-size: 13px;
    line-height: 1.5;
    word-break: break-word;
}

@media (max-width: 860px) {
    .chat-dashboard { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
    .chat-summary { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .chat-summary-item { padding: 10px 12px; }
    .chat-summary-value { font-size: 20px; }

    .chat-toolbar .field { min-width: 100%; }
    .chat-toolbar select { max-width: 100%; flex: 1; }

    .chat-message {
        grid-template-columns: 32px 1fr;
        gap: 10px;
        padding: 8px;
    }
    .chat-avatar { width: 30px; height: 30px; font-size: 13px; }
    .chat-delete {
        opacity: 1;
        grid-column: 1 / -1;
        justify-self: end;
        margin-top: 4px;
    }

    .chat-public-avatar { width: 28px; height: 28px; font-size: 12px; }
}

/* ============================================================
   LIVE-БЕЙДЖ
   ============================================================ */
.chat-live-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 8px;
    background: rgba(220, 38, 38, .08);
    border: 1px solid rgba(220, 38, 38, .3);
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    color: var(--danger);
    letter-spacing: .5px;
    margin-left: 8px;
    vertical-align: middle;
}

.chat-live-badge .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--danger);
    animation: live-pulse 1.5s infinite;
}

@keyframes live-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: .4; transform: scale(.85); }
}

.chat-public-row.is-new {
    animation: new-msg-flash 3s ease;
    position: relative;
}

.chat-public-row.is-new::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg,
        var(--accent-soft),
        transparent);
    border-left: 3px solid var(--accent);
    pointer-events: none;
    border-radius: var(--radius-sm);
    animation: new-msg-flash 3s ease;
}

@keyframes new-msg-flash {
    0%   { background-color: var(--accent-soft); }
    100% { background-color: transparent; }
}

.btn-mini.loading i { animation: spin .8s linear infinite; }

.btn-mini .unseen-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background: var(--danger);
    color: #ffffff;
    border-radius: 999px;
    font-size: 9px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: badge-pop .3s ease;
}

@keyframes badge-pop {
    from { transform: scale(0); }
    to   { transform: scale(1); }
}

@media (max-width: 640px) {
    .chat-live-badge {
        font-size: 9px;
        padding: 2px 6px;
        margin-left: 6px;
    }
}

/* ============================================================
   SETTINGS
   ============================================================ */
.settings-system,
.settings-group,
.settings-actions {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
}

.settings-system h3,
.settings-group h3,
.settings-actions h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
}
.settings-system h3 i,
.settings-actions h3 i { color: var(--accent); }

.settings-system h4 {
    font-size: 12px;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: .6px;
    margin: 20px 0 10px;
    font-weight: 600;
}

.system-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}

.system-box {
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
}

.system-label {
    font-size: 11px;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 6px;
    font-weight: 600;
}

.system-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}
.system-value.err { color: var(--danger); }

.system-hint {
    font-size: 11px;
    color: var(--text-4);
    margin-top: 4px;
}

.settings-items { display: flex; flex-direction: column; }

.settings-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}
.settings-item:last-child { border-bottom: none; }

.settings-info { flex: 1; min-width: 0; }

.settings-label {
    font-size: 13.5px;
    color: var(--text);
    font-weight: 500;
}

.settings-hint {
    font-size: 11.5px;
    color: var(--text-4);
    margin-top: 2px;
}

.settings-control {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}

.settings-input {
    width: 110px;
    padding: 8px 10px;
    background: var(--bg-input);
    border: 1px solid var(--line-2);
    color: var(--text);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    outline: none;
    transition: var(--transition);
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.settings-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    cursor: pointer;
}
.switch input { display: none; }

.switch-slider {
    position: absolute;
    inset: 0;
    background: var(--surface-3);
    border: 1px solid var(--line-2);
    border-radius: 999px;
    transition: var(--transition);
}
.switch-slider::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: var(--surface);
    border-radius: 50%;
    transition: var(--transition);
    box-shadow: 0 1px 2px rgba(15, 23, 42, .15);
}
.switch input:checked + .switch-slider {
    background: var(--accent);
    border-color: var(--accent);
}
.switch input:checked + .switch-slider::before {
    background: #ffffff;
    transform: translateX(20px);
    box-shadow: 0 1px 3px rgba(5, 150, 105, .4);
}

.action-output {
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    color: var(--text-2);
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 12px;
    line-height: 1.5;
    max-height: 200px;
    overflow-y: auto;
    white-space: pre-wrap;
}

.settings-actions { padding: 18px 20px; }

@media (max-width: 640px) {
    .settings-item { flex-wrap: wrap; }
    .settings-control { width: 100%; justify-content: flex-end; }
    .settings-input { width: 100%; max-width: 200px; }
}

/* ============================================================
   БОЕВОЙ ЛОГ
   ============================================================ */
.combat-feed {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px;
    max-height: 500px;
    overflow-y: auto;
    background: var(--surface);
    border-top: 1px solid var(--line);
}

.combat-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 8px 12px;
    background: var(--surface-2);
    border-left: 3px solid var(--line-2);
    border-radius: var(--radius-sm);
    font-size: 13px;
    transition: background var(--transition);
}

.combat-row:hover {
    background: var(--surface-hover);
}

.combat-row.is-new {
    animation: combat-flash 3s ease;
}

@keyframes combat-flash {
    0%   { background: var(--accent-soft); }
    100% { background: var(--surface-2); }
}

.combat-row.combat-kill {
    border-left-color: var(--danger);
}
.combat-row.combat-kill.is-headshot {
    border-left-color: #f59e0b;
    background: linear-gradient(90deg,
        rgba(245, 158, 11, .10),
        var(--surface-2) 30%);
}
.combat-row.combat-damage {
    border-left-color: var(--info);
}
.combat-row.combat-suicide {
    border-left-color: #a855f7;
}
.combat-row.combat-world {
    border-left-color: var(--text-4);
}

.combat-time {
    font-size: 11.5px;
    color: var(--text-4);
    font-variant-numeric: tabular-nums;
    font-family: 'SF Mono', Monaco, monospace;
    flex-shrink: 0;
    min-width: 62px;
}

.combat-icon {
    font-size: 14px;
    flex-shrink: 0;
    line-height: 1;
}

.combat-killer,
.combat-victim {
    color: var(--text);
    font-weight: 500;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.combat-killer { color: var(--accent); }
.combat-victim { color: var(--warning); }

.combat-action {
    color: var(--text-3);
    font-size: 12.5px;
}

.combat-weapon {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-2);
    font-size: 12.5px;
    padding: 2px 8px;
    background: var(--surface-3);
    border-radius: 4px;
    white-space: nowrap;
}

.combat-weapon-img {
    width: 28px;
    height: 18px;
    object-fit: contain;
    display: block;
}

.combat-weapon-icon {
    font-size: 12px;
    line-height: 1;
}

.combat-weapon-name { font-weight: 500; }

.combat-hit {
    color: var(--text-3);
    font-size: 12px;
    white-space: nowrap;
}

.combat-distance {
    color: var(--text-3);
    font-size: 11.5px;
    font-variant-numeric: tabular-nums;
    padding: 2px 6px;
    background: var(--surface-3);
    border-radius: 3px;
}

.combat-damage-val {
    color: var(--info);
    font-weight: 600;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    padding: 2px 6px;
    background: rgba(37, 99, 235, .10);
    border-radius: 3px;
}

.combat-badge {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 3px;
    letter-spacing: .5px;
    flex-shrink: 0;
}

.combat-feed .empty-mini {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-3);
}
.combat-feed .empty-mini i {
    font-size: 32px;
    display: block;
    margin-bottom: 10px;
    opacity: .5;
}

@media (max-width: 768px) {
    .combat-feed { padding: 4px; max-height: 400px; }
    .combat-row {
        padding: 8px 10px;
        gap: 6px;
        font-size: 12px;
    }
    .combat-time { min-width: 54px; font-size: 10.5px; }
    .combat-killer,
    .combat-victim { max-width: 110px; }
    .combat-weapon,
    .combat-hit { font-size: 11px; }
    .combat-badge { font-size: 9px; padding: 1px 6px; }
}

/* ============================================================
   MOBILE NAV — аккордеон
   ============================================================ */
.mobile-nav-group { display: block; }
.mobile-nav-toggle {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-2);
    font-family: inherit;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    justify-content: flex-start;
}
.mobile-nav-toggle .mobile-caret {
    margin-left: auto;
    font-size: 12px;
    transition: transform var(--transition);
    opacity: .6;
}
.mobile-nav-group.open .mobile-caret {
    transform: rotate(180deg);
    opacity: 1;
}
.mobile-nav-sub {
    max-height: 0;
    overflow: hidden;
    transition: max-height .3s ease;
    background: var(--surface-2);
}
.mobile-nav-sub .mobile-nav-link {
    font-size: 14px;
    min-height: 48px;
    padding: 12px 20px;
    border-left: 3px solid transparent;
}
.mobile-nav-sub .mobile-nav-link i {
    font-size: 13px;
    color: var(--text-4);
}

/* ============================================================
   DESKTOP NAV — выпадающие подменю
   ============================================================ */
.nav-item {
    position: relative;
    height: 100%;
    display: flex;
    align-items: stretch;
}

.nav-toggle {
    background: transparent;
    border: none;
    font-family: inherit;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    color: var(--text-2);
    font-weight: 500;
    font-size: 13.5px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    transition: var(--transition);
    height: 100%;
}
.nav-toggle:hover { color: var(--text); }
.nav-toggle > i:first-child { font-size: 13px; opacity: .7; }
.nav-item.open .nav-toggle {
    color: var(--text);
    border-bottom-color: var(--accent);
}
.nav-item.open .nav-toggle > i:first-child {
    color: var(--accent);
    opacity: 1;
}

.nav-caret {
    font-size: 9px;
    margin-left: 4px;
    opacity: .6;
    transition: transform var(--transition);
}
.nav-item.open .nav-caret {
    transform: rotate(180deg);
    opacity: 1;
}

.nav-item .dropdown {
    display: none;
    background: var(--surface);
    border: 1px solid var(--line-2);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    z-index: 9999;
    min-width: 200px;
}
.nav-item.open .dropdown {
    display: block;
}

.dropdown-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    font-size: 13px;
    color: var(--text-2);
    border-radius: var(--radius-sm);
    white-space: nowrap;
    transition: var(--transition);
    text-decoration: none;
}
.dropdown-link:hover {
    background: var(--surface-hover);
    color: var(--text);
}
.dropdown-link i {
    width: 16px;
    text-align: center;
    font-size: 12px;
    opacity: .75;
    color: var(--text-3);
}
.dropdown-link:hover i {
    opacity: 1;
    color: var(--accent);
}
.dropdown-link.active {
    background: var(--accent-soft);
    color: var(--accent);
}

/* ============================================================
   Кнопка звука (для чата)
   ============================================================ */
#chatSoundBtn.muted {
    color: var(--text-4);
    border-color: var(--line);
    opacity: .7;
}
#chatSoundBtn.muted i { color: var(--text-4); }
#chatSoundBtn:not(.muted) {
    color: var(--accent);
    border-color: var(--accent-line);
    background: var(--accent-soft);
}




.sound-toggle {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: var(--surface);
    border: 1px solid var(--line-2);
    color: var(--text-2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: var(--transition);
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}
.sound-toggle:hover {
    background: var(--surface-hover);
    border-color: var(--line-3);
    color: var(--accent);
}
.sound-toggle:active { transform: scale(.94); }
.sound-toggle.muted {
    color: var(--text-4);
    opacity: .75;
}
.sound-toggle.muted:hover { color: var(--text-2); }

@media (max-width: 768px) {
    .sound-toggle { width: 38px; height: 38px; font-size: 13px; }
}
























/* ============================================================
   AUTH — страницы входа и регистрации
   ============================================================ */
.auth-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 16px;
    min-height: calc(100vh - 200px);
}

.auth-card {
    width: 100%;
    max-width: 440px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 32px 28px;
    box-shadow: var(--shadow-lg);
}

.auth-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    border-radius: 50%;
    background: var(--accent-soft);
    border: 1px solid var(--accent-line);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.auth-card h1 {
    font-size: 22px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 6px;
    color: var(--text);
    letter-spacing: -.4px;
}

.auth-sub {
    text-align: center;
    color: var(--text-3);
    font-size: 13px;
    margin-bottom: 24px;
}

.auth-error {
    background: rgba(220, 38, 38, .10);
    border: 1px solid rgba(220, 38, 38, .35);
    color: var(--danger);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 12.5px;
    margin-top: 12px;
}

.auth-alt {
    text-align: center;
    margin-top: 18px;
    font-size: 13px;
    color: var(--text-3);
}
.auth-alt a {
    color: var(--accent);
    font-weight: 600;
}
.auth-alt a:hover { color: var(--accent-2); }

.auth-rules {
    margin-top: 8px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 12px;
    color: var(--text-3);
}
.auth-rules summary {
    cursor: pointer;
    color: var(--text-2);
    font-weight: 600;
    font-size: 12.5px;
    user-select: none;
}
.auth-rules ul {
    margin: 8px 0 0 18px;
}
.auth-rules li { margin-bottom: 4px; }

/* ============================================================
   Поле пароля с глазом
   ============================================================ */
.input-pass {
    position: relative;
}
.input-pass input {
    padding-right: 42px;
}
.pass-toggle {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border-radius: 4px;
    background: transparent;
    border: none;
    color: var(--text-3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    transition: var(--transition);
}
.pass-toggle:hover {
    background: var(--surface-hover);
    color: var(--text);
}

/* ============================================================
   Индикатор сложности пароля
   ============================================================ */
.pass-strength {
    display: grid;
    grid-template-columns: repeat(4, 1fr) auto;
    gap: 4px;
    align-items: center;
    margin-top: 6px;
}
.pass-strength .bar {
    height: 4px;
    background: var(--surface-3);
    border-radius: 2px;
    transition: background .25s ease;
}
.pass-strength .bar.on:nth-child(1) { background: #ef4444; }
.pass-strength .bar.on:nth-child(2) { background: #f59e0b; }
.pass-strength .bar.on:nth-child(3) { background: #84cc16; }
.pass-strength .bar.on:nth-child(4) { background: var(--accent); }
.pass-strength .label {
    font-size: 11px;
    color: var(--text-4);
    margin-left: 8px;
    white-space: nowrap;
}

.field-hint {
    font-size: 11.5px;
    color: var(--text-4);
    margin-top: 4px;
}
.field-hint.ok  { color: var(--accent); }
.field-hint.err { color: var(--danger); }

/* ============================================================
   Кнопка «Войти / Профиль» в топбаре
   ============================================================ */
#userBox { display: flex; }

.user-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px 6px 6px;
    background: var(--surface);
    border: 1px solid var(--line-2);
    border-radius: var(--radius);
    color: var(--text-2);
    font-size: 12.5px;
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    white-space: nowrap;
    max-width: 160px;
}
.user-chip:hover {
    background: var(--surface-hover);
    color: var(--text);
    border-color: var(--line-3);
}

.user-chip-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 11px;
    flex-shrink: 0;
}

.user-chip-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-chip.guest {
    padding: 6px 12px;
    background: var(--accent-soft);
    border-color: var(--accent-line);
    color: var(--accent);
}
.user-chip.guest:hover {
    background: var(--accent);
    color: #fff;
}

@media (max-width: 768px) {
    .user-chip { padding: 4px 10px 4px 4px; font-size: 12px; max-width: 110px; }
    .user-chip-avatar { width: 22px; height: 22px; font-size: 10px; }
    .user-chip.guest { padding: 6px 10px; }
    .user-chip.guest .user-chip-name { display: none; }
}

/* ============================================================
   Личный кабинет
   ============================================================ */
.profile-wrap {
    max-width: 860px;
    margin: 0 auto;
}

.profile-head {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 24px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    flex-wrap: wrap;
}

.profile-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
    overflow: hidden;
    flex-shrink: 0;
}
.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-head-info { flex: 1; min-width: 0; }
.profile-head-info h1 {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -.4px;
    color: var(--text);
    margin-bottom: 6px;
}

.profile-role {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .3px;
}
.profile-role.role-user      { background: var(--surface-3); color: var(--text-3); border: 1px solid var(--line-2); }
.profile-role.role-moderator { background: rgba(59, 130, 246, .12); color: #3b82f6; border: 1px solid rgba(59, 130, 246, .35); }
.profile-role.role-admin     { background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent-line); }

.profile-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 6px;
    flex-wrap: wrap;
    box-shadow: var(--shadow-sm);
}
.profile-tabs button {
    flex: 1;
    min-width: 120px;
    padding: 10px 14px;
    background: transparent;
    border: none;
    color: var(--text-2);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.profile-tabs button:hover { background: var(--surface-hover); color: var(--text); }
.profile-tabs button.active {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
}
.profile-tabs button i { font-size: 12px; }

.profile-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

.profile-section { margin-bottom: 24px; }
.profile-section:last-child { margin-bottom: 0; }
.profile-section h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.profile-section h3 i { color: var(--accent); }

.profile-info-list {
    display: flex;
    flex-direction: column;
}
.profile-info-list .row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
    font-size: 13.5px;
}
.profile-info-list .row:last-child { border-bottom: none; }
.profile-info-list .row span { color: var(--text-3); }
.profile-info-list .row b { color: var(--text); font-weight: 600; }

/* ============================================================
   Админ: пользователи
   ============================================================ */
.user-avatar-mini {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
}

.user-row.is-banned {
    opacity: .75;
    border-color: rgba(220, 38, 38, .35);
}
.user-row.is-banned .user-avatar-mini {
    background: linear-gradient(135deg, #6b7280, #374151);
}

.tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .3px;
    margin-left: 6px;
}
.tag-banned { background: rgba(220, 38, 38, .12); color: var(--danger); border: 1px solid rgba(220, 38, 38, .35); }
.tag-role.role-user      { background: var(--surface-3); color: var(--text-3); border: 1px solid var(--line-2); }
.tag-role.role-moderator { background: rgba(59, 130, 246, .12); color: #3b82f6; border: 1px solid rgba(59, 130, 246, .35); }
.tag-role.role-admin     { background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent-line); }

.ban-reason {
    margin-top: 6px;
    font-size: 12px;
    color: var(--danger);
    padding: 4px 8px;
    background: rgba(220, 38, 38, .08);
    border-radius: 4px;
    display: inline-block;
}

@media (max-width: 640px) {
    .profile-head { padding: 18px; gap: 14px; }
    .profile-avatar { width: 56px; height: 56px; font-size: 22px; }
    .profile-head-info h1 { font-size: 18px; }
    .profile-panel { padding: 18px; }
    .auth-card { padding: 24px 20px; }
    .auth-card h1 { font-size: 19px; }
}

















/* ============================================================
   AVATAR EDITOR (личный кабинет)
   ============================================================ */
.avatar-editor {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 20px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    flex-wrap: wrap;
}

.avatar-preview {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    font-weight: 700;
    overflow: hidden;
    flex-shrink: 0;
    border: 2px solid var(--line-2);
    box-shadow: var(--shadow-sm);
    transition: border-color var(--transition);
}
.avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: opacity .2s ease;
}

.avatar-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    min-width: 220px;
}
.avatar-actions .btn { align-self: flex-start; }
.avatar-actions .form-hint { margin: 0; }

/* Круглая аватарка в user-chip топбара */
.user-chip-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

@media (max-width: 640px) {
    .avatar-editor {
        flex-direction: column;
        text-align: center;
        gap: 16px;
    }
    .avatar-preview { width: 80px; height: 80px; font-size: 30px; }
    .avatar-actions { align-items: center; width: 100%; }
    .avatar-actions .btn { align-self: stretch; width: 100%; }
}







/* ==== Blocks (админка) ==== */
.block-row {
    cursor: grab;
    user-select: none;
}
.block-row.dragging {
    opacity: .4;
    cursor: grabbing;
}
.block-row .drag-handle {
    color: var(--text-4);
    cursor: grab;
    padding: 4px;
}
.block-row .drag-handle:hover { color: var(--text-2); }



.profile-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
    overflow: hidden;
    flex-shrink: 0;
    position: relative;
}
.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    position: absolute;   /* ← заливает весь круг */
    inset: 0;             /* ← прижимает к краям */
    background: var(--surface);  /* ← непрозрачная подложка */
}







/* ============================================================
   EDIT MODE TOGGLE
   ============================================================ */
.edit-mode-toggle {
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 40px;
    min-height: 40px;
}
.edit-mode-toggle.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

/* ============================================================
   КНОПКИ АДМИНА НА КАРТОЧКАХ НОВОСТЕЙ
   ============================================================ */
.news-card { position: relative; }

.news-card-admin {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 10;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity .2s ease;
}
.news-card:hover .news-card-admin { opacity: 1; }

.news-card-admin .btn-mini {
    width: 32px;
    height: 32px;
    padding: 0;
    background: rgba(0, 0, 0, .65);
    border: 1px solid rgba(255, 255, 255, .15);
    color: #fff;
    border-radius: 6px;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.news-card-admin .btn-mini:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.news-card-admin .btn-mini.btn-danger:hover {
    background: var(--danger);
    border-color: var(--danger);
}

@media (max-width: 768px) {
    .news-card-admin { opacity: 1; }
}

/* ============================================================
   ПРАВА РОЛЕЙ
   ============================================================ */
.permissions-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.permissions-table thead th {
    padding: 12px;
    background: var(--surface-2);
    border-bottom: 2px solid var(--line-2);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-3);
    text-align: center;
}
.permissions-table thead th:first-child { text-align: left; }
.permissions-table .role-col { text-align: center; width: 140px; }

.permissions-table tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
}
.permissions-table .group-row td {
    background: var(--surface-2);
    padding: 12px 16px;
    border-top: 1px solid var(--line-2);
    font-size: 13px;
}
.permissions-table tbody tr:not(.group-row):hover {
    background: var(--surface-hover);
}

@media (max-width: 768px) {
    .permissions-table .role-col { width: 80px; }
    .permissions-table thead th { font-size: 10px; padding: 8px 4px; }
    .permissions-table tbody td { padding: 8px 4px; }
}

/* ============================================================
   ROLE PICKER
   ============================================================ */
.role-option {
    width: 100%;
    border: 1px solid var(--line-2);
    background: var(--surface);
    color: var(--text-2);
    transition: var(--transition);
}
.role-option:hover:not(:disabled) {
    background: var(--surface-hover);
    border-color: var(--line-3);
    color: var(--text);
}
.role-option.active {
    background: var(--accent-soft);
    border-color: var(--accent-line);
    color: var(--accent);
}
.role-option.active b { color: var(--accent); }
.role-option:disabled { opacity: .5; cursor: not-allowed; }














/* ============================================================
   COMMENTS
   ============================================================ */
.comments-section {
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid var(--line);
}

.comments-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}
.comments-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}
.comments-header h3 i { color: var(--accent); }

.comments-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 8px;
    background: var(--accent-soft);
    color: var(--accent);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    margin-right: 10px;
}

.btn-subscribe {
    font-size: 12px;
    padding: 6px 12px;
}
.btn-subscribe.primary {
    background: var(--accent-soft);
    color: var(--accent);
    border-color: var(--accent-line);
}

.comments-login-prompt {
    text-align: center;
    padding: 40px 20px;
    background: var(--surface-2);
    border-radius: var(--radius);
    border: 1px dashed var(--line-2);
}
.comments-login-prompt i {
    font-size: 28px;
    color: var(--text-3);
    margin-bottom: 10px;
    display: block;
}
.comments-login-prompt p {
    color: var(--text-3);
    margin-bottom: 16px;
    font-size: 13.5px;
}

.comment-form {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    padding: 16px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.comment-form-body { flex: 1; }
.comment-form textarea {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-input);
    border: 1px solid var(--line-2);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    font-size: 13.5px;
    resize: vertical;
    min-height: 60px;
    outline: none;
    transition: var(--transition);
}
.comment-form textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.comment-form-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 8px;
    display: none;
}
.comment-form-actions.show { display: flex; }

.comment-avatar-small,
.comment-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
    overflow: hidden;
}
.comment-avatar img,
.comment-avatar-small img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.comment {
    padding: 14px 16px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    transition: var(--transition);
}
.comment:target {
    border-color: var(--accent-line);
    background: var(--accent-soft);
}

.comment-head {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 8px;
}

.comment-meta {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
    flex: 1;
    min-width: 0;
}
.comment-author {
    font-weight: 600;
    color: var(--text);
    font-size: 13.5px;
}
.comment-role {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: .5px;
}
.comment-role.role-admin { background: var(--accent-soft); color: var(--accent); }
.comment-role.role-mod   { background: rgba(59, 130, 246, .12); color: #3b82f6; }

.comment-time {
    font-size: 11.5px;
    color: var(--text-4);
}
.comment-edited {
    font-size: 11px;
    color: var(--text-4);
    font-style: italic;
}

.comment-body {
    color: var(--text-2);
    font-size: 13.5px;
    line-height: 1.6;
    margin-bottom: 10px;
    word-break: break-word;
}
.comment-mention {
    color: var(--accent);
    font-weight: 500;
}

.comment-reactions {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
}
.comment-react-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: var(--surface);
    border: 1px solid var(--line-2);
    border-radius: 999px;
    color: var(--text-3);
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
}
.comment-react-btn:hover {
    color: var(--text);
    border-color: var(--line-3);
}
.comment-react-btn.active {
    background: var(--accent-soft);
    color: var(--accent);
    border-color: var(--accent-line);
}

.comment-actions {
    display: flex;
    gap: 12px;
    font-size: 12.5px;
}
.comment-action-link {
    background: none;
    border: none;
    color: var(--text-3);
    font-family: inherit;
    font-size: 12.5px;
    cursor: pointer;
    padding: 0;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: color var(--transition);
}
.comment-action-link:hover { color: var(--accent); }
.comment-action-link.danger:hover { color: var(--danger); }

.comment-children {
    margin-top: 12px;
    padding-left: 20px;
    border-left: 2px solid var(--line);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.comment-edit-form textarea {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-input);
    border: 1px solid var(--accent-line);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    font-size: 13.5px;
    resize: vertical;
    min-height: 60px;
    outline: none;
    margin-bottom: 8px;
}

@media (max-width: 640px) {
    .comment-children { padding-left: 10px; }
}

/* ============================================================
   NOTIFICATIONS
   ============================================================ */
.notif-wrap {
    position: relative;
    display: flex;
}

.notif-btn {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: var(--surface);
    border: 1px solid var(--line-2);
    color: var(--text-2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}
.notif-btn:hover {
    background: var(--surface-hover);
    color: var(--accent);
    border-color: var(--line-3);
}

.notif-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--danger);
    color: #fff;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: badge-pop .3s ease;
}

.notif-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 360px;
    max-width: calc(100vw - 24px);
    background: var(--surface);
    border: 1px solid var(--line-2);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 8000;
    display: none;
    flex-direction: column;
    max-height: 500px;
    overflow: hidden;
}
.notif-panel.open {
    display: flex;
    animation: notifIn .2s ease;
}
@keyframes notifIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.notif-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    background: var(--surface-2);
    font-size: 13px;
    font-weight: 600;
}
.notif-head i { color: var(--accent); }

.notif-link {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 11.5px;
    font-family: inherit;
    cursor: pointer;
    padding: 0;
    font-weight: 500;
    transition: color var(--transition);
}
.notif-link:hover { color: var(--accent-2); }

.notif-body {
    overflow-y: auto;
    flex: 1;
}

.notif-item {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    text-decoration: none;
    border-bottom: 1px solid var(--line);
    transition: background var(--transition);
    color: inherit;
}
.notif-item:hover {
    background: var(--surface-2);
}
.notif-item.unread {
    background: linear-gradient(90deg, var(--accent-soft), transparent 60%);
    border-left: 3px solid var(--accent);
}

.notif-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
}

.notif-text { flex: 1; min-width: 0; }
.notif-title {
    font-size: 13px;
    color: var(--text);
    font-weight: 500;
    margin-bottom: 3px;
}
.notif-desc {
    font-size: 12px;
    color: var(--text-3);
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    margin-bottom: 3px;
}
.notif-time {
    font-size: 11px;
    color: var(--text-4);
}

.loader-mini {
    padding: 24px;
    text-align: center;
    color: var(--text-3);
}

@media (max-width: 640px) {
    .notif-panel {
        position: fixed;
        top: 60px;
        right: 8px;
        left: 8px;
        width: auto;
        max-width: none;
    }
    .notif-btn { width: 38px; height: 38px; font-size: 13px; }
}





.status-ok { color: #22c55e; font-size: 0.85em; }
.status-error { color: #ef4444; font-size: 0.85em; }








/* ============================================================
   PLAYER PROFILES
   ============================================================ */
.player-profile-wrap {
    max-width: 1100px;
    margin: 0 auto;
}

.player-profile-head {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 24px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
    flex-wrap: wrap;
}

.player-profile-avatar {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 34px;
    font-weight: 700;
    overflow: hidden;
    flex-shrink: 0;
    border: 2px solid var(--line-2);
    box-shadow: var(--shadow);
}
.player-profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.player-profile-info {
    flex: 1;
    min-width: 0;
}
.player-profile-info h1 {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -.4px;
    color: var(--text);
    margin-bottom: 8px;
    word-break: break-word;
}
.player-profile-meta {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: center;
    font-size: 13px;
    color: var(--text-3);
}
.player-profile-meta i { color: var(--accent); opacity: .85; margin-right: 4px; }
.player-profile-meta .badge { margin: 0; }

.player-profile-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.player-top-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.player-top-row {
    display: grid;
    grid-template-columns: 24px 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 8px 10px;
    background: var(--surface-2);
    border-radius: 6px;
    font-size: 13px;
    transition: background var(--transition);
}
.player-top-row:hover { background: var(--surface-hover); }

.player-top-rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    background: var(--surface-3);
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-3);
}
.player-top-rank.rank-1 { background: rgba(245,158,11,.15); color: #f59e0b; }
.player-top-rank.rank-2 { background: rgba(203,213,225,.15); color: #94a3b8; }
.player-top-rank.rank-3 { background: rgba(180,83,9,.15); color: #d97706; }
[data-theme="light"] .player-top-rank.rank-1 { background: #fef3c7; color: #b45309; }
[data-theme="light"] .player-top-rank.rank-2 { background: #f1f5f9; color: #475569; }
[data-theme="light"] .player-top-rank.rank-3 { background: #ffedd5; color: #c2410c; }

.player-top-name {
    color: var(--text);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.player-top-val {
    color: var(--accent);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

@media (max-width: 768px) {
    .player-profile-head {
        padding: 18px;
        gap: 14px;
        text-align: center;
    }
    .player-profile-avatar {
        width: 64px;
        height: 64px;
        font-size: 24px;
        margin: 0 auto;
    }
    .player-profile-info h1 { font-size: 20px; text-align: center; }
    .player-profile-meta { justify-content: center; }
    .player-profile-actions {
        width: 100%;
        justify-content: center;
    }
    .player-profile-actions .btn { flex: 1; min-width: 120px; }
}








/* ============================================================
   WEAPONS ADMIN
   ============================================================ */
.weapon-row .weapon-thumb {
    width: 120px;
    height: 90px;
    object-fit: contain;
    background: var(--surface-3);
    border-radius: 6px;
    padding: 6px;
    flex-shrink: 0;
}

.weapon-thumb-empty,
.weapon-thumb-icon {
    width: 120px;
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-3);
    border-radius: 6px;
    color: var(--accent);
    font-size: 32px;
    flex-shrink: 0;
}

/* На странице игрока */
.player-top-row {
    grid-template-columns: 24px 80px 1fr auto !important;
}

.player-top-visual {
    width: 80px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.player-top-weapon-img {
    max-width: 80px;
    max-height: 52px;
    object-fit: contain;
    display: block;
}

.player-top-weapon-icon {
    color: var(--accent);
    font-size: 26px;
}

.player-top-icon-placeholder {
    font-size: 14px;
    opacity: .5;
}

@media (max-width: 640px) {
    .player-top-row {
        grid-template-columns: 20px 60px 1fr auto !important;
        gap: 8px !important;
    }
    .player-top-weapon-img { max-width: 60px; max-height: 40px; }
    .player-top-weapon-icon { font-size: 20px; }

}






















/* ============================================================
   WEAPONS GRID (карточки на странице игрока)
   ============================================================ */
.weapons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 14px;
    padding: 16px;
}

.weapon-card {
    position: relative;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 16px 12px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: all .25s cubic-bezier(.4, 0, .2, 1);
    overflow: hidden;
    /* cursor: url('/images/cursors/aim.svg') 16 16, crosshair; */
	cursor: pointer;
	box-shadow: 0 10px 30px rgba(0, 0, 0, .2);
    user-select: none;
}
.weapon-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 0%, var(--accent-soft), transparent 70%);
    opacity: 0;
    transition: opacity .3s ease;
    pointer-events: none;
}

.weapon-card:hover {
    border-color: var(--accent-line);
    background: var(--surface);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .15);
}

.weapon-card:hover::before {
    opacity: 1;
}

/* Ранг (1, 2, 3 — золото/серебро/бронза) */
.weapon-card-rank {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-3);
    color: var(--text-3);
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
    z-index: 2;
    border: 1px solid var(--line-2);
}
.weapon-card-rank.gold {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #fff;
    border-color: #f59e0b;
    box-shadow: 0 0 12px rgba(245, 158, 11, .5);
}
.weapon-card-rank.silver {
    background: linear-gradient(135deg, #e5e7eb, #9ca3af);
    color: #fff;
    border-color: #9ca3af;
    box-shadow: 0 0 12px rgba(156, 163, 175, .4);
}
.weapon-card-rank.bronze {
    background: linear-gradient(135deg, #d97706, #b45309);
    color: #fff;
    border-color: #b45309;
    box-shadow: 0 0 12px rgba(180, 83, 9, .4);
}

/* Картинка оружия */
.weapon-card-visual {
    width: 100%;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    padding: 8px;
    position: relative;
    z-index: 1;
}

.weapon-card-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
    /* Лёгкая тень для прозрачных PNG — помогает отделить от фона */
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, .25));
    transition: transform .3s ease;
}

.weapon-card:hover .weapon-card-img {
    transform: scale(1.06);
}

/* Font Awesome иконка */
.weapon-card-icon {
    color: var(--accent);
    font-size: 42px;
    opacity: .85;
    filter: drop-shadow(0 2px 6px var(--accent-glow));
}

/* Плейсхолдер */
.weapon-card-placeholder {
    color: var(--text-4);
    font-size: 36px;
    opacity: .4;
}

/* Имя оружия */
.weapon-card-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
    margin-bottom: 6px;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    position: relative;
    z-index: 1;
}

/* Количество убийств */
.weapon-card-kills {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
    background: var(--accent-soft);
    padding: 3px 10px;
    border-radius: 999px;
    border: 1px solid var(--accent-line);
    position: relative;
    z-index: 1;
}

.weapon-card-kills i {
    font-size: 10px;
    opacity: .8;
}

/* Адаптив */
@media (max-width: 768px) {
    .weapons-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 10px;
        padding: 12px;
    }
    .weapon-card {
        padding: 14px 10px 10px;
    }
    .weapon-card-visual {
        height: 80px;
        margin-bottom: 8px;
    }
    .weapon-card-icon { font-size: 34px; }
    .weapon-card-placeholder { font-size: 28px; }
    .weapon-card-name { font-size: 12px; }
    .weapon-card-kills { font-size: 11px; padding: 2px 8px; }
    .weapon-card-rank { width: 20px; height: 20px; font-size: 10px; top: 6px; left: 6px; }
}

@media (max-width: 480px) {
    .weapons-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        padding: 8px;
    }
    .weapon-card-visual { height: 70px; }
}





/* ============================================================
   WEAPON DETAILS MODAL
   ============================================================ */
.weapon-modal-overlay {
    /* Наследуется от media-picker-overlay */
}

.weapon-modal {
    background: var(--surface);
    border: 1px solid var(--line-2);
    border-radius: 12px;
    max-width: 720px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    animation: modalZoom .25s ease;
    overflow: hidden;
}

.weapon-modal-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--line);
    background: var(--surface-2);
}

.weapon-modal-head h3 {
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    margin: 0;
}
.weapon-modal-head h3 i { color: var(--accent); }

.weapon-modal-body {
    overflow-y: auto;
    padding: 0;
    flex: 1;
}

.weapon-details {
    padding: 20px;
}

/* Заголовок с картинкой */
.weapon-details-head {
    text-align: center;
    padding: 20px 20px 24px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 20px;
}

.weapon-details-visual {
    width: 240px;
    height: 140px;
    margin: 0 auto 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.weapon-modal-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, .3));
}

.weapon-modal-icon {
    font-size: 72px;
    color: var(--accent);
    filter: drop-shadow(0 4px 12px var(--accent-glow));
}

.weapon-modal-placeholder {
    font-size: 60px;
    color: var(--text-4);
    opacity: .4;
}

.weapon-details-head h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -.4px;
    margin-bottom: 6px;
}

.weapon-details-key {
    display: inline-block;
    font-size: 12px;
    padding: 3px 10px;
    background: var(--surface-3);
    color: var(--text-3);
    border-radius: 999px;
    border: 1px solid var(--line-2);
    font-family: 'SF Mono', Monaco, monospace;
}

/* 4 карточки со статистикой */
.weapon-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.weapon-stat-box {
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 14px 16px;
    text-align: center;
    transition: var(--transition);
}

.weapon-stat-box:hover {
    border-color: var(--line-2);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.weapon-stat-label {
    font-size: 11px;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: .5px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    margin-bottom: 8px;
}
.weapon-stat-label i { color: var(--accent); opacity: .8; font-size: 10px; }

.weapon-stat-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
    font-variant-numeric: tabular-nums;
    letter-spacing: -.3px;
}

.weapon-stat-hint {
    font-size: 11px;
    color: var(--text-4);
    margin-top: 4px;
}

/* Секции */
.weapon-section {
    margin-bottom: 24px;
}
.weapon-section:last-child { margin-bottom: 0; }

.weapon-section h3 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
}
.weapon-section h3 i { color: var(--accent); font-size: 13px; }

/* Разбивка по hitloc */
.hitloc-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.hitloc-row {
    display: grid;
    grid-template-columns: 130px 1fr 70px;
    gap: 12px;
    align-items: center;
    font-size: 13px;
}

.hitloc-label {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-2);
    white-space: nowrap;
}

.hitloc-bar-wrap {
    height: 8px;
    background: var(--surface-3);
    border-radius: 4px;
    overflow: hidden;
}

.hitloc-bar {
    height: 100%;
    border-radius: 4px;
    transition: width .5s ease;
}

.hitloc-value {
    display: flex;
    align-items: baseline;
    gap: 6px;
    justify-content: flex-end;
    color: var(--text);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.hitloc-value small {
    font-size: 11px;
    color: var(--text-4);
    font-weight: 400;
}

/* Топ-жертвы */
.victims-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.victim-row {
    display: grid;
    grid-template-columns: 28px 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 8px 12px;
    background: var(--surface-2);
    border-radius: 6px;
    font-size: 13px;
    transition: background var(--transition);
}
.victim-row:hover { background: var(--surface-hover); }

.victim-rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    background: var(--surface-3);
    color: var(--text-3);
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
}
.victim-rank.gold   { background: rgba(245,158,11,.15); color: #f59e0b; }
.victim-rank.silver { background: rgba(203,213,225,.15); color: #94a3b8; }
.victim-rank.bronze { background: rgba(180,83,9,.15); color: #d97706; }
[data-theme="light"] .victim-rank.gold   { background: #fef3c7; color: #b45309; }
[data-theme="light"] .victim-rank.silver { background: #f1f5f9; color: #475569; }
[data-theme="light"] .victim-rank.bronze { background: #ffedd5; color: #c2410c; }

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

.victim-link {
    color: var(--accent);
    text-decoration: none;
    transition: var(--transition);
}
.victim-link:hover {
    color: var(--accent-2);
    text-decoration: underline;
}

.victim-kills {
    color: var(--accent);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* Последние убийства */
.recent-kills-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.recent-kill-row {
    display: grid;
    grid-template-columns: auto 20px 1fr auto auto auto;
    gap: 10px;
    align-items: center;
    padding: 7px 10px;
    background: var(--surface-2);
    border-left: 3px solid var(--line-2);
    border-radius: 6px;
    font-size: 12.5px;
    transition: background var(--transition);
}
.recent-kill-row:hover { background: var(--surface-hover); }
.recent-kill-row.is-headshot {
    border-left-color: #f59e0b;
    background: linear-gradient(90deg, rgba(245,158,11,.08), var(--surface-2) 40%);
}

.recent-time {
    font-size: 11px;
    color: var(--text-4);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.recent-icon { font-size: 13px; }

.recent-victim {
    color: var(--warning);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.recent-hitloc {
    color: var(--text-3);
    font-size: 11.5px;
    white-space: nowrap;
}

.recent-distance {
    color: var(--text-4);
    font-size: 11px;
    padding: 1px 6px;
    background: var(--surface-3);
    border-radius: 3px;
    font-variant-numeric: tabular-nums;
}

.recent-badge {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 3px;
    letter-spacing: .5px;
}

/* Адаптив */
@media (max-width: 640px) {
    .weapon-modal {
        max-width: 100vw;
        max-height: 100vh;
        border-radius: 0;
    }

    .weapon-details { padding: 14px; }
    .weapon-details-visual { width: 180px; height: 110px; }
    .weapon-details-head h2 { font-size: 18px; }

    .weapon-stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    .weapon-stat-box { padding: 10px 12px; }
    .weapon-stat-value { font-size: 18px; }

    .hitloc-row {
        grid-template-columns: 100px 1fr 60px;
        gap: 8px;
        font-size: 12px;
    }
    .hitloc-label span:last-child {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .recent-kill-row {
        grid-template-columns: 1fr auto;
        gap: 6px;
    }
    .recent-time { grid-column: 1 / -1; }
    .recent-hitloc,
    .recent-distance,
    .recent-badge { font-size: 10px; }
}







/* ============================================================
   WEAPON DESCRIPTION (в модалке деталей)
   ============================================================ */
.weapon-description {
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 16px 18px;
    margin-bottom: 20px;
}

.weapon-description h3 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}
.weapon-description h3 i { color: var(--accent); font-size: 13px; }

.weapon-description-text {
    font-size: 13.5px;
    line-height: 1.6;
    color: var(--text-2);
    word-break: break-word;
}

@media (max-width: 640px) {
    .weapon-description {
        padding: 12px 14px;
        margin-bottom: 16px;
    }
    .weapon-description-text { font-size: 13px; }
}












/* ============================================================
   MAPS GRID (карточки карт на странице игрока)
   ============================================================ */
.maps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
    padding: 16px;
}

.map-card {
    position: relative;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    user-select: none;
    transition: all .25s cubic-bezier(.4, 0, .2, 1);
    display: flex;
    flex-direction: column;
}

.map-card:hover {
    border-color: var(--accent-line);
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, .2);
}

.map-card:active {
    transform: translateY(-1px) scale(.99);
    transition: transform .1s ease;
}

.map-card:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.map-card-rank {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, .65);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: #fff;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 700;
    z-index: 3;
    border: 1px solid rgba(255, 255, 255, .15);
}
.map-card-rank.gold {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    box-shadow: 0 0 14px rgba(245, 158, 11, .55);
}
.map-card-rank.silver {
    background: linear-gradient(135deg, #e5e7eb, #9ca3af);
    box-shadow: 0 0 14px rgba(156, 163, 175, .45);
}
.map-card-rank.bronze {
    background: linear-gradient(135deg, #d97706, #b45309);
    box-shadow: 0 0 14px rgba(180, 83, 9, .45);
}

.map-card-visual {
    width: 100%;
    aspect-ratio: 16 / 10;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: linear-gradient(135deg, var(--surface-3), var(--surface-2));
    position: relative;
}

.map-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .35s cubic-bezier(.4, 0, .2, 1);
}

.map-card:hover .map-card-img {
    transform: scale(1.06);
}

.map-card-mini {
    object-fit: contain;
    padding: 12px;
}

.map-card-icon {
    color: var(--accent);
    font-size: 48px;
    opacity: .6;
}

.map-card-placeholder {
    color: var(--text-4);
    font-size: 44px;
    opacity: .35;
}

.map-card-name {
    padding: 12px 14px 4px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.map-card-plays {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin: 4px 14px 12px;
    padding: 3px 10px;
    background: var(--accent-soft);
    color: var(--accent);
    border: 1px solid var(--accent-line);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    align-self: flex-start;
}

.map-card-plays i { font-size: 10px; opacity: .8; }

/* Модалка карты */
.map-modal-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 6px;
}

/* Адаптив */
@media (max-width: 768px) {
    .maps-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 10px;
        padding: 12px;
    }
    .map-card-name { font-size: 13px; padding: 10px 12px 4px; }
    .map-card-plays { margin: 4px 12px 10px; font-size: 11px; padding: 2px 8px; }
    .map-card-icon,
    .map-card-placeholder { font-size: 36px; }
}

@media (max-width: 480px) {
    .maps-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        padding: 8px;
    }
}