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

/* ===== 变量 ===== */
: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;
  --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: 100px;
}
.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: 0.5;
  cursor: not-allowed;
}
.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-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;
}
.wizard-title {
  font-size: 20px;
  font-weight: 700;
  padding: 12px 0 16px;
}
.wizard-content {
  padding-bottom: 20px;
}

/* ===== 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);
}
.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 {
  width: 100%;
  text-align: center;
  font-size: 13px;
  color: var(--text-light);
  padding: 8px;
  margin-bottom: 8px;
}
.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-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;
}

/* ===== 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 {
  .view { display: none !important; }
  .view.active { display: block !important; }
  .page-header, .result-footer, .wizard-footer { display: none !important; }
  .result-card { break-inside: avoid; box-shadow: none; border: 1px solid #ddd; }
}
