/* Gliders Learn — 受講者向け学習ポータル */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }

body {
  font-family: "Segoe UI", "Meiryo", "Hiragino Kaku Gothic ProN", sans-serif;
  background: #f8fafc;
  color: #1e293b;
  min-height: 100vh;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
}

/* ===== ヘッダー（dashboard と共通） ===== */
.site-header { background: #1e293b; padding: 16px 32px; border-bottom: 1px solid #334155; }
.header-inner { max-width: 1080px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; }
.site-header-logo { display: flex; align-items: baseline; gap: 6px; }
.site-logo { font-family: 'Outfit', sans-serif; font-size: 1.4rem; font-weight: 700; color: #ffffff; text-decoration: none; letter-spacing: -0.3px; }
.site-logo:hover { opacity: 0.7; }
.logo-dot { color: #60a5fa; }
.site-brand { font-family: 'Outfit', sans-serif; font-size: 0.85rem; font-weight: 600; color: #60a5fa; letter-spacing: 0.5px; }
.header-nav { display: flex; gap: 20px; }
.header-nav a { color: #94a3b8; text-decoration: none; font-size: 0.9rem; font-weight: 500; transition: color 0.2s; }
.header-nav a:hover, .header-nav a.nav-active { color: #ffffff; }

/* ===== レイアウト ===== */
.container { max-width: 1080px; margin: 0 auto; padding: 32px 24px; flex: 1; width: 100%; }
.page-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 8px; color: #0f172a; }
.page-subtitle { color: #64748b; font-size: 0.95rem; margin-bottom: 24px; }

/* コース概要（HERO 相当: 概要文 + 公開日 / 最終更新日） */
.course-hero { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 20px 24px; margin-bottom: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.03); }
.course-hero-desc { color: #334155; font-size: 0.95rem; line-height: 1.7; margin: 0 0 14px; }
.course-hero-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; color: #64748b; font-size: 0.85rem; }
.course-hero-meta strong { color: #0f172a; font-weight: 600; }
.course-hero-sep { color: #cbd5e1; }

.loading-state, .error-state { background: #fff; border-radius: 12px; padding: 24px; text-align: center; color: #64748b; }
.error-state { color: #dc2626; border: 1px solid #fecaca; background: #fef2f2; }
.error-actions { margin-top: 16px; text-align: center; }

/* ===== カード ===== */
.card { background: #fff; border-radius: 12px; padding: 24px; margin-bottom: 20px; border: 1px solid #e2e8f0; box-shadow: 0 1px 3px rgba(0,0,0,0.03); }
.card h2 { font-size: 1.1rem; font-weight: 700; margin-bottom: 12px; color: #0f172a; }
.card-description { color: #475569; font-size: 0.9rem; margin-bottom: 16px; }

/* ===== Resume CTA ===== */
.resume-card { background: linear-gradient(135deg, #3b82f6, #6366f1); color: #fff; border: none; padding: 28px; }
.resume-card h2 { color: #fff; margin-bottom: 4px; }
.resume-card p { font-size: 0.95rem; opacity: 0.92; margin-bottom: 16px; }
.resume-card .btn { background: #fff; color: #3b82f6; font-weight: 700; }
.resume-card .btn:hover { background: #eff6ff; }

/* ===== モジュール行 × A/B/C カード ===== */
.module-row { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 20px 24px; margin-bottom: 16px; display: flex; gap: 20px; align-items: flex-start; }
.module-row.locked { opacity: 0.55; }
.module-row.completed { border-left: 4px solid #10b981; }
@media (max-width: 640px) { .module-row { flex-direction: column; gap: 14px; } }

.module-thumbnail { flex: 0 0 100px; width: 100px; height: 100px; border-radius: 8px; overflow: hidden; background: #f8fafc; border: 1px solid #e2e8f0; display: flex; align-items: center; justify-content: center; }
.module-thumbnail img { width: 100%; height: 100%; object-fit: cover; display: block; }
.module-thumbnail.placeholder { background: #e2e8f0; color: #64748b; font-size: 2rem; font-weight: 700; font-family: 'Outfit', 'Segoe UI', sans-serif; }

.module-body { flex: 1; min-width: 0; }

.module-header { display: flex; align-items: baseline; gap: 12px; margin-bottom: 4px; flex-wrap: wrap; }
.module-chapter { font-size: 0.8rem; font-weight: 700; color: #3b82f6; letter-spacing: 0.05em; }
.module-title { font-size: 1.05rem; font-weight: 700; color: #0f172a; }
.module-badge { font-size: 0.72rem; padding: 2px 8px; border-radius: 999px; }
.module-badge.completed { background: #d1fae5; color: #047857; }
.module-badge.locked { background: #f1f5f9; color: #64748b; }
.module-description { color: #64748b; font-size: 0.85rem; margin-bottom: 14px; line-height: 1.55; }

.section-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 640px) { .section-grid { grid-template-columns: 1fr; } }

.section-card { border: 1px solid #e2e8f0; border-radius: 8px; padding: 14px; background: #fff; cursor: pointer; transition: all 0.15s; text-decoration: none; color: inherit; display: block; }
.section-card:hover:not(.disabled) { border-color: #3b82f6; background: #f8fafc; transform: translateY(-1px); }
.section-card.disabled { cursor: not-allowed; opacity: 0.5; }
.section-card .sec-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.section-card .sec-key { font-size: 0.75rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; color: #fff; }
.section-card .sec-key.A { background: #0ea5e9; }
.section-card .sec-key.B { background: #f59e0b; }
.section-card .sec-key.C { background: #10b981; }
.section-card .sec-title { font-weight: 600; font-size: 0.95rem; color: #0f172a; }
.section-card .sec-meta { display: flex; align-items: center; gap: 8px; font-size: 0.78rem; color: #64748b; }
.section-card .sec-status { margin-left: auto; font-weight: 600; }
.section-card .sec-status.not_started { color: #94a3b8; }
.section-card .sec-status.in_progress { color: #f59e0b; }
.section-card .sec-status.completed { color: #10b981; }

/* ===== ボタン ===== */
.btn { display: inline-block; padding: 10px 20px; border-radius: 8px; font-size: 0.95rem; font-weight: 600; text-decoration: none; cursor: pointer; border: 1px solid transparent; transition: all 0.15s; }
.btn-primary { background: #3b82f6; color: #fff; }
.btn-primary:hover { background: #2563eb; }
.btn-secondary { background: #fff; color: #475569; border-color: #cbd5e1; }
.btn-secondary:hover { background: #f1f5f9; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ===== モジュールビューア (module.html) ===== */
.viewer-shell { display: grid; grid-template-columns: 260px 1fr; gap: 24px; max-width: 1200px; margin: 24px auto; padding: 0 24px; width: 100%; flex: 1; align-items: start; }
@media (max-width: 900px) { .viewer-shell { grid-template-columns: 1fr; } }

.viewer-sidebar { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 16px; position: sticky; top: 24px; max-height: calc(100vh - 48px); overflow-y: auto; }
.vs-key-visual { width: 100%; aspect-ratio: 1 / 1; margin-bottom: 14px; border-radius: 8px; overflow: hidden; border: 1px solid #e2e8f0; background: #f8fafc; }
.vs-key-visual img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vs-key-visual .placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 3rem; font-weight: 700; color: #64748b; background: #e2e8f0; font-family: 'Outfit', 'Segoe UI', sans-serif; }
.viewer-sidebar h3 { font-size: 0.85rem; color: #3b82f6; margin-bottom: 4px; font-weight: 700; letter-spacing: 0.03em; }
.viewer-sidebar .vs-title { font-size: 1rem; font-weight: 700; color: #0f172a; margin-bottom: 8px; }
.viewer-sidebar .vs-progress { font-size: 0.75rem; color: #64748b; margin-bottom: 12px; }
.viewer-sidebar .vs-back { display: inline-block; color: #3b82f6; font-size: 0.82rem; margin-top: 8px; text-decoration: none; }
.viewer-sidebar .vs-back:hover { text-decoration: underline; }

.page-list { list-style: none; margin: 12px 0 0; padding: 0; }
.page-list li { padding: 8px 10px; border-radius: 6px; cursor: pointer; font-size: 0.85rem; color: #475569; transition: all 0.15s; margin-bottom: 2px; }
.page-list li:hover { background: #f1f5f9; }
.page-list li.active { background: #3b82f6; color: #fff; font-weight: 600; }
.page-list li.locked { opacity: 0.45; cursor: not-allowed; pointer-events: none; }
.page-list li .pg-no { font-size: 0.7rem; opacity: 0.7; margin-right: 6px; }

.viewer-main { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; min-height: calc(100vh - 140px); }

.viewer-toolbar { display: flex; align-items: center; gap: 12px; padding: 14px 20px; background: #f8fafc; border-bottom: 1px solid #e2e8f0; flex-wrap: wrap; }
.viewer-toolbar .section-tag { font-size: 0.72rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; color: #fff; }
.viewer-toolbar .section-tag.A { background: #0ea5e9; }
.viewer-toolbar .section-tag.B { background: #f59e0b; }
.viewer-toolbar .section-tag.C { background: #10b981; }
.viewer-toolbar .section-tag.flat { background: #0d9488; }
.viewer-toolbar .progress-bar { flex: 1; height: 6px; background: #e2e8f0; border-radius: 999px; overflow: hidden; min-width: 120px; }
.viewer-toolbar .progress-fill { height: 100%; background: #3b82f6; transition: width 0.25s; }
.viewer-toolbar .page-counter { font-size: 0.8rem; color: #64748b; white-space: nowrap; }

.viewer-content { flex: 1; padding: 32px 40px; overflow-y: auto; }
@media (max-width: 640px) { .viewer-content { padding: 24px 20px; } }

.next-module-hint {
  margin-top: 28px;
  padding: 16px 20px;
  background: #f1f5f9;
  border-left: 3px solid #1e3a5f;
  color: #334155;
  border-radius: 6px;
  font-size: 0.95rem;
  line-height: 1.8;
}

.viewer-footer { display: flex; gap: 10px; padding: 14px 20px; background: #f8fafc; border-top: 1px solid #e2e8f0; flex-wrap: wrap; }
.viewer-footer .spacer { flex: 1; }

/* ===== コンテンツ（Markdown） ===== */
.content-card { max-width: 760px; margin: 0 auto; }
.content-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.meta-tag { font-size: 0.72rem; padding: 3px 8px; border-radius: 4px; background: #f1f5f9; color: #475569; }
.content-title { font-size: 1.4rem; font-weight: 700; margin-bottom: 20px; line-height: 1.35; color: #0f172a; }

.md-content h2 { font-size: 1.15rem; color: #1e40af; margin: 22px 0 12px; padding-bottom: 6px; border-bottom: 1px solid #e2e8f0; }
.md-content h3 { font-size: 1.05rem; color: #1e40af; margin: 18px 0 10px; }
.md-content h4 { font-size: 0.98rem; color: #0f172a; margin: 14px 0 8px; }
.md-content p { line-height: 1.85; margin-bottom: 12px; font-size: 0.96rem; }
.md-content strong { color: #b45309; font-weight: 700; }
.md-content ul, .md-content ol { margin: 8px 0 14px 22px; }
.md-content li { line-height: 1.8; margin-bottom: 4px; font-size: 0.96rem; }
.md-content table { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: 0.9rem; }
.md-content th, .md-content td { padding: 8px 12px; border: 1px solid #e2e8f0; }
.md-content th { background: #f8fafc; text-align: left; font-weight: 700; }
.md-content blockquote { border-left: 3px solid #3b82f6; padding: 8px 16px; margin: 12px 0; background: #eff6ff; border-radius: 0 6px 6px 0; }
.md-content pre { background: #f1f5f9; padding: 16px; border-radius: 8px; overflow-x: auto; margin: 12px 0; font-size: 0.85rem; line-height: 1.6; }
.md-content code { font-family: 'Cascadia Code', 'Consolas', monospace; background: #f1f5f9; padding: 2px 6px; border-radius: 4px; font-size: 0.88em; }
.md-content pre code { background: none; padding: 0; }
.md-content hr { border: none; border-top: 1px solid #e2e8f0; margin: 20px 0; }
.md-content .checklist-item { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 8px; }
.md-content .checklist-box { width: 18px; height: 18px; border: 2px solid #cbd5e1; border-radius: 4px; margin-top: 4px; flex-shrink: 0; }

/* ===== クイズ ===== */
.quiz-situation { background: #fffbeb; border-radius: 8px; padding: 14px 18px; margin-bottom: 16px; line-height: 1.75; font-size: 0.95rem; border-left: 4px solid #f59e0b; color: #78350f; }
.quiz-question { font-size: 1.05rem; font-weight: 600; margin-bottom: 14px; color: #0f172a; }
.quiz-choices { display: flex; flex-direction: column; gap: 8px; }
.choice-btn { display: flex; gap: 10px; padding: 12px 16px; border: 1px solid #e2e8f0; border-radius: 8px; background: #fff; cursor: pointer; text-align: left; font-size: 0.93rem; line-height: 1.6; transition: all 0.15s; color: #1e293b; }
.choice-btn:hover { border-color: #3b82f6; }
.choice-btn .choice-key { font-weight: 700; color: #3b82f6; min-width: 20px; }
.choice-btn.correct { border-color: #10b981; background: #ecfdf5; }
.choice-btn.incorrect { border-color: #ef4444; background: #fef2f2; }
.choice-feedback { margin-top: 8px; padding: 10px 14px; border-radius: 6px; font-size: 0.85rem; line-height: 1.65; display: none; }
.choice-btn.correct .choice-feedback, .choice-btn.incorrect .choice-feedback { display: block; background: rgba(0,0,0,0.04); }
.choice-btn.correct .choice-feedback { color: #065f46; }
.choice-btn.incorrect .choice-feedback { color: #991b1b; }
.quiz-explanation { margin-top: 16px; padding: 14px 18px; background: #f3e8ff; border-left: 3px solid #a855f7; border-radius: 0 6px 6px 0; font-size: 0.9rem; line-height: 1.75; display: none; color: #3b0764; }

/* ===== モーダル ===== */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.6); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px; }
.modal { background: #fff; border-radius: 12px; max-width: 480px; width: 100%; padding: 28px; text-align: center; box-shadow: 0 20px 40px rgba(0,0,0,0.2); }
.modal h3 { font-size: 1.25rem; font-weight: 700; margin-bottom: 12px; color: #0f172a; }
.modal p { color: #475569; margin-bottom: 20px; }
.modal .modal-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.modal.completed h3 { color: #047857; }

/* ===== 修了テスト (final-exam.html / module-row.final-exam) ===== */
.module-row.final-exam { border-left: 4px solid #a855f7; }
.module-row.final-exam .module-thumbnail.placeholder { background: #f3e8ff; color: #7e22ce; }
.module-badge.final-exam { background: #f3e8ff; color: #7e22ce; font-weight: 700; }
.module-badge.exam-locked { background: #fef3c7; color: #92400e; }
.module-badge.stage-locked { background: #e0f2fe; color: #075985; }

.final-exam-action { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 14px; border: 1px dashed #cbd5e1; border-radius: 8px; background: #fafafa; }
.final-exam-action .fea-meta { flex: 1; min-width: 0; font-size: 0.85rem; color: #475569; line-height: 1.55; }
.final-exam-action .fea-meta strong { color: #7e22ce; }

/* ===== 補完モジュール (M0 オリエンテーション / M11 総括) ===== */
.module-row.intro { border-left: 4px solid #0d9488; }
.module-row.intro .module-thumbnail.placeholder { background: #ccfbf1; color: #0f766e; }
.module-badge.intro { background: #ccfbf1; color: #0f766e; font-weight: 700; }
.module-row.summary { border-left: 4px solid #1e40af; }
.module-row.summary .module-thumbnail.placeholder { background: #dbeafe; color: #1e3a8a; }
.module-badge.summary { background: #dbeafe; color: #1e3a8a; font-weight: 700; }

.final-exam.container { max-width: 880px; }

.exam-intro .exam-rules-list { margin: 12px 0 20px 22px; line-height: 1.85; color: #1e293b; font-size: 0.95rem; }
.exam-intro .exam-intro-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

.exam-header { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.exam-progress { font-size: 0.9rem; color: #475569; font-weight: 600; padding: 6px 14px; background: #fff; border: 1px solid #e2e8f0; border-radius: 999px; }

.content-card.exam-question { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 20px 24px; margin-bottom: 16px; max-width: none; }
.exam-choices .choice-btn.selected { border-color: #3b82f6; background: #eff6ff; }
.exam-choices .choice-btn.selected .choice-key { color: #1d4ed8; }

.exam-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }

/* 結果画面 */
.result-summary { text-align: center; padding: 28px; }
.result-summary .result-icon { font-size: 2.4rem; margin-bottom: 6px; }
.result-summary h2 { font-size: 1.3rem; }
.result-summary.passed { background: #ecfdf5; border-color: #6ee7b7; }
.result-summary.passed h2 { color: #047857; }
.result-summary.failed { background: #fef2f2; border-color: #fecaca; }
.result-summary.failed h2 { color: #b91c1c; }
.result-summary .result-score { font-size: 1.05rem; margin: 8px 0 12px; color: #0f172a; }

.result-section-title { font-size: 1.05rem; font-weight: 700; margin: 24px 0 12px; color: #0f172a; }

.result-item { padding: 18px 22px; }
.result-item.correct { border-left: 4px solid #10b981; }
.result-item.incorrect { border-left: 4px solid #ef4444; }
.result-verdict { font-size: 0.78rem; padding: 3px 10px; border-radius: 999px; font-weight: 700; margin-left: auto; }
.result-verdict.correct { background: #d1fae5; color: #047857; }
.result-verdict.incorrect { background: #fee2e2; color: #b91c1c; }
.result-answer { background: #f8fafc; border-radius: 6px; padding: 10px 14px; margin: 10px 0; font-size: 0.9rem; line-height: 1.7; color: #1e293b; }
.result-answer div { margin-bottom: 4px; }
.result-feedback { background: #fffbeb; border-left: 3px solid #f59e0b; border-radius: 0 6px 6px 0; padding: 10px 14px; margin: 10px 0; font-size: 0.88rem; line-height: 1.7; color: #78350f; }
.result-explanation { background: #f3e8ff; border-left: 3px solid #a855f7; border-radius: 0 6px 6px 0; padding: 10px 14px; margin: 10px 0; font-size: 0.88rem; line-height: 1.7; color: #3b0764; }

/* ===== コース一覧（/training/index.html） ===== */
.course-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
@media (max-width: 720px) { .course-list { grid-template-columns: 1fr; } }
.course-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 20px; text-decoration: none; color: inherit; display: flex; flex-direction: column; gap: 14px; transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s; }
.course-card:not(.disabled):hover { border-color: #3b82f6; transform: translateY(-2px); box-shadow: 0 4px 12px rgba(59, 130, 246, 0.12); }
.course-card.disabled { opacity: 0.6; cursor: not-allowed; }
.course-card-thumb { width: 100%; height: 96px; border-radius: 8px; background: linear-gradient(135deg, #3b82f6, #6366f1); display: flex; align-items: center; justify-content: center; color: #fff; font-family: 'Outfit', 'Segoe UI', sans-serif; font-size: 1.4rem; font-weight: 700; letter-spacing: 0.5px; }
.course-card.disabled .course-card-thumb { background: #cbd5e1; color: #64748b; }
.course-card-body { display: flex; flex-direction: column; gap: 8px; flex: 1; }
.course-card-title { font-size: 1.05rem; font-weight: 700; color: #0f172a; }
.course-card-description { color: #64748b; font-size: 0.85rem; line-height: 1.6; flex: 1; }
.course-card-cta { color: #3b82f6; font-weight: 600; font-size: 0.9rem; margin-top: auto; }
.course-card-badge { display: inline-block; background: #f1f5f9; color: #64748b; font-size: 0.72rem; padding: 3px 10px; border-radius: 999px; align-self: flex-start; }

/* ===== ユーティリティ ===== */
.hidden { display: none !important; }
