/* Триумф MMORPG - Основные стили */
/* Шрифты подключаются отдельным <link> в header — иначе @import блокирует разбор всего файла и откладывает стили (в т.ч. нижнюю панель) */

/* Уважение к prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

:root {
    /* До первого inline-скрипта в футере — близкие к реальным, чтобы не было скачка макета */
    --header-offset: 78px;
    --bottom-nav-height: 76px;
    --primary: #8b7cff;
    --primary-dark: #6b5bd4;
    --primary-glow: rgba(139, 124, 255, 0.45);
    --secondary: #00e5d4;
    --accent: #ff6b9d;
    --bg: #060612;
    --bg-card: rgba(16, 16, 38, 0.88);
    --bg-card2: rgba(24, 24, 52, 0.92);
    --bg-input: rgba(28, 28, 55, 0.95);
    --text: #f2f2ff;
    --text-muted: #a0a0d0;
    --gold: #ffd93d;
    --silver: #c8c8e0;
    --red: #ff5c7a;
    --green: #3ee88a;
    --blue: #4da6ff;
    --orange: #ffa94d;
    --purple: #b366ff;
    --border: rgba(120, 120, 200, 0.2);
    --border-light: rgba(139, 124, 255, 0.35);
    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-card: 0 6px 28px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(139, 124, 255, 0.1);
    --max-width: 500px;
    /* Glassmorphism */
    --glass-bg: rgba(12, 12, 32, 0.78);
    --glass-border: rgba(139, 124, 255, 0.15);
    --glass-blur: 24px;
    /* Удобные нажатия на телефонах */
    --touch-target: 48px;
    --page-gutter: 14px;
}

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

html {
    overflow-x: hidden;
    scrollbar-gutter: auto;
}

body {
    font-family: 'Nunito', sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.55;
    min-height: 100vh;
    -webkit-text-size-adjust: 100%;
    overflow-x: hidden;
    -webkit-tap-highlight-color: rgba(139, 124, 255, 0.12);
    background-image: 
        radial-gradient(ellipse 120% 70% at 50% -20%, rgba(139, 124, 255, 0.22) 0%, transparent 50%),
        radial-gradient(ellipse 80% 50% at 50% 0%, rgba(124, 108, 247, 0.12) 0%, transparent 45%),
        radial-gradient(ellipse 70% 50% at 95% 100%, rgba(0, 229, 212, 0.12) 0%, transparent 55%),
        radial-gradient(ellipse 50% 40% at 5% 80%, rgba(255, 107, 157, 0.1) 0%, transparent 50%);
}

@supports (height: 100dvh) {
    body {
        min-height: 100dvh;
    }
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        linear-gradient(rgba(139, 124, 255, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(139, 124, 255, 0.04) 1px, transparent 1px);
    background-size: 36px 36px;
    pointer-events: none;
    z-index: 0;
}

.game-container {
    max-width: var(--max-width);
    width: 100%;
    margin: 0 auto;
    padding-top: var(--header-offset, 78px);
    padding-bottom: calc(var(--bottom-nav-height, 76px) + env(safe-area-inset-bottom, 0px) + 8px);
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
    min-height: 100vh;
    position: relative;
    z-index: 1;
    animation: pageFadeIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@supports (height: 100dvh) {
    .game-container {
        min-height: 100dvh;
    }
}

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

/* ===== TOP BAR (фиксированный) ===== */
.top-bar {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: var(--max-width);
    background: linear-gradient(180deg, var(--glass-bg) 0%, rgba(8, 8, 24, 0.96) 100%);
    border-bottom: 1px solid var(--glass-border);
    box-shadow: 0 6px 32px rgba(0, 0, 0, 0.5), 0 1px 0 rgba(255, 255, 255, 0.05) inset;
    z-index: 1000;
    padding: 10px 14px;
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
}

.top-bar-main {
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 100%;
    min-width: 0;
}

.top-bar-stats {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
    min-width: 0;
}

.stat-item img {
    width: 14px;
    height: 14px;
}

.stat-icon {
    width: 14px;
    height: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
}

.exp-bar-container {
    margin-top: 6px;
    background: var(--bg);
    border-radius: 4px;
    height: 8px;
    overflow: hidden;
    position: relative;
}

.exp-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: 4px;
    min-width: 2px;
    box-shadow: 0 0 14px rgba(139, 124, 255, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.exp-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 7px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
    white-space: nowrap;
}

.top-bar-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 4px;
    font-size: 10px;
    color: var(--text-muted);
    gap: 8px;
}

.top-bar-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.top-bar-notify-btn,
.top-bar-refresh-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    font-size: 15px;
    line-height: 1;
    color: var(--text-muted);
    background: rgba(255,255,255,0.06);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: color 0.2s, background 0.2s;
}
.top-bar-notify-btn:hover,
.top-bar-refresh-btn:hover {
    color: var(--primary);
    background: rgba(108,92,231,0.2);
}
.top-bar-notify-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    font-size: 9px;
    font-weight: 700;
    line-height: 16px;
    color: #fff;
    text-align: center;
    background: linear-gradient(135deg, #e11d48, #be123c);
    border-radius: 999px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.35);
}

.top-bar-settings-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    font-size: 16px;
    text-decoration: none;
    color: var(--text-muted);
    background: rgba(255,255,255,0.06);
    border-radius: 8px;
    transition: color 0.2s, background 0.2s;
}
.top-bar-settings-btn:hover {
    color: var(--primary);
    background: rgba(108,92,231,0.2);
}

/* Уведомления (модальное окно) */
.notifications-modal {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 12px;
    padding-top: max(12px, env(safe-area-inset-top));
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}
.notifications-modal.is-open {
    pointer-events: auto;
    opacity: 1;
    visibility: visible;
}
body.notifications-modal-open {
    overflow: hidden;
}
.notifications-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(4, 6, 18, 0.72);
    backdrop-filter: blur(4px);
}
.notifications-modal__panel {
    position: relative;
    width: 100%;
    max-width: 420px;
    max-height: min(78vh, 520px);
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    background: linear-gradient(165deg, rgba(22, 22, 42, 0.98), rgba(12, 12, 28, 0.99));
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.55);
    overflow: hidden;
}
.notifications-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.notifications-modal__title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    font-family: 'Cinzel', 'Nunito', serif;
    color: var(--text);
}
.notifications-modal__close {
    width: 32px;
    height: 32px;
    padding: 0;
    font-size: 22px;
    line-height: 1;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
}
.notifications-modal__close:hover {
    color: var(--text);
    background: rgba(255,255,255,0.08);
}
.notifications-modal__body {
    flex: 1;
    overflow: auto;
    padding: 8px 10px 12px;
    -webkit-overflow-scrolling: touch;
}
.notifications-modal__loading,
.notifications-modal__empty {
    margin: 16px 8px;
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
}
.notifications-modal__list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.notifications-modal__item {
    margin-bottom: 6px;
}
.notifications-modal__link {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 12px;
    text-decoration: none;
    color: var(--text);
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 10px;
    transition: background 0.15s, border-color 0.15s;
}
.notifications-modal__link:hover {
    background: rgba(108, 92, 231, 0.12);
    border-color: rgba(108, 92, 231, 0.35);
}
.notifications-modal__item-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
}
.notifications-modal__item-text {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.35;
}
.notifications-modal__footer {
    padding: 8px 12px 12px;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.notifications-modal__footer .btn-sm {
    width: 100%;
}

/* Модальное окно приглашения в клан (центр экрана, поверх уведомлений) */
.clan-invite-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.22s ease, visibility 0.22s ease;
}
.clan-invite-modal.is-open {
    pointer-events: auto;
    opacity: 1;
    visibility: visible;
}
body.clan-invite-modal-open {
    overflow: hidden;
}
.clan-invite-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(4, 6, 22, 0.78);
    backdrop-filter: blur(6px);
}
.clan-invite-modal__panel {
    position: relative;
    width: 100%;
    max-width: min(420px, 100vw - 24px);
    max-height: min(88vh, 640px);
    display: flex;
    flex-direction: column;
    background: linear-gradient(155deg, rgba(26, 24, 48, 0.99), rgba(10, 12, 32, 0.99));
    border: 1px solid rgba(108, 92, 231, 0.35);
    border-radius: 18px;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.06) inset,
        0 24px 56px rgba(0, 0, 0, 0.55),
        0 0 80px rgba(108, 92, 231, 0.12);
    overflow: hidden;
}
.clan-invite-modal__close {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
    width: 36px;
    height: 36px;
    padding: 0;
    font-size: 22px;
    line-height: 1;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.06);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
}
.clan-invite-modal__close:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.12);
}
.clan-invite-modal__inner {
    position: relative;
    padding: 20px 18px 18px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.clan-invite-modal__loading,
.clan-invite-modal__error {
    margin: 24px 8px;
    font-size: 14px;
    text-align: center;
    color: var(--text-muted);
}
.clan-invite-modal__error {
    color: #f87171;
}
.clan-invite-modal__hero {
    text-align: center;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.clan-invite-modal__hero-icon {
    display: block;
    font-size: 40px;
    line-height: 1;
    margin-bottom: 8px;
    filter: drop-shadow(0 4px 12px rgba(108, 92, 231, 0.4));
}
.clan-invite-modal__title {
    margin: 0 0 6px;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--text-muted);
    font-family: 'Nunito', sans-serif;
}
.clan-invite-modal__clan-name {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    font-family: 'Cinzel', 'Nunito', serif;
    color: var(--text);
    line-height: 1.25;
    word-break: break-word;
}
.clan-invite-modal__clan-tag {
    margin: 6px 0 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
    letter-spacing: 0.06em;
}
.clan-invite-modal__stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 0 0 14px;
    padding: 0;
}
.clan-invite-modal__stat {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 12px;
    padding: 10px 12px;
    margin: 0;
}
.clan-invite-modal__stat dt {
    margin: 0 0 4px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}
.clan-invite-modal__stat dd {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}
.clan-invite-modal__label {
    margin: 10px 0 2px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}
.clan-invite-modal__value {
    margin: 0 0 4px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    word-break: break-word;
}
.clan-invite-modal__desc-wrap {
    margin-top: 8px;
}
.clan-invite-modal__desc {
    margin: 4px 0 0;
    font-size: 13px;
    line-height: 1.45;
    color: rgba(230, 230, 245, 0.88);
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 140px;
    overflow-y: auto;
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}
.clan-invite-modal__actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.clan-invite-modal__btn-accept,
.clan-invite-modal__btn-decline {
    min-height: 46px;
    font-size: 15px;
    font-weight: 700;
    border-radius: 12px;
}
.clan-invite-modal__btn-decline {
    border: 1px solid rgba(255, 255, 255, 0.12);
}
@media (max-width: 360px) {
    .clan-invite-modal__stats {
        grid-template-columns: 1fr;
    }
    .clan-invite-modal__actions {
        grid-template-columns: 1fr;
    }
}

.online-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
}

.online-dot {
    width: 6px;
    height: 6px;
    background: var(--green);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ===== BOTTOM NAV (фиксированный) ===== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translate3d(-50%, 0, 0);
    width: 100%;
    max-width: var(--max-width);
    background: linear-gradient(0deg, var(--glass-bg) 0%, rgba(8, 8, 24, 0.96) 100%);
    border-top: 1px solid var(--glass-border);
    box-shadow: 0 -6px 32px rgba(0, 0, 0, 0.5), 0 -1px 0 rgba(255, 255, 255, 0.05) inset;
    z-index: 1000;
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    gap: 2px;
    padding: 8px 4px calc(8px + env(safe-area-inset-bottom, 0px));
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    /* Слой композитинга с первого кадра — меньше «позднего» появления */
    will-change: transform;
}

@media (max-width: 1023px) {
    .bottom-nav {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background: rgba(10, 10, 28, 0.98);
    }
}

/* Фоновая музыка: кнопка над нижней навигацией */
.game-bgm-toggle {
    position: fixed;
    left: max(12px, env(safe-area-inset-left, 0px));
    bottom: calc(var(--bottom-nav-height, 76px) + env(safe-area-inset-bottom, 0px) + 8px);
    z-index: 1001;
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(20, 18, 40, 0.9);
    color: var(--text);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
    -webkit-tap-highlight-color: transparent;
    transition: background 0.2s, transform 0.15s;
}
.game-bgm-toggle:hover {
    background: rgba(139, 124, 255, 0.25);
}
.game-bgm-toggle:focus-visible {
    outline: 2px solid var(--accent, #8b7cff);
    outline-offset: 2px;
}

.nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 600;
    padding: 6px 4px;
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    min-width: 0;
    flex: 1 1 0;
    max-width: 88px;
    line-height: 1.15;
    -webkit-tap-highlight-color: transparent;
}

button.nav-btn {
    appearance: none;
    -webkit-appearance: none;
    border: none;
    background: transparent;
    font: inherit;
    cursor: pointer;
    color: var(--text-muted);
}

.nav-btn .nav-label {
    display: block;
    text-align: center;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-btn--home {
    flex: 1.15 1 0;
    max-width: 96px;
    padding-top: 4px;
    padding-bottom: 8px;
    margin-top: -4px;
    border-radius: 16px;
    background: rgba(139, 124, 255, 0.12);
    border: 1px solid rgba(139, 124, 255, 0.35);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

.nav-btn--home .nav-icon {
    font-size: 28px;
    margin-bottom: 2px;
}

.nav-btn--home.active {
    color: var(--primary);
    background: rgba(139, 124, 255, 0.28);
    border-color: rgba(139, 124, 255, 0.55);
    box-shadow: 0 0 24px var(--primary-glow), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.nav-btn--more.active {
    color: var(--primary);
    background: rgba(139, 124, 255, 0.2);
}

.nav-btn:hover {
    color: var(--primary);
    background: rgba(139, 124, 255, 0.18);
    transform: translateY(-3px);
}

.nav-btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.nav-btn.active {
    color: var(--primary);
    background: rgba(139, 124, 255, 0.25);
    box-shadow: 0 0 24px var(--primary-glow), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.nav-btn .nav-icon {
    font-size: 22px;
    margin-bottom: 2px;
    filter: drop-shadow(0 2px 3px rgba(0,0,0,0.35));
}

/* Выдвижное меню «Ещё» (мобильная навигация) */
body.nav-more-open {
    overflow: hidden;
}

.nav-more-sheet {
    position: fixed;
    inset: 0;
    z-index: 5000;
    visibility: hidden;
    pointer-events: none;
    transition: visibility 0.25s linear;
}

.nav-more-sheet.is-open {
    visibility: visible;
    pointer-events: auto;
}

.nav-more-sheet__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.nav-more-sheet.is-open .nav-more-sheet__backdrop {
    opacity: 1;
}

.nav-more-sheet__panel {
    position: absolute;
    left: 50%;
    /* Над фиксированной нижней панелью, не под ней */
    bottom: var(--bottom-nav-height, 76px);
    transform: translate(-50%, 100%);
    width: 100%;
    max-width: var(--max-width);
    max-height: min(78vh, calc(100vh - var(--bottom-nav-height, 76px) - 16px));
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0 16px 20px;
    background: linear-gradient(180deg, rgba(22, 22, 40, 0.99) 0%, rgba(10, 10, 24, 0.99) 100%);
    border: 1px solid var(--glass-border);
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -12px 48px rgba(0, 0, 0, 0.55);
    transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
}

@supports (height: 100dvh) {
    .nav-more-sheet__panel {
        max-height: min(78vh, calc(100dvh - var(--bottom-nav-height, 76px) - 16px));
    }
}

.nav-more-sheet__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0 12px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1;
    background: linear-gradient(180deg, rgba(22, 22, 40, 0.98) 70%, rgba(22, 22, 40, 0.92) 100%);
}

.nav-more-sheet__title {
    font-family: 'Cinzel', serif;
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    margin: 0;
    line-height: 1.25;
}

.nav-more-sheet__close {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--touch-target, 48px);
    height: var(--touch-target, 48px);
    margin: -6px -8px -6px 0;
    padding: 0;
    border: none;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.nav-more-sheet__close:hover {
    background: rgba(139, 124, 255, 0.25);
    color: var(--text);
}

.nav-more-sheet__close:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.nav-more-sheet.is-open .nav-more-sheet__panel {
    transform: translate(-50%, 0);
}

.nav-more-sheet__handle {
    width: 40px;
    height: 4px;
    margin: 8px auto 0;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.2);
}

.nav-more-sheet__hint {
    margin: 12px 0 14px;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
    text-align: center;
}

.nav-more-group-title {
    margin: 16px 0 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.nav-more-group-title:first-of-type {
    margin-top: 4px;
}

.nav-more-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

@media (min-width: 420px) {
    .nav-more-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.nav-more-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 72px;
    padding: 10px 8px;
    text-decoration: none;
    color: var(--text);
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    background-color: rgba(8, 8, 18, 0.28);
    background-image:
        linear-gradient(180deg, rgba(14, 14, 28, 0.48) 0%, rgba(8, 8, 18, 0.55) 100%),
        var(--nav-more-bg, none);
    background-size: cover, cover;
    background-position: center, center;
    background-repeat: no-repeat, no-repeat;
    border: 1px solid var(--border);
    border-radius: 12px;
    transition: background-color 0.2s, background-image 0.2s, border-color 0.2s, transform 0.15s, color 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.nav-more-link:hover {
    border-color: rgba(139, 124, 255, 0.45);
    background-image:
        linear-gradient(180deg, rgba(24, 20, 48, 0.45) 0%, rgba(14, 12, 32, 0.55) 100%),
        var(--nav-more-bg, none);
}

.nav-more-link:active {
    transform: scale(0.98);
}

.nav-more-link.active {
    border-color: var(--primary);
    color: var(--primary);
    background-image:
        linear-gradient(180deg, rgba(42, 36, 86, 0.52) 0%, rgba(22, 18, 56, 0.62) 100%),
        var(--nav-more-bg, none);
}

.nav-more-link__icon {
    font-size: 26px;
    line-height: 1;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.35));
}

.nav-more-link__text {
    line-height: 1.2;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
}

.nav-more-link__sub {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-muted);
    line-height: 1.2;
    max-width: 100%;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
}

.nav-more-link.active .nav-more-link__sub {
    color: rgba(255, 255, 255, 0.55);
}

/* Кнопка чата — горящая анимация при новых сообщениях */
.nav-btn-chat-unread {
    position: relative;
}

.nav-btn-chat-unread .nav-icon {
    animation: chatFlame 1.2s ease-in-out infinite, chatFlameScale 1.2s ease-in-out infinite;
}

.nav-btn-chat-unread::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    border-radius: 10px;
    background: radial-gradient(ellipse at center, rgba(255, 140, 0, 0.4) 0%, rgba(255, 69, 0, 0.2) 40%, transparent 70%);
    animation: chatGlow 1.2s ease-in-out infinite;
    pointer-events: none;
}

@keyframes chatFlame {
    0%, 100% {
        filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3)) drop-shadow(0 0 6px rgba(255, 140, 0, 0.8));
    }
    50% {
        filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3)) drop-shadow(0 0 12px rgba(255, 165, 0, 1)) drop-shadow(0 0 20px rgba(255, 69, 0, 0.6));
    }
}

@keyframes chatFlameScale {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

@keyframes chatGlow {
    0%, 100% {
        opacity: 0.6;
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.15);
    }
}

/* Табы чата — горящая анимация при новых сообщениях */
.tab-chat-unread {
    position: relative;
}

.tab-chat-unread .tab-icon,
.tab-chat-unread .chat-page__segment-icon {
    animation: chatFlame 1.2s ease-in-out infinite;
    /* без scale — чтобы табы не сдвигались */
}

.tab-chat-unread::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    border-radius: 10px;
    background: radial-gradient(ellipse at center, rgba(255, 140, 0, 0.4) 0%, rgba(255, 69, 0, 0.2) 40%, transparent 70%);
    animation: chatGlow 1.2s ease-in-out infinite;
    pointer-events: none;
}

/* ===== CARDS ===== */
.card {
    background: linear-gradient(165deg, var(--bg-card) 0%, rgba(14, 14, 36, 0.96) 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin: 10px var(--page-gutter, 14px);
    min-width: 0;
    box-shadow: var(--shadow-card), 0 1px 0 rgba(255, 255, 255, 0.04) inset;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease, border-color 0.25s ease;
}

.card:hover {
    box-shadow: 0 14px 44px rgba(0, 0, 0, 0.45), 0 0 0 1px var(--border-light), 0 0 40px rgba(139, 124, 255, 0.08);
    transform: translateY(-2px);
    border-color: rgba(139, 124, 255, 0.25);
}

.card-header {
    font-family: 'Cinzel', serif;
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text);
    letter-spacing: 0.6px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.card-header .icon {
    font-size: 24px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.35));
    transition: transform 0.25s ease;
}

.card:hover .card-header .icon {
    transform: scale(1.08);
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 22px;
    border-radius: 10px;
    border: none;
    font-family: 'Nunito', sans-serif;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s ease;
    text-decoration: none;
    gap: 8px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
    min-width: 0;
    -webkit-tap-highlight-color: transparent;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    box-shadow: 0 4px 18px rgba(139, 124, 255, 0.4);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #9d8fff 0%, var(--primary) 100%);
    box-shadow: 0 6px 28px var(--primary-glow);
    transform: translateY(-2px);
}

.btn-secondary {
    background: rgba(40, 40, 80, 0.6);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: rgba(60, 60, 110, 0.7);
    border-color: var(--border-light);
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    color: var(--text);
    border: 2px solid var(--border);
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border-light);
}

.btn-danger {
    background: linear-gradient(135deg, var(--red) 0%, #e63946 100%);
    color: #fff;
    box-shadow: 0 4px 16px rgba(255, 92, 122, 0.35);
}

.btn-danger:hover {
    box-shadow: 0 6px 24px rgba(255, 92, 122, 0.45);
    transform: translateY(-1px);
}

.btn-success {
    background: linear-gradient(135deg, var(--green) 0%, #28c76f 100%);
    color: #fff;
    box-shadow: 0 4px 16px rgba(62, 232, 138, 0.35);
}

.btn-success:hover {
    box-shadow: 0 6px 24px rgba(62, 232, 138, 0.45);
    transform: translateY(-1px);
}

.btn-gold {
    background: linear-gradient(135deg, var(--gold) 0%, #e6b800 100%);
    color: #1a1a2e;
    box-shadow: 0 4px 16px rgba(255, 217, 61, 0.4);
}

.btn-gold:hover {
    box-shadow: 0 6px 24px rgba(255, 217, 61, 0.5);
    transform: translateY(-1px);
}

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

.btn-block {
    width: 100%;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ===== FORMS ===== */
.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
    text-transform: none;
    letter-spacing: 0.02em;
    line-height: 1.35;
}

.form-control {
    width: 100%;
    max-width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-family: 'Nunito', sans-serif;
    font-size: 14px;
    transition: all 0.2s ease;
    outline: none;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(139, 124, 255, 0.3);
}

.form-control:focus-visible,
.btn:focus-visible,
.tab:focus-visible,
.eq-slot:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.form-control::placeholder {
    color: var(--text-muted);
}

/* ===== AUTH PAGES ===== */
.auth-container {
    max-width: var(--max-width);
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    position: relative;
    z-index: 1;
}

.auth-logo {
    font-family: 'Cinzel', serif;
    font-size: 44px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 45%, var(--accent) 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
    letter-spacing: 3px;
    animation: shimmer 5s ease-in-out infinite;
    filter: drop-shadow(0 2px 8px rgba(139, 124, 255, 0.3));
}

@keyframes shimmer {
    0%, 100% { background-position: 0% center; }
    50% { background-position: 100% center; }
}

.auth-subtitle {
    color: var(--text-muted);
    font-size: 15px;
    margin-bottom: 28px;
    font-weight: 500;
}

.auth-card {
    width: 100%;
    background: linear-gradient(165deg, rgba(16, 16, 40, 0.95) 0%, rgba(10, 10, 28, 0.98) 100%);
    border: 1px solid var(--border-light);
    border-radius: 18px;
    padding: 32px;
    box-shadow: var(--shadow-card), 0 0 80px rgba(139, 124, 255, 0.12);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
}

.auth-card h2 {
    font-family: 'Cinzel', serif;
    text-align: center;
    margin-bottom: 24px;
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
}

.auth-links {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
}

.auth-links a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.auth-links a:hover {
    color: var(--secondary);
    text-decoration: underline;
}

/* Auth pages - усиленный фон */
body.auth-page {
    background-image: 
        radial-gradient(ellipse 120% 70% at 50% -10%, rgba(139, 124, 255, 0.25) 0%, transparent 55%),
        radial-gradient(ellipse 90% 55% at 50% 0%, rgba(124, 108, 247, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse 70% 50% at 90% 100%, rgba(0, 229, 212, 0.12) 0%, transparent 55%),
        radial-gradient(ellipse 50% 40% at 10% 90%, rgba(255, 107, 157, 0.1) 0%, transparent 50%);
}

body.auth-page .auth-card {
    animation: cardSlideUp 0.5s ease;
}

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

/* ===== ALERTS ===== */
.alert {
    padding: 14px 18px 14px 20px;
    padding-left: 44px;
    border-radius: 12px;
    margin-bottom: 14px;
    font-size: 14px;
    font-weight: 500;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}
.alert::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    border-radius: 4px 0 0 4px;
}
.alert::after {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    line-height: 1;
}

.alert-danger {
    background: linear-gradient(135deg, rgba(255, 92, 122, 0.18) 0%, rgba(255, 71, 87, 0.1) 100%);
    border: 1px solid rgba(255, 92, 122, 0.4);
    color: #ffb3c1;
}
.alert-danger::before {
    background: linear-gradient(180deg, var(--red) 0%, #ff6b6b 100%);
}
.alert-danger::after {
    content: '⚠️';
}

.alert-success {
    background: linear-gradient(135deg, rgba(62, 232, 138, 0.18) 0%, rgba(46, 213, 115, 0.1) 100%);
    border: 1px solid rgba(62, 232, 138, 0.4);
    color: #7effc4;
}
.alert-success::before {
    background: linear-gradient(180deg, var(--green) 0%, #7bed9f 100%);
}
.alert-success::after {
    content: '✅';
}

.alert-info {
    background: linear-gradient(135deg, rgba(77, 166, 255, 0.18) 0%, rgba(33, 150, 243, 0.1) 100%);
    border: 1px solid rgba(77, 166, 255, 0.4);
    color: #90caf9;
}
.alert-info::before {
    background: linear-gradient(180deg, var(--blue) 0%, #64b5f6 100%);
}
.alert-info::after {
    content: 'ℹ️';
}

.alert-warning {
    background: linear-gradient(135deg, rgba(255, 169, 77, 0.18) 0%, rgba(255, 152, 0, 0.1) 100%);
    border: 1px solid rgba(255, 169, 77, 0.4);
    color: #ffcc80;
}
.alert-warning::before {
    background: linear-gradient(180deg, var(--orange) 0%, #ffb74d 100%);
}
.alert-warning::after {
    content: '⚠️';
}

/* ===== TOAST NOTIFICATIONS (Game.notify) ===== */
.game-toast {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3000;
    max-width: 420px;
    width: calc(100% - 24px);
    padding: 14px 18px 14px 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(12px);
    animation: toastSlideIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.game-toast.toast-out {
    animation: toastSlideOut 0.3s ease forwards;
}
.game-toast-icon {
    font-size: 22px;
    flex-shrink: 0;
}
.game-toast-message {
    flex: 1;
}
.game-toast.toast-danger {
    background: linear-gradient(135deg, rgba(255, 92, 122, 0.95) 0%, rgba(180, 50, 75, 0.95) 100%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
}
.game-toast.toast-success {
    background: linear-gradient(135deg, rgba(62, 232, 138, 0.95) 0%, rgba(40, 180, 100, 0.95) 100%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
}
.game-toast.toast-info {
    background: linear-gradient(135deg, rgba(77, 166, 255, 0.95) 0%, rgba(33, 130, 200, 0.95) 100%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
}
.game-toast.toast-warning {
    background: linear-gradient(135deg, rgba(255, 169, 77, 0.95) 0%, rgba(230, 140, 0, 0.95) 100%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
}
@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-24px) scale(0.92);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
    }
}
@keyframes toastSlideOut {
    from {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateX(-50%) translateY(-16px) scale(0.96);
    }
}

/* ===== REWARD TOAST (под шапкой, единый стиль наград) ===== */
.game-reward-toast-host {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1050;
    width: 100%;
    max-width: var(--max-width);
    padding: 0 12px;
    pointer-events: none;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
}
.game-reward-toast {
    position: relative;
    display: block;
    width: 100%;
    max-width: 360px;
    pointer-events: auto;
    animation: gameRewardToastIn 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}
/* Fallback: если host нет в разметке (редкие страницы) */
.game-reward-toast.game-reward-toast--centered {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 3100;
    max-width: 360px;
    width: calc(100% - 24px);
    animation: gameRewardToastInCentered 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.game-reward-toast.game-reward-toast--centered.game-reward-toast-out {
    animation: gameRewardToastOutCentered 0.35s ease forwards;
}
.game-reward-toast.game-reward-toast-out {
    animation: gameRewardToastOut 0.35s ease forwards;
}
.game-reward-toast-glow {
    position: absolute;
    inset: -4px;
    background: radial-gradient(ellipse 80% 60% at 50% 50%, rgba(139, 124, 255, 0.42) 0%, transparent 70%);
    border-radius: 16px;
    pointer-events: none;
}
.game-reward-toast-inner {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    background: linear-gradient(
        145deg,
        rgba(58, 48, 105, 0.94) 0%,
        rgba(42, 34, 82, 0.96) 45%,
        rgba(52, 44, 98, 0.95) 100%
    );
    border: 2px solid rgba(160, 145, 255, 0.65);
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(40, 28, 90, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.14) inset;
}
.game-reward-toast-icon {
    font-size: 36px;
    flex-shrink: 0;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}
.game-reward-toast-content {
    flex: 1;
    min-width: 0;
}
.game-reward-toast-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 4px;
}
.game-reward-toast-rewards {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    word-break: break-word;
}

/* Варианты баннера (сообщения об ошибке / успехе в том же каркасе, что и награды) */
.game-reward-toast-glow.game-reward-toast-glow--success {
    background: radial-gradient(ellipse 80% 60% at 50% 50%, rgba(80, 220, 160, 0.38) 0%, transparent 70%);
}
.game-reward-toast-inner.game-reward-toast-inner--success {
    background: linear-gradient(
        145deg,
        rgba(32, 72, 58, 0.96) 0%,
        rgba(24, 52, 44, 0.98) 50%,
        rgba(30, 62, 52, 0.97) 100%
    );
    border-color: rgba(100, 210, 160, 0.55);
    box-shadow: 0 12px 40px rgba(20, 60, 45, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}
.game-reward-toast-glow.game-reward-toast-glow--danger {
    background: radial-gradient(ellipse 80% 60% at 50% 50%, rgba(255, 96, 110, 0.42) 0%, transparent 70%);
}
.game-reward-toast-inner.game-reward-toast-inner--danger {
    background: linear-gradient(
        145deg,
        rgba(88, 32, 48, 0.96) 0%,
        rgba(48, 22, 32, 0.98) 50%,
        rgba(58, 28, 38, 0.97) 100%
    );
    border-color: rgba(255, 130, 150, 0.55);
    box-shadow: 0 12px 40px rgba(60, 20, 30, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
}
.game-reward-toast-glow.game-reward-toast-glow--warning {
    background: radial-gradient(ellipse 80% 60% at 50% 50%, rgba(255, 180, 90, 0.4) 0%, transparent 70%);
}
.game-reward-toast-inner.game-reward-toast-inner--warning {
    background: linear-gradient(
        145deg,
        rgba(88, 58, 28, 0.96) 0%,
        rgba(52, 38, 22, 0.98) 50%,
        rgba(62, 44, 26, 0.97) 100%
    );
    border-color: rgba(255, 190, 120, 0.55);
    box-shadow: 0 12px 40px rgba(70, 45, 20, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
}

@keyframes gameRewardToastIn {
    from {
        opacity: 0;
        transform: translateY(-12px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}
@keyframes gameRewardToastOut {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(-8px) scale(0.96);
    }
}
@keyframes gameRewardToastInCentered {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) translateY(-16px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}
@keyframes gameRewardToastOutCentered {
    from {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    to {
        opacity: 0;
        transform: translate(-50%, -50%) translateY(-10px) scale(0.96);
    }
}

/* ===== ACHIEVEMENT TOAST (выделяющийся) ===== */
.game-toast-achievement {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3100;
    max-width: 360px;
    width: calc(100% - 24px);
    animation: toastAchievementIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.game-toast-achievement.toast-achievement-out {
    animation: toastAchievementOut 0.4s ease forwards;
}
.toast-achievement-glow {
    position: absolute;
    inset: -4px;
    background: radial-gradient(ellipse 80% 60% at 50% 50%, rgba(255, 193, 7, 0.35) 0%, transparent 70%);
    border-radius: 20px;
    pointer-events: none;
}
.toast-achievement-inner {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    background: linear-gradient(145deg, rgba(255, 215, 0, 0.25) 0%, rgba(255, 152, 0, 0.2) 50%, rgba(255, 193, 7, 0.22) 100%);
    border: 2px solid rgba(255, 215, 0, 0.55);
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(255, 193, 7, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}
.toast-achievement-icon {
    font-size: 36px;
    flex-shrink: 0;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}
.toast-achievement-content {
    flex: 1;
    min-width: 0;
}
.toast-achievement-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 4px;
}
.toast-achievement-name {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}
.toast-achievement-reward {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.9);
    margin-top: 2px;
}
@keyframes toastAchievementIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-30px) scale(0.85);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
    }
}
@keyframes toastAchievementOut {
    from {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px) scale(0.95);
    }
}

/* ===== BATTLE ===== */
.battle-arena {
    text-align: center;
    padding: 16px;
}

.battle-monster {
    margin: 16px 0;
}

.battle-monster img, .monster-image {
    width: 120px;
    height: 120px;
    object-fit: contain;
    border-radius: 50%;
    border: 3px solid var(--red);
    background: linear-gradient(180deg, rgba(20, 20, 45, 0.9) 0%, var(--bg) 100%);
    padding: 10px;
    box-shadow: 0 0 28px rgba(255, 92, 122, 0.35), 0 4px 12px rgba(0, 0, 0, 0.4);
}

.battle-monster-name {
    font-family: 'Cinzel', serif;
    font-size: 18px;
    font-weight: 700;
    margin-top: 8px;
    color: var(--red);
}

.health-bar-container {
    background: rgba(8, 8, 20, 0.9);
    border-radius: 10px;
    height: 20px;
    overflow: hidden;
    position: relative;
    margin: 10px 0;
    border: 1px solid var(--border);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.health-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--red) 0%, #ff7a8a 100%);
    border-radius: 10px;
    transition: width 0.35s ease;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.health-bar.player {
    background: linear-gradient(90deg, var(--green) 0%, #5effa8 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.health-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}

.battle-log {
    max-height: 200px;
    overflow-y: auto;
    background: var(--bg);
    border-radius: 8px;
    padding: 8px;
    margin-top: 12px;
    font-size: 12px;
    text-align: left;
}

.battle-log-entry {
    padding: 3px 0;
    border-bottom: 1px solid var(--border);
}

.battle-log-entry.player-attack {
    color: var(--green);
}

.battle-log-entry.enemy-attack {
    color: var(--red);
}

.damage-float {
    position: absolute;
    font-size: 18px;
    font-weight: 700;
    color: var(--red);
    animation: floatUp 1s ease-out forwards;
    pointer-events: none;
    z-index: 100;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

.damage-float.player-dmg {
    color: var(--green);
}

.damage-float--crit {
    color: #ffd54f;
    font-size: 19px;
}

.damage-float--pierce {
    color: #7ec8e3;
    font-size: 18px;
}

.damage-float--block {
    color: #90caf9;
}

.damage-float--evade {
    color: #a5d6a7;
    font-size: 17px;
}

@keyframes floatUp {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-60px) scale(1.5);
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.shake {
    animation: shake 0.3s ease-in-out;
}

/* ===== MONSTER/BOSS HIT ANIMATION (sword damage) ===== */
@keyframes monsterHit {
    0% { transform: scale(1) translateX(0); }
    15% { transform: scale(1.06) translateX(-10px); }
    30% { transform: scale(0.97) translateX(6px); }
    50% { transform: scale(1.02) translateX(-4px); }
    70% { transform: scale(0.99) translateX(2px); }
    100% { transform: scale(1) translateX(0); }
}

@keyframes monsterHitFlash {
    0%, 100% { filter: brightness(1); }
    15% { filter: brightness(1.9) saturate(1.4); }
    40% { filter: brightness(1.2); }
}

.monster-hit, .boss-hit, .enemy-hit {
    animation: monsterHit 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97) forwards;
}

.monster-hit img, .boss-hit img, .enemy-hit img,
.monster-hit .monster-image, .boss-hit .monster-image {
    animation: monsterHitFlash 0.45s ease-out;
}

/* Health bar damage pulse */
@keyframes hpBarPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.health-bar.damaged {
    animation: hpBarPulse 0.3s ease-out;
}

/* ===== ПОЛЕ БОЯ: охота + боссы (те же классы, что на странице Охоты) ===== */
.hunt-battle-scene {
    position: relative;
    padding: 20px 16px 24px;
    border-radius: 14px;
    border: 1px solid var(--border);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
    background-color: #12122a;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    overflow: hidden;
}
.hunt-battle-scene::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(8, 8, 22, 0.25) 0%, rgba(10, 10, 28, 0.55) 100%);
    pointer-events: none;
    z-index: 0;
    border-radius: inherit;
}
.hunt-battle-scene--default {
    background-image:
        radial-gradient(ellipse 120% 80% at 50% 100%, rgba(60, 40, 90, 0.45) 0%, transparent 55%),
        linear-gradient(165deg, #1a1530 0%, #0d1228 40%, #15182e 100%);
}
.hunt-battle-scene > * {
    position: relative;
    z-index: 1;
}
.hunt-monster-sprite {
    display: inline-block;
    position: relative;
    margin-bottom: 8px;
    vertical-align: bottom;
}
.monster-image.hunt-monster-fullbody {
    width: auto;
    max-width: min(100%, 220px);
    height: auto;
    min-height: 200px;
    max-height: min(52vh, 340px);
    object-fit: contain;
    object-position: bottom center;
    border-radius: 12px;
    border: 3px solid rgba(255, 92, 122, 0.85);
    background: rgba(0, 0, 0, 0.25);
    padding: 10px 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45), 0 0 28px rgba(255, 92, 122, 0.25);
    transition: transform 0.2s ease;
}
.monster-image.hunt-monster-fullbody:hover {
    transform: scale(1.01);
}
.hunt-sword-slash,
.game-sword-slash {
    position: absolute;
    pointer-events: none;
    left: 12%;
    top: 8%;
    width: 22%;
    height: 78%;
    opacity: 0;
    z-index: 3;
    background: linear-gradient(
        108deg,
        transparent 38%,
        rgba(255, 255, 255, 0.95) 49%,
        rgba(180, 220, 255, 0.9) 51%,
        transparent 62%
    );
    filter: blur(0.6px) drop-shadow(0 0 6px rgba(255, 255, 255, 0.8));
    transform: rotate(-22deg) scaleX(0.35);
    mix-blend-mode: screen;
    border-radius: 50%;
}
.hunt-sword-slash.hunt-sword-slash--anim,
.game-sword-slash.game-sword-slash--anim {
    animation: huntSwordSlash 0.42s ease-out forwards;
}
@keyframes huntSwordSlash {
    0% { opacity: 0; transform: rotate(-22deg) scaleX(0.2) translateX(-18px); }
    12% { opacity: 1; }
    100% { opacity: 0; transform: rotate(-22deg) scaleX(1.05) translateX(28px); }
}

.boss-page .hunt-battle-scene,
#clan-boss-area .hunt-battle-scene {
    margin-bottom: 10px;
}

/* ===== PROFILE ===== */
.profile-header {
    text-align: center;
    padding: 24px 20px;
}

.profile-header--with-avatar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.profile-avatar-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

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

.profile-avatar-open-btn {
    font-size: 11px;
    padding: 6px 12px;
}

.profile-avatar-modal-content {
    max-width: 420px;
}

.profile-avatar-picker-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    padding: 4px 0 8px;
}

.profile-avatar-pick {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px 8px;
    margin: 0;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    font-size: 11px;
    line-height: 1.2;
}

.profile-avatar-pick:hover {
    border-color: var(--primary);
    box-shadow: 0 0 16px rgba(108, 92, 231, 0.2);
}

.profile-avatar-pick.is-current {
    border-color: var(--green);
    box-shadow: 0 0 0 1px rgba(74, 222, 128, 0.35);
}

.profile-avatar-pick-img-wrap {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

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

.profile-avatar-pick-label {
    font-size: 10px;
    color: var(--text-muted);
    text-align: center;
}

@media (max-width: 380px) {
    .profile-avatar-picker-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.profile-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 3px solid var(--primary);
    margin-bottom: 0;
    box-shadow: 0 0 24px var(--primary-glow), 0 4px 12px rgba(0, 0, 0, 0.3);
}

.profile-name {
    font-family: 'Cinzel', serif;
    font-size: 23px;
    font-weight: 700;
    color: var(--text);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.profile-level {
    color: var(--secondary);
    font-size: 15px;
    font-weight: 700;
    text-shadow: 0 0 12px rgba(0, 229, 212, 0.3);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 14px;
}

.stat-box {
    background: linear-gradient(165deg, rgba(24, 24, 52, 0.9) 0%, rgba(14, 14, 38, 0.95) 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.stat-box:hover {
    border-color: var(--border-light);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3), 0 0 24px rgba(139, 124, 255, 0.08);
    transform: translateY(-2px);
}

.stat-box .stat-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.stat-box .stat-value {
    font-size: 20px;
    font-weight: 700;
    margin-top: 4px;
    color: var(--text);
}

/* ===== CURRENCY ===== */
.currency {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-weight: 600;
}

.currency-gold {
    color: var(--gold);
}

.currency-silver {
    color: var(--silver);
}

/* ===== INVENTORY ===== */
.inventory-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

/* Компактные карточки предметов в блоке Инвентарь */
.inventory-items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 8px;
}

@media (min-width: 400px) {
    .inventory-items-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
}

.inventory-items-grid .inventory-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    background: linear-gradient(155deg, rgba(28, 28, 55, 0.85) 0%, rgba(18, 18, 42, 0.95) 100%);
    border-radius: 10px;
    border: 1px solid var(--border);
    transition: all 0.25s ease;
}

.inventory-items-grid .inventory-item:hover {
    border-color: var(--border-light);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2), 0 0 12px rgba(124, 108, 247, 0.06);
    transform: translateY(-1px);
}

.inventory-items-grid .inventory-item img {
    width: 50px;
    height: 50px;
    min-width: 50px;
    min-height: 50px;
    object-fit: contain;
    border-radius: 6px;
}

.inventory-items-grid .inventory-item .inventory-item-body {
    flex: 1;
    min-width: 0;
}

.inventory-items-grid .inventory-item .inventory-item-name {
    font-weight: 600;
    font-size: 12px;
    line-height: 1.3;
}

.inventory-items-grid .inventory-item .inventory-item-stats {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 2px;
}

.inventory-items-grid .inventory-item .inventory-item-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}

.inventory-items-grid .inventory-item .btn-sm {
    padding: 4px 8px;
    font-size: 11px;
}

.inventory-items-grid .inventory-item .badge {
    font-size: 10px;
    padding: 2px 6px;
}

.item-card {
    background: linear-gradient(160deg, rgba(30, 30, 58, 0.9) 0%, rgba(20, 20, 45, 0.95) 100%);
    border-radius: 12px;
    padding: 12px;
    text-align: center;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.item-card:hover {
    border-color: var(--primary);
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 24px rgba(124, 108, 247, 0.25);
}

.item-card.equipped {
    border-color: var(--green);
    box-shadow: 0 0 20px rgba(62, 232, 138, 0.4), inset 0 0 20px rgba(62, 232, 138, 0.05);
}

.item-card img {
    width: 44px;
    height: 44px;
    object-fit: contain;
}

.item-name {
    font-size: 12px;
    font-weight: 700;
    margin-top: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

/* ===== EQUIPMENT SLOTS ===== */
.equipment-slots {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin: 14px 0;
}

.eq-slot {
    width: 70px;
    min-width: 60px;
    height: 70px;
    background: linear-gradient(160deg, rgba(25, 25, 50, 0.9) 0%, rgba(15, 15, 35, 0.95) 100%);
    border: 2px dashed var(--border);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: var(--text-muted);
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
}

.eq-slot:hover {
    border-color: var(--primary);
    box-shadow: 0 0 20px rgba(124, 108, 247, 0.25);
    transform: scale(1.05);
}

.eq-slot.filled {
    border-style: solid;
    border-color: var(--green);
    box-shadow: 0 0 16px rgba(62, 232, 138, 0.2);
}

.eq-slot img {
    width: 34px;
    height: 34px;
    object-fit: contain;
}

.eq-slot-label {
    font-size: 8px;
    text-transform: uppercase;
    font-weight: 600;
}

/* ===== CHAT ===== */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.chat-page {
    margin-bottom: 8px;
}

.chat-page__toolbar {
    padding: 12px 14px;
    background: linear-gradient(155deg, rgba(22, 22, 48, 0.95) 0%, rgba(12, 12, 32, 0.88) 55%, rgba(18, 14, 40, 0.92) 100%);
    border: 1px solid rgba(139, 124, 255, 0.22);
    box-shadow: var(--shadow-card), 0 0 40px rgba(139, 124, 255, 0.06);
}

.chat-page__channel-switch {
    width: 100%;
}

.chat-page__segments {
    display: flex;
    gap: 6px;
    padding: 5px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(139, 124, 255, 0.18);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.chat-page__segment {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    padding: 10px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    color: var(--text-muted);
    border: 1px solid transparent;
    transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.chat-page__segment:hover {
    color: var(--text);
    background: rgba(139, 124, 255, 0.12);
}

.chat-page__segment.is-active {
    color: #fff;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 4px 18px var(--primary-glow), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.chat-page__segment-icon {
    font-size: 1.05rem;
    line-height: 1;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
}

.card.chat-page__panel {
    padding: 0;
    overflow: hidden;
    border: 1px solid rgba(139, 124, 255, 0.2);
    box-shadow: var(--shadow-card), 0 0 0 1px rgba(0, 229, 212, 0.04);
}

.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--header-offset, 72px) - var(--bottom-nav-height, 76px) - 118px);
    min-height: 220px;
    max-height: calc(100dvh - var(--header-offset, 72px) - var(--bottom-nav-height, 76px) - 118px);
}

.chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 14px 14px 18px;
    scroll-behavior: smooth;
    scrollbar-gutter: stable;
    background:
        radial-gradient(ellipse 80% 45% at 50% -5%, rgba(139, 124, 255, 0.09) 0%, transparent 55%),
        radial-gradient(ellipse 60% 40% at 100% 100%, rgba(0, 229, 212, 0.05) 0%, transparent 45%),
        linear-gradient(180deg, rgba(10, 10, 26, 0.55) 0%, rgba(6, 6, 18, 0.72) 100%);
    background-attachment: local;
}

.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(139, 124, 255, 0.25);
    border-radius: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 8px;
}

@supports (height: 100dvh) {
    .chat-container {
        height: calc(100dvh - var(--header-offset, 72px) - var(--bottom-nav-height, 76px) - 118px);
    }
}

@media (max-height: 600px) {
    .chat-container {
        height: calc(100vh - 200px);
        min-height: 150px;
    }
}

@media (max-height: 500px) {
    .chat-container {
        height: calc(100vh - 180px);
        min-height: 120px;
    }

    .chat-page__toolbar {
        padding: 10px 12px;
    }
}

.chat-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 12px;
    min-height: 120px;
    padding: 28px 20px;
    color: var(--text-muted);
    font-size: 14px;
}

.chat-state--loading {
    flex-direction: row;
    gap: 14px;
}

.chat-state__spinner {
    width: 28px;
    height: 28px;
    border: 3px solid rgba(139, 124, 255, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: chatStateSpin 0.75s linear infinite;
}

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

.chat-state__title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}

.chat-state__text {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
    max-width: 280px;
}

.chat-state--empty .chat-state__empty-icon {
    font-size: 2rem;
    line-height: 1;
    filter: drop-shadow(0 2px 8px rgba(139, 124, 255, 0.35));
}

.chat-state--error .chat-state__title {
    color: var(--red);
}

.chat-message {
    display: flex;
    margin-bottom: 12px;
    font-size: 13px;
    overflow-wrap: break-word;
    word-break: break-word;
}

.chat-message--other {
    justify-content: flex-start;
}

.chat-message--self {
    justify-content: flex-end;
}

.chat-message__bubble {
    max-width: min(92%, 340px);
    padding: 10px 14px 12px;
    border-radius: 16px;
    position: relative;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
}

.chat-message--other .chat-message__bubble {
    background: linear-gradient(165deg, rgba(32, 32, 58, 0.92) 0%, rgba(20, 20, 44, 0.96) 100%);
    border: 1px solid rgba(139, 124, 255, 0.18);
    border-bottom-left-radius: 5px;
}

.chat-message--self .chat-message__bubble {
    background: linear-gradient(155deg, rgba(100, 86, 220, 0.55) 0%, rgba(75, 62, 180, 0.75) 100%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-bottom-right-radius: 5px;
}

.chat-message__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
}

.chat-message--self .chat-message__head {
    flex-direction: row-reverse;
}

.chat-message .chat-user {
    font-weight: 700;
    color: var(--primary);
    font-size: 12px;
    text-decoration: none;
    flex: 1;
    min-width: 0;
}

.chat-message--self .chat-user {
    color: rgba(255, 255, 255, 0.95);
    text-align: right;
}

.chat-message .clan-tag {
    font-weight: 700;
    color: var(--gold);
    font-size: 11px;
}

.chat-message .chat-time {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.02em;
    white-space: nowrap;
    flex-shrink: 0;
}

.chat-message--self .chat-time {
    color: rgba(230, 230, 255, 0.75);
}

.chat-message__body {
    font-size: 14px;
    line-height: 1.5;
    color: rgba(245, 245, 255, 0.96);
    white-space: pre-wrap;
}

.chat-input-area {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 12px 12px calc(12px + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(180deg, rgba(14, 14, 34, 0.98) 0%, rgba(10, 10, 26, 0.98) 100%);
    border-top: 1px solid rgba(139, 124, 255, 0.15);
    box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.35);
}

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

.chat-input-area__input.form-control,
.chat-input-area input.form-control {
    border-radius: 999px;
    padding: 12px 18px;
    background: var(--bg-input);
    border: 1px solid rgba(139, 124, 255, 0.22);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.chat-input-area__input:focus,
.chat-input-area input:focus {
    outline: none;
    border-color: var(--border-light);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 0 0 3px rgba(139, 124, 255, 0.2);
}

.chat-input-area__send {
    flex-shrink: 0;
    min-width: var(--touch-target, 48px);
    min-height: var(--touch-target, 48px);
    padding: 0 16px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px var(--primary-glow);
}

.chat-input-area__send-icon {
    display: block;
}

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

.chat-input-area .btn {
    flex-shrink: 0;
    min-width: var(--touch-target, 48px);
    min-height: var(--touch-target, 48px);
    padding-left: 16px;
    padding-right: 16px;
}

/* ===== SHOP ===== */
.shop-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    background: linear-gradient(160deg, rgba(30, 30, 58, 0.75) 0%, rgba(20, 20, 45, 0.9) 100%);
    border-radius: 12px;
    margin-bottom: 12px;
    border: 1px solid var(--border);
    transition: all 0.3s ease;
}

.shop-item:hover {
    border-color: var(--border-light);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25), 0 0 20px rgba(124, 108, 247, 0.05);
    transform: translateX(4px);
}

.shop-item img {
    width: 44px;
    height: 44px;
    object-fit: contain;
}

.shop-item-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.shop-item-name {
    font-weight: 700;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

.shop-item-price {
    text-align: right;
    white-space: nowrap;
    font-weight: 700;
    color: var(--gold);
}

/* ===== AUCTION MINI ITEMS ===== */
.auction-item.auction-item-mini {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: linear-gradient(160deg, rgba(30, 30, 58, 0.75) 0%, rgba(20, 20, 45, 0.9) 100%);
    border-radius: 8px;
    margin-bottom: 8px;
    border: 1px solid var(--border);
    transition: all 0.2s ease;
}

.auction-item.auction-item-mini:hover {
    border-color: var(--border-light);
}

.auction-item-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.auction-item-line1 {
    font-weight: 600;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.auction-item-line2 {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.auction-item-actions {
    flex-shrink: 0;
}

.auction-item-actions-buy {
    display: flex;
    align-items: center;
}

/* ===== AUCTION PAGE ===== */
.auction-tabs {
    justify-content: center;
    gap: 10px;
}

@media (max-width: 480px) {
    .tabs.auction-tabs {
        flex-direction: column;
        align-items: stretch;
    }

    .auction-tabs .auction-tab-btn {
        width: 100%;
        justify-content: center;
    }

    .auction-item.auction-item-mini {
        flex-wrap: wrap;
    }
    .auction-item-actions {
        width: 100%;
        justify-content: flex-end;
    }
    .auction-item-actions-buy form {
        flex-wrap: wrap;
    }
}

/* ===== CLAN ===== */
.clan-building {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: linear-gradient(160deg, rgba(25, 25, 50, 0.8) 0%, rgba(18, 18, 42, 0.9) 100%);
    border-radius: 12px;
    margin-bottom: 10px;
    border: 1px solid var(--border);
    transition: all 0.25s ease;
}

.clan-building:hover {
    border-color: var(--border-light);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.clan-building-icon {
    font-size: 28px;
    width: 40px;
    text-align: center;
}

.clan-building-info {
    flex: 1;
}

.clan-building-name {
    font-weight: 600;
    font-size: 13px;
}

.clan-building-level {
    font-size: 11px;
    color: var(--text-muted);
}

.clan-building-bonus {
    font-size: 11px;
    color: var(--green);
}

/* ===== ARENA ===== */
.arena-queue-timer {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
    text-align: center;
    margin: 20px 0;
}

.league-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.league-bronze { background: rgba(205, 127, 50, 0.25); color: #e8a855; border: 1px solid rgba(205, 127, 50, 0.4); }
.league-silver { background: rgba(192, 192, 192, 0.25); color: #e0e0e0; border: 1px solid rgba(192, 192, 192, 0.4); }
.league-gold { background: rgba(255, 215, 0, 0.25); color: var(--gold); border: 1px solid rgba(255, 215, 0, 0.4); }
.league-platinum { background: rgba(127, 255, 212, 0.25); color: #7fffd4; border: 1px solid rgba(127, 255, 212, 0.4); }
.league-diamond { background: rgba(0, 191, 255, 0.25); color: #00bfff; border: 1px solid rgba(0, 191, 255, 0.4); }
.league-legend { background: rgba(255, 69, 0, 0.25); color: #ff6b35; border: 1px solid rgba(255, 69, 0, 0.4); }

/* ===== BOSS ===== */
.boss-container {
    text-align: center;
}

.boss-image {
    width: 150px;
    height: 150px;
    object-fit: contain;
    border-radius: 50%;
    border: 4px solid var(--red);
    background: var(--bg);
    padding: 10px;
    margin: 12px auto;
    display: block;
    box-shadow: 0 0 30px rgba(255, 92, 122, 0.35);
}

/* ===== TABS ===== */
.tabs {
    display: flex;
    gap: 8px;
    margin: 10px var(--page-gutter, 14px);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 2px 0 6px;
    scrollbar-width: thin;
}

/* Навигация главной: 3 пункта в строке, последняя строка по центру */
.tabs-nav-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    overflow: visible;
}
.tabs-nav-grid .tab {
    flex: 1 1 calc((100% - 16px) / 3);
    min-width: 0;
}

.tab {
    flex: 1;
    padding: 12px 14px;
    background: linear-gradient(135deg, rgba(30, 30, 58, 0.8) 0%, rgba(20, 20, 45, 0.9) 100%);
    border: 1px solid var(--border);
    border-radius: 12px;
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    white-space: nowrap;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    min-width: 0;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    text-overflow: ellipsis;
    -webkit-tap-highlight-color: transparent;
}

.tabs:not(.tabs-nav-grid) .tab {
    flex: 1 1 0;
    min-width: 0;
}

.tab:hover {
    background: linear-gradient(135deg, rgba(139, 124, 255, 0.28) 0%, rgba(107, 91, 212, 0.22) 100%);
    color: var(--text);
    border-color: var(--border-light);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 124, 255, 0.25);
}

.tab.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 4px 16px var(--primary-glow), 0 2px 4px rgba(0, 0, 0, 0.2);
    transform: translateY(-1px);
}

.tab.active:hover {
    box-shadow: 0 6px 20px var(--primary-glow), 0 4px 8px rgba(0, 0, 0, 0.25);
}

/* ===== MODAL ===== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    background: rgba(4, 4, 12, 0.82);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: linear-gradient(165deg, var(--bg-card) 0%, rgba(12, 12, 32, 0.98) 100%);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 26px;
    max-width: calc(var(--max-width) - 40px);
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.65), 0 0 0 1px var(--border-light), 0 0 60px rgba(139, 124, 255, 0.06);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}

.modal-header h3 {
    font-family: 'Cinzel', serif;
    font-size: 18px;
    font-weight: 700;
}

.modal-close {
    background: rgba(255, 255, 255, 0.06);
    border: none;
    color: var(--text-muted);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: var(--touch-target, 48px);
    height: var(--touch-target, 48px);
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, background 0.2s;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}

.modal-close:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.1);
}

/* Profile item modal */
.profile-item-modal-body { padding: 16px; }
.profile-item-modal-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    text-align: center;
}
.profile-item-modal-image { flex-shrink: 0; }
.profile-item-modal-name { font-size: 16px; font-weight: 700; }
.profile-item-modal-params {
    width: 100%;
    padding: 12px;
    background: rgba(255,255,255,0.05);
    border-radius: 10px;
    font-size: 14px;
    text-align: left;
}
.profile-item-modal-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 4px 0;
}
.profile-item-modal-row span { color: var(--text-muted); }

/* Shop filter modal */
.shop-filter-modal-body {
    padding: 16px;
}
.shop-filter-field {
    margin-bottom: 14px;
}
.shop-filter-field:last-child {
    margin-bottom: 0;
}
.shop-filter-field label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}
.shop-filter-field .form-control {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    padding: 12px 16px;
    font-size: 14px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238b7cff' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}
.shop-filter-field .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(139, 124, 255, 0.3);
}

/* ===== CONFIRM MODAL ===== */
.confirm-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 2500;
    justify-content: center;
    align-items: center;
    padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
    animation: confirmOverlayFade 0.25s ease;
}
.confirm-modal-overlay.active {
    display: flex;
}
@keyframes confirmOverlayFade {
    from { opacity: 0; }
    to { opacity: 1; }
}
.confirm-modal {
    background: linear-gradient(160deg, var(--bg-card2) 0%, rgba(18, 18, 42, 0.98) 100%);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    padding: 24px;
    max-width: 380px;
    width: 100%;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(124, 108, 247, 0.15), 0 0 40px rgba(124, 108, 247, 0.08);
    animation: confirmModalSlide 0.3s ease;
}
@keyframes confirmModalSlide {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}
.confirm-modal-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin: 0 auto 16px;
}
.confirm-modal-icon.warning {
    background: linear-gradient(135deg, rgba(255, 169, 77, 0.2) 0%, rgba(255, 107, 157, 0.15) 100%);
    border: 1px solid rgba(255, 169, 77, 0.4);
}
.confirm-modal-icon.danger {
    background: linear-gradient(135deg, rgba(255, 92, 122, 0.2) 0%, rgba(255, 71, 87, 0.15) 100%);
    border: 1px solid rgba(255, 92, 122, 0.4);
}
.confirm-modal-title {
    font-family: 'Cinzel', serif;
    font-size: 17px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 10px;
    color: var(--text);
}
.confirm-modal-message {
    font-size: 14px;
    line-height: 1.5;
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 22px;
}
.confirm-modal-message.confirm-modal-message--html {
    text-align: left;
    color: var(--text-muted);
}
.confirm-modal-message--html p:last-child {
    margin-bottom: 0;
}
.confirm-modal-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    justify-content: center;
}

@media (min-width: 400px) {
    .confirm-modal-actions {
        flex-direction: row;
    }
}
.confirm-modal-btn {
    flex: 1;
    padding: 12px 18px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}
.confirm-modal-btn-cancel {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    border: 1px solid var(--border);
}
.confirm-modal-btn-cancel:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text);
}
.confirm-modal-btn-confirm {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    border: 1px solid rgba(124, 108, 247, 0.5);
    box-shadow: 0 4px 16px var(--primary-glow);
}
.confirm-modal-btn-confirm:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px var(--primary-glow);
}
.confirm-modal-btn-confirm.danger {
    background: linear-gradient(135deg, var(--red) 0%, #e84a6f 100%);
    border-color: rgba(255, 92, 122, 0.5);
    box-shadow: 0 4px 16px rgba(255, 92, 122, 0.3);
}
.confirm-modal-btn-confirm.danger:hover {
    box-shadow: 0 6px 20px rgba(255, 92, 122, 0.4);
}

/* ===== ENERGY ===== */
.energy-bar-container {
    background: var(--bg);
    border-radius: 4px;
    height: 6px;
    overflow: hidden;
    margin-top: 4px;
}

.energy-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--orange), var(--gold));
    border-radius: 4px;
    transition: width 0.5s ease;
}

/* ===== LISTS ===== */
.list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: linear-gradient(160deg, rgba(30, 30, 58, 0.7) 0%, rgba(20, 20, 45, 0.85) 100%);
    border-radius: 12px;
    margin-bottom: 10px;
    border: 1px solid var(--border);
    transition: all 0.25s ease;
}

.list-item:hover {
    border-color: var(--border-light);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.list-item-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.list-item-info .list-item-title,
.list-item-info > div:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(20, 20, 45, 0.5);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/*
 * Узкий экран / тач: без видимой полосы у документа.
 * Глобальные 6px ::-webkit-scrollbar выше дают «полоску ПК» у края — на телефоне отключаем.
 */
@media (max-width: 1023px), (hover: none) and (pointer: coarse) {
    html {
        overflow-x: hidden;
    }

    body {
        overflow-x: hidden;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    html::-webkit-scrollbar,
    body::-webkit-scrollbar {
        display: none;
        width: 0 !important;
        height: 0 !important;
        background: transparent;
    }
}

@media (max-width: 1023px) {
    * {
        scrollbar-width: none;
    }

    *::-webkit-scrollbar {
        width: 0 !important;
        height: 0 !important;
    }

    *::-webkit-scrollbar-track,
    *::-webkit-scrollbar-thumb {
        background: transparent;
    }
}

/* ===== RARITY BORDERS ===== */
.rarity-common { border-color: #9e9e9e !important; box-shadow: 0 0 8px rgba(158, 158, 158, 0.2); }
.rarity-uncommon { border-color: #4caf50 !important; box-shadow: 0 0 10px rgba(76, 175, 80, 0.3); }
.rarity-rare { border-color: #2196f3 !important; box-shadow: 0 0 12px rgba(33, 150, 243, 0.35); }
.rarity-epic { border-color: #9c27b0 !important; box-shadow: 0 0 14px rgba(156, 39, 176, 0.4); }
.rarity-legendary { border-color: #ff9800 !important; box-shadow: 0 0 16px rgba(255, 152, 0, 0.45); }

/* ===== ADMIN ===== */
.admin-sidebar {
    background: var(--bg-card);
    padding: 12px;
}

.admin-menu a {
    display: block;
    padding: 8px 12px;
    color: var(--text);
    text-decoration: none;
    border-radius: 6px;
    margin-bottom: 4px;
    font-size: 13px;
}

.admin-menu a:hover, .admin-menu a.active {
    background: var(--primary);
    color: #fff;
}

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

.admin-table th, .admin-table td {
    padding: 8px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.admin-table th {
    background: var(--bg-card2);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 10px;
}

/* ===== GUEST PREVIEW ===== */
.guest-preview-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr));
    gap: 10px;
    margin-top: 12px;
}

@media (max-width: 420px) {
    .guest-preview-actions {
        grid-template-columns: 1fr;
    }
}

/* ===== SKIP LINK (доступность) ===== */
.skip-link {
    position: absolute;
    top: -100px;
    left: 12px;
    padding: 8px 16px;
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    border-radius: 8px;
    z-index: 10000;
    transition: top 0.2s ease;
}
.skip-link:focus {
    top: 12px;
    outline: 2px solid var(--secondary);
    outline-offset: 2px;
}

/* ===== UTILITY ===== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.p-8 { padding: 16px; }
.p-12 { padding: 12px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8 { gap: 8px; }
.hidden { display: none !important; }

/* ===== BADGE ===== */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
}

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

/* Loading */
.loading {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
}

.spinner {
    width: 30px;
    height: 30px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 8px;
}

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

/* ===== PLAYER LINK ===== */
.player-link {
    color: var(--secondary);
    text-decoration: none;
    font-weight: 600;
}
.player-link:hover {
    color: var(--primary);
    text-decoration: underline;
}

/* ===== HUNT STATES (предотвращение дёрганья) ===== */
#hunt-states {
    min-height: 220px;
    position: relative;
}

#hunt-idle,
#hunt-battle,
#hunt-result {
    width: 100%;
}

/* ===== DUNGEON STYLES ===== */
.dungeon-info {
    text-align: center;
    padding: 12px;
    background: var(--bg);
    border-radius: 8px;
}

.dungeon-floor {
    margin-bottom: 8px;
}

.dungeon-stats {
    margin-top: 8px;
}

.dungeon-timer {
    margin-top: 8px;
    padding: 8px;
    background: rgba(46, 213, 115, 0.1);
    border-radius: 6px;
    border: 1px solid var(--green);
}

#dungeon-states {
    min-height: 220px;
    position: relative;
}

#dungeon-idle,
#dungeon-battle,
#dungeon-result {
    width: 100%;
}

#boss-badge {
    display: inline-block;
    background: var(--red);
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    margin-top: 4px;
}

/* ===== DUNGEON MODULE ===== */
.dungeon-container {
    padding: 8px 0;
}

.dungeon-section {
    animation: fadeIn 0.3s ease;
}

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

/* Dungeon Stats */
.dungeon-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px;
    background: var(--bg-input);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.stat-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}

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

.stat-value {
    font-weight: 700;
    color: var(--text);
}

/* Attempts Container */
.attempts-container {
    padding: 12px;
    background: var(--bg-card2);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.attempts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.attempts-label {
    font-weight: 600;
    color: var(--text);
}

.attempts-value {
    display: flex;
    gap: 4px;
    align-items: center;
}

.attempt-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--bg-input);
    border: 2px solid var(--border);
    transition: all 0.3s ease;
}

.attempt-dot.active {
    background: var(--green);
    border-color: var(--green);
    box-shadow: 0 0 8px rgba(46, 213, 115, 0.5);
}

.attempts-bar-container {
    background: var(--bg-input);
    border-radius: 4px;
    height: 6px;
    overflow: hidden;
    margin-bottom: 8px;
}

.attempts-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--green), var(--secondary));
    transition: width 0.5s ease;
    border-radius: 4px;
}

.attempts-bar.empty {
    background: var(--red);
}

.attempts-bar.partial {
    background: linear-gradient(90deg, var(--orange), var(--gold));
}

.attempts-bar.full {
    background: linear-gradient(90deg, var(--green), var(--secondary));
}

.attempts-timer {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    padding: 6px;
    background: rgba(46, 213, 115, 0.05);
    border-radius: 6px;
    border: 1px solid rgba(46, 213, 115, 0.3);
}

#timer-countdown {
    font-weight: 700;
    color: var(--green);
    font-family: monospace;
    font-size: 14px;
}

/* Floors Grid */
.floors-section {
    margin-top: 16px;
}

.section-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 6px;
}

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

.floor-card {
    background: var(--bg-card2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.floor-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(108, 92, 231, 0.2);
}

.floor-card.completed {
    border-color: var(--green);
}

.floor-card.completed::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--green);
}

.floor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.floor-number {
    font-size: 12px;
    font-weight: 700;
    color: var(--primary);
    background: rgba(108, 92, 231, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
}

.completed-badge {
    color: var(--green);
    font-weight: 700;
    font-size: 14px;
}

.floor-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
    line-height: 1.3;
}

.floor-reqs {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.req-level {
    font-size: 11px;
    color: var(--text-muted);
    background: var(--bg-input);
    padding: 2px 6px;
    border-radius: 4px;
}

.floor-rewards {
    display: flex;
    gap: 8px;
    font-size: 11px;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.floor-rewards span {
    display: flex;
    align-items: center;
    gap: 3px;
}

/* Active Attempt Section */
.active-attempt-section {
    margin-top: 16px;
    padding: 12px;
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.1), rgba(0, 206, 201, 0.05));
    border: 1px solid var(--primary);
    border-radius: var(--radius);
}

.active-floor {
    font-size: 14px;
    color: var(--text);
    margin-bottom: 6px;
}

.active-monster {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.active-hp {
    font-size: 13px;
    color: var(--green);
    font-weight: 600;
}

.active-progress {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
    padding: 4px 8px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
}

.defeated-monsters {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.defeated-monsters strong {
    font-size: 12px;
    color: var(--text-muted);
    display: block;
    margin-bottom: 8px;
}

.defeated-monsters .monster-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.defeated-monsters .btn {
    font-size: 11px;
    padding: 4px 8px;
}

/* Battle Floor Info */
.battle-floor-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-card2);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.floor-badge {
    font-size: 12px;
    font-weight: 700;
    color: var(--primary);
    background: rgba(108, 92, 231, 0.15);
    padding: 3px 10px;
    border-radius: 6px;
}

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

/* Monster Stats */
.monster-stats {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

/* Battle Buttons */
.battle-buttons {
    margin-top: 16px !important;
}

.battle-buttons .btn {
    min-width: 120px;
}

#btn-retry {
    visibility: hidden;
}

/* Result Rewards */
.result-rewards {
    padding: 12px;
    background: var(--bg-card2);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.rewards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 8px;
}

.reward-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    padding: 8px;
    background: var(--bg-input);
    border-radius: 6px;
}

.reward-icon {
    font-size: 16px;
}

.no-rewards {
    color: var(--text-muted);
    font-size: 13px;
}

.no-data {
    text-align: center;
    color: var(--text-muted);
    padding: 20px;
    font-size: 13px;
}

.loading-spinner {
    text-align: center;
    color: var(--text-muted);
    padding: 20px;
    font-size: 13px;
}

/* Battle Log Entry Styles */
.battle-log-entry.info-entry {
    color: var(--text-muted);
    font-style: italic;
}

/* Responsive adjustments */
@media (max-width: 400px) {
    .floors-grid {
        grid-template-columns: 1fr;
    }
    
    .dungeon-stats {
        flex-direction: column;
        gap: 8px;
    }
    
    .battle-buttons {
        flex-direction: column;
    }
    
    .battle-buttons .btn {
        width: 100%;
    }
}

/* ===== AUTO HUNT ===== */
#hunt-auto-modal {
    animation: fadeIn 0.2s ease;
}

#hunt-auto-modal .card {
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Auto Result Stats */
#hunt-auto-result .alert-warning {
    background: linear-gradient(135deg, rgba(255, 169, 77, 0.18) 0%, rgba(255, 152, 0, 0.1) 100%);
    border-color: rgba(255, 169, 77, 0.4);
}

#hunt-auto-result .card {
    padding: 12px;
}

/* ===== RESPONSIVE ===== */
/* Предотвращение overflow и смещения элементов */
.top-bar,
.bottom-nav,
.game-container {
    overflow-x: hidden;
}

/* Изображения в контейнерах не должны вызывать overflow */
.battle-monster img,
.monster-image,
.boss-image,
.shop-item img,
.eq-slot img,
.inventory-item img {
    max-width: 100%;
    object-fit: contain;
}

.modal-content,
.confirm-modal {
    max-width: min(calc(var(--max-width) - 40px), calc(100vw - 24px));
}

.shop-item,
.list-item,
.clan-building {
    min-width: 0;
}

/* Планшеты и средние экраны */
@media (max-width: 600px) {
    .game-container {
        padding-top: var(--header-offset, 68px);
        padding-bottom: calc(var(--bottom-nav-height, 68px) + env(safe-area-inset-bottom, 0px) + 6px);
        margin-left: 0;
        margin-right: 0;
    }

    .card {
        margin-left: 8px;
        margin-right: 8px;
        padding: 14px;
    }

    .tabs {
        margin-left: 8px;
        margin-right: 8px;
    }

    .top-bar {
        padding: 6px 8px;
    }

    .top-bar-stats {
        gap: 4px;
    }

    .stat-item {
        font-size: 11px;
    }

    .stat-item .stat-icon {
        font-size: 9px;
    }

    .exp-text {
        font-size: 8px;
    }

    .exp-bar-container {
        height: 10px;
    }

    .health-text {
        font-size: 11px;
    }

    .top-bar-info {
        font-size: 9px;
    }

    .card-header {
        font-size: 15px;
        margin-bottom: 12px;
    }

    .card-header .icon {
        font-size: 18px;
    }

    .profile-name {
        font-size: 20px;
    }

    .profile-level {
        font-size: 13px;
    }

    .stats-grid {
        gap: 8px;
    }

    .stat-box {
        padding: 10px;
    }

    .stat-box .stat-value {
        font-size: 16px;
    }

    .eq-slot {
        width: 62px;
        min-width: 56px;
        height: 62px;
    }

    .eq-slot img {
        width: 28px;
        height: 28px;
    }

    .eq-slot-label {
        font-size: 7px;
    }

    .tabs-nav-grid .tab {
        flex: 1 1 calc(50% - 4px);
    }

    .tab {
        padding: 10px 8px;
        font-size: 11px;
    }

    .btn {
        padding: 10px 16px;
        font-size: 13px;
    }

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

    .bottom-nav {
        padding: 6px 2px calc(6px + env(safe-area-inset-bottom, 0px));
    }

    .nav-btn {
        padding: 4px 2px;
        font-size: 9px;
        min-width: 0;
        max-width: none;
    }

    .nav-btn .nav-icon {
        font-size: 18px;
    }

    .nav-btn--home .nav-icon {
        font-size: 24px;
    }

    .shop-item {
        padding: 10px;
        gap: 10px;
    }

    .shop-item img {
        width: 36px;
        height: 36px;
    }

    .shop-item-name {
        font-size: 12px;
    }

    .shop-item-stats {
        font-size: 11px;
    }

    .list-item {
        padding: 10px;
        gap: 8px;
        flex-wrap: wrap;
    }

    .list-item form {
        flex-shrink: 0;
    }

    .battle-monster img,
    .monster-image {
        width: 100px;
        height: 100px;
    }

    .boss-image {
        width: 120px;
        height: 120px;
    }

    .battle-monster-name {
        font-size: 16px;
    }

    .health-bar-container {
        max-width: 100%;
    }

    .modal-content {
        padding: 18px 16px calc(18px + env(safe-area-inset-bottom, 0px));
        width: calc(100% - 24px);
        max-width: min(calc(var(--max-width) - 40px), calc(100vw - 24px));
        max-height: min(88dvh, 88vh);
        border-radius: var(--radius);
    }

    .modal-header h3 {
        font-size: 16px;
    }

    .form-control {
        padding: 10px 12px;
        font-size: 13px;
    }

    .floors-grid {
        grid-template-columns: 1fr;
    }

    .battle-buttons .btn {
        min-width: 100%;
    }

    /* Меньше случайного зума в iOS при фокусе в поле */
    textarea.form-control,
    input.form-control:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="hidden"]),
    select.form-control {
        font-size: 16px;
    }

    .title-select-dropdown,
    .shop-filter-field .form-control {
        font-size: 16px !important;
    }

    .game-container .btn:not(.btn-sm),
    .auth-container .btn:not(.btn-sm) {
        min-height: var(--touch-target, 48px);
        padding-left: 20px;
        padding-right: 20px;
    }

    .game-container .btn-sm {
        min-height: 40px;
    }

    .confirm-modal-btn {
        min-height: var(--touch-target, 48px);
    }

    .chat-message__body {
        font-size: 15px;
        line-height: 1.45;
    }

    .chat-message__bubble {
        padding: 11px 15px 13px;
    }

    .chat-messages {
        padding: 12px 12px 16px;
    }
}

/* Маленькие экраны (телефоны) */
@media (max-width: 400px) {
    .game-container {
        padding-top: var(--header-offset, 72px);
        padding-bottom: calc(var(--bottom-nav-height, 64px) + env(safe-area-inset-bottom, 0px) + 6px);
    }

    .card {
        margin-left: 6px;
        margin-right: 6px;
        padding: 12px;
    }

    .top-bar-stats {
        justify-content: flex-start;
    }

    .stat-item {
        font-size: 10px;
    }

    .stat-item {
        flex-shrink: 1;
    }

    .tabs-nav-grid .tab {
        flex: 1 1 calc(50% - 4px);
    }

    .eq-slot {
        width: 58px;
        min-width: 52px;
        height: 58px;
    }

    .eq-slot img {
        width: 24px;
        height: 24px;
    }

    .nav-btn {
        min-width: 0;
        max-width: none;
        font-size: 8px;
    }

    .nav-btn .nav-icon {
        font-size: 16px;
    }

    .nav-btn--home .nav-icon {
        font-size: 22px;
    }

    .profile-name {
        font-size: 18px;
    }

    .profile-header {
        padding: 16px 12px;
    }

    .quick-actions .btn {
        min-width: 100%;
    }

    .monster-card-body {
        flex-direction: column;
        align-items: flex-start;
    }

    .battle-floor-info {
        flex-wrap: wrap;
        justify-content: center;
    }

    .monster-actions {
        flex-direction: column;
    }

    .monster-actions .btn {
        width: 100%;
    }
}

/* Очень маленькие экраны */
@media (max-width: 340px) {
    .top-bar-stats {
        gap: 2px;
    }

    .stat-item {
        font-size: 9px;
    }

    .eq-slot {
        width: 52px;
        min-width: 48px;
        height: 52px;
    }

    .eq-slot-label {
        display: none;
    }

    .card-header {
        font-size: 14px;
    }
}

/* ===== REAL-TIME UPDATES ===== */
/* Эффект обновления статов */
.stat-item span[data-stat],
#stat-energy,
#stat-gold,
#stat-silver,
#online-count {
    transition: color 0.3s ease, transform 0.2s ease;
}

.stat-updated {
    animation: statPulse 0.5s ease;
}

@keyframes statPulse {
    0% {
        color: var(--text);
        transform: scale(1);
    }
    50% {
        color: var(--green);
        transform: scale(1.05);
    }
    100% {
        color: var(--text);
        transform: scale(1);
    }
}

/* Обновление с увеличением (зелёный) */
.stat-increased {
    animation: statIncrease 0.6s ease;
}

@keyframes statIncrease {
    0% {
        color: var(--text);
        transform: scale(1);
    }
    50% {
        color: var(--green);
        transform: scale(1.1);
        text-shadow: 0 0 10px rgba(46, 213, 115, 0.5);
    }
    100% {
        color: var(--text);
        transform: scale(1);
    }
}

/* Обновление с уменьшением (красный) */
.stat-decreased {
    animation: statDecrease 0.6s ease;
}

@keyframes statDecrease {
    0% {
        color: var(--text);
        transform: scale(1);
    }
    50% {
        color: var(--red);
        transform: scale(0.95);
        text-shadow: 0 0 10px rgba(255, 71, 87, 0.5);
    }
    100% {
        color: var(--text);
        transform: scale(1);
    }
}

/* Индикатор обновления почты */
#nav-btn-mail,
.nav-more-link--mail,
.nav-btn[href*="mail.php"] {
    position: relative;
}

#nav-btn-mail .badge,
.nav-more-link--mail .badge,
.nav-btn[href*="mail.php"] .badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--red);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 10px;
    min-width: 16px;
    text-align: center;
    animation: badgePulse 1s ease infinite;
}

@keyframes badgePulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* ===== PRINT ===== */
@media print {
    .top-bar, .bottom-nav, .nav-more-sheet, .skip-link, .nav-btn, .site-footer,
    .btn, .tabs, .quick-actions, .game-toast, .game-toast-achievement, .game-reward-toast-host, .game-reward-toast { display: none !important; }
    .game-container { padding-top: 0; padding-bottom: 0; max-width: 100%; }
    body { background: #fff; color: #000; }
    .card { box-shadow: none; border: 1px solid #ccc; }
}

/* Breadcrumbs */
.breadcrumbs {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 12px;
    padding: 0 12px;
}
.breadcrumbs ol {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
}
.breadcrumbs li {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.breadcrumbs a {
    color: var(--text-muted);
    text-decoration: none;
}
.breadcrumbs a:hover {
    color: var(--primary);
}
.breadcrumbs .breadcrumb-sep {
    color: var(--text-muted);
    opacity: 0.7;
}

.site-footer {
    padding: 16px 16px calc(var(--bottom-nav-height, 76px) + env(safe-area-inset-bottom, 0px) + 28px);
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-muted);
    text-align: center;
    border-top: 1px solid var(--border);
    background: linear-gradient(0deg, rgba(6, 6, 18, 0.6) 0%, transparent 100%);
}
.site-footer a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s ease;
}
.site-footer a:hover {
    color: var(--primary);
}

/* ========== Achievements ========== */
.achievements-page .achievements-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.achievements-page-titles {
    background: linear-gradient(145deg, rgba(24, 24, 52, 0.95) 0%, rgba(16, 16, 38, 0.88) 100%);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-card);
}
.achievements-page-main {
    background: linear-gradient(160deg, rgba(22, 22, 48, 0.96) 0%, rgba(14, 14, 32, 0.9) 100%);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-card);
}
.achievements-page-main-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}
.achievements-page-stat {
    margin-left: auto;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
    padding: 6px 12px;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(139, 124, 255, 0.22), rgba(0, 229, 212, 0.12));
    border: 1px solid rgba(139, 124, 255, 0.35);
    color: var(--silver);
    box-shadow: 0 2px 12px rgba(139, 124, 255, 0.15);
}
.achievements-page-tabs {
    margin-bottom: 14px !important;
}
.achievements-page .achievement-card {
    --ach-card-border: rgba(120, 120, 200, 0.22);
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 16px 16px 14px;
    border: 1px solid var(--ach-card-border);
    border-radius: var(--radius);
    background: linear-gradient(135deg, rgba(28, 28, 55, 0.75) 0%, rgba(18, 18, 42, 0.82) 100%);
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
    position: relative;
    overflow: hidden;
    transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.2s ease;
}
.achievements-page .achievement-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 80% 120% at 0% 0%, rgba(139, 124, 255, 0.12), transparent 55%);
    pointer-events: none;
    opacity: 0.85;
}
.achievements-page .achievement-card:hover {
    border-color: rgba(139, 124, 255, 0.4);
    box-shadow:
        0 8px 28px rgba(0, 0, 0, 0.35),
        0 0 0 1px rgba(139, 124, 255, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    transform: translateY(-1px);
}
.achievements-page .achievement-card.completed {
    --ach-card-border: rgba(62, 232, 138, 0.35);
    background: linear-gradient(135deg, rgba(62, 232, 138, 0.1) 0%, rgba(18, 18, 42, 0.88) 55%, rgba(22, 22, 48, 0.9) 100%);
    box-shadow:
        0 4px 24px rgba(62, 232, 138, 0.12),
        inset 0 1px 0 rgba(62, 232, 138, 0.15);
}
.achievements-page .achievement-card.completed::before {
    background: radial-gradient(ellipse 90% 100% at 100% 0%, rgba(62, 232, 138, 0.14), transparent 50%);
}
.achievements-page .achievement-card.completed:hover {
    border-color: rgba(62, 232, 138, 0.5);
    box-shadow:
        0 8px 32px rgba(62, 232, 138, 0.18),
        inset 0 1px 0 rgba(62, 232, 138, 0.2);
}
.achievement-icon-wrap {
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: linear-gradient(145deg, rgba(139, 124, 255, 0.2), rgba(0, 229, 212, 0.08));
    border: 1px solid rgba(139, 124, 255, 0.28);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
    position: relative;
    z-index: 1;
}
.achievements-page .achievement-card.completed .achievement-icon-wrap {
    background: linear-gradient(145deg, rgba(62, 232, 138, 0.22), rgba(139, 124, 255, 0.1));
    border-color: rgba(62, 232, 138, 0.35);
}
.achievement-icon {
    font-size: 26px;
    line-height: 1;
    display: block;
}
.achievement-body {
    flex: 1;
    min-width: 0;
    position: relative;
    z-index: 1;
}
.achievement-name {
    font-weight: 700;
    font-size: 15px;
    letter-spacing: -0.01em;
    margin-bottom: 6px;
    line-height: 1.3;
}
.achievements-page .achievement-card.completed .achievement-name {
    color: var(--text);
}
.achievement-desc {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 10px;
    line-height: 1.45;
}
.achievement-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}
.achievement-progress .progress-bar {
    flex: 1;
    height: 8px;
    background: rgba(0, 0, 0, 0.35);
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid rgba(139, 124, 255, 0.12);
}
.achievement-progress .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 999px;
    transition: width 0.35s cubic-bezier(0.34, 1.2, 0.64, 1);
    box-shadow: 0 0 12px var(--primary-glow);
}
.achievement-progress .progress-text {
    font-size: 11px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--silver);
    white-space: nowrap;
}
.achievement-reward {
    font-size: 12px;
    font-weight: 600;
    color: var(--gold);
    padding-top: 2px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.achievement-reward::before {
    content: '✦';
    font-size: 9px;
    opacity: 0.85;
}
.achievement-done {
    flex-shrink: 0;
    align-self: center;
    position: relative;
    z-index: 1;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: linear-gradient(145deg, rgba(62, 232, 138, 0.35), rgba(62, 232, 138, 0.12));
    border: 1px solid rgba(62, 232, 138, 0.55);
    box-shadow: 0 2px 14px rgba(62, 232, 138, 0.25);
}
.achievement-done-icon {
    color: var(--green);
    font-size: 16px;
    font-weight: 800;
    line-height: 1;
    text-shadow: 0 0 12px rgba(62, 232, 138, 0.5);
}
.titles-block {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}
.titles-current {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.titles-label {
    font-size: 12px;
    color: var(--text-muted);
}
.titles-value {
    font-size: 15px;
    font-weight: 600;
    color: var(--gold);
}
.achievements-page-titles .titles-value {
    font-size: 16px;
    letter-spacing: 0.01em;
}
.title-select-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 280px;
    overflow-y: auto;
}
.titles-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.title-option {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
}
.title-option:hover {
    background: var(--bg-input);
}
.title-option input {
    margin: 0;
}

.profile-title-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    padding: 8px 16px 8px 14px;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.18) 0%, rgba(255, 193, 7, 0.08) 50%, rgba(255, 152, 0, 0.12) 100%);
    border: 1px solid rgba(255, 215, 0, 0.45);
    border-radius: 50px;
    box-shadow: 0 8px 24px rgba(255, 193, 7, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.profile-title-badge:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 28px rgba(255, 193, 7, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.12);
   border-color: rgba(255, 215, 0, 0.6);
}
.profile-title-badge:focus {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}
.profile-title-crown {
    font-size: 18px;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}
.profile-title-text {
    display: inline-block;
    font-size: 15px;
    font-weight: 700;
    color: var(--gold);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    letter-spacing: 0.02em;
}
.profile-title-modal-content {
    max-width: 420px;
    background: linear-gradient(145deg, var(--card-bg) 0%, rgba(255, 215, 0, 0.06) 100%);
    border: 1px solid rgba(255, 215, 0, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 215, 0, 0.08);
}
.profile-title-modal-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 215, 0, 0.15);
    background: rgba(255, 215, 0, 0.04);
}
.profile-title-modal-crown {
    font-size: 24px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}
.profile-title-modal-title {
    flex: 1;
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--gold);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.profile-title-modal-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.profile-title-modal-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.profile-title-modal-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}
.profile-title-modal-achievement {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}
.profile-title-modal-desc {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-muted);
}

/* Выбор титула — выпадающий список в стиле проекта */
.title-select-wrapper {
    padding: 8px 0;
}
.title-select-dropdown {
    width: 100%;
    padding: 12px 36px 12px 16px;
    font-size: 14px;
    font-family: 'Nunito', sans-serif;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238b7cff' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    transition: all 0.2s ease;
    outline: none;
}
.title-select-dropdown:hover {
    border-color: var(--border-light);
}
.title-select-dropdown:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(139, 124, 255, 0.3);
}
.title-select-dropdown:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
.title-select-dropdown option {
    background: var(--bg-card);
    color: var(--text);
}

/* ===== Заголовки страниц и панели фильтров (рейтинг и др.) ===== */
.page-header {
    margin: 8px var(--page-gutter, 14px) 14px;
    padding: 0 2px;
}

.page-header h1 {
    font-family: 'Cinzel', serif;
    font-size: clamp(1.2rem, 4.8vw, 1.45rem);
    font-weight: 700;
    line-height: 1.25;
    color: var(--text);
    margin: 0;
}

.sort-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 14px;
}

.sort-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin-right: 6px;
}

.sort-bar .form-control {
    flex: 1 1 200px;
    min-width: 0;
}

/* Рейтинг игроков: поиск по нику — поле на всю доступную ширину; на телефоне кнопка под полем */
.ranking-search-form {
    width: 100%;
}
.ranking-search-form input[name="search"] {
    flex: 1 1 12rem;
    min-width: 0;
    max-width: none;
}
@media (max-width: 576px) {
    .ranking-search-form {
        flex-direction: column;
        align-items: stretch;
    }
    .ranking-search-form input[name="search"] {
        flex: none;
        width: 100%;
    }
    .ranking-search-form .btn,
    .ranking-search-form .btn-sm {
        width: 100%;
    }
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    align-items: center;
    margin-top: 16px;
}

.page-info {
    text-align: center;
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.45;
}

@media (max-width: 480px) {
    .sort-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .sort-bar .btn,
    .sort-bar .btn-sm {
        width: 100%;
        justify-content: center;
    }

    .sort-bar > .sort-label {
        width: 100%;
        font-weight: 600;
        font-size: 13px;
        color: var(--text-muted);
        margin-bottom: 2px;
    }
}

/* Горизонтальная прокрутка широких блоков (аукцион, админка) */
.table-responsive,
.data-table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 calc(-1 * var(--page-gutter, 14px));
    padding: 0 var(--page-gutter, 14px);
}

/* Телефоны: без «залипания» hover после касания */
@media (hover: none), (pointer: coarse) {
    .card:hover {
        transform: none;
        box-shadow: var(--shadow-card), 0 1px 0 rgba(255, 255, 255, 0.04) inset;
        border-color: var(--border);
    }

    .list-item:hover,
    .shop-item:hover,
    .inventory-items-grid .inventory-item:hover {
        transform: none;
    }

    .stat-box:hover {
        transform: none;
    }

    .tab:hover {
        transform: none;
    }

    .btn-primary:hover,
    .btn-secondary:hover,
    .btn-danger:hover,
    .btn-success:hover,
    .btn-gold:hover {
        transform: none;
    }

    .item-card:hover {
        transform: none;
    }

    .eq-slot:hover {
        transform: none;
    }
}

@media (max-width: 380px) {
    .inventory-items-grid {
        grid-template-columns: 1fr;
    }
}

/* Карточки по активности: менее 7 дней — без класса; 7–29 дней — оранжевый; 30+ — красный */
.list-item.clan-member-row.player-activity-inactive-week,
.ranking-cards-minimal .ranking-card-minimal.player-activity-inactive-week {
    background: rgba(255, 169, 77, 0.1);
    border-color: rgba(255, 169, 77, 0.42);
}

.list-item.clan-member-row.player-activity-inactive-month,
.ranking-cards-minimal .ranking-card-minimal.player-activity-inactive-month {
    background: rgba(255, 92, 122, 0.09);
    border-color: rgba(255, 92, 122, 0.45);
}

.ranking-cards-minimal .ranking-card-minimal.player-activity-inactive-week:hover {
    background: rgba(255, 169, 77, 0.16);
    border-color: var(--orange);
}

.ranking-cards-minimal .ranking-card-minimal.player-activity-inactive-month:hover {
    background: rgba(255, 92, 122, 0.14);
    border-color: var(--red);
}

/* Результат данжа таверны из колокольника (вне страницы таверны) */
.td-global-result-overlay {
    position: fixed;
    inset: 0;
    z-index: 3200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
    box-sizing: border-box;
    background: rgba(0, 0, 0, 0.78);
    backdrop-filter: blur(8px);
}
.td-global-result-overlay.is-open {
    display: flex;
}
body.td-global-result-open {
    overflow: hidden;
}
.td-global-result-backdrop {
    position: absolute;
    inset: 0;
}
.td-global-result-overlay .td-result {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 400px;
    max-height: 85vh;
    overflow-y: auto;
    margin: 0;
    border-radius: 22px;
    padding: 24px 20px;
    background: linear-gradient(165deg, #1e1e38, #12122a);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
}
.td-global-result-overlay .td-result__title {
    font-size: 1.35rem;
    font-weight: 800;
    text-align: center;
    margin: 0 0 8px;
}
.td-global-result-overlay .td-result__title--win {
    color: #6ee7b7;
}
.td-global-result-overlay .td-result__title--lose {
    color: #fca5a5;
}
.td-global-result-overlay .td-result__sub {
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 18px;
}
.td-global-result-overlay .td-reward-block {
    font-size: 13px;
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.25);
    margin-bottom: 10px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}
.td-global-result-overlay .td-reward-block strong {
    color: #fde68a;
    font-weight: 700;
}

/* ===== Обменник — фон как у пункта «Донат» (assets/img/buttons/donate.png) ===== */
body[data-current-page="exchange"]::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        linear-gradient(180deg, rgba(6, 6, 18, 0.9) 0%, rgba(6, 6, 22, 0.94) 50%, rgba(8, 8, 26, 0.92) 100%),
        url("../img/buttons/donate.png") center / cover no-repeat;
}

.exchange-page {
    padding: 4px 0 16px;
}

.exchange-hero {
    position: relative;
    padding: 22px 18px 20px;
    margin-bottom: 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    background: linear-gradient(155deg, rgba(22, 22, 48, 0.92) 0%, rgba(12, 12, 32, 0.96) 100%);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

.exchange-hero__glow {
    position: absolute;
    width: 140%;
    height: 80%;
    top: -40%;
    left: -20%;
    background: radial-gradient(ellipse at 50% 100%, rgba(255, 217, 61, 0.14) 0%, transparent 55%);
    pointer-events: none;
}

.exchange-hero__title {
    font-family: 'Cinzel', serif;
    font-size: clamp(1.35rem, 4.5vw, 1.55rem);
    font-weight: 700;
    margin: 0 0 10px;
    position: relative;
    letter-spacing: 0.02em;
}

.exchange-hero__lead,
.exchange-hero__hint {
    font-size: 14px;
    color: var(--text-muted);
    margin: 0 0 8px;
    line-height: 1.5;
    position: relative;
}

.exchange-hero__hint {
    margin-bottom: 0;
    font-size: 13px;
}

.exchange-balance-strip {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 16px;
}

.exchange-balance-strip__item {
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
}

.exchange-balance-strip__item--wide {
    grid-column: 1 / -1;
}

.exchange-balance-strip__label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.exchange-balance-strip__value {
    font-size: 16px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.exchange-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

@media (min-width: 520px) {
    .exchange-grid {
        grid-template-columns: 1fr 1fr;
        align-items: stretch;
    }
}

.exchange-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 18px 16px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: linear-gradient(160deg, rgba(30, 30, 58, 0.9) 0%, rgba(18, 18, 42, 0.95) 100%);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
    min-height: 100%;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.exchange-card:hover {
    border-color: rgba(139, 124, 255, 0.35);
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.4);
}

.exchange-card--accent {
    border-color: rgba(255, 217, 61, 0.28);
    background: linear-gradient(165deg, rgba(40, 32, 20, 0.55) 0%, rgba(18, 18, 42, 0.95) 100%);
}

.exchange-card__head {
    margin-bottom: 2px;
}

.exchange-card__icon {
    display: block;
    font-size: 22px;
    margin-bottom: 6px;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.35));
}

.exchange-card__title {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0 0 4px;
}

.exchange-card__sub {
    margin: 0;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.45;
}

.exchange-field__label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.exchange-input {
    min-height: var(--touch-target);
    font-size: 16px;
    font-variant-numeric: tabular-nums;
}

.exchange-preview {
    font-size: 13px;
    color: var(--text-muted);
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.exchange-preview strong {
    color: var(--secondary);
    font-weight: 700;
}

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

.exchange-btn {
    margin-top: auto;
    min-height: var(--touch-target);
    font-weight: 700;
    font-size: 15px;
}

.exchange-footnote {
    margin-top: 18px;
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.5;
    padding: 0 4px;
}

/* ===== FORUM ===== */
.forum-page {
    --forum-accent: var(--primary);
    --forum-accent-rgb: 139, 124, 255;
    --forum-surface: rgba(22, 22, 48, 0.65);
    --forum-surface2: rgba(30, 30, 58, 0.55);
}

.forum-hero {
    margin-bottom: 14px;
    overflow: hidden;
}

.forum-hero--splash {
    position: relative;
    border-color: rgba(var(--forum-accent-rgb), 0.28);
    background:
        radial-gradient(ellipse 90% 80% at 100% 0%, rgba(var(--forum-accent-rgb), 0.22) 0%, transparent 55%),
        radial-gradient(ellipse 70% 60% at 0% 100%, rgba(0, 229, 212, 0.08) 0%, transparent 50%),
        linear-gradient(165deg, var(--bg-card) 0%, rgba(14, 14, 36, 0.96) 100%);
    box-shadow:
        var(--shadow-card),
        0 0 48px rgba(var(--forum-accent-rgb), 0.06);
}

.forum-hero--splash::before {
    content: '';
    position: absolute;
    top: -40%;
    right: -20%;
    width: 55%;
    height: 120%;
    background: radial-gradient(circle, rgba(var(--forum-accent-rgb), 0.12) 0%, transparent 68%);
    pointer-events: none;
}

.forum-hero--splash.card:hover {
    transform: none;
    border-color: rgba(var(--forum-accent-rgb), 0.35);
    box-shadow:
        0 10px 36px rgba(0, 0, 0, 0.42),
        0 0 0 1px rgba(var(--forum-accent-rgb), 0.2),
        0 0 50px rgba(var(--forum-accent-rgb), 0.08);
}

.forum-hero__inner {
    position: relative;
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.forum-hero__badge {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    font-size: 18px;
    color: var(--gold);
    background: linear-gradient(145deg, rgba(var(--forum-accent-rgb), 0.35), rgba(20, 20, 45, 0.9));
    border: 1px solid rgba(var(--forum-accent-rgb), 0.35);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.forum-hero__copy {
    min-width: 0;
    flex: 1;
}

.forum-hero__card-header {
    margin-bottom: 8px;
}

.forum-hero__lead {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.6;
    margin: 0;
}

.forum-cat-scroll {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
    padding: 6px 2px 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.forum-cat-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: linear-gradient(180deg, var(--bg-card2) 0%, var(--forum-surface) 100%);
    color: var(--text);
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    transition: background 0.18s ease, border-color 0.18s ease, transform 0.12s ease, box-shadow 0.18s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.forum-cat-chip:hover {
    border-color: rgba(var(--forum-accent-rgb), 0.45);
    background: linear-gradient(180deg, rgba(var(--forum-accent-rgb), 0.2) 0%, var(--forum-surface2) 100%);
    transform: translateY(-1px);
}

.forum-cat-chip.is-active {
    border-color: rgba(var(--forum-accent-rgb), 0.65);
    background: linear-gradient(135deg, rgba(var(--forum-accent-rgb), 0.32), rgba(var(--forum-accent-rgb), 0.08));
    box-shadow:
        0 0 0 1px rgba(var(--forum-accent-rgb), 0.22),
        0 4px 18px rgba(var(--forum-accent-rgb), 0.15);
    color: #fff;
}

.forum-cat-chip__badge {
    font-size: 11px;
    opacity: 0.95;
    filter: drop-shadow(0 0 6px rgba(255, 217, 61, 0.45));
}

.forum-board-card .forum-section-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.forum-section-head__title {
    font-size: 1.2rem;
    margin: 0;
    font-family: var(--font-heading, 'Cinzel', serif);
    letter-spacing: 0.02em;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.forum-hint {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.45;
}

.forum-hint--block {
    display: block;
    margin-top: 4px;
}

.forum-empty {
    text-align: center;
    padding: 32px 18px;
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.55;
}

.forum-empty--comments {
    padding: 24px 16px;
}

.forum-topic-list__head {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 12px 10px;
    margin: 0 0 6px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.18);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.forum-topic-list__head-title {
    flex: 1;
    min-width: 0;
}

.forum-topic-list__head-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
    flex-shrink: 0;
    justify-content: flex-end;
}

@media (min-width: 560px) {
    .forum-topic-list__head {
        display: flex;
    }

    .forum-topic-list__head-meta span:nth-child(1) {
        min-width: 7.5rem;
    }

    .forum-topic-list__head-meta span:nth-child(2) {
        min-width: 4.5rem;
        text-align: center;
    }

    .forum-topic-list__head-meta span:nth-child(3) {
        min-width: 9.5rem;
        text-align: right;
    }
}

.forum-topic-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.forum-topic-row {
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(0, 0, 0, 0.12);
    transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.forum-topic-row:hover {
    border-color: rgba(var(--forum-accent-rgb), 0.28);
    background: rgba(var(--forum-accent-rgb), 0.06);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.forum-topic-row.is-pinned {
    border-color: rgba(var(--forum-accent-rgb), 0.35);
    background: linear-gradient(90deg, rgba(var(--forum-accent-rgb), 0.14) 0%, rgba(0, 0, 0, 0.1) 40%);
    box-shadow: inset 3px 0 0 rgba(var(--forum-accent-rgb), 0.75);
}

.forum-topic-row__link {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 12px 12px 14px;
    text-decoration: none;
    color: inherit;
    border-radius: inherit;
}

@media (min-width: 560px) {
    .forum-topic-row__link {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 14px;
    }
}

.forum-topic-row__link:hover .forum-topic-row__title {
    color: var(--primary);
}

.forum-topic-row__title {
    font-weight: 700;
    font-size: 15px;
    line-height: 1.35;
    flex: 1;
    min-width: 0;
}

.forum-topic-row__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
    font-size: 12px;
    color: var(--text-muted);
    flex-shrink: 0;
    align-items: center;
}

@media (min-width: 560px) {
    .forum-topic-row__author {
        min-width: 7.5rem;
    }

    .forum-topic-row__replies {
        min-width: 4.5rem;
        justify-content: center;
    }

    .forum-topic-row__time {
        min-width: 9.5rem;
        text-align: right;
    }
}

.forum-topic-row__replies {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.forum-topic-row__replies::before {
    content: '💬';
    font-size: 11px;
    opacity: 0.85;
}

.forum-topic-row__replies-n {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: var(--text);
}

.forum-pin {
    margin-right: 4px;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4));
}

.forum-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.forum-pagination__info {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.06);
    font-variant-numeric: tabular-nums;
}

.forum-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.forum-label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 2px;
    line-height: 1.35;
}

.forum-textarea {
    min-height: 120px;
    resize: vertical;
    padding: 14px 16px;
    line-height: 1.55;
    box-sizing: border-box;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-input);
}

.forum-page .forum-new-topic-panel {
    margin-top: 14px;
    border-top: 3px solid rgba(var(--forum-accent-rgb), 0.55);
    background: linear-gradient(180deg, rgba(var(--forum-accent-rgb), 0.07) 0%, var(--bg-card) 18%);
}

.forum-new-topic-panel__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.forum-footnote {
    font-size: 12px;
    margin-top: 20px;
    text-align: center;
    line-height: 1.5;
    padding: 0 8px;
}

.forum-footnote a {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px solid rgba(var(--forum-accent-rgb), 0.35);
}

.forum-footnote a:hover {
    color: var(--secondary);
    border-bottom-color: var(--secondary);
}

/* Topic page */
.forum-back {
    margin-bottom: 14px;
}

.forum-back__link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px 8px 10px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    color: var(--text);
    background: linear-gradient(180deg, var(--bg-card2) 0%, var(--forum-surface) 100%);
    border: 1px solid var(--border);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
    transition: border-color 0.18s ease, transform 0.12s ease, box-shadow 0.18s ease;
}

.forum-back__link:hover {
    border-color: rgba(var(--forum-accent-rgb), 0.4);
    box-shadow: 0 4px 18px rgba(var(--forum-accent-rgb), 0.12);
    transform: translateX(-2px);
}

.forum-back__icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: rgba(var(--forum-accent-rgb), 0.2);
    font-size: 14px;
}

.forum-op--main {
    border-color: rgba(var(--forum-accent-rgb), 0.22);
    background:
        radial-gradient(ellipse 80% 50% at 100% 0%, rgba(var(--forum-accent-rgb), 0.12) 0%, transparent 55%),
        linear-gradient(165deg, var(--bg-card) 0%, rgba(14, 14, 36, 0.96) 100%);
}

.forum-op__head {
    margin-bottom: 14px;
}

.forum-op__title {
    font-size: 1.28rem;
    margin: 0 0 10px;
    font-family: var(--font-heading, 'Cinzel', serif);
    line-height: 1.28;
    letter-spacing: 0.02em;
}

.forum-op__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    font-size: 13px;
    align-items: center;
}

.forum-badge-locked {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(245, 158, 11, 0.14);
    border: 1px solid rgba(245, 158, 11, 0.4);
    color: var(--orange);
}

.forum-op__body {
    font-size: 15px;
    line-height: 1.65;
    margin-bottom: 16px;
    word-break: break-word;
}

.forum-op__body--panel {
    padding: 16px 18px;
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.forum-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.forum-react {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: linear-gradient(180deg, var(--bg-card2) 0%, var(--forum-surface) 100%);
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease, transform 0.1s ease, box-shadow 0.18s ease;
}

.forum-react:disabled {
    opacity: 0.55;
    cursor: default;
}

.forum-react:not(:disabled):hover {
    border-color: rgba(var(--forum-accent-rgb), 0.45);
    transform: translateY(-1px);
}

.forum-react.is-active {
    border-color: rgba(var(--forum-accent-rgb), 0.75);
    background: linear-gradient(135deg, rgba(var(--forum-accent-rgb), 0.28), rgba(var(--forum-accent-rgb), 0.1));
    box-shadow: 0 0 0 1px rgba(var(--forum-accent-rgb), 0.18);
}

.forum-react__n {
    font-variant-numeric: tabular-nums;
    min-width: 1.2em;
}

.forum-comments-card {
    margin-top: 14px;
    border-color: rgba(255, 255, 255, 0.1);
}

.forum-comments-card__head {
    width: 100%;
    justify-content: space-between;
    margin-bottom: 12px;
}

.forum-comments-card__count {
    font-family: 'Nunito', sans-serif;
    font-size: 13px;
    font-weight: 800;
    padding: 4px 11px;
    border-radius: 999px;
    background: rgba(var(--forum-accent-rgb), 0.2);
    border: 1px solid rgba(var(--forum-accent-rgb), 0.35);
    color: var(--text);
}

.forum-comment-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.forum-comment {
    padding: 14px 14px 14px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(0, 0, 0, 0.14);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
    transition: border-color 0.18s ease, background 0.18s ease;
}

.forum-comment:hover {
    border-color: rgba(var(--forum-accent-rgb), 0.2);
    background: rgba(var(--forum-accent-rgb), 0.04);
}

.forum-comment__head {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    align-items: baseline;
    margin-bottom: 10px;
    font-size: 13px;
}

.forum-comment__user {
    font-weight: 700;
    color: var(--text);
}

.forum-comment__body {
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 12px;
    word-break: break-word;
}

.forum-comment-form {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.forum-comment-textarea {
    min-height: 110px;
}

.forum-edit-details {
    margin: 12px 0 0;
    padding-top: 12px;
    border-top: 1px dashed rgba(255, 255, 255, 0.1);
}

.forum-edit-details--comment {
    margin-bottom: 10px;
    border-top: none;
    padding-top: 0;
}

.forum-edit-summary {
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    color: var(--primary);
    list-style: none;
    user-select: none;
}

.forum-edit-summary::-webkit-details-marker {
    display: none;
}

.forum-edit-summary::before {
    content: '';
}

.forum-edit-form {
    margin-top: 12px;
}

.forum-topic-page .forum-hint--block {
    padding-top: 12px;
    margin-top: 0;
}
