:root {
    color-scheme: dark;
    --bg: #0e1117;
    --panel: #161b24;
    --text: #e8edf5;
    --muted: #97a3b6;
    --accent: #5b8cff;
    --line: #263041;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    background: radial-gradient(circle at top, #182033 0, var(--bg) 55%);
    color: var(--text);
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

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

.brand {
    color: var(--text);
    font-weight: 700;
    letter-spacing: 0.2px;
    text-decoration: none;
}

.status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 14px;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #3ddc84;
    box-shadow: 0 0 10px #3ddc84;
}

.page {
    width: min(760px, 100%);
    margin: 0 auto;
    padding: 56px 24px;
    flex: 1;
}

.hero h1 {
    margin: 0 0 16px;
    font-size: clamp(34px, 6vw, 56px);
    line-height: 1.05;
}

.lead {
    color: var(--muted);
    font-size: 18px;
    line-height: 1.6;
    max-width: 620px;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 28px;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0 20px;
    border: 1px solid transparent;
    border-radius: 12px;
    background: var(--accent);
    color: #fff;
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.button.secondary {
    background: var(--panel);
    border-color: var(--line);
    color: var(--text);
}

.button.secondary:disabled {
    color: var(--muted);
    cursor: not-allowed;
}

.button.small {
    min-height: 38px;
    padding: 0 14px;
    border-radius: 10px;
    font-size: 14px;
}

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

.nav {
    display: flex;
    align-items: center;
    gap: 16px;
}

.nav-link {
    color: var(--muted);
    text-decoration: none;
    font-size: 14px;
}

.nav-link:hover {
    color: var(--text);
}

.inline-form {
    margin: 0;
}

.link-button {
    padding: 0;
    border: 0;
    background: none;
    color: var(--muted);
    font: inherit;
    font-size: 14px;
    cursor: pointer;
}

.link-button:hover {
    color: var(--text);
}

.card {
    margin-top: 18px;
    padding: 24px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 16px;
}

.auth-card {
    max-width: 460px;
    margin: 24px auto 0;
}

.auth-card h1 {
    margin: 0 0 8px;
    font-size: 32px;
}

.form {
    display: grid;
    gap: 16px;
    margin-top: 20px;
}

.form label {
    display: grid;
    gap: 8px;
    color: var(--muted);
    font-size: 14px;
}

.form input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #0f141d;
    color: var(--text);
    font: inherit;
    outline: none;
}

.form input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(91, 140, 255, 0.18);
}

.alert {
    margin-top: 18px;
    padding: 12px 14px;
    border: 1px solid rgba(255, 110, 110, 0.35);
    border-radius: 10px;
    background: rgba(255, 92, 92, 0.1);
    color: #ffb4b4;
    font-size: 14px;
    line-height: 1.5;
}

.alert.success {
    border-color: rgba(61, 220, 132, 0.4);
    background: rgba(61, 220, 132, 0.1);
    color: #7ef0b0;
}

.muted {
    color: var(--muted);
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--muted);
    font-size: 12px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.profile-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.profile-head h1 {
    margin: 0;
}

.level-badge {
    padding: 8px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--panel);
    font-weight: 600;
    white-space: nowrap;
}

.level-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.progress {
    height: 10px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #0d121b;
}

.progress span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #5b8cff, #8f6bff);
}

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

.stat {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--panel);
}

.stat-label {
    color: var(--muted);
    font-size: 13px;
}

.stat strong {
    font-size: 22px;
}

.stat small {
    font-size: 12px;
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.section-head h2 {
    margin: 0;
    font-size: 20px;
}

.achievements {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-top: 16px;
}

.achievement {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #0f141d;
    font-size: 24px;
    filter: grayscale(1);
    opacity: 0.55;
}

.achievement.earned {
    border-color: rgba(91, 140, 255, 0.5);
    background: rgba(91, 140, 255, 0.1);
    filter: none;
    opacity: 1;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border: 1px solid rgba(61, 220, 132, 0.4);
    border-radius: 999px;
    background: rgba(61, 220, 132, 0.1);
    color: #7ef0b0;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

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

.form.compact {
    width: max-content;
    max-width: 100%;
    margin-top: 16px;
}

.rules {
    margin: 12px 0 0;
    padding-left: 20px;
    color: var(--muted);
    line-height: 1.7;
}

.link-url {
    margin-top: 16px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #0f141d;
    overflow-wrap: anywhere;
}

.link-url code {
    color: var(--text);
    font-size: 13px;
}

.highlight-card {
    border-color: rgba(91, 140, 255, 0.45);
    background: linear-gradient(135deg, rgba(91, 140, 255, 0.12), var(--panel) 60%);
}

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 18px;
}

.tab {
    padding: 8px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    text-decoration: none;
    font-size: 14px;
}

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

.tab.active {
    border-color: rgba(91, 140, 255, 0.55);
    background: rgba(91, 140, 255, 0.14);
    color: var(--text);
}

.top-list {
    display: grid;
    gap: 4px;
    margin: 16px 0 0;
    padding: 0;
    list-style: none;
    counter-reset: none;
}

.top-list li {
    display: flex;
    align-items: baseline;
    gap: 14px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
}

.top-list li:last-child {
    border-bottom: 0;
}

.top-place {
    min-width: 32px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.top-value {
    min-width: 90px;
    font-size: 18px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.week-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.week-grid .card {
    margin-top: 18px;
}

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

.messages {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 260px;
    max-height: 56vh;
    margin-top: 18px;
    padding: 16px;
    overflow-y: auto;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #0f141d;
}

.message {
    display: flex;
    flex-direction: column;
    max-width: 78%;
}

.message.me {
    align-self: flex-end;
    align-items: flex-end;
}

.message.peer {
    align-self: flex-start;
    align-items: flex-start;
}

.message.system {
    align-self: center;
    align-items: center;
    max-width: 90%;
}

.message-bubble {
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--panel);
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.message.me .message-bubble {
    border-color: rgba(91, 140, 255, 0.45);
    background: rgba(91, 140, 255, 0.18);
}

.message.system .message-bubble {
    border-color: transparent;
    background: transparent;
    color: var(--muted);
    font-size: 13px;
}

.message-time {
    margin-top: 4px;
    color: var(--muted);
    font-size: 11px;
}

.chat-form {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

.chat-form input {
    flex: 1;
    min-width: 0;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #0f141d;
    color: var(--text);
    font: inherit;
    outline: none;
}

.chat-form input:focus {
    border-color: var(--accent);
}

.stop-form {
    margin-top: 16px;
}

.rating-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
    max-width: 460px;
    margin-top: 20px;
}

.rating-button {
    min-height: 56px;
    padding: 0;
    font-size: 18px;
}

.search-pulse {
    display: flex;
    gap: 8px;
    margin: 22px 0;
}

.search-pulse span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
    animation: search-pulse 1.2s ease-in-out infinite;
}

.search-pulse span:nth-child(2) {
    animation-delay: 0.15s;
}

.search-pulse span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes search-pulse {
    0%,
    100% {
        opacity: 0.25;
        transform: translateY(0);
    }

    50% {
        opacity: 1;
        transform: translateY(-4px);
    }
}

@media (max-width: 640px) {
    .stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .achievements {
        grid-template-columns: repeat(4, 1fr);
    }

    .topbar {
        flex-wrap: wrap;
    }

    .message {
        max-width: 92%;
    }

    .chat-form {
        flex-direction: column;
    }

    .rating-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}

.note {
    margin-top: 28px;
    color: var(--muted);
    font-size: 14px;
}

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

/* --- Админка --- */

.page-wide {
    width: min(1180px, 100%);
}

.admin-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 18px 0 4px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--line);
}

.admin-nav-link {
    padding: 8px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    text-decoration: none;
    font-size: 14px;
}

.admin-nav-link:hover {
    color: var(--text);
}

.admin-nav-link.active {
    border-color: rgba(91, 140, 255, 0.55);
    background: rgba(91, 140, 255, 0.14);
    color: var(--text);
}

.admin-stats {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.stat-date {
    font-size: 15px !important;
}

.admin-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 14px;
    align-items: end;
}

.admin-filters label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 13px;
}

.admin-filters input,
.admin-filters select,
.form textarea,
.form select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #0f141d;
    color: var(--text);
    font: inherit;
    outline: none;
}

.admin-filters input:focus,
.admin-filters select:focus,
.form textarea:focus,
.form select:focus {
    border-color: var(--accent);
}

.admin-filters input[type="checkbox"] {
    width: auto;
}

.admin-check {
    display: flex !important;
    flex-direction: row;
    align-items: center;
    gap: 8px !important;
    align-self: end;
    min-height: 42px;
}

.admin-filter-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.admin-search-field {
    grid-column: span 2;
}

.admin-table-wrap {
    overflow-x: auto;
    margin-top: 16px;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.admin-table th,
.admin-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

.admin-table th {
    color: var(--muted);
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
}

.admin-table tbody tr:hover {
    background: rgba(91, 140, 255, 0.06);
}

.admin-table a {
    text-decoration: none;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
}

.status-pill.status-active,
.status-pill.status-resolved {
    border-color: rgba(61, 220, 132, 0.4);
    background: rgba(61, 220, 132, 0.1);
    color: #7ef0b0;
}

.status-pill.status-banned,
.status-pill.status-rejected {
    border-color: rgba(255, 110, 110, 0.4);
    background: rgba(255, 92, 92, 0.1);
    color: #ffb4b4;
}

.status-pill.status-open,
.status-pill.status-cancelled {
    border-color: rgba(255, 196, 92, 0.4);
    background: rgba(255, 196, 92, 0.1);
    color: #ffd98a;
}

.report-count {
    display: inline-flex;
    min-width: 26px;
    justify-content: center;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(255, 92, 92, 0.16);
    color: #ffb4b4;
    font-size: 12px;
}

.admin-messages {
    display: grid;
    gap: 12px;
    margin-top: 16px;
}

.admin-message {
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #0f141d;
}

.admin-message.system {
    border-style: dashed;
    color: var(--muted);
}

.admin-message header {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: baseline;
    margin-bottom: 8px;
    font-size: 13px;
}

.admin-message-text {
    margin: 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.admin-message-text.deleted {
    color: var(--muted);
    font-style: italic;
}

.admin-message footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    font-size: 12px;
}

.admin-pre {
    max-height: 260px;
    margin: 8px 0 0;
    padding: 10px 12px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #0b0f16;
    color: var(--muted);
    font-size: 12px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.admin-report {
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

.admin-report:last-child {
    border-bottom: 0;
}

.admin-report p {
    margin: 6px 0;
}

.pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 18px;
}

.report-block {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.report-block summary {
    color: var(--muted);
    font-size: 14px;
    cursor: pointer;
}

.report-block summary:hover {
    color: var(--text);
}

.report-block .form {
    margin-top: 14px;
}

@media (max-width: 640px) {
    .admin-search-field {
        grid-column: span 1;
    }

    .admin-filters {
        grid-template-columns: 1fr;
    }
}
