/* ============================================================
   style.css — 呼吸自我測試網站樣式
   Mobile-first：主要目標 375–430px
   ============================================================ */

/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@300;400;500;700&display=swap');

/* ── CSS Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --font: 'Noto Sans TC', sans-serif;
  --bg:  #fafaf8;
  --text-primary:   #2a2a2a;
  --text-secondary: #6b6b6b;
  --border:         #e8e4de;
  --radius:         16px;
  --radius-sm:       8px;
  --transition:     0.38s cubic-bezier(0.4, 0, 0.2, 1);

  /* 主色調 */
  --accent-red:    #d94f44;
  --accent-orange: #d4763a;
  --accent-yellow: #b8920a;
  --accent-green:  #2e9e5b;

  /* 淡色背景 */
  --bg-red:    #fff5f3;
  --bg-orange: #fff8f2;
  --bg-yellow: #fffcf0;
  --bg-green:  #f2fbf5;

  /* 計時器 */
  --timer-bg:    #f5f3ef;
  --timer-text:  #2a2a2a;
}

html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  overflow: hidden; /* 防止多畫面時出現捲軸 */
}

/* ════════════════════════════════════════════════════════════
   進度條 Header
   ════════════════════════════════════════════════════════════ */
#progress-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  padding: 12px 20px 0;
  background: transparent;
  pointer-events: none;
}

#progress-header.hidden { opacity: 0; }

.progress-track {
  width: 100%;
  height: 4px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}

#progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #7ec8a4, #3a9e5b);
  border-radius: 99px;
  transition: width 0.5s ease;
  width: 0%;
}

#progress-label {
  font-size: 11px;
  color: var(--text-secondary);
  text-align: right;
  margin-top: 4px;
  letter-spacing: 0.03em;
}

/* ════════════════════════════════════════════════════════════
   畫面（Screen）
   ════════════════════════════════════════════════════════════ */
.screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 60px 24px 32px;
  overflow-y: auto;
  opacity: 0;
  pointer-events: none;
  transform: translateX(100%);
  transition:
    transform var(--transition),
    opacity   var(--transition);
  background: var(--bg);
  -webkit-overflow-scrolling: touch;
}

.screen--active {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

/* 入場動畫起始位置 */
.slide-from-right { transform: translateX(100%); opacity: 0; }
.slide-from-left  { transform: translateX(-100%); opacity: 0; }

/* 離場動畫 */
.slide-to-left  { transform: translateX(-100%); opacity: 0; }
.slide-to-right { transform: translateX(100%);  opacity: 0; }

/* ════════════════════════════════════════════════════════════
   歡迎頁
   ════════════════════════════════════════════════════════════ */
.welcome-inner {
  width: 100%;
  max-width: 440px;
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 20px;
  padding: 20px 0 40px;
}

.welcome-icon {
  font-size: 64px;
  line-height: 1;
  margin-bottom: 4px;
  animation: breathe 4s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.08); }
}

.welcome-title {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.welcome-subtitle {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.7;
  max-width: 320px;
}

.welcome-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.tag {
  font-size: 13px;
  background: #f0ede8;
  color: var(--text-secondary);
  padding: 5px 12px;
  border-radius: 99px;
}

/* ════════════════════════════════════════════════════════════
   說明頁 (Instruction Screen)
   ════════════════════════════════════════════════════════════ */
.instruction-inner {
  width: 100%;
  max-width: 440px;
  margin: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-bottom: 40px;
}

.step-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.instruction-title {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.instruction-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.instruction-card h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.03em;
}

.instruction-step {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.step-num {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #f0ede8;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.instruction-step p {
  font-size: 15px;
  line-height: 1.65;
  color: var(--text-primary);
  flex: 1;
}

.instruction-note {
  font-size: 13px;
  color: var(--text-secondary);
  background: #f7f5f2;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  line-height: 1.6;
}

/* ── 計時器區塊 ── */
.timer-block {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.timer-label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.timer-display {
  font-size: 52px;
  font-weight: 300;
  letter-spacing: 0.04em;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  transition: color 0.3s;
}

.timer-display.timer-done {
  color: var(--accent-green);
  font-size: 36px;
  font-weight: 500;
}

/* ════════════════════════════════════════════════════════════
   問題頁 (Question Screen)
   ════════════════════════════════════════════════════════════ */
.question-inner {
  width: 100%;
  max-width: 440px;
  margin: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-bottom: 40px;
}

.question-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.question-title {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.4;
}

.question-hint {
  font-size: 13px;
  color: var(--text-secondary);
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

/* ── 選項卡片 ── */
.option {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #fff;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  cursor: pointer;
  transition:
    border-color 0.18s,
    background   0.18s,
    transform    0.12s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.option:hover,
.option--focused {
  border-color: #b0c9b8;
  background: #f8fdf9;
  transform: translateY(-1px);
}

.option--selected {
  border-color: var(--accent-green);
  background: #edfaf3;
}

.option-key {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #f0ede8;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.18s, color 0.18s;
}

.option--selected .option-key {
  background: var(--accent-green);
  color: #fff;
}

.option-text {
  flex: 1;
  font-size: 15px;
  line-height: 1.5;
  font-weight: 500;
  color: var(--text-primary);
}

.option-sub {
  display: block;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-secondary);
  margin-top: 2px;
}

.option-check {
  font-size: 16px;
  opacity: 0;
  transition: opacity 0.2s;
}

.option--selected .option-check { opacity: 1; }

/* ════════════════════════════════════════════════════════════
   結果頁
   ════════════════════════════════════════════════════════════ */
#screen-result {
  transition:
    transform var(--transition),
    opacity   var(--transition),
    background 0.5s;
}

.result-inner {
  width: 100%;
  max-width: 440px;
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 20px;
  padding-bottom: 48px;
}

.result-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.result-emoji {
  font-size: 48px;
  line-height: 1;
}

.result-type-label {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.75;
}

.result-name {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

/* ── Avatar 佔位 ── */
.result-avatar {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: rgba(0,0,0,0.06);
  border: 2px dashed rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.result-avatar::after {
  content: '🌬️';
  font-size: 56px;
  opacity: 0.35;
}

.result-description {
  font-size: 15px;
  line-height: 1.75;
  color: var(--text-primary);
  text-align: left;
  background: rgba(255,255,255,0.6);
  border-radius: var(--radius);
  padding: 18px 20px;
  backdrop-filter: blur(4px);
}

.result-cta {
  width: 100%;
  background: rgba(255,255,255,0.7);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  backdrop-filter: blur(4px);
}

.cta-lead {
  font-size: 16px;
  font-weight: 700;
}

.cta-sub {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

/* ════════════════════════════════════════════════════════════
   通用按鈕
   ════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  border-radius: 99px;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  outline: none;
  transition:
    transform    0.15s,
    box-shadow   0.15s,
    background   0.2s;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.btn:active { transform: scale(0.97); }

.btn--primary {
  background: #2e9e5b;
  color: #fff;
  width: 100%;
  max-width: 320px;
  font-size: 16px;
  box-shadow: 0 4px 16px rgba(46,158,91,0.25);
}

.btn--primary:hover {
  background: #25885a;
  box-shadow: 0 6px 20px rgba(46,158,91,0.35);
}

.btn--next {
  background: #f0ede8;
  color: var(--text-primary);
  width: 100%;
}

.btn--next:hover { background: #e8e4de; }

.btn--timer {
  background: #f0ede8;
  color: var(--text-primary);
  padding: 11px 22px;
  font-size: 14px;
}

.btn--timer-stop {
  background: #fde8e7;
  color: var(--accent-red);
}

.btn--cta {
  color: #fff;
  width: 100%;
  max-width: 280px;
  font-size: 15px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.btn--cta:hover {
  filter: brightness(1.08);
  box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}

.btn--ghost {
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  padding: 8px 16px;
  width: auto;
}

.btn--ghost:hover { color: var(--text-primary); }

.retry-btn { margin-top: 4px; }

/* ── 胸腹說明特殊樣式 ── */
.body-test-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.body-test-item {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.body-test-item h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-green);
  display: flex;
  align-items: center;
  gap: 6px;
}

.body-test-item p {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-primary);
}

/* ════════════════════════════════════════════════════════════
   RWD
   ════════════════════════════════════════════════════════════ */
@media (min-width: 480px) {
  .screen { padding-top: 72px; }
  .welcome-title { font-size: 32px; }
  .instruction-title { font-size: 24px; }
  .result-name { font-size: 34px; }
  .timer-display { font-size: 60px; }
}

@media (prefers-reduced-motion: reduce) {
  .screen { transition: opacity 0.2s; }
  .slide-from-right, .slide-from-left, .slide-to-left, .slide-to-right {
    transform: none;
  }
  .welcome-icon { animation: none; }
}
