﻿:root {
  --bg: #fff9ee;
  --bg-soft: rgba(255, 251, 234, 0.88);
  --card: rgba(255, 253, 246, 0.92);
  --card-strong: rgba(255, 251, 241, 0.96);
  --line: rgba(215, 204, 200, 0.74);
  --text: #4d3a24;
  --text-soft: #7a6142;
  --muted: #9f7e52;
  --warm: #f1cf7b;
  --warm-deep: #dca54d;
  --warm-pale: #fff2cc;
  --shadow: 0 16px 34px rgba(119, 87, 41, 0.16);
  --chat-bottom-width: min(532px, calc(100vw - 28px));
  --model-picker-width: var(--chat-bottom-width);
  --model-picker-bottom-gap: 10px;
  --model-picker-max-height: min(78vh, 720px);
}

body {
  margin: 0;
  font-family: "Microsoft YaHei", sans-serif;
  background-color: #fff9ee;
  background:
    radial-gradient(circle at 14% 12%, rgba(255, 252, 243, 0.94), transparent 44%),
    radial-gradient(circle at 85% 8%, rgba(255, 255, 250, 0.88), transparent 40%),
    linear-gradient(180deg, #fffaf1 0%, #fffdf8 100%);
  color: var(--text);
}

@keyframes tabBarIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

button,
input,
textarea,
select {
  font: inherit;
}

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

.ambient-glow {
  position: fixed;
  inset: auto;
  z-index: 0;
  width: 220px;
  height: 220px;
  border-radius: 999px;
  background: rgba(255, 202, 85, 0.12);
  filter: blur(48px);
  pointer-events: none;
}

.ambient-glow-left {
  top: 62px;
  left: -52px;
}

.ambient-glow-right {
  right: -56px;
  bottom: 126px;
}

.app-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  max-width: 560px;
  margin: 0 auto;
  padding: 14px 14px 78px;
  box-sizing: border-box;
}

body[data-active-view="chatView"] .top-homeplate {
  opacity: 0;
  transform: translateY(-10px) scale(0.98);
  pointer-events: none;
  margin-bottom: 0;
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  overflow: hidden;
  transition: opacity 180ms ease, transform 180ms ease, max-height 180ms ease, margin-bottom 180ms ease, padding 180ms ease;
}

.top-homeplate {
  position: sticky;
  top: 10px;
  z-index: 20;
  display: grid;
  gap: 6px;
  justify-items: center;
  text-align: center;
  margin-bottom: 14px;
  padding: 14px 18px;
  border: 1px solid rgba(225, 203, 166, 0.76);
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(255, 252, 243, 0.94), rgba(255, 248, 232, 0.92));
  box-shadow: 0 12px 28px rgba(138, 97, 39, 0.14);
  backdrop-filter: blur(12px);
}

.homeplate-kicker,
.eyebrow,
.card-kicker,
.mini-label,
.soft-date {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #9b7644;
}

.homeplate-title,
.view-intro h1,
.chat-topbar h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
}

.homeplate-title {
  font-size: clamp(24px, 4.8vw, 30px);
  letter-spacing: 0.02em;
  line-height: 1.25;
}

.homeplate-copy {
  margin: 0;
  font-size: 13px;
  color: #805f34;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

body[data-active-view="chatView"] .app-main {
  height: calc(100vh - 88px);
  min-height: 0;
  overflow: hidden;
}

body[data-active-view="chatView"] #chatView {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.view-intro {
  margin-bottom: 14px;
}

.view-copy,
.card-tip,
.summary-copy,
.welcome-copy {
  margin: 8px 0 0;
  line-height: 1.75;
  color: var(--text-soft);
}

.card {
  border: 1px solid var(--line);
  border-radius: 30px;
  background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.home-hero-card,
.info-card,
.editor-card,
.setting-card,
.chat-topbar,
.mini-entry-card {
  padding: 18px;
}

.home-hero-card {
  background:
    linear-gradient(180deg, rgba(255, 251, 241, 0.98), rgba(245, 245, 220, 0.92)),
    var(--card-strong);
}

.hero-portrait-row {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin-top: 12px;
}

.portrait {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 999px;
  font-size: 24px;
  font-weight: 700;
  box-shadow: 0 10px 18px rgba(88, 70, 53, 0.12);
}

.portrait-qing {
  background: rgb(22, 38, 58);
  color: #f2f4f8;
}

.portrait-qi {
  background: rgb(206, 138, 157);
  color: #fff7fa;
}

.hero-days {
  margin: 16px 0 0;
  text-align: center;
  font-size: 52px;
  font-weight: 700;
}

.hero-subtitle {
  margin: 4px 0 0;
  text-align: center;
  color: #946f41;
}

.season-pill {
  display: inline-flex;
  justify-content: center;
  min-width: 160px;
  margin: 16px auto 0;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(255, 202, 85, 0.18);
  color: #806445;
}

.welcome-card {
  margin-top: 18px;
  padding: 18px;
  border-radius: 24px;
  background: rgba(255, 252, 247, 0.92);
}

.home-action-row,
.weather-grid,
.entry-grid {
  display: grid;
  gap: 12px;
}

.home-action-row {
  grid-template-columns: 1fr 1fr;
  margin-top: 16px;
}

.primary-button,
.secondary-button,
.inline-button,
.compact-button,
.send-button,
.icon-button {
  border: none;
  border-radius: 18px;
  cursor: pointer;
}

.primary-button {
  padding: 12px 14px;
  background: linear-gradient(180deg, #f6d98a 0%, #e9bf67 100%);
  color: #4c371b;
  box-shadow: 0 8px 14px rgba(140, 96, 35, 0.16);
}

.secondary-button,
.compact-button {
  padding: 12px 14px;
  background: rgba(255, 251, 240, 0.96);
  color: #6d5438;
}

.inline-button {
  padding: 0;
  background: transparent;
  color: #936632;
}

.card-headline,
.setting-row,
.setting-toggle-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.home-meta-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.weather-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 14px;
}

.weather-main {
  margin: 6px 0 0;
  font-size: 24px;
  font-weight: 700;
}

.weather-detail {
  margin: 6px 0 0;
  color: var(--text-soft);
}

.reminder-status-text {
  margin-top: 10px;
}

.daily-summary-card {
  background:
    linear-gradient(180deg, rgba(255, 251, 242, 0.98), rgba(255, 248, 235, 0.96)),
    var(--card-strong);
  border-color: rgba(221, 205, 178, 0.82);
}

.daily-summary-headline {
  align-items: flex-start;
}

.daily-summary-heading {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.daily-summary-copy {
  margin-top: 0;
  max-width: 28ch;
}

.daily-summary-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
  row-gap: 6px;
}

.daily-summary-actions .inline-button {
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(255, 248, 229, 0.92);
  color: #855f32;
  box-shadow: inset 0 0 0 1px rgba(226, 205, 168, 0.72);
}

.daily-summary-actions .inline-button.hidden {
  display: none;
}

.daily-summary-meta {
  margin-top: 14px;
}

.stage-block-candidate-panel {
  margin-top: 14px;
  padding: 16px 16px 14px;
  border: 1px solid rgba(231, 209, 170, 0.78);
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(255, 250, 238, 0.96), rgba(255, 246, 226, 0.92));
}

.stage-block-candidate-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.stage-block-candidate-title {
  margin: 6px 0 0;
  font-size: 1rem;
  color: var(--text);
}

.stage-block-candidate-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.stage-block-candidate-actions .inline-button {
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(255, 250, 238, 0.94);
  color: #855f32;
  box-shadow: inset 0 0 0 1px rgba(226, 205, 168, 0.72);
}

.stage-block-candidate-copy {
  margin: 12px 0 0;
  white-space: pre-wrap;
  line-height: 1.8;
  color: var(--text);
}

.stage-block-candidate-meta,
.stage-block-candidate-status {
  margin-top: 10px;
}

.stage-block-candidate-status {
  color: #9a6333;
}

.daily-summary-display,
.daily-summary-editor {
  margin-top: 12px;
  border: 1px solid rgba(226, 211, 186, 0.76);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 253, 247, 0.96), rgba(255, 250, 240, 0.92));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.daily-summary-display {
  min-height: 188px;
  padding: 18px 18px 20px;
}

.daily-summary-content,
.daily-summary-empty {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.85;
}

.daily-summary-content {
  color: var(--text);
}

.daily-summary-empty {
  color: var(--text-soft);
}

.daily-summary-editor {
  padding: 12px;
}

.daily-summary-editor textarea {
  min-height: 196px;
  margin-top: 0;
  border-radius: 18px;
  background: rgba(255, 251, 233, 0.92);
}

.daily-summary-editor textarea[readonly] {
  cursor: default;
}

@media (max-width: 640px) {
  .stage-block-candidate-head {
    flex-direction: column;
  }

  .stage-block-candidate-actions {
    width: 100%;
    justify-content: flex-start;
  }
}

.reminder-editor {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid rgba(215, 204, 200, 0.7);
  border-radius: 18px;
  background: rgba(255, 255, 252, 0.86);
}

#homeReminderInput {
  min-height: 86px;
  margin-top: 0;
}

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

#refreshHomeButton:disabled,
#saveReminderButton:disabled {
  opacity: 0.72;
  cursor: not-allowed;
}

.chat-page-shell {
  position: relative;
}

.chat-page-shell {
  position: relative;
  min-height: calc(100vh - 144px);
  isolation: isolate;
  height: 100%;
}

.chat-page-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  border-radius: 32px;
  background:
    var(
      --chat-page-background-overlay,
      linear-gradient(180deg, rgba(255, 252, 246, 0.94), rgba(255, 248, 239, 0.96))
    ),
    var(--chat-page-background-image, none);
  background-size: var(--chat-page-background-size, auto 100%);
  background-repeat: var(--chat-page-background-repeat, no-repeat);
  background-position: var(--chat-page-background-position, center center);
}

.chat-layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: calc(100vh - 144px);
  height: 100%;
  min-width: 0;
  gap: 2px;
}

.conversation-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 29;
  border: none;
  background: rgba(70, 52, 31, 0.1);
  backdrop-filter: blur(2px);
}

.conversation-drawer {
  position: fixed;
  top: 74px;
  left: 14px;
  right: 14px;
  z-index: 30;
  display: flex;
  flex-direction: column;
  width: auto;
  max-width: min(716px, calc(100vw - 28px));
  max-height: calc(100vh - 196px);
  overflow: hidden;
  margin: 0 auto;
  padding: 16px 14px 16px;
  border: 1px solid rgba(221, 204, 176, 0.82);
  border-radius: 30px;
  background: rgba(255, 253, 248, 0.98);
  box-shadow: 0 16px 36px rgba(90, 65, 34, 0.13);
  transform: translateY(-10px);
  opacity: 0;
  pointer-events: none;
  transition: transform 180ms ease, opacity 180ms ease;
}

.conversation-drawer:not(.hidden),
.appearance-drawer:not(.hidden) {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.appearance-drawer {
  position: fixed;
  left: 14px;
  right: 14px;
  top: 74px;
  z-index: 30;
  width: auto;
  max-width: min(716px, calc(100vw - 28px));
  max-height: calc(100vh - 196px);
  overflow: auto;
  margin: 0 auto;
  padding: 16px 14px;
  border: 1px solid rgba(221, 204, 176, 0.82);
  border-radius: 28px;
  background: rgba(255, 253, 248, 0.98);
  box-shadow: 0 16px 36px rgba(90, 65, 34, 0.13);
  transform: translateY(-10px);
  opacity: 0;
  pointer-events: none;
  transition: transform 180ms ease, opacity 180ms ease;
}

.conversation-drawer-head,
.conversation-drawer-actions,
.conversation-sidebar-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.drawer-kicker {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #9b7644;
}

.conversation-drawer-title {
  margin: 6px 0 0;
  font-size: 18px;
  line-height: 1.45;
}

.conversation-drawer-head {
  align-items: flex-start;
}

.conversation-sidebar-tools {
  margin-top: 10px;
}

.subtle-icon-button {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 999px;
  background: rgba(255, 248, 225, 0.92);
}

.conversation-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 2px 2px 0 0;
}

.appearance-drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.chat-appearance-panel {
  margin-top: 14px;
  display: grid;
  gap: 14px;
}

.chat-appearance-copy {
  margin: 6px 0 0;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.6;
}

.appearance-copy-block {
  display: grid;
  gap: 4px;
}

.appearance-note {
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.5;
}

.appearance-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(226, 212, 188, 0.72);
  border-radius: 18px;
  background: rgba(255, 250, 239, 0.84);
}

.appearance-row.stack-row {
  align-items: flex-start;
  flex-direction: column;
}

.appearance-label {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.background-preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.background-preset {
  border: 1px solid rgba(221, 208, 184, 0.82);
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(255, 251, 241, 0.94);
  color: var(--text-soft);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease, background-color 180ms ease;
}

.background-preset.active {
  border-color: rgba(223, 188, 124, 0.82);
  background: rgba(252, 239, 201, 0.94);
  color: var(--text);
  box-shadow: 0 8px 18px rgba(121, 90, 50, 0.08);
}

.conversation-item {
  padding: 12px 13px;
  border: 1px solid rgba(223, 212, 193, 0.82);
  border-radius: 18px;
  background: rgba(255, 254, 251, 0.96);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.conversation-item.active {
  border-color: rgba(223, 188, 124, 0.78);
  background: rgba(255, 247, 214, 0.9);
  box-shadow: 0 8px 18px rgba(124, 92, 53, 0.08);
}

.conversation-item:hover {
  transform: translateY(-1px);
}

.conversation-item-head,
.conversation-item-actions,
.chat-topbar-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.conversation-item-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.45;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conversation-item-actions {
  margin-top: 8px;
  justify-content: flex-start;
  gap: 12px;
}

.conversation-action {
  border: none;
  padding: 0;
  background: transparent;
  color: #8a6a45;
  font-size: 12px;
  cursor: pointer;
}

.conversation-select-button {
  width: 100%;
  border: none;
  padding: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.conversation-rename-form {
  display: grid;
  gap: 8px;
}

.conversation-rename-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.sidebar-import-button {
  width: 100%;
  justify-content: center;
}

.chat-topbar {
  display: grid;
  gap: 8px;
  position: sticky;
  top: 6px;
  z-index: 15;
  padding: 10px 12px 9px;
  margin: 0;
  border-radius: 26px 26px 18px 18px;
  background: linear-gradient(180deg, rgba(255, 251, 244, 0.96), rgba(255, 250, 242, 0.92));
  box-shadow: 0 10px 22px rgba(118, 86, 45, 0.06);
  border: 1px solid rgba(232, 218, 193, 0.68);
  border-bottom-color: rgba(232, 218, 193, 0.3);
}

.chat-topbar-row,
.chat-topbar-actions,
.chat-heading {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
}

.chat-topbar-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  align-items: center;
  gap: 12px;
}

.chat-heading {
  align-items: center;
  flex-direction: column;
  gap: 6px;
  padding: 0;
}

.chat-topbar-title-group {
  display: grid;
  gap: 2px;
  min-width: 0;
  justify-items: center;
  text-align: center;
  padding-top: 2px;
}

.chat-topbar-mainline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
}

.chat-summary-indicator {
  --summary-progress: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(228, 213, 188, 0.78);
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 251, 241, 0.94);
  color: #8a6539;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.chat-summary-indicator:hover {
  transform: translateY(-1px);
  border-color: rgba(218, 189, 138, 0.92);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), 0 8px 18px rgba(133, 93, 39, 0.08);
}

.chat-summary-indicator:disabled {
  cursor: default;
  opacity: 0.6;
  transform: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.chat-summary-ring {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background:
    conic-gradient(#d6a75e calc(var(--summary-progress) * 1%), rgba(228, 219, 201, 0.48) 0),
    radial-gradient(circle at center, rgba(255, 252, 247, 0.98) 56%, transparent 58%);
  flex: 0 0 auto;
}

.chat-summary-label {
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}

.chat-summary-indicator[data-state="building"] .chat-summary-ring,
.chat-summary-indicator[data-state="recently_updated"] .chat-summary-ring {
  background:
    conic-gradient(#b98a43 calc(var(--summary-progress) * 1%), rgba(228, 219, 201, 0.48) 0),
    radial-gradient(circle at center, rgba(255, 252, 247, 0.98) 56%, transparent 58%);
}

.chat-summary-indicator[data-state="stuck"],
.chat-summary-indicator[data-state="failed_recently"] {
  color: #9f5e37;
  border-color: rgba(224, 183, 159, 0.8);
  background: rgba(255, 246, 240, 0.94);
}

.chat-summary-indicator[data-state="stuck"] .chat-summary-ring,
.chat-summary-indicator[data-state="failed_recently"] .chat-summary-ring {
  background:
    conic-gradient(#cf7b57 calc(var(--summary-progress) * 1%), rgba(233, 214, 204, 0.55) 0),
    radial-gradient(circle at center, rgba(255, 252, 247, 0.98) 56%, transparent 58%);
}

.chat-summary-sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 34;
}

.chat-summary-sheet-backdrop {
  position: absolute;
  inset: 0;
  border: none;
  background: rgba(79, 59, 36, 0.16);
  backdrop-filter: blur(4px);
}

.chat-summary-sheet {
  position: absolute;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 18px);
  transform: translateX(-50%);
  width: min(calc(100vw - 28px), 720px);
  max-height: min(78vh, 760px);
  overflow-y: auto;
  padding: 14px 16px 18px;
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(255, 252, 244, 0.99), rgba(255, 247, 232, 0.98)),
    var(--card-strong);
  border: 1px solid rgba(224, 204, 168, 0.82);
  box-shadow: 0 22px 48px rgba(100, 70, 36, 0.18);
}

.chat-summary-sheet-handle {
  width: 46px;
  height: 5px;
  margin: 0 auto 14px;
  border-radius: 999px;
  background: rgba(205, 181, 139, 0.9);
}

@media (min-width: 900px) {
  .chat-summary-sheet {
    top: 88px;
    bottom: auto;
  }
}

.chat-sidebar-current {
  margin: 0;
  color: #876844;
  font-size: 13px;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conversation-launcher {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(221, 208, 184, 0.76);
  border-radius: 15px;
  background: rgba(255, 252, 245, 0.92);
  color: var(--text);
  box-shadow: 0 8px 20px rgba(115, 85, 45, 0.08);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.conversation-launcher:hover {
  transform: translateY(-1px);
  border-color: rgba(223, 188, 124, 0.76);
  box-shadow: 0 12px 24px rgba(115, 85, 45, 0.1);
}

.chat-topbar-actions {
  margin-left: auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  row-gap: 7px;
}

.chat-topbar-actions .compact-button {
  min-height: 36px;
  padding-inline: 11px;
}

.chat-topbar-action-button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(221, 208, 184, 0.76);
  border-radius: 15px;
  background: rgba(255, 252, 245, 0.92);
  color: var(--text);
  box-shadow: 0 8px 20px rgba(115, 85, 45, 0.08);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.chat-topbar-action-button:hover {
  transform: translateY(-1px);
  border-color: rgba(223, 188, 124, 0.76);
  box-shadow: 0 12px 24px rgba(115, 85, 45, 0.1);
}

.chat-topbar-icon {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
}

.chat-topbar-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.appearance-drawer-head .chat-appearance-head {
  min-width: 0;
}

.chat-heading h1 {
  margin: 0;
  font-size: clamp(20px, 4.8vw, 27px);
  line-height: 1.24;
}

.chat-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.title-edit-button {
  border: none;
  padding: 0;
  background: transparent;
  color: #8a6a45;
  font-size: 12px;
  cursor: pointer;
  opacity: 0.82;
}

.conversation-title-editor {
  width: 100%;
  display: grid;
  gap: 8px;
}

.conversation-title-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.chat-topbar-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  max-width: 34ch;
  text-align: center;
}

.context-control {
  display: grid;
  gap: 4px;
  color: var(--text-soft);
  font-size: 12px;
}

.context-control-drawer {
  justify-items: end;
  min-width: max-content;
}

.context-input-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 112px;
  padding: 8px 10px;
  border: 1px solid rgba(215, 204, 200, 0.92);
  border-radius: 14px;
  background: rgba(255, 252, 247, 0.96);
}

.context-input {
  width: 7ch;
  min-width: 56px;
  border: none;
  padding: 0;
  background: transparent;
  color: var(--text);
  text-align: right;
  outline: none;
}

.context-input::-webkit-outer-spin-button,
.context-input::-webkit-inner-spin-button {
  margin: 0;
}

.context-suffix {
  color: var(--text-soft);
  font-size: 12px;
}

.chat-status-line {
  margin-bottom: 10px;
  padding: 11px 13px;
  border-radius: 16px;
  background: rgba(255, 251, 239, 0.9);
  color: var(--text-soft);
  font-size: 13px;
}

.chat-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 8px 12px 0;
  margin-top: -1px;
  border-radius: 20px 20px 28px 28px;
  background: linear-gradient(180deg, rgba(255, 251, 242, 0.7), rgba(255, 250, 241, 0.56));
  border: 1px solid rgba(233, 220, 197, 0.56);
  border-top-color: rgba(233, 220, 197, 0.18);
  overflow: hidden;
}

.chat-status-line[data-tone="error"] {
  background: rgba(255, 239, 237, 0.92);
  color: #8b584f;
}

.chat-status-line[data-tone="live"] {
  background: rgba(250, 244, 228, 0.94);
}

.chat-status-line[data-tone="info"] {
  background: rgba(251, 248, 240, 0.94);
}

.chat-messages {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 2px 0 var(--chat-messages-safe-bottom, 18px);
  overflow-y: auto;
  scroll-padding-bottom: var(--chat-messages-safe-bottom, 18px);
  border-radius: 22px;
  background:
    var(--chat-messages-background-overlay, transparent),
    var(--chat-messages-background-image, none);
  background-size: var(--chat-messages-background-size, auto auto);
  background-repeat: var(--chat-messages-background-repeat, no-repeat);
  background-position: var(--chat-messages-background-position, center top);
}

.time-divider {
  align-self: center;
  margin: 6px 0 0;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 250, 238, 0.88);
  font-size: 12px;
  color: #9e7948;
}

.message-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.message-row.segment-continuation {
  margin-top: -8px;
}

.message-row.user {
  justify-content: flex-end;
}

.message-bubble-line {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  max-width: 100%;
}

.message-row.user .message-bubble-line {
  justify-content: flex-end;
  gap: 2px;
}

.avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 6px;
  box-shadow: 0 8px 16px rgba(109, 83, 50, 0.12);
}

.avatar.reply {
  background: #4a321b;
  color: #fff8e5;
}

.avatar.user {
  order: 2;
  background: #fff4cd;
  color: #6a4f2c;
  margin-left: -2px;
}

.avatar-spacer {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
}

.avatar-spacer.user {
  order: 2;
}

.message-bubble {
  max-width: min(78%, 420px);
  padding: 14px 16px;
  border-radius: 24px;
  line-height: 2;
  box-shadow: 0 8px 16px rgba(96, 75, 56, 0.07);
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.message-bubble.is-streaming::after {
  content: " · 宝宝等等哦，老公正在打字中ing~";
  color: #9d7d55;
  font-size: 12px;
}

.message-bubble.reply {
  background: rgba(255, 252, 239, 0.96);
}

.message-bubble.user {
  background: rgba(251, 235, 190, 0.96);
}

.message-bubble-wrap {
  display: grid;
  gap: 6px;
  justify-items: start;
}

.message-bubble-wrap.segment-wrap {
  margin-left: 0;
}

.message-row.user .message-bubble-wrap {
  justify-items: end;
  width: auto;
  max-width: min(78%, 420px);
}

.message-inline-time {
  align-self: flex-end;
  min-width: max-content;
  font-size: 11px;
  color: rgba(133, 104, 64, 0.86);
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 160ms ease, transform 160ms ease;
  pointer-events: none;
}

.message-row.user .message-inline-time {
  align-self: flex-end;
  transform: translateX(4px);
}

.message-inline-time.visible {
  opacity: 1;
  transform: translateX(0);
}

.message-action-row {
  display: flex;
  justify-content: flex-end;
}

.message-edit-button {
  border: none;
  padding: 0 4px;
  background: transparent;
  color: #8a6a45;
  font-size: 12px;
  cursor: pointer;
  opacity: 0.74;
  transition: opacity 180ms ease, transform 180ms ease, color 180ms ease;
}

.message-edit-button:active {
  transform: scale(0.97);
}

.message-edit-button:hover {
  opacity: 1;
}

.message-attachments,
.attachment-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.message-attachments {
  margin-top: 8px;
}

.message-image,
.attachment-preview-image {
  display: block;
  width: 120px;
  height: 120px;
  border-radius: 18px;
  object-fit: cover;
  border: 1px solid rgba(215, 204, 200, 0.8);
}

.attachment-strip {
  margin: 0 2px 6px;
}

.attachment-preview {
  position: relative;
  padding: 8px;
  border: 1px solid rgba(215, 204, 200, 0.72);
  border-radius: 18px;
  background: rgba(255, 253, 248, 0.92);
}

.attachment-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 999px;
  background: rgba(61, 49, 37, 0.72);
  color: #fff;
  cursor: pointer;
}

.attachment-caption {
  margin: 8px 0 0;
  color: var(--text-soft);
  font-size: 12px;
}

.edit-resend-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 2px 8px;
  padding: 10px 14px;
  border: 1px solid rgba(224, 190, 125, 0.55);
  border-radius: 18px;
  background: rgba(255, 251, 233, 0.9);
  color: var(--text-soft);
}

.edit-resend-text {
  font-size: 13px;
  line-height: 1.5;
}

.hidden {
  display: none;
}

.chat-composer-wrap {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  width: var(--chat-bottom-width);
  bottom: var(--chat-composer-offset, 46px);
  z-index: 9;
  display: grid;
  gap: 2px;
  padding-top: 0;
  padding-bottom: 0;
  margin-top: 0;
}

.chat-composer-wrap::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: -1px;
  height: 10px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 247, 223, 0.15), rgba(255, 247, 223, 0));
  pointer-events: none;
  z-index: -1;
}

.chat-input-shell {
  position: relative;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 92px;
  gap: 8px;
  min-height: 62px;
  padding: 6px 7px;
  border: 1px solid rgba(223, 190, 131, 0.78);
  border-radius: 24px;
  background: rgba(255, 250, 235, 0.98);
  box-shadow: 0 8px 18px rgba(133, 93, 39, 0.08);
  transition: border-color 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
  align-items: center;
}

.chat-view-bg-warm .chat-body {
  background: linear-gradient(180deg, rgba(255, 251, 242, 0.8), rgba(255, 250, 241, 0.62));
}

.chat-view-bg-linen .chat-body {
  background: linear-gradient(180deg, rgba(254, 252, 247, 0.8), rgba(253, 250, 244, 0.62));
}

.chat-view-bg-twilight .chat-body {
  background: linear-gradient(180deg, rgba(249, 245, 236, 0.8), rgba(248, 243, 234, 0.62));
}

.chat-input-shell .icon-button {
  width: 38px;
  height: 38px;
  min-width: 38px;
  min-height: 38px;
  padding: 0;
  border-radius: 999px;
  background: rgba(252, 242, 205, 0.92);
  color: #755226;
  box-shadow: inset 0 0 0 1px rgba(225, 193, 134, 0.42);
  transition: background-color 180ms ease, box-shadow 180ms ease, filter 180ms ease;
}

#messageInput,
textarea,
.setting-input,
select {
  width: 100%;
  border: 1px solid rgba(224, 190, 125, 0.88);
  border-radius: 18px;
  background: rgba(255, 251, 223, 0.96);
  color: var(--text);
  box-sizing: border-box;
  outline: none;
}

#messageInput {
  grid-column: 2 / 3;
  min-height: 52px;
  max-height: 172px;
  padding: 12px 14px;
  line-height: 1.65;
  resize: none;
  overflow-y: auto;
  border-radius: 20px;
  background: rgba(255, 251, 224, 0.88);
  transition: border-color 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
  display: block;
  align-self: center;
  margin: 0;
}

textarea {
  min-height: 170px;
  margin-top: 14px;
  padding: 14px 16px;
  resize: vertical;
  line-height: 1.8;
}

.setting-input,
select {
  padding: 12px 14px;
}

#messageInput:focus,
textarea:focus,
.setting-input:focus,
select:focus {
  border-color: var(--warm-deep);
  box-shadow: 0 0 0 3px rgba(255, 202, 85, 0.14);
  background: rgba(255, 253, 242, 0.98);
}

.chat-input-shell .send-button {
  background: linear-gradient(180deg, #efd98c 0%, #e7c773 100%);
  color: #51391d;
  box-shadow: 0 5px 10px rgba(138, 98, 38, 0.13);
  min-height: 46px;
  padding: 0 14px;
  border-radius: 20px;
  transition: background-color 180ms ease, box-shadow 180ms ease, filter 180ms ease;
  align-self: center;
  z-index: 1;
}

.expand-button {
  display: none;
}

.chat-input-shell:focus-within {
  border-color: rgba(216, 169, 74, 0.78);
  box-shadow: 0 10px 20px rgba(133, 93, 39, 0.12);
}

.composer-editor-overlay {
  position: fixed;
  inset: 0;
  z-index: 46;
}

.composer-editor-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(78, 59, 34, 0.18);
  backdrop-filter: blur(2px);
}

.composer-editor-panel {
  position: absolute;
  left: 14px;
  right: 14px;
  top: 18px;
  bottom: 18px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 14px;
  padding: 16px 14px;
  border-radius: 28px;
  background: rgba(255, 252, 246, 0.98);
  box-shadow: 0 18px 36px rgba(93, 67, 32, 0.16);
}

.composer-editor-head,
.composer-editor-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.composer-editor-title {
  margin: 6px 0 0;
  font-size: 18px;
  line-height: 1.4;
  color: var(--text);
}

.composer-editor-textarea {
  width: 100%;
  min-height: 0;
  height: 100%;
  margin-top: 0;
  padding: 16px 18px;
  resize: none;
  border: 1px solid rgba(224, 190, 125, 0.72);
  border-radius: 22px;
  background: rgba(255, 251, 232, 0.94);
  line-height: 1.9;
  overflow-y: auto;
  box-sizing: border-box;
}

.composer-editor-hint {
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.5;
}

.chat-input-shell .icon-button:hover,
.chat-input-shell .send-button:hover,
.nav-item:hover,
.message-edit-button:hover {
  filter: brightness(1.02);
}

.chat-input-shell .icon-button:active,
.chat-input-shell .send-button:active,
.nav-item:active {
  transform: scale(0.98);
}

.chat-input-shell .send-button:active {
  box-shadow: 0 3px 7px rgba(138, 98, 38, 0.11);
}

body[data-active-view="chatView"] .app-shell {
  padding-top: 6px;
  padding-bottom: 0;
}

.setting-card + .setting-card,
.editor-card + .editor-card,
.info-card + .info-card,
.entry-grid,
.home-hero-card + .info-card {
  margin-top: 14px;
}

.setting-row {
  margin-top: 14px;
}

.setting-row:first-child,
.setting-toggle-row:first-child {
  margin-top: 0;
}

.model-setting-stack {
  gap: 14px;
}

.setting-card-intro {
  display: grid;
  gap: 4px;
}

.model-setting-grid {
  display: grid;
  gap: 14px;
}

.model-setting-trigger {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 16px 15px 15px;
  border-radius: 24px;
  border: 1px solid rgba(226, 199, 145, 0.68);
  background: linear-gradient(180deg, rgba(255, 251, 235, 0.95), rgba(255, 248, 225, 0.92));
  color: var(--text);
  text-align: left;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: border-color 180ms ease, transform 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
}

.model-setting-trigger:hover {
  transform: translateY(-1px);
  border-color: rgba(215, 173, 101, 0.84);
  box-shadow: 0 10px 24px rgba(144, 108, 54, 0.08);
}

.model-setting-trigger:disabled {
  opacity: 0.7;
}

.model-setting-trigger-secondary {
  background: linear-gradient(180deg, rgba(255, 250, 239, 0.95), rgba(255, 246, 229, 0.9));
}

.model-setting-trigger-copy {
  min-width: 0;
  display: grid;
  gap: 10px;
}

.model-setting-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.model-setting-label {
  margin: 0;
  font-size: 15px;
  line-height: 1.45;
  color: #6a4d28;
}

.model-setting-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(241, 220, 163, 0.58);
  color: #835d2c;
  font-size: 12px;
  line-height: 1;
  letter-spacing: 0.02em;
  box-shadow: inset 0 0 0 1px rgba(212, 177, 108, 0.22);
}

.model-setting-follow {
  margin: 0;
  font-size: 12px;
  line-height: 1.65;
}

.model-setting-inline-status {
  margin: -4px 0 0;
  min-height: 20px;
  font-size: 12px;
  line-height: 1.6;
  color: #8c6737;
}

.model-setting-inline-status.is-error {
  color: #9d4b38;
}

.model-setting-inline-status.is-success {
  color: #6f5b2d;
}

.model-setting-current {
  margin: -2px 0 0;
  color: #6d5029;
  font-size: 13px;
  line-height: 1.6;
  word-break: break-word;
}

.model-setting-trigger-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 249, 231, 0.88);
  color: #8a6230;
  font-size: 12px;
  line-height: 1;
  box-shadow: inset 0 0 0 1px rgba(222, 197, 146, 0.72);
}

.model-setting-status {
  padding: 9px 2px 0;
  border-radius: 0;
  background: transparent;
  border: none;
}

.model-setting-status .card-tip {
  margin: 0;
  line-height: 1.6;
}

.model-picker-overlay {
  position: fixed;
  inset: 0;
  z-index: 48;
}

.model-picker-backdrop {
  position: absolute;
  inset: 0;
  border: none;
  background: rgba(78, 59, 34, 0.2);
  backdrop-filter: blur(4px);
}

.model-picker-sheet {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: var(--model-picker-width);
  bottom: var(--model-picker-bottom-gap);
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: 12px;
  max-height: var(--model-picker-max-height);
  padding: 12px 12px 14px;
  border-radius: 30px;
  background: rgba(255, 252, 246, 0.98);
  box-shadow: 0 24px 40px rgba(91, 66, 33, 0.18);
}

.model-picker-handle {
  width: 46px;
  height: 5px;
  margin: 0 auto;
  border-radius: 999px;
  background: rgba(204, 180, 136, 0.74);
}

.model-picker-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.model-picker-heading {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.model-picker-search {
  margin-top: 0;
  min-height: 48px;
}

.model-picker-options {
  min-height: 0;
  display: grid;
  gap: 8px;
  padding-right: 2px;
  overflow-y: auto;
}

.model-option-button {
  width: 100%;
  display: grid;
  gap: 4px;
  padding: 12px 13px;
  border: 1px solid rgba(228, 206, 162, 0.72);
  border-radius: 18px;
  background: rgba(255, 251, 238, 0.9);
  color: var(--text);
  text-align: left;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.38);
  transition: border-color 180ms ease, transform 180ms ease, background-color 180ms ease, box-shadow 180ms ease;
}

.model-option-button:hover {
  transform: translateY(-1px);
  border-color: rgba(215, 173, 101, 0.84);
  background: rgba(255, 252, 242, 0.96);
  box-shadow: 0 8px 18px rgba(144, 108, 54, 0.08);
}

.model-option-button.is-active {
  border-color: rgba(211, 164, 80, 0.9);
  background: linear-gradient(180deg, rgba(255, 245, 214, 0.96), rgba(255, 239, 196, 0.94));
  box-shadow: 0 10px 22px rgba(149, 109, 49, 0.1);
}

.model-option-button.is-secondary {
  background: rgba(255, 248, 228, 0.84);
}

.model-option-button:disabled {
  opacity: 0.66;
}

.model-option-title {
  display: block;
  font-size: 13px;
  line-height: 1.5;
  color: #6b4d23;
  word-break: break-word;
}

.model-option-meta {
  display: block;
  font-size: 11px;
  line-height: 1.6;
  color: var(--text-soft);
}

.model-option-empty {
  margin: 0;
  padding: 10px 2px 2px;
}

.setting-toggle-row {
  align-items: center;
  padding: 10px 0;
}

.switch {
  position: relative;
  display: inline-flex;
  width: 52px;
  height: 30px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #ecd9a8;
  transition: 0.2s ease;
}

.switch-slider::before {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #fff9e5;
  box-shadow: 0 4px 10px rgba(90, 73, 59, 0.12);
  transition: 0.2s ease;
}

.switch input:checked + .switch-slider {
  background: #e9bd57;
}

.switch input:checked + .switch-slider::before {
  transform: translateX(22px);
}

.range-label {
  color: var(--text-soft);
}

.bottom-nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  width: var(--chat-bottom-width);
  bottom: 2px;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 7px;
  border: 1px solid rgba(225, 189, 123, 0.82);
  border-radius: 28px;
  background: rgba(255, 247, 201, 0.94);
  box-shadow: 0 -3px 18px rgba(143, 102, 43, 0.14);
  backdrop-filter: blur(12px);
  transition: box-shadow 180ms ease, transform 180ms ease, background-color 180ms ease;
  animation: tabBarIn 180ms ease-out;
}

.nav-item {
  border: none;
  border-radius: 20px;
  min-height: 64px;
  padding: 10px 6px 9px;
  background: transparent;
  color: #775b39;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: background-color 180ms ease, color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.nav-item.active {
  background: linear-gradient(180deg, rgba(248, 213, 114, 0.98), rgba(236, 186, 80, 0.96));
  color: #4b3418;
  box-shadow: inset 0 -1px 0 rgba(255, 240, 188, 0.92), 0 5px 12px rgba(146, 98, 33, 0.24);
}

.nav-icon {
  width: 19px;
  height: 19px;
  display: grid;
  place-items: center;
  opacity: 0.92;
}

.nav-icon svg {
  width: 19px;
  height: 19px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-label {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1;
}

@media (min-width: 900px) {
  :root {
    --chat-bottom-width: min(716px, calc(100vw - 44px));
  }

  .app-shell {
    max-width: 760px;
    padding: 22px 22px 82px;
  }

  .bottom-nav {
    width: var(--chat-bottom-width);
  }

  .chat-topbar {
    top: 10px;
  }

  .weather-grid,
  .entry-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .conversation-drawer {
    top: 86px;
    left: 22px;
    right: 22px;
    max-width: min(716px, calc(100vw - 44px));
  }

  .appearance-drawer {
    left: 22px;
    right: 22px;
    max-width: min(716px, calc(100vw - 44px));
  }
}

@media (max-width: 520px) {
  .conversation-drawer {
    width: calc(100vw - 28px);
    max-height: calc(100vh - 188px);
    border-radius: 28px;
  }

  .conversation-drawer-head,
  .conversation-drawer-actions {
    gap: 10px;
  }

  .conversation-drawer-title {
    font-size: 17px;
    line-height: 1.38;
  }

  .chat-topbar {
    gap: 8px;
    padding: 10px 11px;
  }

  .chat-topbar-row {
    grid-template-columns: 42px minmax(0, 1fr) 42px;
    gap: 10px;
  }

  .context-input-wrap {
    min-width: 104px;
  }

  .chat-heading h1 {
    font-size: 19px;
  }

  .chat-topbar-subtitle {
    max-width: none;
    font-size: 12px;
  }

  .appearance-drawer {
    max-height: calc(100vh - 188px);
    border-radius: 26px;
  }

  .chat-composer-wrap {
    width: var(--chat-bottom-width);
    bottom: var(--chat-composer-offset, 44px);
    padding-bottom: 0;
  }

}

@media (max-width: 680px) {
  .conversation-drawer-title {
    font-size: 16px;
  }

  .conversation-item-title {
    font-size: 13px;
  }

  .conversation-action,
  .chat-sidebar-current {
    font-size: 11px;
  }

  .chat-topbar {
    padding: 12px;
  }

  .composer-editor-head,
  .composer-editor-foot {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  :root {
    --shadow: 0 9px 20px rgba(119, 87, 41, 0.12);
    --chat-bottom-width: min(100vw - 16px, 532px);
    --model-picker-bottom-gap: 6px;
  }

  body {
    font-size: 13px;
  }

  .ambient-glow {
    width: 160px;
    height: 160px;
    filter: blur(40px);
  }

  .app-shell {
    max-width: 100%;
    padding: 6px 7px calc(58px + env(safe-area-inset-bottom, 0px));
  }

  body[data-active-view="chatView"] .app-shell {
    padding-top: 4px;
  }

  body[data-active-view="chatView"] .app-main {
    height: calc(100vh - 66px);
  }

  .top-homeplate {
    top: 6px;
    gap: 3px;
    margin-bottom: 8px;
    padding: 8px 10px;
    border-radius: 18px;
    box-shadow: 0 8px 18px rgba(138, 97, 39, 0.1);
  }

  .homeplate-title {
    font-size: clamp(18px, 5.4vw, 22px);
  }

  .homeplate-copy,
  .view-copy,
  .card-tip,
  .summary-copy,
  .welcome-copy {
    font-size: 12px;
    line-height: 1.5;
  }

  .view-intro {
    margin-bottom: 8px;
  }

  .card {
    border-radius: 19px;
  }

  .home-hero-card,
  .info-card,
  .editor-card,
  .setting-card,
  .mini-entry-card {
    padding: 10px;
  }

  .home-hero-card + .info-card,
  .setting-card + .setting-card,
  .editor-card + .editor-card,
  .info-card + .info-card {
    margin-top: 8px;
  }

  .hero-portrait-row {
    gap: 10px;
    margin-top: 6px;
  }

  .portrait {
    width: 40px;
    height: 40px;
    font-size: 17px;
    box-shadow: 0 6px 12px rgba(88, 70, 53, 0.1);
  }

  .hero-days {
    margin-top: 7px;
    font-size: 34px;
    line-height: 1.05;
  }

  .season-pill {
    min-width: 116px;
    margin-top: 8px;
    padding: 6px 10px;
    font-size: 11px;
  }

  .welcome-card {
    margin-top: 9px;
    padding: 10px;
    border-radius: 16px;
  }

  .home-action-row,
  .weather-grid,
  .entry-grid {
    gap: 7px;
  }

  .home-action-row {
    margin-top: 8px;
  }

  .primary-button,
  .secondary-button,
  .compact-button {
    padding: 8px 10px;
    border-radius: 13px;
    font-size: 12px;
  }

  .weather-grid {
    margin-top: 8px;
  }

  .weather-main {
    font-size: 18px;
  }

  .chat-page-shell,
  .chat-layout {
    min-height: calc(100vh - 66px);
  }

  .chat-page-shell::before {
    border-radius: 22px;
  }

  .chat-layout {
    gap: 0;
  }

  .chat-topbar {
    top: 4px;
    gap: 4px;
    padding: 6px 7px;
    border-radius: 18px 18px 13px 13px;
    box-shadow: 0 7px 16px rgba(118, 86, 45, 0.05);
  }

  .chat-topbar-row {
    grid-template-columns: 32px minmax(0, 1fr) 32px;
    gap: 6px;
  }

  .chat-heading {
    gap: 4px;
  }

  .chat-heading h1 {
    font-size: 16px;
    line-height: 1.18;
  }

  .chat-topbar-subtitle {
    font-size: 10.5px;
    line-height: 1.3;
  }

  .chat-topbar-action-button {
    width: 32px;
    height: 32px;
    border-radius: 12px;
  }

  .chat-topbar-icon,
  .chat-topbar-icon svg {
    width: 15px;
    height: 15px;
  }

  .chat-summary-indicator {
    gap: 5px;
    padding: 4px 7px;
  }

  .chat-summary-ring {
    width: 12px;
    height: 12px;
  }

  .chat-summary-label {
    font-size: 10.5px;
  }

  .chat-summary-sheet {
    bottom: calc(env(safe-area-inset-bottom, 0px) + 8px);
    width: min(calc(100vw - 16px), 720px);
    max-height: min(82vh, 680px);
    padding: 10px 12px 12px;
    border-radius: 20px;
    box-shadow: 0 14px 30px rgba(100, 70, 36, 0.16);
  }

  .chat-summary-sheet-handle {
    width: 38px;
    height: 4px;
    margin-bottom: 10px;
  }

  .daily-summary-display,
  .daily-summary-editor {
    margin-top: 9px;
    border-radius: 17px;
  }

  .daily-summary-display {
    min-height: 136px;
    padding: 12px;
  }

  .daily-summary-content,
  .daily-summary-empty {
    font-size: 13px;
    line-height: 1.68;
  }

  .daily-summary-editor {
    padding: 8px;
  }

  .daily-summary-editor textarea {
    min-height: 150px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.62;
  }

  .chat-status-line {
    margin-bottom: 5px;
    padding: 7px 9px;
    border-radius: 12px;
    font-size: 11.5px;
  }

  .chat-body {
    padding: 4px 6px 0;
    border-radius: 14px 14px 20px 20px;
  }

  .chat-messages {
    gap: 10px;
    padding-top: 0;
    border-radius: 18px;
  }

  .time-divider {
    margin-top: 3px;
    padding: 3px 7px;
    font-size: 10.5px;
  }

  .message-row {
    gap: 6px;
  }

  .avatar,
  .avatar-spacer {
    width: 28px;
    height: 28px;
  }

  .avatar {
    margin-top: 3px;
    font-size: 12px;
    box-shadow: 0 5px 10px rgba(109, 83, 50, 0.09);
  }

  .message-bubble {
    max-width: min(86%, 420px);
    padding: 8px 10px;
    border-radius: 16px;
    font-size: 13px;
    line-height: 1.6;
    box-shadow: 0 5px 11px rgba(96, 75, 56, 0.055);
  }

  .message-row.user .message-bubble-wrap {
    max-width: min(86%, 420px);
  }

  .message-row.segment-continuation {
    margin-top: -6px;
  }

  .message-inline-time,
  .message-edit-button {
    font-size: 10px;
  }

  .chat-composer-wrap {
    width: var(--chat-bottom-width);
    bottom: var(--chat-composer-offset, 38px);
  }

  .chat-input-shell {
    grid-template-columns: 30px minmax(0, 1fr) 64px;
    gap: 5px;
    min-height: 46px;
    padding: 4px;
    border-radius: 17px;
    box-shadow: 0 6px 14px rgba(133, 93, 39, 0.07);
  }

  .chat-input-shell .icon-button {
    width: 30px;
    height: 30px;
    min-width: 30px;
    min-height: 30px;
  }

  #messageInput {
    min-height: 38px;
    max-height: 116px;
    padding: 8px 9px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.4;
  }

  .chat-input-shell .send-button {
    min-height: 36px;
    padding: 0 8px;
    border-radius: 14px;
    font-size: 13px;
  }

  .bottom-nav {
    bottom: calc(env(safe-area-inset-bottom, 0px) + 3px);
    gap: 4px;
    padding: 4px;
    border-radius: 19px;
    box-shadow: 0 -2px 12px rgba(143, 102, 43, 0.11);
  }

  .nav-item {
    min-height: 44px;
    padding: 5px 3px;
    border-radius: 14px;
    gap: 3px;
  }

  .nav-icon,
  .nav-icon svg {
    width: 15px;
    height: 15px;
  }

  .nav-label {
    font-size: 10.5px;
  }
}
