:root {
  --bg: #05060f;
  --bg-2: #0a0d1f;
  --panel: rgba(18, 22, 48, 0.55);
  --panel-solid: #0d1128;
  --line: rgba(0, 229, 255, 0.14);
  --line-strong: rgba(0, 229, 255, 0.32);
  --cyan: #00e5ff;
  --cyan-soft: #7df3ff;
  --violet: #8a54ff;
  --magenta: #ff40b4;
  --green: #39ffa0;
  --amber: #ffb340;
  --red: #ff5d6c;
  --text: #e8f0ff;
  --text-dim: #8b96b8;
  --text-faint: #55608a;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
  --glow-cyan: 0 0 24px rgba(0, 229, 255, 0.35);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Segoe UI", "Microsoft YaHei", sans-serif;
  --mono: "SF Mono", "JetBrains Mono", Consolas, monospace;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  overscroll-behavior: none;
}

#bg {
  position: fixed; inset: 0; z-index: -2;
  background:
    radial-gradient(1200px 700px at 85% -10%, rgba(138, 84, 255, 0.22), transparent 60%),
    radial-gradient(900px 600px at -10% 100%, rgba(0, 229, 255, 0.16), transparent 55%),
    radial-gradient(700px 500px at 50% 120%, rgba(255, 64, 180, 0.10), transparent 60%),
    linear-gradient(180deg, #05060f, #080a1a);
}
#bg::after {
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(0,229,255,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,229,255,0.035) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(circle at 50% 30%, #000 0%, transparent 75%);
  -webkit-mask-image: radial-gradient(circle at 50% 30%, #000 0%, transparent 75%);
}

.screen { min-height: 100dvh; }
.hidden { display: none !important; }

/* ============ 登录页 ============ */
.login-wrap {
  min-height: 100dvh; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 40px 24px calc(40px + env(safe-area-inset-bottom));
}
.login-logo { text-align: center; margin-bottom: 28px; }
.logo-orb {
  width: 88px; height: 88px; margin: 0 auto 18px; border-radius: 26px;
  background: linear-gradient(135deg, rgba(0,229,255,0.25), rgba(138,84,255,0.25));
  border: 1px solid var(--line-strong);
  box-shadow: var(--glow-cyan), inset 0 0 30px rgba(0,229,255,0.2);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 40px; font-weight: 700; color: var(--cyan);
  text-shadow: 0 0 18px var(--cyan);
  animation: float 5s ease-in-out infinite;
}
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.brand { font-family: var(--mono); font-size: 30px; letter-spacing: 8px; font-weight: 700;
  background: linear-gradient(90deg, var(--cyan), var(--violet), var(--magenta));
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-sub { color: var(--text-dim); margin-top: 6px; font-size: 14px; letter-spacing: 2px; }

.glass {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}
.login-card { width: 100%; max-width: 380px; padding: 24px; }
.login-tabs { display: flex; gap: 6px; margin-bottom: 20px; background: rgba(0,0,0,0.25); border-radius: 12px; padding: 4px; }
.tab { flex: 1; padding: 9px 0; border: none; background: transparent; color: var(--text-dim);
  font-size: 13px; border-radius: 9px; cursor: pointer; transition: .2s; }
.tab.active { background: linear-gradient(135deg, rgba(0,229,255,0.18), rgba(138,84,255,0.18));
  color: var(--cyan-soft); box-shadow: inset 0 0 0 1px var(--line-strong); }
.tab-panel { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field > span { font-size: 12px; color: var(--text-dim); letter-spacing: 1px; }
.field input {
  width: 100%; padding: 13px 14px; border-radius: var(--radius-sm);
  background: rgba(0,0,0,0.3); border: 1px solid var(--line); color: var(--text);
  font-size: 15px; outline: none; transition: .2s; font-family: var(--font);
}
.field input:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(0,229,255,0.12); }
.row { display: flex; gap: 10px; }
.row input { flex: 1; }
.hint { font-size: 12px; color: var(--text-faint); }
.guest-note { padding: 10px 0; color: var(--text-dim); font-size: 14px; }
.login-foot { margin-top: 20px; font-size: 12px; color: var(--text-faint); text-align: center; }

/* 微信登录 */
.wx-config { display: flex; flex-direction: column; gap: 12px; margin-top: 6px; }
.divider {
  display: flex; align-items: center; gap: 10px; margin: 4px 0; color: var(--text-faint); font-size: 12px;
}
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ============ 按钮 ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: var(--radius-sm); cursor: pointer;
  font-size: 14px; font-weight: 600; padding: 12px 18px; transition: .18s;
  font-family: var(--font); color: var(--text);
}
.btn.primary { background: linear-gradient(135deg, var(--cyan), var(--violet));
  color: #051018; box-shadow: 0 6px 24px rgba(0,229,255,0.3); }
.btn.primary:active { transform: scale(0.98); }
.btn.ghost { background: transparent; border: 1px solid var(--line-strong); color: var(--cyan-soft); }
.btn.small { padding: 8px 12px; font-size: 13px; }
.btn.full { width: 100%; margin-top: 6px; }
.btn.danger { background: rgba(255,93,108,0.15); border: 1px solid rgba(255,93,108,0.4); color: var(--red); }
.btn.block { width: 100%; }

/* ============ 主应用头部 ============ */
.app-header {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  padding: calc(12px + env(safe-area-inset-top)) 18px 12px;
  background: rgba(5,6,15,0.72);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.brand-mark {
  width: 38px; height: 38px; border-radius: 12px; flex: none;
  background: linear-gradient(135deg, rgba(0,229,255,0.2), rgba(138,84,255,0.2));
  border: 1px solid var(--line-strong); box-shadow: var(--glow-cyan);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-weight: 700; color: var(--cyan); font-size: 18px;
}
.header-mid { flex: 1; }
.today-date { font-size: 11px; color: var(--text-faint); font-family: var(--mono); letter-spacing: 1px; }
.hello { font-size: 16px; font-weight: 700; margin-top: 1px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--line);
  background: rgba(0,0,0,0.25); color: var(--text); font-size: 18px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

/* ============ 主内容 ============ */
.main { padding: 16px 16px calc(90px + env(safe-area-inset-bottom)); }
.view-title { font-size: 20px; font-weight: 700; margin: 4px 0 14px; display: flex; align-items: center; justify-content: space-between; }
.view-title .sub { font-size: 13px; color: var(--text-dim); font-weight: 400; }

/* ============ 底部导航 ============ */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; background: rgba(5,6,15,0.85);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar-item {
  flex: 1; padding: 9px 0 10px; background: none; border: none; cursor: pointer;
  color: var(--text-faint); display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 10.5px; transition: .2s;
}
.tabbar-item .ti { font-size: 19px; line-height: 1; }
.tabbar-item.active { color: var(--cyan); text-shadow: 0 0 14px rgba(0,229,255,0.7); }
.tabbar-item .ti { position: relative; }
.tabbar-item .ti .dot {
  position: absolute; top: -6px; right: -10px; min-width: 16px; height: 16px;
  border-radius: 9px; background: var(--red); color: #fff; font-size: 10px;
  font-family: var(--mono); display: flex; align-items: center; justify-content: center;
  padding: 0 4px; box-shadow: 0 0 8px rgba(255,93,108,0.7);
}

/* ============ 卡片 ============ */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); padding: 16px; }
.card + .card { margin-top: 12px; }
.card-h { font-size: 13px; color: var(--text-dim); letter-spacing: 1px; margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; }
.card-h b { color: var(--text); font-size: 14px; }

/* 数据条 */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat { padding: 14px; border-radius: var(--radius-sm); background: rgba(0,0,0,0.22); border: 1px solid var(--line); position: relative; overflow: hidden; }
.stat .n { font-family: var(--mono); font-size: 26px; font-weight: 700; }
.stat .l { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.stat.c { color: var(--cyan); } .stat.v { color: var(--violet); } .stat.m { color: var(--magenta); } .stat.g { color: var(--green); }
.stat::after { content: ""; position: absolute; right: -16px; top: -16px; width: 56px; height: 56px; border-radius: 50%; background: currentColor; opacity: 0.08; }

/* 列表 */
.item {
  display: flex; align-items: flex-start; gap: 12px; padding: 13px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05); cursor: pointer;
}
.item:last-child { border-bottom: none; }
.item-ic { width: 40px; height: 40px; border-radius: 12px; flex: none; display: flex; align-items: center; justify-content: center; font-size: 19px;
  background: rgba(0,0,0,0.28); border: 1px solid var(--line); }
.item-body { flex: 1; min-width: 0; }
.item-title { font-weight: 600; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-sub { font-size: 12.5px; color: var(--text-dim); margin-top: 3px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.item-meta { font-size: 11px; color: var(--text-faint); font-family: var(--mono); margin-top: 4px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.item-right { flex: none; text-align: right; }

/* 徽章 */
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 20px;
  font-size: 11px; font-weight: 600; border: 1px solid; white-space: nowrap; }
.tag.sticker { color: #ffd23f; border-color: rgba(255,210,63,0.4); background: rgba(255,210,63,0.1); }
.tag.wechat_article { color: var(--green); border-color: rgba(57,255,160,0.4); background: rgba(57,255,160,0.1); }
.tag.xiaohongshu { color: var(--red); border-color: rgba(255,93,108,0.4); background: rgba(255,93,108,0.1); }
.tag.douyin { color: var(--cyan); border-color: rgba(0,229,255,0.4); background: rgba(0,229,255,0.1); }
.tag.status-idea { color: var(--text-dim); border-color: rgba(139,150,184,0.35); background: rgba(139,150,184,0.08); }
.tag.status-editing { color: var(--amber); border-color: rgba(255,179,64,0.4); background: rgba(255,179,64,0.1); }
.tag.status-published { color: var(--green); border-color: rgba(57,255,160,0.4); background: rgba(57,255,160,0.1); }

/* 进度步骤 */
.steps { display: flex; flex-direction: column; gap: 0; }
.step { display: flex; gap: 12px; position: relative; padding-bottom: 18px; }
.step:last-child { padding-bottom: 0; }
.step::before { content: ""; position: absolute; left: 11px; top: 26px; bottom: 2px; width: 2px; background: var(--line); }
.step:last-child::before { display: none; }
.step-dot { width: 24px; height: 24px; border-radius: 50%; flex: none; border: 2px solid var(--line-strong);
  display: flex; align-items: center; justify-content: center; font-size: 12px; color: var(--text-faint); background: var(--bg); z-index: 1; }
.step.done .step-dot { background: var(--green); border-color: var(--green); color: #05220f; }
.step.active .step-dot { border-color: var(--cyan); color: var(--cyan); box-shadow: 0 0 12px rgba(0,229,255,0.5); }
.step-body { flex: 1; min-width: 0; }
.step-title { font-weight: 600; font-size: 14px; }
.step-note { font-size: 12px; color: var(--text-dim); margin-top: 3px; }
.step-action { margin-top: 8px; }

/* 空状态 */
.empty { text-align: center; padding: 40px 16px; color: var(--text-faint); }
.empty .big { font-size: 42px; opacity: 0.5; margin-bottom: 10px; }

/* 分段选择 */
.seg { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 14px; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { flex: none; padding: 7px 14px; border-radius: 20px; border: 1px solid var(--line);
  background: rgba(0,0,0,0.22); color: var(--text-dim); font-size: 13px; cursor: pointer; transition: .18s; font-family: var(--font); }
.seg button.active { color: var(--cyan); border-color: var(--cyan); background: rgba(0,229,255,0.1); box-shadow: 0 0 12px rgba(0,229,255,0.25); }

/* 浮动按钮 */
.fab {
  position: fixed; right: 20px; bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 25;
  width: 54px; height: 54px; border-radius: 18px; border: none; cursor: pointer;
  background: linear-gradient(135deg, var(--cyan), var(--violet)); color: #051018;
  font-size: 26px; box-shadow: 0 8px 28px rgba(0,229,255,0.4); display: flex; align-items: center; justify-content: center;
  transition: .18s;
}
.fab:active { transform: scale(0.94); }

/* ============ 弹层 ============ */
.modal-mask {
  position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,0.6);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade .2s ease;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  width: 100%; max-width: 560px; max-height: 90dvh; overflow-y: auto;
  background: #0b0f22; border: 1px solid var(--line-strong); border-radius: 22px 22px 0 0;
  padding: 22px 20px calc(24px + env(safe-area-inset-bottom)); box-shadow: 0 -10px 50px rgba(0,0,0,0.6);
  animation: up .25s ease;
}
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.modal-title { font-size: 17px; font-weight: 700; margin-bottom: 16px; }
.modal .field { margin-bottom: 13px; }
.modal textarea, .modal input, .modal select {
  width: 100%; padding: 12px 13px; border-radius: var(--radius-sm);
  background: rgba(0,0,0,0.3); border: 1px solid var(--line); color: var(--text);
  font-size: 14.5px; outline: none; font-family: var(--font); transition: .2s;
}
.modal textarea { min-height: 90px; resize: vertical; }
.modal textarea:focus, .modal input:focus, .modal select:focus { border-color: var(--cyan); }
.modal select option { background: #0b0f22; }
.modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.modal-actions .btn { flex: 1; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 6px 13px; border-radius: 18px; border: 1px solid var(--line); background: rgba(0,0,0,0.22);
  color: var(--text-dim); font-size: 12.5px; cursor: pointer; transition: .15s; font-family: var(--font); }
.chip.active { color: var(--cyan); border-color: var(--cyan); background: rgba(0,229,255,0.1); }

/* ============ Toast ============ */
#toast-root { position: fixed; left: 50%; bottom: calc(100px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { padding: 11px 18px; border-radius: 12px; background: rgba(11,15,34,0.95); border: 1px solid var(--line-strong);
  color: var(--text); font-size: 13.5px; box-shadow: var(--shadow); animation: up .25s ease; max-width: 86vw; }

/* 选题结果 */
.topic-card .angle { font-size: 13px; color: var(--cyan-soft); margin: 8px 0 6px; }
.topic-outline { list-style: none; display: flex; flex-direction: column; gap: 5px; margin: 8px 0; }
.topic-outline li { font-size: 13px; color: var(--text-dim); padding-left: 16px; position: relative; }
.topic-outline li::before { content: "▸"; position: absolute; left: 0; color: var(--violet); }
.topic-keywords { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.topic-keywords .kw { padding: 3px 9px; border-radius: 6px; font-size: 11.5px; background: rgba(138,84,255,0.15); color: #c9b0ff; border: 1px solid rgba(138,84,255,0.3); }
.typing { display: inline-flex; gap: 3px; align-items: center; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--cyan); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%,100% { opacity: .2; } 50% { opacity: 1; } }

/* 语音按钮 */
.voice-btn.recording { animation: pulse 1.2s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(255,93,108,0.5); } 50% { box-shadow: 0 0 0 14px rgba(255,93,108,0); } }

/* 登录头像圈 */
.avatar { width: 56px; height: 56px; border-radius: 50%; background: linear-gradient(135deg, var(--cyan), var(--violet));
  display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 700; color: #051018; margin: 0 auto 12px; }

/* ============ 热点 ============ */
.chip .heat {
  font-style: normal; margin-left: 3px; font-size: 10px; font-family: var(--mono);
  color: var(--amber); background: rgba(255,179,64,0.15); border-radius: 5px; padding: 0 4px;
}
.heat { color: var(--amber); font-family: var(--mono); }

/* ============ AI 助手对话 ============ */
.chat-card { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.chat-box {
  padding: 14px; display: flex; flex-direction: column; gap: 10px;
  min-height: 300px; max-height: 46vh; overflow-y: auto;
}
.msg { display: flex; }
.msg.me { justify-content: flex-end; }
.msg.ai { justify-content: flex-start; }
.bubble {
  max-width: 80%; padding: 10px 13px; border-radius: 14px; font-size: 14px;
  line-height: 1.55; word-break: break-word; white-space: pre-wrap;
}
.msg.me .bubble {
  background: linear-gradient(135deg, rgba(0,229,255,0.22), rgba(138,84,255,0.22));
  border: 1px solid var(--line-strong); color: var(--text);
  border-bottom-right-radius: 4px;
}
.msg.ai .bubble {
  background: rgba(0,0,0,0.3); border: 1px solid var(--line); color: var(--text);
  border-bottom-left-radius: 4px;
}
.chat-quick { padding: 8px 14px 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chat-inputbar {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px;
  border-top: 1px solid var(--line);
}
.chat-inputbar input {
  flex: 1; padding: 10px 13px; border-radius: 22px; background: rgba(0,0,0,0.3);
  border: 1px solid var(--line); color: var(--text); font-size: 14px; outline: none; font-family: var(--font);
}
.chat-inputbar input:focus { border-color: var(--cyan); }
.icon-btn.mic.recording { color: var(--red); border-color: var(--red); }
.icon-btn.tts { color: var(--text-faint); }
.icon-btn.tts.on { color: var(--cyan); border-color: var(--cyan); box-shadow: 0 0 10px rgba(0,229,255,0.3); }
.chat-actions { display: flex; align-items: center; gap: 10px; padding: 8px 14px 12px; }
