@font-face { font-family: Fredoka; src: url(/fonts/fredoka-latin-500-normal.woff2) format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: Fredoka; src: url(/fonts/fredoka-latin-600-normal.woff2) format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: Nunito; src: url(/fonts/nunito-latin-400-normal.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: Nunito; src: url(/fonts/nunito-latin-700-normal.woff2) format('woff2'); font-weight: 700; font-display: swap; }

/* ============ THEME: Cotton Candy ============ */
:root {
  --b1: #ff6fa5; --b2: #a78bff;              /* brand gradient */
  --brand: #ff5c93; --brand-soft: #ffe3ee;
  --bg: #fff5f9; --surface: #ffffff; --surface-2: #fdf0f6; --surface-3: #f8e6f0;
  --text: #2e1f33; --muted: #8e7a93; --line: #f2dfe9;
  --them: #ffffff; --them-text: var(--text);
  --me-text: #ffffff;
  --ok: #3ccf8e; --danger: #ff5a6e;
  --shadow: 0 8px 28px rgba(160, 70, 120, .12);
  --shadow-sm: 0 2px 8px rgba(160, 70, 120, .08);
  --r: 20px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --fs: 15.5px;
  color-scheme: light;
}
[data-theme="dark"] {
  --brand-soft: #3a2340;
  --bg: #16121d; --surface: #211a2b; --surface-2: #2a2136; --surface-3: #33293f;
  --text: #f6edf8; --muted: #a897b0; --line: #342a40;
  --them: #2a2136;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, .25);
  color-scheme: dark;
}
[data-bubble="berry"]    { --b1: #ff5c93; --b2: #ff9472; --brand: #ff5c93; }
[data-bubble="lavender"] { --b1: #a78bff; --b2: #6f8cff; --brand: #8b6cff; }
[data-bubble="mint"]     { --b1: #36c9a0; --b2: #4aa8f0; --brand: #20b48b; }
[data-bubble="peach"]    { --b1: #ff8f70; --b2: #ffbf5e; --brand: #ff7a59; }
[data-bubble="rose"]     { --b1: #ff6fa5; --b2: #ff6fa5; --brand: #ff5c93; }
[data-size="small"] { --fs: 14px; } [data-size="large"] { --fs: 17.5px; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: Nunito, ui-rounded, system-ui, -apple-system, sans-serif;
  font-size: var(--fs); color: var(--text); background: var(--bg);
  overflow: hidden; -webkit-font-smoothing: antialiased;
}
.defs { position: absolute; width: 0; height: 0; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
h1, h2, h3, .head-name, .btn, .pc-name, .call-name, .us-days { font-family: Fredoka, ui-rounded, system-ui, sans-serif; font-weight: 600; }
.ic { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ic.sm { width: 15px; height: 15px; }
.rot180 { transform: rotate(180deg); }
a { color: inherit; }

/* ============ welcome ============ */
.screen { position: fixed; inset: 0; }
.welcome { display: grid; place-items: center; padding: 24px; overflow: auto; background: var(--bg); }
.blob { position: fixed; border-radius: 50%; filter: blur(60px); opacity: .55; z-index: 0; animation: drift 14s ease-in-out infinite alternate; }
.b1 { width: 340px; height: 340px; background: #ffb3cf; top: -80px; left: -80px; }
.b2 { width: 300px; height: 300px; background: #cbb8ff; bottom: -60px; right: -60px; animation-delay: -5s; }
.b3 { width: 200px; height: 200px; background: #ffd7b8; top: 50%; left: 60%; animation-delay: -9s; }
[data-theme="dark"] .blob { opacity: .22; }
@keyframes drift { to { transform: translate(40px, 30px) scale(1.1); } }
.welcome-card {
  position: relative; z-index: 1; width: min(400px, 100%); text-align: center;
  background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  border-radius: 32px; padding: 32px 26px 22px; box-shadow: var(--shadow); animation: rise .5s cubic-bezier(.2, 1.2, .4, 1);
}
.logo-big { width: 96px; height: 96px; display: block; margin: 0 auto 6px; filter: drop-shadow(0 10px 20px rgba(255, 92, 147, .3)); }
.floaty { animation: floaty 3.2s ease-in-out infinite; }
@keyframes floaty { 50% { transform: translateY(-7px) rotate(-3deg); } }
@keyframes rise { from { transform: translateY(16px) scale(.97); opacity: 0; } }
.welcome h1 { font-size: 2.6rem; margin: 0; background: linear-gradient(135deg, var(--b1), var(--b2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.welcome h2 { margin: 0; font-size: 1.6rem; }
.sub { color: var(--muted); margin: 6px 0 20px; line-height: 1.45; }
.field { display: block; text-align: left; margin-bottom: 12px; }
.field span { display: block; font-size: .82rem; font-weight: 700; color: var(--muted); margin: 0 0 6px 4px; }
input:not([type=checkbox]):not([type=range]):not([type=radio]), textarea, select {
  width: 100%; font: inherit; color: var(--text); background: var(--surface-2);
  border: 2px solid transparent; border-radius: 16px; padding: 12px 14px; outline: none; transition: border-color .2s, background .2s;
}
input:focus, textarea:focus, select:focus { border-color: var(--b1); background: var(--surface); }
.check { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: .92rem; margin: 6px 4px; cursor: pointer; }
.check input { accent-color: var(--brand); width: 18px; height: 18px; }
.btn { border: 0; border-radius: 16px; padding: 13px 18px; font-size: 1.05rem; cursor: pointer; transition: transform .12s, filter .2s; }
.btn:active { transform: scale(.97); }
.btn.primary { width: 100%; color: #fff; background: linear-gradient(135deg, var(--b1), var(--b2)); box-shadow: 0 8px 20px color-mix(in srgb, var(--b1) 35%, transparent); }
.btn.soft { background: var(--brand-soft); color: var(--brand); }
.btn.ghost { background: var(--surface-2); }
.btn.danger { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.btn:disabled { opacity: .6; }
.error { color: var(--danger); min-height: 1.2em; margin: 6px 0; font-size: .9rem; }
.fine { font-size: .8rem; color: var(--muted); margin: 16px 0 4px; display: flex; gap: 6px; align-items: center; justify-content: center; }
.link { background: none; border: 0; color: var(--muted); font-size: .85rem; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

.pin-dots { display: flex; gap: 14px; justify-content: center; margin: 8px 0 22px; }
.pin-dots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--b1); transition: background .15s; }
.pin-dots i.on { background: var(--b1); }
.pin-dots.shake { animation: shake .4s; }
@keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
.pin-pad { display: grid; grid-template-columns: repeat(3, 72px); gap: 14px; justify-content: center; }
.pin-pad button { height: 72px; border-radius: 50%; border: 0; background: var(--surface-2); font-size: 1.5rem; font-family: Fredoka; cursor: pointer; }
.pin-pad button:active { background: var(--brand-soft); }

/* ============ app shell ============ */
.app { position: fixed; inset: 0; display: flex; flex-direction: column-reverse; }
.tabs {
  display: flex; justify-content: space-around; background: var(--surface); border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + var(--safe-b)); z-index: 10;
}
.tabs-brand { display: none; }
.tabs button {
  position: relative; flex: 1; background: none; border: 0; display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: .72rem; font-weight: 700; color: var(--muted); padding: 6px 0; cursor: pointer; border-radius: 14px; transition: color .2s;
}
.tabs button .ic { width: 24px; height: 24px; transition: transform .2s; }
.tabs button.active { color: var(--brand); }
.tabs button.active .ic { transform: translateY(-1px) scale(1.08); fill: color-mix(in srgb, var(--brand) 18%, transparent); }
.badge { position: absolute; top: 2px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--brand); color: #fff; font-size: .68rem; display: grid; place-items: center; font-style: normal; }
.view { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
.view.scroll { overflow-y: auto; padding: 0 16px 24px; }
.page-head { display: flex; align-items: center; justify-content: space-between; padding: calc(16px + var(--safe-t)) 4px 10px; }
.page-head h2 { margin: 0; font-size: 1.9rem; }
.card { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow-sm); }
.section-title { font-size: 1rem; margin: 22px 6px 10px; color: var(--muted); font-family: Nunito; font-weight: 700; }
.section-title small { font-weight: 400; }

@media (min-width: 900px) {
  .app { flex-direction: row; }
  .tabs { flex-direction: column; justify-content: flex-start; gap: 6px; width: 92px; border-top: 0; border-right: 1px solid var(--line); padding: 18px 10px; }
  .tabs-brand { display: flex; flex-direction: column; align-items: center; font-family: Fredoka; font-weight: 600; color: var(--brand); margin-bottom: 18px; }
  .tabs-brand svg { width: 44px; height: 44px; }
  .tabs button { flex: none; padding: 10px 0; }
  .tabs button.active { background: var(--brand-soft); }
  .view.scroll { padding: 0 max(24px, calc(50% - 360px)) 32px; }
}

/* ============ avatars ============ */
.avatar {
  width: 42px; height: 42px; border-radius: 50%; flex: none; position: relative;
  background: linear-gradient(135deg, var(--b1), var(--b2)); color: #fff; display: grid; place-items: center;
  font-family: Fredoka; font-weight: 600; font-size: 1.1rem; overflow: visible;
}
.avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.avatar .dot { position: absolute; right: 0; bottom: 0; width: 12px; height: 12px; border-radius: 50%; background: var(--ok); border: 2px solid var(--surface); }
.avatar.xl { width: 72px; height: 72px; font-size: 1.8rem; }
.avatar.xxl { width: 120px; height: 120px; font-size: 3rem; }
.avatar .mood-pip { position: absolute; right: -4px; top: -4px; font-size: .9rem; background: var(--surface); border-radius: 50%; width: 22px; height: 22px; display: grid; place-items: center; box-shadow: var(--shadow-sm); }

/* ============ chat ============ */
.chat-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; position: relative; z-index: 6;
  padding: calc(10px + var(--safe-t)) 12px 10px; background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--line);
}
.head-main { display: flex; align-items: center; gap: 10px; min-width: 0; cursor: pointer; }
.head-text { min-width: 0; }
.head-name { font-size: 1.12rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.head-status { font-size: .8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.head-status.live { color: var(--brand); font-weight: 700; }
.head-actions { display: flex; gap: 2px; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 50%; border: 0; background: none; color: var(--text); display: grid; place-items: center;
  cursor: pointer; transition: background .15s, transform .1s; flex: none; text-decoration: none;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn:active { transform: scale(.9); }
.icon-btn.sm { width: 34px; height: 34px; } .icon-btn.sm .ic { width: 18px; height: 18px; }
.icon-btn.tint { background: var(--brand-soft); color: var(--brand); }
.head-actions .icon-btn { color: var(--brand); }

.search-bar { position: absolute; inset: 0; background: var(--surface); display: flex; align-items: center; gap: 6px; padding: calc(8px + var(--safe-t)) 10px 8px 16px; }
.search-bar input { flex: 1; padding: 9px 12px; }
.search-bar span { font-size: .8rem; color: var(--muted); white-space: nowrap; }

.pinned-bar { display: flex; align-items: center; gap: 10px; padding: 8px 16px; background: var(--surface); border-bottom: 1px solid var(--line); cursor: pointer; font-size: .88rem; z-index: 5; }
.pinned-bar .ic { color: var(--brand); }
.pinned-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pinned-text b { color: var(--brand); font-size: .75rem; }
.pinned-text span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pinned-count { font-size: .75rem; color: var(--muted); }

.messages-wrap { flex: 1; min-height: 0; position: relative; }
.messages { position: absolute; inset: 0; overflow-y: auto; padding: 10px 12px 14px; overscroll-behavior: contain; }
/* wallpapers */
[data-wall="hearts"] .messages-wrap { background-color: var(--bg); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64' viewBox='0 0 64 64'%3E%3Cpath d='M16 22c1.5-3 6-2.4 6 1 0 2.8-4 5.2-6 6.4-2-1.2-6-3.6-6-6.4 0-3.4 4.5-4 6-1z' fill='%23ff6fa5' fill-opacity='.10'/%3E%3Cpath d='M48 50c1-2 4-1.6 4 .7 0 1.9-2.7 3.5-4 4.3-1.3-.8-4-2.4-4-4.3 0-2.3 3-2.7 4-.7z' fill='%23a78bff' fill-opacity='.12'/%3E%3C/svg%3E"); }
[data-wall="dots"] .messages-wrap { background-color: var(--bg); background-image: radial-gradient(color-mix(in srgb, var(--b2) 20%, transparent) 1.5px, transparent 1.6px); background-size: 22px 22px; }
[data-wall="sky"] .messages-wrap { background: linear-gradient(180deg, color-mix(in srgb, var(--b2) 14%, var(--bg)), color-mix(in srgb, var(--b1) 12%, var(--bg))); }
[data-wall="sunset"] .messages-wrap { background: linear-gradient(160deg, color-mix(in srgb, #ffbf5e 18%, var(--bg)), color-mix(in srgb, var(--b1) 18%, var(--bg)) 60%, color-mix(in srgb, var(--b2) 18%, var(--bg))); }
[data-wall="plain"] .messages-wrap { background: var(--bg); }

.e2e-note {
  margin: 6px auto 14px; max-width: 340px; text-align: center; font-size: .76rem; color: var(--muted); line-height: 1.4;
  background: color-mix(in srgb, var(--surface) 85%, transparent); padding: 8px 12px; border-radius: 14px; display: flex; gap: 6px; align-items: flex-start;
}
.chip { display: block; margin: 0 auto 10px; border: 0; background: var(--surface); color: var(--brand); padding: 7px 14px; border-radius: 20px; font-size: .82rem; font-weight: 700; cursor: pointer; box-shadow: var(--shadow-sm); }
.day-sep { text-align: center; margin: 14px 0 8px; position: sticky; top: 0; z-index: 2; }
.day-sep span { display: inline-block; font-size: .74rem; font-weight: 700; color: var(--muted); background: color-mix(in srgb, var(--surface) 92%, transparent); padding: 4px 12px; border-radius: 12px; box-shadow: var(--shadow-sm); }
.sys { text-align: center; font-size: .78rem; color: var(--muted); margin: 8px 0; }

.row { display: flex; margin: 1px 0; position: relative; transition: transform .2s; }
.row.me { justify-content: flex-end; }
.row.gap { margin-top: 8px; }
.row.flash .bubble { animation: flash 1.2s; }
@keyframes flash { 30% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--b1) 55%, transparent); } }
.row.new { animation: pop .28s cubic-bezier(.2, 1.3, .5, 1); }
@keyframes pop { from { transform: scale(.9) translateY(6px); opacity: 0; } }
.swipe-reply { position: absolute; left: -36px; top: 50%; margin-top: -14px; width: 28px; height: 28px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; color: var(--brand); opacity: 0; }
.bubble-col { max-width: min(78%, 520px); display: flex; flex-direction: column; }
.me .bubble-col { align-items: flex-end; }
.bubble {
  position: relative; padding: 8px 12px 6px; border-radius: 20px; line-height: 1.38; word-wrap: break-word; overflow-wrap: anywhere;
  background: var(--them); color: var(--them-text); box-shadow: var(--shadow-sm); min-width: 64px; cursor: default; user-select: text;
}
.me .bubble { background: linear-gradient(135deg, var(--b1), var(--b2)); color: var(--me-text); }
.them.tail .bubble { border-bottom-left-radius: 6px; }
.me.tail .bubble { border-bottom-right-radius: 6px; }
.bubble .txt { white-space: pre-wrap; }
.bubble .txt a { text-decoration: underline; text-underline-offset: 2px; }
.bubble code { font-family: ui-monospace, Menlo, monospace; font-size: .9em; background: rgba(0, 0, 0, .08); padding: 1px 4px; border-radius: 5px; }
.bubble.big-emoji { background: none !important; box-shadow: none; padding: 0 2px; font-size: 2.6em; line-height: 1.15; }
.bubble.big-emoji .meta { color: var(--muted); }
.bubble.media { padding: 4px; }
.bubble.media .meta-overlay { position: absolute; right: 10px; bottom: 9px; background: rgba(0, 0, 0, .38); color: #fff; padding: 1px 7px; border-radius: 10px; }
.meta { float: right; margin: 6px 0 -2px 10px; font-size: .68rem; opacity: .75; display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; user-select: none; }
.meta .ic { width: 15px; height: 15px; stroke-width: 2.4; }
.meta .tick-read { color: #fff; opacity: 1; filter: drop-shadow(0 0 2px rgba(0,0,0,.15)); }
.them .meta .ic { color: var(--muted); }
.meta .tick-pending { opacity: .6; }
.meta .read-on { color: #ffe36e; }
.quote {
  border-left: 3px solid currentColor; background: rgba(0, 0, 0, .06); border-radius: 10px; padding: 5px 9px; margin: 2px 0 6px;
  font-size: .86em; cursor: pointer; max-height: 4.2em; overflow: hidden;
}
.me .quote { background: rgba(255, 255, 255, .2); }
.quote b { display: block; font-size: .85em; }
.quote span { opacity: .85; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.deleted { font-style: italic; opacity: .7; }
.edited-tag { font-style: italic; }
.reactions { display: flex; gap: 3px; margin: -6px 8px 2px; z-index: 1; }
.reactions button { border: 2px solid var(--bg); background: var(--surface); border-radius: 14px; padding: 1px 7px; font-size: .9rem; cursor: pointer; box-shadow: var(--shadow-sm); }
.reactions button.mine { background: var(--brand-soft); }
.reactions small { font-size: .7rem; color: var(--muted); }
.photo { display: block; border-radius: 16px; max-width: 100%; max-height: 360px; min-width: 120px; min-height: 80px; object-fit: cover; cursor: zoom-in; background: var(--surface-3); }
.photo.loading { width: 240px; height: 180px; animation: shimmer 1.2s infinite; }
@keyframes shimmer { 50% { opacity: .5; } }
.caption { padding: 6px 8px 2px; }
.file-card, .loc-card, .once-card { display: flex; align-items: center; gap: 10px; padding: 4px 2px; cursor: pointer; text-decoration: none; }
.file-card i, .loc-card i, .once-card i { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; background: rgba(0, 0, 0, .07); flex: none; }
.me .file-card i, .me .loc-card i, .me .once-card i { background: rgba(255, 255, 255, .22); }
.file-card div, .loc-card div { min-width: 0; }
.file-card b, .loc-card b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-card small, .loc-card small { opacity: .7; font-size: .78rem; }
.voice { display: flex; align-items: center; gap: 8px; min-width: 220px; padding: 2px 0; }
.voice .play { width: 38px; height: 38px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .08); display: grid; place-items: center; cursor: pointer; color: inherit; flex: none; }
.me .voice .play { background: rgba(255, 255, 255, .25); }
.voice .play .ic { width: 18px; height: 18px; fill: currentColor; stroke: none; }
.voice .wave { flex: 1; height: 30px; display: flex; align-items: center; gap: 2px; cursor: pointer; }
.voice .wave i { flex: 1; background: currentColor; opacity: .35; border-radius: 2px; min-height: 3px; }
.voice .wave i.on { opacity: 1; }
.voice .speed { border: 0; background: rgba(0, 0, 0, .08); color: inherit; border-radius: 10px; font-size: .72rem; font-weight: 700; padding: 3px 6px; cursor: pointer; }
.me .voice .speed { background: rgba(255, 255, 255, .25); }
.voice .dur { font-size: .72rem; opacity: .8; min-width: 30px; }
.poll { min-width: 240px; }
.poll h4 { margin: 2px 0 8px; font-size: 1em; display: flex; gap: 6px; align-items: center; }
.poll-opt { display: block; width: 100%; text-align: left; border: 0; background: rgba(0, 0, 0, .06); color: inherit; border-radius: 12px; padding: 8px 10px; margin: 5px 0; cursor: pointer; position: relative; overflow: hidden; }
.me .poll-opt { background: rgba(255, 255, 255, .18); }
.poll-opt .fill { position: absolute; inset: 0 auto 0 0; background: currentColor; opacity: .12; transition: width .4s; }
.poll-opt .row-in { position: relative; display: flex; justify-content: space-between; gap: 8px; }
.poll-opt.voted { outline: 2px solid currentColor; }
.poll small { opacity: .75; font-size: .76rem; }
.nudge { text-align: center; margin: 10px 0; }
.nudge span { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; background: var(--surface); border-radius: 22px; box-shadow: var(--shadow-sm); font-size: .9rem; }
.nudge b { font-size: 1.4rem; }
.call-log { display: flex; align-items: center; gap: 10px; }
.call-log i { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: rgba(0, 0, 0, .07); }
.me .call-log i { background: rgba(255, 255, 255, .22); }
.call-log small { display: block; opacity: .75; font-size: .76rem; }
.exp-ic { opacity: .8; }
.sched-row { display: flex; justify-content: flex-end; margin: 6px 0; }
.sched-row .bubble { opacity: .65; border: 2px dashed var(--b1); background: var(--surface) !important; color: var(--text); }
.sched-row .sched-meta { font-size: .72rem; color: var(--brand); display: flex; gap: 6px; align-items: center; margin-top: 4px; }
.sched-row button { border: 0; background: none; color: var(--danger); font-size: .72rem; cursor: pointer; text-decoration: underline; }
mark { background: #ffe36e; color: #2e1f33; border-radius: 3px; }
.typing-row .bubble { display: flex; gap: 4px; padding: 13px 14px; }
.typing-row .bubble i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing-row .bubble i:nth-child(2) { animation-delay: .2s; } .typing-row .bubble i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

.jump-down { position: absolute; right: 14px; bottom: 12px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--surface); color: var(--brand); box-shadow: var(--shadow); display: grid; place-items: center; cursor: pointer; z-index: 3; }
.jump-down b { position: absolute; top: -6px; right: -4px; background: var(--brand); color: #fff; font-size: .7rem; border-radius: 10px; padding: 1px 6px; }
.disappear-banner { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: .76rem; color: var(--brand); background: var(--brand-soft); padding: 5px; }

.composer-wrap { position: relative; background: var(--surface); border-top: 1px solid var(--line); padding: 8px 10px calc(8px + var(--safe-b)); z-index: 6; }
.app.in-chat-mobile .composer-wrap { padding-bottom: 8px; }
.composer { display: flex; align-items: flex-end; gap: 6px; }
.composer > .icon-btn { color: var(--brand); }
.input-pill { flex: 1; display: flex; align-items: flex-end; background: var(--surface-2); border-radius: 22px; padding-right: 4px; min-height: 42px; }
.input-pill textarea { background: none !important; border: 0 !important; resize: none; max-height: 140px; padding: 10px 6px 10px 16px; line-height: 1.35; }
.input-pill .icon-btn { margin-bottom: 4px; color: var(--muted); }
.send-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 0; flex: none; cursor: pointer; color: #fff; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--b1), var(--b2)); box-shadow: 0 6px 14px color-mix(in srgb, var(--b1) 35%, transparent); transition: transform .12s;
}
.send-btn:active { transform: scale(.9); }
.reply-preview { display: flex; align-items: center; gap: 8px; margin: 0 4px 8px; padding: 6px 6px 6px 12px; border-left: 3px solid var(--brand); background: var(--surface-2); border-radius: 12px; }
.rp-body { flex: 1; min-width: 0; font-size: .85rem; }
.rp-body b { display: block; color: var(--brand); font-size: .78rem; }
.rp-body span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.recorder { display: flex; align-items: center; gap: 10px; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: blink 1s infinite; }
#rec-time { font-variant-numeric: tabular-nums; font-weight: 700; min-width: 40px; }
.rec-wave { flex: 1; height: 32px; display: flex; align-items: center; gap: 2px; overflow: hidden; justify-content: flex-end; }
.rec-wave i { width: 3px; flex: none; background: var(--brand); border-radius: 2px; }

.emoji-panel { margin: 0 2px 8px; background: var(--surface-2); border-radius: 18px; padding: 8px; animation: rise .2s; }
.ep-tabs { display: flex; gap: 6px; margin-bottom: 6px; }
.ep-tabs button { border: 0; background: none; padding: 5px 12px; border-radius: 12px; font-weight: 700; font-size: .82rem; color: var(--muted); cursor: pointer; }
.ep-tabs button.active { background: var(--surface); color: var(--brand); }
.ep-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 2px; max-height: 210px; overflow-y: auto; }
.ep-grid button { border: 0; background: none; font-size: 1.55rem; padding: 4px; border-radius: 10px; cursor: pointer; }
.ep-grid.stickers { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); }
.ep-grid.stickers button { font-size: 2.6rem; }
.ep-grid button:hover { background: var(--surface); }
.attach-menu { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 12px 6px 14px; animation: rise .2s; }
.attach-menu button { border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: .78rem; font-weight: 700; color: var(--muted); cursor: pointer; }
.attach-menu i { width: 52px; height: 52px; border-radius: 18px; display: grid; place-items: center; color: #fff; }
.a-pink { background: linear-gradient(135deg, #ff7aa8, #ff5c93); } .a-purple { background: linear-gradient(135deg, #b79bff, #8b6cff); }
.a-blue { background: linear-gradient(135deg, #6fb6ff, #4a8cff); } .a-green { background: linear-gradient(135deg, #5fdcaa, #2fbf86); }
.a-orange { background: linear-gradient(135deg, #ffb36b, #ff8a4c); } .a-teal { background: linear-gradient(135deg, #5fd3d8, #36a9c9); }

/* ============ context menu / sheets ============ */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(30, 15, 35, .35); z-index: 40; animation: fade .2s; backdrop-filter: blur(2px); }
@keyframes fade { from { opacity: 0; } }
.ctx { position: fixed; z-index: 45; display: flex; flex-direction: column; gap: 8px; animation: rise .18s; max-width: calc(100vw - 20px); }
.ctx-reacts { display: flex; gap: 2px; background: var(--surface); padding: 6px 8px; border-radius: 30px; box-shadow: var(--shadow); align-self: flex-start; }
.ctx-reacts button { border: 0; background: none; font-size: 1.6rem; width: 42px; height: 42px; border-radius: 50%; cursor: pointer; transition: transform .12s; }
.ctx-reacts button:hover { transform: scale(1.25); }
.ctx-reacts button.mine { background: var(--brand-soft); }
.ctx-menu { background: var(--surface); border-radius: 18px; box-shadow: var(--shadow); padding: 6px; min-width: 210px; align-self: flex-start; }
.ctx.right .ctx-reacts, .ctx.right .ctx-menu { align-self: flex-end; }
.ctx-menu button { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; background: none; padding: 10px 12px; border-radius: 12px; cursor: pointer; text-align: left; }
.ctx-menu button:hover { background: var(--surface-2); }
.ctx-menu button.danger { color: var(--danger); }
.ctx-menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 8px; }

.sheet {
  position: fixed; z-index: 50; left: 50%; bottom: 0; transform: translateX(-50%); width: min(520px, 100%); max-height: 88vh; overflow-y: auto;
  background: var(--surface); border-radius: 28px 28px 0 0; padding: 10px 20px calc(20px + var(--safe-b)); box-shadow: var(--shadow); animation: up .25s cubic-bezier(.2, 1, .4, 1);
}
.sheet::before { content: ''; display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 12px; }
@keyframes up { from { transform: translate(-50%, 40px); opacity: 0; } }
@media (min-width: 700px) { .sheet { bottom: 50%; transform: translate(-50%, 50%); border-radius: 28px; animation: none; } .sheet::before { display: none; } }
.sheet h3 { margin: 4px 0 4px; font-size: 1.3rem; }
.sheet p.hint { color: var(--muted); margin: 0 0 14px; font-size: .9rem; line-height: 1.45; }
.sheet .actions { display: flex; gap: 10px; margin-top: 16px; }
.sheet .actions .btn { flex: 1; }
.sheet .opt-list button { display: flex; width: 100%; justify-content: space-between; align-items: center; border: 0; background: var(--surface-2); border-radius: 14px; padding: 13px 14px; margin: 6px 0; cursor: pointer; text-align: left; }
.sheet .opt-list button.on { background: var(--brand-soft); color: var(--brand); font-weight: 700; }
.swatches { display: flex; gap: 12px; flex-wrap: wrap; margin: 8px 0; }
.swatches button { width: 46px; height: 46px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; }
.swatches button.on { border-color: var(--text); }
.walls { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 8px 0; }
.walls button { height: 70px; border-radius: 14px; border: 3px solid transparent; cursor: pointer; font-size: .7rem; color: var(--muted); display: grid; align-items: end; padding-bottom: 4px; }
.walls button.on { border-color: var(--brand); }
.poll-builder input { margin-bottom: 8px; }
.safety { font-size: 2rem; letter-spacing: 6px; text-align: center; padding: 16px; background: var(--surface-2); border-radius: 18px; line-height: 1.5; }
.safety-digits { font-family: ui-monospace, Menlo, monospace; text-align: center; color: var(--muted); margin-top: 10px; letter-spacing: 2px; }

/* ============ lists (calls, settings) ============ */
.list { overflow: hidden; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 0; background: none; width: 100%; text-align: left; cursor: pointer; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.list-item:hover { background: var(--surface-2); }
.list-item .li-ic { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; flex: none; color: #fff; }
.list-item .li-main { flex: 1; min-width: 0; }
.list-item .li-main b { display: block; font-weight: 700; }
.list-item .li-main small { color: var(--muted); font-size: .8rem; display: block; }
.list-item .li-side { color: var(--muted); font-size: .82rem; display: flex; align-items: center; gap: 6px; }
.list-item .li-side .ic { color: var(--brand); }
.list-head { padding: 14px 16px 6px; font-size: .78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; background: var(--surface); }
.missed b { color: var(--danger); }
.toggle { width: 46px; height: 28px; border-radius: 14px; background: var(--surface-3); position: relative; transition: background .2s; flex: none; }
.toggle::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .2s; }
.toggle.on { background: linear-gradient(135deg, var(--b1), var(--b2)); }
.toggle.on::after { transform: translateX(18px); }
.empty-state { text-align: center; color: var(--muted); padding: 40px 20px; }
.empty-state svg { width: 64px; height: 64px; display: block; margin: 0 auto 10px; opacity: .9; }
.profile-card { display: flex; align-items: center; gap: 16px; padding: 18px; margin-bottom: 16px; cursor: pointer; }
.pc-name { font-size: 1.35rem; }
.pc-about { color: var(--muted); font-size: .9rem; }

/* ============ us ============ */
.us-hero { text-align: center; padding: 26px 16px 22px; background: linear-gradient(135deg, color-mix(in srgb, var(--b1) 22%, var(--surface)), color-mix(in srgb, var(--b2) 22%, var(--surface))); }
.us-avatars { display: flex; align-items: center; justify-content: center; gap: 4px; }
.us-heart { font-size: 1.8rem; animation: beat 1.4s infinite; }
@keyframes beat { 15%, 45% { transform: scale(1.25); } 30% { transform: scale(1); } }
.us-days { font-size: 1.6rem; margin-top: 12px; }
.us-since { color: var(--muted); font-size: .88rem; margin-top: 2px; }
.countdown { margin-top: 12px; padding: 16px; display: flex; align-items: center; gap: 14px; cursor: pointer; }
.countdown .big { font-family: Fredoka; font-size: 2rem; color: var(--brand); min-width: 64px; text-align: center; line-height: 1; }
.countdown .big small { display: block; font-size: .7rem; color: var(--muted); font-family: Nunito; }
.countdown b { display: block; }
.countdown span { color: var(--muted); font-size: .86rem; }
.love-taps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.love-taps button { border: 0; background: var(--surface); border-radius: 20px; padding: 14px 4px 10px; cursor: pointer; box-shadow: var(--shadow-sm); font-size: .76rem; font-weight: 700; color: var(--muted); transition: transform .12s; }
.love-taps button:active { transform: scale(.92); }
.love-taps button b { display: block; font-size: 1.9rem; margin-bottom: 4px; }
.moods { display: grid; grid-template-columns: 1fr 1fr; }
.mood { padding: 16px; text-align: center; cursor: default; }
.mood + .mood { border-left: 1px solid var(--line); }
.mood.mine { cursor: pointer; }
.mood b { display: block; font-size: 2.2rem; }
.mood span { display: block; font-weight: 700; margin-top: 2px; }
.mood small { color: var(--muted); }
.qotd { padding: 18px; }
.qotd p { margin: 0 0 12px; font-size: 1.1rem; font-family: Fredoka; font-weight: 500; line-height: 1.35; }
.memories { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; border-radius: var(--r); overflow: hidden; }
.memories img, .memories .ph { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; cursor: zoom-in; background: var(--surface-3); }

/* ============ call ============ */
.call {
  position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #fff;
  background: radial-gradient(circle at 30% 20%, #ff8ab5, transparent 60%), radial-gradient(circle at 80% 80%, #9d7bff, transparent 60%), #2a1838;
}
#remote-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #120c18; }
#local-video { position: absolute; right: 16px; top: calc(16px + var(--safe-t)); width: 112px; height: 160px; object-fit: cover; border-radius: 18px; border: 2px solid rgba(255,255,255,.7); box-shadow: var(--shadow); transform: scaleX(-1); background: #120c18; z-index: 2; }
#local-video.no-mirror { transform: none; }
.call-info { position: relative; text-align: center; z-index: 1; }
.call-info .avatar { margin: 0 auto 16px; box-shadow: 0 0 0 10px rgba(255,255,255,.12), 0 0 0 22px rgba(255,255,255,.06); }
.call.ringing .call-info .avatar { animation: ringpulse 1.6s infinite; }
@keyframes ringpulse { 50% { box-shadow: 0 0 0 16px rgba(255,255,255,.18), 0 0 0 34px rgba(255,255,255,.08); } }
.call-name { font-size: 2rem; }
.call-state { opacity: .9; margin-top: 4px; font-variant-numeric: tabular-nums; }
.call-e2e { margin-top: 10px; font-size: .78rem; opacity: .75; display: flex; gap: 5px; align-items: center; justify-content: center; }
.call.has-video .call-info { position: absolute; top: calc(18px + var(--safe-t)); left: 18px; text-align: left; text-shadow: 0 1px 8px rgba(0,0,0,.5); }
.call.has-video .call-info .avatar, .call.has-video .call-e2e { display: none; }
.call.has-video .call-name { font-size: 1.3rem; }
.call-controls { position: absolute; bottom: calc(34px + var(--safe-b)); display: flex; gap: 14px; z-index: 2; padding: 10px 14px; border-radius: 40px; background: rgba(20, 10, 30, .35); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
#incoming-controls { gap: 70px; background: none; backdrop-filter: none; }
.round { width: 58px; height: 58px; border-radius: 50%; border: 0; cursor: pointer; display: grid; place-items: center; color: #fff; background: rgba(255,255,255,.18); transition: transform .1s, background .2s; }
.round:active { transform: scale(.9); }
.round.off { background: #fff; color: #2a1838; }
.round.end { background: var(--danger); }
.round.end .ic { transform: rotate(135deg); }
.round.accept { background: var(--ok); animation: wiggle 1.2s infinite; }
.round.big { width: 72px; height: 72px; }
@keyframes wiggle { 10%, 30% { transform: rotate(-12deg); } 20%, 40% { transform: rotate(12deg); } 50% { transform: none; } }

/* ============ viewer / fx / toast ============ */
.viewer { position: fixed; inset: 0; z-index: 70; background: rgba(15, 8, 20, .92); display: grid; place-items: center; animation: fade .2s; }
.viewer-body { max-width: 100vw; max-height: 100vh; display: grid; place-items: center; padding: 56px 12px 20px; }
.viewer-body img, .viewer-body video { max-width: 100%; max-height: calc(100vh - 80px); border-radius: 12px; }
.viewer .icon-btn { position: absolute; top: calc(10px + var(--safe-t)); color: #fff; z-index: 2; }
.viewer-close { right: 10px; } .viewer-dl { right: 58px; }
.viewer .icon-btn:hover { background: rgba(255,255,255,.12); }
.once-timer { position: absolute; top: calc(18px + var(--safe-t)); left: 18px; color: #fff; font-size: .85rem; opacity: .85; display: flex; gap: 6px; align-items: center; }
.fx-layer { position: fixed; inset: 0; pointer-events: none; z-index: 80; overflow: hidden; }
.fx-layer span { position: absolute; bottom: -60px; font-size: 2rem; animation: floatup var(--d, 3s) ease-in forwards; }
@keyframes floatup { to { transform: translate(var(--x, 0), -115vh) rotate(var(--r, 0deg)); opacity: .2; } }
.fx-layer .confetti { width: 9px; height: 14px; border-radius: 3px; top: -20px; bottom: auto; animation: fall var(--d, 3s) ease-in forwards; }
@keyframes fall { to { transform: translate(var(--x, 0), 110vh) rotate(var(--r, 360deg)); } }
.fx-layer .big-kiss { left: 50%; top: 50%; bottom: auto; font-size: 8rem; transform: translate(-50%, -50%); animation: kiss 1.6s ease-out forwards; }
@keyframes kiss { 0% { transform: translate(-50%, -50%) scale(.2); opacity: 0; } 25% { transform: translate(-50%, -50%) scale(1.15); opacity: 1; } 60% { transform: translate(-50%, -50%) scale(1); opacity: 1; } 100% { transform: translate(-50%, -60%) scale(1.3); opacity: 0; } }
.toast { position: fixed; left: 50%; bottom: calc(96px + var(--safe-b)); transform: translateX(-50%); z-index: 90; background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 20px; font-size: .9rem; box-shadow: var(--shadow); animation: rise .2s; max-width: 90vw; text-align: center; }
.privacy-curtain { position: fixed; inset: 0; z-index: 100; background: var(--bg); display: grid; place-items: center; }
.privacy-curtain svg { width: 90px; height: 90px; }

@media (max-width: 899px) {
  .app.chat-only .tabs { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* extras */
.ep-grid button.on { background: var(--brand-soft); outline: 2px solid var(--brand); }
.memories.none { display: block; }
.walls button[data-preview="hearts"] { background: #fff5f9 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Cpath d='M8 9c1-2 4-1.6 4 .7 0 1.9-2.7 3.5-4 4.3-1.3-.8-4-2.4-4-4.3C4 7.4 7 7 8 9z' fill='%23ff6fa5' fill-opacity='.35'/%3E%3C/svg%3E"); }
.walls button[data-preview="dots"] { background: #fff5f9; background-image: radial-gradient(#cbb8ff 1.5px, transparent 1.6px); background-size: 10px 10px; }
.walls button[data-preview="sky"] { background: linear-gradient(180deg, #e9e2ff, #ffe3ee); }
.walls button[data-preview="sunset"] { background: linear-gradient(160deg, #ffe6c2, #ffd0e0 60%, #e2d6ff); }
.walls button[data-preview="plain"] { background: var(--bg); border-color: var(--line); }
.walls button.on { border-color: var(--brand) !important; }
.li-side .rot180 { transform: rotate(180deg); }
.ph { width: 100%; aspect-ratio: 1; object-fit: cover; }
.once-card b, .once-card small { display: block; }
.once-card small { opacity: .7; font-size: .78rem; }
.ctx { display: contents; }
.ctx-reacts, .ctx-menu { position: fixed; z-index: 45; animation: rise .18s; }
.row.ctx-focus { position: relative; z-index: 44; }
.sheet-x { position: absolute; top: 12px; right: 12px; color: var(--muted); }
