:root {
  color-scheme: light dark;
  --paper: #eef2ef;
  --paper-2: #e3e9e5;
  --ink: #1b2b2a;
  --muted: #62736f;
  --faint: #8a9a96;
  --line: #d6dfda;
  --card: #ffffff;
  --jade: #1d6b5b;
  --jade-deep: #155246;
  --jade-ink: #ffffff;
  --jade-soft: #dcebe5;
  --gold: #b9862a;
  --gold-soft: #f6ead0;
  --gold-line: #e3c88c;
  --cinnabar: #b8322a;
  --amber: #b06f0c;
  --online: #2c9f63;
  --shadow: 0 1px 1px rgba(27, 43, 42, .08);
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  --serif: ui-serif, "New York", "Songti SC", "Noto Serif SC", "Noto Serif CJK SC", Georgia, serif;
  --top: env(safe-area-inset-top, 0px);
  --bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0e1513;
    --paper-2: #141d1a;
    --ink: #e4ece9;
    --muted: #8ea19b;
    --faint: #6d7d78;
    --line: #26332f;
    --card: #18221f;
    --jade: #2a7f6c;
    --jade-deep: #1f6555;
    --jade-soft: #1b302a;
    --gold: #d9ac4f;
    --gold-soft: #2f2817;
    --gold-line: #6b5527;
    --cinnabar: #e0624f;
    --amber: #e0a440;
    --online: #3cc27e;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; width: 100%; overflow: hidden;
  background: var(--paper); color: var(--ink);
  font: 16px/1.45 var(--sans);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
body { position: fixed; inset: 0; overscroll-behavior: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--jade); outline-offset: 2px; }
svg { display: block; }

.app { position: relative; height: var(--app-h, 100dvh); width: 100%; overflow: hidden; }
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; }

/* Buttons */
.btn {
  min-height: 44px; padding: 0 18px; border-radius: 22px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); font-weight: 600; font-size: 15px;
}
.btn-primary { background: var(--jade); border-color: var(--jade); color: var(--jade-ink); }
.btn-primary:active { background: var(--jade-deep); }
.btn-quiet { background: transparent; border-color: transparent; color: var(--jade); }
.btn-danger { color: var(--cinnabar); }
.btn:disabled { opacity: .55; cursor: default; }

/* Login and notice */
.login, .notice {
  align-items: center; justify-content: center; text-align: center;
  padding: calc(var(--top) + 32px) 24px calc(var(--bottom) + 32px);
  overflow-y: auto;
}
.login-sky {
  position: absolute; inset: 0 0 auto; height: 38%; z-index: -1;
  background: linear-gradient(180deg, #7fb2d5 0%, #c3dbe9 70%, var(--paper) 100%);
}
@media (prefers-color-scheme: dark) { .login-sky { background: linear-gradient(180deg, #1c2a44 0%, #2d3d5a 70%, var(--paper) 100%); } }
.login-sky .range { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 56px; }
.seal { width: 112px; height: 112px; border-radius: 25px; box-shadow: 0 10px 30px rgba(122, 16, 22, .28); }
.notice .seal { width: 88px; height: 88px; border-radius: 20px; }
.wordmark { font: 600 34px/1.1 var(--serif); letter-spacing: .01em; margin: 18px 0 6px; }
.login-lead, .notice-text { color: var(--muted); margin: 0 0 24px; max-width: 30em; }
.login-form { display: grid; gap: 14px; width: min(340px, 100%); text-align: left; }
.login-form label { display: grid; gap: 6px; font-size: 14px; color: var(--muted); }
.login-form input, .field input, .field select, .field textarea {
  width: 100%; min-height: 46px; padding: 10px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink); font-size: 16px;
}
.login-form .btn { margin-top: 6px; }
.form-error { color: var(--cinnabar); min-height: 1.4em; margin: 14px 0 0; font-size: 14px; }
.notice-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

/* Chat header */
.top {
  display: flex; align-items: center; gap: 10px;
  padding: calc(var(--top) + 8px) 10px 8px 14px;
  background: var(--paper); border-bottom: 1px solid var(--line); z-index: 3;
}
.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--jade); color: var(--jade-ink); font-weight: 600; font-size: 16px;
}
.who { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.who strong { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status { font-size: 12.5px; color: var(--muted); min-height: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status.live { color: var(--jade); }
.icon-btn {
  position: relative; width: 44px; height: 44px; border: 0; border-radius: 12px; background: transparent;
  display: grid; place-items: center; color: var(--ink);
}
.icon-btn svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn circle { fill: currentColor; stroke: none; }
.icon-btn:active { background: var(--paper-2); }
.dot { position: absolute; top: 9px; right: 9px; width: 9px; height: 9px; border-radius: 50%; background: var(--cinnabar); border: 2px solid var(--paper); }
.avatar.group { background: var(--gold); }
@media (prefers-color-scheme: dark) { .avatar.group { color: #1f1606; } }
.chat-top { padding-left: 2px; gap: 8px; }
.back { width: auto; min-width: 44px; padding: 0 6px 0 2px; display: flex; align-items: center; color: var(--jade); }
.back svg { width: 26px; height: 26px; stroke-width: 2.2; }
.back-badge, .badge {
  flex: none; display: grid; place-items: center; border-radius: 11px; background: var(--cinnabar); color: #fff;
  font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1;
}
.back-badge { min-width: 20px; height: 20px; padding: 0 6px; font-size: 12px; }

/* Conversation list: the group chat on top, private chats below, most recent first */
.inbox-top { padding-left: 16px; }
.seal-mini { width: 36px; height: 36px; border-radius: 9px; flex: none; box-shadow: 0 3px 10px rgba(122, 16, 22, .22); }
.inbox-top .who strong { font: 600 21px/1.15 var(--serif); letter-spacing: .01em; }
.convos {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  padding: 4px max(0px, calc((100% - 680px) / 2)) calc(var(--bottom) + 20px);
}
.convo {
  position: relative; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 76px;
  padding: 10px 16px; border: 0; background: transparent; text-align: left; color: var(--ink);
}
.convo + .convo::before { content: ""; position: absolute; top: 0; left: 78px; right: 0; border-top: 1px solid var(--line); }
.convo:active { background: var(--paper-2); }
.convo .avatar { position: relative; width: 50px; height: 50px; font-size: 20px; }
.online-dot { position: absolute; right: -1px; bottom: 0; width: 14px; height: 14px; border-radius: 50%; background: var(--online); border: 2.5px solid var(--paper); }
.convo-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.convo-line { display: flex; align-items: center; gap: 6px; min-width: 0; }
.convo-name { min-width: 0; font-size: 17px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.convo-count, .convo-lock, .convo-flag { flex: none; font-size: 11.5px; line-height: 18px; padding: 0 6px; border-radius: 9px; font-weight: 600; }
.convo-count { color: var(--gold); background: var(--gold-soft); }
.convo-lock { color: var(--jade); background: var(--jade-soft); }
.convo-flag { color: var(--gold); background: var(--gold-soft); box-shadow: inset 0 0 0 1px var(--gold-line); }
.convo-time { flex: none; margin-left: auto; font-size: 12.5px; color: var(--faint); font-variant-numeric: tabular-nums; }
.convo.unread .convo-time { color: var(--cinnabar); }
.convo-preview { flex: 1; min-width: 0; font-size: 14.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.convo.unread .convo-preview { color: var(--ink); }
.convo-preview .live { color: var(--jade); }
.convo-preview .draft { color: var(--cinnabar); }
.badge { min-width: 22px; height: 22px; padding: 0 7px; font-size: 12.5px; }
.inbox-note { margin: 0; padding: 18px 28px 0; text-align: center; font-size: 12.5px; color: var(--faint); }

/* Weather sky band — the one loud element */
.sky {
  position: relative; display: block; width: 100%; border: 0; text-align: left;
  padding: 8px 16px 24px; color: #fff; overflow: hidden; z-index: 2;
  background: linear-gradient(180deg, var(--sky-a), var(--sky-b));
  transition: background .6s ease;
}
.sky .range { position: absolute; left: 0; right: 0; bottom: -1px; width: 100%; height: 22px; pointer-events: none; }
.range-far { fill: var(--range-far, rgba(255,255,255,.35)); }
.range-near { fill: var(--range-near, var(--paper)); }
.sky-clear-day { --sky-a: #3f88c5; --sky-b: #8fc0e3; --range-far: #5d8fb4; }
.sky-clear-night { --sky-a: #142340; --sky-b: #2d4470; --range-far: #23365a; }
.sky-cloud { --sky-a: #6c7f8e; --sky-b: #a9b8c3; --range-far: #7d8d99; }
.sky-fog { --sky-a: #8d9aa2; --sky-b: #c3ccd1; --range-far: #a0abb1; }
.sky-rain { --sky-a: #43596a; --sky-b: #7d93a2; --range-far: #566b7a; }
.sky-snow { --sky-a: #7f98ae; --sky-b: #c9d7e2; --range-far: #e9eff4; }
.sky-storm { --sky-a: #262d3b; --sky-b: #4c5568; --range-far: #353d4d; }
.sky-now { display: flex; align-items: center; gap: 12px; }
.sky-temp { font: 500 36px/1 var(--serif); letter-spacing: -.02em; text-shadow: 0 1px 8px rgba(0,0,0,.18); min-width: 2.2em; }
.sky-words { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.sky-text { font-weight: 600; font-size: 16px; }
.sky-sub { font-size: 13px; opacity: .9; }
/* The place name carries a small chevron: tapping the band opens the panel where the place is picked. */
.sky-place::after {
  content: ''; display: inline-block; width: 5px; height: 5px; margin: 0 8px 0 6px;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: translateY(-3px) rotate(45deg); transition: transform .2s ease;
}
.sky[aria-expanded="true"] .sky-place::after { transform: translateY(0) rotate(225deg); }
.sky.loading .sky-now, .sky.loading .sky-alerts { opacity: .55; transition: opacity .2s ease; }
.sky-icon { font-size: 30px; line-height: 1; filter: drop-shadow(0 1px 4px rgba(0,0,0,.18)); }
.sky-alerts { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.sky-alerts:empty { display: none; }
.alert-line {
  display: flex; gap: 8px; align-items: baseline; font-size: 13.5px; line-height: 1.35;
  padding: 5px 10px; border-radius: 10px; background: rgba(255,255,255,.18); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.alert-line b { flex: none; font-weight: 700; }
.alert-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alert-more { flex: none; font-size: 12px; opacity: .9; }
.alert-line.severe { background: rgba(184, 50, 42, .88); }
.alert-line.warn { background: rgba(176, 111, 12, .82); }
.sky-detail { background: var(--card); border-bottom: 1px solid var(--line); padding: 12px 16px 14px; font-size: 14px; max-height: 45%; overflow-y: auto; z-index: 2; }
.sky-detail h3 { font-size: 13px; color: var(--muted); font-weight: 600; margin: 10px 0 4px; }
.sky-detail h3:first-child { margin-top: 0; }
.sky-places { display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 10px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.place-chip {
  font: inherit; font-size: 13.5px; line-height: 1; padding: 7px 12px; border-radius: 999px; cursor: pointer;
  color: var(--ink); background: var(--paper); border: 1px solid var(--line);
}
.place-chip[aria-checked="true"] { color: var(--jade-ink); background: var(--jade); border-color: var(--jade); font-weight: 600; }
.place-chip:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.sky-detail p { margin: 2px 0; }
.sky-detail details { margin: 6px 0; }
.sky-detail summary { font-weight: 600; cursor: pointer; }
.sky-detail .official-text { white-space: pre-wrap; color: var(--muted); font-size: 13px; margin-top: 6px; }
.sky-detail .updated { color: var(--faint); font-size: 12px; margin-top: 10px; }

/* Banner */
.banner { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--gold-soft); border-bottom: 1px solid var(--gold-line); font-size: 14px; }
.banner p { margin: 0; flex: 1; }
.banner .btn { min-height: 34px; padding: 0 14px; font-size: 14px; }
.banner .x { border: 0; background: transparent; color: var(--muted); width: 32px; height: 32px; }

/* Thread */
.thread { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 10px 10px 14px; overscroll-behavior: contain; }
.older { text-align: center; padding: 6px 0 10px; }
.empty { text-align: center; color: var(--muted); padding: 40px 20px; }
.list { display: flex; flex-direction: column; }
.day { align-self: center; font-size: 12.5px; color: var(--muted); background: var(--paper-2); padding: 3px 12px; border-radius: 12px; margin: 14px 0 8px; }
.notice-line { align-self: center; font-size: 13px; color: var(--muted); margin: 6px 0; text-align: center; max-width: 90%; }

.msg { display: flex; flex-direction: column; max-width: 82%; margin-top: 8px; }
.msg.mine { align-self: flex-end; align-items: flex-end; }
.msg.theirs { align-self: flex-start; align-items: flex-start; }
.msg.mine + .msg.mine, .msg.theirs + .msg.theirs { margin-top: 3px; }
.sender { font-size: 12px; color: var(--muted); margin: 0 10px 2px; }
.bubble {
  position: relative; padding: 7px 12px 6px; border-radius: 18px; max-width: 100%;
  background: var(--card); box-shadow: var(--shadow);
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  overflow-wrap: anywhere;
}
.mine .bubble { background: var(--jade); color: var(--jade-ink); }
.mine .bubble a { color: inherit; }
.theirs .bubble a { color: var(--jade); }
.bubble .text { margin: 0; white-space: pre-wrap; }
.bubble.media { padding: 3px; overflow: hidden; }
.bubble.media .caption { padding: 4px 9px 0; margin: 0; white-space: pre-wrap; }
.stamp { display: flex; justify-content: flex-end; gap: 4px; align-items: center; font-size: 11px; opacity: .72; margin-top: 1px; line-height: 1.2; }
.bubble.media .stamp { padding: 2px 9px 4px; }
.ticks { letter-spacing: -.25em; padding-right: .25em; }
.ticks.read { color: #9be3c9; opacity: 1; }
.theirs .ticks.read { color: var(--jade); }
.pressed { transform: scale(.97); transition: transform .15s; }

.quote {
  display: block; width: 100%; text-align: left; border: 0; margin: 2px 0 5px; padding: 5px 9px; border-radius: 10px;
  background: rgba(0,0,0,.06); border-left: 3px solid var(--gold); color: inherit; font-size: 13.5px;
}
.mine .quote { background: rgba(255,255,255,.14); border-left-color: #f2d58f; }
.quote b { display: block; font-size: 12.5px; }
.quote span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: .85; }

.photo { display: block; width: 260px; max-width: 100%; max-height: 360px; object-fit: cover; border-radius: 15px; background: var(--paper-2); border: 0; padding: 0; }
.photo img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 15px; }
video.clip { display: block; width: 260px; max-width: 100%; max-height: 380px; border-radius: 15px; background: #000; }

.voice { display: flex; align-items: center; gap: 10px; min-width: 200px; padding: 2px 0; }
.voice-play { width: 38px; height: 38px; border-radius: 50%; border: 0; display: grid; place-items: center; background: var(--jade); color: #fff; flex: none; }
.mine .voice-play { background: rgba(255,255,255,.22); }
.voice-play svg { width: 18px; height: 18px; fill: currentColor; }
.voice-bar { flex: 1; height: 4px; border-radius: 2px; background: rgba(127,127,127,.3); overflow: hidden; }
.voice-fill { display: block; height: 100%; width: 0; background: currentColor; }
.voice-time { font-size: 12.5px; font-variant-numeric: tabular-nums; min-width: 2.6em; text-align: right; }

.place { display: block; width: 240px; max-width: 100%; color: inherit; text-decoration: none; }
.place-map {
  position: relative; display: block; height: 120px; border-radius: 15px; overflow: hidden;
  background-color: #dfe8de;
  background-image:
    linear-gradient(90deg, transparent 47%, #f6f3ea 47%, #f6f3ea 53%, transparent 53%),
    linear-gradient(0deg, transparent 58%, #f6f3ea 58%, #f6f3ea 63%, transparent 63%),
    linear-gradient(28deg, transparent 30%, #cfe0ee 30%, #cfe0ee 37%, transparent 37%),
    repeating-linear-gradient(90deg, transparent 0 34px, rgba(255,255,255,.55) 34px 36px),
    repeating-linear-gradient(0deg, transparent 0 28px, rgba(255,255,255,.55) 28px 30px);
}
@media (prefers-color-scheme: dark) { .place-map { background-color: #22302b; filter: brightness(.85); } }
.pin { position: absolute; left: 50%; top: 50%; width: 26px; height: 26px; margin: -26px 0 0 -13px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--cinnabar); box-shadow: 0 2px 6px rgba(0,0,0,.3); }
.pin::after { content: ""; position: absolute; inset: 8px; border-radius: 50%; background: #fff; }
.place-info { padding: 6px 9px 2px; font-size: 14px; }
.place-info b { display: block; }
.place-links { display: flex; gap: 6px; padding: 4px 6px 2px; }
.place-links a { flex: 1; text-align: center; font-size: 13px; padding: 6px 0; border-radius: 10px; background: rgba(127,127,127,.14); color: inherit; text-decoration: none; font-weight: 600; }

.reactions { display: flex; gap: 2px; margin: -6px 10px 0; padding: 1px 6px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); font-size: 14px; z-index: 1; position: relative; }

/* Pending messages */
.msg.pending .bubble { opacity: .78; }
.msg.failed .bubble { outline: 2px solid var(--cinnabar); }
.progress { height: 3px; border-radius: 2px; background: rgba(255,255,255,.35); margin: 4px 6px; overflow: hidden; }
.progress i { display: block; height: 100%; background: #fff; }
.retry { border: 0; background: transparent; color: var(--cinnabar); font-size: 12.5px; padding: 4px 6px; }

/* Appointment cards: invitation-style, gold edge, serif time */
.appt {
  width: 290px; max-width: 100%; border-radius: 18px; overflow: hidden; background: var(--card);
  border: 1px solid var(--gold-line); box-shadow: var(--shadow); color: var(--ink);
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.appt-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 14px; background: var(--gold-soft); font-size: 13px; font-weight: 600; color: var(--gold); }
.appt-head .chip { font-weight: 600; font-size: 12px; padding: 2px 9px; border-radius: 10px; background: var(--card); color: var(--muted); }
.appt[data-status="accepted"] .chip { color: var(--jade); }
.appt[data-status="pending"] .chip.mine-turn { background: var(--jade); color: #fff; }
.appt[data-status="declined"] .chip, .appt[data-status="cancelled"] .chip { color: var(--cinnabar); }
.appt-body { padding: 10px 14px 4px; }
.appt-day { font-size: 14px; color: var(--muted); }
.appt-time { font: 500 28px/1.15 var(--serif); letter-spacing: -.01em; margin: 2px 0; font-variant-numeric: lining-nums; }
.appt-title { font-weight: 600; }
.appt-note { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.appt-note::before { content: "「"; }
.appt-note::after { content: "」"; }
.rounds { list-style: none; margin: 10px 0 0; padding: 8px 0 0; border-top: 1px dashed var(--gold-line); font-size: 13px; color: var(--muted); }
.rounds li { display: flex; gap: 8px; padding: 2px 0; }
.rounds li b { color: var(--ink); font-weight: 600; flex: none; min-width: 3.4em; }
.appt-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 14px 12px; }
.appt-actions .btn { min-height: 38px; padding: 0 14px; font-size: 14.5px; flex: 1 1 auto; }
.appt-wait { padding: 8px 14px 12px; font-size: 13.5px; color: var(--muted); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.appt-wait .btn { min-height: 32px; font-size: 13px; padding: 0 10px; }
.appt.old { opacity: .7; }
.appt.old .appt-time { text-decoration: line-through; text-decoration-thickness: 1px; font-size: 22px; }
.appt .stamp { padding: 0 14px 8px; color: var(--muted); }
.event-line { align-self: center; display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); background: var(--paper-2); border-radius: 14px; padding: 5px 12px; margin: 8px 0 2px; max-width: 92%; text-align: center; }
.event-line.accept { color: var(--jade); background: var(--jade-soft); font-weight: 600; }

/* Dock */
.dock { background: var(--paper); border-top: 1px solid var(--line); padding: 6px 8px calc(var(--bottom) + 6px); z-index: 3; }
.composer { display: flex; align-items: flex-end; gap: 6px; }
.composer textarea {
  flex: 1; resize: none; min-height: 40px; max-height: 140px; padding: 9px 14px; border-radius: 20px;
  border: 1px solid var(--line); background: var(--card); font-size: 16px; line-height: 1.35;
}
.round-btn { width: 40px; height: 40px; flex: none; border-radius: 50%; border: 0; background: transparent; color: var(--jade); display: grid; place-items: center; }
.round-btn svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.round-btn.send { background: var(--jade); color: #fff; }
.round-btn.send svg { width: 20px; height: 20px; }
.round-btn:active { background: var(--jade-soft); }
.round-btn.send:active { background: var(--jade-deep); }
.invite-hint, .reply-bar { display: flex; align-items: center; gap: 8px; margin: 0 2px 6px; }
.invite-hint button:first-child {
  flex: 1; text-align: left; border: 1px solid var(--gold-line); background: var(--gold-soft); color: var(--ink);
  border-radius: 14px; padding: 8px 12px; font-size: 14px; font-weight: 600;
}
.invite-x { border: 0; background: transparent; color: var(--muted); width: 34px; height: 34px; border-radius: 50%; flex: none; }
.reply-preview { flex: 1; min-width: 0; border-left: 3px solid var(--gold); background: var(--card); border-radius: 10px; padding: 6px 10px; font-size: 13.5px; }
.reply-preview b { display: block; font-size: 12.5px; color: var(--jade); }
.reply-preview span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.recorder { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; }
.rec-live { display: flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; font-size: 17px; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--cinnabar); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .25; } }

/* Toast */
.toast {
  position: absolute; left: 50%; top: calc(var(--top) + 64px); transform: translateX(-50%); z-index: 20;
  background: var(--ink); color: var(--paper); padding: 9px 16px; border-radius: 14px; font-size: 14px; max-width: 88%; text-align: center;
  box-shadow: 0 6px 24px rgba(0,0,0,.2);
}

/* Sheets */
.scrim { position: absolute; inset: 0; background: rgba(10, 20, 18, .42); z-index: 30; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 31; max-height: 88%; overflow-y: auto;
  background: var(--paper); border-radius: 22px 22px 0 0; padding: 8px 18px calc(var(--bottom) + 18px);
  box-shadow: 0 -10px 40px rgba(0,0,0,.18); animation: rise .22s ease-out;
}
@media (min-width: 700px) { .sheet { left: 50%; right: auto; width: 560px; transform: translateX(-50%); bottom: 24px; border-radius: 22px; animation: none; } }
@keyframes rise { from { transform: translateY(24px); opacity: .6; } }
@media (prefers-reduced-motion: reduce) { .sheet { animation: none; } .sky { transition: none; } .rec-dot { animation: none; } }
.grabber { width: 38px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 10px; }
.sheet h2 { font-size: 19px; margin: 4px 0 12px; }
.sheet h3 { font-size: 14px; color: var(--muted); font-weight: 600; margin: 18px 0 8px; }
.sheet p { margin: 6px 0; }
.sheet .hint { color: var(--muted); font-size: 14px; }
.sheet .hint.error { color: var(--cinnabar); }
.sheet-actions { display: flex; gap: 10px; margin-top: 16px; }
.sheet-actions .btn { flex: 1; }
.menu-list { display: flex; flex-direction: column; background: var(--card); border-radius: 14px; overflow: hidden; border: 1px solid var(--line); }
.menu-list button, .menu-list a {
  display: flex; align-items: center; gap: 12px; min-height: 50px; padding: 0 16px; border: 0; background: transparent;
  text-align: left; font-size: 16px; color: var(--ink); text-decoration: none; border-top: 1px solid var(--line);
}
.menu-list > :first-child { border-top: 0; }
.menu-list .danger { color: var(--cinnabar); }
.menu-list .icon { width: 22px; text-align: center; }
.emoji-row { display: flex; justify-content: space-between; gap: 2px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 6px; margin-bottom: 12px; }
.emoji-row button { flex: 1 1 0; min-width: 0; padding: 0; font-size: 22px; height: 44px; border: 0; border-radius: 12px; background: transparent; }
.emoji-row button[aria-pressed="true"] { background: var(--jade-soft); }
.attach-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.attach-grid button { display: flex; flex-direction: column; align-items: center; gap: 6px; border: 0; background: transparent; font-size: 13.5px; color: var(--ink); padding: 6px 0; }
.attach-grid .tile { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; font-size: 26px; background: var(--card); border: 1px solid var(--line); }
.attach-grid .tile.gold { background: var(--gold-soft); border-color: var(--gold-line); }
.field { display: grid; gap: 6px; margin: 10px 0; font-size: 14px; color: var(--muted); }
.field textarea { min-height: 70px; resize: vertical; line-height: 1.4; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.speak-row { display: flex; gap: 8px; }
.speak-row .btn { flex: 1; }
.steps { padding-left: 1.3em; margin: 8px 0; }
.steps li { margin: 6px 0; }
.sched-group { margin-bottom: 6px; }
.sched-item { display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; border: 0; border-top: 1px solid var(--line); background: transparent; padding: 10px 2px; color: var(--ink); }
.sched-item:first-of-type { border-top: 0; }
.sched-when { font: 500 20px/1.1 var(--serif); min-width: 3.2em; }
.sched-what { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 14px; }
.sched-what span { color: var(--muted); font-size: 13px; }
.sched-empty { color: var(--muted); font-size: 14px; }
.cal-box { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.cal-box .sheet-actions { margin-top: 10px; flex-wrap: wrap; }
.cal-url { font-size: 12px; color: var(--muted); word-break: break-all; margin-top: 8px; }

/* Viewer */
.viewer { position: absolute; inset: 0; z-index: 40; background: #000; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: calc(var(--top) + 10px) 10px calc(var(--bottom) + 14px); }
.viewer img { max-width: 100%; max-height: calc(100% - 90px); object-fit: contain; -webkit-touch-callout: default; }
.viewer-tip { color: #aaa; font-size: 13px; margin: 10px 0; }

.flash { animation: flash 1.2s ease; }
@keyframes flash { 0%, 60% { filter: brightness(1.15) saturate(1.2); } }
/* Pasted or dropped photos and videos, shown before they are sent. */
.paste-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; max-height: 52vh; overflow-y: auto; }
.paste-tile { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 14px; background: var(--card); border: 1px solid var(--line); }
.paste-tile.video { display: grid; place-items: center; align-content: center; gap: 4px; font-size: 28px; color: var(--muted); }
.paste-tile .paste-name { max-width: 90%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.screen.chat.dropping .thread { outline: 3px dashed var(--gold-line); outline-offset: -10px; border-radius: 18px; background: var(--gold-soft); }
