:root {
  --bg: #0b0c10;
  --surface: #14161d;
  --surface-2: #1c1f29;
  --border: rgba(255, 255, 255, 0.08);
  --text: #f3f4f6;
  --muted: #9ca3af;
  --accent: #f59e0b;
  --accent-soft: rgba(245, 158, 11, 0.14);
  --danger: #ef4444;
  --radius: 24px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  overflow: hidden;
  overscroll-behavior: none;
}

.hidden {
  display: none !important;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 520px;
  margin: 0 auto;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.6);
}

.brand-name {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--text);
}

.counter {
  font-size: 12px;
  color: var(--muted);
  margin-left: 4px;
  font-variant-numeric: tabular-nums;
}

.topbar-actions {
  display: flex;
  gap: 8px;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.icon-btn:active {
  transform: scale(0.94);
  color: var(--text);
}

.progress-track {
  height: 2px;
  background: rgba(255, 255, 255, 0.06);
  margin: 0 20px;
  border-radius: 99px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.25s ease;
}

.stage {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px 18px 10px;
  min-height: 0;
}

.card-stack {
  position: relative;
  width: 100%;
  height: 100%;
  max-height: 560px;
}

.feed-card {
  position: absolute;
  inset: 0;
  background: linear-gradient(165deg, #171a23 0%, #11131a 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px 24px 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  touch-action: none;
  user-select: none;
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.28s ease;
  will-change: transform;
}

.feed-card.dragging {
  transition: none;
}

.feed-card.behind {
  transform: scale(0.95) translateY(14px);
  opacity: 0.45;
  pointer-events: none;
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.source-pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--accent-soft);
  color: var(--accent);
  max-width: 78%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.origin-link {
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  white-space: nowrap;
}

.card-main {
  margin: auto 0;
  padding: 16px 0;
}

.card-hook {
  margin: 0 0 22px;
  font-size: clamp(22px, 6vw, 27px);
  line-height: 1.42;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #ffffff;
}

.card-question {
  margin: 0;
  font-size: 16px;
  line-height: 1.6;
  color: #fcd34d;
  padding-left: 14px;
  border-left: 3px solid var(--accent);
}

.card-hint {
  font-size: 12px;
  color: rgba(156, 163, 175, 0.65);
  display: flex;
  justify-content: space-between;
}

.dock {
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  gap: 12px;
  padding: 10px 18px 18px;
}

.btn {
  border: none;
  border-radius: 16px;
  padding: 15px 18px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.12s ease, opacity 0.15s ease;
}

.btn:active {
  transform: scale(0.96);
}

.btn-skip {
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--border);
}

.btn-chat, .btn-primary {
  background: var(--accent);
  color: #11131a;
}

.empty-state {
  text-align: center;
  padding: 32px 24px;
}

.empty-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 99px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  margin-bottom: 14px;
}

.empty-state h2 {
  margin: 0 0 10px;
  font-size: 20px;
}

.empty-state p {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

/* 展开聊抽屉 */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 40;
}

.chat-drawer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-width: 520px;
  margin: 0 auto;
  height: 86dvh;
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-radius: 24px 24px 0 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -16px 40px rgba(0, 0, 0, 0.6);
}

.drawer-handle {
  width: 38px;
  height: 4px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.18);
  margin: 10px auto 4px;
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 18px 12px;
  border-bottom: 1px solid var(--border);
}

.drawer-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.digest-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 16px;
  font-size: 13.5px;
  line-height: 1.65;
  color: #d1d5db;
}

.digest-box summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 6px;
}

.digest-hook {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 8px;
}

.msg {
  max-width: 88%;
  padding: 11px 14px;
  border-radius: 16px;
  font-size: 14.5px;
  line-height: 1.62;
  white-space: pre-wrap;
  word-break: break-word;
}

.msg.user {
  align-self: flex-end;
  background: var(--accent);
  color: #11131a;
  font-weight: 500;
  border-bottom-right-radius: 4px;
}

.msg.assistant {
  align-self: flex-start;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.quick-prompts {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px 18px 4px;
  scrollbar-width: none;
}

.quick-prompts::-webkit-scrollbar {
  display: none;
}

.chip {
  flex-shrink: 0;
  background: var(--surface-2);
  color: #e5e7eb;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12.5px;
  cursor: pointer;
}

.chat-form {
  display: flex;
  gap: 8px;
  padding: 10px 18px 14px;
  border-top: 1px solid var(--border);
}

.chat-form input {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  color: var(--text);
  font-size: 15px;
  outline: none;
}

.chat-form input:focus {
  border-color: var(--accent);
}

.send-btn {
  background: var(--accent);
  color: #11131a;
  border: none;
  border-radius: 14px;
  padding: 0 18px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.send-btn:disabled {
  opacity: 0.45;
}
