:root {
  --paper: #F7F3F0;
  --surface: #FFFFFF;
  --surface-2: #F0E8E4;
  --ink: #221D1E;
  --ink-soft: #5B5152;
  --hint: #908486;
  --line: #E7DDD8;
  /* подписи двоих: первый участник — зелёный, второй — розовый */
  --slot-a: #2F6B4F;
  --slot-b: #C05B72;
  --shadow: 0 12px 32px rgba(32, 29, 30, 0.10);
  --radius: 22px;

  /* стекло: полупрозрачные слои с размытием, как в iOS 26 */
  --glass-bg: rgba(255, 255, 255, 0.55);
  --glass-strong: rgba(255, 255, 255, 0.72);
  --glass-soft: rgba(255, 255, 255, 0.46);
  --glass-active: rgba(255, 255, 255, 0.92);
  --glass-edge: rgba(255, 255, 255, 0.85);
  --glass-shadow: 0 14px 34px rgba(66, 44, 52, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.95);
  --glass-blur: blur(22px) saturate(180%);

  /* бумага для записок на стене */
  --note-sage: #E7F0E1;
  --note-mint: #DDF1EB;
  --note-sky: #E2EDF8;
  --note-lilac: #ECE8F7;
  --note-rose: #F8E5EA;
  --note-peach: #FBE8DB;
  --note-sand: #F8EEDA;
  --note-pearl: #EFEDEA;
  --note-ink: #2A2522;

  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Manrope", system-ui, "Segoe UI", sans-serif;
  --font-ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Manrope", system-ui, "Segoe UI", Roboto, sans-serif;
}

[data-theme="dark"] {
  --paper: #1A1418;
  --surface: #231B20;
  --surface-2: #2D2329;
  --ink: #F6EFEA;
  --ink-soft: #CBBFBB;
  --hint: #A2949A;
  --line: #382C33;
  --slot-a: #7FB894;
  --slot-b: #E09AA8;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.35);

  --glass-bg: rgba(56, 42, 51, 0.48);
  --glass-strong: rgba(46, 34, 42, 0.68);
  --glass-soft: rgba(255, 255, 255, 0.08);
  --glass-active: rgba(255, 255, 255, 0.16);
  --glass-edge: rgba(255, 255, 255, 0.16);
  --glass-shadow: 0 16px 38px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.14);
  --glass-blur: blur(24px) saturate(170%);

  /* Бумага записок одна и та же в обеих темах: это лист, приклеенный к стене,
     он не должен менять цвет от того, что в комнате погасили свет. */
}

* { box-sizing: border-box; }

html, body, #root { height: 100%; }

body {
  margin: 0;
  position: relative;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

button, input, textarea {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-align: left;
}

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--slot-a);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ---------------------------------------------------------------- каркас */

/* Свет в комнате: под стеклом должно что-то просвечивать, иначе оно не стекло */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(44% 30% at 6% -4%, rgba(47, 107, 79, 0.34), transparent 70%),
    radial-gradient(42% 28% at 96% 4%, rgba(192, 91, 114, 0.32), transparent 72%),
    radial-gradient(70% 42% at 50% 104%, rgba(226, 190, 160, 0.24), transparent 72%);
}

[data-theme="dark"] body::before {
  background:
    radial-gradient(46% 32% at 6% -6%, rgba(78, 168, 122, 0.40), transparent 70%),
    radial-gradient(44% 30% at 96% 2%, rgba(214, 122, 148, 0.38), transparent 72%),
    radial-gradient(72% 44% at 50% 104%, rgba(126, 74, 122, 0.34), transparent 74%);
}

.app {
  position: relative;
  z-index: 1;
  height: 100%;
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

@media (min-width: 620px) {
  .app {
    box-shadow: 0 0 0 1px var(--line);
  }
}

.scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 26px 18px calc(108px + env(safe-area-inset-bottom));
}

/* Полосы прокрутки прячем, как в приложениях. В Telegram на компьютере полоса
   занимала 15px справа, и весь контент съезжал влево; на телефоне её и так не видно.
   Прокрутка колесом, тачпадом и пальцем работает как прежде. */
.scroll,
.pact-screen,
.sheet,
.draw-screen,
.pm-viewer {
  scrollbar-width: none;
}

.scroll::-webkit-scrollbar,
.pact-screen::-webkit-scrollbar,
.sheet::-webkit-scrollbar,
.draw-screen::-webkit-scrollbar,
.pm-viewer::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.scroll > * {
  animation: rise 320ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .scroll > * { animation: none; }
}

.boot {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  color: var(--hint);
  font-size: 14px;
  text-align: center;
}

/* ----------------------------------------------------------------- шапка */

.hero { padding: 4px 0 6px; }

.hero-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 31px;
  line-height: 1.14;
  letter-spacing: -0.03em;
  margin: 0 0 2px;
}

.hero-heart {
  color: var(--slot-b);
  margin: 0 7px;
  vertical-align: 1px;
}

.hero-name.a { color: var(--slot-a); }
.hero-name.b { color: var(--slot-b); }

.hero-amp {
  color: var(--hint);
  font-style: italic;
  padding: 0 6px;
}

.hero-count {
  margin: 6px 0 0;
  color: var(--ink-soft);
  font-size: 14px;
}

.hero-count .figure {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 21px;
  color: var(--ink);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------ лента дней */

.ribbon { position: relative; margin: 20px 0 6px; }

.ribbon-line {
  position: absolute;
  left: 0;
  right: 0;
  top: 18px;
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--slot-a), var(--slot-b));
  opacity: 0.9;
}

.ribbon-ticks { position: absolute; left: 0; right: 0; top: 0; height: 39px; }

.tick {
  position: absolute;
  top: 15px;
  width: 1px;
  height: 10px;
  border-radius: 1px;
  background: var(--paper);
  opacity: 0.55;
  transform: translateX(-50%);
}

.tick.tall { top: 10px; height: 20px; }

.ribbon-heart {
  position: absolute;
  right: -8px;
  top: 12px;
  color: var(--slot-b);
}

.ribbon-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--hint);
  padding-top: 44px;
}

/* -------------------------------------------------------------- заголовки */

.head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 30px 0 8px;
}

.head-round {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  background: var(--glass-strong);
  border: 1px solid var(--glass-edge);
  color: var(--ink);
  box-shadow: var(--glass-shadow);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  transition: transform 160ms ease;
}

.head-round:active { transform: scale(0.94); }

.head-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 10px 8px 13px;
  border-radius: 999px;
  background: var(--glass-soft);
  border: 1px solid var(--glass-edge);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  transition: color 160ms ease, background 160ms ease;
}

.head-chip:hover { color: var(--ink); }

.head-chip-ico { opacity: 0.55; }

.head-main {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.head-title {
  font-family: var(--font-display);
  font-size: 17.5px;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.02em;
}

.head-sub {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--hint);
}

.sub {
  margin: 2px 0 10px;
  font-size: 13px;
  color: var(--hint);
}

/* ------------------------------------------------------------- список строк */

.list,
.glass-list {
  margin-top: 10px;
  padding: 0 16px;
  border-radius: 24px;
  border: 1px solid var(--glass-edge);
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-shadow);
  overflow: hidden;
}

.row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  width: 100%;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.row:last-child { border-bottom: 0; }

.row-when {
  display: flex;
  flex-direction: column;
  min-width: 62px;
  padding-top: 1px;
}

.row-day {
  font-size: 12px;
  color: var(--hint);
  text-transform: lowercase;
}

.row-time {
  font-size: 14px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.row-body { display: flex; flex-direction: column; gap: 2px; flex: 1; }

.row-title { font-size: 15px; line-height: 1.35; }

.row-meta { font-size: 12.5px; color: var(--hint); }

.row-go {
  color: var(--hint);
  font-size: 18px;
  line-height: 1;
  padding-top: 2px;
}

/* ------------------------------------------------------------------ плитки */

.banner {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 20px;
  background:
    linear-gradient(120deg, rgba(47, 107, 79, 0.14), rgba(192, 91, 114, 0.14)),
    var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-edge);
  box-shadow: var(--glass-shadow);
  font-size: 13.5px;
  color: var(--ink-soft);
}

.banner b { color: var(--ink); font-weight: 500; }

.card {
  margin-top: 14px;
  padding: 16px;
  border-radius: 24px;
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-edge);
  box-shadow: var(--glass-shadow);
}

.card-quiet {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  box-shadow: none;
  background: var(--glass-soft);
}

.empty {
  padding: 22px 4px 6px;
  color: var(--hint);
}

.empty-title { margin: 0 0 4px; font-size: 14px; color: var(--ink-soft); }

.empty-text { margin: 0 0 14px; font-size: 13px; line-height: 1.45; }

/* ---------------------------------------------------------------- кнопки */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 999px;
  padding: 12px 20px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: opacity 160ms ease, transform 160ms ease;
}

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

.btn-primary {
  background: var(--ink);
  color: var(--paper);
  width: 100%;
  padding: 15px 20px;
  box-shadow: 0 10px 22px rgba(20, 12, 16, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.btn-ghost {
  border: 1px solid var(--glass-edge);
  color: var(--ink-soft);
  background: var(--glass-soft);
}

/* Удаление в стиле iOS: тот же размер, что у основной кнопки, системный красный. */
.btn-danger {
  width: 100%;
  padding: 15px 20px;
  background: #FF3B30;
  color: #fff;
  box-shadow: 0 10px 22px rgba(255, 59, 48, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

[data-theme="dark"] .btn-danger {
  background: #FF453A;
  box-shadow: 0 10px 22px rgba(255, 69, 58, 0.30), inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.btn + .btn-danger { margin-top: 10px; }

.btn-small { padding: 9px 16px; font-size: 13px; border-radius: 999px; }

.btn[disabled] { opacity: 0.5; }

.actions { display: flex; gap: 10px; margin-top: 16px; }
.actions .btn { flex: 1; }

/* ---------------------------------------------------------------- сегменты */

.seg {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 18px;
  background: var(--glass-soft);
  border: 1px solid var(--glass-edge);
  margin: 18px 0 6px;
}

.seg-btn {
  flex: 1;
  text-align: center;
  padding: 9px 10px;
  border-radius: 14px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 160ms ease, color 160ms ease;
}

.seg-btn.is-active {
  background: var(--glass-active);
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(20, 12, 16, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

/* --------------------------------------------------------------- подарки */

/* Переключатель корзин — две стеклянные капсулы в общей рамке. */
.baskets {
  display: flex;
  gap: 6px;
  padding: 5px;
  margin: 2px 0 14px;
  border-radius: 999px;
  background: var(--glass-soft);
  border: 1px solid var(--glass-edge);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  backdrop-filter: blur(18px) saturate(160%);
}

.basket-tab {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.22s ease, color 0.22s ease, box-shadow 0.22s ease;
  -webkit-tap-highlight-color: transparent;
}

.basket-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.basket-tab.is-active {
  background: var(--glass-active);
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 2px 10px rgba(20, 12, 16, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.basket-count {
  flex: 0 0 auto;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--hint);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.basket-tab.is-active .basket-count { background: var(--glass-soft); color: var(--ink-soft); }

.basket-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  margin-bottom: 12px;
}

.basket-note { font-size: 13px; color: var(--hint); }

/* Карточка вещи: квадрат с буквой, текст, круглая галочка справа. */
.wish-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  margin-bottom: 10px;
  border-radius: 18px;
  background: var(--glass-soft);
  border: 1px solid var(--glass-edge);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  backdrop-filter: blur(20px) saturate(160%);
  box-shadow: 0 10px 24px rgba(20, 12, 16, 0.08);
  animation: rise 0.34s cubic-bezier(0.2, 0.7, 0.3, 1) both;
  transition: opacity 0.25s ease;
}

.wish-card.is-received { opacity: 0.6; }

.wish-card.is-received .wish-title {
  text-decoration: line-through;
  text-decoration-color: var(--hint);
  text-decoration-thickness: 1px;
}

.wish-ava {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.18);
}

/* Вместо буквы — фото вещи. Чуть крупнее буквы, чтобы снимок можно было разглядеть. */
.wish-ava.is-photo {
  flex-basis: 52px;
  width: 52px;
  height: 52px;
  padding: 0;
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid var(--glass-edge);
  background: var(--surface-2);
  box-shadow: 0 4px 12px rgba(20, 12, 16, 0.18);
  cursor: zoom-in;
  -webkit-tap-highlight-color: transparent;
}

.wish-ava.is-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.wish-ava.is-photo:active { transform: scale(0.95); }

/* Фото в форме подарка. */
.wish-photo-add {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px;
  border-radius: 16px;
  border: 1.5px dashed var(--line);
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.2s ease;
}

[data-theme="dark"] .wish-photo-add { border-color: rgba(255, 255, 255, 0.16); }
.wish-photo-add:active { background: var(--glass-soft); }
.wish-photo-add[disabled] { opacity: 0.6; }

.wish-photo-add-ico {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--glass-soft);
  color: var(--ink-soft);
}

.wish-photo-add-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.wish-photo-add-title { font-size: 15px; font-weight: 500; }
.wish-photo-add-sub { font-size: 12.5px; color: var(--hint); }

.wish-photo-edit {
  display: flex;
  align-items: center;
  gap: 14px;
}

.wish-photo-thumb {
  flex: 0 0 84px;
  width: 84px;
  height: 84px;
  border-radius: 16px;
  object-fit: cover;
  border: 1px solid var(--glass-edge);
  background: var(--surface-2);
}

.wish-photo-acts { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }

.wish-photo-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px 7px 11px;
  border-radius: 999px;
  border: 1px solid var(--glass-edge);
  background: var(--glass-soft);
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.wish-photo-btn.is-quiet { color: var(--ink-soft); background: transparent; }
.wish-photo-btn[disabled] { opacity: 0.55; }

.wish-body { flex: 1; min-width: 0; }

.wish-line {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.wish-title { font-size: 15px; line-height: 1.35; }

.wish-card.is-editable { cursor: pointer; }
.wish-card.is-editable:active { opacity: 0.92; }

/* Цена — плашка, чтобы не читалась как случайное число. */
.wish-price {
  flex: 0 0 auto;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-soft);
  font-size: 12.5px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.wish-note { margin: 4px 0 0; font-size: 13px; color: var(--ink-soft); line-height: 1.45; }

.wish-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 9px;
  flex-wrap: wrap;
}

.wish-done {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 12px;
  font-weight: 500;
}

.wish-done svg { color: var(--slot-a); }

.wish-edit {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--hint);
}

/* Знак белорусского рубля: «Б» с чертой по центру (в шрифтах символа пока нет). */
.byn-sign {
  position: relative;
  display: inline-block;
  font-weight: 600;
  line-height: 1;
}

.byn-sign::after {
  content: '';
  position: absolute;
  left: -0.05em;
  right: -0.05em;
  top: 52%;
  height: 0.1em;
  background: currentColor;
  border-radius: 0.05em;
}

.wish-check {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1.5px solid var(--glass-edge);
  background: var(--glass-soft);
  color: var(--hint);
  cursor: pointer;
  transition: transform 0.18s ease, background 0.22s ease, color 0.22s ease, border-color 0.22s ease;
  -webkit-tap-highlight-color: transparent;
}

.wish-check svg { opacity: 0.35; transition: opacity 0.22s ease; }
.wish-check:active { transform: scale(0.88); }

.wish-check.is-on {
  background: var(--slot-a);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 18px rgba(47, 107, 79, 0.32);
}

.wish-check.is-on svg { opacity: 1; }

[data-theme="dark"] .wish-check.is-on { color: #10261c; }

.link-quiet { color: var(--hint); font-size: 13px; text-decoration: none; border-bottom: 1px solid var(--line); }
.link-quiet:hover { color: var(--ink); }

.state {
  font-size: 12px;
  font-weight: 500;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--glass-edge);
  background: var(--glass-soft);
  color: var(--ink-soft);
}

.state.mine { border-color: var(--ink); color: var(--ink); }
.state.gifted { border-color: transparent; background: var(--surface-2); color: var(--hint); }

/* ----------------------------------------------------------- метки авторов */

.dot { width: 6px; height: 6px; border-radius: 50%; }
.dot.a { background: var(--slot-a); }
.dot.b { background: var(--slot-b); }

/* ------------------------------------------------------------------- даты */

.date-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.date-row:last-child { border-bottom: 0; }

.date-left { display: flex; flex-direction: column; gap: 2px; }

.date-title { font-size: 15px; }

.date-when { font-size: 12.5px; color: var(--hint); }

.countdown {
  font-family: var(--font-display);
  font-size: 15px;
  color: var(--ink);
  white-space: nowrap;
}

.countdown.soft { color: var(--hint); font-family: var(--font-ui); font-size: 13px; }

/* ------------------------------------------------------------------ идеи */

.idea {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  width: 100%;
}

.idea:last-child { border-bottom: 0; }

.idea-check {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  font-size: 12px;
}

.idea.is-done .idea-check { background: var(--slot-b); border-color: var(--slot-b); color: var(--paper); }
.idea.is-done .idea-title { color: var(--hint); text-decoration: line-through; }

.idea-title { font-size: 15px; line-height: 1.4; }

.idea-note { font-size: 12.5px; color: var(--hint); margin-top: 2px; }

/* ---------------------------------------------------------------- шторка */

.sheet-wrap { position: fixed; inset: 0; z-index: 40; display: flex; align-items: flex-end; }

.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 16, 17, 0.42);
  animation: fade 180ms ease both;
}

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

.sheet {
  position: relative;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  background: var(--glass-strong);
  -webkit-backdrop-filter: blur(30px) saturate(190%);
  backdrop-filter: blur(30px) saturate(190%);
  border-top: 1px solid var(--glass-edge);
  border-radius: 28px 28px 0 0;
  padding: 10px 20px calc(26px + env(safe-area-inset-bottom));
  box-shadow: 0 -16px 44px rgba(20, 10, 16, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  animation: slide 340ms cubic-bezier(0.32, 0.72, 0, 1) both;
}

@keyframes slide { from { transform: translateY(14px); opacity: 0.6; } to { transform: none; opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .sheet, .sheet-backdrop { animation: none; }
}

.sheet-grip {
  width: 38px;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
  margin: 4px auto 14px;
}

.sheet-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  margin: 0 0 16px;
  letter-spacing: -0.02em;
}

/* ------------------------------------------------------------------ поля */

.field { display: block; margin-bottom: 16px; }

.field-label { display: block; font-size: 12.5px; color: var(--hint); margin-bottom: 5px; }

.field-input {
  width: 100%;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 8px 0;
  font-size: 16px;
  outline: none;
}

.field-input:focus { border-bottom-color: var(--ink); }

.field-input::placeholder { color: var(--hint); opacity: 0.7; }

textarea.field-input { resize: none; line-height: 1.45; }

.field-pair { display: flex; gap: 14px; }
.field-pair .field { flex: 1; }

/* --------------------------------------------------------- выбор даты */

.datefield { margin-bottom: 16px; }

.datefield-value {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--glass-edge);
  background: var(--glass-soft);
  color: var(--ink);
  font-size: 16px;
  font-weight: 500;
  transition: border-color 160ms ease;
}

.datefield-value.is-open { border-color: var(--ink-soft); }

.datefield-text { font-variant-numeric: tabular-nums; }
.datefield-text.is-empty { color: var(--hint); font-weight: 400; }

/* Окно выбора — всегда по центру экрана поверх формы, а не внутри неё:
   так оно не раздвигает шторку и не уезжает вниз страницы. */
.picker-wrap {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.picker-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 14, 18, 0.45);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  animation: fade 160ms ease both;
}

.picker {
  position: relative;
  width: min(300px, 100%);
  max-height: calc(100% - 16px);
  overflow-y: auto;
  border-radius: 22px;
  border: 1px solid var(--glass-edge);
  background: var(--surface);
  box-shadow: 0 24px 60px rgba(10, 6, 10, 0.35);
  animation: pop 200ms cubic-bezier(0.22, 1, 0.36, 1) both;
  scrollbar-width: none;
}

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

.calendar { padding: 12px 10px 6px; }

.calendar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px 10px;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.calendar-nav {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  line-height: 1;
  color: var(--ink-soft);
  background: var(--glass-soft);
  border: 1px solid var(--glass-edge);
}

.calendar-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  padding-bottom: 4px;
  font-size: 10.5px;
  color: var(--hint);
  text-align: center;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.calendar-day {
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-size: 13.5px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  transition: background 140ms ease, color 140ms ease;
}

.calendar-day:active { background: var(--glass-soft); }

.calendar-day.is-out { opacity: 0.3; }

.calendar-day.is-today { box-shadow: inset 0 0 0 1.5px var(--ink-soft); }

.calendar-day.is-selected {
  background: var(--ink);
  color: var(--paper);
  font-weight: 600;
  box-shadow: none;
}

.calendar-foot {
  display: flex;
  justify-content: space-between;
  padding: 10px 6px 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
}

.calendar-foot button { padding: 4px 2px; }
.calendar-foot button:hover { color: var(--ink); }

/* -------------------------------------------------------- выбор времени */

.timepick { padding: 14px 12px 6px; }

.timepick-show {
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 2px;
  margin-bottom: 10px;
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.timepick-show .is-empty { color: var(--hint); }
.timepick-colon { color: var(--hint); padding: 0 2px; }

.timepick-label {
  display: block;
  margin: 6px 2px 6px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--hint);
}

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

.timepick-cell {
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-size: 13.5px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  transition: background 140ms ease, color 140ms ease;
}

.timepick-cell:active { background: var(--glass-soft); }

.timepick-cell.is-selected {
  background: var(--ink);
  color: var(--paper);
  font-weight: 600;
}

/* ------------------------------------------------------------------ таббар */

.tabbar {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: calc(10px + env(safe-area-inset-bottom));
  display: flex;
  align-items: stretch;
  gap: 2px;
  padding: 5px;
  border-radius: 26px;
  border: 1px solid var(--glass-edge);
  background: var(--glass-strong);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-shadow);
  z-index: 30;
}

.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 0 7px;
  border-radius: 21px;
  color: var(--hint);
  position: relative;
  transition: color 160ms ease, background 160ms ease;
}

.tab.is-active {
  color: var(--ink);
  background: var(--glass-active);
  box-shadow: 0 2px 8px rgba(20, 12, 16, 0.10);
}

.tab.is-active .tab-label { font-weight: 600; }

.tab-label { font-size: 10.5px; letter-spacing: -0.01em; }

/* Панель «Ещё»: крупные плитки, по одной на раздел. */
.more-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding-bottom: 6px;
}

.more-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 16px 8px 14px;
  border-radius: 20px;
  border: 1px solid var(--glass-edge);
  background: var(--glass-soft);
  text-align: center;
  transition: transform 0.15s ease, background 0.15s ease;
}

.more-tile:active { transform: scale(0.96); }

.more-tile.is-active {
  background: var(--glass-active);
  box-shadow: 0 2px 10px rgba(20, 12, 16, 0.10);
}

.more-ico {
  position: relative;
  display: flex;
  margin-bottom: 4px;
  color: var(--ink);
}

.more-ico .tab-badge { top: -6px; left: auto; right: -12px; margin-left: 0; }

.more-label { font-size: 14px; font-weight: 600; color: var(--ink); }

.more-hint { font-size: 11.5px; line-height: 1.3; color: var(--hint); }

.tab-ico { display: block; }

/* ---------------------------------------------------------------- задачи */

:root {
  --done: #2F8F5B;
  --done-bg: rgba(47, 143, 91, 0.12);
  --done-edge: rgba(47, 143, 91, 0.35);
  --late: #C2484F;
}

[data-theme="dark"] {
  --done: #7FCF9A;
  --done-bg: rgba(127, 207, 154, 0.14);
  --done-edge: rgba(127, 207, 154, 0.38);
  --late: #F08A8F;
}

:root {
  --soon: #B7791F;
  --soon-bg: rgba(183, 121, 31, 0.12);
  --late-bg: rgba(194, 72, 79, 0.10);
  --late-edge: rgba(194, 72, 79, 0.38);
}

[data-theme="dark"] {
  --soon: #F2C27B;
  --soon-bg: rgba(242, 194, 123, 0.14);
  --late-bg: rgba(240, 138, 143, 0.10);
  --late-edge: rgba(240, 138, 143, 0.36);
}

/* Переключатель «Мне / От меня»: счётчик только когда есть что делать. */
.task-tabs { margin-bottom: 12px; }

.task-count {
  flex: 0 0 auto;
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--slot-b);
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 18px;
  font-variant-numeric: tabular-nums;
}

[data-theme="dark"] .task-count { color: #1A1418; }

/* Прогресс: сколько сделано из всего списка. */
.task-progress {
  margin-bottom: 18px;
  padding: 14px 16px 15px;
  border-radius: 18px;
  background: var(--glass-soft);
  border: 1px solid var(--glass-edge);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  backdrop-filter: blur(20px) saturate(160%);
}

.task-progress-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.task-progress-text { font-size: 14px; font-weight: 600; color: var(--ink); }
.task-progress.has-late .task-progress-text { color: var(--late); }
.task-progress.is-complete .task-progress-text { color: var(--done); }

.task-progress-num {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.task-progress-num span { font-size: 14px; font-weight: 500; color: var(--hint); }

.task-progress-bar {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-2);
}

[data-theme="dark"] .task-progress-bar { background: rgba(255, 255, 255, 0.08); }

.task-progress-bar span {
  display: block;
  height: 100%;
  min-width: 6px;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--done-edge), var(--done));
  transition: width 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Группы «В работе» и «Готово». */
.task-group + .task-group { margin-top: 22px; }

.task-group-title {
  margin: 0 0 10px 4px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--hint);
}

/* Карточка задачи. */
.task-card {
  position: relative;
  margin-bottom: 10px;
  padding: 14px 14px 14px 12px;
  border-radius: 20px;
  background: var(--glass-soft);
  border: 1px solid var(--glass-edge);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  backdrop-filter: blur(20px) saturate(160%);
  box-shadow: 0 10px 24px rgba(20, 12, 16, 0.08);
  transition: background 0.3s ease, border-color 0.3s ease, opacity 0.3s ease;
}

.task-card.is-editable { cursor: pointer; }
.task-card.is-editable:active { transform: scale(0.99); }

.task-card.is-overdue {
  background: var(--late-bg);
  border-color: var(--late-edge);
}

/* Выполнено — карточка зеленеет и становится тише, чтобы не спорить с текущими. */
.task-card.is-done {
  background: var(--done-bg);
  border-color: var(--done-edge);
}

.task-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

/* Кружок для отметки: заметный контур и большая зона касания вокруг. */
.task-check {
  position: relative;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 2px solid var(--done-edge);
  background: transparent;
  color: var(--done);
  transition: transform 0.18s ease, background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
  -webkit-tap-highlight-color: transparent;
}

.task-check:not(.is-static)::before {
  content: "";
  position: absolute;
  inset: -9px;
}

.task-check svg { opacity: 0; transition: opacity 0.2s ease; }
.task-check:not(.is-static):not(.is-on):active svg { opacity: 0.5; }
.task-check:not(.is-static):active { transform: scale(0.88); }

.task-card.is-overdue .task-check:not(.is-on) { border-color: var(--late-edge); }

.task-check.is-on {
  background: var(--done);
  border-color: transparent;
  color: #fff;
  animation: react-pop 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
}

[data-theme="dark"] .task-check.is-on { color: #10261c; }
.task-check.is-on svg { opacity: 1; }

/* В списке «От меня» кружок только показывает статус. */
.task-check.is-static:not(.is-on) { border-color: var(--glass-edge); border-style: dashed; }

.task-body { flex: 1; min-width: 0; padding-top: 4px; }

.task-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.task-title {
  flex: 1;
  min-width: 0;
  font-size: 15.5px;
  line-height: 1.35;
  font-weight: 600;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.task-card.is-done .task-title {
  color: var(--ink-soft);
  text-decoration: line-through;
  text-decoration-color: var(--done-edge);
  text-decoration-thickness: 1.5px;
}

.task-tag {
  flex: 0 0 auto;
  margin-top: 1px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 17px;
  white-space: nowrap;
}

.task-tag.is-late { background: var(--late); color: #fff; }
[data-theme="dark"] .task-tag.is-late { color: #2A1214; }
.task-tag.is-soon { background: var(--soon-bg); color: var(--soon); }

.task-edit {
  flex: 0 0 auto;
  margin-top: 1px;
  color: var(--hint);
  line-height: 0;
}

.task-note {
  margin: 5px 0 0;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--ink-soft);
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.task-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.task-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px 4px 8px;
  border-radius: 999px;
  background: var(--glass-soft);
  border: 1px solid var(--glass-edge);
  color: var(--ink-soft);
  font-size: 12.5px;
  line-height: 16px;
}

.task-chip svg { flex: none; opacity: 0.8; }
.task-chip.is-late { color: var(--late); border-color: var(--late-edge); background: transparent; }
.task-chip.is-done { color: var(--done); border-color: var(--done-edge); background: transparent; }

/* Фото-отчёт: сетка квадратных миниатюр под текстом задачи. Каждая открывается
   на весь экран, у своих — крестик в углу; последняя плитка «+» добавляет ещё. */
.task-photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, 60px);
  gap: 6px;
  margin: 10px 0 0 42px;
}

.task-photo {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid var(--glass-edge);
  background: var(--surface-2);
}

.task-card.is-done .task-photo { border-color: var(--done-edge); }

.task-photo-img {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
}

.task-photo-img img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.task-photo-del {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(20, 14, 18, 0.55);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: #fff;
}

/* Крестик маленький, но зона касания — как у обычной кнопки. */
.task-photo-del::before { content: ""; position: absolute; inset: -8px; }
.task-photo-del:active { transform: scale(0.9); }

.task-photo-add {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1.5px dashed var(--glass-edge);
  background: transparent;
  color: var(--ink-soft);
  font-family: inherit;
  cursor: pointer;
}

[data-theme="dark"] .task-photo-add { border-color: rgba(255, 255, 255, 0.2); }
.task-photo-add:active { background: var(--glass-soft); }

.task-photo-add-busy { font-size: 11.5px; font-weight: 600; color: var(--hint); }

.task-photo-add[disabled],
.task-photo-del[disabled] { opacity: 0.55; }

/* Кнопка «Фото» — такой же чип, но с пунктиром: видно, что это действие. */
.task-chip.task-attach {
  border-style: dashed;
  background: transparent;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
}

[data-theme="dark"] .task-chip.task-attach { border-color: rgba(255, 255, 255, 0.2); }
.task-chip.task-attach:active { background: var(--glass-soft); transform: scale(0.96); }

.task-attach[disabled] { opacity: 0.55; }

/* Форма задачи. */
.task-block { margin-bottom: 18px; }

.task-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--glass-edge);
  background: var(--glass-soft);
}

.task-switch-text { display: flex; flex-direction: column; gap: 1px; }
.task-switch-title { font-size: 15px; color: var(--ink); }
.task-switch-sub { font-size: 12px; color: var(--hint); }

.task-toggle {
  flex: 0 0 46px;
  height: 28px;
  padding: 2px;
  border-radius: 999px;
  background: var(--line);
  transition: background 0.2s ease;
}

.task-toggle span {
  display: block;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s ease;
}

.task-switch.is-on .task-toggle { background: var(--done); }
.task-switch.is-on .task-toggle span { transform: translateX(18px); }

.task-remind { margin-top: 12px; }

.task-leads { display: flex; flex-wrap: wrap; gap: 6px; }

.task-lead {
  padding: 8px 13px;
  border-radius: 999px;
  border: 1px solid var(--glass-edge);
  background: var(--glass-soft);
  color: var(--ink-soft);
  font-size: 13px;
  transition: background 0.18s ease, color 0.18s ease;
}

.task-lead.is-active {
  background: var(--ink);
  border-color: transparent;
  color: var(--paper);
  font-weight: 600;
}

/* ------------------------------------------------------------------ 18+ */

/* Вкладка 18+ меняет общий свет комнаты, а не рисует свой слой:
   свой слой внутри анимированной вкладки обрезался по краям ленты. */
.pm { position: relative; }

body::before { transition: opacity 0.4s ease; }

body.pm-active::before {
  background:
    radial-gradient(90% 55% at 50% -10%, rgba(140, 70, 110, 0.16), transparent 75%),
    radial-gradient(80% 50% at 50% 110%, rgba(192, 91, 114, 0.10), transparent 75%);
}

[data-theme="dark"] body.pm-active::before {
  background:
    radial-gradient(90% 55% at 50% -10%, rgba(150, 70, 120, 0.22), transparent 75%),
    radial-gradient(80% 50% at 50% 110%, rgba(190, 90, 120, 0.12), transparent 75%);
}

body.pm-active .scroll { padding-bottom: calc(200px + env(safe-area-inset-bottom)); }

/* Пока раздел закрыт, свет комнаты тот же, что и внутри. */
body.pm-locked::before {
  background:
    radial-gradient(90% 55% at 50% -10%, rgba(140, 70, 110, 0.16), transparent 75%),
    radial-gradient(80% 50% at 50% 110%, rgba(192, 91, 114, 0.10), transparent 75%);
}

[data-theme="dark"] body.pm-locked::before {
  background:
    radial-gradient(90% 55% at 50% -10%, rgba(150, 70, 120, 0.22), transparent 75%),
    radial-gradient(80% 50% at 50% 110%, rgba(190, 90, 120, 0.12), transparent 75%);
}

/* Экран пароля: светящийся замок, стеклянные клавиши с розовым отсветом,
   точки наполняются градиентом. При верном пароле засов поднимается. */
:root {
  --pin-accent: #C05B72;
  --pin-accent-2: #8E3F69;
  --pin-accent-glow: rgba(192, 91, 114, 0.34);
  --pin-key-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0.52));
  --pin-key-edge: rgba(255, 255, 255, 0.95);
  --pin-key-shadow: 0 10px 22px rgba(110, 52, 78, 0.10), inset 0 1px 0 rgba(255, 255, 255, 1);
  --pin-key-ink: #2A2024;
  --pin-dot-edge: rgba(91, 81, 82, 0.45);
  --pin-error: #C2484F;
}

[data-theme="dark"] {
  --pin-accent: #E09AA8;
  --pin-accent-2: #B4588A;
  --pin-accent-glow: rgba(224, 120, 150, 0.30);
  --pin-key-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.10), rgba(255, 255, 255, 0.025));
  --pin-key-edge: rgba(255, 255, 255, 0.10);
  --pin-key-shadow: 0 12px 26px rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  --pin-key-ink: #F6EFEA;
  --pin-dot-edge: rgba(246, 239, 234, 0.38);
  --pin-error: #F08A8F;
}

.pin {
  /* Размер клавиш считается от высоты видимой области: экран пароля должен целиком
     помещаться над таббаром на любом телефоне. Telegram сам отдаёт высоту окна
     в --tg-viewport-stable-height; вне Telegram берём высоту экрана. */
  --pin-h: var(--tg-viewport-stable-height, 100vh);
  --pin-k: clamp(50px, calc((var(--pin-h) - 380px) / 4.5), 74px);
  --pin-gap-y: clamp(8px, calc(var(--pin-k) * 0.19), 14px);
  --pin-gap-x: clamp(16px, calc(var(--pin-k) * 0.32), 24px);
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 320px;
  margin: 0 auto;
  padding-top: 10px;
  text-align: center;
  transition: opacity 0.35s ease 0.2s, transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) 0.2s;
}

.pin.is-open { opacity: 0; transform: scale(1.04); }

/* --- замок */

.pin-orb {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 84px;
  height: 84px;
  margin-bottom: 14px;
}

/* Мягкое свечение позади замка */
.pin-orb::before {
  content: "";
  position: absolute;
  inset: -22px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--pin-accent-glow), transparent 68%);
  animation: pin-breathe 4.2s ease-in-out infinite;
  pointer-events: none;
}

/* Тонкое кольцо, которое медленно вращается */
.pin-halo {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  padding: 1.5px;
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    var(--pin-accent) 70deg,
    transparent 150deg,
    transparent 200deg,
    var(--pin-accent-2) 280deg,
    transparent 360deg
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  opacity: 0.85;
  animation: pin-spin 9s linear infinite;
}

.pin-lock {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 66px;
  height: 66px;
  border-radius: 50%;
  border: 1px solid var(--pin-key-edge);
  background: var(--pin-key-bg);
  box-shadow: var(--pin-key-shadow);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  color: var(--pin-accent);
  transition: color 0.3s ease, transform 0.35s cubic-bezier(0.3, 1.6, 0.5, 1);
}

.pin-shackle {
  transform-box: fill-box;
  transform-origin: 100% 100%;
  transition: transform 0.38s cubic-bezier(0.3, 1.5, 0.5, 1);
}

.pin.is-open .pin-shackle { transform: translateY(-2.6px) rotate(-24deg); }
.pin.is-open .pin-lock { color: var(--done); transform: scale(1.08); }
.pin.is-open .pin-halo { animation-duration: 1.6s; }

.pin.is-waiting .pin-lock { color: var(--hint); }
.pin.is-waiting .pin-halo,
.pin.is-waiting .pin-orb::before { animation-play-state: paused; opacity: 0.35; }

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

@keyframes pin-breathe {
  0%, 100% { opacity: 0.65; transform: scale(0.94); }
  50% { opacity: 1; transform: scale(1.06); }
}

/* --- тексты */

.pin-eyebrow {
  margin: 0 0 2px;
  font-family: "Cormorant Garamond", "Times New Roman", serif;
  font-style: italic;
  font-weight: 500;
  font-size: 17px;
  letter-spacing: 0.01em;
  color: var(--pin-accent);
}

.pin-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.pin-sub {
  margin: 6px 0 0;
  max-width: 270px;
  min-height: 20px;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--hint);
}

/* --- точки */

.pin-dots {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  min-height: 14px;
  margin-top: 22px;
}

.pin-dot {
  position: relative;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 1.5px solid var(--pin-dot-edge);
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.pin-dot.is-on {
  border-color: transparent;
  background: linear-gradient(135deg, var(--pin-accent), var(--pin-accent-2));
  box-shadow: 0 0 0 4px rgba(192, 91, 114, 0.12), 0 0 14px var(--pin-accent-glow);
  animation: pin-pop 0.26s cubic-bezier(0.3, 1.8, 0.5, 1);
}

.pin-dots.is-error .pin-dot { border-color: var(--pin-error); }
.pin-dots.is-busy .pin-dot.is-on { animation: pin-wave 0.9s ease-in-out infinite; }
.pin-dots.is-busy .pin-dot:nth-child(2) { animation-delay: 0.1s; }
.pin-dots.is-busy .pin-dot:nth-child(3) { animation-delay: 0.2s; }
.pin-dots.is-busy .pin-dot:nth-child(4) { animation-delay: 0.3s; }
.pin-dots.is-busy .pin-dot:nth-child(5) { animation-delay: 0.4s; }
.pin-dots.is-busy .pin-dot:nth-child(6) { animation-delay: 0.5s; }

.pin.is-open .pin-dot.is-on {
  background: var(--done);
  box-shadow: 0 0 12px var(--done-edge);
  animation: none;
}

.pin-dots.is-shaking { animation: pin-shake 0.42s cubic-bezier(0.36, 0.07, 0.19, 0.97); }

@keyframes pin-pop {
  0% { transform: scale(0.4); }
  100% { transform: scale(1); }
}

@keyframes pin-wave {
  0%, 100% { transform: translateY(0); opacity: 1; }
  50% { transform: translateY(-4px); opacity: 0.6; }
}

@keyframes pin-shake {
  15%, 85% { transform: translateX(-3px); }
  30%, 70% { transform: translateX(6px); }
  45%, 55% { transform: translateX(-8px); }
  50% { transform: translateX(8px); }
}

.pin-error {
  min-height: 38px;
  margin: 12px 0 0;
  font-size: 13px;
  line-height: 1.4;
  color: var(--pin-error);
}

/* --- клавиатура */

.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, var(--pin-k));
  justify-content: center;
  gap: var(--pin-gap-y) var(--pin-gap-x);
  margin-top: 4px;
}

.pin-key {
  position: relative;
  width: var(--pin-k);
  height: var(--pin-k);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 50%;
  border: 1px solid var(--pin-key-edge);
  background: var(--pin-key-bg);
  box-shadow: var(--pin-key-shadow);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  color: var(--pin-key-ink);
  font-family: var(--font-display);
  font-size: calc(var(--pin-k) * 0.4);
  font-weight: 300;
  font-variant-numeric: tabular-nums;
  transition: transform 0.14s ease, opacity 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

/* Розовый отсвет из центра клавиши при нажатии */
.pin-key::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle at 50% 55%, var(--pin-accent-glow), transparent 70%);
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.35s ease, transform 0.35s ease;
  pointer-events: none;
}

.pin-key:active:not([disabled]) { transform: scale(0.92); }

.pin-key:active:not([disabled])::after {
  opacity: 1;
  transform: scale(1);
  transition-duration: 0.05s;
}

.pin-key:focus-visible {
  outline: 2px solid var(--pin-accent);
  outline-offset: 3px;
}

.pin-key[disabled] { opacity: 0.38; }

.pin-key.is-plain {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  color: var(--ink-soft);
}

.pin-key.is-plain[disabled] { opacity: 0; }

.pin-key.is-go { color: var(--hint); }

.pin-key.is-go.is-ready {
  border-color: rgba(255, 255, 255, 0.22);
  background: linear-gradient(140deg, var(--pin-accent) 0%, var(--pin-accent-2) 100%);
  color: #fff;
  box-shadow: 0 12px 28px var(--pin-accent-glow), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

[data-theme="dark"] .pin-key.is-go.is-ready { color: #fff; }

.pin-key.is-busy { opacity: 0.7; }

/* Невысокие экраны: замок и отступы компактнее, место уходит клавишам. */
@media (max-height: 800px) {
  .pin { padding-top: 0; }
  .pin-orb { width: 68px; height: 68px; margin-bottom: 8px; }
  .pin-orb::before { inset: -16px; }
  .pin-lock { width: 54px; height: 54px; }
  .pin-lock svg { width: 28px; height: 28px; }
  .pin-eyebrow { font-size: 16px; }
  .pin-title { font-size: 22px; }
  .pin-dots { margin-top: 16px; }
  .pin-error { min-height: 20px; margin-top: 10px; }
}

@media (max-height: 620px) {
  .pin-eyebrow { display: none; }
  .pin-orb { width: 56px; height: 56px; }
  .pin-lock { width: 46px; height: 46px; }
  .pin-lock svg { width: 24px; height: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  .pin-halo,
  .pin-orb::before,
  .pin-dot.is-on,
  .pin-dots.is-busy .pin-dot.is-on { animation: none; }
}

.pm-feed { display: flex; flex-direction: column; gap: 10px; }

.pm-day {
  align-self: center;
  margin: 10px 0 2px;
  padding: 3px 11px;
  border-radius: 999px;
  background: var(--glass-soft);
  color: var(--hint);
  font-size: 12px;
}

.pm-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  max-width: 82%;
}

.pm-row.is-mine { align-self: flex-end; align-items: flex-end; }

.pm-bubble {
  position: relative;
  padding: 8px 12px 8px 13px;
  border-radius: 19px 19px 19px 6px;
  background: var(--glass-strong);
  border: 1px solid var(--glass-edge);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  font-size: 15px;
  line-height: 1.4;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.pm-bubble.is-mine {
  border-radius: 19px 19px 6px 19px;
  border-color: transparent;
  color: #fff;
}

.pm-bubble.is-mine.a { background: var(--slot-a); }
.pm-bubble.is-mine.b { background: var(--slot-b); }

[data-theme="dark"] .pm-bubble.is-mine { color: #1A1418; }

.pm-bubble.is-mine { cursor: pointer; transition: transform 0.15s ease, filter 0.15s ease; }
.pm-bubble.is-picked { transform: scale(0.97); filter: brightness(0.92); }

/* Время в правом нижнем углу пузыря. Распорка резервирует под него место
   в последней строке текста. */
.pm-stamp {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  line-height: 1;
  color: var(--hint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.pm-bubble .pm-stamp {
  position: absolute;
  right: 11px;
  bottom: 7px;
}

.pm-bubble.is-mine .pm-stamp { color: rgba(255, 255, 255, 0.78); }
[data-theme="dark"] .pm-bubble.is-mine .pm-stamp { color: rgba(26, 20, 24, 0.62); }

.pm-stamp-space {
  display: inline-block;
  width: 38px;
  height: 1px;
}

.pm-stamp-space.has-tick { width: 54px; }

.pm-tick { display: block; margin-left: 1px; }

/* Под фото и видео время стоит отдельно, мелкой строкой. */
.pm-meta {
  display: inline-flex;
  padding: 0 6px;
}

.pm-chip {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--glass-strong);
  border: 1px solid var(--glass-edge);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  color: #D2445F;
  font-size: 13px;
  font-weight: 500;
  animation: rise 0.18s ease both;
}

.pm-del {
  border: 0;
  background: transparent;
  padding: 0;
  font: inherit;
  font-size: 11.5px;
  color: var(--hint);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* Медиа под вуалью: видно, что там что-то есть, но не что именно. */
.pm-veil,
.pm-media {
  position: relative;
  display: block;
  width: 240px;
  max-width: 100%;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border-radius: 20px;
  background: #2A1A24;
  border: 1px solid var(--glass-edge);
  cursor: pointer;
}

.pm-veil.is-circle { width: 200px; aspect-ratio: 1; border-radius: 50%; }

.pm-veil img,
.pm-veil video,
.pm-media img,
.pm-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.pm-veil img,
.pm-veil video {
  filter: blur(26px) saturate(0.7);
  transform: scale(1.2);
}

.pm-veil-label {
  position: absolute;
  inset: auto 10px 12px;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(20, 12, 18, 0.52);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  color: #fff;
  font-size: 12px;
  text-align: center;
}

.pm-veil.is-circle .pm-veil-label { inset: auto 22px 34px; }

/* Кружок как в Telegram: во время просмотра чуть крупнее, вокруг — кольцо прогресса. */
.pm-circle {
  position: relative;
  display: block;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  overflow: hidden;
  background: #2A1A24;
  box-shadow: 0 12px 28px rgba(20, 12, 18, 0.28);
  cursor: pointer;
  outline: none;
  transition: width 0.28s cubic-bezier(0.2, 0.8, 0.2, 1), height 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

.pm-circle.is-playing,
.pm-circle.is-paused {
  width: 248px;
  height: 248px;
  /* Пока кружок открыт, свайп по нему — перемотка, а не прокрутка ленты. */
  touch-action: none;
}

.pm-circle:focus-visible { box-shadow: 0 0 0 3px var(--slot-b), 0 12px 28px rgba(20, 12, 18, 0.28); }

.pm-circle video { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }

.pm-circle-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.pm-circle.is-playing .pm-circle-ring,
.pm-circle.is-paused .pm-circle-ring { opacity: 1; }

.pm-circle-track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.22);
  stroke-width: 2.6;
}

.pm-circle-bar {
  fill: none;
  stroke: #fff;
  stroke-width: 2.6;
  stroke-linecap: round;
  filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.35));
}

/* Точка на конце кольца — за неё удобно тянуть. Кольцо повёрнуто на −90°,
   поэтому координаты точки считаются от верха и поворачиваются вместе с ним. */
.pm-circle-knob {
  fill: #fff;
  transform: rotate(90deg);
  transform-origin: 50px 50px;
  filter: drop-shadow(0 0 3px rgba(0, 0, 0, 0.45));
}

.pm-circle-center {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(20, 12, 18, 0.45);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: #fff;
  pointer-events: none;
  animation: pop 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.pm-circle-time {
  position: absolute;
  left: 50%;
  bottom: 14%;
  transform: translateX(-50%);
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(20, 12, 18, 0.5);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  pointer-events: none;
}

.pm-circle-total { opacity: 0.65; font-weight: 500; }

@media (prefers-reduced-motion: reduce) {
  .pm-circle { transition: none; }
}

.pm-circle-play {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(20, 12, 18, 0.45);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: #fff;
}

/* Поле ввода: закреплено над таббаром, на ширину приложения. */
.pm-dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(84px + env(safe-area-inset-bottom));
  max-width: 560px;
  margin: 0 auto;
  padding: 0 12px;
  z-index: 35;
  transition: bottom 0.2s ease;
}

body.pm-typing .pm-dock { bottom: calc(8px + env(safe-area-inset-bottom)); }

body.pm-typing .tabbar {
  opacity: 0;
  transform: translateY(24px);
  pointer-events: none;
}

.tabbar { transition: opacity 0.2s ease, transform 0.2s ease; }

.pm-composer {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 6px;
  border-radius: 26px;
  border: 1px solid var(--glass-edge);
  background: var(--glass-strong);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-shadow);
}

.pm-input {
  flex: 1;
  min-width: 0;
  max-height: 120px;
  padding: 9px 4px;
  border: 0;
  background: transparent;
  resize: none;
  outline: none;
  font-size: 16px;
  line-height: 1.35;
}

.pm-input::placeholder { color: var(--hint); }

.pm-tool,
.pm-send {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--ink-soft);
}

.pm-send { background: var(--ink); color: var(--paper); }

.pm-tool[disabled],
.pm-send[disabled] { opacity: 0.4; }

.pm-picked {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  padding: 8px 8px 8px 14px;
  border-radius: 20px;
  background: var(--glass-strong);
  border: 1px solid var(--glass-edge);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  font-size: 13px;
}

.pm-picked-name { flex: 1; }

.pm-sending {
  margin: 0 0 6px;
  text-align: center;
  font-size: 12px;
  color: var(--hint);
}

/* Просмотр и запись — на весь экран, поверх всего. */
.pm-viewer,
.pm-rec {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: calc(56px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom));
  background: rgba(12, 6, 10, 0.94);
  color: #fff;
}

.pm-viewer img,
.pm-viewer video {
  max-width: 100%;
  max-height: 100%;
  min-height: 0;
  flex: 1 1 auto;
  object-fit: contain;
  border-radius: 14px;
}

.pm-viewer-bar {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top));
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: space-between;
}

.pm-viewer-act {
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 14px;
}

.pm-viewer-caption { margin: 0; font-size: 15px; text-align: center; }

.pm-rec-close {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top));
  right: 16px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.pm-rec-frame {
  width: min(78vw, 320px);
  aspect-ratio: 1;
  border-radius: 50%;
  overflow: hidden;
  background: #241520;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.14);
  transition: box-shadow 0.25s ease;
}

.pm-rec-frame.is-live { box-shadow: 0 0 0 4px #E2566F; }

.pm-rec-frame video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

.pm-rec-time { margin: 0; font-size: 14px; color: rgba(255, 255, 255, 0.72); font-variant-numeric: tabular-nums; }

.pm-rec-btn {
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 4px solid #fff;
}

.pm-rec-btn span {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #E2566F;
  transition: width 0.2s ease, height 0.2s ease, border-radius 0.2s ease;
}

.pm-rec-btn.is-live span { width: 26px; height: 26px; border-radius: 7px; }

.pm-rec-fail { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.pm-rec-fail p { margin: 0; color: rgba(255, 255, 255, 0.8); }

/* Счётчик непрочитанного на вкладке. */
.tab-badge {
  position: absolute;
  top: 4px;
  left: 50%;
  margin-left: 6px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #E2566F;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}

/* ------------------------------------------------------------------ тосты */

.toasts {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(104px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  z-index: 60;
}

.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--glass-strong);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-edge);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 500;
  padding: 11px 16px;
  border-radius: 18px;
  max-width: 88%;
  box-shadow: var(--glass-shadow);
  animation: toast-in 300ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--line);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

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

.loading-line { padding: 20px 0; color: var(--hint); font-size: 13px; }

/* ---------------------------------------------------------- фото весь экран */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 18px;
  background: rgba(12, 8, 10, 0.94);
  cursor: zoom-out;
  animation: fade 180ms ease both;
}

.lightbox img {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.lightbox-caption {
  margin: 0;
  max-width: 32ch;
  text-align: center;
  font-size: 14px;
  line-height: 1.45;
  color: #F1E7E2;
}

.lightbox-hint {
  font-size: 11.5px;
  color: rgba(241, 231, 226, 0.45);
}

@media (prefers-reduced-motion: reduce) {
  .lightbox { animation: none; }
}

/* ------------------------------------------------------------- альбомы */

.album-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

.album-card {
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--glass-edge);
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-shadow);
  text-align: left;
  transition: transform 160ms ease;
  animation: pop 320ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.album-card:active { transform: scale(0.975); }

.album-cover {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  background: linear-gradient(140deg, rgba(47, 107, 79, 0.18), rgba(192, 91, 114, 0.18));
  background-size: cover;
  background-position: center;
  color: var(--hint);
}

.album-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px 12px;
}

.album-title {
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
}

.album-meta { font-size: 11.5px; color: var(--hint); }

.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  margin-bottom: 12px;
}

.photo-cell {
  position: relative;
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface-2);
  animation: pop 280ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.photo-cell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: zoom-in;
}

.photo-del {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(12, 8, 10, 0.55);
  color: #FFFFFF;
  font-size: 15px;
  line-height: 1;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.album-add {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px;
  border-radius: 16px;
  border: 1px dashed var(--glass-edge);
  background: var(--glass-soft);
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 600;
}

.album-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 13px 14px;
  margin-bottom: 16px;
  border-radius: 16px;
  border: 1px solid var(--glass-edge);
  background: var(--glass-soft);
  color: var(--ink);
  font-size: 14.5px;
  font-weight: 600;
}

.album-link .row-go { margin-left: auto; }

/* ------------------------------------------------------------ анимации */

@keyframes pop {
  from { opacity: 0; transform: scale(0.94); }
  to { opacity: 1; transform: none; }
}

@keyframes grow {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(14px) scale(0.96); }
  to { opacity: 1; transform: none; }
}

@keyframes toast-out {
  from { opacity: 1; transform: none; }
  to { opacity: 0; transform: translateY(10px) scale(0.97); }
}

.ribbon-line {
  transform-origin: left center;
  animation: grow 800ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.hero-heart,
.ribbon-heart {
  animation: pop 420ms cubic-bezier(0.34, 1.56, 0.64, 1) 240ms both;
}

.toast.is-leaving { animation: toast-out 240ms ease both; }

.toast-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  flex: none;
  background: rgba(47, 107, 79, 0.18);
  color: var(--slot-a);
}

.toast-ico.is-error {
  background: rgba(192, 91, 114, 0.20);
  color: var(--slot-b);
}

.lightbox img {
  animation: pop 260ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------------------------------------------------------- приветствие */

.intro {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(56px + env(safe-area-inset-top)) 26px calc(150px + env(safe-area-inset-bottom));
  text-align: center;
  background: var(--paper);
  overflow: hidden;
  animation: fade 420ms ease both;
}

.intro.is-closing { animation: fade-out 360ms ease both; }

@keyframes fade-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

.intro-glow {
  position: absolute;
  width: 96vw;
  height: 96vw;
  border-radius: 50%;
  filter: blur(54px);
  pointer-events: none;
}

.intro-glow-a {
  top: -24vh;
  left: -36vw;
  background: radial-gradient(circle, rgba(47, 107, 79, 0.55), transparent 66%);
  animation: enter-left 1500ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.intro-glow-b {
  bottom: -22vh;
  right: -36vw;
  background: radial-gradient(circle, rgba(192, 91, 114, 0.55), transparent 66%);
  animation: enter-right 1500ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

[data-theme="dark"] .intro-glow-a {
  background: radial-gradient(circle, rgba(78, 168, 122, 0.60), transparent 66%);
}

[data-theme="dark"] .intro-glow-b {
  background: radial-gradient(circle, rgba(214, 122, 148, 0.60), transparent 66%);
}

@keyframes enter-left {
  from { opacity: 0; transform: translate3d(-45%, -25%, 0) scale(0.75); }
  to { opacity: 1; transform: none; }
}

@keyframes enter-right {
  from { opacity: 0; transform: translate3d(45%, 25%, 0) scale(0.75); }
  to { opacity: 1; transform: none; }
}

/* Фон из ваших фото: размытые, насыщенные, медленно сменяют друг друга
   и чуть приближаются, как будто дышат. */
.intro-photos {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #1A1016;
}

.intro-photo {
  position: absolute;
  inset: -6%;
  width: 112%;
  height: 112%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.16);
  filter: blur(9px) saturate(1.45) brightness(0.82);
  transition: opacity 1.8s ease, transform 7s ease-out;
  will-change: opacity, transform;
}

.intro-photo.is-on {
  opacity: 1;
  transform: scale(1.04);
}

/* Тёплая вуаль: сверху и снизу темнее, чтобы текст и кнопка читались,
   посередине пропускает цвет фото. */
.intro-veil {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 70% at 50% 46%, rgba(40, 14, 30, 0.10), rgba(28, 10, 22, 0.55) 78%),
    linear-gradient(180deg, rgba(24, 8, 18, 0.45) 0%, rgba(24, 8, 18, 0) 26%, rgba(24, 8, 18, 0) 58%, rgba(20, 6, 14, 0.78) 100%);
}

/* Лёгкое зерно, как у плёнки: размытие не выглядит цифровым. */
.intro-grain {
  position: absolute;
  inset: 0;
  opacity: 0.14;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.intro-content {
  position: relative;
  z-index: 1;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: rise 700ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Сердце рисуется одной линией, будто пером. */
.intro-mark {
  margin-bottom: 14px;
  overflow: visible;
}

.intro-mark-line {
  fill: none;
  stroke: var(--slot-b);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: intro-draw 1.8s cubic-bezier(0.65, 0, 0.35, 1) 0.15s forwards;
}

@keyframes intro-draw {
  to { stroke-dashoffset: 0; }
}

.intro-hello {
  margin: 0 0 2px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--ink-soft);
  animation: rise 700ms cubic-bezier(0.22, 1, 0.36, 1) 0.2s both;
}

.intro-script {
  margin: 0;
  font-family: "Cormorant Garamond", "Times New Roman", serif;
  font-style: italic;
  font-weight: 500;
  font-size: 54px;
  line-height: 1.02;
  letter-spacing: -0.01em;
  animation: rise 900ms cubic-bezier(0.22, 1, 0.36, 1) 0.35s both;
}

.intro-whisper {
  margin: 14px 0 0;
  max-width: 290px;
  font-family: "Cormorant Garamond", "Times New Roman", serif;
  font-style: italic;
  font-size: 21px;
  line-height: 1.35;
  color: var(--ink-soft);
  animation: rise 900ms cubic-bezier(0.22, 1, 0.36, 1) 0.55s both;
}

/* Дни вместе: без рамки, одной типографикой. Орнамент, крупное число,
   под ним подпись курсивом и тихая расшифровка в годах и месяцах. */
.intro-together {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 30px;
  animation: rise 900ms cubic-bezier(0.22, 1, 0.36, 1) 0.75s both;
}

.intro-orn {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  color: var(--slot-b);
}

.intro-orn svg { display: block; fill: currentColor; opacity: 0.9; }

.intro-orn-line {
  width: 46px;
  height: 1px;
  background: linear-gradient(90deg, transparent, currentColor);
  opacity: 0.6;
}

.intro-orn-line.is-right { background: linear-gradient(90deg, currentColor, transparent); }

.intro-together-num {
  font-family: "Cormorant Garamond", "Times New Roman", serif;
  font-weight: 600;
  font-size: 76px;
  line-height: 0.95;
  letter-spacing: -0.02em;
  font-variant-numeric: lining-nums tabular-nums;
  background: linear-gradient(180deg, var(--ink) 30%, var(--slot-b) 120%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.intro-together-word {
  margin-top: 2px;
  font-family: "Cormorant Garamond", "Times New Roman", serif;
  font-style: italic;
  font-size: 22px;
  line-height: 1.2;
  color: var(--ink-soft);
}

.intro-together-span {
  margin-top: 8px;
  font-size: 12.5px;
  letter-spacing: 0.01em;
  color: var(--hint);
}

/* Поверх фото всё становится светлым, кнопка — молочным стеклом. */
.intro.has-photos { color: #FFF7F4; }

.intro.has-photos .intro-hello,
.intro.has-photos .intro-whisper,
.intro.has-photos .intro-together-word { color: rgba(255, 244, 240, 0.86); }

.intro.has-photos .intro-together-span { color: rgba(255, 244, 240, 0.62); }

.intro.has-photos .intro-orn { color: #FFC9D6; }

/* Поверх фото число светится: от молочного к нежно-розовому. */
.intro.has-photos .intro-together-num {
  background: linear-gradient(180deg, #FFFFFF 25%, #FFC2D1 110%);
  -webkit-background-clip: text;
  background-clip: text;
  filter: drop-shadow(0 6px 26px rgba(255, 140, 175, 0.38));
}

.intro.has-photos .intro-script { text-shadow: 0 4px 30px rgba(30, 6, 20, 0.45); }

.intro.has-photos .intro-mark-line {
  stroke: #FFD9E2;
  filter: drop-shadow(0 0 10px rgba(255, 160, 190, 0.7));
}

.intro.has-photos .btn-primary {
  background: rgba(255, 250, 247, 0.94);
  color: #241820;
  box-shadow: 0 12px 30px rgba(20, 6, 14, 0.35);
}

.intro.has-photos .intro-skip,
.intro.has-photos .intro-later { color: rgba(255, 244, 240, 0.78); }

.intro.has-photos .intro-later { text-decoration-color: rgba(255, 244, 240, 0.4); }

.intro.has-photos .intro-dot { background: rgba(255, 255, 255, 0.32); }
.intro.has-photos .intro-dot.is-on { background: #FFF7F4; }

@media (max-height: 640px) {
  .intro-script { font-size: 44px; }
  .intro-whisper { font-size: 19px; }
  .intro-together { margin-top: 18px; }
  .intro-together-num { font-size: 60px; }
}

.intro-foot {
  position: absolute;
  left: 26px;
  right: 26px;
  bottom: calc(34px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.intro-dots {
  display: flex;
  gap: 6px;
}

.intro-dot {
  width: 6px;
  height: 6px;
  border-radius: 3px;
  background: var(--line);
  transition: width 240ms ease, background 240ms ease;
}

.intro-dot.is-on {
  width: 20px;
  background: var(--ink);
}

.intro-skip {
  position: absolute;
  top: calc(14px + env(safe-area-inset-top));
  right: 20px;
  z-index: 2;
  padding: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--hint);
}

.intro-later {
  font-size: 12px;
  color: var(--hint);
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: 3px;
}

/* --------------------------------------------------------------- стена */

.wall {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}

.wall-card {
  position: relative;
  border-radius: 16px;
  box-shadow: 0 10px 26px rgba(30, 18, 24, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  transform: rotate(var(--tilt, 0deg));
  animation: wall-pop 320ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* наклон карточки живёт в переменной, иначе анимация появления его затирает */
@keyframes wall-pop {
  from { opacity: 0; transform: rotate(var(--tilt, 0deg)) scale(0.94); }
  to { opacity: 1; transform: rotate(var(--tilt, 0deg)); }
}

.wall-card.note {
  padding: 18px 16px;
  color: var(--note-ink);
}

.wall-card.note[data-color="sage"] { background: var(--note-sage); }
.wall-card.note[data-color="mint"] { background: var(--note-mint); }
.wall-card.note[data-color="sky"] { background: var(--note-sky); }
.wall-card.note[data-color="lilac"] { background: var(--note-lilac); }
.wall-card.note[data-color="rose"] { background: var(--note-rose); }
.wall-card.note[data-color="peach"] { background: var(--note-peach); }
.wall-card.note[data-color="sand"] { background: var(--note-sand); }
.wall-card.note[data-color="pearl"] { background: var(--note-pearl); }

.wall-note-text {
  display: block;
  font-size: 14.5px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.wall-card.drawing {
  padding: 0;
  overflow: hidden;
}

.wall-card.drawing img {
  width: 100%;
  max-height: 72vh;
  object-fit: contain;
  display: block;
  cursor: zoom-in;
  background: #FBF7F2;
}

.wall-del {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
  color: var(--note-ink);
  background: rgba(0, 0, 0, 0.10);
  opacity: 0.5;
  transition: opacity 160ms ease;
}

.wall-del:hover { opacity: 0.9; }

.wall-card.drawing .wall-del {
  color: #FFFFFF;
  background: rgba(12, 8, 10, 0.5);
}

/* выбор: записка или рисунок */

.choice-row { display: flex; gap: 10px; }

.choice {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 22px 12px;
  border-radius: 20px;
  border: 1px solid var(--glass-edge);
  background: var(--glass-soft);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  transition: transform 160ms ease;
}

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

/* записка */

.note-preview { margin-bottom: 18px; }

.note-preview .wall-card {
  animation: none;
  min-height: 88px;
  display: flex;
  align-items: center;
}

.wall-note-text.is-empty { color: var(--hint); }

/* Реакции: маленькие капсулы внизу карточки. На бумаге записки — полупрозрачные,
   чтобы цвет листа просвечивал. */
.wall-reacts {
  display: flex;
  gap: 6px;
  margin-top: 12px;
}

.react {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  min-width: 34px;
  padding: 0 9px;
  justify-content: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.42);
  border: 1px solid rgba(42, 37, 34, 0.08);
  color: rgba(42, 37, 34, 0.55);
  font-size: 12.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  transition: transform 0.15s ease, background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.react:active { transform: scale(0.9); }

.react.has-count { color: rgba(42, 37, 34, 0.78); }

.react.is-mine { animation: react-pop 0.32s cubic-bezier(0.34, 1.56, 0.64, 1); }

.react.is-mine[data-kind="fire"] {
  background: rgba(240, 106, 40, 0.16);
  border-color: rgba(240, 106, 40, 0.42);
  color: #E25A1C;
}

.react.is-mine[data-kind="up"] {
  background: rgba(47, 143, 91, 0.15);
  border-color: rgba(47, 143, 91, 0.38);
  color: #2F7F52;
}

.react.is-mine[data-kind="down"] {
  background: rgba(90, 84, 92, 0.14);
  border-color: rgba(90, 84, 92, 0.34);
  color: #4A4450;
}

@keyframes react-pop {
  0% { transform: scale(0.8); }
  60% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* У рисунка реакции стоят на светлой полоске под картинкой. */
.wall-card-foot {
  padding: 0 12px 12px;
  background: #FBF7F2;
}

.wall-card-foot .wall-reacts { margin-top: 0; padding-top: 10px; }

.swatch-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.swatch {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid transparent;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
  transition: transform 160ms ease;
}

.swatch[data-color="sage"] { background: var(--note-sage); }
.swatch[data-color="mint"] { background: var(--note-mint); }
.swatch[data-color="sky"] { background: var(--note-sky); }
.swatch[data-color="lilac"] { background: var(--note-lilac); }
.swatch[data-color="rose"] { background: var(--note-rose); }
.swatch[data-color="peach"] { background: var(--note-peach); }
.swatch[data-color="sand"] { background: var(--note-sand); }
.swatch[data-color="pearl"] { background: var(--note-pearl); }

.swatch.is-on { border-color: var(--ink); transform: scale(1.08); }

/* рисование */

/* Полноэкранный режим рисования: шапка сверху, холст на всё свободное место,
   палитра снизу. Ничего не прокручивается, всё помещается в экран. */
.draw-screen {
  position: fixed;
  inset: 0;
  /* выше таббара и листов, но ниже тостов — чтобы ошибка сохранения была видна */
  z-index: 55;
  display: flex;
  flex-direction: column;
  max-width: 560px;
  margin: 0 auto;
  padding: calc(8px + env(safe-area-inset-top)) 14px calc(12px + env(safe-area-inset-bottom));
  background: var(--paper);
  overscroll-behavior: none;
  animation: fade 180ms ease both;
}

.draw-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  margin-bottom: 8px;
}

.draw-close {
  min-width: 70px;
  padding: 8px 0;
  font-size: 15px;
  color: var(--ink-soft);
}

.draw-head-side { min-width: 70px; }

.draw-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Холст позиционирован абсолютно: его собственный размер в пикселях
   не должен раздувать раскладку и выталкивать палитру за экран. */
.draw-stage {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
}

.draw-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 18px;
  background: #FBF7F2;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  box-shadow: inset 0 0 0 1px var(--glass-edge);
  cursor: crosshair;
}

.draw-panel {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 12px;
}

/* Восемь цветов в один ряд на всю ширину. */
.draw-colors {
  display: flex;
  justify-content: space-between;
  gap: 6px;
}

/* на узких телефонах кружки чуть сжимаются, но остаются в одном ряду */
.draw-colors .swatch {
  flex: 0 1 32px;
  min-width: 0;
  width: 32px;
  height: auto;
  aspect-ratio: 1;
}

.draw-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.draw-sizes,
.draw-actions { display: flex; align-items: center; gap: 8px; }

.size-dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--glass-edge);
  background: var(--glass-soft);
}

.size-dot span {
  display: block;
  border-radius: 50%;
  background: var(--ink-soft);
}

.size-dot.is-on { border-color: var(--ink); }
.size-dot.is-on span { background: var(--ink); }

/* С ластиком толщина показывается пустым кружком — видно, что это не цвет. */
.size-dot span.is-eraser {
  background: transparent;
  box-shadow: inset 0 0 0 1.5px var(--ink-soft);
}

.size-dot.is-on span.is-eraser { background: transparent; box-shadow: inset 0 0 0 1.5px var(--ink); }

.draw-eraser {
  width: 34px;
  height: 30px;
  margin-left: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid var(--glass-edge);
  background: var(--glass-soft);
  color: var(--ink-soft);
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}

.draw-eraser:active { transform: scale(0.94); }

.draw-eraser.is-on {
  border-color: transparent;
  background: var(--ink);
  color: var(--paper);
}

.draw-action {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--glass-soft);
  border: 1px solid var(--glass-edge);
}

/* ------------------------------------------------------- письма в будущее */

.letter-sealed {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 0;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line);
  font: inherit;
  color: inherit;
  text-align: left;
}

.letter-sealed:last-child { border-bottom: 0; }

/* Своё запечатанное письмо открывается на правку, чужое — просто строка. */
.letter-sealed.is-mine { cursor: pointer; }
.letter-sealed.is-mine:active { opacity: 0.9; }

.letter-seal {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
  background: var(--glass-soft);
  border: 1px solid var(--glass-edge);
}

.letter-sealed-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.letter-sealed-title { font-size: 15px; line-height: 1.35; }

.letter-sealed-meta { font-size: 12.5px; color: var(--hint); }

.letter-open-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}

/* Бумага письма: цвета те же, что у записок на стене, — читается в обеих темах. */
.letter-open {
  padding: 20px 18px 16px;
  border-radius: 18px;
  background: var(--note-sand);
  color: var(--note-ink);
  box-shadow: 0 12px 28px rgba(30, 18, 24, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.letter-open-text {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: 15px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.letter-open-meta {
  margin: 0;
  font-size: 12px;
  color: rgba(42, 37, 34, 0.62);
}

/* ------------------------------------------------------------- «Мы» */

/* Карточка «наша история»: свет двух цветов комнаты, крупное число дней,
   разбивка на годы-месяцы-дни и ближайшие вехи. */
.we-story {
  position: relative;
  margin-top: 14px;
  padding: 18px 18px 16px;
  overflow: hidden;
  border-radius: 26px;
  border: 1px solid var(--glass-edge);
  background:
    radial-gradient(120% 90% at 0% 0%, rgba(47, 107, 79, 0.18), transparent 60%),
    radial-gradient(120% 90% at 100% 100%, rgba(192, 91, 114, 0.20), transparent 60%),
    var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-shadow);
}

[data-theme="dark"] .we-story {
  background:
    radial-gradient(120% 90% at 0% 0%, rgba(127, 184, 148, 0.16), transparent 60%),
    radial-gradient(120% 90% at 100% 100%, rgba(224, 154, 168, 0.18), transparent 60%),
    var(--glass-bg);
}

.we-story-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.we-eyebrow {
  font-family: "Cormorant Garamond", "Times New Roman", serif;
  font-style: italic;
  font-weight: 500;
  font-size: 17px;
  color: var(--slot-b);
}

.we-edit {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--glass-edge);
  background: var(--glass-soft);
  color: var(--ink-soft);
  -webkit-tap-highlight-color: transparent;
}

.we-edit:active { transform: scale(0.92); }

.we-since-label {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--hint);
}

/* Дата начала — главное в карточке: крупно, в двух цветах комнаты. */
.we-since-date {
  margin: 0;
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.03em;
  background: linear-gradient(120deg, var(--slot-a), var(--slot-b));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.we-marks {
  margin-top: 14px;
  padding-top: 4px;
  border-top: 1px solid var(--line);
}

.we-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0 0;
}

.we-mark-dot {
  flex: 0 0 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--slot-a), var(--slot-b));
  box-shadow: 0 0 0 3px rgba(192, 91, 114, 0.12);
}

.we-mark-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.we-mark-title { font-size: 14px; font-weight: 500; line-height: 1.3; }
.we-mark-date { font-size: 12px; color: var(--hint); }

.we-mark-left {
  flex: 0 0 auto;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
  white-space: nowrap;
}

.we-story.is-empty { padding-bottom: 18px; }
.we-empty-title { margin: 6px 0 4px; font-family: var(--font-display); font-size: 20px; font-weight: 700; }
.we-empty-text { margin: 0 0 14px; font-size: 13.5px; line-height: 1.45; color: var(--ink-soft); }

/* Листок календаря: месяц сверху, число крупно. */
.we-cal {
  flex: 0 0 46px;
  width: 46px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  border-radius: 12px;
  border: 1px solid var(--glass-edge);
  background: var(--glass-strong);
  text-align: center;
  box-shadow: 0 4px 10px rgba(20, 12, 16, 0.08);
}

.we-cal-month {
  padding: 2px 0 1px;
  background: var(--slot-b);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

[data-theme="dark"] .we-cal-month { color: #1A1418; }

.we-cal-day {
  padding: 3px 0 4px;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--ink);
}

.we-cal.is-big { flex-basis: 56px; width: 56px; border-radius: 14px; }
.we-cal.is-big .we-cal-month { font-size: 11px; padding: 3px 0 2px; }
.we-cal.is-big .we-cal-day { font-size: 24px; padding: 4px 0 5px; }

/* Ближайшая дата — отдельной карточкой. */
.we-next {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  margin-top: 10px;
  padding: 14px 16px 14px 14px;
  border-radius: 22px;
  border: 1px solid var(--glass-edge);
  background:
    linear-gradient(120deg, rgba(192, 91, 114, 0.16), rgba(192, 91, 114, 0.04) 70%),
    var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-shadow);
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.we-next:active { transform: scale(0.99); }

.we-next-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }

.we-next-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--slot-b);
}

.we-next-title { font-size: 16px; font-weight: 600; line-height: 1.3; }
.we-next-when { font-size: 12.5px; color: var(--hint); }

.we-next-left { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; }

.we-next-num {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.we-next-unit { font-size: 12px; color: var(--hint); }

.we-next-today {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--slot-b);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

[data-theme="dark"] .we-next-today { color: #1A1418; }

/* Остальные даты. */
.we-dates { padding: 0 14px; }

.we-date {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.we-date:last-child { border-bottom: 0; }
.we-date:active { opacity: 0.85; }

.we-date-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.we-date-title { font-size: 15px; font-weight: 500; line-height: 1.3; }
.we-date-when { font-size: 12.5px; color: var(--hint); }

.we-date-left {
  flex: 0 0 auto;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--glass-soft);
  border: 1px solid var(--glass-edge);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
  white-space: nowrap;
}

.we-date.is-past { opacity: 0.6; }
.we-date.is-past .we-cal-month { background: var(--hint); }

/* Копилка идей. */
.we-idea {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.we-idea:last-child { border-bottom: 0; }

.we-idea-check {
  position: relative;
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  background: transparent;
  color: transparent;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

[data-theme="dark"] .we-idea-check { border-color: rgba(255, 255, 255, 0.22); }

.we-idea-check::before { content: ""; position: absolute; inset: -10px; }

.we-idea.is-done .we-idea-check {
  border-color: transparent;
  background: var(--slot-b);
  color: #fff;
}

[data-theme="dark"] .we-idea.is-done .we-idea-check { color: #1A1418; }

.we-idea-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  text-align: left;
}

.we-idea-title { font-size: 15px; line-height: 1.35; overflow-wrap: anywhere; }
.we-idea-note { font-size: 12.5px; color: var(--hint); overflow-wrap: anywhere; }

.we-idea.is-done .we-idea-title { color: var(--hint); text-decoration: line-through; }

.we-idea-del {
  position: relative;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 0;
  background: transparent;
  color: var(--hint);
  opacity: 0.7;
}

.we-idea-del::before { content: ""; position: absolute; inset: -6px; }
.we-idea-del:active { background: var(--glass-soft); }

/* «Как насчёт…» — выбранная копилкой идея. */
.we-pick {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 10px;
  padding: 14px 12px 14px 14px;
  border-radius: 20px;
  border: 1px solid var(--glass-edge);
  background:
    linear-gradient(120deg, rgba(47, 107, 79, 0.16), rgba(192, 91, 114, 0.18)),
    var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-shadow);
  animation: rise 320ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.we-pick-ico {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--glass-strong);
  color: var(--slot-b);
}

.we-pick-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }

.we-pick-label {
  font-family: "Cormorant Garamond", "Times New Roman", serif;
  font-style: italic;
  font-size: 15px;
  color: var(--ink-soft);
}

.we-pick-title { font-size: 16px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.we-pick-note { font-size: 12.5px; color: var(--ink-soft); }

.we-pick-close {
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 0;
  background: transparent;
  color: var(--hint);
}

.we-surprise {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 12px;
  padding: 13px 16px;
  border-radius: 999px;
  border: 1px solid var(--glass-edge);
  background:
    linear-gradient(120deg, rgba(47, 107, 79, 0.12), rgba(192, 91, 114, 0.14)),
    var(--glass-soft);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  backdrop-filter: blur(18px) saturate(160%);
  color: var(--ink);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  transition: transform 0.15s ease;
}

.we-surprise svg { color: var(--slot-b); }
.we-surprise:active { transform: scale(0.98); }

/* ------------------------------------------------------------ главная */

/* Hero: приветствие, имена, дни вместе, лента и ближайшая дата — в одной стеклянной карточке
   с двумя огнями цветов комнаты. */
.home-hero {
  position: relative;
  margin-top: 4px;
  padding: 18px 18px 16px;
  overflow: hidden;
  border-radius: 28px;
  border: 1px solid var(--glass-edge);
  background:
    radial-gradient(110% 80% at 0% 0%, rgba(47, 107, 79, 0.20), transparent 62%),
    radial-gradient(110% 80% at 100% 100%, rgba(192, 91, 114, 0.22), transparent 62%),
    var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-shadow);
}

[data-theme="dark"] .home-hero {
  background:
    radial-gradient(110% 80% at 0% 0%, rgba(127, 184, 148, 0.18), transparent 62%),
    radial-gradient(110% 80% at 100% 100%, rgba(224, 154, 168, 0.20), transparent 62%),
    var(--glass-bg);
}

.home-hello {
  display: block;
  margin-bottom: 4px;
  font-family: "Cormorant Garamond", "Times New Roman", serif;
  font-style: italic;
  font-weight: 500;
  font-size: 18px;
  color: var(--ink-soft);
}

.home-names { font-size: 30px; }

.home-hero .ribbon { margin-top: 14px; margin-bottom: 2px; }

.home-start {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px dashed var(--glass-edge);
  background: var(--glass-soft);
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
}

[data-theme="dark"] .home-start { border-color: rgba(255, 255, 255, 0.2); }

/* Ближайшая важная дата — строкой внизу карточки. */
.home-next {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid var(--glass-edge);
  background: var(--glass-soft);
  color: inherit;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

.home-next:active { transform: scale(0.99); }

.home-next-dot {
  flex: 0 0 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--slot-b);
  box-shadow: 0 0 0 4px rgba(192, 91, 114, 0.16);
  animation: home-pulse 2.4s ease-in-out infinite;
}

@keyframes home-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(192, 91, 114, 0.18); }
  50% { box-shadow: 0 0 0 6px rgba(192, 91, 114, 0.06); }
}

.home-next-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 600;
}

.home-next-left {
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 600;
  color: var(--slot-b);
  white-space: nowrap;
}

/* Сводка: сетка 2×2 из стеклянных плиток. */
.home-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}

.home-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
  padding: 12px 14px 13px;
  border-radius: 20px;
  border: 1px solid var(--glass-edge);
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-shadow);
  color: inherit;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.home-tile:active { transform: scale(0.97); }

.home-tile-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 8px;
}

.home-tile-ico {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  background: var(--glass-soft);
  border: 1px solid var(--glass-edge);
  color: var(--ink-soft);
}

.home-tile-badge {
  min-width: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--slot-b);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 22px;
  text-align: center;
}

[data-theme="dark"] .home-tile-badge { color: #1A1418; }

.home-tile-value {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.home-tile-label {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
  color: var(--hint);
}

.home-tile.is-late .home-tile-ico { color: var(--late); border-color: var(--late-edge); }
.home-tile.is-late .home-tile-value { color: var(--late); }
.home-tile.is-calm .home-tile-ico { color: var(--done); border-color: var(--done-edge); }
.home-tile.is-hot .home-tile-ico { color: var(--slot-b); }
.home-tile.is-hot {
  background:
    linear-gradient(140deg, rgba(192, 91, 114, 0.16), transparent 70%),
    var(--glass-bg);
}

/* Последняя записка со стены — на своей цветной бумаге. */
.home-note {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 12px;
  border-radius: 22px;
  border: 1px solid var(--glass-edge);
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-shadow);
  color: inherit;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

.home-note:active { transform: scale(0.99); }

.home-note-label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 2px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--hint);
}

.home-note-paper {
  display: block;
  padding: 14px 16px 12px;
  border-radius: 14px;
  color: var(--note-ink);
  background: var(--note-sage);
  transform: rotate(-0.6deg);
  box-shadow: 0 8px 18px rgba(30, 18, 24, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.home-note-paper[data-color="sage"] { background: var(--note-sage); }
.home-note-paper[data-color="mint"] { background: var(--note-mint); }
.home-note-paper[data-color="sky"] { background: var(--note-sky); }
.home-note-paper[data-color="lilac"] { background: var(--note-lilac); }
.home-note-paper[data-color="rose"] { background: var(--note-rose); }
.home-note-paper[data-color="peach"] { background: var(--note-peach); }
.home-note-paper[data-color="sand"] { background: var(--note-sand); }
.home-note-paper[data-color="pearl"] { background: var(--note-pearl); }

.home-note-text {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-family: var(--font-display);
  font-size: 15.5px;
  line-height: 1.5;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.home-note-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font-size: 11.5px;
  color: rgba(42, 37, 34, 0.6);
}

.home-note-drawing {
  display: block;
  overflow: hidden;
  border-radius: 14px;
  background: #fff;
}

.home-note-drawing img {
  display: block;
  width: 100%;
  max-height: 200px;
  object-fit: contain;
}

/* Планы: листок календаря, название и время. */
.home-plans { padding: 0 14px; }

.home-plan {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.home-plan:last-child { border-bottom: 0; }
.home-plan:active { opacity: 0.85; }

.home-plan .we-cal-month { background: var(--slot-a); }

.home-plan-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.home-plan-title { font-size: 15px; font-weight: 500; line-height: 1.3; }
.home-plan-meta { font-size: 12.5px; color: var(--hint); }
.home-plan-go { flex: none; color: var(--hint); opacity: 0.6; }

@media (prefers-reduced-motion: reduce) {
  .home-next-dot { animation: none; }
}

/* -------------------------------------------------------------- клятва */

body.pact-open .sheet-wrap { z-index: 58; }

/* Полноэкранный экран: подписание клятвы и ответ на напоминание. */
.pact-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background:
    radial-gradient(90% 50% at 0% 0%, rgba(47, 107, 79, 0.16), transparent 70%),
    radial-gradient(90% 50% at 100% 100%, rgba(192, 91, 114, 0.18), transparent 70%),
    var(--paper);
  animation: fade 220ms ease both;
}

[data-theme="dark"] .pact-screen {
  background:
    radial-gradient(90% 50% at 0% 0%, rgba(127, 184, 148, 0.14), transparent 70%),
    radial-gradient(90% 50% at 100% 100%, rgba(224, 154, 168, 0.16), transparent 70%),
    var(--paper);
}

.pact-inner {
  max-width: 480px;
  margin: 0 auto;
  padding: calc(28px + env(safe-area-inset-top)) 20px calc(32px + env(safe-area-inset-bottom));
}

.pact-eyebrow {
  display: block;
  font-family: "Cormorant Garamond", "Times New Roman", serif;
  font-style: italic;
  font-weight: 500;
  font-size: 18px;
  color: var(--slot-b);
}

.pact-title {
  margin: 2px 0 8px;
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.pact-lead {
  margin: 0 0 18px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-soft);
}

/* Лист клятвы: та же бумага, что у записок и писем, — читается одинаково в обеих темах. */
.pact-paper {
  position: relative;
  padding: 20px 18px 16px;
  border-radius: 20px;
  background: var(--note-sand);
  color: var(--note-ink);
  box-shadow: 0 14px 32px rgba(30, 18, 24, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.pact-paper::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(42, 37, 34, 0.12);
  border-radius: 14px;
  pointer-events: none;
}

.pact-paper-head {
  margin: 0 0 10px;
  font-family: "Cormorant Garamond", "Times New Roman", serif;
  font-size: 19px;
  font-style: italic;
  line-height: 1.35;
}

.pact-paper-head b { font-style: normal; font-weight: 700; }

.pact-vows {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pact-vow {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.pact-vow-num {
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  margin-top: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(192, 91, 114, 0.14);
  color: #A64D6B;
  font-size: 12px;
  font-weight: 700;
}

.pact-vow-text {
  font-family: var(--font-display);
  font-size: 15px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

/* Подпись второго прямо на листе — видно, под каким текстом она стоит. */
.pact-other {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px dashed rgba(42, 37, 34, 0.2);
}

.pact-other-sign {
  height: 52px;
  max-width: 70%;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.pact-other-meta { font-size: 12px; color: rgba(42, 37, 34, 0.62); }

.pact-paper.is-proof .pact-other-sign { height: 64px; }
.pact-other.is-proof .pact-other-meta { font-weight: 600; color: #A64D6B; }

.pact-tools {
  display: flex;
  justify-content: flex-end;
  min-height: 20px;
  margin: 10px 2px 14px;
}

.pact-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 0;
  border: 0;
  background: none;
  color: var(--hint);
  font-family: inherit;
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* Поле подписи: бумага, линия, как на документе. */
.pact-pad {
  position: relative;
  height: 150px;
  border-radius: 18px;
  overflow: hidden;
  background: #FBF7F2;
  box-shadow: inset 0 0 0 1px rgba(42, 37, 34, 0.12), 0 8px 20px rgba(30, 18, 24, 0.10);
}

.pact-pad-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
}

.pact-pad-hint {
  position: absolute;
  left: 0;
  right: 0;
  top: 46%;
  text-align: center;
  font-family: "Cormorant Garamond", "Times New Roman", serif;
  font-style: italic;
  font-size: 19px;
  color: rgba(42, 37, 34, 0.35);
  pointer-events: none;
}

.pact-pad-line {
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 34px;
  border-bottom: 1.5px solid rgba(42, 37, 34, 0.22);
  pointer-events: none;
}

.pact-pad-clear {
  position: absolute;
  top: 8px;
  right: 10px;
  padding: 4px 10px;
  border: 0;
  border-radius: 999px;
  background: rgba(42, 37, 34, 0.08);
  color: rgba(42, 37, 34, 0.7);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
}

.pact-sign-name {
  margin: 8px 4px 16px;
  font-size: 12.5px;
  color: var(--hint);
  text-align: right;
}

/* «Удерживай — клянусь»: кнопка наливается цветом, пока держишь палец. */
.pact-hold {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 56px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}

.pact-hold-fill {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--slot-a), var(--slot-b));
  transform-origin: left center;
  transform: scaleX(var(--hold, 0));
}

.pact-hold-label { position: relative; }

.pact-hold.is-holding { transform: scale(0.985); }
.pact-hold.is-disabled { opacity: 0.4; cursor: default; }

.pact-later {
  display: block;
  margin: 14px auto 0;
  padding: 6px 12px;
  border: 0;
  background: none;
  color: var(--hint);
  font-family: inherit;
  font-size: 14px;
}

.pact-later.is-danger { margin-top: 4px; color: var(--late); font-size: 13px; }

/* После подписи. */
.pact-done {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding-top: 18vh;
  text-align: center;
}

.pact-seal {
  width: 76px;
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--slot-a), var(--slot-b));
  color: #fff;
  box-shadow: 0 16px 36px rgba(192, 91, 114, 0.35);
  animation: pop 420ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.pact-done-title {
  margin: 8px 0 0;
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.pact-done-text {
  margin: 0 0 14px;
  max-width: 320px;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--ink-soft);
}

/* Напоминание: о чём речь и ответы. */
.pact-claim-text {
  margin: 4px 0 10px;
  padding: 14px 16px;
  border-radius: 16px;
  border-left: 3px solid var(--slot-b);
  background: var(--glass-bg);
  font-size: 16px;
  line-height: 1.45;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.pact-claim-task {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--ink-soft);
}

.pact-answers {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 18px;
}

.pact-answers .btn { width: 100%; }

.pact-note {
  margin: 2px 0 0;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--hint);
  text-align: center;
}

.pact-verdict {
  margin-top: 18px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--glass-soft);
  border: 1px solid var(--glass-edge);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  color: var(--ink-soft);
}

.pact-verdict.is-admitted,
.pact-verdict.is-done { color: var(--done); border-color: var(--done-edge); background: var(--done-bg); }

/* Карточка-свидетельство в «Мы». */
.pact-card {
  margin-top: 14px;
  padding: 16px;
  border-radius: 24px;
  border: 1px solid var(--glass-edge);
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-shadow);
}

.pact-card.is-sealed {
  background:
    linear-gradient(160deg, rgba(192, 91, 114, 0.08), transparent 60%),
    var(--glass-bg);
}

.pact-card-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.pact-card-ico {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 13px;
  background: var(--glass-soft);
  border: 1px solid var(--glass-edge);
  font-size: 19px;
}

.pact-card-title-wrap { display: flex; flex-direction: column; min-width: 0; }
.pact-card-title { font-family: var(--font-display); font-size: 17px; font-weight: 700; }
.pact-card-sub { font-size: 12.5px; color: var(--hint); }

.pact-card .pact-vow-num { background: var(--glass-soft); color: var(--slot-b); }
.pact-card .pact-vow-text { font-size: 14px; }
.pact-card .pact-link { margin-top: 8px; }

.pact-signs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 14px 0 12px;
}

.pact-sign {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 8px 10px;
  border-radius: 16px;
  background: #FBF7F2;
  color: #2A2024;
  text-align: center;
  box-shadow: inset 0 0 0 1px rgba(42, 37, 34, 0.1);
}

.pact-sign img {
  width: 100%;
  height: 54px;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.pact-sign-name-line {
  width: 100%;
  padding-top: 4px;
  border-top: 1px solid rgba(42, 37, 34, 0.18);
  font-size: 13px;
  font-weight: 700;
}

.pact-sign-name-line.slot-a { color: #2F6B4F; }
.pact-sign-name-line.slot-b { color: #C05B72; }

.pact-sign-when { font-size: 11px; color: rgba(42, 37, 34, 0.6); }

.pact-sign.is-empty {
  justify-content: flex-end;
  min-height: 100px;
  background: transparent;
  color: var(--hint);
  box-shadow: inset 0 0 0 1.5px var(--line);
  border: 0;
}

.pact-sign.is-empty .pact-sign-name-line { color: var(--hint); border-top-color: var(--line); }
.pact-sign-wait { margin-bottom: auto; padding-top: 22px; font-size: 12px; font-style: italic; }

.pact-remind {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 12px 16px;
  border-radius: 999px;
  border: 1px solid var(--glass-edge);
  background: var(--glass-soft);
  color: var(--ink);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
}

.pact-remind:active { transform: scale(0.98); }

.pact-history {
  margin-top: 14px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
}

.pact-history-title {
  display: block;
  margin: 6px 2px 4px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--hint);
}

.pact-history-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: 10px 2px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  color: inherit;
  font-family: inherit;
  text-align: left;
}

.pact-history-row:last-child { border-bottom: 0; }
.pact-history-who { font-size: 12px; font-weight: 600; color: var(--ink-soft); }
.pact-history-date { font-weight: 400; color: var(--hint); }

.pact-history-text {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.4;
}

.pact-history-status { font-size: 12px; color: var(--hint); }
.pact-history-status.is-admitted,
.pact-history-status.is-done { color: var(--done); }
.pact-history-status.is-open { color: var(--slot-b); }

/* Баннер на главной: напоминание о клятве или ожидание подписи. */
.home-pact {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 20px;
  border: 1px solid var(--glass-edge);
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-shadow);
  color: inherit;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

.home-pact.is-claim {
  border-color: rgba(192, 91, 114, 0.45);
  background:
    linear-gradient(120deg, rgba(192, 91, 114, 0.18), rgba(192, 91, 114, 0.04)),
    var(--glass-bg);
}

.home-pact-ico { flex: none; font-size: 22px; }
.home-pact-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.home-pact-title { font-size: 15px; font-weight: 600; line-height: 1.3; }
.home-pact-sub { font-size: 12.5px; color: var(--hint); }

/* Чип «Напомнить о клятве» в задачах. */
.task-chip.task-claim {
  border-color: rgba(192, 91, 114, 0.4);
  background: transparent;
  color: var(--slot-b);
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
}

/* ----------------------------------------------------------- настроение */

/* Цвет сердечек зависит от настроения: от холодного серого до яркого алого. */
:root {
  --mood-0: var(--line);
  --mood-1: #6F6870;
  --mood-2: #8E8DB4;
  --mood-3: #C98FA2;
  --mood-4: #DA6B8A;
  --mood-5: #E2385E;
}

[data-theme="dark"] {
  --mood-1: #9A929B;
  --mood-2: #A9A8D0;
  --mood-3: #DDA6B8;
  --mood-4: #EE87A3;
  --mood-5: #FF5A7D;
}

.mood-card {
  margin-top: 12px;
  padding: 16px 16px 14px;
  border-radius: 24px;
  border: 1px solid var(--glass-edge);
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-shadow);
  transition: background 0.4s ease, border-color 0.4s ease;
}

/* Карточка подсвечивается настроением второго: сразу видно, как он сейчас. */
.mood-card.partner-level-1 {
  border-color: rgba(111, 104, 112, 0.5);
  background: linear-gradient(160deg, rgba(60, 56, 64, 0.22), transparent 65%), var(--glass-bg);
}

.mood-card.partner-level-2 { background: linear-gradient(160deg, rgba(142, 141, 180, 0.14), transparent 65%), var(--glass-bg); }
.mood-card.partner-level-4 { background: linear-gradient(160deg, rgba(218, 107, 138, 0.14), transparent 65%), var(--glass-bg); }

.mood-card.partner-level-5 {
  border-color: rgba(226, 56, 94, 0.45);
  background: linear-gradient(160deg, rgba(226, 56, 94, 0.20), transparent 70%), var(--glass-bg);
}

.mood-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 6px;
}

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

.mood-sub {
  font-family: "Cormorant Garamond", "Times New Roman", serif;
  font-style: italic;
  font-size: 15px;
  color: var(--hint);
}

.mood-row { padding: 10px 0 12px; }
.mood-row + .mood-row { border-top: 1px solid var(--line); padding-top: 14px; padding-bottom: 2px; }

.mood-row-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.mood-name { font-size: 14px; font-weight: 700; }
.mood-name.slot-a { color: var(--slot-a); }
.mood-name.slot-b { color: var(--slot-b); }

.mood-when { font-size: 12px; color: var(--hint); text-align: right; }

.mood-hearts { display: flex; gap: 4px; }
.mood-hearts.is-picker { gap: 2px; margin-left: -6px; }

.mood-heart {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--mood-0);
  transition: color 0.2s ease, transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

button.mood-heart {
  width: 46px;
  height: 46px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  -webkit-tap-highlight-color: transparent;
}

button.mood-heart:active { transform: scale(0.82); }

[data-theme="dark"] .mood-heart:not(.is-on) { color: rgba(255, 255, 255, 0.18); }

.mood-hearts.level-1 .mood-heart.is-on { color: var(--mood-1); }
.mood-hearts.level-2 .mood-heart.is-on { color: var(--mood-2); }
.mood-hearts.level-3 .mood-heart.is-on { color: var(--mood-3); }
.mood-hearts.level-4 .mood-heart.is-on { color: var(--mood-4); }
.mood-hearts.level-5 .mood-heart.is-on {
  color: var(--mood-5);
  filter: drop-shadow(0 2px 8px rgba(226, 56, 94, 0.35));
}

.mood-hearts.is-picker .mood-heart.is-on { animation: mood-pop 0.32s cubic-bezier(0.34, 1.56, 0.64, 1); }

@keyframes mood-pop {
  0% { transform: scale(0.7); }
  100% { transform: scale(1); }
}

.mood-label {
  margin: 6px 0 1px;
  font-size: 15px;
  font-weight: 600;
}

.mood-desc {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--ink-soft);
}

.mood-note {
  margin: 8px 0 0;
  padding: 8px 12px;
  border-left: 3px solid var(--slot-b);
  border-radius: 10px;
  background: var(--glass-soft);
  font-size: 14px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

/* Свои слова — кнопка: нажал и поправил. Карандаш подсказывает, что это можно изменить. */
.mood-note.is-mine {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  border-top: 0;
  border-right: 0;
  border-bottom: 0;
  color: inherit;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

.mood-note.is-mine:active { opacity: 0.85; }
.mood-note-text { flex: 1; min-width: 0; }
.mood-note-pencil { flex: none; margin-top: 2px; color: var(--hint); }

.mood-note-actions {
  display: flex;
  justify-content: space-between;
  margin-top: 2px;
  padding: 0 4px;
}

.mood-note-open.is-danger { color: var(--late); }

/* Отметка не за сегодня — бледнее: видно, что это было раньше. */
.mood-row.is-stale .mood-hearts,
.mood-row.is-stale .mood-label,
.mood-row.is-stale .mood-desc,
.mood-row.is-stale .mood-note { opacity: 0.5; }

.mood-note-open {
  margin-top: 8px;
  padding: 4px 0;
  border: 0;
  background: none;
  color: var(--hint);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
}

.mood-note-form {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.mood-note-input {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--glass-edge);
  background: var(--glass-soft);
  color: var(--ink);
  font-family: inherit;
  font-size: 16px;
  outline: none;
}

.mood-note-send {
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: var(--slot-b);
  color: #fff;
}

.mood-note-send[disabled] { opacity: 0.4; }

/* Неделя: точка на день. */
.mood-week {
  display: flex;
  justify-content: space-between;
  max-width: 260px;
  margin-top: 12px;
}

.mood-week-day { display: flex; flex-direction: column; align-items: center; gap: 3px; }

.mood-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
}

[data-theme="dark"] .mood-dot.level-0 { border-color: rgba(255, 255, 255, 0.16); }

.mood-dot.level-1 { border-color: transparent; background: var(--mood-1); }
.mood-dot.level-2 { border-color: transparent; background: var(--mood-2); }
.mood-dot.level-3 { border-color: transparent; background: var(--mood-3); }
.mood-dot.level-4 { border-color: transparent; background: var(--mood-4); }
.mood-dot.level-5 { border-color: transparent; background: var(--mood-5); }

.mood-week-label { font-size: 10px; color: var(--hint); }

@media (prefers-reduced-motion: reduce) {
  .mood-hearts.is-picker .mood-heart.is-on { animation: none; }
}
