/* ── 人物对话 · 选择页 ── */

#screen-dialogue {
  background:
    radial-gradient(ellipse at 30% 10%, rgba(70, 20, 10, 0.4) 0%, transparent 50%),
    linear-gradient(180deg, #12080a 0%, #0e0608 100%);
}

#screen-dialogue .page-lead {
  color: rgba(201, 168, 76, 0.55);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-align: center;
  font-style: italic;
  padding: 8px 0 12px;
  border-bottom: 1px solid rgba(201, 168, 76, 0.1);
  margin-bottom: 14px;
}

#screen-dialogue #dialogue-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 80px;
}

#screen-dialogue .dialogue-card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  margin: 0;
  background: linear-gradient(135deg, rgba(28, 16, 10, 0.95) 0%, rgba(16, 10, 6, 0.98) 100%);
  border: 1px solid color-mix(in srgb, var(--dlg-accent, #d4af37) 32%, transparent);
  border-radius: 16px;
  padding: 16px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

#screen-dialogue .dialogue-card::after {
  content: '✦';
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 20px;
  color: color-mix(in srgb, var(--dlg-accent, #d4af37) 18%, transparent);
  pointer-events: none;
}

#screen-dialogue .dialogue-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, transparent, var(--dlg-accent, #d4af37), transparent);
  pointer-events: none;
}

#screen-dialogue .dialogue-card:active {
  transform: scale(0.99);
  border-color: color-mix(in srgb, var(--dlg-accent, #d4af37) 50%, transparent);
  box-shadow: 0 0 20px color-mix(in srgb, var(--dlg-accent, #d4af37) 15%, transparent);
}

#screen-dialogue .dialogue-card-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid color-mix(in srgb, var(--dlg-accent, #d4af37) 55%, transparent);
  box-shadow:
    0 0 12px color-mix(in srgb, var(--dlg-accent, #d4af37) 35%, transparent),
    0 0 0 1px rgba(0, 0, 0, 0.25),
    0 4px 16px rgba(0, 0, 0, 0.5);
}

#screen-dialogue .dialogue-card-avatar.ring-anna,
#screen-dialogue .dialogue-card-avatar.ring-levin,
#screen-dialogue .dialogue-card-avatar.ring-neutral {
  box-shadow:
    0 0 12px color-mix(in srgb, var(--dlg-accent, #d4af37) 35%, transparent),
    0 0 0 1px rgba(0, 0, 0, 0.25),
    0 4px 16px rgba(0, 0, 0, 0.5);
}

#screen-dialogue .dialogue-card__body {
  flex: 1;
  min-width: 0;
  padding-right: 20px;
}

#screen-dialogue .dialogue-card__name {
  font-family: 'Noto Serif SC', serif;
  font-size: 15px;
  font-weight: 700;
  color: #e8d5b7;
  letter-spacing: 0.04em;
  margin: 0;
  line-height: 1.35;
}

#screen-dialogue .dialogue-card__role {
  font-size: 11px;
  color: rgba(201, 168, 76, 0.5);
  font-style: italic;
  letter-spacing: 0.03em;
  margin: 4px 0 0;
  line-height: 1.4;
}

#screen-dialogue .dialogue-card__chevron {
  flex-shrink: 0;
  font-size: 18px;
  color: rgba(201, 168, 76, 0.35);
  line-height: 1;
  margin-right: 4px;
}

/* ── 人物对话 · 聊天页 ── */

.dialogue-screen.screen {
  background: transparent;
}

.dialogue-screen {
  overflow: hidden;
  background-color: #1a0f1e;
}

.dialogue-screen.scene-anna {
  background-color: #1c0810;
  background-image:
    repeating-linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.012) 0,
      rgba(255, 255, 255, 0.012) 1px,
      transparent 1px,
      transparent 5px
    ),
    radial-gradient(ellipse 55% 45% at 88% 8%, rgba(255, 160, 60, 0.14) 0%, transparent 55%),
    radial-gradient(ellipse 80% 60% at 50% 100%, rgba(60, 10, 20, 0.5) 0%, transparent 55%),
    linear-gradient(175deg, #1c0810 0%, #240810 45%, #180608 100%);
}

.dialogue-screen.scene-levin {
  background-color: #101808;
  background-image:
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.01) 0,
      rgba(255, 255, 255, 0.01) 2px,
      transparent 2px,
      transparent 8px
    ),
    radial-gradient(ellipse 70% 50% at 20% 90%, rgba(80, 60, 30, 0.25) 0%, transparent 50%),
    radial-gradient(ellipse 60% 40% at 80% 20%, rgba(40, 70, 30, 0.18) 0%, transparent 50%),
    linear-gradient(165deg, #0e1408 0%, #162010 40%, #1a1810 100%);
}

.dialogue-screen.scene-salon {
  background-color: #1a0f1e;
  background-image:
    repeating-linear-gradient(
      45deg,
      rgba(201, 168, 76, 0.02) 0,
      rgba(201, 168, 76, 0.02) 1px,
      transparent 1px,
      transparent 6px
    ),
    linear-gradient(180deg, #1a0f1e 0%, #221018 100%);
}

.dialogue-candle-glow {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  height: 220px;
  pointer-events: none;
  z-index: 1;
  background: radial-gradient(ellipse at 50% 0%, rgba(201, 120, 30, 0.12) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.dialogue-screen.scene-anna .dialogue-candle-glow {
  opacity: 1;
}

.dialogue-particles {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
  opacity: 0.55;
}

.dialogue-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(20, 10, 16, 0.72) !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom-color: rgba(201, 168, 76, 0.12) !important;
}

.dialogue-body {
  position: relative;
  z-index: 6;
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - 56px);
  padding: 12px 14px max(16px, env(safe-area-inset-bottom));
}

/* 角色信息栏 */
.dlg-header {
  background: linear-gradient(180deg, rgba(15, 8, 4, 0.97) 0%, rgba(20, 10, 6, 0.85) 100%);
  border-bottom: 1px solid rgba(201, 168, 76, 0.15);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
  margin: -12px -14px 12px;
  flex-shrink: 0;
}

.dlg-header::after {
  content: '';
  display: block;
  position: absolute;
  bottom: 0;
  left: 10%;
  right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(201, 168, 76, 0.35), transparent);
}

.dlg-portrait {
  width: 56px;
  height: 68px;
  border-radius: 12px;
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid rgba(201, 168, 76, 0.4);
  box-shadow:
    0 0 0 4px rgba(201, 168, 76, 0.1),
    inset 0 0 20px rgba(0, 0, 0, 0.3),
    0 8px 24px rgba(0, 0, 0, 0.6);
}

.dlg-header__name {
  font-family: 'Noto Serif SC', serif;
  font-size: 18px;
  font-weight: 700;
  color: #f0e6d3;
  letter-spacing: 0.05em;
  line-height: 1.3;
  margin: 0;
}

.dlg-stamp {
  display: inline-flex;
  margin-top: 6px;
  background: rgba(201, 168, 76, 0.1);
  border: 1px solid rgba(201, 168, 76, 0.2);
  border-radius: 4px;
  padding: 2px 10px;
  font-size: 11px;
  color: rgba(201, 168, 76, 0.7);
  font-style: italic;
  letter-spacing: 0.04em;
  transform: none;
  box-shadow: none;
}

/* 聊天区域 + 角花 */
.dlg-chat-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  margin-bottom: 12px;
  padding: 14px 10px;
  border-radius: 16px;
  border: 1px solid rgba(201, 168, 76, 0.1);
  background: rgba(0, 0, 0, 0.18);
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.25);
}

.dlg-corner {
  position: absolute;
  width: 70px;
  height: 70px;
  z-index: 2;
  pointer-events: none;
  color: rgba(201, 168, 76, 0.35);
  filter: drop-shadow(0 0 3px rgba(201, 168, 76, 0.2));
}

.dlg-corner--tl { top: 4px; left: 4px; }
.dlg-corner--tr { top: 4px; right: 4px; transform: scaleX(-1); }
.dlg-corner--bl { bottom: 4px; left: 4px; transform: scaleY(-1); }
.dlg-corner--br { bottom: 4px; right: 4px; transform: scale(-1, -1); }

.dlg-msgs {
  position: relative;
  z-index: 1;
  max-height: 46vh;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  background: transparent;
  padding: 16px;
}

/* 对话气泡 */
.chat-row {
  display: flex;
  margin-bottom: 12px;
}

.chat-row--ai {
  justify-content: flex-start;
}

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

.chat-bubble {
  position: relative;
  max-width: 88%;
  font-family: 'Noto Serif SC', Georgia, serif;
}

.chat-ai {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 14px 16px;
  background: linear-gradient(145deg, rgba(28, 18, 10, 0.92), rgba(18, 12, 6, 0.96));
  border: 1px solid rgba(201, 168, 76, 0.15);
  border-radius: 0 14px 14px 14px;
  font-family: 'Noto Serif SC', serif;
  font-size: 14px;
  line-height: 2;
  color: #c8b89a;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.chat-ai::before {
  content: '';
  position: absolute;
  left: 0;
  top: 20%;
  bottom: 20%;
  width: 2px;
  background: linear-gradient(180deg, transparent, rgba(201, 168, 76, 0.5), transparent);
  border-radius: 2px;
}

.chat-ai__avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  margin-top: 2px;
  border: 1.5px solid rgba(201, 168, 76, 0.45);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.chat-ai__text {
  margin: 0;
  flex: 1;
  min-width: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-ai__text::after {
  content: '';
  display: inline-block;
  width: 2px;
  height: 1em;
  margin-left: 1px;
  vertical-align: text-bottom;
  background: rgba(201, 168, 76, 0.7);
  animation: dlg-cursor 0.85s step-end infinite;
}

.chat-ai--done .chat-ai__text::after {
  display: none;
}

.chat-ai--typing .chat-ai__text::after {
  animation: dlg-cursor 0.6s step-end infinite;
}

@keyframes dlg-cursor {
  50% { opacity: 0; }
}

.chat-user {
  padding: 12px 16px;
  background: linear-gradient(145deg, rgba(60, 20, 20, 0.7), rgba(40, 12, 12, 0.8));
  border: 1px solid rgba(139, 26, 26, 0.25);
  border-radius: 14px 0 14px 14px;
  color: #f0d8d8;
  font-size: 14px;
  line-height: 1.75;
  white-space: pre-wrap;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.chat-ai--loading .chat-ai__text {
  letter-spacing: 0.2em;
  opacity: 0.6;
}

/* 建议问题 · 卷轴信封 */
.dlg-hints {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 16px;
  margin-bottom: 4px;
}

.hint-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  background: linear-gradient(135deg, rgba(28, 18, 10, 0.9), rgba(20, 12, 6, 0.95));
  border: 1px solid rgba(201, 168, 76, 0.25);
  border-radius: 8px;
  padding: 8px 14px;
  font-family: 'Noto Serif SC', serif;
  font-size: 12px;
  color: #d4b483;
  letter-spacing: 0.03em;
  cursor: pointer;
  text-align: left;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.hint-chip::before {
  content: '❧';
  margin-right: 6px;
  color: rgba(201, 168, 76, 0.5);
  font-size: 10px;
  flex-shrink: 0;
}

@media (hover: hover) {
  .hint-chip:hover {
    background: rgba(201, 168, 76, 0.1);
    border-color: rgba(201, 168, 76, 0.5);
    transform: translateY(-1px);
  }
}

.hint-chip:focus-visible {
  background: rgba(201, 168, 76, 0.1);
  border-color: rgba(201, 168, 76, 0.5);
  outline: none;
}

.hint-chip:active {
  transform: scale(0.98);
}

/* 输入区 */
.dlg-form {
  display: flex;
  gap: 10px;
  align-items: stretch;
  background: linear-gradient(180deg, rgba(10, 6, 4, 0) 0%, rgba(10, 6, 4, 0.95) 100%);
  padding: 12px 16px;
  border-top: 1px solid rgba(201, 168, 76, 0.12);
  margin: 0 -14px -16px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}

.dlg-input {
  flex: 1;
  min-height: 48px;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid rgba(201, 168, 76, 0.25);
  background: rgba(25, 15, 8, 0.9);
  color: #e8d5b7;
  font-size: 14px;
  font-family: 'Noto Serif SC', serif;
  caret-color: #c9a84c;
  outline: none;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.dlg-input::placeholder {
  color: rgba(201, 168, 76, 0.35);
}

.dlg-input:focus {
  border-color: rgba(201, 168, 76, 0.5);
  box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.08);
  outline: none;
}

.dlg-send {
  flex: 0 0 auto;
  min-height: 48px;
  padding: 12px 20px;
  border: 1px solid rgba(185, 28, 28, 0.6);
  border-radius: 12px;
  background: linear-gradient(135deg, #7a1515, #991b1b);
  color: #fecaca;
  font-size: 14px;
  font-weight: 600;
  font-family: 'Noto Serif SC', serif;
  letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(139, 26, 26, 0.3);
  transition: box-shadow 0.2s ease, transform 0.15s ease, background 0.2s ease;
}

@media (hover: hover) {
  .dlg-send:hover {
    background: linear-gradient(135deg, #991b1b, #b91c1c);
  }
}

.dlg-send:active {
  transform: scale(0.96);
}

@media (prefers-reduced-motion: reduce) {
  .chat-ai__text::after {
    display: none !important;
  }

  .hint-chip:hover {
    transform: none;
  }
}
