/* ==========================================================================
   app.css — раскладка и компоненты мини-аппки арены (стиль Schale)
   ========================================================================== */

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }

/* Полоса прокрутки скрыта, но скролл работает — иначе появление/исчезновение
   нативного скроллбара сдвигает ширину и «ломает» вёрстку. */
html { scrollbar-width: none; -ms-overflow-style: none; }
html::-webkit-scrollbar, body::-webkit-scrollbar { width: 0; height: 0; display: none; }
.overlay-sheet, .filters { scrollbar-width: none; -ms-overflow-style: none; }
.overlay-sheet::-webkit-scrollbar, .filters::-webkit-scrollbar { width: 0; height: 0; display: none; }

body {
  font-family: var(--font-body);
  color: var(--text);
  background:
    linear-gradient(var(--bg-grid) 1px, transparent 1px) 0 0 / 100% 30px,
    linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px) 0 0 / 30px 100%,
    var(--bg);
  min-height: 100vh;
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
  line-height: 1.45;
}
/* фиксированное сияние-нимб вверху — глубина без «дёрганья» при скролле */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(135% 62% at 50% -14%, var(--top-glow), transparent 58%),
    radial-gradient(90% 40% at 100% 0%, var(--top-glow), transparent 60%);
}

.app {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(var(--safe-top) + 8px) 0 calc(var(--nav-h) + var(--safe-bottom) + 12px);
  min-height: 100vh;
}

/* ── ШАПКА / НИМБ ─────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 10px;
  padding: calc(var(--safe-top) + 6px) var(--pad) 10px;
  margin-top: calc(-1 * var(--safe-top) - 8px);   /* компенсируем верхний паддинг .app */
  background: var(--header-bg); backdrop-filter: blur(9px); -webkit-backdrop-filter: blur(9px);
  border-bottom: 1px solid var(--line);
}
.topbar::after {   /* тонкий акцент-нимб под шапкой */
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent); opacity: .5;
}
.brand {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-head); font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase;
  font-size: 15px; color: var(--text);
}
.halo {
  width: 18px; height: 18px; border-radius: 50%;
  border: 3px solid var(--halo);
  box-shadow: 0 0 10px var(--halo);
  transform: rotate(-18deg);
  flex: none;
}
.brand .sub { color: var(--cyan-deep); }
.topbar .spacer { flex: 1; }

/* переключатель персоны Арона/Плана */
.theme-toggle {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--r-pill); padding: 5px 11px 5px 9px;
  transform: skewX(var(--skew)); box-shadow: var(--sh-1);
  transition: box-shadow .15s ease, transform .1s ease;
}
.theme-toggle > * { transform: skewX(calc(-1 * var(--skew))); }
.theme-toggle:active { transform: skewX(var(--skew)) scale(0.96); }
.theme-toggle .tt-halo {
  width: 13px; height: 13px; border-radius: 50%;
  border: 3px solid var(--halo); box-shadow: 0 0 8px var(--halo);
  flex: none;
}
.theme-toggle .tt-name {
  font-family: var(--font-head); font-weight: 600; font-size: 11px;
  letter-spacing: .1em; color: var(--cyan-deep);
}

/* ── ЗАГОЛОВОК ЭКРАНА (скошенный акцент) ──────────────────────── */
.screen-head {
  display: flex; align-items: center; gap: 10px;
  padding: 4px var(--pad) 12px;
}
.screen-head .tag {
  font-family: var(--font-head); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  font-size: 19px;
}
.slant {
  display: inline-block; transform: skewX(var(--skew));
  background: var(--cyan); color: var(--on-accent);
  padding: 2px 12px; box-shadow: var(--sh-accent);
}
.slant > * { display: inline-block; transform: skewX(calc(-1 * var(--skew))); }

/* ── КАРТОЧКА (общая) ─────────────────────────────────────────── */
.card {
  position: relative; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-card);
  box-shadow: var(--sh-1); overflow: hidden;
}
.card::before {  /* фирменная цветная полоса сверху */
  content: ""; position: absolute; top: 0; left: 0; right: 0;
  height: var(--stripe); background: var(--accent, var(--cyan));
}

/* ── СЕТКА КОЛЛЕКЦИИ ──────────────────────────────────────────── */
.grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 10px; padding: 0 var(--pad);
}
.unit {
  cursor: pointer; padding: 7px 7px 8px; text-align: center;
  transition: transform .12s ease, box-shadow .12s ease;
}
.unit:active { transform: translateY(1px) scale(0.985); }
.unit .portrait {
  width: 100%; aspect-ratio: 1 / 1.08; border-radius: var(--r-card);
  display: grid; place-items: center; position: relative; overflow: hidden;
  background:
    radial-gradient(120% 88% at 50% 14%, var(--accent-soft, #eaf6fd), transparent 60%),
    linear-gradient(158deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line); margin-bottom: 6px;
}
.unit .portrait .init {
  font-family: var(--font-head); font-weight: 600;
  font-size: 34px; color: var(--accent, var(--cyan-deep)); opacity: .95;
}
.unit .nm { font-weight: 600; font-size: 12.5px; }
.unit .meta { font-size: 10px; color: var(--text-dim); margin-top: 1px; }
.unit .role-ic { font-size: 11px; }

/* ── BA-НАКЛАДКИ ПОРТРЕТА (общие для всех карточек) ──────────────
   .el-badge — иконка школы в кружке (верх-лево);
   .p-scrim  — затемнение низа под читаемость;
   .p-corner — стопка «звёзды + Lv» в углу;
   .stars    — золотые звёзды редкости; .lv-badge — уровень ученицы. */
.el-badge {
  position: absolute; top: 5px; left: 5px; z-index: 3;
  width: 21px; height: 21px; border-radius: 50%;
  display: grid; place-items: center; font-size: 11px;
  background: var(--chip-bg); border: 1px solid var(--chip-border);
  box-shadow: 0 1px 3px rgba(10,20,30,.28);
}
.p-scrim {
  position: absolute; left: 0; right: 0; bottom: 0; height: 48%;
  background: var(--scrim);
  pointer-events: none; z-index: 1;
}
.p-corner {
  position: absolute; left: 5px; bottom: 5px; z-index: 3;
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
}
.lv-badge {
  font-family: var(--font-num); font-size: 9px; font-weight: 700; line-height: 1.4;
  color: var(--lv-fg); background: var(--lv-bg); border: 1px solid var(--lv-border);
  border-radius: 3px; padding: 0 5px; box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.lv-badge b { font-size: 11px; color: var(--lv-num); margin-left: 1px; font-weight: 700; }

/* ── ФИЛЬТРЫ (скошенные пилюли) ───────────────────────────────── */
.filters {
  display: flex; flex-wrap: nowrap; gap: 6px;
  padding: 0 var(--pad) 12px;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.filters .pill { flex: none; }
.pill {
  font-size: 12px; font-weight: 600; cursor: pointer;
  background: var(--surface); color: var(--text-dim);
  border: 1px solid var(--line); border-radius: var(--r-pill);
  padding: 5px 10px; transform: skewX(var(--skew));
  transition: all .12s ease; white-space: nowrap;
}
.pill > span { display: inline-block; transform: skewX(calc(-1 * var(--skew))); }
.pill.on { background: var(--cyan); color: var(--on-accent); border-color: var(--cyan); box-shadow: var(--sh-accent); }
.pill:active { transform: skewX(var(--skew)) scale(0.96); }

/* ── ДЕТАЛЬ ПЕРСОНАЖА ─────────────────────────────────────────── */
.detail { padding: 0 var(--pad); }
.char-body .hero {
  display: flex; gap: 14px; padding: 16px 14px;
}
.char-body .hero .portrait {
  width: 96px; height: 96px; flex: none; border-radius: var(--r-card);
  display: grid; place-items: center; position: relative; overflow: hidden;
  background:
    radial-gradient(120% 88% at 50% 14%, var(--accent-soft, #eaf6fd), transparent 60%),
    linear-gradient(158deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
}
.char-body .hero .portrait .init { font-family: var(--font-head); font-size: 44px; color: var(--accent); opacity: .95; }
/* меньший тёмный градиент снизу — по просьбе */
.char-body .hero .portrait .p-scrim { height: 34%; }
/* уменьшенный бейдж уровня */
.char-body .hero .portrait .lv-badge { position: absolute; left: 5px; bottom: 5px; z-index: 3; font-size: 8px; padding: 0 4px; }
.char-body .hero .portrait .lv-badge b { font-size: 10px; }
.char-body .hero .who { min-width: 0; }
.char-body .hero .who .nm { font-family: var(--font-head); font-size: 22px; font-weight: 600; }
.char-body .hero .who .full { color: var(--text-dim); font-size: 12px; }
.char-body .hero .who .hero-aff { margin-top: 8px; font-size: 12px; color: var(--text-dim); }
.char-body .hero .who .hero-aff b { font-family: var(--font-num); color: #e0578e; margin-left: 3px; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.badge {
  font-size: 11px; font-weight: 600; padding: 3px 8px;
  border-radius: var(--r-pill); background: var(--surface-2);
  border: 1px solid var(--line); color: var(--text-dim);
}
.badge.hue { background: var(--accent-soft); border-color: transparent; color: var(--accent-ink, var(--navy)); }

/* статы */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 4px 14px 14px; }
.stat { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-card); padding: 9px 11px; }
.stat .k { font-size: 11px; color: var(--text-dim); }
.stat .v { font-family: var(--font-num); font-size: 18px; font-weight: 600; }
.stat .bar { height: 5px; border-radius: 3px; background: var(--line); margin-top: 6px; overflow: hidden; }
.stat .bar > i { display: block; height: 100%; background: var(--accent, var(--cyan)); border-radius: 3px; }

/* навык */
.skill { margin: 4px 14px 14px; padding: 12px 13px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-card); }
.skill .st-type { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: var(--r-pill); color: #fff; }
.skill .st-name { font-family: var(--font-head); font-size: 16px; font-weight: 600; margin: 6px 0 2px; }
.skill .st-od { font-family: var(--font-num); font-size: 12px; color: var(--cyan-deep); }
.skill .st-desc { font-size: 13px; color: var(--text-dim); margin-top: 7px; }
.quote { margin: 0 14px 16px; font-style: italic; color: var(--text-faint); font-size: 13px; }

/* слот скина (заглушка-задел) */
.skin-slot { margin: 0 14px 16px; padding: 11px 13px; border: 1px dashed var(--line-strong); border-radius: var(--r-card); background: transparent; }
.skin-slot .lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); }
.skin-slot .row { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.skin-slot .cur { font-weight: 600; font-size: 13px; }
.skin-slot .soon { margin-left: auto; font-size: 11px; color: var(--text-faint); }

/* ── СБОРКА ОТРЯДА ────────────────────────────────────────────── */
.squad-slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 0 var(--pad) 12px; }
.slot {
  aspect-ratio: 3/4; border-radius: var(--r-card); position: relative;
  display: grid; place-items: center; text-align: center; padding: 8px;
  background: var(--surface); border: 1px solid var(--line); cursor: pointer;
}
.slot.empty { border-style: dashed; color: var(--text-faint); }
.slot .rm { position: absolute; top: 4px; right: 6px; font-size: 14px; color: var(--danger); }
.slot .init { font-family: var(--font-head); font-size: 26px; color: var(--accent); }
.slot .nm { font-weight: 600; font-size: 12px; margin-top: 2px; }
.slot .rl { font-size: 10px; color: var(--text-dim); }
.slot .plus { font-size: 26px; color: var(--text-faint); }

/* заполненный слот — мини-карточка BA: портрет сверху, инфо снизу */
.slot.filled {
  aspect-ratio: auto; display: flex; flex-direction: column; align-items: stretch;
  place-items: unset; text-align: center; padding: 6px 6px 8px; gap: 1px;
}
.slot .slot-pic {
  position: relative; overflow: hidden; width: 100%; aspect-ratio: 1 / 1;
  border-radius: var(--r-card); display: grid; place-items: center; margin-bottom: 4px;
  background:
    radial-gradient(120% 88% at 50% 14%, var(--accent-soft, #eaf6fd), transparent 60%),
    linear-gradient(158deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
}
.slot .slot-pic .init { font-family: var(--font-head); font-size: 30px; color: var(--accent); opacity: .95; margin: 0; }

/* список выбора в сборке */
.picklist { padding: 0 var(--pad); }
.pick-row {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  padding: 9px 11px; margin-bottom: 7px;
}
.pick-row.disabled { opacity: .42; cursor: default; }
.pick-row .pic { width: 38px; height: 38px; flex: none; border-radius: var(--r-card); display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); font-family: var(--font-head); color: var(--accent); font-size: 16px; }
.pick-row .info { flex: 1; min-width: 0; }
.pick-row .info .nm { font-weight: 600; font-size: 14px; }
.pick-row .info .sub { font-size: 11px; color: var(--text-dim); }
.pick-row .act { font-size: 20px; color: var(--cyan-deep); }
.pick-row.picked .act { color: var(--danger); }

/* ── ПРОФИЛЬ ──────────────────────────────────────────────────── */
.profile-head { display: flex; align-items: center; gap: 14px; padding: 8px var(--pad) 16px; }
.avatar {
  width: 64px; height: 64px; border-radius: 50%; flex: none;
  display: grid; place-items: center; position: relative;
  background: linear-gradient(135deg, var(--cyan), var(--cyan-deep)); color: #fff;
  font-family: var(--font-head); font-size: 26px; font-weight: 600;
}
.avatar .halo-a { position: absolute; top: -7px; width: 46px; height: 16px; border-radius: 50%; border: 3px solid var(--halo); transform: rotate(-14deg); box-shadow: 0 0 8px var(--halo); }
.profile-head .who .nm { font-family: var(--font-head); font-size: 20px; font-weight: 600; }
.profile-head .who .rank { font-size: 12px; color: var(--cyan-deep); }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 0 var(--pad) 14px; }
.stat-cell { text-align: center; padding: 12px 6px; }
.stat-cell .v { font-family: var(--font-num); font-size: 22px; font-weight: 600; }
.stat-cell .k { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.section-title {
  position: relative; font-family: var(--font-head); font-size: 13px;
  letter-spacing: .06em; text-transform: uppercase; color: var(--text-dim);
  padding: 4px var(--pad) 8px calc(var(--pad) + 11px);
}
.section-title::before {
  content: ""; position: absolute; left: var(--pad); top: 6px;
  width: 4px; height: 13px; background: var(--cyan);
  transform: skewX(var(--skew)); box-shadow: var(--sh-accent);
}
.cta { display: block; width: calc(100% - 2 * var(--pad)); margin: 0 var(--pad) 10px; text-align: center; cursor: pointer; font-family: var(--font-head); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; font-size: 14px; padding: 13px; border-radius: var(--r-card); border: none; }
.cta.primary { background: var(--cyan); color: var(--on-accent); box-shadow: var(--sh-accent); }
.cta.ghost { background: var(--surface); color: var(--text); border: 1px solid var(--line-strong); }
.cta:active { transform: translateY(1px); }

/* превью отряда в профиле */
.team-preview { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 0 var(--pad) 14px; }
.tp-cell { text-align: center; padding: 6px 6px 8px; }
.tp-cell .tp-pic {
  position: relative; overflow: hidden; width: 100%; aspect-ratio: 1 / 1;
  border-radius: var(--r-card); display: grid; place-items: center; margin-bottom: 5px;
  background:
    radial-gradient(120% 88% at 50% 14%, var(--accent-soft, #eaf6fd), transparent 60%),
    linear-gradient(158deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
}
.tp-cell .tp-pic .init { font-family: var(--font-head); font-size: 26px; color: var(--accent); opacity: .95; }
.tp-cell .nm { font-size: 11.5px; font-weight: 600; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tp-cell .rl { font-size: 10px; color: var(--text-dim); margin-top: 1px; }
.tp-cell.empty .tp-pic { border-style: dashed; background: var(--surface-2); }
.tp-cell.empty .tp-pic .init { color: var(--text-faint); }
.tp-cell.empty .nm { color: var(--text-faint); }

/* ── ВИКИ ─────────────────────────────────────────────────────── */
.wiki { padding: 0 var(--pad); }
.wiki .mech { padding: 12px 13px; margin-bottom: 10px; }
.wiki .mech h4 { margin: 0 0 6px; font-family: var(--font-head); font-size: 14px; }
.wiki .mech p { margin: 0; font-size: 13px; color: var(--text-dim); }
.wiki .ramp { display: flex; gap: 4px; margin-top: 9px; align-items: flex-end; height: 46px; }
.wiki .ramp .b { flex: 1; background: linear-gradient(var(--cyan), var(--cyan-deep)); border-radius: 2px 2px 0 0; position: relative; }
.wiki .ramp .b span { position: absolute; bottom: -15px; left: 0; right: 0; text-align: center; font-size: 8.5px; color: var(--text-faint); font-family: var(--font-num); }
.eff-group { margin: 14px 0 4px; font-family: var(--font-head); text-transform: uppercase; letter-spacing: .06em; font-size: 12px; color: var(--cyan-deep); padding-left: 2px; }
.eff-row { display: flex; gap: 10px; align-items: flex-start; padding: 9px 11px; margin-bottom: 7px; }
.eff-row .ic { font-size: 18px; flex: none; width: 22px; text-align: center; }
.eff-row .body .nm { font-weight: 600; font-size: 13px; }
.eff-row .body .ds { font-size: 12px; color: var(--text-dim); }
.eff-row .dur { margin-left: auto; font-size: 10px; font-family: var(--font-num); color: var(--text-faint); white-space: nowrap; }

/* ── НИЖНЯЯ НАВИГАЦИЯ ─────────────────────────────────────────── */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  height: calc(var(--nav-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  display: flex; background: var(--surface);
  border-top: 1px solid var(--line-strong);
  box-shadow: 0 -2px 12px rgba(28,37,48,.08);
}
.nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; text-decoration: none; color: var(--text-faint);
  font-size: 10.5px; font-weight: 600; cursor: pointer; position: relative;
}
.nav a .ic { font-size: 20px; line-height: 1; }
.nav a.on { color: var(--cyan-deep); }
.nav a.on::before { content: ""; position: absolute; top: 0; width: 26px; height: 3px; background: var(--cyan); border-radius: 0 0 3px 3px; box-shadow: var(--sh-accent); }

/* ── УТИЛ ─────────────────────────────────────────────────────── */
.pad { padding: 0 var(--pad); }
.mt { margin-top: 12px; }
.empty-hint { text-align: center; color: var(--text-faint); font-size: 13px; padding: 24px var(--pad); }
.stub-note { font-size: 11px; color: var(--text-faint); text-align: center; padding: 10px var(--pad) 0; }
.back-row { padding: 8px var(--pad) 4px; }
.back-btn { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--cyan-deep); background: none; border: none; padding: 4px 0; }

@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.screen { animation: fadeUp .18s ease; }

/* ══════════════════════════════════════════════════════════════════════ */
/*  ДОБАВЛЕНО: профиль (попытки/воспитанник), стата арены, скины,          */
/*  редизайн отряда, оверлей-пикер, Вики-хаб, рецепты алхимии.             */
/* ══════════════════════════════════════════════════════════════════════ */

.stat-cell .v .sm { font-size: 13px; color: var(--text-faint); font-weight: 500; }

/* попытки арены */
.tries-card { display: flex; align-items: center; gap: 10px; padding: 12px 13px; margin: 0 var(--pad) 6px; }
.tries-lbl { font-size: 12.5px; font-weight: 600; color: var(--text-dim); }
.tries-pips { display: flex; gap: 5px; margin-left: auto; }
.tries-pips .pip { width: 13px; height: 13px; border-radius: 50%; background: var(--line-strong); }
.tries-pips .pip.on { background: var(--cyan); box-shadow: var(--sh-accent); }
.tries-num { font-family: var(--font-num); font-size: 13px; font-weight: 700; color: var(--cyan-deep); }

/* карточка воспитанника */
.ward { display: flex; gap: 12px; align-items: center; padding: 12px 13px; margin: 0 var(--pad) 6px; cursor: pointer; }
.ward:active { transform: translateY(1px); }
.ward .ward-pic {
  width: 60px; height: 60px; flex: none; border-radius: var(--r-card);
  display: grid; place-items: center; position: relative; overflow: hidden;
  background:
    radial-gradient(120% 88% at 50% 14%, var(--accent-soft), transparent 60%),
    linear-gradient(158deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
}
.ward .ward-pic .init { font-family: var(--font-head); font-size: 30px; color: var(--accent); opacity: .95; }
.ward .ward-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ward .ward-nm {
  font-family: var(--font-head); font-size: 15.5px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ward .ward-info { font-size: 12px; color: var(--text-dim); }
.ward .ward-info .wi-k { color: var(--text-faint); }
.ward .ward-info .wi-v { font-family: var(--font-num); font-weight: 700; color: var(--text); }

/* бейдж «есть скины» на портрете коллекции (верх-право, как маркер улучшения в BA) */
.unit .portrait .skin-badge {
  position: absolute; top: 5px; right: 5px; z-index: 3; font-size: 9px; font-weight: 700;
  font-family: var(--font-num); background: var(--chip-bg); color: var(--chip-fg);
  border: 1px solid var(--chip-border); border-radius: var(--r-pill); padding: 1px 5px;
  box-shadow: 0 1px 3px rgba(10,20,30,.22);
}

/* селектор скинов (деталь + фокус отряда) */
.skins { margin: 0 14px 16px; }
.skins .lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); margin-bottom: 7px; }
.skins .chips { display: flex; flex-wrap: wrap; gap: 7px; }
.skin-chip {
  display: inline-flex; align-items: center; gap: 5px; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-pill);
  padding: 6px 11px; font-size: 12.5px; font-weight: 600; color: var(--text-dim);
  transition: all .12s ease;
}
.skin-chip .tg { font-size: 11px; }
.skin-chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); box-shadow: 0 0 0 1px var(--accent) inset; }
.skin-chip.locked { opacity: .62; }
.skin-chip:active { transform: scale(0.96); }

/* стата арены на экране отряда */
.arena-stat { padding: 13px 14px; margin: 0 var(--pad) 4px; }
.arena-stat .as-title { font-family: var(--font-head); font-size: 14px; letter-spacing: .04em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 10px; }
.arena-stat .as-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.arena-stat .as-cell { text-align: center; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-card); padding: 9px 4px; }
.arena-stat .as-cell .v { font-family: var(--font-num); font-size: 19px; font-weight: 700; }
.arena-stat .as-cell .v .sm { font-size: 12px; color: var(--text-faint); font-weight: 500; }
.arena-stat .as-cell .k { font-size: 10px; color: var(--text-dim); margin-top: 2px; }

/* слоты отряда — редизайн (кликабельные, с меткой скина) */
.slot.filled .edit-ic {
  position: absolute; top: 4px; right: 4px; z-index: 3;
  width: 19px; height: 19px; border-radius: 50%; display: grid; place-items: center;
  font-size: 11px; color: #fff; background: rgba(10,17,27,.6); box-shadow: 0 1px 3px rgba(0,0,0,.28);
}
.slot .nm { margin-top: 1px; }
.slot .skin-tag { font-size: 9px; color: var(--text-faint); margin-top: 2px; padding: 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.slot.empty { cursor: pointer; }
.slot.empty .hint { font-size: 10px; color: var(--text-faint); margin-top: 2px; }
.slot.empty:active, .slot.filled:active { transform: translateY(1px) scale(0.99); }

/* ── ОВЕРЛЕЙ (пикер / фокус) ─────────────────────────────────── */
body.no-scroll { overflow: hidden; }
.overlay[hidden] { display: none; }   /* иначе display:flex перебивает атрибут hidden */
.overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(10, 14, 20, 0.55); backdrop-filter: blur(2px);
  display: flex; align-items: flex-end; justify-content: center;
  animation: ovFade .15s ease;
}
@keyframes ovFade { from { opacity: 0; } to { opacity: 1; } }
.overlay-sheet {
  width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto;
  background: var(--bg); border-radius: 14px 14px 0 0;
  border-top: 1px solid var(--line-strong); box-shadow: var(--sh-2);
  padding-bottom: calc(var(--safe-bottom) + 14px);
  animation: sheetUp .22s cubic-bezier(.2,.7,.3,1);
}
@keyframes sheetUp { from { transform: translateY(28px); opacity: .4; } to { transform: none; opacity: 1; } }
.sheet-inner { padding: 4px 0 6px; }
.sheet-head {
  position: sticky; top: 0; z-index: 2; background: var(--bg);
  display: flex; align-items: center; gap: 10px;
  padding: 12px var(--pad) 10px; border-bottom: 1px solid var(--line);
}
.sheet-title { font-family: var(--font-head); font-size: 15px; font-weight: 600; }
.sheet-head .sheet-x { margin-left: auto; background: none; border: none; cursor: pointer; font-size: 17px; color: var(--text-dim); padding: 2px 6px; }
.sheet-head .sheet-back { background: none; border: none; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--cyan-deep); padding: 2px 0; }
.filters.compact { padding: 10px var(--pad) 8px; }

/* сетка выбора персонажа в пикере */
.pick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; padding: 4px var(--pad) 12px; }
.pick-cell {
  cursor: pointer; text-align: center; padding: 9px 6px 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card);
  position: relative; overflow: hidden; transition: transform .1s ease;
}
.pick-cell::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: var(--stripe); background: var(--accent, var(--cyan)); }
.pick-cell:active { transform: scale(0.97); }
.pick-cell.here { box-shadow: 0 0 0 2px var(--accent) inset; }
.pick-cell .pc-pic {
  width: 100%; aspect-ratio: 1/1; border-radius: var(--r-card); margin-bottom: 6px;
  display: grid; place-items: center; position: relative; overflow: hidden;
  background:
    radial-gradient(120% 88% at 50% 14%, var(--accent-soft), transparent 60%),
    linear-gradient(158deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
}
.pick-cell .pc-pic .init { font-family: var(--font-head); font-size: 28px; color: var(--accent); opacity: .95; }
.pick-cell .pc-nm { font-weight: 600; font-size: 12px; }
.pick-cell .pc-sub { font-size: 10px; color: var(--text-dim); margin-top: 1px; }
.sheet-foot { padding: 6px var(--pad) 4px; }
.sheet-foot .cta { width: 100%; margin: 6px 0 0; }
.cta.danger { color: var(--danger); border-color: var(--danger); }

/* фокус-карточка внутри оверлея: убрать двойные отступы у charBody */
.overlay-sheet .char-body .hero { margin-top: 6px; }

/* ── ВИКИ: карточки игр (раздел «Игры») ───────────────────────── */
.game-card {
  display: flex; align-items: center; gap: 13px; width: 100%; cursor: pointer;
  text-align: left; padding: 15px 14px; font: inherit; color: inherit; margin-bottom: 8px;
}
.game-card:active { transform: translateY(1px); }
.gc-ic { font-size: 28px; flex: none; }
.gc-t { font-family: var(--font-head); font-size: 17px; font-weight: 600; }
.gc-d { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.hub-arr { margin-left: auto; color: var(--cyan-deep); font-size: 18px; }

/* правила игры (строки) */
.mech.rule { display: flex; gap: 11px; align-items: flex-start; margin-bottom: 8px; }
.mech.rule .ic { font-size: 20px; flex: none; width: 24px; text-align: center; }
.mech.rule .body .nm { font-weight: 600; font-size: 14px; font-family: var(--font-head); }
.mech.rule .body .ds { font-size: 12.5px; color: var(--text-dim); margin-top: 2px; }

/* ── РЕЦЕПТЫ АЛХИМИИ ──────────────────────────────────────────── */
.alchemy .alc-intro { font-size: 12px; color: var(--text-dim); padding: 0 var(--pad) 12px; }
.recipe { padding: 10px 12px; margin-bottom: 8px; }
.recipe .rc-head { display: flex; align-items: center; gap: 9px; }
.recipe .rc-face { font-size: 20px; flex: none; }
.recipe .rc-nm { font-family: var(--font-head); font-size: 15px; font-weight: 600; }
.recipe .rc-tier { margin-left: auto; font-family: var(--font-num); font-size: 10px; font-weight: 700; color: var(--on-accent); background: var(--cyan); padding: 1px 6px; border-radius: var(--r-pill); }
.recipe .rc-pairs { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 8px; }
.recipe .pair {
  display: inline-flex; align-items: center; gap: 3px; font-size: 15px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-pill); padding: 3px 8px;
}
.recipe .pair .plus { font-size: 11px; color: var(--text-faint); }
.recipe .pair .auto { font-size: 9px; font-family: var(--font-body); font-weight: 700; color: var(--warn); margin-left: 3px; text-transform: uppercase; }
.recipe .pair .jack { font-size: 12px; font-weight: 600; color: var(--cyan-deep); }

/* ══════════════════════════════════════════════════════════════════════ */
/*  ДОБАВЛЕНО (лог 05.07): воспитанник+дневные попытки в ряд, таблица       */
/*  рейтинга на Арене, оглавление Вики с подтемами, подраздел НекоКафе.     */
/* ══════════════════════════════════════════════════════════════════════ */

/* ряд «воспитанник + дневные попытки» в профиле */
.ward-row {
  display: grid; grid-template-columns: 1.35fr 1fr; gap: 10px;
  padding: 0 var(--pad) 8px; align-items: stretch;
}
.ward-row .ward { margin: 0; }               /* карточка ward внутри грида — без внешних отступов */
.daily {
  display: flex; flex-direction: column; justify-content: center; gap: 6px;
  padding: 10px 11px; min-width: 0;
}
.daily .daily-line { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-width: 0; }
.daily .d-k { font-size: 11px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.daily .d-v { font-family: var(--font-num); font-size: 13px; font-weight: 700; color: var(--cyan-deep); flex: none; }
.daily .daily-reset {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  margin-top: 1px; padding-top: 6px; border-top: 1px solid var(--line); min-width: 0;
}
.daily .dr-k { font-size: 10.5px; color: var(--text-faint); white-space: nowrap; }
.daily .dr-t { font-family: var(--font-num); font-size: 12px; font-weight: 700; color: var(--text); flex: none; letter-spacing: -.3px; }

/* очень узкие экраны — карточка попыток уходит под воспитанника */
@media (max-width: 360px) {
  .ward-row { grid-template-columns: 1fr; }
}

/* таблица рейтинга (экран Арены) */
.leaderboard { display: flex; flex-direction: column; gap: 7px; padding: 0 var(--pad) 6px; }
.lb-row {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
}
.lb-row .lb-rank { font-family: var(--font-num); font-size: 15px; font-weight: 700; width: 24px; text-align: center; flex: none; }
.lb-row .lb-name { font-weight: 600; font-size: 13.5px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-row .lb-streak { font-family: var(--font-num); font-size: 12px; color: var(--text-dim); flex: none; }
.lb-row .lb-pts { font-family: var(--font-num); font-size: 14px; font-weight: 700; color: var(--cyan-deep); flex: none; min-width: 46px; text-align: right; }
.lb-row.me { box-shadow: 0 0 0 2px var(--cyan) inset; }
.lb-row.me::before { background: var(--cyan); }
.lb-row.me .lb-name { color: var(--cyan-deep); }

/* ── ВИКИ: оглавление с подтемами ─────────────────────────────── */
.wiki-intro { font-size: 12.5px; color: var(--text-dim); padding: 0 0 12px; }
.wiki .toc { margin-bottom: 10px; padding: 4px 4px 10px; }
.toc-head {
  display: flex; align-items: center; gap: 11px; width: 100%; cursor: pointer;
  text-align: left; padding: 11px 11px 9px; font: inherit; color: inherit;
  background: none; border: none;
}
.toc-head:active { transform: translateY(1px); }
.toc-head .toc-ic { font-size: 22px; flex: none; }
.toc-head .toc-t { font-family: var(--font-head); font-size: 17px; font-weight: 600; }
.toc-head .toc-arr { margin-left: auto; color: var(--cyan-deep); font-size: 18px; }
.toc-subs { display: flex; flex-wrap: wrap; gap: 7px; padding: 0 11px; }
.toc-sub {
  cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--accent-ink, var(--cyan-deep));
  background: var(--accent-soft, var(--surface-2)); border: 1px solid var(--line);
  border-radius: var(--r-pill); padding: 6px 11px; transition: transform .1s ease;
}
.toc-sub:active { transform: scale(0.96); }

/* заголовок каталога эффектов (якорь deep-scroll) + доводка секций Вики */
.eff-head { margin: 16px 0 6px; font-family: var(--font-head); font-size: 15px; font-weight: 600; padding-left: 2px; scroll-margin-top: 12px; }
.wiki .mech[id], .wiki .section-title[id] { scroll-margin-top: 12px; }

/* ══════════════════════════════════════════════════════════════════════ */
/*  ГАЛЕРЕЯ (арты + скины): кнопки в детали, сетка-оверлей, просмотр арта.   */
/* ══════════════════════════════════════════════════════════════════════ */

/* кнопки «Галерея» в детали персонажа */
.gallery-btns { margin: 0 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.gal-btn {
  display: flex; align-items: center; gap: 12px; width: 100%; cursor: pointer;
  text-align: left; padding: 12px 13px; font: inherit; color: inherit;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-card);
  transition: transform .1s ease;
}
.gal-btn:active { transform: translateY(1px); }
.gal-btn .gb-ic { font-size: 24px; flex: none; }
.gal-btn .gb-tx { display: flex; flex-direction: column; min-width: 0; }
.gal-btn .gb-t { font-family: var(--font-head); font-size: 15px; font-weight: 600; }
.gal-btn .gb-s { font-size: 11px; color: var(--text-dim); margin-top: 1px; }
.gal-btn .gb-arr { margin-left: auto; color: var(--cyan-deep); font-size: 17px; flex: none; }

/* сетка галереи в оверлее */
.gal-note { font-size: 12px; color: var(--text-dim); padding: 10px var(--pad) 4px; }
.gal-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; padding: 6px var(--pad) 14px; }
.gal-tile { cursor: pointer; text-align: center; transition: transform .1s ease; }
.gal-tile:active { transform: scale(0.97); }
.gal-tile .gt-thumb {
  position: relative; overflow: hidden; width: 100%; aspect-ratio: 1 / 1.15;
  border-radius: var(--r-card); display: grid; place-items: center; margin-bottom: 5px;
  background:
    radial-gradient(120% 88% at 50% 14%, var(--accent-soft, #eaf6fd), transparent 60%),
    linear-gradient(158deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
}
.gal-tile .gt-face { position: absolute; top: 6px; right: 7px; font-size: 14px; opacity: .55; }
.gal-tile .gt-init { font-family: var(--font-head); font-size: 30px; color: var(--accent); opacity: .95; }
.gal-tile .gt-lock,
.gal-tile .gt-check {
  position: absolute; left: 6px; bottom: 6px; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; font-size: 12px; z-index: 3;
}
.gal-tile .gt-lock { background: rgba(10,17,27,.72); color: #fff; }
.gal-tile .gt-check { background: var(--accent); color: #fff; box-shadow: 0 0 0 2px var(--surface); }
.gal-tile.locked .gt-thumb { filter: grayscale(.6) brightness(.92); opacity: .7; }
.gal-tile.locked .gt-thumb::after {
  content: ""; position: absolute; inset: 0; background: rgba(10,17,27,.28); z-index: 1;
}
.gal-tile.on .gt-thumb { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }
.gal-tile .gt-nm { font-size: 11px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* просмотр одного арта/скина */
.art-view { padding: 8px var(--pad) 6px; }
.art-frame {
  position: relative; overflow: hidden; width: 100%; aspect-ratio: 4 / 3;
  border-radius: var(--r-card); display: grid; place-items: center;
  background:
    radial-gradient(120% 92% at 50% 10%, var(--accent-soft, #eaf6fd), transparent 62%),
    linear-gradient(158deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
}
.art-frame::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: var(--stripe); background: var(--accent, var(--cyan)); }
.art-frame .af-face { position: absolute; top: 10px; right: 12px; font-size: 20px; opacity: .5; }
.art-frame .af-init { font-family: var(--font-head); font-size: 72px; color: var(--accent); opacity: .9; }
.art-frame .af-ph { position: absolute; bottom: 10px; left: 0; right: 0; text-align: center; font-size: 10.5px; color: var(--text-faint); letter-spacing: .04em; }
.art-nm { font-family: var(--font-head); font-size: 19px; font-weight: 600; margin-top: 12px; }
.art-author { font-size: 12.5px; color: var(--cyan-deep); font-weight: 600; margin-top: 4px; }
.art-desc { font-size: 13px; color: var(--text-dim); margin-top: 8px; line-height: 1.5; }

/* ── ТОСТ ─────────────────────────────────────────────────────── */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + var(--safe-bottom) + 18px);
  transform: translateX(-50%); background: var(--navy); color: var(--bg);
  padding: 9px 15px; border-radius: var(--r-card); font-size: 13px; font-weight: 500;
  z-index: 80; box-shadow: var(--sh-2); opacity: 0; transition: opacity .18s;
  max-width: 82vw; text-align: center; pointer-events: none;
}
