:root {
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, Roboto, "Segoe UI", sans-serif;
  --ink: #edf7f1;
  --muted: #8fa69a;
  --ground: #000;
  --panel: #0c0f0d;
  --panel-2: #151916;
  --line: rgba(213, 244, 225, .09);
  --accent: #a9f3c9;
  --accent-ink: #092116;
  --danger: #ff9c9c;
  --soft-shadow: 0 8px 24px rgba(0, 0, 0, .12);
  --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; background: var(--ground); 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; justify-content: center; text-align: center;
  background: radial-gradient(circle at 50% 35%, rgba(89, 177, 126, .16), transparent 37%);
}
.brand-mark { width: 72px; height: 72px; display: grid; place-items: center; border: 1px solid #4b705d; border-radius: 25px; color: var(--accent); font: 500 36px/1 Georgia, serif; transform: rotate(-4deg); box-shadow: 0 0 60px rgba(91, 176, 126, .12); }
.welcome-name { margin-top: 24px; color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .26em; }
.welcome h1 { max-width: 440px; font: 500 39px/1.08 Georgia, serif; margin: 16px 0; letter-spacing: -.035em; }
.welcome p { color: #b3c4ba; 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; background: var(--accent); color: var(--accent-ink); 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; grid-template-columns: minmax(320px, 400px) 1fr; overflow: hidden; }
.sidebar { min-width: 0; padding: calc(18px + env(safe-area-inset-top)) 18px 18px; background: linear-gradient(165deg, #111b16 0%, var(--panel) 58%, #0d1511 100%); border-right: 1px solid var(--line); overflow-y: auto; overscroll-behavior: contain; }
.home-brand { display: flex; align-items: center; gap: 10px; margin: 0 2px 22px; }
.home-brand-mark { width: 34px; height: 34px; display: grid; place-items: center; flex: 0 0 auto; border: 1px solid #42634f; border-radius: 12px; color: var(--accent); font: 500 18px/1 Georgia, serif; transform: rotate(-3deg); }
.home-brand > div { min-width: 0; flex: 1; display: grid; gap: 3px; }
.home-brand strong { font-size: 11px; letter-spacing: .2em; }
.home-brand span:not(.home-brand-mark) { overflow: hidden; color: var(--muted); font: 400 11px/1.3 Georgia, serif; white-space: nowrap; text-overflow: ellipsis; }
.identity { display: flex; align-items: center; }
.identity-card { position: relative; gap: 12px; margin-bottom: 14px; padding: 16px; overflow: hidden; border: 1px solid rgba(169,243,201,.12); border-radius: 20px; background: rgba(8,15,11,.44); box-shadow: var(--soft-shadow); }
.identity-card::after { content: ""; position: absolute; right: -44px; bottom: -70px; width: 150px; height: 150px; border-radius: 50%; background: radial-gradient(circle, rgba(169,243,201,.08), transparent 68%); pointer-events: none; }
.identity-copy { min-width: 0; flex: 1; display: grid; gap: 2px; }
.profile-avatar { width: 48px; height: 48px; flex: 0 0 auto; cursor: pointer; transition: transform .24s ease, box-shadow .24s ease; }
.profile-avatar:hover { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(0,0,0,.24); }
.eyebrow { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .13em; margin-bottom: 5px; }
.identity-alias { overflow: hidden; font-size: 24px; letter-spacing: -.02em; white-space: nowrap; text-overflow: ellipsis; }
.identity-expiry { color: var(--muted); font-size: 10px; }
.copy-button { position: relative; z-index: 1; display: grid; place-items: center; gap: 3px; flex: 0 0 auto; border: 0; padding: 6px; background: transparent; color: var(--accent); font-size: 16px; cursor: pointer; }
.copy-button span:last-child { color: var(--muted); font-size: 9px; }
.icon-button { width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 50%; background: rgba(255,255,255,.02); cursor: pointer; }
.quick-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 10px; }
.quick-action { min-height: 78px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); border-radius: 16px; padding: 10px 5px; background: rgba(255,255,255,.025); color: #c8d8cf; font-size: 10px; line-height: 1.25; cursor: pointer; transition: transform .18s ease, border-color .18s ease, background .18s ease; }
.quick-action:hover, .quick-action[aria-expanded="true"] { transform: translateY(-1px); border-color: rgba(169,243,201,.25); background: rgba(169,243,201,.06); }
.quick-icon { height: 22px; color: var(--accent); font-size: 23px; line-height: 1; }
.connect-card { margin-bottom: 4px; padding: 14px; border: 1px solid rgba(169,243,201,.14); border-radius: 16px; background: rgba(8,15,11,.5); animation: panel-reveal .22s ease both; }
.connect-card label { display: block; color: #bfd0c6; font-size: 13px; 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; }
.connect-row input:focus { border-color: #75c497; box-shadow: 0 0 0 3px rgba(117,196,151,.1); }
.form-error { min-height: 0; color: var(--danger); font-size: 12px; margin: 8px 2px 0; }
.form-error:empty { margin: 0; }
.requests-section { margin-top: 18px; }
.request-list { display: grid; gap: 8px; }
.request-card { display: grid; grid-template-columns: 38px 1fr; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 14px; background: rgba(169,243,201,.045); }
.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 { grid-column: 2; display: flex; gap: 7px; }
.request-actions button { border-radius: 9px; padding: 7px 10px; font-size: 12px; 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; justify-content: space-between; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; margin: 24px 4px 10px; }
.link-button { margin-left: auto; border: 0; padding: 0; background: transparent; color: var(--muted); font-size: 11px; cursor: pointer; }
.link-button:hover { color: var(--accent); }
.chat-list { display: grid; gap: 6px; }
.chat-item { width: 100%; display: grid; grid-template-columns: 42px 1fr auto; gap: 11px; align-items: center; text-align: left; padding: 11px; border: 1px solid transparent; border-radius: 15px; background: transparent; cursor: pointer; transition: opacity .26s ease, transform .26s ease, max-height .3s ease, padding .3s ease, background .18s ease; }
.chat-item:hover, .chat-item.active { border-color: var(--line); background: rgba(169,243,201,.055); }
.chat-item.expiring { max-height: 0; padding-top: 0; padding-bottom: 0; opacity: 0; transform: translateX(-12px); overflow: hidden; }
.avatar { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; background: #243a2e; color: var(--accent); font-weight: 800; }
.avatar[data-avatar="luna"] { background: #282343; color: #d5d0ff; }
.avatar[data-avatar="coral"] { background: #3d2929; color: #ffb0a5; }
.avatar[data-avatar="bosque"] { background: #1d392e; color: #9de7b5; }
.avatar[data-avatar="brisa"] { background: #203743; color: #a9e7f8; }
.chat-name { display: block; font-weight: 650; }
.chat-preview { display: block; max-width: 190px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--muted); font-size: 11px; margin-top: 4px; }
.chat-time { color: #698073; font-size: 18px; }
.empty-list { color: var(--muted); text-align: center; font-size: 12px; line-height: 1.5; padding: 34px 22px; }
.empty-list > span { display: block; margin-bottom: 10px; color: #50675a; font-size: 28px; }
.empty-list strong { display: block; margin-bottom: 4px; color: #b9c9c0; font-size: 13px; }
.empty-list p { margin: 0; }

.conversation { min-width: 0; min-height: 0; overflow: hidden; background: radial-gradient(circle at 45% 40%, #0e1511 0, #000 70%); }
.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); font: 400 28px/1.2 Georgia, serif; }
.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%; color: var(--accent); font-size: 28px; box-shadow: 0 0 0 14px rgba(72,115,90,.08); }
.chat-view { position: relative; height: 100%; min-height: 0; overflow: hidden; }
html.keyboard-open .composer { padding-bottom: 8px; }
.chat-header { position: absolute; z-index: 5; top: 0; right: 0; left: 0; min-height: calc(74px + env(safe-area-inset-top)); padding: calc(12px + env(safe-area-inset-top)) 18px 10px; display: flex; align-items: center; gap: 12px; border: 0; background: linear-gradient(to bottom, rgba(2,4,3,.92), rgba(5,9,7,.72)); -webkit-backdrop-filter: saturate(140%) blur(24px); backdrop-filter: saturate(140%) blur(24px); }
.peer { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.peer > strong { font-size: 15px; }
.peer > span { color: var(--muted); font-size: 10px; letter-spacing: .01em; }
.chat-lock { color: var(--accent); font-size: 10px; filter: grayscale(.25); }
.back { display: none; }
.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; gap: 9px; }
.message { position: relative; max-width: min(76%, 520px); align-self: flex-start; animation: message-arrive .38s cubic-bezier(.2,.9,.25,1.15) both; transform-origin: bottom left; }
.message.mine { align-self: flex-end; }
.message.mine { transform-origin: bottom right; }
.message.removing { overflow: hidden; animation: message-leave .58s cubic-bezier(.4,0,.2,1) both; }
.bubble { position: relative; min-height: 38px; padding: 10px 32px 10px 14px; border-radius: 20px 20px 20px 7px; background: rgba(31,39,34,.94); overflow-wrap: anywhere; line-height: 1.42; }
.mine .bubble { background: #b6efce; color: #071b10; border-radius: 20px 20px 7px 20px; }
.message-lifetime { --life-angle: 360deg; position: absolute; right: 10px; bottom: 10px; width: 12px; height: 12px; border-radius: 50%; background: conic-gradient(var(--accent) var(--life-angle), rgba(169,243,201,.13) 0); opacity: .78; }
.message-lifetime::after { content: ""; position: absolute; inset: 3px; border-radius: inherit; background: #1f2722; }
.mine .message-lifetime { background: conic-gradient(#245c3d var(--life-angle), rgba(9,33,22,.14) 0); }
.mine .message-lifetime::after { background: #b6efce; }
.bubble img { display: block; max-width: 100%; max-height: 420px; border-radius: 10px; }
.image-shell { position: relative; min-width: 160px; min-height: 120px; overflow: hidden; border-radius: 12px; background: #182119; }
.image-shell .blur-preview { position: absolute; inset: 0; width: 100%; height: 100%; transform: scale(1.08); filter: blur(8px); }
.image-shell img { position: relative; z-index: 1; width: 100%; 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; background: #b8c8c1; transition: background .12s ease, transform .12s ease; }
.voice-wave i.played { background: var(--accent-strong); transform: scaleY(1.06); }
.voice-time { color: var(--muted); 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; background: rgba(255,255,255,.07); font-size: 10px; }
.reply-quote span { opacity: .72; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message-menu { position: absolute; top: 5px; right: -34px; width: 28px; height: 28px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 11px; cursor: pointer; }
.mine .message-menu { right: auto; left: -34px; }
.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; background: var(--panel); font-size: 12px; }
.mine .message-reactions { margin-left: auto; }
.message-meta { color: var(--muted); font-size: 9px; margin: 4px 5px 0; }
.message-status { color: var(--accent); }
.mine .message-meta { text-align: right; }
.system-message { align-self: center; color: #72877b; font-size: 10px; margin: 8px; }
.composer-stack { position: absolute; z-index: 5; right: 0; bottom: 0; left: 0; padding-top: 4px; background: linear-gradient(to top, rgba(0,0,0,.96), rgba(4,8,6,.72)); -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; background: rgba(31,39,34,.78); }
.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 { width: 60px; height: 60px; object-fit: cover; border-radius: 10px; background: #0a100d; }
.media-preview-copy { min-width: 0; display: grid; gap: 3px; }
.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; padding: 10px; border-radius: 20px; background: rgba(25,30,27,.9); box-shadow: 0 14px 40px rgba(0,0,0,.28); animation: attachment-rise .24s cubic-bezier(.2,.8,.2,1) both; }
.attachment-choice { min-height: 54px; 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; }
.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%; background: var(--accent); color: var(--accent-ink); 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; background: rgba(255,255,255,.055); color: var(--ink); font-size: 12px; outline: none; }
.upload-track { height: 3px; overflow: hidden; border-radius: 99px; background: rgba(169,243,201,.14); }
.upload-track span { display: block; width: 0; height: 100%; background: var(--accent); 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; align-items: flex-end; gap: 8px; background: transparent; }
.composer textarea { flex: 1; max-height: 120px; resize: none; border: 0; border-radius: 21px; background: rgba(36,42,38,.9); color: var(--ink); padding: 11px 15px; outline: none; box-shadow: inset 0 0 0 .5px rgba(255,255,255,.1); transition: background .18s ease, box-shadow .18s ease; }
.composer textarea:focus { background: rgba(42,49,44,.94); box-shadow: inset 0 0 0 .5px rgba(255,255,255,.17); }
.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); font-size: 25px; transition: transform .22s ease, background .18s ease; }
.attach-button.open { transform: rotate(45deg); background: rgba(169,243,201,.15); }
.record-button { border: 0; background: rgba(255,255,255,.055); color: #d7e5dc; font-size: 16px; }
.record-button.recording { color: #d44f5c; background: #fde8e9; box-shadow: 0 0 0 5px rgba(212,79,92,.09); animation: record-button-pulse 1.2s ease-in-out infinite; }
.send-button { border: 0; background: var(--accent); color: var(--accent-ink); 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; background: rgba(255,248,248,.97); 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-bar time { min-width: 38px; color: #7f3941; font-size: 12px; font-weight: 750; font-variant-numeric: tabular-nums; text-align: center; }
.recording-bar button { min-height: 36px; border: 0; border-radius: 12px; padding: 0 11px; font-size: 11px; font-weight: 750; cursor: pointer; }
.recording-cancel { background: transparent; color: #93656a; }
.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 { 0% { opacity: 1; filter: blur(0); max-height: 600px; } 62% { opacity: 0; filter: blur(8px); transform: scale(.98); max-height: 600px; } 100% { opacity: 0; filter: blur(10px); transform: scale(.96); max-height: 0; margin: 0; } }
@keyframes identity-shift { 45% { opacity: .55; transform: scale(.985); } }
@keyframes conversation-leave { to { opacity: 0; transform: scale(.992); } }
.identity-card.identity-changing { animation: identity-shift .34s ease; }
.conversation.expiring { animation: conversation-leave .62s ease both; }

dialog { width: min(360px, calc(100% - 32px)); border: 1px solid #33483d; border-radius: 18px; padding: 8px; background: #142019; color: var(--ink); }
.info-dialog h2 { margin: 8px 12px 12px; font-size: 20px; }
.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 { width: 100%; height: 100%; object-fit: cover; }
.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; }
.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::backdrop { background: rgba(0,0,0,.62); backdrop-filter: blur(3px); }
.dialog-action { width: 100%; border: 0; border-radius: 12px; padding: 13px; background: transparent; text-align: left; cursor: pointer; }
.dialog-action:hover { background: rgba(255,255,255,.05); }
.dialog-action.danger { color: var(--danger); }
.avatar-panel { padding: 12px 12px 8px; }
.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 strong { font-size: 13px; }
.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(5, 1fr); gap: 8px; margin-top: 10px; }
.avatar-option { width: 46px; height: 46px; border: 1px solid var(--line); border-radius: 50%; background: #243a2e; color: var(--accent); font-size: 20px; cursor: pointer; }
.avatar-option.selected { outline: 2px solid var(--accent); outline-offset: 2px; }
.avatar-option[data-avatar="luna"] { background: #282343; color: #d5d0ff; }
.avatar-option[data-avatar="coral"] { background: #3d2929; color: #ffb0a5; }
.avatar-option[data-avatar="bosque"] { background: #1d392e; color: #9de7b5; }
.avatar-option[data-avatar="brisa"] { background: #203743; color: #a9e7f8; }
.toast { position: fixed; z-index: 5; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); transform: translate(-50%, 30px); opacity: 0; pointer-events: none; border: 1px solid var(--line); border-radius: 99px; padding: 10px 16px; background: #1a2921; font-size: 12px; transition: .2s ease; }
.toast.visible { transform: translate(-50%, 0); opacity: 1; }

@media (max-width: 700px) {
  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.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 { 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. */
:root {
  color-scheme: light;
  --ink: #24313b;
  --muted: #71808c;
  --ground: #f6f8fb;
  --panel: #ffffff;
  --panel-2: #eef3f5;
  --line: rgba(62, 83, 96, .13);
  --accent: #79d6bd;
  --accent-strong: #287d69;
  --accent-ink: #153e35;
  --lavender: #a79de3;
  --danger: #c85d65;
  --soft-shadow: 0 12px 36px rgba(57, 78, 91, .08);
}

html, body {
  background: var(--ground);
}

body {
  background:
    radial-gradient(circle at 12% 2%, rgba(121, 214, 189, .16), transparent 34%),
    radial-gradient(circle at 94% 88%, rgba(167, 157, 227, .12), transparent 32%),
    var(--ground);
}

.welcome {
  background:
    radial-gradient(circle at 50% 34%, rgba(121, 214, 189, .28), transparent 34%),
    radial-gradient(circle at 88% 80%, rgba(167, 157, 227, .16), transparent 28%);
}
.brand-mark { border-color: rgba(40, 125, 105, .28); color: var(--accent-strong); background: rgba(255,255,255,.7); box-shadow: 0 20px 60px rgba(75, 133, 118, .14); }
.welcome-name { color: var(--accent-strong); }
.welcome p { color: #61717c; }
.primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 8px 20px rgba(65, 158, 133, .16); }

.sidebar {
  background: linear-gradient(160deg, rgba(241,249,246,.98), rgba(250,249,255,.98) 72%, rgba(239,244,250,.98));
  border-right-color: var(--line);
}
.home-brand-mark { border-color: rgba(40,125,105,.26); color: var(--accent-strong); background: rgba(255,255,255,.62); }
.identity-card { border-color: rgba(77,133,117,.13); background: rgba(255,255,255,.72); box-shadow: var(--soft-shadow); }
.identity-card::after { background: radial-gradient(circle, rgba(121,214,189,.18), transparent 68%); }
.copy-button, .quick-icon, .link-button:hover { color: var(--accent-strong); }
.icon-button { border-color: var(--line); background: rgba(255,255,255,.66); }
.quick-action { border-color: rgba(67,92,105,.1); background: rgba(255,255,255,.62); color: #53636f; box-shadow: 0 6px 18px rgba(58,79,92,.035); }
.quick-action:hover, .quick-action[aria-expanded="true"] { border-color: rgba(40,125,105,.2); background: rgba(121,214,189,.14); }
.connect-card { border-color: rgba(40,125,105,.13); background: rgba(255,255,255,.78); box-shadow: var(--soft-shadow); }
.connect-card label { color: #5f706a; }
.connect-row input, .invite-duration select, .invite-result input { border-color: rgba(65,88,100,.16); background: rgba(255,255,255,.88); color: var(--ink); }
.connect-row input:focus { border-color: var(--accent-strong); box-shadow: 0 0 0 3px rgba(121,214,189,.2); }
.request-card { background: rgba(255,255,255,.72); }
.chat-item:hover, .chat-item.active { border-color: rgba(40,125,105,.12); background: rgba(121,214,189,.13); }
.chat-time { color: #84938d; }
.empty-list > span { color: #9aafa5; }
.empty-list strong { color: #51616c; }

.avatar, .avatar-option { background: #dff3eb; color: #287d69; }
.avatar[data-avatar="luna"], .avatar-option[data-avatar="luna"] { background: #e8e5fa; color: #7166b5; }
.avatar[data-avatar="coral"], .avatar-option[data-avatar="coral"] { background: #fae5e1; color: #b55f58; }
.avatar[data-avatar="bosque"], .avatar-option[data-avatar="bosque"] { background: #dcefe3; color: #367b53; }
.avatar[data-avatar="brisa"], .avatar-option[data-avatar="brisa"] { background: #def1f7; color: #347b93; }

.conversation {
  background:
    radial-gradient(circle at 18% 12%, rgba(121,214,189,.12), transparent 34%),
    radial-gradient(circle at 90% 85%, rgba(167,157,227,.1), transparent 31%),
    #f8fafc;
}
.empty-orbit { border-color: rgba(40,125,105,.24); color: var(--accent-strong); background: rgba(255,255,255,.65); box-shadow: 0 0 0 14px rgba(121,214,189,.1); }
.chat-header { border-bottom: 1px solid rgba(66,88,100,.08); background: linear-gradient(to bottom, rgba(248,251,251,.94), rgba(248,251,251,.78)); }
.chat-lock, .message-status { color: var(--accent-strong); }
.bubble { background: rgba(255,255,255,.96); color: var(--ink); box-shadow: 0 5px 18px rgba(55,76,89,.07); }
.mine .bubble { background: #d9f3e9; color: #183e34; box-shadow: 0 5px 18px rgba(64,130,111,.08); }
.message-lifetime { background: conic-gradient(var(--accent-strong) var(--life-angle), rgba(40,125,105,.12) 0); }
.message-lifetime::after { background: #fff; }
.mine .message-lifetime { background: conic-gradient(#287d69 var(--life-angle), rgba(40,125,105,.12) 0); }
.mine .message-lifetime::after { background: #d9f3e9; }
.image-shell { background: #e8eeeb; }
.reply-quote { background: rgba(255,255,255,.48); }
.message-menu:hover, .attachment-choice:hover, .dialog-action:hover { background: rgba(68,91,103,.06); }
.message-reactions { background: rgba(255,255,255,.92); box-shadow: 0 4px 12px rgba(55,76,89,.05); }
.system-message { color: #86958e; }

.composer-stack { border-top: 1px solid rgba(66,88,100,.07); background: linear-gradient(to top, rgba(248,250,252,.98), rgba(248,250,252,.76)); }
.composer textarea { background: rgba(255,255,255,.94); color: var(--ink); box-shadow: inset 0 0 0 1px rgba(62,83,96,.1), 0 5px 18px rgba(55,76,89,.05); }
.composer textarea:focus { background: #fff; box-shadow: inset 0 0 0 1px rgba(40,125,105,.25), 0 5px 18px rgba(55,76,89,.06); }
.attach-button, .record-button { background: rgba(255,255,255,.86); color: var(--accent-strong); box-shadow: inset 0 0 0 1px rgba(62,83,96,.08); }
.attach-button.open { background: rgba(121,214,189,.22); }
.send-button { background: var(--accent); color: var(--accent-ink); box-shadow: 0 7px 18px rgba(65,158,133,.2); }
.attachment-menu, .media-preview, .reply-bar { background: rgba(255,255,255,.94); border: 1px solid rgba(62,83,96,.09); box-shadow: 0 15px 42px rgba(57,78,91,.1); }
.attachment-choice > span, .preview-send { background: var(--accent); color: var(--accent-ink); }
.attachment-duration select { background: #f2f5f6; color: var(--ink); }
.upload-track { background: rgba(40,125,105,.13); }
.upload-track span { background: var(--accent-strong); }
.recording-bar { color: #7f3941; }

dialog { border-color: rgba(62,83,96,.14); background: rgba(255,255,255,.96); color: var(--ink); box-shadow: 0 24px 70px rgba(47,64,76,.18); }
dialog::backdrop { background: rgba(61,71,78,.28); }
.qr-request, .reveal-image { color: var(--accent-ink); background: rgba(121,214,189,.5); border-color: rgba(40,125,105,.2); }
.scanner-frame { border-color: rgba(40,125,105,.25); }
.scanner-frame::before { border-color: rgba(121,214,189,.92); }
.reaction-row button, .invite-result button { border-color: var(--line); background: #f7f9fa; color: var(--ink); }
.toast { border-color: rgba(40,125,105,.12); background: rgba(255,255,255,.96); color: var(--ink); box-shadow: 0 12px 36px rgba(57,78,91,.14); }

@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; }
}
