/* 围炉 · Today 风格 VI
   蓝白 / 白卡片 / 浅灰分区 / 细边框 / 清爽排版 */

:root {
  --bg: #faf5ee;
  --surface: #fffdf8;
  --surface-2: #f7eee4;
  --ink: #2f2621;
  --ink-2: #5a4a40;
  --muted: #94837a;
  --line: #eadfd3;
  --accent: #c46a46;
  --accent-soft: #f7e4d8;
  --green: #c46a46; /* 兼容旧变量名，现为陶土主色 */
  --green-soft: #f7e4d8;
  --clay: #b4553b;
  --amber: #c9922e;
  --amber-soft: #fbf0d8;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(47, 38, 33, 0.04);
  --serif: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", Georgia, serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

.page {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 20px calc(40px + env(safe-area-inset-bottom));
}

.page.tight {
  padding-top: 16px;
}

a {
  color: var(--ink);
  text-decoration: none;
}

/* 顶部 */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 40px;
  margin-bottom: 16px;
}

.back {
  border: none;
  background: none;
  padding: 6px 10px 6px 0;
  font-size: 15px;
  color: var(--ink-2);
  cursor: pointer;
}

.eyebrow {
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--muted);
  text-transform: uppercase;
  font-weight: 500;
}

.h1 {
  font-family: var(--serif);
  margin: 6px 0 4px;
  font-size: 32px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.035em;
}

.h2 {
  font-family: var(--serif);
  margin: 0;
  font-size: 20px;
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: -0.02em;
}

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

.muted {
  color: var(--muted);
}

.small {
  font-size: 13px;
}

.accent {
  color: var(--accent);
}

/* 卡片 */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.card + .card {
  margin-top: 12px;
}

.card.dark,
.card.green {
  background: linear-gradient(135deg, #c46a46 0%, #d98a62 100%);
  border-color: transparent;
  color: #fff;
}

.card.dark .muted,
.card.dark .sub,
.card.dark .eyebrow,
.card.dark .label,
.card.green .label,
.card.green .muted,
.card.green .sub,
.card.green .eyebrow {
  color: rgba(255, 255, 255, 0.82);
}

.card.dark .accent {
  color: var(--accent);
}

.card.flat {
  box-shadow: none;
}

.card.tap {
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease;
}

.card.tap:active {
  transform: scale(0.99);
  border-color: #cfcfcf;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stack.sm {
  gap: 8px;
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.grid2 .card + .card {
  margin-top: 0;
}

/* 文本块 */
.label {
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  font-weight: 500;
}

.big {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 52px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.btn:active {
  opacity: 0.85;
}

.btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.btn.ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}

.btn.accent {
  background: var(--accent);
  color: #fff;
}

.btn.small {
  width: auto;
  min-height: 38px;
  padding: 0 14px;
  font-size: 13px;
  border-radius: 10px;
}

.btn.link {
  width: auto;
  min-height: auto;
  padding: 0;
  background: none;
  color: var(--ink);
  font-size: 14px;
}

/* 表单 */
.field {
  margin-bottom: 14px;
}

.input,
select.input {
  width: 100%;
  height: 52px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--ink);
  font-size: 16px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.input:focus {
  border-color: var(--ink);
  background: #fff;
}

.input::placeholder {
  color: #b5b5b5;
}

.hint {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

.error {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--accent);
  min-height: 18px;
}

/* 分段控件 */
.segmented {
  display: flex;
  padding: 3px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 18px;
}

.segmented button {
  flex: 1;
  height: 40px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  font-family: inherit;
  cursor: pointer;
}

.segmented button.active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

/* 列表与成员 */
.list {
  display: flex;
  flex-direction: column;
}

.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.list-row:first-child {
  border-top: none;
  padding-top: 4px;
}

.list-row:last-child {
  padding-bottom: 4px;
}

.avatar {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid transparent;
}

.avatar.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px dashed #cfcfcf;
}

.grow {
  flex: 1;
  min-width: 0;
}

.name {
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.tag {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  border: 1px solid var(--line);
}

.tag.green {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.tag.accent {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: transparent;
}

/* 邀请码 */
.code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 28px;
  letter-spacing: 0.16em;
  font-weight: 700;
}

/* 空态 */
.empty {
  text-align: center;
  padding: 24px 10px;
  color: var(--muted);
  font-size: 14px;
}

/* 底部弹层 */
.sheet-mask {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 10, 0.4);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

.sheet-mask.open {
  opacity: 1;
  pointer-events: auto;
}

.sheet {
  width: 100%;
  max-width: 480px;
  background: var(--surface);
  border-radius: 18px 18px 0 0;
  padding: 12px 20px calc(24px + env(safe-area-inset-bottom));
  transform: translateY(12px);
  transition: transform 0.18s ease;
}

.sheet-mask.open .sheet {
  transform: translateY(0);
}

.sheet::before {
  content: "";
  display: block;
  width: 36px;
  height: 4px;
  border-radius: 999px;
  background: #d9d9d9;
  margin: 0 auto 18px;
}

.sheet-title {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 4px;
}

.sheet-sub {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 18px;
}

/* 轻提示 */
.toast {
  position: fixed;
  left: 50%;
  bottom: 36px;
  transform: translateX(-50%) translateY(8px);
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  padding: 10px 18px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 80;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* 旧页面兼容（t.html） */
.brand {
  font-family: var(--serif);
  font-size: 44px;
  font-weight: 700;
  letter-spacing: 6px;
  text-align: center;
}

.note {
  font-size: 15px;
  line-height: 1.9;
}

.quote {
  color: var(--muted);
  font-size: 13px;
  margin-top: 14px;
}

.disabled {
  margin-top: 20px;
  display: flex;
  gap: 8px;
}

.disabled input {
  flex: 1;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 14px;
  background: var(--surface-2);
  color: var(--muted);
}

.disabled button {
  border: none;
  border-radius: 12px;
  padding: 0 18px;
  background: #eee;
  color: var(--muted);
}

.foot {
  margin-top: 24px;
  text-align: center;
  font-size: 12px;
  color: #b0b0b0;
  line-height: 1.8;
}

/* 聊天 */
.chat-page {
  padding-bottom: 124px;
}

.chat-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 8px;
}

.chat-head .avatar {
  width: 36px;
  height: 36px;
  font-size: 13px;
}

.chat-title {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
}

.chat-sub {
  font-size: 12px;
  color: var(--muted);
}

.messages {
  display: flex;
  flex-direction: column;
  padding: 10px 0 20px;
}

.msg {
  display: flex;
  margin: 5px 0;
}

.msg.agent {
  justify-content: flex-start;
}

.msg.user {
  justify-content: flex-end;
}

.bubble {
  max-width: 84%;
  padding: 11px 14px;
  border-radius: 16px;
  font-size: 15px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.msg.agent .bubble {
  background: var(--surface);
  border: 1px solid var(--line);
  border-bottom-left-radius: 6px;
}

.msg.user .bubble {
  background: var(--ink);
  color: #fff;
  border-bottom-right-radius: 6px;
}

.msg.system {
  justify-content: center;
  margin: 12px 0;
}

.msg.system .bubble {
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  padding: 4px;
}

.typing {
  color: var(--muted);
  font-size: 13px;
  padding: 6px 2px;
}

.composer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  gap: 8px;
  padding: 10px 16px calc(26px + env(safe-area-inset-bottom));
  background: rgba(250, 245, 238, 0.96);
  border-top: 1px solid var(--line);
  z-index: 30;
}

.composer-inner {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  gap: 8px;
}

.composer input {
  flex: 1;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 23px;
  background: #fff;
  font-size: 15px;
  font-family: inherit;
  outline: none;
}

.composer input:focus {
  border-color: var(--ink);
}

.composer button {
  width: 64px;
  height: 46px;
  border: none;
  border-radius: 23px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
}

.composer button:disabled {
  opacity: 0.4;
}

/* 卡片内的小区块 */
.section {
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.section:first-of-type {
  border-top: none;
  padding-top: 0;
}

.section-label {
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 4px;
  font-weight: 500;
}

.section-text {
  font-size: 15px;
  line-height: 1.7;
}

.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.pill {
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--ink-2);
}

.pill.warn {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent);
}

.link-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
}

.link-box span {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.outbox {
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.7;
}

/* 底部导航 + 常驻语音按钮 */
body.has-shell .page {
  padding-bottom: 216px;
}

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 253, 248, 0.97);
  border-top: 1px solid var(--line);
  z-index: 40;
  backdrop-filter: blur(10px);
}

.tabbar-inner {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
}

.tab {
  flex: 1;
  border: none;
  background: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 4px 2px;
  color: var(--muted);
  font-size: 10px;
  font-family: inherit;
  letter-spacing: 0.02em;
}

.tab svg {
  width: 22px;
  height: 22px;
}

.tab.active {
  color: var(--accent);
}

.voice-fab {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(68px + env(safe-area-inset-bottom));
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 4px solid #fffdf8;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(196, 106, 70, 0.28);
  z-index: 45;
}

.voice-fab:active {
  transform: translateX(-50%) scale(0.96);
}

.voice-panel {
  text-align: center;
}

.voice-mic {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  border: none;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 6px auto 10px;
}

.voice-mic:active {
  background: #dbe8ff;
}

.voice-mic svg {
  width: 34px;
  height: 34px;
}

.mic-btn {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border: none;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

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

/* 选择胶囊 / 加载 */
.pill {
  cursor: pointer;
}

.pill.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.loading-mask {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.94);
  z-index: 90;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  text-align: center;
}

.loading-mask.show {
  display: flex;
}

.spinner {
  width: 34px;
  height: 34px;
  border: 3px solid var(--accent-soft);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: weilu-spin 0.9s linear infinite;
}

@keyframes weilu-spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-title {
  font-size: 16px;
  font-weight: 600;
}

.loading-sub {
  font-size: 13px;
  color: var(--muted);
}

.row-input {
  display: flex;
  gap: 8px;
}

.row-input .input {
  flex: 1;
}

.row-input .btn {
  width: auto;
  min-width: 84px;
  height: 52px;
  padding: 0 16px;
}

.voice-mic {
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.voice-mic.recording {
  background: var(--clay);
  color: #fff;
  animation: voice-pulse 1.2s ease-out infinite;
}

@keyframes voice-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(229, 72, 77, 0.35);
  }
  70% {
    box-shadow: 0 0 0 18px rgba(229, 72, 77, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(229, 72, 77, 0);
  }
}

/* 首页卡片流 */
.agent-line {
  font-size: 13px;
  color: var(--muted);
  margin: 2px 0 0;
}

.avatar.tap {
  cursor: pointer;
}

.scope-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 26px 0 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  letter-spacing: 0.04em;
}

.scope-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.scope-dot.in {
  background: var(--accent);
}

.scope-dot.out {
  background: var(--amber);
}

.feed-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 14px 15px 17px;
  margin-top: 9px;
  border-left: 3px solid transparent;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}

.feed-card.in {
  background: #fbeee5;
  border-color: #f0d8c8;
  border-left-color: var(--accent);
}

.feed-card.out {
  background: #fbf3e2;
  border-color: #efdfc2;
  border-left-color: var(--amber);
}

.feed-main {
  flex: 1;
  min-width: 0;
}

.feed-title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
}

.feed-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
}

.feed-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 9px;
}

.feed-tag {
  font-size: 11px;
  color: var(--ink-2);
  background: rgba(255, 255, 255, 0.75);
  border-radius: 999px;
  padding: 3px 9px;
  white-space: nowrap;
}

.check {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1.5px solid #dccbbd;
  background: transparent;
  padding: 0;
}

.feed-card.out .check {
  border-color: #dcc49a;
}

.check:active {
  background: #fff;
}

.feed-card.gone {
  transform: translateX(-115%);
  opacity: 0;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.feed-empty {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 16px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  margin-top: 9px;
}

.scope-sub {
  margin: -4px 0 6px 16px;
  font-size: 12px;
  color: var(--muted);
}

.login-line {
  font-family: var(--serif);
  margin: 24px 0 6px;
  font-size: 27px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.02em;
}

.card.soft {
  background: #fdf6ee;
  border-color: #f0ddcc;
}

.soft-text {
  font-size: 15px;
  line-height: 1.8;
  color: var(--ink-2);
}

.quick-row { display: flex; gap: 10px; margin-top: 10px; }
.quick-btn {
  flex: 1;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 14px;
  padding: 14px 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.4;
}
.quick-btn:active { background: var(--accent-soft); border-color: var(--accent); }
.people { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px 8px; margin-top: 6px; }
.person { border: none; background: transparent; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 4px; }
.person .avatar { width: 48px; height: 48px; }
.person-name { font-size: 12px; color: var(--ink-2); }
