/* ——————————————————————————— Дизайн-система Lumen Studio */
:root {
  --bg: #08080c;
  --bg-2: #0e0e15;
  --surface: #14141d;
  --surface-2: #1b1b26;
  --surface-3: #23232f;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #f4f2ee;
  --text-dim: #a7a5b4;
  --text-faint: #6f6d7e;
  --accent: #ffd75e;
  --accent-2: #a48bff;
  --accent-3: #ff7ab6;
  --ok: #3ddc97;
  --warn: #ffb347;
  --err: #ff5a5f;
  --radius: 20px;
  --radius-sm: 12px;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
  --font-ui: 'Manrope', 'Golos Text', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Unbounded', 'Manrope', system-ui, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.45;
  min-height: 100%;
  overscroll-behavior-y: none;
}

body {
  background:
    radial-gradient(1200px 700px at 110% -10%, rgba(164, 139, 255, 0.16), transparent 60%),
    radial-gradient(900px 600px at -15% 8%, rgba(255, 215, 94, 0.10), transparent 55%),
    var(--bg);
  padding-bottom: calc(88px + var(--safe-b));
}

#app {
  max-width: 720px;
  margin: 0 auto;
  padding: calc(14px + var(--safe-t)) 16px 8px;
}

button {
  font-family: inherit;
}

input,
textarea,
select {
  font-family: inherit;
  font-size: 16px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  width: 100%;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
  -webkit-appearance: none;
  appearance: none;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent-2);
  background: var(--surface-3);
}

textarea {
  resize: vertical;
  min-height: 88px;
  line-height: 1.4;
}

select {
  background-image: linear-gradient(45deg, transparent 50%, var(--text-dim) 50%), linear-gradient(135deg, var(--text-dim) 50%, transparent 50%);
  background-position: calc(100% - 19px) 50%, calc(100% - 14px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 6px;
  letter-spacing: 0.2px;
}

/* ——————————————————————————— Хедер */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--accent), var(--accent-3) 55%, var(--accent-2));
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 800;
  color: #101014;
  font-size: 17px;
  box-shadow: 0 6px 18px rgba(255, 215, 94, 0.22);
}

.brand-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.3px;
  line-height: 1.1;
}

.brand-sub {
  font-size: 11.5px;
  color: var(--text-faint);
}

.chip-account {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  max-width: 46vw;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.chip-account .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  flex: 0 0 auto;
}

.dot.ok {
  background: var(--ok);
}

/* ——————————————————————————— Карточки и блоки */
.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.012));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}

.card.tight {
  padding: 13px;
}

.card-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  margin: 0 0 4px;
  letter-spacing: -0.2px;
}

.card-sub {
  color: var(--text-dim);
  font-size: 13px;
  margin: 0 0 12px;
}

.section-title {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.4px;
  margin: 22px 0 10px;
}

.section-title:first-child {
  margin-top: 0;
}

.row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.row.wrap {
  flex-wrap: wrap;
}

.grow {
  flex: 1;
  min-width: 0;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.stack > * + * {
  margin-top: 12px;
}

.muted {
  color: var(--text-dim);
}

.faint {
  color: var(--text-faint);
}

.small {
  font-size: 12.5px;
}

.xsmall {
  font-size: 11.5px;
}

.center {
  text-align: center;
}

/* ——————————————————————————— Кнопки */
.btn {
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 13px;
  padding: 11px 15px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.08s, background 0.15s, border-color 0.15s, opacity 0.15s;
  min-height: 44px;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.975);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn.primary {
  background: linear-gradient(135deg, var(--accent), #ffc94d);
  color: #131316;
  border-color: transparent;
  box-shadow: 0 10px 26px rgba(255, 215, 94, 0.18);
}

.btn.ghost {
  background: transparent;
}

.btn.accent {
  background: linear-gradient(135deg, var(--accent-2), #7d63ff);
  color: #fff;
  border-color: transparent;
}

.btn.danger {
  background: rgba(255, 90, 95, 0.12);
  border-color: rgba(255, 90, 95, 0.4);
  color: #ff8a8d;
}

.btn.block {
  width: 100%;
}

.btn.sm {
  padding: 8px 11px;
  font-size: 12.5px;
  min-height: 36px;
  border-radius: 10px;
}

.btn.icon {
  width: 44px;
  padding: 0;
  flex: 0 0 auto;
}

.btn-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-row.equal > .btn {
  flex: 1;
}

/* ——————————————————————————— Табы/сегменты */
.seg {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px;
  gap: 3px;
  overflow-x: auto;
  scrollbar-width: none;
}

.seg::-webkit-scrollbar {
  display: none;
}

.seg button {
  border: none;
  background: transparent;
  color: var(--text-dim);
  border-radius: 999px;
  padding: 8px 13px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.seg button.active {
  background: var(--surface-3);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

/* ——————————————————————————— Нижняя навигация */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  padding: 8px 12px calc(8px + var(--safe-b));
  background: linear-gradient(180deg, rgba(8, 8, 12, 0.4), rgba(8, 8, 12, 0.96) 45%);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.tabbar-inner {
  max-width: 720px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 5px;
}

.tabbar button {
  border: none;
  background: transparent;
  color: var(--text-faint);
  border-radius: 13px;
  padding: 7px 2px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 10.5px;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font-ui);
}

.tabbar button svg {
  width: 21px;
  height: 21px;
}

.tabbar button.active {
  color: var(--bg);
  background: linear-gradient(135deg, var(--accent), #ffcb54);
}

/* ——————————————————————————— Метрики */
.metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.metric {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 13px;
}

.metric .k {
  font-size: 11.5px;
  color: var(--text-faint);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.metric .v {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.6px;
  margin-top: 2px;
  line-height: 1.15;
}

.metric .d {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
}

.health-ring {
  --pct: 0;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--pct) * 1%), rgba(255, 255, 255, 0.08) 0);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.health-ring::before {
  content: '';
  position: absolute;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background: var(--surface);
}

.health-ring > span {
  position: relative;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 21px;
}

.bar {
  height: 7px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.bar > i {
  display: block;
  height: 100%;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--accent), var(--accent-3));
}

.bar.alt > i {
  background: linear-gradient(90deg, var(--accent-2), #5fd3ff);
}

/* ——————————————————————————— Списки/пункты */
.list-item {
  display: flex;
  gap: 11px;
  padding: 11px 0;
  border-top: 1px solid var(--line);
  align-items: flex-start;
}

.list-item:first-child {
  border-top: none;
}

.bullet {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 800;
  background: rgba(255, 215, 94, 0.14);
  color: var(--accent);
  margin-top: 1px;
}

.bullet.ok {
  background: rgba(61, 220, 151, 0.14);
  color: var(--ok);
}

.bullet.warn {
  background: rgba(255, 179, 71, 0.14);
  color: var(--warn);
}

.tag {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-dim);
  border: 1px solid var(--line);
}

.tag.accent {
  background: rgba(255, 215, 94, 0.13);
  color: var(--accent);
  border-color: rgba(255, 215, 94, 0.25);
}

.tag.violet {
  background: rgba(164, 139, 255, 0.14);
  color: var(--accent-2);
  border-color: rgba(164, 139, 255, 0.28);
}

.tag.pink {
  background: rgba(255, 122, 182, 0.14);
  color: var(--accent-3);
  border-color: rgba(255, 122, 182, 0.28);
}

.tag.green {
  background: rgba(61, 220, 151, 0.13);
  color: var(--ok);
  border-color: rgba(61, 220, 151, 0.28);
}

/* ——————————————————————————— Идеи */
.idea {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  margin-bottom: 11px;
  transition: border-color 0.15s, transform 0.1s;
}

.idea:active {
  transform: scale(0.995);
}

.idea-head {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.idea-title {
  font-weight: 800;
  font-size: 15px;
  line-height: 1.28;
  margin: 0 0 5px;
  letter-spacing: -0.2px;
}

.score {
  flex: 0 0 auto;
  width: 50px;
  height: 50px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 16px;
  background: rgba(255, 215, 94, 0.12);
  color: var(--accent);
  border: 1px solid rgba(255, 215, 94, 0.25);
}

.score.mid {
  background: rgba(164, 139, 255, 0.12);
  color: var(--accent-2);
  border-color: rgba(164, 139, 255, 0.25);
}

.score.low {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-dim);
  border-color: var(--line);
}

.hook {
  font-size: 13px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border-left: 3px solid var(--accent-3);
  border-radius: 0 9px 9px 0;
  padding: 7px 10px;
  margin: 9px 0;
}

.outline {
  margin: 8px 0 0;
  padding-left: 0;
  list-style: none;
  counter-reset: oi;
}

.outline li {
  counter-increment: oi;
  position: relative;
  padding-left: 24px;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 5px;
  line-height: 1.4;
}

.outline li::before {
  content: counter(oi);
  position: absolute;
  left: 0;
  top: 1px;
  width: 17px;
  height: 17px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-dim);
  font-size: 10.5px;
  font-weight: 800;
  display: grid;
  place-items: center;
}

.reason {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 9px;
  line-height: 1.42;
}

.idea-actions {
  display: flex;
  gap: 7px;
  margin-top: 11px;
  flex-wrap: wrap;
}

/* ——————————————————————————— Шаблоны/сетки */
.tpl-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.tpl {
  border: 1px solid var(--line);
  border-radius: 15px;
  overflow: hidden;
  background: var(--surface);
  cursor: pointer;
  position: relative;
  transition: border-color 0.15s, transform 0.1s;
}

.tpl:active {
  transform: scale(0.98);
}

.tpl.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent) inset;
}

.tpl canvas {
  display: block;
  width: 100%;
  height: auto;
  background: #000;
}

.tpl .tpl-name {
  padding: 8px 10px 9px;
  font-size: 12.5px;
  font-weight: 700;
}

.tpl .tpl-desc {
  padding: 0 10px 10px;
  margin-top: -5px;
  font-size: 11px;
  color: var(--text-faint);
  line-height: 1.32;
}

/* ——————————————————————————— Редактор */
.editor {
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-gutter: stable;
}

/*
 * Панель редактирования свойств на телефоне перекрывала макет: холст и шапка
 * закрепляем сверху, чтобы превью всегда было видно во время правок.
 */
.editor-sticky {
  position: sticky;
  top: calc(-10px - var(--safe-t));
  z-index: 5;
  background: var(--bg-2);
  margin: calc(-10px - var(--safe-t)) -12px 0;
  padding: calc(10px + var(--safe-t)) 12px 8px;
  border-bottom: 1px solid var(--line);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
}

/* Макет в закреплённой панели компактнее — свойства получают больше места. */
.editor-sticky .canvas-wrap {
  max-height: 34vh;
  width: max-content;
  max-width: 100%;
  margin: 0 auto;
  padding: 0 8px;
}

.editor-sticky .canvas-wrap canvas {
  max-height: 34vh;
  width: auto;
  max-width: 100%;
}

/* Превью слайдов в закреплённой панели — в одну компактную строку. */
.editor-sticky .thumb-row {
  margin: 6px 0 0;
}

.editor-sticky .slide-thumb {
  width: 56px;
}

.canvas-wrap {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  background: #000;
  border: 1px solid var(--line);
  touch-action: none;
  user-select: none;
  display: flex;
  justify-content: center;
}

.canvas-wrap canvas {
  display: block;
  width: 100%;
  height: auto;
}

.layer-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 230px;
  overflow-y: auto;
}

.layer-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 12.5px;
}

.layer-row.active {
  border-color: var(--accent-2);
  background: var(--surface-3);
}

.layer-row .kind {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.07);
  display: grid;
  place-items: center;
  font-size: 11px;
  flex: 0 0 auto;
}

.layer-row .name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prop-group {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  margin-top: 12px;
}

.prop-group:first-child {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}

input[type='range'] {
  -webkit-appearance: none;
  appearance: none;
  height: 26px;
  background: transparent;
  padding: 0;
  border: none;
}

input[type='range']::-webkit-slider-runnable-track {
  height: 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.13);
}

input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: -7.5px;
  border: 2px solid #111;
}

input[type='color'] {
  padding: 3px;
  height: 42px;
  cursor: pointer;
}

.swatch-row {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.swatch {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  border: 2px solid rgba(255, 255, 255, 0.18);
  cursor: pointer;
  flex: 0 0 auto;
}

.swatch.active {
  border-color: var(--text);
  transform: scale(1.08);
}

.sticker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(58px, 1fr));
  gap: 7px;
  max-height: 260px;
  overflow-y: auto;
  padding: 2px;
}

.sticker-btn {
  aspect-ratio: 1;
  border-radius: 11px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 7px;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.sticker-btn img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.sticker-btn:active {
  transform: scale(0.94);
}

.font-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}

.font-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 11px;
  background: var(--surface-2);
  cursor: pointer;
  min-width: 0;
}

.font-card.active {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.font-card .sample {
  font-size: 21px;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.font-card .meta {
  font-size: 10.5px;
  color: var(--text-faint);
  margin-top: 4px;
}

/* ——————————————————————————— Модальные окна */
.modal-back {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade 0.16s ease-out;
}

.modal {
  width: 100%;
  max-width: 720px;
  max-height: 92vh;
  overflow-y: auto;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 22px 22px 0 0;
  padding: 18px 16px calc(22px + var(--safe-b));
  animation: slide-up 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@media (min-width: 640px) {
  .modal-back {
    align-items: center;
  }
  .modal {
    border-radius: 22px;
    max-width: 620px;
    max-height: 88vh;
  }
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

@keyframes slide-up {
  from {
    transform: translateY(22px);
    opacity: 0.6;
  }
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
}

/* ——————————————————————————— Разное */
.hint {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 6px;
  line-height: 1.42;
}

.banner {
  border-radius: 14px;
  padding: 11px 13px;
  font-size: 13px;
  background: rgba(164, 139, 255, 0.10);
  border: 1px solid rgba(164, 139, 255, 0.25);
  color: #d9d0ff;
  margin-bottom: 12px;
  line-height: 1.42;
}

.banner.warn {
  background: rgba(255, 179, 71, 0.10);
  border-color: rgba(255, 179, 71, 0.28);
  color: #ffd9a1;
}

.banner.err {
  background: rgba(255, 90, 95, 0.10);
  border-color: rgba(255, 90, 95, 0.3);
  color: #ffb0b2;
}

.banner.ok {
  background: rgba(61, 220, 151, 0.10);
  border-color: rgba(61, 220, 151, 0.28);
  color: #a6f0cc;
}

.empty {
  text-align: center;
  padding: 34px 16px;
  color: var(--text-dim);
}

.empty .emoji {
  font-size: 38px;
  margin-bottom: 8px;
}

.spinner {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, 0.25);
  border-top-color: var(--text);
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + var(--safe-b));
  transform: translateX(-50%) translateY(14px);
  background: var(--surface-3);
  border: 1px solid var(--line-strong);
  color: var(--text);
  padding: 11px 16px;
  border-radius: 13px;
  font-size: 13px;
  font-weight: 600;
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  max-width: 88vw;
  box-shadow: var(--shadow);
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Тосты не кликабельны и не должны перехватывать скролл/свайпы */
.toast {
  pointer-events: none;
  contain: layout style paint;
}

.toast.err {
  border-color: rgba(255, 90, 95, 0.5);
}

.thumb-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.thumb-row::-webkit-scrollbar {
  display: none;
}

.slide-thumb {
  flex: 0 0 auto;
  width: 74px;
  border-radius: 9px;
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
  background: #000;
  position: relative;
}

.slide-thumb.active {
  border-color: var(--accent);
}

.slide-thumb canvas {
  display: block;
  width: 100%;
  height: auto;
}

.slide-thumb .n {
  position: absolute;
  left: 4px;
  top: 3px;
  font-size: 10px;
  font-weight: 800;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 4px;
  padding: 0 4px;
  color: #fff;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}

.switch input {
  width: 42px;
  height: 25px;
  border-radius: 999px;
  background: var(--surface-3);
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  cursor: pointer;
  border: 1px solid var(--line-strong);
  padding: 0;
  transition: background 0.15s;
  flex: 0 0 auto;
}

.switch input::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: var(--text-dim);
  transition: transform 0.17s, background 0.17s;
}

.switch input:checked {
  background: rgba(255, 215, 94, 0.35);
  border-color: rgba(255, 215, 94, 0.6);
}

.switch input:checked::after {
  transform: translateX(17px);
  background: var(--accent);
}

details.more {
  border-top: 1px solid var(--line);
  margin-top: 10px;
  padding-top: 8px;
}

details.more > summary {
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-dim);
  list-style: none;
}

details.more > summary::-webkit-details-marker {
  display: none;
}

details.more > summary::before {
  content: '▸ ';
}

details.more[open] > summary::before {
  content: '▾ ';
}

.cover-badge {
  position: absolute;
  right: 8px;
  top: 8px;
  font-size: 10px;
  font-weight: 800;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 6px;
  padding: 2px 6px;
  color: #fff;
}

.kbd {
  font-family: var(--font-ui);
  font-size: 11px;
  background: var(--surface-3);
  border-radius: 5px;
  padding: 1px 6px;
  border: 1px solid var(--line-strong);
}

@media (max-width: 380px) {
  .metrics {
    grid-template-columns: 1fr;
  }
  .grid-2 {
    grid-template-columns: 1fr;
  }
}
