﻿body {
  margin: 0;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  background-color: #f3f4f6;
  color: #111827;
}

.app-shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 20px;
  box-sizing: border-box;
}

.history-panel,
.chat-container {
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}

.history-panel {
  padding: 18px;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 48px);
  height: calc(100vh - 48px);
  max-height: calc(100vh - 48px);
  box-sizing: border-box;
  overflow: hidden;
}


.history-panel-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 14px;
  flex-shrink: 0;
}


.history-panel-header h2 {
  margin: 0;
  font-size: 22px;
}

.history-panel-header p {
  margin: 6px 0 0;
  color: #6b7280;
  font-size: 13px;
}

.history-panel-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-list {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  overflow-y: auto;
  padding-right: 6px;
  padding-bottom: 2px;
}


.history-empty {
  padding: 14px;
  border: 1px dashed #d1d5db;
  border-radius: 12px;
  color: #6b7280;
  font-size: 14px;
  background-color: #f9fafb;
}

.history-item {
  position: relative;
  width: 100%;
  border: 1px solid #e5e7eb;
  background-color: #f8fafc;
  border-radius: 12px;
  padding: 10px 12px;
  transition: 0.2s ease;
  box-sizing: border-box;
  overflow: hidden;
}


.history-item:hover {
  border-color: #a5b4fc;
  background-color: #eef2ff;
}

.history-item.active {
  border-color: #4338ca;
  background: linear-gradient(180deg, #eef2ff 0%, #e0e7ff 100%);
  box-shadow: 0 10px 24px rgba(79, 70, 229, 0.12), inset 0 0 0 1px rgba(79, 70, 229, 0.16);
}

.history-item.active::before {
  content: "";
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 0;
  width: 4px;
  border-radius: 999px;
  background: #4f46e5;
}


.history-item-header {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.history-item-title-button {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  border: none;
  background: transparent;
  padding: 0;
  text-align: left;
  cursor: pointer;
  color: inherit;
}

.history-item-title-button:disabled {
  cursor: not-allowed;
}

.history-item-main {
  width: 100%;
  display: grid;
  gap: 4px;
  min-width: 0;
  border: none;
  background: transparent;
  padding: 4px 0 0;
  text-align: left;
  cursor: pointer;
  color: inherit;
}


.history-item-main:disabled {
  cursor: not-allowed;
}

.history-item-title {
  min-width: 0;
  font-size: 14px;
  font-weight: 700;
  color: #111827;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}



.history-item.active .history-item-title {
  color: #312e81;
}

.history-item-preview {
  font-size: 12px;
  color: #4b5563;
  line-height: 1.45;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}


.history-item.active .history-item-preview,
.history-item.active .history-item-time {
  color: #4338ca;
}


.history-item-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}


.history-item-time {
  flex-shrink: 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  color: #6b7280;
}


.history-item-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  justify-content: flex-end;
}


.history-action-btn {
  border: 1px solid #d1d5db;
  background-color: #ffffff;
  color: #374151;
  border-radius: 999px;
  padding: 3px 6px;
  font-size: 10px;
  line-height: 1.2;
  cursor: pointer;
}



.history-action-btn:hover {
  border-color: #6366f1;
  color: #4338ca;
}

.history-delete-btn:hover {
  border-color: #ef4444;
  color: #b91c1c;
}

.chat-container {
  padding: 24px;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.top-bar-actions {
  display: flex;
  align-items: center;
}

h1 {
  text-align: left;
  color: #333;
  margin: 0;
}

.settings-toggle-btn {
  min-width: 72px;
  padding: 10px 14px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  background-color: #ffffff;
  color: #111827;
  font-size: 14px;
  cursor: pointer;
}

.settings-toggle-btn:hover {
  background-color: #f3f4f6;
  border-color: #9ca3af;
}

.settings-panel {
  margin-bottom: 16px;
}

.settings-card {
  margin-bottom: 0;
}

.profile-card {

  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background-color: #f8fafc;
}

.profile-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.profile-header h2 {
  margin: 0;
  font-size: 18px;
  color: #1f2937;
}

.profile-status {
  font-size: 13px;
  color: #6b7280;
}

.profile-fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.settings-select-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settings-select-label {
  font-size: 13px;
  color: #4b5563;
}

.settings-help-text {
  font-size: 12px;
  line-height: 1.6;
  color: #6b7280;
}

.settings-help-text.error {
  color: #b91c1c;
}

.profile-fields input,
.profile-fields select,
.profile-fields textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 14px;
  font-size: 15px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  outline: none;
}

.profile-fields select,
.profile-fields textarea {
  background-color: #ffffff;
  color: #111827;
}

.profile-fields textarea {
  min-height: 120px;
  resize: vertical;
}

.profile-fields input:focus,
.profile-fields select:focus,
.profile-fields textarea:focus,
#user-input:focus {
  border-color: #4f46e5;
}


.profile-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.secondary-btn {
  border: none;
  border-radius: 10px;
  background-color: #111827;
  color: white;
  cursor: pointer;
  font-size: 14px;
  padding: 12px 16px;
}

#save-profile-btn {
  height: 40px;
  padding: 0 20px;
  font-size: 14px;
  border-radius: 8px;
  background: linear-gradient(135deg, #a78bfa, #ec4899);
  color: white;
  border: none;
  cursor: pointer;
  white-space: nowrap;
}

.secondary-outline-btn {
  background-color: #ffffff;
  color: #111827;
  border: 1px solid #d1d5db;
}

.profile-actions .secondary-btn {
  width: auto;
}

.secondary-btn:hover {
  background-color: #1f2937;
}

.secondary-outline-btn:hover {
  background-color: #f3f4f6;
}

.danger-btn {
  background-color: #dc2626;
}

.danger-btn:hover {
  background-color: #b91c1c;
}

.chat-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 14px;
  padding: 14px 16px;
  background-color: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
}

.chat-header-label {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 4px;
}

.current-chat-title {
  font-size: 18px;
  font-weight: 700;
  color: #111827;
}

.chat-header-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.chat-header-tip {
  font-size: 13px;
  color: #4f46e5;
  text-align: right;
}


.chat-box {
  height: 460px;
  overflow-y: auto;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 16px;
  background-color: #fafafa;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.message-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}


.attachment-panel {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  margin-top: 14px;
}

.attachment-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 999px;
  background-color: #ffffff;
  color: #374151;
  font-size: 13px;
  cursor: pointer;
  transition: 0.2s ease;
}

.attachment-toggle-btn:hover {
  border-color: #a5b4fc;
  background-color: #f8fafc;
  color: #111827;
}

.attachment-toggle-btn.has-attachments {
  border-color: #a5b4fc;
  background-color: #eef2ff;
  color: #4338ca;
}

.attachment-toggle-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background-color: rgba(79, 70, 229, 0.12);
  font-size: 14px;
  line-height: 1;
}

.attachment-panel-body {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background-color: #f8fafc;
}

.attachment-panel-toolbar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}


.upload-dropzone {
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  padding: 14px 16px;
  border: 1px dashed #c7d2fe;
  border-radius: 12px;
  background-color: #f9fafb;
  cursor: pointer;
  transition: 0.2s ease;
}

.upload-dropzone-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-left: auto;
}

.upload-dropzone-actions .secondary-btn {
  min-width: 128px;
}


.upload-dropzone:hover,
.upload-dropzone:focus {
  border-color: #818cf8;
  background-color: #eef2ff;
  outline: none;
}

.upload-dropzone.drag-active {
  border-color: #4338ca;
  background-color: #ddd6fe;
}

.upload-dropzone.disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.upload-dropzone-title {
  font-size: 14px;
  font-weight: 700;
  color: #1f2937;
}

.upload-dropzone-subtitle {
  margin-top: 4px;
  font-size: 12px;
  color: #6b7280;
  line-height: 1.6;
}

.voice-input-btn {
  position: relative;
  flex: 0 0 auto;
  min-width: 116px;
  height: 46px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 18px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.voice-input-btn:hover {
  transform: translateY(-1px);
}

.voice-input-btn:disabled {
  transform: none;
}


.voice-input-btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background-color: rgba(255, 255, 255, 0.82);
  color: #e45aa3;
  font-size: 10px;
  line-height: 1;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92), 0 6px 12px rgba(217, 166, 221, 0.2);
}


.voice-input-btn[aria-pressed="true"] {
  border-color: #f4a6d6;
  background-color: #fff1f6;
  color: #be185d;
}

.voice-input-btn[aria-pressed="true"] .voice-input-btn-icon {
  background-color: rgba(255, 255, 255, 0.94);
  color: #ff4f9f;
  animation: voiceInputDotPulse 1.2s ease-in-out infinite;
}


.voice-input-panel {
  margin-top: 12px;
  padding: 14px 16px;
  border: 1px solid #e5e7eb;
  border-radius: 18px;
  background-color: #ffffff;
}

.voice-input-panel-shell {
  display: flex;
  align-items: center;
  gap: 14px;
}

.voice-input-visual {
  flex-shrink: 0;
  display: flex;
  align-items: flex-end;
  gap: 6px;
  min-height: 56px;
  padding: 10px 12px;
  border-radius: 18px;
  background-color: #f8fafc;
}

.voice-input-pulse {
  display: block;
  width: 8px;
  height: 18px;
  border-radius: 999px;
  background: linear-gradient(180deg, #f9a8d4 0%, #a78bfa 55%, #93c5fd 100%);
  transform-origin: center bottom;
  animation: voiceInputWave 1.1s ease-in-out infinite;
}

.voice-input-pulse:nth-child(2) {
  animation-delay: 0.16s;
}

.voice-input-pulse:nth-child(3) {
  animation-delay: 0.32s;
}

.voice-input-panel:not(.is-recording) .voice-input-pulse {
  height: 14px;
  opacity: 0.58;
  animation-play-state: paused;
}

.voice-input-panel-content {
  min-width: 0;
  flex: 1;
  display: grid;
  gap: 6px;
}

.voice-input-panel-kicker {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #8b93b3;
}

.voice-input-status {
  color: #334155;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.5;
}

.voice-input-panel-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.voice-input-duration,
.voice-input-shortcut {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  background-color: #f8fafc;
  color: #64748b;
  font-size: 12px;
}

.voice-input-transcript-preview {
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid #e5e7eb;
  background-color: #f8fafc;
  color: #475569;
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

.voice-input-panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.voice-input-action-btn {
  min-width: 132px;
}

.voice-input-transcript-preview.is-empty {
  color: #94a3b8;
}

@keyframes voiceInputWave {
  0%, 100% {
    transform: scaleY(0.58);
    opacity: 0.62;
  }

  50% {
    transform: scaleY(1.18);
    opacity: 1;
  }
}

@keyframes voiceInputDotPulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.32);
  }

  50% {
    box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);
  }
}



.attachment-list,
.message-attachments {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}


.attachment-empty {
  padding: 12px;
  border-radius: 10px;
  border: 1px dashed #d1d5db;
  background-color: #ffffff;
  color: #6b7280;
  font-size: 13px;
}

.attachment-card {
  border: 1px solid #d1d5db;
  border-radius: 12px;
  background-color: #ffffff;
  overflow: hidden;
}

.attachment-card[open] {
  border-color: #a5b4fc;
}

.attachment-card-summary {
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  cursor: pointer;
}

.attachment-card-summary::-webkit-details-marker {
  display: none;
}

.attachment-card-title-wrap {
  min-width: 0;
}

.attachment-card-title {
  font-size: 14px;
  font-weight: 700;
  color: #111827;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-card-meta {
  margin-top: 2px;
  font-size: 12px;
  color: #6b7280;
}

.attachment-remove-btn {
  border: 1px solid #d1d5db;
  background-color: #ffffff;
  color: #374151;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  flex-shrink: 0;
}

.attachment-remove-btn:hover {
  border-color: #ef4444;
  color: #b91c1c;
}

.attachment-card-body {
  padding: 0 14px 14px;
}

.attachment-card-note {
  margin: 0;
  font-size: 13px;
  line-height: 1.7;
  color: #4b5563;
}

.attachment-text-preview {
  margin: 0;
  padding: 12px;
  border-radius: 10px;
  background-color: #f8fafc;
  color: #111827;
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-x: auto;
}

.attachment-image-preview {
  display: block;
  max-width: 100%;
  max-height: 240px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  object-fit: contain;
  background-color: #ffffff;
}

.message {
  position: relative;
  max-width: 82%;
  padding: 12px 16px;
  border-radius: 14px;
  line-height: 1.8;
  word-break: break-word;
  font-size: 15px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.message-actions {
  position: absolute;
  bottom: 10px;
  right: 12px;
  display: flex;
  flex-direction: row;  
  gap: 6px;
  justify-content: flex-end;
}

.copy-message-btn {
  border: 1px solid rgba(17, 24, 39, 0.14);
  background-color: rgba(255, 255, 255, 0.88);
  color: #111827;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
  transition: opacity 0.16s ease, transform 0.16s ease, background-color 0.16s ease;
}

.copy-message-btn:hover {
  background-color: #ffffff;
}

.message-content {
  min-width: 0;
}

.ai-message .message-content {
  padding-right: 64px;
}

.message-audio-player {
  width: min(320px, 100%);
  max-width: 100%;
}

.assistant-emoji {
  padding: 10px;
  max-width: min(240px, 100%);
}

.assistant-emoji-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
}

.assistant-emoji-image {
  display: block;
  width: 100%;
  max-width: 220px;
  height: auto;
  border-radius: 12px;
}

.daniya-affection-meter {
  margin-top: 4px;
  padding: 10px 12px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.68), rgba(244, 238, 255, 0.82));
  border: 1px solid rgba(255, 255, 255, 0.78);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

.daniya-affection-meter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.daniya-affection-meter-kicker {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #7c84ab;
}

.daniya-affection-meter-value {
  font-family: "Share Tech Mono", Consolas, monospace;
  font-size: 13px;
  color: #55607f;
}

.daniya-affection-meter-stage {
  margin-top: 6px;
  font-size: 12px;
  color: #6b7397;
}

.daniya-affection-meter-bar {
  position: relative;
  margin-top: 8px;
  width: 100%;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.6);
  box-shadow: inset 0 1px 2px rgba(123, 113, 178, 0.14);
}

.daniya-affection-meter-fill {
  position: relative;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(255, 150, 205, 0.92), rgba(167, 182, 255, 0.95), rgba(147, 213, 255, 0.95));
  box-shadow: 0 0 20px rgba(168, 181, 255, 0.24);
  transform-origin: left center;
  animation: daniyaAffectionPulse 3.2s ease-in-out infinite;
}

.daniya-affection-meter-shine {
  position: absolute;
  top: 0;
  right: -18px;
  width: 18px;
  height: 100%;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0));
  opacity: 0.82;
}

.daniya-affection-meter.is-maxed .daniya-affection-meter-fill {
  background: linear-gradient(90deg, #ff8fc8 0%, #c4a4ff 52%, #92ccff 100%);
}

@keyframes daniyaAffectionPulse {
  0%, 100% {
    transform: scaleX(0.985);
    opacity: 0.92;
  }

  50% {
    transform: scaleX(1);
    opacity: 1;
  }
}



@media (hover: hover) {
  .ai-message .message-actions {
    opacity: 0;
    pointer-events: none;
  }

  .ai-message:hover .message-actions,
  .ai-message:focus-within .message-actions {
    opacity: 1;
    pointer-events: auto;
  }

  .ai-message .copy-message-btn {
    transform: translateY(-2px);
  }

  .ai-message:hover .copy-message-btn,
  .ai-message:focus-within .copy-message-btn {
    transform: translateY(0);
  }
}


.message-content > :first-child {
  margin-top: 0;
}

.message-content > :last-child {
  margin-bottom: 0;
}

.ai-message {
  align-self: flex-start;
  background-color: #d1d5db;
  color: #111827;
}

.user-message {
  align-self: flex-end;
  background: rgba(79, 70, 229, 0.55);
  color: white;
}

.user-message a {
  color: white;
}

.user-message .attachment-card {
  background-color: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.25);
}

.user-message .attachment-card[open] {
  border-color: rgba(255, 255, 255, 0.4);
}

.user-message .attachment-card-title,
.user-message .attachment-card-note,
.user-message .attachment-card-meta,
.user-message .attachment-text-preview {
  color: white;
}

.user-message .attachment-text-preview {
  background-color: rgba(17, 24, 39, 0.18);
}

.user-message .attachment-image-preview {
  border-color: rgba(255, 255, 255, 0.2);
}

.user-message .message-content,
.system-message .message-content,
.thinking-message .message-content {
  white-space: pre-wrap;
}

.system-message {
  align-self: center;
  background-color: #ede9fe;
  color: #5b21b6;
  font-size: 14px;
}

.thinking-message {
  display: none;
  align-self: flex-start;
  background-color: #eef2ff;
  color: #4338ca;
  font-style: italic;
  border: 1px solid rgba(99, 102, 241, 0.22);
  box-shadow: 0 8px 18px rgba(79, 70, 229, 0.08);
}




.message-content h1,

.message-content h2,
.message-content h3,
.message-content h4 {
  margin: 0 0 10px;
  line-height: 1.5;
}

.message-content p {
  margin: 0 0 10px;
}

.message-content ul,
.message-content ol {
  margin: 0 0 10px 20px;
  padding: 0;
}

.message-content li + li {
  margin-top: 6px;
}

.message-content blockquote {
  margin: 0 0 10px;
  padding: 10px 12px;
  border-left: 4px solid rgba(79, 70, 229, 0.35);
  background-color: rgba(255, 255, 255, 0.45);
  border-radius: 8px;
}

.message-content a {
  color: inherit;
}

.message-content code {
  font-family: Consolas, "Courier New", monospace;
  font-size: 14px;
}

.message-content :not(pre) > code {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 6px;
  background-color: rgba(17, 24, 39, 0.08);
}

.message-content pre {
  margin: 0 0 10px;
  padding: 14px;
  border-radius: 10px;
  background-color: #111827;
  color: #f9fafb;
  overflow-x: auto;
  line-height: 1.6;
}

.message-content pre code {
  display: block;
  white-space: pre;
}

.input-area {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-top: 20px;
}

#user-input {
  flex: 1;
  min-height: 54px;
  max-height: 220px;
  padding: 14px;
  font-size: 16px;
  line-height: 1.6;
  border: 1px solid #d1d5db;
  border-radius: 14px;
  outline: none;
  resize: none;
  overflow-y: hidden;
  box-sizing: border-box;
}


#user-input:disabled {
  background-color: #f3f4f6;
  color: #6b7280;
}

#send-btn,
#stop-btn {
  padding: 14px 20px;
  font-size: 16px;
  border: none;
  border-radius: 10px;
  color: white;
  cursor: pointer;
}

#send-btn {
  background-color: #4f46e5;
}

#send-btn:hover {
  background-color: #4338ca;
}

/* 呼吸灯引导动画 — 新用户首次访问时触发 */
@keyframes btn-glow-pulse {
  0%, 100% { box-shadow: 0 0 8px 2px rgba(99, 102, 241, 0.3); }
  50% { box-shadow: 0 0 20px 6px rgba(99, 102, 241, 0.7); }
}

#send-btn.glow-guide {
  animation: btn-glow-pulse 2s ease-in-out infinite;
}

/* 聊天气泡入场动画 */
@keyframes msg-slide-left {
  from { opacity: 0; transform: translateX(-16px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes msg-slide-right {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: translateX(0); }
}

.message.msg-enter.ai-message {
  animation: msg-slide-left 0.3s ease-out;
}
.message.msg-enter.user-message {
  animation: msg-slide-right 0.3s ease-out;
}

#stop-btn {
  min-width: 112px;
}

#stop-btn:disabled {
  background-color: #fca5a5;
}


#send-btn:disabled,
.secondary-btn:disabled,
.history-action-btn:disabled,
.attachment-remove-btn:disabled {
  background-color: #a5b4fc;
  cursor: not-allowed;
  color: white;
  border-color: transparent;
}

#stop-btn:not(:disabled) {
  background-color: #dc2626;
}

#stop-btn:not(:disabled):hover {
  background-color: #b91c1c;
}


@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .history-panel {
    min-height: auto;
  }

  .history-panel-actions,
  .upload-dropzone {
    flex-direction: row;
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding: 12px;
    gap: 12px;
  }

  .chat-container,
  .history-panel {
    padding: 16px;
    border-radius: 12px;
  }

    h1 {
    font-size: 24px;
  }


    .top-bar,
  .profile-header,
  .chat-header-bar,
  .history-item-footer,
  .upload-dropzone,
  .attachment-card-summary {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .top-bar-actions {
    width: 100%;
  }


  .profile-actions,
  .input-area,
  .history-panel-actions {
    flex-direction: column;
  }

  .chat-box {
    height: 52vh;
    padding: 12px;
  }

  .message {
    max-width: 90%;
    font-size: 14px;
    line-height: 1.7;
  }

  .message-content pre {
    padding: 12px;
  }

                #user-input,
  #send-btn,
  #stop-btn,
  .secondary-btn,
  .settings-toggle-btn,
  .attachment-toggle-btn {
    width: 100%;
    box-sizing: border-box;
  }




        .chat-header-tip,
  .chat-header-meta,
  .history-item-actions {
    text-align: left;
    justify-content: flex-start;
  }
}

body {
  --pointer-x: 50vw;
  --pointer-y: 32vh;
  --pointer-ratio-x: 0;
  --pointer-ratio-y: 0;
  position: relative;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  color: #25304d;
  background:
    radial-gradient(circle at 14% 12%, rgba(255, 221, 237, 0.95), transparent 24%),
    radial-gradient(circle at 86% 14%, rgba(206, 233, 255, 0.9), transparent 24%),
    radial-gradient(circle at 58% 82%, rgba(224, 214, 255, 0.88), transparent 26%),
    linear-gradient(180deg, #fffafc 0%, #f7f5ff 50%, #eff5ff 100%);
}


body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body::before {
  background:
    radial-gradient(circle at 24% 32%, rgba(255, 255, 255, 0.6), transparent 18%),
    radial-gradient(circle at 74% 28%, rgba(255, 255, 255, 0.46), transparent 16%),
    radial-gradient(circle at 62% 68%, rgba(255, 255, 255, 0.34), transparent 20%);
  opacity: 0.9;
}

body::after {
  background:
    radial-gradient(circle at 20% 78%, rgba(255, 190, 224, 0.12), transparent 10%),
    radial-gradient(circle at 76% 70%, rgba(153, 210, 255, 0.14), transparent 11%),
    radial-gradient(circle at 46% 16%, rgba(185, 170, 255, 0.1), transparent 9%);
  filter: blur(14px);
  opacity: 0.85;
}

body.pointer-reactive-ui::after {
  background:
    radial-gradient(circle 180px at var(--pointer-x, 50vw) var(--pointer-y, 32vh), rgba(255, 255, 255, 0.42), transparent 70%),
    radial-gradient(circle 280px at calc(var(--pointer-x, 50vw) + 2vw) calc(var(--pointer-y, 32vh) - 2vh), rgba(255, 189, 229, 0.22), transparent 68%),
    radial-gradient(circle 340px at calc(var(--pointer-x, 50vw) - 7vw) calc(var(--pointer-y, 32vh) + 6vh), rgba(153, 210, 255, 0.18), transparent 72%),
    radial-gradient(circle at 20% 78%, rgba(255, 190, 224, 0.12), transparent 10%),
    radial-gradient(circle at 76% 70%, rgba(153, 210, 255, 0.14), transparent 11%),
    radial-gradient(circle at 46% 16%, rgba(185, 170, 255, 0.1), transparent 9%);
  filter: blur(18px);
  opacity: 0.96;
}

body.pointer-reactive-ui .history-panel,
body.pointer-reactive-ui .chat-container,
body.pointer-reactive-ui .workspace-reserved-panel,
body.pointer-reactive-ui .settings-screen .profile-card {
  position: relative;
  will-change: transform;
  transition: transform 0.35s ease, box-shadow 0.35s ease, border-color 0.35s ease, background 0.35s ease;
  transform: translate3d(
    calc(var(--pointer-ratio-x, 0) * 6px),
    calc(var(--pointer-ratio-y, 0) * 8px),
    0
  );
}


.app-shell {
  position: relative;
  z-index: 1;
  max-width: 1540px;
  padding: 30px 30px 36px;
  grid-template-columns: minmax(260px, 320px) minmax(0, 860px) minmax(220px, 280px);
  justify-content: center;
  gap: 26px;
  align-items: start;
  transition: transform 0.45s ease, filter 0.45s ease, opacity 0.45s ease;
}

.scene-transition-overlay {
  --scene-transition-start: #ffb4d8;
  --scene-transition-end: #a7b8ff;
  --scene-transition-accent: rgba(255, 255, 255, 0.94);
  --scene-transition-shadow: rgba(176, 170, 235, 0.28);
  --scene-transition-veil: linear-gradient(180deg, rgba(248, 247, 255, 0.22), rgba(242, 246, 255, 0.36));
  --scene-transition-surface: linear-gradient(180deg, rgba(255, 255, 255, 0.52), rgba(255, 255, 255, 0.2));
  --scene-transition-border: rgba(255, 255, 255, 0.68);
  --scene-transition-kicker-color: #7e86ae;
  --scene-transition-title-color: #405070;
  --scene-transition-hint-color: rgba(83, 95, 128, 0.92);
  --scene-transition-badge-bg: linear-gradient(135deg, rgba(255, 180, 216, 0.24), rgba(167, 184, 255, 0.26));
  --scene-transition-badge-color: #6b7498;
  --scene-transition-shell-radius: 28px;
  --scene-transition-shell-width: min(82vw, 420px);
  --scene-transition-sheen-rotate: 8deg;
  --scene-transition-shell-hidden-rotate: 0deg;
  --scene-transition-shell-visible-rotate: 0deg;
  --scene-transition-pattern-opacity: 0.34;
  position: fixed;
  inset: 0;
  z-index: 99998;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.26s ease, visibility 0s linear 0.26s;
}

.scene-transition-overlay::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--scene-transition-veil);
  backdrop-filter: blur(14px) saturate(1.08);
}

.scene-transition-overlay.is-visible {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.34s ease;
}

.scene-transition-glow,
.scene-transition-pattern,
.scene-transition-sheen {
  position: absolute;
  pointer-events: none;
}

.scene-transition-glow {
  border-radius: 999px;
  filter: blur(46px);
  opacity: 0.18;
  transform: scale(0.88);
  transition: transform 0.52s ease, opacity 0.52s ease;
}

.scene-transition-overlay.is-visible .scene-transition-glow {
  opacity: 0.5;
  transform: scale(1.03);
}

.scene-transition-glow-a {
  top: -18vmax;
  left: -12vmax;
  width: 42vmax;
  height: 42vmax;
  background: radial-gradient(circle, var(--scene-transition-start) 0%, transparent 70%);
}

.scene-transition-glow-b {
  right: -14vmax;
  bottom: -20vmax;
  width: 40vmax;
  height: 40vmax;
  background: radial-gradient(circle, var(--scene-transition-end) 0%, transparent 72%);
}

.scene-transition-pattern {
  inset: 15% 12%;
  border-radius: 36px;
  opacity: 0;
  transform: scale(0.92) rotate(-2deg);
  transition: transform 0.58s ease, opacity 0.58s ease;
  background:
    radial-gradient(circle at 26% 35%, rgba(255, 255, 255, 0.14) 0, transparent 18%),
    radial-gradient(circle at 74% 64%, rgba(255, 255, 255, 0.12) 0, transparent 16%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), transparent 64%);
  mix-blend-mode: screen;
}

.scene-transition-overlay.is-visible .scene-transition-pattern {
  opacity: var(--scene-transition-pattern-opacity);
  transform: scale(1) rotate(0deg);
}

.scene-transition-sheen {
  inset: -12%;
  background: linear-gradient(108deg, transparent 32%, rgba(255, 255, 255, 0.08) 44%, var(--scene-transition-accent) 50%, rgba(255, 255, 255, 0.08) 56%, transparent 68%);
  opacity: 0;
  transform: translate3d(-42%, 0, 0) rotate(var(--scene-transition-sheen-rotate));
  transition: transform 0.68s ease, opacity 0.68s ease;
}

.scene-transition-overlay.is-visible .scene-transition-sheen {
  opacity: 0.48;
  transform: translate3d(42%, 0, 0) rotate(var(--scene-transition-sheen-rotate));
}

.scene-transition-shell {
  position: relative;
  z-index: 1;
  min-width: var(--scene-transition-shell-width);
  padding: 22px 26px;
  border-radius: var(--scene-transition-shell-radius);
  background: var(--scene-transition-surface);
  border: 1px solid var(--scene-transition-border);
  box-shadow:
    0 24px 58px var(--scene-transition-shadow),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(22px) saturate(1.08);
  text-align: center;
  transform: translateY(16px) scale(0.96) rotate(var(--scene-transition-shell-hidden-rotate));
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.3s ease;
}

.scene-transition-overlay.is-visible .scene-transition-shell {
  transform: translateY(0) scale(1) rotate(var(--scene-transition-shell-visible-rotate));
  opacity: 1;
}

.scene-transition-overlay[data-variant="settings"] .scene-transition-shell {
  min-width: min(76vw, 360px);
}

.scene-transition-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--scene-transition-badge-bg);
  border: 1px solid rgba(255, 255, 255, 0.38);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.42);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--scene-transition-badge-color);
}

.scene-transition-kicker {
  margin-top: 12px;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--scene-transition-kicker-color);
}

.scene-transition-title {
  margin-top: 10px;
  font-size: clamp(24px, 4vw, 34px);
  line-height: 1.08;
  letter-spacing: -0.04em;
  color: var(--scene-transition-title-color);
}

.scene-transition-hint {
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--scene-transition-hint-color);
}

.scene-transition-overlay[data-character="daniya"] .scene-transition-pattern {
  background:
    radial-gradient(circle at 24% 38%, rgba(255, 185, 226, 0.32) 0, transparent 18%),
    radial-gradient(circle at 76% 58%, rgba(183, 190, 255, 0.26) 0, transparent 16%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.12), transparent 72%);
}

.scene-transition-overlay[data-character="aimisi"] .scene-transition-pattern {
  inset: 17% 10%;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.14) 0 1px, transparent 1px 14px),
    linear-gradient(120deg, rgba(255, 164, 221, 0.24), transparent 42%, rgba(149, 215, 255, 0.2) 76%, transparent 100%);
}

.scene-transition-overlay[data-character="aimisi"] .scene-transition-glow-a {
  top: -20vmax;
  left: -8vmax;
}

.scene-transition-overlay[data-character="aimisi"] .scene-transition-glow-b {
  right: -8vmax;
  bottom: -18vmax;
}


.scene-transition-overlay[data-character="fuluoluo"] .scene-transition-pattern {
  inset: 12% 13%;
  border-radius: 20px;
  background:
    linear-gradient(132deg, rgba(255, 255, 255, 0.04), transparent 38%, rgba(148, 175, 255, 0.16) 100%),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.12) 0 1px, transparent 1px 18px);
}

.scene-transition-overlay[data-character="assistant"] .scene-transition-pattern {
  inset: 16% 12%;
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.12) 0 1px, transparent 1px 18px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px 18px),
    linear-gradient(135deg, rgba(156, 184, 255, 0.16), transparent 72%);
}

.scene-transition-overlay[data-character="companion"] .scene-transition-pattern {
  background:
    radial-gradient(circle at 24% 36%, rgba(255, 203, 225, 0.24) 0, transparent 18%),
    radial-gradient(circle at 76% 66%, rgba(176, 194, 255, 0.2) 0, transparent 16%),
    linear-gradient(140deg, rgba(255, 255, 255, 0.08), transparent 72%);
}

body.scene-transition-active .app-shell {
  transform: scale(0.988);
  filter: blur(7px) saturate(1.04);
  opacity: 0.82;
}


.chat-stage {

  min-width: 0;
  display: flex;
  justify-content: center;
  align-self: stretch;
}

.history-panel,
.chat-container,
.workspace-reserved-panel {
  border-radius: 30px;
  border: 1px solid rgba(255, 255, 255, 0.68);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.64), rgba(255, 255, 255, 0.38));
  box-shadow:
    0 26px 70px rgba(181, 175, 225, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(24px) saturate(1.08);
}

.history-panel {
  position: sticky;
  top: 24px;
  padding: 22px;
  min-height: calc(100vh - 56px);
  height: calc(100vh - 56px);
  max-height: calc(100vh - 56px);
  overflow: hidden;
}


.chat-container {
  width: 100%;
  max-width: 860px;
  min-height: calc(100vh - 56px);
  height: calc(100vh - 56px);
  max-height: calc(100vh - 56px);
  padding: 28px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.workspace-reserved-panel {
  position: sticky;
  top: 24px;
  min-height: calc(100vh - 56px);
  height: calc(100vh - 56px);
  max-height: calc(100vh - 56px);
  padding: 18px;
  overflow: hidden;
}

.workspace-reserved-inner {
  height: 100%;
  border-radius: 24px;
  padding: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0.16));
  border: 1px solid rgba(255, 255, 255, 0.46);
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}

.workspace-reserved-kicker,
.workspace-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.52);
  border: 1px solid rgba(255, 255, 255, 0.68);
  box-shadow: 0 10px 24px rgba(194, 185, 233, 0.14);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #7d84af;
}

.workspace-reserved-kicker::before,
.workspace-kicker::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff95ca, #97c7ff);
  box-shadow: 0 0 14px rgba(255, 149, 202, 0.3);
}

.workspace-heading {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.top-bar {
  align-items: flex-start;
  margin-bottom: 20px;
}

.top-bar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 4px;
}

.welcome-return-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(241, 237, 255, 0.92)),
    linear-gradient(135deg, rgba(139, 124, 255, 0.22), rgba(92, 200, 255, 0.14));
  color: #635bdb;
  box-shadow:
    0 16px 30px rgba(183, 173, 229, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.96);
  cursor: pointer;
  transition: transform 0.22s ease, box-shadow 0.22s ease, background 0.22s ease, color 0.22s ease;
  overflow: hidden;
}

.welcome-return-btn::before {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.12));
  opacity: 0.75;
}

.welcome-return-btn:hover {
  transform: translateY(-2px);
  color: #4c46c7;
  box-shadow:
    0 20px 36px rgba(173, 161, 228, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.98);
}

.welcome-return-btn:active {
  transform: translateY(0);
}

.welcome-return-btn:focus-visible {
  outline: 2px solid rgba(99, 102, 241, 0.3);
  outline-offset: 3px;
}

.welcome-return-btn:disabled {
  opacity: 0.58;
  cursor: not-allowed;
  transform: none;
  box-shadow:
    0 12px 24px rgba(183, 173, 229, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.86);
}

.welcome-return-btn-icon {
  position: relative;
  z-index: 1;
  font-size: 22px;
  line-height: 1;
  transform: translateX(-1px);
}


h1 {
  margin: 0;
  font-size: clamp(32px, 4vw, 44px);
  line-height: 1.04;
  letter-spacing: -0.04em;
  color: #2a3454;
}

.workspace-assistant-role-name {
  margin-left: 10px;
  font-size: 0.58em;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #7c6fd2;
}


.history-panel-header h2,
.profile-header h2,
.workspace-reserved-panel h2 {
  color: #33405f;
}

.history-panel-header p,
.workspace-reserved-panel p,
.profile-status,
.settings-help-text,
.chat-header-label {
  color: #6f7896;
}

#history-search,
.profile-fields input,
.profile-fields select,
#user-input,
.settings-toggle-btn,
.attachment-toggle-btn,
.secondary-outline-btn,
.history-action-btn,
.attachment-remove-btn,
.copy-message-btn {
  border-color: rgba(255, 255, 255, 0.78);
  background: rgba(255, 255, 255, 0.54);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

#history-search,
.profile-fields input,
.profile-fields select,
#user-input {
  color: #33405d;
}

#history-search::placeholder,
.profile-fields input::placeholder,
#user-input::placeholder {
  color: rgba(112, 120, 151, 0.78);
}

#history-search,
.profile-fields input,
.profile-fields select {
  min-height: 48px;
  border-radius: 16px;
}

#history-search:focus,
.profile-fields input:focus,
.profile-fields select:focus,
#user-input:focus {
  border-color: rgba(177, 141, 255, 0.86);
  box-shadow:
    0 0 0 4px rgba(190, 171, 255, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.history-search-kbd {
  background: rgba(255, 255, 255, 0.62);
  border-color: rgba(255, 255, 255, 0.76);
  color: #8a91b0;
}

.history-item {
  border-radius: 18px;
  border-color: rgba(255, 255, 255, 0.7);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0.4));
  box-shadow: 0 12px 24px rgba(191, 184, 231, 0.12);
}

.history-item:hover {
  border-color: rgba(187, 159, 255, 0.8);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.74), rgba(245, 239, 255, 0.66));
  box-shadow: 0 16px 28px rgba(192, 179, 234, 0.18);
  transform: translateY(-1px);
}

.history-item.active {
  border-color: rgba(171, 143, 255, 0.92);
  background: linear-gradient(180deg, rgba(247, 243, 255, 0.96), rgba(235, 240, 255, 0.92));
  box-shadow:
    0 18px 32px rgba(176, 163, 228, 0.2),
    inset 0 0 0 1px rgba(174, 146, 255, 0.24);
}

.history-item.active::before {
  background: linear-gradient(180deg, #d88cff 0%, #98b6ff 100%);
}

.settings-toggle-btn,
.secondary-btn,
.secondary-outline-btn,
.attachment-toggle-btn,
#send-btn,
#stop-btn {
  border-radius: 18px;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background-color 0.18s ease;
}

.settings-toggle-btn,
.secondary-outline-btn,
.attachment-toggle-btn {
  color: #4f5b7f;
}

.settings-toggle-btn:hover,
.secondary-outline-btn:hover,
.attachment-toggle-btn:hover,
.history-action-btn:hover,
.attachment-remove-btn:hover,
.copy-message-btn:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.7);
  border-color: rgba(189, 164, 255, 0.72);
}

.secondary-btn,
#send-btn {
  color: #fff;
  background: linear-gradient(135deg, #ff9eca 0%, #c5a8ff 48%, #95cbff 100%);
  box-shadow: 0 18px 28px rgba(185, 166, 235, 0.28);
}

.secondary-btn:hover,
#send-btn:hover {
  background: linear-gradient(135deg, #ff92c5 0%, #bda0ff 48%, #88c5ff 100%);
  box-shadow: 0 20px 34px rgba(184, 164, 235, 0.34);
}

.danger-btn,
#stop-btn:not(:disabled) {
  background: linear-gradient(135deg, #ff9db2 0%, #ff7f9f 100%);
  box-shadow: 0 18px 28px rgba(255, 135, 165, 0.22);
}

.danger-btn:hover,
#stop-btn:not(:disabled):hover {
  background: linear-gradient(135deg, #ff8ea8 0%, #ff7196 100%);
}

.settings-panel,
.profile-card,
.chat-header-bar,
.attachment-panel-body,
.upload-dropzone,
.attachment-card,
.attachment-empty,
.history-empty {
  border-radius: 22px;
  border-color: rgba(255, 255, 255, 0.64);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.52), rgba(255, 255, 255, 0.32));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.84);
}

.chat-header-bar {
  padding: 18px 20px;
  margin-bottom: 18px;
}

.current-chat-title {
  font-size: 20px;
  color: #2d3958;
}

.chat-header-tip {
  color: #7c6fd2;
}

.chat-box {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  padding: 20px 20px 18px;
  border-radius: 28px;
  border-color: rgba(255, 255, 255, 0.74);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.58), rgba(255, 255, 255, 0.36)),
    radial-gradient(circle at top, rgba(255, 255, 255, 0.32), transparent 55%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 20px 44px rgba(186, 178, 228, 0.14);
  gap: 16px;
}

.message-list {
  gap: 16px;
}

.message {
  max-width: 78%;
  padding: 14px 18px;
  border-radius: 22px;
  font-size: 15px;
  line-height: 1.82;
  box-shadow: 0 14px 28px rgba(193, 184, 232, 0.12);
}

.ai-message {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.74), rgba(241, 236, 255, 0.76));
  border: 1px solid rgba(255, 255, 255, 0.82);
  color: #33405d;
}

.user-message {
  background: linear-gradient(135deg, #f5a6cf 0%, #d19fff 52%, #a7c8ff 100%);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #ffffff;
}

.system-message {
  background: rgba(248, 242, 255, 0.88);
  color: #775ac7;
  border: 1px solid rgba(201, 183, 255, 0.5);
}

.thinking-message,
.typing-indicator {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(238, 235, 255, 0.82));
  color: #6d64b9;
  border: 1px solid rgba(196, 182, 255, 0.5);
  box-shadow: 0 12px 24px rgba(186, 174, 230, 0.14);
}

.typing-indicator span {
  background: linear-gradient(180deg, #c5a3ff, #8fc8ff);
}

.message-content blockquote {
  border-left-color: rgba(182, 155, 255, 0.65);
  background: rgba(255, 255, 255, 0.46);
}

.message-content :not(pre) > code {
  background: rgba(60, 72, 112, 0.08);
}

.message-content pre {
  background: #29324d;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.attachment-panel {
  margin-top: 16px;
  gap: 12px;
}

.upload-dropzone {
  padding: 16px 18px;
}

.upload-dropzone:hover,
.upload-dropzone:focus {
  border-color: rgba(175, 149, 255, 0.8);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(245, 240, 255, 0.72));
}

.upload-dropzone.drag-active,
.attachment-toggle-btn.has-attachments {
  background: linear-gradient(180deg, rgba(246, 239, 255, 0.92), rgba(236, 242, 255, 0.88));
  border-color: rgba(172, 144, 255, 0.8);
  color: #6759b9;
}

.voice-input-btn {
  background: linear-gradient(135deg, #f8d9ff 0%, #f3ddff 38%, #e9ddff 70%, #dee7ff 100%);
  border-color: rgba(230, 191, 245, 0.96);
  color: #7d57bf;
  box-shadow: 0 14px 28px rgba(214, 177, 231, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.88);
}

.voice-input-btn:hover {
  background: linear-gradient(135deg, #fbdfff 0%, #f6e3ff 40%, #ede2ff 72%, #e3ebff 100%);
  border-color: rgba(225, 176, 236, 1);
  color: #7348be;
}

.voice-input-btn[aria-pressed="true"] {
  border-color: rgba(246, 168, 214, 0.98);
  background: linear-gradient(135deg, #ffcaeb 0%, #f6d2ff 44%, #efd8ff 72%, #e2e6ff 100%);
  color: #ba4d90;
  box-shadow: 0 16px 30px rgba(221, 164, 218, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

.voice-input-btn[aria-pressed="true"] .voice-input-btn-icon {
  background: rgba(255, 255, 255, 0.96);
}


.voice-input-panel {
  border: 1px solid rgba(255, 255, 255, 0.72);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(246, 243, 255, 0.82));
  box-shadow: 0 16px 32px rgba(188, 178, 228, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

.voice-input-panel.is-recording {
  border-color: rgba(255, 171, 210, 0.8);
}

.voice-input-panel.is-stopping {
  border-color: rgba(212, 185, 247, 0.82);
}

.voice-input-panel.has-error {
  border-color: rgba(248, 113, 113, 0.74);
}

.voice-input-panel.is-unavailable {
  border-color: rgba(251, 191, 36, 0.68);
}


.voice-input-visual {
  background: linear-gradient(180deg, rgba(255, 247, 252, 0.94), rgba(238, 243, 255, 0.9));
  border: 1px solid rgba(255, 255, 255, 0.82);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.voice-input-status {
  color: #44506f;
}

.voice-input-panel.is-recording .voice-input-status {
  color: #b65d93;
}

.voice-input-panel.is-stopping .voice-input-status {
  color: #8d69c6;
}

.voice-input-panel.has-error .voice-input-status {
  color: #c2410c;
}

.voice-input-panel.is-unavailable .voice-input-status {
  color: #a16207;
}


.voice-input-duration,
.voice-input-shortcut,
.voice-input-transcript-preview {
  border-color: rgba(214, 204, 244, 0.72);
  background: rgba(255, 255, 255, 0.72);
}

.voice-input-transcript-preview {
  color: #5f6786;
}

.voice-input-panel.has-error .voice-input-transcript-preview {
  border-color: rgba(254, 202, 202, 0.92);
  background: rgba(255, 247, 237, 0.92);
  color: #9a3412;
}

.voice-input-panel.is-unavailable .voice-input-transcript-preview {
  border-color: rgba(253, 230, 138, 0.88);
  background: rgba(255, 251, 235, 0.92);
  color: #92400e;
}

.voice-input-transcript-preview.is-empty {
  color: #97a0be;
}

.input-area {
  align-items: stretch;
  gap: 12px;
  margin-top: 18px;
  padding: 14px;
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.58), rgba(255, 255, 255, 0.36));
  box-shadow: 0 16px 34px rgba(188, 178, 228, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

#user-input {
  min-height: 62px;
  padding: 16px 18px;
  border-radius: 22px;
}

#send-btn,
#stop-btn {
  min-height: 62px;
  padding: 0 24px;
}

#send-btn:disabled,
.secondary-btn:disabled,
.history-action-btn:disabled,
.attachment-remove-btn:disabled {
  background: rgba(196, 183, 236, 0.8);
}

#scroll-bottom-btn {
  background: rgba(255, 255, 255, 0.76);
  border-color: rgba(255, 255, 255, 0.8);
  box-shadow: 0 14px 24px rgba(187, 177, 227, 0.18);
  color: #6c76a0;
}

.workspace-reserved-stack {
  margin-top: auto;
  display: grid;
  gap: 14px;
  padding-top: 30px;
}

.avatar-workspace {
  gap: 16px;
}

.avatar-float-panel {
  position: relative;
}

.avatar-float-trigger {
  position: absolute;
  top: 88px;
  right: -14px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  padding: 0;
  cursor: pointer;
  opacity: 0.35;
  z-index: 8;
  background: linear-gradient(180deg, #f9a8d4 0%, #e6a6ea 48%, #c084fc 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.72),
    inset 0 0 14px rgba(255, 255, 255, 0.38),
    0 6px 18px rgba(205, 148, 243, 0.14);
  transition:
    width 0.28s ease,
    height 0.28s ease,
    opacity 0.28s ease,
    transform 0.28s ease,
    box-shadow 0.28s ease,
    filter 0.28s ease;
}

.avatar-float-trigger::before,
.avatar-float-trigger::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.avatar-float-trigger::before {
  inset: 3px;
  background: radial-gradient(circle at 34% 30%, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.04) 72%);
  opacity: 0.9;
}

.avatar-float-trigger::after {
  inset: -12px;
  background: radial-gradient(circle, rgba(247, 171, 223, 0.34), rgba(192, 132, 252, 0));
  opacity: 0;
  transform: scale(0.78);
  transition: opacity 0.28s ease, transform 0.28s ease;
}

.avatar-float-panel:hover .avatar-float-trigger,
.avatar-float-trigger:hover,
.avatar-float-trigger:focus-visible {
  width: 40px;
  height: 40px;
  opacity: 1;
  transform: translateX(2px) scale(1.02);
  filter: saturate(1.08);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.84),
    inset 0 0 22px rgba(255, 255, 255, 0.42),
    0 12px 30px rgba(208, 134, 246, 0.24);
  animation: avatarSecretPulse 1.6s ease-in-out infinite;
}

.avatar-float-panel:hover .avatar-float-trigger::after,
.avatar-float-trigger:hover::after,
.avatar-float-trigger:focus-visible::after {
  opacity: 1;
  transform: scale(1.08);
}

.avatar-float-trigger:focus-visible {
  outline: 0;
}


.avatar-stage-card,
.avatar-meta-card {
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.56);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.54), rgba(255, 255, 255, 0.24));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.74);
}

.avatar-stage-card {
  padding: 18px;
}

 .avatar-stage {
  position: relative;
  min-height: 240px;
  border-radius: 28px;
  overflow: hidden;
  display: grid;
  place-items: center;
  isolation: isolate;
  background:
    radial-gradient(circle at 32% 24%, rgba(255, 255, 255, 0.85), transparent 28%),
    radial-gradient(circle at 72% 18%, rgba(196, 230, 255, 0.44), transparent 24%),
    radial-gradient(circle at 50% 82%, rgba(226, 209, 255, 0.44), transparent 32%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.74), rgba(238, 242, 255, 0.58));
}

.avatar-stage::after {
  content: "";
  position: absolute;
  inset: 18px;
  border-radius: 24px;
  border: 1px dashed rgba(161, 151, 232, 0.45);
  pointer-events: none;
  z-index: 4;
}

.avatar-stage-canvas-shell {
  position: absolute;
  inset: 0;
  z-index: 2;
}

.avatar-stage-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.avatar-stage-orb,
.avatar-stage-ring {
  position: absolute;
  z-index: 1;
  border-radius: 50%;
  transition: transform 0.22s ease, opacity 0.22s ease, box-shadow 0.22s ease;
}

.avatar-stage-orb {
  width: 126px;
  height: 126px;
  background: radial-gradient(circle at 35% 35%, rgba(255, 255, 255, 0.96), rgba(255, 165, 216, 0.78) 44%, rgba(150, 201, 255, 0.22) 100%);
  box-shadow: 0 0 46px rgba(255, 174, 225, 0.34);
}

.avatar-stage-ring {
  width: 188px;
  height: 188px;
  border: 2px solid rgba(165, 154, 236, 0.34);
  box-shadow: 0 0 30px rgba(166, 153, 235, 0.14);
}

.avatar-stage-core {
  position: relative;
  z-index: 3;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.76);
  color: #69739b;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.avatar-stage-caption {
  margin-top: 14px;
  display: grid;
  gap: 8px;
}

.avatar-stage-label,
.avatar-meta-label {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #8a91b8;
}

.avatar-stage-text,
.avatar-meta-value {
  color: #4e5876;
  font-size: 13px;
  line-height: 1.7;
  word-break: break-word;
}

.avatar-stage-footnote {
  color: #8a91b8;
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}


.avatar-meta-grid {
  display: grid;
  gap: 12px;
}

.avatar-meta-card {
  padding: 14px 16px;
}

.avatar-meta-card-wide {
  min-height: 76px;
}

.avatar-mood-row,
.avatar-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.avatar-mood-tag {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.76);
  background: rgba(255, 255, 255, 0.58);
  color: #7079a0;
  font-size: 12px;
  cursor: default;
}

.avatar-mood-tag.active {
  color: #5d53b5;
  border-color: rgba(173, 146, 255, 0.82);
  background: linear-gradient(180deg, rgba(246, 240, 255, 0.92), rgba(234, 242, 255, 0.84));
  box-shadow: 0 12px 24px rgba(188, 178, 228, 0.18);
}

.avatar-action-row .secondary-btn {
  flex: 1 1 180px;
}



.avatar-stage.avatar-stage--has-model .avatar-stage-orb,
.avatar-stage.avatar-stage--has-model .avatar-stage-ring {
  opacity: 0.2;
}

.avatar-stage.avatar-stage--has-model .avatar-stage-core {
  opacity: 0;
}

.avatar-stage.avatar-stage--speaking .avatar-stage-canvas {
  transform: translateY(-2px) scale(1.01);
  transition: transform 0.18s ease;
}


.avatar-stage[data-mood="happy"] .avatar-stage-orb {
  transform: translateY(-8px) scale(1.06);
}

.avatar-stage[data-mood="gentle"] .avatar-stage-ring {
  transform: scale(0.96);
  border-color: rgba(143, 191, 255, 0.42);
}

.avatar-stage[data-mood="thinking"] .avatar-stage-core {
  color: #5e6db7;
}

.avatar-stage[data-mood="pout"] .avatar-stage-orb {
  box-shadow: 0 0 52px rgba(255, 145, 188, 0.28);
}

.avatar-stage[data-state="error"] {
  background: linear-gradient(180deg, rgba(255, 243, 246, 0.92), rgba(255, 236, 241, 0.8));
}

.avatar-stage.avatar-stage--speaking .avatar-stage-orb {
  animation: avatarPulse 0.68s ease-in-out infinite;
}

.avatar-stage.avatar-stage--speaking .avatar-stage-ring {
  animation: avatarRing 1.2s linear infinite;
}

@keyframes avatarPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}

@keyframes avatarRing {
  0% { transform: scale(0.96); opacity: 0.88; }
  100% { transform: scale(1.08); opacity: 0.24; }
}

@keyframes avatarSecretPulse {
  0%, 100% {
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.84),
      inset 0 0 22px rgba(255, 255, 255, 0.42),
      0 12px 30px rgba(208, 134, 246, 0.24);
  }
  50% {
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.94),
      inset 0 0 28px rgba(255, 255, 255, 0.56),
      0 16px 40px rgba(219, 141, 248, 0.34);
  }
}

.reserved-ghost-card {

  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.56);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.46), rgba(255, 255, 255, 0.2));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.74);
}


.reserved-ghost-card-lg {
  height: 190px;
}

.reserved-ghost-card {
  height: 120px;
}

.reserved-ghost-card-sm {
  height: 78px;
}

.history-list,
.chat-box,
.workspace-reserved-inner {
  scrollbar-width: thin;
  scrollbar-color: rgba(178, 164, 228, 0.78) rgba(255, 255, 255, 0.16);
}

.history-list::-webkit-scrollbar,
.chat-box::-webkit-scrollbar,
.workspace-reserved-inner::-webkit-scrollbar {
  width: 10px;
}

.history-list::-webkit-scrollbar-track,
.chat-box::-webkit-scrollbar-track,
.workspace-reserved-inner::-webkit-scrollbar-track {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.24);
}

.history-list::-webkit-scrollbar-thumb,
.chat-box::-webkit-scrollbar-thumb,
.workspace-reserved-inner::-webkit-scrollbar-thumb {
  border-radius: 999px;
  border: 2px solid transparent;
  background:
    linear-gradient(180deg, rgba(201, 174, 255, 0.94), rgba(132, 203, 255, 0.9));
  background-clip: padding-box;
  box-shadow: 0 8px 18px rgba(173, 164, 228, 0.18);
}

.history-list::-webkit-scrollbar-thumb:hover,
.chat-box::-webkit-scrollbar-thumb:hover,
.workspace-reserved-inner::-webkit-scrollbar-thumb:hover {
  background:
    linear-gradient(180deg, rgba(189, 159, 255, 0.98), rgba(111, 195, 255, 0.94));
  background-clip: padding-box;
}

.app-shell {
  max-width: 1550px;
  padding: 30px 30px 36px;
  grid-template-columns: minmax(260px, 320px) minmax(0, 860px) minmax(220px, 292px);
  justify-content: center;
  gap: 24px;
  align-items: start;
}


#history-expand-btn {
  min-width: 120px;
}

.history-panel.history-panel-expanded {
  position: fixed;
  top: 16px;
  left: 16px;
  width: min(430px, 40vw);
  min-height: calc(100vh - 32px);
  height: calc(100vh - 32px);
  max-height: calc(100vh - 32px);
  overflow: hidden;
  z-index: 35;
}


.avatar-stage-footnote--intro {
  text-align: left;
}

@media (max-width: 1280px) {
  .app-shell {
    grid-template-columns: minmax(250px, 300px) minmax(0, 1fr);
    max-width: 1180px;
  }

  .workspace-reserved-panel {
    display: none;
  }

  .workspace-reserved-panel.avatar-float-panel {
    display: block;
    position: fixed;
    top: 104px;
    right: 0;
    z-index: 20;
    min-height: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .workspace-reserved-panel.avatar-float-panel .workspace-reserved-inner {
    display: none;
  }

  .workspace-reserved-panel.avatar-float-panel .avatar-float-trigger {
    top: 0;
    right: 14px;
  }

    .chat-container {
    max-width: none;
  }
}

@media (max-width: 980px) {
  .workspace-reserved-panel {
    display: block;
    position: static;
    min-height: auto;
  }

  .app-shell {
    grid-template-columns: 1fr;
    padding: 18px;
    gap: 18px;
  }

    .history-panel,
  .workspace-reserved-panel {
    position: static;
    min-height: auto;
    height: auto;
    max-height: none;
    overflow: visible;
  }


    .history-panel.history-panel-expanded {
    position: static;
    width: auto;
    min-height: auto;
    height: auto;
    max-height: none;
    overflow: visible;
  }


  .chat-stage {
    display: block;
  }

  .chat-container {
    max-width: none;
    min-height: auto;
    height: auto;
    max-height: none;
    overflow: visible;
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding: 14px;
    gap: 14px;
  }

  .history-panel,
  .chat-container {
    padding: 18px;
    border-radius: 24px;
  }

        .top-bar,
    .profile-header,
    .chat-header-bar,
    .history-item-footer,
    .upload-dropzone,
    .attachment-card-summary {
      flex-direction: column;
      align-items: flex-start;
    }

    .attachment-panel-toolbar,
    .upload-dropzone-actions,
    .voice-input-panel-shell {
      width: 100%;
    }

    .attachment-panel-toolbar {
      flex-direction: column;
      align-items: stretch;
    }

    .upload-dropzone-actions {
      justify-content: stretch;
    }

    .voice-input-btn {
      width: 100%;
    }

    .voice-input-panel-shell {
      flex-direction: column;
      align-items: flex-start;
    }

  .input-area,
  .profile-actions,
  .history-panel-actions {
    flex-direction: column;
  }


  .message {
    max-width: 92%;
  }

  #send-btn,
  #stop-btn,
  .secondary-btn,
  .settings-toggle-btn,
  .attachment-toggle-btn {
    width: 100%;
  }
}


@media (prefers-reduced-motion: reduce) {
  .scene-transition-overlay,
  .scene-transition-glow,
  .scene-transition-pattern,
  .scene-transition-sheen,
  .scene-transition-shell,
  .app-shell {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }

  .scene-transition-pattern,
  .scene-transition-sheen {
    display: none;
  }

  body.scene-transition-active .app-shell {
    transform: none;
    filter: none;
    opacity: 0.92;
  }
}


body.settings-screen-open {
  overflow: hidden;
}

body.settings-screen-open .app-shell {
  transform: scale(0.978);
  filter: blur(12px) saturate(1.04);
  opacity: 0.22;
  pointer-events: none;
}

body.pointer-reactive-ui .settings-screen::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(circle 220px at var(--pointer-x, 50vw) var(--pointer-y, 32vh), rgba(255, 255, 255, 0.24), transparent 70%),
    radial-gradient(circle 340px at calc(var(--pointer-x, 50vw) - 10vw) calc(var(--pointer-y, 32vh) + 6vh), rgba(201, 231, 255, 0.16), transparent 74%),
    radial-gradient(circle 280px at calc(var(--pointer-x, 50vw) + 10vw) calc(var(--pointer-y, 32vh) - 6vh), rgba(255, 201, 228, 0.18), transparent 72%);
}

body.pointer-reactive-ui .settings-screen-panel {
  box-shadow:
    0 34px 78px rgba(176, 167, 225, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.settings-toggle-btn {
  display: inline-flex;

  align-items: center;
  gap: 10px;
  min-width: 96px;
  padding: 12px 18px;
  border: 1px solid rgba(255, 255, 255, 0.84);
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(245, 241, 255, 0.88));
  color: #4e5b81;
  box-shadow:
    0 16px 30px rgba(188, 176, 231, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

.settings-toggle-btn:hover {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(241, 236, 255, 0.94));
}

.settings-toggle-btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff9eca 0%, #c5a8ff 48%, #95cbff 100%);
  color: #fff;
  font-size: 12px;
  box-shadow: 0 10px 18px rgba(185, 166, 235, 0.24);
}

.settings-toggle-btn-text {
  letter-spacing: 0.08em;
}

.settings-screen[hidden] {
  display: none !important;
}

.settings-screen {
  position: fixed;
  inset: 0;
  z-index: 9000;
  overflow-y: auto;
  overflow-x: hidden;
  isolation: isolate;
  background:
    radial-gradient(circle at 16% 18%, rgba(255, 215, 236, 0.7), transparent 26%),
    radial-gradient(circle at 84% 16%, rgba(199, 232, 255, 0.66), transparent 28%),
    radial-gradient(circle at 54% 82%, rgba(230, 212, 255, 0.72), transparent 32%),
    linear-gradient(180deg, rgba(255, 250, 252, 0.96), rgba(247, 245, 255, 0.98) 46%, rgba(238, 245, 255, 0.98) 100%);
}

.settings-screen::before {
  content: "";
  position: fixed;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.08));
  backdrop-filter: blur(18px);
  pointer-events: none;
}

.settings-screen .wc-scene,
.settings-screen .wc-gradient-haze,
.settings-screen .wc-bubble-field,
.settings-screen .wc-particle-field,
.settings-screen .wc-cursor-trail {
  position: fixed;
}

.settings-screen-center {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 42px 28px;
  box-sizing: border-box;
}

.settings-screen-layout {
  position: relative;
  z-index: 1;
  width: min(100%, 1380px);
  display: grid;
  grid-template-columns: minmax(280px, 0.72fr) minmax(820px, 1.28fr);
  gap: 32px;
  align-items: start;
}

.settings-screen-copy {
  position: sticky;
  top: 30px;
  max-width: 430px;
  padding: 12px 4px 12px 6px;
}

.settings-screen-title {
  margin: 18px 0 0;
  font-family: "Inter", "Segoe UI", sans-serif;
  font-size: clamp(54px, 8vw, 96px);
  line-height: 0.92;
  letter-spacing: -0.06em;
  color: #ffffff;
  text-shadow: 0 14px 44px rgba(164, 157, 215, 0.28);
}

.settings-screen-hint {
  margin-top: 22px;
  padding: 16px 18px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.34);
  border: 1px solid rgba(255, 255, 255, 0.46);
  box-shadow: 0 18px 34px rgba(187, 176, 230, 0.14);
  color: #6f7896;
  line-height: 1.8;
  backdrop-filter: blur(18px);
}

.settings-screen-panel {
  position: relative;
  width: min(100%, 920px);
  justify-self: end;
  transform: translateX(clamp(0px, calc(100vw - 1280px), 400px));
  padding: 28px;
  border-radius: 34px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.76), rgba(255, 255, 255, 0.48));
  box-shadow:
    0 30px 72px rgba(176, 167, 225, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(28px) saturate(1.08);
  overflow: hidden;
}

.settings-screen-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.36), transparent 38%, rgba(255, 255, 255, 0.16) 100%);
  pointer-events: none;
}

.settings-screen-panel > * {
  position: relative;
  z-index: 1;
}

.settings-screen-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.settings-screen-panel-kicker {
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.8);
  color: #8490b2;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.settings-screen-panel-title {
  margin: 14px 0 0;
  font-size: 34px;
  line-height: 1.05;
  letter-spacing: -0.04em;
  color: #33405f;
}


.settings-screen-close-btn {

  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 18px;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.84);
  color: #66739a;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 16px 28px rgba(188, 176, 230, 0.14);
}

.settings-screen-close-btn:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.96);
}

.settings-screen-close-btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff9eca 0%, #c5a8ff 48%, #95cbff 100%);
  color: #fff;
  box-shadow: 0 10px 18px rgba(185, 166, 235, 0.24);
}

.settings-screen-card-grid {
  display: grid;
  gap: 18px;
}

.settings-screen .profile-card {
  margin-bottom: 0;
  padding: 24px;
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.82);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(246, 244, 255, 0.88));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 18px 40px rgba(188, 178, 228, 0.12);
}

.settings-screen .profile-header {
  margin-bottom: 16px;
  align-items: flex-start;
  gap: 12px;
}

.settings-screen .profile-fields {
  gap: 14px;
}

.settings-screen .profile-fields input,
.settings-screen .profile-fields select,
.settings-screen .profile-fields textarea,
.settings-screen .settings-picker-btn {
  min-height: 54px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  background: rgba(255, 255, 255, 0.82);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.86),
    0 10px 24px rgba(198, 192, 233, 0.08);
}

.settings-screen .profile-fields textarea {
  min-height: 136px;
  padding-top: 14px;
  padding-bottom: 14px;
}

.settings-screen .profile-fields input:focus,
.settings-screen .profile-fields select:focus,
.settings-screen .profile-fields textarea:focus {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 0 0 4px rgba(255, 188, 224, 0.18),
    0 16px 30px rgba(191, 183, 231, 0.14);
  transform: translateY(-1px);
}

.settings-screen .settings-help-text {
  font-size: 13px;
  line-height: 1.7;
}

.settings-static-value {
  display: flex;
  align-items: center;
  min-height: 54px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  background: rgba(255, 255, 255, 0.82);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.86),
    0 10px 24px rgba(198, 192, 233, 0.08);
  color: #4e5876;
  font-size: 14px;
  line-height: 1.7;
  word-break: break-word;
}

.settings-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.settings-action-row .secondary-btn {
  flex: 1 1 180px;
}

.settings-inline-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.settings-json-input {
  font-family: "Share Tech Mono", Consolas, monospace;
}

.settings-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.settings-switch-label {
  margin-bottom: 0;
}

.settings-switch-control {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.settings-switch-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.settings-switch-slider {
  position: relative;
  width: 54px;
  height: 32px;
  border-radius: 999px;
  background: rgba(207, 214, 234, 0.95);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.72);
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.settings-switch-slider::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 8px 18px rgba(126, 138, 178, 0.24);
  transition: transform 0.2s ease;
}

.settings-switch-input:checked + .settings-switch-slider {
  background: linear-gradient(135deg, #8b7cff, #5cc8ff);
}

.settings-switch-input:checked + .settings-switch-slider::after {
  transform: translateX(22px);
}

.settings-switch-input:focus-visible + .settings-switch-slider {
  outline: 2px solid rgba(99, 102, 241, 0.38);
  outline-offset: 2px;
}

.settings-switch-input:disabled + .settings-switch-slider {
  opacity: 0.6;
}

.settings-picker-btn {
  justify-content: center;
}

.settings-screen .profile-actions {
  margin-top: 18px;
  justify-content: flex-end;
}

.settings-screen .profile-actions .secondary-btn {
  flex: 0 0 auto;
  min-width: 180px;
  border-radius: 16px;
}

@media (max-width: 1160px) {
  .settings-screen-center {
    align-items: stretch;
    padding-top: 26px;
    padding-bottom: 26px;
  }

  .settings-screen-layout {
    grid-template-columns: 1fr;
  }

  .settings-screen-copy {
    position: static;
    max-width: none;
  }

    .settings-screen-panel {
    width: 100%;
    justify-self: stretch;
    transform: none;
  }

  .settings-screen-title {
    font-size: clamp(44px, 18vw, 86px);
  }
}

@media (max-width: 720px) {
  .settings-screen-center {
    padding: 16px;
  }

  .settings-screen-panel,
  .settings-screen .profile-card {
    padding: 20px;
    border-radius: 26px;
  }

  .settings-screen-panel-header {
    flex-direction: column;
  }

  .settings-screen-close-btn {
    width: 100%;
    justify-content: center;
  }

  .settings-inline-fields {
    grid-template-columns: 1fr;
  }

    .settings-screen .profile-actions .secondary-btn,
  .settings-action-row .secondary-btn {
    width: 100%;
  }
}

/* Share icon button (replaces export text button) */
.export-share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}
.export-share-btn:hover {
  border-color: #7c3aed;
  color: #7c3aed;
  background: #f5f3ff;
}
.export-share-btn:active {
  transform: scale(0.95);
}
.export-share-btn:disabled {
  opacity: 0.35;
  cursor: default;
}
.export-share-btn:disabled:hover {
  border-color: #e5e7eb;
  color: #6b7280;
  background: #fff;
}

/* Mobile: hamburger hidden by default, shown via media query */
.mobile-history-toggle { display: none; }

@media (max-width: 768px) {

  /* Hide header area */
  .workspace-heading { display: none !important; }

  /* Hide chat-header-bar (current conversation + export button) */
  .chat-header-bar { display: none !important; }

  /* App shell: fixed layout */
  .app-shell {
    display: flex !important;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    grid-template-columns: none !important;
    padding: 0 !important;
    gap: 0 !important;
    max-width: none;
    overflow: hidden;
  }

  /* History panel: slide-in overlay */
  .history-panel {
    position: fixed;
    top: 0; left: 0;
    width: min(320px, 80vw);
    height: 100vh; height: 100dvh;
    max-height: none; min-height: none;
    z-index: 9999;
    display: none;
    flex-direction: column;
    background: #fff;
    box-shadow: 4px 0 24px rgba(0,0,0,0.12);
    border-radius: 0;
    padding-top: 60px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .history-panel.open { display: flex; }

  /* Backdrop */
  .mobile-sidebar-backdrop {
    position: fixed; inset: 0; z-index: 9998;
    background: rgba(0,0,0,0.35);
    backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
    cursor: pointer;
  }
  .mobile-sidebar-backdrop[hidden] { display: none; }

  /* Hamburger: show on mobile */
  .mobile-history-toggle {
    display: flex;
    flex-direction: column; justify-content: center; align-items: center;
    gap: 5px; position: fixed; top: 14px; left: 14px; z-index: 9001;
    width: 42px; height: 42px; border: none; border-radius: 10px;
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 4px 14px rgba(0,0,0,0.10);
    cursor: pointer; padding: 0; transition: background 0.2s;
  }
  .mobile-history-toggle:active { background: rgba(255,255,255,0.65); }
  .mobile-history-toggle-bar {
    display: block; width: 20px; height: 2px; border-radius: 2px;
    background: #4e5b81; transition: transform 0.25s ease, opacity 0.25s ease;
  }
  .mobile-history-toggle[aria-expanded="true"] .mobile-history-toggle-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .mobile-history-toggle[aria-expanded="true"] .mobile-history-toggle-bar:nth-child(2) { opacity: 0; }
  .mobile-history-toggle[aria-expanded="true"] .mobile-history-toggle-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  /* Chat stage: fill remaining space */
  .chat-stage { display: block; flex: 1; min-height: 0; overflow: hidden; }

  /* Chat container */
  .chat-container {
    max-width: none; min-height: auto;
    height: 100%; max-height: none;
    border-radius: 0 !important; box-shadow: none !important;
    border: none !important;
    display: flex; flex-direction: column;
    overflow: hidden; padding: 10px 12px 0;
  }
  
  /* Chat box: scrollable */
  .chat-box {
    flex: 1 1 auto; min-height: 0; height: auto !important;
    padding: 10px 4px;
    border: none !important; border-radius: 0 !important;
    background-color: transparent !important; box-shadow: none !important;    
    background-image: var(--chat-bg-image, none);
    background-size: cover;
    background-position: center;
  }

  /* Input area: fixed bottom, relative for stop-btn overlay */
  /* Input area: compact single row (like Claude) */
  .input-area {
    flex-shrink: 0;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: flex-end;
    margin-top: 8px;
    padding: 8px 12px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
    border-radius: 20px; gap: 8px;
    position: relative;
  }
  #user-input { font-size: 16px !important; min-height: 44px; padding: 10px 14px; border-radius: 18px; flex: 1; min-width: 0; }
  #send-btn { min-width: 44px; min-height: 44px; width: 44px; height: 44px; padding: 0; border-radius: 50%; flex-shrink: 0; font-size: 14px; display: flex; align-items: center; justify-content: center; }
  .attachment-panel { display: none !important; }
  #user-input { font-size: 16px !important; min-height: 44px; padding: 10px 14px; border-radius: 18px; flex: 1; min-width: 0; }
  #send-btn, #stop-btn { min-width: 48px; min-height: 48px; padding: 10px 14px; border-radius: 14px; flex-shrink: 0; font-size: 14px; }

  /* Stop button: hidden by default, overlay send when AI generating */
  #stop-btn { display: none !important; }
  #stop-btn:not(:disabled) {
    display: flex !important;
    position: absolute; inset: 0; z-index: 2;
    border-radius: inherit; width: auto; height: auto;
  }
  #send-btn { position: relative; z-index: 1; }

  /* Top bar */
  .top-bar { flex-wrap: wrap; gap: 6px; padding: 8px 0; }
  .top-bar-actions { width: auto; }
  .settings-toggle-btn { padding: 8px 14px; min-width: auto; font-size: 13px; }
  .settings-toggle-btn-text { display: none; }
  h1 { font-size: 20px !important; }

  /* Attachment */
  .attachment-panel-toolbar { flex-direction: row; }
  .voice-input-btn { width: auto; }

  .scenario-selector-box { width: 95% !important; max-height: 90vh !important; padding: 14px !important; }
  .story-option-btn { padding: 12px 16px; font-size: 15px; min-height: 48px; }

  .workspace-reserved-panel { display: none !important; }

  .settings-screen-center { padding: 12px; }
  .settings-screen-panel { width: 100%; border-radius: 20px; padding: 18px; }
  .settings-inline-fields { grid-template-columns: 1fr; }
  .settings-screen .profile-fields input,
  .settings-screen .profile-fields select,
  .settings-screen .profile-fields textarea { min-height: 48px; }
}
/* TOS overlay */
#aivie-tos-overlay {
  position: fixed; inset: 0; z-index: 100000;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
#aivie-tos-overlay[hidden] { display: none; }
.aivie-tos-box {
  background: #1e1b2e; color: #e0dff0; border-radius: 16px;
  padding: 32px 36px; max-width: 520px; width: 90%;
  box-shadow: 0 8px 40px rgba(0,0,0,0.3);
}
.aivie-tos-box h3 { margin: 0 0 16px; font-size: 20px; font-weight: 700; }
.aivie-tos-box ul { margin: 0 0 20px; padding-left: 18px; line-height: 1.8; font-size: 14px; }
.aivie-tos-box ul li { margin-bottom: 4px; }
.aivie-tos-accept-btn {
  width: 100%; padding: 12px; border: none; border-radius: 10px;
  background: linear-gradient(135deg, #7c6aef, #c084fc);
  color: #fff; font-size: 15px; font-weight: 600; cursor: pointer;
  transition: opacity 0.2s;
}
.aivie-tos-accept-btn:hover { opacity: 0.9; }
.aivie-tos-close-btn {
  position: absolute; top: 12px; right: 16px; width: 32px; height: 32px;
  border: none; background: transparent; color: #999; font-size: 22px;
  cursor: pointer; line-height: 1; border-radius: 50%;
  transition: background 0.2s, color 0.2s;
}
.aivie-tos-close-btn:hover { background: rgba(255,255,255,0.1); color: #fff; }
.aivie-tos-box { position: relative; }

/* ── Voice Switch Disclaimer Overlay ── */
.voice-disclaimer-overlay {
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.voice-disclaimer-overlay[hidden] { display: none; }
.voice-disclaimer-box {
  position: relative;
  background: rgba(18, 18, 28, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 28px 32px;
  max-width: 420px;
  width: 90%;
  color: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(16px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}
.voice-disclaimer-box h3 {
  margin: 0 0 14px;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}
.voice-disclaimer-box ul {
  margin: 0 0 20px;
  padding-left: 18px;
  line-height: 1.75;
  font-size: 13px;
}
.voice-disclaimer-box ul li {
  margin-bottom: 6px;
}
.voice-disclaimer-accept-btn {
  display: block;
  width: 100%;
  padding: 10px 0;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #a78bfa 0%, #7c3aed 100%);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}
.voice-disclaimer-accept-btn:hover { opacity: 0.88; }
.voice-disclaimer-close-btn {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}
.voice-disclaimer-close-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.story-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

.story-option-btn {
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  border: none;
  border-bottom: 1px dashed #999;
  border-radius: 0;
  background: transparent;
  color: #1a1a2e;
  font-size: 14px;
  line-height: 1.5;
  cursor: pointer;
  transition: color 0.2s ease, border-bottom-color 0.2s ease;
}

.story-option-btn:hover {
  color: #7c3aed;
  border-bottom-color: #7c3aed;
}

.story-option-btn:active {
  opacity: 0.7;
}
.scenario-loading-hint { text-align: center; font-size: 14px; opacity: 0.5; padding: 20px 0; }

/* === Bubble chat animation === */
@keyframes bubbleFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.message.assistant {
  animation: bubbleFadeIn 0.3s ease-out both;
}

/* Compact spacing for consecutive assistant messages */
.message.assistant + .message.assistant {
  margin-top: 4px;
}

/* Single assistant message keeps normal spacing */
.message.assistant + .message.assistantEmoji,
.message.assistant + .message.user {
  margin-top: 16px;
}


.message-inner-wrapper {
  max-width: 100%; display: flex; flex-direction: column; gap: 8px; flex: 1; min-width: 0; }

/* === Chat Avatars === */
.chat-avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.message { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.message.ai-message {
  flex-direction: row; align-items: flex-start;max-width: 78%;
}
  .ai-message > .message-content {
  background: rgba(255, 255, 255, 0.45);
}
.message.user-message { flex-direction: row-reverse; align-items: flex-start; }
.message .avatar-col { flex-shrink: 0; padding-top: 4px; }
/* Hide duplicate avatars for consecutive same-side messages */
.message.ai-message + .message.ai-message .avatar-col { 
  visibility: hidden;
  width: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
}
/* User message right-aligned */
.message.user-message { justify-content: flex-end; }
/* Default gray user avatar placeholder */
.avatar-default { width: 36px; height: 36px; border-radius: 50%; background: #888; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 16px; flex-shrink: 0; }
/* Avatar upload in settings */
.avatar-upload-section { display: flex; align-items: center; gap: 12px; }
.avatar-upload-preview { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border-color, #ccc); }
.avatar-upload-placeholder { width: 48px; height: 48px; border-radius: 50%; background: #888; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 20px; }
.avatar-upload-actions { display: flex; gap: 8px; }
/* Mobile: smaller avatars */
@media (max-width: 768px) {
  .chat-avatar, .avatar-default { width: 28px; height: 28px; font-size: 14px; }
  .avatar-upload-preview, .avatar-upload-placeholder { width: 40px; height: 40px; }
}

.msg-time-divider {
  text-align: center;
  font-size: 12px;
  color: #999;
  padding: 12px 0 4px;
  user-select: none;
}

/* 剧情模式背景 */
.story-bg {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-size: contain;
  background-position: center;
  filter: blur(4px) brightness(0.7);
  z-index: -1;
  transition: opacity 0.8s ease;
}
.story-bg.hidden { opacity: 0; }

/* 故事模式：隐藏 UI chrome，只留聊天内容 */
body.story-mode-active .history-panel,
body.story-mode-active .chat-header-bar,
body.story-mode-active .workspace-heading,
body.story-mode-active .settings-toggle-btn,
body.story-mode-active .settings-panel,
body.story-mode-active .settings-overlay,
body.story-mode-active #mobile-history-toggle {
  display: none !important;
}
body.story-mode-active .chat-box {
  background: transparent;
}
body.story-mode-active .chat-container {
  background: transparent;
  box-shadow: none;
}
body.story-mode-active .app-shell {
  grid-template-columns: 1fr;
}

/* 聊天背景遮罩 — 保证文字可读 */
.chat-box.has-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  z-index: 0;
  pointer-events: none;
  border-radius: inherit;
}
.chat-box.has-bg > * {
  position: relative;
  z-index: 1;
}

/* 背景选择网格 */
.chat-bg-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.chat-bg-option {
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: 8px;
  border: 2px solid rgba(255,255,255,0.2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #999;
  background-size: cover;
  background-position: center;
  overflow: hidden;
  transition: border-color 0.2s;
}
.chat-bg-option:hover, .chat-bg-option.active {
  border-color: #a78bfa;
}
.chat-bg-option[data-bg="default"] {
  background: #fafafa;
  color: #666;
}
#chat-bg-layer {
  position: fixed;
  inset: 0;
  background-size: cover;
  background-position: center;
  z-index: -1;
  pointer-events: none;
}

/* Mobile: hide overflow sections, fix viewport */
@media (max-width: 768px) {
  html, body {
    overflow: hidden;
    height: 100%;
    height: 100dvh;
  }
  .workspace-reserved,
  .workspace-reserved-panel,
  .avatar-float-panel {
    display: none !important;
  }
  .app-shell-settings {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
  }
  .app-shell-settings.open {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .settings-panel {
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 0 !important;
  }
}

/* Account Card */
.account-card .account-info { display: flex; flex-direction: column; gap: 8px; }
.account-card .account-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px solid #f1f5f9; }
.account-card .account-label { font-size: 13px; color: #64748b; }
.account-card .account-value { font-size: 14px; color: #1e293b; font-weight: 500; }
.account-logout-btn { margin-top: 12px; padding: 10px 16px; background: #fee2e2; color: #dc2626; border: 1px solid #fecaca; border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 500; transition: background 0.2s; width: 100%; }
.account-logout-btn:hover { background: #fecaca; }
#account-status.profile-status { background: #dcfce7; color: #16a34a; }

/* Mobile: hide welcome page left side, show card only */
@media (max-width: 768px) {
  .wc-copy { display: none !important; }
  .wc-floating-tags { display: none !important; }
}

/* Regenerate button - matches copy-message-btn style */
.regen-btn {
  border: 1px solid rgba(167, 139, 250, 0.3);
  background-color: rgba(167, 139, 250, 0.1);
  color: #7c3aed;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.16s ease, transform 0.16s ease;
}
.regen-btn:hover {
  background-color: rgba(167, 139, 250, 0.25);
}
.regen-btn:active {
  transform: scale(0.96);
}

/* Message timestamp */
.message-time {
  font-size: 11px;
  color: #999;
  margin-top: 4px;
  text-align: right;
}

/* === Guestbook / 留言板 === */
.bamboo-leaf {
  position: absolute;
  top: -40px;
  width: 20px;
  height: 20px;
  background: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M17 8C8 10 5.9 16.17 3.82 21.34l1.89.66.95-2.3c.48.17.98.3 1.5.3 3 0 6.5-4 8-8' fill='%234a7c59' opacity='0.7'/></svg>");
  background-size: contain;
  animation: bambooFall linear infinite;
  pointer-events: none;
  opacity: 0.6;
}
@keyframes bambooFall {
  0% { transform: translateY(-40px) rotate(0deg); opacity: 0; }
  10% { opacity: 0.6; }
  100% { transform: translateY(110vh) rotate(360deg); opacity: 0; }
}
#light-spots::before, #light-spots::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}
#light-spots::before {
  width: 200px; height: 200px;
  top: 20%; left: 60%;
  background: radial-gradient(circle, rgba(255,255,200,0.3), transparent 70%);
  animation: lightPulse 5s ease-in-out infinite alternate;
}
#light-spots::after {
  width: 150px; height: 150px;
  top: 60%; left: 30%;
  background: radial-gradient(circle, rgba(200,230,255,0.25), transparent 70%);
  animation: lightPulse 7s ease-in-out infinite alternate-reverse;
}
@keyframes lightPulse {
  0% { transform: scale(0.8); opacity: 0.4; }
  100% { transform: scale(1.2); opacity: 0.8; }
}
.guestbook-card {
  position: relative;
  background: rgba(0,0,0,0.25);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 12px;
  color: #fff;
}
.guestbook-card .nickname {
  font-size: 13px;
  color: rgba(255,255,255,0.6);
  margin-bottom: 4px;
}
.guestbook-card .content {
  font-size: 15px;
  line-height: 1.6;
  color: #fff;
}
.guestbook-card .time {
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  margin-top: 6px;
}
.guestbook-card .delete-btn {
  float: right;
  background: none;
  border: none;
  color: rgba(255,255,255,0.3);
  cursor: pointer;
  font-size: 14px;
}
.guestbook-card .delete-btn:hover {
  color: #ff6b6b;
}
#guestbook-screen {
  opacity: 0;
  transition: opacity 0.6s ease;
}
#guestbook-screen.active {
  opacity: 1;
}

/* Guestbook send button */
#guestbook-send {
  padding: 12px 20px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: #222;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.3s ease;
}
#guestbook-send:hover {
  color: #7c3aed;
  text-shadow: 0 0 8px rgba(124,58,237,0.4);
}

.message-audio-bubble {
  min-width: 200px;
  background: transparent !important;
  box-shadow: none !important;
  padding: 4px 0 !important;
}