/* FamTalk — family chat + calls.
   Palette follows the logo: deep blue roof, logo blue for actions + "mine", kunyit (the logo's yellow sparks) for attention. */
:root {
  --night: #0c2d6b;      /* roof + call screen */
  --night-2: #1746a2;
  --pandan: #1463e6;     /* primary action (logo blue) */
  --pandan-d: #0b4fc4;
  --mine: #dbe8ff;       /* my bubbles */
  --kunyit: #f2b33d;     /* unread, attention */
  --red: #d9463b;
  --mist: #eef3fb;       /* page */
  --paper: #ffffff;
  --ink: #17262d;
  --ink-2: #51636b;
  --line: #d6e0f0;
  --r-lg: 22px;
  --r: 14px;
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --mist: #0b1324; --paper: #131e33; --ink: #e8eefb; --ink-2: #9fb0cc; --line: #24324d;
    --mine: #173a7a; --night: #0a1f4a; --night-2: #143a86;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font); font-size: 16px; line-height: 1.45; color: var(--ink); background: var(--mist);
  -webkit-tap-highlight-color: transparent; -webkit-font-smoothing: antialiased; overscroll-behavior-y: none;
}
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--pandan); }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -0.01em; }
:focus-visible { outline: 3px solid var(--kunyit); outline-offset: 2px; }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }
.center { text-align: center; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ic { width: 22px; height: 22px; flex: none; }
[hidden] { display: none !important; }

.app { max-width: 640px; margin: 0 auto; min-height: 100%; }
.view { min-height: 100vh; min-height: 100dvh; }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px;
  border-radius: 999px; border: 1.5px solid var(--line); background: var(--paper); font-weight: 700; font-size: 15px;
  cursor: pointer; text-decoration: none; color: var(--ink); transition: transform .12s, background .15s;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--pandan); border-color: var(--pandan); color: #fff; }
.btn.primary:hover { background: var(--pandan-d); }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.danger.ghost, .btn.ghost.danger { background: transparent; color: var(--red); border-color: transparent; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.sm { min-height: 36px; padding: 6px 14px; font-size: 14px; }
.btn.lg { min-height: 54px; font-size: 17px; }
.btn.block { width: 100%; }
.btn .ic { width: 18px; height: 18px; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.is-busy { color: transparent !important; position: relative; }
.btn.is-busy::after { content: ''; position: absolute; width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid #fff; border-right-color: transparent; animation: spin .7s linear infinite; }
.btn:not(.primary):not(.danger).is-busy::after { border-color: var(--ink-2); border-right-color: transparent; }
.link-btn { background: none; border: 0; color: var(--pandan); font-weight: 700; padding: 8px; cursor: pointer; font-size: 14px; }
.icon-btn {
  width: 44px; height: 44px; display: inline-grid; place-items: center; border-radius: 50%; border: 0; background: transparent;
  color: inherit; cursor: pointer; flex: none; text-decoration: none;
}
.icon-btn:active { background: rgba(127, 127, 127, .18); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- avatars */
.avatar {
  --c: var(--pandan); position: relative; display: inline-grid; place-items: center; flex: none;
  width: 48px; height: 48px; border-radius: 50%; font-size: 26px; line-height: 1;
  background: color-mix(in srgb, var(--c) 18%, var(--paper)); box-shadow: inset 0 0 0 2.5px var(--c);
}
.avatar.xs { width: 28px; height: 28px; font-size: 15px; box-shadow: inset 0 0 0 1.5px var(--c); }
.avatar.sm { width: 38px; height: 38px; font-size: 20px; }
.avatar.lg { width: 66px; height: 66px; font-size: 36px; box-shadow: inset 0 0 0 3px var(--c); }
.avatar.xl { width: 92px; height: 92px; font-size: 50px; box-shadow: inset 0 0 0 3.5px var(--c); }
.avatar.xxl { width: 132px; height: 132px; font-size: 72px; box-shadow: inset 0 0 0 4px var(--c); }
.avatar.group { color: var(--night); background: color-mix(in srgb, var(--kunyit) 35%, var(--paper)); box-shadow: inset 0 0 0 2.5px var(--kunyit); }
.avatar.group .ic { width: 55%; height: 55%; }
.avatar .dot { position: absolute; right: 0; bottom: 0; width: 26%; height: 26%; min-width: 11px; min-height: 11px; border-radius: 50%; background: #9aa9ae; border: 2.5px solid var(--paper); }
.avatar .dot.on { background: #2fbf71; }

/* ---------------------------------------------------------------- auth */
.auth { min-height: 100vh; min-height: 100dvh; padding-bottom: 40px; }
.auth-roof { position: relative; color: #fff; padding: calc(28px + var(--safe-t)) 20px 64px; text-align: center; background: var(--night); }
.roof-shape, .house-roof {
  position: absolute; left: 0; right: 0; bottom: -1px; height: 44px; background: var(--mist);
  clip-path: polygon(0 100%, 0 70%, 50% 0, 100% 70%, 100% 100%);
}
.auth-brand h1 { font-size: 30px; font-weight: 800; margin-top: 6px; }
.auth-brand p { margin: 6px 0 0; opacity: .85; }
.brand-mark { width: 76px; height: 76px; display: inline-block; border-radius: 18px; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); }
.splash .brand-mark { width: 96px; height: 96px; border-radius: 22px; }
.auth-card { margin: 0 16px; background: var(--paper); border-radius: var(--r-lg); padding: 22px 18px; display: grid; gap: 14px; }
.auth-card h2 { font-size: 21px; }
.auth-card > p { margin: -6px 0 0; }
.who-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 12px; padding: 4px 16px 18px; }
.who { display: grid; justify-items: center; gap: 10px; padding: 18px 8px; border: 0; border-radius: var(--r-lg); background: var(--paper); cursor: pointer; font-weight: 700; font-size: 17px; }
.who:active { transform: scale(.97); }
.pin-box { display: grid; justify-items: center; gap: 6px; padding: 0 16px; text-align: center; margin-top: -30px; position: relative; }
.pin-box h2 { font-size: 24px; margin-top: 8px; }
.pin-box p { margin: 0; }
.pin-dots { display: flex; gap: 14px; margin: 14px 0 4px; min-height: 18px; }
.pin-dots i { width: 16px; height: 16px; border-radius: 50%; border: 2.5px solid var(--night-2); }
.pin-dots i.on { background: var(--night-2); }
.pin-dots.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
.pin-err { min-height: 22px; color: var(--red); font-weight: 600; font-size: 14px; }
.keypad { display: grid; grid-template-columns: repeat(3, 76px); gap: 12px; margin: 6px 0 4px; }
.keypad button { height: 76px; border-radius: 50%; border: 0; background: var(--paper); font-size: 28px; font-weight: 700; cursor: pointer; }
.keypad button:active { background: var(--line); }
.keypad .ok { background: var(--pandan); color: #fff; font-size: 16px; }

/* ---------------------------------------------------------------- forms */
.field { display: grid; gap: 6px; }
.field > span { font-weight: 700; font-size: 14px; color: var(--ink-2); }
.field input, textarea.caption, input.caption {
  width: 100%; min-height: 48px; padding: 10px 14px; border-radius: var(--r); border: 1.5px solid var(--line); background: var(--mist);
}
.field input:focus, input.caption:focus { outline: none; border-color: var(--pandan); background: var(--paper); }
.check { display: flex; gap: 10px; align-items: center; font-weight: 600; }
.check input { width: 22px; height: 22px; accent-color: var(--pandan); }
.form-error { background: color-mix(in srgb, var(--red) 12%, var(--paper)); color: var(--red); padding: 10px 14px; border-radius: var(--r); font-weight: 600; font-size: 14px; }
.emoji-row { display: flex; flex-wrap: wrap; gap: 6px; }
.emoji-opt { width: 46px; height: 46px; border-radius: 50%; border: 2px solid transparent; background: var(--mist); font-size: 24px; cursor: pointer; }
.emoji-opt.on { border-color: var(--pandan); background: var(--mine); }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { width: 38px; height: 38px; border-radius: 50%; border: 3px solid var(--paper); box-shadow: 0 0 0 1.5px var(--line); cursor: pointer; }
.swatch.on { box-shadow: 0 0 0 3px var(--ink); }

/* ---------------------------------------------------------------- home: the house */
.house { position: relative; background: var(--night); color: #fff; padding: calc(10px + var(--safe-t)) 12px 54px; }
.house-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 4px 10px 8px; }
.house-top h1 { font-size: 22px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.house-people { display: flex; gap: 6px; overflow-x: auto; padding: 4px 2px 6px; scrollbar-width: none; justify-content: safe center; }
.house-people::-webkit-scrollbar { display: none; }
.person { display: grid; justify-items: center; gap: 4px; min-width: 86px; padding: 8px 4px; border: 0; background: transparent; color: #fff; cursor: pointer; border-radius: var(--r); }
.person:active { background: rgba(255, 255, 255, .1); }
.person .avatar { --ring: var(--night); }
.person .avatar .dot { border-color: var(--night); }
.person .pn { font-weight: 700; font-size: 15px; max-width: 84px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person .ps { font-size: 12px; color: #8de3b6; line-height: 1; }
.house-empty { padding: 18px 8px; opacity: .9; text-align: center; width: 100%; }
.house-empty a { color: var(--kunyit); font-weight: 700; }
.house-sub { display: flex; align-items: center; gap: 6px; font-size: 13px; opacity: .8; margin-top: 4px; }
.house-sub .avatar { box-shadow: inset 0 0 0 1.5px var(--c); }

.notice-slot:empty { display: none; }
.notice { margin: 12px 16px 0; display: flex; gap: 12px; align-items: center; background: var(--paper); border-radius: var(--r-lg); padding: 14px; border-left: 5px solid var(--kunyit); }
.notice.warn { border-left-color: var(--red); }
.notice > .ic { color: var(--night-2); }
.notice p { margin: 2px 0 0; font-size: 13px; color: var(--ink-2); }
.notice > div { flex: 1; }

.section-h { font-size: 15px; font-weight: 800; color: var(--ink-2); padding: 16px 20px 6px; }
.chats { padding-bottom: calc(24px + var(--safe-b)); }
.chat-row { display: flex; gap: 12px; align-items: center; padding: 12px 18px; text-decoration: none; color: inherit; }
.chat-row:active { background: color-mix(in srgb, var(--line) 50%, transparent); }
.cr-main { flex: 1; min-width: 0; display: grid; gap: 2px; border-bottom: 1px solid var(--line); padding-bottom: 12px; margin-bottom: -12px; }
.cr-top, .cr-bottom { display: flex; align-items: baseline; gap: 8px; }
.cr-top b { flex: 1; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cr-top time { font-size: 12px; color: var(--ink-2); }
.cr-prev { flex: 1; font-size: 14px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cr-prev .missed { color: var(--red); font-weight: 600; }
.chat-row.unread .cr-top time { color: var(--pandan); font-weight: 700; }
.chat-row.unread .cr-prev { color: var(--ink); font-weight: 600; }
.badge { min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; background: var(--kunyit); color: #2b1d00; font-size: 12px; font-weight: 800; display: inline-grid; place-items: center; }

.person-sheet { display: grid; justify-items: center; gap: 4px; text-align: center; padding-bottom: 6px; }
.person-sheet h2 { font-size: 24px; margin-top: 10px; }
.person-sheet p { margin: 0 0 16px; }
.ps-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; }
.ps-btn { display: grid; justify-items: center; gap: 8px; padding: 16px 6px; border-radius: var(--r-lg); border: 0; background: var(--mist); color: var(--ink); font-weight: 700; font-size: 14px; cursor: pointer; text-decoration: none; }
.ps-btn .ic { width: 28px; height: 28px; color: var(--pandan); }
.ps-btn.video { background: var(--pandan); color: #fff; }
.ps-btn.video .ic { color: #fff; }

/* ---------------------------------------------------------------- chat */
.view-chat { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.chat-head { display: flex; align-items: center; gap: 8px; padding: calc(6px + var(--safe-t)) 6px 6px 4px; background: var(--night); color: #fff; flex: none; }
.chat-head .avatar .dot { border-color: var(--night); }
.ch-title { flex: 1; min-width: 0; display: grid; margin-left: 4px; }
.ch-title b { font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-sub { font-size: 12.5px; opacity: .8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-sub.typing { color: #8de3b6; opacity: 1; font-weight: 600; }
.msgs { flex: 1; overflow-y: auto; padding: 10px 10px 14px; display: flex; flex-direction: column; gap: 3px; overscroll-behavior: contain; }
.day-sep { text-align: center; margin: 12px 0 6px; }
.day-sep span { font-size: 12px; font-weight: 700; color: var(--ink-2); background: var(--paper); padding: 4px 12px; border-radius: 999px; }
.msg { display: flex; align-items: flex-end; gap: 6px; max-width: 84%; margin-top: 6px; }
.msg.cont { margin-top: 0; }
.msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.msg-face { width: 28px; flex: none; }
.bubble { background: var(--paper); border-radius: 18px 18px 18px 6px; padding: 7px 11px 6px; min-width: 64px; position: relative; overflow-wrap: anywhere; }
.msg.cont .bubble { border-radius: 6px 18px 18px 6px; }
.msg.mine .bubble { background: var(--mine); border-radius: 18px 18px 6px 18px; }
.msg.mine.cont .bubble { border-radius: 18px 6px 6px 18px; }
.bubble .who { font-size: 13px; font-weight: 800; margin-bottom: 1px; }
.bubble .txt { white-space: normal; }
.bubble .txt a { color: inherit; text-decoration: underline; }
.bubble .meta { float: right; margin: 6px 0 -2px 10px; font-size: 11px; color: var(--ink-2); display: inline-flex; align-items: center; gap: 3px; line-height: 1; }
.ticks .ic { width: 16px; height: 16px; }
.ticks.seen { color: #0b8f5a; }
.bubble.photo { padding: 4px; }
.bubble.photo .txt { padding: 4px 6px 0; }
.bubble.photo .meta { margin-right: 6px; }
.photo { display: block; border: 0; padding: 0; width: min(260px, 62vw); max-height: 340px; border-radius: 14px; overflow: hidden; background: var(--line); cursor: zoom-in; }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.deleted { font-style: italic; color: var(--ink-2); }
.msg.pending { opacity: .7; }
.msg.failed .bubble { box-shadow: inset 0 0 0 1.5px var(--red); cursor: pointer; }
.call-log { align-self: center; display: flex; align-items: center; gap: 8px; background: var(--paper); border-radius: 999px; padding: 6px 8px 6px 14px; margin: 8px 0; font-size: 14px; font-weight: 600; }
.call-log .ic { width: 18px; height: 18px; color: var(--pandan); }
.call-log time { font-size: 12px; color: var(--ink-2); font-weight: 500; }
.call-log.missed, .call-log.missed .ic { color: var(--red); }
.call-log .link-btn { padding: 4px 8px; font-size: 13px; }
.older { text-align: center; }
.chat-empty { margin: auto; text-align: center; display: grid; justify-items: center; gap: 12px; max-width: 300px; color: var(--ink-2); padding: 20px; }
.chat-empty .ic { width: 18px; height: 18px; vertical-align: -3px; }
.composer { flex: none; display: flex; align-items: flex-end; gap: 6px; padding: 8px 8px calc(8px + var(--safe-b)); background: var(--mist); border-top: 1px solid var(--line); }
.composer textarea { flex: 1; resize: none; min-height: 46px; max-height: 140px; padding: 11px 16px; border-radius: 23px; border: 1.5px solid var(--line); background: var(--paper); line-height: 1.4; }
.composer textarea:focus { outline: none; border-color: var(--pandan); }
.composer .attach { color: var(--ink-2); }
.send { width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--pandan); color: #fff; display: grid; place-items: center; cursor: pointer; flex: none; }
.send:disabled { background: var(--line); color: var(--ink-2); }
.photo-preview { width: 100%; max-height: 50vh; object-fit: contain; border-radius: var(--r); background: var(--mist); margin-bottom: 12px; }
input.caption { margin-bottom: 12px; }
.progress { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; margin-bottom: 12px; }
.progress i { display: block; height: 100%; width: 0; background: var(--pandan); transition: width .2s; }
.viewer { position: fixed; inset: 0; z-index: 60; background: rgba(5, 15, 20, .95); display: grid; place-items: center; padding: 56px 10px 70px; }
.viewer img { max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer .close { position: absolute; top: calc(8px + var(--safe-t)); right: 8px; color: #fff; }
.viewer .btn { position: absolute; bottom: calc(18px + var(--safe-b)); }

/* ---------------------------------------------------------------- settings */
.page-head { display: flex; align-items: center; gap: 6px; padding: calc(8px + var(--safe-t)) 8px 8px 4px; background: var(--night); color: #fff; }
.page-head h1 { font-size: 20px; }
.settings { padding: 14px 14px calc(30px + var(--safe-b)); display: grid; gap: 12px; }
.set-card { background: var(--paper); border-radius: var(--r-lg); padding: 16px; display: grid; gap: 10px; }
.set-card h2 { font-size: 17px; display: flex; gap: 8px; align-items: center; }
.set-card h2 .ic { color: var(--pandan); }
.set-card p { margin: 0; }
.me-card { grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; }
.me-card .grow { display: grid; }
.me-card b { font-size: 18px; }
.member-list { list-style: none; margin: 0; padding: 0; display: grid; }
.member-list li { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.member-list li:last-child { border-bottom: 0; }
.tag { font-size: 11px; font-weight: 800; background: var(--mine); color: var(--pandan-d); padding: 2px 8px; border-radius: 999px; vertical-align: 2px; }
.steps { margin: 0; padding-left: 22px; display: grid; gap: 6px; }

/* ---------------------------------------------------------------- sheets, toasts, misc */
.sheet-back { position: fixed; inset: 0; background: rgba(5, 20, 26, .45); z-index: 40; animation: fade .2s; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-width: 640px; margin: 0 auto; max-height: 90vh; overflow-y: auto;
  background: var(--paper); border-radius: 26px 26px 0 0; padding: 8px 18px calc(22px + var(--safe-b)); animation: up .25s cubic-bezier(.2, .8, .3, 1);
}
.sheet form { display: grid; gap: 14px; }
.sheet h2 { font-size: 20px; margin: 6px 0 14px; }
.sheet.closing { animation: down .22s forwards; }
.sheet-back.closing { animation: fade .22s reverse forwards; }
.grab { width: 44px; height: 5px; border-radius: 3px; background: var(--line); margin: 4px auto 8px; }
.confirm-q { font-weight: 700; font-size: 17px; text-align: center; margin: 14px 4px 20px; }
.sheet .row .btn.block { flex: 1; }
@keyframes up { from { transform: translateY(100%); } }
@keyframes down { to { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }

.toasts { position: fixed; top: calc(10px + var(--safe-t)); left: 0; right: 0; z-index: 70; display: grid; gap: 8px; justify-items: center; pointer-events: none; padding: 0 12px; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px; max-width: 520px; width: 100%; background: var(--ink); color: var(--paper);
  padding: 10px 12px 10px 16px; border-radius: 18px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); animation: drop .25s; font-weight: 600; font-size: 14px;
}
.toast .tt { flex: 1; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.toast.err { background: var(--red); color: #fff; }
.toast.out { opacity: 0; transform: translateY(-10px); transition: .3s; }
@keyframes drop { from { opacity: 0; transform: translateY(-14px); } }
.offline-bar { position: sticky; top: 0; z-index: 30; background: var(--kunyit); color: #2b1d00; text-align: center; font-size: 13px; font-weight: 700; padding: calc(6px + var(--safe-t)) 10px 6px; }
.loading { display: flex; gap: 8px; justify-content: center; padding: 60px 0; }
.loading i { width: 10px; height: 10px; border-radius: 50%; background: var(--pandan); animation: bob 1s infinite ease-in-out; }
.loading i:nth-child(2) { animation-delay: .15s; }
.loading i:nth-child(3) { animation-delay: .3s; }
@keyframes bob { 50% { transform: translateY(-10px); opacity: .5; } }
.empty { text-align: center; padding: 30px 24px; display: grid; justify-items: center; gap: 8px; }
.empty .ee { font-size: 46px; }
.empty p { margin: 0 0 8px; color: var(--ink-2); max-width: 320px; }
.splash { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 8px; font-size: 22px; color: var(--night); }

/* ---------------------------------------------------------------- call screen */
.call { position: fixed; inset: 0; z-index: 80; background: radial-gradient(120% 80% at 50% 25%, var(--night-2), var(--night) 60%, #06202a); color: #fff; overflow: hidden; display: flex; flex-direction: column; }
body.in-call { overflow: hidden; }
.call .remote { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; opacity: 0; pointer-events: none; }
.call.has-video .remote { opacity: 1; }
.call-top { position: relative; z-index: 2; text-align: center; padding: calc(40px + var(--safe-t)) 20px 0; }
.call.has-video .call-top { padding-top: calc(14px + var(--safe-t)); text-shadow: 0 1px 6px rgba(0, 0, 0, .6); text-align: left; padding-right: 130px; }
.call-name { font-size: 30px; font-weight: 800; }
.call.has-video .call-name { font-size: 20px; }
.call-status { font-size: 16px; opacity: .85; margin-top: 4px; font-variant-numeric: tabular-nums; }
.call-face { position: relative; z-index: 1; flex: 1; display: grid; place-content: center; justify-items: center; gap: 14px; }
.call.has-video .call-face { visibility: hidden; }
.call-face .avatar { background: color-mix(in srgb, var(--c) 30%, var(--night)); }
.call-face.ringing .avatar { animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: inset 0 0 0 4px var(--c), 0 0 0 0 rgba(255, 255, 255, .35); } 100% { box-shadow: inset 0 0 0 4px var(--c), 0 0 0 36px rgba(255, 255, 255, 0); } }
.cam-note { font-size: 14px; opacity: .8; }
.call .local { position: absolute; z-index: 3; top: calc(14px + var(--safe-t)); right: 14px; width: 104px; height: 150px; object-fit: cover; border-radius: 16px; background: #000; box-shadow: 0 6px 20px rgba(0, 0, 0, .4); }
.call:not(.has-video) .local { width: 92px; height: 130px; }
.call .local.mirror { transform: scaleX(-1); }
.call.st-starting .local, .call.st-outgoing .local { top: auto; bottom: calc(130px + var(--safe-b)); }
.call-bottom { position: relative; z-index: 2; padding: 0 16px calc(34px + var(--safe-b)); display: grid; justify-items: center; gap: 10px; }
.call-ctrls { display: flex; gap: 14px; justify-content: center; background: rgba(0, 0, 0, .28); padding: 12px 16px; border-radius: 999px; backdrop-filter: blur(8px); }
.cbtn { display: grid; justify-items: center; gap: 4px; border: 0; background: transparent; color: #fff; cursor: pointer; font-size: 11.5px; font-weight: 600; }
.cbtn .ic { width: 58px; height: 58px; padding: 16px; border-radius: 50%; background: rgba(255, 255, 255, .16); }
.cbtn.off .ic { background: #fff; color: var(--night); }
.cbtn.red .ic { background: var(--red); }
.cbtn.green .ic { background: #23a55a; }
.cbtn.big .ic { width: 74px; height: 74px; padding: 20px; }
.cbtn.big { font-size: 15px; }
.cbtn:disabled { opacity: .4; }
.cbtn.green.big .ic { animation: nudge 1.4s infinite; }
@keyframes nudge { 0%, 60%, 100% { transform: none; } 70% { transform: rotate(-12deg); } 80% { transform: rotate(12deg); } 90% { transform: rotate(-6deg); } }
.call-answer { display: flex; gap: 90px; justify-content: center; }
.call .link-btn { color: #fff; opacity: .85; text-decoration: underline; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}
@media (min-width: 700px) {
  .app { padding: 0; }
  .view-chat { border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
}

/* ---------------------------------------------------------------- v2: usernames, contacts, groups */
.welcome { margin: 0 16px; display: grid; gap: 12px; }
.how { background: var(--paper); border-radius: var(--r-lg); margin: 0 0 6px; padding: 18px 18px 18px 40px; display: grid; gap: 8px; }
.at-input { display: flex; align-items: center; border-radius: var(--r); border: 1.5px solid var(--line); background: var(--mist); padding-left: 14px; }
.at-input:focus-within { border-color: var(--pandan); background: var(--paper); }
.at-input b { color: var(--ink-2); font-size: 18px; }
.at-input input { flex: 1; min-width: 0; min-height: 48px; border: 0; background: transparent; padding: 10px 14px 10px 4px; font-size: 17px; }
.at-input input:focus { outline: none; }
.hint { font-size: 13px; color: var(--ink-2); }
.hint.good { color: #12855a; font-weight: 600; }
.hint.bad { color: var(--red); font-weight: 600; }
.keypad > span { display: block; }

.house-top { align-items: flex-start; }
.house-logo { width: 42px; height: 42px; border-radius: 11px; flex: none; margin-top: 2px; }
.my-username { display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; padding: 3px 10px 3px 3px; border-radius: 999px; border: 0;
  background: rgba(255, 255, 255, .14); color: #fff; font-weight: 700; font-size: 13.5px; cursor: pointer; }
.my-username .avatar { box-shadow: inset 0 0 0 1.5px var(--c); }
.house-people { justify-content: flex-start; }
.person.add .plus { background: rgba(255, 255, 255, .1); box-shadow: inset 0 0 0 2.5px rgba(255, 255, 255, .55); color: #fff; }
.person.add .plus .ic { width: 30px; height: 30px; }
.section-row { display: flex; align-items: center; justify-content: space-between; padding-right: 10px; }
.section-row .btn .ic { width: 18px; height: 18px; }
.avatar.group { font-size: 26px; }
.avatar.sm.group { font-size: 20px; }
.avatar.xl.group { font-size: 50px; }

.add-form { display: grid; gap: 12px; }
.found:empty { display: none; }
.found { display: grid; gap: 12px; margin-top: 4px; }
.found-card { display: flex; align-items: center; gap: 14px; background: var(--mist); border-radius: var(--r-lg); padding: 12px; }
.found-card .grow { display: grid; }
.found-card b { font-size: 18px; }
.share-box { display: grid; justify-items: center; text-align: center; gap: 10px; padding-bottom: 6px; }
.big-username { font-size: 28px; font-weight: 800; color: var(--pandan); letter-spacing: -0.01em; overflow-wrap: anywhere; }
.share-box p { margin: 0 0 4px; max-width: 340px; }
.center-row { justify-content: center; }
.ps-more { display: grid; gap: 6px; width: 100%; margin-top: 14px; }
.blocked-note { color: var(--red); font-weight: 700; }

.chat-head .ch-who { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; background: none; border: 0; color: inherit; padding: 4px; border-radius: 12px; cursor: pointer; text-align: left; }
.chat-head .ch-who:active { background: rgba(255, 255, 255, .1); }
.chat-head .ch-title { margin-left: 2px; }
.stranger { margin: 10px 10px 0; background: color-mix(in srgb, var(--kunyit) 22%, var(--paper)); border-radius: var(--r); padding: 12px 14px; display: grid; gap: 8px; flex: none; }
.stranger p { margin: 0; font-size: 14px; }
.blocked-bar { flex: none; text-align: center; padding: 14px 12px calc(14px + var(--safe-b)); background: var(--paper); border-top: 1px solid var(--line); font-weight: 600; color: var(--ink-2); }
.sys-line { align-self: center; font-size: 12.5px; color: var(--ink-2); background: color-mix(in srgb, var(--paper) 70%, transparent); padding: 4px 12px; border-radius: 999px; margin: 6px 0; text-align: center; }
.pick-list { display: grid; max-height: 42vh; overflow-y: auto; border-radius: var(--r); background: var(--mist); }
.pick { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.pick:last-child { border-bottom: 0; }
.pick input { width: 22px; height: 22px; accent-color: var(--pandan); }
.group-card { justify-items: center; text-align: center; }
.member-list li[data-id] { cursor: pointer; }
