:root {
  color-scheme: light;
  --bg: #f4f1ec;
  --surface: #fffaf2;
  --surface-strong: #ffffff;
  --ink: #20242a;
  --muted: #6b7280;
  --line: #ded8cf;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --danger: #b42318;
  --warn: #a15c07;
  --blue: #2563eb;
  --gold: #c88a04;
  --purple: #7c3aed;
  --shadow: 0 18px 48px rgba(35, 31, 27, 0.13);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.08), transparent 32%),
    linear-gradient(225deg, rgba(180, 35, 24, 0.08), transparent 28%),
    var(--bg);
  color: var(--ink);
  font-family:
    "Microsoft YaHei", "PingFang SC", "Segoe UI", system-ui, sans-serif;
  overflow-x: hidden;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

button:active:not(:disabled) {
  transform: scale(0.96);
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 18px;
  width: min(1480px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px;
}

.sidebar,
.workspace {
  background: rgba(255, 250, 242, 0.92);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.sidebar {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 36px);
  padding: 18px;
  border-radius: 8px;
}

.brand {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 12px;
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
  font-size: 22px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 20px;
  line-height: 1.2;
}

.brand p,
.scenario-card p,
.context-band p,
.feedback,
.final-advice,
.about-hero p,
.about-band p,
.feature-card p,
.improve-list p,
.score-columns p {
  color: var(--muted);
  line-height: 1.55;
}

.about-link,
.back-link,
.link-button {
  text-decoration: none;
}

.about-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 800;
}

.toolbar {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin: 16px 0;
}

.icon-button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 700;
}

.icon-button.active {
  border-color: var(--accent);
  background: #e8f5f3;
  color: var(--accent-dark);
}

.panel {
  display: none;
}

.panel.active {
  display: block;
}

.panel-block {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.panel-block h2 {
  margin-bottom: 8px;
  font-size: 16px;
}

.panel-note,
.empty-state {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.empty-state {
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
}

/* ===== 难度选择器 ===== */
.difficulty-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.difficulty-bar span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.difficulty-bar select {
  flex: 1;
  min-height: 32px;
  border: 0;
  border-radius: 6px;
  background: #f9f7f4;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  outline: none;
  padding: 0 8px;
  cursor: pointer;
}

.difficulty-bar select:focus {
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.2);
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.field input,
.field textarea,
.field select,
.composer textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.field input,
.field select {
  min-height: 42px;
  padding: 0 12px;
}

.field textarea,
.composer textarea {
  resize: vertical;
  padding: 12px;
  line-height: 1.5;
}

.field input:focus,
.field textarea:focus,
.field select:focus,
.composer textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.scenario-list {
  display: grid;
  gap: 10px;
  max-height: calc(100vh - 340px);
  overflow: auto;
  padding-right: 4px;
}

.scenario-card {
  width: 100%;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-align: left;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
}

.scenario-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(35, 31, 27, 0.08);
}

.scenario-card:hover,
.scenario-card.active {
  border-color: var(--accent);
  background: #f0fbf9;
}

.scenario-card strong {
  display: block;
  margin-bottom: 5px;
  font-size: 15px;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef2f7;
  color: #344054;
  font-size: 12px;
  font-weight: 700;
}

.tag.micro {
  background: #fff7e6;
  color: var(--warn);
}

.tag.obvious {
  background: #fff1f0;
  color: var(--danger);
}

.tag.mixed {
  background: #eff6ff;
  color: var(--blue);
}

.compact-list {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.compact-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  transition: border-color 0.2s, transform 0.15s;
}

.compact-item:hover {
  transform: translateY(-1px);
}

.compact-item strong {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
}

.compact-item p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.history-item {
  cursor: pointer;
}

.history-item:hover {
  border-color: var(--accent);
  background: #f0fbf9;
}

.inline-actions,
.stack-actions {
  display: flex;
  gap: 8px;
}

.inline-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.stack-actions {
  flex-direction: column;
  margin-top: 12px;
}

.small-button {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.danger-action {
  border-color: #fecaca;
  color: var(--danger);
}

.score-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  background: #e8f5f3;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 900;
  transition: transform 0.3s ease;
}

.mini-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.mini-stat {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  transition: transform 0.2s;
}

.mini-stat:hover {
  transform: translateY(-2px);
}

.mini-stat strong {
  display: block;
  font-size: 22px;
}

.mini-stat span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

/* ===== 成就面板 ===== */
.achievement-panel {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.achievement-panel h2 {
  margin-bottom: 8px;
  font-size: 16px;
}

.ach-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 8px;
}

.ach-summary {
  grid-column: 1 / -1;
  padding: 10px 12px;
  border: 1px solid var(--gold);
  border-radius: 8px;
  background: linear-gradient(135deg, #fef9e7, #fff8e1);
}

.ach-summary strong {
  display: block;
  font-size: 20px;
  color: var(--gold);
}

.ach-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.ach-card {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  transition: transform 0.2s, border-color 0.2s;
}

.ach-card:hover {
  transform: translateY(-1px);
}

.ach-card.unlocked {
  border-color: #e6d5a8;
  background: linear-gradient(135deg, #fffef9, #fef9e7);
}

.ach-card.locked {
  opacity: 0.55;
  filter: grayscale(0.6);
}

.ach-icon {
  font-size: 18px;
  display: block;
  margin-bottom: 2px;
}

.ach-card strong {
  display: block;
  font-size: 13px;
  margin-bottom: 2px;
}

.ach-card p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

/* ===== 成就 Toast ===== */
.achievement-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 280px;
  max-width: 380px;
  padding: 16px 18px;
  border: 2px solid var(--gold);
  border-radius: 12px;
  background: linear-gradient(135deg, #fffef5, #fff8e1);
  box-shadow: 0 12px 40px rgba(200, 138, 4, 0.2);
  animation: toastIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.achievement-toast .ach-icon {
  font-size: 32px;
  animation: toastBounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.achievement-toast strong {
  display: block;
  font-size: 14px;
  color: var(--gold);
}

.achievement-toast p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.achievement-toast.fade-out {
  animation: toastOut 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(60px) scale(0.9); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0) scale(1); }
  to { opacity: 0; transform: translateX(60px) scale(0.9); }
}

@keyframes toastBounce {
  0% { transform: scale(0); }
  60% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

.workspace {
  display: grid;
  grid-template-rows: auto auto minmax(260px, 1fr) auto auto;
  min-height: calc(100vh - 36px);
  border-radius: 8px;
  overflow: hidden;
}

.session-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.eyebrow {
  margin-bottom: 6px;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 800;
}

.session-head h2 {
  font-size: clamp(24px, 4vw, 38px);
  line-height: 1.14;
}

.score-ring {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 86px;
  height: 86px;
  border: 7px solid #cfeae6;
  border-radius: 50%;
  background: #f7fffd;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
              border-color 0.3s;
}

/* ===== 得分弹跳动画 ===== */
.score-ring.score-pop {
  animation: scoreBounce 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  border-color: var(--accent);
}

@keyframes scoreBounce {
  0% { transform: scale(1); }
  50% { transform: scale(1.18); }
  100% { transform: scale(1); }
}

.score-ring span {
  font-size: 28px;
  font-weight: 900;
  line-height: 1;
  transition: color 0.3s;
}

.score-ring small {
  color: var(--muted);
  font-size: 12px;
}

.context-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  background: #fbf7ef;
}

.context-band span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.dialogue {
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: auto;
  padding: 22px 24px;
}

/* ===== 消息滑入动画 ===== */
.message {
  width: min(760px, 88%);
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  animation: messageSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  opacity: 0;
  animation-fill-mode: forwards;
}

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

.message.opponent {
  align-self: flex-start;
  border-left: 5px solid var(--danger);
  animation-delay: 0.05s;
}

.message.player {
  align-self: flex-end;
  border-left: 5px solid var(--accent);
  background: #f6fffd;
  animation-delay: 0.1s;
}

.speaker {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.message p {
  line-height: 1.56;
}

.feedback {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #e6e1d8;
  font-size: 14px;
}

.composer {
  padding: 16px 24px 20px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.round-status {
  display: grid;
  grid-template-columns: auto minmax(120px, 1fr);
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

progress {
  width: 100%;
  height: 10px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: #e5e7eb;
}

progress::-webkit-progress-bar {
  background: #e5e7eb;
}

progress::-webkit-progress-value {
  background: var(--accent);
  transition: width 0.3s;
}

.composer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}

.primary-button,
.secondary-button,
.ghost-button {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 8px;
  font-weight: 800;
  transition: transform 0.15s, box-shadow 0.15s, background 0.2s;
}

.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.primary-button {
  border: 1px solid var(--accent-dark);
  background: var(--accent);
  color: #fff;
}

.primary-button:hover:not(:disabled) {
  background: #0e8b82;
  box-shadow: 0 4px 14px rgba(15, 118, 110, 0.25);
}

.secondary-button {
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
}

.secondary-button:hover:not(:disabled) {
  background: #dbeafe;
}

.ghost-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.ghost-button:hover:not(:disabled) {
  background: #f9f7f4;
}

button:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.result-panel {
  padding: 18px 24px 24px;
  border-top: 1px solid var(--line);
  background: #fbf7ef;
  position: relative;
  overflow: hidden;
}

.result-panel h2 {
  margin-bottom: 12px;
  font-size: 20px;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.metric {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  transition: transform 0.3s;
}

.metric:hover {
  transform: translateY(-2px);
}

.metric strong {
  display: block;
  font-size: 24px;
}

.metric span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.final-advice {
  margin-top: 12px;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

/* ===== 彩纸庆祝效果 ===== */
.confetti {
  position: absolute;
  width: var(--s);
  height: var(--s);
  background: var(--c);
  border-radius: 2px;
  top: 50%;
  left: 50%;
  pointer-events: none;
  animation: confettiFall var(--d) cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
  opacity: 0.9;
}

@keyframes confettiFall {
  0% {
    transform: translate(0, 0) rotate(0deg) scale(1);
    opacity: 0.9;
  }
  30% {
    opacity: 1;
  }
  100% {
    transform: translate(var(--x), calc(var(--y) + 200px)) rotate(720deg) scale(0.2);
    opacity: 0;
  }
}

/* ===== About 页 ===== */
.about-page {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 18px;
}

.about-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 54px;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.back-link {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

.about-hero,
.about-band,
.improve-section,
.score-explain {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 242, 0.95);
  box-shadow: var(--shadow);
}

.about-hero {
  min-height: 430px;
  display: grid;
  align-content: center;
  gap: 18px;
  padding: clamp(28px, 7vw, 72px);
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.16), transparent 42%),
    linear-gradient(225deg, rgba(37, 99, 235, 0.11), transparent 38%),
    #fff;
}

.about-hero h1 {
  max-width: 880px;
  font-size: clamp(34px, 7vw, 68px);
  line-height: 1.08;
}

.about-hero p {
  max-width: 720px;
  font-size: 18px;
}

.about-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

.about-band {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(0, 1.1fr);
  gap: 24px;
  margin-top: 18px;
  padding: 24px;
}

.about-band span,
.feature-card span {
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 900;
}

.about-band h2,
.section-head h2,
.score-explain h2 {
  margin-top: 6px;
  font-size: clamp(24px, 4vw, 36px);
  line-height: 1.18;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.feature-card {
  min-height: 220px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.feature-card h2 {
  margin: 10px 0 8px;
  font-size: 20px;
}

.improve-section,
.score-explain {
  margin-top: 18px;
  padding: 24px;
}

.section-head {
  margin-bottom: 18px;
}

.improve-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.improve-list div,
.score-columns p {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.improve-list strong,
.score-columns strong {
  display: block;
  margin-bottom: 6px;
  color: var(--ink);
}

.score-columns {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

/* ===== AI 模式 UI ===== */
.ai-toggle-btn {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-weight: 800;
  font-size: 13px;
  transition: all 0.25s;
}

.ai-toggle-btn.ai-active {
  border-color: var(--purple);
  background: linear-gradient(135deg, #f5f0ff, #eee5ff);
  color: var(--purple);
  box-shadow: 0 0 12px rgba(124, 58, 237, 0.15);
  animation: aiPulse 2s ease-in-out infinite;
}

@keyframes aiPulse {
  0%, 100% { box-shadow: 0 0 8px rgba(124, 58, 237, 0.12); }
  50% { box-shadow: 0 0 18px rgba(124, 58, 237, 0.25); }
}

.ai-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 800;
  margin-left: 6px;
}

.ai-status.on { color: var(--purple); }
.ai-status.on::before { content: "●"; font-size: 8px; animation: aiPulse 1.5s ease-in-out infinite; }
.ai-status.off { color: var(--muted); }
.ai-status.off::before { content: "○"; font-size: 8px; }

.ai-panel {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafaf8;
}

.ai-panel h2 {
  margin-bottom: 8px;
  font-size: 14px;
}

.ai-panel .field {
  margin-bottom: 8px;
}

.ai-panel .field input {
  font-size: 12px;
}

.ai-panel-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.ai-loading-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(255, 250, 242, 0.85);
  backdrop-filter: blur(4px);
  z-index: 10;
  border-radius: 8px;
}

.ai-loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--line);
  border-top-color: var(--purple);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.ai-loading-text {
  color: var(--purple);
  font-size: 14px;
  font-weight: 800;
}

/* ===== AI 场景生成 ===== */
.ai-scenario-area {
  margin-bottom: 14px;
  padding: 12px;
  border: 1px dashed #d4c8f0;
  border-radius: 8px;
  background: linear-gradient(135deg, #faf8ff, #f5f0ff);
}

.ai-scenario-area span {
  display: block;
  margin-bottom: 6px;
  color: var(--purple);
  font-size: 12px;
  font-weight: 800;
}

.ai-scenario-area textarea {
  width: 100%;
  min-height: 72px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
  resize: vertical;
  font: inherit;
  line-height: 1.5;
}

.ai-scenario-area textarea:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
}

.ai-result-card {
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid #d4c8f0;
  border-radius: 6px;
  background: #fff;
}

.ai-result-card strong {
  display: block;
  margin-bottom: 4px;
  color: var(--purple);
  font-size: 13px;
}

.ai-result-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.ai-result-card.ai-error {
  border-color: #fecaca;
  background: #fff5f5;
}

.ai-result-card.ai-error strong {
  color: var(--danger);
}

/* ===== PRO 付费系统 ===== */
.pro-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 26px;
  padding: 2px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f3f4f6;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.pro-badge.active {
  border-color: var(--gold);
  background: linear-gradient(135deg, #fef9e7, #fff8e1);
  color: var(--gold);
}

.pro-upgrade-btn {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--gold);
  border-radius: 8px;
  background: linear-gradient(135deg, #fffbeb, #fef3c7);
  color: #92400e;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s, background 0.2s;
}

.pro-upgrade-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(200, 138, 4, 0.2);
  background: linear-gradient(135deg, #fef3c7, #fde68a);
}

.locked-item {
  opacity: 0.55;
  filter: grayscale(0.3);
  position: relative;
}

.lock-icon {
  font-size: 14px;
  vertical-align: middle;
}

/* ===== 付款弹窗 ===== */
.payment-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(24, 24, 27, 0.5);
  backdrop-filter: blur(6px);
  animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalSlideIn {
  from { opacity: 0; transform: translateY(24px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.payment-modal {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  animation: modalSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.payment-header {
  padding: 24px 24px 18px;
  background: linear-gradient(135deg, #fef9e7, #fff8e1);
  text-align: center;
}

.payment-header h2 {
  font-size: 24px;
  margin-bottom: 6px;
}

.payment-header p {
  color: var(--muted);
  font-size: 14px;
}

.payment-body {
  padding: 20px 24px;
}

.price-card {
  padding: 18px;
  border: 2px solid var(--gold);
  border-radius: 10px;
  background: linear-gradient(135deg, #fffef9, #fffbeb);
  text-align: center;
  margin-bottom: 16px;
}

.price-card .price-tag {
  font-size: 42px;
  font-weight: 900;
  color: #92400e;
  line-height: 1;
}

.price-card .price-unit {
  display: block;
  color: #a16207;
  font-size: 14px;
  margin-top: 4px;
}

.price-features {
  list-style: none;
  padding: 0;
  margin: 16px 0 0;
  display: grid;
  gap: 8px;
}

.price-features li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #374151;
}

.price-features li::before {
  content: "✓";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #d1fae5;
  color: #065f46;
  font-size: 11px;
  font-weight: 900;
}

.pay-btn {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, #eab308, #ca8a04);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s, opacity 0.2s;
}

.pay-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(202, 138, 4, 0.3);
}

.pay-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.pay-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  color: #9ca3af;
  font-size: 12px;
}

.pay-divider::before,
.pay-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.activation-row {
  display: flex;
  gap: 8px;
}

.activation-row input {
  flex: 1;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fafb;
  color: var(--ink);
  outline: none;
  font-size: 13px;
}

.activation-row input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.activation-row button {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.activation-row button:hover {
  background: #f9fafb;
}

.pay-status {
  display: block;
  margin-top: 12px;
  min-height: 20px;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.pay-status.loading { color: var(--accent); }
.pay-status.success { color: #065f46; }
.pay-status.error { color: var(--danger); }

.payment-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--line);
  text-align: center;
}

.payment-footer button {
  min-height: 36px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}

.payment-footer button:hover {
  background: #f9fafb;
}

/* ===== 事件分析系统 ===== */
.event-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 40px 20px;
  color: var(--purple);
  font-size: 14px;
  font-weight: 800;
}

.event-error {
  padding: 16px;
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: #fff5f5;
}

.event-error strong {
  display: block;
  margin-bottom: 6px;
  color: var(--danger);
}

.event-error p {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.event-error-hint {
  color: #9ca3af !important;
  font-size: 12px !important;
}

/* 分析卡片 */
.analysis-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}

.analysis-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(135deg, #f0fdfa, #ecfdf5);
}

.analysis-header h3 {
  margin: 0;
  font-size: 16px;
}

.malice-level {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border: 1px solid;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.analysis-body {
  padding: 14px 16px;
}

.analysis-row {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #f3f0ea;
}

.analysis-row:last-child {
  border-bottom: 0;
}

.analysis-row.highlight {
  background: #fffbeb;
  margin: 0 -16px;
  padding: 10px 16px;
}

.analysis-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.analysis-row p {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
}

.key-phrases {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.key-phrase-tag {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 6px;
  background: #fff1f0;
  color: var(--danger);
  font-size: 12px;
  font-weight: 700;
}

/* 搜索结果 */
.search-empty {
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.search-list {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.search-item {
  display: block;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-decoration: none;
  color: var(--ink);
  transition: border-color 0.2s, transform 0.15s;
}

.search-item:hover {
  border-color: var(--blue);
  transform: translateY(-1px);
}

.search-item strong {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
  color: var(--blue);
}

.search-item p {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.search-source {
  color: #9ca3af;
  font-size: 11px;
  font-weight: 700;
}

.result-count {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

/* 反击话术卡片 */
.counterattack-list {
  display: grid;
  gap: 12px;
  margin-top: 10px;
}

.counterattack-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  transition: border-color 0.2s, transform 0.15s;
}

.counterattack-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.counterattack-phrase {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.5;
  margin-bottom: 8px;
  color: var(--ink);
}

.counterattack-meta {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.strategy-tag {
  padding: 2px 8px;
  border-radius: 6px;
  background: #e8f5f3;
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 700;
}

.intensity-tag {
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
}

.intensity-tag.intensity-温和 {
  background: #f0fdf4;
  color: #166534;
}

.intensity-tag.intensity-适中 {
  background: #fffbeb;
  color: #92400e;
}

.intensity-tag.intensity-强硬 {
  background: #fef2f2;
  color: #991b1b;
}

.counterattack-explanation {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

/* 反馈按钮 */
.phrase-feedback {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid #f3f0ea;
}

.feedback-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  min-height: 32px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  font-size: 14px;
  transition: transform 0.15s, background 0.2s, border-color 0.2s;
}

.feedback-btn:hover {
  background: #f9fafb;
  transform: scale(1.1);
}

.feedback-btn.up:hover {
  border-color: #166534;
  background: #f0fdf4;
}

.feedback-btn.down:hover {
  border-color: #991b1b;
  background: #fef2f2;
}

.feedback-btn.voted {
  animation: votePop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes votePop {
  0% { transform: scale(1); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

.feedback-count {
  min-width: 28px;
  text-align: center;
  font-size: 13px;
  font-weight: 800;
  color: var(--muted);
}

/* 安慰卡片 */
.comfort-section {
  margin-top: 18px;
}

.comfort-card {
  padding: 16px;
  border: 1px solid #d4c8f0;
  border-radius: 10px;
  background: linear-gradient(135deg, #faf8ff, #f5f0ff);
}

.comfort-row {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(212, 200, 240, 0.3);
}

.comfort-row:last-of-type {
  border-bottom: 0;
}

.comfort-label {
  color: var(--purple);
  font-size: 12px;
  font-weight: 800;
}

.comfort-row p {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
}

.comfort-mantra {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 8px;
  background: rgba(124, 58, 237, 0.08);
  color: var(--purple);
  font-size: 15px;
  font-weight: 800;
  text-align: center;
  font-style: italic;
}

/* 热门话术排行 */
.popular-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.popular-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  transition: transform 0.15s;
}

.popular-item:hover {
  transform: translateY(-1px);
}

.popular-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #f3f4f6;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  flex-shrink: 0;
}

.popular-rank.rank-1 { background: #fef3c7; color: #92400e; }
.popular-rank.rank-2 { background: #f3f4f6; color: #6b7280; }
.popular-rank.rank-3 { background: #fed7aa; color: #9a3412; }

.popular-phrase {
  flex: 1;
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
}

.popular-score {
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 800;
  flex-shrink: 0;
}

/* 双视角输入 */
.dual-perspective {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

.perspective-box {
  display: grid;
  gap: 6px;
}

.perspective-box span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.perspective-box.attacker span {
  color: var(--danger);
}

.perspective-box.victim span {
  color: var(--accent-dark);
}

.perspective-box textarea {
  min-height: 100px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
  resize: vertical;
  font: inherit;
  line-height: 1.5;
}

.perspective-box.attacker textarea {
  border-color: #fecaca;
}

.perspective-box.attacker textarea:focus {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.1);
}

.perspective-box.victim textarea {
  border-color: #cfeae6;
}

.perspective-box.victim textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.response-section {
  margin-top: 18px;
}

.response-section h3 {
  margin-bottom: 8px;
  font-size: 16px;
}

/* ===== 响应式 ===== */
@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
    padding: 10px;
  }

  .dual-perspective {
    grid-template-columns: 1fr;
  }

  .analysis-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .comfort-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .sidebar,
  .workspace {
    min-height: auto;
  }

  .scenario-list {
    max-height: 340px;
  }

  .session-head,
  .context-band {
    align-items: flex-start;
    flex-direction: column;
  }

  .score-ring {
    width: 76px;
    height: 76px;
  }

  .message {
    width: 100%;
  }

  .result-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ach-grid {
    grid-template-columns: 1fr;
  }

  .about-band,
  .feature-grid,
  .improve-list,
  .score-columns {
    grid-template-columns: 1fr;
  }

  .about-hero {
    min-height: 360px;
  }

  .achievement-toast {
    right: 10px;
    bottom: 10px;
    min-width: auto;
    max-width: calc(100vw - 20px);
  }
}

@media (max-width: 520px) {
  .app-shell {
    padding: 0;
  }

  .sidebar,
  .workspace {
    border-left: 0;
    border-right: 0;
    border-radius: 0;
  }

  .composer-actions {
    flex-direction: column;
  }

  .primary-button,
  .secondary-button,
  .ghost-button {
    width: 100%;
  }

  .compact-item {
    grid-template-columns: 1fr;
  }

  .inline-actions {
    justify-content: stretch;
  }

  .inline-actions .small-button {
    width: 100%;
  }

  .about-page {
    padding: 10px;
  }

  .about-actions .link-button {
    width: 100%;
  }
}