:root {
  --bg: #e4eef1;
  --ink: #10262b;
  --muted: #5c7278;
  --line: #d5e3e7;
  --card: #ffffff;
  --accent: #0f6e78;
  --accent-deep: #0b3f46;
  --soft: #e5f3f4;
  --danger: #9c3b3b;
  --shadow: 0 18px 50px rgba(16, 48, 54, 0.12);
  color-scheme: light;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background:
    radial-gradient(900px 420px at 10% -10%, #d5ecee, transparent 60%),
    var(--bg);
  color: var(--ink);
  min-height: 100dvh;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button, input, textarea { -webkit-tap-highlight-color: transparent; }
h1, h2, p { margin: 0; }

.auth {
  min-height: 100dvh;
  display: grid;
  align-content: end;
  padding: 22px 16px calc(18px + env(safe-area-inset-bottom));
  background:
    radial-gradient(120% 70% at 80% 0%, #1c8b8a 0%, transparent 55%),
    linear-gradient(165deg, #08343a 0%, #0f6e78 48%, #d7ecee 48.2%);
}
.auth-sky { color: white; padding: 28px 8px 22px; max-width: 440px; }
.brand { letter-spacing: 0.18em; text-transform: uppercase; font-size: 12px; opacity: 0.8; }
.auth-sky h1 { font-size: 34px; line-height: 1.05; letter-spacing: -0.045em; margin-top: 10px; max-width: 12ch; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.pills span { border: 1px solid rgba(255,255,255,.35); border-radius: 999px; padding: 6px 10px; font-size: 12px; }
.card, .note, .me-card, .status-card {
  background: var(--card);
  border-radius: 28px;
  box-shadow: var(--shadow);
}
.card { padding: 22px 18px 16px; }
.card h2 { font-size: 28px; letter-spacing: -0.04em; }
.mark {
  width: 52px; height: 52px; border-radius: 18px;
  background: var(--accent); color: white;
  display: grid; place-items: center; margin-bottom: 14px;
}
.mark svg { width: 24px; height: 24px; }
.lead, .note p, .empty p { color: var(--muted); line-height: 1.45; }
.lead { margin: 6px 0 8px; }
label { display: block; font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); margin: 14px 0 6px; }
.eyebrow { display: block; margin: 0 0 2px; font-size: 13px; color: var(--muted); }
input, textarea {
  width: 100%; border: 1px solid var(--line); background: #f6fbfb;
  border-radius: 16px; padding: 14px 14px; outline: none;
}
textarea { resize: vertical; min-height: 96px; }
input:focus, textarea:focus { border-color: #8ec4c6; background: white; box-shadow: 0 0 0 4px rgba(15,110,120,.12); }
.primary, .ghost, .danger { border: 0; border-radius: 16px; padding: 14px 16px; width: 100%; margin-top: 14px; }
.primary { background: linear-gradient(180deg, #148892, var(--accent-deep)); color: white; font-weight: 700; }
.ghost { background: var(--soft); color: var(--accent-deep); }
.danger { background: #f8ecec; color: var(--danger); }
.row { display: flex; gap: 8px; }
.row > * { flex: 1; }
.error { color: var(--danger); min-height: 1.2em; margin: 8px 0 0; font-size: 14px; }
.linkish { background: none; border: 0; color: var(--accent); width: auto; margin-top: 12px; padding: 8px 0; }

.shell, .chat { min-height: 100dvh; display: flex; flex-direction: column; }
.top {
  display: flex; align-items: center; gap: 10px;
  padding: calc(14px + env(safe-area-inset-top)) 14px 12px;
  position: sticky; top: 0; z-index: 5;
  background: rgba(228, 238, 241, 0.9);
  backdrop-filter: blur(16px);
}
.top h2 { font-size: 28px; letter-spacing: -0.04em; }
.top p, #chat-sub { color: var(--muted); font-size: 13px; }
.icon, .title-btn {
  border: 0; background: white; color: var(--accent-deep);
  box-shadow: 0 6px 16px rgba(16, 48, 54, 0.06);
}
.icon {
  width: 42px; height: 42px; border-radius: 16px;
  display: grid; place-items: center; flex: 0 0 auto;
}
.icon.soft { background: white; }
.grow { flex: 1; min-width: 0; }
.scroll { flex: 1; overflow: auto; padding: 4px 14px 24px; }
.status-card { padding: 12px 12px 8px; margin-bottom: 12px; }
.status-strip { display: flex; gap: 14px; overflow-x: auto; padding: 8px 2px 6px; }
.story { width: 72px; background: none; border: 0; padding: 0; text-align: center; color: var(--ink); }
.ring {
  width: 62px; height: 62px; border-radius: 50%; margin: 0 auto 6px; padding: 3px;
  background: conic-gradient(from 210deg, #0f6e78, #9fe3df, #d4a24a, #0f6e78);
  display: grid; place-items: center;
}
.ring.seen { background: #c9d7db; }
.ring.mine { background: var(--soft); }
.ring span {
  width: 100%; height: 100%; border-radius: 50%; background: white;
  display: grid; place-items: center; font-weight: 750; color: var(--accent-deep);
}
.story small { display: block; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.finder input { margin-top: 6px; }
.conv, .person, .me-card {
  width: 100%; display: flex; gap: 12px; align-items: center; text-align: left;
  background: white; border: 0; border-radius: 22px; padding: 12px; margin-bottom: 8px;
  box-shadow: 0 8px 24px rgba(16, 48, 54, 0.05);
}
.avatar {
  width: 48px; height: 48px; border-radius: 18px; flex: 0 0 auto; position: relative;
  display: grid; place-items: center; font-weight: 750; color: white;
  background: linear-gradient(160deg, hsl(var(--hue), 42%, 42%), hsl(calc(var(--hue) + 30), 45%, 28%));
}
.dot { position: absolute; right: -2px; bottom: -2px; width: 12px; height: 12px; border-radius: 50%; background: #1f9d72; border: 2px solid white; }
.conv b, .person b, .me-card b { display: block; font-size: 16px; }
.conv .grow span, .person .grow span, .me-card span {
  display: block; color: var(--muted); font-size: 13px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.meta { margin-left: auto; display: grid; justify-items: end; gap: 6px; color: var(--muted); font-size: 12px; }
.mini-lock { width: 16px; height: 16px; color: var(--accent); display: grid; }
.mini-lock svg { width: 14px; height: 14px; }
.empty, .empty-chat { text-align: center; color: var(--muted); padding: 36px 18px; }
.empty .mark, .empty-chat .mark { margin: 0 auto 12px; }
.empty b, .empty-chat b { color: var(--ink); display: block; margin-bottom: 4px; }

.chat {
  background:
    radial-gradient(circle at 20% 10%, rgba(15,110,120,.08), transparent 28%),
    radial-gradient(circle at 80% 0%, rgba(212,162,74,.16), transparent 24%),
    linear-gradient(180deg, #e7f1f3, #f7fbfb 30%);
}
.title-btn { display: flex; gap: 10px; align-items: center; text-align: left; background: none; border: 0; box-shadow: none; flex: 1; min-width: 0; padding: 0; }
.stream { flex: 1; overflow: auto; padding: 8px 14px 12px; display: flex; flex-direction: column; gap: 7px; }
.day { align-self: center; background: rgba(255,255,255,.8); color: var(--muted); font-size: 12px; border-radius: 999px; padding: 4px 10px; }
.bubble {
  max-width: min(80%, 340px); padding: 10px 12px 7px; background: white; color: var(--ink);
  border-radius: 18px 18px 18px 6px; align-self: flex-start;
  box-shadow: 0 8px 18px rgba(16, 48, 54, 0.06);
}
.bubble.mine { background: linear-gradient(180deg, #167f88, #0e5961); color: white; align-self: flex-end; border-radius: 18px 18px 6px 18px; }
.bubble img, .bubble audio { width: min(230px, 100%); border-radius: 12px; display: block; }
.bubble .who { font-size: 12px; font-weight: 750; margin-bottom: 3px; color: #0f6e78; }
.bubble.mine .who { color: #d7f6f4; }
.time { display: block; margin-top: 4px; font-size: 11px; opacity: .78; text-align: right; }
.composer {
  display: flex; gap: 8px; align-items: flex-end;
  margin: 0 10px calc(10px + env(safe-area-inset-bottom));
  padding: 8px; background: white; border-radius: 24px;
  box-shadow: 0 10px 30px rgba(16, 48, 54, 0.08);
}
.composer textarea { min-height: 42px; max-height: 120px; border: 0; background: transparent; box-shadow: none; padding: 10px 4px; }
.composer .icon { width: 42px; height: 42px; }
.file { display: none; }
.preview-bar, .record-bar {
  margin: 0 14px 8px; background: white; border-radius: 18px; padding: 8px;
  display: flex; gap: 8px; align-items: center; box-shadow: var(--shadow);
}
.preview-bar img { width: 54px; height: 54px; object-fit: cover; border-radius: 12px; }
.menu {
  position: absolute; right: 14px; top: 72px; background: white; border-radius: 18px;
  box-shadow: var(--shadow); padding: 8px; z-index: 6; min-width: 220px;
}
.menu p { font-size: 12px; color: var(--muted); padding: 6px 10px 2px; text-transform: uppercase; letter-spacing: .04em; }
.menu button { width: 100%; text-align: left; background: none; border: 0; border-radius: 12px; padding: 11px 10px; }
.menu button:hover { background: var(--soft); }
.checks { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.check { display: flex; gap: 10px; align-items: center; background: white; border-radius: 16px; padding: 12px; }
.note, .me-card { padding: 16px; margin-top: 12px; }
.note b { display: block; margin-bottom: 4px; }
.note.warm { background: #f4efe4; }
.viewer { min-height: 100dvh; background: #102428; color: white; display: flex; flex-direction: column; }
.viewer .top { background: transparent; }
.viewer .icon { background: rgba(255,255,255,.12); color: white; box-shadow: none; }
.viewer-body { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; padding: 18px; gap: 12px; font-size: 22px; }
.viewer-body img { width: 100%; max-height: 62dvh; object-fit: contain; border-radius: 18px; }
.bars { display: flex; gap: 4px; padding: 12px 12px 0; }
.bars i { flex: 1; height: 3px; border-radius: 3px; background: rgba(255,255,255,.28); }
.bars i.on { background: white; }

@media (min-width: 860px) {
  body { background: #c9dbdf; }
  #app { max-width: 460px; min-height: 100dvh; margin: 0 auto; background: var(--bg); box-shadow: var(--shadow); }
  .auth { min-height: 100dvh; }
}
