/* Тёплый дневник: бумага, чернила, стикеры */
:root {
  --page: #F5EDDF;
  --card: #FFFBF2;
  --ink: #2E2620;
  --muted: #6A5B4E;
  --line: #E6DAC6;
  --line-strong: #D8C8AE;
  --accent: #B8324F;
  --accent-ink: #FFFFFF;
  --accent-soft: #F8E1DF;
  --sasha: #2467B5;
  --katya: #D9486E;
  --quiet: #EDE4F3;
  --quiet-ink: #54406B;
  --tape: rgba(214, 170, 90, .42);
  --n-butter: #FFF1BF;
  --n-blush: #FFE0DC;
  --n-sky: #DDEBF5;
  --n-sage: #E0ECD7;
  --shadow: 0 1px 2px rgba(70, 45, 20, .07), 0 8px 22px rgba(70, 45, 20, .08);
  --shadow-lift: 0 2px 4px rgba(70, 45, 20, .1), 0 14px 30px rgba(70, 45, 20, .14);
  --sticker-shadow: drop-shadow(0 1px 1px rgba(60, 30, 10, .22)) drop-shadow(0 4px 7px rgba(60, 30, 10, .16));
  --hand: 'Caveat', 'Segoe Script', cursive;
  --serif: 'Lora', Georgia, serif;
  --ui: 'Nunito', -apple-system, system-ui, 'Segoe UI', sans-serif;
  --nav-h: 66px;
  --safe-b: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px));
}
[data-theme="dark"] {
  --page: #1E1915;
  --card: #2B241E;
  --ink: #F3E9DA;
  --muted: #B9A996;
  --line: #40362C;
  --line-strong: #54473A;
  --accent: #E8607E;
  --accent-ink: #2A0F16;
  --accent-soft: #46262C;
  --sasha: #4D93C4;
  --katya: #E8607E;
  --quiet: #352B40;
  --quiet-ink: #D9C8EC;
  --tape: rgba(214, 170, 90, .26);
  --n-butter: #4A3F22;
  --n-blush: #4B2F33;
  --n-sky: #2A3B48;
  --n-sage: #2F3B2C;
  --shadow: 0 1px 2px rgba(0, 0, 0, .25), 0 8px 22px rgba(0, 0, 0, .25);
  --shadow-lift: 0 2px 4px rgba(0, 0, 0, .3), 0 14px 30px rgba(0, 0, 0, .35);
  --sticker-shadow: drop-shadow(0 2px 5px rgba(0, 0, 0, .45));
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--page); -webkit-text-size-adjust: 100%; }
html.locked, html.locked body { overflow: hidden; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
  font: 500 16px/1.45 var(--ui);
  overscroll-behavior-y: none;
  user-select: none;
  -webkit-user-select: none;
}
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .32 0 0 0 0 .18 0 0 0 .1 0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, textarea { font: inherit; color: inherit; user-select: text; -webkit-user-select: text; }
h1, h2, h3, p { margin: 0; }
img { display: block; }
[hidden] { display: none !important; }
.selectable { user-select: text; -webkit-user-select: text; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

#app {
  position: relative;
  max-width: 560px;
  margin: 0 auto;
  padding: 14px 16px calc(var(--nav-h) + var(--safe-b) + 26px);
}

/* загрузка и сообщения на весь экран */
.splash { min-height: 70vh; display: grid; place-items: center; }
.splash-heart { width: 34px; height: 34px; background: var(--accent); transform: rotate(45deg); border-radius: 6px 0 0 0; animation: beat 1.1s infinite; position: relative; }
.splash-heart::before, .splash-heart::after { content: ''; position: absolute; width: 34px; height: 34px; border-radius: 50%; background: var(--accent); }
.splash-heart::before { left: -17px; top: 0; }
.splash-heart::after { top: -17px; left: 0; }
.fatal { min-height: 70vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 12px; padding: 20px; }
.fatal h1 { font: 700 34px/1.1 var(--hand); }
.fatal p { color: var(--muted); max-width: 300px; }

/* шапка */
.top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.hello { font: 700 36px/1.05 var(--hand); }
.sub { color: var(--muted); font-size: 14px; margin-top: 3px; }
.sub button { color: inherit; text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; font-weight: 700; }
.icon-btn { width: 44px; height: 44px; margin: -4px -8px 0 0; display: grid; place-items: center; color: var(--muted); border-radius: 50%; flex: none; }
.icon-btn svg { width: 23px; height: 23px; }
.page-title { font: 700 38px/1.05 var(--hand); margin: 2px 0 12px; }

/* двое */
.duo { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 6px 0 16px; }
.pcard {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: var(--card);
  border-radius: 18px;
  padding: 10px 8px 12px;
  box-shadow: var(--shadow);
  transition: transform .18s;
  width: 100%;
}
.pcard:active { transform: scale(.975); }
.pcard::before {
  content: '';
  position: absolute;
  top: -7px;
  left: 50%;
  width: 66px;
  height: 18px;
  margin-left: -33px;
  background: var(--tape);
  transform: rotate(-2.5deg);
  border-radius: 2px;
}
.pcard:nth-child(2)::before { transform: rotate(2deg); }
.pcard-art { height: 148px; display: flex; align-items: flex-end; justify-content: center; }
.sticker { filter: var(--sticker-shadow); pointer-events: none; -webkit-user-drag: none; }
.pcard-art .sticker { max-height: 146px; max-width: 100%; animation: bob 4.4s ease-in-out infinite; transform-origin: 50% 90%; }
.pcard:nth-child(2) .pcard-art .sticker { animation-delay: -2.1s; }
.pname { font: 700 27px/1 var(--hand); margin-top: 6px; }
.pstatus { font-weight: 800; font-size: 14.5px; line-height: 1.25; margin-top: 3px; }
.puntil { color: var(--muted); font-size: 13px; }
.pnote { font: italic 400 13px/1.3 var(--serif); color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; }
.pquiet { display: inline-flex; align-items: center; gap: 4px; margin-top: 5px; background: var(--quiet); color: var(--quiet-ink); font-size: 12px; font-weight: 800; padding: 2px 9px; border-radius: 99px; }
.pspacer { flex: 1; min-height: 8px; }
.pcta { font-size: 13.5px; font-weight: 800; color: var(--accent); background: var(--accent-soft); padding: 7px 13px; border-radius: 99px; line-height: 1.1; }

.heart-btn {
  position: absolute;
  left: 50%;
  top: 74px;
  width: 44px;
  height: 44px;
  margin-left: -22px;
  display: grid;
  place-items: center;
  z-index: 2;
  background: var(--card);
  border-radius: 50%;
  box-shadow: var(--shadow-lift);
}
.heart-btn svg { width: 24px; height: 24px; fill: var(--accent); animation: beat 1.9s infinite; }
.heart-btn:active svg { transform: scale(1.3); }

/* карточки */
.card { position: relative; background: var(--card); border-radius: 18px; padding: 16px; box-shadow: var(--shadow); margin-bottom: 14px; }
.card-title { font: 700 27px/1.1 var(--hand); }
.section-title { font: 700 27px/1.1 var(--hand); margin: 20px 2px 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.section-title small { font: 600 13px var(--ui); color: var(--muted); }
.add-link { font: 800 14px var(--ui); color: var(--accent); background: var(--accent-soft); border-radius: 99px; padding: 8px 14px; line-height: 1.1; flex: none; min-height: 40px; }

/* настроение */
.faces { display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px; margin-top: 10px; }
.face-btn { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px 0; font-size: 12px; font-weight: 700; color: var(--muted); border-radius: 12px; line-height: 1.15; min-height: 66px; }
.face-btn svg { width: 46px; height: 46px; transition: transform .22s cubic-bezier(.3, 1.8, .5, 1); }
.face-btn:active svg { transform: scale(.88); }
.faces.has-value .face-btn:not(.on) svg { filter: saturate(.35); opacity: .55; }
.face-btn.on { color: var(--ink); }
.face-btn.on svg { transform: scale(1.18); }
.rates { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 4px; }
.rate { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; }
.rate-label { font-weight: 700; font-size: 15px; }
.dots { display: flex; gap: 2px; flex: none; }
.dot-btn { width: 36px; height: 40px; display: grid; place-items: center; }
.dot-btn i { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line-strong); transition: transform .2s cubic-bezier(.3, 1.8, .5, 1), background .15s, border-color .15s; display: block; }
.dot-btn.on i { background: var(--accent); border-color: var(--accent); }
.dot-btn:active i { transform: scale(.8); }
.dot-btn svg { width: 24px; height: 24px; fill: none; stroke: var(--line-strong); stroke-width: 2; transition: transform .2s cubic-bezier(.3, 1.8, .5, 1); }
.dot-btn.on svg { fill: var(--accent); stroke: var(--accent); }
.partner-mood { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 14.5px; color: var(--muted); }
.partner-mood svg { width: 34px; height: 34px; flex: none; }
.partner-mood b { color: var(--ink); font-weight: 800; }

/* кнопки */
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 52px; border-radius: 15px; background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: 16.5px; padding: 12px 16px; transition: transform .14s, opacity .14s; }
.btn:active { transform: scale(.975); }
.btn[disabled] { opacity: .55; }
.btn.ghost { background: var(--accent-soft); color: var(--accent); }
.btn.plain { background: transparent; color: var(--muted); min-height: 46px; font-weight: 700; }
.btn.danger { background: transparent; color: var(--muted); min-height: 46px; font-weight: 700; font-size: 15px; }
.btn-row { display: flex; gap: 10px; margin-top: 12px; }
.btn-row > * { flex: 1; }
.btn-small { margin-top: 12px; min-height: 46px; font-size: 15px; }

/* поле записи */
.composer {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: var(--card);
  border-radius: 18px;
  padding: 16px;
  min-height: 62px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 16px;
  font-family: var(--serif);
  font-style: italic;
}
.composer svg { width: 26px; height: 26px; flex: none; color: var(--accent); }
.composer:active { transform: scale(.985); }

/* отправка стикеров */
.send-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 8px; }
.send-btn { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 12.5px; font-weight: 800; line-height: 1.15; color: var(--ink); position: relative; }
.send-art { height: 92px; display: flex; align-items: flex-end; justify-content: center; }
.send-btn .sticker { max-height: 90px; max-width: 100%; transition: transform .2s cubic-bezier(.3, 1.8, .5, 1); }
.send-btn:active .sticker { transform: scale(.9) rotate(-3deg); }
.send-love { position: absolute; top: 2px; right: 8px; font-size: 22px; line-height: 1; }
.hint { color: var(--muted); font-size: 13.5px; margin-top: 8px; line-height: 1.35; }

.notice { background: var(--n-butter); border-radius: 14px; padding: 11px 14px; font-size: 14.5px; line-height: 1.35; margin-bottom: 14px; }

/* письмо-конверт */
.envelope { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; background: var(--card); border-radius: 18px; padding: 14px 16px; box-shadow: var(--shadow-lift); margin-bottom: 14px; animation: nudge 3.4s ease-in-out infinite; }
.env-icon { position: relative; width: 62px; height: 44px; flex: none; background: var(--n-butter); border-radius: 5px; box-shadow: inset 0 0 0 1.5px var(--line-strong); overflow: hidden; }
.env-icon::before { content: ''; position: absolute; left: 5px; top: -24px; width: 52px; height: 52px; background: var(--card); transform: rotate(45deg); box-shadow: 0 0 0 1.5px var(--line-strong); border-radius: 4px; }
.env-seal { position: absolute; left: 50%; top: 15px; margin-left: -10px; width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: 11px; display: grid; place-items: center; line-height: 1; }
.env-text b { display: block; font: 700 24px/1.1 var(--hand); color: var(--ink); }
.env-text span { color: var(--muted); font-size: 14px; }

/* следующая дата */
.ticket { display: flex; align-items: center; gap: 12px; background: var(--n-butter); border-radius: 16px; padding: 12px 14px; margin-bottom: 14px; position: relative; width: 100%; text-align: left; }
.ticket-emoji { font-size: 28px; line-height: 1; flex: none; }
.ticket-main { min-width: 0; flex: 1; }
.ticket-main b { display: block; font-weight: 800; overflow-wrap: anywhere; line-height: 1.25; }
.ticket-main span { font-size: 13.5px; color: var(--muted); }
[data-theme="dark"] .ticket-main span { color: var(--ink); opacity: .78; }
.ticket-left { font: 700 25px/1 var(--hand); text-align: right; flex: none; white-space: nowrap; padding-left: 10px; border-left: 2px dashed rgba(90, 60, 20, .28); }
.ticket.past { opacity: .6; }

/* лента */
.feed { background: var(--card); border-radius: 18px; box-shadow: var(--shadow); overflow: hidden; }
.feed-row { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 11px 14px; min-height: 54px; }
.feed-row + .feed-row { border-top: 1px solid var(--line); }
.feed-row:active { background: var(--line); }
.feed-icon { width: 26px; text-align: center; font-size: 19px; line-height: 1; flex: none; }
.feed-main { min-width: 0; flex: 1; font-size: 14.5px; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.feed-main b { font-weight: 800; }
.feed-time { font-size: 12px; color: var(--muted); flex: none; }

/* пусто */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 16px 16px 20px; color: var(--muted); gap: 6px; }
.empty .sticker { max-height: 130px; max-width: 150px; margin-bottom: 4px; }
.empty b { font: 700 25px/1.15 var(--hand); color: var(--ink); }
.empty.small { padding: 10px 12px 12px; font-size: 14.5px; }

/* вкладки */
#tabs {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: 560px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--card);
  box-shadow: 0 -1px 0 var(--line), 0 -6px 20px rgba(70, 45, 20, .07);
  padding: 6px 8px calc(6px + var(--safe-b));
  border-radius: 20px 20px 0 0;
}
.tab { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-height: 54px; font-size: 12.5px; font-weight: 700; color: var(--muted); border-radius: 14px; }
.tab svg { width: 25px; height: 25px; transition: transform .22s cubic-bezier(.3, 1.8, .5, 1); }
.tab.on { color: var(--accent); font-weight: 800; }
.tab.on svg { transform: translateY(-1px) scale(1.08); }
.tab-badge { position: absolute; top: 4px; left: 50%; margin-left: 9px; min-width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--card); }

/* заметки */
.chips { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px 12px; padding: 2px 16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; min-height: 40px; padding: 8px 15px; border-radius: 99px; background: var(--card); box-shadow: inset 0 0 0 1.5px var(--line); font-weight: 700; font-size: 14.5px; color: var(--muted); line-height: 1.2; }
.chip.on { background: var(--ink); color: var(--page); box-shadow: none; font-weight: 800; }
.search { display: block; width: 100%; min-height: 46px; padding: 10px 14px; border-radius: 13px; border: 1.5px solid var(--line); background: var(--card); margin-bottom: 12px; outline: none; }
.search:focus { border-color: var(--accent); }
.masonry { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
.masonry > div { min-width: 0; }
.note {
  display: block;
  width: 100%;
  text-align: left;
  margin-bottom: 12px;
  padding: 14px 13px 11px;
  border-radius: 4px 4px 16px 4px;
  background: var(--n-butter);
  box-shadow: var(--shadow);
  transform: rotate(var(--tilt, 0deg));
  transition: transform .18s;
  position: relative;
}
.note:active { transform: rotate(0) scale(.98); }
.note.c-blush { background: var(--n-blush); }
.note.c-sky { background: var(--n-sky); }
.note.c-sage { background: var(--n-sage); }
.note-tag { display: block; font: 800 12px var(--ui); margin-bottom: 4px; color: var(--muted); }
[data-theme="dark"] .note-tag, [data-theme="dark"] .note-foot { color: var(--ink); opacity: .78; }
.note-text { display: block; font: 400 15.5px/1.42 var(--serif); overflow-wrap: anywhere; white-space: pre-wrap; display: -webkit-box; -webkit-line-clamp: 9; -webkit-box-orient: vertical; overflow: hidden; }
.note-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 8px; font-size: 12px; font-weight: 700; color: var(--muted); }
.note-pin { position: absolute; top: -6px; right: 12px; width: 15px; height: 15px; border-radius: 50%; background: var(--accent); box-shadow: 0 2px 3px rgba(0, 0, 0, .3), inset -2px -2px 3px rgba(0, 0, 0, .2); }

/* большая кнопка действия */
.main-add { margin-bottom: 14px; }

/* сегменты */
.seg { display: flex; background: var(--line); border-radius: 13px; padding: 3px; margin-bottom: 12px; }
.seg button { flex: 1; min-height: 42px; border-radius: 10px; font-weight: 700; font-size: 14.5px; color: var(--muted); padding: 4px 6px; line-height: 1.15; }
.seg button.on { background: var(--card); color: var(--ink); font-weight: 800; box-shadow: 0 1px 3px rgba(60, 40, 20, .15); }

/* дневник */
.filter-row { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px 10px; padding: 2px 16px; scrollbar-width: none; align-items: center; }
.filter-row::-webkit-scrollbar { display: none; }
.filter-row .chip { min-height: 38px; font-size: 14px; padding: 7px 13px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 14px; font-weight: 700; margin-bottom: 8px; }
.legend i { display: inline-block; width: 16px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 6px; }
.legend span span { color: var(--muted); font-weight: 600; }
.chart-wrap { position: relative; touch-action: pan-y; }
.chart-wrap svg { display: block; width: 100%; outline: none; }
.chart-tip { position: absolute; top: 0; background: var(--ink); color: var(--page); border-radius: 10px; padding: 6px 10px; font-size: 13px; pointer-events: none; white-space: nowrap; line-height: 1.35; z-index: 3; }
.chart-tip div { display: flex; align-items: center; gap: 6px; }
.chart-tip i { width: 12px; height: 3px; border-radius: 2px; display: inline-block; }
.chart-tip b { font-weight: 800; }
.chart-tip .tip-day { opacity: .75; font-size: 12px; }
.text-toggle { display: inline-block; margin-top: 2px; padding: 8px 0; color: var(--muted); font-size: 13.5px; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-strong); min-height: 40px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.data-table th, .data-table td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--line); font-weight: 600; }
.data-table th { color: var(--muted); font-weight: 700; }
.day-head { display: flex; align-items: baseline; gap: 8px; margin: 18px 2px 8px; }
.day-head b { font: 700 25px/1 var(--hand); }
.day-head span { font-size: 13px; color: var(--muted); }
.entry { position: relative; background: var(--card); border-radius: 16px; padding: 13px 14px; margin-bottom: 10px; box-shadow: var(--shadow); width: 100%; }
.entry::before { content: ''; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 0 3px 3px 0; background: var(--who); }
.entry-head { display: flex; align-items: center; gap: 10px; }
.entry-head svg { width: 40px; height: 40px; flex: none; }
.entry-who { flex: 1; min-width: 0; }
.entry-who b { display: block; font-weight: 800; }
.entry-who span { font-size: 13px; color: var(--muted); }
.entry-edit { color: var(--accent); font-size: 13.5px; font-weight: 800; min-height: 36px; padding: 0 2px 0 10px; }
.entry-text { font: 400 15.5px/1.5 var(--serif); margin-top: 8px; overflow-wrap: anywhere; white-space: pre-wrap; }
.entry-best { margin-top: 8px; font: 600 22px/1.15 var(--hand); }
.photo-row { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; scrollbar-width: none; }
.photo-row::-webkit-scrollbar { display: none; }
.photo-row button { flex: none; border-radius: 10px; overflow: hidden; }
.photo-row img { height: 112px; width: auto; max-width: 180px; object-fit: cover; background: var(--line); }

/* реакции */
.rx { display: flex; gap: 2px; margin-top: 8px; }
.rx button { min-width: 42px; height: 38px; font-size: 18px; border-radius: 99px; display: flex; align-items: center; justify-content: center; gap: 2px; filter: grayscale(.55); opacity: .62; transition: transform .2s cubic-bezier(.3, 1.8, .5, 1); }
.rx button:active { transform: scale(1.25); }
.rx button.mine { background: var(--accent-soft); filter: none; opacity: 1; box-shadow: inset 0 0 0 1.5px var(--accent); }
.rx button.theirs { background: var(--line); filter: none; opacity: 1; }

/* вместе */
.polaroids { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 12px; }
.polaroid { display: block; width: 100%; text-align: left; background: #FFFDF8; color: #2E2620; padding: 8px 8px 10px; border-radius: 3px; box-shadow: var(--shadow-lift); transform: rotate(var(--tilt, 0deg)); transition: transform .2s; position: relative; }
.polaroid:active { transform: rotate(0) scale(.98); }
.polaroid-photo { position: relative; aspect-ratio: 1; width: 100%; background: #F0E6D4; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.polaroid-photo > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.polaroid-duo { display: flex; align-items: flex-end; justify-content: center; }
.polaroid-duo .sticker { height: 92px; width: auto; }
.polaroid-duo .sticker + .sticker { margin-left: -14px; }
.polaroid b { display: block; font: 700 22px/1.08 var(--hand); margin-top: 8px; overflow-wrap: anywhere; }
.polaroid small { display: block; font-size: 12.5px; color: #6A5B4E; font-weight: 600; margin-top: 2px; }
.polaroid .mini-hearts { margin-top: 4px; font-size: 13px; font-weight: 700; color: #6A5B4E; }
.polaroid .mini-hearts em { color: #B8324F; font-style: normal; letter-spacing: 1px; }
.list { background: var(--card); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
.list-head { font-size: 13.5px; font-weight: 800; color: var(--muted); margin: 12px 4px 6px; }
.row { display: flex; align-items: center; min-height: 52px; }
.row + .row { border-top: 1px solid var(--line); }
.check { width: 50px; height: 50px; flex: none; display: grid; place-items: center; }
.check i { width: 25px; height: 25px; border-radius: 50%; border: 2px solid var(--line-strong); display: grid; place-items: center; transition: background .15s, border-color .15s, transform .2s cubic-bezier(.3, 1.8, .5, 1); }
.check i svg { width: 16px; height: 16px; stroke: var(--accent-ink); stroke-width: 3; fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 24; stroke-dashoffset: 24; transition: stroke-dashoffset .25s; }
.check.on i { background: var(--accent); border-color: var(--accent); transform: scale(1.06); }
.check.on i svg { stroke-dashoffset: 0; }
.row-main { flex: 1; min-width: 0; text-align: left; padding: 10px 14px 10px 0; line-height: 1.3; overflow-wrap: anywhere; min-height: 50px; }
.row-main small { display: block; color: var(--muted); font-size: 13px; }
.row.done .row-title { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line-strong); }
.row-who { font-size: 12.5px; font-weight: 700; color: var(--muted); padding-right: 14px; flex: none; }
.inline-add { display: flex; align-items: center; border-top: 1px solid var(--line); padding-left: 14px; min-height: 52px; }
.list .inline-add:first-child { border-top: 0; }
.inline-add input { flex: 1; min-width: 0; border: 0; background: none; outline: none; padding: 12px 8px 12px 0; font-size: 16px; }
.inline-add input::placeholder { color: var(--muted); }
.inline-add button { width: 50px; height: 50px; font-size: 26px; font-weight: 400; color: var(--accent); flex: none; line-height: 1; }
.secret-note { font-size: 13px; color: var(--muted); margin: 6px 4px 0; }

/* нижние панели */
.sheet-wrap { position: fixed; left: 0; right: 0; top: 0; height: var(--tg-viewport-height, 100vh); z-index: 50; }
.sheet-back { position: absolute; inset: 0; background: rgba(40, 25, 10, .42); opacity: 0; transition: opacity .25s; }
.sheet {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 100%;
  max-width: 560px;
  max-height: 92%;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  background: var(--card);
  border-radius: 22px 22px 0 0;
  padding: 0 18px calc(18px + var(--safe-b));
  transform: translate(-50%, 100%);
  transition: transform .34s cubic-bezier(.2, .9, .25, 1);
}
.sheet-wrap.open .sheet-back { opacity: 1; }
.sheet-wrap.open .sheet { transform: translate(-50%, 0); }
.grab { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; justify-content: center; height: 26px; margin: 0 -18px 2px; background: var(--card); touch-action: none; cursor: grab; }
.grab::before { content: ''; width: 42px; height: 5px; border-radius: 3px; background: var(--line-strong); }
.sheet-title { font: 700 32px/1.1 var(--hand); margin-bottom: 12px; }
.field-label { display: block; font-size: 14px; font-weight: 800; margin: 12px 0 5px; color: var(--muted); }
.field { display: block; width: 100%; min-height: 48px; border-radius: 13px; border: 1.5px solid var(--line); background: var(--page); padding: 11px 13px; outline: none; font-size: 16px; }
.field:focus { border-color: var(--accent); }
input.field[type="date"] { -webkit-appearance: none; appearance: none; min-height: 48px; }
.lined {
  display: block;
  width: 100%;
  min-height: 150px;
  resize: none;
  border: 0;
  outline: none;
  border-radius: 13px;
  padding: 8px 14px;
  font: 400 17px/30px var(--serif);
  background-color: var(--page);
  background-image: repeating-linear-gradient(transparent, transparent 29px, var(--line) 29px, var(--line) 30px);
  background-attachment: local;
  background-position: 0 8px;
}
.lined.short { min-height: 92px; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 54px; width: 100%; text-align: left; border-top: 1px solid var(--line); font-weight: 700; }
.toggle-row small { display: block; color: var(--muted); font-weight: 600; font-size: 13px; }
.switch { position: relative; flex: none; width: 50px; height: 30px; border-radius: 99px; background: var(--line-strong); transition: background .18s; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .2s cubic-bezier(.3, 1.5, .5, 1); }
.on > .switch { background: var(--accent); }
.on > .switch::after { transform: translateX(20px); }

/* статусы */
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.mode-btn { display: flex; align-items: center; gap: 9px; min-height: 56px; padding: 8px 12px; border-radius: 14px; background: var(--page); text-align: left; font-weight: 700; font-size: 15px; line-height: 1.2; transition: transform .14s; }
.mode-btn:active { transform: scale(.96); }
.mode-btn span { font-size: 22px; line-height: 1; flex: none; }
.mode-btn.on { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); font-weight: 800; }
.mode-group { font-size: 14px; font-weight: 800; color: var(--muted); margin: 14px 2px 8px; }
.mode-group:first-of-type { margin-top: 2px; }
.mode-done { display: flex; flex-direction: column; align-items: center; text-align: center; }
.mode-done .sticker { max-height: 150px; max-width: 200px; animation: pop .45s cubic-bezier(.3, 1.6, .5, 1); }
.mode-done h3 { font: 700 30px/1.1 var(--hand); margin-top: 8px; }
.mode-done p { color: var(--muted); font-size: 14.5px; margin-top: 2px; max-width: 320px; }
.durations { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 14px 0 6px; }
.durations .chip { background: var(--page); }

/* фото в формах */
.ph-list { display: flex; flex-wrap: wrap; gap: 8px; }
.ph { position: relative; width: 78px; height: 78px; border-radius: 11px; overflow: hidden; background: var(--line); }
.ph img { width: 100%; height: 100%; object-fit: cover; }
.ph button { position: absolute; top: 3px; right: 3px; width: 26px; height: 26px; border-radius: 50%; background: rgba(0, 0, 0, .55); color: #fff; font-size: 16px; line-height: 1; }
.ph.loading::after { content: ''; position: absolute; inset: 26px; border-radius: 50%; border: 3px solid var(--line-strong); border-top-color: var(--accent); animation: spin .8s linear infinite; }
.ph-add { display: grid; place-items: center; width: 78px; height: 78px; border-radius: 11px; border: 2px dashed var(--line-strong); color: var(--muted); font-size: 13px; font-weight: 800; text-align: center; line-height: 1.2; cursor: pointer; position: relative; }

/* просмотр */
.read-text { font: 400 17px/1.55 var(--serif); white-space: pre-wrap; overflow-wrap: anywhere; }
.paper-letter { position: relative; background: var(--n-butter); padding: 18px 16px; border-radius: 4px 4px 18px 4px; box-shadow: var(--shadow); margin-bottom: 8px; animation: unfold .5s cubic-bezier(.2, .9, .25, 1); transform-origin: top; }
.letter-from { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.letter-from .sticker { height: 76px; width: auto; }
.letter-from b { font: 700 26px/1.1 var(--hand); display: block; }
.letter-from span { color: var(--muted); font-size: 13px; }
.meta { color: var(--muted); font-size: 13.5px; margin-bottom: 10px; }
.gallery { display: flex; gap: 8px; overflow-x: auto; margin: 0 -18px 12px; padding: 0 18px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.gallery::-webkit-scrollbar { display: none; }
.gallery button { flex: none; scroll-snap-align: center; border-radius: 12px; overflow: hidden; }
.gallery img { height: 230px; width: auto; max-width: 86vw; object-fit: cover; background: var(--line); }
.score { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.score .sticker { height: 54px; width: 44px; object-fit: contain; flex: none; }
.score-main { flex: 1; min-width: 0; }
.score-main b { font-weight: 800; display: block; line-height: 1.2; }
.score-main small { color: var(--muted); font-size: 13.5px; display: block; line-height: 1.3; }
.hearts { display: flex; gap: 2px; margin-top: 2px; }
.hearts button, .hearts span { width: 36px; height: 36px; display: grid; place-items: center; }
.hearts.static span { width: 24px; height: 26px; }
.hearts svg { width: 26px; height: 26px; fill: none; stroke: var(--line-strong); stroke-width: 2; transition: transform .22s cubic-bezier(.3, 2, .5, 1); }
.hearts.static svg { width: 20px; height: 20px; }
.hearts .on svg { fill: var(--accent); stroke: var(--accent); }
.hearts button:active svg { transform: scale(1.3); }

/* фото на весь экран */
.lightbox { position: fixed; inset: 0; z-index: 80; background: rgba(15, 10, 6, .94); display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; animation: fade .2s; }
.lightbox::-webkit-scrollbar { display: none; }
.lightbox div { flex: none; width: 100%; height: 100%; display: grid; place-items: center; scroll-snap-align: center; padding: 12px; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 6px; object-fit: contain; }
.lightbox-close { position: fixed; z-index: 81; top: 16px; right: 16px; width: 44px; height: 44px; border-radius: 50%; background: rgba(255, 255, 255, .16); color: #fff; font-size: 24px; line-height: 1; }

/* пришёл стикер */
.sticker-pop { position: fixed; inset: 0; z-index: 70; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; background: rgba(30, 18, 8, .76); animation: fade .2s; padding: 20px; }
.sticker-pop .sticker { width: min(66vw, 260px); max-height: 54vh; object-fit: contain; animation: stickerIn .6s cubic-bezier(.25, 1.6, .45, 1); }
.sticker-pop p { font: 700 34px/1.1 var(--hand); color: #fff; text-align: center; text-shadow: 0 2px 8px rgba(0, 0, 0, .4); }
.sticker-pop small { color: rgba(255, 255, 255, .85); font-size: 14px; }

/* всплывашка */
#toast { position: fixed; z-index: 90; left: 50%; bottom: calc(var(--nav-h) + var(--safe-b) + 14px); transform: translate(-50%, 20px); background: var(--ink); color: var(--page); padding: 11px 17px; border-radius: 14px; font-weight: 700; font-size: 14.5px; opacity: 0; transition: opacity .2s, transform .25s; pointer-events: none; max-width: calc(100% - 32px); width: max-content; text-align: center; line-height: 1.3; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* эффекты */
#fx { position: fixed; inset: 0; z-index: 95; pointer-events: none; overflow: hidden; }
.spark { position: absolute; font-size: 24px; line-height: 1; animation: spark var(--dur, 1s) cubic-bezier(.15, .7, .3, 1) forwards; will-change: transform, opacity; }

.enter > * { animation: rise .42s cubic-bezier(.2, .8, .25, 1) both; }
.enter > *:nth-child(2) { animation-delay: .05s; }
.enter > *:nth-child(3) { animation-delay: .1s; }
.enter > *:nth-child(4) { animation-delay: .15s; }
.enter > *:nth-child(5) { animation-delay: .2s; }
.enter > *:nth-child(n+6) { animation-delay: .24s; }
.wiggle { animation: wiggle .5s ease; }

@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-.8deg); } 50% { transform: translateY(-3px) rotate(.8deg); } }
@keyframes beat { 0%, 100% { transform: scale(1); } 12% { transform: scale(1.18); } 24% { transform: scale(1); } 36% { transform: scale(1.12); } 48% { transform: scale(1); } }
.splash-heart { animation-name: beatRot; }
@keyframes beatRot { 0%, 100% { transform: rotate(45deg) scale(1); } 15% { transform: rotate(45deg) scale(1.15); } 30% { transform: rotate(45deg) scale(1); } }
@keyframes nudge { 0%, 88%, 100% { transform: rotate(0); } 91% { transform: rotate(-1.4deg); } 94% { transform: rotate(1.4deg); } 97% { transform: rotate(-.7deg); } }
@keyframes pop { from { transform: scale(.5); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes stickerIn { 0% { transform: scale(.2) rotate(-14deg); opacity: 0; } 60% { opacity: 1; } 100% { transform: none; } }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(-7deg) scale(1.08); } 45% { transform: rotate(6deg) scale(1.08); } 70% { transform: rotate(-3deg); } }
@keyframes spark { 0% { transform: translate(0, 0) scale(.4) rotate(0); opacity: 1; } 75% { opacity: 1; } 100% { transform: translate(var(--dx), var(--dy)) scale(var(--s, 1)) rotate(var(--r, 30deg)); opacity: 0; } }
@keyframes unfold { from { transform: scaleY(.3); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 350px) {
  .pcard-art { height: 122px; }
  .pcard-art .sticker { max-height: 120px; }
  .heart-btn { top: 62px; }
  .face-btn svg { width: 40px; height: 40px; }
  .dot-btn { width: 32px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
