/* BB机 base styles: app shell, desktop, settings pages. Chat styles live in chat.css.
   Liquid glass follows iOS 27: glass only on controls floating above content, a darkened
   outer edge, a bright specular rim, and springy presses. iPhone Safari can't refract the
   backdrop (no url() backdrop-filter), so the look is built from tint, blur and light. */
:root {
  --bg: #f2f2f7;
  --surface: #ffffff;
  --surface-2: #e9e9ee;
  --line: rgba(60, 60, 67, 0.14);
  --text: #111111;
  --muted: #8a8a8f;
  --accent: #007aff;
  --danger: #ff3b30;

  /* liquid glass */
  --lg-tint: rgba(255, 255, 255, 0.52);
  --lg-tint-clear: rgba(255, 255, 255, 0.16);
  --lg-blur: blur(14px) saturate(1.8);
  --lg-blur-clear: blur(10px) saturate(1.7);
  --lg-highlight: radial-gradient(130% 80% at 18% -18%, rgba(255, 255, 255, 0.55), transparent 58%);
  --lg-rim:
    inset 0 1.5px 1px -0.5px rgba(255, 255, 255, 0.9),
    inset 0 -1.5px 1px -0.5px rgba(0, 0, 0, 0.1),
    inset 0 0 0 0.5px rgba(255, 255, 255, 0.45);
  --lg-edge: 0 0 0 0.5px rgba(0, 0, 0, 0.1);
  --lg-shadow: 0 8px 30px rgba(20, 24, 40, 0.12);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  --app-h: 100dvh;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --nav-h: calc(var(--safe-top) + 60px);
  --wallpaper: none;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --surface: #1c1c1e;
    --surface-2: #2c2c2e;
    --line: rgba(120, 120, 128, 0.32);
    --text: #f5f5f7;
    --muted: #98989d;
    --accent: #0a84ff;
    --danger: #ff453a;

    --lg-tint: rgba(44, 44, 48, 0.55);
    --lg-tint-clear: rgba(30, 30, 34, 0.24);
    --lg-highlight: radial-gradient(130% 80% at 18% -18%, rgba(255, 255, 255, 0.16), transparent 58%);
    --lg-rim:
      inset 0 1.5px 1px -0.5px rgba(255, 255, 255, 0.32),
      inset 0 -1.5px 1px -0.5px rgba(0, 0, 0, 0.35),
      inset 0 0 0 0.5px rgba(255, 255, 255, 0.12);
    --lg-edge: 0 0 0 0.5px rgba(0, 0, 0, 0.6);
    --lg-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
    color-scheme: dark;
  }
}
/* Accessibility wins: solid surfaces when the user asks for less transparency. */
@media (prefers-reduced-transparency: reduce) {
  :root { --lg-tint: var(--surface); --lg-tint-clear: rgba(40, 40, 46, 0.85); --lg-blur: none; --lg-blur-clear: none; }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); overflow: hidden; }
body {
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Apple SD Gothic Neo", "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
button:disabled { opacity: 0.4; cursor: default; }
[hidden] { display: none !important; }
::selection { background: rgba(0, 122, 255, 0.28); }

#root { position: fixed; inset: 0 0 auto 0; height: var(--app-h); overflow: hidden; }
.screen {
  position: absolute; inset: 0; display: flex; flex-direction: column; overflow: hidden;
  background: var(--bg);
  animation: screen-in 0.36s cubic-bezier(0.2, 0.9, 0.25, 1);
}
.screen.home, .screen.splash, .screen.login { animation: none; }
@keyframes screen-in { from { transform: translateX(30%); opacity: 0.3; } to { transform: none; opacity: 1; } }
.splash { background: var(--bg); }

/* ---------- liquid glass building blocks ---------- */
.glass, .glass-btn, .action-items, .action-cancel, .toast, .dock, .widget {
  background: var(--lg-highlight), var(--lg-tint);
  -webkit-backdrop-filter: var(--lg-blur);
  backdrop-filter: var(--lg-blur);
  box-shadow: var(--lg-rim), var(--lg-edge), var(--lg-shadow);
}
.glass-btn {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: var(--text);
  transition: transform 0.34s var(--spring);
}
.glass-btn:active, .spring:active { transform: scale(0.9); }
.spring { transition: transform 0.34s var(--spring); }
.glass-btn.capsule { width: auto; padding: 0 16px; border-radius: 99px; font-size: 16px; font-weight: 600; }
.glass-btn.prominent {
  color: #fff; background: radial-gradient(130% 80% at 18% -18%, rgba(255, 255, 255, 0.45), transparent 58%), var(--accent);
}

/* ---------- avatars ---------- */
.avatar {
  flex: none; width: 40px; height: 40px; border-radius: 50%; object-fit: cover; display: block;
  background: var(--surface-2);
}
.avatar-letter {
  display: grid; place-items: center; color: #fff; font-weight: 600; font-size: 17px;
  background: linear-gradient(135deg, #9aa6bd, #626d84);
}

/* ---------- page with floating glass navigation ---------- */
.page { --page-bg: var(--bg); }
.navbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 20; height: var(--nav-h);
  padding: calc(var(--safe-top) + 8px) 12px 0;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; gap: 8px;
  pointer-events: none;
}
/* iOS 27 "uniform toolbar": content softly dissolves under the top edge. */
.navbar::before {
  content: ""; position: absolute; inset: 0 0 -18px; z-index: -1;
  background: linear-gradient(to bottom, var(--page-bg) 30%, color-mix(in srgb, var(--page-bg) 70%, transparent) 65%, transparent);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  -webkit-mask-image: linear-gradient(to bottom, #000 60%, transparent); mask-image: linear-gradient(to bottom, #000 60%, transparent);
}
.navbar > * { pointer-events: auto; }
.navbar h1 {
  margin: 0; height: 44px; line-height: 44px; text-align: center; font-size: 17px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 56vw;
}
.nav-left { justify-self: start; display: flex; gap: 8px; }
.nav-right { justify-self: end; display: flex; gap: 8px; }
.page-body {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: calc(var(--nav-h) + 4px) 16px calc(var(--safe-bottom) + 32px);
}

/* ---------- grouped lists ---------- */
.group-title { margin: 24px 18px 8px; font-size: 13px; font-weight: 500; color: var(--muted); }
.group { background: var(--surface); border-radius: 26px; overflow: hidden; margin-top: 18px; }
.group-title + .group { margin-top: 0; }
.group-footer { margin: 8px 18px 0; font-size: 13px; color: var(--muted); line-height: 1.45; }
.row {
  display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 7px 18px;
  position: relative;
}
.row + .row::before { content: ""; position: absolute; top: 0; left: 18px; right: 0; border-top: 0.5px solid var(--line); }
.row.tappable { cursor: pointer; transition: background 0.15s; }
.row.tappable:active { background: var(--surface-2); }
.row-label { flex: none; display: flex; flex-direction: column; }
.row-value { flex: 1; min-width: 0; display: flex; justify-content: flex-end; color: var(--muted); white-space: nowrap; }
.row-value input, .row-value select {
  width: 100%; border: 0; outline: none; background: none; text-align: right; font-size: 16px; color: var(--muted); padding: 8px 0;
}
.row-value select { direction: rtl; appearance: none; -webkit-appearance: none; }
.row-value input.switch { width: 51px; padding: 0; }
.row-chevron { color: var(--muted); opacity: 0.55; font-size: 22px; line-height: 1; margin-left: -4px; }
.row-danger .row-label { color: var(--danger); }
.row-icon { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: #fff; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35); }
.row-profile { padding: 14px 18px; }
.profile-name { font-size: 20px; font-weight: 600; }
.profile-sub { font-size: 13px; color: var(--muted); }

.field-textarea {
  display: block; width: 100%; border: 0; outline: none; resize: vertical; background: none;
  padding: 14px 18px; font-size: 16px; line-height: 1.55; min-height: 120px;
}
.field-textarea.code { font: 13px/1.5 ui-monospace, Menlo, monospace; white-space: pre; overflow-x: auto; }

.switch {
  appearance: none; -webkit-appearance: none; width: 51px; height: 31px; border-radius: 99px; position: relative;
  background: var(--surface-2); transition: background 0.25s; cursor: pointer; flex: none; margin: 0;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 99px;
  background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2); transition: transform 0.34s var(--spring), width 0.2s;
}
.switch:active::after { width: 33px; }
.switch:checked { background: #34c759; }
.switch:checked::after { transform: translateX(20px); }
.switch:checked:active::after { transform: translateX(14px); }

.btn-row { display: flex; gap: 10px; padding: 12px 14px 14px; border-top: 0.5px solid var(--line); }
.btn-primary {
  height: 52px; border-radius: 99px; font-size: 17px; font-weight: 600; color: #fff;
  background: radial-gradient(130% 80% at 18% -18%, rgba(255, 255, 255, 0.4), transparent 58%), var(--accent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 6px 18px rgba(0, 122, 255, 0.3);
  transition: transform 0.34s var(--spring);
}
.btn-primary:active { transform: scale(0.96); }
.btn-secondary {
  flex: 1; border-radius: 99px; padding: 12px; background: var(--surface-2); color: var(--accent); font-weight: 600;
  transition: transform 0.34s var(--spring);
}
.btn-secondary:active { transform: scale(0.95); }
.btn-secondary.danger { color: var(--danger); }

.profile-hero { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 10px 0 4px; cursor: pointer; }
.profile-hero .avatar { box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15); }
.profile-hero span { color: var(--accent); font-size: 15px; font-weight: 500; }

.wallpaper-preview {
  height: 180px; margin: 12px; border-radius: 18px; display: grid; place-items: center; cursor: pointer;
  background: linear-gradient(165deg, #6f7fd8, #b98ad6 50%, #ef9f8a) center / cover;
}
.wallpaper-preview span { padding: 8px 16px; border-radius: 99px; font-size: 14px; font-weight: 500; color: #fff;
  background: rgba(255, 255, 255, 0.2); -webkit-backdrop-filter: blur(10px) saturate(1.6); backdrop-filter: blur(10px) saturate(1.6);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 0 0 0.5px rgba(0, 0, 0, 0.1); }

.empty { text-align: center; color: var(--muted); padding: 60px 20px; }

/* ---------- login ---------- */
.login { justify-content: center; align-items: center; padding: 24px; }
.login-card { width: min(340px, 100%); display: flex; flex-direction: column; gap: 14px; text-align: center; }
.login-logo { width: 92px; height: 92px; border-radius: 24px; margin: 0 auto 4px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15); }
.login-card h1 { margin: 0 0 8px; font-size: 28px; font-weight: 700; }
.login-card input {
  height: 52px; padding: 0 20px; border-radius: 99px; border: 0; background: var(--surface); font-size: 17px; outline: none;
}
.form-error { margin: 0; min-height: 1.4em; color: var(--danger); font-size: 14px; }

/* ---------- desktop ---------- */
.home {
  --lg-tint: var(--lg-tint-clear);
  --lg-blur: var(--lg-blur-clear);
  --lg-highlight: radial-gradient(130% 80% at 18% -18%, rgba(255, 255, 255, 0.4), transparent 58%);
  --lg-rim:
    inset 0 1.5px 1px -0.5px rgba(255, 255, 255, 0.85),
    inset 0 -1.5px 1px -0.5px rgba(0, 0, 0, 0.12),
    inset 0 0 0 0.5px rgba(255, 255, 255, 0.4);
  --lg-edge: 0 0 0 0.5px rgba(0, 0, 0, 0.12);
  background: var(--wallpaper) center / cover no-repeat, linear-gradient(165deg, #6f7fd8 0%, #b98ad6 50%, #ef9f8a 100%);
  padding: calc(var(--safe-top) + 18px) 22px 0;
  color: #fff;
}
@media (prefers-color-scheme: dark) {
  .home { background: var(--wallpaper) center / cover no-repeat, linear-gradient(165deg, #1e2547 0%, #3a2650 50%, #57322c 100%); }
}
.home-widgets { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.widget {
  aspect-ratio: 1; border-radius: 26px; padding: 16px; text-align: left; color: #fff;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.22);
  display: flex; flex-direction: column; overflow: hidden;
}
.widget-clock { justify-content: flex-end; }
.clock-time { font-size: 50px; font-weight: 200; letter-spacing: -1.5px; line-height: 1; }
.clock-date { margin-top: 8px; font-size: 14px; font-weight: 600; opacity: 0.95; }
.widget-collab { gap: 10px; cursor: pointer; transition: transform 0.34s var(--spring); }
.widget-collab:active { transform: scale(0.95); }
.widget-collab-head { display: flex; align-items: center; gap: 10px; }
.widget-collab-head .avatar { box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.6); }
.widget-collab-name { font-weight: 700; font-size: 16px; }
.widget-collab-status { font-size: 12px; opacity: 0.85; }
.widget-collab-last {
  font-size: 14px; line-height: 1.38; opacity: 0.96; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.home-spacer { flex: 1; }
.home-apps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px 8px; margin-top: 26px; justify-items: center; }
.miniapp-page .page-body { padding: var(--nav-h) 0 0; overflow: hidden; display: flex; }
.miniapp-frame { flex: 1; width: 100%; border: 0; background: var(--bg); }
.miniapp-bare { position: fixed; inset: 0; z-index: 50; display: flex; background: #0d0c0b; padding-top: env(safe-area-inset-top); }
.miniapp-bare .miniapp-frame { background: #0d0c0b; }
.app-icon { display: flex; flex-direction: column; align-items: center; gap: 7px; color: #fff; }
.app-icon .app-tile { transition: transform 0.34s var(--spring); }
.app-icon:active .app-tile { transform: scale(0.88); }

/* Layered app icon: colour base, glass glyph, specular rim and a soft top light. */
.app-tile {
  position: relative; width: 62px; height: 62px; border-radius: 17px; display: grid; place-items: center; color: #fff;
  box-shadow:
    inset 0 1.5px 1px -0.5px rgba(255, 255, 255, 0.75),
    inset 0 -2px 2px -1px rgba(0, 0, 0, 0.18),
    inset 0 0 0 0.5px rgba(255, 255, 255, 0.3),
    0 0 0 0.5px rgba(0, 0, 0, 0.08),
    0 6px 16px rgba(0, 0, 0, 0.16);
  overflow: hidden; isolation: isolate;
}
.app-tile::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(120% 70% at 25% -10%, rgba(255, 255, 255, 0.55), transparent 55%);
}
.app-tile .icon { filter: drop-shadow(0 1.5px 2px rgba(0, 0, 0, 0.22)); }
.app-label { font-size: 12px; font-weight: 500; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.45); white-space: nowrap; }
.tint-green { background: linear-gradient(170deg, #6ef08a, #25bd4c); }
.tint-pink { background: linear-gradient(170deg, #ff9ec0, #ff4f8a); }
.tint-amber { background: linear-gradient(170deg, #ffd56a, #ff9d0a); }
.tint-violet { background: linear-gradient(170deg, #c1a0ff, #7b4cf2); }
.tint-teal { background: linear-gradient(170deg, #6ee6dd, #17afaa); }
.tint-rose { background: linear-gradient(170deg, #ffab9c, #ff6286); }
.tint-indigo { background: linear-gradient(170deg, #8ea2ff, #4a5ef0); }
.tint-gray { background: linear-gradient(170deg, #b4b4bc, #72727a); }
.dock {
  margin: 0 -8px calc(var(--safe-bottom) + 10px); padding: 14px 18px; border-radius: 36px;
  display: flex; justify-content: center; gap: 44px;
}
.dock .app-label { display: none; }

/* ---------- conversation list ---------- */
.chats-page .page-body { padding-left: 0; padding-right: 0; }
.conv-list { list-style: none; margin: 0; padding: 0 8px; }
.conv-list li {
  display: flex; gap: 12px; align-items: center; padding: 10px 12px; cursor: pointer; border-radius: 22px;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; transition: background 0.15s;
}
.conv-list li:active { background: var(--surface-2); }
.conv-text { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.conv-top { display: flex; justify-content: space-between; gap: 8px; }
.conv-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-time { color: var(--muted); font-size: 14px; flex: none; }
.conv-last { color: var(--muted); font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-last.is-busy { color: var(--accent); }

/* ---------- search ---------- */
.search-field {
  width: 100%; height: 44px; padding: 0 18px; border: 0; outline: none; border-radius: 99px; font-size: 16px;
  background: var(--surface); margin-bottom: 12px; -webkit-appearance: none; appearance: none;
}
.search-results { list-style: none; margin: 0; padding: 0; background: var(--surface); border-radius: 26px; overflow: hidden; }
.search-results:empty { display: none; }
.search-results li { padding: 12px 18px; cursor: pointer; position: relative; }
.search-results li + li::before { content: ""; position: absolute; top: 0; left: 18px; right: 0; border-top: 0.5px solid var(--line); }
.search-results li:active { background: var(--surface-2); }
.search-snippet { margin-top: 3px; font-size: 14px; color: var(--muted); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.search-snippet mark { background: rgba(255, 204, 0, 0.45); color: var(--text); border-radius: 3px; padding: 0 1px; }

/* ---------- soon ---------- */
.soon { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 80px 24px; color: var(--muted); }
.soon-icon {
  width: 92px; height: 92px; border-radius: 26px; display: grid; place-items: center; color: #fff;
  background: radial-gradient(120% 70% at 25% -10%, rgba(255, 255, 255, 0.5), transparent 55%), linear-gradient(170deg, #b4b4bc, #72727a);
  box-shadow: inset 0 1.5px 1px -0.5px rgba(255, 255, 255, 0.7), 0 10px 24px rgba(0, 0, 0, 0.15);
}
.soon h2 { color: var(--text); margin: 20px 0 6px; font-size: 22px; }

/* ---------- overlays ---------- */
.action-sheet {
  position: fixed; inset: 0; z-index: 200; background: rgba(0, 0, 0, 0.22);
  display: flex; align-items: flex-end; animation: fade-in 0.2s;
}
@keyframes fade-in { from { opacity: 0; } }
.action-panel {
  width: 100%; padding: 10px 10px calc(var(--safe-bottom) + 10px); display: flex; flex-direction: column; gap: 10px;
  animation: sheet-up 0.42s var(--spring);
}
@keyframes sheet-up { from { transform: translateY(60%) scale(0.96); opacity: 0; } }
/* Reading surfaces get a thicker veil so what's behind doesn't bleed through. */
.action-items, .action-cancel { background: var(--lg-highlight), color-mix(in srgb, var(--surface) 86%, transparent); }
.action-items { border-radius: 30px; overflow: hidden; }
.reaction-picker {
  display: flex; justify-content: space-between; padding: 8px 10px; border-radius: 99px;
  background: var(--lg-highlight), color-mix(in srgb, var(--surface) 86%, transparent);
  -webkit-backdrop-filter: var(--lg-blur); backdrop-filter: var(--lg-blur); box-shadow: var(--lg-rim), var(--lg-edge), var(--lg-shadow);
  animation: sheet-up 0.42s var(--spring);
}
.reaction-picker button { width: 38px; height: 38px; border-radius: 50%; font-size: 24px; line-height: 38px; transition: transform 0.3s var(--spring); }
.reaction-picker button:active { transform: scale(1.3); }
.reaction-picker button.is-selected { background: rgba(0, 122, 255, 0.18); }
.action-title { padding: 14px 18px; text-align: center; font-size: 13px; color: var(--muted); border-bottom: 0.5px solid var(--line); }
.action-items button, .action-cancel { display: block; width: 100%; padding: 17px; font-size: 18px; color: var(--accent); }
.action-items button:active { background: rgba(127, 127, 127, 0.14); }
.action-items button + button { border-top: 0.5px solid var(--line); }
.action-items button.danger { color: var(--danger); }
.pick-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 14px; }
.action-items .pick-chips button { display: inline-block; width: auto; padding: 8px 13px; font-size: 15px; border: 1px solid var(--line); border-radius: 99px; }
.action-items .pick-chips button + button { border-top: 1px solid var(--line); }
.action-items .pick-chips button.is-picked { background: var(--accent); color: #fff; border-color: var(--accent); }
.voice-tagged { font-size: 11px; opacity: 0.7; }
.action-cancel { border-radius: 99px; font-weight: 600; transition: transform 0.34s var(--spring); }
.action-cancel:active { transform: scale(0.96); }
.viewer { position: fixed; inset: 0; z-index: 300; background: rgba(0, 0, 0, 0.94); display: grid; place-items: center; animation: fade-in 0.2s; }
.viewer-strip { width: 100%; height: 100%; display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.viewer-strip::-webkit-scrollbar { display: none; }
.viewer-page { flex: 0 0 100%; height: 100%; display: grid; place-items: center; scroll-snap-align: center; }
.viewer img { max-width: 100%; max-height: 100%; }
.viewer-img { touch-action: pan-x; transform-origin: center; transition: transform 0.05s linear; will-change: transform; }
.viewer-strip.is-zoomed { overflow: hidden; }
.viewer-strip.is-zoomed .viewer-img { touch-action: none; }
.viewer-count { position: absolute; left: 50%; bottom: calc(var(--safe-bottom, 0px) + 24px); transform: translateX(-50%); color: #fff; font-size: 14px; opacity: 0.85; pointer-events: none; }
.toast {
  position: fixed; left: 50%; top: calc(var(--safe-top) + 12px); transform: translateX(-50%); z-index: 400;
  color: var(--text); padding: 12px 20px; border-radius: 99px; font-size: 14px; font-weight: 500;
  max-width: 88vw; text-align: center; animation: toast-in 0.5s var(--spring);
}
@keyframes toast-in { from { transform: translate(-50%, -24px) scale(0.9); opacity: 0; } }

/* Wide screens (computer): keep it phone-shaped. */
@media (min-width: 640px) {
  /* The transform also makes fixed overlays stay inside the phone frame. */
  #root { left: 50%; width: 430px; transform: translateX(-50%); box-shadow: 0 0 0 0.5px var(--line), 0 10px 40px rgba(0, 0, 0, 0.12); }
}

/* ---------- library pages (presets, world books, stickers) ---------- */
.page-note { margin: 6px 18px 4px; font-size: 13px; line-height: 1.5; color: var(--muted); }
.row-sub { font-size: 12.5px; color: var(--muted); font-weight: 400; margin-top: 1px; }
.entry-row .row-label { flex: 1; min-width: 0; }
.entry-row .row-value { flex: none; }
.entry-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entry-row .row-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.group-title-row { display: flex; justify-content: space-between; align-items: center; }
.text-link { color: var(--accent); font-size: 13px; text-transform: none; }
.sticker-library { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 10px; }
.sticker-tile { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px; border-radius: 12px; min-width: 0; }
.sticker-tile:active { background: var(--surface-2); }
.sticker-tile img { width: 100%; aspect-ratio: 1; object-fit: contain; }
.sticker-tile span { font-size: 11px; color: var(--muted); max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.import-list { padding: 4px 0; }
.import-item { display: flex; align-items: center; gap: 10px; padding: 6px 14px; }
.import-item + .import-item { border-top: 0.5px solid var(--line); }
.import-item img { width: 44px; height: 44px; object-fit: contain; flex: none; }
.import-item input:not(.switch) { flex: 1; min-width: 0; border: 0; outline: none; background: none; font-size: 16px; }
.import-item.is-off img, .import-item.is-off input:not(.switch) { opacity: 0.35; }
.sticker-preview { display: grid; place-items: center; padding: 16px; }
.sticker-preview img { max-width: 160px; max-height: 160px; object-fit: contain; }
.tint-green .icon, .row-icon .icon { color: #fff; }

/* ---------- memory ---------- */
.segmented { display: flex; gap: 4px; padding: 4px; margin: 4px 0 6px; border-radius: 99px; background: var(--surface-2); }
.segmented button { flex: 1; padding: 8px 6px; border-radius: 99px; font-size: 14px; font-weight: 500; color: var(--muted); transition: background 0.2s; }
.segmented button.is-active { background: var(--surface); color: var(--text); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1); }
.memory-row { align-items: flex-start; padding-top: 12px; padding-bottom: 12px; }
.memory-text { flex: 1; font-size: 15px; line-height: 1.5; }
.memory-badge { flex: none; font-size: 11px; color: var(--accent); background: rgba(0, 122, 255, 0.12); padding: 2px 7px; border-radius: 99px; }
.reading { white-space: pre-wrap; font-size: 16px; line-height: 1.75; padding: 8px 6px 40px; -webkit-user-select: text; user-select: text; }
.row-hint { font-size: 12px; color: var(--muted); font-weight: 400; }
.archive-link { display: flex; align-items: center; gap: 8px; margin: 14px 20px; color: var(--muted); font-size: 15px; }
.archive-link .row-chevron { margin-left: auto; }

/* 唤醒: quiet hours "01:00 到 08:00" */
.time-range { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.row-value .time-range input[type="time"] { width: auto; min-width: 0; padding: 4px 6px; border-radius: 8px; background: var(--fill, rgba(120, 120, 128, 0.12)); border: 0; font: inherit; color: var(--text); }

/* 设定图 */
.ref-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; padding: 10px 16px 14px; }
.ref-grid img, .ref-add { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 14px; }
.ref-add { border: 1.5px dashed var(--muted); background: transparent; color: var(--muted); font-size: 26px; }
