/* =============================================
   ウェブ解析士 演習問題集 - スタイルシート
   ============================================= */

:root {
  --primary: #1a56db;
  --primary-dark: #1240b0;
  --primary-light: #e8f0fe;
  --secondary: #0ea5e9;
  --success: #059669;
  --success-light: #d1fae5;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --warning: #d97706;
  --warning-light: #fef3c7;
  --neutral: #64748b;
  --bg: #f0f4f8;
  --white: #ffffff;
  --text-main: #1e293b;
  --text-sub: #475569;
  --border: #e2e8f0;
  --shadow: 0 4px 24px rgba(0,0,0,0.10);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.07);
  --radius: 16px;
  --radius-sm: 10px;
  --transition: 0.22s cubic-bezier(.4,0,.2,1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Noto Sans JP', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', sans-serif;
  background: var(--bg);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== ヘッダー ===== */
.app-header {
  background: linear-gradient(135deg, #1a56db 0%, #0ea5e9 100%);
  color: #fff;
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(26,86,219,0.3);
}
.header-inner {
  max-width: 860px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.header-logo i { font-size: 1.3rem; }

.header-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  font-weight: 600;
}
.progress-bar-wrap {
  width: 140px;
  height: 8px;
  background: rgba(255,255,255,0.3);
  border-radius: 99px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: #fff;
  border-radius: 99px;
  transition: width 0.4s ease;
  width: 0%;
}

/* ===== メインコンテンツ ===== */
.main-content {
  flex: 1;
  max-width: 860px;
  margin: 0 auto;
  width: 100%;
  padding: 28px 16px 40px;
}

/* ===== 画面切り替え ===== */
.screen { display: none; }
.screen.active { display: block; animation: fadeIn 0.3s ease; }

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

/* ===== 【画面1】章選択 ===== */
.welcome-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px 32px;
  text-align: center;
}
.welcome-icon {
  width: 72px; height: 72px;
  background: var(--primary-light);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
  font-size: 2rem;
  color: var(--primary);
}
.welcome-title {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 12px;
  line-height: 1.5;
}
.welcome-desc {
  font-size: 0.95rem;
  color: var(--text-sub);
  margin-bottom: 28px;
  line-height: 1.8;
}

.chapter-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-top: 8px;
}
.chapter-btn {
  background: var(--white);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  text-align: left;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.chapter-btn:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(26,86,219,0.15);
}
.chapter-num {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 0.05em;
}
.chapter-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.4;
}

/* ===== 【画面2】開始確認 ===== */
.confirm-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px 32px;
  text-align: center;
  max-width: 560px;
  margin: 0 auto;
}
.confirm-icon {
  width: 72px; height: 72px;
  background: linear-gradient(135deg, var(--primary-light), #dbeafe);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
  font-size: 2rem;
  color: var(--primary);
}
.confirm-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-main);
}
.confirm-desc {
  font-size: 0.95rem;
  color: var(--text-sub);
  line-height: 1.8;
  margin-bottom: 24px;
}
.confirm-info {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.info-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  padding: 6px 14px;
  border-radius: 99px;
}
.btn-ok {
  width: 100%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 16px 24px;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  margin-bottom: 12px;
  letter-spacing: 0.03em;
}
.btn-ok:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(26,86,219,0.35);
}
.btn-back {
  background: none;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-sub);
  cursor: pointer;
  transition: all var(--transition);
  width: 100%;
}
.btn-back:hover {
  border-color: var(--neutral);
  color: var(--text-main);
  background: var(--bg);
}

/* ===== 【画面3】問題 ===== */
.question-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px 28px;
}
.question-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.question-badge {
  background: var(--primary);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 4px 14px;
  border-radius: 99px;
  letter-spacing: 0.05em;
}
.question-type-badge {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 99px;
}
.type-a { background: #dbeafe; color: #1e40af; }
.type-b { background: #fce7f3; color: #9d174d; }

.question-instruction {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-light);
  border-left: 4px solid var(--primary);
  padding: 8px 14px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 16px;
}
.question-text {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.75;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 2px dashed var(--border);
}

.choices-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.choice-btn {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  text-align: left;
  cursor: pointer;
  transition: all var(--transition);
  width: 100%;
}
.choice-btn:hover:not(:disabled) {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: translateX(4px);
}
.choice-btn:disabled { cursor: not-allowed; }
.choice-btn.correct-choice {
  border-color: var(--success);
  background: var(--success-light);
}
.choice-btn.wrong-choice {
  border-color: var(--danger);
  background: var(--danger-light);
}
.choice-btn.other-choice {
  opacity: 0.6;
}
.choice-label {
  width: 28px; height: 28px;
  min-width: 28px;
  border-radius: 50%;
  background: var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-sub);
  transition: all var(--transition);
}
.choice-btn.correct-choice .choice-label {
  background: var(--success);
  color: #fff;
}
.choice-btn.wrong-choice .choice-label {
  background: var(--danger);
  color: #fff;
}
.choice-text {
  font-size: 0.93rem;
  font-weight: 500;
  color: var(--text-main);
  line-height: 1.6;
}

/* ===== 【画面4】解説 ===== */
.explain-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px 28px;
}
.explain-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.result-badge {
  font-size: 0.9rem;
  font-weight: 700;
  padding: 5px 16px;
  border-radius: 99px;
}
.result-badge.correct { background: var(--success-light); color: var(--success); }
.result-badge.wrong   { background: var(--danger-light);  color: var(--danger); }

.explain-question {
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.7;
  margin-bottom: 16px;
  padding: 14px 16px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--primary);
}
.correct-answer-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  background: var(--success-light);
  border: 2px solid #6ee7b7;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  font-size: 0.95rem;
  font-weight: 700;
  color: #065f46;
}
.correct-answer-box i { font-size: 1.1rem; color: var(--success); }

.explain-section h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.explain-section h3 i { color: var(--warning); }
.explain-content {
  font-size: 0.9rem;
  line-height: 1.8;
  color: var(--text-sub);
}
.explain-item {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  border-left: 4px solid;
}
.explain-item.correct-item {
  background: var(--success-light);
  border-color: var(--success);
  color: #065f46;
}
.explain-item.wrong-item {
  background: var(--danger-light);
  border-color: var(--danger);
  color: #7f1d1d;
}
.explain-item-label {
  font-weight: 700;
  margin-right: 6px;
}
.explain-item-text { font-weight: 600; }
.explain-item-reason { font-size: 0.85rem; margin-top: 4px; opacity: 0.85; }

.source-box {
  margin-top: 20px;
  padding: 12px 16px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--text-sub);
}
.source-box strong { color: var(--text-main); font-weight: 700; }

.btn-next {
  margin-top: 24px;
  width: 100%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 16px 24px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: 0.03em;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-next:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(26,86,219,0.35);
}

/* ===== 【画面5】結果 ===== */
.result-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px 28px;
  text-align: center;
}
.result-icon {
  font-size: 3.5rem;
  margin-bottom: 12px;
}
.result-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 24px;
}
.score-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
}
.score-circle {
  width: 120px; height: 120px;
  border-radius: 50%;
  border: 8px solid var(--primary);
  display: flex; align-items: center; justify-content: center;
  gap: 2px;
  background: var(--primary-light);
}
.score-circle.great { border-color: var(--success); background: var(--success-light); }
.score-circle.ok    { border-color: var(--warning); background: var(--warning-light); }
.score-circle.low   { border-color: var(--danger);  background: var(--danger-light); }

.score-number {
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--primary);
}
.score-circle.great .score-number { color: var(--success); }
.score-circle.ok .score-number    { color: var(--warning); }
.score-circle.low .score-number   { color: var(--danger); }

.score-denom { font-size: 1rem; font-weight: 600; color: var(--text-sub); align-self: flex-end; margin-bottom: 8px; }

.score-rate {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-main);
}
.eval-comment {
  font-size: 0.95rem;
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  margin: 16px 0;
  font-weight: 600;
  line-height: 1.7;
}
.eval-great { background: var(--success-light); color: #065f46; }
.eval-ok    { background: var(--warning-light); color: #78350f; }
.eval-low   { background: var(--danger-light);  color: #7f1d1d; }

.result-detail {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 28px;
  text-align: left;
}
.detail-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 500;
}
.detail-row.correct-row { background: var(--success-light); color: #065f46; }
.detail-row.wrong-row   { background: var(--danger-light);  color: #7f1d1d; }
.detail-row i { font-size: 1rem; }

.result-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.btn-retry {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 14px 24px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-retry:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(26,86,219,0.3); }
.btn-chapter-select {
  background: none;
  border: 2px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 14px 24px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
  cursor: pointer;
  transition: all var(--transition);
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-chapter-select:hover { background: var(--primary-light); }

/* ===== フッター ===== */
.app-footer {
  text-align: center;
  padding: 16px;
  font-size: 0.78rem;
  color: var(--text-sub);
  border-top: 1px solid var(--border);
  background: var(--white);
}

/* ===== レスポンシブ ===== */
@media (max-width: 600px) {
  .main-content { padding: 16px 10px 32px; }
  .welcome-card, .confirm-card, .question-card, .explain-card, .result-card {
    padding: 22px 16px;
  }
  .chapter-grid { grid-template-columns: 1fr; }
  .header-logo span { font-size: 0.88rem; }
  .progress-bar-wrap { width: 90px; }
  .welcome-title { font-size: 1.15rem; }
  .confirm-title { font-size: 1.1rem; }
  .question-text { font-size: 0.96rem; }
  .score-circle { width: 96px; height: 96px; }
  .score-number { font-size: 2rem; }
}
