/* ==================== QUESTS (noctis — dark theme) ====================
   Страница лежит внутри <div class="col-lg-12"> — так же, как sessions и
   остальные разделы темы. Без колонки блок не получает ширину сетки и
   схлопывается влево. min-width:0 обязателен: иначе grid-элементы
   отказываются сжиматься и содержимое вылезает вправо. */
.quests-page { display: grid; gap: 18px; min-width: 0; max-width: 100%; }
.quests-page > * { min-width: 0; }

/* Плашка .shopscontainer идёт вплотную к контенту — отбиваем её */
.shopscontainer + .col-lg-12 .quests-page { margin-top: 18px; }

/* ==================== Сворачиваемые панели (история / победители) ==================== */
/* align-items:start — иначе свёрнутая панель растягивается по высоте соседней
   и превращается в пустую коробку во весь блок */
.quests-panels-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
@media (max-width: 900px) { .quests-panels-row { grid-template-columns: minmax(0, 1fr); } }

/* Раскрытие на скрытом чекбоксе — без JavaScript вообще.
   От <details> пришлось отказаться: у закрытого details содержимое браузером
   не отрисовывается, а переход «не отрисовано → отрисовано» не запускает
   transition — анимация не работала в принципе. С чекбоксом содержимое
   всегда в потоке, поэтому max-height анимируется в обе стороны.

   Чекбокс скрыт через display:none */
/* display:none, а не opacity: тема рисует чекбоксы своими стилями и они
   всё равно проступали слева от заголовка. На работу селектора :checked ~
   это не влияет — переключение идёт кликом по <label for>. */
.quests-panel-check { display: none !important; }

/* padding/margin гасим с !important: замер показал panel 78px при label 56 и
   wrap 0 — лишние 20px не входят в offsetHeight детей, значит это отступы,
   приходящие из стилей темы (у неё есть общее правило margin-bottom для label). */
.quests-panel { position: relative; background: #232323; border: 1px solid #262626; border-radius: 15px; overflow: hidden; min-width: 0; padding: 0 !important; }
.quests-panel > .quests-panel-toggle,
.quests-panel > .quests-panel-wrap,
.quests-panel > .quests-panel-check { margin: 0 !important; }

/* width:100% и box-sizing обязательны: <label> инлайновый по умолчанию,
   без них он сжимается по тексту и шеврон (margin-left:auto) липнет
   к заголовку вместо правого края панели. */
.quests-panel-toggle {
    display: flex; align-items: center; gap: 10px;
    width: 100%;
    box-sizing: border-box;
    height: 56px; min-height: 56px; padding: 0 18px; margin: 0;
    cursor: pointer; text-align: left;
    color: #e6e6e6; font-family: inherit; font-size: 16px; font-weight: 600;
    transition: background .15s ease;
}
.quests-panel-toggle:hover { background: #262626; }
.quests-panel-toggle:focus { outline: none; }

/* Плавное раскрытие через max-height. Вариант с grid-template-rows: 0fr -> 1fr
   красивее, но интерполяция fr-единиц есть только в свежих браузерах —
   в остальных трек не схлопывался и из-под шапки торчал кусок содержимого.
   640px — заведомо больше содержимого (список фиксирован в 300px). */
/* height:0 в дополнение к max-height: если какое-то правило темы задаёт
   содержимому min-height, одного max-height не хватает и из-под заголовка
   остаётся пустая полоса. Анимацию по-прежнему тянет max-height. */
.quests-panel-wrap {
    display: block;
    height: 0;
    max-height: 0;
    padding: 0;
    overflow: hidden;
    transition: max-height .3s ease;
}
.quests-panel-check:checked ~ .quests-panel-wrap { height: auto; max-height: 640px; }

/* Шеврон рисуем бордерами: юникодные стрелки в разных шрифтах
   рендерятся по-разному и выглядели инородным кружком */
.quests-panel-toggle::after {
    content: ''; margin-left: auto; flex: 0 0 auto;
    width: 9px; height: 9px;
    border-right: 2px solid #8c69fb; border-bottom: 2px solid #8c69fb;
    transform: rotate(45deg); margin-top: -4px;
    transition: transform .2s ease, margin-top .2s ease;
}
.quests-panel-check:checked ~ .quests-panel-toggle::after { transform: rotate(225deg); margin-top: 3px; }
.quests-panel-hint { color: #787878; font-size: 12px; font-weight: 400; }

/* min-height:0 обязателен — без него grid-строка не сожмётся до нуля */
.quests-panel-body { padding: 0 18px 16px; overflow: hidden; min-height: 0; }
.quests-panel-limits { display: flex; align-items: center; gap: 6px; margin: 0 0 12px; }
.quests-limit-btn {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 42px; height: 30px; padding: 0 10px;
    border: 1px solid #262626; background: #1a1a1a; color: #787878;
    border-radius: 8px; font-size: 12px; line-height: 1; cursor: pointer;
    transition: color .15s ease, background .15s ease, border-color .15s ease;
}
.quests-limit-btn:hover { color: #e6e6e6; }
.quests-limit-active { background: rgba(140, 105, 251, .14); border-color: #8c69fb; color: #8c69fb; font-weight: 700; }

/* Высота фиксирована, а не max-height: при переключении 5/15/30 панель
   не меняет размер, поэтому содержимое страницы под ней не съезжает.
   Лишние строки скрываются ниже, прокрутка — внутри списка. */
.quests-panel-list { height: 300px; overflow-y: auto; }
.quests-panel-list[data-limit="5"] > *:nth-child(n+6) { display: none; }
.quests-panel-list[data-limit="15"] > *:nth-child(n+16) { display: none; }
.quests-panel-list[data-limit="30"] > *:nth-child(n+31) { display: none; }
.quests-panel-list::-webkit-scrollbar { width: 8px; }
.quests-panel-list::-webkit-scrollbar-track { background: #1a1a1a; border-radius: 8px; }
.quests-panel-list::-webkit-scrollbar-thumb { background: #2e2e2e; border-radius: 8px; }
.quests-panel-list::-webkit-scrollbar-thumb:hover { background: #3a3846; }
.quests-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.quests-title { margin: 0; font-size: 22px; font-weight: 700; color: #e6e6e6; }
.quests-subtitle { margin: 6px 0 0; color: #7a7a7a; font-size: 14px; }
.quests-coins { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 12px; background: rgba(240, 185, 11, 0.08); border: 1px solid rgba(240, 185, 11, 0.25); color: #e6e6e6; font-size: 14px; }
.quests-coins b { color: #f0b90b; }
.quests-coins-icon { font-size: 16px; }

/* Серия и бонус — такие же компактные чипы, как баланс.
   Раньше это были три крупные карточки во всю ширину вместе с рейтингом. */
.quests-badges { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.quests-chip {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 9px 14px; border-radius: 12px;
    font-size: 14px; color: #b7b4bf; white-space: nowrap;
    background: #232323; border: 1px solid #262626;
}
.quests-chip b { color: #e6e6e6; }
.quests-chip-icon { font-size: 15px; line-height: 1; }
.quests-chip-streak { background: rgba(216, 87, 82, .08); border-color: rgba(216, 87, 82, .25); }
.quests-chip-streak b { color: #f07a6e; }
.quests-chip-bonus { background: rgba(71, 188, 138, .08); border-color: rgba(71, 188, 138, .25); }
.quests-chip-bonus b { color: #47bc8a; }
.quests-auth-note { padding: 12px 16px; border-radius: 12px; background: rgba(140, 105, 251, 0.08); border: 1px solid rgba(140, 105, 251, 0.25); color: #b7b4bf; font-size: 13px; }
.quests-dashboard { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.quests-dashboard-stat { display: flex; align-items: center; gap: 10px; padding: 13px 15px; background: #232323; border: 1px solid #262626; border-radius: 13px; }
.quests-dashboard-stat > span:last-child { display: grid; gap: 3px; }
.quests-dashboard-stat b { color: #e6e6e6; font-size: 17px; }
.quests-dashboard-stat small { color: #787878; font-size: 11px; }
.quests-dashboard-icon { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; font-size: 19px; }
.quests-icon-coin { color: #f0b90b; background: rgba(240,185,11,.12); }
.quests-icon-fire { color: #f07a6e; background: rgba(216,87,82,.12); }
.quests-icon-wheel { color: #8c69fb; background: rgba(140,105,251,.12); }
.quests-section-head { display: flex; align-items: end; justify-content: space-between; gap: 15px; flex-wrap: wrap; margin-top: 4px; }
.quests-section-head h3 { margin: 0; color: #e6e6e6; font-size: 18px; }
.quests-section-head span { display: block; margin-top: 4px; color: #787878; font-size: 12px; }
.quests-tabs { display: flex; gap: 5px; padding: 4px; border: 1px solid #262626; background: #1a1a1a; border-radius: 10px; }
.quests-tab { border: 0; border-radius: 7px; padding: 7px 10px; color: #787878; background: transparent; font-size: 12px; cursor: pointer; transition: color .15s, background .15s; }
.quests-tab:hover, .quests-tab-active { color: #e6e6e6; background: #2a2931; }

.quests-hidden { display: none !important; }
.quests-list { display: grid; gap: 12px; }
.quests-empty { text-align: center; padding: 40px; color: #7a7a7a; }

.quest-card {
    display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center;
    background: #232323; border: 1px solid #262626; border-radius: 15px; padding: 16px 18px;
    transition: border-color 0.2s ease, transform 0.15s ease;
    animation: quests-card-in .28s ease both;
}
.quest-card:hover { border-color: #2e2e2e; }
.quest-card-done { border-color: rgba(71, 188, 138, 0.4); }
.quest-card-claimed { border-color: #262626; opacity: 0.85; }

.quest-icon { width: 52px; height: 52px; border-radius: 14px; background: rgba(140, 105, 251, 0.12); display: flex; align-items: center; justify-content: center; font-size: 26px; color: #8C69FB; }
.quest-card-done .quest-icon { background: rgba(71, 188, 138, 0.14); color: #47bc8a; }

.quest-body { display: grid; gap: 8px; min-width: 0; }
.quest-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.quest-name { font-size: 16px; font-weight: 700; color: #e6e6e6; }
.quest-period { display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 999px; font-size: 10px; font-weight: 700; color: #8f8b9a; background: #1a1a1a; border: 1px solid #2a2931; }
.quest-period-daily { color: #47bc8a; border-color: rgba(71,188,138,.3); background: rgba(71,188,138,.08); }
.quest-period-weekly { color: #f0b90b; border-color: rgba(240,185,11,.3); background: rgba(240,185,11,.08); }
.quest-desc { font-size: 13px; color: #b7b4bf; }
.quests-badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.quests-badge-done { background: rgba(71, 188, 138, 0.16); color: #47bc8a; border: 1px solid rgba(71, 188, 138, 0.35); }

.quest-progress { display: grid; gap: 5px; max-width: 420px; }
.quest-progress-head { display: flex; justify-content: space-between; font-size: 12px; color: #787878; }
.quest-progress-head b { color: #b7b4bf; font-weight: 600; }
.quest-progress-bar { height: 7px; border-radius: 999px; background: #1a1a1a; border: 1px solid #262626; overflow: hidden; }
.quest-progress-fill { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #8C69FB, #b28aff); transition: width 0.4s ease; }
.quest-card-done .quest-progress-fill { background: linear-gradient(90deg, #47bc8a, #6dd5a8); }

.quest-side { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.quest-reward { display: inline-flex; align-items: center; gap: 6px; font-size: 15px; font-weight: 700; color: #f0b90b; }
.quest-reward-label { color: #787878; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.quest-reward-coin { font-size: 15px; }
.quest-state { color: #787878; font-size: 11px; }
.quest-state-done { color: #47bc8a; font-weight: 700; }
.quest-state-claimed { color: #8f8b9a; }
.quest-btn {
    min-width: 150px; padding: 9px 18px; border-radius: 10px; border: 1px solid transparent;
    background: #8C69FB; color: #fff; font-size: 13px; font-weight: 700; cursor: pointer;
    transition: background 0.15s ease, transform 0.1s ease;
}
.quest-btn:hover { background: #9b7bff; }
.quest-btn:active { transform: translateY(1px); }
.quest-btn:disabled { background: #2a2931; color: #6a6a6a; cursor: not-allowed; }
.quest-card-done .quest-btn:not(:disabled) { background: #47bc8a; }
.quest-card-done .quest-btn:not(:disabled):hover { background: #5cc99a; }
.quest-card-filtered-out { display: none; }
@keyframes quests-card-in { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }

@media (max-width: 640px) {
    .quests-dashboard { grid-template-columns: 1fr; }
    .quest-card { grid-template-columns: auto 1fr; }
    .quest-side { grid-column: 1 / -1; flex-direction: row; justify-content: space-between; align-items: center; }
    .quest-btn { min-width: 140px; }
}

/* ==================== Кейс удачи ==================== */
.quests-case-card { padding: 24px; background: linear-gradient(160deg, #1d1a2b 0%, #232323 55%, #1a1a1a 100%); border: 1px solid rgba(140, 105, 251, 0.28); border-radius: 20px; box-shadow: 0 18px 50px rgba(0, 0, 0, 0.4); overflow: hidden; }
.quests-case-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.quests-case-kicker { color: #f0b90b; text-transform: uppercase; letter-spacing: 1.5px; font-size: 11px; font-weight: 800; }
.quests-case-title { margin: 5px 0 8px; color: #f3efff; font-size: 26px; }
.quests-case-subtitle { margin: 0; color: #b7b4bf; font-size: 13px; line-height: 1.5; max-width: 460px; }
.quests-case-meta { display: flex; flex-direction: column; gap: 6px; color: #787878; font-size: 12px; }
.quests-case-meta b { color: #e6e6e6; }

.quests-case-tabs { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 16px; }
.quests-case-tab { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border: 1px solid #2e2e36; border-radius: 999px; background: #1a1a1a; color: #b7b4bf; font-size: 13px; cursor: pointer; transition: color .15s, border-color .15s, background .15s; }
.quests-case-tab:hover { color: #e6e6e6; border-color: #3a3846; }
.quests-case-tab-active { color: #fff; background: linear-gradient(135deg, #8c69fb, #6d4fe0); border-color: transparent; }
.quests-case-tab iconify-icon { font-size: 15px; }

/* Окно просмотра обрезает содержимое, лента внутри свободно едет.
   Раньше overflow:hidden стоял на .quests-case-track — на самой движущейся
   ленте. Её содержимое обрезалось по ширине контейнера, и при сдвиге видимый
   кусок просто уезжал за край: сцена оказывалась пустой. */
.quests-case-stage { position: relative; padding: 26px 0; margin-bottom: 18px; overflow: hidden; }
.quests-case-track { display: flex; gap: 10px; overflow: visible; padding: 4px 0; width: max-content; will-change: transform; }
.quests-case-item { flex: 0 0 120px; }
/* Фиксированная высота: без неё карточки с двухстрочным названием
   («Спонсор на 30 дней») выше соседних и лента выглядит рваной */
.quests-case-item-inner { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; height: 124px; padding: 12px 10px; border-radius: 14px; background: linear-gradient(180deg, #2a2931, #1f1f24); border: 1px solid #2e2e36; transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease; }
.quests-case-item-icon { flex: 0 0 auto; width: 46px; height: 46px; display: flex; align-items: center; justify-content: center; border-radius: 12px; font-size: 24px; color: #f0b90b; background: rgba(240, 185, 11, 0.1); }
.quests-case-item-name { color: #e6e6e6; font-size: 12px; font-weight: 700; text-align: center; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Холостая прокрутка до открытия: лента медленно едет влево ровно на ширину
   одного набора призов и зацикливается — стык незаметен, потому что дальше
   идёт тот же набор. --quests-set-width проставляет JS после отрисовки. */
.quests-case-idle { animation: quests-case-drift 32s linear infinite; }
.quests-case-idle:hover { animation-play-state: paused; }
@keyframes quests-case-drift {
    from { transform: translateX(0); }
    to   { transform: translateX(calc(var(--quests-set-width, 1040px) * -1)); }
}
.quests-case-item.is-win .quests-case-item-inner { border-color: #f0b90b; box-shadow: 0 0 0 2px rgba(240, 185, 11, 0.35), 0 10px 30px rgba(240, 185, 11, 0.25); transform: scale(1.06); }
.quests-case-marker { position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; margin-left: -1px; background: linear-gradient(180deg, transparent, #f0b90b 20%, #f0b90b 80%, transparent); z-index: 2; }
.quests-case-glow { position: absolute; top: 0; bottom: 0; left: 50%; width: 140px; margin-left: -70px; background: radial-gradient(ellipse at center, rgba(240, 185, 11, 0.12), transparent 70%); pointer-events: none; z-index: 1; }

.quests-case-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.quests-case-btn { min-height: 42px; padding: 10px 18px; border-radius: 12px; font-size: 13px; font-weight: 700; cursor: pointer; border: 1px solid transparent; transition: opacity .15s, transform .15s, box-shadow .15s; }
.quests-case-btn:disabled { opacity: .45; cursor: not-allowed; }
.quests-case-btn-primary { background: linear-gradient(135deg, #8c69fb, #6d4fe0); color: #fff; box-shadow: 0 8px 22px rgba(140, 105, 251, 0.35); }
.quests-case-btn-primary:not(:disabled):hover { box-shadow: 0 10px 28px rgba(140, 105, 251, 0.5); }
.quests-case-btn-free { background: rgba(71, 188, 138, 0.12); color: #47bc8a; border-color: rgba(71, 188, 138, 0.35); }
.quests-case-btn:not(:disabled):active { transform: translateY(1px); }
.quests-case-code { display: flex; gap: 7px; margin-left: auto; }
.quests-case-code input { width: 200px; padding: 10px 12px; border: 1px solid #3a3846; border-radius: 10px; background: #1a1a1a; color: #e6e6e6; }
.quests-case-code button { border: 1px solid #3a3846; border-radius: 10px; background: #2a2931; color: #e6e6e6; padding: 0 14px; cursor: pointer; }
/* Текущее значение прогресса — акцентируем, чтобы «5 / 10» читалось с одного взгляда */
.quest-value { color: #8c69fb; font-weight: 700; }

.quests-case-result { min-height: 22px; margin-top: 14px; color: #47bc8a; font-size: 14px; font-weight: 700; text-align: center; }
.quests-case-result-error { color: #f07a6e; }
.quests-win-flash { animation: quests-win-flash 0.5s ease 2; }
@keyframes quests-win-flash { 0%, 100% { box-shadow: 0 18px 50px rgba(0, 0, 0, 0.4); } 50% { box-shadow: 0 0 0 3px rgba(240, 185, 11, 0.55), 0 18px 60px rgba(240, 185, 11, 0.45); } }
/* Ваучер прижат вправо только когда рядом реально есть место. Ниже 900px он
   становится отдельной строкой на всю ширину — иначе он то влезает в строку
   с кнопками, то перескакивает под них, и блок «прыгает». */
@media (max-width: 900px) {
    .quests-case-actions { flex-wrap: wrap; }
    .quests-case-btn { flex: 1 1 auto; }
    .quests-case-code { margin-left: 0; width: 100%; flex-basis: 100%; }
    .quests-case-code input { flex: 1 1 auto; width: auto; min-width: 0; }
    .quests-case-code button { flex: 0 0 auto; }
}
@media (max-width: 640px) { .quests-case-item { flex-basis: 96px; } }
.quests-history-card { padding: 18px; background: #232323; border: 1px solid #262626; border-radius: 15px; }
.quests-history-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.quests-history-head h3 { margin: 0; color: #e6e6e6; font-size: 17px; }
.quests-history-head span, .quests-history-empty { color: #787878; font-size: 12px; }
.quests-history-list { display: grid; gap: 7px; }
.quests-history-row { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center; padding: 9px 10px; background: #1a1a1a; border: 1px solid #262626; border-radius: 9px; font-size: 12px; }
.quests-history-name { color: #e6e6e6; font-weight: 700; }
.quests-history-status { color: #47bc8a; }
.quests-history-meta { color: #787878; white-space: nowrap; }
@media (max-width: 620px) { .quests-history-row { grid-template-columns: 1fr auto; } .quests-history-meta { grid-column: 1 / -1; } }
.quests-winners-card { padding: 18px; background: #232323; border: 1px solid #262626; border-radius: 15px; }
.quests-winners-list { display: grid; gap: 6px; }
.quests-winner-row { display: grid; grid-template-columns: 1fr auto auto auto; gap: 10px; align-items: center; padding: 8px 10px; background: #1a1a1a; border: 1px solid #262626; border-radius: 9px; font-size: 12px; }
.quests-winner-name { color: #e6e6e6; font-weight: 700; }
.quests-winner-prize { color: #f0b90b; font-weight: 700; }
.quests-winner-wheel { color: #8c69fb; }
.quests-winner-time { color: #787878; white-space: nowrap; }
@media (max-width: 620px) { .quests-winner-row { grid-template-columns: 1fr auto; } .quests-winner-wheel, .quests-winner-time { grid-column: 1 / -1; } }
.quests-summary-row { display: grid; grid-template-columns: minmax(160px, .55fr) minmax(140px, .45fr) minmax(0, 1.35fr); gap: 12px; }
.quests-streak-card, .quests-leaderboard-card, .quests-streak-bonus { padding: 16px; background: #232323; border: 1px solid #262626; border-radius: 15px; }
.quests-streak-card { display: flex; align-items: center; gap: 12px; }
.quests-streak-bonus { display: flex; align-items: center; }
.quests-streak-bonus div { display: grid; gap: 4px; }
.quests-streak-bonus b { color: #47bc8a; font-size: 20px; }
.quests-streak-bonus span { color: #787878; font-size: 12px; }
.quests-summary-icon { font-size: 28px; }
.quests-streak-card div { display: grid; gap: 4px; }
.quests-streak-card b { color: #f0b90b; font-size: 20px; }
.quests-streak-card span { color: #787878; font-size: 12px; }
.quests-leader-list { display: grid; gap: 6px; }
.quests-leader-row { display: grid; grid-template-columns: 24px 1fr auto; gap: 8px; align-items: center; color: #b7b4bf; font-size: 12px; }
.quests-leader-row b { color: #f0b90b; }
.quests-leader-row a { color: #e6e6e6; text-decoration: none; }
.quests-leader-row span { color: #8c69fb; font-weight: 700; }
@media (max-width: 620px) { .quests-summary-row { grid-template-columns: 1fr; } }
