/* ═══════════════════════════════════════════════════════════════════════
   aurora-ui.css v1 — общие компоненты дизайн-системы «Aurora Dossier».
   Требует aurora-tokens.css. Классы с префиксом au- (не конфликтуют с легаси).
   Все нетривиальные анимации глушатся в html.perf-low и prefers-reduced-motion.
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Фон: слой 1 — статичные aurora-пятна (blur считается один раз) ── */
.ambient{position:fixed;inset:0;z-index:-2;background:var(--bg);overflow:hidden;transition:background .5s}
.ambient::before,.ambient::after{content:"";position:absolute;border-radius:50%;
  filter:blur(90px);opacity:var(--amb);transition:background .6s,opacity .5s}
/* Сферы следуют пользовательскому акценту: --aurora-1/glow задаёт accent-color.js
   под выбранный цвет (тема-aware). Дефолт (коралл) → фолбэк на --accent. */
.ambient::before{width:70vmax;height:70vmax;left:-15vmax;top:-22vmax;
  background:radial-gradient(circle,var(--aurora-1,var(--accent)),transparent 62%)}
.ambient::after{width:62vmax;height:62vmax;right:-18vmax;bottom:-20vmax;
  background:radial-gradient(circle,var(--aurora-glow,color-mix(in srgb,var(--accent) 65%,var(--coral))),transparent 60%)}
/* Фон: слой 2 — canvas с частицами (рисует aurora-ambient.js) */
#fx{position:fixed;inset:0;z-index:-1;pointer-events:none}

/* ── Стеклянная сцена (≤1–2 на экран!) ── */
.au-scene{position:relative;background:var(--card);border:1px solid var(--card-brd);
  border-radius:var(--r-xl);box-shadow:var(--shadow),inset 0 1px 0 var(--sheen);
  -webkit-backdrop-filter:blur(22px) saturate(1.2);backdrop-filter:blur(22px) saturate(1.2);
  transition:background .4s,border-color .4s}
.au-scene::before{content:"";position:absolute;inset:0;pointer-events:none;border-radius:inherit;
  background:radial-gradient(120% 60% at 50% -10%,var(--sheen),transparent 60%)}

/* ── Плоская вложенная панель (НЕ стекло) ── */
.au-panel{background:var(--panel);border:1px solid var(--line);border-radius:var(--r-l)}

/* ── Стат-чип с иконкой (цвет через --c) ── */
.au-chip{display:flex;align-items:center;gap:10px;padding:11px 12px;border-radius:14px;
  background:var(--panel);border:1px solid var(--line)}
.au-chip .ci{width:30px;height:30px;border-radius:9px;display:grid;place-items:center;flex-shrink:0;
  font-size:15px;color:var(--c,var(--accent));
  background:color-mix(in srgb,var(--c,var(--accent)) 18%,transparent);
  border:1px solid color-mix(in srgb,var(--c,var(--accent)) 42%,transparent)}
.au-chip .cn{font-size:11px;font-weight:700;color:var(--muted)}
.au-chip .cv{font-size:16px;font-weight:800;letter-spacing:-.01em}
.au-chip.locked{opacity:.6;border-style:dashed}
.au-chip.locked .cv{color:var(--dim)}

/* ── Кнопки ── */
.au-btn{display:inline-flex;align-items:center;justify-content:center;gap:10px;
  min-height:48px;padding:14px 20px;border-radius:14px;font-weight:800;font-size:16px;color:#fff;
  background:linear-gradient(100deg,var(--violet),var(--coral));
  box-shadow:0 14px 34px -12px rgba(233,74,117,.55);transition:transform .18s,box-shadow .18s}
.au-btn:hover{transform:translateY(-2px)}
.au-btn:active{transform:scale(.98)}
.au-btn-2{display:inline-flex;align-items:center;justify-content:center;gap:8px;
  min-height:46px;padding:12px 18px;border-radius:12px;font-weight:700;font-size:14px;color:var(--text);
  background:var(--panel);border:1px solid var(--line);transition:border-color .18s,transform .18s}
.au-btn-2:hover{border-color:color-mix(in srgb,var(--accent) 40%,var(--line))}
.au-btn-2:active{transform:scale(.98)}
.au-btn-ghost{display:inline-flex;align-items:center;justify-content:center;gap:8px;
  min-height:42px;padding:10px 14px;background:none;border:none;color:var(--muted);font-weight:700;font-size:14px}
.au-btn-ghost:hover{color:var(--text)}

/* ── Eyebrow (надзаголовок) ── */
.au-eye{font-size:12px;font-weight:800;letter-spacing:.16em;text-transform:uppercase;
  color:var(--accent);display:inline-flex;align-items:center;gap:8px}
.au-eye i{font-size:14px}

/* ── Display-число/слово (градиент-текст, tabular-nums) ── */
.au-display{font-weight:800;letter-spacing:-.04em;line-height:.95;font-variant-numeric:tabular-nums;
  background:linear-gradient(120deg,var(--grad-base),var(--accent));
  -webkit-background-clip:text;background-clip:text;color:transparent}
.au-num{font-variant-numeric:tabular-nums}

/* ── PRO-бейдж ── */
.au-pro{display:inline-block;font-size:10px;font-weight:900;letter-spacing:.06em;color:#241700;
  background:linear-gradient(100deg,#FFD879,var(--gold));padding:2px 7px;border-radius:6px;
  box-shadow:0 2px 10px rgba(224,162,27,.45)}

/* ── Кольцо (медаль/прогресс) ── */
.au-ring{position:relative;width:132px;height:132px}
.au-ring .rc{position:absolute;inset:0;border-radius:50%;
  background:conic-gradient(var(--violet),var(--coral) .62turn,var(--line) .62turn);
  -webkit-mask:radial-gradient(circle,transparent 61%,#000 62%);mask:radial-gradient(circle,transparent 61%,#000 62%);
  animation:au-spin 20s linear infinite}
.au-ring .ic{position:absolute;inset:15%;border-radius:50%;background:var(--panel);border:1px solid var(--line);
  display:grid;place-items:center;color:var(--accent);font-size:42px}
@keyframes au-spin{to{transform:rotate(1turn)}}

/* ── Бейдж-награда (диск) ── */
.au-badge{display:flex;flex-direction:column;align-items:center;gap:8px}
.au-badge .disc{width:54px;height:54px;border-radius:50%;display:grid;place-items:center;font-size:22px;color:#fff;
  background:linear-gradient(150deg,color-mix(in srgb,var(--bc,var(--accent)) 78%,#fff),var(--bc,var(--accent)));
  box-shadow:0 8px 18px -8px color-mix(in srgb,var(--bc,var(--accent)) 65%,transparent),inset 0 1px 0 rgba(255,255,255,.45)}
.au-badge .bt{font-size:10.5px;color:var(--muted);text-align:center;line-height:1.2;max-width:82px;font-weight:600}
.au-badge.locked .disc{background:var(--panel);border:1.5px dashed var(--line);color:var(--muted);font-size:16px;font-weight:800}

/* ── Тост ── */
.au-toast{position:fixed;left:50%;bottom:26px;transform:translate(-50%,20px);background:var(--text);color:var(--bg);
  font-weight:700;font-size:14px;padding:11px 20px;border-radius:999px;z-index:2000;opacity:0;pointer-events:none;
  transition:.3s;box-shadow:0 12px 40px rgba(0,0,0,.3)}
.au-toast.show{opacity:1;transform:translate(-50%,0)}

/* ── Пустое состояние ── */
.au-empty{text-align:center;padding:36px 20px}
.au-empty .ei{font-size:38px;color:var(--dim);margin-bottom:12px}
.au-empty .et{font-size:15px;color:var(--muted);line-height:1.5;margin-bottom:18px}

/* ── Скелетон ── */
.au-sk{background:linear-gradient(90deg,var(--panel) 25%,var(--line) 37%,var(--panel) 63%);
  background-size:200% 100%;animation:au-sk 1.3s ease-in-out infinite;border-radius:8px}
@keyframes au-sk{0%{background-position:-200% 0}100%{background-position:200% 0}}

/* ── Анимации входа (активируются классом .in на родителе, stagger по nth-child) ── */
.au-pop{opacity:0;transform:translateY(20px) scale(.92)}
.in .au-pop{animation:au-pop .55s cubic-bezier(.2,1.4,.3,1) both}
@keyframes au-pop{to{opacity:1;transform:none}}
.au-fade{opacity:0}
.in .au-fade{animation:au-fade .5s ease both}
@keyframes au-fade{to{opacity:1;transform:none}}
.in .au-pop:nth-child(1){animation-delay:.04s}.in .au-pop:nth-child(2){animation-delay:.09s}
.in .au-pop:nth-child(3){animation-delay:.14s}.in .au-pop:nth-child(4){animation-delay:.19s}
.in .au-pop:nth-child(5){animation-delay:.24s}.in .au-pop:nth-child(6){animation-delay:.29s}
.in .au-pop:nth-child(7){animation-delay:.34s}.in .au-pop:nth-child(8){animation-delay:.39s}

/* ── Доступность ── */
.au-scope :focus-visible,:focus-visible.au-btn,:focus-visible.au-btn-2{outline:2px solid var(--coral);outline-offset:3px;border-radius:6px}

/* ── Глушение тяжёлого (ручной perf-low + системный reduced-motion) ── */
html.perf-low .au-ring .rc,
html.perf-low .in .au-pop,
html.perf-low .in .au-fade,
html.perf-low .au-sk{animation:none!important}
html.perf-low .au-pop,html.perf-low .au-fade{opacity:1;transform:none}
@media (prefers-reduced-motion:reduce){
  .au-ring .rc,.in .au-pop,.in .au-fade,.au-sk{animation:none!important}
  .au-pop,.au-fade{opacity:1;transform:none}
  .au-btn,.au-btn-2{transition:none}
}

/* ═══ Единая кнопка «назад» + хедер-экшены во всех разделах ═══
   html body — чтобы перебить инлайновые .back-btn каждой страницы по specificity. */
html body .back-btn,
html body .hero-back,
html body .top__back,
html body .appbar__back,
html body .appbar__act,
html body .mini-back{
  width:40px; height:40px; min-width:40px; flex-shrink:0;
  display:inline-flex; align-items:center; justify-content:center;
  border-radius:12px; padding:0; line-height:1;
  background:var(--panel) !important; border:1px solid var(--card-brd) !important;
  color:var(--text) !important; font-size:18px; font-weight:700;
  cursor:pointer; box-shadow:none !important;
  -webkit-backdrop-filter:blur(8px); backdrop-filter:blur(8px);
  transition:background .15s, border-color .15s, transform .1s;
}
html body .back-btn:hover,
html body .hero-back:hover,
html body .top__back:hover,
html body .appbar__back:hover,
html body .mini-back:hover{
  background:color-mix(in srgb, var(--accent) 12%, var(--panel)) !important;
  border-color:color-mix(in srgb, var(--accent) 34%, var(--card-brd)) !important;
}
html body .back-btn:active,
html body .hero-back:active,
html body .top__back:active,
html body .appbar__back:active,
html body .appbar__act:active,
html body .mini-back:active{ transform:scale(.94); }

/* ═══ Единый стиль чат-инпутов во всех разделах (турниры/тусовка/дуэль) ═══ */
html body .chat-input-panel{ background:transparent !important; border:none !important; box-shadow:none !important; }
html body .chat-textarea, html body .chat-inp{
  background:var(--panel) !important; border:1px solid var(--card-brd) !important;
  color:var(--text) !important; border-radius:14px !important;
}
html body .chat-textarea:focus, html body .chat-inp:focus{
  border-color:color-mix(in srgb, var(--accent) 50%, var(--card-brd)) !important;
  box-shadow:0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent) !important;
}
html body .chat-send-circle, html body .chat-send-btn{
  background:linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 62%, #000)) !important;
  color:#fff !important; border:none !important;
}
/* Пилюли-ответы в чате турниров — чистые панели (иконка внутри различает режим) */
html body .chat-action-pills .pill-btn{
  background:var(--panel) !important; border:1px solid var(--card-brd) !important; color:var(--text) !important;
}

/* ═══ Единая стрелка «назад» (← как в ЧГК/СИ) на всех страницах ═══
   Прячем исходный глиф/иконку, рисуем один ← через ::before.
   .appbar__act (кнопка профиля) НЕ трогаем — там своя иконка. */
html body .back-btn, html body .hero-back, html body .top__back,
html body .appbar__back, html body .mini-back{ font-size:0 !important; }
html body .back-btn > i, html body .hero-back > i, html body .top__back > i,
html body .appbar__back > i, html body .mini-back > i,
html body .back-btn > svg, html body .mini-back > svg{ display:none !important; }
html body .back-btn::before, html body .hero-back::before, html body .top__back::before,
html body .appbar__back::before, html body .mini-back::before{
  content:"\2190"; font-size:19px; font-weight:400; line-height:1; color:var(--text);
}
/* ═══ Чат: убрать системный скроллбар в поле ввода (турниры/тусовка/дуэль) ═══ */
html body .chat-textarea, html body .chat-inp{ scrollbar-width:none !important; }
html body .chat-textarea::-webkit-scrollbar,
html body .chat-inp::-webkit-scrollbar{ display:none !important; width:0 !important; height:0 !important; }

/* ═══ Тонкий современный скроллбар везде (вместо системного «толстого» со стрелками) ═══
   Применяется ко всем модалкам/контейнерам. .chat-textarea (скрыт) перебивает точечно. */
*::-webkit-scrollbar{ width:8px; height:8px; }
*::-webkit-scrollbar-track{ background:transparent; }
*::-webkit-scrollbar-thumb{ background:var(--card-brd); border-radius:999px; }
*::-webkit-scrollbar-thumb:hover{ background:var(--muted); }
*{ scrollbar-width:thin; scrollbar-color:var(--card-brd) transparent; }

/* Стрелка «назад» без подчёркивания (в архиве это <a>) */
html body .back-btn, html body .hero-back, html body .top__back,
html body .appbar__back, html body .mini-back{ text-decoration:none !important; }
/* Кнопка «?» (правила) в дуэлях использует класс .back-btn, но это НЕ «назад» —
   вернуть исходный знак вопроса, убрать нарисованную стрелку. */
html body .back-btn[onclick*="Rules"], html body .back-btn[title*="равила"]{
  font-size:15px !important; font-weight:900 !important;
}
html body .back-btn[onclick*="Rules"]::before, html body .back-btn[title*="равила"]::before{
  content:"" !important;
}

/* ═══ Единая шапка раздела: [назад][название] слева, шрифт/размер как в тестах ═══
   Без иконок/эмодзи/подзаголовков. Цвет названия — var(--text) (белый ночью/чёрный днём). */
html body .subtitle, html body .hero-sub, html body .header-subtitle{ display:none !important; }
html body .logo, html body .hero-title, html body .header-title, html body .top__title,
html body .mini-title, html body .page-title{
  font-size:18px !important; font-weight:800 !important; letter-spacing:-.01em !important;
  color:var(--text) !important; text-align:left !important; margin:0 !important; display:block !important;
}
/* Иконки в названиях больше не рисуем */
html body .logo::before, html body .hero-title::before,
html body .header-title::before, html body .top__title::before{ content:none !important; }
