:root {
  --bg: #efeae2; --panel: #f0f2f5; --bar: #ffffff; --text: #111b21; --muted: #667781;
  --me: #d9fdd3; --them: #ffffff; --accent: #00a884; --line: #e9edef; --danger: #c0392b; --chip: #e7f8f2;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b141a; --panel: #111b21; --bar: #202c33; --text: #e9edef; --muted: #8696a0;
    --me: #005c4b; --them: #202c33; --accent: #00a884; --line: #222d34; --danger: #f15c6d; --chip: #1f2c33;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
body { overscroll-behavior: none; }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }
.screen { position: fixed; inset: 0; display: flex; flex-direction: column; }
.muted { color: var(--muted); } .small { font-size: 14px; }

/* lock */
#lock { align-items: center; justify-content: center; background: var(--panel);
  padding: env(safe-area-inset-top) 16px env(safe-area-inset-bottom); }
.lock-box { width: 100%; max-width: 360px; text-align: center; }
.lock-logo { width: 84px; height: 84px; border-radius: 20px; }
h1 { margin: 12px 0 4px; font-size: 24px; }
.big { width: 100%; margin-top: 20px; padding: 14px; border: 0; border-radius: 12px; background: var(--accent);
  color: #fff; font-weight: 600; font-size: 17px; }
.big:active { transform: scale(.98); }
.link { margin-top: 18px; background: none; border: 0; color: var(--accent); font-weight: 600; }
.msg { min-height: 20px; color: var(--danger); font-size: 14px; margin: 10px 0 0; }
form#setup { text-align: left; margin-top: 8px; }
label { display: block; margin-top: 12px; font-size: 14px; color: var(--muted); }
label input { display: block; width: 100%; margin-top: 4px; padding: 12px; font-size: 16px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bar); color: var(--text); }

/* app */
.top { display: flex; align-items: center; justify-content: space-between; background: var(--bar);
  padding: calc(env(safe-area-inset-top) + 8px) 16px 8px; border-bottom: 1px solid var(--line); }
.title { font-weight: 600; font-size: 18px; display: flex; align-items: center; gap: 8px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.icon { background: none; border: 0; font-size: 24px; padding: 4px 8px; }
.menu { position: absolute; right: 12px; top: calc(env(safe-area-inset-top) + 50px); z-index: 5; background: var(--bar);
  border-radius: 12px; box-shadow: 0 6px 24px rgba(0,0,0,.25); overflow: hidden; }
.menu button { display: block; width: 100%; text-align: left; padding: 13px 18px; background: none; border: 0;
  border-bottom: 1px solid var(--line); }
.status { background: var(--chip); padding: 8px 16px; font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--line);
  max-height: 30vh; overflow: auto; }
.status div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status:empty { display: none; }
.chat { flex: 1; overflow-y: auto; padding: 10px 12px 6px; display: flex; flex-direction: column; gap: 6px;
  -webkit-overflow-scrolling: touch; }
.b { max-width: 86%; padding: 7px 10px 6px; border-radius: 10px; white-space: pre-wrap; word-wrap: break-word;
  box-shadow: 0 1px .5px rgba(0,0,0,.13); font-size: 15.5px; }
.b.me { align-self: flex-end; background: var(--me); border-top-right-radius: 3px; }
.b.them { align-self: flex-start; background: var(--them); border-top-left-radius: 3px; }
.b .t { display: block; text-align: right; font-size: 11px; color: var(--muted); margin-top: 2px; }
.b .st { display: block; font-size: 13px; color: var(--accent); font-style: italic; }
.b.err { color: var(--danger); }
.b a { color: var(--accent); }
.day { align-self: center; font-size: 12px; color: var(--muted); background: var(--bar); padding: 3px 10px; border-radius: 8px; margin: 6px 0; }
.composer { display: flex; align-items: flex-end; gap: 6px; padding: 6px 8px; background: var(--panel); }
#input { flex: 1; resize: none; max-height: 140px; padding: 10px 14px; border: 0; border-radius: 22px; font: inherit;
  background: var(--bar); color: var(--text); outline: none; }
.round { width: 44px; height: 44px; flex: none; border: 0; border-radius: 50%; background: var(--accent); color: #fff; font-size: 19px; }
.round.rec { background: var(--danger); animation: pulse 1s infinite; }
.tabs { display: flex; background: var(--bar); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tab { flex: 1; background: none; border: 0; padding: 7px 0 6px; font-size: 20px; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 1px; }
.tab span { font-size: 12px; font-weight: 600; }
.tab.on { color: var(--accent); }
