/* ============ Шрифт заголовков ============ */
/* Nauryz Red Keds (© 2024 Red Keds, бесплатный), в файле только кириллица, латиница и знаки. */
@font-face {
  font-family: 'NauryzRedKeds';
  src: url('../fonts/NauryzRedKeds.woff2') format('woff2');
  font-weight: 100 900; /* одно начертание на все веса — без искусственного жирного */
  font-display: swap;
}

/* ============ Токены ============ */
:root {
  --cream: #FFFFFF;
  --cyan: #DAF5F9;
  --paper: #FFFFFF;
  --ink: #1C1B3A;
  --ink-2: #5D6182;
  --tomato: #EC1864;      /* акцент: малиновый */
  --tomato-deep: #E0115F; /* он же на кнопках: белый текст на #EC1864 не дотягивает
                             по контрасту до 4.5:1, а на этом — 4.8:1. Разницы глазом
                             не видно, поэтому фирменный цвет остался прежним. */
  --lilac: #B79CF2;
  --sun: #FFE066;    /* жёлтый: был #FFC43D, но читался оранжевым */
  --green: #A5E3B2;  /* «сделано» */
  --stone: #D5CCBD;  /* «Все»: единственный тон без собственного цвета */
  --slate: #4A4E6E;  /* «заброшено» */
  --forest: #6077D4;
  --yellow: #FFE066;
  --blue: #6077D4;
  --lav: #DAF5F9;
  --violet: #6077D4;
  --peach: #B79CF2;

  --r: 14px;          /* радиус вогнутых «плечиков» язычка */
  --tab-w: 50px;      /* ширина боковых язычков папок */
  --gutter: 28px;
  --lane: calc(var(--gutter) + var(--tab-w)); /* правая полоса: язычки папок и кнопка корзины */

  /* Заголовки — Nauryz Red Keds (файл в fonts/). Пока он не загрузился, браузер берёт Onest. */
  --display: 'NauryzRedKeds', 'Onest', system-ui, sans-serif;
  --font: 'Onest', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --hand: 'Caveat', 'Comic Sans MS', cursive;
  --mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', monospace;

  --page: var(--cyan);
  --grid: rgba(96, 119, 212, .15);
  --shadow: rgba(28, 27, 58, .2);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--ink);
  background-color: var(--page);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 34px 34px;
  transition: background-color .45s ease;
  overflow-x: hidden;
}

/* бумажное зерно поверх всего */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  opacity: .13;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .11 0 0 0 0 .11 0 0 0 0 .23 0 0 0 .5 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

body.has-modal { overflow: hidden; }

/* ============ Полосы прокрутки ============ */
/* Бегунок — «таблетка» цвета текста страницы, дорожка — цвет фона под ней.
   Chrome и Safari берут ::-webkit-scrollbar, Firefox — scrollbar-color. */
:root { --sb-thumb: var(--page-fi, var(--ink)); --sb-track: var(--page); }
::-webkit-scrollbar { width: 14px; height: 14px; }
::-webkit-scrollbar-track { background: var(--sb-track); }
::-webkit-scrollbar-thumb {
  background: var(--sb-thumb);
  border: 4px solid var(--sb-track);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover { border-width: 3px; }
::-webkit-scrollbar-corner { background: var(--sb-track); }
@supports (-moz-appearance: none) {
  html { scrollbar-color: var(--sb-thumb) var(--sb-track); }
  .modal, .picker-list, .lookup-results, .search-results { scrollbar-color: var(--sb-thumb) var(--sb-track); scrollbar-width: thin; }
}
/* внутренние списки — на белом фоне */
.picker-list, .lookup-results, .search-results { --sb-thumb: var(--ink); --sb-track: #FFFFFF; }
.picker-list::-webkit-scrollbar, .lookup-results::-webkit-scrollbar, .search-results::-webkit-scrollbar { width: 12px; }
/* модальное окно прокручивается поверх затемнения */
.modal { --sb-thumb: rgba(255, 255, 255, .85); --sb-track: transparent; }
.modal::-webkit-scrollbar-thumb { border-color: transparent; background-clip: padding-box; }

a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--violet); outline-offset: 3px; border-radius: 8px; }

.mono { font: 500 11px/1.3 var(--mono); letter-spacing: .06em; text-transform: uppercase; opacity: .75; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Заголовки страниц набраны Nauryz. Трекинг подогнан под запасной Onest; когда
   Nauryz загрузился, app.js ставит .has-display-font и трекинг ослабляется.
   В окне записи (.detail-info h2, .add-head h2) шрифт обычный: там заголовок —
   название фильма или книги, набранное не нами, и плотный дисплейный шрифт
   на длинных названиях читается хуже. */
.footer-word, .folder-vtitle, .title-sheet h1, .coll-hero h1, .pack-name, .home-collections h2, .about-block h2 {
  font-family: var(--display);
  font-synthesis: none;
}
.has-display-font :is(.footer-word, .folder-vtitle, .title-sheet h1, .coll-hero h1, .pack-name, .home-collections h2, .about-block h2) {
  letter-spacing: -.01em;
  font-weight: 400;
}

/* ============ Кнопки и общие элементы ============ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 10px 18px 11px;
  /* Главный акцент — малиновый. Жёлтый на кнопках читался оранжевым и тянул
     на себя всю страницу; теперь он остался в мелочах: крестик, звёзды, метки. */
  background: var(--tomato-deep);
  color: #FFFFFF;
  font-weight: 700; font-size: 15px;
  cursor: pointer;
  white-space: nowrap;
  transition: transform .18s ease, background .18s;
}
.btn:hover { transform: rotate(-2deg) scale(1.04); }
.btn span { font-size: 20px; line-height: 0; }
.btn--big { font-size: 17px; padding: 14px 26px 15px; }

.sticker {
  display: inline-block;
  background: var(--s);
  border-radius: 999px;
  padding: 7px 13px 8px;
  font-weight: 700; font-size: 14px;
  letter-spacing: -.01em;
}
.sticker:nth-child(odd) { transform: rotate(-2deg); }
.sticker:nth-child(even) { transform: rotate(1.5deg); }

.hand-note { font: 700 26px/1 var(--hand); color: var(--tomato); }


/* ============ Верхняя панель ============ */
.topbar {
  position: relative; z-index: 30;
  display: flex; align-items: center; gap: 16px;
  padding: 18px var(--gutter);
}
/* разделы сайта слева в шапке */
.mainnav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.mainnav a {
  position: relative;
  font-weight: 700; font-size: 16px; letter-spacing: -.01em;
  color: var(--page-fi, var(--ink));
  text-decoration: none;
  padding: 8px 14px 9px;
  border-radius: 999px;
  transition: background .18s;
}
.mainnav a:hover { background: rgba(28, 27, 58, .07); }
body[data-view="collection"] .mainnav a:hover { background: rgba(255, 255, 255, .18); }
.mainnav a.is-active { background: var(--ink); color: var(--cream); }
body[data-view="collection"] .mainnav a.is-active { background: var(--page-fi, var(--ink)); color: var(--page, var(--cream)); }

.search { position: relative; flex: 1; max-width: 440px; margin-left: auto; }
.search input {
  width: 100%;
  border: 2px solid var(--ink); border-radius: 999px;
  background: var(--cream);
  padding: 10px 16px 11px 42px;
  font-size: 15px;
}
.search-icon, .field-inline svg {
  position: absolute; left: 15px; top: 50%; translate: 0 -50%;
  width: 18px; height: 18px; fill: none; stroke: var(--ink); stroke-width: 2.4; stroke-linecap: round;
  pointer-events: none;
}
.search-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  background: var(--cream);
  border: 2px solid var(--ink); border-radius: 20px;
  padding: 6px;
  box-shadow: 0 16px 40px var(--shadow);
}
.result {
  width: 100%; display: flex; align-items: center; gap: 12px;
  border: 0; background: none; text-align: left; cursor: pointer;
  padding: 8px; border-radius: 14px;
}
.result:hover { background: #DAF5F9; }
.result-type { margin-left: auto; font-size: 12px; font-weight: 700; background: var(--c); color: var(--fi); padding: 4px 9px; border-radius: 999px; }
.result-empty { margin: 10px 12px; color: var(--ink-2); }

/* ============ Главная: полка с папками ============ */
.shelf {
  display: flex;
  height: calc(100vh - 88px);
  min-height: 640px;
  padding: 6px calc(var(--gutter) + var(--tab-w)) var(--gutter) var(--gutter);
}

.folder {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  margin-left: -24px; /* прячем скругление предыдущей папки */
  filter: drop-shadow(10px 2px 14px var(--shadow));
  transition: flex-grow .55s cubic-bezier(.2, .8, .2, 1);
  --tc: var(--c);
}
.folder:first-child { margin-left: 0; }
.folder--title { flex: 0 0 34%; }
.folder:not(.folder--title):hover,
.folder:not(.folder--title):focus-within { flex-grow: 1.9; }

.folder-body {
  position: absolute; inset: 0;
  display: flex; gap: 14px;
  padding: 24px 22px 22px calc(24px + var(--tab-w) + 14px);
  background: var(--c);
  color: var(--fi);
  border-radius: 24px;
  overflow: hidden;
  text-decoration: none;
  cursor: pointer;
}

/* боковой язычок: торчит справа, с вогнутыми плечиками */
.folder-tab {
  position: absolute;
  left: 100%;
  top: var(--tab-top, 36px);
  width: var(--tab-w);
  height: 150px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  writing-mode: vertical-rl;
  background: var(--c);
  color: var(--fi);
  border-radius: 0 16px 16px 0;
  font-weight: 800; font-size: 15px; letter-spacing: .01em;
  text-decoration: none;
  white-space: nowrap;
}
.folder-tab small { font: 500 10px var(--mono); letter-spacing: .08em; opacity: .7; }
.folder-tab::before, .folder-tab::after {
  content: ""; position: absolute; left: 0;
  width: var(--r); height: var(--r);
  pointer-events: none;
}
.folder-tab::before { bottom: 100%; background: radial-gradient(circle at 100% 0, transparent calc(var(--r) - .5px), var(--tc) var(--r)); }
.folder-tab::after  { top: 100%;    background: radial-gradient(circle at 100% 100%, transparent calc(var(--r) - .5px), var(--tc) var(--r)); }
.folder--title .folder-tab { --tab-top: 470px; }

.folder-vtitle {
  margin: 0;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: clamp(44px, 7vh, 84px);
  font-weight: 800;
  letter-spacing: -.055em;
  line-height: .82;
  white-space: nowrap;
  align-self: flex-end;
}
.folder-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.folder-main > .mono { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: 0; transition: opacity .3s; }
.folder:hover .folder-main > .mono, .folder:focus-within .folder-main > .mono { opacity: .75; }
.folder-peek {
  flex: 1;
  display: grid;
  /* Число колонок задано явно, а не через auto-fill: при наведении ширина
     папки анимируется, и auto-fill пересчитывал бы колонки по ходу анимации —
     обложки на очередном кадре скачком уменьшались вдвое и перескакивали
     между рядами. Пороги ниже повторяют ту плотность, которую auto-fill давал
     у раскрытой папки, но зависят от ширины окна, а она во время наведения не
     меняется — поэтому пересчёта посреди анимации не случается. */
  grid-template-columns: minmax(84px, 1fr);
  grid-auto-rows: max-content;
  gap: 12px;
  align-content: start;
  overflow: hidden;
  padding: 4px;
  -webkit-mask-image: linear-gradient(#000 62%, transparent 96%);
          mask-image: linear-gradient(#000 62%, transparent 96%);
}
@media (min-width: 1350px) { .folder-peek { grid-template-columns: repeat(2, minmax(84px, 1fr)); } }
@media (min-width: 1720px) { .folder-peek { grid-template-columns: repeat(3, minmax(84px, 1fr)); } }
@media (min-width: 2100px) { .folder-peek { grid-template-columns: repeat(4, minmax(84px, 1fr)); } }
@media (min-width: 2480px) { .folder-peek { grid-template-columns: repeat(5, minmax(84px, 1fr)); } }
.mini-cover {
  display: block;
  aspect-ratio: 300 / 420;
  border-radius: 12px;
  overflow: hidden;
  transform: rotate(var(--rot));
  box-shadow: 0 3px 0 rgba(28, 27, 58, .25);
  transition: transform .35s;
}
.mini-cover svg { display: block; width: 100%; height: 100%; }
.folder:hover .mini-cover { transform: rotate(0) translateY(-2px); }
.folder-foot { display: flex; justify-content: space-between; align-items: end; gap: 10px; font-weight: 600; font-size: 14px; padding-right: 70px; }
.folder-foot { opacity: 0; transition: opacity .3s; }
.folder:hover .folder-foot, .folder:focus-within .folder-foot { opacity: 1; }
.folder-foot .open { opacity: 0; transform: translateX(-8px); transition: .3s; white-space: nowrap; }
.folder:hover .folder-foot .open, .folder:focus-within .folder-foot .open { opacity: 1; transform: none; }
.folder-figure {
  position: absolute; right: 12px; bottom: 10px;
  width: 86px;
  transition: transform .45s cubic-bezier(.3, 1.6, .5, 1);
}
.folder:hover .folder-figure { transform: rotate(40deg) scale(1.12); }

/* титульный лист */
/* титульный лист не ссылка: рука только над плитками статистики и плашкой подборок (это <a>) */
.title-sheet { flex-direction: column; gap: 14px; padding: 26px 30px; cursor: default; }
.title-sheet h1 {
  margin: 2px 0 0;
  color: var(--tomato);
  font-size: clamp(60px, 6.6vw, 104px);
  font-weight: 900;
  letter-spacing: -.07em;
  line-height: 1;
}
.decode { margin: -2px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.decode span { background: var(--c); color: var(--fi); border-radius: 999px; padding: 5px 12px 6px; font-size: 15px; font-weight: 600; }
.decode span:nth-child(odd) { transform: rotate(-2deg); }
.decode span:nth-child(even) { transform: rotate(1.5deg); }
.decode b { font-weight: 900; }
.lead { margin: 0; font-size: 17px; line-height: 1.35; max-width: 30ch; color: var(--ink-2); }
/* титульный лист: заголовок с фигурами и крупная статистика */
.title-row { display: flex; align-items: flex-start; }

.title-deco { position: absolute; top: 16px; right: 20px; width: 96px; height: 92px; pointer-events: none; }
.title-deco svg { position: absolute; display: block; }
.title-deco svg:first-child { width: 58px; top: 0; right: 0; animation: spin 18s linear infinite; }
.title-deco svg:last-child { width: 40px; top: 48px; right: 50px; animation: spin 26s linear infinite reverse; }

.big-stats { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 10px; flex: 1; min-height: 240px; max-height: 360px; }
.stat-tile {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between;
  min-height: 118px;
  background: var(--c); color: var(--fi);
  border-radius: 20px;
  padding: 12px 16px 12px;
  text-decoration: none;
  transition: transform .25s cubic-bezier(.3, 1.4, .5, 1);
}
.stat-tile:nth-child(odd):hover { transform: rotate(-1.5deg) translateY(-3px); }
.stat-tile:nth-child(even):hover { transform: rotate(1.5deg) translateY(-3px); }
.stat-top, .stat-bottom { position: relative; z-index: 1; font-size: 13px; font-weight: 600; opacity: .9; }
.stat-num { position: relative; z-index: 1; font-size: clamp(52px, 5.6vw, 96px); font-weight: 900; letter-spacing: -.06em; line-height: .86; }
.stat-fig { position: absolute; right: -18px; bottom: -20px; width: 104px; transition: transform .5s cubic-bezier(.3, 1.4, .5, 1); }
.stat-fig svg { display: block; width: 100%; }
.stat-tile:hover .stat-fig { transform: rotate(45deg) scale(1.08); }

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

.now-thumb { flex: none; width: 38px; height: 52px; border-radius: 8px; overflow: hidden; display: block; }
.now-thumb svg { display: block; width: 100%; height: 100%; }
.now-text { flex: 1; min-width: 0; display: grid; gap: 3px; }
.now-text b { font-size: 15px; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now-text small { font-size: 12.5px; color: var(--ink-2); }
.stats { display: flex; flex-wrap: wrap; gap: 8px; }

@keyframes bob { 50% { transform: translateY(-6px) rotate(-4deg); } }

/* ============ Коллекция ============ */
.coll { padding: 0 calc(var(--gutter) + 40px) 0 var(--gutter); color: var(--fi); }
.coll-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-top: 18px; }
.coll-hero h1 {
  margin: 14px 0 .16em;
  font-size: clamp(54px, 8.4vw, 128px);
  font-weight: 800;
  letter-spacing: -.065em;
  line-height: 1;
}
.coll-sub { margin: 0; font-size: 17px; font-weight: 500; opacity: .9; }
.coll-figure { position: relative; width: clamp(120px, 15vw, 200px); flex: none; }
.coll-figure > svg:first-child { animation: spin 40s linear infinite; }
.coll-figure--still > svg:first-child { animation: bob 4s ease-in-out infinite; }
.coll-figure > svg:first-child { display: block; width: 100%; }
.coll-figure .doodle { position: absolute; width: 38px; top: -6px; left: -20px; color: var(--cream); }

.coll-tools { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
/* действия над страницей (подборка, корзина) — у правого края белого листа */
.coll-tools--end { justify-content: flex-end; }
.field-inline { position: relative; flex: 1; max-width: 340px; }
.field-inline input, .select select {
  width: 100%;
  border: 2px solid var(--ink); border-radius: 999px;
  background: var(--cream); color: var(--ink);
  padding: 10px 16px 11px 42px;
  font-size: 15px;
}
.select select { padding-left: 16px; padding-right: 36px; appearance: none; cursor: pointer; font-weight: 600;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%232B1810' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 12px; }

/* горизонтальные язычки статусов */
.status-tabs {
  display: flex; align-items: flex-end;
  margin-top: 30px;
  /* язычки начинаются за скруглением листа (28px) + место под плечико (--r) */
  padding-left: calc(28px + var(--r) + 4px);
  overflow-x: auto;
  scrollbar-width: none;
  /* место для «плечиков» активного язычка */
  padding-right: 20px;
  /* Неактивные язычки сдвинуты вниз на 8px (transform ниже) и заходят под лист.
     Без этого запаса они торчали бы за край ряда, ряд со скроллом становился
     прокручиваемым по вертикали, и при клике браузер подкручивал его на 8px —
     открытый язычок отрывался от листа. */
  padding-bottom: 8px;
  margin-bottom: -8px;
}
.status-tabs::-webkit-scrollbar { display: none; }
.stab {
  --tc: var(--sc);
  position: relative;
  flex: none;
  border: 0;
  background: var(--tc);
  /* Цвет текста задаёт сама плашка: тёмному «Заброшено» нужен светлый. */
  color: var(--stc, var(--ink));
  font-weight: 700; font-size: 15px;
  padding: 13px 22px 20px;
  margin-right: -10px;
  border-radius: 16px 16px 0 0;
  cursor: pointer;
  transform: translateY(8px);
  transition: transform .2s;
  box-shadow: 0 -2px 10px rgba(28, 27, 58, .08);
}
.stab:hover { transform: translateY(3px); }
.stab .count { font: 500 12px var(--mono); margin-left: 8px; opacity: .6; }
/* Открытый язычок сливается с листом, поэтому текст на нём всегда тёмный. */
.stab.is-active { --tc: var(--cream); color: var(--ink); transform: none; padding-bottom: 16px; box-shadow: none; }
/* «Все» — песочный: он светлый, как остальные язычки, но единственный без
   собственного цвета, поэтому не спорит ни с одной страницей, ни со статусами,
   ни с белым открытым язычком. Текста и счётчика это не касается — они обычные. */
.stab.is-active::before, .stab.is-active::after {
  content: ""; position: absolute; bottom: 0;
  width: var(--r); height: var(--r);
  pointer-events: none;
}
.stab.is-active::before { right: 100%; background: radial-gradient(circle at 0 0, transparent calc(var(--r) - .5px), var(--tc) var(--r)); }
.stab.is-active::after  { left: 100%;  background: radial-gradient(circle at 100% 0, transparent calc(var(--r) - .5px), var(--tc) var(--r)); }

.sheet {
  position: relative; z-index: 7;
  min-height: 60vh;
  background-color: var(--cream);
  background-image:
    linear-gradient(rgba(96, 119, 212, .12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(96, 119, 212, .12) 1px, transparent 1px);
  background-size: 34px 34px;
  color: var(--ink);
  border-radius: 28px; /* низ скруглён так же, как верх */
  padding: 34px 30px 60px;
  box-shadow: 0 -6px 24px rgba(28, 27, 58, .12);
}
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(186px, 1fr)); gap: 34px 24px; }

.card {
  display: flex; flex-direction: column; gap: 12px;
  border: 0; background: none; padding: 0; text-align: left; cursor: pointer;
}
.cover {
  position: relative; display: block;
  aspect-ratio: 300 / 420;
  border: 2px solid var(--ink);
  border-radius: 20px;
  overflow: hidden;
  transition: transform .3s cubic-bezier(.3, 1.4, .5, 1);
}
.cover svg { display: block; width: 100%; height: 100%; }
.card:hover .cover, .card:focus-visible .cover { transform: rotate(-2.5deg) translateY(-6px); }
.card:nth-child(even):hover .cover, .grid > :nth-child(even) .card:hover .cover { transform: rotate(2.5deg) translateY(-6px); }
.status-pill {
  position: absolute; top: 10px; right: 10px;
  background: var(--sc);
  color: var(--stc, var(--ink));
  border: 1.5px solid var(--ink); border-radius: 999px;
  padding: 3px 9px 4px;
  font-size: 12px; font-weight: 700;
}
.card-meta { display: grid; gap: 5px; }
.card-code { font: 500 10.5px var(--mono); letter-spacing: .08em; color: var(--ink-2); }
.card h3 { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -.025em; line-height: 1.15; }
.card .sub { font-size: 13.5px; color: var(--ink-2); }

.empty { grid-column: 1 / -1; display: grid; justify-items: center; gap: 8px; padding: 50px 0; text-align: center; }
.empty svg { width: 130px; }
.empty p { margin: 0 0 8px; font: 700 34px var(--hand); color: var(--tomato); }

/* другие папки — язычки у правого края */
.side-tabs { position: fixed; right: 0; top: 150px; z-index: 20; display: flex; flex-direction: column; gap: 8px; }
.side-tab {
  writing-mode: vertical-rl;
  background: var(--c); color: var(--fi);
  padding: 20px 12px 20px 14px;
  border-radius: 16px 0 0 16px;
  font-weight: 800; font-size: 14px;
  text-decoration: none;
  transform: translateX(10px);
  transition: transform .25s;
  filter: drop-shadow(-4px 2px 8px var(--shadow));
}
.side-tab:hover { transform: translateX(0); }
/* язычок открытой папки: выдвинут и того же цвета, что страница */
.side-tab.is-current { transform: translateX(-14px); padding-left: 20px; padding-right: 20px; font-weight: 900; box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--fi) 35%, transparent); }
.side-tab.is-current:hover { transform: translateX(-14px); }

/* ============ Модальное окно ============ */
.modal {
  position: fixed; inset: 0; z-index: 50;
  display: flex; justify-content: center; align-items: flex-start;
  padding: 70px 20px 40px;
  overflow-y: auto;
}
.modal-backdrop { position: fixed; inset: 0; background: rgba(28, 27, 58, .5); animation: fade .25s; }
.sheet-card {
  position: relative;
  width: min(940px, 100%);
  background: var(--c);
  color: var(--fi);
  border-radius: 28px;
  padding: 14px;
  animation: pop .4s cubic-bezier(.3, 1.4, .5, 1);
  transition: background .3s;
  --tc: var(--c);
}
.sheet-tab {
  position: absolute; bottom: 100%; left: 36px;
  background: var(--tc);
  padding: 12px 22px 10px;
  border-radius: 16px 16px 0 0;
  font: 600 12px var(--mono); letter-spacing: .08em; text-transform: uppercase;
}
.sheet-tab::before, .sheet-tab::after { content: ""; position: absolute; bottom: 0; width: var(--r); height: var(--r); }
.sheet-tab::before { right: 100%; background: radial-gradient(circle at 0 0, transparent calc(var(--r) - .5px), var(--tc) var(--r)); }
.sheet-tab::after  { left: 100%;  background: radial-gradient(circle at 100% 0, transparent calc(var(--r) - .5px), var(--tc) var(--r)); }
.close {
  position: absolute; top: -18px; right: -14px; z-index: 2;
  width: 46px; height: 46px;
  border: 2px solid var(--ink); border-radius: 50%;
  background: var(--yellow); color: var(--ink);
  font-size: 26px; line-height: 1; cursor: pointer;
  transition: transform .2s;
}
.close:hover { transform: rotate(90deg); }
.sheet-inner {
  background: var(--cream);
  color: var(--ink);
  border-radius: 20px;
  padding: 30px;
}

.detail { display: grid; grid-template-columns: minmax(200px, 280px) 1fr; gap: 34px; align-items: start; }
.detail-cover { border: 2px solid var(--ink); border-radius: 22px; overflow: hidden; transform: rotate(-2deg); position: sticky; top: 0; }
.detail-cover svg { display: block; width: 100%; }
.detail-info { display: grid; gap: 20px; min-width: 0; }
.detail-info h2 { margin: 0; font-size: clamp(28px, 3.4vw, 44px); font-weight: 800; letter-spacing: -.05em; line-height: 1.05; }
.detail-sub { margin: -10px 0 0; font-size: 16px; color: var(--ink-2); }
.detail-desc { margin: 0; font-size: 15px; line-height: 1.55; color: var(--ink-2); white-space: pre-wrap; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 24px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center;
  border: 2px solid var(--ink); border-radius: 999px;
  background: transparent;
  padding: 6px 14px 7px;
  font-size: 14px; font-weight: 700;
  cursor: pointer;
  transition: transform .15s, background .15s;
}
.chip:hover { transform: rotate(-2deg); }
.chip.is-on, .chip:has(input:checked) { background: var(--sc); color: var(--stc, var(--ink)); }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip--type:has(input:checked), .chip--type.is-on { background: var(--c); color: var(--fi); }
.chip:has(input:focus-visible) { outline: 3px solid var(--violet); outline-offset: 2px; }

.field { display: grid; gap: 7px; align-content: start; }
.label { font: 600 11px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
.field input:not([type=radio]), .field textarea {
  width: 100%;
  border: 2px solid var(--ink); border-radius: 14px;
  background: #FFFFFF;
  padding: 10px 12px;
  font-size: 15px;
}


.tags { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--tc);
  border-radius: 999px;
  padding: 5px 6px 6px 13px;
  font-size: 14px; font-weight: 700;
}
.tag:nth-child(odd) { transform: rotate(-1.5deg); }

/* Удаление — тихая ссылка: красной она стояла вплотную к малиновой кнопкой
   «Редактировать», и две почти одинаковые красные кнопки рядом сбивали с толку.
   Красный возвращается при наведении, когда до нажатия остался шаг. */
.link-danger { justify-self: start; border: 0; background: none; padding: 0; color: var(--ink-2); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.link-danger:hover { color: #C8124F; }

/* форма добавления */
.add-head { grid-column: 1 / -1; display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.add-head h2 { margin: 0; font-size: clamp(28px, 3.2vw, 40px); font-weight: 800; letter-spacing: -.05em; line-height: .95; }
.add-head .hand-note { transform: rotate(-4deg); }
.type-chips { grid-column: 1 / -1; }
.type-chips .chip { font-size: 16px; padding: 9px 18px 10px; }

/* тост */
.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 60;
  translate: -50% 20px;
  background: var(--ink); color: var(--cream);
  padding: 12px 20px 13px; border-radius: 999px;
  font-weight: 700;
  opacity: 0; pointer-events: none;
  transition: .3s cubic-bezier(.3, 1.4, .5, 1);
}
.toast.is-on { opacity: 1; translate: -50% 0; }

@keyframes pop { from { transform: translateY(30px) rotate(1.5deg); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }


/* ============ Логика дневника: дополнительные элементы ============ */

/* настоящие обложки (загруженные или из каталога) */
.cover-img { display: block; width: 100%; height: 100%; background: #FFFFFF center / cover no-repeat; }
.mini-cover .cover-img, .now-thumb .cover-img { border-radius: inherit; }
.detail-cover .cover-img { aspect-ratio: 300 / 420; }

/* звёзды с половинками */
.stars-static, .star-picker { display: inline-flex; gap: 1px; }
.star-slot { position: relative; display: inline-block; width: var(--size); height: var(--size); flex: none; }
.star-slot svg { display: block; }
.star-base, .star-fill { position: absolute; top: 0; left: 0; height: 100%; overflow: hidden; }
.star-fill { width: 0; pointer-events: none; }
.star-picker .star-slot { transition: transform .15s; }
.star-picker .star-slot:hover { transform: scale(1.15) rotate(-8deg); }
.star-hit { position: absolute; top: 0; bottom: 0; width: 50%; border: 0; padding: 0; background: transparent; cursor: pointer; z-index: 1; }
.star-hit-left { left: 0; }
.star-hit-right { right: 0; }
.star-hit:focus-visible { outline-offset: 0; }

/* главная */
.sticker--link { text-decoration: none; color: var(--ink); transition: transform .18s; }
.sticker--link:hover { transform: rotate(-3deg) scale(1.05); }
.folder-empty { grid-column: 1 / -1; font: 700 24px var(--hand); opacity: .7; white-space: nowrap; }

/* пустые состояния */
.empty-hint { max-width: 36ch; color: var(--ink-2); font-size: 15px; margin: -6px 0 10px; }

/* кнопки */
.btn--small { font-size: 13px; padding: 6px 12px 7px; }
.btn--ghost { background: var(--cream); color: var(--ink); }
.btn--danger { background: var(--tomato-deep); color: #FFFFFF; }
.btn:disabled { opacity: .45; cursor: default; transform: none; }

/* лист без язычков статусов (подборки, корзина) */
.sheet--flat { margin-top: 30px; }

/* подборки: маленькие папки с язычком */
.packs { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 56px 26px; padding-top: 26px; }
.pack {
  --tc: var(--c);
  position: relative;
  display: block;
  border: 0; padding: 0; background: none; text-align: left; cursor: pointer;
  color: var(--fi);
  filter: drop-shadow(0 6px 10px var(--shadow));
  transition: transform .3s cubic-bezier(.3, 1.4, .5, 1);
}
.pack:hover { transform: translateY(-6px) rotate(-1deg); }
.pack:nth-child(even):hover { transform: translateY(-6px) rotate(1deg); }
.pack-tab {
  position: absolute; bottom: calc(100% - 1px); left: var(--tab-left, 40px); right: var(--tab-right, auto);
  background: var(--tc);
  padding: 9px 16px 7px;
  border-radius: 14px 14px 0 0;
  font: 600 11px var(--mono); letter-spacing: .06em; text-transform: uppercase;
  white-space: nowrap;
}
.pack-tab::before, .pack-tab::after { content: ""; position: absolute; bottom: 0; width: var(--r); height: var(--r); }
.pack-tab::before { right: 100%; background: radial-gradient(circle at 0 0, transparent calc(var(--r) - .5px), var(--tc) var(--r)); }
.pack-tab::after  { left: 100%;  background: radial-gradient(circle at 100% 0, transparent calc(var(--r) - .5px), var(--tc) var(--r)); }
.pack-body { display: flex; flex-direction: column; gap: 14px; background: var(--c); border-radius: 22px; padding: 20px 20px 18px; min-height: 230px; overflow: hidden; }
.pack-name { font-size: 25px; font-weight: 800; letter-spacing: -.045em; line-height: 1.05; }
.pack-peek { display: flex; gap: 8px; }
.pack-peek .mini-cover { flex: none; width: 66px; }

/* выбор записей в подборку */
.picker-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 4px 12px; max-height: 340px; overflow: auto; }
.picker-row { position: relative; display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 14px; cursor: pointer; }
.picker-row:hover { background: var(--cyan); }
/* Отмеченные подсвечены: иначе в длинном списке непонятно, что уже взято. */
.picker-row:has(input:checked) { background: #F1EAFF; }
.picker-row:has(input:checked):hover { background: var(--cyan); }
.picker-row input { position: absolute; opacity: 0; pointer-events: none; }
.picker-check { flex: none; width: 22px; height: 22px; border: 2px solid var(--ink); border-radius: 7px; background: var(--cream); display: grid; place-items: center; }
.picker-row input:checked + .picker-check { background: var(--sun); }
.picker-row input:checked + .picker-check::after { content: ""; width: 10px; height: 5px; border: solid var(--ink); border-width: 0 0 2.5px 2.5px; transform: translateY(-1px) rotate(-45deg); }
.picker-row input:focus-visible + .picker-check { outline: 3px solid var(--violet); outline-offset: 2px; }
.picker-row .now-thumb { width: 30px; height: 42px; }
.picker-row-title { flex: 1; min-width: 0; font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.picker-empty { margin: 0 0 24px; color: var(--ink-2); }

.collection-item { position: relative; }
.collection-item .card { width: 100%; }
.collection-remove {
  position: absolute; top: -10px; left: -10px; z-index: 2;
  width: 32px; height: 32px;
  border: 2px solid var(--ink); border-radius: 50%;
  background: var(--yellow); color: var(--ink);
  font-size: 18px; line-height: 1; cursor: pointer;
  opacity: 0; transition: opacity .2s, transform .2s;
}
.collection-item:hover .collection-remove, .collection-remove:focus-visible { opacity: 1; }
.collection-remove:hover { transform: rotate(90deg); }
@media (hover: none) { .collection-remove { opacity: 1; } }

/* корзина */
.card--trash { cursor: default; }
.card--trash .cover { filter: saturate(.55); }
.card--trash:hover .cover { transform: none; }
.card-code .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--c); margin-right: 6px; vertical-align: 1px; border: 1px solid var(--ink); }
.trash-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 4px; }

/* окно записи: просмотр */
.chip--static { cursor: default; }
.chip--static:hover { transform: none; }
.chip--cat { background: var(--c); color: var(--fi); }
.chips--small .chip { font-size: 13px; padding: 5px 11px 6px; }
.tag--static { padding: 5px 13px 6px; }
.detail-value { font-size: 17px; font-weight: 600; }
.notes-list { display: grid; gap: 8px; }
.note-card {
  margin: 0;
  font: 600 23px/32px var(--hand);
  background: #FFFFFF repeating-linear-gradient(transparent 0 31px, rgba(96, 119, 212, .35) 31px 32px);
  border: 2px solid var(--ink); border-radius: 16px;
  padding: 8px 16px;
  white-space: pre-wrap;
}
.quote-card {
  position: relative;
  margin: 0;
  font-size: 17px; font-weight: 500; line-height: 1.4; font-style: italic;
  background: #ECE3FF;
  border-radius: 18px;
  padding: 14px 18px 14px 46px;
  white-space: pre-wrap;
}
.quote-card::before { content: "“"; position: absolute; left: 12px; top: -4px; font: 900 56px/1 var(--font); color: var(--tomato); font-style: normal; }
.source-link { justify-self: start; font-weight: 600; color: var(--ink-2); text-underline-offset: 3px; }
.detail-actions { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-top: 4px; }

/* окно записи: редактирование */
.edit-form { display: grid; grid-template-columns: minmax(200px, 250px) 1fr; gap: 26px 34px; align-items: start; }
.edit-side, .edit-main { display: grid; gap: 20px; min-width: 0; }
.edit-side .detail-cover { position: static; }
.cover-actions { display: flex; align-items: center; gap: 14px; }
.edit-notes { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr; gap: 24px; }
.edit-notes .note-card, .edit-notes .quote-card { display: flex; align-items: flex-start; gap: 8px; }
.edit-notes .note-card span, .edit-notes .quote-card span { flex: 1; white-space: pre-wrap; }
.note-delete { flex: none; margin-top: 6px; border: 0; background: rgba(28, 27, 58, .12); width: 22px; height: 22px; border-radius: 50%; cursor: pointer; line-height: 1; font: 600 15px var(--font); font-style: normal; }
.note-compose { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.note-compose textarea { width: 100%; min-height: 96px; resize: vertical; font-family: inherit; }
.note-compose .btn { align-self: flex-end; }
.note-compose [data-note-more] { align-self: flex-start; }
.edit-actions { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.edit-actions .btn { margin-left: auto; }
/* окно подборки */
.col-form { display: grid; gap: 22px; }
/* Поле поиска лежит внутри .field, а её правило для input перебивает отступ
   под иконку — поэтому возвращаем его здесь, иначе лупа ложится на текст. */
.col-form .field-inline { max-width: 100%; }
.col-form .field-inline input { padding-left: 42px; border-radius: 999px; }
.col-form .picker-list { max-height: min(46vh, 420px); margin-top: 4px; }
/* Место под вертикальную полосу резервируем заранее. Без этого браузер считает
   колонки по полной ширине, потом добавляет полосу — и список уезжает вбок
   ровно на её ширину, хотя прокручивать там нечего. overflow-x — страховка для
   браузеров постарше, которые scrollbar-gutter не знают. */
.picker-list { scrollbar-gutter: stable; overflow-x: hidden; }
.col-form .picker-empty { margin: 10px 4px 0; }
.col-form .edit-actions { margin-top: 2px; }

.field--lookup { position: relative; }
.lookup-status { text-transform: none; letter-spacing: 0; font: 700 18px var(--hand); color: var(--tomato); margin-left: 6px; }
.lookup-results:not(:empty) {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 5;
  margin-top: 6px;
  background: var(--cream);
  border: 2px solid var(--ink); border-radius: 18px;
  padding: 6px;
  max-height: 320px; overflow: auto;
  box-shadow: 0 16px 40px var(--shadow);
}
.date-inputs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.date-inputs input { max-width: 200px; }
.date-inputs #dateExactPicker { width: min(260px, 100%); }
.date-inputs #dateMonthPicker { width: 180px; }
.field input.is-invalid { border-color: #C8124F; background: #FFE3EE; }
/* Статус не выбран, а запись сохраняют — подсвечиваем группу целиком:
   подсветить нечего, поля тут нет, только кнопки. */
.chips.is-invalid { outline: 2px dashed #C8124F; outline-offset: 7px; border-radius: 14px; }
.field-hint { text-transform: none; letter-spacing: 0; font: 700 18px var(--hand); color: var(--tomato); margin-left: 6px; }

/* ---- самодельные список и календарь (js/pickers.js) ---- */
.pick { position: relative; }
.pick-btn {
  display: flex; align-items: center; gap: 8px;
  width: 100%;
  border: 2px solid var(--ink); border-radius: 14px;
  background: #FFFFFF; color: var(--ink);
  padding: 10px 12px 11px;
  font-size: 15px; font-weight: 600; text-align: left;
  cursor: pointer;
}
.pick-btn:hover { background: #F6F3FF; }
.pick.is-empty .pick-value { color: var(--ink-2); font-weight: 500; }
.pick-value { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-caret { flex: none; width: 12px; height: 8px; background: no-repeat center / 12px 8px; }
.pick-icon { flex: none; width: 18px; height: 18px; fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-linecap: round; }
.pick-panel {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 6;
  min-width: 100%;
  background: var(--cream);
  border: 2px solid var(--ink); border-radius: 18px;
  padding: 6px;
  box-shadow: 0 16px 40px var(--shadow);
}
.pick--list .pick-panel { display: grid; gap: 2px; max-height: 262px; overflow: auto; }
.pick-opt {
  border: 0; background: none; border-radius: 11px;
  padding: 8px 12px; text-align: left;
  font-size: 15px; font-weight: 600; cursor: pointer;
}
.pick-opt:hover { background: var(--cyan); }
.pick-opt.is-on { background: var(--sun); }

.pick--date .pick-panel { width: 290px; padding: 12px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.cal-title { font-size: 16px; letter-spacing: -.02em; }
.cal-nav {
  flex: none; width: 32px; height: 32px;
  border: 2px solid var(--ink); border-radius: 50%;
  background: var(--cream); color: var(--ink);
  font-size: 17px; line-height: 1; cursor: pointer;
  transition: background .15s;
}
.cal-nav:hover { background: var(--sun); }
.cal-week, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-week span { text-align: center; font: 600 10px var(--mono); text-transform: uppercase; color: var(--ink-2); padding-bottom: 6px; }
.cal-day {
  height: 34px;
  border: 0; border-radius: 10px;
  background: none; color: var(--ink);
  font-size: 14px; font-weight: 600; cursor: pointer;
}
.cal-day:hover { background: var(--cyan); }
.cal-day.is-weekend { color: var(--tomato); }
.cal-day.is-today { box-shadow: inset 0 0 0 2px var(--lilac); }
.cal-day.is-on { background: var(--sun); box-shadow: inset 0 0 0 2px var(--ink); }
.cal-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 10px; }
.cal-link {
  border: 0; background: none; padding: 4px 6px;
  font-size: 13px; font-weight: 600; color: var(--ink-2);
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
.cal-link:hover { color: var(--ink); }


/* ============ Полка подборок на главной ============ */
.home-collections { padding: 10px var(--lane) 60px var(--gutter); }
.home-collections-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 8px; }
.home-collections h2 { margin: 6px 0 0; font-size: clamp(34px, 3.4vw, 52px); line-height: 1; letter-spacing: -.02em; color: var(--ink); }
.home-collections-all { font-weight: 700; color: var(--ink); text-decoration: none; padding: 8px 14px 9px; border: 2px solid var(--ink); border-radius: 999px; background: var(--cream); white-space: nowrap; }
.home-collections-all:hover { background: var(--ink); color: var(--cream); }
.packs--row { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 50px 22px; }
.pack-new {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 230px;
  border: 2px dashed rgba(28, 27, 58, .35); border-radius: 22px;
  background: rgba(255, 255, 255, .45);
  color: var(--ink); font-weight: 700; font-size: 16px;
  cursor: pointer;
  transition: background .2s, border-color .2s;
}
.pack-new span { font-size: 40px; line-height: 1; font-weight: 400; }
.pack-new:hover { background: var(--cream); border-color: var(--ink); }

/* ============ Кнопка корзины ============ */
/* Живёт в правой полосе (--lane), куда контент не заходит; цвета — наоборот
   к странице: фон кнопки — цвет текста страницы, иконка — цвет фона. */
.trash-fab {
  position: fixed; right: 16px; bottom: 16px; z-index: 40;
  width: 50px; height: 50px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--page-fi, var(--ink));
  color: var(--page, var(--cyan));
  box-shadow: 0 6px 18px var(--shadow);
  transition: transform .2s cubic-bezier(.3, 1.4, .5, 1), background .45s, color .45s;
}
.trash-fab svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.trash-fab:hover { transform: rotate(-10deg) scale(1.08); }
.trash-fab.is-active { box-shadow: 0 0 0 3px var(--page, var(--cyan)), 0 0 0 5px var(--page-fi, var(--ink)); }
.trash-fab-count {
  position: absolute; top: -4px; right: -4px;
  min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 999px; border: 2px solid var(--page, var(--cyan));
  background: var(--sun); color: var(--ink);
  font: 800 11px/18px var(--font); text-align: center;
}
body.has-modal .trash-fab { display: none; }
/* поверх тёмного футера кнопка белая */
.trash-fab.is-on-footer { background: #FFFFFF; color: var(--ink); }
.trash-fab.is-on-footer .trash-fab-count { border-color: #FFFFFF; }
.trash-fab.is-on-footer.is-active { box-shadow: 0 0 0 3px var(--ink), 0 0 0 5px #FFFFFF; }

/* ============ Футер: последний лист картотеки ============ */
.site-footer { padding: 70px var(--gutter) 0; }
.footer-sheet {
  --tc: var(--ink);
  position: relative;
  background: var(--ink); color: var(--cream);
  border-radius: 28px 28px 0 0;
  padding: 36px 36px 22px;
}
.footer-tab {
  position: absolute; bottom: calc(100% - 1px); left: 40px;
  background: var(--tc); color: var(--cream);
  padding: 12px 22px 10px;
  border-radius: 16px 16px 0 0;
  font: 600 12px var(--mono); letter-spacing: .08em; text-transform: uppercase;
}
.footer-tab::before, .footer-tab::after { content: ""; position: absolute; bottom: 0; width: var(--r); height: var(--r); }
.footer-tab::before { right: 100%; background: radial-gradient(circle at 0 0, transparent calc(var(--r) - .5px), var(--tc) var(--r)); }
.footer-tab::after  { left: 100%;  background: radial-gradient(circle at 100% 0, transparent calc(var(--r) - .5px), var(--tc) var(--r)); }
.footer-grid { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 30px 40px; }
.footer-col p { margin: 0 0 12px; font-size: 15px; line-height: 1.45; color: rgba(255, 255, 255, .8); max-width: 34ch; }
.footer-word { display: inline-block; font-size: 44px; line-height: 1; color: var(--tomato); text-decoration: none; margin-bottom: 10px; }
.footer-decode { font: 500 13px var(--mono) !important; letter-spacing: .02em; color: #fff !important; }
.footer-decode b { color: var(--tomato); }
.footer-label { margin: 6px 0 12px; font: 600 11px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: rgba(255, 255, 255, .55); }
.design-switch { display: inline-flex; padding: 4px; gap: 4px; border-radius: 999px; background: rgba(255, 255, 255, .1); }
.design-switch button {
  border: 0; border-radius: 999px; padding: 8px 14px 9px;
  background: transparent; color: rgba(255, 255, 255, .85);
  font-weight: 700; font-size: 14px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.design-switch button.is-on { background: var(--sun); color: var(--ink); }
.design-switch button:disabled { cursor: default; color: rgba(255, 255, 255, .45); }
.design-switch small { font: 500 10px var(--mono); text-transform: uppercase; letter-spacing: .06em; }
.backup-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 2px; }
.backup-import {
  border: 0; background: none; padding: 0;
  color: rgba(255, 255, 255, .8);
  font-weight: 600; font-size: 14px;
  text-decoration: underline; text-underline-offset: 3px;
  cursor: pointer;
}
.backup-import:hover { color: #FFFFFF; }
.footer-bottom { padding-right: 64px; display: flex; justify-content: space-between; gap: 16px; margin-top: 30px; padding-top: 16px; border-top: 1px solid rgba(255, 255, 255, .14); font: 500 12px var(--mono); color: rgba(255, 255, 255, .55); }
.footer-bottom a { color: inherit; }

/* ============ Страница поиска ============ */
.result--all { justify-content: center; font-weight: 700; border-top: 1px solid rgba(28, 27, 58, .1); border-radius: 0 0 14px 14px; margin-top: 4px; padding: 12px; }
.field-inline--wide { max-width: 560px; }
.search-page-form { align-items: center; }
.stab:disabled { opacity: .45; cursor: default; }
.stab:disabled:hover { transform: translateY(8px); }
.search-section { margin: 0 0 18px; font: 600 11px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
.packs--search { margin-bottom: 40px; padding-top: 18px; }
.search-item { display: flex; flex-direction: column; gap: 8px; }
.search-snippet { margin: 0; font-size: 13px; line-height: 1.4; color: var(--ink-2); background: #FFFFFF; border: 1px dashed rgba(28, 27, 58, .25); border-radius: 12px; padding: 8px 10px; }
.search-snippet span { display: block; font: 600 10px var(--mono); letter-spacing: .08em; text-transform: uppercase; margin-bottom: 3px; }
.search-snippet mark, .card mark { background: var(--sun); color: var(--ink); border-radius: 4px; padding: 0 2px; }

/* ============ О приложении ============ */
.about { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 34px 48px; }
.about-block h2 { margin: 0 0 12px; font-size: 28px; line-height: 1.05; letter-spacing: -.01em; }
.about-block p { margin: 0 0 10px; font-size: 16px; line-height: 1.55; color: var(--ink-2); max-width: 52ch; }
.about-block a { color: var(--ink); font-weight: 600; }


/* ============ Крестик «удалить» на карточке ============ */
.card-wrap { position: relative; display: flex; }
.card-wrap .card { width: 100%; }
.card-delete {
  position: absolute; top: -10px; right: -10px; z-index: 3;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border: 2px solid var(--ink); border-radius: 50%;
  background: #FFFFFF; color: var(--ink);
  cursor: pointer;
  opacity: 0; transform: scale(.8);
  transition: opacity .18s, transform .18s, background .18s, color .18s;
}
.card-delete svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; }
.card-wrap:hover .card-delete, .card-wrap:focus-within .card-delete { opacity: 1; transform: none; }
.card-delete:hover { background: var(--tomato-deep); color: #FFFFFF; border-color: var(--tomato-deep); transform: rotate(90deg); }
@media (hover: none) { .card-delete { opacity: 1; transform: none; } }

/* ============ Окно подтверждения ============ */
.confirm-root { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 20px; }
.confirm-root[hidden] { display: none; }
.confirm-backdrop { position: absolute; inset: 0; background: rgba(28, 27, 58, .55); animation: fade .2s; }
.confirm-card {
  position: relative;
  width: min(440px, 100%);
  background: #FFFFFF; color: var(--ink);
  border: 2px solid var(--ink); border-radius: 24px;
  padding: 26px 26px 22px;
  box-shadow: 0 18px 50px rgba(28, 27, 58, .3);
  animation: pop .3s cubic-bezier(.3, 1.4, .5, 1);
}
.confirm-card h2 { margin: 0 0 10px; font-size: 21px; line-height: 1.25; letter-spacing: -.02em; }
.confirm-card p { margin: 0 0 22px; font-size: 15px; line-height: 1.45; color: var(--ink-2); }
.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }

/* ============ Адаптив ============ */
@media (max-width: 1180px) {
  .folder--title { flex-basis: 30%; }
  .folder-vtitle { font-size: clamp(40px, 6.4vh, 72px); }
}

/* планшет и телефон: папки стопкой сверху вниз, язычки сверху */
@media (max-width: 860px) {
  :root { --gutter: 16px; }
  .topbar { flex-wrap: wrap; gap: 10px; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .btn--add { margin-left: auto; }

  .shelf { flex-direction: column; height: auto; min-height: 0; padding: 50px var(--gutter) 40px; gap: 0; }
  .folder, .folder--title { flex: none; margin: 0; margin-top: -24px; filter: drop-shadow(0 -6px 12px var(--shadow)); }
  .folder:not(.folder--title):hover { flex-grow: 0; }
  .folder:first-child { margin-top: 0; }
  .folder--title { z-index: 1 !important; }
  .folder[data-category="movie"] { z-index: 2 !important; --tab-left: 40%; }
  .folder[data-category="game"] { z-index: 3 !important; --tab-left: 8%; }
  .folder[data-category="book"] { z-index: 4 !important; --tab-left: 44%; }
  .folder[data-category="series"] { z-index: 5 !important; --tab-left: 18%; }

  .folder-body { position: relative; inset: auto; flex-direction: column; gap: 12px; padding: 20px 20px 64px; }
  .folder-main > .mono { display: none; }
  .title-sheet { padding-bottom: 60px; }
  .folder-tab, .folder--title .folder-tab {
    left: var(--tab-left, 8%); top: auto; bottom: calc(100% - 1px);
    width: auto; height: 44px;
    padding: 0 20px;
    writing-mode: horizontal-tb;
    border-radius: 16px 16px 0 0;
    font-size: 15px;
  }
  .folder--title .folder-tab { display: none; }
  .folder-tab::before { bottom: 0; left: auto; right: 100%; top: auto;
    background: radial-gradient(circle at 0 0, transparent calc(var(--r) - .5px), var(--tc) var(--r)); }
  .folder-tab::after { top: auto; bottom: 0; left: 100%;
    background: radial-gradient(circle at 100% 0, transparent calc(var(--r) - .5px), var(--tc) var(--r)); }

  .folder-vtitle { writing-mode: horizontal-tb; transform: none; align-self: auto; font-size: 34px; line-height: 1; padding-right: 70px; }
  .folder-main { gap: 12px; }
  .folder-peek { display: flex; gap: 10px; overflow: hidden; -webkit-mask-image: linear-gradient(90deg, #000 70%, transparent); mask-image: linear-gradient(90deg, #000 70%, transparent); }
  .mini-cover { flex: none; width: 78px; }
  .folder-foot { display: none; }
  .folder-figure { width: 64px; top: 10px; right: 14px; bottom: auto; }

  .coll { padding: 0 var(--gutter); }
  .coll-hero { align-items: center; }
  .side-tabs { position: static; flex-direction: row; flex-wrap: wrap; gap: 6px; margin: 4px var(--gutter) 18px; }
  .side-tab { writing-mode: horizontal-tb; border-radius: 14px; transform: none; padding: 9px 14px 10px; filter: none; }
  .side-tab.is-current, .side-tab.is-current:hover { transform: none; padding: 9px 14px 10px; box-shadow: inset 0 0 0 2px var(--fi); }
  .status-tabs { padding-left: calc(22px + var(--r) + 2px); }
  .stab { padding: 11px 16px 18px; font-size: 14px; }
  .sheet { padding: 24px 16px 40px; border-radius: 22px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 26px 14px; }

  .modal { padding: 60px 12px 24px; }
  .detail, .edit-form, .edit-notes { grid-template-columns: 1fr; }
  .edit-side .detail-cover { max-width: 200px; }
  .mainnav { order: 0; flex-basis: 100%; }
  .mainnav a { font-size: 15px; padding: 7px 12px 8px; }
  .packs { grid-template-columns: 1fr; }
  .pack-body { min-height: 150px; }
  .pack-new { min-height: 110px; flex-direction: row; }
  .home-collections { padding: 10px var(--gutter) 30px; }
  .trash-fab { right: 12px; width: 46px; height: 46px; }
  .site-footer { padding-top: 60px; }
  .footer-grid { grid-template-columns: 1fr; }
  .footer-sheet { padding: 30px 20px 18px; }
  .footer-tab { left: 20px; }
  .home-collections-head { align-items: flex-start; flex-direction: column; }
  .detail-cover { position: static; max-width: 220px; justify-self: center; }
  .detail-grid { grid-template-columns: 1fr; }
  .sheet-inner { padding: 22px 18px; }
  .close { right: -4px; }
}

@media (max-width: 480px) {
  .grid { grid-template-columns: 1fr 1fr; }
  .card h3 { font-size: 15px; }
  .coll-figure { width: 96px; }
  .coll-tools .btn { flex: 1; justify-content: center; }
  .field-inline { max-width: none; flex-basis: 100%; }
  .select { flex: 0 1 auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
