:root {
  --bg: #f0f2f5;
  --card: #ffffff;
  --header: #1a2744;
  --accent: #c8960c;
  --accent-bg: #fff8e1;
  --text: #1a1a2e;
  --text2: #6b7280;
  --border: #e5e7eb;
  --green: #16a34a;
  --green-bg: #dcfce7;
  --yellow: #b45309;
  --yellow-bg: #fef3c7;
  --red: #dc2626;
  --red-bg: #fee2e2;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --radius: 12px;
  --radius-sm: 8px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.6;
}

.app-wrap {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

/* ── Header ── */
.app-header {
  background: var(--header);
  color: white;
  padding: 14px 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 10px;
}
.back-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.85);
  font-size: 22px;
  cursor: pointer;
  padding: 2px 6px;
  line-height: 1;
  flex-shrink: 0;
}
.header-title {
  font-size: 17px;
  font-weight: 700;
  color: white;
  flex: 1;
}
.header-sub {
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
  flex-shrink: 0;
}

/* ── Step progress bar ── */
.step-bar {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: white;
  border-bottom: 1px solid var(--border);
  gap: 0;
}
.step-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}
.step-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  transition: all 0.2s;
}
.step-circle.done { background: var(--green); color: white; }
.step-circle.current { background: var(--accent); color: white; }
.step-circle.future { background: var(--border); color: var(--text2); }
.step-label {
  font-size: 10px;
  color: var(--text2);
  white-space: nowrap;
}
.step-label.current { color: var(--accent); font-weight: 600; }
.step-line {
  flex: 1;
  height: 2px;
  background: var(--border);
  margin-bottom: 14px;
}
.step-line.done { background: var(--green); }

/* ── Main ── */
.app-main { flex: 1; padding: 16px; padding-bottom: 32px; }

/* ── Cards ── */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}
.card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}
.card h3 { font-size: 16px; font-weight: 700; margin-bottom: 6px; }

/* ── Hero (index page) ── */
.hero {
  background: var(--header);
  color: white;
  padding: 32px 20px 28px;
  text-align: center;
}
.hero-icon { font-size: 56px; margin-bottom: 12px; }
.hero h1 { font-size: 22px; font-weight: 800; margin-bottom: 8px; }
.hero p { font-size: 14px; color: rgba(255,255,255,0.75); line-height: 1.7; }

/* ── Buttons ── */
.btn {
  display: block;
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: opacity 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.98); opacity: 0.9; }
.btn-primary { background: var(--header); color: white; }
.btn-accent { background: var(--accent); color: white; }
.btn-green { background: var(--green); color: white; }
.btn-outline { background: white; color: var(--header); border: 2px solid var(--header); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-sm {
  display: inline-block;
  width: auto;
  padding: 8px 16px;
  font-size: 14px;
}

/* ── Step1: type cards ── */
.type-grid { display: flex; flex-direction: column; gap: 10px; }
.type-card {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: white;
}
.type-card:active { transform: scale(0.99); }
.type-card.selected { border-color: var(--accent); background: var(--accent-bg); }
.type-card .type-icon { font-size: 28px; flex-shrink: 0; margin-top: 2px; }
.type-card .type-name { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.type-card .type-voice { font-size: 13px; color: var(--text2); font-style: italic; line-height: 1.5; }

/* ── Step2: scoring ── */
.score-item { margin-bottom: 20px; }
.score-q { font-size: 14px; font-weight: 600; margin-bottom: 10px; line-height: 1.5; }
.score-q span { color: var(--accent); font-size: 12px; font-weight: 700; margin-right: 4px; }
.score-desc { font-size: 12px; color: var(--text2); margin-bottom: 10px; }
.score-btns { display: flex; gap: 8px; }
.score-btn {
  flex: 1;
  padding: 10px 0;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: white;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--text2);
}
.score-btn.active { border-color: var(--accent); background: var(--accent-bg); color: var(--accent); }

.score-display {
  background: var(--header);
  color: white;
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  margin-bottom: 16px;
}
.score-num { font-size: 48px; font-weight: 800; line-height: 1; }
.score-max { font-size: 18px; opacity: 0.6; }
.score-level { font-size: 20px; font-weight: 700; margin-top: 6px; color: var(--accent); }

.level-result {
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}
.level-result h3 { font-size: 18px; font-weight: 800; margin-bottom: 6px; }
.level-result p { font-size: 14px; line-height: 1.7; }

/* ── Step3: area form ── */
label { display: block; font-size: 13px; font-weight: 600; color: var(--text2); margin-bottom: 6px; }
input[type=text], textarea, select {
  width: 100%;
  padding: 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  background: white;
  color: var(--text);
  margin-bottom: 14px;
  -webkit-appearance: none;
  font-family: inherit;
}
input[type=text]:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
}
textarea { min-height: 90px; resize: vertical; }
.voice-wrap { position: relative; margin-bottom: 14px; }
.voice-wrap textarea { margin-bottom: 0; padding-right: 52px; }
.voice-btn {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--header);
  color: white;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.voice-btn.recording { background: var(--red); animation: pulse 1s infinite; }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.1); } }

/* ── Peak times grid ── */
.peak-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.peak-card {
  background: var(--accent-bg);
  border-radius: var(--radius-sm);
  padding: 10px;
}
.peak-time { font-size: 11px; font-weight: 700; color: var(--accent); margin-bottom: 4px; }
.peak-desc { font-size: 13px; line-height: 1.5; }

/* ── Tags ── */
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.tag-green { background: var(--green-bg); color: var(--green); }
.tag-red { background: var(--red-bg); color: var(--red); }

/* ── Verdict badge ── */
.verdict {
  border-radius: var(--radius);
  padding: 14px 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.verdict .verdict-icon { font-size: 28px; flex-shrink: 0; }
.verdict .verdict-label { font-size: 20px; }
.verdict .verdict-sub { font-size: 13px; font-weight: 400; margin-top: 2px; opacity: 0.85; }
.verdict.green { background: var(--green-bg); color: var(--green); }
.verdict.yellow { background: var(--yellow-bg); color: var(--yellow); }
.verdict.red { background: var(--red-bg); color: var(--red); }

/* ── Scout table ── */
.scout-row {
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 8px;
}
.scout-row.green { background: var(--green-bg); border-left: 4px solid var(--green); }
.scout-row.yellow { background: var(--yellow-bg); border-left: 4px solid #f59e0b; }
.scout-row.red { background: var(--red-bg); border-left: 4px solid var(--red); }
.scout-name { font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.scout-finding { font-size: 13px; margin-bottom: 4px; }
.scout-advice { font-size: 12px; opacity: 0.8; }

/* ── Photo upload ── */
.photo-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  margin-bottom: 12px;
  background: white;
}
.photo-area p { color: var(--text2); font-size: 14px; margin-bottom: 12px; }
.photo-btns { display: flex; gap: 8px; justify-content: center; }
.photo-btn {
  padding: 10px 16px;
  border: 1.5px solid var(--header);
  border-radius: 8px;
  background: white;
  color: var(--header);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.previews {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.preview-item {
  position: relative;
  width: 80px;
  height: 80px;
}
.preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
}
.preview-del {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--red);
  color: white;
  border: none;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* ── Opportunity / risk list ── */
.opp-list, .risk-list { padding: 0; list-style: none; }
.opp-list li, .risk-list li {
  padding: 8px 0 8px 20px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
  line-height: 1.5;
  position: relative;
}
.opp-list li:last-child, .risk-list li:last-child { border-bottom: none; }
.opp-list li::before { content: "✓"; position: absolute; left: 0; color: var(--green); font-weight: 700; }
.risk-list li::before { content: "!"; position: absolute; left: 2px; color: var(--red); font-weight: 700; }

/* ── Military quote ── */
.military-quote {
  background: var(--header);
  color: white;
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  position: relative;
}
.military-quote::before { content: "⚔️"; position: absolute; top: -10px; left: 12px; font-size: 20px; }
.military-quote p { font-size: 14px; line-height: 1.8; }

/* ── Loading overlay ── */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 39, 68, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  color: white;
  gap: 16px;
}
.spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(255,255,255,0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-overlay p { font-size: 15px; opacity: 0.9; }

/* ── Error box ── */
.error-box {
  background: var(--red-bg);
  border: 1.5px solid var(--red);
  border-radius: var(--radius-sm);
  padding: 14px;
  color: var(--red);
  font-size: 14px;
  margin-bottom: 12px;
}

/* ── Warning box ── */
.warning-box {
  background: var(--yellow-bg);
  border-left: 4px solid #f59e0b;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 12px;
  font-size: 13px;
  color: var(--yellow);
  margin-bottom: 12px;
}

/* ── Index step list ── */
.step-list { display: flex; flex-direction: column; gap: 0; }
.step-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
}
.step-item:last-child { border-bottom: none; }
.step-num {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--header);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 15px;
  flex-shrink: 0;
}
.step-item-info { flex: 1; }
.step-item-title { font-size: 15px; font-weight: 700; }
.step-item-desc { font-size: 12px; color: var(--text2); margin-top: 2px; }
.step-item-arrow { color: var(--text2); font-size: 18px; }
.step-item.done .step-num { background: var(--green); }
.step-item.done .step-item-title::after { content: " ✓"; color: var(--green); }

/* ── Report ── */
.report-section { margin-bottom: 20px; }
.report-section h2 {
  font-size: 13px;
  font-weight: 700;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--border);
}
.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.info-row:last-child { border-bottom: none; }
.info-label { color: var(--text2); }
.info-val { font-weight: 600; }

/* ── Misc ── */
.section-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text2);
  margin-bottom: 8px;
}
.text-accent { color: var(--accent); }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-4 { margin-bottom: 4px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.hidden { display: none !important; }

input[type=file] { display: none; }
