/* ===================================================
   SC試験対策学習サイト - メインスタイルシート
   スマホファースト / セキュリティ専門家テーマ
=================================================== */

/* ---- リセット & ベース ---- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --primary: #6d28d9;
  --primary-dark: #5b21b6;
  --primary-light: #ede9fe;
  --secondary: #0ea5e9;
  --accent-green: #10b981;
  --accent-green-light: #d1fae5;
  --accent-amber: #f59e0b;
  --accent-amber-light: #fef3c7;
  --accent-red: #ef4444;
  --accent-red-light: #fee2e2;
  --accent-purple: #8b5cf6;
  --accent-purple-light: #ede9fe;
  --accent-rose: #f43f5e;
  --accent-rose-light: #ffe4e6;
  --bg: #f1f5f9;
  --bg-subtle: #f8fafc;
  --card-bg: #ffffff;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.10), 0 4px 8px rgba(0,0,0,0.06);
  --radius: 14px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --font-main: 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', 'Meiryo', sans-serif;
}

html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font-main);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.7;
  min-height: 100vh;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

/* ---- リスト（CSSリセット後の padding 補完） ---- */
ul, ol { padding-left: 1.5em; }
li { margin-bottom: 4px; line-height: 1.65; }
/* レイアウト専用リストはリセットのまま */
.check-list,
.quiz-options,
.filter-bar,
.topic-list,
.progress-stats,
.recommend-grid,
.order-list { padding-left: 0; }
.check-list li,
.quiz-options li { margin-bottom: 0; }

/* ---- ヘッダー ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
}
.header-inner {
  max-width: 800px;
  margin: 0 auto;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.back-link {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--primary);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: var(--primary-light);
  transition: background 0.15s;
  white-space: nowrap;
  min-height: 40px;
}
.back-link:hover { background: #ddd6fe; text-decoration: none; }
.back-link:active { background: #c4b5fd; text-decoration: none; }
.header-progress-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ---- ヒーロー ---- */
.site-hero {
  background: linear-gradient(135deg, #1e1b4b 0%, #4c1d95 40%, #6d28d9 70%, #7c3aed 100%);
  color: white;
  padding: 40px 20px 36px;
  text-align: center;
}
.site-hero h1 {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
  line-height: 1.3;
}
.site-hero p {
  font-size: 0.9rem;
  opacity: 0.85;
  max-width: 440px;
  margin: 0 auto 20px;
}
.hero-badge {
  display: inline-block;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 20px;
  padding: 4px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 16px;
}

/* ---- 進捗バー ---- */
.progress-section {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  padding: 16px 20px;
}
.progress-inner { max-width: 800px; margin: 0 auto; }
.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}
.progress-title { font-size: 0.85rem; font-weight: 700; color: var(--text-secondary); }
.progress-count { font-size: 1.1rem; font-weight: 800; color: var(--primary); }
.progress-count span { font-size: 0.8rem; font-weight: 500; color: var(--text-muted); }
.progress-bar-track {
  width: 100%;
  height: 10px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #a78bfa);
  border-radius: 99px;
  transition: width 0.5s ease;
}
.progress-stats { display: flex; gap: 16px; margin-top: 8px; }
.progress-stat {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}
.progress-stat .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-done { background: var(--accent-green); }
.dot-todo { background: var(--border-strong); }

/* ---- おすすめ ---- */
.recommend-section {
  padding: 16px 16px 0;
  max-width: 800px;
  margin: 0 auto;
}
.section-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.recommend-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.recommend-card {
  background: linear-gradient(135deg, #f5f3ff, #ede9fe);
  border: 1px solid #c4b5fd;
  border-radius: var(--radius-sm);
  padding: 12px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  display: block;
  color: var(--text-primary);
}
.recommend-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); text-decoration: none; }
.recommend-card:active { transform: scale(0.98); }
.rec-label { font-size: 0.65rem; font-weight: 700; color: var(--primary); margin-bottom: 4px; }
.rec-title { font-size: 0.8rem; font-weight: 700; line-height: 1.3; }
.rec-time { font-size: 0.7rem; color: var(--text-muted); margin-top: 4px; }

/* ---- フィルターバー ---- */
.filter-section {
  padding: 12px 16px 0;
  max-width: 800px;
  margin: 0 auto;
}
.filter-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  flex-wrap: nowrap;
  padding-bottom: 4px;
  scrollbar-width: none;
  -ms-overflow-style: none;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}
.filter-bar::-webkit-scrollbar { display: none; }
.filter-btn {
  padding: 8px 16px;
  border-radius: 20px;
  border: 1.5px solid var(--border-strong);
  background: var(--card-bg);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font-main);
  min-height: 40px;
  white-space: nowrap;
}
.filter-btn:hover { border-color: var(--primary); color: var(--primary); }
.filter-btn:active { transform: scale(0.96); }
.filter-btn.active { background: var(--primary); border-color: var(--primary); color: white; }

/* ---- カテゴリ・トピック一覧 ---- */
.category-section { padding: 16px 16px 0; max-width: 800px; margin: 0 auto; }
.category-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 4px 0;
  margin-top: 8px;
  margin-bottom: 8px;
  border-bottom: 2px solid var(--border);
  display: flex;
  align-items: center;
  gap: 6px;
}
.topic-list { display: flex; flex-direction: column; gap: 10px; }
.topic-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
  overflow: hidden;
  text-decoration: none;
  color: var(--text-primary);
}
.topic-card:hover { border-color: var(--primary); box-shadow: var(--shadow); transform: translateY(-1px); text-decoration: none; }
.topic-card:active { transform: scale(0.99); box-shadow: none; text-decoration: none; }
.topic-card.completed { background: #f0fdf4; border-color: #86efac; }
.topic-card.completed::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--accent-green);
}
.topic-card-check {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
  transition: all 0.15s;
  font-size: 0.85rem;
}
.topic-card.completed .topic-card-check { background: var(--accent-green); border-color: var(--accent-green); color: white; }
.topic-card-body { flex: 1; min-width: 0; }
.topic-card-title { font-size: 0.95rem; font-weight: 700; line-height: 1.3; margin-bottom: 4px; }
.topic-card-summary { font-size: 0.8rem; color: var(--text-secondary); line-height: 1.4; margin-bottom: 6px; }
.topic-card-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.4;
}
.badge-time { background: #f1f5f9; color: var(--text-secondary); }
.badge-freq-high { background: #fee2e2; color: #dc2626; }
.badge-freq-medium { background: #fef3c7; color: #d97706; }
.badge-freq-low { background: #f1f5f9; color: var(--text-muted); }
.badge-imp { background: var(--primary-light); color: var(--primary-dark); }
.badge-done { background: var(--accent-green-light); color: #059669; }

/* ---- 学習ページ ---- */
.page-main {
  max-width: 800px;
  margin: 0 auto;
  padding: 16px 16px 40px;
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
  padding-bottom: max(40px, calc(env(safe-area-inset-bottom) + 24px));
}
.breadcrumb {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb-sep { color: var(--border-strong); }
.page-header { margin-bottom: 20px; }
.page-title {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 10px;
}
.page-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.meta-time { background: #f1f5f9; color: var(--text-secondary); padding: 4px 10px; border-radius: 20px; font-size: 0.8rem; font-weight: 600; }
.meta-importance { color: var(--accent-amber); font-size: 0.9rem; font-weight: 700; }
.meta-freq { padding: 4px 10px; border-radius: 20px; font-size: 0.78rem; font-weight: 700; }
.meta-freq.high { background: #fee2e2; color: #dc2626; }
.meta-freq.medium { background: #fef3c7; color: #d97706; }
.meta-freq.low { background: #f1f5f9; color: var(--text-muted); }

/* ---- カード ---- */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
  animation: fadeIn 0.3s ease both;
}
.card:nth-child(1) { animation-delay: 0.04s; }
.card:nth-child(2) { animation-delay: 0.08s; }
.card:nth-child(3) { animation-delay: 0.12s; }
.card:nth-child(4) { animation-delay: 0.16s; }
.card:nth-child(5) { animation-delay: 0.20s; }
.card:nth-child(6) { animation-delay: 0.24s; }
.card:nth-child(n+7) { animation-delay: 0.28s; }

.conclusion-card { background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%); border-color: #c4b5fd; }
.exam-card { background: linear-gradient(135deg, #fefce8 0%, #fffbeb 100%); border-color: #fcd34d; }
.warning-card { background: linear-gradient(135deg, #fff7ed 0%, #fff1f2 100%); border-color: #fca5a5; }
.quiz-card { background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%); border-color: #86efac; }
.attack-card { background: linear-gradient(135deg, #fff1f2 0%, #fef2f2 100%); border-color: #fca5a5; }
.defense-card { background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%); border-color: #86efac; }
.point-card { background: linear-gradient(135deg, #faf5ff 0%, #f5f3ff 100%); border-color: #c4b5fd; }

.section-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.lead-text { font-size: 1.05rem; font-weight: 600; color: var(--text-primary); line-height: 1.6; margin-bottom: 12px; }
p { margin-bottom: 10px; font-size: 0.95rem; line-height: 1.75; }
p:last-child { margin-bottom: 0; }

.keyword { color: var(--primary); font-weight: 700; }
.keyword-red { color: var(--accent-red); font-weight: 700; }
.keyword-green { color: var(--accent-green); font-weight: 700; }
.highlight { background: #fef9c3; padding: 1px 4px; border-radius: 3px; font-weight: 700; }
.caution { color: var(--accent-red); font-weight: 700; }
.tip { color: var(--accent-green); font-weight: 700; }

/* ---- ハイライトボックス ---- */
.highlight-box {
  background: var(--primary-light);
  border-left: 4px solid var(--primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 12px 16px;
  margin: 12px 0;
  font-size: 0.9rem;
}
.highlight-box.amber { background: var(--accent-amber-light); border-color: var(--accent-amber); }
.highlight-box.green { background: var(--accent-green-light); border-color: var(--accent-green); }
.highlight-box.red { background: var(--accent-red-light); border-color: var(--accent-red); }
.highlight-box.purple { background: var(--accent-purple-light); border-color: var(--accent-purple); }
.highlight-box.rose { background: var(--accent-rose-light); border-color: var(--accent-rose); }

/* ---- ダイアグラム ---- */
.diagram-wrap {
  overflow-x: auto;
  margin: 12px 0;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}
.diagram-box {
  background: #f8fafc;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
  min-width: 280px;
}
.diagram-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}

/* フローダイアグラム */
.flow-diagram { display: flex; flex-direction: column; align-items: center; gap: 0; }
.flow-box {
  background: var(--primary-light);
  border: 2px solid var(--primary);
  border-radius: 8px;
  padding: 8px 20px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary-dark);
  min-width: 160px;
  text-align: center;
}
.flow-box.red { background: var(--accent-red-light); border-color: var(--accent-red); color: #991b1b; }
.flow-box.green { background: var(--accent-green-light); border-color: var(--accent-green); color: #065f46; }
.flow-box.amber { background: var(--accent-amber-light); border-color: var(--accent-amber); color: #92400e; }
.flow-arrow { font-size: 1.2rem; color: var(--text-muted); line-height: 1.2; padding: 2px 0; }
.flow-label { font-size: 0.7rem; color: var(--text-muted); text-align: center; max-width: 140px; }

/* 攻撃フロー専用 */
.attack-flow {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.8rem;
}
.attack-step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
}
.attack-step.danger { background: #fff1f2; border-color: #fca5a5; }
.attack-step.warning { background: var(--accent-amber-light); border-color: #fcd34d; }
.attack-step.safe { background: var(--accent-green-light); border-color: #86efac; }
.attack-step-num {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--accent-red);
  color: white;
  font-size: 0.75rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.attack-step.safe .attack-step-num { background: var(--accent-green); }
.attack-step.warning .attack-step-num { background: var(--accent-amber); }
.attack-step-content { flex: 1; }
.attack-step-title { font-weight: 700; margin-bottom: 2px; }
.attack-step-desc { font-size: 0.78rem; color: var(--text-secondary); }

/* ---- テーブル ---- */
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; margin: 10px 0; }
th { background: var(--primary); color: white; padding: 8px 12px; text-align: left; font-weight: 700; font-size: 0.8rem; }
th:first-child { border-radius: 8px 0 0 0; }
th:last-child { border-radius: 0 8px 0 0; }
td { padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: top; line-height: 1.5; }
tr:nth-child(even) td { background: var(--bg-subtle); }
tr:hover td { background: var(--primary-light); }
.table-wrap {
  overflow-x: auto;
  margin: 10px 0;
  border-radius: 8px;
  border: 1px solid var(--border);
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}
.table-wrap table { margin: 0; }

/* ---- ステップリスト ---- */
.step-list { display: flex; flex-direction: column; gap: 10px; margin: 10px 0; }
.step-item { display: flex; align-items: flex-start; gap: 12px; }
.step-num {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-weight: 800;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}
.step-content { flex: 1; }
.step-title { font-weight: 700; font-size: 0.9rem; margin-bottom: 2px; }
.step-desc { font-size: 0.85rem; color: var(--text-secondary); line-height: 1.5; }

/* ---- チェックリスト ---- */
.check-list { list-style: none; display: flex; flex-direction: column; gap: 8px; margin: 8px 0; }
.check-list li { display: flex; align-items: flex-start; gap: 8px; font-size: 0.9rem; line-height: 1.5; }
.check-list li::before { content: '✓'; color: var(--accent-green); font-weight: 800; flex-shrink: 0; margin-top: 1px; }
.check-list li.caution::before { content: '✗'; color: var(--accent-red); }
.check-list li.note::before { content: '→'; color: var(--primary); }
.check-list li.warn::before { content: '⚠'; color: var(--accent-amber); }

/* ---- 比較グリッド ---- */
.compare-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0; }
.compare-card { border-radius: var(--radius-sm); padding: 12px; border: 2px solid var(--border); }
.compare-card.attack { border-color: #fca5a5; background: #fff1f2; }
.compare-card.defense { border-color: #86efac; background: #f0fdf4; }
.compare-card.left { border-color: #93c5fd; background: #eff6ff; }
.compare-card.right { border-color: #86efac; background: #f0fdf4; }
.compare-card.purple { border-color: #c4b5fd; background: #f5f3ff; }
.compare-card.amber { border-color: #fcd34d; background: #fefce8; }
.compare-head { font-weight: 800; font-size: 0.9rem; margin-bottom: 8px; }
.compare-head.red { color: #991b1b; }
.compare-head.green { color: #065f46; }
.compare-head.blue { color: var(--primary-dark); }
.compare-item { font-size: 0.82rem; color: var(--text-secondary); margin-bottom: 4px; }

/* ---- 試験バッジ ---- */
.exam-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #fef9c3;
  border: 1px solid #fcd34d;
  color: #92400e;
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  margin: 2px;
}
.exam-badge.red { background: #fee2e2; border-color: #fca5a5; color: #991b1b; }
.exam-badge.purple { background: #ede9fe; border-color: #c4b5fd; color: #5b21b6; }
.exam-badge.green { background: #d1fae5; border-color: #6ee7b7; color: #065f46; }

/* ---- セキュリティ専用コンポーネント ---- */
/* 攻撃 vs 防御 */
.threat-defense-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 12px 0;
}
.threat-box {
  background: #fff1f2;
  border: 2px solid #fca5a5;
  border-radius: var(--radius-sm);
  padding: 12px;
}
.defense-box {
  background: #f0fdf4;
  border: 2px solid #86efac;
  border-radius: var(--radius-sm);
  padding: 12px;
}
.threat-box h4 { color: #dc2626; font-size: 0.85rem; font-weight: 800; margin-bottom: 8px; }
.defense-box h4 { color: #059669; font-size: 0.85rem; font-weight: 800; margin-bottom: 8px; }
.threat-item, .defense-item { font-size: 0.8rem; color: var(--text-secondary); padding: 3px 0; border-bottom: 1px solid rgba(0,0,0,0.05); }
.threat-item:last-child, .defense-item:last-child { border-bottom: none; }

/* コードブロック */
.code-block {
  background: #1e293b;
  color: #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 0.78rem;
  line-height: 1.8;
  overflow-x: auto;
  margin: 10px 0;
}
.code-bad { background: #2d1111; border-left: 3px solid var(--accent-red); }
.code-good { background: #0f1f10; border-left: 3px solid var(--accent-green); }
.code-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 4px;
}
.code-label.bad { color: var(--accent-red); }
.code-label.good { color: var(--accent-green); }

/* ネットワーク図 */
.net-diagram {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px;
}
.net-node { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.net-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}
.net-label { font-size: 0.7rem; font-weight: 700; color: var(--text-secondary); }
.net-line { height: 3px; width: 40px; background: var(--border-strong); border-radius: 2px; align-self: center; margin-top: -20px; }
.icon-pc { background: #dbeafe; }
.icon-router { background: #d1fae5; }
.icon-fw { background: #fee2e2; }
.icon-server { background: #ede9fe; }
.icon-cloud { background: #e0f2fe; }
.icon-attacker { background: #fee2e2; }
.icon-victim { background: #fef9c3; }
.icon-internet { background: #f1f5f9; }

/* ---- クイズ ---- */
.quiz-list { display: flex; flex-direction: column; gap: 16px; }
.quiz-q {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
  display: flex;
  gap: 8px;
}
.quiz-q-num {
  background: var(--primary);
  color: white;
  border-radius: 50%;
  width: 22px; height: 22px;
  font-size: 0.75rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
  user-select: none;
  -webkit-user-select: none;
}
.quiz-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--card-bg);
  cursor: pointer;
  font-size: 0.88rem;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
  font-family: var(--font-main);
  text-align: left;
  width: 100%;
  min-height: 48px;
  line-height: 1.4;
}
.quiz-option:hover { border-color: var(--primary); background: var(--primary-light); }
.quiz-option:active:not(:disabled) { transform: scale(0.98); }
.quiz-option.correct { border-color: var(--accent-green); background: var(--accent-green-light); }
.quiz-option.wrong { border-color: var(--accent-red); background: var(--accent-red-light); }
.quiz-answer {
  display: none;
  padding: 12px 16px;
  background: var(--accent-green-light);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent-green);
  font-size: 0.86rem;
  line-height: 1.65;
}
.quiz-answer.show { display: block; animation: slideDown 0.25s ease both; }

/* ---- 完了ボタン・ナビ ---- */
.completion-area { text-align: center; padding: 24px 0 10px; }
.btn-complete {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 32px;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  color: white;
  border: none;
  border-radius: 50px;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  font-family: var(--font-main);
  box-shadow: 0 4px 14px rgba(109,40,217,0.35);
  transition: all 0.2s;
  min-width: 200px;
  justify-content: center;
}
.btn-complete:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(109,40,217,0.4); }
.btn-complete:active { transform: scale(0.97); box-shadow: none; }
.btn-complete.done {
  background: linear-gradient(135deg, var(--accent-green), #059669);
  box-shadow: 0 4px 14px rgba(16,185,129,0.35);
}

.page-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0 20px; }
.nav-btn {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--card-bg);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary);
  transition: all 0.15s;
  line-height: 1.3;
}
.nav-btn:hover { border-color: var(--primary); background: var(--primary-light); text-decoration: none; }
.nav-btn:active { background: var(--primary-light); transform: scale(0.98); }
.nav-btn.nav-prev { justify-content: flex-start; }
.nav-btn.nav-next { justify-content: flex-end; text-align: right; }
.nav-btn.disabled { opacity: 0.4; pointer-events: none; }

/* ---- フッター ---- */
.site-footer {
  background: #1e293b;
  color: #94a3b8;
  text-align: center;
  padding: 24px 16px;
  font-size: 0.8rem;
  margin-top: 40px;
}
.site-footer a { color: #a78bfa; }

/* ---- スクロールトップ・進捗バー ---- */
.scroll-top-btn {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(24px, calc(env(safe-area-inset-bottom) + 16px));
  width: 46px; height: 46px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(109,40,217,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px) scale(0.9);
  transition: opacity 0.25s, transform 0.25s;
  z-index: 80;
  font-family: var(--font-main);
}
.scroll-top-btn.show { opacity: 1; pointer-events: auto; transform: translateY(0) scale(1); }
.scroll-top-btn:active { transform: scale(0.92); }
.reading-progress {
  position: fixed;
  top: 0; left: 0;
  width: 0%;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), #a78bfa);
  z-index: 200;
  transition: width 0.1s linear;
  pointer-events: none;
}

/* ---- レスポンシブ ---- */
@media (max-width: 480px) {
  .site-hero h1 { font-size: 1.35rem; }
  .page-title { font-size: 1.25rem; }
  .recommend-grid { grid-template-columns: 1fr; }
  .compare-grid { grid-template-columns: 1fr; }
  .threat-defense-grid { grid-template-columns: 1fr; }
  .page-nav { grid-template-columns: 1fr; }
  .card { padding: 16px; }
  .btn-complete { width: 100%; min-width: 0; }
  .nav-btn { font-size: 0.82rem; padding: 12px 12px; }
  .highlight-box { font-size: 0.88rem; padding: 10px 14px; }
  .check-list li { font-size: 0.88rem; line-height: 1.55; }
  .compare-item { font-size: 0.8rem; }
  td { padding: 7px 10px; font-size: 0.82rem; }
  th { padding: 7px 10px; font-size: 0.78rem; }
  p { font-size: 0.93rem; }
}
@media (max-width: 360px) {
  .page-title { font-size: 1.15rem; }
  .card { padding: 14px; }
  .section-title { font-size: 0.95rem; }
}
@media (min-width: 600px) {
  .recommend-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 768px) {
  .site-hero h1 { font-size: 2rem; }
  .page-title { font-size: 1.75rem; }
  .card { padding: 24px; }
}

/* ---- アニメーション ---- */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---- クイズ（ページ内 .quiz-item 形式） ---- */
.quiz-item {
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.quiz-item:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.quiz-question {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.55;
  margin-bottom: 10px;
}
.quiz-choices {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 0;
}
.quiz-choices button {
  display: block;
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--card-bg);
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.5;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
  min-height: 48px;
  -webkit-tap-highlight-color: transparent;
}
.quiz-choices button:hover:not(:disabled) {
  border-color: var(--primary);
  background: var(--primary-light);
}
.quiz-choices button:active:not(:disabled) { transform: scale(0.98); }
.quiz-choices button:disabled { cursor: default; }
.quiz-choices button.correct {
  border-color: var(--accent-green);
  background: var(--accent-green-light);
  color: #065f46;
  font-weight: 700;
}
.quiz-choices button.wrong {
  border-color: var(--accent-red);
  background: var(--accent-red-light);
  color: #991b1b;
}
.quiz-explanation {
  margin-top: 10px;
  padding: 12px 16px;
  background: var(--accent-green-light);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent-green);
  font-size: 0.86rem;
  line-height: 1.7;
  display: none;
}
.quiz-explanation.show {
  display: block;
  animation: slideDown 0.25s ease both;
}

/* ---- 比較カードタイトル ---- */
.compare-card-title {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 8px;
  line-height: 1.3;
}

/* ---- スポンサーエリア ---- */
.sponsor-area {
  margin: 28px 0 8px;
  padding: 20px 16px;
  border-top: 1px solid var(--border);
  text-align: center;
}
.sponsor-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 12px;
}
.sponsor-inner {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  overflow: hidden;
}

/* ---- モバイルUI改善 ---- */
/* タッチフィードバック強化 */
@media (hover: none) and (pointer: coarse) {
  .topic-card:active { background: var(--primary-light); transform: scale(0.99); }
  .nav-btn:active { background: var(--primary-light); }
  .back-link:active { background: #c4b5fd; }
  .filter-btn:active { transform: scale(0.95); }
}

/* ダイアグラムのモバイル表示改善 */
.diagram-wrap {
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
}
.diagram-box {
  max-width: none;
}

/* テーブルのモバイル改善 */
@media (max-width: 480px) {
  .table-wrap {
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
  }
  .table-wrap table {
    min-width: 360px;
  }
  .quiz-question { font-size: 0.9rem; }
  .quiz-choices button { font-size: 0.86rem; padding: 11px 14px; }
  .sponsor-inner { gap: 8px; }
  .compare-card-title { font-size: 0.87rem; }
}

/* 読みやすさ向上 */
@media (max-width: 380px) {
  .quiz-choices button { font-size: 0.84rem; padding: 10px 12px; min-height: 46px; }
  .section-title { font-size: 0.93rem; }
}

/* ---- ユーティリティ ---- */
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mb-4 { margin-bottom: 4px; }
.mb-8 { margin-bottom: 8px; }
.text-center { text-align: center; }
.text-sm { font-size: 0.85rem; }
.text-xs { font-size: 0.75rem; }
.font-bold { font-weight: 700; }
.text-muted { color: var(--text-muted); }
