/* ============================================================
   SAPPHIRE — аниме онлайн. Дизайн в стиле видеокарт Sapphire:
   тёмный «гранит», сапфирово-синие градиенты, диагональные
   штрихи, скошенные углы, гранёный гем.
   ============================================================ */

:root {
  --bg: #060a13;
  --bg2: #0a1120;
  --panel: #0d1526;
  --panel2: #101a30;
  --line: rgba(102, 153, 255, .14);
  --line-strong: rgba(102, 153, 255, .32);
  --text: #e9effc;
  --muted: #8ba0c9;
  --blue: #2e7bff;
  --blue-deep: #1e4fd8;
  --blue2: #6fb1ff;
  --cyan: #41d7ff;
  --red: #e8465a;
  --gold: #ffc861;
  --radius: 12px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html {
  scroll-behavior: smooth;
  scroll-padding-top: 68px; /* якорь #watch не прячется под липкой шапкой */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
/* страховка от горизонтального скролла на узких экранах (clip не ломает sticky) */
html, body { overflow-x: clip; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* на тач-экранах вся навигация — одним касанием */
a, button, .chip, .ep-chip, input, select, textarea, label { touch-action: manipulation; }

/* Фоновые эффекты: сапфировое свечение + диагональные штрихи */
.bg-fx {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(900px 500px at 12% -5%, rgba(46, 123, 255, .16), transparent 60%),
    radial-gradient(800px 600px at 105% 30%, rgba(65, 215, 255, .08), transparent 55%),
    radial-gradient(700px 700px at 50% 115%, rgba(30, 79, 216, .14), transparent 60%),
    var(--bg);
}
.bg-fx::before {
  content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(45deg,
    rgba(255, 255, 255, .018) 0 1px, transparent 1px 22px);
}

::selection { background: rgba(46, 123, 255, .45); }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #1a2c52; border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #24406f; }

a { color: var(--blue2); text-decoration: none; }
a:hover { color: var(--cyan); }
img { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.anime-title, .hero-title, .profile-name, .card-title, .cc-title, .desc, .hero-desc { overflow-wrap: break-word; }

.wrap { max-width: 1280px; margin: 0 auto; padding: 0 20px; }
.main-content { min-height: calc(100vh - 320px); padding-top: 18px; padding-bottom: 40px; }
.muted { color: var(--muted); }
.star { color: var(--gold); font-weight: 700; }

/* ---------------- Панели и карточки ---------------- */
.panel, .card {
  position: relative;
  background: linear-gradient(180deg, var(--panel2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.panel::before, .card::before {
  content: ""; position: absolute; top: 0; left: 8%; right: 8%; height: 2px;
  background: linear-gradient(90deg, transparent, var(--blue) 30%, var(--cyan) 70%, transparent);
  opacity: .45; border-radius: 2px; pointer-events: none;
}

.section { margin: 30px 0; }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 14px; margin-bottom: 14px;
}
.section-title {
  margin: 0; font-size: 19px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 2px;
}
.section-title::before {
  content: "/// ";
  background: linear-gradient(90deg, var(--blue2), var(--cyan));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.link-more { font-size: 13px; white-space: nowrap; }
.result-info { font-size: 13px; color: var(--muted); white-space: nowrap; }

.empty-state { padding: 34px; text-align: center; color: var(--muted); }

/* ---------------- Верхняя панель ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(6, 10, 19, .82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { display: flex; align-items: center; gap: 18px; padding: 11px 20px; flex-wrap: wrap; }

.brand { display: flex; align-items: center; gap: 10px; color: var(--text); }
.brand:hover { color: var(--text); }
.brand-gem { width: 30px; height: 30px; filter: drop-shadow(0 0 8px rgba(46, 123, 255, .6)); }
.brand-text { font-weight: 800; letter-spacing: 1.5px; font-size: 17px; line-height: 1.1; }
.brand-text small {
  display: block; font-size: 9.5px; font-weight: 600; letter-spacing: 2.4px;
  color: var(--blue2); text-transform: lowercase; opacity: .9;
}

.nav-links { display: flex; gap: 16px; }
.nav-links a { color: var(--muted); font-weight: 600; font-size: 14px; }
.nav-links a:hover { color: var(--text); }

.search-form { display: flex; gap: 8px; flex: 1 1 240px; max-width: 430px; }
.search-input { flex: 1; }

.userbox { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.user-name { color: var(--blue2); font-weight: 700; }
.userbox form { display: contents; }

.announce {
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(46, 123, 255, .16), rgba(65, 215, 255, .10));
  padding: 9px 0; font-size: 13.5px;
}

.flashes { padding-top: 12px; }
.flash {
  padding: 11px 15px; border-radius: 10px; margin: 7px 0; font-size: 14px;
  border: 1px solid var(--line-strong);
  background: rgba(46, 123, 255, .12);
}
.flash-ok { border-color: rgba(65, 215, 255, .4); background: rgba(65, 215, 255, .09); }
.flash-err { border-color: rgba(232, 70, 90, .45); background: rgba(232, 70, 90, .12); }

/* ---------------- Кнопки, чипы, формы ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 20px; font: 600 14px/1 "Segoe UI", Roboto, sans-serif;
  letter-spacing: .4px; color: #fff; border: 0; cursor: pointer;
  border-radius: 0;
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
  transition: filter .15s ease, transform .15s ease, box-shadow .15s ease;
  white-space: nowrap;
}
.btn:hover { filter: brightness(1.18); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary {
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-deep) 100%);
  box-shadow: 0 4px 18px rgba(46, 123, 255, .35);
}
.btn-primary:hover { box-shadow: 0 6px 24px rgba(46, 123, 255, .5); }
.btn-ghost {
  clip-path: none; border-radius: 9px;
  background: rgba(102, 153, 255, .07);
  border: 1px solid var(--line-strong); color: var(--blue2);
}
.btn-ghost:hover { background: rgba(102, 153, 255, .14); color: #fff; }
.btn-danger { background: linear-gradient(135deg, #e8465a, #b22639); }
.btn-sm { padding: 6px 13px; font-size: 13px; }
.btn-wide { width: 100%; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 13px; border-radius: 9px; font-size: 13px; color: var(--muted);
  background: rgba(102, 153, 255, .06); border: 1px solid var(--line);
  clip-path: polygon(7px 0, 100% 0, 100% calc(100% - 7px), calc(100% - 7px) 100%, 0 100%, 0 7px);
}
.chip:hover { color: #fff; border-color: var(--line-strong); }
.chip-count { font-size: 11px; color: var(--blue2); }
.chip-sm { padding: 4px 10px; font-size: 12px; border-radius: 7px; }
.chip-active { color: #fff; background: rgba(46, 123, 255, .22); border-color: var(--blue); }
.chip-hot { color: #ff9aa8; border-color: rgba(232, 70, 90, .4); }
.chip-rating { color: var(--gold); border-color: rgba(255, 200, 97, .35); }
.chip-link { color: var(--blue2); }

.input, .select, .textarea {
  background: #0a1222; border: 1px solid var(--line); border-radius: 9px;
  color: var(--text); padding: 9px 12px; font: inherit; font-size: 14px;
  transition: border-color .15s ease, box-shadow .15s ease;
  width: 100%;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(46, 123, 255, .18);
}
.input::placeholder, .textarea::placeholder { color: #5a6c93; }
.textarea { resize: vertical; }
.select { cursor: pointer; }
.checkline { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); cursor: pointer; }
.checkline input { accent-color: var(--blue); width: 16px; height: 16px; }
code { background: var(--panel2); padding: 1px 6px; border-radius: 6px; font-size: 12.5px; color: var(--cyan); }

/* ---------------- Главная ---------------- */
.hero {
  display: grid; grid-template-columns: 1.55fr .85fr; gap: 30px; align-items: center;
  padding: 36px; overflow: hidden; margin-top: 12px;
}
.hero-info { min-width: 0; }
.hero-kicker {
  font-family: Consolas, monospace; font-size: 12px; letter-spacing: 3px;
  color: var(--cyan); margin-bottom: 10px;
}
.hero-title {
  margin: 0 0 12px; font-size: clamp(26px, 4vw, 42px); font-weight: 900;
  letter-spacing: .5px; line-height: 1.12;
}
.hero-meta { display: flex; flex-wrap: wrap; gap: 14px; color: var(--muted); font-size: 14px; margin-bottom: 12px; }
.hero-genres { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 14px; }
.hero-desc { color: var(--muted); margin: 0 0 20px; max-width: 640px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-poster { justify-self: end; }
.hero-poster img {
  width: 260px; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 12px;
  border: 1px solid var(--line-strong);
  box-shadow: 0 18px 50px rgba(46, 123, 255, .3), 0 0 0 4px rgba(46, 123, 255, .08);
  transform: rotate(1.5deg);
}

.row-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
}
.anime-card { display: flex; flex-direction: column; overflow: hidden; transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease; }
.anime-card:hover {
  transform: translateY(-4px); border-color: var(--line-strong);
  box-shadow: 0 10px 34px rgba(46, 123, 255, .28);
  color: var(--text);
}
.card-poster { display: block; aspect-ratio: 2 / 3; overflow: hidden; background: #0a1222; }
.card-poster img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s ease; }
.anime-card:hover .card-poster img { transform: scale(1.05); }
.card-rating {
  position: absolute; top: 9px; right: 9px; z-index: 2;
  padding: 3px 9px; font-size: 12px; font-weight: 700; color: #fff;
  background: rgba(6, 10, 19, .82); border: 1px solid var(--line-strong); border-radius: 7px;
}
.card-flag {
  position: absolute; top: 9px; left: 9px; z-index: 2;
  padding: 3px 9px; font-size: 10.5px; font-weight: 700; letter-spacing: 1px;
  background: linear-gradient(135deg, var(--red), #b22639); border-radius: 6px; color: #fff;
}
.card-body { display: block; padding: 11px 12px 13px; }
.card-title {
  display: block; font-weight: 700; font-size: 14px; line-height: 1.3;
  margin-bottom: 4px; overflow: hidden; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.card-meta { display: block; font-size: 12px; color: var(--muted); }

.continue-row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }
.continue-card { display: flex; gap: 12px; padding: 10px; align-items: center; color: var(--text); }
.continue-card:hover { border-color: var(--line-strong); color: var(--text); }
.continue-card img { width: 56px; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 8px; }
.cc-body { min-width: 0; }
.cc-title { display: block; font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cc-meta { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.cc-progress { display: block; height: 4px; border-radius: 2px; background: #16233f; margin-top: 8px; overflow: hidden; }
.cc-progress span { display: block; height: 100%; width: 38%; background: linear-gradient(90deg, var(--blue), var(--cyan)); border-radius: 2px; }

.genre-cloud { display: flex; flex-wrap: wrap; gap: 9px; }

/* ---------------- Каталог ---------------- */
.filters { display: flex; flex-wrap: wrap; gap: 10px; padding: 14px; margin-bottom: 14px; }
.filters .input[type="search"] { flex: 1 1 200px; width: auto; }
.filters .select { flex: 0 1 170px; width: auto; }
.filter-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 22px 0 8px; }
.pager-info { font-size: 13px; color: var(--muted); }
.pager-spacer { width: 90px; }

/* ---------------- Страница аниме ---------------- */
.crumbs { font-size: 13px; color: var(--muted); margin: 4px 0 14px; }
.anime-head { display: grid; grid-template-columns: 230px 1fr; gap: 26px; padding: 26px; }
.anime-poster img {
  width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 10px;
  border: 1px solid var(--line-strong);
  box-shadow: 0 14px 40px rgba(46, 123, 255, .22);
}
.anime-title { margin: 0 0 6px; font-size: clamp(22px, 3vw, 32px); font-weight: 900; }
.anime-orig { color: var(--muted); font-size: 14px; margin-bottom: 14px; }
.chips-row { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 12px; }
.desc { color: var(--muted); max-width: 760px; margin: 4px 0 16px; }

.player-shell { margin-bottom: 8px; }
.player-box {
  position: relative; aspect-ratio: 16 / 9; width: 100%;
  background: #04060c; border: 1px solid var(--line-strong); border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 0 0 4px rgba(46, 123, 255, .07), 0 20px 60px rgba(0, 0, 0, .5);
}
.player-box::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 3;
  background: linear-gradient(90deg, transparent 0, transparent calc(100% - 1px), rgba(102,153,255,.25) 100%);
  opacity: 0;
}
.player-iframe, .player-video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }
.player-empty {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 14px; padding: 20px; text-align: center;
}
.player-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; }
.player-now { font-size: 13.5px; color: var(--muted); text-align: center; }
.player-variants {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-top: 12px; padding: 10px 12px;
  background: rgba(102, 153, 255, .05); border: 1px solid var(--line); border-radius: 10px;
}
.pv-label { font-size: 13px; color: var(--muted); margin-right: 4px; }

.season-block { margin-top: 16px; }
.season-title { font-size: 14px; letter-spacing: 2px; text-transform: uppercase; color: var(--blue2); margin: 0 0 10px; }
.eps-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.ep-chip {
  min-width: 46px; padding: 9px 10px; text-align: center; font-weight: 700; font-size: 13.5px;
  color: var(--muted); background: rgba(102, 153, 255, .06);
  border: 1px solid var(--line); border-radius: 0;
  clip-path: polygon(7px 0, 100% 0, 100% calc(100% - 7px), calc(100% - 7px) 100%, 0 100%, 0 7px);
}
.ep-chip:hover { color: #fff; border-color: var(--line-strong); }
.ep-chip.active {
  color: #fff; background: linear-gradient(135deg, var(--blue), var(--blue-deep));
  box-shadow: 0 4px 16px rgba(46, 123, 255, .45);
}
.demo-note { font-size: 12px; color: #5a6c93; margin-top: 14px; }

/* ---------------- Авторизация ---------------- */
.auth-card { max-width: 440px; margin: 46px auto; padding: 32px; }
.auth-kicker { font-family: Consolas, monospace; font-size: 12px; letter-spacing: 3px; color: var(--cyan); margin-bottom: 8px; }
.auth-title { margin: 0 0 20px; font-size: 26px; font-weight: 900; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.field label small { color: #5a6c93; }
.auth-alt { margin-top: 18px; font-size: 14px; color: var(--muted); }
.error-card { text-align: center; }
.error-code { font-family: Consolas, monospace; color: var(--cyan); letter-spacing: 5px; font-size: 14px; margin-bottom: 8px; }

/* ---------------- Футер ---------------- */
.site-footer { border-top: 1px solid var(--line); margin-top: 50px; background: rgba(6, 10, 19, .6); }
.footer-inner { display: flex; justify-content: space-between; gap: 16px; padding: 24px 20px; flex-wrap: wrap; }
.footer-brand { font-family: Consolas, monospace; color: var(--blue2); letter-spacing: 1px; font-size: 13px; }
.footer-note { font-size: 12px; color: #5a6c93; }

/* ============================================================
   АДМИН-ПАНЕЛЬ
   ============================================================ */
.admin-layout { display: grid; grid-template-columns: 242px 1fr; min-height: 100vh; }
.admin-side {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  background: linear-gradient(180deg, #0a1222, #070d1a);
  border-right: 1px solid var(--line); padding: 18px 14px;
}
.admin-side .brand { margin-bottom: 22px; padding: 0 6px; }
.admin-nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: 9px; color: var(--muted); font-weight: 600; font-size: 14px;
  border: 1px solid transparent;
}
.nav-item:hover { background: rgba(102, 153, 255, .08); color: #fff; }
.nav-item.active {
  background: linear-gradient(90deg, rgba(46, 123, 255, .2), rgba(46, 123, 255, .06));
  border-color: var(--line-strong); color: #fff;
}
.ni { width: 20px; text-align: center; color: var(--blue2); }
.admin-side-bottom { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }

.admin-main { padding: 22px 26px 50px; max-width: 1250px; width: 100%; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.page-title { margin: 0; font-size: 22px; font-weight: 900; text-transform: uppercase; letter-spacing: 1.5px; }
.page-title::before {
  content: "/// ";
  background: linear-gradient(90deg, var(--blue2), var(--cyan));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.stat-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.stat-card { padding: 18px 20px; }
.stat-num { font-size: 34px; font-weight: 900; line-height: 1;
  background: linear-gradient(135deg, var(--blue2), var(--cyan));
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat-label { font-size: 12.5px; color: var(--muted); margin-top: 8px; letter-spacing: .6px; }

.admin-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; margin-bottom: 16px; }
.list-panel { padding: 16px; }
.panel-title {
  font-family: Consolas, monospace; font-size: 12.5px; letter-spacing: 2px;
  color: var(--cyan); margin: 0 0 12px; font-weight: 700;
}
.quick-panel { padding: 16px; }
.quick-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.table-panel { overflow: hidden; }
.table-panel .panel-title { padding: 16px 16px 0; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; font-size: 11px; letter-spacing: 1.2px; text-transform: uppercase;
  color: var(--muted); padding: 12px 10px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table td { padding: 10px; border-bottom: 1px solid rgba(255, 255, 255, .04); vertical-align: middle; }
.table tbody tr:hover { background: rgba(102, 153, 255, .05); }
.table-panel .table th:first-child, .table-panel .table td:first-child { padding-left: 16px; }
.row-title { font-weight: 700; color: var(--text); }
.row-title:hover { color: var(--cyan); }
.row-sub { font-size: 12px; color: #5a6c93; font-family: Consolas, monospace; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.actions form { display: contents; }
.badge {
  display: inline-block; padding: 2px 8px; font-size: 11px; font-weight: 700;
  border-radius: 6px; background: rgba(102, 153, 255, .14); color: var(--blue2);
  border: 1px solid var(--line-strong); vertical-align: middle;
}
.badge-err { background: rgba(232, 70, 90, .14); color: #ff9aa8; border-color: rgba(232, 70, 90, .4); }
.badge-ok { background: rgba(65, 215, 255, .1); color: var(--cyan); border-color: rgba(65, 215, 255, .3); }

.toolbar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar .input { flex: 1 1 220px; width: auto; }

.form-panel { padding: 18px; }
.form-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; align-items: end; }
.form-grid .field { margin: 0; }
.span-2 { grid-column: span 2; }
.span-4 { grid-column: span 4; }
.form-actions { margin-top: 18px; display: flex; gap: 10px; }

.ep-list { padding: 6px 16px 16px; }
.ep-item { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,.045); }
.ep-row { display: grid; grid-template-columns: 44px 52px 52px 1fr 150px 150px 1.4fr auto; gap: 8px; align-items: end; }
.ep-idx { font-family: Consolas, monospace; color: #5a6c93; font-size: 12px; padding-bottom: 10px; }
.ep-field label { display: block; font-size: 10.5px; letter-spacing: 1px; color: #5a6c93; text-transform: uppercase; margin-bottom: 4px; }
.ep-actions { padding-bottom: 1px; }
.ep-del { padding-bottom: 1px; }
.inline-form { display: flex; gap: 6px; align-items: center; }
.input-xs { width: 140px; padding: 5px 9px; font-size: 13px; }

.hint { font-size: 13px; color: var(--muted); margin-top: 0; }
.hint-panel { padding: 16px 18px; margin-top: 16px; }
.hints { margin: 0; padding-left: 18px; color: var(--muted); font-size: 13.5px; }
.hints li { margin-bottom: 6px; }

.poster-manage { padding: 16px 18px; margin-bottom: 16px; }
.poster-manage-row { display: flex; gap: 16px; align-items: center; }
.poster-preview {
  width: 92px; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 8px;
  border: 1px solid var(--line-strong); background: #0a1222;
}
.poster-manage-info { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
input[type="file"].input { padding: 7px 10px; }
input[type="file"].input::file-selector-button {
  background: rgba(102, 153, 255, .12); color: var(--blue2);
  border: 1px solid var(--line-strong); border-radius: 7px;
  padding: 6px 12px; margin-right: 12px; cursor: pointer; font: inherit; font-size: 13px;
}
input[type="file"].input::file-selector-button:hover { background: rgba(102, 153, 255, .22); color: #fff; }

/* ---------------- Мониторинг сервера ---------------- */
.srv-live { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); font-family: Consolas, monospace; }
.srv-live .dot { animation: srv-pulse 2s infinite; }
@keyframes srv-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

.srv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; margin-bottom: 16px; }
.srv-gauge { padding: 16px 18px; }
.gauge-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.gauge-name { font-size: 11px; letter-spacing: 1.6px; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.gauge-val { font-size: 24px; font-weight: 900; font-family: Consolas, monospace; line-height: 1; }
.gauge-val.val-ok { color: var(--cyan); }
.gauge-val.val-warn { color: var(--gold); }
.gauge-val.val-crit { color: var(--red); }
.gauge-bar { height: 8px; border-radius: 4px; background: var(--panel2); overflow: hidden; margin: 12px 0 8px; }
.gauge-bar span {
  display: block; height: 100%; width: 0; border-radius: 4px;
  background: linear-gradient(90deg, var(--blue), var(--cyan));
  transition: width .6s ease;
}
.gauge-bar.warn span { background: linear-gradient(90deg, #a8691a, var(--gold)); }
.gauge-bar.crit span { background: linear-gradient(90deg, #8f1d30, var(--red)); }
.gauge-sub { font-size: 12.5px; color: var(--muted); }

.srv-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; margin-bottom: 16px; }
.srv-cols > .panel { padding: 16px 18px; }
.srv-kv {
  display: flex; justify-content: space-between; gap: 14px; padding: 7px 0;
  border-bottom: 1px dashed rgba(102, 153, 255, .12); font-size: 13.5px; color: var(--muted);
}
.srv-kv:last-child { border-bottom: none; }
.srv-kv b { color: var(--text); font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.srv-kv b.state-ok { color: var(--cyan); }
.srv-kv b.state-err { color: var(--red); }
.srv-note { font-size: 12px; color: #5a6c93; margin-top: 10px; }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; background: #5a6c93; vertical-align: 1px; }
.dot-ok { background: var(--cyan); box-shadow: 0 0 7px rgba(65, 215, 255, .8); }
.dot-err { background: var(--red); box-shadow: 0 0 7px rgba(232, 70, 90, .8); }

.srv-net-vals { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; margin-bottom: 12px; }
.srv-net-vals > div { display: flex; flex-direction: column; gap: 2px; }
.srv-net-vals b { font-family: Consolas, monospace; font-size: 16px; color: var(--text); }
.spark { width: 100%; display: block; margin-top: 4px; }

.table-panel .srv-note { padding: 0 16px 14px; }

.srv-panel { padding: 16px 18px; margin-bottom: 16px; }
.srv-panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.srv-panel-head .panel-title { margin: 0; }
.srv-mini { display: flex; gap: 26px; flex-wrap: wrap; margin-top: 8px; }
.srv-mini-item { display: flex; flex-direction: column; gap: 3px; min-width: 70px; }
.srv-mini-item b { font-size: 21px; font-weight: 900; font-family: Consolas, monospace; color: var(--text); }
.srv-mini-item b.val-ok { color: var(--cyan); }
.srv-mini-item b.val-warn { color: var(--gold); }
.srv-mini-item b.val-crit { color: var(--red); }
.srv-mini-item span { font-size: 11px; letter-spacing: 1.4px; text-transform: uppercase; color: #5a6c93; }

/* ---------------- Адаптив ---------------- */
@media (max-width: 1100px) {
  .hero { grid-template-columns: 1fr; }
  .hero-poster { display: none; }
  .form-grid { grid-template-columns: repeat(2, 1fr); }
  .span-2, .span-4 { grid-column: span 2; }
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
  .ep-row { grid-template-columns: 40px 48px 48px 1fr 120px 120px 1fr auto; }
}

/* --- Шапка: бургер-меню на планшетах и телефонах --- */
.nav-burger { display: none; }
@media (max-width: 900px) {
  .topbar-inner { gap: 10px; padding-top: 9px; padding-bottom: 9px; }
  .brand-text small { max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  .nav-burger {
    display: inline-flex; flex-direction: column; justify-content: center; align-items: center; gap: 5px;
    flex: 0 0 auto; width: 44px; height: 44px; margin-left: auto; padding: 0;
    background: rgba(102, 153, 255, .08); border: 1px solid var(--line-strong);
    border-radius: 9px; cursor: pointer;
    transition: background .2s ease, border-color .2s ease;
  }
  .nav-burger:active { background: rgba(102, 153, 255, .2); }
  .nav-burger span {
    width: 20px; height: 2px; border-radius: 2px; background: var(--blue2);
    transition: transform .28s ease, opacity .2s ease, background .2s ease;
  }
  .topbar.nav-open .nav-burger span:nth-child(1) { transform: translateY(7px) rotate(45deg); background: var(--cyan); }
  .topbar.nav-open .nav-burger span:nth-child(2) { opacity: 0; }
  .topbar.nav-open .nav-burger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); background: var(--cyan); }

  .search-form { order: 3; flex: 1 1 100%; max-width: none; }

  /* меню спрятано до тапа по бургеру */
  .nav-links, .userbox { display: none; }
  .topbar.nav-open .nav-links,
  .topbar.nav-open .userbox {
    display: flex; flex-direction: column; flex-basis: 100%;
    animation: menu-in .3s cubic-bezier(.2, .9, .3, 1);
  }
  .topbar.nav-open .nav-links {
    order: 5; gap: 2px; padding: 8px 0 4px; margin-top: 4px;
    border-top: 1px solid var(--line);
  }
  .topbar.nav-open .nav-links a { padding: 13px 10px; font-size: 16px; border-radius: 9px; }
  .topbar.nav-open .nav-links a:hover { background: rgba(102, 153, 255, .09); color: #fff; }
  .topbar.nav-open .userbox {
    order: 6; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 9px;
    padding: 10px 0 6px; margin-top: 2px;
    border-top: 1px solid var(--line);
  }
  .topbar.nav-open .user-name { flex: 1 1 100%; padding: 6px 2px; font-size: 16px; }
  .topbar.nav-open .userbox .btn { flex: 1 1 auto; min-height: 44px; }
  .topbar.nav-open .userbox .gem-balance, .topbar.nav-open .userbox .customer-badge { flex: 1 1 auto; text-align: center; }
}
@keyframes menu-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 860px) {
  /* minmax(0,1fr) — иначе широкий .table раздувает колонку и обрезается */
  .admin-layout { grid-template-columns: minmax(0, 1fr); }
  .admin-side { position: static; height: auto; flex-direction: column; }
  .admin-nav { flex-direction: row; flex-wrap: wrap; }
  .anime-head { grid-template-columns: 1fr; }
  .anime-poster img { max-width: 230px; margin: 0 auto; }
}

/* --- Телефон --- */
@media (max-width: 640px) {
  body { font-size: 16px; }
  .wrap {
    padding-left: max(14px, env(safe-area-inset-left));
    padding-right: max(14px, env(safe-area-inset-right));
  }
  .main-content { padding-top: 14px; padding-bottom: 30px; }
  .brand-text small { display: none; }

  /* крупнее под палец: цели от 44 px */
  .btn { padding: 12px 18px; min-height: 46px; font-size: 15px; }
  .btn-sm { padding: 10px 14px; min-height: 42px; font-size: 14px; }
  .chip { padding: 9px 14px; font-size: 14px; }
  .chip-sm { padding: 7px 12px; font-size: 13px; }
  .input, .select, .textarea { font-size: 16px; padding: 11px 12px; } /* 16 px — iOS не зумит поле */
  .checkline { font-size: 15px; padding: 6px 0; }
  .checkline input { width: 18px; height: 18px; }
  .userbox .gem-balance, .userbox .customer-badge { padding: 8px 12px; }

  /* главная */
  .hero { padding: 20px 16px; gap: 0; margin-top: 8px; }
  .hero-title { font-size: 26px; }
  .hero-actions { gap: 10px; }
  .hero-actions .btn { flex: 1 1 140px; }
  .section { margin: 22px 0; }
  .section-title { font-size: 17px; letter-spacing: 1.4px; }
  .result-info { white-space: normal; }
  .link-more { white-space: normal; }
  .row-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .continue-row { grid-template-columns: 1fr; }
  .genre-cloud { gap: 8px; }

  /* каталог */
  .filters { padding: 12px; gap: 9px; }
  .filters .input, .filters .select { flex: 1 1 100%; width: 100%; min-height: 46px; }
  .filters .btn { flex: 1 1 40%; }
  .filter-chips { gap: 8px; }

  /* страница аниме */
  .anime-head { padding: 16px; gap: 14px; }
  .player-nav { gap: 8px; }
  .player-nav .btn { flex: 1; }
  .player-variants { gap: 8px; }
  .pv-label { flex-basis: 100%; }
  .eps-grid { gap: 9px; }
  .ep-chip { min-width: 52px; padding: 13px 12px; font-size: 15px; }

  /* пагинация */
  .pager { gap: 8px; }
  .pager .btn { flex: 1; }
  .pager-spacer { flex: 1; width: auto; }
  .pager-info { font-size: 12.5px; white-space: nowrap; }

  /* админка */
  .admin-main { padding: 16px 12px 40px; }
  .admin-nav .nav-item { padding: 12px; font-size: 14.5px; }
  .table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .stat-cards { grid-template-columns: 1fr 1fr; }
  .stat-num { font-size: 26px; }
  .form-grid { grid-template-columns: 1fr; }
  .span-2, .span-4 { grid-column: span 1; }
  .quick-actions .btn { flex: 1 1 100%; }
  .form-actions { flex-wrap: wrap; }
  .form-actions .btn { flex: 1 1 auto; }
  .ep-row { grid-template-columns: 1fr 1fr; }
  .ep-idx { display: none; }
  .ep-field.ep-title, .ep-field.ep-url { grid-column: 1 / -1; }
  /* кнопка «Сохранить» у серии обязана остаться видимой на телефоне */
  .ep-actions { grid-column: 1 / -1; padding-top: 4px; }
  .ep-actions .btn { width: 100%; }
  .import-item { flex-wrap: wrap; }
  .import-item form { flex-basis: 100%; display: block; }
  .import-item form .btn { width: 100%; }
  .poster-manage-row { flex-wrap: wrap; }
  .srv-mini { gap: 16px; }

  /* профиль */
  .profile-head { padding: 18px 16px; gap: 12px; }
  .profile-gem svg { width: 44px; height: 44px; }
  .profile-name { font-size: 23px; }
  .balance-num { font-size: 28px; }
  .profile-balance { padding: 12px 18px; }
  .rc-row { gap: 14px; }

  /* авторизация */
  .auth-card { margin: 22px auto; padding: 24px 18px; }
  .auth-title { font-size: 22px; }

  /* футер */
  .footer-inner {
    flex-direction: column; gap: 8px;
    padding-bottom: calc(22px + env(safe-area-inset-bottom));
  }
}

/* --- импорт с Шикимори --- */
.import-panel { padding: 18px; margin-bottom: 16px; }
.import-list { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.import-item {
  display: flex; align-items: center; gap: 14px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 10px; background: rgba(102,153,255,.04);
}
.import-item img { width: 44px; aspect-ratio: 2/3; object-fit: cover; border-radius: 6px; }
.import-item form { display: contents; }
.import-info { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.import-info small { color: var(--muted); }

/* ============================================================
   ГЕЙМИФИКАЦИЯ: параллакс-фон, конвейер, профиль, ачивки
   ============================================================ */

/* ---------------- Параллакс-фон (сцена рисуется из background.js) ---------------- */
.bg-scene {
  position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden;
}
.bg-layer {
  position: absolute; inset: -80px;
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center;
  will-change: transform;
}

/* ---------------- Шапка: профиль, титул, сапфиры ---------------- */
.user-name { color: var(--blue2); font-weight: 700; }
.customer-badge {
  display: inline-block; padding: 3px 10px; font-size: 11.5px; font-weight: 700;
  letter-spacing: .4px; color: #ffe6b8; white-space: nowrap;
  background: linear-gradient(135deg, rgba(255, 200, 97, .16), rgba(46, 123, 255, .12));
  border: 1px solid rgba(255, 200, 97, .4);
  border-radius: 7px;
  clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
}
.customer-badge:hover { color: #fff; }
.customer-badge-big { font-size: 14px; padding: 6px 14px; }
.gem-balance {
  font-weight: 700; font-size: 13.5px; color: var(--cyan); white-space: nowrap;
  padding: 4px 10px; border: 1px solid rgba(65, 215, 255, .3); border-radius: 8px;
  background: rgba(65, 215, 255, .07);
}
.gem-balance:hover { color: #fff; border-color: rgba(65, 215, 255, .55); }

/* ---------------- Плеер: пред/след + наименование ---------------- */
.player-nav {
  display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 12px;
}
.player-epname {
  text-align: center; font-size: 14px; color: var(--muted); margin-top: 8px;
}
.player-epname:empty { display: none; }

/* ---------------- Конвейер «Может чекнишь?» ---------------- */
.conveyor {
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
  padding: 4px 0 10px;
}
.conveyor-track {
  display: flex; width: max-content;
  animation: conveyor-scroll 70s linear infinite;
  will-change: transform;
}
.conveyor:hover .conveyor-track { animation-play-state: paused; }
@keyframes conveyor-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
.conveyor-card {
  position: relative; display: block; flex: 0 0 auto; width: 178px; margin-right: 18px;
  color: var(--text);
  transition: transform .18s ease, filter .18s ease;
}
.conveyor-card:hover { transform: translateY(-4px) scale(1.02); filter: brightness(1.1); color: var(--text); }
.ccp-wrap {
  display: block; aspect-ratio: 2 / 3; overflow: hidden; background: #0a1222;
  border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 8px 26px rgba(0, 0, 0, .45);
}
.conveyor-card:hover .ccp-wrap { border-color: var(--line-strong); }
.ccp-wrap img { width: 100%; height: 100%; object-fit: cover; }
.conveyor-title {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  font-size: 12.5px; font-weight: 700; line-height: 1.3; margin-top: 7px;
  min-height: 2.6em;
}
@media (prefers-reduced-motion: reduce) {
  .conveyor-track { animation: none; }
}

/* ---------------- Тосты достижений ---------------- */
#achv-toasts {
  position: fixed; right: 18px; bottom: 18px; z-index: 200;
  display: flex; flex-direction: column; gap: 10px; pointer-events: none;
}
.achv-toast {
  display: flex; align-items: center; gap: 13px; width: 330px; padding: 13px 16px;
  background: linear-gradient(180deg, #101a30, #0d1526);
  border: 1px solid rgba(255, 200, 97, .45);
  border-radius: 12px;
  box-shadow: 0 14px 44px rgba(0, 0, 0, .6), 0 0 0 3px rgba(255, 200, 97, .07);
  animation: at-in .35s cubic-bezier(.2, .9, .3, 1.2);
  transition: opacity .6s ease, transform .6s ease;
}
.achv-toast.at-hide { opacity: 0; transform: translateY(8px); }
@keyframes at-in {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}
.at-icon {
  flex: 0 0 auto; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center;
  font-size: 22px; background: rgba(255, 200, 97, .12);
  border: 1px solid rgba(255, 200, 97, .4); border-radius: 10px;
}
.at-kicker { font-family: Consolas, monospace; font-size: 10px; letter-spacing: 2px; color: var(--gold); }
.at-title { font-weight: 800; font-size: 14.5px; line-height: 1.25; margin: 2px 0; }
.at-reward { font-size: 12.5px; font-weight: 700; color: var(--cyan); }

/* ---------------- Профиль ---------------- */
.profile-head {
  display: flex; align-items: center; gap: 22px; padding: 26px 28px; margin-top: 12px;
  flex-wrap: wrap;
}
.profile-gem svg { width: 58px; height: 58px; filter: drop-shadow(0 0 14px rgba(46, 123, 255, .55)); }
.profile-head-info { flex: 1; min-width: 220px; }
.profile-kicker { font-family: Consolas, monospace; font-size: 11.5px; letter-spacing: 3px; color: var(--cyan); margin-bottom: 6px; }
.profile-name { margin: 0 0 8px; font-size: 30px; font-weight: 900; letter-spacing: .5px; }
.profile-sub { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.profile-balance { text-align: center; padding: 14px 26px; border: 1px solid rgba(65, 215, 255, .25); border-radius: 12px; background: rgba(65, 215, 255, .05); }
.balance-num {
  font-size: 34px; font-weight: 900; line-height: 1;
  background: linear-gradient(135deg, var(--blue2), var(--cyan));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.balance-label { font-size: 13px; color: var(--muted); margin-top: 6px; }
.balance-hint { font-size: 11px; color: #5a6c93; margin-top: 2px; }

/* «Постоянный клиент» */
.rc-panel { padding: 20px 22px; }
.rc-row { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; }
.rc-progress-wrap { flex: 1 1 380px; min-width: 0; }
.rc-bar {
  height: 12px; border-radius: 6px; background: #101c36; border: 1px solid var(--line);
  overflow: hidden; position: relative;
}
.rc-bar span {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--cyan));
  border-radius: 6px;
  box-shadow: 0 0 12px rgba(65, 215, 255, .5);
  transition: width .4s ease;
}
.rc-milestones {
  display: flex; justify-content: space-between; margin-top: 8px;
  font-family: Consolas, monospace; font-size: 10.5px; color: #5a6c93;
}
.rc-ms { position: relative; padding-top: 2px; }
.rc-ms.done { color: var(--cyan); }
.rc-ms-special.done { color: var(--gold); font-weight: 700; }
.rc-status { flex: 0 1 auto; }
.rc-title { font-size: 18px; font-weight: 800; color: #ffe6b8; margin-bottom: 4px; }
.rc-streak { font-size: 13px; }
.rc-streak b { color: var(--text); }

/* Скины фона */
.skin-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
}
.skin-card {
  overflow: hidden; display: flex; flex-direction: column;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.skin-card:hover { transform: translateY(-3px); border-color: var(--line-strong); box-shadow: 0 10px 30px rgba(46, 123, 255, .22); }
.skin-active { border-color: rgba(65, 215, 255, .55); box-shadow: 0 0 0 1px rgba(65, 215, 255, .3), 0 10px 30px rgba(65, 215, 255, .12); }
.skin-locked { opacity: .82; }
.skin-preview {
  display: block; aspect-ratio: 16 / 10; background: #0a1222;
  border-bottom: 1px solid var(--line);
}
.skin-preview svg { display: block; }
.skin-body { padding: 12px 13px 14px; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.skin-name { font-weight: 800; font-size: 14.5px; }
.skin-hint { font-size: 12px; min-height: 2.4em; }
.skin-state { font-size: 12.5px; font-weight: 700; }
.skin-state-active { color: var(--cyan); }
.skin-state-locked { color: #5a6c93; }

/* Достижения */
.achv-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(min(290px, 100%), 1fr));
}
.achv-card { display: flex; gap: 14px; padding: 15px 16px; align-items: flex-start; }
.achv-icon {
  flex: 0 0 auto; width: 46px; height: 46px; display: flex; align-items: center; justify-content: center;
  font-size: 22px; border-radius: 10px;
  background: rgba(255, 200, 97, .1); border: 1px solid rgba(255, 200, 97, .35);
}
.achv-locked .achv-icon { background: rgba(102, 153, 255, .05); border-color: var(--line); filter: grayscale(1); }
.achv-locked { opacity: .72; }
.achv-open { border-color: rgba(255, 200, 97, .3); }
.achv-body { min-width: 0; }
.achv-title { font-weight: 800; font-size: 14.5px; line-height: 1.3; margin-bottom: 3px; }
.achv-lvl {
  font-size: 11px; color: var(--gold); border: 1px solid rgba(255, 200, 97, .4);
  padding: 1px 7px; border-radius: 6px; vertical-align: 1px; margin-left: 4px;
}
.achv-desc { font-size: 12.5px; line-height: 1.45; }
.achv-progress { font-size: 12px; margin-top: 5px; color: var(--cyan); }
.achv-locked .achv-progress { color: #5a6c93; }

/* Статистика */
.stat-chips { display: flex; flex-wrap: wrap; gap: 9px; }
.stat-chips .chip b { color: var(--text); }

@media (max-width: 640px) {
  .achv-toast { width: min(330px, calc(100vw - 28px)); right: 14px; bottom: calc(14px + env(safe-area-inset-bottom)); }
  .conveyor-card { width: 148px; margin-right: 13px; }
}

/* ---------------- Баннеры профиля («статус») ---------------- */
.p-scene {
  position: relative; height: 150px; margin-top: 12px; overflow: hidden;
  border: 1px solid var(--line-strong); border-radius: 12px;
  box-shadow: 0 10px 34px rgba(0, 0, 0, .35);
}
.bn { position: absolute; inset: 0; overflow: hidden; }
.bn-preview-inner { width: 1180px; height: 150px; position: absolute; left: 50%; top: 0; transform-origin: top center; }

/* — общие частицы — */
.bn-star {
  position: absolute; width: 3px; height: 3px; border-radius: 50%;
  background: #cfe2ff; animation: bn-twinkle 3s ease-in-out infinite;
}
@keyframes bn-twinkle { 0%, 100% { opacity: .15; } 50% { opacity: .95; } }

.bn-beam {
  position: absolute; bottom: 0; width: 130px; height: 160px; pointer-events: none;
  background: linear-gradient(to top, rgba(111, 177, 255, .16), transparent 75%);
  transform-origin: bottom center; filter: blur(2px);
  animation: bn-sweep 6s ease-in-out infinite alternate;
}
@keyframes bn-sweep { from { transform: rotate(-14deg); } to { transform: rotate(14deg); } }
.bn-beam.bb1 { left: 28%; }
.bn-beam.bb2 { left: 58%; animation-delay: -3s; }

/* — билборд — */
.bn-billboard { background: linear-gradient(180deg, #04070f, #0a1428 60%, #0d1a30); }
.bn-board { position: absolute; left: 50%; top: 24px; transform: translateX(-50%); width: min(640px, 74%); }
.bn-board-screen {
  position: relative; height: 64px; border-radius: 10px; overflow: hidden;
  background: #0b1226; border: 3px solid #2e7bff;
  box-shadow: 0 0 18px rgba(46, 123, 255, .55), inset 0 0 26px rgba(46, 123, 255, .22);
  display: flex; align-items: center;
}
.bn-board-gem { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 26px; height: 26px; filter: drop-shadow(0 0 6px rgba(111, 177, 255, .8)); }
.bn-marquee {
  display: flex; width: max-content; white-space: nowrap; margin-left: 44px;
  animation: bn-marquee 16s linear infinite;
  font: 700 15px/1 Consolas, monospace; letter-spacing: 2px; color: #9fd0ff;
  text-shadow: 0 0 10px rgba(65, 215, 255, .7);
}
@keyframes bn-marquee { to { transform: translateX(-50%); } }
.bn-leg { position: absolute; top: 88px; width: 8px; height: 46px; background: #1a2745; border-radius: 0 0 3px 3px; }
.bn-leg.l1 { left: 32%; }
.bn-leg.l2 { right: 32%; }
.bn-road {
  position: absolute; bottom: 0; width: 100%; height: 22px;
  background: linear-gradient(180deg, #0a0f1c, #05080f);
  border-top: 1px solid rgba(111, 177, 255, .25);
}

/* — дакимакура — */
.bn-daki { background: linear-gradient(180deg, #170d18, #331a2e 55%, #6b3450); }
.bn-daki-moon {
  position: absolute; right: 7%; top: 12px; width: 44px; height: 44px; border-radius: 50%;
  background: #ffe9f2; box-shadow: 0 0 26px rgba(255, 233, 242, .65); opacity: .9;
}
.bn-petal {
  position: absolute; top: -14px; width: 11px; height: 8px; opacity: .85;
  background: #ffb7d0; border-radius: 62% 38% 60% 40%;
  animation: bn-petal 6s linear infinite;
}
@keyframes bn-petal {
  from { transform: translateY(0) rotate(0); }
  to { transform: translateY(185px) rotate(340deg); }
}
.bn-daki-pillow {
  position: absolute; left: 50%; top: 32px; transform: translateX(-50%);
  width: min(430px, 62%); animation: bn-float 4.2s ease-in-out infinite;
  filter: drop-shadow(0 12px 18px rgba(0, 0, 0, .4));
}
@keyframes bn-float { 0%, 100% { transform: translateX(-50%) translateY(0); } 50% { transform: translateX(-50%) translateY(-7px); } }
.bn-daki-tag {
  position: absolute; right: 5%; bottom: 11px; font-family: Consolas, monospace; font-size: 11.5px;
  color: #ffd7e8; background: rgba(23, 13, 24, .55); border: 1px solid rgba(255, 183, 208, .4);
  padding: 4px 10px; border-radius: 7px;
}

/* — экран танцпола — */
.bn-dance { background: linear-gradient(180deg, #0a0618, #1a0d38 60%, #241046); }
.bn-dance-floor {
  position: absolute; bottom: -6px; left: -15%; width: 130%; height: 48px; opacity: .8;
  background:
    repeating-linear-gradient(0deg, rgba(65, 215, 255, .16) 0 1.5px, transparent 1.5px 11px),
    repeating-linear-gradient(90deg, rgba(255, 79, 216, .12) 0 1.5px, transparent 1.5px 28px);
  transform: perspective(120px) rotateX(45deg); transform-origin: bottom;
}
.bn-ball {
  position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
  width: 34px; height: 34px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #e6f2ff, #8ba0c9 55%, #46536e);
  box-shadow: 0 0 16px rgba(200, 220, 255, .5);
}
.bn-ball-spark { position: absolute; top: 24px; width: 4px; height: 4px; border-radius: 50%; background: #fff; animation: bn-twinkle 1.6s ease-in-out infinite; }
.bn-ball-spark.s1 { left: 43%; }
.bn-ball-spark.s2 { left: 56%; animation-delay: .8s; }
.bn-dance-beam {
  position: absolute; top: -24px; width: 90px; height: 175px; pointer-events: none;
  transform-origin: top center; filter: blur(2px);
  background: linear-gradient(to bottom, rgba(255, 111, 174, .18), transparent 80%);
  animation: bn-sweep2 4.5s ease-in-out infinite alternate;
}
.bn-dance-beam.db1 { left: 20%; }
.bn-dance-beam.db2 { right: 20%; animation-delay: -2.2s; background: linear-gradient(to bottom, rgba(65, 215, 255, .16), transparent 80%); }
@keyframes bn-sweep2 { from { transform: rotate(-18deg); } to { transform: rotate(18deg); } }
.bn-dance-frame {
  position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(255, 255, 255, .03) 0 1px, transparent 1px 3px);
}

.bn-act { position: absolute; inset: 0; opacity: 0; }
.act-g { animation: bn-act1 9s linear infinite; }
.act-j { animation: bn-act2 9s linear infinite; }
.act-k { animation: bn-act3 9s linear infinite; }
@keyframes bn-act1 { 0%, 2% { opacity: 0; } 5%, 30% { opacity: 1; } 34%, 100% { opacity: 0; } }
@keyframes bn-act2 { 0%, 35% { opacity: 0; } 39%, 62% { opacity: 1; } 66%, 100% { opacity: 0; } }
@keyframes bn-act3 { 0%, 68% { opacity: 0; } 72%, 96% { opacity: 1; } 100%, 0% { opacity: 0; } }

/* танцовщицы — реальные GIF-ассеты с OpenGameArt (CC0, Ansimuz) */
.bn-dancer {
  position: absolute; image-rendering: pixelated;
  filter: drop-shadow(0 0 10px rgba(255, 111, 174, .4));
  animation: bn-dancer-bob .9s ease-in-out infinite alternate;
}
.bn-dancer.mir {
  transform: scaleX(-1);
  filter: drop-shadow(0 0 10px rgba(65, 215, 255, .4));
  animation-name: bn-dancer-bob-mir;
}
@keyframes bn-dancer-bob { from { transform: translateY(0); } to { transform: translateY(-4px); } }
@keyframes bn-dancer-bob-mir { from { transform: scaleX(-1) translateY(0); } to { transform: scaleX(-1) translateY(-4px); } }

/* Джоджо-акт: персонаж Warped City (CC0, Ansimuz), 4 кадра idle */
.bn-idle {
  position: absolute; bottom: 22px; left: 43%; width: 128px; height: 121px;
  transform: translateX(-50%);
  background: url("/static/profile-art/warped/idle-sheet.png") 0 0 / 512px 121px no-repeat;
  image-rendering: pixelated;
  animation: bn-idle-play .7s steps(4) infinite;
  filter: drop-shadow(0 0 12px rgba(201, 166, 255, .45));
}
@keyframes bn-idle-play { from { background-position-x: 0; } to { background-position-x: -512px; } }
.bn-gogo {
  position: absolute; bottom: -12px; font-family: Georgia, serif; font-weight: 700;
  color: #b98cff; opacity: 0; text-shadow: 0 0 10px rgba(185, 140, 255, .85);
  animation: bn-gogo 2.7s linear infinite;
}
@keyframes bn-gogo {
  0% { transform: translateY(0); opacity: 0; }
  15% { opacity: .95; }
  100% { transform: translateY(-115px); opacity: 0; }
}
/* Акт «Командир»: чиби-девушка (CC0, ruberboy) марширует, персонаж Warped City преклонил колено */
.bn-cmd {
  position: absolute; bottom: 18px; left: 38%; width: 80px; height: 124px;
  transform: translateX(-50%);
  background: url("/static/profile-art/chibi/chibi-sheet.png") 0 0 / 760px 124px no-repeat;
  animation: bn-cmd-play 1.1s steps(10) infinite;
  filter: drop-shadow(0 0 10px rgba(255, 215, 110, .3));
}
@keyframes bn-cmd-play { from { background-position-x: 0; } to { background-position-x: -760px; } }
.bn-kneel {
  position: absolute; bottom: 20px; left: 56%; width: 121px; height: 114px;
  transform: scaleX(-1); transform-origin: 50% 100%;
  background: url("/static/profile-art/warped/crouch.png") center bottom / 100% auto no-repeat;
  image-rendering: pixelated;
  animation: bn-kneel-bow 1.4s ease-in-out infinite;
  filter: brightness(1.45) drop-shadow(0 0 10px rgba(65, 215, 255, .45));
}
@keyframes bn-kneel-bow {
  0%, 100% { transform: scaleX(-1) rotate(0); }
  50% { transform: scaleX(-1) rotate(7deg); }
}
.bn-bubble {
  position: absolute; left: 41.5%; top: 46px; background: #fff; color: #1d2c4f;
  font-weight: 800; font-size: 13.5px; padding: 7px 12px; border-radius: 10px;
  animation: bn-bubble 1.1s ease-in-out infinite;
}
.bn-bubble::after {
  content: ""; position: absolute; left: -11px; top: 55%;
  border: 6px solid transparent; border-right-color: #fff;
}
@keyframes bn-bubble { 0%, 100% { transform: scale(1) rotate(-1deg); } 50% { transform: scale(1.08) rotate(1.5deg); } }
@media (prefers-reduced-motion: reduce) {
  .bn, .bn * { animation: none !important; }
  .bn-act.act-g { opacity: 1; }
}

@media (max-width: 860px) {
  .p-scene { height: 138px; }
  /* человечки не прячутся, а уменьшаются — анимации живут и на телефоне
     (zoom не конфликтует с transform-анимациями персонажей) */
  .bn-dancer { zoom: .58; }
  .bn-idle { zoom: .58; }
  .bn-cmd { zoom: .58; }
  .bn-kneel { zoom: .58; }
  .bn-gogo { zoom: .7; }
  .bn-bubble { zoom: .78; }
}

.skin-preview-wide { aspect-ratio: 16 / 7; }

/* ---------------- SVG-иконки (site/icons.py) с анимациями ---------------- */
.icon {
  width: 1em; height: 1em; display: inline-block; vertical-align: -.14em;
  flex: none; overflow: visible;
}

/* контекстные размеры и цвета */
.gem-balance .icon { color: #6fd3ff; }
.balance-label .icon { color: var(--cyan); }
.card-rating .icon, .star .icon, .chip-rating .icon { color: var(--gold); animation-duration: 3.4s; }
.chip .icon { color: var(--blue2); }
.achv-progress .icon { width: 11px; height: 11px; color: var(--cyan); }
.btn .icon { vertical-align: -.16em; }
.ni .icon { width: 17px; height: 17px; }
.nav-item .ni .icon { transition: transform .25s ease; }
.nav-item:hover .ni .icon { transform: scale(1.2); }
.skin-state-locked .icon { color: #5a6c93; }
.achv-icon .icon { width: 26px; height: 26px; color: var(--gold); }
.achv-locked .achv-icon .icon { color: #6c7ea8; }
.at-icon .icon { width: 26px; height: 26px; color: var(--gold); }
.at-reward .icon { width: 12px; height: 12px; color: var(--cyan); vertical-align: -.02em; }
.ep-del .icon { width: 13px; height: 13px; }
.ep-del:hover .icon { animation: i-wiggle .45s ease-in-out infinite; }
.flash .icon { width: 13px; height: 13px; }
.hints .icon { width: 12px; height: 12px; }

/* пульсирующая точка у метки «Применён» */
.dot-live {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--cyan); margin-right: 6px;
  animation: dot-pulse 1.6s ease-in-out infinite;
}
@keyframes dot-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(65, 208, 255, .5); }
  50% { box-shadow: 0 0 0 4px rgba(65, 208, 255, 0); }
}

/* ключевые кадры иконок */
@keyframes i-pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.14); opacity: .8; } }
@keyframes i-glow {
  0%, 100% { filter: drop-shadow(0 0 1px rgba(111, 211, 255, .25)); }
  50% { filter: drop-shadow(0 0 6px rgba(111, 211, 255, .85)); }
}
@keyframes i-gem {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 2px rgba(111, 211, 255, .3)); }
  50% { transform: scale(1.12) rotate(3deg); filter: drop-shadow(0 0 7px rgba(111, 211, 255, .85)); }
}
@keyframes i-twinkle { 0%, 100% { transform: scale(1) rotate(0); } 50% { transform: scale(1.18) rotate(14deg); } }
@keyframes i-bolt {
  0%, 88%, 100% { opacity: 1; transform: none; }
  90% { opacity: .3; transform: scale(.92) rotate(-5deg); }
  94% { opacity: 1; transform: scale(1.08); }
  97% { opacity: .55; }
}
@keyframes i-spin { to { transform: rotate(360deg); } }
@keyframes i-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-1.6px); } }
@keyframes i-nudge { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(1.4px); } }
@keyframes i-wiggle { 0%, 100% { transform: rotate(-7deg); } 50% { transform: rotate(7deg); } }
@keyframes i-bob { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-1.2px) rotate(-4deg); } }
@keyframes i-swing { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(9deg); } }
@keyframes i-flicker {
  0%, 100% { opacity: 1; transform: scale(1); }
  42% { opacity: .78; } 46% { opacity: .95; }
  55% { opacity: .7; transform: scale(.97); }
  65% { opacity: 1; transform: scale(1.03); }
}
@keyframes i-dash { to { stroke-dashoffset: -48; } }

/* классы анимаций (можно навешивать вручную: {{ icon('bolt', 'a-spin') }}) */
.a-pulse { animation: i-pulse 2.2s ease-in-out infinite; }
.a-glow { animation: i-glow 2.6s ease-in-out infinite; }
.a-gem { animation: i-gem 2.4s ease-in-out infinite; }
.a-star { animation: i-twinkle 2.8s ease-in-out infinite; }
.a-bolt { animation: i-bolt 3.4s linear infinite; }
.a-spin { animation: i-spin 9s linear infinite; }
.a-float { animation: i-float 2.8s ease-in-out infinite; }
.a-nudge { animation: i-nudge 1.9s ease-in-out infinite; }
.a-wiggle { animation: i-wiggle 2.6s ease-in-out infinite; }
.a-bob { animation: i-bob 2.7s ease-in-out infinite; }
.a-swing { animation: i-swing 3s ease-in-out infinite; }
.a-flicker { animation: i-flicker 2.9s linear infinite; }
.a-wave { stroke-dasharray: 30 18; animation: i-dash 1.5s linear infinite; }
.a-none { animation: none !important; }

/* чипы статистики: мягкий флоат с разбросом фаз, чтобы не дышали синхронно */
.stat-chips .chip .icon { animation: i-float 3.2s ease-in-out infinite; }
.stat-chips .chip:nth-child(2n) .icon { animation-delay: -.8s; }
.stat-chips .chip:nth-child(3n) .icon { animation-delay: -1.6s; }
.stat-chips .chip:nth-child(5n) .icon { animation-delay: -2.4s; }

@media (prefers-reduced-motion: reduce) {
  .icon, .dot-live { animation: none !important; }
}

/* ============================================================
   МОБИЛЬНАЯ ВЕРСИЯ: дополнения к брейкпоинтам выше
   ============================================================ */

/* ---------------- Плавающая кнопка «Следующая серия» ----------------
   Появляется на телефоне, когда плеер уехал за верхний край экрана:
   серию можно листать не скролля обратно к плееру. */
.next-fab {
  position: fixed; right: 14px; bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: 120;
  display: inline-flex; align-items: center; gap: 9px;
  padding: 15px 20px; color: #fff;
  font: 700 14.5px/1 "Segoe UI", Roboto, sans-serif; letter-spacing: .3px;
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-deep) 100%);
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
  box-shadow: 0 10px 32px rgba(46, 123, 255, .5);
  transform: translateY(110px); opacity: 0; pointer-events: none;
  transition: transform .32s cubic-bezier(.2, .9, .3, 1.2), opacity .28s ease, filter .15s ease;
}
.next-fab.fab-on { transform: translateY(0); opacity: 1; pointer-events: auto; }
.next-fab:active { filter: brightness(1.25); }
.nf-arrow { animation: nf-nudge 1.2s ease-in-out infinite; }
@keyframes nf-nudge {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(4px); }
}
@media (min-width: 901px) { .next-fab { display: none; } }
@media (prefers-reduced-motion: reduce) {
  .next-fab { transition: opacity .2s ease; transform: none; }
  .nf-arrow { animation: none; }
}

/* ---------------- Отклик на нажатие (тач-экраны) ----------------
   Ховер-эффекты на телефоне не работают — даём ощутимый отклик на :active */
@media (hover: none) {
  .chip, .ep-chip { transition: transform .12s ease; }
  .anime-card:active { transform: scale(.975); border-color: var(--line-strong); box-shadow: 0 6px 22px rgba(46, 123, 255, .3); }
  .anime-card:active .card-poster img { transform: scale(1.05); }
  .skin-card:active, .continue-card:active { transform: scale(.98); }
  .conveyor-card:active { transform: scale(.96); filter: brightness(1.12); }
  .btn:active { transform: scale(.97); filter: brightness(1.3); }
  .chip:active, .ep-chip:active { transform: scale(.94); color: #fff; border-color: var(--line-strong); }
  .ep-chip:active { background: rgba(102, 153, 255, .16); }
  .nav-item:active { background: rgba(102, 153, 255, .16); color: #fff; }
  .table tbody tr:active { background: rgba(102, 153, 255, .07); }
  .skin-preview svg, .skin-preview { transition: transform .15s ease; }
  .skin-card:active .skin-preview { transform: scale(1.02); }
  .sticker-btn:active { transform: scale(.9); }
  .dlg-row:active { background: rgba(102, 153, 255, .12); }
  .msg:active { filter: brightness(1.08); }
}

/* ============================================================
   СОЦСИСТЕМА: друзья, диалоги, чат, стикеры, «Маскот дня»
   ============================================================ */

/* --- аватарки-буквы --- */
.ava {
  flex: 0 0 auto; width: 42px; height: 42px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 17px; color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--blue-deep));
  box-shadow: 0 4px 14px rgba(46, 123, 255, .35);
  user-select: none;
}
.ava-sm { width: 26px; height: 26px; font-size: 12px; box-shadow: none; }
.ava-gem { background: linear-gradient(135deg, #6fb1ff, #41d7ff); }

/* --- страница «Друзья» --- */
.fr-list { display: flex; flex-direction: column; gap: 10px; }
.fr-row { display: flex; align-items: center; gap: 13px; padding: 11px 15px; }
.fr-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.fr-name { font-size: 15px; overflow-wrap: anywhere; }
.fr-sub { font-size: 12.5px; color: var(--muted); }
.fr-sub.seen-online { color: #45d483; font-weight: 600; }

/* --- список диалогов --- */
.msg-layout { display: grid; grid-template-columns: 1.5fr 1fr; gap: 16px; align-items: start; }
.dlg-panel, .grp-panel { padding: 16px; }
.dlg-list { display: flex; flex-direction: column; }
.dlg-row { display: flex; gap: 12px; align-items: center; padding: 11px 10px; border-radius: 10px; color: var(--text); }
.dlg-row:hover { background: rgba(102, 153, 255, .08); color: var(--text); }
.dlg-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.dlg-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.dlg-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dlg-stamp { font-size: 11.5px; color: #5a6c93; flex: none; font-family: Consolas, monospace; }
.dlg-bottom { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.dlg-preview { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dlg-unread, .nav-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 21px; height: 21px; padding: 0 6px; border-radius: 11px;
  font-size: 12px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  box-shadow: 0 3px 10px rgba(46, 123, 255, .45);
}
.nav-badge { vertical-align: 2px; margin-left: 7px; }
.grp-members { max-height: 230px; overflow-y: auto; display: flex; flex-direction: column; gap: 5px; padding: 4px; }

/* --- страница чата --- */
.chat-back { display: inline-block; font-size: 13.5px; margin: 2px 0 10px; }
.chat-panel { display: flex; flex-direction: column; overflow: hidden; }
.chat-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 13px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.chat-head-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.chat-head-info { display: flex; flex-direction: column; min-width: 0; }
.chat-title { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-sub { font-size: 12px; color: var(--muted); }
.chat-head-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.chat-addform { display: flex; gap: 6px; align-items: center; }
.chat-addform .select { width: auto; padding: 6px 9px; font-size: 13px; max-width: 150px; }
.chat-sound-btn .icon { width: 17px; height: 17px; display: block; }
.chat-sound-btn.is-off { opacity: .45; }

.chat-msgs {
  display: flex; flex-direction: column; gap: 9px; padding: 16px;
  overflow-y: auto; max-height: 62vh; min-height: 300px;
  scrollbar-gutter: stable;
}
.msg {
  max-width: 76%; padding: 8px 13px 6px; border-radius: 14px;
  background: var(--panel2); border: 1px solid var(--line); align-self: flex-start;
}
.msg.mine {
  align-self: flex-end;
  background: linear-gradient(135deg, rgba(46, 123, 255, .3), rgba(30, 79, 216, .18));
  border-color: var(--line-strong);
}
.msg-user { font-size: 11.5px; font-weight: 700; color: var(--blue2); margin-bottom: 2px; }
.msg-body { font-size: 14.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-meta { font-size: 10.5px; color: #5a6c93; text-align: right; margin-top: 3px; font-family: Consolas, monospace; }
.msg-sticker { background: transparent; border-color: transparent; padding: 0 2px; }
.msg-sticker-img { width: 110px; height: 110px; }
.msg-sticker .msg-meta {
  width: max-content; margin: -8px auto 0; position: relative;
  background: rgba(6, 10, 19, .6); border-radius: 8px; padding: 1px 7px;
}
.msg-system {
  align-self: center; font-size: 12px; color: var(--muted); text-align: center;
  background: rgba(102, 153, 255, .07); border: 1px dashed var(--line);
  padding: 4px 12px; border-radius: 10px;
}

/* композер + панель стикеров */
.chat-composer-wrap { position: relative; border-top: 1px solid var(--line); }
.chat-composer { display: flex; gap: 8px; padding: 12px 14px; align-items: flex-end; }
.chat-composer .input { flex: 1; }
#chat-input {
  resize: none; min-height: 42px; max-height: 132px;
  line-height: 1.45; overflow-y: auto;
}
.chat-sticker-btn { padding: 9px 12px; flex: none; }
.chat-sticker-btn .icon { width: 20px; height: 20px; }
.sticker-panel {
  /* fixed, а не absolute: .chat-panel с overflow:hidden обрезал верх панели
     (шапку с табами) на невысоких окнах — «стикеры не листаются» */
  position: fixed; right: 16px; bottom: 86px; z-index: 90;
  width: min(390px, calc(100vw - 28px));
  display: flex; flex-direction: column;
  max-height: min(62vh, 520px);
  padding: 12px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .55);
}
/* ВАЖНО: у .sticker-panel есть display:flex — он перебивает атрибут [hidden],
   и панель «висит» открытой; это правило возвращает закрытие */
.sticker-panel[hidden] { display: none !important; }
.sticker-panel-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 8px; margin-bottom: 4px;
}
.sticker-panel-head .panel-title { margin: 0; }
.sticker-close {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; padding: 0; cursor: pointer;
  background: rgba(102, 153, 255, .08); color: var(--muted);
  border: 1px solid var(--line); border-radius: 8px;
  transition: color .12s ease, border-color .12s ease;
}
.sticker-close:hover { color: #fff; border-color: var(--line-strong); }
.sticker-close .icon { width: 15px; height: 15px; }
.sticker-tabs {
  display: flex; gap: 6px; padding: 2px 0 8px;
  overflow-x: auto; scrollbar-width: none;
}
.sticker-tabs::-webkit-scrollbar { display: none; }
.sticker-tab {
  flex: none; padding: 6px 12px; font-size: 12.5px; font-weight: 600;
  color: var(--muted); background: rgba(102, 153, 255, .06);
  border: 1px solid var(--line); border-radius: 8px; cursor: pointer;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.sticker-tab:hover { color: #fff; border-color: var(--line-strong); }
.sticker-tab.active { color: #fff; background: rgba(46, 123, 255, .22); border-color: var(--blue); }
.sticker-scroll {
  flex: 1 1 auto; min-height: 0; max-height: none; overflow-y: auto;
  /* изоляция прокрутки: свайп не «протекает» в страницу под панелью */
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
}
.sticker-scroll::-webkit-scrollbar { width: 8px; }
.sticker-scroll::-webkit-scrollbar-thumb { background: #2e4a7d; border: 0; border-radius: 4px; }
.sticker-scroll::-webkit-scrollbar-track { background: rgba(102, 153, 255, .06); }
.sticker-group-name {
  font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase;
  color: #5a6c93; margin: 9px 2px 6px;
}
.sticker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 6px; }
.sticker-btn {
  background: rgba(102, 153, 255, .05); border: 1px solid transparent; border-radius: 12px;
  padding: 5px; cursor: pointer;
  transition: transform .12s ease, border-color .12s ease, background .12s ease;
}
.sticker-btn:hover { transform: scale(1.07); border-color: var(--line-strong); background: rgba(102, 153, 255, .12); }
.sticker-btn img { width: 100%; aspect-ratio: 1; }

/* всплывающая ошибка отправки */
.chat-error {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 300;
  padding: 11px 18px; font-size: 14px; color: #fff; white-space: nowrap;
  background: linear-gradient(135deg, #e8465a, #b22639); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
  animation: at-in .3s ease; transition: opacity .5s ease;
  max-width: calc(100vw - 28px); overflow: hidden; text-overflow: ellipsis;
}
.chat-error-hide { opacity: 0; }

/* всплывающие уведомления о новых сообщениях (справа) */
.chat-toasts {
  position: fixed; right: 14px; bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  z-index: 250; display: flex; flex-direction: column; gap: 8px;
  width: min(320px, calc(100vw - 28px));
}
.chat-toast {
  display: flex; gap: 10px; align-items: center; padding: 10px 12px;
  background: linear-gradient(150deg, var(--panel), var(--panel2));
  border: 1px solid var(--line-strong); border-radius: 12px; cursor: pointer;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .5);
  animation: toast-in .28s ease; transition: opacity .4s ease, transform .4s ease;
}
@keyframes toast-in {
  from { transform: translateX(46px); opacity: 0; }
}
.chat-toast-out { opacity: 0; transform: translateX(30px); }
.chat-toast-ava { width: 36px; height: 36px; flex: none; font-size: 15px; }
img.chat-toast-ava { padding: 2px; background: rgba(102, 153, 255, .08); border-radius: 10px; }
.chat-toast-info { flex: 1; min-width: 0; }
.chat-toast-top { display: flex; align-items: baseline; gap: 7px; min-width: 0; }
.chat-toast-name {
  font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-toast-sender {
  font-size: 11.5px; color: var(--blue2); flex: none;
  max-width: 45%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-toast-body {
  font-size: 12.5px; color: var(--muted); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-toast-go { flex: none; color: var(--blue2); font-weight: 700; }

/* --- «Маскот дня» на главной --- */
.mascot-sec { margin-top: 20px; }
.mascot-card {
  max-width: 520px; margin: 0 auto; padding: 18px 26px 16px;
  text-align: center; overflow: hidden;
}
.mascot-card::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, transparent 42%, rgba(65, 215, 255, .07) 50%, transparent 58%);
}
.mascot-label { display: flex; align-items: center; justify-content: center; gap: 7px; margin-bottom: 8px; }
.mascot-label .icon { width: 16px; height: 16px; color: var(--gold); }
.mascot-label-text {
  font-weight: 900; font-size: 15px; letter-spacing: 3px; text-transform: uppercase;
  background: linear-gradient(90deg, var(--blue2), var(--cyan));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.mascot-img {
  width: 96px; height: 96px; margin: 2px auto 8px; display: block;
  animation: mascot-float 3.2s ease-in-out infinite;
  filter: drop-shadow(0 10px 22px rgba(46, 123, 255, .35));
}
@keyframes mascot-float {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-7px) rotate(2deg); }
}
.mascot-wish { font-size: 15.5px; font-weight: 600; margin: 0 auto; max-width: 420px; }
.mascot-note { font-size: 12px; color: var(--muted); margin-top: 7px; font-family: Consolas, monospace; }
.mascot-fair { text-align: center; font-size: 11.5px; color: #5a6c93; margin-top: 8px; }
@media (prefers-reduced-motion: reduce) {
  .mascot-img { animation: none; }
}

/* --- соцсистема: адаптив --- */
@media (max-width: 900px) {
  .msg-layout { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .fr-row { flex-wrap: wrap; }
  .fr-row .actions { flex-basis: 100%; justify-content: flex-end; }
  /* чат занимает практически весь экран, лента тянется между шапкой и композером */
  .chat-panel { min-height: calc(100vh - 130px); }
  @supports (height: 100dvh) {
    .chat-panel { min-height: calc(100dvh - 130px); }
  }
  .chat-msgs { flex: 1 1 auto; max-height: none; min-height: 0; padding: 12px; }
  .msg { max-width: 88%; }
  .msg-sticker-img { width: 92px; height: 92px; }
  .chat-composer {
    padding: 10px; gap: 7px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    position: sticky; bottom: 0;
    background: inherit;
  }
  .chat-composer .btn { flex: none; }
  #chat-input { min-height: 46px; max-height: 110px; }
  .chat-addform { flex-basis: 100%; }
  .chat-addform .select { flex: 1; max-width: none; }
  /* панель стикеров — фиксированный «bottom sheet»: всегда целиком на экране,
     сетка листается внутри жестом (контейнер .sticker-scroll изолирован) */
  .sticker-panel {
    position: fixed; left: 10px; right: 10px; bottom: calc(76px + env(safe-area-inset-bottom, 0px));
    width: auto; z-index: 90;
    display: flex; flex-direction: column;
    max-height: min(62vh, 480px);
    padding: 10px 12px 12px;
  }
  .sticker-panel-head, .sticker-tabs { flex: none; }
  .sticker-scroll { flex: 1 1 auto; min-height: 0; max-height: none; }
  .sticker-grid { grid-template-columns: repeat(4, 1fr); }
  .mascot-card { padding: 16px 16px 14px; }
  .mascot-wish { font-size: 14.5px; }
  .chat-error { bottom: calc(18px + env(safe-area-inset-bottom, 0px)); }
  /* уведомления — сверху справа, чтобы не закрывать композер */
  .chat-toasts {
    right: 10px; left: auto; top: calc(64px + env(safe-area-inset-top, 0px));
    bottom: auto; width: min(300px, calc(100vw - 20px));
  }
}
