/* =========================================================
   星际私语 · 网站版
   深空主题（由小程序 wxss 转化：750rpx 设计稿 → px，1rpx≈0.5px）
   桌面端居中窄栏，移动端全屏
   ========================================================= */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  background: radial-gradient(1200px 800px at 50% -10%, #1a1e4d 0%, #0e1129 60%);
  color: #e8e9f5;
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Helvetica Neue', 'Microsoft YaHei', sans-serif;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

button {
  font-family: inherit;
  border: none;
  background: none;
  color: inherit;
  cursor: pointer;
}

input {
  font-family: inherit;
}

/* 通用卡片 */
.card {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
}

/* ===== 视图容器（桌面居中窄栏） ===== */
.view {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-width: 720px;
  margin: 0 auto;
  background: linear-gradient(180deg, #101233 0%, #141838 42%, #0e1129 100%);
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}
/* display:flex 会覆盖 hidden 属性，必须显式隐藏 */
.view[hidden],
.confirm-mask[hidden] {
  display: none !important;
}

/* ===== 导航栏 ===== */
.nav {
  flex-shrink: 0;
  background: rgba(16, 18, 51, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.nav-inner {
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 15px;
}
.nav-title {
  font-size: 18px;
  font-weight: 600;
  color: #fff;
  letter-spacing: 1px;
}
.nav-more {
  color: rgba(255, 255, 255, 0.55);
  font-size: 20px;
  font-weight: 700;
  padding: 5px 10px;
  letter-spacing: 2px;
  line-height: 1;
}
.nav-placeholder {
  visibility: hidden;
}
.nav-back {
  color: #fff;
  font-size: 28px;
  line-height: 1;
  padding: 5px 10px;
  font-weight: 300;
}

/* ===== 角色卡片 ===== */
.hero {
  flex-shrink: 0;
  margin: 10px 15px 0;
  padding: 16px 18px;
  border-radius: 14px;
  position: relative;
  background: linear-gradient(135deg, rgba(124, 108, 255, 0.35) 0%, rgba(91, 140, 255, 0.22) 55%, rgba(58, 60, 128, 0.35) 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);

}
.hero::after {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  width: 75px;
  height: 75px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.14) 0%, transparent 70%);
  pointer-events: none;
}
.hero-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 19px;
  font-weight: 700;
  color: #fff;
}
.hero-title-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
}
.hero-sub {
  margin-top: 5px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.65);
}
.persona-menu {
  position: absolute;
  right: 14px;
  bottom: 13px;
  z-index: 20;
}
.hero-persona {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.18);
}
.hero-persona-name {
  font-size: 12px;
  color: #fff;
}
.hero-persona-arrow {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
}
.persona-dropdown {
  position: absolute;
  top: calc(100% + 7px);
  right: 0;
  width: 280px;
  padding: 8px;
  border-radius: 12px;
  background: #1b1f45;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}
.persona-item {
  display: flex;
  align-items: center;
  padding: 10px 11px;
  border-radius: 8px;
  cursor: pointer;
}
.persona-item:hover {
  background: rgba(255, 255, 255, 0.08);
}
.persona-item.active {
  background: rgba(124, 108, 255, 0.18);
}
.persona-item-emoji {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  background: linear-gradient(135deg, rgba(124, 108, 255, 0.35), rgba(91, 140, 255, 0.22));
}
.persona-item-info {
  flex: 1;
  margin-left: 10px;
  min-width: 0;
}
.persona-item-name {
  display: block;
  font-size: 16px;
  color: #fff;
  font-weight: 500;
}
.persona-item-desc {
  display: block;
  margin-top: 3px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.5);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.persona-item-check {
  flex-shrink: 0;
  margin-left: 6px;
  font-size: 15px;
  color: #7c6cff;
  font-weight: 700;
}

/* ===== AI 生成提示 ===== */
.ai-notice {
  flex-shrink: 0;
  margin: 8px 15px 0;
  text-align: center;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.35);
}

/* ===== 对话流 ===== */
.msg-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.msg-scroll::-webkit-scrollbar {
  width: 0;
  height: 0;
}
.msg-list {
  padding: 12px 15px 15px;
}
.msg-row {
  display: flex;
  margin-bottom: 14px;
}
.row-ai {
  justify-content: flex-start;
}
.row-user {
  justify-content: flex-end;
}
.avatar {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-right: 8px;
}
.avatar-ai {
  background: linear-gradient(135deg, rgba(124, 108, 255, 0.5), rgba(91, 140, 255, 0.35));
  border: 1px solid rgba(255, 255, 255, 0.2);
}
.msg-col {
  display: flex;
  flex-direction: column;
  max-width: 78%;
}
.row-user .msg-col {
  align-items: flex-end;
}
.bubble {
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 15px;
  line-height: 1.6;
  word-break: break-word;
}
.bubble-ai {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #eef0ff;
  border-top-left-radius: 4px;
}
.bubble-user {
  background: linear-gradient(135deg, #7c6cff 0%, #5b8cff 100%);
  color: #fff;
  border-top-right-radius: 4px;
}
.bubble-text {
  white-space: pre-wrap;
}
.bubble-tag {
  margin-top: 5px;
  align-self: flex-start;
}
.row-user .bubble-tag {
  align-self: flex-end;
}
.bubble-tag-text {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.4);
}
.typing {
  padding: 5px 20px 15px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.45);
}

/* ===== 快捷提问 ===== */
.chips {
  flex-shrink: 0;
  padding-bottom: 6px;
}
.chips-inner {
  display: flex;
  gap: 8px;
  padding: 0 15px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.chips-inner::-webkit-scrollbar {
  display: none;
}
.chip {
  flex-shrink: 0;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  white-space: nowrap;
}
.chip:active {
  background: rgba(255, 255, 255, 0.16);
}

/* ===== 输入栏 ===== */
.input-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  background: rgba(16, 18, 51, 0.95);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.input-wrap {
  flex: 1;
  min-height: 42px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  padding: 8px 16px;
}
.input {
  width: 100%;
  height: 22px;
  line-height: 22px;
  font-size: 15px;
  color: #fff;
  background: transparent;
  border: none;
  outline: none;
}
.input::placeholder {
  color: rgba(255, 255, 255, 0.35);
}
.voice-btn,
.send-btn {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.voice-btn:active {
  background: rgba(255, 255, 255, 0.2);
}
.voice-btn.speeching {
  background: rgba(255, 80, 80, 0.25);
  border-color: rgba(255, 80, 80, 0.6);
  animation: voice-pulse 1.2s ease-out infinite;
}
.voice-btn.speeching .voice-icon,
.voice-btn.speeching {
  color: #ff5a5a;
}
.send-btn {
  font-size: 16px;
  color: rgba(255, 255, 255, 0.35);
  transition: all 0.2s;
}
.send-btn-on {
  background: linear-gradient(135deg, #7c6cff 0%, #5b8cff 100%);
  color: #fff;
}
@keyframes voice-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 80, 80, 0.45);
  }
  100% {
    box-shadow: 0 0 0 8px rgba(255, 80, 80, 0);
  }
}

/* ===== 关于页 ===== */
.about-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 15px 30px;
  -webkit-overflow-scrolling: touch;
}
.brand {
  text-align: center;
  padding: 25px 0 20px;
}
.brand-logo {
  font-size: 55px;
  line-height: 1;
}
.brand-name {
  margin-top: 10px;
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 2px;
}
.brand-slogan {
  margin-top: 6px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.6);
}
.brand-version {
  margin-top: 8px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.35);
}
.section {
  margin-top: 15px;
}
.section-title {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 8px;
  padding-left: 3px;
}
.persona-list,
.menu {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  overflow: hidden;
}
.persona {
  display: flex;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.persona:last-child {
  border-bottom: none;
}
.persona-emoji {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  background: linear-gradient(135deg, rgba(124, 108, 255, 0.4), rgba(91, 140, 255, 0.25));
}
.persona-info {
  margin-left: 10px;
}
.persona-name {
  font-size: 15px;
  color: #fff;
  font-weight: 600;
}
.persona-desc {
  margin-top: 3px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.55);
}
.menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 14px;
  font-size: 15px;
  color: #eef0ff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  text-align: left;
}
.menu-item:last-child {
  border-bottom: none;
}
.menu-item:active {
  background: rgba(255, 255, 255, 0.06);
}
.menu-item-danger > span:first-child {
  color: #ff8080;
}
.menu-arrow {
  color: rgba(255, 255, 255, 0.35);
  font-size: 20px;
}
.disclaimer {
  margin-top: 20px;
  padding: 14px 15px;
  font-size: 11px;
  line-height: 1.8;
  color: rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 10px;
}
.disclaimer em {
  color: rgba(255, 255, 255, 0.55);
  font-style: normal;
}

/* ===== 协议页 ===== */
.tabs {
  flex-shrink: 0;
  display: flex;
  margin: 10px 15px 0;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  padding: 3px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.tab {
  flex: 1;
  text-align: center;
  padding: 8px 0;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.6);
  border-radius: 999px;
}
.tab-on {
  background: linear-gradient(135deg, #7c6cff 0%, #5b8cff 100%);
  color: #fff;
  font-weight: 600;
}
.content {
  flex: 1;
  min-height: 0;
  margin-top: 10px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.doc {
  padding: 15px 17px 30px;
}
.doc-title {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}
.doc-date {
  margin: 6px 0 12px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
}
.doc-p {
  margin-top: 10px;
  font-size: 13px;
  line-height: 1.75;
  color: rgba(255, 255, 255, 0.75);
}
.doc-body {
  color: rgba(255, 255, 255, 0.6);
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  left: 50%;
  bottom: 120px;
  transform: translateX(-50%);
  max-width: 80vw;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(30, 34, 74, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 13px;
  text-align: center;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
  z-index: 999;
}
.toast-show {
  opacity: 1;
}

/* ===== Confirm ===== */
.confirm-mask {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  z-index: 1000;
}
.confirm-box {
  width: 300px;
  max-width: 84vw;
  border-radius: 16px;
  background: #1b1f45;
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 22px 20px 0;
  box-shadow: 0 16px 60px rgba(0, 0, 0, 0.5);
}
.confirm-title {
  font-size: 17px;
  font-weight: 600;
  color: #fff;
  text-align: center;
}
.confirm-content {
  margin-top: 10px;
  font-size: 13px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.65);
  text-align: center;
}
.confirm-actions {
  display: flex;
  margin-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.confirm-btn {
  flex: 1;
  padding: 13px 0;
  font-size: 15px;
  color: #fff;
  text-align: center;
}
.confirm-btn + .confirm-btn {
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}
.confirm-danger {
  color: #ff8080;
}

/* ===== 桌面端微调 ===== */
@media (min-width: 768px) {
  .view {
    height: 100vh;
    height: 100dvh;
  }
  .msg-list {
    padding: 16px 24px;
  }
  .bubble {
    font-size: 15px;
  }
  .persona-dropdown {
    width: 300px;
  }
}
