:root {
  --app-height: 100dvh;
  --composer-height: 70px;
}

* { box-sizing: border-box; }
html { width: 100%; height: 100%; min-height: -webkit-fill-available; background: var(--ground); }
body { position: fixed; top: var(--viewport-top, 0px); right: 0; left: 0; margin: 0; width: 100%; height: var(--app-height); min-height: 0; overflow: hidden; overscroll-behavior: none; color: var(--ink); }
button, input, textarea { font: inherit; }
button { color: inherit; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.welcome {
  min-height: var(--app-height); max-width: 520px; margin: auto; padding: calc(48px + env(safe-area-inset-top)) 28px calc(40px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; align-items: center; text-align: center;
}
.welcome-name { margin-top: 24px; font-size: 11px; font-weight: 800; letter-spacing: .26em; }
.welcome h1 { max-width: 440px; margin: 16px 0; }
.welcome p { line-height: 1.55; max-width: 390px; margin: 0 0 30px; }
.welcome small { color: var(--muted); margin-top: 18px; }
.primary { border: 0; border-radius: 14px; padding: 14px 20px; font-weight: 700; cursor: pointer; }
.primary:disabled { opacity: .55; cursor: wait; }
.primary.compact { padding: 8px 14px; font-size: 12px; }

.app { height: var(--app-height); min-height: 0; display: grid; overflow: hidden; }
.sidebar { min-width: 0; border-right: 1px solid var(--line); overflow-y: auto; overscroll-behavior: contain; container: mute-sidebar / inline-size; }
.home-brand { display: flex; align-items: center; }
.home-brand > div { min-width: 0; flex: 1; display: grid; gap: 3px; }
.home-brand span:not(.home-brand-mark) { overflow: hidden; color: var(--muted); font: 400 11px/1.3 Georgia, serif; text-overflow: ellipsis; }
.identity { display: flex; align-items: center; }
.identity-card { position: relative; overflow: hidden; }
.identity-card::after { content: ""; position: absolute; right: -44px; bottom: -70px; width: 150px; height: 150px; border-radius: 50%; pointer-events: none; }
.identity-copy { flex: 1; display: grid; gap: 2px; }
.profile-avatar { width: 48px; height: 48px; flex: 0 0 auto; padding: 0; border: 0; overflow: hidden; appearance: none; -webkit-appearance: none; cursor: pointer; transition: transform .24s ease, box-shadow .24s ease; }
.profile-avatar:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
@media (hover: hover) and (pointer: fine) { .profile-avatar:hover { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(0,0,0,.24); } }
.eyebrow { display: block; color: var(--muted); text-transform: uppercase; margin-bottom: 5px; }
.identity-alias { letter-spacing: -.02em; }
.copy-button { position: relative; z-index: 1; display: grid; place-items: center; flex: 0 0 auto; border: 0; padding: 6px; background: transparent; font-size: 16px; cursor: pointer; }
.icon-button { border-radius: 50%; cursor: pointer; }
.quick-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 10px; }
.quick-action { display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; }
.quick-icon { color: var(--accent); font-size: 23px; line-height: 1; }
.connect-card { margin-bottom: 4px; animation: panel-reveal .22s ease both; }
.connect-card label { display: block; margin-bottom: 9px; }
.connect-row { display: flex; gap: 8px; }
.connect-row input { width: 100%; min-width: 0; border: 1px solid #32463b; border-radius: 12px; background: #0c1510; color: var(--ink); padding: 10px 12px; outline: none; }
.form-error { min-height: 0; color: var(--danger); font-size: 12px; margin: 8px 2px 0; }
.form-error:empty { margin: 0; }
.request-list { display: grid; gap: 8px; }
.request-card { display: grid; grid-template-columns: 38px 1fr; gap: 10px; }
.request-card .avatar { width: 38px; height: 38px; font-size: 17px; }
.request-copy { min-width: 0; display: grid; gap: 3px; font-size: 12px; line-height: 1.35; }
.request-copy strong { font-size: 14px; }
.request-copy span { color: var(--muted); }
.request-actions button { font-weight: 700; cursor: pointer; }
.request-accept { border: 0; background: var(--accent); color: var(--accent-ink); }
.request-reject { border: 1px solid var(--line); background: transparent; color: var(--muted); }
.request-actions button:disabled { opacity: .55; cursor: wait; }
.list-heading { display: flex; }
.link-button { margin-left: auto; border: 0; padding: 0; background: transparent; color: var(--muted); font-size: 11px; cursor: pointer; }
@media (hover: hover) and (pointer: fine) { .link-button:hover { color: var(--accent); } }
.chat-list { display: grid; }
.chat-item { width: 100%; display: grid; align-items: center; text-align: left; cursor: pointer; transition: opacity 200ms var(--ease-ui), background-color var(--motion-fast) ease; }
.chat-item.expiring { opacity: 0; pointer-events: none; }
.avatar { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; background: #243a2e; color: var(--accent); font-weight: 800; }
.chat-name { display: block; }
.chat-preview { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.empty-list > span { display: block; margin-bottom: 10px; font-size: 28px; }
.empty-list strong { display: block; margin-bottom: 4px; }
.empty-list p { margin: 0; }

.conversation { min-width: 0; min-height: 0; overflow: hidden; }
.conversation.empty { display: grid; place-items: center; }
.empty-chat { text-align: center; max-width: 360px; padding: 30px; color: var(--muted); }
.empty-chat h2 { color: var(--ink); }
.empty-chat p { line-height: 1.55; }
.empty-orbit { margin: auto; width: 82px; height: 82px; display: grid; place-items: center; border: 1px solid #31503f; border-radius: 50%; font-size: 28px; }
.chat-view { position: relative; height: 100%; min-height: 0; overflow: hidden; }
html.keyboard-open .composer { padding-bottom: 6px; }
/* Safari may resize both viewports, including during keyboard rotation. */
@media (hover: none) and (pointer: coarse) {
  .composer:focus-within { padding-bottom: 6px; }
}
html.keyboard-open .recording-bar { bottom: 6px; }
.chat-header { position: absolute; z-index: 5; top: 0; right: 0; left: 0; display: flex; align-items: center; gap: 12px; border: 0; -webkit-backdrop-filter: saturate(140%) blur(24px); backdrop-filter: saturate(140%) blur(24px); }
.peer { flex: 1; display: flex; flex-direction: column; }
.peer > span { color: var(--muted); letter-spacing: .01em; }
.chat-lock { color: var(--accent); font-size: 10px; filter: grayscale(.25); }
.messages { position: absolute; inset: 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; scroll-padding: 100px 0; padding: calc(92px + env(safe-area-inset-top)) max(22px, calc((100% - 760px) / 2)) calc(var(--composer-height) + 12px); display: flex; flex-direction: column; }
.message { position: relative; align-self: flex-start; transform-origin: bottom left; }
.message.mine { align-self: flex-end; }
.message.mine { transform-origin: bottom right; }
.message.removing { overflow: hidden; animation: message-leave 200ms var(--ease-ui) both; }
.bubble { position: relative; min-height: 38px; }
.message-lifetime { --life-angle: 360deg; position: absolute; right: 10px; bottom: 10px; width: 12px; height: 12px; border-radius: 50%; opacity: .78; }
.message-lifetime::after { content: ""; position: absolute; inset: 3px; border-radius: inherit; }
.bubble img { display: block; max-width: 100%; max-height: 420px; border-radius: 10px; }
.image-shell { position: relative; overflow: hidden; }
.image-shell .blur-preview { position: absolute; inset: 0; width: 100%; height: 100%; transform: scale(1.08); filter: blur(8px); }
.image-shell img { z-index: 1; opacity: 0; transition: opacity .28s ease; }
.image-shell.loaded img { opacity: 1; }
.image-shell.loaded .blur-preview { opacity: 0; transition: opacity .28s ease; }
.bubble video { display: block; width: min(340px, 68vw); max-width: 100%; max-height: 420px; border-radius: 12px; background: #000; }
.voice-note { width: min(292px, 68vw); min-height: 48px; display: grid; grid-template-columns: 38px 1fr 40px; align-items: center; gap: 10px; }
.voice-note audio { display: none; }
.voice-play { width: 38px; height: 38px; display: grid; place-items: center; border: 0; border-radius: 50%; padding: 0 0 0 2px; background: var(--accent); color: var(--accent-ink); font-size: 13px; cursor: pointer; }
.voice-play:disabled { opacity: .45; }
.voice-wave { height: 30px; display: flex; align-items: center; gap: 2px; overflow: hidden; }
.voice-wave i { width: 3px; flex: 1 1 3px; max-width: 4px; border-radius: 99px; transition: background .12s ease, transform .12s ease; }
.voice-wave i.played { transform: scaleY(1.06); }
.voice-time { font-size: 10px; font-variant-numeric: tabular-nums; text-align: right; }
.voice-error .voice-wave { opacity: .42; }
.mine .voice-play { background: #fff; color: var(--accent-strong); }
.optimistic-media .bubble { overflow: hidden; }
.upload-overlay { position: absolute; inset: 0; display: grid; place-items: center; border-radius: inherit; background: rgba(0,0,0,.35); backdrop-filter: blur(1.5px); }
.upload-overlay::before { content: ""; width: 28px; height: 28px; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; animation: upload-spin .8s linear infinite; }
.upload-failed .upload-overlay { background: rgba(100,22,22,.48); }
.upload-failed .upload-overlay::before { content: "!"; display: grid; place-items: center; border-color: #fff; color: #fff; font-weight: 800; animation: none; }
@keyframes upload-spin { to { transform: rotate(1turn); } }
.reply-quote { display: grid; gap: 2px; margin: -3px -4px 8px; padding: 6px 8px; border-left: 2px solid var(--accent); border-radius: 5px; font-size: 10px; }
.reply-quote span { opacity: .72; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message-menu { position: absolute; border: 0; border-radius: 50%; background: transparent; font-size: 11px; cursor: pointer; }
@media (hover: hover) and (pointer: fine) { .message-menu:hover { background: rgba(255,255,255,.06); color: var(--ink); } }
.message-reactions { width: max-content; margin: 3px 5px 0; padding: 3px 7px; border: 1px solid var(--line); border-radius: 99px; font-size: 12px; }
.mine .message-reactions { margin-left: auto; }
.message-meta { color: var(--muted); margin: 4px 5px 0; }
.mine .message-meta { text-align: right; }
.system-message { align-self: center; font-size: 10px; margin: 8px; }
.composer-stack { position: absolute; z-index: 5; right: 0; bottom: 0; left: 0; padding-top: 4px; -webkit-backdrop-filter: saturate(140%) blur(24px); backdrop-filter: saturate(140%) blur(24px); }
.reply-bar { width: min(820px, calc(100% - 36px)); margin: 4px auto 0; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 0; border-left: 2px solid var(--accent); border-radius: 12px; }
.reply-bar > div { min-width: 0; flex: 1; display: grid; gap: 2px; font-size: 11px; }
.reply-bar > div > span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reply-bar button { border: 0; background: transparent; color: var(--muted); font-size: 22px; cursor: pointer; }
.media-preview { width: min(820px, calc(100% - 36px)); margin: 4px auto 0; display: grid; grid-template-columns: 60px 1fr auto auto; align-items: center; gap: 10px; padding: 8px; border: 0; border-radius: 16px; background: rgba(31,39,34,.84); }
.media-preview img, .media-preview video { width: 60px; height: 60px; object-fit: cover; border-radius: 10px; background: #0a100d; }
.media-preview-copy { min-width: 0; display: grid; gap: 3px; }
.media-preview .preview-duration { grid-column: 1 / -1; margin: 0; }
.media-preview-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.media-preview-copy span { color: var(--muted); font-size: 11px; }
.attachment-menu { width: min(420px, calc(100% - 20px)); margin: 0 auto 3px; animation: attachment-rise .24s cubic-bezier(.2,.8,.2,1) both; }
.attachment-choice { display: grid; grid-template-columns: 38px 1fr; grid-template-rows: auto auto; align-items: center; column-gap: 10px; padding: 8px; border-radius: 14px; cursor: pointer; }
@media (hover: hover) and (pointer: fine) { .attachment-choice:hover { background: rgba(255,255,255,.045); } }
.attachment-choice > span { grid-row: 1 / 3; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; font-size: 20px; }
.attachment-choice strong { align-self: end; font-size: 13px; }
.attachment-choice small { align-self: start; color: var(--muted); font-size: 10px; }
.attachment-duration { display: grid; gap: 6px; margin-top: 6px; padding: 10px 8px 4px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.attachment-duration select { width: 100%; appearance: none; border: 0; border-radius: 12px; padding: 10px 12px; font-size: 12px; outline: none; }
.upload-track { height: 3px; overflow: hidden; border-radius: 99px; }
.upload-track span { display: block; width: 0; height: 100%; transition: width .15s linear; }
.preview-action, .preview-send { border: 0; cursor: pointer; }
.preview-action { width: 28px; height: 28px; border-radius: 50%; background: transparent; color: var(--muted); font-size: 22px; line-height: 1; }
.preview-send { border-radius: 10px; padding: 9px 11px; background: var(--accent); color: var(--accent-ink); font-size: 12px; font-weight: 750; white-space: nowrap; }
.preview-send:disabled, .preview-action:disabled { opacity: .55; cursor: wait; }
.reveal-image { min-width: 170px; border: 1px solid rgba(169,243,201,.35); border-radius: 12px; padding: 18px 15px; background: rgba(169,243,201,.08); color: var(--accent); font-weight: 700; cursor: pointer; }
.composer { margin: 0 auto; width: min(820px, 100%); padding: 9px 18px calc(9px + env(safe-area-inset-bottom)); display: flex; background: transparent; }
.composer textarea { flex: 1; resize: none; border: 0; border-radius: 21px; padding: 11px 15px; outline: none; transition: background .18s ease, box-shadow .18s ease; }
.attach-button, .record-button, .send-button { flex: 0 0 auto; width: 43px; height: 43px; display: grid; place-items: center; border-radius: 50%; cursor: pointer; }
.attach-button { border: 0; background: rgba(255,255,255,.07); color: var(--accent); transition: transform .22s ease, background .18s ease; }
.attach-button.open { transform: rotate(45deg); }
.record-button { border: 0; background: rgba(255,255,255,.055); color: #d7e5dc; font-size: 16px; }
.record-button.recording { animation: record-button-pulse 1.2s ease-in-out infinite; }
.send-button { border: 0; font-size: 17px; transition: transform .16s ease; }
.send-button:active { transform: scale(.94); }
.recording-bar { position: absolute; z-index: 7; right: 10px; bottom: calc(8px + env(safe-area-inset-bottom)); left: 10px; width: min(620px, calc(100% - 20px)); min-height: 54px; margin: auto; display: grid; grid-template-columns: 34px minmax(0,1fr) auto auto auto; align-items: center; gap: 9px; padding: 7px 8px 7px 10px; border: 1px solid rgba(200,93,101,.13); border-radius: 22px; box-shadow: 0 14px 40px rgba(91,53,58,.14); font-size: 12px; }
.recording-pulse { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: rgba(212,79,92,.1); }
.recording-pulse span { width: 9px; height: 9px; border-radius: 50%; background: #d44f5c; box-shadow: 0 0 0 0 rgba(212,79,92,.3); animation: recording-pulse 1.25s ease-out infinite; }
.recording-copy { min-width: 0; display: grid; gap: 2px; }
.recording-copy strong { overflow: hidden; color: #7f3941; font-size: 12px; white-space: nowrap; text-overflow: ellipsis; }
.recording-copy span { color: #9a6a70; font-size: 9px; }
.recording-copy .recording-once { display: inline-flex; align-items: center; gap: 5px; width: fit-content; color: #7f3941; font-size: 10px; cursor: pointer; }
.recording-once input { width: 14px; height: 14px; margin: 0; accent-color: #d44f5c; }
.recording-copy .recording-once span { color: inherit; font-size: inherit; }
.recording-bar time { min-width: 38px; color: #7f3941; font-size: 12px; font-weight: 750; font-variant-numeric: tabular-nums; text-align: center; }
.recording-bar button { border: 0; border-radius: 12px; padding: 0 11px; font-size: 11px; font-weight: 750; cursor: pointer; }
.recording-cancel { background: transparent; }
.recording-send { background: #d44f5c; color: #fff; }
.recording-bar.sending .recording-pulse span { border: 2px solid rgba(40,125,105,.2); border-top-color: var(--accent-strong); background: transparent; animation: upload-spin .8s linear infinite; }
.recording-bar.sending { border-color: rgba(40,125,105,.13); background: rgba(247,253,250,.98); }
.recording-bar.sending .recording-copy strong, .recording-bar.sending time { color: var(--accent-strong); }
.recording-active .composer { opacity: 0; pointer-events: none; }
@keyframes recording-pulse { 70% { box-shadow: 0 0 0 9px rgba(212,79,92,0); } }
@keyframes record-button-pulse { 50% { transform: scale(.94); } }
@keyframes panel-reveal { from { opacity: 0; transform: translateY(-5px); } }
@keyframes attachment-rise { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes message-arrive { 0% { opacity: 0; transform: translateY(12px) scale(.94); } 72% { opacity: 1; transform: translateY(-1px) scale(1.012); } 100% { transform: none; } }
@keyframes message-leave { from { opacity: 1; } to { opacity: 0; } }
@keyframes identity-shift { 45% { opacity: .55; transform: scale(.985); } }
@keyframes conversation-leave { to { opacity: 0; } }
.identity-card.identity-changing { animation: identity-shift .34s ease; }
.conversation.expiring { animation: conversation-leave 200ms var(--ease-ui) both; }

dialog { width: min(360px, calc(100% - 32px)); padding: 8px; }
.room-panel { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; padding: 20px; min-width: 0; }
.room-panel h2, .room-panel p { margin: 0; }
.room-panel label { display: grid; gap: 7px; color: var(--muted); font-size: 13px; font-weight: 700; }
.room-panel input { width: 100%; min-width: 0; box-sizing: border-box; border: 1px solid var(--line); border-radius: 14px; background: var(--panel-2); color: var(--ink); padding: 12px 13px; font: inherit; }
.room-search-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.room-search-row button, .room-result button { border: 0; border-radius: 13px; padding: 0 15px; color: white; font-weight: 800; }
.room-selected { display: flex; flex-wrap: wrap; gap: 7px; min-height: 34px; }
.room-chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel-2); color: var(--ink); font-size: 12px; }
.room-chip button { border: 0; background: transparent; color: var(--muted); padding: 0; }
.room-count { font-size: 12px; }
.room-result { display: grid; align-items: center; border: 1px solid var(--line); border-radius: 16px; padding: 10px; }
.group-avatar { position: relative; overflow: visible; background: linear-gradient(135deg, rgba(116,92,255,.3), rgba(44,208,190,.2)); }
.group-avatar img { position: absolute; width: 68%; height: 68%; border-radius: 50%; border: 2px solid var(--panel); object-fit: cover; }
.group-avatar img:first-child { left: -2px; top: 2px; }
.group-avatar img:nth-child(2) { right: -2px; bottom: 1px; }
.group-avatar img:nth-child(3) { right: -1px; top: -2px; width: 46%; height: 46%; }
.room-info-content { display: grid; gap: 12px; margin-top: 15px; text-align: left; }
.room-info-list { display: grid; gap: 7px; }
.room-info-person { display: grid; align-items: center; gap: 9px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.room-info-person .avatar { width: 34px; height: 34px; }
.room-info-person small { color: var(--muted); }
.room-info-person button { border: 0; background: transparent; color: var(--danger); }
.room-owner-tools { display: grid; gap: 8px; }
.room-owner-tools input { box-sizing: border-box; width: 100%; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); color: var(--ink); padding: 10px; }
.sender-label { color: var(--muted); font-size: 11px; font-weight: 800; margin: 5px 0 -3px 12px; }
.message.system { align-self: center; max-width: 90%; color: var(--muted); font-size: 12px; text-align: center; }
.message.system .bubble { background: transparent; border: 0; box-shadow: none; padding: 4px; }
.room-dialog { position: fixed; inset: var(--viewport-top, 0px) 0 auto; margin: 12px auto; width: min(480px, calc(100% - 24px)); max-width: none; max-height: calc(var(--app-height, 100dvh) - 24px); padding: 0; overflow: auto; overscroll-behavior: contain; border-radius: 26px; scroll-padding-block: 20px; }
.room-dialog[open] { animation: room-reveal 220ms ease both; }
.room-dialog::backdrop { backdrop-filter: blur(8px); }
.room-heading { display: grid; gap: 9px; min-width: 0; }
.room-heading h2 { font-size: clamp(23px, 6vw, 28px); line-height: 1.15; letter-spacing: -.7px; }
.room-heading p { font-size: 14px; line-height: 1.5; color: var(--muted); }
.room-participants, .room-search-section { display: grid; gap: 10px; min-width: 0; }
.room-section-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 13px; }
.room-count { font-variant-numeric: tabular-nums; border-radius: 20px; padding: 4px 9px; font-weight: 700; }
.room-chip { max-width: 100%; min-width: 0; padding: 4px 8px 4px 4px; }
.room-chip .avatar { flex: 0 0 28px; width: 28px; height: 28px; }
.room-chip > span:not(.avatar) { min-width: 0; overflow-wrap: anywhere; }
.room-chip button { min-width: var(--control-size); min-height: var(--control-size); cursor: pointer; }
.room-panel input { font-size: 16px; min-height: 46px; scroll-margin-block: 20px; }
.room-search-field { position: relative; min-width: 0; }
.room-search-field svg { position: absolute; left: 12px; top: 14px; width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 1.8; pointer-events: none; }
.room-search-field input { padding-left: 38px; }
.room-search-row button, .room-result button { min-height: 44px; font-size: 13px; cursor: pointer; }
.room-result { grid-template-columns: 32px minmax(0,1fr) auto; gap: 8px; animation: room-reveal 200ms ease; }
.room-result .avatar { width: 32px; height: 32px; }
.room-result strong { font-size: 13px; overflow-wrap: anywhere; }
.room-result button { padding-inline: 10px; }
.room-panel .form-error:empty { display: none; }
.room-name-label small { font-weight: 400; color: var(--muted); }
.room-actions { display: grid; gap: 8px; }
.room-actions #room-create { width: 100%; min-height: 48px; margin: 0; border: 0; border-radius: 15px; background: #3A76F0; color: #fff; font-weight: 750; transition: opacity 200ms ease, background 200ms ease; }
.room-actions #room-create:disabled { opacity: .42; cursor: not-allowed; }
.room-actions #room-close { width: 100%; padding: 10px 16px; margin: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--panel-2); color: var(--ink); font-size: 14px; font-weight: 650; text-align: center; cursor: pointer; }
.room-panel button:disabled { cursor: not-allowed; }
.room-panel input:focus-visible, .room-panel button:focus-visible { outline: 2px solid #3A76F0; outline-offset: 3px; }
@keyframes room-reveal { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 360px) { .room-panel { padding: 16px; gap: 12px; } }
@media (max-width: 300px) { .room-search-row { grid-template-columns: minmax(0,1fr); } }
@media (prefers-reduced-motion: reduce) { .room-dialog[open], .room-chip, .room-result { animation: none; } .room-actions #room-create { transition: none; } }
.info-expiry { margin: 0 12px 8px; color: var(--accent); line-height: 1.45; }
.info-note { margin: 0 12px 10px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.qr-panel { display: grid; place-items: center; text-align: center; }
.qr-image { width: min(250px, 72vw); aspect-ratio: 1; margin: 10px 0; padding: 10px; border-radius: 14px; background: #fff; }
.qr-panel strong { font-size: 21px; }
.qr-panel p { margin: 10px 8px 4px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.qr-connect-person { display: flex; align-items: center; gap: 12px; margin: 8px 4px 2px; }
.qr-connect-person .avatar { flex: 0 0 auto; }
.qr-connect-person div { display: grid; gap: 3px; }
.qr-connect-person span { color: var(--muted); font-size: 12px; line-height: 1.4; }
.qr-request { color: var(--accent-ink); background: var(--accent); font-weight: 750; }
.scanner-panel { padding: 12px; }
.scanner-frame { position: relative; width: 100%; aspect-ratio: 1; overflow: hidden; border: 1px solid #385345; border-radius: 16px; background: #08100c; }
.scanner-frame::before { content: ""; position: absolute; z-index: 2; inset: 16%; border: 2px solid rgba(169,243,201,.78); border-radius: 18px; box-shadow: 0 0 0 999px rgba(0,0,0,.22); pointer-events: none; }
.scanner-frame video { position: relative; z-index: 1; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .22s ease; }
.scanner-frame.camera-ready video { opacity: 1; }
.scanner-placeholder { position: absolute; z-index: 0; inset: 0; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--accent); }
.scanner-placeholder svg { width: min(46%, 150px); filter: drop-shadow(0 8px 24px rgba(58,118,240,.12)); }
.scanner-placeholder span { color: var(--muted); font-size: 12px; font-weight: 700; }
.scanner-frame.camera-ready .scanner-placeholder { opacity: 0; }
.scanner-line { position: absolute; z-index: 3; top: 25%; right: 18%; left: 18%; height: 1px; background: var(--accent); box-shadow: 0 0 10px var(--accent); animation: scanner 2.6s ease-in-out infinite alternate; }
@keyframes scanner { to { transform: translateY(150px); } }
.scanner-panel p { min-height: 34px; margin: 12px 4px; color: var(--muted); font-size: 11px; line-height: 1.45; text-align: center; }
.scan-photo { display: block; border: 1px solid var(--line); border-radius: 11px; padding: 11px; color: var(--accent); font-size: 12px; font-weight: 700; text-align: center; cursor: pointer; }
.scan-qr-dialog .scan-close-button { width: calc(100% - 24px); margin: 0 auto 8px; border-radius: 13px; color: #fff; font-weight: 750; text-align: center; }
@media (hover: hover) and (pointer: fine) { .scan-qr-dialog .scan-close-button:hover { background: #2C6BED; } }
.invite-duration { display: grid; gap: 6px; margin: 15px 4px 10px; color: var(--muted); font-size: 11px; }
.invite-duration select { width: 100%; border: 1px solid #32463b; border-radius: 11px; padding: 10px; background: #0c1510; color: var(--ink); }
.invite-create { width: 100%; }
.invite-result { display: grid; gap: 8px; margin-top: 13px; padding-top: 13px; border-top: 1px solid var(--line); }
.invite-result input { width: 100%; border: 1px solid #32463b; border-radius: 10px; padding: 9px; background: #0c1510; color: var(--ink); font-size: 11px; }
.invite-result > span { color: var(--muted); font-size: 10px; line-height: 1.4; }
.invite-result > div { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.invite-result button { border: 1px solid var(--line); border-radius: 10px; padding: 9px; background: rgba(255,255,255,.035); color: var(--ink); font-weight: 700; cursor: pointer; }
.reaction-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 8px; }
.reaction-row button { border: 1px solid var(--line); border-radius: 12px; padding: 10px 4px; background: rgba(255,255,255,.025); font-size: 22px; cursor: pointer; }
.dialog-action { width: 100%; border: 0; border-radius: 12px; padding: 13px; background: transparent; text-align: center; cursor: pointer; }
@media (hover: hover) and (pointer: fine) { .dialog-action:hover { background: rgba(255,255,255,.05); } }
.dialog-action.danger { color: var(--danger); }
.avatar-panel { padding: 12px 12px 8px; }
.username-form label { color:var(--muted); font-size:12px; }
.username-form input { width:100%; border:1px solid var(--line); border-radius:12px; padding:12px; background:var(--panel-2); color:var(--ink); font:inherit; outline:none; }
.username-form input:focus { border-color:var(--accent); box-shadow:0 0 0 3px rgba(58,118,240,.14); }
.username-form small { color:var(--muted); font-size:11px; line-height:1.4; }
.username-form .preview-send { width:100%; padding:12px; }
.notification-panel { margin: 4px 8px 8px; padding: 12px 4px 6px; border-top: 1px solid var(--line); }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 9px 8px; }
.setting-row > span { display: grid; gap: 2px; }
.setting-row small { color: var(--muted); font-size: 10px; line-height: 1.35; }
.setting-row input { width: 38px; height: 22px; accent-color: var(--accent); }
.avatar-picker { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); justify-items: center; gap: 16px 8px; margin-top: 16px; }
.avatar-option { position: relative; width: min(58px, 100%); aspect-ratio: 1; border: 1px solid var(--line); border-radius: 50%; background: var(--surface, #edf3ff); color: var(--accent); cursor: pointer; }
.avatar-option.selected { outline: 2px solid var(--accent); outline-offset: 3px; box-shadow: 0 7px 18px rgba(44,107,237,.16); }
.avatar-option.selected::after { content: "✓"; position: absolute; right: 0; bottom: 0; display: grid; place-items: center; width: 17px; height: 17px; border: 2px solid var(--panel); border-radius: 50%; background: var(--accent); color: #fff; font-size: 10px; line-height: 1; }
.avatar, .avatar-option { overflow: hidden; padding: 0; }
.avatar > img, .avatar-option > img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.options-dialog, .delete-account-dialog { position: fixed; top: var(--viewport-center-y, 50dvh); right: auto; bottom: auto; left: 50%; transform: translate(-50%, -50%); box-sizing: border-box; width: min(420px, calc(100% - 24px)); max-width: none; max-height: calc(var(--app-height, 100dvh) - 24px); margin: 0; padding: 0; border-radius: 22px; }
.options-dialog[open] { display: flex; flex-direction: column; }
.options-scroll { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.options-disclosure { border-bottom: 1px solid var(--line); }
.options-disclosure summary { display: flex; align-items: center; justify-content: space-between; padding: 3px 5px; cursor: pointer; list-style: none; }
.options-disclosure summary::-webkit-details-marker { display: none; }
.options-disclosure summary:focus-visible, .options-actions button:focus-visible, .options-footer button:focus-visible, .delete-account-actions button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.options-avatar-preview { width: 34px; height: 34px; flex: 0 0 34px; }
.options-chevron { width: 9px; height: 9px; margin-right: 9px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .2s ease; }
.options-disclosure[open] .options-chevron { transform: rotate(225deg); }
.options-dialog .avatar-picker { gap: 10px 8px; margin: 6px 0 0; }
.options-dialog .notification-panel { margin: 0; border: 0; }
.options-dialog .setting-row small { font-size: 10px; }
.options-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding-top: 12px; }
.options-actions .dialog-action { min-height: 40px; padding: 8px 9px; border: 1px solid var(--line); background: var(--panel-2); color: var(--ink); font-size: 12px; font-weight: 650; line-height: 1.25; }
.options-actions .options-wide { grid-column: 1 / -1; }
.options-actions .danger { color: var(--danger); }
.options-footer { flex: 0 0 auto; padding: 9px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--panel); }
.options-footer .dialog-action { min-height: 40px; padding: 8px; border: 1px solid var(--line); background: var(--panel-2); color: var(--ink); font-size: 13px; font-weight: 750; }
.delete-account-dialog { padding: 23px 21px 19px; }
.delete-account-dialog h2 { margin: 7px 0 9px; font-size: 22px; line-height: 1.2; }
.delete-account-dialog p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.delete-account-dialog .delete-account-error { margin-top: 8px; color: var(--danger); }
.delete-account-error:empty { display: none; }
.delete-account-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 19px; }
.delete-account-actions button { min-height: 42px; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); color: var(--ink); font: inherit; font-size: 12px; font-weight: 750; cursor: pointer; }
.delete-account-actions #confirm-delete-account, .delete-account-actions .confirm-danger { color: var(--danger); }
.delete-account-actions button:disabled { opacity: .6; cursor: wait; }
.recovery-entry { margin-top: 13px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--accent); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.recovery-setting { padding: 2px 5px 13px; }
.recovery-setting p { margin: 0 0 9px; color: var(--muted); line-height: 1.45; }
.recovery-setting button { width: 100%; min-height: 38px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel-2); color: var(--accent); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.recovery-dialog { position: fixed; top: var(--viewport-center-y, 50dvh); right: auto; bottom: auto; left: 50%; transform: translate(-50%, -50%); box-sizing: border-box; width: min(410px, calc(100% - 24px)); max-width: none; max-height: calc(var(--app-height, 100dvh) - 24px); margin: 0; padding: 22px 20px; overflow-y: auto; border-radius: 22px; }
.recovery-dialog h2 { margin: 0 0 8px; font-size: 22px; line-height: 1.2; }
.recovery-dialog > p { margin: 0 0 17px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.recovery-dialog form { display: grid; gap: 8px; }
.recovery-dialog form > label:not(.recovery-reveal) { margin-top: 5px; font-size: 12px; font-weight: 700; }
.recovery-dialog form > input { width: 100%; box-sizing: border-box; min-height: 43px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel-2); color: var(--ink); font: inherit; font-size: 16px; }
.recovery-dialog input:focus-visible, .recovery-dialog button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.recovery-reveal, .recovery-confirm { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.recovery-reveal { margin: 4px 0; }
.recovery-error { margin: 0; color: var(--danger); font-size: 12px; }
.recovery-error:empty { display: none; }
.recovery-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.recovery-actions button, .recovery-finish { min-height: 42px; padding: 8px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel-2); color: var(--ink); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.recovery-actions button:last-child, .recovery-finish { border-color: transparent; background: var(--accent); color: #fff; }
.recovery-actions button:disabled, .recovery-finish:disabled { opacity: .5; cursor: default; }
.recovery-key-value { display: block; padding: 13px 11px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); color: var(--ink); font: 700 14px/1.7 ui-monospace, SFMono-Regular, monospace; letter-spacing: .02em; overflow-wrap: anywhere; user-select: all; }
.recovery-confirm { margin: 18px 0 11px; color: var(--ink); }
.recovery-finish { width: 100%; }
.toast { position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); transform: translate(-50%, 8px); opacity: 0; pointer-events: none; border-radius: 99px; padding: 10px 16px; transition: transform 200ms var(--ease-ui), opacity 200ms var(--ease-ui); }
.toast.visible { transform: translate(-50%, 0); opacity: 1; }

@media (max-width: 700px) {
  .avatar-picker { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  html, body { background: #000; }
  .app { display: block; min-height: 0; height: var(--app-height); }
  .sidebar { height: var(--app-height); padding-bottom: calc(18px + env(safe-area-inset-bottom)); border: 0; }
  .conversation { display: none; position: absolute; top: 0; right: 0; bottom: auto; left: 0; z-index: 2; width: 100%; height: var(--app-height); min-height: 0; }
  .conversation.mobile-open { display: block; }
  .conversation.mobile-open { touch-action: auto; }
  .conversation.empty { display: none; }
  .conversation.mobile-open .chat-view { position: absolute; inset: 0; height: auto; min-height: 0; }
  .back { display: grid; }
  .chat-header { padding-left: 10px; }
  .messages { padding: calc(86px + env(safe-area-inset-top)) 13px calc(var(--composer-height) + 10px); }
  .message { max-width: 84%; }
  .composer { padding-left: 10px; padding-right: 10px; }
  .composer textarea, .connect-row input { min-width: 0; font-size: 16px; }
  .media-preview { width: calc(100% - 20px); grid-template-columns: 52px 1fr auto; }
  .reply-bar { width: calc(100% - 20px); }
  .media-preview img, .media-preview video { width: 52px; height: 52px; }
  .preview-send { grid-column: 2 / 4; }
  .home-brand { margin-top: 2px; }
  .identity-card { padding: 15px 14px; }
  .attachment-menu { width: calc(100% - 20px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Tema claro: sereno, amable y optimizado para pantallas móviles. */
.welcome-name { color: var(--accent-strong); }
.primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 8px 20px rgba(65, 158, 133, .16); }

.identity-card { border-color: rgba(77,133,117,.13); }
.copy-button, .quick-icon { color: var(--accent-strong); }
@media (hover: hover) and (pointer: fine) { .link-button:hover { color: var(--accent-strong); } }
.icon-button { border-color: var(--line); }
.quick-action { border-color: rgba(67,92,105,.1); }
.chat-item.active { border-color: rgba(40,125,105,.12); background: rgba(121,214,189,.13); }
@media (hover: hover) and (pointer: fine) { .chat-item:hover { border-color: rgba(40,125,105,.12); background: rgba(121,214,189,.13); } }
.empty-list > span { color: #9aafa5; }
@media (hover: hover) and (pointer: fine) { .message-menu:hover, .attachment-choice:hover, .dialog-action:hover { background: rgba(68,91,103,.06); } }
.send-button { background: var(--accent); color: var(--accent-ink); box-shadow: 0 7px 18px rgba(65,158,133,.2); }
.attachment-choice > span, .preview-send { background: var(--accent); color: var(--accent-ink); }
.recording-bar { color: #7f3941; }

.qr-request, .reveal-image { color: var(--accent-ink); background: rgba(121,214,189,.5); border-color: rgba(40,125,105,.2); }
@media (max-width: 700px) {
  html, body { background: var(--ground); }
  .sidebar { background: linear-gradient(160deg, #eef8f4 0%, #faf9ff 70%, #f2f6fa 100%); }
  .conversation { background: #f8fafc; }
  .recording-bar { grid-template-columns: 32px minmax(0,1fr) auto auto; gap: 6px; }
  .recording-copy > span { display: none; }
  .recording-cancel { grid-column: 1 / 3; min-height: 0 !important; justify-self: start; padding: 0 6px !important; }
  .recording-send { grid-column: 4; grid-row: 1 / 3; }
}

/* Bloqueo privado del dispositivo */
.pin-gate {
  position: fixed;
  z-index: 1000;
  inset: 0;
  width: 100%;
  height: var(--app-height);
  overflow-y: auto;
  overscroll-behavior: none;
  display: grid;
  place-items: center;
  padding: calc(24px + env(safe-area-inset-top)) 24px calc(20px + env(safe-area-inset-bottom));
}
.pin-card {
  width: min(350px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.pin-card.shake { animation: pin-shake .34s ease; }
.pin-name { margin-top: 14px; color: var(--accent-strong); font-size: 10px; font-weight: 800; letter-spacing: .25em; }
.pin-slogan { margin: 8px 0 26px; color: #61717c; font: 500 18px/1.3 Georgia, serif; }
.pin-card h1 { margin: 0 0 7px; font-size: 25px; letter-spacing: -.025em; }
.pin-help { min-height: 38px; max-width: 290px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.pin-dots { display: flex; gap: 18px; margin: 24px 0 8px; }
.pin-dots span {
  width: 13px;
  height: 13px;
  border: 1.5px solid rgba(40,125,105,.35);
  border-radius: 50%;
  transition: transform .16s ease, background .16s ease, border-color .16s ease;
}
.pin-dots span.filled { transform: scale(1.12); }
.pin-error { min-height: 18px; margin: 0 0 8px; color: var(--danger); font-size: 12px; font-variant-numeric: tabular-nums; }
.pin-keypad { width: min(270px, 82vw); display: grid; grid-template-columns: repeat(3, 1fr); gap: 11px 18px; }
.pin-key {
  width: 66px;
  height: 66px;
  justify-self: center;
  border-radius: 50%;
  font-size: 23px;
  font-weight: 520;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform .1s ease, background .1s ease;
}
.pin-key:active { transform: scale(.92); }
.pin-delete { box-shadow: none; font-size: 21px; }
.pin-reset { margin-top: 17px; border: 0; padding: 7px 10px; background: transparent; color: var(--accent-strong); font-size: 13px; cursor: pointer; }
.pin-reset:disabled { opacity: .55; }
.pin-privacy { margin-top: 7px; font-size: 10px; }
body.pin-locked { user-select: none; }

@keyframes pin-shake {
  20%, 60% { transform: translateX(-7px); }
  40%, 80% { transform: translateX(7px); }
}

@media (max-height: 680px) {
  .pin-gate { place-items: start center; padding-top: calc(14px + env(safe-area-inset-top)); }
  .pin-name { margin-top: 8px; }
  .pin-slogan { margin: 5px 0 14px; font-size: 15px; }
  .pin-dots { margin: 14px 0 5px; }
  .pin-key { width: 54px; height: 54px; }
  .pin-keypad { gap: 7px 16px; }
  .pin-reset { margin-top: 8px; }
}

/* Paleta Mute: Signal Blue */
:root {
  --lavender: #3A76F0;
}

body {
  background:
    radial-gradient(circle at 10% 0%, rgba(58,118,240,.09), transparent 34%),
    radial-gradient(circle at 96% 92%, rgba(44,107,237,.06), transparent 30%),
    #FFFFFF;
}
.welcome-name, .copy-button, .quick-icon { color: #2C6BED; }
@media (hover: hover) and (pointer: fine) { .link-button:hover { color: #2C6BED; } }
.welcome p { color: #5E5E5E; }
.primary, .send-button, .attachment-choice > span, .preview-send { background: #3A76F0; color: #FFFFFF; }
.primary, .send-button { box-shadow: 0 8px 20px rgba(58,118,240,.22); }

.sidebar { border-right-color: var(--line); }
.identity-card, .connect-card, .request-card { border-color: rgba(58,118,240,.12); background: rgba(255,255,255,.9); }
.identity-card::after { background: radial-gradient(circle, rgba(58,118,240,.13), transparent 68%); }
.icon-button, .quick-action { border-color: var(--line); background: rgba(255,255,255,.82); }
.quick-action[aria-expanded="true"], .chat-item.active { border-color: rgba(58,118,240,.18); background: rgba(58,118,240,.09); }
@media (hover: hover) and (pointer: fine) { .quick-action:hover, .chat-item:hover { border-color: rgba(58,118,240,.18); background: rgba(58,118,240,.09); } }
.connect-row input, .invite-duration select, .invite-result input { border-color: rgba(27,27,27,.13); background: #FFFFFF; color: #1B1B1B; }
.connect-row input:focus { border-color: #3A76F0; box-shadow: 0 0 0 3px rgba(58,118,240,.16); }
.chat-time, .empty-list > span { color: #5E5E5E; }
.avatar, .avatar-option { background: #EAF0FF; color: #2C6BED; }

.conversation { background: #F6F6F6; }
.chat-lock, .message-status { color: #2C6BED; }
.mine .message-lifetime { background: conic-gradient(#FFFFFF var(--life-angle), rgba(255,255,255,.25) 0); }
.image-shell { background: #E9E9E9; }
.reply-quote { background: rgba(255,255,255,.18); border-left-color: currentColor; }
.voice-wave i { background: #CFCFCF; }
.mine .voice-wave i { background: rgba(255,255,255,.4); }
.mine .voice-wave i.played { background: #FFFFFF; }
.mine .voice-time { color: rgba(255,255,255,.8); }

.composer textarea { background: #FFFFFF; color: #1B1B1B; box-shadow: inset 0 0 0 1px rgba(27,27,27,.09), 0 5px 18px rgba(27,27,27,.04); }
.composer textarea:focus { background: #FFFFFF; box-shadow: inset 0 0 0 1px rgba(58,118,240,.35), 0 5px 18px rgba(27,27,27,.05); }
.attachment-menu, .media-preview, .reply-bar { border: 1px solid rgba(27,27,27,.09); }
.attachment-duration select { background: #F6F6F6; color: #1B1B1B; }
.upload-track { background: rgba(58,118,240,.14); }
.upload-track span { background: #3A76F0; }
.reveal-image, .qr-request { color: #FFFFFF; background: #3A76F0; border-color: #2C6BED; }
.once-viewer { width: min(94vw, 760px); max-height: 90dvh; padding: 16px; }
.once-viewer img { display: block; max-width: 100%; max-height: 72dvh; object-fit: contain; margin: 14px auto 0; }
.once-viewer video { display: block; width: min(100%, 720px); max-height: 72dvh; margin: 14px auto 0; border-radius: 12px; background: #000; }
.once-viewer .voice-note { width: min(292px, 72vw); margin: 18px auto 4px; }
.scanner-frame::before { border-color: #3A76F0; }

dialog { border-color: rgba(27,27,27,.12); }
.reaction-row button, .invite-result button { border-color: var(--line); background: #F6F6F6; color: #1B1B1B; }
.toast { border-color: rgba(58,118,240,.14); }

.pin-name, .pin-reset { color: #2C6BED; }
.pin-slogan, .pin-help, .pin-delete { color: #5E5E5E; }
.pin-privacy { color: #5E5E5E; }

@media (max-width: 700px) {
  html, body { background: #FFFFFF; }
  .sidebar { background: linear-gradient(160deg, #FFFFFF 0%, #F6F6F6 100%); }
  .conversation { background: #F6F6F6; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #FFFFFF;
    --muted: #F6F6F6;
    --ground: #1B1B1B;
    --panel: #2B2B2B;
    --panel-2: #2B2B2B;
    --line: rgba(255,255,255,.11);
    --accent: #3A76F0;
    --accent-strong: #2C6BED;
    --accent-ink: #FFFFFF;
    --soft-shadow: 0 12px 36px rgba(0,0,0,.22);
  }
  html, body { background: #1B1B1B; }
  body { background: radial-gradient(circle at 10% 0%, rgba(58,118,240,.14), transparent 32%), #1B1B1B; }
  .welcome { background: radial-gradient(circle at 50% 34%, rgba(58,118,240,.18), transparent 36%); }
  .icon-button, .quick-action { background: #2B2B2B; color: #FFFFFF; }
  .welcome p, .quick-action, .connect-card label, .chat-time, .empty-list > span, .system-message { color: #F6F6F6; opacity: .74; }
  .sidebar, .sidebar:is(*) { background: linear-gradient(160deg, #1B1B1B 0%, #2B2B2B 100%); }
  .identity-card, .connect-card, .request-card { background: #2B2B2B; border-color: rgba(58,118,240,.2); }
  .connect-row input, .invite-duration select, .invite-result input { background: #1B1B1B; color: #FFFFFF; border-color: rgba(255,255,255,.14); }
  .conversation, .conversation:is(*) { background: #1B1B1B; }
  .empty-list strong { color: #FFFFFF; }
  .avatar, .avatar-option, .avatar[data-avatar], .avatar-option[data-avatar] { background: rgba(58,118,240,.2); color: #FFFFFF; }
  .empty-orbit { background: #2B2B2B; color: #3A76F0; }
  .chat-header { background: linear-gradient(to bottom, rgba(27,27,27,.96), rgba(27,27,27,.78)); border-bottom-color: rgba(255,255,255,.08); }
  .bubble { background: #2B2B2B; color: #FFFFFF; box-shadow: 0 5px 18px rgba(0,0,0,.14); }
  .mine .bubble { background: #3A76F0; color: #FFFFFF; }
  .message-lifetime::after { background: #2B2B2B; }
  .mine .message-lifetime::after { background: #3A76F0; }
  .message-reactions { background: #2B2B2B; }
  .composer-stack { background: linear-gradient(to top, rgba(27,27,27,.98), rgba(27,27,27,.8)); border-top-color: rgba(255,255,255,.08); }
  .composer textarea, .composer textarea:focus, .attach-button, .record-button { background: #2B2B2B; color: #FFFFFF; box-shadow: inset 0 0 0 1px rgba(255,255,255,.1); }
  .attachment-menu, .media-preview, .reply-bar { background: rgba(43,43,43,.98); border-color: rgba(255,255,255,.1); }
  .attachment-duration select, .reaction-row button, .invite-result button { background: #1B1B1B; color: #FFFFFF; }
  dialog { background: #2B2B2B; color: #FFFFFF; border-color: rgba(255,255,255,.12); }
  .toast { background: #2B2B2B; color: #FFFFFF; border-color: rgba(58,118,240,.25); }
  .pin-gate { background: radial-gradient(circle at 50% 15%, rgba(58,118,240,.22), transparent 34%), #1B1B1B; }
  .pin-card { color: #FFFFFF; }
  .pin-key { background: #2B2B2B; color: #FFFFFF; border-color: rgba(255,255,255,.1); }
  .pin-slogan, .pin-help, .pin-delete, .pin-privacy { color: #F6F6F6; opacity: .74; }
  .pin-dots span { background: #2B2B2B; }
  .pin-dots span.filled { background: #3A76F0; }
}

/* Marca Mute y navegación del encabezado */
.brand-mark, .home-brand-mark, .pin-brand {
  display: block;
  object-fit: contain;
  flex-shrink: 0;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
  filter: none;
  transform: none;
}
.brand-mark { width: 72px; height: 72px; }
.pin-brand { width: 64px; height: 64px; }
.back {
  position: relative;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 15px;
  box-shadow: none;
  transition: background .18s ease, transform .15s ease;
  font-size: 0;
  line-height: 1;
}
.back svg {
  display: block;
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
@media (hover: hover) and (pointer: fine) { .back:hover { background: rgba(58,118,240,.15); } }
.back:active { transform: scale(.94); }
.back:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
@media (prefers-color-scheme: dark) {
  .back { color: #9DBBFF; background: rgba(58,118,240,.18); }
}
@media (prefers-reduced-motion: reduce) {
  .back { transition: none; }
  .back:active { transform: none; }
}

/* Onboarding, privacidad y bandeja de solicitudes */
.requests-toggle {
  width: 100%; display: flex; align-items: center; justify-content: space-between; padding: 0 13px; font-size: 13px; font-weight: 700; cursor: pointer;
}
.requests-chevron { width: 7px; height: 7px; border-right: 1.7px solid currentColor; border-bottom: 1.7px solid currentColor; transform: rotate(45deg); transition: transform .18s ease; }
.requests-toggle[aria-expanded="true"] .requests-chevron { transform: rotate(225deg); }
.request-list { margin-top: 8px; }
.request-actions { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); }
.request-actions button { min-width: 0; padding: 8px 6px; }
.request-block { border: 1px solid rgba(201,62,62,.2); }

.attachment-menu { display: grid; gap: 6px; }
.attachment-choice { margin: 0; }

.onboarding-dialog { width: min(430px, calc(100% - 28px)); padding: 0; overflow: hidden; border-radius: 24px; }
.onboarding-card { display: flex; flex-direction: column; }
.onboarding-topline { display: flex; align-items: center; justify-content: space-between; }
.onboarding-topline .welcome-name { margin: 0; }
.onboarding-topline button { border: 0; padding: 8px; background: transparent; color: var(--muted); font-size: 13px; cursor: pointer; }
.onboarding-visual { position: relative; }
.onboarding-visual::before, .onboarding-visual::after { content: ""; position: absolute; inset: 34px; border: 2px solid #3A76F0; border-radius: 50%; }
.onboarding-visual[data-visual="orbit"]::after { inset: 76px; border: 0; background: #3A76F0; box-shadow: 42px -25px 0 -5px #9DBBFF, -41px 29px 0 -7px #2C6BED; }
.onboarding-visual[data-visual="orbit"]::before, .onboarding-visual[data-visual="orbit"]::after { display: none; }
.onboarding-talk-icon { display: block; width: 100%; height: 100%; padding: 20px; box-sizing: border-box; color: var(--accent-strong); filter: drop-shadow(0 5px 10px rgba(58,118,240,.12)); }
.onboarding-visual:not([data-visual="orbit"]) .onboarding-talk-icon { display: none; }
.onboarding-visual[data-visual="shield"]::before { inset: 34px 45px 31px; border-radius: 34px 34px 45px 45px; clip-path: polygon(50% 0,100% 18%,91% 72%,50% 100%,9% 72%,0 18%); background: rgba(58,118,240,.12); }
.onboarding-visual[data-visual="shield"]::after { inset: 70px 58px; border-width: 0 0 3px 3px; border-radius: 0; transform: rotate(-45deg); }
.onboarding-visual[data-visual="alias"]::before { content: "@"; inset: 31px; display: grid; place-items: center; border: 0; color: #3A76F0; font-size: 74px; font-weight: 760; }
.onboarding-visual[data-visual="alias"]::after { display: none; }
.onboarding-visual[data-visual="clock"]::before, .onboarding-visual[data-visual="clock"]::after, .onboarding-visual[data-visual="profile"]::before, .onboarding-visual[data-visual="profile"]::after { display: none; }
.privacy-illustration { display: none; position: absolute; inset: 0; width: 100%; height: 100%; box-sizing: border-box; padding: 20px; color: var(--accent-strong); filter: drop-shadow(0 5px 10px rgba(58,118,240,.12)); }
.onboarding-visual[data-visual="clock"] .privacy-clock-icon, .onboarding-visual[data-visual="profile"] .privacy-profile-icon { display: block; }
.onboarding-step { font-size: 12px; font-weight: 760; font-variant-numeric: tabular-nums; }
.onboarding-card h2 { margin: 10px 0 9px; letter-spacing: -.035em; }
.onboarding-card p { margin: 0; color: var(--muted); }
.onboarding-dots { display: flex; gap: 6px; margin: 20px 0; }
.onboarding-dots span { width: 7px; height: 7px; border-radius: 99px; background: rgba(94,94,94,.24); transition: width .2s ease, background .2s ease; }
.onboarding-dots span.active { width: 22px; background: #3A76F0; }
.onboarding-continue { width: 100%; }
.onboarding-actions { display: grid; grid-template-columns: minmax(0,1fr); gap: 8px; margin-top: auto; }
.onboarding-actions.has-back { grid-template-columns: minmax(0,1fr) minmax(0,1.4fr); }
.onboarding-continue { margin-top: 0; }
.onboarding-back { min-height: var(--control-size); border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); color: var(--ink); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
.onboarding-back[hidden] { display: none; }

.privacy-dialog { width: min(430px, calc(100% - 28px)); padding: 0; overflow: hidden; border-radius: 24px; }

/* Identidad pública */
.username-dialog { width: min(430px, calc(100% - 24px)); max-height: min(90dvh, 720px); padding: 0; overflow: hidden; border-radius: 26px; border-color: var(--line); }
.username-dialog[open] { animation: username-dialog-in .22s cubic-bezier(.2,.8,.2,1) both; }
.username-dialog[open]::backdrop { animation: username-backdrop-in .2s ease both; }
.username-panel { overflow-y: auto; overscroll-behavior: contain; padding: 28px 26px calc(20px + env(safe-area-inset-bottom)); scrollbar-width: thin; }
.username-header { display: grid; gap: 7px; }
.username-header h2 { margin: 0; line-height: 1.12; letter-spacing: -.035em; }
.username-intro { margin: 2px 0 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.username-state { display: grid; gap: 14px; margin-top: 22px; }
.username-state[hidden], .username-success[hidden] { display: none; }
.username-current { margin: 0; color: var(--muted); font-size: 13px; }
.username-current strong { color: var(--ink); font-weight: 760; }
.username-form { display: grid; gap: 9px; margin: 0; }
.username-form > label { color: var(--ink); font-size: 13px; font-weight: 720; }
.username-field { display: flex; align-items: center; min-height: 54px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel-2); box-shadow: inset 0 1px 0 rgba(255,255,255,.08); transition: border-color .18s ease, box-shadow .18s ease, background .18s ease; }
.username-field:focus-within { border-color: #3A76F0; box-shadow: 0 0 0 4px rgba(58,118,240,.13); }
.username-field > span { padding-left: 16px; color: #3A76F0; font-size: 18px; font-weight: 780; }
.username-field input { min-width: 0; width: 100%; border: 0; padding: 15px 16px 15px 3px; background: transparent; color: var(--ink); outline: 0; font-family: inherit; font-size: 17px; font-weight: 650; line-height: 1.2; letter-spacing: -.01em; }
.username-field input::placeholder { color: var(--muted); opacity: .55; }
.username-field:has(input:disabled) { opacity: .62; }
.username-rules { color: var(--muted); font-size: 11px; line-height: 1.45; }
.username-feedback { min-height: 21px; }
.username-status { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.45; animation: username-status-in .18s ease both; }
.username-status:empty { animation: none; }
.username-status.invalid { color: var(--danger); }
.username-status.checking { color: #3A76F0; }
.username-status.locked { color: var(--muted); }
.username-protection { display: flex; gap: 11px; align-items: flex-start; margin: 2px 0 8px; padding: 13px 14px; border-radius: 16px; }
.username-protection-icon { display: grid; place-items: center; width: 26px; height: 26px; flex: 0 0 26px; border-radius: 50%; background: rgba(58,118,240,.13); color: #3A76F0; font-size: 14px; font-weight: 800; }
.username-protection div { display: grid; gap: 4px; }
.username-protection strong { font-size: 12px; line-height: 1.4; }
.username-protection p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.username-submit { position: relative; width: 100%; min-height: 50px; border: 0; border-radius: 15px; background: #3A76F0; color: #fff; font-family: inherit; font-size: 14px; font-weight: 760; line-height: 1; cursor: pointer; box-shadow: 0 10px 24px rgba(44,107,237,.2); transition: transform .16s ease, opacity .16s ease, box-shadow .16s ease; }
.username-submit:not(:disabled):active { transform: scale(.985); }
.username-submit:disabled { opacity: .42; cursor: default; box-shadow: none; }
.username-submit.is-saving::before { content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 8px; vertical-align: -2px; border: 2px solid rgba(255,255,255,.42); border-top-color: #fff; border-radius: 50%; animation: username-spin .7s linear infinite; }
.username-secondary { display: block; width: 100%; margin-top: 8px; border: 0; padding: 12px; background: transparent; color: var(--muted); font-family: inherit; font-size: 13px; font-weight: 680; line-height: 1; cursor: pointer; }
.username-secondary[hidden] { display: none; }
.username-managed { justify-items: center; padding: 18px 8px 8px; text-align: center; }
.username-managed-name { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 9px; }
.username-managed-name strong { font-size: clamp(26px, 8vw, 36px); line-height: 1.1; letter-spacing: -.04em; }
.username-managed-name span { padding: 5px 8px; border-radius: 99px; background: rgba(58,118,240,.11); color: #3A76F0; font-size: 10px; font-weight: 780; text-transform: uppercase; letter-spacing: .06em; }
.username-managed p { margin: 5px 0 0; font-size: 14px; line-height: 1.45; }
.username-managed small { max-width: 290px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.username-success { margin: 34px 0 26px; padding: 22px 16px; border-radius: 18px; background: rgba(58,118,240,.08); color: #2C6BED; text-align: center; font-size: 17px; font-weight: 780; animation: username-status-in .22s ease both; }
@keyframes username-dialog-in { from { opacity: 0; transform: translateY(9px) scale(.985); } }
@keyframes username-backdrop-in { from { opacity: 0; } }
@keyframes username-status-in { from { opacity: 0; transform: translateY(3px); } }
@keyframes username-spin { to { transform: rotate(360deg); } }

/* La reacción vive en el retrato para mantener estable el botón y su foco. */
.avatar-celebrate[data-avatar] > img { will-change: transform; }
.avatar-celebrate[data-avatar="avatar-01"] > img { animation: avatar-nod 1s ease; }
.avatar-celebrate[data-avatar="avatar-02"] > img { animation: avatar-float 1s ease; }
.avatar-celebrate[data-avatar="avatar-03"] > img { animation: avatar-breathe 1s ease; }
.avatar-celebrate[data-avatar="avatar-04"] > img { animation: avatar-sprint 1s cubic-bezier(.2,.8,.2,1); }
.avatar-celebrate[data-avatar="avatar-05"] > img { animation: avatar-beat 1s ease; }
.avatar-celebrate[data-avatar="avatar-06"] > img { animation: avatar-sketch 1s ease; }
.avatar-celebrate[data-avatar="avatar-07"] > img { animation: avatar-trail 1s ease; }
.avatar-celebrate[data-avatar="avatar-08"] > img { animation: avatar-slide 1s ease; }
.avatar-celebrate[data-avatar="avatar-09"] > img { animation: avatar-rock 1s ease; }
.avatar-celebrate[data-avatar="avatar-10"] > img { animation: avatar-float 1s ease; }
@keyframes avatar-rock { 20%{transform:rotate(-9deg) scale(1.06)} 45%{transform:rotate(7deg) scale(1.08)} 70%{transform:rotate(-3deg)} }
@keyframes avatar-beat { 20%,60%{transform:scale(1.09)} 40%,80%{transform:scale(.98)} }
@keyframes avatar-nod { 25%{transform:translateY(3px) rotate(2deg)} 55%{transform:translateY(-2px)} }
@keyframes avatar-sprint { 25%{transform:translate(-4px,2px) rotate(-5deg)} 55%{transform:translate(5px,-5px) rotate(4deg)} }
@keyframes avatar-sketch { 20%{transform:rotate(-5deg)} 40%{transform:rotate(5deg) scale(1.07)} 60%{transform:rotate(-3deg)} }
@keyframes avatar-slide { 25%{transform:translateX(-6px) rotate(-4deg)} 55%{transform:translateX(5px) rotate(3deg)} }
@keyframes avatar-trail { 25%{transform:rotate(-5deg) translateY(-2px)} 55%{transform:rotate(5deg) translateY(-5px)} }
@keyframes avatar-breathe { 45%{transform:scale(1.1)} }
@keyframes avatar-float { 30%{transform:translateY(-7px) rotate(2deg)} 65%{transform:translateY(2px) rotate(-2deg)} }

@media (max-width: 700px) {
  .onboarding-card { min-height: min(600px, calc(100dvh - 32px)); }
  .onboarding-visual { margin-top: 26px; }
  .privacy-dialog { max-height: 90dvh; }
  .username-dialog, .username-panel { max-height: calc(100dvh - 18px); }
  .username-panel { padding: 24px 20px calc(16px + env(safe-area-inset-bottom)); }
}
@media (prefers-color-scheme: dark) {
  .requests-toggle { background: rgba(58,118,240,.16); border-color: rgba(157,187,255,.22); }
  .request-block { color: #ffaaaa; background: rgba(255,120,120,.08); border-color: rgba(255,160,160,.18); }
  .onboarding-visual { background: radial-gradient(circle, rgba(58,118,240,.3), rgba(58,118,240,.08) 62%, transparent 63%); }
}
@media (prefers-reduced-motion: reduce) {
  .avatar-celebrate[data-avatar] > img { animation: none; }
  .requests-chevron, .onboarding-dots span { transition: none; }
}
.microphone-icon {
  width: 21px;
  height: 21px;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.record-button { transition: color .18s ease, background .18s ease, transform .12s ease, box-shadow .18s ease; }
.record-button:active { transform: scale(.92); }
.record-button.recording .microphone-icon { stroke-width: 2; }

@media (max-width: 700px) {
  .chat-header { gap: 9px; padding-right: 10px; }
  .chat-header > .avatar { width: 38px; height: 38px; flex: 0 0 38px; }
  .peer { min-width: 0; }
  .peer > strong, .peer > span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
}

/* Jerarquía tipográfica y controles inspirados en iOS */
.welcome h1, .empty-chat h2, .pin-slogan { font-family: inherit; }
.welcome h1 { font-weight: 720; }
.pin-slogan { font-weight: 520; letter-spacing: -.018em; }
.home-brand span:not(.home-brand-mark) { font-weight: 450; letter-spacing: -.01em; }

.identity-main { grid-template-columns: auto minmax(0, 1fr); }
.identity-heading {
  margin-bottom: 3px;
}
.identity-actions { position: relative; z-index: 1; align-items: center; flex: 0 0 auto; }
.identity-actions .copy-icon { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 380px) {
  .identity-card { gap: 8px; padding: 12px; }
  .identity-card .profile-avatar { width: 44px; height: 44px; }
  .identity-alias { font-size: 22px; }
}
@container mute-sidebar (max-width: 350px) {
  .identity-card { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .identity-actions { width: 100%; grid-template-columns: repeat(3, minmax(0, 1fr)); padding-top: 9px; border-top: 1px solid var(--line); }
  .identity-actions .copy-button { width: 100%; }
}
.copy-button { min-width: 44px; gap: 2px; border-radius: 10px; color: #2C6BED; }
.copy-icon {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.copy-button span:last-child { font-size: 10px; font-weight: 560; }

.quick-icon {
  width: 23px;
  height: 23px;
  flex: 0 0 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.list-heading {
  justify-content: flex-start;
  color: var(--ink);
  font-weight: 720;
  text-transform: none;
}
#active-count { color: var(--muted); font-weight: 560; }
.chat-item.unread { background: rgba(58,118,240,.055); }
.chat-item.unread .chat-name { font-weight: 760; }
.chat-name { color: var(--ink); letter-spacing: -.012em; }
.chat-time {
  place-items: center;
}
.chat-trailing { display: flex; justify-content: flex-end; }
.unread-badge {
  min-width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  padding: 0 6px;
  border-radius: 999px;
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 730;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.chat-time::before {
  width: 7px;
  height: 7px;
  border-top: 1.8px solid currentColor;
  border-right: 1.8px solid currentColor;
  transform: rotate(45deg);
}

@media (prefers-color-scheme: dark) {
  :root { --soft-shadow: 0 3px 14px rgba(0,0,0,.18); }
  .copy-button span:last-child, .chat-preview, #active-count { color: #F6F6F6; opacity: .68; }
  .chat-time { color: rgba(246,246,246,.5); }
}
/* Detalles del chat: conserva el selector y las acciones existentes. */
.info-dialog { position: fixed; top: var(--viewport-center-y, 50dvh); right: auto; bottom: auto; left: 50%; transform: translate(-50%, -50%); width: min(480px, calc(100% - 24px)); max-width: none; max-height: calc(var(--app-height, 100dvh) - 24px); margin: 0; padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 26px; background: var(--panel); box-shadow: 0 24px 70px rgba(22,29,43,.18); }
.info-dialog[open] { display: flex; flex-direction: column; }
.info-dialog .info-panel { min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 18px 20px 0; }
.info-heading { margin-bottom: 14px; }
.info-heading-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.info-heading .eyebrow { margin: 0; color: var(--muted); font-size: 11px; font-weight: 650; letter-spacing: .16em; }
.info-close-top { width: 38px; height: 38px; flex: 0 0 38px; padding: 0; border: 0; border-radius: 50%; background: var(--panel-2); color: var(--muted); font-size: 25px; line-height: 1; cursor: pointer; transition: background 150ms ease, transform 150ms ease; }
@media (hover: hover) and (pointer: fine) { .info-close-top:hover { background: var(--line); } }
.info-close-top:active { transform: scale(.95); }
.info-dialog .info-title { margin: 0; overflow-wrap: anywhere; color: var(--ink); font-weight: 750; line-height: 1.12; letter-spacing: -.035em; }
.info-subtitle { margin: 5px 0 0; color: var(--muted); font-size: 13px; line-height: 1.35; }
.info-expiry-card { display: grid; grid-template-columns: 42px minmax(0,1fr) auto; align-items: center; gap: 10px; padding: 13px; border: 0; border-radius: 18px; background: var(--accent-soft); }
.info-expiry-icon, .info-retention-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: rgba(58,118,240,.1); color: var(--accent-strong); }
.info-expiry-icon svg, .info-retention-icon svg { width: 23px; height: 23px; }
.info-expiry-copy { min-width: 0; }
.info-card-label { display: block; margin-bottom: 2px; color: var(--ink); font-size: 15px; font-weight: 720; }
.info-dialog .info-expiry { margin: 0; color: var(--ink); font-weight: 730; line-height: 1.25; font-variant-numeric: tabular-nums; }
.info-expiry-hint { margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.35; }
.info-countdown-pill { align-self: start; max-width: 130px; padding: 6px 9px; border-radius: 999px; background: rgba(58,118,240,.1); color: var(--accent-strong); font-size: 11px; font-weight: 680; text-align: center; white-space: nowrap; }
.info-retention-section { display: grid; grid-template-columns: 42px minmax(0,1fr) auto; align-items: center; gap: 10px; margin-top: 10px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); }
.info-retention-icon { background: var(--panel-2); color: var(--ink); }
.info-retention-copy { min-width: 0; }
.info-retention-copy label { color: var(--ink); font-size: 15px; font-weight: 720; }
.info-retention-note { margin: 3px 0 0; color: var(--muted); font-size: 12px; line-height: 1.3; }
.info-retention-section select { min-width: 98px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); color: var(--ink); font-family: inherit; font-size: 14px; font-weight: 650; cursor: pointer; transition: border-color 150ms ease, background 150ms ease; }
.info-retention-section select:disabled { opacity: .62; cursor: not-allowed; }
.info-dialog .room-info-content { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.info-delete-card { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 62px; margin-top: 10px; padding: 10px 13px; border: 1px solid rgba(183,53,69,.32); border-radius: 17px; background: var(--danger-soft); color: var(--danger); text-align: left; cursor: pointer; transition: background 150ms ease, transform 150ms ease; }
@media (hover: hover) and (pointer: fine) { .info-delete-card:hover { background: rgba(183,53,69,.14); } }
.info-delete-card:active { transform: scale(.99); }
.info-delete-icon { display: grid; place-items: center; flex: 0 0 34px; width: 34px; height: 34px; }
.info-delete-icon svg { width: 23px; height: 23px; }
.info-delete-card strong, .info-delete-card small { display: block; }
.info-delete-card strong { font-size: 16px; line-height: 1.25; }
.info-delete-card small { margin-top: 4px; color: var(--danger); font-size: 12px; font-weight: 450; line-height: 1.35; opacity: .82; }
.info-footer { flex: 0 0 auto; display: grid; gap: 8px; padding: 12px 20px 18px; background: var(--panel); }
.info-footer #close-info { min-height: 46px; border: 0; border-radius: 14px; color: #fff; font-size: 15px; font-weight: 700; transition: background 150ms ease, transform 150ms ease; }
@media (hover: hover) and (pointer: fine) { .info-footer #close-info:hover { background: #286be5; } }
.info-footer #close-info:active { transform: scale(.99); }
.info-footer #room-leave { min-height: 44px; font-size: 13px; font-weight: 650; }
.info-dialog button:focus-visible, .info-retention-section select:focus-visible { outline: 2px solid #3478f6; outline-offset: 3px; }
@media (max-width: 520px) {
  .info-dialog { border-radius: 26px; }
  .info-dialog .info-panel { padding: 16px 16px 0; }
  .info-footer { padding: 10px 16px 16px; }
  .info-expiry-card { grid-template-columns: 40px minmax(0,1fr); gap: 9px; padding: 11px; }
  .info-expiry-icon, .info-retention-icon { width: 40px; height: 40px; }
  .info-countdown-pill { display: none; }
  .info-retention-section { grid-template-columns: 40px minmax(0,1fr) auto; gap: 9px; padding: 10px; }
}
@media (max-width: 370px) {
  .info-retention-section select { grid-column: 2 / -1; justify-self: stretch; width: 100%; }
  .info-retention-icon { grid-row: 1; }
  .info-retention-copy { grid-column: 2 / -1; }
}
:root[data-theme="dark"] .info-dialog { box-shadow: 0 24px 70px rgba(0,0,0,.45); }
:root[data-theme="dark"] .info-expiry-icon, :root[data-theme="dark"] .info-countdown-pill { background: rgba(106,151,255,.15); }
:root[data-theme="dark"] .info-delete-card { border-color: rgba(255,155,168,.35); }

/* Safety is a separate, deliberate task. No decorative motion or extra navigation. */
.safety-dialog { width: min(100% - 2rem, 560px); max-height: calc(100dvh - 2rem); margin: auto; padding: 0; border: 1px solid var(--line); border-radius: 24px; color: var(--ink); background: var(--panel); overflow-y: auto; overscroll-behavior: contain; }
.safety-panel { display: grid; gap: 1rem; padding: 1.5rem 1.5rem calc(1.5rem + env(safe-area-inset-bottom, 0px)); }
.safety-panel h2 { margin: 0; font-size: clamp(1.5rem, 5vw, 2rem); line-height: 1.12; letter-spacing: -.02em; }
.safety-panel p { margin: 0; line-height: 1.5; overflow-wrap: anywhere; }
.safety-panel label { display: grid; gap: .5rem; line-height: 1.4; }
.safety-panel select, .safety-panel textarea { width: 100%; min-height: 44px; padding: .75rem; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: var(--panel-2); font: inherit; font-size: 1rem; }
#abuse-compose, #abuse-review { display: grid; gap: 1rem; }
#abuse-compose[hidden], #abuse-review[hidden], #support-contact[hidden] { display: none; }
.safety-panel .dialog-action { min-height: 44px; margin: 0; }
.abuse-evidence { display: grid; gap: .75rem; padding: 1rem; border: 1px solid var(--line); border-radius: 16px; background: var(--panel-2); overflow-wrap: anywhere; }
.abuse-evidence:empty { display: none; }
.abuse-evidence img, .abuse-evidence video { display: block; max-width: 100%; max-height: 360px; margin: auto; object-fit: contain; border-radius: 10px; }
.abuse-evidence audio { width: 100%; }
.abuse-consent { display: flex !important; align-items: center; gap: .75rem; min-height: 44px; line-height: 1.4; }
.abuse-consent input { flex: 0 0 auto; width: 22px; height: 22px; accent-color: var(--accent); }
.person-safety-button { min-width: 44px; min-height: 44px; border: 0; border-radius: 50%; background: var(--panel-2); color: var(--muted); cursor: pointer; touch-action: manipulation; }
.person-safety-button { flex: 0 0 44px; }
.room-info-person:has(.person-safety-button) { grid-template-columns: 34px minmax(0, 1fr) 44px auto; }
.room-info-person .person-safety-button { color: var(--accent); }
.text-send-status { display: block; min-height: 44px; margin-left: auto; padding: .25rem .5rem; border: 0; border-radius: 10px; color: var(--muted); background: transparent; font-size: .75rem; cursor: pointer; }
.text-send-status:disabled { cursor: default; opacity: .8; }
.safety-panel button:focus-visible, .safety-panel input:focus-visible, .safety-panel textarea:focus-visible, .safety-panel select:focus-visible, .person-safety-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
@media (prefers-contrast: more) { .safety-dialog, .abuse-evidence, .safety-panel select, .safety-panel textarea { border-color: var(--ink); } }
