:root {
  --bg: #ffffff; --soft: #f2f4f8; --line: #e1e5ec; --ink: #14171c; --mute: #5d6673;
  --purple: #85317d; --gold: #fedb42; --me: #85317d; --them: #eef0f5;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #111318; --soft: #1b1e25; --line: #2b303a; --ink: #f2f4f8; --mute: #a2abb8;
    --purple: #d58bcd; --me: #7a2d73; --them: #232731; }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink);
  font: 17px/1.35 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
body { overscroll-behavior-y: none; }
button, input { font: inherit; color: inherit; }
#app { min-height: 100%; display: flex; flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left); }

/* first screens */
.hero { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; padding: 28px 24px calc(28px + env(safe-area-inset-bottom)); text-align: center; }
.hero img { width: 96px; height: 96px; border-radius: 22px; }
.hero h1 { font-size: 26px; margin: 0; }
.hero p { margin: 0; color: var(--mute); max-width: 300px; }
.big { display: block; width: 100%; max-width: 320px; min-height: 56px; padding: 15px 18px; border: 0;
  border-radius: 16px; background: var(--gold); color: #14171c; font-weight: 700; font-size: 18px;
  text-align: center; cursor: pointer; }
.big.plain { background: var(--soft); color: var(--ink); font-weight: 600; }
.big input { display: none; }
.steps { text-align: left; width: 100%; max-width: 320px; margin: 0; padding: 0; list-style: none; }
.steps li { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.steps b { flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--gold); color: #14171c;
  display: grid; place-items: center; font-size: 15px; }
.bar { width: 100%; max-width: 320px; height: 10px; border-radius: 5px; background: var(--soft); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--purple); transition: width .2s; }
.small { font-size: 14px; color: var(--mute); }

/* home */
.top { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 10px 16px 8px;
  border-bottom: 1px solid var(--line); }
.top .row { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.top h2 { flex: 1; margin: 0; font-size: 22px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon { flex: none; width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--soft);
  font-size: 20px; cursor: pointer; }
.search { width: 100%; height: 44px; margin-top: 6px; padding: 0 14px; border: 0; border-radius: 12px;
  background: var(--soft); outline: none; }
.list { flex: 1; padding: 0 0 calc(76px + env(safe-area-inset-bottom)); }
.sec { padding: 16px 16px 6px; font-size: 13px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--purple); }
.chat { display: flex; gap: 12px; align-items: center; width: 100%; min-height: 64px; padding: 10px 16px;
  border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; cursor: pointer; }
.av { flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 700; color: #14171c; background: var(--gold); }
.chat .tx { flex: 1; min-width: 0; }
.chat .nm { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat .ln { color: var(--mute); font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat .dt { flex: none; font-size: 13px; color: var(--mute); }
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: flex; background: var(--bg);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabs button { flex: 1; height: 56px; border: 0; background: none; font-weight: 600; color: var(--mute); cursor: pointer; }
.tabs button.on { color: var(--purple); box-shadow: inset 0 3px 0 var(--gold); }
.note { margin: 12px 16px 0; padding: 12px 14px; border-radius: 14px; background: var(--soft);
  display: flex; gap: 10px; align-items: center; }
.note span { flex: 1; font-size: 15px; }
.note button { flex: none; min-height: 44px; padding: 0 14px; border: 0; border-radius: 12px;
  background: var(--gold); color: #14171c; font-weight: 700; cursor: pointer; }
.empty { padding: 40px 24px; text-align: center; color: var(--mute); }

/* one chat */
.msgs { flex: 1; padding: 12px 12px calc(20px + env(safe-area-inset-bottom)); display: flex;
  flex-direction: column; gap: 6px; }
.day { align-self: center; margin: 10px 0 4px; font-size: 12px; color: var(--mute); }
.m { max-width: 80%; padding: 9px 13px; border-radius: 18px; background: var(--them); align-self: flex-start;
  white-space: pre-wrap; overflow-wrap: anywhere; }
.m.me { align-self: flex-end; background: var(--me); color: #fff; }
.m .who { display: block; font-size: 12px; font-weight: 700; color: var(--purple); margin-bottom: 2px; }
.m img { display: block; max-width: 100%; width: 220px; border-radius: 12px; margin-top: 4px; cursor: pointer; }
.more { align-self: center; min-height: 44px; padding: 0 18px; border: 0; border-radius: 22px;
  background: var(--soft); font-weight: 600; cursor: pointer; }

/* photos */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; padding: 3px; }
.grid button { aspect-ratio: 1; border: 0; padding: 0; background: var(--soft); overflow: hidden; cursor: pointer; }
.grid img { width: 100%; height: 100%; object-fit: cover; display: block; }
.albums { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; padding: 14px 16px; }
.album { border: 0; padding: 0; background: none; text-align: left; cursor: pointer; }
.album .cv { aspect-ratio: 1; border-radius: 16px; overflow: hidden; background: var(--soft); }
.album img { width: 100%; height: 100%; object-fit: cover; display: block; }
.album b { display: block; margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.album span { font-size: 14px; color: var(--mute); }
.view { position: fixed; inset: 0; z-index: 20; background: #000; display: flex; align-items: center;
  justify-content: center; }
.view img { max-width: 100%; max-height: 100%; }
.view button { position: absolute; border: 0; background: rgba(255,255,255,.18); color: #fff; width: 48px;
  height: 48px; border-radius: 50%; font-size: 22px; cursor: pointer; }
.view .x { top: calc(12px + env(safe-area-inset-top)); right: 12px; }
.view .p { left: 10px; } .view .n { right: 10px; }

/* settings sheet */
.sheet { position: fixed; inset: 0; z-index: 15; background: rgba(0,0,0,.4); display: flex; align-items: flex-end; }
.sheet > div { width: 100%; background: var(--bg); border-radius: 22px 22px 0 0;
  padding: 18px 18px calc(22px + env(safe-area-inset-bottom)); display: flex; flex-direction: column;
  gap: 10px; align-items: center; }
.sheet .big { max-width: none; }
