/* deep360: a private room for negotiations and business messages, phone first.
   The logo (navy disc, blue ring, dark core) and the deep360 wordmark stay as they are;
   the logo comes alive: a light runs around the ring, faster while models answer,
   and the ring sends out one ripple when an answer lands. */

:root {
  --mist: #f3f6fa;          /* drawer, sign-in */
  --paper: #ffffff;         /* where you read and write */
  --raised: #ffffff;
  --sunk: #edf1f7;
  --deep: #06163a;          /* ink: the logo's core */
  --text: #1d2b45;
  --muted: #56657f;
  --faint: #74829a;
  --line: #e1e7f0;
  --line-strong: #cdd6e4;
  --current: #1267e8;       /* the logo's ring: actions, focus, selection */
  --current-soft: #e8f0fe;
  --brand: #082a70;         /* the logo's disc */
  --user: #e9f1ff;
  --danger: #c33b2f;
  --danger-soft: #fdecea;
  --ok: #138a55;
  --ok-soft: #e6f6ee;
  --warn: #9b5a08;
  --warn-soft: #fff3dc;
  --shadow: 0 16px 40px rgba(9, 32, 77, 0.14);
  --top: env(safe-area-inset-top, 0px);
  --bottom: env(safe-area-inset-bottom, 0px);
  --left: env(safe-area-inset-left, 0px);
  --right: env(safe-area-inset-right, 0px);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "MiSans", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --mist: #0b1424;
    --paper: #0e1a2e;
    --raised: #16233b;
    --sunk: #111e33;
    --deep: #eef3fc;
    --text: #d6deec;
    --muted: #9aa8c0;
    --faint: #8090a8;
    --line: #1f2c45;
    --line-strong: #2b3a57;
    --current: #4c8dff;
    --current-soft: #16294a;
    --brand: #082a70;
    --user: #17305a;
    --danger: #ff8a7e;
    --danger-soft: #3a1c1c;
    --ok: #4fd39a;
    --ok-soft: #10301f;
    --warn: #f3b562;
    --warn-soft: #3a2a10;
    --shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { height: 100%; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
svg { width: 20px; height: 20px; flex: none; }
a { color: var(--current); }
:focus-visible { outline: 2px solid var(--current); outline-offset: 2px; border-radius: 8px; }

/* ---------- the logo ---------- */
.logo {
  --size: 28px;
  --period: 7s;
  position: relative;
  display: inline-block;
  flex: none;
  width: var(--size);
  height: var(--size);
  vertical-align: middle;
}
.logo svg { display: block; width: 100%; height: 100%; overflow: visible; }
.logo .l-orbit { transform-box: view-box; transform-origin: 16px 16px; animation: orbit var(--period) linear infinite; }
.logo .l-ripple { fill: none; stroke: #2f80ff; stroke-width: 1.6; opacity: 0; transform-box: view-box; transform-origin: 16px 16px; }
/* the models are working: the light runs fast and the ring brightens and dims */
.logo.thinking { --period: 1.2s; }
.logo.thinking .l-ring { animation: ring-glow 1.2s ease-in-out infinite; }
/* an answer just landed: one ripple goes out from the ring */
.logo.ping .l-ripple { animation: ripple 0.9s ease-out 1; }
@keyframes orbit { to { transform: rotate(360deg); } }
@keyframes ring-glow { 50% { stroke: #8cbcff; } }
@keyframes ripple { 0% { opacity: 0.9; transform: scale(1); } 100% { opacity: 0; transform: scale(1.6); } }

/* ---------- shared controls ---------- */
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--deep);
}
.icon-btn:hover { background: var(--sunk); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--raised);
  color: var(--deep);
  font-weight: 600;
}
.btn.primary { border-color: var(--current); background: var(--current); color: #fff; }
.btn:disabled { opacity: 0.45; cursor: default; }

/* ---------- sign in ---------- */
.signin {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: 1fr auto;
  justify-items: center;
  padding: calc(28px + var(--top)) max(20px, var(--right)) calc(18px + var(--bottom)) max(20px, var(--left));
  background: var(--mist);
}
.signin-card { align-self: center; width: min(360px, 100%); text-align: center; }
.signin-card form, .signin-card details { text-align: left; }
.signin-logo { --size: 68px; filter: drop-shadow(0 10px 20px rgba(8, 42, 112, 0.25)); }
.signin h1 {
  margin: 16px 0 8px;
  color: var(--deep);
  font-size: 34px;
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.signin h1 span, .wordmark b span { color: var(--current); }
.signin-lead {
  margin: 0 auto 26px;
  max-width: 320px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}
.signin-lead b { display: block; margin-bottom: 4px; color: var(--deep); font-size: 17px; font-weight: 650; }
.password-login { display: grid; gap: 6px; }
.password-login[hidden] { display: none; }
.password-login label { margin-top: 8px; font-size: 13px; color: var(--muted); }
.password-login input, .key-login input {
  height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--raised);
  color: var(--deep);
  font-size: 16px; /* 16px keeps iPhone from zooming the page */
}
.password-login input:focus, .key-login input:focus { outline: 2px solid var(--current); outline-offset: 0; border-color: transparent; }
.password-login input[readonly] { color: var(--muted); background: var(--sunk); }
.password-login .btn { margin-top: 16px; min-height: 50px; font-size: 16px; }
.signin-note { margin: 4px 0 0; color: var(--faint); font-size: 13px; text-align: center; }
.setup-title { margin: 0 0 2px; color: var(--deep); font-weight: 600; text-align: center; }
.key-login { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 12px; }
.key-login + .key-login { margin-top: 0; border-top: 0; padding-top: 4px; }
.key-login summary { cursor: pointer; color: var(--muted); font-size: 14px; text-align: center; list-style: none; padding: 4px 0; }
.key-login summary::-webkit-details-marker { display: none; }
.key-login form { display: grid; gap: 8px; margin-top: 12px; }
.key-login label { font-size: 13px; color: var(--muted); }
.key-login input { font-family: var(--mono); }
.google-slot { min-height: 56px; display: grid; justify-items: center; gap: 8px; margin-top: 12px; }
.signin-error { min-height: 22px; margin: 14px 0 0; color: var(--danger); font-size: 14px; text-align: center; }
.signin-foot { margin: 0; color: var(--faint); font-size: 12px; }
/* the one orchestrated moment: the ring draws itself, then the light starts running */
.signin:not([hidden]) .signin-logo .l-ring { stroke-dasharray: 66; animation: draw 0.9s cubic-bezier(0.3, 0.7, 0.2, 1) both; }
.signin:not([hidden]) .signin-logo .l-orbit { animation: orbit var(--period) linear infinite, fade 0.6s 0.8s both; }
@keyframes draw { from { stroke-dashoffset: 66; } }
@keyframes fade { from { opacity: 0; } }

/* ---------- app shell ---------- */
.app {
  display: grid;
  grid-template-columns: 1fr;
  height: 100vh;
  height: 100dvh;
}
.main {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-width: 0;
  min-height: 0;
  background: var(--paper);
}
.topbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: calc(8px + var(--top)) max(8px, var(--right)) 8px max(8px, var(--left));
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  backdrop-filter: saturate(1.3) blur(12px);
  -webkit-backdrop-filter: saturate(1.3) blur(12px);
  z-index: 5;
}
.model-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  max-width: 100%;
  height: 42px;
  margin: 0 auto;
  padding: 0 10px 0 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--raised);
  color: var(--deep);
  font-weight: 650;
  font-size: 15px;
}
.model-pill .logo { --size: 26px; }
.model-pill #modelPillText { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.model-pill > svg { width: 18px; height: 18px; color: var(--muted); }

/* ---------- thread ---------- */
.thread {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 8px max(18px, var(--right)) 28px max(18px, var(--left));
}
.welcome, .messages { width: min(720px, 100%); margin: 0 auto; }
.welcome { padding: 26px 0 8px; }
.welcome h2 {
  margin: 0;
  color: var(--deep);
  font-size: 28px;
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: 0.005em;
}
.welcome > p { margin: 6px 0 20px; color: var(--muted); font-size: 15px; }
.scenes { display: grid; border-top: 1px solid var(--line); }
.scene {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 2px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  text-align: left;
  color: inherit;
}
.scene b { display: block; color: var(--deep); font-size: 16px; font-weight: 650; }
.scene small { display: block; margin-top: 1px; color: var(--muted); font-size: 13.5px; line-height: 1.5; }
.scene::after { content: ""; width: 8px; height: 8px; border-top: 1.6px solid var(--faint); border-right: 1.6px solid var(--faint); transform: rotate(45deg); margin-right: 6px; }
.scene:hover b, .scene:focus-visible b { color: var(--current); }

.messages { display: grid; gap: 30px; padding-top: 18px; }
.turn { display: grid; gap: 14px; min-width: 0; }
.msg-user {
  justify-self: end;
  max-width: 86%;
  padding: 10px 14px;
  border-radius: 16px 16px 4px 16px;
  background: var(--user);
  color: var(--deep);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.msg-user .thumbs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.msg-user .thumbs img { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; }
.msg-user .thumbs span { padding: 3px 8px; border-radius: 8px; background: var(--paper); font-size: 12px; color: var(--muted); }

.answers { display: grid; gap: 14px; min-width: 0; }
.answers.compare { gap: 12px; }
.answer { min-width: 0; }
.answers.compare .answer {
  padding: 12px 14px 8px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--tone, var(--current));
  border-radius: 4px 12px 12px 4px;
  background: var(--raised);
}
.answer-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 13px;
}
.answer-head b { color: var(--deep); font-weight: 650; white-space: nowrap; }
.answer-head .meta { margin-left: auto; color: var(--faint); text-align: right; font-size: 12.5px; }
.answer-body { color: var(--text); overflow-wrap: anywhere; line-height: 1.75; }
.answer-body > :first-child { margin-top: 0; }
.answer-body > :last-child { margin-bottom: 0; }
.answer-body p { margin: 0 0 0.8em; }
.answer-body strong { color: var(--deep); }
.answer-body h3, .answer-body h4, .answer-body h5 { margin: 1.2em 0 0.4em; color: var(--deep); font-size: 1.04em; line-height: 1.45; }
.answer-body ul, .answer-body ol { margin: 0 0 0.8em; padding-left: 1.4em; }
.answer-body li { margin: 0.25em 0; }
.answer-body blockquote { margin: 0 0 0.8em; padding: 2px 0 2px 12px; border-left: 3px solid var(--line-strong); color: var(--muted); }
.answer-body code { padding: 1px 5px; border-radius: 5px; background: var(--sunk); font-family: var(--mono); font-size: 0.88em; }
.answer-body pre {
  margin: 0 0 0.9em;
  padding: 12px 14px;
  overflow-x: auto;
  border-radius: 10px;
  background: #0d1a30;
  color: #dbe6fb;
  font-size: 13.5px;
  line-height: 1.55;
}
.answer-body pre code { padding: 0; background: none; color: inherit; font-size: inherit; }
.answer-body .table-wrap { margin: 0 0 0.9em; overflow-x: auto; }
.answer-body table { border-collapse: collapse; min-width: 100%; font-size: 14px; line-height: 1.55; }
.answer-body th, .answer-body td { padding: 7px 10px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.answer-body th { background: var(--sunk); color: var(--deep); }
.answer-body hr { border: 0; border-top: 1px solid var(--line); margin: 1em 0; }
.answer-body.error { color: var(--danger); }
.answer-body.pending:empty::before { content: "正在想…"; color: var(--faint); }
.answer-body.pending::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 15px;
  margin-left: 3px;
  vertical-align: -2px;
  border-radius: 2px;
  background: var(--current);
  animation: blink 1s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
.answer-note { margin: 0 0 8px; padding: 7px 10px; border-radius: 8px; background: var(--sunk); color: var(--muted); font-size: 13px; line-height: 1.6; }
.answer-thinking { margin: 0 0 10px; padding-left: 10px; border-left: 2px solid var(--line-strong); color: var(--muted); }
.answer-thinking summary { cursor: pointer; color: var(--faint); font-size: 13px; }
.answer-thinking div { margin-top: 6px; max-height: 280px; overflow-y: auto; white-space: pre-wrap; font-size: 13.5px; line-height: 1.7; }
.answer-actions { display: flex; gap: 2px; margin-top: 6px; margin-left: -8px; }
.answer-actions button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 32px;
  padding: 0 8px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--muted);
  font-size: 13px;
}
.answer-actions button:hover { background: var(--sunk); color: var(--deep); }
.answer-actions svg { width: 16px; height: 16px; }

/* one-tap edits of the last answer */
.refine {
  width: min(720px, 100%);
  margin: 14px auto 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.refine > span { margin-right: 2px; color: var(--faint); font-size: 13px; }
.refine .chip { height: 34px; background: var(--raised); color: var(--deep); }
.refine .chip:hover { border-color: var(--current); color: var(--current); }
.refine .chip.strong { border-color: var(--current); background: var(--current-soft); color: var(--current); font-weight: 600; }

/* ---------- composer ---------- */
.composer {
  padding: 8px max(12px, var(--right)) calc(10px + var(--bottom)) max(12px, var(--left));
  border-top: 1px solid var(--line);
  background: var(--paper);
}
.composer > * { width: min(720px, 100%); margin-left: auto; margin-right: auto; }
.composer-bar { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: none; }
.composer-bar::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--muted);
  font-size: 13.5px;
  white-space: nowrap;
}
.chip svg { width: 16px; height: 16px; }
.chip[aria-pressed="true"] { border-color: var(--current); background: var(--current-soft); color: var(--current); font-weight: 600; }
.scene-chip { border-color: transparent; background: var(--deep); color: var(--paper); font-weight: 600; padding-right: 4px; }
.scene-chip button { display: inline-grid; place-items: center; width: 24px; height: 24px; border: 0; border-radius: 50%; background: none; color: inherit; }
.scene-chip button svg { width: 14px; height: 14px; }
.attachments { display: flex; gap: 8px; padding-bottom: 8px; overflow-x: auto; }
.file-pending {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  max-width: 260px;
  height: 56px;
  padding: 0 6px 0 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--raised);
}
.file-pending > svg { color: var(--current); }
.file-pending span { min-width: 0; display: grid; }
.file-pending b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--deep); font-size: 13.5px; font-weight: 600; }
.file-pending small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--faint); font-size: 12px; }
.file-pending button { display: grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: 50%; background: none; color: var(--muted); }
.file-pending button svg { width: 14px; height: 14px; }
.file-pending.reading b { color: var(--muted); font-weight: 500; }
.composer.drop .composer-box { border-color: var(--current); border-style: dashed; }
.msg-user .files { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.file-chip { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; padding: 3px 9px 3px 6px; border-radius: 8px; background: var(--paper); color: var(--deep); font-size: 13px; }
.file-chip svg { width: 16px; height: 16px; color: var(--current); }
.file-chip small { color: var(--faint); font-size: 12px; }
.attachments figure { position: relative; margin: 0; flex: none; }
.attachments img { width: 56px; height: 56px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.attachments button {
  position: absolute;
  top: -6px;
  right: -6px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 2px solid var(--paper);
  border-radius: 50%;
  background: var(--deep);
  color: var(--paper);
}
.attachments button svg { width: 12px; height: 12px; }
.composer-box {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  padding: 5px;
  border: 1px solid var(--line-strong);
  border-radius: 24px;
  background: var(--raised);
}
.composer-box:focus-within { border-color: var(--current); box-shadow: 0 0 0 3px color-mix(in srgb, var(--current) 16%, transparent); }
.composer-box .attach { width: 38px; height: 38px; border-radius: 50%; color: var(--muted); cursor: pointer; }
.composer textarea {
  flex: 1;
  min-width: 0;
  max-height: 40vh;
  padding: 8px 4px;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  color: var(--deep);
  font-size: 16px;
  line-height: 1.5;
}
.composer textarea::placeholder { color: var(--faint); }
.send {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: var(--current);
  color: #fff;
  transition: opacity 0.15s;
}
.send:disabled { opacity: 0.28; cursor: default; }
.send.busy { background: var(--deep); color: var(--paper); }

/* ---------- drawer ---------- */
.drawer {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  width: min(316px, 86vw);
  padding: calc(12px + var(--top)) 12px calc(12px + var(--bottom)) max(12px, var(--left));
  background: var(--mist);
  border-right: 1px solid var(--line);
  transform: translateX(-102%);
  transition: transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.drawer.open { transform: none; box-shadow: var(--shadow); }
.scrim {
  position: fixed;
  inset: 0;
  z-index: 25;
  background: rgba(6, 18, 40, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.drawer.open + .scrim { opacity: 1; pointer-events: auto; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 0 0 12px 4px; }
.wordmark { display: inline-flex; align-items: center; gap: 9px; color: var(--deep); text-decoration: none; }
.wordmark .logo { --size: 28px; }
.wordmark b { font-size: 19px; letter-spacing: -0.01em; }
.new-chat {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  margin-bottom: 8px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--raised);
  color: var(--deep);
  font-weight: 600;
}
.history { min-height: 0; overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.history h3 { margin: 16px 8px 4px; color: var(--faint); font-size: 12.5px; font-weight: 600; }
.history-item { display: flex; align-items: center; gap: 4px; border-radius: 8px; }
.history-item a {
  flex: 1;
  min-width: 0;
  padding: 9px 10px;
  color: var(--text);
  text-decoration: none;
  font-size: 14.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-item.active, .history-item:hover { background: var(--sunk); }
.history-item.active a { color: var(--deep); font-weight: 600; }
.history-item button { width: 32px; height: 32px; border: 0; border-radius: 8px; background: none; color: var(--faint); display: grid; place-items: center; opacity: 0; }
.history-item:hover button, .history-item.active button { opacity: 1; }
.history-item button svg { width: 16px; height: 16px; }
.history-empty { padding: 10px; color: var(--faint); font-size: 14px; }
.drawer-foot { border-top: 1px solid var(--line); padding-top: 12px; }
.account { display: flex; align-items: center; gap: 10px; padding: 0 4px; }
.avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 50%;
  background: var(--deep);
  color: var(--paper);
  font-weight: 700;
}
.account-text { min-width: 0; display: grid; }
.account-text b { color: var(--deep); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-text small { color: var(--faint); font-size: 12px; line-height: 1.5; }
.drawer-links { display: flex; flex-wrap: wrap; gap: 2px 16px; margin-top: 8px; padding: 0 4px; }
.drawer-links a, .drawer-links button { padding: 6px 0; border: 0; background: none; color: var(--muted); font-size: 14px; text-decoration: none; }
.drawer-links a:hover, .drawer-links button:hover { color: var(--deep); }

/* ---------- sheets ---------- */
.sheet {
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  max-height: 88dvh;
  margin: auto auto 0;
  padding: 0 0 var(--bottom);
  border: 0;
  border-radius: 18px 18px 0 0;
  background: var(--paper);
  color: var(--text);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.sheet[open] { display: grid; grid-template-rows: auto auto 1fr auto; animation: sheet-in 0.24s cubic-bezier(0.2, 0.8, 0.2, 1); }
.sheet::backdrop { background: rgba(6, 18, 40, 0.42); }
@keyframes sheet-in { from { transform: translateY(28px); opacity: 0; } }
.sheet-grip { width: 36px; height: 4px; margin: 8px auto 0; border-radius: 4px; background: var(--line-strong); }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 12px 14px 8px 20px; }
.sheet-head h2 { margin: 0; color: var(--deep); font-size: 19px; font-weight: 700; }
.sheet-head p { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; line-height: 1.55; text-wrap: pretty; }
.model-list { overflow-y: auto; padding: 0 12px 14px; }
.model-group { margin: 14px 8px 4px; color: var(--faint); font-size: 12.5px; font-weight: 600; }
.model-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 10px;
  border: 0;
  border-radius: 10px;
  background: none;
  text-align: left;
  color: inherit;
}
.model-row:hover { background: var(--sunk); }
.model-row b { display: block; color: var(--deep); font-size: 15.5px; font-weight: 620; }
.model-row small { display: block; color: var(--muted); font-size: 13px; line-height: 1.45; }
.model-row .tick {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1.5px solid var(--line-strong);
  border-radius: 50%;
  color: transparent;
}
.model-row .tick svg { width: 15px; height: 15px; }
.model-row[aria-checked="true"] .tick { border-color: var(--current); background: var(--current); color: #fff; }
.compare-mode .model-row .tick { border-radius: 6px; }
.model-row:disabled { cursor: default; opacity: 0.5; }
.model-row:disabled:hover { background: none; }
.model-more {
  display: block;
  width: calc(100% - 16px);
  margin: 10px 8px 0;
  padding: 10px 0 0;
  border: 0;
  border-top: 1px solid var(--line);
  background: none;
  color: var(--muted);
  font-size: 13.5px;
  text-align: left;
}
.sheet-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.plan-chip { display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 4px; font-style: normal; font-size: 11px; font-weight: 600; vertical-align: 1px; color: var(--ok); background: var(--ok-soft); }
.plan-chip.off { color: var(--warn); background: var(--warn-soft); }

/* ---------- 号池 ---------- */
.account-list { overflow-y: auto; display: grid; gap: 10px; align-content: start; padding: 4px 16px 20px; }
.quick-list { display: grid; gap: 8px; }
.quick-open {
  display: grid;
  gap: 1px;
  width: 100%;
  padding: 12px 14px;
  border: 0;
  border-radius: 12px;
  background: var(--deep);
  color: var(--paper);
  text-align: left;
}
.quick-open b { font-size: 15.5px; }
.quick-open span { font-size: 12.5px; opacity: 0.72; }
.quick-open:disabled { background: var(--sunk); color: var(--faint); }
.account-group { margin: 12px 2px 0; color: var(--faint); font-size: 12.5px; font-weight: 600; }
.account-card { display: grid; gap: 4px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--raised); }
.account-card.is-limited { background: var(--sunk); }
.account-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.account-card-head b { color: var(--deep); font-size: 15px; overflow-wrap: anywhere; }
.account-card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.account-card .warn { color: var(--warn); }
.account-card .account-note { color: var(--deep); }
.account-state { flex: none; padding: 2px 8px; border-radius: 6px; font-size: 12px; color: var(--muted); background: var(--sunk); }
.account-state.ok { color: var(--ok); background: var(--ok-soft); }
.account-state.limit { color: var(--warn); background: var(--warn-soft); }
.account-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.account-actions .btn { min-height: 36px; padding: 0 14px; font-size: 14px; }
.limit-picker { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; font-size: 13px; color: var(--muted); }
.limit-picker .chip { height: 34px; }
.limit-picker .chip.ghost { border-color: transparent; background: transparent; }
.account-add { display: grid; gap: 8px; margin-top: 8px; padding-top: 4px; border-top: 1px solid var(--line); }
.platform-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.account-add input {
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--raised);
  color: var(--deep);
  font-size: 16px;
}
.account-add .btn { min-height: 46px; }
.account-hint { margin: 0; color: var(--faint); font-size: 12.5px; line-height: 1.6; text-wrap: pretty; }
.account-add .account-note { margin: 0; color: var(--deep); font-size: 13px; }

/* ---------- 档案 ---------- */
.profile-chip { max-width: 70vw; overflow: hidden; text-overflow: ellipsis; }
.profile-chip.on { border-color: var(--current); background: var(--current-soft); color: var(--current); font-weight: 600; }
.profile-card.on { border-color: var(--current); }
.profile-notes { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.account-add textarea {
  min-height: 132px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--raised);
  color: var(--deep);
  font-size: 16px;
  line-height: 1.55;
  resize: vertical;
}
.platform-chips .chip[aria-pressed="true"] { border-color: var(--current); background: var(--current-soft); color: var(--current); font-weight: 600; }

/* ---------- search in the drawer ---------- */
.history-search {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  margin: 0 0 4px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--raised);
  color: var(--faint);
}
.history-search svg { width: 17px; height: 17px; }
.history-search input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; color: var(--deep); font-size: 16px; }
.history-search:focus-within { border-color: var(--current); }
.drawer { grid-template-rows: auto auto auto 1fr auto; }

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(100px + var(--bottom));
  z-index: 60;
  max-width: min(420px, calc(100vw - 32px));
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--deep);
  color: var(--paper);
  font-size: 14px;
  opacity: 0;
  transform: translate(-50%, 8px);
  pointer-events: none;
  transition: opacity 0.18s, transform 0.18s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- phones ---------- */
@media (max-width: 480px) {
  .welcome { padding-top: 18px; }
  .welcome h2 { font-size: 26px; }
  .msg-user { max-width: 88%; padding: 9px 13px; font-size: 15.5px; line-height: 1.6; }
  .answer-body { font-size: 15.5px; }
  .model-pill { font-size: 14.5px; }
}
@media (max-width: 360px) {
  .welcome h2 { font-size: 24px; }
  .answer-head .meta { display: none; }
}

/* ---------- wide screens ---------- */
@media (min-width: 960px) {
  .app { grid-template-columns: 288px minmax(0, 1fr); }
  .drawer { position: static; width: auto; transform: none; box-shadow: none; padding-left: 14px; }
  .scrim, .only-mobile { display: none !important; }
  .topbar { padding-left: 20px; padding-right: 20px; }
  .model-pill { margin-left: 0; }
  .welcome { padding-top: 11vh; }
  .welcome h2 { font-size: 34px; }
  .welcome > p { font-size: 16px; margin-bottom: 26px; }
  .scenes { grid-template-columns: 1fr 1fr; column-gap: 32px; }
  .sheet { margin: auto; border-radius: 16px; max-height: 80vh; }
  .sheet-grip { display: none; }
  .toast { bottom: 112px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .logo .l-orbit { display: none; }  /* the logo exactly as drawn, no light */
}
