/* ==================== 全局 CSS 变量（冷色调神秘风） ==================== */
:root {
  /* 主背景：深蓝黑 */
  --bg:           #0a0e1a;
  --bg-card:      rgba(255,255,255,0.05);
  --bg-card-md:   rgba(255,255,255,0.09);
  --text:         #e8ecf8;
  --muted:        #8b92b0;
  --line:         rgba(255,255,255,0.07);
  
  /* 主色调：冷紫靛蓝（替代粉紫） */
  --pink:         #a78bfa;
  --pink-2:       #818cf8;
  --purple:       #7c6cf0;
  --gold:         #c4b5fd;
  --green:        #6ee7b7;
  --shadow-md:    0 12px 36px rgba(0,0,0,0.32);
  --radius-lg:    22px;
  --radius-md:    16px;
  --radius-sm:    10px;
  --nav-h:        70px;
  
  /* 冷紫渐变（用于按钮等） */
  --accent-start: #a78bfa;
  --accent-end:   #818cf8;
  --accent-glow:  rgba(129,140,248,0.3);
  
  /* iOS 安全区变量 */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

/* ==================== 基础重置 ==================== */
*, *::before, *::after { 
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
html {
  touch-action: manipulation;
}
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", sans-serif;
  background:
    radial-gradient(circle at top right,  rgba(129,140,248,.12), transparent 30%),
    radial-gradient(circle at top left,   rgba(167,139,250,.10), transparent 28%),
    radial-gradient(circle at 50% 80%,    rgba(99,102,241,.06), transparent 35%),
    linear-gradient(180deg, #0d1120 0%, #0a0e1a 100%);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: none;
}

/* ==================== 手机容器 ==================== */
.phone-shell {
  width: 100%;
  max-width: 430px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  background: rgba(8,10,20,0.75);
  backdrop-filter: blur(14px);
  position: relative;
  overflow: hidden;
  border-left:  1px solid rgba(255,255,255,.04);
  border-right: 1px solid rgba(255,255,255,.04);
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
}

/* ==================== 顶部栏 ==================== */
.page-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  padding: calc(14px + var(--safe-top)) 18px 12px;
  background: linear-gradient(180deg, rgba(10,14,26,.97), rgba(10,14,26,.70));
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  contain: layout style;
}
    .page-topbar h1 { margin: 0; font-size: 18px; font-weight: 700; }
    .page-topbar .subtitle { margin: 3px 0 0; color: var(--muted); font-size: 12px; }

/* ==================== 页面 / 路由 ==================== */
.page {
  display: none;
  padding: 16px 16px calc(var(--nav-h) + var(--safe-bottom) + 14px);
  animation: page-in .25s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}
.page.active { display: block; }
@keyframes page-in {
  from { opacity: 0; transform: translateY(20px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.page.exiting {
  animation: page-out .2s ease forwards;
}
@keyframes page-out {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(-10px); }
}

/* ==================== 底部导航 ==================== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  height: calc(var(--nav-h) + var(--safe-bottom));
  display: flex;
  align-items: flex-start;
  padding-top: 8px;
  padding-bottom: var(--safe-bottom);
  background: linear-gradient(180deg, rgba(10,14,26,0), rgba(10,14,26,.97) 30%);
  backdrop-filter: blur(14px);
  border-top: 1px solid rgba(255,255,255,.04);
  z-index: 40;
}
.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  color: var(--muted);
  font-size: 10px;
  user-select: none;
  transition: color .18s, transform .1s;
  padding: 8px 0;
  margin: -8px 0;
}
.nav-item:active { transform: scale(0.92); }
.nav-item .nav-icon { 
  font-size: 20px; 
  line-height: 1;
  transition: transform .2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.nav-item.active { 
  color: var(--pink); 
}
.nav-item.active .nav-icon {
  transform: scale(1.1);
}

    /* ==================== 通用卡片 ==================== */
    .card {
      background: var(--bg-card);
      border: 1px solid var(--line);
      border-radius: var(--radius-lg);
      overflow: hidden;
    }
    .section-title {
      margin: 22px 2px 12px;
      font-size: 15px;
      font-weight: 700;
      display: flex;
      justify-content: space-between;
      align-items: center;
    }
    .section-title .hint { color: var(--muted); font-size: 12px; font-weight: 400; }

    /* ==================== 按钮 ==================== */
.btn {
  border: none;
  border-radius: var(--radius-md);
  padding: 13px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s, transform .15s cubic-bezier(0.22, 1, 0.36, 1), box-shadow .2s;
  touch-action: manipulation;
  -webkit-touch-callout: none;
}
.btn:active:not(:disabled) { 
  opacity: .85; 
  transform: scale(0.96);
}
.btn:disabled { 
  opacity: .5; 
  cursor: not-allowed; 
  transform: none;
}
    .btn-primary {
      color: #fff;
      background: linear-gradient(135deg, var(--accent-start), var(--accent-end));
      box-shadow: 0 10px 24px var(--accent-glow);
    }
    .btn-ghost {
      color: var(--text);
      background: rgba(255,255,255,.06);
      border: 1px solid rgba(255,255,255,.08);
    }

    /* ============================================================
       PAGE: 首页（极简神秘风）
    ============================================================ */
    
    /* 隐藏首页顶栏 */
    #page-home .home-topbar-hidden {
      display: none;
    }
    
    /* 极简首页容器：垂直居中 */
    .home-minimal-container {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      min-height: calc(100vh - var(--nav-h) - var(--safe-bottom) - 32px);
      padding: 40px 24px;
      position: relative;
      text-align: center;
    }
    
    /* 背景星尘光效 */
    .home-glow {
      position: absolute;
      border-radius: 50%;
      pointer-events: none;
      filter: blur(80px);
    }
    .home-glow-1 {
      width: 200px;
      height: 200px;
      background: rgba(129,140,248,.08);
      top: 10%;
      left: 10%;
      animation: glow-drift 8s ease-in-out infinite alternate;
    }
    .home-glow-2 {
      width: 160px;
      height: 160px;
      background: rgba(167,139,250,.06);
      bottom: 15%;
      right: 10%;
      animation: glow-drift 10s ease-in-out infinite alternate-reverse;
    }
    @keyframes glow-drift {
      0%   { transform: translate(0, 0) scale(1); }
      100% { transform: translate(20px, -15px) scale(1.15); }
    }
    
    /* Logo 文字 */
    .home-logo {
      margin-bottom: 32px;
      animation: home-fadein 1s cubic-bezier(0.22, 1, 0.36, 1) both;
    }
    .home-logo-text {
      font-size: 48px;
      font-weight: 200;
      letter-spacing: 12px;
      text-transform: uppercase;
      background: linear-gradient(135deg, #e0e7ff 0%, #c4b5fd 50%, #818cf8 100%);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      background-clip: text;
    }
    
    /* 主文案 */
    .home-tagline {
      font-size: 16px;
      line-height: 1.8;
      color: rgba(232,236,248,.6);
      margin: 0 0 48px;
      letter-spacing: 2px;
      animation: home-fadein 1s cubic-bezier(0.22, 1, 0.36, 1) .15s both;
    }
    
    /* 按钮组 */
    .home-actions {
      display: flex;
      flex-direction: column;
      gap: 14px;
      width: 240px;
      animation: home-fadein 1s cubic-bezier(0.22, 1, 0.36, 1) .3s both;
    }
    
    .home-btn {
      width: 100%;
      padding: 14px 0;
      border-radius: 50px;
      font-size: 15px;
      font-weight: 500;
      cursor: pointer;
      transition: all .25s cubic-bezier(0.22, 1, 0.36, 1);
      letter-spacing: 2px;
      text-align: center;
      border: none;
      font-family: inherit;
    }
    .home-btn:active {
      transform: scale(0.96);
    }
    
    /* 描边按钮（选择角色） */
    .home-btn-outline {
      color: var(--pink);
      background: transparent;
      border: 1.5px solid rgba(167,139,250,.35);
      backdrop-filter: blur(4px);
    }
    .home-btn-outline:hover {
      border-color: rgba(167,139,250,.6);
      background: rgba(167,139,250,.08);
      box-shadow: 0 0 24px rgba(167,139,250,.15);
    }
    
    /* 实心按钮（开始聊天） */
    .home-btn-primary {
      color: #fff;
      background: linear-gradient(135deg, var(--accent-start), var(--accent-end));
      box-shadow: 0 8px 28px var(--accent-glow);
    }
    .home-btn-primary:hover {
      box-shadow: 0 12px 36px rgba(129,140,248,.4);
      transform: translateY(-1px);
    }
    
    /* 首页淡入动画 */
    @keyframes home-fadein {
      from { opacity: 0; transform: translateY(20px); }
      to   { opacity: 1; transform: translateY(0); }
    }

    /* ============================================================
       PAGE: 角色广场
    ============================================================ */
    .char-grid { display: flex; flex-direction: column; gap: 0; }
.char-card {
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: transform .25s cubic-bezier(0.22, 1, 0.36, 1), box-shadow .25s, border-color .2s;
  will-change: transform;
}
.char-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 48px rgba(0,0,0,.4);
  border-color: rgba(167,139,250,.3);
}
.char-card:active { 
  transform: scale(0.96) translateY(-2px);
  transition: transform .1s;
}
    .char-cover {
      height: 156px;
      background-size: cover;
      background-position: center top;
      position: relative;
      overflow: hidden;
    }
    .char-cover::after {
      content: "";
      position: absolute;
      inset: 0;
      background: linear-gradient(180deg, transparent 60%, rgba(0,0,0,.32));
      pointer-events: none;
    }
    .char-info .char-name {
      font-size: 15px;
      font-weight: 700;
      color: var(--text);
      display: flex;
      align-items: center;
      gap: 5px;
      margin-bottom: 4px;
    }
    .char-info .char-name small {
      font-size: 11px;
      font-weight: 400;
      color: var(--muted);
    }
    .char-bio {
      color: var(--muted);
      font-size: 12px;
      line-height: 1.55;
      min-height: 34px;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
      overflow: hidden;
      margin-top: 0;
    }
    .char-tags { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 9px; }
    .char-tag  {
      font-size: 11px;
      padding: 3px 8px;
      border-radius: 999px;
      background: rgba(255,255,255,.06);
      border: 1px solid rgba(255,255,255,.05);
      color: var(--text);
    }
    .char-tag.asset-tag {
      border-color: rgba(167,139,250,.18);
      background: rgba(167,139,250,.10);
      color: #d4c4fe;
    }
    .char-tag.warning-tag {
      border-color: rgba(196,181,253,.18);
      background: rgba(196,181,253,.10);
      color: var(--gold);
    }
    .free-badge {
      position: absolute;
      top: 10px;
      right: 10px;
      z-index: 2;
      font-size: 11px;
      padding: 3px 8px;
      border-radius: 999px;
      background: rgba(110,231,183,.15);
      color: var(--green);
      border: 1px solid rgba(110,231,183,.20);
    }

    /* ============================================================
       广场：卡类型分区标题 & 类型徽章
    ============================================================ */
    .square-section-header {
      display: flex;
      align-items: center;
      gap: 10px;
      margin: 22px 0 12px;
    }
    .square-section-header:first-child { margin-top: 4px; }
    .square-section-icon {
      font-size: 20px;
      line-height: 1;
    }
    .square-section-title {
      font-size: 15px;
      font-weight: 700;
      color: var(--text);
    }
    .square-section-desc {
      font-size: 12px;
      color: var(--muted);
      margin-left: auto;
    }
    .square-section-divider {
      height: 1px;
      background: linear-gradient(90deg, var(--line), transparent);
      margin-bottom: 12px;
    }
    .type-badge {
      position: absolute;
      top: 10px;
      left: 10px;
      z-index: 2;
      font-size: 11px;
      padding: 3px 8px;
      border-radius: 999px;
    }
    .type-badge.intimate {
      background: rgba(167,139,250,.18);
      color: #c4b5fd;
      border: 1px solid rgba(167,139,250,.28);
    }
    .type-badge.scenario {
      background: rgba(124,108,240,.20);
      color: #b8a9fe;
      border: 1px solid rgba(124,108,240,.30);
    }
    .type-badge.world {
      background: rgba(56,189,248,.14);
      color: #93d5f5;
      border: 1px solid rgba(56,189,248,.22);
    }
    .detail-type-row {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 10px 16px 0;
    }
    .detail-type-badge {
      font-size: 12px;
      padding: 4px 10px;
      border-radius: 999px;
      font-weight: 600;
    }
    .detail-type-badge.intimate { background:rgba(167,139,250,.14); color:#c4b5fd; border:1px solid rgba(167,139,250,.24); }
    .detail-type-badge.scenario { background:rgba(124,108,240,.16); color:#b8a9fe; border:1px solid rgba(124,108,240,.26); }
    .detail-type-badge.world    { background:rgba(56,189,248,.10); color:#93d5f5; border:1px solid rgba(56,189,248,.18); }

    /* ============================================================
       PAGE: 聊天页
    ============================================================ */
    #page-chat {
      padding: 0;
      display: none;
      flex-direction: column;
      height: 100vh;
    }
    #page-chat.active { display: flex; }

    .chat-topbar {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 12px 16px;
      background: linear-gradient(180deg, rgba(10,14,26,.97), rgba(10,14,26,.72));
      backdrop-filter: blur(14px);
      border-bottom: 1px solid var(--line);
      flex-shrink: 0;
    }
    .chat-back {
      width: 32px;
      height: 32px;
      display: grid;
      place-items: center;
      border-radius: 10px;
      background: rgba(255,255,255,.06);
      cursor: pointer;
      font-size: 15px;
      flex-shrink: 0;
      transition: background .15s;
    }
    .chat-back:active { background: rgba(255,255,255,.12); }
    .chat-avatar {
      width: 40px;
      height: 40px;
      border-radius: 13px;
      display: grid;
      place-items: center;
      font-weight: 700;
      font-size: 17px;
      flex-shrink: 0;
      background: linear-gradient(135deg, var(--purple), var(--pink));
      overflow: hidden;
    }
    .chat-avatar img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      object-position: center top;
      border-radius: 13px;
    }
    .chat-meta { flex: 1; min-width: 0; }
    .chat-meta .chat-name { font-size: 16px; font-weight: 700; }
    .chat-meta .chat-sign { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

    .online-dot {
      display: inline-block;
      width: 7px;
      height: 7px;
      border-radius: 50%;
      background: var(--green);
      margin-right: 4px;
      vertical-align: middle;
      box-shadow: 0 0 6px rgba(110,231,183,.5);
      animation: pulse-dot 2s infinite;
    }
    @keyframes pulse-dot {
      0%, 100% { opacity: 1; }
      50%       { opacity: .45; }
    }
    .chat-topbar-right { margin-left: auto; color: var(--muted); font-size: 20px; cursor: pointer; }

    .chat-messages {
      flex: 1;
      overflow-y: auto;
      padding: 14px 14px 8px;
      display: flex;
      flex-direction: column;
      gap: 4px;
    }
    .chat-messages::-webkit-scrollbar { width: 0; }

    .msg-row {
      display: flex;
      flex-direction: row;
      align-items: flex-start;
      gap: 8px;
      margin-bottom: 12px;
    }
    .msg-row.ai  { justify-content: flex-start; }
    .msg-row.user { justify-content: flex-end; }

    .msg-avatar {
      width: 36px;
      height: 36px;
      min-width: 36px;
      min-height: 36px;
      aspect-ratio: 1 / 1;
      border-radius: 10px;
      flex-shrink: 0;
      overflow: hidden;
      background: var(--bg-card-md);
      display: grid;
      place-items: center;
      font-size: 13px;
      font-weight: 700;
      color: var(--muted);
    }
    .msg-avatar img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      object-position: center top;
    }

    .msg-bubble {
      max-width: calc(100% - 40px);
      padding: 11px 14px;
      line-height: 1.75;
      font-size: 14px;
      border-radius: 18px;
      word-break: break-word;
    }
    .msg-bubble.ai {
      background: var(--bg-card-md);
      border: 1px solid var(--line);
      border-top-left-radius: 6px;
    }
    .msg-bubble.user {
      color: #fff;
      background: linear-gradient(135deg, var(--accent-start), var(--accent-end));
      border-top-right-radius: 6px;
    }

    .msg-body {
      display: flex;
      flex-direction: column;
      align-items: flex-start;
      max-width: calc(100% - 44px);
    }

.msg-row {
  animation: msg-in .25s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}
@keyframes msg-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to   { opacity: 1;  transform: translateY(0) scale(1); }
}

    .msg-time {
      display: block;
      text-align: center;
      font-size: 11px;
      color: rgba(139,146,176,.55);
      margin: 16px 0 8px;
      padding: 0;
    }

    .msg-bubble.typing {
      background: var(--bg-card-md);
      border: 1px solid var(--line);
      border-top-left-radius: 6px;
      padding: 13px 18px;
      display: flex;
      align-items: center;
      gap: 5px;
    }
    .typing-dot {
      width: 7px;
      height: 7px;
      border-radius: 50%;
      background: var(--muted);
      animation: typing-bounce .9s infinite;
    }
    .typing-dot:nth-child(2) { animation-delay: .15s; }
    .typing-dot:nth-child(3) { animation-delay: .30s; }
    @keyframes typing-bounce {
      0%, 80%, 100% { transform: translateY(0); opacity: .55; }
      40%           { transform: translateY(-5px); opacity: 1; }
    }

    .date-divider {
      text-align: center;
      font-size: 11px;
      color: rgba(139,146,176,.45);
      padding: 6px 0 10px;
      position: relative;
    }

.chat-composer {
  flex-shrink: 0;
  padding: 8px 12px calc(var(--nav-h) + var(--safe-bottom) + 2px);
  background: linear-gradient(180deg, rgba(10,14,26,0), rgba(10,14,26,.95) 30%);
  backdrop-filter: blur(10px);
  position: relative;
  z-index: 10;
}
    .composer-inner {
      display: flex;
      gap: 8px;
      align-items: flex-end;
      padding: 9px 10px 9px 14px;
      border: 1px solid rgba(255,255,255,.07);
      border-radius: var(--radius-lg);
      background: rgba(255,255,255,.04);
      transition: border-color .2s;
    }
    .composer-inner:focus-within {
      border-color: rgba(167,139,250,.3);
    }
.composer-input {
  flex: 1;
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
  outline: none;
  background: none;
  border: none;
  resize: none;
  min-height: 24px;
  max-height: 120px;
  font-family: inherit;
  -webkit-appearance: none;
  border-radius: 0;
  caret-color: var(--pink);
}
.composer-input::placeholder { 
  color: var(--muted);
  opacity: 0.7;
}
.composer-inner:focus-within {
  border-color: rgba(167,139,250,.4);
  box-shadow: 0 0 0 3px rgba(167,139,250,.08);
}
    .send-btn {
      width: 38px;
      height: 38px;
      border-radius: 12px;
      border: none;
      background: linear-gradient(135deg, var(--accent-start), var(--accent-end));
      color: #fff;
      font-size: 16px;
      cursor: pointer;
      flex-shrink: 0;
      display: grid;
      place-items: center;
      transition: opacity .15s, transform .1s;
      position: relative;
      overflow: hidden;
    }
    .send-btn:active:not(:disabled) { opacity: .75; transform: scale(.93); }
    .send-btn:disabled {
      opacity: .6;
      cursor: not-allowed;
      background: linear-gradient(135deg, var(--accent-start), var(--accent-end));
    }
    .send-btn.loading .send-icon { display: none; }
    .send-btn.loading::after {
      content: '';
      width: 18px;
      height: 18px;
      border: 2px solid rgba(255,255,255,.3);
      border-top-color: #fff;
      border-radius: 50%;
      animation: spin .7s linear infinite;
    }
    @keyframes spin { to { transform: rotate(360deg); } }

    .msg-bubble {
      -webkit-user-select: text;
      user-select: text;
    }
.copy-toast {
  position: fixed;
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 20px);
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: rgba(16,20,36,.92);
  color: var(--text);
  font-size: 13px;
  padding: 8px 18px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.08);
  backdrop-filter: blur(10px);
  z-index: 200;
  opacity: 0;
  transition: opacity .2s, transform .2s;
  pointer-events: none;
  white-space: nowrap;
}
    .copy-toast.show {
      opacity: 1;
      transform: translateX(-50%) translateY(0);
    }

.ui-toast {
  position: fixed;
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 16px);
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: rgba(16,20,36,.95);
  color: var(--text);
  font-size: 14px;
  padding: 10px 20px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.10);
  backdrop-filter: blur(12px);
  z-index: 210;
  opacity: 0;
  transition: opacity .22s ease, transform .22s ease;
  pointer-events: none;
  white-space: nowrap;
  max-width: min(320px, 90vw);
  text-align: center;
}
    .ui-toast.show {
      opacity: 1;
      transform: translateX(-50%) translateY(0);
    }
    .ui-toast.success { border-color: rgba(52,211,153,.30); }
    .ui-toast.error   { border-color: rgba(255,100,100,.30); color: #ff9090; }
    .ui-toast.warn    { border-color: rgba(251,191,36,.30);  color: #fcd34d; }

    .confirm-sheet {
      padding: 24px 20px 20px;
    }
    .confirm-title {
      font-size: 16px;
      font-weight: 600;
      color: var(--text);
      margin-bottom: 10px;
      line-height: 1.4;
    }
    .confirm-body {
      font-size: 14px;
      color: var(--muted);
      line-height: 1.6;
      margin-bottom: 20px;
      white-space: pre-wrap;
    }
    .btn.btn-danger {
      background: linear-gradient(135deg, #ef4444, #dc2626);
      color: #fff;
      border: none;
    }
    .btn.btn-danger:hover { opacity: .88; }

    .guest-trial-bar {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 10px 16px;
      background: rgba(129,140,248,.10);
      border-bottom: 1px solid rgba(129,140,248,.16);
      font-size: 12px;
      color: rgba(255,255,255,.7);
    }
    .guest-trial-bar .trial-copy {
      display: flex;
      flex-direction: column;
      gap: 2px;
      min-width: 88px;
    }
    .guest-trial-bar .trial-label {
      font-size: 11px;
      color: rgba(255,255,255,.58);
    }
    .guest-trial-bar .trial-status {
      font-weight: 600;
      color: var(--purple);
    }
    .guest-trial-bar .trial-status.ok { color: var(--purple); }
    .guest-trial-bar .trial-status.warning { color: var(--gold); }
    .guest-trial-bar .trial-status.exhausted { color: #ff9a9a; }
    .guest-trial-bar .trial-meter {
      flex: 1;
      min-width: 72px;
      height: 6px;
      border-radius: 999px;
      overflow: hidden;
      background: rgba(255,255,255,.10);
    }
    .guest-trial-bar .trial-meter span {
      display: block;
      height: 100%;
      border-radius: inherit;
      background: linear-gradient(90deg, var(--purple), var(--pink));
      transition: width .25s ease;
    }
    .guest-trial-bar .trial-login-btn {
      font-size: 12px;
      color: var(--purple);
      background: rgba(129,140,248,.15);
      border: 1px solid rgba(129,140,248,.25);
      border-radius: 999px;
      padding: 3px 12px;
      cursor: pointer;
      flex-shrink: 0;
    }

    .msg-bubble.error-bubble {
      background: rgba(255, 80, 80, .10);
      border: 1px solid rgba(255, 80, 80, .25);
      color: #ff8a8a;
      font-size: 13px;
      border-top-left-radius: 6px;
    }
    .retry-btn {
      display: inline-block;
      margin-top: 6px;
      font-size: 12px;
      padding: 3px 10px;
      border-radius: 999px;
      border: 1px solid rgba(167,139,250,.35);
      background: rgba(167,139,250,.10);
      color: var(--pink);
      cursor: pointer;
      transition: background .15s;
    }
    .retry-btn:hover { background: rgba(167,139,250,.18); }

    .chat-topbar-right {
      width: 34px;
      height: 34px;
      border-radius: 10px;
      border: 1px solid rgba(255,255,255,.07);
      background: rgba(255,255,255,.04);
      display: grid;
      place-items: center;
      font-size: 18px;
      color: var(--text);
      cursor: pointer;
      flex-shrink: 0;
      user-select: none;
      transition: background .15s, transform .15s;
    }
    .chat-topbar-right:active {
      background: rgba(255,255,255,.08);
      transform: scale(.96);
    }

    /* ── 关系状态栏 ──────────────────────────────────────────────── */
    .chat-state-bar {
      background: rgba(255,255,255,.03);
      border-bottom: 1px solid rgba(255,255,255,.06);
      padding: 7px 14px 8px;
      flex-shrink: 0;
    }
    .state-bar-inner {
      display: flex;
      align-items: center;
      gap: 10px;
    }
    .state-affection {
      display: flex;
      align-items: center;
      gap: 6px;
      flex: 1;
      min-width: 0;
    }
    .state-label {
      font-size: 10px;
      color: var(--muted);
      white-space: nowrap;
      letter-spacing: .5px;
    }
    .affection-bar-wrap {
      display: flex;
      align-items: center;
      gap: 5px;
      flex: 1;
      min-width: 0;
    }
    .affection-bar-bg {
      flex: 1;
      height: 5px;
      border-radius: 99px;
      background: rgba(255,255,255,.08);
      overflow: hidden;
    }
    .affection-bar-fill {
      height: 100%;
      border-radius: 99px;
      background: linear-gradient(90deg, var(--purple), var(--pink));
      transition: width .6s cubic-bezier(.22,1,.36,1);
    }
    .affection-value {
      font-size: 10px;
      color: var(--pink);
      font-variant-numeric: tabular-nums;
      min-width: 20px;
      text-align: right;
    }
    .affection-bar-fill.full {
      animation: affection-glow 1.6s ease-in-out infinite alternate;
    }
    @keyframes affection-glow {
      from { box-shadow: 0 0 4px rgba(167,139,250,.4); }
      to   { box-shadow: 0 0 12px rgba(167,139,250,.9), 0 0 4px rgba(129,140,248,.7); }
    }
    .state-pill {
      font-size: 10px;
      padding: 2px 8px;
      border-radius: 99px;
      white-space: nowrap;
      font-weight: 500;
      letter-spacing: .3px;
    }
    .state-phase {
      background: rgba(124,108,240,.15);
      color: #a89cfe;
      border: 1px solid rgba(124,108,240,.28);
    }
    .state-mood {
      background: rgba(167,139,250,.10);
      color: #c4b5fd;
      border: 1px solid rgba(167,139,250,.22);
    }
    .state-mood.mood-happy    { color:#c4b5fd; background:rgba(196,181,253,.12); border-color:rgba(196,181,253,.25); }
    .state-mood.mood-warm     { color:#b8a0f5; background:rgba(184,160,245,.12); border-color:rgba(184,160,245,.25); }
    .state-mood.mood-melting  { color:#d4c4fe; background:rgba(167,139,250,.15); border-color:rgba(167,139,250,.30); }
    .state-mood.mood-cold     { color:#80cfff; background:rgba(128,207,255,.10); border-color:rgba(128,207,255,.22); }
    .state-mood.mood-angry    { color:#ff8080; background:rgba(255,80,80,.10);   border-color:rgba(255,80,80,.22); }
    .state-mood.mood-sad      { color:#8b92b0; background:rgba(139,146,176,.10); border-color:rgba(139,146,176,.22); }
    .state-mood.mood-shy      { color:#c4b5fd; background:rgba(196,181,253,.10); border-color:rgba(196,181,253,.22); }
    .state-mood.mood-surprised{ color:#a8e6cf; background:rgba(168,230,207,.10); border-color:rgba(168,230,207,.22); }

    /* ── 角色状态面板 ───────────────────────── */
    .char-status-panel {
      background: rgba(255,255,255,.02);
      border-bottom: 1px solid rgba(255,255,255,.06);
      flex-shrink: 0;
      overflow: hidden;
    }
    .csp-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 6px 14px;
      cursor: pointer;
      user-select: none;
      transition: background .15s;
    }
    .csp-header:active { background: rgba(255,255,255,.04); }
    .csp-title {
      font-size: 11px;
      color: rgba(255,255,255,.40);
      letter-spacing: .5px;
    }
    .csp-arrow {
      font-size: 9px;
      color: rgba(255,255,255,.25);
      transition: transform .2s;
    }
    .csp-arrow.collapsed { transform: rotate(180deg); }
    .csp-body {
      padding: 0 14px 8px;
      display: flex;
      flex-wrap: wrap;
      gap: 6px 10px;
      max-height: 200px;
      overflow-y: auto;
      transition: max-height .25s ease, padding .25s ease;
    }
    .csp-body.collapsed {
      max-height: 0;
      padding-top: 0;
      padding-bottom: 0;
      overflow: hidden;
    }
    .csp-field {
      display: flex;
      align-items: flex-start;
      gap: 4px;
      font-size: 11px;
      line-height: 1.45;
      min-width: 0;
    }
    .csp-field.full-width { width: 100%; flex-direction: column; gap: 2px; }
    .csp-key {
      color: rgba(255,255,255,.35);
      white-space: nowrap;
      flex-shrink: 0;
    }
    .csp-val {
      color: rgba(255,255,255,.68);
      word-break: break-all;
    }
    .csp-field.mood .csp-val { color: #c4b5fd; }

    .chat-secondary-name {
      font-size: 11px;
      color: rgba(255,255,255,.45);
      margin-top: 2px;
      display: none;
    }
    .chat-secondary-name.show {
      display: block;
    }

    .wechat-menu-overlay {
      position: fixed;
      inset: 0;
      z-index: 160;
      background: transparent;
      opacity: 0;
      pointer-events: none;
      transition: opacity .16s;
    }
    .wechat-menu-overlay.open {
      opacity: 1;
      pointer-events: all;
    }
    .wechat-menu {
      position: absolute;
      top: calc(env(safe-area-inset-top, 0px) + 66px);
      right: 16px;
      width: 204px;
      background: rgba(16,20,36,.97);
      border: 1px solid rgba(255,255,255,.07);
      box-shadow: 0 18px 48px rgba(0,0,0,.36);
      border-radius: 16px;
      backdrop-filter: blur(16px);
      overflow: hidden;
      transform: translateY(-6px) scale(.98);
      transition: transform .18s ease, opacity .18s ease;
      opacity: 0;
    }
    .wechat-menu-overlay.open .wechat-menu {
      transform: translateY(0) scale(1);
      opacity: 1;
    }
    .wechat-menu::before {
      content: "";
      position: absolute;
      top: -6px;
      right: 14px;
      width: 12px;
      height: 12px;
      background: rgba(16,20,36,.97);
      border-top: 1px solid rgba(255,255,255,.07);
      border-left: 1px solid rgba(255,255,255,.07);
      transform: rotate(45deg);
    }
    .wechat-menu-group {
      padding: 6px 0;
    }
    .wechat-menu-group + .wechat-menu-group {
      border-top: 1px solid rgba(255,255,255,.05);
    }
    .wechat-menu-item {
      display: flex;
      align-items: center;
      gap: 10px;
      width: 100%;
      background: transparent;
      border: none;
      color: var(--text);
      text-align: left;
      padding: 13px 14px;
      font-size: 14px;
      cursor: pointer;
      transition: background .15s;
    }
    .wechat-menu-item:active {
      background: rgba(255,255,255,.05);
    }
    .wechat-menu-item.danger {
      color: #ff8d8d;
    }
    .wechat-menu-icon {
      width: 18px;
      text-align: center;
      flex-shrink: 0;
      opacity: .92;
    }

    .history-sheet {
      padding-bottom: 20px;
    }
    .history-list {
      display: flex;
      flex-direction: column;
      gap: 10px;
      max-height: 52vh;
      overflow-y: auto;
      margin-top: 4px;
    }
    .history-empty {
      font-size: 13px;
      color: var(--muted);
      line-height: 1.7;
      padding: 16px 0 6px;
    }
    .history-card {
      background: rgba(255,255,255,.04);
      border: 1px solid rgba(255,255,255,.05);
      border-radius: 16px;
      padding: 12px 14px;
    }
    .history-role {
      font-size: 12px;
      color: var(--pink);
      margin-bottom: 6px;
      font-weight: 600;
    }
    .history-role.user {
      color: var(--green);
    }
    .history-content {
      font-size: 14px;
      line-height: 1.7;
      color: var(--text);
      white-space: pre-wrap;
      word-break: break-word;
    }
    .history-time {
      margin-top: 8px;
      font-size: 11px;
      color: var(--muted);
    }

    .textarea-field {
      min-height: 92px;
      resize: none;
      line-height: 1.6;
    }

    /* ============================================================
       PAGE: 我的（冷色调）
    ============================================================ */
    .profile-header {
      display: flex;
      align-items: center;
      gap: 14px;
      padding: 18px;
      border-radius: var(--radius-lg);
      background: linear-gradient(135deg, rgba(167,139,250,.10), rgba(129,140,248,.08));
      border: 1px solid rgba(255,255,255,.06);
      margin-bottom: 6px;
    }
    .profile-avatar {
      width: 56px;
      height: 56px;
      min-width: 56px;
      min-height: 56px;
      max-width: 56px;
      max-height: 56px;
      aspect-ratio: 1 / 1;
      border-radius: 18px;
      background: linear-gradient(135deg, var(--purple), var(--pink));
      display: grid;
      place-items: center;
      font-size: 22px;
      font-weight: 700;
      flex-shrink: 0;
      overflow: hidden;
    }
    .profile-name { font-size: 17px; font-weight: 700; }
    .profile-sub  { font-size: 12px; color: var(--muted); margin-top: 3px; }

    .setting-card {
      background: var(--bg-card);
      border: 1px solid var(--line);
      border-radius: var(--radius-lg);
      overflow: hidden;
      margin-bottom: 12px;
    }
    .setting-row {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 15px 16px;
      border-bottom: 1px solid rgba(255,255,255,.04);
      cursor: pointer;
      transition: background .15s;
    }
    .setting-row:last-child { border-bottom: none; }
    .setting-row:active { background: rgba(255,255,255,.04); }
    .setting-row.static {
      cursor: default;
    }
    .setting-row.static:active {
      background: transparent;
    }
    .setting-row-icon { font-size: 18px; width: 26px; text-align: center; flex-shrink: 0; }
    .setting-row-text { flex: 1; }
    .setting-row-text .row-label { font-size: 14px; }
    .setting-row-text .row-hint  { font-size: 12px; color: var(--muted); margin-top: 2px; }
    .setting-row-arrow { color: var(--muted); font-size: 13px; }

    .auth-row {
      display: flex;
      gap: 10px;
      margin-bottom: 12px;
    }
    .auth-row .btn { flex: 1; }

    /* ============================================================
       弹窗：通用 Modal（登录弹窗 + 角色详情弹窗）
    ============================================================ */
    .modal-overlay {
      position: fixed;
      inset: 0;
      background: rgba(0,0,0,.65);
      z-index: 100;
      display: flex;
      align-items: flex-end;
      justify-content: center;
      backdrop-filter: blur(4px);
      opacity: 0;
      pointer-events: none;
      transition: opacity .22s;
    }
    .modal-overlay.open { opacity: 1; pointer-events: all; }
.modal-sheet {
  width: 100%;
  max-width: 430px;
  background: #0f0f1e;
  border-radius: 28px 28px 0 0;
  padding: 24px 22px calc(36px + var(--safe-bottom));
  border-top: 1px solid rgba(255,255,255,.07);
  transform: translateY(40px);
  transition: transform .26s cubic-bezier(0.22, 1, 0.36, 1);
  max-height: 90vh;
  max-height: 90dvh;
  overflow-y: auto;
  will-change: transform;
}
    .modal-overlay.open .modal-sheet { transform: translateY(0); }
    .modal-handle {
      width: 36px;
      height: 4px;
      border-radius: 2px;
      background: rgba(255,255,255,.12);
      margin: 0 auto 20px;
    }
    .modal-title { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
    .modal-sub   { font-size: 13px; color: var(--muted); margin-bottom: 22px; }
    
    /* 登录/注册 Tab 切换（冷色调） */
    .auth-tabs {
      display: flex;
      gap: 8px;
      margin-bottom: 20px;
      padding: 4px;
      background: rgba(255,255,255,0.04);
      border-radius: 12px;
    }
    .auth-tab {
      flex: 1;
      background: transparent;
      border: none;
      color: var(--muted);
      font-size: 14px;
      font-weight: 600;
      padding: 10px 0;
      cursor: pointer;
      transition: all .25s ease;
      font-family: inherit;
      border-radius: 10px;
      letter-spacing: 0.5px;
    }
    .auth-tab:hover {
      color: var(--text);
      background: rgba(255,255,255,0.04);
    }
    .auth-tab.active {
      color: #fff;
      background: linear-gradient(135deg, var(--accent-start) 0%, var(--accent-end) 100%);
      box-shadow: 0 4px 15px rgba(129,140,248,0.35);
    }
    
    /* 忘记密码链接（冷色调） */
    .forgot-password-link {
      font-size: 13px;
      color: var(--pink);
      text-decoration: none;
      opacity: 0.85;
      transition: opacity 0.2s;
    }
    .forgot-password-link:hover {
      opacity: 1;
    }
    
    .input-field {
      width: 100%;
      background: rgba(255,255,255,.05);
      border: 1px solid rgba(255,255,255,.08);
      border-radius: var(--radius-md);
      padding: 13px 14px;
      color: var(--text);
      font-size: 14px;
      outline: none;
      margin-bottom: 12px;
      font-family: inherit;
      transition: border-color .2s, box-shadow .2s;
    }
    .input-field::placeholder { color: var(--muted); }
    .input-field:focus {
      border-color: rgba(167,139,250,.4);
      box-shadow: 0 0 0 3px rgba(167,139,250,.08);
    }
    .modal-actions { display: flex; gap: 10px; margin-top: 6px; }
    .modal-actions .btn { flex: 1; }

    /* ============================================================
       角色详情弹窗专属样式
    ============================================================ */
    .char-detail-cover {
      height: 300px;
      border-radius: var(--radius-lg);
      background-size: cover;
      background-position: center top;
      display: flex;
      align-items: flex-end;
      padding: 20px;
      margin-bottom: 18px;
      position: relative;
      overflow: hidden;
    }
    .char-detail-cover::after {
      content: "";
      position: absolute;
      inset: 0;
      background: linear-gradient(180deg, transparent 20%, rgba(0,0,0,.45) 60%, rgba(0,0,0,.88));
    }
    .char-detail-cover-inner {
      position: relative;
      z-index: 1;
    }
    .char-detail-name {
      font-size: 26px;
      font-weight: 700;
      line-height: 1.2;
    }
    .char-detail-sign {
      font-size: 13px;
      color: rgba(255,255,255,.75);
      margin-top: 4px;
    }
    .char-detail-tags {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      margin-bottom: 14px;
    }
    .char-detail-tag {
      font-size: 12px;
      padding: 4px 10px;
      border-radius: 999px;
      background: rgba(167,139,250,.10);
      border: 1px solid rgba(167,139,250,.18);
      color: var(--pink);
    }
    .char-detail-section {
      margin-bottom: 16px;
    }
    .char-detail-section-title {
      font-size: 13px;
      color: var(--muted);
      font-weight: 600;
      margin-bottom: 7px;
      text-transform: uppercase;
      letter-spacing: .03em;
    }
    .char-detail-section p {
      font-size: 14px;
      line-height: 1.75;
      color: var(--text);
      margin: 0;
    }
    .char-detail-divider {
      height: 1px;
      background: var(--line);
      margin: 16px 0;
    }
    .char-detail-actions {
      display: flex;
      gap: 10px;
      margin-top: 20px;
    }
    .char-detail-actions .btn { flex: 1; padding: 15px; font-size: 15px; }

    .detail-opening-preview {
      background: var(--bg-card-md);
      border: 1px solid rgba(167,139,250,.15);
      border-radius: 16px;
      border-top-left-radius: 4px;
      padding: 14px 16px;
      font-size: 14px;
      line-height: 1.8;
      color: var(--text);
      position: relative;
    }
    .detail-opening-preview::before {
      content: "";
      position: absolute;
      top: -1px;
      left: -1px;
      right: -1px;
      bottom: -1px;
      border-radius: inherit;
      background: linear-gradient(135deg, rgba(167,139,250,.08), rgba(129,140,248,.06));
      pointer-events: none;
    }

    /* ============================================================
       广场：推荐横幅
    ============================================================ */
    .featured-banner-card {
      border-radius: var(--radius-lg);
      overflow: hidden;
      position: relative;
      height: 180px;
      cursor: pointer;
      transition: transform .22s, box-shadow .22s;
    }
    .featured-banner-card:hover {
      transform: translateY(-2px);
      box-shadow: 0 20px 48px rgba(0,0,0,.42);
    }
    .featured-banner-card:active { transform: scale(.98); }
    .featured-banner-bg {
      position: absolute;
      inset: 0;
      background-size: cover;
      background-position: center top;
    }
    .featured-banner-bg::after {
      content: "";
      position: absolute;
      inset: 0;
      background: linear-gradient(135deg, rgba(0,0,0,.15) 0%, transparent 40%),
                  linear-gradient(180deg, transparent 20%, rgba(0,0,0,.72) 80%);
    }
    .featured-banner-content {
      position: absolute;
      inset: 0;
      padding: 16px 18px 18px;
      display: flex;
      flex-direction: column;
      justify-content: flex-end;
      z-index: 1;
    }
    .featured-banner-label {
      display: inline-flex;
      align-items: center;
      gap: 5px;
      font-size: 11px;
      padding: 3px 10px;
      border-radius: 999px;
      background: rgba(167,139,250,.22);
      border: 1px solid rgba(167,139,250,.32);
      color: #d4c4fe;
      margin-bottom: 8px;
      width: fit-content;
      backdrop-filter: blur(4px);
    }
    .featured-banner-name {
      font-size: 22px;
      font-weight: 700;
      color: #fff;
      line-height: 1.2;
      text-shadow: 0 2px 12px rgba(0,0,0,.5);
    }
    .featured-banner-sub {
      font-size: 12px;
      color: rgba(255,255,255,.75);
      margin-top: 4px;
      line-height: 1.5;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
      overflow: hidden;
    }
    .featured-banner-btn {
      position: absolute;
      top: 14px;
      right: 14px;
      font-size: 12px;
      padding: 6px 14px;
      border-radius: 999px;
      border: 1px solid rgba(255,255,255,.3);
      background: rgba(255,255,255,.15);
      color: #fff;
      backdrop-filter: blur(8px);
      cursor: pointer;
      transition: background .15s;
    }
    .featured-banner-btn:hover { background: rgba(255,255,255,.25); }

    /* ============================================================
       广场：角色卡片视觉增强
    ============================================================ */
    .char-card:hover .char-cover::after {
      background: linear-gradient(180deg, transparent 50%, rgba(0,0,0,.42));
    }
    .char-online-hint {
      display: flex;
      align-items: center;
      gap: 4px;
      font-size: 11px;
      color: var(--green);
      margin-top: 6px;
    }

    .square-section-header {
      position: relative;
    }
    .square-section-header::after {
      content: "";
      position: absolute;
      bottom: -8px;
      left: 0;
      width: 32px;
      height: 2px;
      border-radius: 999px;
      background: linear-gradient(90deg, var(--pink), var(--purple));
    }

    .char-grid.single-section .square-section-header,
    .char-grid.single-section .square-section-divider {
      display: none;
    }

    /* ============================================================
       广场：可折叠手风琴分区
    ============================================================ */
    .square-accordion {
      margin-bottom: 10px;
      border-radius: var(--radius-lg);
      overflow: hidden;
      border: 1px solid rgba(255,255,255,.06);
      background: rgba(255,255,255,.02);
    }

    .accordion-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 14px 16px;
      cursor: pointer;
      position: relative;
      background: var(--gradient, transparent);
      transition: background .2s, opacity .2s;
      user-select: none;
      border-left: 3px solid var(--accent, var(--pink));
    }
    .accordion-header:active { opacity: .85; }
    .accordion-header:not(.collapsed) {
      border-bottom: 1px solid rgba(255,255,255,.05);
    }

    .accordion-header-left {
      display: flex;
      align-items: center;
      gap: 12px;
    }
    .accordion-icon {
      font-size: 22px;
      line-height: 1;
      filter: drop-shadow(0 0 6px var(--accent, var(--pink)));
    }
    .accordion-title-block {
      display: flex;
      flex-direction: column;
      gap: 2px;
    }
    .accordion-title {
      font-size: 15px;
      font-weight: 700;
      color: var(--text);
      line-height: 1.2;
    }
    .accordion-desc {
      font-size: 11px;
      color: var(--muted);
      line-height: 1.3;
    }

    .accordion-header-right {
      display: flex;
      align-items: center;
      gap: 8px;
    }
    .accordion-count {
      font-size: 12px;
      color: var(--muted);
      background: rgba(255,255,255,.06);
      border-radius: 999px;
      padding: 2px 9px;
    }
    .accordion-arrow {
      font-size: 11px;
      color: var(--muted);
      transition: transform .25s ease;
    }

    .accordion-body {
      overflow: hidden;
      max-height: 0;
      transition: max-height .35s ease, padding .25s ease;
      padding: 0 12px;
    }
    .accordion-body.open {
      max-height: 2000px;
      padding: 12px 12px 14px;
    }

    .accordion-cards-grid {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 12px;
    }

    /* ── 占卜分区 ───────────────────────────────────── */
    .divination-cover-icon {
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -60%);
      font-size: 46px;
      line-height: 1;
      filter: drop-shadow(0 4px 12px rgba(0,0,0,.5));
    }

    .coming-soon-badge {
      position: absolute;
      top: 10px;
      right: 10px;
      font-size: 10px;
      font-weight: 600;
      padding: 3px 8px;
      border-radius: 999px;
      background: rgba(196,181,253,.15);
      color: var(--gold);
      border: 1px solid rgba(196,181,253,.22);
      letter-spacing: .3px;
    }

    .divination-template {
      opacity: .88;
    }
    .divination-template:hover {
      opacity: 1;
    }

    .char-tag.divination-tag {
      background: rgba(56,189,248,.10);
      color: #93d5f5;
      border: 1px solid rgba(56,189,248,.18);
    }

    .type-badge.divination {
      background: rgba(110,231,183,.10);
      color: #a8ffe0;
      border: 1px solid rgba(110,231,183,.20);
    }

    /* ============================================================
       聊天页：消息气泡升级
    ============================================================ */
    .msg-bubble p { margin: 0; }
    .msg-bubble p + p { margin-top: 8px; }

    .msg-row.error-row { opacity: .9; }

    /* ============================================================
       剧情线选择弹窗
    ============================================================ */
    .greeting-select-sheet {
      max-height: 88vh;
      overflow-y: auto;
      padding-bottom: 24px;
    }

    .greeting-select-header {
      padding: 16px 20px 12px;
      border-bottom: 1px solid var(--line);
    }

    .greeting-select-title {
      font-size: 16px;
      font-weight: 700;
      color: var(--text);
      margin-bottom: 4px;
    }

    .greeting-select-desc {
      font-size: 12px;
      color: var(--muted);
      line-height: 1.5;
    }

    .greeting-list {
      padding: 10px 0 4px;
    }

    .greeting-item {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 14px 20px;
      cursor: pointer;
      border-bottom: 1px solid var(--line);
      transition: background .15s;
    }

    .greeting-item:last-child {
      border-bottom: none;
    }

    .greeting-item:active,
    .greeting-item:hover {
      background: rgba(255,255,255,.04);
    }

    .greeting-item-inner {
      flex: 1;
      min-width: 0;
    }

    .greeting-item-label {
      font-size: 14px;
      font-weight: 600;
      color: var(--pink);
      margin-bottom: 4px;
    }

    .greeting-item-preview {
      font-size: 12px;
      color: var(--muted);
      line-height: 1.55;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .greeting-item-arrow {
      font-size: 20px;
      color: var(--muted);
      flex-shrink: 0;
    }

/* ============================================================
   响应式适配
=========================================================== */

@media (max-width: 375px) {
  :root {
    --radius-lg: 18px;
    --radius-md: 14px;
  }
  .page { padding: 12px 12px calc(var(--nav-h) + var(--safe-bottom) + 12px); }
  .char-cover { height: 140px; }
  .msg-bubble { max-width: 85%; font-size: 15px; }
  .home-logo-text { font-size: 38px; letter-spacing: 8px; }
  .home-tagline { font-size: 15px; }
  .home-actions { width: 200px; }
  .accordion-header { padding: 12px 14px; }
  .accordion-title { font-size: 14px; }
}

@media (min-width: 414px) {
  .char-cover { height: 170px; }
  .msg-bubble { font-size: 15px; }
}

@media (max-height: 500px) and (orientation: landscape) {
  .phone-shell {
    max-width: 100%;
  }
  .page-topbar {
    padding-top: calc(8px + var(--safe-top));
  }
  .bottom-nav {
    height: calc(60px + var(--safe-bottom));
  }
  .chat-messages {
    padding: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================================
   Regenerate / Continue 操作按钮样式
=========================================================== */

.msg-action-btns {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  opacity: 0;
  transform: translateY(4px);
  transition: all 0.2s ease;
  justify-content: flex-start;
}

.msg-row.ai:hover .msg-action-btns,
.msg-row.ai:active .msg-action-btns {
  opacity: 1;
  transform: translateY(0);
}

/* 移动端：始终显示按钮（因为 hover 不适用） */
@media (max-width: 768px) {
  .msg-action-btns {
    opacity: 0.6;
    transform: translateY(0);
  }
  
  .msg-row.ai .msg-action-btns {
    opacity: 0.5;
  }
}

.msg-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.6);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  line-height: 1;
  padding: 0;
  flex-shrink: 0;
  position: relative;
}

.msg-action-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.9);
  transform: scale(1.1);
}

.msg-action-btn:active {
  transform: scale(0.95);
  background: rgba(255, 126, 182, 0.2);
  color: #ff7eb6;
}

.regenerate-btn {
  font-size: 20px !important;
  line-height: 0.5;
  padding-bottom: 4px;
}

.regenerate-btn:hover {
  background: rgba(138, 114, 255, 0.2);
  color: #8a72ff;
}

.continue-btn {
  font-size: 10px !important;
}

.continue-btn:hover {
  background: rgba(52, 211, 153, 0.2);
  color: #34d399;
}

/* 按钮加载状态 */
.msg-action-btn.loading {
  pointer-events: none;
  color: transparent !important;
}

.msg-action-btn.loading::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  margin: auto;
  width: 14px;
  height: 14px;
  border: 2px solid var(--pink);
  border-right-color: transparent;
  border-radius: 50%;
  animation: spinBtn 0.6s linear infinite;
}

@keyframes spinBtn {
  to { transform: rotate(360deg); }
}

/* 移动端优化：增大触摸区域 */
@media (max-width: 768px) {
  .msg-action-btn {
    width: 32px;
    height: 32px;
    font-size: 16px;
  }
  
  .msg-action-btns {
    gap: 8px;
    margin-top: 8px;
  }
}
