/* css/common.css - единые стили для всех инструментов Caps Game */
/* Тёмная тема, Inter, единый стиль в духе игры */

:root {
    /* Базовые цвета — тёмная гамма */
    --bg-page: #0f1419;
    --bg-elevated: #1a2027;
    --bg-card: #1e2228;
    --bg-card-hover: #252a31;
    --bg-header: #1a2639;
    --bg-header-2: #0f172a;

    /* Текст */
    --text: #e8edf2;
    --text-muted: #8a99ad;
    --text-dim: #5f6d80;

    /* Границы и разделители */
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.14);

    /* Акценты */
    --accent: #ffcd00;
    --accent-dark: #e6b800;
    --accent-soft: rgba(255, 205, 0, 0.14);

    /* Статусы (приглушённые) */
    --success: #4ade80;
    --success-bg: rgba(51, 189, 28, 0.15);
    --danger: #ff6b66;
    --danger-bg: rgba(255, 71, 64, 0.15);
    --warning: #ffcd00;
    --warning-bg: rgba(255, 205, 0, 0.15);
    --info: #60a5fa;
    --info-bg: rgba(84, 129, 255, 0.15);

    /* Типы коллекций (по мотивам игры) */
    --type-common-bg: rgba(148, 163, 184, 0.16);
    --type-common-fg: #cbd5e1;
    --type-special-bg: rgba(51, 189, 28, 0.16);
    --type-special-fg: #4ade80;
    --type-event-bg: rgba(84, 129, 255, 0.16);
    --type-event-fg: #93b4ff;
    --type-community-bg: rgba(180, 39, 165, 0.16);
    --type-community-fg: #e384d6;
    --type-premium-bg: rgba(255, 205, 0, 0.16);
    --type-premium-fg: #ffcd00;

    /* Формы */
    --border-radius: 1.75rem;
    --border-radius-sm: 1rem;

    /* Тени */
    --shadow: 0 12px 24px -12px rgba(0, 0, 0, 0.5);
    --shadow-hover: 0 24px 32px -18px rgba(0, 0, 0, 0.7);
    --shadow-modal: 0 30px 60px -20px rgba(0, 0, 0, 0.8);
}

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

html {
    color-scheme: dark;
}

body {
    background: radial-gradient(ellipse at top, #182028 0%, #0b1014 60%, #07090c 100%);
    background-attachment: fixed;
    color: var(--text);
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', 'Roboto', sans-serif;
    font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Общая обёртка */
.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 28px 24px;
}

/* Шапка сайта (навигация) */
.site-header {
    background: linear-gradient(135deg, var(--bg-header) 0%, var(--bg-header-2) 100%);
    border-radius: var(--border-radius);
    padding: 1.2rem 2rem;
    margin-bottom: 2rem;
    color: white;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.site-header h1 {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.4px;
    margin: 0 0 0.25rem 0;
    color: #fff;
}

.site-header h1 i {
    color: var(--accent);
    margin-right: 8px;
}

.site-header p {
    color: rgba(232, 237, 242, 0.7);
    margin: 0.25rem 0 0 0;
    font-size: 0.9rem;
}

.site-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1rem;
}

.nav-link-custom {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
    padding: 0.5rem 1.25rem;
    border-radius: 60px;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    transition: 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid transparent;
}

.nav-link-custom:hover {
    background: var(--accent);
    color: #0f1419;
    transform: translateY(-2px);
}

.nav-link-custom.active {
    background: var(--accent);
    color: #0f1419;
}

/* Карточки */
.card-modern {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    color: var(--text);
}

.card-modern:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    border-color: var(--border-strong);
}

.card-header-modern {
    background: linear-gradient(105deg, var(--bg-header) 0%, var(--bg-header-2) 100%);
    color: white;
    padding: 1.2rem 1.8rem;
    border-bottom: 3px solid var(--accent);
}

/* Бейджи */
.badge-type {
    display: inline-block;
    padding: 5px 18px;
    border-radius: 60px;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.badge-type-common { background: var(--type-common-bg); color: var(--type-common-fg); }
.badge-type-event { background: var(--type-event-bg); color: var(--type-event-fg); }
.badge-type-community { background: var(--type-community-bg); color: var(--type-community-fg); }
.badge-type-premium { background: var(--type-premium-bg); color: var(--type-premium-fg); }
.badge-type-special { background: var(--type-special-bg); color: var(--type-special-fg); }

.badge-status-available {
    background: var(--success-bg);
    color: var(--success);
    padding: 5px 18px;
    border-radius: 60px;
    font-size: 0.7rem;
    font-weight: 800;
    display: inline-block;
}
.badge-status-soldout {
    background: var(--danger-bg);
    color: var(--danger);
    padding: 5px 18px;
    border-radius: 60px;
    font-size: 0.7rem;
    font-weight: 800;
    display: inline-block;
}

.stat-pill {
    background: rgba(255, 255, 255, 0.05);
    padding: 6px 18px;
    border-radius: 60px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--border);
}

.stat-pill strong {
    color: var(--accent);
    font-weight: 700;
}

/* Кнопки */
.btn-primary-custom {
    background: var(--info);
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 60px;
    font-weight: 600;
    transition: 0.2s;
    cursor: pointer;
    font-family: inherit;
}

.btn-primary-custom:hover {
    background: #3b82f6;
    transform: translateY(-2px);
}

.btn-accent {
    background: var(--accent);
    color: #0f1419;
    border: none;
    padding: 10px 24px;
    border-radius: 60px;
    font-weight: 700;
    transition: 0.2s;
    cursor: pointer;
    font-family: inherit;
}

.btn-accent:hover {
    background: var(--accent-dark);
    transform: scale(0.98);
}

.btn-gold {
    background: linear-gradient(180deg, #ffd94d 0%, #ffcd00 100%);
    color: #0f1419;
    font-weight: 700;
    border: none;
    border-radius: 60px;
    transition: 0.2s;
    font-family: inherit;
}
.btn-gold:hover {
    background: linear-gradient(180deg, #ffcd00 0%, #e6b800 100%);
    transform: scale(0.98);
}

.btn-outline-gold {
    border: 2px solid var(--accent);
    color: var(--accent);
    background: transparent;
    font-weight: 600;
    border-radius: 60px;
    padding: 6px 20px;
    transition: 0.2s;
    font-family: inherit;
    cursor: pointer;
}
.btn-outline-gold:hover {
    background: var(--accent);
    color: #0f1419;
}

/* Селекты и формы */
.select-modern, .input-modern {
    width: 100%;
    padding: 12px 18px;
    border-radius: 60px;
    border: 1px solid var(--border-strong);
    background: var(--bg-elevated);
    color: var(--text);
    font-size: 0.9rem;
    transition: 0.2s;
    font-family: inherit;
}

.select-modern:focus, .input-modern:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(255, 205, 0, 0.18);
}

.select-modern option {
    background: var(--bg-elevated);
    color: var(--text);
}

/* Скелетон загрузки */
.skeleton {
    background: linear-gradient(90deg, #232830 25%, #2c333c 50%, #232830 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 12px;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Анимации */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

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

/* Сетка галереи (3 колонки) */
.grid-3cols {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 28px;
}

@media (max-width: 1000px) {
    .grid-3cols { grid-template-columns: repeat(2, 1fr); gap: 24px; }
    .app-container { padding: 20px; }
}

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

/* Футер */
.site-footer {
    margin-top: 3rem;
    text-align: center;
    font-size: 0.7rem;
    color: var(--text-dim);
    border-top: 1px solid var(--border);
    padding-top: 1.8rem;
}

/* Утилиты */
.text-accent { color: var(--accent); }
.bg-accent { background: var(--accent); }

/* Адаптивные таблицы */
.table-responsive-custom {
    overflow-x: auto;
}

/* ============= СТИЛИ ДЛЯ FINDER ============= */

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

.chip-card {
    background: var(--bg-card);
    border-radius: 1.2rem;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    border: 1px solid var(--border);
    aspect-ratio: 1 / 1;
    display: flex;
    flex-direction: column;
    position: relative;
    color: var(--text);
}

.chip-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    border-color: var(--border-strong);
}

.chip-image-wrapper {
    flex: 1;
    background: linear-gradient(135deg, var(--bg-header) 0%, var(--bg-header-2) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    min-height: 120px;
    position: relative;
    overflow: hidden;
}

.chip-image-wrapper img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.3s;
}

.chip-card:hover .chip-image-wrapper img {
    transform: scale(1.05);
}

.chip-status-icon {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 1.4rem;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
    background: rgba(0,0,0,0.6);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    border: 2px solid rgba(255,255,255,0.15);
}

.chip-grade-badge {
    position: absolute;
    bottom: 8px;
    left: 8px;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 30px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    backdrop-filter: blur(4px);
    background: rgba(0,0,0,0.7);
    color: white;
    border: 1px solid rgba(255,255,255,0.15);
}

.chip-info {
    padding: 0.6rem 0.8rem 0.8rem;
    background: var(--bg-card);
    flex-shrink: 0;
}

.chip-collection {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 0.2rem;
}

.chip-owner {
    font-size: 0.65rem;
    color: var(--text);
    background: rgba(255,255,255,0.06);
    padding: 1px 8px;
    border-radius: 30px;
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chip-id {
    font-size: 0.55rem;
    color: var(--text-dim);
    font-family: 'Inter', monospace;
}

.chip-status-label {
    font-size: 0.6rem;
    color: var(--text-muted);
    font-weight: 500;
}

.section-title {
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 0.9rem;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
    border-left: 4px solid var(--accent);
    padding-left: 12px;
}

.status-group {
    margin-bottom: 2rem;
}

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

.status-group-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 0.8rem;
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

/* ============= СТИЛИ ДЛЯ RECRUITER ============= */

.grade-common { background-color: #475569; color: #f1f5f9; font-weight: 600; }
.grade-common-plus { background-color: #334155; color: #e2e8f0; font-weight: 600; }
.grade-rare { background-color: rgba(51, 189, 28, 0.22); color: #4ade80; font-weight: 600; }
.grade-rare-plus { background-color: rgba(51, 189, 28, 0.32); color: #86efac; font-weight: 600; }
.grade-epic { background-color: rgba(84, 129, 255, 0.22); color: #93b4ff; font-weight: 600; }
.grade-epic-plus { background-color: rgba(84, 129, 255, 0.32); color: #b6c9ff; font-weight: 600; }
.grade-legend { background-color: rgba(255, 205, 0, 0.22); color: #ffcd00; font-weight: 600; }
.grade-legend-plus { background-color: rgba(255, 205, 0, 0.32); color: #ffe14d; font-weight: 600; }
.grade-diamond { background-color: rgba(84, 129, 255, 0.32); color: #cbd8ff; font-weight: 700; }

.avatar-frame {
    width: 70px;
    height: 70px;
    background: var(--bg-elevated);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 3px solid var(--accent);
    flex-shrink: 0;
}

.stat-badge {
    background-color: rgba(255, 255, 255, 0.08);
    border-radius: 40px;
    padding: 0.3rem 1rem;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text);
}

.badge-league {
    background: linear-gradient(145deg, #5481ff, #2c53db);
    color: white;
    padding: 5px 14px;
    border-radius: 30px;
    font-size: 0.75rem;
    font-weight: 600;
}

.achievement-badge {
    background-color: rgba(255, 255, 255, 0.07);
    color: var(--text);
    font-size: 0.7rem;
    padding: 4px 10px;
    border-radius: 30px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--border);
}

.boss-level-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-elevated);
    color: var(--text);
    padding: 4px 14px;
    border-radius: 30px;
    font-size: 0.8rem;
    border: 1px solid var(--border);
}

.streak-win { color: #4ade80; }
.streak-lose { color: #ff6b66; }

/* ============= СТИЛИ ДЛЯ SQUAD-REQUESTS ============= */

.request-card {
    border: 1px solid var(--border);
    border-radius: 1.2rem;
    box-shadow: var(--shadow);
    transition: 0.2s;
    background: var(--bg-card);
    overflow: hidden;
    color: var(--text);
}
.request-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
    border-color: var(--border-strong);
}
.request-card .card-body {
    padding: 1.25rem 1.5rem;
}

.pending-badge {
    background: var(--warning-bg);
    color: var(--warning);
    font-weight: 700;
    padding: 4px 16px;
    border-radius: 40px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.accepted-badge {
    background: var(--success-bg);
    color: var(--success);
    font-weight: 700;
    padding: 4px 16px;
    border-radius: 40px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.rejected-badge {
    background: var(--danger-bg);
    color: var(--danger);
    font-weight: 700;
    padding: 4px 16px;
    border-radius: 40px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.avatar-mini {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    border: 2px solid var(--accent);
}
.avatar-mini img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.squad-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--bg-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 3px solid var(--accent);
    flex-shrink: 0;
}
.squad-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.squad-header {
    background: linear-gradient(105deg, var(--bg-header) 0%, var(--bg-header-2) 100%);
    border-radius: 1.75rem;
    padding: 1.5rem 2rem;
    color: white;
    margin-bottom: 1.8rem;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 1.2rem;
    flex-wrap: wrap;
    border: 1px solid var(--border);
}
.squad-header .squad-title {
    font-size: 1.6rem;
    font-weight: 700;
    margin: 0;
}

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}
.filter-bar .btn-outline-filter {
    border-radius: 60px;
    padding: 6px 20px;
    border: 2px solid var(--border-strong);
    background: var(--bg-elevated);
    color: var(--text);
    font-weight: 600;
    font-size: 0.8rem;
    transition: 0.2s;
    cursor: pointer;
    font-family: inherit;
}
.filter-bar .btn-outline-filter.active {
    border-color: var(--accent);
    background: var(--accent);
    color: #0f1419;
}
.filter-bar .btn-outline-filter:hover {
    border-color: var(--accent);
}

.request-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.small-meta {
    font-size: 0.7rem;
    color: var(--text-dim);
}

/* ============= ТАБЫ И МИНИ-КАРТОЧКИ КОЛЛЕКЦИЙ ============= */

.collection-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 1.5rem;
}

.collection-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 60px;
    border: 2px solid transparent;
    background: var(--bg-card);
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text);
    cursor: pointer;
    transition: 0.2s;
    box-shadow: 0 4px 10px -6px rgba(0,0,0,0.4);
    user-select: none;
}

.collection-tab:hover {
    transform: translateY(-2px);
    border-color: var(--border-strong);
}

.collection-tab .tab-count {
    background: rgba(255,255,255,0.1);
    padding: 1px 9px;
    border-radius: 30px;
    font-size: 0.7rem;
}

.collection-tab.active {
    color: #0f1419;
    box-shadow: 0 8px 18px -8px rgba(0,0,0,0.6);
}
.collection-tab.active .tab-count {
    background: rgba(0,0,0,0.18);
    color: #0f1419;
}

/* Мини-карточки коллекций */
.collection-mini-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 2rem;
}

.collection-mini {
    background: var(--bg-card);
    border-radius: 1.2rem;
    padding: 14px;
    cursor: pointer;
    transition: 0.2s;
    border: 2px solid transparent;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow);
    color: var(--text);
}

.collection-mini:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    border-color: rgba(255, 205, 0, 0.35);
}

.collection-mini.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(255,205,0,0.18), var(--shadow-hover);
}

.collection-mini-logo {
    width: 100%;
    aspect-ratio: 5 / 3;
    border-radius: 1rem;
    background: linear-gradient(135deg, var(--bg-header) 0%, var(--bg-header-2) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 8px;
    position: relative;
}

.collection-mini-logo::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 1rem;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06);
    pointer-events: none;
}

.collection-mini-logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    position: relative;
    z-index: 1;
}

.collection-mini-logo .placeholder {
    font-size: 2.2rem;
    opacity: 0.35;
}

.collection-mini-title {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text);
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    min-height: 2.1em;
}

.collection-mini-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.7rem;
    color: var(--text-muted);
    gap: 6px;
}

.collection-mini-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 30px;
    font-size: 0.65rem;
    font-weight: 700;
}

.collection-mini .diamond-mark {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 0.9rem;
    filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));
    z-index: 2;
}

.collection-mini-designer {
    font-size: 0.65rem;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    gap: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.collection-mini-designer img {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    object-fit: cover;
}

/* ============= МОДАЛКА ============= */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s, visibility 0.25s;
}

.modal-overlay.open {
    opacity: 1;
    visibility: visible;
}

.modal-dialog {
    background: var(--bg-card);
    border-radius: 24px;
    width: 100%;
    max-width: 1100px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow-modal);
    border: 1px solid var(--border);
    transform: scale(0.95);
    transition: transform 0.25s;
}

.modal-overlay.open .modal-dialog {
    transform: scale(1);
}

.modal-header {
    background: linear-gradient(105deg, var(--bg-header) 0%, var(--bg-header-2) 100%);
    color: white;
    padding: 1.1rem 1.6rem;
    border-bottom: 3px solid var(--accent);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 3;
}

.modal-header-left {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    flex: 1;
}

.modal-header-logo {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: rgba(0,0,0,0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 6px;
    flex-shrink: 0;
    border: 1px solid rgba(255,255,255,0.08);
}
.modal-header-logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 800;
    color: #fff;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.modal-header-designer {
    font-size: 0.7rem;
    color: rgba(232,237,242,0.65);
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 3px;
}
.modal-header-designer img {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    object-fit: cover;
}

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

.modal-close {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    transition: 0.2s;
    flex-shrink: 0;
}
.modal-close:hover {
    background: rgba(255,255,255,0.22);
    transform: rotate(90deg);
}

.modal-body {
    overflow-y: auto;
    padding: 1.6rem;
    flex: 1;
    -webkit-overflow-scrolling: touch;
}

.modal-body::-webkit-scrollbar {
    width: 10px;
}
.modal-body::-webkit-scrollbar-track {
    background: transparent;
}
.modal-body::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.12);
    border-radius: 10px;
    border: 2px solid var(--bg-card);
}
.modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.22);
}

.modal-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 1.4rem;
}

.modal-section-title {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
    border-left: 4px solid var(--accent);
    padding-left: 12px;
}

/* Мобильная модалка — на весь экран */
@media (max-width: 640px) {
    .modal-overlay {
        padding: 0;
        align-items: flex-end;
    }
    .modal-dialog {
        border-radius: 24px 24px 0 0;
        max-height: 95vh;
        max-width: 100%;
        transform: translateY(100%);
    }
    .modal-overlay.open .modal-dialog {
        transform: translateY(0);
    }
    .modal-header {
        padding: 0.9rem 1rem;
    }
    .modal-header-logo {
        width: 42px;
        height: 42px;
        border-radius: 12px;
    }
    .modal-header h3 {
        font-size: 1rem;
    }
    .modal-body {
        padding: 1rem;
    }
    .modal-close {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
    .modal-pills .stat-pill {
        font-size: 0.75rem;
        padding: 5px 12px;
    }
}

/* ============= СЕТКА ФИШЕК В МОДАЛКЕ ============= */
/* В игре всегда 3 в ряд — сохраняем это и здесь */

.modal-chips-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    width: 100%;
}

@media (max-width: 900px) {
    .modal-chips-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
    }
}

@media (max-width: 480px) {
    .modal-chips-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .modal-chip-card {
        max-width: 320px;
        margin: 0 auto;
        width: 100%;
    }
    .modal-chip-image {
        border-radius: 16px;
        padding: 12px;
    }
    .modal-chip-number {
        font-size: 0.8rem;
        padding: 3px 14px;
    }
}

.modal-chip-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.modal-chip-image {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: linear-gradient(135deg, #1a2639 0%, #0f172a 100%);
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
    transition: transform 0.2s, border-color 0.2s;
    position: relative;
}

.modal-chip-card:hover .modal-chip-image {
    transform: translateY(-3px);
    border-color: rgba(255, 205, 0, 0.4);
}

.modal-chip-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.modal-chip-number {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text);
    background: rgba(255, 255, 255, 0.06);
    padding: 3px 14px;
    border-radius: 30px;
    border: 1px solid var(--border);
    line-height: 1.2;
    white-space: nowrap;
}



/* Блокировка скролла body при открытой модалке */
body.modal-open {
    overflow: hidden;
}

/* Адаптив для Finder / общих элементов */
@media (max-width: 768px) {
    .chip-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 0.75rem;
    }
    .chip-image-wrapper {
        min-height: 90px;
    }
    .chip-info {
        padding: 0.4rem 0.6rem 0.6rem;
    }
}

@media (max-width: 480px) {
    .chip-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 0.5rem;
    }
    .chip-image-wrapper {
        min-height: 70px;
    }
    .chip-status-icon {
        width: 26px;
        height: 26px;
        font-size: 1rem;
        top: 4px;
        right: 4px;
    }
    .chip-grade-badge {
        font-size: 0.5rem;
        padding: 1px 6px;
        bottom: 4px;
        left: 4px;
    }
    .squad-header {
        padding: 1rem 1.2rem;
    }
    .squad-header .squad-title {
        font-size: 1.2rem;
    }
    .squad-avatar {
        width: 50px;
        height: 50px;
    }
    .avatar-frame {
        width: 50px;
        height: 50px;
    }
    .collection-mini-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 10px;
    }
    .collection-mini {
        padding: 10px;
    }
    .collection-mini-title {
        font-size: 0.78rem;
    }
}