@font-face {
  font-family: "Onest";
  src: url("/fonts/onest-cyrillic.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Onest";
  src: url("/fonts/onest-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #FBF7F5;
  --card: #FFFFFF;
  --card-2: #F6F0EF;
  --ink: #1E1A22;
  --muted: #655E6A;
  --line: #ECE3E4;
  --accent: #E0456C;
  --accent-ink: #FFFFFF;
  --accent-soft: #FCE7ED;
  --violet: #7A55E8;
  --violet-soft: #EEE8FD;
  --ok: #23845A;
  --ok-soft: #E2F4EA;
  --warn: #B4610F;
  --shadow: 0 1px 2px rgba(40, 20, 30, .04), 0 6px 20px -8px rgba(80, 30, 60, .12);
  --radius: 20px;
  --glow-a: rgba(255, 122, 154, .30);
  --glow-b: rgba(255, 170, 110, .22);
  --glow-c: rgba(127, 90, 240, .20);
  --grain-opacity: .045;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141116;
    --card: #1F1A22;
    --card-2: #282229;
    --ink: #F4EEF2;
    --muted: #ABA2AE;
    --line: #2F2833;
    --accent: #FF6A8E;
    --accent-ink: #1A0A10;
    --accent-soft: #3A1D28;
    --violet: #A68BFF;
    --violet-soft: #2A2240;
    --ok: #5BD69A;
    --ok-soft: #173326;
    --warn: #F2A35A;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -10px rgba(0, 0, 0, .6);
    --glow-a: rgba(255, 90, 140, .20);
    --glow-b: rgba(255, 150, 90, .10);
    --glow-c: rgba(127, 90, 240, .22);
    --grain-opacity: .06;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 "Onest", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

/* Свечение и зерно: один неподвижный слой, без размытия и анимаций */
.glow {
  position: fixed; inset: 0 0 auto 0; height: 340px; z-index: 0; pointer-events: none;
  background:
    radial-gradient(60% 70% at 15% 0%, var(--glow-a), transparent 70%),
    radial-gradient(50% 60% at 60% -10%, var(--glow-b), transparent 70%),
    radial-gradient(55% 70% at 100% 5%, var(--glow-c), transparent 70%);
}
.glow::after {
  content: ""; position: absolute; inset: 0; opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

.view {
  position: relative; z-index: 1;
  max-width: 560px; margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 18px) 16px calc(env(safe-area-inset-bottom) + 96px);
  outline: none;
}
.view.no-tabs { padding-bottom: calc(env(safe-area-inset-bottom) + 32px); }

h1, h2, h3 { margin: 0; letter-spacing: -.02em; }
h1 { font-size: 28px; font-weight: 700; line-height: 1.15; }
h2 { font-size: 19px; font-weight: 650; }
h3 { font-size: 16px; font-weight: 600; }
p { margin: 0; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.tiny { font-size: 12.5px; }

.head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.head .sub { margin-top: 4px; color: var(--muted); font-size: 15px; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow);
}
.card + .card, .stack > * + * { margin-top: 12px; }
.section { margin-top: 26px; }
.section > h2 { margin-bottom: 10px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.center { text-align: center; }

/* Кнопки */
button { font: inherit; color: inherit; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 18px; border-radius: 14px; border: 1px solid transparent;
  background: var(--accent); color: var(--accent-ink); font-weight: 600; cursor: pointer;
  text-decoration: none; transition: transform .12s ease, opacity .12s ease;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.block { width: 100%; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.soft { background: var(--accent-soft); color: var(--accent); }
.btn.violet { background: var(--violet-soft); color: var(--violet); }
.btn.small { min-height: 36px; padding: 0 12px; border-radius: 11px; font-size: 14px; }
.btn.danger { background: transparent; color: var(--accent); border-color: var(--line); }
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; flex: none;
  border-radius: 14px; border: 1px solid var(--line); background: var(--card); cursor: pointer;
  color: var(--ink);
}
.icon-btn svg { width: 22px; height: 22px; }
.link-btn { background: none; border: 0; padding: 6px 0; color: var(--accent); font-weight: 600; cursor: pointer; }

:focus-visible { outline: 2.5px solid var(--violet); outline-offset: 2px; }

/* Метки и чипсы */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 2px 16px 4px; scrollbar-width: none; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  min-height: 38px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  font-size: 14.5px; cursor: pointer; white-space: nowrap;
}
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.tag {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px;
  background: var(--card-2); color: var(--muted); font-size: 12.5px; font-weight: 500;
}
.tag.accent { background: var(--accent-soft); color: var(--accent); }
.tag.violet { background: var(--violet-soft); color: var(--violet); }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.badge {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 12px; font-weight: 700;
}

/* Переключатель разделов */
.seg {
  display: flex; gap: 4px; padding: 4px; border-radius: 14px; background: var(--card-2);
  border: 1px solid var(--line); overflow-x: auto; scrollbar-width: none;
}
.seg::-webkit-scrollbar { display: none; }
.seg button {
  flex: 1 1 auto; min-height: 38px; padding: 0 8px; border: 0; border-radius: 10px; background: none;
  color: var(--muted); font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.seg button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }

/* Поля */
label.field { display: block; margin-top: 14px; }
label.field > span { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 600; color: var(--muted); }
input[type=text], input[type=password], input[type=url], input[type=number], input[type=date], textarea, select {
  width: 100%; min-height: 48px; padding: 12px 14px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  font: inherit; font-size: 16px; /* меньше 16 — iOS приближает поле */
}
textarea { min-height: 140px; resize: vertical; line-height: 1.5; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--violet); box-shadow: 0 0 0 3px var(--violet-soft); }

/* Нижнее меню */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex; justify-content: center;
  background: var(--card); border-top: 1px solid var(--line);
  padding: 6px 6px calc(env(safe-area-inset-bottom) + 6px);
}
.tabs a {
  position: relative; flex: 1; max-width: 112px; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 2px; border-radius: 12px; color: var(--muted); text-decoration: none; font-size: 11.5px; font-weight: 600;
}
.tabs a svg { width: 24px; height: 24px; }
.tabs a[aria-current="page"] { color: var(--accent); }
.tabs .dot {
  position: absolute; top: 3px; left: calc(50% + 8px); width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--card);
}

/* Нижний лист для форм */
.sheet { position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet[hidden] { display: none; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(20, 10, 20, .42); }
.sheet-body {
  position: relative; width: 100%; max-width: 560px; max-height: 92dvh; overflow-y: auto;
  background: var(--bg); border-radius: 24px 24px 0 0;
  padding: 10px 16px calc(env(safe-area-inset-bottom) + 20px);
  animation: rise .22s ease-out;
}
.sheet-body::before { content: ""; display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 14px; }
.sheet-actions { display: flex; gap: 10px; margin-top: 20px; }
.sheet-actions .btn { flex: 1; }
@keyframes rise { from { transform: translateY(40px); } to { transform: none; } }

.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 86px); z-index: 30;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  max-width: calc(100% - 32px); padding: 12px 16px; border-radius: 14px;
  background: var(--ink); color: var(--bg); font-size: 15px; font-weight: 500;
  transition: opacity .2s ease, transform .2s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Вход */
.login { min-height: calc(100dvh - 60px); display: flex; flex-direction: column; justify-content: center; }
.login .logo { width: 76px; height: 76px; border-radius: 20px; box-shadow: var(--shadow); }
.login h1 { margin-top: 18px; font-size: 34px; }
.who { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 24px; }
.who button {
  min-height: 64px; border-radius: 18px; border: 1px solid var(--line); background: var(--card);
  font-size: 18px; font-weight: 650; cursor: pointer; box-shadow: var(--shadow);
}
.who button[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.error { margin-top: 12px; color: var(--accent); font-weight: 600; font-size: 14.5px; }

/* Сегодня */
.partner-card { position: relative; overflow: hidden; }
.mood-big { font-size: 44px; line-height: 1; }
.mood-scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.mood-scale button {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 0 8px; border-radius: 16px; border: 1px solid var(--line); background: var(--card);
  cursor: pointer; font-size: 11.5px; color: var(--muted); font-weight: 600;
}
.mood-scale button .e { font-size: 28px; line-height: 1; }
.mood-scale button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.energy { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.energy button {
  min-height: 42px; border-radius: 13px; border: 1px solid var(--line); background: var(--card);
  cursor: pointer; font-size: 14px; font-weight: 600; color: var(--muted);
}
.energy button[aria-pressed="true"] { border-color: var(--violet); background: var(--violet-soft); color: var(--violet); }
.nudges { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.nudges button {
  min-height: 64px; padding: 8px 6px; border-radius: 16px; border: 1px solid var(--line); background: var(--card);
  cursor: pointer; font-size: 13px; font-weight: 600; line-height: 1.2;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
}
.nudges button .e { font-size: 22px; }
.strip { display: grid; grid-template-columns: repeat(14, 1fr); gap: 4px; margin-top: 8px; }
.strip i { height: 22px; border-radius: 6px; background: var(--card-2); }
.strip i[data-m="1"] { background: #8A93A6; }
.strip i[data-m="2"] { background: #B9A1C9; }
.strip i[data-m="3"] { background: #F2C6A0; }
.strip i[data-m="4"] { background: #FF9DB5; }
.strip i[data-m="5"] { background: #E0456C; }
.strip-label { display: flex; justify-content: space-between; margin-top: 4px; font-size: 12px; color: var(--muted); }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat {
  display: block; padding: 14px; border-radius: 18px; background: var(--card); border: 1px solid var(--line);
  text-decoration: none; color: var(--ink); box-shadow: var(--shadow);
}
.stat b { display: block; font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.stat span { font-size: 13.5px; color: var(--muted); }
.stat.hot b { color: var(--accent); }
.feed-item { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.feed-item:first-child { border-top: 0; }

.note { margin-top: 12px; background: linear-gradient(135deg, var(--accent-soft), var(--violet-soft)); border: 0; }
.note-text { margin-top: 8px; font-size: 20px; font-weight: 650; line-height: 1.35; white-space: pre-wrap; overflow-wrap: anywhere; }
.chip.hot { border-color: var(--accent); color: var(--accent); }
a.chip { text-decoration: none; }
.onboarding { margin-top: 14px; }
.progress { height: 6px; margin-top: 10px; border-radius: 3px; background: var(--card-2); overflow: hidden; }
.progress i { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, #FF7A9A, #7F5AF0); }
.step { color: inherit; text-decoration: none; }
.step .check {
  flex: none; display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  border: 1.5px solid var(--line); font-size: 13px; font-weight: 700;
}
.step.ok .check { background: var(--ok); border-color: var(--ok); color: #fff; }
.step.ok .grow { color: var(--muted); text-decoration: line-through; }
.celebrate {
  position: fixed; inset: 0; z-index: 40; display: grid; place-items: center;
  background: rgba(20, 10, 20, .35);
}
.celebrate-card {
  position: relative; width: min(300px, calc(100% - 48px)); padding: 26px 20px; border-radius: 26px;
  background: var(--card); text-align: center; box-shadow: var(--shadow); animation: pop .35s cubic-bezier(.2, 1.4, .4, 1);
}
.celebrate-card b { display: block; margin-top: 6px; font-size: 24px; letter-spacing: -.02em; }
.celebrate-card p { margin-top: 6px; color: var(--muted); }
.celebrate-big { font-size: 56px; line-height: 1; }
.celebrate-card i {
  position: absolute; left: 50%; top: 40%; font-style: normal; font-size: 22px; pointer-events: none;
  animation: burst 1.3s ease-out forwards;
}
@keyframes pop { from { transform: scale(.85); } to { transform: none; } }
@keyframes burst {
  from { transform: translate(-50%, -50%) scale(.4); opacity: 1; }
  to { transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y))) scale(1); opacity: 0; }
}

/* Поговорить */
.feeling { border-left: 4px solid var(--line); }
.feeling.k-thanks, .feeling.k-love, .feeling.k-joy { border-left-color: #FF9DB5; }
.feeling.k-hurt, .feeling.k-worry { border-left-color: #B9A1C9; }
.feeling.k-need { border-left-color: #F2C6A0; }
.feeling.unread { box-shadow: 0 0 0 2px var(--accent-soft), var(--shadow); }
.feeling .body { margin-top: 8px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 16px; }
.reply { margin-top: 10px; padding: 10px 12px; border-radius: 14px; background: var(--card-2); font-size: 15px; white-space: pre-wrap; overflow-wrap: anywhere; }
.kind-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kind-grid button {
  text-align: left; padding: 12px; border-radius: 16px; border: 1px solid var(--line); background: var(--card);
  cursor: pointer; font-size: 14.5px; font-weight: 600; min-height: 56px;
}
.kind-grid button .e { display: block; font-size: 20px; margin-bottom: 2px; }
.kind-grid button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.hint { margin-top: 10px; padding: 12px 14px; border-radius: 14px; background: var(--violet-soft); color: var(--ink); font-size: 14px; }

/* Смотреть */
.vote-card { text-align: center; padding: 28px 18px 18px; }
.vote-card .kind { font-size: 13px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.vote-card h2 { font-size: 26px; margin-top: 8px; overflow-wrap: anywhere; }
.vote-actions { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 22px; }
.vote-actions .btn { padding: 0 8px; }
.item { display: flex; gap: 12px; align-items: flex-start; }
.item + .item { margin-top: 10px; }
.item .title { font-weight: 650; overflow-wrap: anywhere; }
.stars { display: inline-flex; gap: 2px; }
.stars button { background: none; border: 0; padding: 4px; cursor: pointer; font-size: 22px; line-height: 1; color: var(--line); }
.stars button.on { color: #F5A524; }
.stars.ro { font-size: 14px; color: #F5A524; letter-spacing: 1px; }

.rating {
  flex: none; display: inline-grid; place-items: center; min-width: 42px; height: 30px; padding: 0 6px;
  border-radius: 10px; background: var(--ok-soft); color: var(--ok); font-weight: 700; font-size: 14px;
}
.rating.mid { background: var(--violet-soft); color: var(--violet); }
.rating.low { background: var(--card-2); color: var(--muted); }
.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 12px; }
.photos button { padding: 0; border: 0; background: none; cursor: pointer; }
.photos img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; background: var(--card-2); }
label.btn { cursor: pointer; }
input[type=date], input[type=time] { min-width: 0; -webkit-appearance: none; appearance: none; }

/* Идеи */
.pick { text-align: left; background: linear-gradient(135deg, var(--accent-soft), var(--violet-soft)); border: 0; }
.pick .big { font-size: 22px; font-weight: 700; margin-top: 6px; letter-spacing: -.01em; }
.like-row { display: flex; gap: 6px; margin-top: 12px; }
.like-row button {
  flex: 1; min-height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--card);
  cursor: pointer; font-size: 14px; font-weight: 600; color: var(--muted);
}
.like-row button[aria-pressed="true"].yes { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.like-row button[aria-pressed="true"].no { background: var(--card-2); color: var(--ink); }
.filters summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
  min-height: 40px; font-weight: 600; color: var(--muted);
}
.filters summary::-webkit-details-marker { display: none; }
.filter-group { margin-top: 12px; }
.filter-group > span { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }

.empty { text-align: center; padding: 34px 18px; color: var(--muted); }
.empty .e { font-size: 36px; display: block; margin-bottom: 8px; }

.divider { height: 1px; background: var(--line); margin: 14px 0; }
.list-plain { margin: 8px 0 0; padding-left: 20px; }
.list-plain li + li { margin-top: 6px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (min-width: 600px) {
  .view { padding-top: 32px; }
}
