﻿:root {
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: #e9ecef; background: #090b0d;
  --muted: #8e959d; --faint: #626b75; --line: #24282d; --blue: #40b0ff;
  --panel: #101214; --soft: #171c21;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; width: 100%; height: 100%; }
body { min-width: 320px; overflow: hidden; }
button, input, textarea, select { font: inherit; }
button { color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; opacity: .45; }
input, textarea { color: inherit; outline: none; }
button, input, textarea { outline-offset: 4px; }
:focus-visible { outline: 2px solid var(--blue); }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
img { display: block; object-fit: contain; }
.icon-button { width: 44px; height: 44px; padding: 11px; border: 0; background: transparent; border-radius: 10px; display: grid; place-items: center; color: #a8afb6; flex-shrink: 0; }
.icon-button:hover { color: #fff; background: #ffffff09; }
.eyebrow { font-size: 12px; letter-spacing: .12em; color: var(--blue); margin: 0 0 14px; }
.primary-button, .secondary-button { display: inline-flex; align-items: center; justify-content: center; gap: 14px; border-radius: 12px; font-weight: 600; font-size: 14px; min-height: 46px; padding: 11px 20px; }
.primary-button { color: #062037; background: #65beff; border: 1px solid #91cfff; }
.primary-button:hover { background: #8dceff; }
.secondary-button { color: #b7dcf7; background: #17242e; border: 1px solid #273e4f; }
.secondary-button:hover { background: #1d303e; }
.login-view { min-height: 100%; height: 100dvh; overflow: auto; display: grid; grid-template-columns: minmax(0, 380px); justify-content: center; align-content: safe center; padding: max(32px, env(safe-area-inset-top)) 24px max(24px, env(safe-area-inset-bottom)); background: radial-gradient(ellipse at 50% 25%, #12202a55, transparent 65%), #0d0f11; }
.login-card { width: 100%; min-width: 0; margin: auto; }
.login-card h1 { font-size: clamp(26px, 5vw, 32px); line-height: 1.35; font-weight: 650; letter-spacing: -.04em; margin: 0; }
.login-copy { margin: 12px 0 38px; font-size: 14px; line-height: 1.7; color: var(--muted); }
.login-card label { display: block; margin-bottom: 10px; font-size: 13px; color: #b0b7bf; }
.login-card input, .login-card select { display: block; width: 100%; background: #171b20; color: inherit; border: 1px solid #2b323a; border-radius: 12px; padding: 15px; font-size: 16px; }
.login-card input:focus, .login-card select:focus { border-color: #4997cf; }
.login-card input + label { margin-top: 20px; }
.login-card .primary-button { margin-top: 14px; width: 100%; justify-content: space-between; }
.form-error { min-height: 20px; font-size: 13px; line-height: 1.5; color: #f6a79d; margin: 12px 0 0; }
.login-footnote { color: var(--faint); line-height: 1.7; font-size: 12px; margin: 14px 0 0; }
.login-signature { text-align: center; color: #5e6871; font-size: 12px; margin: 52px 0 0; }
.login-signature span { padding: 0 8px; }
.text-button { border: 0; background: none; color: #79c6ff; padding: 12px 0; font-size: 13px; }
.login-view.registering { place-content: start center; }
.registration-form label { margin-top: 20px; }
.registration-form .field-hint, .field-hint { color: var(--muted); font-size: 11px; line-height: 1.8; margin: 8px 0 0; }
.empty-state { padding: 28px 12px; text-align: center; }
.invitation-code { width: 100%; margin-top: 10px; background: #10181f; color: #bce4ff; border: 1px solid #39546a; border-radius: 10px; padding: 13px 10px; font-family: ui-monospace, monospace; font-size: 16px; text-align: center; }
.invitation-list-title { font-size: 13px; font-weight: 500; margin-top: 24px; }
.invitation-list > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); font-size: 11px; color: #98a8b5; line-height: 1.8; }
.invitation-list .text-button { flex-shrink: 0; }
.app-frame { display: grid; grid-template-columns: 354px minmax(0, 1fr); width: min(calc(100% - 48px), 1360px); height: calc(100dvh - 48px); margin: 24px auto; background: var(--panel); border: 1px solid #2c3035; border-radius: 24px; overflow: hidden; }
.sidebar { display: flex; flex-direction: column; min-height: 0; min-width: 0; border-right: 1px solid var(--line); }
.island-header { display: flex; align-items: center; gap: 13px; padding: 26px 22px 22px; }
.header-avatar { flex: 0 0 52px; border-radius: 50%; object-fit: cover; background: #26333d; }
.island-header > div { min-width: 0; flex: 1; }
.header-title { display: flex; align-items: center; gap: 10px; min-width: 0; margin-bottom: 5px; }
.island-header h1 { min-width: 0; font-size: 21px; line-height: 1.3; font-weight: 700; margin: 0; letter-spacing: -.04em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.island-header p { margin: 0; color: #9da4ab; font-size: 12px; white-space: nowrap; }
.chat-nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0 16px; gap: 5px; }
.nav-item { display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 7px; min-height: 73px; border: 0; background: none; color: #a7aeb5; border-radius: 13px; font-size: 14px; }
.nav-item:hover:not(.unavailable) { background: #ffffff04; }
.nav-item.active { color: #e7f5ff; background: #162229; }
.nav-item.active svg { color: var(--blue); }
.nav-item small { font-size: 9px; color: #66717b; margin-left: 2px; }
.nav-item.unavailable { color: #747d86; cursor: default; gap: 7px; }
.nav-icon { position: relative; display: block; height: 22px; }
.nav-icon i { position: absolute; background: #53b8ff; border: 2px solid #162229; width: 9px; height: 9px; border-radius: 50%; right: -3px; top: -2px; }
.sidebar-content { padding: 22px 12px; overflow-y: auto; flex: 1; min-height: 0; }
.search-box { display: flex; align-items: center; gap: 9px; margin: 0 8px 25px; background: #181c20; border: 1px solid #242a30; border-radius: 10px; padding: 10px 12px; color: #747e87; }
.search-box:focus-within { border-color: #3e728f; }
.search-box svg { width: 17px; height: 17px; }
.search-box input { min-width: 0; width: 100%; background: transparent; border: 0; font-size: 13px; outline: none; }
input::placeholder, textarea::placeholder { color: #727d87; }
.section-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 0 12px; margin-bottom: 12px; }
.section-heading h2 { margin: 0; color: #9da5ae; font-size: 12px; font-weight: 500; }
.section-heading > span { font-size: 10px; color: #626e78; }
.conversation-row { width: 100%; display: flex; align-items: center; gap: 13px; border: 1px solid transparent; background: none; border-radius: 13px; text-align: left; padding: 15px 11px; }
.conversation-row:hover { background: #171c21; }
.conversation-row.selected { background: #182129; border-color: #243540; }
.friend-row:hover { background: none; }
.friend-copy { flex: 1; min-width: 0; }
.friend-copy strong { display: block; font-size: 15px; line-height: 1.5; overflow-wrap: anywhere; }
.friend-copy p { margin: 5px 0 3px; font-size: 12px; line-height: 1.6; color: #969fa8; overflow-wrap: anywhere; }
.friend-copy small { font-size: 12px; line-height: 1.6; color: #8f9eaa; }
.contact-avatar { width: 54px; height: 54px; flex: 0 0 54px; position: relative; display: grid; place-items: center; border-radius: 50%; background: #17262d; }
.contact-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.presence-dot { width: 10px; height: 10px; border: 2px solid #101214; background: #59636c; position: absolute; right: 0; bottom: 2px; border-radius: 50%; }
.presence-dot.online { background: #68cfa6; }
.contact-avatar.small { width: 42px; height: 42px; flex-basis: 42px; }
.conversation-copy { display: block; flex: 1; min-width: 0; }
.conversation-title { display: flex; gap: 10px; align-items: center; margin-bottom: 9px; }
.conversation-title strong { min-width: 0; font-size: 16px; font-weight: 650; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversation-title time { flex-shrink: 0; color: #818b94; font-size: 11px; }
.conversation-bottom { display: flex; align-items: center; gap: 8px; }
#conversation-preview { display: block; flex: 1; font-size: 13px; line-height: 1.5; color: #969fa8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#conversation-preview.is-typing { color: #79bde9; }
.unread-count { display: inline-grid; place-items: center; border-radius: 20px; min-width: 19px; height: 19px; padding: 0 5px; color: #062135; background: #6ac3ff; font-size: 10px; font-weight: 700; }
.friend-note, .search-empty { font-size: 12px; line-height: 1.8; color: #7e8993; margin: 0 12px 12px; }
.search-empty { text-align: center; padding: 26px 0; }
.sidebar-footer { display: flex; align-items: center; gap: 8px; flex-shrink: 0; min-height: 65px; border-top: 1px solid var(--line); padding: 15px 20px; }
.human-avatar { width: 35px; height: 35px; flex: 0 0 35px; object-fit: cover; border-radius: 11px; background: #26333d; }
.human-avatar.large { width: 54px; height: 54px; font-size: 19px; flex-basis: 54px; border-radius: 16px; }
.connection-pill { flex-shrink: 0; white-space: nowrap; font-size: 10px; color: #8b979e; display: flex; align-items: center; gap: 5px; }
.connection-pill i { width: 5px; height: 5px; background: #77818a; border-radius: 50%; }
.connection-pill[data-state="online"] i { background: #68cfa6; }
.welcome-view { display: flex; align-items: center; justify-content: center; flex-direction: column; position: relative; background: radial-gradient(ellipse at 50% 45%, #14232d44, transparent 65%); padding: 32px; }
.welcome-center { min-width: 0; max-width: 100%; text-align: center; margin-top: -28px; }
#welcome-chat { max-width: 100%; }
#welcome-chat-label { min-width: 0; overflow-wrap: anywhere; }
.welcome-mark { width: 130px; height: 130px; border: 1px solid #22333f; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 32px; background: #142129; position: relative; }
.welcome-mark::after { content: ""; position: absolute; inset: -12px; border: 1px solid #1c2933; border-radius: 50%; }
.welcome-mark img { opacity: .9; border-radius: 50%; }
.welcome-center .eyebrow { color: #6f899a; letter-spacing: .08em; font-size: 11px; margin-top: 8px; }
.welcome-center h2 { font-size: clamp(22px, 3vw, 30px); font-weight: 550; letter-spacing: -.04em; margin: 0; }
.welcome-center > p:not(.eyebrow) { font-size: 13px; line-height: 1.8; margin: 14px 0 30px; color: #8b969f; }
.welcome-footer { position: absolute; bottom: 24px; margin: 0; color: #52616e; font-size: 11px; letter-spacing: .08em; }
.chat-view { position: relative; display: flex; flex-direction: column; min-height: 0; min-width: 0; background: #111518; }
.chat-header { min-height: 87px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); padding: 17px 24px; flex-shrink: 0; background: #121619; }
.chat-heading { flex: 1; min-width: 0; }
.chat-heading h2 { font-size: 16px; line-height: 1.4; margin: 0 0 5px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#connection-label { margin: 0; color: #7f929f; font-size: 11px; }
#connection-label[data-state="online"] { color: #7dbca8; }
.back-button { margin-left: -12px; }
.connection-banner { color: #dfbe8e; background: #312819; border-bottom: 1px solid #4a3b22; font-size: 12px; line-height: 1.7; padding: 9px 24px; flex-shrink: 0; }
.messages { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 24px clamp(16px, 3vw, 36px) 12px; scrollbar-width: thin; scrollbar-color: #36434c transparent; }
.chat-intro { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 14px 0 28px; text-align: center; }
.chat-intro p { font-size: 12px; line-height: 1.8; color: #8696a1; margin: 0; }
.history-feedback { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 8px 16px; color: #a5b3bd; font-size: 12px; line-height: 1.7; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.history-feedback .text-button { flex-shrink: 0; padding: 6px 0; }
.intro-line { flex: 1; max-width: 36px; height: 1px; background: #2b3943; }
.date-divider { text-align: center; font-size: 10px; color: #70808c; margin: 8px 0 22px; }
.message-row { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 24px; }
.message-avatar { width: 31px; height: 31px; flex: 0 0 31px; display: grid; place-items: center; border-radius: 10px; background: #1c2d37; font-size: 11px; color: #a5c1d3; }
.message-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.message-row.user { flex-direction: row-reverse; }
.message-row.user .message-avatar { background: #293846; }
.message-wrap { max-width: min(82%, 650px); min-width: 0; }
.message-name { font-size: 10px; color: #8a9aa6; margin: 0 0 6px 2px; overflow-wrap: anywhere; }
.message-row.user .message-name { text-align: right; margin-right: 2px; }
.message-bubble { padding: 12px 15px; font-size: 14px; line-height: 1.85; color: #e0e8ee; background: #202b33; border: 1px solid #2a3741; border-radius: 3px 14px 14px 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.message-row.user .message-bubble { color: #e4f3ff; border-color: #315a76; background: #204461; border-radius: 14px 3px 14px 14px; }
.message-meta { font-size: 10px; line-height: 1.6; color: #7c8c98; margin: 6px 2px 0; }
.message-row.user .message-meta { text-align: right; }
.message-meta.warning { color: #d9b88b; }
.typing { display: flex; align-items: center; gap: 4px; padding: 5px 28px 11px; flex-shrink: 0; }
.typing > span { width: 4px; height: 4px; border-radius: 50%; background: #7c9bb0; animation: pulse 1.4s infinite; }
.typing > span:nth-child(2) { animation-delay: .2s; }
.typing > span:nth-child(3) { animation-delay: .4s; }
.typing small { font-size: 10px; margin-left: 6px; color: #8a9da9; }
.composer { padding: 12px 24px 16px; flex-shrink: 0; }
.composer-box { border: 1px solid #33404a; border-radius: 15px; padding: 9px 9px 9px 15px; display: flex; align-items: flex-end; gap: 12px; background: #1b232a; }
.composer-box:focus-within { border-color: #4980a6; }
.composer textarea { resize: none; width: 100%; min-width: 0; min-height: 36px; max-height: 144px; padding: 7px 0; background: none; border: 0; line-height: 1.55; font-size: 14px; outline: none; scrollbar-width: thin; }
.send-button { display: grid; place-items: center; border: 0; border-radius: 10px; width: 36px; height: 36px; flex: 0 0 36px; background: #72c5ff; color: #0b2c42; }
.send-button:not(:disabled):hover { background: #a1d8ff; }
.send-button:disabled { opacity: 1; background: #2a3a46; color: #718696; }
.send-button svg { width: 21px; height: 21px; stroke-width: 2; }
.composer-hint { text-align: right; font-size: 11px; color: #8c9ba6; margin: 9px 3px 0; }
.new-message-button { position: absolute; bottom: 130px; left: 50%; transform: translateX(-50%); z-index: 2; border: 1px solid #38556b; border-radius: 20px; background: #203748; color: #bce3ff; padding: 8px 15px; font-size: 12px; box-shadow: 0 3px 15px #0005; }
.sheet-dialog { width: min(calc(100% - 32px), 380px); max-height: calc(100dvh - 64px); overflow-y: auto; padding: 24px; border: 1px solid #34414b; border-radius: 20px; background: #161d23; color: #e6edf2; box-shadow: 0 24px 100px #0009; }
.sheet-dialog::backdrop { background: #0009; backdrop-filter: blur(4px); }
.dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 24px; }
.dialog-header h2 { font-size: 17px; font-weight: 600; margin: 0; }
.dialog-header .icon-button { margin: -9px -9px -9px 0; }
.dialog-profile { display: flex; align-items: center; gap: 13px; margin-bottom: 24px; }
.dialog-profile strong { font-size: 16px; }
.dialog-profile > div { min-width: 0; overflow-wrap: anywhere; }
.dialog-profile p { color: #8799a7; font-size: 11px; margin: 6px 0 0; }
.detail-list { padding: 14px 0; border-block: 1px solid #2a3741; margin: 0 0 16px; }
.detail-list > div { display: flex; justify-content: space-between; gap: 16px; font-size: 12px; line-height: 2.2; }
.detail-list dt { color: #91a0ac; }
.detail-list dd { margin: 0; overflow-wrap: anywhere; text-align: right; }
.dialog-note { font-size: 12px; color: #8f9eaa; line-height: 1.9; margin: 16px 0; }
.context-settings { padding-bottom: 18px; border-bottom: 1px solid #2a3741; }
.context-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.context-toolbar h3, .history-details h3 { font-size: 13px; font-weight: 600; margin: 0; }
.context-toolbar .text-button { padding: 10px 0; }
.context-name { margin: 4px 0 0; font-size: 12px; line-height: 1.8; color: #b3c1cb; overflow-wrap: anywhere; }
.context-settings .dialog-note { margin-bottom: 0; }
#context-action-status { color: #d9b88b; }
.history-details { margin-top: 20px; }
.history-details .dialog-note { margin: 8px 0 0; }
.password-form label { display: block; font-size: 12px; color: #a6b6c1; margin: 16px 0 8px; }
.password-form input { width: 100%; min-width: 0; padding: 12px; border: 1px solid #34434f; border-radius: 10px; background: #11181e; font-size: 16px; }
.password-form input:focus { border-color: #4997cf; }
.password-form input[readonly] { color: #a0b1bd; background: #1c252d; }
.password-form .primary-button { justify-content: center; font-size: 13px; }
.full-width { width: 100%; margin-top: 12px; }
.danger-button { padding: 12px; border: 1px solid #66403d; background: #362728; color: #eeb4ad; border-radius: 12px; font-size: 13px; }
.toast { position: fixed; bottom: max(30px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); z-index: 10; padding: 12px 18px; background: #263744; color: #ecf6fc; border: 1px solid #455e70; border-radius: 12px; font-size: 13px; line-height: 1.6; max-width: min(90%, 500px); width: max-content; box-shadow: 0 6px 30px #0005; }
@keyframes pulse { 0%, 70%, 100% { opacity: .3; } 35% { opacity: 1; } }
@media (max-width: 960px) and (min-width: 761px) {
  .app-frame { grid-template-columns: 302px minmax(0, 1fr); width: calc(100% - 24px); height: calc(100dvh - 24px); margin: 12px auto; border-radius: 18px; }
  .island-header { padding-inline: 17px; gap: 10px; }
  .island-header p { font-size: 10px; }
  .chat-header { padding-inline: 18px; }
  .composer { padding-inline: 18px; }
}
@media (max-width: 760px) {
  :root, body { background-color: var(--panel); }
  .login-view { background-color: var(--panel); }
  .app-frame { display: block; width: 100%; height: 100dvh; margin: 0; border: 0; border-radius: 0; }
  .sidebar { width: 100%; height: 100%; border: 0; padding-top: env(safe-area-inset-top); }
  .app-frame[data-detail="true"] .sidebar { display: none; }
  .welcome-view { display: none; }
  .chat-view { height: 100%; }
  .island-header { padding: 26px 24px 22px; }
  .island-header h1 { font-size: 23px; }
  .island-header p { font-size: 13px; }
  .chat-nav { margin: 0 20px; }
  .nav-item { min-height: 76px; font-size: 15px; }
  .sidebar-content { padding: 24px 14px; }
  .search-box { margin-inline: 10px; margin-bottom: 26px; padding: 12px; }
  .conversation-row { padding: 18px 11px; }
  .conversation-title strong { font-size: 17px; }
  #conversation-preview { font-size: 14px; }
  .sidebar-footer { min-height: calc(51px + max(16px, env(safe-area-inset-bottom))); padding: 16px 24px max(16px, env(safe-area-inset-bottom)); }
  .chat-header { padding: max(14px, env(safe-area-inset-top)) 16px 14px; min-height: 78px; gap: 10px; }
  .back-button { margin-left: -7px; }
  .chat-heading h2 { font-size: 16px; }
  .connection-banner { padding-inline: 18px; }
  .messages { padding: 18px 16px 8px; }
  .chat-intro { gap: 8px; }
  .message-wrap { max-width: calc(100% - 47px); }
  .message-bubble { font-size: 15px; padding: 10px 13px; }
  .composer { padding: 10px 14px max(12px, env(safe-area-inset-bottom)); }
  .composer textarea { font-size: 16px; }
  .composer-hint { display: none; }
  .new-message-button { bottom: 108px; }
}
/* Home Screen apps have no address bar; fill their containing viewport rather than a toolbar-sized dvh. */
@media (max-width: 760px) and (display-mode: standalone) {
  .app-frame, .login-view { height: 100%; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; scroll-behavior: auto !important; } }
.context-banner { margin: 0; padding: 9px 20px; font-size: 12px; line-height: 1.6; color: var(--muted, #9ba8b4); border-bottom: 1px solid #26323a; overflow-wrap: anywhere; }
