/**
 * 撒开脚丫 · 运动游戏设计工具
 * 样式文件 — 移动端优先
 */

/* ===== 变量 ===== */
:root {
  --primary: #FF6B35;
  --primary-light: #FF8E5E;
  --primary-dark: #E55100;
  --secondary: #2EC4B6;
  --secondary-light: #5DD9D1;
  --bg: #FFF9F5;
  --bg-card: #FFFFFF;
  --bg-hover: #FFF0E8;
  --text: #1A1A2E;
  --text-secondary: #6B6B80;
  --text-light: #9999AA;
  --border: #FFE5D9;
  --border-strong: #FFCCB0;
  --accent: #FFD23F;
  --success: #4CAF50;
  --danger: #F44336;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 2px 12px rgba(255, 107, 53, 0.08);
  --shadow-md: 0 4px 20px rgba(255, 107, 53, 0.12);
  --shadow-lg: 0 8px 30px rgba(255, 107, 53, 0.16);
  --max-width: 480px;
  --wizard-footer-clearance: 168px;
  --result-footer-clearance: 92px;
  --transition: 0.25s ease;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: contain;
}

input, textarea, button { font-family: inherit; font-size: inherit; }
button { cursor: pointer; border: none; background: none; }
input, textarea { -webkit-appearance: none; appearance: none; }

/* ===== App Container ===== */
#app {
  max-width: var(--max-width);
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
}

/* ===== View System ===== */
.view {
  display: none;
  min-height: 100vh;
  padding: 16px;
  padding-bottom: 120px;
}
#view-wizard {
  padding-bottom: calc(var(--wizard-footer-clearance) + 72px);
}
#view-result {
  padding-bottom: calc(var(--result-footer-clearance) + 88px);
}
.view.active { display: block; animation: fadeIn 0.3s ease; }

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

/* ===== Home ===== */
.home-hero {
  text-align: center;
  padding: 48px 20px 32px;
}
.hero-icon { font-size: 56px; margin-bottom: 12px; }
.hero-title {
  font-size: 32px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: 2px;
}
.hero-subtitle {
  font-size: 16px;
  color: var(--secondary);
  font-weight: 600;
  margin-top: 4px;
}
.hero-desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 12px;
}

.home-modes {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 24px;
}
.home-footer-hint {
  text-align: center;
  margin-top: 28px;
  font-size: 12px;
  color: var(--text-tertiary);
  letter-spacing: 0.5px;
}
.mode-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 2px solid var(--border);
  transition: var(--transition);
  width: 100%;
  text-align: left;
}
.mode-card.active {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}
.mode-card.active:active { transform: scale(0.98); }
.mode-card.disabled {
  opacity: 1;
  cursor: not-allowed;
  filter: grayscale(1);
  border-style: dashed;
  border-color: #d5d5de;
  background: #f3f3f6;
  box-shadow: none;
  position: relative;
}
.mode-card.disabled .mode-info h2,
.mode-card.disabled .mode-info p { color: #8b8b98; }
.soon-badge,
.task-card.is-soon .task-badge {
  background: #ececf1;
  color: #5c5c6b;
  border: 1px solid #cfcfd8;
  font-weight: 700;
}
.soon-badge {
  flex: 0 0 auto;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
}
.mode-icon { font-size: 28px; flex-shrink: 0; }
.mode-info { flex: 1; }
.mode-info h2 { font-size: 17px; font-weight: 700; }
.mode-info p { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.mode-arrow { color: var(--primary); font-size: 20px; font-weight: 700; }

/* ===== Page Header ===== */
.page-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0 16px;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}
.page-header h2 { font-size: 18px; font-weight: 700; flex: 1; }
.btn-back {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--bg-card);
  font-size: 18px;
  color: var(--text);
  box-shadow: var(--shadow);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* ===== Task Selection ===== */
.task-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.task-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 2px solid var(--border);
  transition: var(--transition);
  position: relative;
}
.task-card:active { transform: scale(0.98); border-color: var(--primary); }
.task-card.is-soon {
  opacity: 1;
  cursor: not-allowed;
  filter: grayscale(0.9);
  border-style: dashed;
  border-color: #d0d0d8;
  background: #f6f6f8;
  box-shadow: none;
}
.task-card.is-soon:active { transform: none; border-color: #d0d0d8; }
.task-card.is-soon .task-body h3,
.task-card.is-soon .task-body p { color: #8a8a98; }
.task-icon { font-size: 32px; flex-shrink: 0; }
.task-body { flex: 1; }
.task-body h3 { font-size: 16px; font-weight: 700; }
.task-body p { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }
.task-arrow { color: var(--primary); font-size: 20px; }
.task-badge {
  position: absolute;
  top: 8px; right: 8px;
  background: var(--bg-hover);
  color: var(--text-light);
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
}

/* ===== Wizard ===== */
.wizard-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
}
.wizard-progress {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}
.wizard-progress-bar {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.wizard-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  border-radius: 3px;
  transition: width 0.4s ease;
  width: 16%;
}
.wizard-step-indicator {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
  white-space: nowrap;
}
.btn-text-feedback {
  flex: 0 0 auto;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--primary-dark);
  background: #fff;
}
.wizard-title {
  font-size: 20px;
  font-weight: 700;
  padding: 12px 0 16px;
}
.wizard-content {
  padding-bottom: 72px;
}

/* ===== Form Fields ===== */
.step-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.field-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.field-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.field-group.is-invalid .field-label { color: var(--danger); }
.field-group.is-invalid .radio-options,
.field-group.is-invalid .radio-grid {
  outline: 2px solid var(--danger);
  border-radius: var(--radius-sm);
}
.required { color: var(--danger); }
.field-hint {
  font-size: 12px;
  color: var(--text-light);
}

/* Radio Options (vertical) */
.radio-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.radio-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
.radio-option.selected {
  border-color: var(--primary);
  background: var(--bg-hover);
}
.radio-option input { display: none; }
.radio-label {
  font-size: 14px;
  flex: 1;
}
.radio-label small { color: var(--text-light); font-size: 12px; }

/* Radio Grid (horizontal) */
.radio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px;
}
.grid-option {
  text-align: center;
  padding: 12px 8px;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
}
.grid-option.selected {
  border-color: var(--primary);
  background: var(--bg-hover);
  color: var(--primary);
  font-weight: 600;
}

/* Tag Options */
.tag-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tag-option {
  padding: 8px 14px;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: 20px;
  font-size: 13px;
  transition: var(--transition);
  user-select: none;
}
.tag-option.selected {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

/* Slider */
.slider {
  width: 100%;
  height: 40px;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
}
.slider::-webkit-slider-runnable-track {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px; height: 24px;
  background: var(--primary);
  border-radius: 50%;
  margin-top: -9px;
  box-shadow: var(--shadow);
}
.slider::-moz-range-track {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
}
.slider::-moz-range-thumb {
  width: 24px; height: 24px;
  background: var(--primary);
  border-radius: 50%;
  border: none;
  box-shadow: var(--shadow);
}
.slider-value {
  color: var(--primary);
  font-weight: 700;
}
.slider-range {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-light);
  margin-top: -4px;
}

/* Text Input */
.text-input {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text);
  resize: vertical;
  min-height: 44px;
}
.text-input:focus {
  outline: none;
  border-color: var(--primary);
}

/* Info Card */
.info-card {
  background: linear-gradient(135deg, #FFF5EE, #FFFBF7);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
}
.info-card h4 { font-size: 14px; margin-bottom: 8px; }
.time-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.time-chip {
  background: var(--bg-card);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

/* Wizard Footer */
.wizard-footer {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  max-width: var(--max-width);
  margin: 0 auto;
  background: var(--bg);
  padding: 12px 16px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  z-index: 20;
}
.btn-skip {
  display: block;
  width: 100%;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--primary-dark);
  background: #fff4ec;
  border: 1.5px dashed var(--primary);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 8px;
}
.wizard-error {
  min-height: 0;
  margin: 0 0 8px;
  color: var(--danger);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}
.wizard-error:empty { display: none; }
.wizard-nav {
  display: flex;
  gap: 10px;
}

/* ===== Buttons ===== */
.btn-primary {
  background: var(--primary);
  color: #fff;
  padding: 14px 24px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  flex: 1;
  transition: var(--transition);
}
.btn-primary:active { transform: scale(0.97); background: var(--primary-dark); }
.btn-primary:disabled,
.btn-secondary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.25);
  transform: none;
}
.btn-secondary {
  background: var(--bg-card);
  color: var(--text);
  padding: 14px 24px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  border: 2px solid var(--border);
  flex: 1;
  transition: var(--transition);
}
.btn-secondary:active { transform: scale(0.97); }
.btn-generate {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  font-weight: 700;
}
.btn-full { width: 100%; }
.btn-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  font-size: 18px;
  box-shadow: var(--shadow);
  display: flex; align-items: center; justify-content: center;
}
.btn-text-only {
  display: block;
  margin: 24px auto;
  color: var(--text-secondary);
  font-size: 14px;
  text-align: center;
}

/* ===== Loading ===== */
.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 70vh;
  gap: 20px;
}
.loading-animation {
  display: flex;
  gap: 8px;
}
.loading-circle {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--primary);
  animation: bounce 0.6s infinite alternate;
}
.loading-circle:nth-child(2) { background: var(--secondary); animation-delay: 0.2s; }
.loading-circle:nth-child(3) { background: var(--accent); animation-delay: 0.4s; }

@keyframes bounce {
  to { transform: translateY(-16px); opacity: 0.5; }
}

.loading-message {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  text-align: center;
}
.loading-hint {
  font-size: 13px;
  color: var(--text-light);
}

/* ===== Result ===== */
.result-page-header {
  display: flex;
  align-items: center;
  gap: 10px;
}
.result-actions {
  display: flex;
  gap: 6px;
}
.result-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 80px;
}

.result-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  border: 1px solid var(--border);
}
.card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, #FFF5EE, #FFFBF7);
}
.card-icon { font-size: 20px; }
.card-title { font-size: 15px; font-weight: 700; }
.card-body { padding: 14px 16px; }
.card-text {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
}

/* Info Grid */
.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.info-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.info-label { font-size: 11px; color: var(--text-light); }
.info-value { font-size: 14px; font-weight: 500; }

/* Goals */
.goal-primary {
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.goal-secondary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.goal-badge {
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}
.goal-badge.primary {
  background: var(--primary);
  color: #fff;
}
.goal-badge.secondary {
  background: var(--bg-hover);
  color: var(--primary);
}

/* Timeline */
.timeline {
  position: relative;
}
.timeline-item {
  position: relative;
  padding-left: 24px;
  padding-bottom: 16px;
}
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before {
  content: '';
  position: absolute;
  left: 6px; top: 16px; bottom: 0;
  width: 2px;
  background: var(--border);
}
.timeline-item:last-child::before { display: none; }
.timeline-dot {
  position: absolute;
  left: 2px; top: 6px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--bg-card);
  box-shadow: 0 0 0 2px var(--primary);
}
.timeline-content { }
.timeline-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.timeline-phase { font-size: 14px; font-weight: 600; }
.timeline-duration {
  font-size: 12px;
  color: var(--secondary);
  font-weight: 600;
  background: rgba(46, 196, 182, 0.1);
  padding: 2px 8px;
  border-radius: 10px;
}
.timeline-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}
.timeline-script {
  margin-top: 6px;
  padding: 8px 10px;
  background: linear-gradient(135deg, #FFF5EE, #FFFBF7);
  border-left: 3px solid var(--primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 13px;
  color: var(--text);
  line-height: 1.6;
}

/* Check List */
.check-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.check-item {
  font-size: 14px;
  padding-left: 24px;
  position: relative;
  line-height: 1.6;
}
.check-item::before {
  content: '✓';
  position: absolute;
  left: 0; top: 0;
  color: var(--secondary);
  font-weight: 700;
}

/* Scripts */
.script-block {
  margin-bottom: 12px;
}
.script-block:last-child { margin-bottom: 0; }
.script-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--secondary);
  margin-bottom: 4px;
}
.script-content {
  font-size: 14px;
  padding: 10px 12px;
  background: linear-gradient(135deg, #F0FAF8, #F8FDFC);
  border-left: 3px solid var(--secondary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  line-height: 1.7;
}

/* 6C */
.sixc-block {
  margin-bottom: 12px;
}
.sixc-block:last-child { margin-bottom: 0; }
.sixc-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 4px;
}
.sixc-action {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* STEP */
.step-block {
  margin-bottom: 12px;
}
.step-block:last-child { margin-bottom: 0; }
.step-label {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
}
.step-content {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Result Footer */
.result-footer {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  gap: 10px;
  background: var(--bg);
  padding: 12px 16px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  z-index: 20;
}

/* ===== Error ===== */
.error-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  gap: 16px;
  text-align: center;
}
.error-icon { font-size: 48px; }
.error-message {
  font-size: 15px;
  color: var(--text-secondary);
  max-width: 300px;
}
.error-container .btn-primary {
  flex: none;
  width: min(220px, 100%);
  min-height: 50px;
}

/* ===== Settings ===== */
.settings-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.settings-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.settings-card h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
}
.settings-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 16px;
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text);
  color: #fff;
  padding: 10px 20px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  z-index: 1000;
  white-space: nowrap;
  max-width: 90vw;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===== Responsive ===== */
@media (min-width: 520px) {
  body { background: var(--bg); }
  #app {
    box-shadow: 0 0 40px rgba(0,0,0,0.05);
  }
}

/* ===== Print ===== */
@media print {
  body { background: #fff; }
  #app, body[data-view="result"] #app { max-width: none; box-shadow: none; }
  .view { display: none !important; padding: 0; }
  .view.active { display: block !important; }
  .btn-back, .result-actions, .result-tools, .tweak-panel, .result-footer,
  .wizard-footer, .btn-feedback-float, .toast, .feedback-modal, .skip-dialog,
  .diagram-download, .diagram-follow-status, .diagram-follow-toggle, .history-list {
    display: none !important;
  }
  .page-header { position: static; }
  .result-card, .diagram-card { break-inside: avoid; box-shadow: none; border: 1px solid #ddd; position: static !important; overflow: visible; }
  .result-content { display: block !important; }
}

/* ===== 用户反馈 ===== */
.btn-feedback-float {
  position: fixed;
  bottom: max(16px, env(safe-area-inset-bottom));
  left: 16px;
  right: auto;
  z-index: 90;
  padding: 10px 16px;
  border: 1.5px solid var(--border-strong);
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--primary-dark);
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  transition: var(--transition);
}
.btn-feedback-float:hover { background: var(--bg-hover); transform: translateY(-2px); }

/* 固定操作栏出现时，为反馈入口预留独立点击区，避免遮挡主操作按钮。 */
body[data-view="wizard"] .btn-feedback-float,
body[data-view="result"] .btn-feedback-float {
  display: none;
}

@media (min-width: 520px) {
  .btn-feedback-float {
    left: calc(50% - var(--max-width) / 2 + 12px);
    right: auto;
  }
}

.feedback-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.feedback-modal.hidden { display: none; }
.feedback-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(26, 26, 46, 0.45);
}
.feedback-dialog {
  position: relative;
  width: 100%;
  max-width: var(--max-width);
  background: var(--bg-card);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 20px;
  box-shadow: var(--shadow-lg);
  animation: feedbackSlideUp 0.25s ease;
}
@keyframes feedbackSlideUp {
  from { transform: translateY(40px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.feedback-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.feedback-header h3 { margin: 0; font-size: 17px; color: var(--text); }
.feedback-close {
  border: none;
  background: none;
  font-size: 18px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px 8px;
}
.feedback-hint {
  margin: 8px 0 12px;
  font-size: 13px;
  color: var(--text-secondary);
}
.feedback-dialog textarea,
.feedback-dialog input[type="text"] {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  resize: vertical;
}
.feedback-dialog textarea:focus,
.feedback-dialog input[type="text"]:focus {
  outline: 2px solid var(--primary-light);
  border-color: var(--primary);
}
.feedback-char-count {
  text-align: right;
  font-size: 12px;
  color: var(--text-light);
  margin: 4px 0 10px;
}
.fb-honeypot {
  position: absolute;
  left: -9999px;
  top: -9999px;
  height: 1px;
  width: 1px;
  opacity: 0;
}
.feedback-status {
  min-height: 20px;
  font-size: 13px;
  color: var(--text-secondary);
  margin: 8px 0;
}
.feedback-status.success { color: var(--success); }
.feedback-status.error { color: var(--danger); }
.feedback-submit { width: 100%; }
.feedback-submit:disabled { opacity: 0.6; cursor: not-allowed; }

.feedback-card { border: 1.5px dashed var(--border-strong); }
.feedback-inline-btn { width: 100%; margin-top: 8px; }

/* ===== 游戏示意图卡片 ===== */
.diagram-card {
  position: sticky;
  top: var(--diagram-sticky-top, 64px);
  align-self: start;
  height: auto;
  z-index: 8;
  overflow: visible;
  border-color: var(--border-strong);
  box-shadow: 0 6px 24px rgba(98, 54, 24, 0.12);
  transition: box-shadow 0.22s ease, border-color 0.22s ease;
}
.diagram-card.is-following {
  border-color: var(--primary-light);
  box-shadow: 0 12px 32px rgba(98, 54, 24, 0.2);
}
.diagram-card .card-header { min-width: 0; }
.diagram-card .card-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.diagram-follow-status {
  margin-left: auto;
  flex: 0 0 auto;
  max-width: 118px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 3px 8px;
  border: 1px solid #F6C7A8;
  border-radius: 999px;
  background: #FFF7ED;
  color: #9A4513;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.diagram-follow-toggle {
  display: none;
  flex: 0 0 auto;
  min-width: 44px;
  min-height: 34px;
  padding: 6px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: #FFFFFF;
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 700;
}
.diagram-canvas {
  width: 100%;
  background: #fff;
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 12px;
  transition: height 0.22s ease;
}
.diagram-canvas svg {
  display: block;
  width: 100%;
  height: auto;
}
.diagram-note {
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: #5c6b73;
}

.diagram-guide {
  margin: -2px 0 10px;
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.5;
}
.diagram-download { width: 100%; }

@media (max-width: 859px) {
  .result-content > .result-card:not(.diagram-card) {
    scroll-margin-top: clamp(280px, 44vh, 370px);
  }
  .diagram-card.is-following .diagram-follow-toggle { display: block; }
  .diagram-card.is-compact .card-header { padding: 8px 10px; }
  .diagram-card.is-compact .card-icon { font-size: 16px; }
  .diagram-card.is-compact .card-title { font-size: 13px; }
  .diagram-card.is-compact .card-body { padding: 6px 8px 8px; }
  .diagram-card.is-compact .diagram-canvas {
    height: clamp(148px, 27vh, 210px);
    margin-bottom: 0;
  }
  .diagram-card.is-compact .diagram-canvas svg {
    width: 100%;
    height: auto;
  }
  .diagram-card.is-compact .diagram-guide,
  .diagram-card.is-compact .diagram-download { display: none; }
}

@media (max-width: 359px) {
  .diagram-follow-status { display: none; }
}

/* 宽屏把示意图固定在左栏，方案在右栏滚动；手机则由上面的吸顶卡片持续对照。 */
@media (min-width: 860px) {
  body[data-view="result"] #app { max-width: 1080px; }
  body[data-view="result"] .result-footer { max-width: 1080px; }
  body[data-view="result"] .btn-feedback-float {
    left: max(16px, calc(50% - 540px));
    right: auto;
  }
  .result-content {
    display: grid;
    grid-template-columns: minmax(340px, 0.9fr) minmax(0, 1.1fr);
    align-items: start;
    gap: 14px 18px;
  }
  .result-content > .diagram-card {
    grid-column: 1;
    grid-row: 1 / span 40;
    align-self: start;
    height: auto;
  }
  .result-content > .result-card:not(.diagram-card),
  .result-content > .demo-banner {
    grid-column: 2;
  }
}

@media print {
  .diagram-card { position: static; }
  .diagram-follow-status,
  .diagram-follow-toggle { display: none !important; }
}

/* ===== 沿用上次 / 跳过确认 ===== */
.carryover-banner {
  background: #fff7ed;
  border: 1px solid #f6c7a8;
  border-radius: var(--radius-sm);
  padding: 12px;
}
.carryover-banner p {
  font-size: 13px;
  color: #7a3e12;
  margin-bottom: 8px;
}
.carryover-banner .btn-secondary { width: 100%; }
.skip-dialog {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(26, 26, 46, 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.skip-dialog.hidden { display: none; }
.skip-dialog-card {
  width: 100%;
  max-width: var(--max-width);
  background: #fff;
  border-radius: 16px 16px 0 0;
  padding: 18px 16px 20px;
}
.skip-dialog-card h3 { font-size: 17px; margin-bottom: 8px; }
.skip-dialog-card p { white-space: pre-line; font-size: 14px; color: var(--text-secondary); margin-bottom: 14px; }
.skip-dialog-actions { display: flex; gap: 10px; }

/* ===== 等待生成 ===== */
.loading-stages {
  list-style: none;
  width: min(100%, 320px);
  margin: 8px auto 0;
  text-align: left;
}
.loading-stages li {
  position: relative;
  padding: 6px 0 6px 26px;
  color: var(--text-light);
  font-size: 14px;
}
.loading-stages li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 11px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid #e4e4ee;
  background: #fff;
}
.loading-stages li.is-active { color: var(--text); font-weight: 700; }
.loading-stages li.is-active::before { border-color: var(--primary); background: #fff4ec; }
.loading-stages li.is-done { color: var(--secondary); }
.loading-stages li.is-done::before { border-color: var(--secondary); background: var(--secondary); }
.loading-preview {
  width: min(100%, 440px);
  max-height: 42vh;
  overflow: auto;
  margin: 12px auto 0;
  text-align: left;
}
.loading-preview section {
  margin-bottom: 10px;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.loading-preview h4 {
  margin: 0 0 4px;
  font-size: 12px;
  color: var(--primary-dark);
}
.loading-preview p {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
}
.loading-partial,
.loading-elapsed {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
  min-height: 1.2em;
}

/* ===== 结果页工具 ===== */
.ai-disclaimer {
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid #f6c7a8;
  border-radius: 10px;
  background: #fff7ed;
  color: #7a3e12;
  font-size: 13px;
  line-height: 1.6;
}
@media print {
  .ai-disclaimer {
    display: block !important;
    border: 1px solid #999;
    background: #fff;
    color: #000;
  }
}

.result-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
}
.result-tools .btn-secondary {
  flex: 1 1 30%;
  min-width: 96px;
  padding: 10px 8px;
  font-size: 14px;
}
.tweak-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 12px;
}
.tweak-panel.hidden { display: none; }
.tweak-panel label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.tweak-panel textarea {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 10px;
  margin-bottom: 8px;
  resize: vertical;
  background: var(--bg);
}
.tweak-panel .btn-primary { width: 100%; }
.plan-warning {
  background: #fff8e8;
  border: 1px solid #f0c36a;
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 12px;
  font-size: 13px;
  line-height: 1.6;
}
.plan-warning ul { margin: 6px 0 6px 18px; }
.plan-warning p { color: var(--text-secondary); }

.learning-item { margin-bottom: 16px; }
.learning-item:last-of-type { margin-bottom: 8px; }
.learning-name { font-size: 15px; margin-bottom: 4px; }
.learning-explanation {
  font-size: 14px;
  line-height: 1.7;
  margin-bottom: 6px;
}
.learning-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.learning-links a {
  color: var(--primary-dark);
  font-weight: 700;
  font-size: 14px;
  word-break: break-word;
}
.learning-meta {
  display: block;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.5;
}
.learning-note {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-light);
  line-height: 1.6;
}
@media print {
  .learning-links a::after {
    content: " (" attr(href) ")";
    font-weight: 400;
    font-size: 11px;
    color: #333;
  }
}

/* ===== 本地历史 ===== */
.history-list { margin-top: 28px; }
.history-list h3 { font-size: 15px; margin-bottom: 4px; }
.history-hint { font-size: 12px; color: var(--text-light); margin-bottom: 8px; }
.history-item {
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  text-align: left;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 8px;
}
.history-item span {
  font-weight: 600;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.history-item small { flex: 0 0 auto; color: var(--text-light); font-size: 12px; }

@media (max-width: 859px) {
  .result-content { display: flex; flex-direction: column; }
  .result-tools .btn-secondary { flex-basis: calc(50% - 8px); }
}
