/* styles.css — 移动端优先，深色质感 */

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

:root {
  --bg: #0a0a0c;
  --bg-elev: #16161a;
  --bg-elev-2: #1f1f24;
  --line: #2a2a30;
  --text: #f5f5f7;
  --text-dim: #a0a0a8;
  --text-mute: #65656c;
  --accent: #ffd600;       /* 主色：金黄（谈判主题感） */
  --accent-2: #ff9500;
  --good: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow: 0 8px 24px rgba(0,0,0,0.4);
  --pad: 20px;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.55;
  overflow-x: hidden;
}

body {
  max-width: 480px;
  margin: 0 auto;
  position: relative;
  min-height: 100vh;
  background: linear-gradient(180deg, #0a0a0c 0%, #11111a 100%);
}

/* ============ Topbar ============ */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px var(--pad);
  background: rgba(10,10,12,0.85);
  backdrop-filter: saturate(150%) blur(18px);
  -webkit-backdrop-filter: saturate(150%) blur(18px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; }
.brand-logo {
  width: 28px; height: 28px;
  background: var(--accent); color: #000;
  border-radius: 8px;
  font-weight: 800; font-size: 13px;
  display: grid; place-items: center;
  letter-spacing: -0.5px;
}
.brand-name { font-weight: 600; font-size: 15px; }
.topbar-actions { display: flex; gap: 4px; }
.icon-btn {
  width: 36px; height: 36px;
  background: transparent; border: none;
  color: var(--text-dim);
  font-size: 18px;
  border-radius: 10px;
  cursor: pointer;
}
.icon-btn:active { background: var(--bg-elev); }

/* ============ Page system ============ */
.page {
  display: none;
  padding: 20px var(--pad) 80px;
  min-height: calc(100vh - 56px);
  animation: fadeIn .25s ease;
}
.page.active { display: block; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.back-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 15px;
  padding: 4px 0;
  cursor: pointer;
  margin-bottom: 16px;
}
.back-btn.small { font-size: 22px; padding: 0 8px; }

.page-title {
  font-size: 24px; font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: -0.5px;
}
.page-sub {
  color: var(--text-dim);
  font-size: 14px;
  margin-bottom: 24px;
}

/* ============ Hero ============ */
.hero {
  padding: 32px 4px 20px;
}
.hero-tag {
  display: inline-block;
  background: var(--bg-elev);
  color: var(--accent);
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 16px;
  letter-spacing: 0.5px;
}
.hero-title {
  font-size: 38px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -1.5px;
  margin-bottom: 14px;
}
.hl {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-sub {
  color: var(--text-dim);
  font-size: 15px;
  margin-bottom: 28px;
}

.cta-btn {
  display: inline-block;
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .12s, opacity .2s;
  font-family: inherit;
}
.cta-btn:active { transform: scale(0.98); }
.cta-btn.primary {
  background: var(--accent);
  color: #000;
}
.cta-btn.ghost {
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--line);
}
.cta-btn.small { width: auto; padding: 10px 18px; font-size: 14px; }
.cta-btn:disabled { opacity: .4; cursor: not-allowed; }

.ghost-btn {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--line);
  padding: 10px 16px;
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
}

.hero-stats {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  padding: 16px;
  background: var(--bg-elev);
  border-radius: var(--radius);
  border: 1px solid var(--line);
}
.stat { flex: 1; text-align: center; }
.stat-num {
  display: block;
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
}
.stat-label {
  font-size: 12px;
  color: var(--text-dim);
}

/* ============ Feature Grid ============ */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 32px;
}
.feature-card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 14px;
}
.feat-emoji { font-size: 24px; margin-bottom: 8px; }
.feature-card h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}
.feature-card p {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.5;
}

/* ============ Boss list ============ */
.boss-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.boss-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: border-color .2s, transform .12s;
}
.boss-card:active { transform: scale(0.99); }
.boss-card:hover { border-color: var(--accent); }
.boss-avatar {
  width: 56px; height: 56px;
  font-size: 32px;
  display: grid; place-items: center;
  background: var(--bg-elev-2);
  border-radius: 14px;
  flex-shrink: 0;
}
.boss-info-text { flex: 1; min-width: 0; }
.boss-info-text h3 {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 2px;
}
.boss-info-text .tagline {
  font-size: 13px;
  color: var(--text-dim);
}
.difficulty {
  font-size: 12px;
  color: var(--accent);
}

/* ============ Setup form ============ */
.setup-form {
  display: flex; flex-direction: column; gap: 16px;
}
.form-row {
  display: flex; flex-direction: column; gap: 6px;
}
.form-row label {
  font-size: 13px;
  color: var(--text-dim);
}
.unit { color: var(--text-mute); font-size: 11px; margin-left: 4px; }
.form-row input, .form-row textarea {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s;
}
.form-row input:focus, .form-row textarea:focus {
  border-color: var(--accent);
}
.form-row textarea { resize: vertical; min-height: 70px; }

/* ============ Dialogue page ============ */
.page-dialogue {
  padding: 0;
  display: none;
  flex-direction: column;
  height: calc(100vh - 56px);
}
.page-dialogue.active { display: flex; }

.dialogue-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.boss-info { display: flex; align-items: center; gap: 10px; flex: 1; margin: 0 8px; }
.boss-avatar-small {
  width: 36px; height: 36px;
  font-size: 22px;
  display: grid; place-items: center;
  background: var(--bg-elev);
  border-radius: 10px;
}
.boss-name { font-size: 14px; font-weight: 600; }
.boss-mood { font-size: 12px; color: var(--text-dim); }
.round-counter { font-size: 14px; color: var(--text-dim); font-weight: 600; }
.muted { color: var(--text-mute); }

.tts-toggle {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  color: var(--text);
  width: 36px; height: 36px;
  border-radius: 10px;
  font-size: 16px;
  display: grid; place-items: center;
  cursor: pointer;
  margin-right: 8px;
  transition: background 0.15s, opacity 0.15s;
}
.tts-toggle:hover { background: rgba(255,255,255,0.06); }
.tts-toggle.off { opacity: 0.45; }

.scene-bg {
  padding: 16px 20px;
  background: linear-gradient(180deg, rgba(255,214,0,0.05), transparent);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 12px;
  align-items: flex-start;
  flex-shrink: 0;
}
.scene-emoji { font-size: 28px; flex-shrink: 0; }
.scene-desc {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.6;
  white-space: pre-wrap;
}

.chat-area {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.msg {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.55;
  word-wrap: break-word;
  animation: msgIn .2s ease;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.msg-boss {
  align-self: flex-start;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
}
.msg-boss .msg-action {
  font-size: 12px;
  color: var(--text-mute);
  font-style: italic;
  margin-bottom: 4px;
}
.msg-user {
  align-self: flex-end;
  background: var(--accent);
  color: #000;
  border-bottom-right-radius: 4px;
  font-weight: 500;
}

/* 流式打字光标 */
.stream-cursor {
  display: inline-block;
  width: 7px;
  height: 1.05em;
  margin-left: 3px;
  background: var(--accent);
  vertical-align: text-bottom;
  animation: cursorBlink 1s steps(2) infinite;
  border-radius: 1px;
}
@keyframes cursorBlink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* 老板"正在思考"三点动画（流式开始前的占位） */
.typing-dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  padding: 2px 0;
}
.typing-dots i {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-mute);
  animation: typingBounce 1.2s infinite ease-in-out;
}
.typing-dots i:nth-child(2) { animation-delay: 0.15s; }
.typing-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* 流式中的老板气泡（可选高亮） */
.msg-streaming {
  border-color: rgba(255, 214, 0, 0.4) !important;
}

.input-bar {
  display: flex;
  gap: 8px;
  padding: 12px 12px;
  background: var(--bg);
  border-top: 1px solid var(--line);
  flex-shrink: 0;
}
.input-bar textarea {
  flex: 1;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  resize: none;
  outline: none;
  max-height: 120px;
}
.send-btn {
  align-self: flex-end;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 12px;
  padding: 0 20px;
  height: 44px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.send-btn:disabled { background: var(--bg-elev); color: var(--text-mute); }

.action-bar {
  text-align: center;
  padding: 4px 16px 16px;
  background: var(--bg);
  flex-shrink: 0;
}

/* ============ Review page ============ */
.review-grade {
  text-align: center;
  padding: 30px 20px;
  background: linear-gradient(135deg, var(--bg-elev) 0%, var(--bg-elev-2) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
}
.review-grade .grade-letter {
  font-size: 64px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: -3px;
  line-height: 1;
}
.review-grade .grade-num {
  font-size: 14px;
  color: var(--text-dim);
  margin-top: 6px;
}
.review-grade .one-liner {
  margin-top: 14px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
}

.review-section {
  margin-bottom: 20px;
}
.review-section-title {
  font-size: 13px;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 10px;
  font-weight: 600;
}

.dim-list {
  display: flex; flex-direction: column; gap: 10px;
}
.dim-row {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
}
.dim-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 8px;
}
.dim-name { font-weight: 600; font-size: 14px; }
.dim-name .weight { color: var(--text-mute); font-size: 12px; font-weight: 400; margin-left: 4px; }
.dim-score {
  font-size: 18px; font-weight: 700;
  color: var(--accent);
}
.dim-score.score-low { color: var(--bad); }
.dim-score.score-mid { color: var(--warn); }
.dim-score.score-high { color: var(--good); }

.dim-bar {
  height: 6px;
  background: var(--bg-elev-2);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}
.dim-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  border-radius: 3px;
  transition: width .6s ease;
}
.dim-comment {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.55;
}

.moment-card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
}
.moment-round {
  font-size: 12px;
  color: var(--accent);
  margin-bottom: 6px;
  font-weight: 600;
}
.moment-quote {
  font-size: 13px;
  color: var(--text-dim);
  font-style: italic;
  margin-bottom: 8px;
  padding-left: 10px;
  border-left: 2px solid var(--line);
}
.moment-issue {
  font-size: 13px;
  margin-bottom: 8px;
}
.moment-better {
  font-size: 13px;
  background: rgba(52,211,153,0.08);
  border: 1px solid rgba(52,211,153,0.3);
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--good);
}
.moment-better::before {
  content: "💡 更好的说法：";
  display: block;
  color: var(--good);
  font-weight: 600;
  font-size: 12px;
  margin-bottom: 4px;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tag {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
}
.tag.good { color: var(--good); border-color: rgba(52,211,153,0.4); }
.tag.bad { color: var(--bad); border-color: rgba(248,113,113,0.4); }

.tip-card {
  background: linear-gradient(135deg, rgba(255,214,0,0.08), rgba(255,149,0,0.04));
  border: 1px solid rgba(255,214,0,0.3);
  border-radius: 12px;
  padding: 14px;
  font-size: 14px;
  line-height: 1.6;
}

.review-actions {
  display: flex;
  gap: 10px;
  margin-top: 24px;
}
.review-actions .cta-btn { flex: 1; }

/* ============ History ============ */
.chart-container {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 20px;
  height: 220px;
}
.history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.history-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
}
.history-grade {
  width: 40px; height: 40px;
  background: var(--bg-elev-2);
  border-radius: 10px;
  display: grid; place-items: center;
  font-weight: 800;
  color: var(--accent);
  flex-shrink: 0;
}
.history-info { flex: 1; min-width: 0; }
.history-meta {
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 2px;
}
.history-date {
  font-size: 11px;
  color: var(--text-mute);
}
.history-score {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-dim);
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-mute);
}
.empty-state .empty-emoji { font-size: 40px; margin-bottom: 12px; }

/* ============ Modal ============ */
.modal {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal.active { display: flex; }
.modal-content {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.modal-content h3 { font-size: 17px; font-weight: 700; }
.modal-content .muted { color: var(--text-dim); font-size: 13px; margin-top: -10px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }

/* ============ Loading ============ */
.loading-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(10,10,12,0.85);
  backdrop-filter: blur(6px);
  z-index: 200;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
}
.loading-overlay.active { display: flex; }
.loader {
  width: 36px; height: 36px;
  border: 3px solid var(--bg-elev);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text {
  color: var(--text-dim);
  font-size: 14px;
}

/* mood color */
.mood-cold, .mood-irritated, .mood-angry { color: var(--bad); }
.mood-cooling, .mood-sympathetic, .mood-disappointed, .mood-concerned { color: var(--warn); }
.mood-warm, .mood-interested, .mood-satisfied { color: var(--good); }
.mood-neutral { color: var(--text-dim); }
