* { box-sizing: border-box; }
html { color: #221F50; background: #fff; font-family: system-ui, sans-serif; line-height: 1.6; }
body { margin: 0; }
main { width: 100%; max-width: 480px; margin: 40px auto; padding: 0 20px; overflow-wrap: anywhere; }
header { margin-bottom: 24px; font-weight: 700; }
h1 { font-size: 1.5rem; margin: 0 0 24px; }
form { margin: 0 0 20px; }
label { display: block; margin-top: 16px; }
input:not([type="hidden"]) { display: block; width: 100%; min-width: 0; height: 48px; padding: 8px 12px; border: 1px solid #5d5c78; border-radius: 4px; background: #fff; color: inherit; font: inherit; }
button { width: 100%; height: 48px; margin-top: 24px; border: 2px solid #221F50; border-radius: 4px; background: #221F50; color: #fff; font: inherit; font-weight: 700; cursor: pointer; }
button:hover { background: #fff; color: #221F50; }
button:active { background: #e6e7f2; color: #221F50; }
a { color: #077199; text-underline-offset: 3px; }
a:hover { color: #221F50; text-decoration-thickness: 3px; }
a:active { background: #e6e7f2; }
:focus-visible { outline: 3px solid #156db0; outline-offset: 3px; }
[role="alert"] { color: #8a1620; margin: 0 0 16px; }
@media (max-width: 480px) { main { margin-top: 24px; } }

/* Step 2: keep the existing authentication screens unchanged. */
main.admin { max-width: 960px; min-width: 0; }
.admin h1 { margin-top: 24px; }
.admin select { width: 100%; height: 48px; padding: 8px 12px; font: inherit; background: #fff; color: inherit; border: 1px solid #5d5c78; border-radius: 4px; }
.admin .table-scroll { width: 100%; max-width: 100%; overflow-x: auto; margin: 24px 0; }
.admin table { width: 100%; border-collapse: collapse; }
.admin th, .admin td { padding: 12px; text-align: left; vertical-align: top; border-bottom: 1px solid #d5d9e6; min-width: 100px; }
.admin th { white-space: nowrap; }
.admin .admin-button { display: flex; align-items: center; justify-content: center; width: 100%; height: 48px; padding: 0 16px; border: 2px solid #221F50; border-radius: 4px; background: #221F50; color: #fff; font-weight: 700; text-decoration: none; }
.small, .admin .small, .learning .small { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; height: 36px; width: auto; padding: 0 16px; margin: 0; white-space: nowrap; }
.admin .admin-button:hover { background: #fff; color: #221F50; }
.admin .admin-button:active { background: #e6e7f2; color: #221F50; }
.admin .admin-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.admin .row-action { margin: 0 0 8px; }
.admin .link-button { background: transparent; color: #077199; border-color: transparent; text-decoration: underline; }
.admin .link-button:hover { background: #221F50; color: #fff; }
.admin .link-button:active { background: #e6e7f2; color: #221F50; }
.admin dd { margin-left: 0; margin-bottom: 12px; }

/* Step 4: learner pages and quiz editor. */
main.learning { max-width: 640px; min-width: 0; }
.episode-list { list-style: none; padding: 0; margin: 24px 0; }
.episode-list li { padding: 16px 0; border-bottom: 1px solid #d5d9e6; }
.episode-list li a, .episode-list li span { display: block; }
.episode-list li span { margin-top: 8px; }
.learning fieldset { min-width: 0; margin: 24px 0; padding: 12px; border: 1px solid #5d5c78; border-radius: 4px; }
.learning legend { max-width: 100%; padding: 0 4px; }
.learning .quiz-choice { display: flex; align-items: center; gap: 12px; min-height: 44px; margin: 8px 0; padding: 8px; cursor: pointer; }
.learning .quiz-choice input { flex: 0 0 20px; width: 20px; height: 20px; padding: 0; margin: 0; }
.learning .quiz-choice span { min-width: 0; }
.learning .quiz-choice:hover { background: #e6e7f2; }
h2 { font-size: 1.125rem; }
h3 { font-size: 1rem; }
.learning .admin-button { display: flex; align-items: center; justify-content: center; width: 100%; height: 48px; margin: 24px 0; padding: 0 16px; border: 2px solid #221F50; border-radius: 4px; background: #221F50; color: #fff; font-weight: 700; text-decoration: none; }
.learning .admin-button:hover { background: #fff; color: #221F50; }
.learning .admin-button:active { background: #e6e7f2; color: #221F50; }
.admin textarea { display: block; width: 100%; min-height: 96px; padding: 8px 12px; border: 1px solid #5d5c78; border-radius: 4px; font: inherit; color: inherit; background: #fff; resize: vertical; }

/* Step 5: company learning status. */
.status-counts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 24px 0; }
.status-counts dl { min-width: 0; margin: 0; padding: 16px; border: 1px solid #d5d9e6; border-radius: 4px; }
.status-counts dt { font-weight: 700; }
.status .status-counts dd { margin: 8px 0 0; }
@media (max-width: 480px) { .status-counts { grid-template-columns: 1fr; } }

/* Step 6: shared navigation and keyboard focus. */
.site-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; width: 100%; max-width: 960px; margin: 24px auto; padding: 0 20px; overflow-wrap: anywhere; }
.service-name { min-width: 0; }
.header-controls { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 12px; min-width: 0; max-width: 100%; margin-left: auto; }
.header-controls nav { display: flex; flex-wrap: wrap; gap: 12px; min-width: 0; }
.header-controls .user-name { min-width: 0; }
.header-controls form { margin: 0; }
.quiz-choice:has(input:focus-visible) { outline: 3px solid #156db0; outline-offset: 3px; }
@media (max-width: 480px) {
  .site-header .service-name { flex-basis: 100%; }
  .header-controls { justify-content: flex-start; margin-left: 0; }
}

/* Step 3: embedded video and learner controls. */
.video-player { width: 100%; min-width: 0; }
.video-frame { width: 100%; aspect-ratio: 16 / 9; }
.video-frame iframe { display: block; width: 100%; height: 100%; border: 0; }
.player-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0; }
.player-time { white-space: nowrap; }
.player-controls .player-position { flex: 1 1 100px; min-width: 0; max-width: 100%; width: 100px; }
.player-controls input.player-position { height: 36px; padding: 0; }
.video-player:fullscreen { padding: 16px; background: #fff; overflow: auto; }

.sound-credit { margin-top: 2.5rem; font-size: 0.8rem; color: #5d5c78; }
.kaisetsu { white-space: pre-line; }

/* 確認テストの結果と、解説の読み返し（2026-11-16 社長「合格の通知がしょぼい」「みづらい」）。 */
.result-banner { margin: 0 0 24px; padding: 24px 20px; border-radius: 8px; text-align: center; }
.result-banner p { margin: 0; }
.result-banner.is-pass { background: #eaf5fb; border: 2px solid #0a8fc0; color: #221F50; }
.result-banner.is-retry { background: #fbf6fb; border: 2px solid #90268F; color: #90268F; }
.result-mark { display: block; width: 64px; height: 64px; margin: 0 auto; }
.is-pass .result-title { margin-top: 12px; font-size: 1.75rem; font-weight: 700; }
.is-retry .result-title { font-size: 1.125rem; font-weight: 700; }
.result-banner .result-episode { margin-top: 8px; font-size: 0.9rem; }
.result-card { margin: 0 0 16px; padding: 16px 20px; border: 1px solid #d5d9e6; border-radius: 8px; }
.result-card h2, .result-card .result-q { margin: 0 0 12px; font-size: 1.05rem; line-height: 1.5; }
.result-no { display: inline-block; margin-right: 10px; padding: 1px 10px; border-radius: 999px; background: #221F50; color: #fff; font-size: 0.8rem; vertical-align: 2px; white-space: nowrap; }
.result-yours { margin: 0; }
.result-yours dt { font-size: 0.8rem; color: #5d5c78; }
.result-yours dd { margin: 2px 0 0; }
.result-judge { display: inline-block; margin: 10px 0 0; padding: 2px 12px; border-radius: 4px; font-size: 0.9rem; font-weight: 700; }
.is-ok .result-judge { background: #eaf5fb; color: #221F50; }
.is-ng .result-judge { background: #f7f0f7; color: #90268F; }
.kaisetsu-box { margin-top: 14px; padding: 12px 16px; background: #f2f8fc; border-left: 4px solid #077199; border-radius: 0 6px 6px 0; }
.kaisetsu-box h3, .kaisetsu-box h4 { margin: 0 0 6px; font-size: 0.8rem; color: #077199; }
.kaisetsu-box p { margin: 0; }
.quiz-review > h2 { margin: 32px 0 16px; font-size: 1.2rem; }

/* 講座の一覧：サムネイル・進み具合・済マーク（2026-11-16 社長「達成感を感じられるように」）。 */
main.learning:has(.episode-list) { max-width: 960px; }
.course-progress { margin: 0 0 24px; padding: 16px 20px; border: 1px solid #d5d9e6; border-radius: 8px; }
.course-progress p { margin: 0 0 10px; font-weight: 700; }
.course-progress.is-complete { background: #eaf5fb; border: 2px solid #0a8fc0; color: #221F50; }
.course-progress progress { display: block; width: 100%; height: 12px; border: 0; border-radius: 999px; overflow: hidden; background: #e6e7f2; accent-color: #0a8fc0; }
.course-progress progress::-webkit-progress-bar { background: #e6e7f2; }
.course-progress progress::-webkit-progress-value { background: #0a8fc0; border-radius: 999px; }
.course-progress progress::-moz-progress-bar { background: #0a8fc0; }
.episode-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; margin: 0; }
.episode-list li.course-card { padding: 0; border: 1px solid #d5d9e6; border-radius: 8px; overflow: hidden; background: #fff; }
.episode-list li.course-card a { display: block; height: 100%; color: inherit; text-decoration: none; }
.episode-list li.course-card a:hover { background: #f2f8fc; }
.episode-list li.course-card span { margin: 0; }
.course-thumb { position: relative; display: block; aspect-ratio: 16 / 9; background: #e6e7f2; }
.course-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.episode-list li .course-done { position: absolute; top: 8px; left: 8px; display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px 4px 6px; border-radius: 999px; background: #0a8fc0; color: #fff; font-size: 0.9rem; font-weight: 700; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35); }
.course-card.st-passed { border-color: #0a8fc0; box-shadow: 0 0 0 1px #0a8fc0; }
.course-body { display: block; padding: 12px 16px 16px; }
.course-name { display: block; font-weight: 700; line-height: 1.5; }
.episode-list li .course-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; font-size: 0.85rem; }
.episode-list li .course-status { display: inline-block; padding: 2px 12px; border-radius: 4px; font-weight: 700; background: #e6e7f2; color: #5d5c78; }
.episode-list li .course-length { display: inline; color: #5d5c78; }
.episode-list li.st-passed .course-status { background: #0a8fc0; color: #fff; }
.episode-list li.st-watched .course-status { background: #eaf5fb; color: #077199; }
.episode-list li.st-watching .course-status { background: #eef3f9; color: #221F50; }

/* 色は eラーニングのご提案資料（v18）に合わせる（2026-11-16 社長）：紺 #221F50・水色 #0a8fc0・薄い水色 #eaf5fb・線 #d5d9e6・補助の文字 #5d5c78・紫 #90268F。 */
/* 表紙と同じ形：薄い水色の地（#f2f8fc→#e3f1f9）・左端に紺の細い帯・紺の文字・水色の差し色。中身の枠は白。 */
html { min-height: 100%; background: linear-gradient(180deg, #f2f8fc 0%, #e3f1f9 100%) fixed; }
body::before { content: ""; position: fixed; left: 0; top: 0; bottom: 0; width: 10px; background: #221F50; z-index: 1; }
@media (max-width: 480px) { body::before { width: 5px; } }
.site-header .service-name { color: #221F50; font-size: 1.05rem; text-decoration: none; }
.site-header { padding-bottom: 16px; border-bottom: 1px solid #d5d9e6; }
.site-header > * { position: relative; }
.site-header { max-width: 960px; }
h1 { letter-spacing: 0.02em; }
.course-progress, .result-card, .learning fieldset, .admin table { background: #fff; }
.episode-list li.course-card { box-shadow: 0 4px 14px rgba(34, 31, 80, 0.08); }
.episode-list li.course-card.st-passed { box-shadow: 0 0 0 1px #0a8fc0, 0 4px 14px rgba(34, 31, 80, 0.08); }
.result-banner.is-pass, .result-banner.is-retry { background: #fff; }
/* 合格スタンプ（2026-11-16 社長「案Cにする」）：絵を薄くして、まん中に大きく押す。 */
.episode-list li .course-done { top: 50%; left: 50%; right: auto; bottom: auto; padding: 0; border-radius: 50%; background: none; box-shadow: none; transform: translate(-50%, -50%) rotate(-12deg); line-height: 0; }
.course-done svg { display: block; width: 116px; height: 116px; }
.episode-list li.st-passed .course-thumb { background: #fff; }
.episode-list li.st-passed .course-thumb img { opacity: 0.55; }

/* 状態の札（2026-11-16 社長「案4にする」）：未受講＝灰の地／視聴中＝紺のベタ＋再生の印／視聴済み＝白地に紫の線／テスト合格＝水色のベタ。 */
.episode-list li .course-status { border: 2px solid transparent; }
.episode-list li.st-new .course-status { background: #e6e7f2; border-color: #e6e7f2; color: #5d5c78; }
.episode-list li.st-watching .course-status { background: #221F50; border-color: #221F50; color: #fff; }
.episode-list li.st-watching .course-status::before { content: "▶ "; font-size: 0.75em; }
.episode-list li.st-watched .course-status { background: #fff; border-color: #90268F; color: #90268F; }
.episode-list li.st-passed .course-status { border-color: #0a8fc0; }
