/* Лура — мини-приложение, дизайн v3 «Свет за жидким стеклом».
 * Три материала: пустота (#000), жидкое стекло, свет. Единственный цвет — свет её настроения (--mood),
 * он живёт за лицом; стекло его преломляет, кромки стекла светлее со стороны лица (--la — угол на лицо).
 */

@font-face {
  font-family: "Onest";
  src: url("../fonts/onest.woff") format("woff");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --void: #000;
  --void-rgb: 0 0 0; /* время суток чуть меняет оттенок пустоты (ставит app.js) */
  --ink: #f5f7fc;
  --ink-2: rgba(235, 240, 255, 0.66);
  --ink-3: rgba(235, 240, 255, 0.42);
  --mist: var(--ink-2);
  --ash: var(--ink-3);
  --hair: rgba(255, 255, 255, 0.08);
  --hair-2: rgba(255, 255, 255, 0.14);
  --danger: #ff6b6b;
  /* свет настроения: ставит mood.js (r g b), сила — от эмоции и её силы */
  --mood: 61 123 255;
  --mood-k: 0.6;
  --glow: rgb(61 123 255);
  --blush: rgb(255 150 190);
  --top: max(env(safe-area-inset-top), calc(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px)));
  --bottom: max(env(safe-area-inset-bottom), var(--tg-safe-area-inset-bottom, 0px));
  --vh: var(--tg-viewport-height, 100vh);
  --ease: cubic-bezier(0.22, 0.9, 0.24, 1);
  --snap: cubic-bezier(0.2, 0.9, 0.1, 1);
  --spring: cubic-bezier(0.34, 1.42, 0.5, 1);
  color-scheme: dark;
  font-family: "Onest", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial,
    sans-serif;
  font-optical-sizing: auto;
  -webkit-text-size-adjust: 100%;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { background: rgb(var(--void-rgb)); }
/* у body фона нет: иначе он закрыл бы свет настроения (.backdrop лежит под содержимым, z-index: -1) */
html, body { margin: 0; color: var(--ink); }
body { min-height: 100vh; background: transparent; overscroll-behavior-y: none; -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale; user-select: none; -webkit-user-select: none; }

button { font: inherit; color: inherit; cursor: pointer; }
input, textarea { user-select: text; -webkit-user-select: text; }
:focus { outline: none; }
:focus-visible { outline: 2px solid rgba(255, 255, 255, 0.85); outline-offset: 3px; }
[hidden] { display: none !important; }
.glass-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ---------- фон: свет её настроения и зерно ---------- */

.backdrop { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; background: rgb(var(--void-rgb)); }
.light { position: absolute; border-radius: 50%; will-change: transform; }
/* главный свет — большое мягкое пятно за лицом; характер эмоции (дыхание, мерцание, «сердцебиение»)
   двигает его через --lk (яркость), --ls (размер), --ly (высота) — их ставит mood.js на .backdrop */
.light.a { width: 150vw; height: 92vh; left: -25vw; top: -34vh; opacity: calc(0.8 * var(--lk, 1));
  translate: var(--lx, 0px) var(--ly, 0px); scale: var(--ls, 1);
  background: radial-gradient(closest-side, rgb(var(--mood) / calc(0.95 * var(--mood-k))),
    rgb(var(--mood) / calc(0.36 * var(--mood-k))) 46%, rgb(var(--mood) / 0) 100%);
  animation: drift-a 26s ease-in-out infinite alternate; }
.light.b { width: 90vw; height: 70vh; right: -42vw; top: 12vh;
  background: radial-gradient(closest-side, rgb(var(--mood) / calc(0.28 * var(--mood-k))), rgb(var(--mood) / 0));
  animation: drift-b 34s ease-in-out infinite alternate; }
.light.c { width: 120vw; height: 60vh; left: -30vw; bottom: -38vh;
  background: radial-gradient(closest-side, rgb(var(--mood) / calc(0.16 * var(--mood-k))), rgb(var(--mood) / 0));
  animation: drift-c 41s ease-in-out infinite alternate; }
@keyframes drift-a { to { transform: translate(6vw, 4vh) scale(1.08); } }
@keyframes drift-b { to { transform: translate(-14vw, -6vh) scale(0.92); } }
@keyframes drift-c { to { transform: translate(10vw, -8vh) scale(1.12); } }
body:not([data-screen="home"]) .light, body.lifted .light { animation-play-state: paused; }
.grain { position: absolute; inset: 0; opacity: 0.075; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 1.1 -0.25'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"); }

/* ---------- жидкое стекло (живое: размытие того, что за ним) ----------
   слои: блик от наклона (::after) · кромка-градиент (светлая на лицо) · внутренний свет · дымка с настроением ·
   backdrop-filter (на Chromium — ещё и преломление краёв, его включает glass.js) */

.lg {
  --lg-blur: 22px;
  --lg-sat: 180%;
  --lg-fill: rgba(14, 15, 22, 0.55);
  --lg-rim: 0.55;
  position: relative;
  isolation: isolate;
  border: 0;
  background:
    radial-gradient(120% 100% at 22% 0%, rgb(var(--mood) / calc(0.18 * var(--mood-k))), rgb(var(--mood) / 0) 60%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.03)),
    var(--lg-fill);
  -webkit-backdrop-filter: blur(var(--lg-blur)) saturate(var(--lg-sat));
  backdrop-filter: blur(var(--lg-blur)) saturate(var(--lg-sat));
  box-shadow:
    inset 0 1px 0.5px rgba(255, 255, 255, 0.3),
    inset 0 -1px 0.5px rgba(255, 255, 255, 0.06),
    0 10px 30px -12px rgba(0, 0, 0, 0.85),
    0 26px 60px -30px rgb(var(--mood) / calc(0.42 * var(--mood-k)));
}
/* кромка 1 px: кольцо-градиент, светлое в сторону лица (маска оставляет только край — середина не просвечивает) */
.lg::before, .pg::before, .glass::before { content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px;
  pointer-events: none; --rim: 0.32;
  background: conic-gradient(from var(--la, 0deg), rgba(255, 255, 255, var(--rim)), rgba(255, 255, 255, 0.06) 22%,
    rgba(255, 255, 255, 0.025) 50%, rgba(255, 255, 255, 0.12) 72%, rgba(255, 255, 255, var(--rim)));
  -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, linear-gradient(#000 0 0);
  mask-composite: exclude; }
.lg::before { --rim: var(--lg-rim); }
/* Статичное отражение: никаких бегущих белых «зайчиков» за курсором. */
.lg::after { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none;
  background: linear-gradient(118deg, rgba(255, 255, 255, 0.055), transparent 32%, rgba(255, 255, 255, 0.018) 60%,
    transparent 78%); }

/* ---------- единое настоящее стекло для карточек и пузырей ---------- */

.pg, .glass {
  --lg-blur: 18px;
  --lg-sat: 165%;
  position: relative;
  isolation: isolate;
  border: 0;
  background:
    radial-gradient(130% 120% at 4% 0%, rgb(var(--mood) / calc(0.14 * var(--mood-k))), transparent 68%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.105), rgba(255, 255, 255, 0.025) 48%, rgba(255, 255, 255, 0.045)),
    rgba(13, 16, 27, 0.34);
  -webkit-backdrop-filter: blur(var(--lg-blur)) saturate(var(--lg-sat));
  backdrop-filter: blur(var(--lg-blur)) saturate(var(--lg-sat));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.13), inset 0 -1px 0 rgba(255, 255, 255, 0.025),
    0 12px 32px -18px rgba(0, 0, 0, 0.78);
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .pg, .glass { background: rgba(23, 26, 39, 0.88); }
}

@media (prefers-reduced-transparency: reduce) {
  .lg, .pg, .glass { --lg-blur: 5px; background-color: rgba(15, 17, 25, 0.84); }
}

/* ---------- экраны ---------- */

#app { position: relative; }
.screen { min-height: 100vh; padding: calc(var(--top) + 8px) 0 calc(118px + var(--bottom)); }
.screen.enter { animation: screen-in 0.32s var(--snap) backwards; }
@keyframes screen-in { from { opacity: 0; transform: translateY(10px); } }

.title { margin: 14px 112px 22px 20px; font-size: 34px; line-height: 1.06; font-weight: 680; letter-spacing: -0.035em;
  text-wrap: balance; transition: opacity 0.2s; }
.title.center { margin: 8px 24px 10px; text-align: center; }
body.scrolled .screen:not(.home) .title { opacity: 0; }

/* компактная шапка экранов настроек: большой заголовок уехал — его имя в стеклянной капсуле сверху */
.topbar { position: fixed; z-index: 25; top: calc(var(--top) + 6px); left: 12px; right: 12px; display: flex; align-items: center;
  height: 52px; padding: 0 108px 0 18px; border-radius: 26px; --lg-blur: 26px; pointer-events: none;
  opacity: 0; transform: translateY(-14px) scale(0.97); transition: opacity 0.22s, transform 0.4s var(--spring); }
.topbar-title { overflow: hidden; font-size: 17px; font-weight: 620; letter-spacing: -0.015em; white-space: nowrap;
  text-overflow: ellipsis; }
body.scrolled:not([data-screen="home"]) .topbar { opacity: 1; transform: none; }

/* ---------- текст, который меняется: быстрый перекат букв ---------- */

.roll { display: inline-grid; vertical-align: bottom; overflow: hidden; }
.roll-line { grid-area: 1 / 1; white-space: pre; }
.roll-ch { display: inline-block; animation: roll-in 0.22s var(--snap) backwards; }
.roll-line.out .roll-ch { animation: roll-out 0.1s ease-in forwards; animation-delay: 0s !important; }
@keyframes roll-in { from { transform: translateY(0.62em); opacity: 0; } }
@keyframes roll-out { to { transform: translateY(-0.5em); opacity: 0; } }

/* ---------- главная: лицо, свет, разговор ---------- */

.screen.home { position: fixed; left: 0; right: 0; top: var(--app-top, 0px); display: flex; flex-direction: column;
  min-height: 0; height: var(--vh); height: var(--app-h, var(--vh)); padding: calc(var(--top) + 4px) 0 0; }
.home-head { position: relative; z-index: 2; display: flex; flex: none; align-items: center; justify-content: space-between;
  height: 44px; padding: 0 12px 0 20px; }
.hello { display: flex; align-items: center; gap: 10px; min-width: 0; font-size: 16px; font-weight: 500;
  letter-spacing: -0.01em; color: var(--ink-2); }
.status { min-width: 0; }
.presence { flex: none; width: 8px; height: 8px; border-radius: 50%; background: rgb(var(--mood));
  box-shadow: 0 0 12px rgb(var(--mood) / 0.9); transition: background 0.3s, box-shadow 0.3s; }
.presence.typing { animation: presence 1s ease-in-out infinite; }
.presence.offline { background: rgba(255, 255, 255, 0.28); box-shadow: none; }
@keyframes presence { 50% { transform: scale(0.55); opacity: 0.5; } }

.icon-btn { display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border-radius: 50%;
  color: rgba(255, 255, 255, 0.86); --lg-blur: 16px; --lg-rim: 0.42; transition: transform 0.3s var(--spring), opacity 0.2s; }
.icon-btn:not(.lg) { border: 1px solid rgba(255, 255, 255, 0.10);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.035));
  -webkit-backdrop-filter: blur(var(--lg-blur, 16px)) saturate(165%);
  backdrop-filter: blur(var(--lg-blur, 16px)) saturate(165%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 6px 18px rgba(0, 0, 0, 0.12); }
.icon-btn:active { transform: scale(0.88); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn.small { width: 34px; height: 34px; flex: none; }
.icon-btn.small svg { width: 16px; height: 16px; }
body.lifted .home-head .icon-btn { opacity: 0; pointer-events: none; }

.stage { position: relative; flex: none; height: clamp(170px, 33vh, 300px); margin: 0 -6px; color: #fff;
  touch-action: none; cursor: pointer; transform-origin: 88% 0;
  transition: height 0.5s var(--ease), opacity 0.3s, transform 0.5s var(--ease); }
.stage svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible;
  filter: drop-shadow(0 0 18px rgb(var(--mood) / calc(0.55 * var(--mood-k)))); }
.home.talking .stage { height: clamp(130px, 22vh, 200px); }
body.composing .home .stage { height: clamp(96px, 15vh, 140px); }
/* прокрутил переписку вверх — лицо «уезжает» в угол (там его подхватывает мини-лицо) */
body.lifted .home .stage { height: 0; opacity: 0; transform: scale(0.4); }
.stage.loading { height: 72vh; }
.stage.small { height: 34vh; margin-top: 10vh; }

/* градиенты лица (классы, а не style-атрибуты: CSP приложения запрещает встроенные стили) */
.aura-0 { stop-color: var(--glow, #fff); stop-opacity: 0.62; }
.aura-1 { stop-color: var(--glow, #fff); stop-opacity: 0.16; }
.aura-2 { stop-color: var(--glow, #fff); stop-opacity: 0; }
.blush-0 { stop-color: var(--blush, #fff); stop-opacity: 0.75; }
.blush-1 { stop-color: var(--blush, #fff); stop-opacity: 0; }

.mood-line { display: flex; flex: none; flex-direction: column; align-items: center; gap: 8px; padding: 0 20px 4px;
  max-height: 90px; transition: max-height 0.4s var(--ease), opacity 0.25s; }
body.lifted .mood-line { max-height: 0; opacity: 0; overflow: hidden; }
/* табло во всю ширину: погашенные точки — цвета настроения, горящие — белые и светятся им же */
.mood-board { display: flex; justify-content: center; width: 100%;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 22%, #000 78%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 22%, #000 78%, transparent); }
.mood-board .dots-canvas { filter: drop-shadow(0 0 7px rgb(var(--mood) / calc(0.9 * var(--mood-k)))); }
/* «почему» — пилюля под табло; пусто — не занимает места */
.why { display: inline-flex; align-items: center; gap: 7px; max-width: 100%; height: 0; padding: 0 12px;
  border-radius: 14px; font-size: 13px; line-height: 18px; color: var(--ink); letter-spacing: -0.005em; opacity: 0;
  background: rgb(var(--mood) / calc(0.16 * var(--mood-k))); border: 1px solid rgb(var(--mood) / calc(0.3 * var(--mood-k)));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
  transition: height 0.25s var(--snap), opacity 0.2s, background 0.6s, border-color 0.6s; }
.why::before { content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%; background: rgb(var(--mood));
  box-shadow: 0 0 8px rgb(var(--mood)); }
.why.on { height: 28px; opacity: 1; }
.why-text { min-width: 0; }
body.composing .mood-line { display: none; }

/* переписка — колонка, прижатая к низу: пока сообщений мало, они у поля ввода, как в мессенджере */
.chat { position: relative; display: flex; flex: 1 1 auto; flex-direction: column; min-height: 0; overflow-y: auto;
  overscroll-behavior: contain; padding: 14px 14px 10px; -webkit-overflow-scrolling: touch; scrollbar-width: none;
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 22px); mask-image: linear-gradient(180deg, transparent 0, #000 22px); }
.chat::-webkit-scrollbar { display: none; }
.chat > :first-child { margin-top: auto; }
.chat-empty { display: flex; flex-direction: column; align-items: center; gap: 14px; margin: 6vh 20px 4px; text-align: center; }
.chat-empty p { margin: 0; font-size: 15px; line-height: 1.45; color: var(--ink-2); text-wrap: balance; }
.starters { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.starter { height: 36px; padding: 0 15px; border-radius: 18px; font-size: 14px; font-weight: 500; color: var(--ink);
  transition: transform 0.3s var(--spring); }
.starter:active { transform: scale(0.94); }
.chat-note { margin: 4px 16px 6px; text-align: center; font-size: 12px; line-height: 1.4; color: var(--ink-3);
  text-wrap: balance; }
.chat-more { display: block; align-self: center; margin: 0 auto 10px; padding: 6px 14px; border-radius: 14px;
  color: var(--ink-2); font-size: 13px; }
.chat-more:disabled { opacity: 0.5; }
/* день — маленькая стеклянная пилюля */
.day { align-self: center; margin: 16px 0 8px; padding: 3px 10px; border-radius: 12px; font-size: 12px; font-weight: 500;
  line-height: 16px; color: var(--ink-3); background: rgba(255, 255, 255, 0.045); border: 1px solid rgba(255, 255, 255, 0.06); }

.msg { display: flex; flex-direction: column; margin-top: 10px; }
.msg.same { margin-top: 3px; }
.msg.lura { align-items: flex-start; }
.msg.me { align-items: flex-end; }
.bubble { position: relative; max-width: min(84%, 520px); padding: 10px 14px 11px; border-radius: 22px;
  font-size: 16.5px; line-height: 23px; letter-spacing: -0.006em; white-space: pre-wrap; overflow-wrap: anywhere;
  hyphens: auto; -webkit-touch-callout: none; transition: transform 0.25s var(--spring), opacity 0.2s; }
.lura .bubble { border-bottom-left-radius: 8px; }
.lura.same .bubble { border-top-left-radius: 10px; }
.me .bubble { border-bottom-right-radius: 8px; background: var(--ink); color: #07080c; border: 1px solid var(--ink); }
.me.same .bubble { border-top-right-radius: 10px; }
.bubble.pressing { transform: scale(0.97); }
.msg.enter { animation: msg-in 0.26s var(--snap) backwards; }
.msg.me.enter { transform-origin: 100% 100%; }
.msg.lura.enter { transform-origin: 0 100%; }
@keyframes msg-in { from { opacity: 0; transform: translateY(10px) scale(0.96); } }
/* твоё сообщение «вытекает» из капли кнопки отправки */
.msg.me.drip { animation: drip-in 0.3s var(--snap) 0.16s backwards; }
@keyframes drip-in { from { clip-path: circle(12px at calc(100% - 12px) calc(100% - 12px)); opacity: 0.6; } to { clip-path: circle(150% at 100% 100%); } }
.drop { position: fixed; z-index: 50; width: 44px; height: 44px; border-radius: 50%; background: var(--ink); pointer-events: none;
  box-shadow: 0 0 18px rgb(var(--mood) / 0.6); }
.bubble.sending { opacity: 0.55; }
.bubble.failed { box-shadow: 0 0 0 1.5px rgba(255, 107, 107, 0.85); }
.msg-note { margin: 4px 6px 0; font-size: 12px; color: var(--ink-3); }
.msg-note button { padding: 0; border: 0; background: none; color: var(--ink); font-size: 12px; font-weight: 600; }
.word { animation: word-in 0.16s var(--snap) backwards; }
@keyframes word-in { from { opacity: 0; filter: blur(2px); } }
/* ответ ещё пишется — мигающая каретка цвета настроения */
.bubble.drafting::after { content: ""; display: inline-block; width: 2px; height: 1.05em; margin-left: 3px;
  vertical-align: -0.16em; border-radius: 1px; background: rgb(var(--mood)); box-shadow: 0 0 8px rgb(var(--mood));
  animation: caret 0.8s steps(2, jump-none) infinite; }
@keyframes caret { 50% { opacity: 0; } }

/* «печатает» — три светодиода табло */
.typing { display: inline-flex; align-items: center; gap: 6px; height: 23px; padding: 0 2px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--ink); opacity: 0.2;
  animation: blip 1.05s ease-in-out infinite; }
.typing i:nth-child(2) { animation-delay: 0.15s; }
.typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes blip { 30% { opacity: 1; transform: translateY(-3px); box-shadow: 0 0 8px rgb(var(--mood)); } 60% { opacity: 0.2; transform: none; } }

/* долгое нажатие на сообщение: оно приподнимается над затемнённым размытым фоном, под ним — стеклянное меню */
.ctx-layer { position: fixed; inset: 0; z-index: 45; background: rgba(0, 0, 0, 0.5);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: fade-in 0.2s ease-out; }
.ctx-layer.out { animation: fade-out 0.16s ease-in forwards; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
.ctx-bubble { position: fixed; z-index: 46; margin: 0; pointer-events: none; animation: lift 0.32s var(--spring) forwards; }
.ctx-bubble .bubble { max-width: none; box-shadow: 0 18px 40px -16px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(255, 255, 255, 0.06); }
.ctx-bubble.out { animation: fade-out 0.14s ease-in forwards; }
@keyframes lift { to { transform: scale(1.03); } }
.ctx-menu { position: fixed; z-index: 47; display: flex; flex-direction: column; min-width: 210px; padding: 6px; border-radius: 20px;
  --lg-blur: 30px; transform-origin: var(--ox, 0) 0; animation: menu-in 0.34s var(--spring) backwards; }
@keyframes menu-in { from { opacity: 0; transform: scale(0.7); } }
.ctx-menu button { display: flex; align-items: center; height: 44px; padding: 0 14px; border: 0; border-radius: 14px;
  background: none; font-size: 16px; font-weight: 500; text-align: left; }
.ctx-menu button:active { background: rgba(255, 255, 255, 0.08); }
.ctx-menu button + button { box-shadow: inset 0 1px 0 var(--hair); }

.private-note { margin: 0 20px 8px; padding: 10px 14px; border-radius: 16px; font-size: 13px; line-height: 1.4;
  color: var(--ink-2); }

/* поле ввода — капсула жидкого стекла */
.composer { position: relative; z-index: 3; display: flex; flex: none; align-items: flex-end; gap: 8px;
  margin: 0 12px calc(86px + var(--bottom)); padding: 5px 5px 5px 18px; border-radius: 27px; --lg-blur: 22px;
  transition: margin 0.35s var(--ease), border-radius 0.3s var(--ease); }
.composer.tall { border-radius: 22px; }
body.composing .composer { margin-bottom: 10px; }
.composer textarea { flex: 1; min-width: 0; height: 44px; max-height: 154px; margin: 0; padding: 11px 0; border: 0;
  background: transparent; color: var(--ink); font: inherit; font-size: 16px; line-height: 22px; resize: none;
  outline: none; scrollbar-width: none; }
.composer textarea:focus-visible { outline: none; }
.composer:focus-within { --lg-rim: 0.75; }
.composer textarea::placeholder { color: var(--ink-3); }
.send { position: relative; display: grid; flex: none; place-items: center; width: 44px; height: 44px; padding: 0; border: 0;
  border-radius: 50%; background: var(--ink); color: #000;
  box-shadow: inset 0 -2px 4px rgba(0, 0, 0, 0.12), 0 0 22px rgb(var(--mood) / calc(0.45 * var(--mood-k)));
  transition: transform 0.4s var(--spring), opacity 0.2s, box-shadow 0.6s; }
.send svg { width: 22px; height: 22px; }
.send:disabled { opacity: 0.22; transform: scale(0.88); box-shadow: none; }
.send:not(:disabled):active { transform: scale(0.9); }
/* пока сообщение уходит — тонкое кольцо цвета настроения вокруг кнопки */
.send.busy::after { content: ""; position: absolute; inset: -4px; border-radius: 50%;
  border: 2px solid rgb(var(--mood) / 0.25); border-top-color: rgb(var(--mood)); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* мини-лицо в углу на остальных экранах (и на главной, когда лицо «уехало» при прокрутке) */
.mini-face { position: fixed; z-index: 26; top: calc(var(--top) + 9px); right: 15px; width: 86px; height: 46px;
  padding: 5px 8px; border-radius: 23px; color: #fff; pointer-events: none; --lg-blur: 18px;
  opacity: 0; transform: translateY(-10px) scale(0.86); transition: opacity 0.3s, transform 0.5s var(--spring); }
.mini-face svg { display: block; width: 100%; height: 100%; overflow: visible; }
body:not([data-screen="home"]) .mini-face, body.lifted .mini-face { opacity: 1; transform: none; pointer-events: auto;
  cursor: pointer; }
body.lifted .mini-face { top: calc(var(--top) + 2px); }

/* ---------- группы и строки ---------- */

.group-wrap { margin: 0 16px 28px; }
.group-head { margin: 0 6px 9px; font-size: 14px; font-weight: 600; letter-spacing: -0.005em; color: var(--ink-2); }
.group { border-radius: 24px; overflow: hidden; }
.group-foot { margin: 9px 6px 0; font-size: 13px; line-height: 1.4; color: var(--ink-3); }
.group-foot.wide { margin: 6px 22px 24px; }

.row { position: relative; display: flex; align-items: center; gap: 14px; width: 100%; min-height: 58px;
  max-height: 260px; padding: 13px 16px; border: 0; background: transparent; text-align: left;
  transition: max-height 0.4s var(--ease), padding 0.4s var(--ease), opacity 0.25s, background 0.2s, transform 0.25s var(--spring); }
.row + .row::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; height: 1px; background: var(--hair); }
.row.stack { flex-direction: column; align-items: stretch; gap: 12px; }
.row.tappable:active { background: rgba(255, 255, 255, 0.05); transform: scale(0.99); }
.row.collapsed { max-height: 0; min-height: 0; padding-top: 0; padding-bottom: 0; opacity: 0; overflow: hidden; }
.row.collapsed::before { opacity: 0; }
.row-text { flex: 1; min-width: 0; }
.row-label { font-size: 16px; line-height: 1.25; font-weight: 520; letter-spacing: -0.01em; }
.row-hint { margin-top: 3px; font-size: 13px; line-height: 1.38; color: var(--ink-3); }
.row.danger .row-label { font-weight: 600; color: #ff9b9b; }
.chevron { flex: none; width: 9px; height: 9px; margin-right: 4px; border-top: 2px solid rgba(255, 255, 255, 0.3);
  border-right: 2px solid rgba(255, 255, 255, 0.3); transform: rotate(45deg); }

/* ---------- переключатель: ручка перетекает каплей ---------- */

.switch { position: relative; flex: none; width: 52px; height: 32px; padding: 0; border: 0; border-radius: 16px;
  background: rgba(255, 255, 255, 0.15); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.35);
  transition: background 0.3s, box-shadow 0.4s; }
.switch .knob { position: absolute; top: 2px; left: 2px; width: 28px; height: 28px; border-radius: 14px; background: #fff;
  box-shadow: 0 2px 7px rgba(0, 0, 0, 0.4), inset 0 -1px 2px rgba(0, 0, 0, 0.12);
  transition: transform 0.5s var(--spring), width 0.2s var(--ease), background 0.25s; }
.switch.on { background: var(--ink); box-shadow: 0 0 18px rgb(var(--mood) / calc(0.5 * var(--mood-k))); }
.switch.on .knob { background: #000; transform: translateX(20px); }
.switch:active .knob { width: 35px; }
.switch.on:active .knob { transform: translateX(13px); }
.switch.flip .knob { animation: knob-drip 0.42s var(--ease); }
@keyframes knob-drip { 45% { scale: 1.28 0.86; } }

/* ---------- сегменты: линза-«желе» ---------- */

.seg { position: relative; display: flex; padding: 3px; border-radius: 16px; background: rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3); isolation: isolate; transition: opacity 0.3s; touch-action: pan-y; }
.seg button { position: relative; z-index: 1; flex: 1 1 0; min-width: 0; height: 36px; padding: 0 8px; border: 0;
  border-radius: 13px; background: none; color: var(--ink-2); font-size: 14px; font-weight: 600; letter-spacing: -0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color 0.25s, scale 0.3s var(--spring); }
.seg button.on { color: #000; }
.seg button.under { color: #000; scale: 1.06; }
.seg-lens, .tab-lens { position: absolute; z-index: 0; left: 0; width: 0; will-change: transform;
  background: linear-gradient(180deg, #fff, #e9edf7); }
.seg-lens { top: 3px; bottom: 3px; border-radius: 13px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45), inset 0 -1px 2px rgba(0, 0, 0, 0.08); }
.seg.disabled { opacity: 0.38; pointer-events: none; }

/* ---------- линейка и табло ---------- */

.dots-canvas { display: block; filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.32)); }
.instrument { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.ruler-value { display: flex; align-items: center; justify-content: center; height: 54px; }
.ruler-caption { min-height: 18px; font-size: 13px; color: var(--ink-3); }
.ruler { position: relative; width: 100%; height: 66px; margin-top: 4px; overflow: hidden; touch-action: pan-y; cursor: grab;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 24%, #000 76%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 24%, #000 76%, transparent); }
.instrument.active .ruler { cursor: grabbing; }
.ruler-track { position: absolute; top: 0; bottom: 0; left: 50%; will-change: transform; }
.tick { position: absolute; bottom: 28px; width: 2px; height: 12px; margin-left: -1px; border-radius: 1px;
  background: rgba(255, 255, 255, 0.6); }
.tick.major { height: 22px; background: #fff; }
.tick-label { position: absolute; bottom: 6px; transform: translateX(-50%); font-size: 11px; color: var(--ink-3);
  font-variant-numeric: tabular-nums; white-space: nowrap; }
/* лупа над стрелкой — окошко жидкого стекла */
.ruler-lens { position: absolute; left: 50%; bottom: 6px; width: 46px; height: 56px; margin-left: -23px; border-radius: 16px;
  --lg-blur: 0px; --lg-sat: 140%; --lg-fill: rgba(255, 255, 255, 0.02); --lg-rim: 0.5; pointer-events: none; }
.ruler-needle { position: absolute; left: 50%; bottom: 24px; width: 3px; height: 36px; margin-left: -1.5px; border-radius: 2px;
  background: #fff; box-shadow: 0 0 16px rgb(var(--mood) / 0.9); transition: height 0.3s var(--spring); }
.instrument.active .ruler-needle { height: 44px; }

.stepper { display: flex; align-items: center; gap: 10px; flex: none; }
.stepper-value { display: flex; justify-content: center; min-width: 30px; }
.round { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border-radius: 50%; font-size: 20px;
  line-height: 1; transition: transform 0.3s var(--spring), opacity 0.2s; }
.round:active { transform: scale(0.86); }
.round:disabled { opacity: 0.28; }

.range { display: flex; align-items: center; gap: 12px; }
.range-row .range { padding: 2px 0 4px; }
.range-sep { color: var(--ink-3); }
.time-dots { flex: none; }

/* ---------- поля ---------- */

.field { width: 100%; min-width: 0; height: 42px; padding: 0 12px; border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px; background: rgba(255, 255, 255, 0.06); color: #fff; font: inherit; font-size: 16px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3); transition: border-color 0.2s, background 0.2s; }
.field::placeholder { color: rgba(255, 255, 255, 0.32); }
.field:focus { border-color: rgb(var(--mood) / calc(0.4 + 0.4 * var(--mood-k))); background: rgba(255, 255, 255, 0.09); }
.row > .field { flex: 0 1 58%; }
.search-wrap { margin: 0 16px 20px; }
.field.search { height: 46px; padding-left: 42px; border-radius: 23px; -webkit-appearance: none; appearance: none;
  background: rgba(255, 255, 255, 0.06) no-repeat 14px 50% / 18px
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-opacity='.5' stroke-width='2' stroke-linecap='round'><circle cx='10.5' cy='10.5' r='6.5'/><path d='m20 20-4.6-4.6'/></svg>"); }

/* ---------- Telegram ---------- */

.hero { margin: 0 16px 28px; padding: 22px 20px; border-radius: 30px; overflow: hidden; }
.hero.glass { background:
    radial-gradient(120% 110% at 85% 0%, rgb(var(--mood) / calc(0.5 * var(--mood-k))), rgb(var(--mood) / 0) 62%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03)), rgba(10, 11, 16, 0.7); }
.hero.glass::before { --rim: 0.42; }
.hero-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hero-label { font-size: 22px; font-weight: 650; letter-spacing: -0.02em; }
.hero-status { margin-top: 8px; font-size: 15px; line-height: 1.4; color: var(--ink-2); }
.hero-text { margin: 0; font-size: 16px; line-height: 1.45; color: rgba(255, 255, 255, 0.86); }
.steps { margin: 18px 0 8px; padding: 0; list-style: none; counter-reset: step; }
.steps li { position: relative; min-height: 32px; margin: 14px 0; padding-left: 46px; font-size: 15px; line-height: 1.4;
  counter-increment: step; }
.steps li::before { content: counter(step); position: absolute; top: -3px; left: 0; display: grid; place-items: center;
  width: 32px; height: 32px; border: 1px solid rgba(255, 255, 255, 0.3); border-radius: 50%; font-size: 14px; font-weight: 600; }
.avatar { position: relative; display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.09); font-size: 14px; font-weight: 600; letter-spacing: 0.02em; }
.avatar.ping::after { content: ""; position: absolute; top: 1px; right: 1px; width: 9px; height: 9px; border-radius: 50%;
  background: rgb(var(--mood)); box-shadow: 0 0 10px rgb(var(--mood) / 0.9); }
.badge { flex: none; padding: 7px 11px; border-radius: 10px; background: rgba(255, 255, 255, 0.08); color: var(--ink-3);
  font-size: 13px; font-weight: 600; }
.badge.on { background: var(--ink); color: #000; }

/* ---------- память ---------- */

.count { display: flex; align-items: center; gap: 18px; margin: 0 16px 22px; padding: 22px 20px; border-radius: 30px; }
.count-label { font-size: 16px; line-height: 1.3; color: rgba(255, 255, 255, 0.84); }
.memory-row .row-label { font-size: 15px; line-height: 1.35; font-weight: 400; }
.memory-row.leaving { animation: leave 0.28s var(--ease) forwards; }
@keyframes leave { to { opacity: 0; transform: translateX(46px); max-height: 0; min-height: 0; padding-top: 0; padding-bottom: 0; } }

/* ---------- кнопки ---------- */

.btn { display: block; width: 100%; height: 52px; margin-top: 12px; border: 1px solid rgba(255, 255, 255, 0.09); border-radius: 26px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.035));
  -webkit-backdrop-filter: blur(18px) saturate(165%); backdrop-filter: blur(18px) saturate(165%);
  font-size: 16px; font-weight: 600; letter-spacing: -0.01em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.10), 0 8px 24px rgba(0, 0, 0, 0.12);
  transition: transform 0.3s var(--spring), background 0.2s, border-color 0.2s; }
.btn:active { transform: scale(0.97); }
.btn.primary { border-color: rgba(255, 255, 255, 0.72); background: linear-gradient(180deg, #fff, #e9edf7); color: #000;
  box-shadow: inset 0 -2px 4px rgba(0, 0, 0, 0.1), 0 0 26px rgb(var(--mood) / calc(0.4 * var(--mood-k))); }
.btn.danger { border-color: rgba(255, 255, 255, 0.14); background: #ff5c5c; color: #000; }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .icon-btn:not(.lg), .btn:not(.primary):not(.danger) { background: rgba(24, 27, 38, 0.92); }
}

/* ---------- таб-бар: жидкое стекло и линза-«желе» с лупой ---------- */

.tabbar { position: fixed; z-index: 30; left: 50%; bottom: calc(10px + var(--bottom)); display: flex; gap: 2px;
  width: min(calc(100vw - 24px), 420px); padding: 6px; border-radius: 32px; transform: translateX(-50%);
  --lg-blur: 26px; --lg-fill: rgba(8, 9, 13, 0.62); touch-action: none;
  transition: transform 0.45s var(--spring), opacity 0.25s; }
/* «лужица света»: верхняя кромка таб-бара ловит свечение лица */
.tabbar { box-shadow: inset 0 1px 0.5px rgb(var(--mood) / calc(0.55 * var(--mood-k))), inset 0 -1px 0.5px rgba(255, 255, 255, 0.06),
  0 10px 30px -12px rgba(0, 0, 0, 0.85), 0 26px 60px -30px rgb(var(--mood) / calc(0.42 * var(--mood-k))); }
.tab { position: relative; z-index: 1; display: flex; flex: 1 1 0; flex-direction: column; align-items: center;
  justify-content: center; gap: 3px; min-width: 0; height: 52px; padding: 0; border: 0; border-radius: 26px; background: none;
  color: rgba(255, 255, 255, 0.55); font-size: 11px; font-weight: 600; letter-spacing: 0.01em;
  transition: color 0.3s, scale 0.35s var(--spring); }
.tab.on, .tab.under { color: #000; }
.tab.under { scale: 1.06; }
.tab:active .tab-icon { transform: scale(0.86); }
.tab-icon { display: block; transition: transform 0.3s var(--spring); }
.tab-icon svg { display: block; width: 24px; height: 24px; overflow: visible; }
/* глаза на иконке «Лура» моргают вместе с ней */
.tab-icon ellipse { transform-box: fill-box; transform-origin: center; transition: transform 0.09s ease-in; }
.tab-icon.blink ellipse { transform: scaleY(0.12); }
/* пока ты в настройках, Лура написала — точка на её вкладке */
.tab.ping::after { content: ""; position: absolute; top: 7px; left: calc(50% + 9px); width: 8px; height: 8px;
  border-radius: 50%; background: rgb(var(--mood)); box-shadow: 0 0 10px rgb(var(--mood) / 0.9);
  animation: msg-in 0.3s var(--spring) backwards; }
.tab-lens { top: 6px; bottom: 6px; border-radius: 26px;
  box-shadow: 0 0 22px rgb(var(--mood) / calc(0.45 * var(--mood-k))), inset 0 1px 0 #fff, inset 0 -2px 5px rgba(0, 0, 0, 0.1);
  transition: box-shadow 0.8s; }
body.sheet-open .tabbar, body.composing .tabbar, body.bar-hidden:not([data-screen="home"]) .tabbar {
  transform: translateX(-50%) translateY(150%); opacity: 0; pointer-events: none;
  transition: transform 0.35s var(--ease), opacity 0.2s; }

/* ---------- тост — «островок»: вырастает из точки и уходит в неё ---------- */

.toast { position: fixed; z-index: 60; top: calc(var(--top) + 10px); left: 50%; display: flex; align-items: center; gap: 10px;
  height: 42px; max-width: calc(100vw - 32px); padding: 0 18px 0 11px; border-radius: 21px; font-size: 15px;
  font-weight: 600; white-space: nowrap; pointer-events: none; --lg-blur: 30px; --lg-fill: rgba(6, 7, 10, 0.72);
  opacity: 0; transform: translateX(-50%) scale(0.5); clip-path: inset(0 calc(50% - 21px) round 21px);
  transition: clip-path 0.42s var(--spring), transform 0.42s var(--spring), opacity 0.18s; }
.toast > * { opacity: 0; transition: opacity 0.12s; }
.toast span:last-child { overflow: hidden; text-overflow: ellipsis; }
.toast.show { opacity: 1; transform: translateX(-50%); clip-path: inset(0 0 round 21px); }
.toast.show > * { opacity: 1; transition: opacity 0.2s 0.08s; }
.toast-mark { position: relative; flex: none; width: 20px; height: 20px; border-radius: 50%; background: var(--ink);
  box-shadow: 0 0 10px rgb(var(--mood) / 0.6); }
.toast-mark.ok::after { content: ""; position: absolute; left: 7px; top: 4px; width: 5px; height: 9px;
  border-right: 2px solid #000; border-bottom: 2px solid #000; transform: rotate(45deg); }
.toast-mark.error { background: none; border: 2px solid #ff8f8f; box-shadow: none; }
.toast-mark.error::after { content: "!"; position: absolute; inset: 0; display: grid; place-items: center; font-size: 12px;
  font-weight: 800; color: #ff8f8f; }

/* ---------- шторка ---------- */

.sheet-layer { position: fixed; inset: 0; z-index: 40; pointer-events: none; background: rgba(0, 0, 0, 0);
  transition: background 0.3s; }
.sheet-layer.open { pointer-events: auto; background: rgba(0, 0, 0, 0.6); }
.sheet { position: absolute; left: 8px; right: 8px; bottom: calc(8px + var(--bottom)); max-height: 84vh; overflow: auto;
  --lg-blur: 44px; --lg-fill: rgba(6, 7, 10, 0.78); padding: 10px 20px 22px; border-radius: 32px;
  transform: translateY(calc(100% + 24px + var(--bottom))); visibility: hidden;
  transition: transform 0.45s var(--ease), visibility 0s 0.45s; overscroll-behavior: contain; }
.sheet-layer.open .sheet { transform: none; visibility: visible; transition: transform 0.5s var(--spring); }
.sheet-handle { position: relative; width: 100%; height: 26px; margin: -6px 0 6px; touch-action: none; cursor: grab; }
.sheet-handle::after { content: ""; position: absolute; left: 50%; top: 10px; width: 40px; height: 5px; margin-left: -20px;
  border-radius: 3px; background: rgba(255, 255, 255, 0.28); }
.sheet-title { margin: 0 0 4px; font-size: 24px; font-weight: 650; letter-spacing: -0.022em; }
.sheet-sub { margin: 0 0 14px; font-size: 14px; color: var(--ink-3); }
.sheet-label { margin: 18px 2px 8px; font-size: 13px; color: var(--ink-2); }
.sheet-note { margin: 16px 2px 4px; font-size: 13px; line-height: 1.4; color: var(--ink-3); }
.sheet-body .instrument { margin: 8px 0 6px; }
.confirm-text { margin: 4px 2px 10px; font-size: 17px; line-height: 1.45; }

.about { margin: 18px 30px 22px; text-align: center; font-size: 16px; line-height: 1.45; color: rgba(255, 255, 255, 0.84);
  text-wrap: balance; }
.error-screen .about { margin-top: 8px; }
.error-screen .btn { width: auto; margin: 18px 24px 0; }

/* запасной экран, если приложение не запустилось (boot.js) */
.boot-fail { position: fixed; inset: 0; z-index: 90; display: flex; flex-direction: column; justify-content: center;
  padding: 24px; background: #000; text-align: center; }
.boot-fail-title { margin: 0 0 10px; font-size: 24px; font-weight: 650; }
.boot-fail-text { margin: 0 0 18px; font-size: 15px; line-height: 1.45; color: var(--ink-2); overflow-wrap: anywhere;
  user-select: text; -webkit-user-select: text; }

/* ---------- первый запуск: одна сцена — свет распускается, лицо проявляется, переписка и стекло всплывают ---------- */

body.intro.ready .light.a { animation: bloom 0.8s var(--ease) backwards, drift-a 26s ease-in-out 0.8s infinite alternate; }
@keyframes bloom { from { opacity: 0; transform: scale(0.6); } }
body.intro.ready .home .stage svg { animation: face-in 0.6s var(--spring) 0.15s backwards; }
@keyframes face-in { from { opacity: 0; transform: scale(0.82); } }
body.intro.ready .home .mood-line { animation: rise 0.5s var(--ease) 0.45s backwards; }
body.intro.ready .home .chat .msg:nth-last-child(-n+6) { animation: rise 0.45s var(--ease) backwards; }
body.intro.ready .home .chat .msg:nth-last-child(6) { animation-delay: 0.62s; }
body.intro.ready .home .chat .msg:nth-last-child(5) { animation-delay: 0.65s; }
body.intro.ready .home .chat .msg:nth-last-child(4) { animation-delay: 0.68s; }
body.intro.ready .home .chat .msg:nth-last-child(3) { animation-delay: 0.71s; }
body.intro.ready .home .chat .msg:nth-last-child(2) { animation-delay: 0.74s; }
body.intro.ready .home .chat .msg:nth-last-child(1) { animation-delay: 0.77s; }
body.intro.ready .home .composer { animation: rise 0.6s var(--spring) 0.8s backwards; }
body.intro.ready .tabbar { animation: bar-rise 0.6s var(--spring) 0.88s backwards; }
@keyframes rise { from { opacity: 0; transform: translateY(24px); } }
@keyframes bar-rise { from { opacity: 0; transform: translateX(-50%) translateY(24px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important;
    animation-delay: 0s !important; transition-duration: 0.001ms !important; }
  .light { animation: none !important; }
  .bubble.drafting::after { animation: none; }
}
@media (prefers-reduced-transparency: reduce) {
  .lg { -webkit-backdrop-filter: none; backdrop-filter: none; --lg-fill: rgba(14, 15, 22, 0.96); }
  .pg, .glass { -webkit-backdrop-filter: none; backdrop-filter: none; }
  .icon-btn:not(.lg), .btn:not(.primary):not(.danger) { -webkit-backdrop-filter: none; backdrop-filter: none; background: rgba(20, 22, 30, 0.94); }
}

/* ---------- паутина памяти ---------- */
:root {
  --mw-people: #ff7aa8;
  --mw-about: #7fd6ff;
  --mw-likes: #ffc46b;
  --mw-dates: #ff9a62;
  --mw-events: #b49cff;
  --mw-important: #ffe58a;
  --mw-goals: #6cf0c2;
  --mw-subs: #8fa8ff;
  --mw-other: #c9d2e3;
  --mw-self: #ffffff;
}
.memweb-bar { margin: 0 16px 14px; }
.memweb-bar .seg { width: 100%; }
.memweb-pane, .memweb-list { margin: 0 0 22px; }
.memweb-pane[hidden], .memweb-list[hidden] { display: none; }
.memweb { position: relative; height: min(64vh, 540px); margin: 0 16px; border-radius: 30px; overflow: hidden;
  background:
    radial-gradient(120% 80% at 50% 45%, rgb(var(--mood) / 0.16), transparent 62%),
    radial-gradient(60% 50% at 20% 85%, rgba(255, 122, 168, 0.07), transparent 70%),
    rgba(255, 255, 255, 0.035); }
.memweb-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none;
  cursor: grab; }
.memweb-canvas:active { cursor: grabbing; }
.memweb-empty { position: absolute; left: 24px; right: 24px; bottom: 26%; margin: 0; text-align: center;
  font-size: 15px; line-height: 1.35; color: var(--ink-2); pointer-events: none; }
.memweb-empty[hidden] { display: none; }
.memweb-legend { position: absolute; left: 12px; right: 12px; bottom: 10px; display: flex; flex-wrap: wrap; gap: 6px 12px;
  justify-content: center; font-size: 11.5px; color: var(--ink-3); pointer-events: none; }
.memweb-legend span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.mw-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--mw-other);
  box-shadow: 0 0 8px currentColor; flex: none; }
.mw-people { background: var(--mw-people); color: var(--mw-people); }
.mw-about { background: var(--mw-about); color: var(--mw-about); }
.mw-likes { background: var(--mw-likes); color: var(--mw-likes); }
.mw-dates { background: var(--mw-dates); color: var(--mw-dates); }
.mw-events { background: var(--mw-events); color: var(--mw-events); }
.mw-important { background: var(--mw-important); color: var(--mw-important); }
.mw-goals { background: var(--mw-goals); color: var(--mw-goals); }
.mw-subs { background: var(--mw-subs); color: var(--mw-subs); }
.mw-other { background: var(--mw-other); color: var(--mw-other); }
.memweb-hits { margin: 14px 16px 0; display: grid; gap: 8px; }
.memweb-hits-title { font-size: 13px; color: var(--ink-3); margin: 2px 4px; }
.memweb-hit { display: grid; gap: 3px; padding: 11px 14px; border-radius: 18px; background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--hair); }
.memweb-hit.lura { background: rgb(var(--mood) / 0.08); }
.memweb-hit-when { font-size: 12px; color: var(--ink-3); }
.memweb-hit-text { font-size: 15px; line-height: 1.35; color: var(--ink); overflow-wrap: anywhere; }
.mw-sheet { display: grid; gap: 10px; padding: 4px 4px 8px; }
.mw-sheet-group { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }
.mw-sheet-kind { color: var(--ink-3); }
.mw-sheet-title { margin: 0; font-size: 24px; line-height: 1.15; font-weight: 680; letter-spacing: -0.02em;
  overflow-wrap: anywhere; }
.mw-sheet-text { margin: 0; font-size: 16px; line-height: 1.4; color: var(--ink-2); overflow-wrap: anywhere; }
.mw-sheet-when { margin: 0; font-size: 14px; color: var(--mw-dates); }
.mw-sheet-links { display: flex; flex-wrap: wrap; gap: 8px; }
.mw-chip { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 13px; border-radius: 17px;
  border: 1px solid var(--hair-2); background: rgba(255, 255, 255, 0.06); color: var(--ink); font: inherit;
  font-size: 14px; }
.mw-chip:active { transform: scale(0.97); }
@media (prefers-reduced-motion: reduce) {
  .mw-chip:active { transform: none; }
}
