:root {
  --bg: #f7f3ef;
  --panel: #ffffff;
  --muted: #c4bdb5;
  --primary: #b67c62;
  --radius-lg: 36px;
  --radius-md: 20px;
  --radius-sm: 14px;
  --shadow: 0 12px 25px rgba(0, 0, 0, 0.08);
  font-family: "Segoe UI", "PingFang SC", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: #2f2a26;
}

body.chat-page {
  overflow: hidden;
}

.phone-shell {
  max-width: 500px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

body:not(.chat-page) .phone-shell {
  min-height: 100vh;
}

body.chat-page .phone-shell {
  padding: 0;
  gap: 0;
  height: 100%;
  min-height: 0;
}

.card {
  background: var(--panel);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow);
}

.api-settings-card h3 {
  margin-top: 16px;
  font-size: 16px;
}

.api-settings-card .preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-end;
  margin-bottom: 12px;
}

.api-settings-card .preset-row label {
  flex-basis: 100%;
  font-size: 14px;
  color: #5c493b;
}

.api-settings-card .preset-row select {
  flex: 1;
  min-width: 160px;
}

.data-management-card h3 {
  margin: 12px 0 4px;
  font-size: 16px;
}

.data-management-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.backup-options {
  border: 1px dashed #d9cfc6;
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.backup-options h4 {
  margin: 0;
  font-size: 15px;
  color: #5c493b;
}

.backup-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  font-size: 14px;
  color: #5c493b;
}

.backup-checkboxes label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.restore-scope {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.scope-select select {
  margin-top: 4px;
}

#backupStatus {
  min-height: 20px;
}

.danger-zone {
  border-top: 1px solid #f0d4c8;
  padding-top: 12px;
}

.ghost.danger {
  color: #b44040;
  border-color: rgba(180, 64, 64, 0.4);
}

.rounded-icon {
  border-radius: var(--radius-md);
  background: #fff;
  padding: 12px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #6f655c;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow);
  cursor: pointer;
}

.rounded-icon img {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  object-fit: cover;
}

.home-hero {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 16px;
}

.home-avatar {
  border-radius: 28px;
  background: #fff;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  cursor: pointer;
}

.home-avatar img {
  width: 100%;
  border-radius: 24px;
  object-fit: cover;
}

.home-shortcuts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.wallpaper-card {
  border-radius: 32px;
  height: 180px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.wallpaper-card img,
.wallpaper-card .wallpaper-fallback {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.wallpaper-fallback {
  background: linear-gradient(135deg, #1e1e2f, #080810);
}

.app-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.app-icon {
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.9);
  padding: 12px;
  text-align: center;
  color: #6f6258;
  font-size: 13px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4), var(--shadow);
  cursor: pointer;
}

.app-icon span {
  display: block;
  margin-top: 6px;
}

.placeholder-pane {
  text-align: center;
  padding: 40px 20px;
  border-radius: var(--radius-md);
  border: 1px dashed #d6cfc6;
  color: #9a8f85;
}

.entry-row {
  border: 1px solid #e8dfd7;
  border-radius: var(--radius-md);
  padding: 10px;
  margin-bottom: 10px;
  background: #fdf9f5;
}

.entry-row .row-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  color: #8a7c72;
}

.chat-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
  flex: 1;
  min-height: 0;
}

body.chat-page .chat-section {
  padding: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  flex: 1;
  gap: 0;
  overflow: hidden;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding-right: 8px;
  padding-bottom: 8px;
  min-height: 0;
}

body.chat-page .chat-messages {
  padding: 20px 18px 14px;
  scroll-padding-bottom: 54px;
}

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

.chat-input {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

body.chat-page .chat-input {
  padding: 12px 16px 18px;
  border-top: 1px solid #e7dacf;
  background: #f4ede6;
  flex-shrink: 0;
  box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.08);
}

.chat-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.chat-toolbar-btn {
  flex: 1;
  min-width: 46px;
  height: 46px;
  border-radius: 16px;
  background: #f7f1eb;
  border: 1px solid rgba(0, 0, 0, 0.05);
  cursor: pointer;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #8d7a6d;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6);
}

.chat-toolbar-btn:active {
  transform: translateY(1px);
}

.chat-toolbar-btn:hover {
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.12);
}

.chat-input-wrapper {
  display: flex;
  align-items: center;
  border: 1px solid #e0d7cf;
  border-radius: 999px;
  padding: 4px 8px 4px 16px;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4);
}

.chat-input textarea {
  resize: none;
  border: none;
  background: transparent;
  height: 44px;
  padding: 0;
  margin: 0;
  flex: 1;
  line-height: 44px;
  overflow-y: hidden;
  overflow-x: auto;
  white-space: nowrap;
}

.chat-input textarea:focus {
  outline: none;
}

.chat-input-actions {
  display: flex;
  gap: 6px;
  padding-left: 12px;
}

.chat-input-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #f3e7dc;
  border: 1px solid rgba(0, 0, 0, 0.03);
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, background 0.15s ease;
}

.chat-input-icon:active {
  transform: scale(0.95);
  background: #e6d5c6;
}

.meeting-mode .chat-toolbar,
.meeting-mode #summaryBtn,
.meeting-mode #stickerBtn,
.meeting-mode #voiceBtn,
.meeting-mode #transferBtn,
.meeting-mode #refreshBtn,
.meeting-mode #quotePreview {
  display: none !important;
}

.meeting-mode .chat-input-actions {
  justify-content: flex-end;
  gap: 12px;
  padding-left: 0;
}

.meeting-mode .chat-avatar {
  display: none;
}

.meeting-mode .chat-content {
  margin-left: 0;
}

.meeting-mode .chat-meta {
    font-size: 12px;
    color: #8a8a8a;
    margin-bottom: 4px;
    text-align: center;
  }
  
.meeting-mode .meeting-item .bubble {
    margin-top: 0;
  }

/* 线下面会模式下统一居中显示消息气泡并保留文本换行 */
.meeting-mode .chat-bubbles {
  align-items: center;
}

.meeting-mode .chat-item {
  justify-content: center;
}

.meeting-mode .chat-content {
  align-items: center;
  max-width: 100%;
}

.meeting-mode .chat-content .bubble,
.meeting-mode .chat-item.user .chat-content .bubble {
  align-self: center;
  white-space: pre-line;
}


.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-sm);
  font-size: 20px;
  line-height: 1;
}

.sticker-panel {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.sticker-panel button {
  border-radius: 16px;
  border: none;
  padding: 8px 12px;
  background: #fff7d9;
  cursor: pointer;
}

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

button {
  border: none;
  background: var(--primary);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

button.ghost {
  background: #eee4dd;
  color: #7a5a4b;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #e0d7cf;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: #fff;
  margin-bottom: 12px;
}

label {
  font-size: 14px;
  margin-bottom: 4px;
  display: block;
  color: #6d5c51;
}

.nav-bar {
  display: flex;
  justify-content: space-around;
  padding: 12px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
  position: sticky;
  bottom: 12px;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: #7a6b61;
  font-size: 12px;
}

.nav-item.active {
  color: var(--primary);
}

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

.list-item {
  padding: 12px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  gap: 12px;
}

.list-item.active {
  border: 2px solid var(--primary);
  background: rgba(182, 124, 98, 0.08);
}

.avatar {
  width: 56px;
  height: 56px;
  border-radius: 20px;
  background: #f0e7df;
  object-fit: cover;
}

.section-title {
  font-size: 16px;
  font-weight: 600;
  margin: 8px 0;
}

.split {
  display: flex;
  gap: 16px;
}

.split > * {
  flex: 1;
}

.preset-management-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.preset-management-modal {
  background: var(--panel);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.preset-management-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.preset-management-header h1 {
  font-size: 20px;
  margin: 0;
}

.summary-management-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 12px 0;
}

.summary-management-header h1 {
  font-size: 20px;
  margin: 0;
}

.summary-management-shell {
  flex: 1;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 12px;
}

.summary-management-modal {
  flex: 1;
  max-width: 720px;
  background: #fff7f0;
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.summary-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.summary-panels {
  min-height: 360px;
}

.summary-management-shell .summary-panel {
  display: none;
  flex-direction: column;
  gap: 16px;
}

.summary-management-shell .summary-panel.active {
  display: flex;
}

.summary-panel.active {
  display: flex;
}

.summary-filter-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.summary-field-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.summary-actions-row {
  display: flex;
  gap: 8px;
  justify-content: flex-start;
  flex-wrap: wrap;
  margin-top: 4px;
}

.summary-text-wrapper {
  position: relative;
  margin-top: 8px;
}

.summary-text-wrapper textarea {
  width: 100%;
  min-height: 220px;
  resize: vertical;
}

.summary-management-shell .pill-button {
  padding: 8px 14px;
  font-size: 14px;
}

.back-link {
  text-decoration: none;
  color: var(--primary);
  font-weight: 600;
}

.management-tabs,
.preset-subtabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tab-button,
.subtab-button {
  flex: 1;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px;
  background: #f0e7df;
  color: #5c493b;
  font-weight: 600;
  cursor: pointer;
}

.tab-button.active,
.subtab-button.active {
  background: var(--primary);
  color: #fff;
}

.management-panels {
  min-height: 400px;
}

.management-panel {
  display: none;
  flex-direction: column;
  gap: 16px;
}

.management-panel.active {
  display: flex;
}

.panel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

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

.panel-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 12px 0;
}

.avatar-field {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 12px 0;
}

.management-panel label {
  font-weight: 600;
  display: block;
  margin-top: 12px;
}

.management-panel input,
.management-panel textarea,
.management-panel select {
  width: 100%;
  padding: 8px;
  border-radius: var(--radius-sm);
  border: 1px solid #ddd;
  font-size: 14px;
}

.preset-panels .preset-panel {
  display: none;
  flex-direction: column;
  gap: 16px;
}

.preset-panels .preset-panel.active {
  display: flex;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  display: inline-flex;
  align-items: center;
  border: none;
  border-radius: var(--radius-sm);
  background: rgba(182, 124, 98, 0.15);
  color: #5c493b;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
}

.tag:not(button) {
  cursor: default;
}

.hidden {
  display: none !important;
}

.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;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.modal {
  background: #fff;
  border-radius: var(--radius-md);
  padding: 20px;
  width: min(90vw, 380px);
  box-shadow: var(--shadow);
}

.summary-modal,
.preset-modal,
.edit-message-modal,
.character-editor-modal {
  width: min(95vw, 640px);
  max-height: 90vh;
  overflow-y: auto;
}

.prompt-config-modal {
  width: min(95vw, 720px);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.prompt-config-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.prompt-config-header-main {
  flex: 1 1 auto;
  min-width: 0;
}

.prompt-config-header-main h3 {
  margin: 0;
}

.prompt-config-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  flex-shrink: 0;
}

.prompt-config-header-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  flex: 0 0 auto;
}

.prompt-config-subtitle {
  margin: 8px 0 0;
  color: #7a6c5f;
  font-size: 13px;
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
}

.prompt-config-scope {
  margin-top: 4px;
  font-size: 12px;
  color: #7a6c5f;
}

.prompt-config-toolbar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #faf7f4;
  border-radius: var(--radius-md);
  padding: 12px;
}

.prompt-add-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.prompt-add-header select {
  flex: 1;
  min-width: 200px;
}

.prompt-config-add {
  flex: 1;
  min-width: 220px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.prompt-config-add-row {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  align-items: center;
}

.prompt-config-add-row select {
  flex: 1;
  min-width: 0;
}

.prompt-config-add-row button {
  flex: 0 0 auto;
  padding-inline: 16px;
  white-space: nowrap;
}

.prompt-custom-form {
  background: #fff;
  border-radius: var(--radius-md);
  padding: 12px;
  box-shadow: var(--shadow-small);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.prompt-custom-form textarea {
  min-height: 80px;
}

.prompt-config-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.prompt-accordion {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
  }
  
  .prompt-section {
    border: 1px solid #e5ddd5;
    border-radius: var(--radius-md);
    background: #fff;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
  }

.prompt-section--dragging {
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.18);
  transform: translateY(var(--prompt-section-drag-offset-y, 0)) scale(1.02);
  z-index: 2;
}

.prompt-section-full {
    border-color: #d0e2ff;
    background: #f5f8ff;
  }
  
  .prompt-section.disabled {
    opacity: 0.6;
  }

.prompt-section-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  margin-right: 8px;
  font-size: 14px;
  color: #b0a397;
  cursor: grab;
  /* Prevent the browser from treating touch gestures on the handle as scroll. */
  touch-action: none;
}

.prompt-section--dragging .prompt-section-handle {
  cursor: grabbing;
}

.prompt-section-header {
  width: 100%;
  border: none;
  background: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  cursor: pointer;
  font-size: 15px;
  color: #5c493b;
  font-weight: 600;
}

.prompt-section-title {
  color: inherit;
}

.prompt-section-caret {
  font-size: 12px;
  color: #9a8c80;
}

.prompt-section-body {
  display: none;
  flex-direction: column;
  gap: 12px;
  padding: 0 16px 16px;
}

.prompt-section.open .prompt-section-body {
  display: flex;
}

.prompt-section label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: #5c493b;
}

.prompt-section textarea {
  min-height: 80px;
}

/* 让 controls 横向排布 */
.prompt-section-controls {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;      /* 不轻易换行 */
}

/* 标签：勾选框 + 文本在一行 */
.prompt-section label.prompt-section-toggle {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  margin: 0;
}

.prompt-section label.prompt-section-toggle input {
  margin: 4px;
}


.prompt-section-hint {
  font-size: 12px;
  color: #9a8c80;
  margin: 0;
}

.prompt-config-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.prompt-config-status {
  font-size: 13px;
  color: #7a6c5f;
}

.prompt-config-status[data-state="warning"] {
  color: #c45b3d;
}

.prompt-config-buttons {
  display: flex;
  gap: 8px;
}

.summary-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 420px;
  max-height: 80vh;
}

.summary-panel.hidden {
  display: none !important;
}

.summary-panel-header {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
}

.summary-panel-header h3 {
  flex: 1;
  text-align: center;
  font-size: 18px;
  margin: 0;
}

.summary-panel-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
}

.summary-view-block,
.summary-edit-block {
  flex: 1;
  border: 1px solid #e5ddd5;
  border-radius: var(--radius-md);
  padding: 16px;
  background: #faf7f4;
  overflow-y: auto;
}

.summary-edit-block {
  display: flex;
  flex-direction: column;
  background: transparent;
  border: none;
  padding: 0;
  gap: 12px;
}

.summary-panel:not(.editing) .summary-edit-block {
  display: none;
}

.summary-panel.editing .summary-view-block {
  display: none;
}

.summary-panel.editing .summary-edit-toggle {
  visibility: hidden;
}

.summary-edit-block textarea {
  flex: 1;
  min-height: 280px;
  resize: vertical;
  margin-bottom: 0;
}

.summary-panel-subtitle {
  margin: 0;
  color: #8a7668;
}

.summary-menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.summary-menu-btn {
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid #e5ddd5;
  background: #fff7f0;
  color: #5b4336;
  font-size: 16px;
  font-weight: 600;
  min-height: 84px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.4;
}

.summary-menu-btn:hover {
  background: #ffe8d7;
}

.summary-close-btn {
  margin-top: 8px;
}

.summary-text-block {
  white-space: pre-wrap;
  font-family: var(
    --font-body,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "PingFang SC",
    "Microsoft Yahei",
    sans-serif
  );
  font-size: 14px;
  line-height: 1.6;
  color: #3a2c25;
}

.summary-text-block p {
  margin: 0 0 10px;
}

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

.summary-card {
  background: #fff;
  border-radius: var(--radius-md);
  border: 1px solid #eaded4;
  padding: 12px 14px;
}

.summary-card-title {
  font-size: 15px;
  font-weight: 600;
  color: #5b4336;
  margin-bottom: 6px;
}

.summary-card ul {
  margin: 0;
  padding-left: 18px;
}

.summary-card li {
  line-height: 1.5;
  color: #3c2a1f;
}

.summary-card p {
  margin: 0;
  color: #3c2a1f;
  line-height: 1.6;
}

.summary-empty {
  color: #a08d81;
  text-align: center;
  font-size: 14px;
}

.summary-working-overlay {
  position: fixed;
  inset: 0;
  background: rgba(30, 24, 19, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.summary-working-box {
  background: rgba(255, 255, 255, 0.95);
  border-radius: var(--radius-lg);
  padding: 28px 40px;
  text-align: center;
  min-width: 240px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
  color: #3a2c25;
}

.summary-spinner {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 4px solid #f0d9c7;
  border-top-color: var(--primary);
  margin: 0 auto;
  animation: summary-spin 1s linear infinite;
}

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

.chat-bubbles {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 80px;
}

.chat-item {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  width: 100%;
}

.chat-item.user {
  flex-direction: row-reverse;
}

.chat-avatar {
  width: 48px;
  height: 48px;
  border-radius: 18px;
  object-fit: cover;
  background: #fff4ea;
  border: 2px solid #fff;
  box-shadow: var(--shadow);
}

.chat-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 0 1 auto;
  max-width: calc(100% - 72px);
}

.chat-item.user .chat-content {
  align-items: flex-end;
}

.chat-meta {
  font-size: 12px;
  color: #b19f92;
  margin-top: 2px;
}

.chat-content .bubble {
  align-self: flex-start;
}

.chat-item.user .chat-content .bubble {
  align-self: flex-end;
}

.bubble {
  max-width: min(80vw, 360px);
  padding: 12px 16px;
  border-radius: 20px;
  background: #fef8ef;
  box-shadow: 0 8px 20px rgba(223, 198, 171, 0.45);
  position: relative;
  font-size: 15px;
  color: #4c3d34;
  word-break: break-word;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
}

.chat-item.user .bubble {
  background: #f0f5ff;
  box-shadow: 0 8px 20px rgba(154, 172, 208, 0.4);
}

.chat-item.user .bubble.transfer {
  background: linear-gradient(145deg, #ffb347, #ff7a00);
  box-shadow: 0 16px 30px rgba(255, 140, 76, 0.35);
}

.bubble.sticker {
  background: #fff2d5;
  font-weight: 600;
}

.bubble.voice {
  background: linear-gradient(120deg, #e9f1ff, #f9fbff);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.bubble.voice.expanded {
  transform: translateY(-2px);
}

.voice-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: #35507a;
}

.voice-wave {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, #83b1ff, #4f7edc);
  opacity: 0.7;
}

.voice-transcript {
  display: none;
  font-size: 12px;
  line-height: 1.4;
  color: #4d4d4d;
  margin-top: 6px;
}

.bubble.voice.expanded .voice-transcript {
  display: block;
}

.bubble.transfer {
  background: linear-gradient(145deg, #ffb347, #ff7a00);
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 16px 30px rgba(255, 140, 76, 0.35);
  word-break: break-word;
  width: 240px;
  max-width: 240px;
}

.transfer-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.4);
}

.transfer-amount {
  font-size: 26px;
  font-weight: 700;
}

.transfer-note,
.transfer-target,
.transfer-source {
  font-size: 13px;
  opacity: 0.92;
  word-break: break-word;
}

.quote-block {
  border-left: 3px solid rgba(255, 166, 101, 0.8);
  padding-left: 12px;
  margin-bottom: 8px;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.4);
  padding-bottom: 8px;
  width: 100%;
}

.quote-speaker {
  font-size: 13px;
  font-weight: 600;
  color: #4a372b;
  margin-bottom: 4px;
}

.quote-divider {
  width: 100%;
  border-bottom: 1px dashed rgba(0, 0, 0, 0.08);
  margin: 4px 0 8px;
}

.quote-reply {
  font-size: 15px;
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 12px;
}

.chat-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.pill-button {
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  background: #efe9e4;
  color: #6a5a51;
}

.chat-tabs {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.9);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  box-shadow: var(--shadow);
}

.chat-tab {
  font-size: 16px;
  color: #a39a92;
}

.chat-tab.active {
  color: #4a3d34;
  font-weight: 600;
}

.chat-list-card {
  flex: 1;
}

.chat-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-list-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #fefaf3;
  border-radius: 24px;
  padding: 14px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6), var(--shadow);
  cursor: pointer;
}

.chat-list-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 14px;
  color: #8f8176;
}

.chat-list-meta strong {
  font-size: 16px;
  color: #3c2f29;
}

.chat-detail-header {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.9);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  box-shadow: var(--shadow);
}

body.chat-page .chat-detail-header {
  border-radius: 0;
  box-shadow: none;
  background: #f4ede6;
  border-bottom: 1px solid #e7dacf;
  padding: 12px 20px;
  position: sticky;
  top: 0;
  z-index: 5;
}

.back-button {
  min-width: 64px;
}

.chat-detail-title {
  flex: 1;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chat-detail-title strong {
  font-size: 18px;
}

.chat-detail-title small {
  color: #9d8e83;
  font-size: 13px;
}

.chat-detail-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

button.icon {
  width: 44px;
  padding: 8px;
}

/* ==== 聊天页面布局修复：适配移动浏览器 ==== */

body.chat-page {
  margin: 0;
  padding: 0;
  height: 100dvh; /* 使用动态视口高度，排除浏览器工具栏 */
  display: flex;
  flex-direction: column;
  background: var(--bg);
  overflow: hidden;
}

.chat-page .phone-shell {
  width: 100%;
  max-width: 430px;
  height: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* 头部固定高度 */
.chat-detail-header {
  flex: 0 0 auto;
  flex-shrink: 0;
}

/* 聊天区域占据剩余空间 */
.chat-section {
  flex: 1;
  min-height: 0; /* 关键：允许 flex 子元素缩小 */
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* 消息列表可滚动 */
.chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 16px 8px;
  -webkit-overflow-scrolling: touch; /* iOS 平滑滚动 */
}

/* "暂无消息"提示 */
.chat-messages .placeholder-pane {
  margin-top: 12px;
}

/* 输入区域固定在底部 */
.chat-input {
  flex: 0 0 auto;
  flex-shrink: 0;
  padding: 8px 12px;
  padding-bottom: max(10px, env(safe-area-inset-bottom)); /* iOS 安全区 */
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  background: rgba(255, 255, 255, 0.96);
}

/* 工具栏按钮适当缩小 */
.chat-toolbar-btn {
  flex: 1;
  min-width: 42px;
  height: 42px;
  border-radius: 14px;
  background: #f7f1eb;
  border: 1px solid rgba(0, 0, 0, 0.05);
  cursor: pointer;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #8d7a6d;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6);
}

/* 输入框自适应高度优化 */
.chat-input textarea {
  resize: none;
  border: none;
  background: transparent;
  min-height: 40px;
  height: 40px;
  max-height: 100px;
  padding: 10px 0;
  margin: 0;
  flex: 1;
  line-height: 1.4;
  overflow-y: auto;
  overflow-x: hidden;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.quote-preview {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.quote-preview-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.quote-preview-text strong {
  font-size: 13px;
  color: #8c6b54;
}

.quote-preview-text p {
  margin: 0;
  font-size: 13px;
  color: #3b2f27;
}

.quote-preview .small {
  padding: 6px 10px;
  border-radius: 12px;
  font-size: 12px;
}

.message-menu-backdrop {
  position: fixed;
  inset: 0;
  background: transparent;
  z-index: 15;
}

.message-context-menu {
  position: fixed;
  z-index: 16;
  background: #fff7ee;
  border-radius: 12px;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 130px;
}

.message-context-menu button {
  background: none;
  border: none;
  padding: 8px 12px;
  text-align: left;
  font-size: 14px;
  border-radius: 10px;
  color: #5c4638;
}

.message-context-menu button:hover {
  background: rgba(0, 0, 0, 0.05);
}

.chat-item.selected-for-delete .bubble {
  box-shadow: 0 0 0 2px rgba(250, 134, 76, 0.6);
}

.bulk-delete-bar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: max(10px, env(safe-area-inset-bottom));
  width: min(420px, calc(100% - 24px));
  background: rgba(44, 24, 11, 0.92);
  color: #fff;
  border-radius: 20px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.25);
  z-index: 18;
}

.bulk-delete-actions {
  display: flex;
  gap: 8px;
}

.bulk-delete-bar button {
  border-radius: 16px;
  padding: 8px 16px;
}

.bulk-delete-bar .ghost {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

/* ==== 视奸手机锁屏样式 ==== */

.spy-phone-page .phone-shell {
  padding-top: 8px;
  padding-bottom: 16px;
  min-height: 100vh;
  height: 100vh;
  gap: 16px;
}

.spy-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.12);
  color: #4b4139;
  font-size: 14px;
}

.spy-status-time {
  text-decoration: none;
  color: inherit;
}

.spy-status-title {
  flex: 1;
  text-align: center;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.spy-status-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.spy-status-icon {
  font-size: 12px;
}

.spy-lock-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
}

.spy-lock-info {
  text-align: center;
  margin-bottom: 8px;
}

.spy-lock-time {
  font-size: 40px;
  font-weight: 600;
  line-height: 1.1;
}

.spy-lock-date {
  font-size: 14px;
  color: #7f7064;
  margin-top: 4px;
}

.spy-lock-weather {
  font-size: 13px;
  color: #a08c7d;
  margin-top: 4px;
}

.spy-hero-image {
  border-radius: 24px;
  overflow: hidden;
  height: 140px;
  box-shadow: var(--shadow);
}

.spy-hero-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.spy-main-row {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

.spy-square-image {
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.spy-square-image img {
  width: 100%;
  height: 100%;
  min-height: 120px;
  object-fit: cover;
  display: block;
}

.spy-app-grid-top {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.spy-app-icon {
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.95);
  padding: 10px;
  text-align: center;
  font-size: 18px;
  color: #6f6258;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5), var(--shadow);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  aspect-ratio: 1 / 1;
  width: min(72px, 22vw);
}

.spy-app-icon span {
  font-size: 12px;
}

.spy-divider {
  height: 1px;
  background: #e2d5cb;
  margin: 16px 0 4px;
}

.spy-app-dock {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

/* ==== 视奸浏览器记录页面样式 ==== */

.spy-browser-page .phone-shell {
  padding-top: 8px;
  padding-bottom: 16px;
  min-height: 100vh;
  height: 100vh;
  gap: 16px;
}

.spy-browser-header {
  margin-bottom: 8px;
}

.spy-browser-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.browser-card-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.browser-card {
  position: relative;
  perspective: 1000px;
}

.browser-card-inner {
  position: relative;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  transform-style: preserve-3d;
  transition: transform 0.3s ease;
  min-height: 80px;
}

.browser-card-face {
  position: absolute;
  inset: 0;
  padding: 14px 16px;
  backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.browser-card-front {
  background: rgba(255, 255, 255, 0.98);
}

.browser-card-back {
  background: #f5ebe0;
  transform: rotateY(180deg);
}

.browser-card.flipped .browser-card-inner {
  transform: rotateY(180deg);
}

.browser-card-title {
  font-size: 15px;
  font-weight: 600;
  color: #4a3728;
}

.browser-card-content {
  font-size: 13px;
  color: #3c2a1f;
  line-height: 1.6;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.browser-card-meta {
  margin-top: auto;
  font-size: 12px;
  color: #a08d81;
  text-align: right;
}
