/* ============================================
   Атлас подарков Telegram (/gifts)
   ============================================ */

.page-gifts .container,
.page-gifts .main-container,
.page-gifts .tm-main.container.main-container {
    max-width: 1280px !important;
    width: 100% !important;
    margin: 0 auto !important;
    padding: 0 16px !important;
}

.ga { color: #fff; padding: 24px 0 60px; }
.ga a { color: inherit; text-decoration: none; }

/* --- Шапка --- */
.ga-hero {
    position: relative;
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    gap: 24px;
    padding: 36px;
    border-radius: 24px;
    border: 1px solid rgba(77, 178, 255, 0.18);
    background: radial-gradient(ellipse at 90% 10%, rgba(77, 178, 255, 0.18), transparent 60%), linear-gradient(135deg, #1e2c3a, #17212b);
    overflow: hidden;
}
.ga-kicker { font-size: 11px; font-weight: 700; letter-spacing: 2px; color: #4db2ff; text-transform: uppercase; }
.ga-hero h1 { font-size: clamp(28px, 4vw, 46px); line-height: 1.1; margin: 14px 0; font-weight: 800; letter-spacing: -1px; }
.ga-hero h1 em { font-style: normal; color: #4db2ff; }
.ga-hero p { color: #8b9ba8; font-size: 15px; line-height: 1.6; margin: 0; max-width: 460px; }
.ga-stats { display: flex; flex-wrap: wrap; gap: 28px; margin-top: 24px; }
.ga-stats span { display: flex; flex-direction: column; gap: 4px; color: #8b9ba8; font-size: 12px; }
.ga-stats b { font-size: 26px; color: #fff; }
.ga-hero-art { position: relative; min-height: 220px; }
.ga-hero-art .ga-art { position: absolute; width: 56%; aspect-ratio: 1; background: none; filter: drop-shadow(0 18px 24px rgba(0, 0, 0, 0.45)); }
.ga-hero-art .ga-art:nth-child(1) { left: 22%; top: 0; z-index: 2; }
.ga-hero-art .ga-art:nth-child(2) { left: 0; top: 34%; transform: rotate(-10deg); }
.ga-hero-art .ga-art:nth-child(3) { right: 0; top: 30%; transform: rotate(10deg); }
.ga-back { display: inline-flex; align-items: center; gap: 6px; color: #8b9ba8 !important; font-size: 14px; margin-bottom: 14px; }
.ga-back:hover { color: #fff !important; }

/* --- Панель поиска --- */
.ga-toolbar { display: flex; flex-wrap: wrap; gap: 12px; margin: 24px 0 18px; align-items: center; }
.ga-search { flex: 1 1 260px; position: relative; }
.ga-search input {
    width: 100%; padding: 13px 16px 13px 42px; border-radius: 14px; border: 1px solid rgba(255, 255, 255, 0.1);
    background: #242e38; color: #fff; font-size: 15px; outline: none;
}
.ga-search input:focus { border-color: #4db2ff; }
.ga-search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: #8b9ba8; }
.ga-select {
    padding: 13px 14px; border-radius: 14px; border: 1px solid rgba(255, 255, 255, 0.1);
    background: #242e38; color: #fff; font-size: 14px; outline: none; cursor: pointer;
}
.ga-count { color: #8b9ba8; font-size: 14px; margin-left: auto; }
.ga-tabs { display: flex; gap: 8px; margin: 24px 0 0; flex-wrap: wrap; }
.ga-tab {
    padding: 10px 18px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04); color: #8b9ba8; font-size: 14px; font-weight: 600; cursor: pointer;
}
.ga-tab.active { background: rgba(77, 178, 255, 0.15); border-color: #4db2ff; color: #fff; }
.ga-tab b { color: #4db2ff; margin-left: 4px; }

/* --- Сетка --- */
.ga-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 16px; }
.ga-card {
    display: flex; flex-direction: column; background: #242e38; border-radius: 16px; overflow: hidden;
    border: 1px solid transparent; transition: transform 0.2s, border-color 0.2s; cursor: pointer; text-align: left;
    padding: 0; color: #fff; font: inherit;
}
.ga-card:hover { transform: translateY(-3px); border-color: rgba(77, 178, 255, 0.4); }
.ga-card:focus-visible { outline: 2px solid #4db2ff; outline-offset: 2px; }
.ga-card-art { padding: 10px; }
.ga-card-body { padding: 0 14px 14px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ga-card-title { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ga-card-meta { color: #8b9ba8; font-size: 13px; display: flex; justify-content: space-between; gap: 6px; }
.ga-rarity { color: #ffd34d; font-weight: 700; }
.ga-rarity.crafted { color: #c79bff; }

/* --- Картинка подарка: фон, узор, постер и анимация --- */
.ga-art {
    position: relative; aspect-ratio: 1; border-radius: 14px; overflow: hidden;
    background: radial-gradient(circle at 50% 45%, #2f3f50, #1c2732);
}
.ga-art.has-backdrop { background: radial-gradient(circle at 50% 45%, var(--bg-center), var(--bg-edge)); }
.ga-pattern { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(3, 1fr); padding: 6%; opacity: 0.45; pointer-events: none; }
.ga-pattern i {
    width: 34%; aspect-ratio: 1; margin: auto; background: var(--pattern, #fff);
    -webkit-mask: var(--symbol) center / contain no-repeat; mask: var(--symbol) center / contain no-repeat;
}
.ga-art .ga-poster, .ga-art lottie-player { position: absolute; inset: 8%; width: 84%; height: 84%; object-fit: contain; }
.ga-art lottie-player { opacity: 0; transition: opacity 0.2s; }
.ga-art.is-playing lottie-player { opacity: 1; }
.ga-art.is-playing .ga-poster { opacity: 0; }
.ga-unavailable { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #6d8394; font-size: 12px; }

/* --- Фоны и узоры --- */
.ga-swatch { aspect-ratio: 1; border-radius: 14px; margin: 10px; }
.ga-symbol { aspect-ratio: 1; margin: 10px; border-radius: 14px; background: #1c2732; display: flex; align-items: center; justify-content: center; }
.ga-symbol img { width: 56%; height: 56%; object-fit: contain; }

/* --- Подгрузка --- */
.ga-more[hidden] { display: none; }
.ga-more { display: flex; justify-content: center; margin-top: 24px; min-height: 48px; }
.ga-more button {
    padding: 12px 28px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.06); color: #fff; font-size: 15px; font-weight: 600; cursor: pointer;
}
.ga-empty, .ga-loading { grid-column: 1 / -1; text-align: center; color: #8b9ba8; padding: 40px 0; }

/* --- Окно модели с примеркой --- */
.ga-dialog { border: none; padding: 0; border-radius: 22px; background: #1c2732; color: #fff; width: min(760px, calc(100% - 24px)); max-height: calc(100% - 24px); }
.ga-dialog::backdrop { background: rgba(0, 0, 0, 0.65); }
.ga-dialog-body { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; padding: 24px; }
.ga-dialog header { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.ga-dialog h2 { margin: 0; font-size: 22px; }
.ga-close { background: rgba(255, 255, 255, 0.08); border: none; color: #fff; width: 36px; height: 36px; border-radius: 50%; cursor: pointer; font-size: 18px; }
.ga-dialog .ga-art { width: 100%; }
.ga-fields { display: flex; flex-direction: column; gap: 14px; }
.ga-field label { display: block; color: #8b9ba8; font-size: 13px; margin-bottom: 6px; }
.ga-field .ga-select { width: 100%; }
.ga-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 4px; }
.ga-fact { background: #242e38; border-radius: 12px; padding: 10px 12px; }
.ga-fact span { display: block; color: #8b9ba8; font-size: 12px; }
.ga-fact b { font-size: 15px; }
.ga-note { color: #6d8394; font-size: 12px; line-height: 1.5; }
.ga-cta { display: inline-flex; justify-content: center; padding: 12px 18px; border-radius: 12px; background: linear-gradient(135deg, #4db2ff, #0088cc); color: #fff !important; font-weight: 700; }

@media (max-width: 760px) {
    .ga-hero { grid-template-columns: 1fr; padding: 24px; }
    .ga-hero-art { display: none; }
    .ga-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
    .ga-dialog-body { grid-template-columns: 1fr; }
    .ga-count { width: 100%; margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
    .ga-card, .ga-art lottie-player { transition: none; }
}

/* ============================================
   Выбор из списка (как в giftrush): кнопка + панель с поиском
   ============================================ */
.ga-pick-wrap { position: relative; min-width: 0; }
.ga-pick {
    display: flex; align-items: center; gap: 12px; width: 100%; min-width: 220px; padding: 9px 14px 9px 9px;
    border-radius: 16px; border: 1px solid rgba(255, 255, 255, 0.1); background: #242e38; color: #fff;
    font: inherit; text-align: left; cursor: pointer; transition: border-color 0.2s, box-shadow 0.2s;
}
.ga-pick:hover { border-color: rgba(77, 178, 255, 0.35); }
.ga-pick[aria-expanded="true"] { border-color: #4db2ff; box-shadow: 0 0 0 4px rgba(77, 178, 255, 0.12); }
.ga-pick-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ga-pick-text small { font-size: 10px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: #6d8394; }
.ga-pick-text b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ga-pick-chevron { width: 18px; height: 18px; color: #8b9ba8; transition: transform 0.2s; flex-shrink: 0; }
.ga-pick[aria-expanded="true"] .ga-pick-chevron { transform: rotate(180deg); color: #4db2ff; }

.ga-thumb {
    width: 42px; height: 42px; border-radius: 12px; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
    background: #1c2732; border: 1px solid rgba(255, 255, 255, 0.06); color: #4db2ff; overflow: hidden;
}
.ga-thumb img { width: 82%; height: 82%; object-fit: contain; }
.ga-thumb.is-symbol img { filter: brightness(0) invert(1); width: 64%; height: 64%; }
.ga-thumb.is-color { color: rgba(255, 255, 255, 0.7); border-color: rgba(255, 255, 255, 0.15); }
.ga-thumb svg { width: 20px; height: 20px; }

.ga-pop {
    position: absolute; z-index: 60; top: calc(100% + 10px); left: 0; width: max(100%, 380px); max-width: calc(100vw - 32px);
    display: flex; flex-direction: column; border-radius: 22px; border: 1px solid rgba(255, 255, 255, 0.1);
    background: linear-gradient(180deg, #1f2b38, #19232e); box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55); overflow: hidden;
}
.ga-pop.is-up { top: auto; bottom: calc(100% + 10px); }
.ga-pop.is-right { left: auto; right: 0; }
.ga-pop-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 20px 20px 12px; }
.ga-pop-head small { display: block; font-size: 10px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: #6d8394; margin-bottom: 6px; }
.ga-pop-head h3 { margin: 0; font-size: 20px; font-weight: 800; }
.ga-pop-close {
    width: 36px; height: 36px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.1); background: rgba(255, 255, 255, 0.04);
    color: #8b9ba8; display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0;
}
.ga-pop-close svg { width: 16px; height: 16px; }
.ga-pop-search { position: relative; margin: 0 14px 10px; }
.ga-pop-search input {
    width: 100%; padding: 12px 14px 12px 42px; border-radius: 14px; border: 1px solid rgba(77, 178, 255, 0.35);
    background: #17212b; color: #fff; font-size: 15px; outline: none;
}
.ga-pop-search input:focus { border-color: #4db2ff; }
.ga-pop-search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: #8b9ba8; }
.ga-pop-list { overflow-y: auto; max-height: min(360px, 50vh); padding: 4px 8px 8px; overscroll-behavior: contain; }
.ga-pop-list::-webkit-scrollbar { width: 6px; }
.ga-pop-list::-webkit-scrollbar-thumb { background: rgba(77, 178, 255, 0.35); border-radius: 3px; }
.ga-opt {
    display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px; margin: 2px 0; border-radius: 16px;
    border: 1px solid transparent; background: none; color: #fff; font: inherit; text-align: left; cursor: pointer;
}
.ga-opt:hover, .ga-opt:focus-visible { background: rgba(255, 255, 255, 0.04); outline: none; }
.ga-opt.is-selected { border-color: rgba(77, 178, 255, 0.45); background: rgba(77, 178, 255, 0.08); }
.ga-opt-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ga-opt-text b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ga-opt-text span { font-size: 13px; color: #6d8394; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ga-opt-badge { padding: 3px 8px; border-radius: 8px; border: 1px solid rgba(255, 211, 77, 0.3); color: #ffd34d; font-size: 12px; font-weight: 600; }
.ga-opt-check { width: 26px; height: 26px; border-radius: 50%; background: #4db2ff; color: #0e1621; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ga-opt-check svg { width: 15px; height: 15px; }
.ga-pop-empty { text-align: center; color: #6d8394; padding: 24px 0; font-size: 14px; }
.ga-pop-foot { display: flex; justify-content: space-between; align-items: center; padding: 12px 20px; border-top: 1px solid rgba(255, 255, 255, 0.06); color: #6d8394; font-size: 13px; }
.ga-pop-foot em { font-style: normal; color: #4db2ff; display: inline-flex; align-items: center; gap: 6px; }
.ga-pop-foot svg { width: 14px; height: 14px; }

.ga-dialog .ga-fields .ga-pick { min-width: 0; }
.ga-pick-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

@media (max-width: 760px) {
    /* На телефоне панель — лист снизу экрана */
    .ga-pop, .ga-pop.is-up {
        position: fixed; left: 8px; right: 8px; bottom: 8px; top: auto; width: auto; max-width: none; max-height: 78vh;
    }
    .ga-pop-list { max-height: 52vh; }
    .ga-pick { min-width: 0; }
    .ga-pick-row { grid-template-columns: 1fr; }
}
/* Внутри окна примерки панель поверх окна, иначе её обрезает прокрутка окна */
.ga-pop.is-sheet { position: fixed; top: 50%; left: 50%; right: auto; bottom: auto; transform: translate(-50%, -50%); width: min(440px, calc(100vw - 24px)); }
@media (max-width: 760px) {
    .ga-pop.is-sheet { top: auto; left: 8px; right: 8px; bottom: 8px; transform: none; width: auto; }
}
