*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0a0a0f;
  --surface: rgba(18, 18, 28, 0.85);
  --border: rgba(255, 255, 255, 0.08);
  --text: #e8e4df;
  --text-muted: #8a8580;
  --accent: #c9a96e;
  --accent-dim: rgba(201, 169, 110, 0.15);
  --danger: #c45c5c;
  --radius: 16px;
  --font-serif: 'Noto Serif SC', 'ZCOOL XiaoWei', serif;
}

html, body {
  height: 100%;
}

body {
  font-family: var(--font-serif);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  overflow: hidden;
}

.noise {
  position: fixed;
  inset: 0;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

.glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
}

.glow-1 {
  width: 500px;
  height: 500px;
  background: rgba(201, 169, 110, 0.08);
  top: -150px;
  right: -100px;
}

.glow-2 {
  width: 400px;
  height: 400px;
  background: rgba(100, 80, 160, 0.06);
  bottom: -100px;
  left: -80px;
}

#app {
  position: relative;
  z-index: 1;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.screen {
  display: none;
  width: 100%;
  height: 100%;
  animation: fadeIn 0.5s ease;
}

.screen.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

#chat-screen.active {
  flex-direction: column;
  align-items: stretch;
  justify-content: stretch;
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 48px 40px;
  max-width: 520px;
  width: calc(100% - 32px);
  backdrop-filter: blur(20px);
  text-align: center;
}

.badge {
  display: inline-block;
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  color: var(--accent);
  border: 1px solid var(--accent-dim);
  background: var(--accent-dim);
  padding: 4px 14px;
  border-radius: 100px;
  margin-bottom: 28px;
}

h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 20px;
  line-height: 1.4;
}

h2 {
  font-size: 1.5rem;
  margin-bottom: 16px;
}

.lead {
  font-size: 1.05rem;
  color: var(--text);
  margin-bottom: 12px;
}

.sub {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 36px;
}

.decline-card p {
  color: var(--text-muted);
  margin-bottom: 28px;
}

.actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  font-family: var(--font-serif);
  font-size: 0.95rem;
  padding: 12px 32px;
  border-radius: 100px;
  border: none;
  cursor: pointer;
  transition: all 0.25s ease;
}

.btn-primary {
  background: var(--accent);
  color: #1a1510;
  font-weight: 600;
}

.btn-primary:hover {
  background: #dbb97e;
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(201, 169, 110, 0.25);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.2);
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0 12px;
  flex-shrink: 0;
}

.chat-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.btn-text {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-serif);
  font-size: 0.85rem;
  cursor: pointer;
  transition: color 0.2s;
}

.btn-text:hover {
  color: var(--danger);
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.message {
  max-width: 85%;
  padding: 14px 18px;
  border-radius: 14px;
  font-size: 0.95rem;
  line-height: 1.65;
  animation: msgIn 0.35s ease;
  white-space: pre-wrap;
  word-break: break-word;
}

@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.message.assistant:not(.report) {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.message.assistant.report {
  align-self: flex-start;
  max-width: 95%;
  border: 1px solid rgba(201, 169, 110, 0.35);
  background: rgba(201, 169, 110, 0.08);
  box-shadow: 0 8px 32px rgba(201, 169, 110, 0.12);
  border-bottom-left-radius: 4px;
}

.message.assistant.report::before {
  content: '✦ 心灵侧写报告';
  display: block;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 12px;
}


.message.user {
  align-self: flex-end;
  background: var(--accent-dim);
  border: 1px solid rgba(201, 169, 110, 0.2);
  border-bottom-right-radius: 4px;
}

.message.typing::after {
  content: '▋';
  animation: blink 0.8s step-end infinite;
  color: var(--accent);
}

@keyframes blink {
  50% { opacity: 0; }
}

.chat-input-area {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  padding: 12px 0 24px;
  flex-shrink: 0;
  border-top: 1px solid var(--border);
}

#user-input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 16px;
  color: var(--text);
  font-family: var(--font-serif);
  font-size: 0.95rem;
  resize: none;
  max-height: 120px;
  line-height: 1.5;
  transition: border-color 0.2s;
}

#user-input:focus {
  outline: none;
  border-color: rgba(201, 169, 110, 0.4);
}

#user-input::placeholder {
  color: var(--text-muted);
}

.btn-send {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: none;
  background: var(--accent);
  color: #1a1510;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
}

.btn-send:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.btn-send:not(:disabled):hover {
  background: #dbb97e;
  transform: scale(1.05);
}

.btn-send svg {
  width: 18px;
  height: 18px;
}

@media (max-width: 480px) {
  .card {
    padding: 36px 24px;
  }

  h1 {
    font-size: 1.45rem;
  }

  .actions {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }
}
