:root {
  --bg: #081219;
  --bg2: #0c1b24;
  --panel: #10232d;
  --panel2: #132a35;
  --line: rgba(163, 226, 237, .13);
  --text: #e9f6f8;
  --muted: #89a8b2;
  --dim: #5d7d88;
  --accent: #7ee4f1;
  --accent-soft: rgba(126, 228, 241, .12);
  --mint: #9ef0d4;
  --mine: #174955;
  --theirs: #11252f;
  --danger: #ff9d9d;
  --shadow: 0 22px 55px rgba(0, 0, 0, .38);
  --tab-h: 62px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; overflow: hidden; }
body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(1000px 600px at 100% 0%, rgba(46, 139, 160, .2), transparent 58%),
    radial-gradient(800px 600px at -10% 100%, rgba(53, 112, 91, .13), transparent 60%),
    var(--bg);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, textarea, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
.app {
  width: 100%;
  max-width: 760px;
  height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(8, 18, 25, .18), rgba(8, 18, 25, .72));
  padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom));
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  background: rgba(8, 18, 25, .75);
  border-bottom: 1px solid var(--line);
  z-index: 8;
}
.who { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.avatar {
  width: 41px; height: 41px; flex: 0 0 auto;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 22px;
  background: linear-gradient(145deg, #1d5f70, #0d2632);
  border: 1px solid rgba(149, 236, 246, .24);
  box-shadow: 0 8px 22px rgba(0, 0, 0, .28), inset 0 1px 0 rgba(255, 255, 255, .1);
}
.avatar.small { width: 35px; height: 35px; font-size: 18px; }
.who-text { min-width: 0; }
.name { font-size: 16px; font-weight: 650; letter-spacing: .02em; }
.sub { margin-top: 3px; display: flex; align-items: center; gap: 6px; font-size: 10px; color: var(--muted); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: #718b94; }
.dot.on { background: #7ce7b7; box-shadow: 0 0 0 3px rgba(124, 231, 183, .12); }
.badge {
  flex: 0 0 auto;
  padding: 6px 9px;
  border-radius: 999px;
  border: 1px solid rgba(158, 240, 212, .25);
  background: rgba(158, 240, 212, .06);
  color: #b9f6e6;
  font-size: 9px;
  letter-spacing: .12em;
  white-space: nowrap;
}
.screen { flex: 1; min-height: 0; position: relative; }
.chat-screen { display: flex; flex-direction: column; }
.messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px 14px 6px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scroll-behavior: auto;
  overscroll-behavior: contain;
}
.day {
  align-self: center;
  margin: 10px 0 2px;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(126, 228, 241, .055);
  border: 1px solid rgba(126, 228, 241, .08);
  color: var(--dim);
  font-size: 9px;
  letter-spacing: .08em;
}
.msg {
  display: flex;
  align-items: flex-end;
  gap: 7px;
  width: fit-content;
  max-width: min(84%, 560px);
  min-width: 0;
  animation: pop .16s ease-out;
}
.msg.mine { align-self: flex-end; flex-direction: row-reverse; margin-left: auto; }
.mini {
  width: 24px; height: 24px; flex: 0 0 auto;
  border-radius: 50%;
  display: grid; place-items: center;
  background: #132a35;
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}
.msg.mine .mini { background: rgba(23, 73, 85, .9); color: #c7f5fb; }
.wrap { min-width: 0; }
.bubble {
  min-width: 0;
  max-width: 100%;
  padding: 9px 11px;
  border-radius: 14px;
  border-bottom-left-radius: 5px;
  background: var(--theirs);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  box-shadow: 0 5px 16px rgba(0, 0, 0, .1);
}
.mine .bubble {
  background: linear-gradient(155deg, #1c5361, #143a46);
  border-color: rgba(126, 228, 241, .18);
  border-bottom-left-radius: 14px;
  border-bottom-right-radius: 5px;
}
.sticker-bubble {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 1px !important;
  font-size: 40px;
  line-height: 1.15;
}
.sticker-bubble img {
  width: 116px;
  height: 116px;
  object-fit: contain;
  display: block;
  border-radius: 13px;
  background: rgba(12, 27, 35, .45);
}
.meta { margin-top: 3px; font-size: 8px; color: #5e7d87; }
.mine .meta { text-align: right; }
.streaming .bubble::after {
  content: "▍";
  margin-left: 1px;
  color: var(--accent);
  animation: blink 1s steps(2, start) infinite;
}
.typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 1px 18px 7px;
}
.typing span {
  width: 4px; height: 4px; border-radius: 50%; background: var(--accent);
  animation: bounce 1s infinite;
}
.typing span:nth-child(2) { animation-delay: .12s; }
.typing span:nth-child(3) { animation-delay: .24s; }
.composer {
  display: flex;
  align-items: flex-end;
  gap: 7px;
  padding: 8px 11px 9px;
  background: rgba(8, 18, 25, .88);
  border-top: 1px solid var(--line);
  z-index: 6;
}
.round {
  width: 39px; height: 39px; flex: 0 0 auto;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(19, 42, 53, .92);
  color: var(--text);
  font-size: 19px;
  cursor: pointer;
}
textarea {
  flex: 1;
  min-height: 39px;
  max-height: 116px;
  resize: none;
  border: 1px solid var(--line);
  background: rgba(15, 33, 43, .92);
  color: var(--text);
  border-radius: 15px;
  padding: 9px 12px;
  outline: none;
  line-height: 1.4;
  font-size: 14px;
}
textarea::placeholder { color: #65838d; }
textarea:focus { border-color: rgba(126, 228, 241, .4); }
.send {
  height: 39px;
  padding: 0 14px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(155deg, #a5f0f5, #5ecbdc);
  color: #062129;
  font-weight: 750;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 7px 20px rgba(94, 203, 220, .18);
}
.send:active { transform: translateY(1px); }
.tabbar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: calc(var(--tab-h) + env(safe-area-inset-bottom));
  padding: 6px 18px env(safe-area-inset-bottom);
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 8px;
  background: rgba(8, 18, 25, .92);
  border-top: 1px solid var(--line);
  z-index: 9;
}
.tab {
  flex: 1;
  height: 48px;
  border: 0;
  background: transparent;
  color: #6c8b95;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 9px;
  letter-spacing: .04em;
  cursor: pointer;
  border-radius: 12px;
}
.tab span { font-size: 17px; line-height: 1; }
.tab.active { color: var(--accent); background: rgba(126, 228, 241, .06); }
.space-screen, .settings-screen { overflow-y: auto; padding: 18px 16px 24px; }
.space-hero {
  padding: 22px 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(150deg, rgba(28, 73, 84, .7), rgba(13, 32, 41, .82));
  box-shadow: var(--shadow);
}
.space-orb {
  width: 50px; height: 50px; border-radius: 16px;
  display: grid; place-items: center;
  background: rgba(126, 228, 241, .09);
  border: 1px solid rgba(126, 228, 241, .15);
  font-size: 26px;
  margin-bottom: 12px;
}
.space-hero h2 { margin: 0 0 6px; font-size: 18px; letter-spacing: .02em; }
.space-hero p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.space-empty {
  margin-top: 16px;
  padding: 38px 18px;
  border: 1px dashed rgba(163, 226, 237, .13);
  border-radius: 18px;
  text-align: center;
  color: var(--muted);
}
.empty-mark { font-size: 30px; opacity: .65; }
.empty-title { margin-top: 8px; font-size: 13px; color: var(--text); }
.empty-sub { margin-top: 4px; font-size: 10px; color: var(--dim); }
.settings-head { display: flex; align-items: center; gap: 11px; margin: 4px 0 16px; }
.settings-head h2 { margin: 0; font-size: 18px; }
.settings-head p { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.settings-card {
  margin-bottom: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(16, 35, 45, .72);
}
.row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 7px 0; font-size: 11px; color: var(--muted); }
.row + .row { border-top: 1px solid rgba(163, 226, 237, .06); }
.row b { color: var(--text); font-weight: 500; text-align: right; }
.settings-title { font-size: 12px; font-weight: 650; margin-bottom: 6px; }
.muted { color: var(--muted); font-size: 10px; line-height: 1.65; margin: 0; }
.ghost {
  margin-top: 10px;
  width: 100%;
  padding: 9px;
  border-radius: 10px;
  border: 1px solid rgba(126, 228, 241, .2);
  background: rgba(126, 228, 241, .06);
  color: var(--accent);
  font-size: 11px;
}
.sheet {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 30;
  padding: 8px 16px calc(18px + env(safe-area-inset-bottom));
  border-radius: 22px 22px 0 0;
  background: rgba(11, 26, 34, .98);
  border-top: 1px solid var(--line);
  box-shadow: 0 -20px 50px rgba(0, 0, 0, .35);
  animation: sheetUp .18s ease-out;
}
.sheet-grab { width: 34px; height: 4px; border-radius: 999px; background: rgba(163, 226, 237, .18); margin: 0 auto 10px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 0 2px 10px; font-size: 11px; color: var(--muted); letter-spacing: .08em; }
.sheet-close { border: 0; background: transparent; color: var(--muted); font-size: 22px; line-height: 1; }
.sticker-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; max-height: 52dvh; overflow-y: auto; overscroll-behavior: contain; padding-right: 2px; }
.sticker {
  height: 62px;
  padding: 4px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: rgba(26, 54, 65, .6);
  font-size: 25px;
  cursor: pointer;
  overflow: hidden;
}
.sticker img { width: 100%; height: 100%; object-fit: contain; display: block; }
.sticker:active { background: rgba(126, 228, 241, .15); }
.sheet-backdrop { position: absolute; inset: 0; z-index: 20; background: rgba(2, 8, 12, .45);  }
.login {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center; padding: 24px;
  background: rgba(4, 11, 16, .94);
}
.login-card {
  width: min(360px, 100%);
  padding: 26px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #102730, #0b1a22);
  box-shadow: var(--shadow);
}
.login-avatar { width: 64px; height: 64px; border-radius: 18px; overflow: hidden; }
.login-avatar img { width: 100%; height: 100%; object-fit: cover; }
.login h1 { margin: 12px 0 5px; font-size: 21px; }
.login p { margin: 0 0 16px; color: var(--muted); font-size: 11px; line-height: 1.65; }
.login input {
  width: 100%; padding: 11px 12px; margin-bottom: 10px;
  border: 1px solid var(--line); border-radius: 12px;
  background: #0a171e; color: var(--text); outline: none;
}
.login button {
  width: 100%; padding: 11px; border: 0; border-radius: 12px;
  background: linear-gradient(155deg, #a5f0f5, #5ecbdc); color: #062129;
  font-weight: 750; cursor: pointer;
}
.error { min-height: 16px; margin-top: 8px; color: var(--danger); font-size: 11px; }
@keyframes pop { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .45; } 30% { transform: translateY(-3px); opacity: 1; } }
@keyframes sheetUp { from { transform: translateY(20px); opacity: .6; } to { transform: none; opacity: 1; } }
@media (min-width: 761px) {
  .app { border-left: 1px solid rgba(163, 226, 237, .06); border-right: 1px solid rgba(163, 226, 237, .06); }
  .messages { padding-left: 22px; padding-right: 22px; }
}
@media (max-width: 380px) {
  .sticker-grid { grid-template-columns: repeat(5, 1fr); }
  .badge { font-size: 8px; padding: 5px 7px; }
}

.reply-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-top: 1px solid var(--line);
  background: rgba(13, 30, 39, .9);
  font-size: 10px;
  color: var(--muted);
}
.reply-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reply-text span { color: var(--accent); margin-right: 5px; }
.reply-text b { font-weight: 500; color: #c4e8ee; }
.reply-cancel { border: 0; background: transparent; color: var(--muted); font-size: 20px; line-height: 1; }
.bubble img.photo {
  display: block;
  max-width: min(240px, 62vw);
  max-height: 300px;
  border-radius: 11px;
  object-fit: cover;
}
.msg-menu {
  position: absolute;
  left: 50%; bottom: calc(var(--tab-h) + 76px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  width: min(330px, calc(100% - 32px));
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(11, 26, 34, .98);
  box-shadow: var(--shadow);
}
.msg-menu button {
  padding: 8px 4px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(25, 52, 62, .7);
  color: var(--text);
  font-size: 11px;
}
.msg-menu button:active { background: rgba(126, 228, 241, .15); }
.reply-quote {
  margin-bottom: 5px;
  padding: 5px 7px;
  border-left: 2px solid rgba(126, 228, 241, .45);
  border-radius: 4px;
  background: rgba(126, 228, 241, .06);
  color: #9fc4cc;
  font-size: 10px;
  line-height: 1.4;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.space-list { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.space-card {
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(16, 35, 45, .72);
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
}
.space-time { color: var(--dim); font-size: 9px; letter-spacing: .04em; margin-bottom: 6px; }
.space-content { white-space: pre-wrap; word-break: break-word; font-size: 12px; line-height: 1.65; color: #d5edf0; }
.space-meta { margin-top: 8px; color: var(--dim); font-size: 9px; }
.tab { position: relative; }
.tab-badge {
  position: absolute;
  top: 3px;
  right: 18%;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #ff7d7d;
  color: #2b0909;
  font-size: 9px;
  line-height: 16px;
  font-weight: 800;
  text-align: center;
  box-shadow: 0 2px 8px rgba(255, 80, 80, .3);
}
.scroll-bottom {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 7;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(13, 31, 40, .9);
  color: var(--accent);
  font-size: 17px;
}
.space-refresh {
  margin-top: 13px;
  padding: 7px 12px;
  border: 1px solid rgba(126, 228, 241, .2);
  border-radius: 9px;
  background: rgba(126, 228, 241, .06);
  color: var(--accent);
  font-size: 10px;
}.avatar img, .mini img, .space-orb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: inherit;
}
.avatar { overflow: hidden; }
.space-orb { overflow: hidden; }.install-link {
  display: block;
  text-align: center;
  text-decoration: none;
  box-sizing: border-box;
}.sheet-actions { display: flex; align-items: center; gap: 8px; }
.sheet-add {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid rgba(126, 228, 241, .22);
  background: rgba(126, 228, 241, .07);
  color: var(--accent);
  font-size: 18px;
  line-height: 1;
}.bubble + .bubble { margin-top: 6px; }.memory-list {
  margin-top: 10px;
  max-height: 260px;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, .025);
  color: var(--text);
  font-size: 11px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}
.import-divider {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 14px 0 8px;
  color: var(--muted);
  font-size: 10px;
}
.import-divider::before,
.import-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}.memory-search-row { display: flex; gap: 8px; margin-top: 9px; }
.memory-input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, .035);
  color: var(--text);
  padding: 9px 10px;
  font-size: 11px;
  outline: none;
}
.memory-input:focus { border-color: rgba(126, 228, 241, .45); }.poke-bubble {
  background: rgba(255, 214, 120, .12) !important;
  border: 1px solid rgba(255, 214, 120, .25) !important;
  color: #ffd678 !important;
  box-shadow: none !important;
}.retry-btn {
  margin-top: 7px;
  padding: 3px 10px;
  border: 1px solid rgba(255, 214, 120, .35);
  border-radius: 7px;
  background: rgba(255, 214, 120, .08);
  color: #ffd678;
  font-size: 10px;
}.file-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 12px;
  line-height: 1.5;
  word-break: break-all;
}
.poke-bubble { user-select: none; }.self-note-caption {
  margin-top: 5px;
  max-width: 260px;
  color: rgba(190, 205, 210, .62);
  font-size: 9px;
  font-style: italic;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}.space-image {
  width: 100%;
  max-height: 240px;
  object-fit: cover;
  border-radius: 10px;
  margin-top: 9px;
  border: 1px solid var(--line);
}.home-screen { overflow: auto; padding: 14px 14px 20px; }
.home-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.home-head h2 { margin: 0; font-size: 20px; }
.home-head p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.home-wind { color: var(--accent); font-size: 10px; border: 1px solid var(--line); border-radius: 999px; padding: 4px 8px; }
.home-map { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: #0a151b; }
.home-map img { display: block; width: 100%; height: auto; }
.home-hotspot { position: absolute; border: 1px solid transparent; background: transparent; border-radius: 8px; cursor: pointer; }
.home-hotspot:hover { border-color: rgba(126, 228, 241, .55); background: rgba(126, 228, 241, .08); }
.home-hotspot.active { border-color: rgba(255, 214, 120, .85); background: rgba(255, 214, 120, .12); box-shadow: 0 0 0 2px rgba(255, 214, 120, .08); }
.home-info { margin-top: 10px; color: var(--muted); font-size: 11px; line-height: 1.6; }.home-board { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.home-board-head { display: flex; align-items: center; justify-content: space-between; color: var(--text); font-size: 13px; margin-bottom: 8px; }
.home-board-head .ghost { padding: 5px 9px; font-size: 10px; }
.home-notes { display: flex; flex-direction: column; gap: 7px; }
.home-note { padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255, 255, 255, .025); }
.home-note-top { display: flex; justify-content: space-between; color: var(--muted); font-size: 9px; margin-bottom: 4px; }
.home-note-text { color: var(--text); font-size: 11px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.home-note-form { display: grid; grid-template-columns: 86px 1fr; gap: 7px; margin-top: 8px; }
.home-note-form select, .home-note-form input { min-width: 0; border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.035); color: var(--text); padding: 8px; font-size: 11px; }
.home-note-form input { grid-column: 1 / -1; }
.home-note-form button { font-size: 10px; padding: 7px; }.home-room-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.home-room-list button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, .03);
  color: var(--muted);
  padding: 5px 9px;
  font-size: 10px;
}
.home-room-list button.active {
  border-color: rgba(255, 214, 120, .7);
  color: #ffd678;
  background: rgba(255, 214, 120, .1);
}.home-go { margin-top: 9px; padding: 7px 12px; font-size: 10px; }