/* ==========================================================================
   講習アプリ（ログイン前後）のスタイル
   プレイヤーは「上映ステージ」方式: ネイビーの背景に白いスライドキャンバスを置き、
   下部のコントロールバーに 前へ／読了バー／次へ を集約する。
   ========================================================================== */

.app-body { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }

.app-header {
  background: #fff; border-bottom: 1px solid var(--edge);
  padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.app-brand {
  font-weight: 700; color: var(--navy); text-decoration: none; font-size: 0.95rem; letter-spacing: .01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.app-user { font-size: 0.8rem; display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
.app-user__name { color: #56616d; max-width: 32vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-user__out { white-space: nowrap; }
@media (max-width: 520px) {
  .app-brand { font-size: 0.85rem; }
  .app-user__name { display: none; }
}
.app-user__out { color: #6a7480; text-decoration: none; border-bottom: 1px solid #c6ced6; padding-bottom: 1px; }
.app-user__out:hover { color: var(--base); border-color: var(--base); }

.app-main { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: 22px 14px 40px; }

.app-footer { border-top: 1px solid var(--edge); padding: 16px; text-align: center; font-size: 0.75rem; color: #8a94a0; }

/* ==========================================================================
   認証系（登録・ログイン）
   ========================================================================== */
.auth-card {
  background: #fff; border: 1px solid var(--edge); border-radius: 18px;
  padding: 34px 26px 28px; max-width: 460px; margin: 26px auto;
  box-shadow: 0 10px 34px rgba(30, 70, 112, .07), 0 2px 6px rgba(30, 70, 112, .04);
}
.auth-card h1 { font-size: 1.3rem; margin-bottom: 6px; letter-spacing: .01em; }
.auth-card .desc { font-size: 0.88rem; color: #4a545f; margin-bottom: 18px; }
.auth-card label { display: block; font-weight: 700; font-size: 0.88rem; margin: 16px 0 5px; }
.auth-card label .req {
  display: inline-block; vertical-align: 1px; color: var(--care); font-size: 0.68rem; margin-left: 7px;
  background: var(--care-bg); border: 1px solid var(--care-line); border-radius: 999px; padding: 0 8px; line-height: 1.6;
}
.auth-card input[type="text"],
.auth-card input[type="email"],
.auth-card input[type="password"] {
  width: 100%; font-size: 1rem; font-family: inherit;
  padding: 11px 13px; border: 1.5px solid #c2cbd4; border-radius: 10px; background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.auth-card input::placeholder { color: #a6afb9; }
.auth-card input:focus { outline: none; border-color: var(--base); box-shadow: 0 0 0 3px rgba(43, 94, 150, .16); }
.auth-card input[disabled] { background: #f2f5f8; color: #56616d; }
.auth-card .hint { font-size: 0.78rem; color: #6a7480; margin-top: 4px; }
.auth-card .btn { margin-top: 22px; }
.auth-card .alt { text-align: center; font-size: 0.85rem; margin-top: 16px; }

/* 登録ステップ表示 */
.steps { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 0 0 20px; }
.steps .s {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.72rem; font-weight: 700; color: #9aa5b1; white-space: nowrap;
}
.steps .s .dot {
  width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: #edf1f5; color: #9aa5b1; font-size: 0.72rem; border: 1.5px solid #d5dce3;
}
.steps .s.is-current { color: var(--base); }
.steps .s.is-current .dot { background: var(--base); border-color: var(--base); color: #fff; }
.steps .s.is-done { color: var(--ok); }
.steps .s.is-done .dot { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok); }
.steps .bar { width: 18px; height: 1.5px; background: #d5dce3; }

.msg-ok { background: var(--ok-bg); border: 1.5px solid var(--ok-line); color: var(--ok); border-radius: 10px; padding: 12px 14px; font-size: 0.9rem; margin-bottom: 14px; }
.msg-err { background: #fdf0f0; border: 1.5px solid #c98a8a; color: #8a2f2f; border-radius: 10px; padding: 12px 14px; font-size: 0.9rem; margin-bottom: 14px; }
.msg-info { background: var(--base-bg); border: 1.5px solid #9dbcdd; color: var(--base-dark); border-radius: 10px; padding: 12px 14px; font-size: 0.9rem; margin-bottom: 14px; }

/* ==========================================================================
   プレイヤー（上映ステージ）
   ========================================================================== */
body.player {
  background:
    radial-gradient(1200px 500px at 50% -10%, rgba(86, 140, 197, .25), rgba(86, 140, 197, 0) 60%),
    linear-gradient(180deg, #101a29 0%, #16263a 55%, #22405f 100%);
}
body.player .app-header { background: rgba(255, 255, 255, .06); border-bottom: 1px solid rgba(255, 255, 255, .12); backdrop-filter: blur(6px); }
body.player .app-brand { color: #fff; }
body.player .app-user__name { color: rgba(255, 255, 255, .75); }
body.player .app-user__out { color: rgba(255, 255, 255, .65); border-color: rgba(255, 255, 255, .3); }
body.player .app-user__out:hover { color: #fff; border-color: #fff; }
body.player { --stage-w: min(100%, calc((100dvh - 200px) * 1.5)); }
body.player .app-main { max-width: 1040px; display: flex; flex-direction: column; padding-bottom: 18px; }
/* プレイヤーはシェル（左サイドバー）内に暗いステージを描く
   （body.shell の明色背景より優先させるため2クラスで指定） */
body.player.shell {
  background:
    radial-gradient(1200px 500px at 50% -10%, rgba(86, 140, 197, .25), rgba(86, 140, 197, 0) 60%),
    linear-gradient(180deg, #101a29 0%, #16263a 55%, #22405f 100%);
}
body.player .shell-main { padding: 20px 22px 12px; }
body.player .shell-inner { max-width: 1040px; display: flex; flex-direction: column; flex: 1; }
body.player .shell-footer { color: rgba(255, 255, 255, .45); }
/* プレイヤー内の通知もステージと同じ幅・同じ端に揃える */
body.player .msg-info, body.player .msg-ok, body.player .msg-err {
  width: var(--stage-w); margin-left: auto; margin-right: auto;
}
body.player .app-footer { border-top: none; color: rgba(255, 255, 255, .45); }

/* ---- 上部: コース全体の進捗（ステージと同じ幅・同じ端） ---- */
.course-progress { width: var(--stage-w); margin: 2px auto 14px; }
.course-progress .row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  font-size: 0.78rem; color: rgba(255, 255, 255, .75); margin-bottom: 7px;
}
.course-progress .row .n { font-weight: 700; color: #fff; font-size: 0.88rem; letter-spacing: .04em; }
.course-progress .row .n small { font-weight: 400; opacity: .75; margin-left: 2px; }
.course-progress .track { background: rgba(255, 255, 255, .18); border-radius: 999px; height: 6px; overflow: hidden; }
.course-progress .fill {
  background: linear-gradient(90deg, #9ec8ef, #fff); height: 100%; border-radius: 999px;
  transition: width .5s cubic-bezier(.4, 0, .2, 1); min-width: 6px;
}

/* ---- スライドキャンバス（比率 縦2:横3 で固定。あふれる内容は内部スクロール） ---- */
.stage { flex: 1; display: flex; flex-direction: column; }
.slide-canvas {
  position: relative; background: #fff; border-radius: 18px;
  box-shadow: 0 24px 60px rgba(5, 20, 40, .45), 0 4px 14px rgba(5, 20, 40, .28);
  aspect-ratio: 3 / 2;
  width: var(--stage-w);
  margin: 0 auto 14px;
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: slide-in .45s cubic-bezier(.25, .1, .25, 1) both;
}
/* 本文: キャンバス内でスクロール。内容が収まるときは上下中央（擬似要素のバネで実現） */
.slide-canvas .slide-body {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: 36px 48px 48px;
  display: flex; flex-direction: column;
}
.slide-canvas .slide-body::before { content: ""; margin-top: auto; }
.slide-canvas .slide-body::after  { content: ""; margin-bottom: auto; }
/* 続きがあることを示す下端のフェード（.has-more は app 側JSが付与） */
.slide-canvas > .scroll-hint {
  position: absolute; left: 0; right: 0; bottom: 0; height: 62px; z-index: 1;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0), #fff 80%);
  opacity: 0; transition: opacity .25s; pointer-events: none;
}
.slide-canvas.has-more > .scroll-hint { opacity: 1; }
/* キャンバス内スクロールバーを細く */
.slide-canvas .slide-body::-webkit-scrollbar { width: 8px; }
.slide-canvas .slide-body::-webkit-scrollbar-thumb { background: #c9d3dd; border-radius: 999px; }
.slide-canvas .slide-body::-webkit-scrollbar-track { background: transparent; }
/* デスクトップの盤面ではやや締まった組みにして収まりを良くする */
@media (min-width: 881px) {
  .slide-canvas .slide-body { font-size: 0.95rem; line-height: 1.88; }
}
/* スマホ・狭幅では比率固定をやめ、内容なりの高さ（ページ全体でスクロール） */
@media (max-width: 880px) {
  .slide-canvas { aspect-ratio: auto; width: 100%; min-height: 60vh; }
  .slide-canvas .slide-body { overflow-y: visible; padding: 28px 24px 50px; }
}
@keyframes slide-in {
  from { opacity: 0; transform: translateY(14px) scale(.985); }
  to   { opacity: 1; transform: none; }
}

/* ---- スライド内リビール（本文が上から順に、図の要素がひとつずつ現れる） ----
   .anim は course.php のJSが（reduce-motion でない環境でのみ）付与し、
   各要素の data-rv / --rvd で表示順を制御する。JSが動かない環境では即時表示。 */
.anim [data-rv] {
  opacity: 0;
  animation: rv-in .55s cubic-bezier(.22, .61, .36, 1) both;
  animation-delay: var(--rvd, 0s);
}
@keyframes rv-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}
/* 強調ボックスはわずかに弾む */
.anim .keypoint[data-rv], .anim .note[data-rv] { animation-name: rv-pop; }
@keyframes rv-pop {
  0%   { opacity: 0; transform: translateY(12px) scale(.965); }
  70%  { opacity: 1; transform: translateY(-2px) scale(1.005); }
  100% { opacity: 1; transform: none; }
}
/* 図の中のカード類は下からすっと */
.anim .pr[data-rv], .anim .tr-c[data-rv], .anim .ln-item[data-rv],
.anim .hier-item[data-rv], .anim .tl2-col[data-rv], .anim .quiz-choice[data-rv] {
  animation-name: rv-card;
}
@keyframes rv-card {
  from { opacity: 0; transform: translateY(10px) scale(.97); }
  to   { opacity: 1; transform: none; }
}
/* 矢印・コネクタは伸びるように */
.anim .ln-arrow[data-rv], .anim .hier-arrow[data-rv] { animation-name: rv-fade; }
@keyframes rv-fade { from { opacity: 0; } to { opacity: 1; } }
/* 見出しの下線が左から引かれる */
.anim .slide-canvas h2[data-rv] { border-bottom-color: transparent; position: relative; }
.anim .slide-canvas h2[data-rv]::after {
  content: ""; position: absolute; left: 0; bottom: -1px; height: 1px; background: var(--edge);
  width: 0; animation: rv-line .7s ease-out both;
  animation-delay: calc(var(--rvd, 0s) + .25s);
}
@keyframes rv-line { to { width: 100%; } }
@media (prefers-reduced-motion: reduce) {
  .anim [data-rv] { animation: none !important; opacity: 1; }
}
/* スライド上端のアクセントライン */
.slide-canvas::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: linear-gradient(90deg, var(--base), #6f9cc8);
}
.slide-canvas .kicker { margin-bottom: 2px; }
.slide-canvas h2 {
  font-size: 1.45rem; line-height: 1.45; margin: 6px 0 18px; letter-spacing: .01em;
  padding-bottom: 14px; border-bottom: 1px solid var(--edge);
}
.slide-canvas h3 { font-size: 1.02rem; color: var(--base); margin: 22px 0 8px; }
.slide-canvas p { margin-bottom: 1.05em; }
.slide-canvas .slide-body > *:last-child { margin-bottom: 0; }
/* スライド番号（キャンバス右下・スクロールしても定位置） */
.slide-num {
  position: absolute; right: 14px; bottom: 10px; z-index: 2;
  font-size: 0.75rem; color: #9aa5b1; letter-spacing: .1em; font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: rgba(255, 255, 255, .92); border-radius: 999px; padding: 2px 12px;
}
.slide-num b { color: var(--base); font-size: 0.85rem; }

@media (max-width: 640px) {
  .slide-canvas { border-radius: 14px; }
  .slide-canvas .slide-body { padding: 24px 18px 48px; }
  .slide-canvas h2 { font-size: 1.22rem; }
}

/* 歴史の系譜図（背景と建て付け・スライド内の図組み） */
.lineage { display: flex; align-items: stretch; gap: 0; max-width: 860px; margin: 0 auto; font-size: 0.8rem; text-align: center; }
.ln-item {
  flex: 1; background: #f1f4f7; border: 1.5px solid var(--line); border-radius: 10px;
  padding: 10px 8px 11px; line-height: 1.6; display: flex; flex-direction: column; justify-content: center;
}
.ln-item b { color: #4a545f; }
.ln-item span { font-size: 0.7rem; color: #6a7480; }
.ln-item.is-focus { background: var(--base-bg); border-color: var(--base); }
.ln-item.is-focus b { color: var(--base-dark); }
.ln-item.is-focus span { color: var(--base); }
.ln-arrow { width: 22px; position: relative; flex-shrink: 0; }
.ln-arrow::before {
  content: ""; position: absolute; top: 50%; left: 3px; right: 3px; height: 2px; background: var(--line);
}
.ln-arrow::after {
  content: ""; position: absolute; top: 50%; right: 1px; transform: translateY(-50%);
  border: 5px solid transparent; border-left: 6px solid var(--line); border-right: 0;
}
@media (max-width: 640px) {
  .lineage { flex-direction: column; }
  .ln-arrow { width: auto; height: 18px; }
  .ln-arrow::before { top: 3px; bottom: 3px; left: 50%; right: auto; width: 2px; height: auto; }
  .ln-arrow::after {
    top: auto; bottom: 0; right: auto; left: 50%; transform: translateX(-50%);
    border: 5px solid transparent; border-top: 6px solid var(--line); border-bottom: 0;
  }
}

/* 原則リスト（ヘルシンキ宣言・指針の内容） */
.princ { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; max-width: 860px; margin: 0 auto; }
@media (max-width: 640px) { .princ { grid-template-columns: 1fr; } }
.pr {
  background: #fff; border: 1.5px solid #c9d3dd; border-radius: 10px;
  padding: 10px 13px; font-size: 0.82rem; line-height: 1.7;
}
.pr b { color: var(--base-dark); display: block; }
.pr span { color: #56616d; font-size: 0.78rem; }
.pr.ok { background: var(--ok-bg); border-color: var(--ok-line); }
.pr.ok b { color: var(--ok); }
.pr.care { background: var(--care-bg); border-color: var(--care-line); }
.pr.care b { color: var(--care); }

/* 3枚組カード（計画書の3ルール等） */
.trio { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 860px; margin: 0 auto; }
@media (max-width: 640px) { .trio { grid-template-columns: 1fr; } }
.tr-c { border-radius: 10px; padding: 11px 13px; font-size: 0.8rem; line-height: 1.7; border: 2px solid; }
.tr-c b { display: block; margin-bottom: 2px; }
.tr-c span { color: #56616d; font-size: 0.77rem; }
.tr-c.ok { background: var(--ok-bg); border-color: var(--ok-line); }
.tr-c.ok b { color: var(--ok); }
.tr-c.gray { background: #f1f4f7; border-color: #9aa5b1; }
.tr-c.gray b { color: #4a545f; }
.tr-c.care { background: var(--care-bg); border-color: var(--care-line); }
.tr-c.care b { color: var(--care); }

/* 指針→運用の階層図（スライド内の図組み） */
.hier { max-width: 640px; margin: 0 auto; font-size: 0.85rem; text-align: center; }
.hier-top {
  display: inline-block; background: var(--base); color: #fff; font-weight: 700;
  border-radius: 12px; padding: 10px 26px 12px; font-size: 1rem; line-height: 1.6;
}
.hier-top span { display: block; font-size: 0.72rem; font-weight: 400; opacity: .9; letter-spacing: .02em; }
.hier-arrow { width: 2px; height: 20px; background: var(--line); margin: 6px auto; position: relative; }
.hier-arrow::after {
  content: ""; position: absolute; left: 50%; bottom: -1px; transform: translateX(-50%);
  border: 6px solid transparent; border-top: 7px solid var(--line); border-bottom: 0;
}
.hier-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 560px) { .hier-row { grid-template-columns: 1fr; } }
.hier-item {
  background: #f1f4f7; border: 1.5px solid var(--line); border-radius: 10px;
  padding: 10px 8px 12px; font-weight: 700; color: #4a545f; line-height: 1.6;
}
.hier-item span { display: block; font-size: 0.72rem; font-weight: 400; color: #6a7480; }
.hier-item.is-focus { background: var(--base-bg); border-color: var(--base); color: var(--base-dark); }
.hier-item.is-focus span { color: var(--base); }

/* 承認 前/後 図（スライド内の図組み） */
.tl2 { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: stretch; font-size: 0.85rem; }
@media (max-width: 560px) { .tl2 { grid-template-columns: 1fr; } }
.tl2-col { border-radius: 12px; padding: 12px 14px; }
.tl2-col .tl2-h { font-weight: 700; margin-bottom: 6px; }
.tl2-col ul { margin-left: 1.3em; }
.tl2-col li { margin-bottom: 3px; line-height: 1.7; }
.tl2-before { background: #f1f4f7; border: 2px solid var(--line); }
.tl2-before .tl2-h { color: #4a545f; }
.tl2-after { background: var(--ok-bg); border: 2px solid var(--ok-line); }
.tl2-after .tl2-h { color: var(--ok); }
.tl2-gate { display: flex; align-items: center; justify-content: center; }
.tl2-gate span {
  background: var(--base); color: #fff; font-weight: 700; border-radius: 999px;
  padding: 6px 14px; font-size: 0.85rem; white-space: nowrap;
}

/* ---- 下部: コントロールバー ---- */
.control-bar {
  position: sticky; bottom: 10px; z-index: 30;
  width: var(--stage-w); margin-left: auto; margin-right: auto;
  background: #fff; border-radius: 14px;
  box-shadow: 0 12px 34px rgba(5, 20, 40, .38), 0 2px 8px rgba(5, 20, 40, .22);
  padding: 12px 14px;
  display: flex; align-items: center; gap: 14px;
}
.control-bar .btn { padding: 10px 26px; font-size: 0.95rem; flex-shrink: 0; }
.control-bar .btn-prev { border-color: #c2cbd4; color: #56616d; padding: 10px 18px; }
.control-bar .btn-prev:hover { border-color: var(--base); color: var(--base); opacity: 1; }
.control-bar .spacer { width: 74px; flex-shrink: 0; }
@media (max-width: 640px) {
  .control-bar { gap: 10px; padding: 10px 10px; }
  .control-bar .btn { padding: 10px 18px; }
  .control-bar .spacer { width: 0; }
}

/* 読了バー（このスライドの滞在時間の充填表示） */
.read-timer { flex: 1; min-width: 0; }
.read-timer .lab {
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
  font-size: 0.72rem; color: #6a7480; margin-bottom: 5px; line-height: 1.4;
}
.read-timer .lab .st { font-weight: 700; letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.read-timer .track {
  position: relative; background: #e4e9ee; border-radius: 999px; height: 10px; overflow: hidden;
}
.read-timer .fill {
  height: 100%; width: 0%; border-radius: 999px;
  background: linear-gradient(90deg, #4e7fb3, var(--base));
  transition: width .6s linear, background-color .3s;
}
/* 一時停止中: 琥珀のストライプ */
.read-timer.is-paused .fill {
  background: repeating-linear-gradient(-45deg, var(--care-line) 0 8px, #dcae62 8px 16px);
  transition: none;
}
.read-timer.is-paused .lab .st { color: var(--care); }
/* 読了: 緑 */
.read-timer.is-done .fill { width: 100% !important; background: linear-gradient(90deg, #57a56c, var(--ok)); }
.read-timer.is-done .lab .st { color: var(--ok); }

/* 読了時の「次へ」を静かに強調 */
.btn-next.is-ready { animation: ready-pulse 1.6s ease-out 1; }
@keyframes ready-pulse {
  0% { box-shadow: 0 0 0 0 rgba(43, 94, 150, .45); }
  100% { box-shadow: 0 0 0 14px rgba(43, 94, 150, 0); }
}

/* ==========================================================================
   ミニテスト（スライドと同じキャンバス上に出題）
   ========================================================================== */
.q-badge {
  display: inline-flex; align-items: center; gap: 7px; align-self: flex-start;
  background: var(--base-bg); color: var(--base-dark); font-weight: 700;
  border: 1px solid #b9d0e6; border-radius: 999px; padding: 3px 16px; font-size: 0.8rem; margin-bottom: 16px;
}
.q-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--base); }
.q-text { font-size: 1.08rem; font-weight: 700; line-height: 1.95; margin-bottom: 20px; }

.quiz-choices { counter-reset: choice; margin-bottom: 4px; }
.quiz-choice { display: block; margin-bottom: 10px; cursor: pointer; }
.quiz-choice input { position: absolute; opacity: 0; }
.quiz-choice .c {
  position: relative; display: block; border: 1.5px solid #c2cbd4; border-radius: 12px;
  padding: 13px 15px 13px 52px; font-size: 0.92rem; line-height: 1.85; background: #fff;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.quiz-choice .c::before {
  counter-increment: choice; content: counter(choice, upper-alpha);
  position: absolute; left: 13px; top: 13px;
  width: 26px; height: 26px; border-radius: 50%;
  border: 1.5px solid #c2cbd4; color: #6a7480;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 700; background: #f7f9fb;
  transition: background .15s, border-color .15s, color .15s;
}
.quiz-choice:hover .c { border-color: var(--base); }
.quiz-choice input:checked + .c {
  border-color: var(--base); background: var(--base-bg);
  box-shadow: 0 0 0 1px var(--base) inset;
}
.quiz-choice input:checked + .c::before { background: var(--base); border-color: var(--base); color: #fff; }
.quiz-choice input:focus-visible + .c { outline: 2px solid var(--base); outline-offset: 2px; }
.quiz-actions { margin-top: 20px; text-align: center; }

/* 差し戻し（不正解）スライド */
.wrong-canvas { text-align: center; justify-content: center; }
.wrong-canvas .w-icon { margin: 0 auto 14px; width: 58px; height: 58px; }
.wrong-canvas .t { font-weight: 700; color: var(--care); font-size: 1.2rem; margin-bottom: 10px; text-wrap: balance; }
.wrong-canvas p { font-size: 0.94rem; max-width: 30em; margin: 0 auto 20px; text-align: left; }
.wrong-canvas::before { background: linear-gradient(90deg, var(--care-line), #e0bd7d); }

/* 完了スライド（プロトタイプ用） */
.done-canvas { text-align: center; justify-content: center; }
.done-canvas::before { background: linear-gradient(90deg, var(--ok-line), #9fd0ab); }
.done-canvas .d-icon { margin: 0 auto 16px; width: 64px; height: 64px; }
.done-canvas .t { font-size: 1.3rem; font-weight: 700; color: var(--ok); margin-bottom: 10px; text-wrap: balance; }
.done-canvas p { font-size: 0.94rem; }

/* ==========================================================================
   マイページ（各部の一覧と受講状況）
   ========================================================================== */
.app-user__link {
  color: #56616d; text-decoration: none; font-weight: 700;
  padding: 4px 12px; border-radius: 999px; transition: background .15s, color .15s;
}
.app-user__link:hover { background: var(--base-bg); color: var(--base-dark); }
body.player .app-user__link { color: rgba(255, 255, 255, .8); }
body.player .app-user__link:hover { background: rgba(255, 255, 255, .12); color: #fff; }
@media (max-width: 520px) { .app-user__link { padding: 4px 8px; } }

body.mypage .app-main { max-width: 860px; }

.mp-head {
  background: #fff; border-radius: 18px;
  box-shadow: 0 18px 46px rgba(5, 20, 40, .38);
  padding: 26px 26px 22px; margin-bottom: 18px;
}
.mp-hello h1 { font-size: 1.25rem; letter-spacing: .01em; margin-bottom: 2px; }
.mp-sub { font-size: 0.86rem; color: #56616d; margin-bottom: 16px; }
.mp-overview { display: flex; align-items: center; gap: 26px; flex-wrap: wrap; }
.mp-stat { display: flex; flex-direction: column; }
.mp-stat .v { font-size: 1.5rem; font-weight: 700; color: var(--navy); line-height: 1.3; font-variant-numeric: tabular-nums; }
.mp-stat .v small { font-size: 0.85rem; font-weight: 700; color: #6a7480; }
.mp-stat .l { font-size: 0.72rem; color: #8a94a0; font-weight: 700; letter-spacing: .04em; }
.mp-resume { margin-left: auto; min-width: 230px; }
@media (max-width: 640px) {
  .mp-head { padding: 20px 18px 18px; }
  .mp-overview { gap: 18px; }
  .mp-resume { min-width: 100%; margin-left: 0; }
}
.mp-track { background: #e4e9ee; border-radius: 999px; height: 8px; overflow: hidden; margin-top: 18px; }
.mp-fill { background: linear-gradient(90deg, #4e7fb3, var(--base)); height: 100%; border-radius: 999px; min-width: 6px; }

.mp-sections { display: flex; flex-direction: column; gap: 12px; }
.mp-sec {
  background: #fff; border-radius: 14px;
  box-shadow: 0 10px 30px rgba(5, 20, 40, .3);
  padding: 18px 20px; display: flex; align-items: center; gap: 18px;
}
.mp-sec.is-coming { opacity: .74; background: rgba(255, 255, 255, .88); }
.mp-sec-main { display: flex; gap: 14px; flex: 1; min-width: 0; }
.mp-sec-no {
  flex-shrink: 0; align-self: flex-start;
  background: var(--base-bg); color: var(--base-dark); font-weight: 700; font-size: 0.78rem;
  border-radius: 8px; padding: 4px 10px; white-space: nowrap; margin-top: 2px;
}
.mp-sec.is-coming .mp-sec-no { background: #eef1f4; color: #8a94a0; }
.mp-sec-body { flex: 1; min-width: 0; }
.mp-sec-title { font-weight: 700; font-size: 1.02rem; color: var(--navy); }
.mp-sec.is-coming .mp-sec-title { color: #56616d; }
.mp-sec-desc { font-size: 0.8rem; color: #56616d; line-height: 1.75; margin: 2px 0 8px; }
.mp-sec-meta { display: flex; gap: 16px; font-size: 0.75rem; color: #6a7480; font-weight: 700; margin-bottom: 5px; }
.mp-sec-track { background: #e4e9ee; border-radius: 999px; height: 6px; overflow: hidden; max-width: 340px; }
.mp-sec-fill { background: var(--base); height: 100%; border-radius: 999px; }
.mp-sec-side { display: flex; flex-direction: column; align-items: flex-end; gap: 9px; flex-shrink: 0; }
.mp-sec-btn { padding: 8px 22px; font-size: 0.85rem; }
.mp-badge {
  font-size: 0.7rem; font-weight: 700; border-radius: 999px; padding: 2px 12px; letter-spacing: .04em;
}
.mp-badge-done { background: var(--ok-bg); color: var(--ok); border: 1px solid var(--ok-line); }
.mp-badge-doing { background: var(--base-bg); color: var(--base-dark); border: 1px solid #9dbcdd; }
.mp-badge-todo { background: #f1f4f7; color: #6a7480; border: 1px solid #c9d3dd; }
.mp-badge-coming { background: #f1f4f7; color: #8a94a0; border: 1px dashed #b6c0ca; }
@media (max-width: 640px) {
  .mp-sec { flex-direction: column; align-items: stretch; gap: 12px; padding: 16px; }
  .mp-sec-side { flex-direction: row; align-items: center; justify-content: space-between; }
}
.mp-note { font-size: 0.78rem; color: rgba(255, 255, 255, .75); text-align: center; margin-top: 18px; }

/* ==========================================================================
   ログイン後シェル（白い左サイドバー＋ライトなコンテンツ領域）
   受講画面（player）は対象外＝暗いステージを維持する
   ========================================================================== */
body.shell { background: #f6f5f1; }
.shell-wrap { display: flex; flex: 1; min-height: 100dvh; }

.side-nav {
  width: 244px; flex-shrink: 0;
  background: #fff; border-right: 1px solid var(--edge);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100dvh;
}
.sn-brand {
  display: block; padding: 18px 18px 14px;
  font-weight: 700; color: var(--navy); text-decoration: none; font-size: 0.95rem; line-height: 1.4;
  border-bottom: 1px solid var(--edge);
}
.sn-brand small { display: block; font-size: 0.63rem; color: #8a8a80; font-weight: 400; letter-spacing: .04em; }
.sn-user { padding: 13px 18px; border-bottom: 1px solid var(--edge); }
.sn-name { font-weight: 700; font-size: 0.9rem; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sn-aff { font-size: 0.74rem; color: #8a8a80; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sn-member {
  display: inline-block; margin-top: 5px;
  font-size: 0.66rem; font-weight: 700; letter-spacing: .04em;
  background: var(--ok-bg); color: var(--ok); border: 1px solid var(--ok-line);
  border-radius: 999px; padding: 1px 10px;
}
.sn-nav { padding: 10px; flex: 1; display: flex; flex-direction: column; min-height: 0; }
.sn-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: 10px; margin-bottom: 2px;
  color: #4a4a42; text-decoration: none; font-size: 0.9rem; font-weight: 700;
  transition: background .15s, color .15s;
}
.sn-item svg { width: 19px; height: 19px; color: #8a8a80; flex-shrink: 0; }
.sn-item:hover { background: #f4f3ef; }
.sn-item.is-active { background: var(--base-bg); color: var(--navy); }
.sn-item.is-active svg { color: var(--navy); }
.sn-item--out { margin-top: auto; color: #8a8a80; font-weight: 400; }
.sn-item--out:hover { color: #4a4a42; }

.shell-main { flex: 1; min-width: 0; padding: 28px 26px 20px; display: flex; flex-direction: column; }
.shell-inner { max-width: 880px; margin: 0 auto; width: 100%; flex: 1; }
.shell-title { font-size: 1.3rem; color: var(--navy); letter-spacing: .01em; margin: 0 0 18px; }
.shell-footer { text-align: center; font-size: 0.72rem; color: #9a9486; padding: 26px 10px 8px; }

/* スマホ・狭幅: サイドバーを上部の横並びナビに畳む */
@media (max-width: 880px) {
  .shell-wrap { flex-direction: column; }
  .side-nav { width: 100%; height: auto; position: static; border-right: none; border-bottom: 1px solid var(--edge); }
  .sn-brand { padding: 12px 16px 8px; border-bottom: none; }
  .sn-user { display: none; }
  .sn-nav { flex-direction: row; overflow-x: auto; padding: 2px 10px 10px; gap: 2px; -webkit-overflow-scrolling: touch; }
  .sn-item { white-space: nowrap; padding: 7px 12px; font-size: 0.82rem; flex-shrink: 0; }
  .sn-item svg { width: 16px; height: 16px; }
  .sn-item--out { margin-top: 0; margin-left: auto; }
  .shell-main { padding: 18px 14px 12px; }
}

/* シェル内はライト背景なので、カードの影を抑えて罫線ベースに */
body.shell .mp-head, body.shell .mp-sec, body.shell .mp-link,
body.shell .cert-card, body.shell .auth-card {
  border: 1px solid var(--edge);
  box-shadow: 0 2px 8px rgba(22, 38, 58, .05);
}
body.shell .mp-link:hover { box-shadow: 0 8px 20px rgba(22, 38, 58, .1); }
body.shell .mp-sec.is-coming { background: #fbfaf7; opacity: 1; }
body.shell .mp-note { color: #8a8a80; }
.shell-narrow { max-width: 640px; margin: 0 auto; }
body.shell .auth-card { max-width: none; margin: 0 0 18px; }
body.shell .cert-card { max-width: none; margin: 0; }

/* ---- ダッシュボード（マイページ） ---- */
.dash-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 26px; }
.dash-card {
  background: #fff; border: 1px solid var(--edge); border-radius: 14px;
  padding: 18px 20px; box-shadow: 0 2px 8px rgba(22, 38, 58, .05);
  display: flex; flex-direction: column;
}
.dc-h { font-size: 0.76rem; font-weight: 700; color: #8a8a80; letter-spacing: .08em; margin-bottom: 12px; }

.dash-resume { grid-column: span 2; }
.dash-cert { grid-column: span 2; }

/* 進捗リング */
.dash-progress { align-items: center; text-align: center; }
.ring-wrap { position: relative; width: 108px; height: 108px; margin: 2px auto 10px; }
.ring { width: 100%; height: 100%; }
.ring-num { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.ring-num b { font-size: 1.65rem; color: var(--navy); font-variant-numeric: tabular-nums; }
.ring-num small { font-size: 0.8rem; color: #8a8a80; font-weight: 700; margin-left: 1px; }
.dash-stats { width: 100%; }
.dash-stats > div { display: flex; justify-content: space-between; font-size: 0.82rem; padding: 5px 2px; border-top: 1px dashed var(--edge); }
.dash-stats dt { color: #8a8a80; }
.dash-stats dd { font-weight: 700; color: var(--ink); }

/* 現在地と再開 */
.dr-now { margin-bottom: 8px; }
.dr-sec {
  display: inline-block; background: var(--base-bg); color: var(--navy);
  font-size: 0.72rem; font-weight: 700; border-radius: 999px; padding: 2px 12px; margin-bottom: 7px;
}
.dr-title { font-size: 1.08rem; font-weight: 700; color: var(--navy); line-height: 1.6; }
.dr-sub { font-size: 0.82rem; color: #6a6a60; margin-bottom: 14px; flex: 1; }
.dr-cta { display: flex; gap: 10px; flex-wrap: wrap; }
.dr-cta .btn { padding: 9px 26px; font-size: 0.9rem; }

/* 受講証ウィジェット */
.dcert-code {
  align-self: flex-start;
  background: linear-gradient(180deg, #f3f8fd, var(--base-bg));
  border: 1.5px dashed #7ba2c9; border-radius: 10px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 1.05rem; letter-spacing: .08em; color: var(--navy); font-weight: 700;
  padding: 8px 18px; margin-bottom: 8px;
}
.dcert-meta { font-size: 0.76rem; color: #8a8a80; margin-bottom: 8px; }
.dcert-none { font-size: 0.84rem; color: #6a6a60; flex: 1; margin-bottom: 8px; }
.dash-more { font-size: 0.85rem; font-weight: 700; color: var(--link); text-decoration: none; margin-top: auto; align-self: flex-start; }
.dash-more:hover { text-decoration: underline; }

/* お知らせ */
.news-list { list-style: none; }
.news-list li {
  position: relative; padding: 7px 0 7px 16px; font-size: 0.8rem; color: #4a4a42; line-height: 1.75;
  border-top: 1px dashed var(--edge);
}
.news-list li:first-child { border-top: none; padding-top: 0; }
.news-list li::before {
  content: ""; position: absolute; left: 2px; top: 0.95em;
  width: 6px; height: 6px; border-radius: 50%; background: var(--care-line);
}
.news-list li:first-child::before { top: 0.55em; }

.dash-sec-h { font-size: 1.02rem; color: var(--navy); letter-spacing: .02em; margin: 0 0 12px; }

@media (max-width: 880px) {
  .dash-grid { grid-template-columns: 1fr; }
  .dash-resume, .dash-cert { grid-column: auto; }
}

/* ---- マイページ: クイックリンク（受講証・登録情報） ---- */
.mp-links { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 18px; }
@media (max-width: 640px) { .mp-links { grid-template-columns: 1fr; } }
.mp-link {
  display: flex; align-items: center; gap: 12px;
  background: #fff; border-radius: 14px; padding: 15px 18px;
  box-shadow: 0 10px 30px rgba(5, 20, 40, .3);
  text-decoration: none; color: var(--ink);
  transition: transform .15s, box-shadow .15s;
}
.mp-link:hover { transform: translateY(-2px); box-shadow: 0 14px 36px rgba(5, 20, 40, .36); }
.mp-link svg { width: 30px; height: 30px; color: var(--navy); flex-shrink: 0; }
.mp-link .t { font-weight: 700; color: var(--navy); flex: 1; }
.mp-link .mp-link-sub { font-size: 0.72rem; color: #8a94a0; }
.mp-link .mp-badge { flex-shrink: 0; }

/* ---- パンくず（マイページ配下） ---- */
.mp-breadcrumb {
  font-size: 0.8rem; color: rgba(255, 255, 255, .7); margin: 2px 2px 14px;
  display: flex; align-items: center; gap: 8px;
}
.mp-breadcrumb a { color: rgba(255, 255, 255, .9); text-decoration: none; border-bottom: 1px solid rgba(255, 255, 255, .35); }
.mp-breadcrumb a:hover { color: #fff; border-color: #fff; }

/* ---- 受講証（修了コード） ---- */
.cert-card {
  background: #fff; border-radius: 18px;
  box-shadow: 0 18px 46px rgba(5, 20, 40, .38);
  max-width: 640px; margin: 0 auto; padding: 32px 28px 26px;
}
.cert-head { text-align: center; margin-bottom: 18px; }
.cert-head svg { width: 56px; height: 56px; margin-bottom: 10px; }
.cert-head .t { font-size: 1.25rem; font-weight: 700; color: var(--navy); margin-bottom: 6px; }
.cert-head p { font-size: 0.88rem; color: #56616d; }
.cert-code {
  position: relative;
  background: linear-gradient(180deg, #f3f8fd, var(--base-bg));
  border: 1.5px dashed #7ba2c9; border-radius: 12px;
  text-align: center; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 1.35rem; letter-spacing: .1em; color: var(--navy); font-weight: 700;
  padding: 22px 10px 16px; margin: 18px 0 10px; word-break: break-all;
}
.cert-code .tag {
  position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
  background: var(--navy); color: #fff;
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic", "Noto Sans JP", sans-serif;
  font-size: 0.66rem; letter-spacing: .14em; font-weight: 700;
  border-radius: 999px; padding: 2px 14px; white-space: nowrap;
}
.cert-copy { text-align: center; margin-bottom: 18px; }
.cert-copy .btn { padding: 8px 24px; font-size: 0.85rem; }
.cert-meta { border-top: 1px solid var(--edge); margin-top: 8px; }
.cert-meta > div { display: flex; border-bottom: 1px solid var(--edge); font-size: 0.9rem; }
.cert-meta dt { width: 94px; flex-shrink: 0; padding: 10px 8px; color: #6a7480; font-weight: 700; font-size: 0.8rem; background: #f8f7f4; }
.cert-meta dd { flex: 1; padding: 10px 12px; display: flex; align-items: center; gap: 10px; }
.cert-badge { font-size: 0.7rem; font-weight: 700; border-radius: 999px; padding: 1px 12px; }
.cert-badge.is-valid { background: var(--ok-bg); color: var(--ok); border: 1px solid var(--ok-line); }
.cert-badge.is-expired { background: var(--care-bg); color: var(--care); border: 1px solid var(--care-line); }
.cert-resend { text-align: center; margin: 18px 0 6px; }
.cert-resend .btn { padding: 8px 24px; font-size: 0.85rem; }
.cert-paper { background: #f8f7f4; border: 1px dashed #cfcabe; border-radius: 12px; padding: 14px 16px; margin-top: 16px; }
.cert-paper .h { font-weight: 700; font-size: 0.85rem; color: #6a7480; margin-bottom: 3px; }
.cert-paper p { font-size: 0.8rem; color: #6a7480; }
.cert-progress { max-width: 420px; margin: 0 auto 18px; }
.cert-progress .row { display: flex; justify-content: space-between; font-size: 0.85rem; color: #56616d; margin-bottom: 7px; }
.cert-progress .row b { color: var(--navy); }
.cert-cta { text-align: center; }

/* ---- 完了スライド上のコード表示 ---- */
.done-code {
  display: inline-block; margin: 6px auto 4px;
  background: linear-gradient(180deg, #f3f8fd, var(--base-bg));
  border: 1.5px dashed #7ba2c9; border-radius: 12px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 1.3rem; letter-spacing: .1em; color: var(--navy); font-weight: 700;
  padding: 12px 26px;
}
.done-note { font-size: 0.8rem; color: #6a7480; margin-bottom: 14px; }

/* ==========================================================================
   目次ドロワー（左端ホバー／目次ボタン）
   ========================================================================== */
.toc-handle {
  position: fixed; right: 0; top: 50%; transform: translateY(-50%); z-index: 60;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  background: #fff; color: var(--navy); border: 1px solid var(--edge);
  border-right: none; border-radius: 12px 0 0 12px;
  font-family: inherit; font-size: 0.7rem; font-weight: 700; letter-spacing: .1em;
  padding: 14px 6px 14px 9px; cursor: pointer;
  box-shadow: -6px 4px 18px rgba(5, 20, 40, .35);
  transition: padding .15s, box-shadow .15s;
}
.toc-handle:hover { padding-right: 12px; box-shadow: -8px 5px 22px rgba(5, 20, 40, .45); }
.toc-handle svg { width: 16px; height: 16px; }
.toc-handle .ch { font-size: 0.75rem; line-height: 1; color: #8a8a80; }

.toc-hover-zone { position: fixed; right: 0; top: 0; bottom: 0; width: 14px; z-index: 61; }

.toc-drawer {
  position: fixed; right: 0; top: 0; bottom: 0; z-index: 62;
  width: 300px; max-width: 86vw;
  background: #fff; box-shadow: -14px 0 44px rgba(5, 20, 40, .4);
  transform: translateX(100%); transition: transform .22s ease;
  display: flex; flex-direction: column;
}
.toc-drawer.is-open { transform: none; }
/* 読み込み時に一瞬だけ顔を出して、目次があることを知らせる */
.toc-drawer:not(.is-open) { animation: toc-peek 1.1s cubic-bezier(.4, 0, .2, 1) .9s 1; }
@keyframes toc-peek {
  0%, 100% { transform: translateX(100%); }
  40%, 62% { transform: translateX(calc(100% - 42px)); }
}
@media (prefers-reduced-motion: reduce) { .toc-drawer:not(.is-open) { animation: none; } }
/* デスクトップ: 左端ホバーでも開く */
@media (hover: hover) and (pointer: fine) {
  .toc-hover-zone:hover + .toc-drawer, .toc-drawer:hover { transform: none; }
}
.toc-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 12px; border-bottom: 1px solid var(--edge);
  font-weight: 700; color: var(--navy); font-size: 0.95rem;
}
.toc-close {
  background: none; border: none; font-size: 1.3rem; line-height: 1; cursor: pointer;
  color: #8a94a0; padding: 2px 6px; border-radius: 6px;
}
.toc-close:hover { background: #f1f4f7; color: var(--ink); }
.toc-scroll { flex: 1; overflow-y: auto; padding: 10px 10px 14px; }
.toc-sec { margin-bottom: 14px; }
.toc-sec-title {
  font-size: 0.78rem; font-weight: 700; color: #6a7480; letter-spacing: .04em;
  padding: 6px 8px 5px; display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.toc-sec.is-coming .toc-sec-title { color: #9aa5b1; }
.toc-sec-title .c {
  font-size: 0.66rem; border: 1px dashed #b6c0ca; border-radius: 999px; padding: 0 9px; color: #9aa5b1; font-weight: 700;
}
.toc-item {
  display: flex; align-items: center; gap: 9px;
  font-size: 0.84rem; line-height: 1.55; color: var(--ink); text-decoration: none;
  padding: 7px 8px; border-radius: 9px; margin-bottom: 1px;
}
a.toc-item:hover { background: var(--base-bg); }
.toc-item .n {
  flex-shrink: 0; width: 21px; height: 21px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; font-weight: 700;
  background: #f1f4f7; color: #6a7480; border: 1px solid #c9d3dd;
}
.toc-item.is-read .n { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-line); }
.toc-item.is-current { background: var(--base-bg); font-weight: 700; color: var(--base-dark); }
.toc-item.is-current .n { background: var(--base); color: #fff; border-color: var(--base); }
.toc-item.is-locked { color: #a6afb9; cursor: default; }
.toc-quiz:not(.is-current) { color: #56616d; }
.toc-mypage {
  display: block; text-align: center; font-size: 0.84rem; font-weight: 700;
  color: var(--base); text-decoration: none;
  border-top: 1px solid var(--edge); padding: 13px 10px;
}
.toc-mypage:hover { background: #f7f9fb; }

.toc-backdrop {
  position: fixed; inset: 0; z-index: 55; background: rgba(10, 24, 42, .4);
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.toc-backdrop.is-open { opacity: 1; pointer-events: auto; }

/* 開発モードバッジ */
.dev-badge {
  position: fixed; right: 10px; bottom: 10px; z-index: 50;
  background: var(--care); color: #fff; font-size: 0.7rem; font-weight: 700;
  border-radius: 999px; padding: 3px 12px; opacity: .85; pointer-events: none;
}

/* ==========================================================================
   アクセシビリティ・モーション配慮
   ========================================================================== */
:focus-visible { outline: 2px solid var(--base); outline-offset: 2px; }
body.player :focus-visible { outline-color: #fff; }

@media (prefers-reduced-motion: reduce) {
  .slide-canvas { animation: none; }
  .btn-next.is-ready { animation: none; }
  .course-progress .fill, .read-timer .fill { transition: none; }
}

/* ---- フッター内の法的リンク（免責事項・個人情報保護方針） ---- */
.app-footer .foot-links { margin-top: 4px; }
.foot-links a { color: inherit; text-decoration: none; margin-right: 14px; }
.foot-links a:last-child { margin-right: 0; }
.foot-links a:hover { text-decoration: underline; }
@media (max-width: 640px) { .shell-footer .foot-links { display: block; margin: 6px 0 0; } }

/* ---- 左ナビ最下部の法的リンク ---- */
.sn-legal { margin-top: auto; padding: 14px 18px 16px; display: flex; flex-direction: column; gap: 5px; }
.sn-legal a { font-size: 0.7rem; color: #a8b0ba; text-decoration: none; }
.sn-legal a:hover { color: var(--link); text-decoration: underline; }
@media (max-width: 880px) { .sn-legal { display: none; } }

/* ---- 講習の扉（course.php をパラメータなしで開いたときの案内ページ。白背景の通常レイアウト） ---- */
.cover { max-width: 780px; }
.cover-kicker { font-size: 0.78rem; font-weight: 700; color: var(--base); letter-spacing: .08em; margin-bottom: 7px; }
.cover-title { font-size: 1.55rem; color: var(--navy); letter-spacing: .02em; margin: 0 0 6px; }
.cover-sub { font-size: 0.88rem; color: #67707c; margin-bottom: 24px; }
.cover-status { margin-bottom: 16px; }
.cover-status .row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 7px; flex-wrap: wrap; }
.cover-status .n { font-weight: 700; font-size: 1.08rem; color: var(--navy); }
.cover-status .n small { font-weight: 400; font-size: 0.8rem; color: #67707c; }
.cover-status .p { font-size: 0.82rem; color: #4a545f; }
.cover-status .track { height: 6px; background: #e9e6de; border-radius: 99px; overflow: hidden; }
.cover-status .fill { height: 100%; background: var(--base); border-radius: 99px; }
.cover-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 30px; }
.cover-secs { display: flex; flex-direction: column; gap: 8px; }
.cover-sec {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 16px; background: #fff; border: 1px solid var(--edge); border-radius: 12px;
  text-decoration: none; color: inherit;
}
a.cover-sec:hover { border-color: var(--base); box-shadow: 0 1px 6px rgba(22, 38, 58, .07); }
.cover-sec.is-locked { opacity: .55; }
.cover-sec .cs-no { flex-shrink: 0; font-weight: 700; font-size: 0.76rem; color: var(--base); background: var(--base-bg); border-radius: 6px; padding: 3px 9px; }
.cover-sec .cs-main { flex: 1; min-width: 0; }
.cover-sec .cs-main b { display: block; font-size: 0.91rem; color: var(--ink); line-height: 1.4; }
.cover-sec .cs-main small { font-size: 0.73rem; color: #8a94a0; }
.cover-sec .cs-badge { flex-shrink: 0; font-size: 0.72rem; padding: 3px 11px; border-radius: 99px; }
.cs-badge.st-done { background: #eaf6ec; color: #2f6b3d; }
.cs-badge.st-doing { background: var(--base-bg); color: var(--base); }
.cs-badge.st-todo { background: #f1efe9; color: #8a8a80; }
@media (max-width: 640px) {
  .cover-title { font-size: 1.28rem; }
  .cover-sec .cs-main small { display: none; }
}

/* ==========================================================================
   Udemyライク・プレイヤー（上部バー＋中央ステージ＋右「講習の内容」パネル）
   ========================================================================== */
body.player.udemy { display: flex; flex-direction: column; height: 100dvh; overflow: hidden; }
body.player.udemy { --stage-w: min(100%, calc((100dvh - 215px) * 1.5)); }

/* ---- 上部バー ---- */
.pl-top {
  height: 52px; flex-shrink: 0;
  display: flex; align-items: center; gap: 14px; padding: 0 18px;
  background: #101a29; border-bottom: 1px solid rgba(255, 255, 255, .1);
}
.pl-brand { color: #fff; font-weight: 700; font-size: 0.88rem; text-decoration: none; white-space: nowrap; }
.pl-brand:hover { color: #cfe0f2; }
.pl-sep { width: 1px; height: 20px; background: rgba(255, 255, 255, .18); flex-shrink: 0; }
.pl-course { font-size: 0.85rem; color: rgba(255, 255, 255, .78); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-right { margin-left: auto; display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
.pl-prog { display: flex; align-items: center; gap: 7px; font-size: 0.76rem; color: rgba(255, 255, 255, .75); }
.pl-prog svg { width: 28px; height: 28px; display: block; }
.pl-content-btn {
  display: none; font: inherit; font-size: 0.78rem; color: rgba(255, 255, 255, .85);
  background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 8px; padding: 6px 12px; cursor: pointer;
}
.pl-mypage {
  font-size: 0.78rem; color: rgba(255, 255, 255, .8); text-decoration: none;
  border: 1px solid rgba(255, 255, 255, .25); border-radius: 8px; padding: 6px 13px; white-space: nowrap;
}
.pl-mypage:hover { color: #fff; border-color: rgba(255, 255, 255, .55); }

/* ---- 本体レイアウト ---- */
.pl-body { flex: 1; display: flex; min-height: 0; }
.pl-main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; padding: 18px 24px 12px; }

/* ---- 右パネル「講習の内容」 ---- */
.pl-side {
  width: 330px; flex-shrink: 0; background: #fff; border-left: 1px solid var(--edge);
  display: flex; flex-direction: column; min-height: 0;
}
.pl-side-head {
  flex-shrink: 0; display: flex; align-items: baseline; gap: 10px;
  padding: 13px 16px; border-bottom: 1px solid var(--edge);
}
.pl-side-head .t { font-weight: 700; font-size: 0.9rem; color: var(--navy); }
.pl-side-head .r { margin-left: auto; font-size: 0.7rem; color: #8a94a0; }
.pl-side-close {
  display: none; font: inherit; font-size: 1rem; line-height: 1; color: #8a94a0;
  background: none; border: none; cursor: pointer; padding: 2px 4px;
}
.pl-side-scroll { flex: 1; overflow-y: auto; min-height: 0; }

.pl-sec { border-bottom: 1px solid var(--edge); }
.pl-sec summary {
  list-style: none; cursor: pointer; user-select: none;
  display: flex; align-items: center; gap: 8px;
  padding: 11px 16px; background: #f7f6f2;
  font-size: 0.82rem; font-weight: 700; color: var(--ink);
}
.pl-sec summary::-webkit-details-marker { display: none; }
.pl-sec summary .t { flex: 1; min-width: 0; line-height: 1.4; }
.pl-sec summary small { font-weight: 400; font-size: 0.7rem; color: #8a94a0; }
.pl-sec summary::after {
  content: ''; width: 7px; height: 7px; flex-shrink: 0;
  border-right: 1.6px solid #8a94a0; border-bottom: 1.6px solid #8a94a0;
  transform: rotate(45deg); transition: transform .15s ease; margin-top: -3px;
}
.pl-sec[open] summary::after { transform: rotate(-135deg); margin-top: 3px; }
.pl-sec summary:hover { background: #f1efe9; }

.pl-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 8px 16px 8px 18px; font-size: 0.79rem; line-height: 1.5; color: #4a545f;
  text-decoration: none;
}
a.pl-item:hover { background: #f4f7fa; }
.pl-item .tx { min-width: 0; }
.pl-item .no { color: #9aa5b1; }
.pl-item.is-current { background: var(--base-bg); box-shadow: inset 3px 0 0 var(--base); }
.pl-item.is-current .tx { color: var(--navy); font-weight: 700; }
.pl-item.is-locked { opacity: .5; }
.pl-item .ck {
  flex-shrink: 0; width: 14px; height: 14px; margin-top: 3px; position: relative;
  border: 1.5px solid #b7bec6; border-radius: 3px; background: #fff;
}
.pl-item.is-read .ck { background: var(--base); border-color: var(--base); }
.pl-item.is-read .ck::after {
  content: ''; position: absolute; left: 3px; top: 1px; width: 4px; height: 7px;
  border-right: 1.7px solid #fff; border-bottom: 1.7px solid #fff; transform: rotate(40deg);
}
.pl-item .ck.qz { border-radius: 50%; }
.pl-item .ck.qz::before {
  content: '?'; position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 9px; font-weight: 700; color: #8a94a0;
}
.pl-item.is-read .ck.qz::before { content: none; }

/* ---- 狭い画面: 右パネルをオーバーレイに ---- */
@media (max-width: 1080px) {
  .pl-content-btn { display: inline-block; }
  .pl-side {
    position: fixed; top: 0; right: 0; bottom: 0; z-index: 60;
    width: min(330px, 88vw);
    transform: translateX(100%); transition: transform .22s ease;
    box-shadow: -18px 0 50px rgba(5, 20, 40, .35);
  }
  .pl-side.is-open { transform: translateX(0); }
  .pl-side-close { display: block; }
  .pl-backdrop {
    position: fixed; inset: 0; z-index: 55; background: rgba(8, 16, 28, .5);
    opacity: 0; pointer-events: none; transition: opacity .2s ease;
  }
  .pl-backdrop.is-open { opacity: 1; pointer-events: auto; }
  .pl-course { display: none; }
  .pl-sep { display: none; }
}
@media (max-width: 640px) {
  .pl-top { padding: 0 12px; gap: 10px; }
  .pl-mypage { display: none; }
  .pl-prog span { display: none; }
  .pl-main { padding: 12px 12px 10px; }
  body.player.udemy { --stage-w: 100%; }
}

/* ==========================================================================
   管理画面（事務局向け）— note風: 白トップバー＋左テキストナビ＋白パネル
   ========================================================================== */
body.admin { background: #f5f5f3; display: flex; flex-direction: column; min-height: 100dvh; }
.ad-top {
  display: flex; align-items: center; gap: 18px; height: 56px; padding: 0 26px;
  background: #fff; border-bottom: 1px solid #e8e6df; flex-shrink: 0;
}
.ad-brand { color: #1c1c18; font-weight: 700; font-size: 0.95rem; white-space: nowrap; }
.ad-brand b { margin-left: 9px; font-size: 0.66rem; background: #16263a; color: #fff; border-radius: 5px; padding: 2px 8px; vertical-align: 2px; letter-spacing: .06em; }
.ad-back { margin-left: auto; color: #4a545f; font-size: 0.8rem; text-decoration: none; }
.ad-back:hover { color: #1c1c18; text-decoration: underline; }

.ad-wrap {
  flex: 1; width: 100%; max-width: 1200px; margin: 0 auto;
  display: flex; align-items: flex-start; gap: 34px; padding: 38px 26px 80px;
}
.ad-side { width: 190px; flex-shrink: 0; }
.ad-side-h { font-size: 1.1rem; font-weight: 700; color: #1c1c18; margin: 2px 0 20px 15px; }
.ad-side nav { display: flex; flex-direction: column; gap: 2px; }
.ad-side nav a {
  padding: 8px 12px; font-size: 0.87rem; color: #55534c; text-decoration: none;
  border-left: 3px solid transparent;
}
.ad-side nav a:hover { color: #1c1c18; }
.ad-side nav a.is-active { color: #1c1c18; font-weight: 700; border-left-color: #1c1c18; }

.ad-main { flex: 1; min-width: 0; }
.ad-panel { background: #fff; border-radius: 8px; box-shadow: 0 1px 3px rgba(30, 28, 20, .05); }
.ad-title { font-size: 1.02rem; font-weight: 700; color: #1c1c18; margin: 0; padding: 20px 28px; border-bottom: 1px solid #eeece7; }
.ad-panel-body { padding: 26px 28px 34px; }

/* 期間タブ（週/月/年/全期間） */
.ad-tabs { display: inline-flex; border: 1px solid #d8d5cd; border-radius: 7px; overflow: hidden; margin-bottom: 26px; }
.ad-tabs a {
  padding: 7px 19px; font-size: 0.8rem; color: #55534c; text-decoration: none;
  border-right: 1px solid #d8d5cd; background: #fff;
}
.ad-tabs a:last-child { border-right: none; }
.ad-tabs a:hover { background: #f5f5f3; }
.ad-tabs a.is-active { background: #1c1c18; color: #fff; }

/* 数値タイル */
.ad-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.ad-card { background: #f7f6f3; border-radius: 8px; padding: 24px 12px 18px; text-align: center; }
.ad-card svg { width: 22px; height: 22px; color: #55534c; margin-bottom: 4px; }
.ad-card .n { font-size: 1.9rem; font-weight: 700; color: var(--base); line-height: 1.25; }
.ad-card .n.ok { color: #2f8a49; }
.ad-card .n.heat { color: #c2506b; }
.ad-card .l { font-size: 0.75rem; color: #6a6860; }
.ad-updated { text-align: right; font-size: 0.73rem; color: #8a877e; margin: 14px 0 4px; }

.ad-h2 { font-size: 0.95rem; color: #1c1c18; margin: 30px 0 12px; }
.ad-lead { font-size: 0.88rem; color: #55534c; margin-bottom: 18px; max-width: 44em; }
.ad-tablewrap { overflow-x: auto; }
.ad-table { width: 100%; border-collapse: collapse; font-size: 0.83rem; }
.ad-table th, .ad-table td { padding: 10px 12px; text-align: left; white-space: nowrap; }
.ad-table th { font-size: 0.74rem; color: #8a877e; font-weight: 700; border-bottom: 1px solid #dedbd2; }
.ad-table td { border-bottom: 1px solid #f0eee8; color: #33322c; }
.ad-table tr:last-child td { border-bottom: none; }
.ad-kv th { width: 9em; border-bottom: 1px solid #f0eee8; vertical-align: top; }
.ad-kv td { white-space: normal; }
.ad-badge { display: inline-block; font-size: 0.7rem; padding: 2px 9px; border-radius: 99px; }
.ad-badge.ok { background: #eaf6ec; color: #2f6b3d; }
.ad-badge.warn { background: #fbf2e9; color: #a3591a; }
.ad-badge.err { background: #fbeeec; color: #a33c2e; }
.ad-link { color: var(--link); font-size: 0.83rem; }
.ad-search { display: flex; gap: 10px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.ad-search input { font: inherit; padding: 9px 14px; border: 1px solid #d8d5cd; border-radius: 8px; width: min(340px, 100%); background: #fff; }
.ad-count { font-size: 0.78rem; color: #8a877e; }
.ad-empty { font-size: 0.86rem; color: #8a877e; }
.ad-pager { display: flex; gap: 6px; margin-top: 16px; font-size: 0.83rem; }
.ad-pager a, .ad-pager .cur { padding: 4px 10px; border-radius: 7px; text-decoration: none; }
.ad-pager a { color: var(--link); border: 1px solid #e0ddd5; }
.ad-pager .cur { background: #1c1c18; color: #fff; }
.ad-actions { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.ad-actions form { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.ad-danger { margin-top: 10px; padding-top: 14px; border-top: 1px dashed #d8bcb4; }
.ad-danger label { font-size: 0.8rem; color: #7a2c20; }
.btn.danger { color: #a33c2e; border-color: #d8a79c; }
.btn.danger:hover { background: #fbeeec; }
.ad-note { font-size: 0.78rem; color: #8a877e; margin-top: 10px; }
.ad-prose { font-size: 0.87rem; }
.ad-prose ol { padding-left: 1.4em; }
.ad-prose li { margin-bottom: 6px; }
body.admin .mono, .ad-table .mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.92em; letter-spacing: .03em; }
body.admin .msg-ok, body.admin .msg-err { margin: 0 0 16px; }

@media (max-width: 880px) {
  .ad-wrap { flex-direction: column; gap: 18px; padding: 20px 14px 60px; }
  .ad-side { width: 100%; }
  .ad-side-h { margin: 0 0 10px 2px; }
  .ad-side nav { flex-direction: row; overflow-x: auto; gap: 4px; border-bottom: 1px solid #e8e6df; padding-bottom: 6px; }
  .ad-side nav a { border-left: none; border-bottom: 2px solid transparent; white-space: nowrap; padding: 6px 10px; }
  .ad-side nav a.is-active { border-bottom-color: #1c1c18; }
  .ad-panel-body { padding: 18px 16px 26px; }
  .ad-title { padding: 16px; }
}

/* ---- 管理: インサイト ---- */
.in-sec { font-size: 0.88rem; color: var(--navy); margin: 22px 0 8px; }
.in-sec .in-cpmeta { margin-left: 10px; font-size: 0.73rem; font-weight: 400; color: #8a94a0; }
.in-title { white-space: normal; min-width: 16em; }
.in-barcol { min-width: 130px; }
.in-bar {
  display: inline-block; vertical-align: middle; width: 90px; height: 8px;
  background: #eeece4; border-radius: 99px; overflow: hidden; margin-right: 6px;
}
.in-bar.w80 { width: 80px; }
.in-bar i { display: block; height: 100%; background: var(--base); border-radius: 99px; }
.in-bar.hot i { background: #c2691f; }
.in-bar.cold i { background: #9aa5b1; }
.in-barcol small { font-size: 0.72rem; color: #8a94a0; }
.in-qlist { display: flex; flex-direction: column; gap: 8px; }
.in-q { background: #fff; border: 1px solid var(--edge); border-radius: 12px; }
.in-q summary {
  list-style: none; cursor: pointer; display: flex; gap: 14px; align-items: center;
  padding: 11px 16px; font-size: 0.83rem;
}
.in-q summary::-webkit-details-marker { display: none; }
.in-q summary .qt { flex: 1; min-width: 0; line-height: 1.5; }
.in-q summary .qs { flex-shrink: 0; font-size: 0.75rem; color: #4a545f; white-space: nowrap; }
.in-choices { border-top: 1px solid #eeece4; padding: 10px 16px 12px; }
.in-choice { display: flex; gap: 10px; align-items: baseline; font-size: 0.79rem; padding: 4px 0; color: #4a545f; }
.in-choice .mk { flex-shrink: 0; width: 1.2em; color: #b7bec6; }
.in-choice.is-correct .mk { color: #2f6b3d; font-weight: 700; }
.in-choice.is-correct .lb { color: #2f6b3d; }
.in-choice .lb { flex: 1; min-width: 0; line-height: 1.5; }
.in-choice .ct { flex-shrink: 0; font-size: 0.73rem; color: #8a94a0; white-space: nowrap; }

/* ---- 左ナビ: 管理画面への切替（管理者のみ表示） ---- */
.sn-item--admin { margin-top: auto; color: #a3591a; }
.sn-item--admin:hover { background: #fbf2e9; color: #7a3f0f; }
.sn-item--admin + .sn-item--out { margin-top: 0; }
@media (max-width: 880px) {
  .sn-item--admin { margin-top: 0; }
}

/* ---- 受講証: PDF修了証の発行導線 ---- */
.cert-pdf-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.cert-pdf-note { font-size: 0.78rem; color: #8a94a0; margin-top: 10px; }

/* ---- 管理: 決済設定 ---- */
.ad-status { display: flex; align-items: baseline; gap: 14px; border-radius: 8px; padding: 14px 18px; margin-bottom: 8px; }
.ad-status b { font-size: 1rem; flex-shrink: 0; }
.ad-status span { font-size: 0.84rem; }
.ad-status.is-live { background: #eaf6ec; color: #2f6b3d; }
.ad-status.is-prep { background: #fdf6e8; color: #7a5a12; }
.ad-form { max-width: 560px; }
.ad-form label { display: block; font-size: 0.82rem; font-weight: 700; color: #33322c; margin: 16px 0 5px; }
.ad-form label small { font-weight: 400; color: #8a877e; margin-left: 6px; }
.ad-form input { width: 100%; font: inherit; padding: 9px 13px; border: 1px solid #d8d5cd; border-radius: 8px; background: #fff; }
.ad-form-actions { margin-top: 20px; }
.ad-form-inline { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-top: 26px; padding-top: 18px; border-top: 1px solid #eeece7; }
