/* 100万円チャレンジ 授業資料 — モバイルファースト。PC は末尾の @media(min-width:900px) で上書き */
:root {
  --bg: #f3f7fc;
  --card: #ffffff;
  --ink: #152a4a;
  --navy: #0d2b5c;
  --sub: #5d6b80;
  --line: #e2eaf4;
  --blue: #1565d8;
  --blue-d: #0f4fb0;
  --blue-l: #e9f2fe;
  --teal: #13a39a;
  --teal-l: #e5f7f5;
  --amber: #e2a312;
  --amber-l: #fff7e0;
  --orange: #ef7d22;
  --orange-l: #fff1e6;
  --pink: #e04b62;
  --pink-l: #fdecef;
  --green: #1f9a55;
  --green-l: #e7f6ed;
  --red: #d8413a;
  --red-l: #fdeceb;
  --yellow: #f4c534;
  --shadow: 0 1px 2px rgba(16, 42, 84, 0.04), 0 6px 20px rgba(16, 42, 84, 0.06);
  --radius: 16px;
}
* { box-sizing: border-box; }
/* hidden だと position: sticky が効かなくなるので clip を使う */
html, body { overflow-x: clip; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Noto Sans JP", "Hiragino Sans", system-ui, sans-serif;
  font-size: 15.5px;
  line-height: 1.8;
  word-break: auto-phrase;
  line-break: strict;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--blue); }
p, li { text-wrap: pretty; }
.ic { width: 1.1em; height: 1.1em; vertical-align: -0.18em; flex: none; }
.muted { color: var(--sub); }
.small { font-size: 0.8rem; }
.center { text-align: center; }
.hand { font-family: "Klee One", cursive; color: var(--navy); }

/* ---------- ヘッダー ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 1px 0 var(--line), 0 4px 16px rgba(16, 42, 84, 0.05);
  backdrop-filter: blur(8px);
}
.logo { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--navy); font-weight: 900; font-size: 1rem; white-space: nowrap; }
.logo b { font-style: italic; font-size: 1.35em; letter-spacing: -0.02em; }
.logo em { font-style: normal; }
.logo-ic { color: var(--blue); width: 1.3em; height: 1.3em; }
.logo.big { font-size: 1.25rem; justify-content: center; }
.pill-plan, .topnav { display: none; }
.me { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.me-link { display: flex; align-items: center; gap: 6px; text-decoration: none; color: var(--ink); }
.me-name { display: none; font-size: 0.85rem; }
.me-admin { color: var(--sub); display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; }
.me form { margin: 0; }
.icon-btn { border: 0; background: transparent; color: var(--sub); width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; cursor: pointer; }
.icon-btn:hover, .me-admin:hover { background: var(--blue-l); color: var(--blue); }

.avatar {
  --h: 210;
  display: inline-grid; place-items: center; flex: none;
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, hsl(var(--h) 80% 62%), hsl(calc(var(--h) + 30) 70% 48%));
  color: #fff; font-weight: 700; font-size: 0.9rem; box-shadow: 0 0 0 2px #fff;
}
.avatar.sm { width: 24px; height: 24px; font-size: 0.7rem; }
.avatars { display: inline-flex; }
.avatars .avatar + .avatar { margin-left: -6px; }

/* 下部タブ（スマホ） */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: #fff; box-shadow: 0 -1px 0 var(--line), 0 -6px 18px rgba(16, 42, 84, 0.06);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 0.68rem; color: var(--sub); text-decoration: none; min-width: 0; }
.tabbar a .ic { width: 22px; height: 22px; }
.tabbar a.on { color: var(--blue); font-weight: 700; }

/* ---------- レイアウト ---------- */
.page { max-width: 1200px; margin: 0 auto; padding: 14px 12px 96px; }
.page-title { font-size: 1.45rem; font-weight: 900; color: var(--navy); margin: 6px 0 2px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-title .who { display: inline-flex; align-items: center; gap: 6px; font-size: 0.9rem; font-weight: 700; background: #fff; padding: 2px 10px 2px 4px; border-radius: 99px; box-shadow: var(--shadow); }
.page-lead { color: var(--sub); margin: 0 0 14px; font-size: 0.9rem; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.members-chip { display: inline-flex; align-items: center; gap: 6px; background: #fff; border-radius: 99px; padding: 3px 6px 3px 12px; box-shadow: var(--shadow); font-size: 0.8rem; color: var(--ink); }
.crumb { font-size: 0.82rem; color: var(--sub); margin: 4px 0 10px; }
.crumb a { color: var(--sub); }

.card, .content section {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px 14px; margin: 0 0 14px; min-width: 0;
}
.grid-2, .grid-3 { display: grid; gap: 10px; margin-bottom: 14px; }
.grid-2 > *, .grid-3 > * { margin: 0; min-width: 0; }
.empty { color: var(--sub); text-align: center; padding: 18px 0; margin: 0; }

/* 見出し */
.sec-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.sec-head .num {
  flex: none; width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, #2f80ed, var(--blue-d)); color: #fff;
  display: grid; place-items: center; font-weight: 900; font-size: 1.05rem;
  box-shadow: 0 4px 10px rgba(21, 101, 216, 0.3);
}
.sec-title { flex: 1; min-width: 0; }
.sec-head h2 { margin: 2px 0 0; font-size: 1.12rem; line-height: 1.5; color: var(--navy); font-weight: 900; display: flex; align-items: center; gap: 6px; }
.sec-head p { margin: 2px 0 0; color: var(--sub); font-size: 0.85rem; }
.sec-head .ts { align-self: center; }
.badge-point { display: inline-flex; align-items: center; gap: 8px; background: var(--blue-l); border-radius: 99px; padding: 3px 12px 3px 3px; font-size: 0.8rem; }
.badge-point b { background: #ffe9a6; color: #6b4d00; border-radius: 99px; padding: 1px 12px; }
.content h3, .quiz-cat { font-size: 1.02rem; color: var(--blue); margin: 20px 0 6px; font-weight: 700; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.quiz-cat { border-left: 4px solid var(--blue); padding-left: 10px; }

/* ---------- ヒーロー ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: var(--radius);
  background: linear-gradient(180deg, #ffffff 0%, #eef5fe 55%, #dcebfb 100%);
  border: 1px solid var(--line); box-shadow: var(--shadow);
  padding: 18px 16px 70px; margin-bottom: 14px;
}
.hero-text { position: relative; z-index: 1; max-width: 640px; }
.kicker { font-family: Georgia, serif; letter-spacing: 0.14em; color: var(--blue); font-size: 0.78rem; }
.hero h1 { font-size: 1.75rem; line-height: 1.3; margin: 4px 0 6px; color: var(--navy); font-weight: 900; }
.hero-sub { margin: 0; font-weight: 700; color: var(--navy); }
.hero-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 0.82rem; color: var(--sub); margin: 10px 0 0; }
.hero-meta b { color: var(--navy); }
.play-dot { width: 26px; height: 26px; padding: 6px; border-radius: 50%; background: var(--navy); color: #fff; fill: #fff; }
.hero-hand { display: none; }
.skyline { position: absolute; right: 0; bottom: 0; width: 100%; height: 80px; opacity: 0.45; -webkit-mask-image: linear-gradient(90deg, transparent, #000 40%); mask-image: linear-gradient(90deg, transparent, #000 40%); }

/* ---------- 統計 ---------- */
.stat { display: flex; align-items: center; gap: 14px; text-decoration: none; color: inherit; }
.stat.link:hover { border-color: #bcd3f3; }
.stat-ic { width: 42px; height: 42px; padding: 9px; border-radius: 12px; background: var(--amber-l); color: var(--amber); }
.stat-ic.blue { background: var(--blue-l); color: var(--blue); }
.stat-ic.red { background: var(--red-l); color: var(--red); }
.stat-l { font-size: 0.8rem; color: var(--sub); font-weight: 700; }
.stat-v { font-size: 2rem; font-weight: 900; color: var(--navy); line-height: 1.1; }
.stat-v small { font-size: 0.5em; margin-left: 2px; }

/* ---------- 授業カード ---------- */
.lesson-list { display: grid; gap: 10px; }
.lesson-card {
  display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit;
  background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 12px; min-width: 0;
}
.lesson-card:hover { border-color: #bcd3f3; box-shadow: var(--shadow); }
.lesson-card.disabled { opacity: 0.55; background: #f8fafd; }
.lc-no { flex: none; width: 64px; text-align: center; font-size: 0.62rem; letter-spacing: 0.12em; color: var(--blue); font-family: Georgia, serif; }
.lc-no b { display: block; font-size: 1.7rem; line-height: 1.1; color: var(--navy); font-family: "Noto Sans JP", sans-serif; }
.lc-main { flex: 1; min-width: 0; }
.lc-title { font-weight: 900; color: var(--navy); }
.lc-meta { display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: 0.75rem; color: var(--sub); margin-top: 4px; }
.lc-meta span { display: inline-flex; align-items: center; gap: 3px; }
.lc-arrow { color: var(--sub); }
.progress { height: 6px; border-radius: 99px; background: #eaf0f7; margin-top: 8px; overflow: hidden; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--yellow), #f0a500); border-radius: 99px; }

/* ---------- 授業ページ ---------- */
.lesson-wrap { display: block; }
.lesson-main { min-width: 0; }
.side { position: sticky; top: var(--topbar-h, 54px); z-index: 10; margin: -4px 0 12px; }
.side-box summary .side-title { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.side-cur { font-size: 0.75rem; font-weight: 500; color: var(--blue); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-cur:empty::before { content: "目次を開いて章を選ぶ"; color: var(--sub); }
.chap a.on { background: var(--blue-l); color: var(--blue-d); font-weight: 700; }
.chap a.on .t { background: var(--blue); color: #fff; }
.side-box { background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.side-box summary { list-style: none; cursor: pointer; padding: 10px 14px; font-weight: 900; color: var(--navy); display: flex; justify-content: space-between; align-items: center; }
.side-box summary::-webkit-details-marker { display: none; }
.side-box[open] summary .ic { transform: rotate(180deg); }
.chap { list-style: none; margin: 0; padding: 4px 8px 8px; max-height: 55vh; overflow-y: auto; }
.chap a { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 10px; text-decoration: none; color: var(--ink); font-size: 0.88rem; }
.chap a:hover { background: var(--blue-l); }
.chap .t { flex: none; font-family: ui-monospace, Menlo, monospace; font-size: 0.78rem; background: #eef3fa; color: var(--navy); border-radius: 6px; padding: 1px 7px; cursor: pointer; }
.chap .t:hover { background: var(--navy); color: #fff; }
.chap .t.nt { font-family: inherit; background: var(--amber-l); color: #9a6b00; cursor: inherit; }
.chap .t.nt:hover { background: var(--amber-l); color: #9a6b00; }
.side-links { border-top: 1px solid var(--line); padding: 8px; display: grid; }
.side-links a { display: flex; align-items: center; gap: 10px; padding: 6px 8px; color: var(--ink); text-decoration: none; font-size: 0.88rem; border-radius: 10px; }
.side-links a:hover { background: var(--blue-l); }
.side-links .ic { color: var(--navy); }

.video { padding: 10px; }
.video-box { position: relative; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: #0d1b2e; }
.video-box iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video p { margin: 8px 4px 0; }

.goal { background: linear-gradient(180deg, #fffdf3, var(--amber-l)); border: 1.5px solid #f3d36b; border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; box-shadow: var(--shadow); }
.goal h2 { margin: 0 0 6px; font-size: 1.1rem; color: var(--navy); display: flex; align-items: center; gap: 8px; }
.goal-ic { color: var(--amber); width: 26px; height: 26px; }
.goal ul { list-style: none; margin: 0; padding: 0; }
.goal li { position: relative; padding-left: 30px; margin: 6px 0; font-weight: 500; }
.goal .chk { position: absolute; left: 0; top: 4px; width: 22px; height: 22px; padding: 3px; border-radius: 50%; background: var(--yellow); color: #fff; }
.goal-hand { margin: 10px 0 0; font-size: 1rem; background: #fff; border-radius: 12px; padding: 8px 14px; display: inline-block; }

/* 本文 */
/* ページ内リンクの着地位置：ヘッダー（スマホは目次バーも）の高さ＋余白。高さは app.js が入れる */
[id] { scroll-margin-top: calc(var(--topbar-h, 54px) + var(--anchor-extra, 0px) + 12px); }
.content p { margin: 8px 0; }
.content table { border-collapse: separate; border-spacing: 0; width: 100%; margin: 10px 0; font-size: 0.88rem; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.content th, .content td { padding: 7px 9px; vertical-align: top; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); }
.content tr > :last-child { border-right: 0; }
.content tr:last-child > * { border-bottom: 0; }
.content th { background: #eef4fc; text-align: left; color: var(--navy); }
.content .scroll { overflow-x: auto; }
.content svg { max-width: 100%; height: auto; display: block; margin: 10px auto; }
.content .up { color: var(--red); font-weight: 700; }
.content .down { color: var(--blue); font-weight: 700; }
.ts a, .ts { font-family: ui-monospace, Menlo, monospace; }
.ts a { display: inline-block; background: var(--navy); color: #fff; border-radius: 6px; padding: 0 8px; text-decoration: none; font-size: 0.78rem; line-height: 1.7; }
.ts a:hover { background: var(--blue); }
.point, .life, .pro, .fix { border-radius: 12px; padding: 10px 14px; margin: 12px 0; font-size: 0.93rem; }
.point { background: var(--amber-l); border: 1px solid #f5dc8e; }
.point b:first-child { color: #9a6b00; }
.life { background: var(--green-l); border: 1px solid #c3e8d2; }
.life::before { content: "身近な例"; display: inline-block; background: var(--green); color: #fff; font-size: 0.72rem; font-weight: 700; border-radius: 99px; padding: 0 9px; margin-right: 6px; }
.pro { background: var(--blue-l); border: 1px solid #c7dbf7; }
.pro::before { content: "現場ではこう使う"; display: inline-block; background: var(--blue); color: #fff; font-size: 0.72rem; font-weight: 700; border-radius: 99px; padding: 0 9px; margin-right: 6px; }
.fix { background: var(--red-l); border: 1px solid #f5c9c6; }
.fix::before { content: "補足・訂正"; display: inline-block; background: var(--red); color: #fff; font-size: 0.72rem; font-weight: 700; border-radius: 99px; padding: 0 9px; margin-right: 6px; }
.content details { border: 1px solid var(--line); border-radius: 12px; background: #fbfdff; margin: 8px 0; }
.content details summary { cursor: pointer; padding: 10px 12px; font-weight: 700; }
.content details .a { padding: 4px 12px 10px; }

/* トップダウン分析のステップ */
.steps { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.step { position: relative; border-radius: 14px; padding: 12px 10px 10px; text-align: center; border: 1.5px solid; min-width: 0; }
.step-h { font-weight: 900; font-size: 1rem; line-height: 1.3; }
.step-h small { display: block; font-weight: 500; font-size: 0.72rem; }
.step .ic { width: 34px; height: 34px; margin: 6px auto; display: block; }
.step ul { text-align: left; margin: 4px 0 6px; padding-left: 1.1em; font-size: 0.76rem; color: var(--ink); line-height: 1.6; }
.step-f { font-weight: 700; font-size: 0.8rem; }
.c-blue { background: var(--blue-l); border-color: #b5cff4; color: var(--blue-d); }
.c-teal { background: var(--teal-l); border-color: #a5ded9; color: #0d7f78; }
.c-amber { background: var(--amber-l); border-color: #f2d58a; color: #a8740a; }
.c-pink { background: var(--pink-l); border-color: #f4b8c2; color: #c33a51; }
.c-orange { background: var(--orange-l); border-color: #f6c79f; color: #b85a12; }
.c-purple { background: #f1ecfd; border-color: #cfc0f5; color: #6a3fc8; }

/* 金利が動くと */
.rate-rows { display: grid; gap: 10px; margin: 12px 0; }
.rate-row { border-radius: 14px; padding: 10px; }
.up-row { background: var(--red-l); border: 1px solid #f5c9c6; }
.down-row { background: var(--blue-l); border: 1px solid #c7dbf7; }
.rate-h { font-weight: 900; font-size: 1.05rem; display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.rate-h small { font-weight: 500; font-size: 0.75rem; }
.up-row .rate-h { color: var(--red); }
.down-row .rate-h { color: var(--blue); }
.rate-h .ic { width: 26px; height: 26px; }
.rate-cells { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.rate-cells div { background: #fff; border-radius: 10px; padding: 6px 8px; font-size: 0.78rem; line-height: 1.4; min-width: 0; }
.rate-cells b { display: block; font-size: 0.85rem; color: var(--navy); }

/* 一問一答 */
.qcard { border: 1px solid var(--line); border-radius: 14px; padding: 12px; margin: 10px 0; background: #fff; transition: border-color 0.2s; }
.qcard.done-ok { border-color: #9fd9b6; background: #fbfefc; }
.qcard.done-ng { border-color: #f1b3ae; background: #fffbfb; }
.qtop { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.qn { font-weight: 900; color: var(--blue); }
.lv { font-size: 0.7rem; border-radius: 99px; padding: 0 8px; background: #eef3fa; color: var(--sub); white-space: nowrap; }
.lv.adv { background: #efe7fd; color: #6a3fc8; }
.qstat { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; }
.qbadge { font-size: 0.72rem; font-weight: 700; border-radius: 99px; padding: 1px 10px; white-space: nowrap; }
.qbadge.ok { background: var(--green-l); color: var(--green); }
.qbadge.ng { background: var(--red-l); color: var(--red); }
.qbadge.new { background: #eef1f5; color: var(--sub); }
.qbadge.amber { background: var(--amber-l); color: #9a6b00; }
.qtext { font-weight: 700; margin: 6px 0 10px; }
.ans { background: #f7faff; border-left: 4px solid var(--blue); border-radius: 8px; padding: 8px 12px; font-size: 0.93rem; }
.judge { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.judge .muted { width: 100%; }
.saved { margin: 6px 0 0; }

/* ボタン・フォーム */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; border-radius: 12px; padding: 9px 16px; font: inherit; font-weight: 700; font-size: 0.9rem;
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn.primary { background: linear-gradient(180deg, #2b7bea, var(--blue-d)); color: #fff; box-shadow: 0 4px 12px rgba(21, 101, 216, 0.28); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost { background: #fff; border-color: #c7d8ef; color: var(--blue-d); }
.btn.ok { background: var(--green-l); color: var(--green); border-color: #bfe5cf; flex: 1; }
.btn.ng { background: var(--red-l); color: var(--red); border-color: #f3c3bf; flex: 1; }
.btn.picked { outline: 3px solid currentColor; outline-offset: 1px; }
.btn:disabled { opacity: 0.6; cursor: default; }
.btn.wide { width: 100%; }
textarea, input[type="text"], input:not([type]) {
  width: 100%; font: inherit; font-size: 16px; border: 1px solid #cddbee; border-radius: 12px; padding: 10px 12px; background: #fbfdff; color: var(--ink);
}
textarea:focus, input:focus { outline: 3px solid #bcd6fa; border-color: var(--blue); }
.work-card { border: 1px solid var(--line); border-radius: 14px; padding: 12px; margin: 10px 0; }
.work-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.work-top h3 { margin: 0; font-size: 1rem; color: var(--navy); flex: 1 1 12em; }
.work-prompt { background: #f7faff; border-radius: 10px; padding: 8px 12px; font-size: 0.9rem; }
.work-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 8px; flex-wrap: wrap; font-size: 0.85rem; }
.work-actions a { display: inline-flex; align-items: center; gap: 4px; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-form input { flex: 1 1 12em; }

/* 学習記録 */
.chart { width: 100%; max-width: 760px; height: auto; display: block; margin: 0 auto; }
.chart .grid { stroke: #e7eef7; }
.chart .ax { fill: var(--sub); font-size: 12px; }
.chart .bar { fill: #9cc2f5; }
.chart .bar.last { fill: var(--blue); }
.chart .trend { fill: none; stroke: #5b8fd8; stroke-width: 2; stroke-dasharray: 5 4; }
.chart .dot { fill: var(--blue-d); }
.chart .tip rect { fill: var(--blue-d); }
.chart .tip text { fill: #fff; font-size: 13px; font-weight: 700; }
.chart + .chart { margin-top: 8px; }
.cats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.cat { border-radius: 12px; padding: 10px; text-align: center; border: 1px solid; font-size: 0.85rem; font-weight: 700; }
.cat b { display: block; font-size: 1.6rem; line-height: 1.2; }
.cat b small { font-size: 0.55em; }
.hist-list { list-style: none; margin: 0; padding: 0; }
.hist { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.hist:last-child { border-bottom: 0; }
.hist > div:nth-child(2) { flex: 1; min-width: 0; }
.hist-q { font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; }
.hist-r { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.hist .ic { width: 26px; height: 26px; }
.okc { color: var(--green); }
.ngc { color: var(--red); }

/* 課題 */
.asg-row { display: flex; align-items: center; gap: 10px; padding: 12px 4px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.asg-row:last-child { border-bottom: 0; }
.asg-main { flex: 1; min-width: 0; }
.asg-title { font-weight: 700; color: var(--navy); }
.asg-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.sub { border: 1px solid var(--line); border-radius: 14px; padding: 12px; margin: 10px 0; }
.sub.mine { border-color: #bcd3f3; background: #fbfdff; }
.sub header { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sub-body { margin: 8px 0; font-size: 0.93rem; overflow-wrap: anywhere; }
.cmt { display: flex; gap: 8px; background: var(--amber-l); border-radius: 12px; padding: 8px 10px; margin: 6px 0; font-size: 0.88rem; overflow-wrap: anywhere; }
.cmt-form { display: flex; gap: 6px; margin-top: 8px; }
.cmt-form input { padding: 7px 10px; }

/* メンバー */
.mem-row { display: flex; align-items: center; gap: 10px; padding: 12px 2px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; flex-wrap: wrap; }
.mem-row:last-child { border-bottom: 0; }
.mem-main { flex: 1; min-width: 8em; }
.mem-stats { display: flex; gap: 14px; }
.mem-stats div { display: flex; flex-direction: column; align-items: center; }
.mem-stats b { font-size: 1.15rem; color: var(--navy); }
.flash { border-color: #f3d36b; background: var(--amber-l); }
.code { font-family: ui-monospace, Menlo, monospace; font-size: 1.6rem; font-weight: 700; letter-spacing: 0.08em; color: var(--navy); margin: 6px 0; user-select: all; }

/* ログイン */
.login-body .page { min-height: 100svh; display: grid; place-items: center; padding: 20px; background: radial-gradient(circle at 80% 10%, #dcebfb, transparent 60%), var(--bg); }
.login-card { width: min(420px, 100%); background: #fff; border-radius: 20px; box-shadow: var(--shadow); padding: 28px 22px; text-align: center; border: 1px solid var(--line); }
.login-card .hand { font-size: 1.1rem; margin: 6px 0 18px; }
.login-form { text-align: left; display: grid; gap: 8px; }
.login-form label { font-weight: 700; font-size: 0.85rem; }
.login-form input { text-align: center; letter-spacing: 0.1em; font-family: ui-monospace, Menlo, monospace; }
.err { color: var(--red); margin: 0; font-size: 0.85rem; }
.foot { text-align: center; margin: 20px 0; }

/* ---------- PC ---------- */
@media (min-width: 900px) {
  body { font-size: 16px; }
  .topbar { padding: 12px 26px; gap: 16px; }
  .logo { font-size: 1.15rem; }
  .pill-plan { display: inline-flex; align-items: center; gap: 5px; background: var(--blue-l); color: var(--navy); border-radius: 99px; padding: 2px 12px; font-size: 0.78rem; white-space: nowrap; }
  .topnav { display: flex; gap: 4px; margin-left: 16px; }
  .topnav a { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 10px; color: var(--ink); text-decoration: none; font-size: 0.9rem; white-space: nowrap; }
  .topnav a:hover { background: var(--blue-l); }
  .topnav a.on { color: var(--blue); font-weight: 700; background: var(--blue-l); }
  .me-name { display: inline; }
  .tabbar { display: none; }
  .page { padding: 24px 26px 40px; }
  .card, .content section { padding: 22px 24px; }
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .hero { padding: 30px 32px 34px; min-height: 230px; }
  .hero h1 { font-size: 2.5rem; }
  .hero-hand { display: block; position: absolute; right: 36px; top: 26px; z-index: 1; margin: 0; font-size: 1.45rem; line-height: 1.6; transform: rotate(-4deg); text-align: right; }
  .skyline { width: 52%; height: 78%; opacity: 0.4; }
  .lesson-wrap { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 22px; align-items: start; }
  .side { top: calc(var(--topbar-h, 64px) + 14px); margin: 0; }
  /* 章の一覧だけをスクロールさせ、ゴール・確認テスト等のリンクは下に常に出す */
  .side-inner { display: flex; flex-direction: column; max-height: calc(100vh - var(--topbar-h, 64px) - 28px - 48px); }
  .side-inner .chap { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
  .side-inner .side-links { flex: none; }
  .side-cur { display: none; }
  .side-box summary { pointer-events: none; }
  .side-box summary .ic { display: none; }
  .chap { max-height: none; }
  .steps { grid-template-columns: repeat(4, 1fr); }
  .step:not(:last-child)::after { content: ""; position: absolute; right: -10px; top: 50%; border: 7px solid transparent; border-left-color: #9dbbe6; transform: translate(50%, -50%); }
  .rate-row { display: grid; grid-template-columns: 150px 1fr; align-items: center; gap: 10px; }
  .rate-h { flex-direction: column; margin: 0; text-align: center; }
  .rate-cells { grid-template-columns: repeat(6, 1fr); }
  .cats { grid-template-columns: repeat(3, 1fr); }
  .judge .muted { width: auto; }
  .btn.ok, .btn.ng { flex: none; }
  .goal { display: grid; grid-template-columns: 1fr auto; gap: 0 20px; align-items: center; }
  .goal h2 { grid-column: 1 / -1; }
  .goal-hand { margin: 0; transform: rotate(-3deg); }
}

/* 第2回：HTML 図解 */
.hawk { margin: 12px 0; }
.hawk-bar { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-radius: 99px; background: linear-gradient(90deg, #d8413a, #eef2f8 50%, #1565d8); color: #fff; font-weight: 900; }
.hawk-bar small { display: block; font-size: 0.7rem; font-weight: 500; }
.hawk-bar .h-r { text-align: right; }
.hawk-sub { display: flex; justify-content: space-between; gap: 10px; font-size: 0.75rem; color: var(--sub); margin: 6px 4px 10px; line-height: 1.5; }
.hawk-sub span:last-child { text-align: right; }
.hawk-cases { display: grid; gap: 8px; }
.hc { border-radius: 12px; padding: 8px 12px; font-size: 0.88rem; }
.hc b { display: block; color: var(--navy); }
.hc.to-dove { background: var(--blue-l); color: var(--blue-d); }
.hc.to-hawk { background: var(--red-l); color: var(--red); }
.flow { display: grid; gap: 10px; margin: 12px 0; }
.flow-in { display: flex; align-items: center; gap: 6px; }
.fbox { flex: 1; border-radius: 12px; padding: 10px; color: #fff; font-weight: 700; text-align: center; font-size: 0.88rem; line-height: 1.4; min-width: 0; }
.fbox small { display: block; font-weight: 500; font-size: 0.72rem; }
.fbox.dark { background: var(--navy); }
.fbox.blue { background: var(--blue); }
.farrow { color: var(--sub); font-weight: 900; }
.flow-in .farrow:last-child { display: none; }
.flow-out { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.flow-out li { border-radius: 10px; padding: 6px 10px; font-size: 0.86rem; display: flex; gap: 8px; align-items: baseline; }
.flow-out li b { flex: none; font-size: 0.75rem; border-radius: 99px; padding: 0 8px; color: #fff; }
.flow-out .buy { background: var(--red-l); }
.flow-out .buy b { background: var(--red); }
.flow-out .sell { background: var(--blue-l); }
.flow-out .sell b { background: var(--blue); }
.fw { margin: 12px 0; font-size: 0.85rem; }
.fw-t { font-weight: 700; margin: 0 0 8px; }
.fw-row { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.fw-l { flex: none; width: 4.5em; color: var(--sub); }
.fw-bar { flex: 1; display: flex; height: 30px; border-radius: 8px; overflow: hidden; background: #eef2f7; min-width: 0; }
.fw-bar i { font-style: normal; display: grid; place-items: center; font-weight: 700; font-size: 0.78rem; white-space: nowrap; }
.fw-bar .hold, .sw.hold { background: #9cc2f5; color: var(--navy); }
.fw-bar .hike, .sw.hike { background: var(--red); color: #fff; }
.fw-legend { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 0.75rem; color: var(--sub); margin: 6px 0; }
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-left: 6px; }
.fw-note { margin: 6px 0 0; }
.fw-note b { color: var(--red); }
@media (min-width: 900px) {
  .hawk-cases { grid-template-columns: 1fr 1fr; }
  .hc.to-hawk { text-align: right; }
  .flow { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); align-items: center; }
  .flow-in .farrow:last-child { display: inline; }
}

.cmp { display: grid; gap: 10px; margin: 12px 0; }
.cmp-card { border: 1.5px solid; border-radius: 14px; padding: 10px 12px; min-width: 0; }
.cmp-card h4 { margin: 0 0 4px; font-size: 1rem; }
.cmp-card dl { margin: 0; color: var(--ink); font-size: 0.86rem; }
.cmp-card dt { font-weight: 700; font-size: 0.74rem; color: var(--sub); margin-top: 6px; }
.cmp-card dd { margin: 0; }
.fxcmp { display: grid; gap: 10px; margin: 12px 0; }
.fxc { border-radius: 14px; padding: 10px 12px; font-size: 0.85rem; }
.fxc.win { background: var(--green-l); }
.fxc.lose { background: var(--red-l); }
.fxc-h { margin: 0 0 6px; font-weight: 700; }
.fxrow { display: flex; align-items: center; gap: 8px; margin: 4px 0; }
.fxrow span { flex: none; width: 3.5em; color: var(--sub); }
.fxrow i { font-style: normal; font-weight: 700; color: #fff; border-radius: 6px; padding: 2px 8px; white-space: nowrap; min-width: 3.5em; }
.fxrow .plus { background: var(--blue); }
.fxrow .minus { background: var(--red); }
.fxc-r { margin: 6px 0 0; font-weight: 700; }
.fxc.win .fxc-r { color: var(--green); }
.fxc.lose .fxc-r { color: var(--red); }
.rating { margin: 12px 0; }
.rt-row { display: grid; gap: 8px; }
.rt-group { border-radius: 12px; padding: 8px; }
.rt-group.ok { background: var(--blue-l); }
.rt-group.ng { background: var(--orange-l); }
.rt-cells { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.rt-cells span { background: var(--c); color: #fff; font-weight: 900; text-align: center; border-radius: 8px; padding: 6px 2px; font-size: 0.85rem; white-space: nowrap; }
.rt-group p { margin: 4px 0 0; text-align: center; font-weight: 700; font-size: 0.82rem; line-height: 1.4; }
.rt-arrow { margin: 8px 0 0; color: var(--red); font-weight: 700; font-size: 0.88rem; text-align: center; }
.recov { margin: 12px 0; font-size: 0.85rem; }
.rc-t { font-weight: 700; margin: 0 0 6px; }
.rc-row { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.rc-row span { flex: none; width: 7.5em; color: var(--sub); font-size: 0.8rem; }
.rc-row i { font-style: normal; font-weight: 700; color: #fff; border-radius: 6px; padding: 4px 10px; text-align: right; white-space: nowrap; }
.rc-row .stock { background: var(--red); }
.rc-row .mix { background: var(--blue); min-width: 6em; }
@media (min-width: 900px) {
  .cmp { grid-template-columns: repeat(3, 1fr); }
  .fxcmp { grid-template-columns: 1fr 1fr; }
  .rt-row { grid-template-columns: 1fr 1fr; }
}

/* 動画：スクロール中は隅に浮かせる（iframe は動かさず位置だけ変える＝再生が途切れない） */
.video-slot { position: relative; }
.vbar { display: none; }
.vplayer.floating { position: fixed; z-index: 30; right: 12px; bottom: calc(var(--tabbar-h, 0px) + 12px); width: var(--vw, 52vw); background: #0d1b2e; border-radius: 12px; overflow: hidden; box-shadow: 0 12px 32px rgba(13, 27, 46, 0.35); }
.vplayer.floating .video-box { border-radius: 0; }
.vplayer.floating .vbar { display: flex; align-items: center; gap: 2px; padding: 4px 6px; color: #fff; font-size: 0.75rem; }
.vbar-t { display: inline-flex; align-items: center; gap: 4px; margin-right: auto; opacity: 0.85; white-space: nowrap; }
.vbtn { border: 0; background: transparent; color: #cfe0f7; font: inherit; font-weight: 700; font-size: 0.72rem; min-width: 26px; height: 24px; border-radius: 6px; cursor: pointer; display: inline-grid; place-items: center; }
.vbtn:hover, .vbtn.on { background: rgba(255, 255, 255, 0.16); color: #fff; }
.vbtn .ic { width: 14px; height: 14px; }
.vbtn[data-vsize="l"] { display: none; }
.vplayer.floating[data-size="s"] { --vw: 46vw; }
.vplayer.floating[data-size="m"] { --vw: 68vw; }
.video-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; }
.video-foot p { margin: 8px 4px 0; flex: 1 1 20em; }
.vtoggle { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--sub); margin: 6px 4px 0; cursor: pointer; }
@media (min-width: 900px) {
  .vbtn[data-vsize="l"] { display: inline-grid; }
  .vplayer.floating { right: 20px; bottom: 20px; }
  .vplayer.floating[data-size="s"] { --vw: 320px; }
  .vplayer.floating[data-size="m"] { --vw: 480px; }
  .vplayer.floating[data-size="l"] { --vw: min(720px, 46vw); }
}

/* 課題：提出済みの表示・読み込み中・トースト */
.wview { border: 1px solid #c3e8d2; background: var(--green-l); border-radius: 12px; padding: 10px 12px; margin: 8px 0 0; }
.wview-h { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 0.88rem; color: var(--navy); }
.wview-time { margin-left: auto; }
.wview-body { white-space: pre-wrap; overflow-wrap: anywhere; background: #fff; border-radius: 10px; padding: 8px 12px; margin: 6px 0 0; font-size: 0.93rem; }
.wbtns { display: inline-flex; gap: 8px; }
.btn.loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.loading::after { content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid rgba(255, 255, 255, 0.45); border-top-color: #fff; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; left: 50%; bottom: calc(var(--tabbar-h, 0px) + 20px); transform: translate(-50%, 16px); z-index: 50; background: var(--navy); color: #fff; font-weight: 700; font-size: 0.9rem; padding: 10px 18px; border-radius: 99px; box-shadow: 0 10px 28px rgba(13, 27, 46, 0.3); opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.ok::before { content: "✓ "; color: #7ee2a8; }
.toast.ng { background: var(--red); }
