:root {
  --bg: #fafafa;
  --panel: #ffffff;
  --ink: #0b0b0f;
  --muted: #6b7280;
  --faint: #9ca3af;
  --line: #e8e8ec;
  --line-strong: #d9d9df;
  --fill: #f4f4f5;
  --radius: 16px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  padding-bottom: 88px;
  color: var(--ink);
  background-color: var(--bg);
  background-image: radial-gradient(circle at 1px 1px, #ebebf0 1px, transparent 1.4px);
  background-size: 24px 24px;
  font: 15px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--ink); color: #fff; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

button { font-family: inherit; }
.icon { width: 16px; height: 16px; flex: none; }

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 19px;
  height: 19px;
  padding: 0 4px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--panel);
  color: #71717a;
  font-family: inherit;
  font-size: 11px;
  line-height: 1;
}

/* 顶栏 */
.top {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid rgba(11, 11, 15, 0.06);
  background: rgba(250, 250, 250, 0.82);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
}

.top-inner,
main {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding-left: 24px;
  padding-right: 24px;
}

.top-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
}

.mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--ink);
  color: #fff;
}

.mark svg { width: 18px; height: 18px; }

.name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.badge {
  padding: 1px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-size: 10.5px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.search {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 8px;
  width: 280px;
  height: 38px;
  padding: 0 10px 0 12px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--fill);
  color: var(--muted);
  transition: background 0.16s, border-color 0.16s, box-shadow 0.16s;
}

.search:focus-within {
  border-color: var(--line-strong);
  background: var(--panel);
  box-shadow: 0 0 0 3px rgba(11, 11, 15, 0.05);
}

.search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 13.5px;
}

.search input::placeholder { color: var(--faint); }
.search input:focus-visible { outline: none; }
.search kbd { background: var(--panel); border-color: #e6e6ea; color: var(--faint); }

.ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: #3f3f46;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.16s, box-shadow 0.16s, color 0.16s;
}

.ghost:hover {
  border-color: var(--line-strong);
  box-shadow: 0 1px 2px rgba(11, 11, 15, 0.05);
}

.primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.16s, transform 0.12s, opacity 0.16s;
}

.primary:hover { background: #26262c; }
.primary:active { transform: scale(0.99); }
.primary:disabled { opacity: 0.5; cursor: default; }
.primary .icon { width: 15px; height: 15px; }

.small { height: 32px; padding: 0 12px; font-size: 12.5px; }

/* 首屏 */
.hero {
  padding: 52px 0 30px;
  text-align: center;
}

.hero h1 {
  margin: 0;
  font-size: 44px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.045em;
}

.hero p {
  max-width: 620px;
  margin: 14px auto 0;
  color: var(--muted);
  font-size: 14.5px;
}

.br-mobile { display: none; }

/* 输入区 */
.composer {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
  box-shadow: 0 1px 2px rgba(11, 11, 15, 0.04), 0 24px 48px -40px rgba(11, 11, 15, 0.25);
  transition: border-color 0.18s, box-shadow 0.18s;
}

.composer:focus-within {
  border-color: #c9c9d1;
  box-shadow: 0 1px 2px rgba(11, 11, 15, 0.04), 0 24px 48px -36px rgba(11, 11, 15, 0.28), 0 0 0 3px rgba(11, 11, 15, 0.04);
}

.composer textarea {
  display: block;
  width: 100%;
  min-height: 118px;
  padding: 22px 24px 6px;
  border: 0;
  outline: none;
  resize: none;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 16.5px;
  line-height: 1.7;
}

.composer textarea::placeholder { color: var(--faint); }

.tagpick {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 2px 24px 10px;
}

.tagpick-chips { display: contents; }
.tagpick .tag { font-size: 12px; }

.tagpick-new {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  padding: 3px 10px;
  border: 1px dashed var(--line-strong);
  border-radius: 999px;
  color: var(--faint);
  font-size: 12px;
  cursor: text;
  transition: border-color 0.14s, color 0.14s;
}

.tagpick-new:focus-within { border-color: var(--ink); color: var(--muted); }

.tagpick-new input {
  width: 9em;
  padding: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font: inherit;
}

.tagpick-new input::placeholder { color: var(--faint); }

.composer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 18px 16px 24px;
}

.hint {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  color: var(--faint);
  font-size: 12px;
}

.hint kbd + kbd { margin-left: -1px; }
.hint span { margin-left: 4px; white-space: nowrap; }

.status {
  margin-left: 4px;
  color: var(--muted);
  font-size: 12px;
  opacity: 0;
  transform: translateY(1px);
  transition: opacity 0.2s, transform 0.2s;
}

.status.show { opacity: 1; transform: none; }

/* 概览 */
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
}

.stat .label {
  color: var(--muted);
  font-size: 11.5px;
  letter-spacing: 0.04em;
}

.stat .value {
  font-size: 25px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.stat .value em {
  margin-left: 4px;
  color: var(--faint);
  font-size: 12px;
  font-style: normal;
  font-weight: 400;
  letter-spacing: 0;
}

/* 两栏 */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 296px;
  gap: 24px;
  margin-top: 36px;
  align-items: start;
}

.stream-wrap { min-width: 0; }

.stream-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 14px;
}

.stream-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.stream-count { color: var(--faint); font-size: 12px; }

.active-filter { display: flex; gap: 6px; margin-left: auto; }

.filter {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 11px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 12px;
  cursor: pointer;
}

.filter:hover { background: #26262c; }

/* 按天分组 */
.day { display: flex; flex-direction: column; gap: 12px; }
.day + .day { margin-top: 20px; }

.dayhead {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 4px 2px;
  color: #3f3f46;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.daycount {
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--fill);
  color: var(--faint);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0;
}

/* 卡片 */
.card {
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 1px 2px rgba(11, 11, 15, 0.03);
  transition: border-color 0.16s, box-shadow 0.16s, transform 0.16s;
}

.card:hover {
  border-color: #dcdce2;
  box-shadow: 0 10px 30px -22px rgba(11, 11, 15, 0.35), 0 1px 2px rgba(11, 11, 15, 0.04);
  transform: translateY(-1px);
}

.card.flash {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(11, 11, 15, 0.08);
}

.text {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 15.5px;
  line-height: 1.78;
}

.taglink {
  display: inline;
  margin: 0 1px;
  padding: 1px 6px;
  border: 0;
  border-radius: 6px;
  background: var(--fill);
  color: #52525b;
  font: inherit;
  font-size: 0.9em;
  line-height: 1.5;
  cursor: pointer;
  transition: background 0.14s, color 0.14s;
}

.taglink:hover { background: var(--ink); color: #fff; }

.rel {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #f1f1f4;
  color: var(--faint);
  font-size: 12px;
}

.rellabel { letter-spacing: 0.04em; }

.relchip {
  max-width: 15em;
  padding: 4px 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: #52525b;
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.14s, color 0.14s;
}

.relchip:hover { border-color: var(--ink); color: var(--ink); }

.meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  color: var(--faint);
  font-size: 12px;
}

.actions { display: flex; align-items: center; gap: 2px; }

.confirm-text { margin-right: 4px; color: var(--muted); font-size: 12px; }

.act {
  padding: 3px 8px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--faint);
  font-size: 12px;
  cursor: pointer;
  transition: color 0.14s, background 0.14s;
}

.act:hover { background: var(--fill); color: var(--ink); }
.act.danger:hover { color: #d92d20; }

@media (hover: hover) {
  .actions { opacity: 0; transition: opacity 0.14s; }
  .card:hover .actions,
  .card:focus-within .actions { opacity: 1; }
}

textarea.editing {
  display: block;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fcfcfd;
  color: var(--ink);
  font: inherit;
  line-height: 1.7;
  resize: vertical;
  outline: none;
}

textarea.editing:focus { border-color: var(--line-strong); box-shadow: 0 0 0 3px rgba(11, 11, 15, 0.05); }

.card .tagpick { padding: 10px 0 0; }

.editbar { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }

/* 空状态 */
.empty {
  padding: 48px 24px;
  border: 1px dashed #dfdfe5;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.6);
  text-align: center;
}

.empty-mark {
  width: 42px;
  height: 42px;
  margin: 0 auto 14px;
  border-radius: 13px;
}

.empty-mark svg { width: 22px; height: 22px; }

.empty-title { margin: 0 0 4px; font-size: 15px; font-weight: 600; }
.empty-text { margin: 0; color: var(--muted); font-size: 13px; }

/* 侧栏 */
aside {
  position: sticky;
  top: 84px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.panel {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 1px 2px rgba(11, 11, 15, 0.03);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.panel-head h2 {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.panel-count { color: var(--faint); font-size: 11px; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; }

.tag {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 3px 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--fill);
  color: #52525b;
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.14s, background 0.14s, color 0.14s;
}

.tag:hover { border-color: var(--line-strong); color: var(--ink); }

.tag.on {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.tag-count { color: var(--faint); font-size: 10.5px; }
.tag.on .tag-count { color: rgba(255, 255, 255, 0.6); }

.heat {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 84px;
  margin: 4px 0 10px;
}

.bar {
  flex: 1;
  min-width: 0;
  min-height: 6px;
  border-radius: 3px 3px 1px 1px;
  background: var(--ink);
}

.bar.zero { background: #ededf0; }
.bar:hover { outline: 2px solid rgba(11, 11, 15, 0.12); outline-offset: 1px; }

.muted { margin: 0; color: var(--faint); font-size: 12px; }

/* 我的 */
.profile-entry { padding-left: 6px; }
.profile-label { font-size: 13px; font-weight: 500; }

.avatar {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}

#page-profile { display: block; }

.profile { max-width: 720px; margin: 34px auto 0; }
.profile-tabs { margin-bottom: 20px; }

.profile-card {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 26px 28px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
  box-shadow: 0 1px 2px rgba(11, 11, 15, 0.03);
}

.profile-avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-size: 26px;
  font-weight: 600;
}

.profile-who { flex: 1; min-width: 0; }
.profile-who h1 { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: -0.03em; }
.profile-meta { margin: 4px 0 0; color: var(--faint); font-size: 12.5px; }

.profile-rename { display: flex; gap: 8px; width: 100%; }

.profile-rename input {
  flex: 1;
  min-width: 0;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  outline: none;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
}

#profile-stats { margin-top: 14px; }
.profile-note { margin-top: 14px; }
.profile-note .muted { margin: 0; line-height: 1.7; }
#mode-bar { margin-top: 14px; }
#profile-think .think-view { margin-top: 8px; }

body[data-view="profile"] .hero,
body[data-view="profile"] .composer,
body[data-view="profile"] .search,
body[data-view="profile"] #stats,
body[data-tab="tags"] .search,
body[data-tab="stats"] .search { display: none; }

/* 视图切换 */
[hidden] { display: none !important; }

.views {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 30px;
}

.tabs {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: var(--fill);
}

.tab {
  padding: 5px 15px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.tab:hover { color: var(--ink); }

.tab.on {
  background: var(--panel);
  color: var(--ink);
  font-weight: 500;
  box-shadow: 0 1px 2px rgba(11, 11, 15, 0.08);
}

.view-note { color: var(--faint); font-size: 12px; }
#think-btn { margin-left: auto; }
#settings-btn { flex: none; }

/* 思考视图 */
.think-view { margin-top: 26px; }

.think-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.think-head h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.think-meta { margin: 4px 0 0; color: var(--faint); font-size: 12px; }
.think-actions { display: flex; gap: 8px; }

.think-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding: 10px 16px;
  border: 1px solid #f2dfc0;
  border-radius: 12px;
  background: #fff9ef;
  color: #8a5a1c;
  font-size: 13px;
}

.linkbtn {
  margin-left: auto;
  border: 0;
  background: none;
  color: #8a5a1c;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.linkbtn:hover { text-decoration: underline; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }

.member {
  max-width: 100%;
  padding: 4px 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: #52525b;
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.14s, color 0.14s;
}

.member:hover { border-color: var(--ink); color: var(--ink); }
.member:disabled { cursor: default; opacity: 0.5; }

.entries { display: flex; flex-direction: column; gap: 12px; margin-top: 18px; }

.entry {
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: 0 1px 2px rgba(11, 11, 15, 0.03);
}

.entry-text { margin: 0; color: #27272a; font-size: 15px; line-height: 1.85; letter-spacing: -0.005em; }

.entry-note { margin: 10px 0 0; color: var(--faint); font-size: 11.5px; }

.think-foot { margin-top: 26px; color: var(--faint); font-size: 11.5px; }

.think-empty,
.think-loading {
  padding: 52px 24px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  text-align: center;
}

.think-empty h2 { margin: 0 0 8px; font-size: 20px; letter-spacing: -0.02em; }
.think-empty .muted { max-width: 520px; margin: 0 auto 20px; line-height: 1.8; }
.intro-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; }

.think-loading p { margin: 12px 0 0; font-weight: 500; }
.think-loading .muted { margin-top: 4px; font-weight: 400; }

.loading-dots { display: inline-flex; gap: 5px; }

.loading-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink);
  animation: dot-pulse 1.1s infinite ease-in-out;
}

.loading-dots span:nth-child(2) { animation-delay: 0.15s; }
.loading-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes dot-pulse {
  0%, 80%, 100% { opacity: 0.2; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

.setup {
  max-width: 720px;
  margin: 0 auto;
  padding: 28px 30px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: 0 1px 2px rgba(11, 11, 15, 0.03);
}

.setup h2 { margin: 0 0 6px; font-size: 20px; letter-spacing: -0.02em; }
.setup > .muted { max-width: 600px; margin: 0 0 20px; font-size: 12.5px; line-height: 1.75; }

.setup-form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { color: var(--muted); font-size: 12px; font-weight: 500; }

.field input,
.field select {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 13.5px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field select {
  appearance: none;
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
}

.field input:focus,
.field select:focus {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 3px rgba(11, 11, 15, 0.05);
}

.setup-actions { display: flex; gap: 10px; margin-top: 6px; }

.form-title {
  margin: 26px 0 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.llm-list { display: flex; flex-direction: column; gap: 8px; }

.llm-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fcfcfd;
}

.llm-row.active { border-color: var(--ink); background: #fff; }

.llm-info { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }

.llm-model { font-size: 13.5px; font-weight: 600; letter-spacing: -0.01em; }

.llm-base {
  overflow: hidden;
  color: var(--faint);
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.llm-current {
  flex: none;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--fill);
  color: var(--muted);
  font-size: 10.5px;
}

.llm-row .act { flex: none; }

.model-line { display: flex; gap: 8px; }
.model-line input { flex: 1; min-width: 0; }
.model-line .ghost { flex: none; height: 40px; }

.model-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 126px;
  overflow: auto;
}

.model-chip {
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: #52525b;
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.14s, background 0.14s, color 0.14s;
}

.model-chip:hover { border-color: var(--ink); color: var(--ink); }
.model-chip.on { border-color: var(--ink); background: var(--ink); color: #fff; }

.test-status { min-height: 18px; margin: 0; color: var(--faint); font-size: 12px; }
.test-status.ok { color: #0f7b4f; }
.test-status.error { color: #c0322c; }

.setup-note {
  margin: 18px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 11.5px;
  line-height: 1.7;
}

.error-note {
  display: flex;
  gap: 8px;
  align-items: baseline;
  margin-bottom: 14px;
  padding: 12px 16px;
  border: 1px solid #f3d6d6;
  border-radius: 12px;
  background: #fff5f5;
  color: #a12c2c;
  font-size: 13px;
}

.error-note strong { flex: none; }

/* 登录 */
.auth-body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

.auth-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  width: 100%;
  max-width: 400px;
}

.auth-brand { display: flex; align-items: center; gap: 10px; }
.auth-brand .mark { width: 36px; height: 36px; border-radius: 11px; }
.auth-brand .name { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }

.auth-card {
  width: 100%;
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
  box-shadow: 0 1px 2px rgba(11, 11, 15, 0.04), 0 30px 60px -44px rgba(11, 11, 15, 0.35);
}

.auth-card h1 { margin: 0; font-size: 24px; font-weight: 600; letter-spacing: -0.03em; }
.auth-sub { margin: 6px 0 22px; color: var(--muted); font-size: 13px; line-height: 1.7; }

.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form input { height: 44px; font-size: 16px; }
.auth-error { min-height: 18px; margin: 0; color: #c0322c; font-size: 12.5px; }
.auth-submit { width: 100%; height: 44px; justify-content: center; }
.auth-switch {
  width: 100%;
  margin-top: 12px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
}
.auth-switch:hover { color: var(--ink); text-decoration: underline; }
.auth-note { margin: 18px 0 0; color: var(--faint); font-size: 11.5px; line-height: 1.7; }
.auth-foot { margin: 0; color: var(--faint); font-size: 11.5px; }

.icon-only { width: 38px; padding: 0; justify-content: center; }

/* 焦点 */
:where(button, a):focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

textarea:focus-visible { outline: none; }

@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; }
  .think-head { align-items: flex-start; }
  aside {
    position: static;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  aside .panel:last-child { grid-column: 1 / -1; }
}

@media (max-width: 720px) {
  .top-inner { flex-wrap: wrap; min-height: 0; padding-top: 10px; padding-bottom: 10px; }
  .top-actions { width: 100%; margin-left: 0; gap: 8px; }
  .search { flex: 1 1 auto; width: auto; min-width: 0; }
  .hero { padding-top: 36px; }
  .hero h1 { font-size: 33px; }
  .br-mobile { display: inline; }
  .stats { grid-template-columns: 1fr 1fr; }
  .views { flex-wrap: wrap; }
  .view-note { display: none; }
  .composer-bar { padding-left: 18px; }
  .tagpick { padding-left: 18px; padding-right: 18px; }
  .composer textarea { padding-left: 18px; padding-right: 18px; }
}

@media (max-width: 560px) {
  .top-inner, main { padding-left: 16px; padding-right: 16px; }
  aside { grid-template-columns: 1fr; }
  .hint kbd,
  .hint span:not(.status),
  .search kbd { display: none; }
  .badge { display: none; }
  .auth-body { padding: 20px 16px; }
  .auth-card { padding: 26px 20px; }
  .stream-head { flex-wrap: wrap; }
  .active-filter { margin-left: 0; }
  .setup { padding: 22px 20px; }
  .llm-row { flex-wrap: wrap; }
  .model-line { flex-wrap: wrap; }
  .model-line .ghost { width: 100%; height: 34px; }
  .entry { padding: 18px 18px; }
  .empty { padding: 36px 18px; }
}

/* 碎片全文：点卡片从屏幕中间弹出 */
.reader {
  width: min(600px, calc(100vw - 40px));
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 32px 80px -30px rgba(11, 11, 15, 0.5);
}

.reader::backdrop { background: rgba(11, 11, 15, 0.36); }

/* 焦点落在弹窗容器上，不给整个框画焦点圈 */
.reader:focus-visible { outline: none; }

.reader-inner {
  display: flex;
  flex-direction: column;
  max-height: min(78vh, 640px);
  padding: 18px 22px 22px;
}

.reader-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--faint);
  font-size: 12px;
}

.reader-text {
  margin: 10px 0 0;
  overflow-y: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 16px;
  line-height: 1.78;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---------- 手机端：浏览优先（方案 C） ---------- */

.menu-text,
#more-btn,
.more-menu,
.tabbar,
.sheet,
.toast,
.tagstrip,
.page {
  display: none;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 12px;
  background: none;
  color: #3f3f46;
  cursor: pointer;
}

.icon-btn svg { width: 20px; height: 20px; }

@media (max-width: 720px) {
  body { padding-bottom: calc(82px + env(safe-area-inset-bottom)); }
  main { padding-left: 16px; padding-right: 16px; }
  .hero { display: none; }

  /* 顶栏：品牌 + ⋯ 一行，搜索一行 */
  .top-inner {
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 12px 10px 16px;
    min-height: 0;
  }
  .top-actions { display: contents; }
  .top-inner .search {
    order: 3;
    flex: 1 0 100%;
    width: auto;
    height: 38px;
    border-radius: 12px;
  }
  #more-btn { order: 2; margin-left: auto; display: grid; }
  .search kbd { display: none; }

  /* 概览胶囊 */
  .stats {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .stats::-webkit-scrollbar { display: none; }
  .stat {
    flex: none;
    flex-direction: row;
    align-items: baseline;
    gap: 4px;
    padding: 5px 12px;
    border: 0;
    border-radius: 999px;
    background: var(--fill);
  }
  .stat .label { order: 2; color: var(--muted); font-size: 0; letter-spacing: 0; }
  .stat .label::after { content: attr(data-short); font-size: 11.5px; }
  .stat .value { order: 1; font-size: 15px; letter-spacing: -0.02em; }
  .stat .value em { display: none; }
  body[data-tab="tags"] #stats,
  body[data-tab="profile"] #stats { display: none; }

  /* 分类页签 */
  .tagstrip {
    grid-column: 1 / -1;
    gap: 18px;
    margin: 0 -16px;
    padding: 6px 16px 0;
    overflow-x: auto;
    scrollbar-width: none;
  }
  body[data-tab="fragments"] .tagstrip { display: flex; }
  body[data-tab="fragments"] .tagstrip:empty { display: none; }
  .tagstrip::-webkit-scrollbar { display: none; }
  .strip-tab {
    flex: none;
    padding: 6px 0 8px;
    border: 0;
    border-bottom: 2px solid transparent;
    background: none;
    color: var(--muted);
    font: inherit;
    font-size: 13.5px;
    white-space: nowrap;
    cursor: pointer;
  }
  .strip-tab.on { border-bottom-color: var(--ink); color: var(--ink); font-weight: 600; }

  /* 两列卡片墙 */
  .layout { display: block; margin-top: 4px; }
  aside { display: none; }
  .stream-head { display: none; }
  .stream { padding-bottom: 8px; }
  .day {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 2px;
  }
  .day + .day { margin-top: 6px; }
  .dayhead {
    grid-column: 1 / -1;
    margin: 12px 0 0;
    padding: 0;
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
  }
  .card {
    display: flex;
    flex-direction: column;
    padding: 11px 12px 10px;
    border-radius: 14px;
  }
  .day .card:only-of-type { grid-column: 1 / -1; }
  .text {
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 13.5px;
    line-height: 1.72;
  }
  .rel {
    margin-top: 8px;
    padding-top: 8px;
    gap: 4px;
    font-size: 11px;
  }
  .relchip { max-width: 100%; padding: 3px 9px; font-size: 11px; }
  .meta { flex-wrap: wrap; margin-top: auto; padding-top: 8px; font-size: 11px; }
  .actions { flex-wrap: wrap; opacity: 1; }
  .card.editing { grid-column: 1 / -1; }
  .card.editing .actions { display: none; }
  .card.editing textarea.editing { resize: none; }
  .act { min-height: 36px; padding: 0 8px; }
  .card:hover { transform: none; }

  .empty { padding: 32px 16px; }

  /* 标签页 / 统计页 */
  body[data-tab="tags"] #page-tags,
  body[data-tab="stats"] #page-stats { display: block; }
  .page { padding-top: 2px; }
  .page .panel { padding: 15px 14px; }
  .page .panel-head { margin-bottom: 14px; }
  .page .panel-head h2 { color: var(--ink); font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
  .page .tags { gap: 8px; }
  .page .tag { padding: 5px 12px; font-size: 13px; }
  .page .heat { height: 96px; }

  /* 我的 */
  #profile-btn { display: none; }
  .profile { margin-top: 2px; }
  .profile-tabs { margin: 4px 0 16px; }
  .profile-card { padding: 18px; gap: 14px; border-radius: 18px; }
  .profile-avatar { width: 52px; height: 52px; font-size: 21px; }
  .profile-who h1 { font-size: 19px; }
  #profile-stats { margin-top: 12px; }
  .profile-note { margin-top: 12px; }

  /* 底部导航 */
  .tabbar {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: 1fr 1fr 62px 1fr 1fr;
    align-items: end;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: saturate(180%) blur(16px);
    -webkit-backdrop-filter: saturate(180%) blur(16px);
  }
  .navtab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 6px 0;
    border: 0;
    background: none;
    color: var(--muted);
    font: inherit;
    font-size: 10.5px;
    cursor: pointer;
  }
  .navtab svg { width: 21px; height: 21px; }
  .navtab.on { color: var(--ink); }
  .navtab.add {
    justify-self: center;
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    margin-bottom: 2px;
    border-radius: 16px;
    background: var(--ink);
    color: #fff;
    box-shadow: 0 12px 22px -12px rgba(11, 11, 15, 0.55);
  }
  .navtab.add svg { width: 22px; height: 22px; }
  .navtab.add:active { transform: scale(0.96); }

  /* 半屏输入 */
  .sheet {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: flex-end;
    background: rgba(11, 11, 15, 0.34);
  }
  .sheet[hidden] { display: none; }
  .sheet-panel {
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 8px 14px calc(10px + env(safe-area-inset-bottom));
    border-radius: 22px 22px 0 0;
    background: var(--panel);
    animation: sheet-up 0.22s ease-out;
  }
  .sheet-panel.expanded {
    height: 100%;
    padding-top: calc(8px + env(safe-area-inset-top));
  }
  .sheet-panel.expanded,
  .sheet-panel.dragging { overflow: hidden; }
  @keyframes sheet-up { from { transform: translateY(40%); } to { transform: none; } }
  .sheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 2px 2px;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
  }
  .sheet-head .act { color: var(--muted); }
  .grab {
    position: relative;
    display: block;
    width: 100%;
    height: 22px;
    padding: 0;
    border: 0;
    background: none;
    touch-action: none;
    cursor: grab;
  }
  .grab::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 38px;
    height: 4px;
    margin: -2px 0 0 -19px;
    border-radius: 2px;
    background: #e4e4e9;
  }
  .grab:active { cursor: grabbing; }
  #sheet-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
  }
  #sheet-body .composer {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
  }
  #sheet-body .composer textarea {
    flex: 1;
    min-height: 88px;
    padding: 6px 4px 4px;
    font-size: 16px;
  }
  #sheet-body .composer-bar { padding: 0 0 4px; }
  #sheet-body .tagpick { padding: 0 4px 8px; }
  #sheet-body .hint { display: none; }
  #sheet-body .primary { flex: 1; height: 44px; justify-content: center; }

  /* 提示条 */
  .toast {
    display: block;
    position: fixed;
    bottom: calc(80px + env(safe-area-inset-bottom));
    left: 50%;
    z-index: 60;
    max-width: 90vw;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(11, 11, 15, 0.9);
    color: #fff;
    font-size: 12.5px;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 6px);
    transition: opacity 0.2s, transform 0.2s;
  }
  .toast.show { opacity: 1; transform: translate(-50%, 0); }

  /* 更多菜单 */
  .more-menu {
    position: absolute;
    top: calc(56px + env(safe-area-inset-top));
    right: 12px;
    z-index: 45;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 176px;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--panel);
    box-shadow: 0 18px 40px -24px rgba(11, 11, 15, 0.5);
  }
  .more-menu[hidden] { display: none; }
  .more-menu .ghost {
    width: 100%;
    height: 44px;
    justify-content: flex-start;
    border: 0;
    border-radius: 10px;
    padding: 0 12px;
    font-size: 13.5px;
  }
  .more-menu .icon-only { width: 100%; }
  .more-menu .menu-text { display: inline; }

  /* 思考页顶部工具条 */
  #mode-bar { margin-top: 6px; }
  .think-view { margin-top: 12px; }
}
