/* はじめてのClaude — スタイル
   色はすべて :root の変数で管理しています。テーマを変えるときはここだけ直せばOK。 */
:root {
  --primary: #5a3a28;        /* メインの濃い色（ボタン・選択中ナビ） */
  --primary-ink: #fff;
  --text: #3a2c23;
  --muted: #73665b;
  --border: #e6ddd2;
  --paper: #fff;
  --bg: #f8f5f0;
  --side: #fcfaf7;
  --sand: #f3e4d2;           /* 明るいアクセント */
  --sand-strong: #d9b896;
  --accent: #c2683a;         /* テラコッタ（進捗バーなど） */
  --soft: #f6efe6;
  --soft-2: #efe4d6;
  --ok: #3f7d45;
  --ok-bg: #edf6ea;
  --ng: #b2561a;
  --ng-bg: #fff2e6;
  --blue: #2f5f9e;
  --blue-bg: #eef4fb;
  font-family: "Noto Sans JP", "Hiragino Sans", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 16px;
  line-height: 1.8;
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button, a, input, select, textarea { touch-action: manipulation; }
button { cursor: pointer; }
a { color: var(--primary); text-underline-offset: 4px; }
button:disabled { cursor: not-allowed; opacity: .45; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 3px solid #e49d30; outline-offset: 4px;
}
h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: clamp(1.7rem, 3vw, 2.25rem); line-height: 1.45; letter-spacing: .035em; font-weight: 700; }
h2 { font-size: 1.4rem; line-height: 1.6; }
h3 { font-size: 1.12rem; line-height: 1.6; }
small { font-size: .82rem; }
ul, ol { padding-left: 1.5rem; }
li + li { margin-top: .4rem; }
kbd { font-family: Consolas, monospace; font-size: .85em; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; background: #fff; }
:not(pre) > code { font-family: Consolas, "Cascadia Code", monospace; font-size: .88em; background: var(--soft-2); padding: 1px 6px; border-radius: 4px; overflow-wrap: anywhere; }

/* ---------- レイアウト ---------- */
.app-shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--side); border-right: 1px solid var(--border); padding: 34px 22px; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; font-size: 1.22rem; font-weight: 700; line-height: 1.5; letter-spacing: .06em; color: var(--primary); }
.brand-mark { display: grid; place-items: center; width: 48px; height: 48px; flex-shrink: 0; background: var(--primary); color: var(--sand); border-radius: 15px; }
.brand-mark svg { width: 28px; height: 28px; }
.brand small { display: block; font-size: .58rem; letter-spacing: .1em; margin-top: 7px; }
.course-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 23px; }
.course-switch a { display: grid; text-decoration: none; text-align: center; border: 1px solid var(--border); border-radius: 8px; padding: 8px; font-size: .9rem; font-weight: 700; min-height: 52px; background: #fff; }
.course-switch small { font-size: .66rem; font-weight: 400; }
.course-switch [aria-current="page"] { background: var(--sand); border-color: var(--sand-strong); }
.nav-caption { font-size: .75rem; color: var(--muted); margin: 20px 10px 10px; }
nav { display: grid; gap: 5px; }
nav a { display: flex; align-items: center; gap: 12px; text-decoration: none; border-radius: 8px; padding: 12px; font-size: .92rem; min-height: 44px; }
nav a > span:first-child { width: 24px; text-align: center; font-size: 1.02rem; flex-shrink: 0; }
nav a:hover { background: var(--soft-2); }
nav a[aria-current="page"] { background: var(--primary); color: var(--primary-ink); }
nav a[hidden] { display: none; }
.nav-count { margin-left: auto; font-size: .75rem; opacity: .8; }
.nav-lesson-label { min-width: 0; }
.nav-lesson-title { display: block; font-size: .72rem; line-height: 1.6; margin-top: 4px; overflow-wrap: anywhere; }
.sidebar-progress { margin-top: auto; padding: 28px 10px 16px; }
.overline { font-size: .73rem; letter-spacing: .06em; color: var(--muted); }
.sidebar-progress p { font-size: .8rem; margin: 6px 0; }
.sidebar-progress strong { font-size: 1.4rem; }
.sidebar-progress a { font-size: .75rem; }
progress { width: 100%; height: 7px; appearance: none; border: 0; border-radius: 20px; background: #ece4da; }
progress::-webkit-progress-bar { background: #ece4da; border-radius: 20px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 20px; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 20px; }
.safe-note { display: flex; gap: 8px; border-top: 1px solid var(--border); padding-top: 20px; font-size: .68rem; color: var(--muted); }
.safe-note > span { font-size: 20px; }
.mobile-only { display: none; }

.workspace { min-width: 0; }
.topbar { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 20px 42px; border-bottom: 1px solid var(--border); font-size: .68rem; color: var(--muted); letter-spacing: .08em; }
.topbar-divider { padding: 0 16px; color: #bcae9f; }
.private-label { font-size: .7rem; letter-spacing: 0; }
.private-label::before { content: ""; display: inline-block; width: 6px; height: 6px; background: var(--accent); border-radius: 100%; margin-right: 8px; }
main { max-width: 1280px; margin: 0 auto; padding: 36px 42px 60px; min-height: 80vh; }
main:focus, h1:focus { outline: none; }

/* ---------- 見出し ---------- */
.page-heading { margin-bottom: 28px; }
.page-heading .eyebrow { display: flex; gap: 8px; align-items: center; font-size: .73rem; font-weight: 600; letter-spacing: .08em; color: #8a5a3b; margin-bottom: 10px; }
.page-heading .lead { color: var(--muted); max-width: 760px; margin-top: 12px; font-size: 1rem; }
.heading-row, .section-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.section-heading { margin: 32px 0 16px; }
.section-heading p { font-size: .82rem; color: var(--muted); }
.pill { border: 1px solid var(--border); border-radius: 30px; padding: 3px 11px; font-size: .72rem; color: #6a5547; white-space: nowrap; background: #fff; }
.pill.sand { background: var(--sand); border-color: var(--sand); }
.pill.level-1 { background: #eef6ea; border-color: #d5e8cd; color: #3d6b33; }
.pill.level-2 { background: #fdf1e3; border-color: #f0d9bd; color: #8a4d17; }
.pill.level-3 { background: #eef1fb; border-color: #d4dbf1; color: #384f8f; }
.pill.new { background: #fbe9e1; border-color: #f1c9b6; color: #9a3f17; font-weight: 700; }

/* ---------- ボタン ---------- */
.button { display: inline-flex; align-items: center; justify-content: center; gap: 10px; text-decoration: none; border: 1px solid var(--primary); background: var(--primary); color: #fff; border-radius: 8px; padding: 10px 19px; font-weight: 600; font-size: .88rem; min-height: 46px; line-height: 1.55; }
.button.secondary { background: #fff; color: var(--primary); border-color: var(--border); }
.button.ghost { background: transparent; border-color: transparent; color: var(--primary); }
.button.small { padding: 7px 12px; min-height: 40px; font-size: .8rem; }
.button:hover { filter: brightness(.96); }
.button-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

/* ---------- 学習マップ ---------- */
.resume-card { background: var(--primary); color: #fff; display: grid; grid-template-columns: minmax(0, 1fr) 210px; gap: 24px; padding: 30px 32px; border-radius: 14px; position: relative; overflow: hidden; }
.resume-card .overline { color: #e6c9ad; }
.resume-card h2 { margin: 8px 0 10px; }
.resume-card p { font-size: .9rem; color: #efdccb; margin-bottom: 22px; }
.resume-card .button { background: var(--sand); color: var(--primary); border-color: var(--sand); }
.hero-illustration { place-self: center; position: relative; width: 172px; height: 145px; display: flex; align-items: center; justify-content: center; }
.hero-illustration::before, .hero-illustration::after { content: ""; position: absolute; border: 1px solid #8d6650; transform: rotate(-17deg); width: 150px; height: 122px; border-radius: 22px; }
.hero-illustration::after { transform: rotate(12deg); border-style: dashed; }
.hero-illustration .mark { z-index: 1; color: var(--sand); width: 92px; height: 92px; }
.hero-illustration .dot { position: absolute; right: 0; bottom: 10px; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: #e3b48d; color: var(--primary); z-index: 2; font-weight: 700; }
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--border); border-radius: 12px; margin: 20px 0 28px; background: #fff; }
.stat { padding: 18px 22px; display: flex; align-items: baseline; gap: 8px; }
.stat + .stat { border-left: 1px solid var(--border); }
.stat strong { font-size: 1.5rem; line-height: 1.2; }
.stat span { font-size: .76rem; color: var(--muted); }
.news-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.news-card { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; }
.news-card time { font-size: .72rem; color: var(--muted); letter-spacing: .04em; }
.news-card strong { font-size: .98rem; line-height: 1.6; }
.news-card p { font-size: .86rem; color: var(--muted); }
.news-card a { font-size: .8rem; margin-top: auto; padding-top: 6px; }
.module { border: 1px solid var(--border); background: #fff; border-radius: 12px; margin-bottom: 18px; overflow: hidden; }
.module-head { display: flex; align-items: center; gap: 16px; padding: 20px 24px; background: #fcfaf6; border-bottom: 1px solid var(--border); }
.module-number { border: 1px solid #e7cfb7; color: #7a4a2c; background: var(--soft); border-radius: 10px; min-width: 43px; height: 43px; display: grid; place-items: center; font-size: .88rem; font-weight: 700; }
.module-head p { font-size: .82rem; color: var(--muted); margin-top: 4px; }
.module-head > .pill { margin-left: auto; }
.lesson-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 7px 24px; gap: 0 24px; }
.lesson-link { display: flex; align-items: center; gap: 12px; padding: 17px 0; text-decoration: none; border-bottom: 1px solid #f1ebe3; min-width: 0; color: var(--text); }
.lesson-link:last-child { border-bottom: 0; }
.lesson-link:hover .lesson-title { color: #8a4a22; text-decoration: underline; }
.lesson-status { flex-shrink: 0; width: 25px; height: 25px; border: 1px solid #ddd0c2; border-radius: 50%; font-size: .66rem; display: grid; place-items: center; color: #6c5a4d; }
.lesson-status.done { background: #e2efd9; border-color: #e2efd9; color: #2f5d27; }
.lesson-title { font-size: 1rem; font-weight: 500; line-height: 1.6; }
.lesson-meta { font-size: .75rem; color: var(--muted); }
.arrow { margin-left: auto; color: #94806f; }

/* ---------- コールアウト ---------- */
.callout { background: var(--soft); border: 1px solid #ecdcc9; border-radius: 10px; padding: 18px 22px; margin: 22px 0; font-size: 1rem; }
.callout.warning { background: #fff4e6; border-color: #f0d8b6; color: #7d4511; }
.callout.blue { background: var(--blue-bg); border-color: #d3e2f4; color: #254f72; }
.callout.new { background: #fdf0ea; border-color: #f3cdbb; color: #7f3514; }
.callout strong { display: block; margin-bottom: 4px; }
.callout p + p { margin-top: 8px; }
.callout ul { margin: 6px 0 0; }

/* ---------- レッスン本文 ---------- */
.content-grid { display: grid; grid-template-columns: minmax(0, 1fr) 230px; gap: 28px; align-items: start; }
.reader { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 32px; min-width: 0; }
.reader > section + section { margin-top: 36px; padding-top: 28px; border-top: 1px solid #f0e9e0; }
.reader h2 { margin-bottom: 14px; }
.reader h3 { margin: 22px 0 10px; }
.reader p + p { margin-top: 16px; }
.reader p { overflow-wrap: anywhere; line-height: 1.95; }
.reader :target { scroll-margin-top: 20px; }
.reader-side { position: sticky; top: 24px; font-size: .82rem; }
.reader-side h3 { font-size: .9rem; margin-bottom: 12px; }
.reader-side ul { list-style: none; padding: 0; display: grid; gap: 10px; }
.reader-side li { margin: 0; }
.reader-side a { display: block; text-decoration: none; padding: 5px 0; color: var(--muted); }
.reader-side .button { margin-top: 16px; width: 100%; }
.reader-side .callout a { display: inline; padding: 0; color: var(--primary); text-decoration: underline; }
.lesson-topline { display: flex; gap: 14px; align-items: center; margin-bottom: 22px; font-size: .8rem; }
.lesson-topline a { margin-right: auto; }
.reading-label { display: inline-block; padding: 4px 9px; background: var(--sand); color: #7a4a2c; border-radius: 5px; font-size: .73rem; margin-bottom: 13px; }
.goals { padding: 18px 23px; background: #fbf7f1; border-radius: 10px; margin: 0 0 22px; }
.goals ul { margin-bottom: 0; }
.goals strong { font-size: .9rem; }
.diagram { background: #fbf8f4; border: 1px solid var(--border); border-radius: 12px; padding: 22px; margin: 20px 0; }
.diagram-nodes { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }
.diagram-node { background: #fff; border: 1px solid #e0cdb9; border-radius: 8px; padding: 12px 16px; font-size: .9rem; max-width: 100%; text-align: center; }
.diagram-connections { display: grid; gap: 8px; margin: 20px 0 0; list-style: none; padding: 0; }
.diagram-connections li { font-size: .88rem; text-align: center; margin: 0; }
.diagram figcaption { margin-top: 15px; color: var(--muted); font-size: .8rem; text-align: center; }
.diagram-edge { padding: 2px 8px; margin: 0 8px; border-radius: 4px; background: var(--soft-2); color: #7a4a2c; }
.analogy { border-left: 4px solid var(--sand-strong); padding: 16px 22px; background: #fbf6ef; margin: 20px 0; }
.analogy strong { display: block; margin-bottom: 7px; }
.analogy .limits { font-size: .86rem; color: var(--muted); margin-top: 12px; }
.misconception { border: 1px solid var(--border); padding: 16px 20px; border-radius: 8px; margin-top: 12px; }
.misconception strong { display: block; font-size: .95rem; }
.misconception p { margin-top: 8px; }
.table-wrap { overflow-x: auto; margin: 18px 0; border: 1px solid var(--border); border-radius: 10px; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; background: #fff; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid #f0e9e0; vertical-align: top; }
th { background: #fbf7f1; font-weight: 600; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
.code-block { margin: 18px 0; }
.code-block .code-label { font-size: .75rem; color: var(--muted); margin-bottom: 6px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.copy-btn { border: 1px solid var(--border); background: #fff; border-radius: 6px; font-size: .72rem; padding: 2px 10px; min-height: 30px; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; background: #2f241d; color: #f3e6d8; padding: 18px; border-radius: 8px; font-size: .88rem; line-height: 1.7; overflow-x: auto; margin: 0; }
code { font-family: Consolas, "Cascadia Code", monospace; }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 18px 0; }
.compare > div { border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px; background: #fff; font-size: .92rem; }
.compare .bad { border-color: #f0d1b8; background: #fff8f1; }
.compare .good { border-color: #cfe3c6; background: #f5faf2; }
.compare b { display: block; font-size: .8rem; margin-bottom: 6px; }
.compare pre { font-size: .82rem; }
.sources { font-size: .85rem; overflow-wrap: anywhere; }
.sources a { display: inline-block; margin: 4px 0; }
.lesson-completion { border-top: 1px solid var(--border); padding-top: 24px; margin-top: 32px; }
.status-line { font-size: .82rem; color: var(--muted); margin: 14px 0; }
.term-line + .term-line { margin-top: 10px !important; }

/* ---------- 問題 ---------- */
.question-card { border: 1px solid var(--border); border-radius: 12px; background: #fff; padding: 28px; }
.question-card h2 { font-size: 1.18rem; margin: 12px 0 20px; line-height: 1.8; white-space: pre-wrap; }
.question-card .overline { display: flex; justify-content: space-between; gap: 8px; }
.options { display: grid; gap: 12px; border: 0; padding: 0; margin: 20px 0; min-width: 0; }
.options legend { font-size: .82rem; color: var(--muted); margin-bottom: 12px; }
.option { position: relative; display: flex; gap: 13px; align-items: flex-start; border: 1px solid #e3d8cc; border-radius: 9px; padding: 16px; background: #fff; font-size: 1rem; cursor: pointer; }
.option input { accent-color: var(--blue); width: 19px; height: 19px; flex-shrink: 0; margin-top: 5px; }
.option-letter { font-weight: 700; color: #8a7767; flex-shrink: 0; }
.option-content { min-width: 0; overflow-wrap: anywhere; }
.option:not(.graded):has(input:checked) { border-color: #3f75b9; background: #eff5ff; box-shadow: 0 0 0 1px #3f75b9; }
.option.correct { border: 2px solid #46853f; background: var(--ok-bg); }
.option.wrong { border: 2px solid #c36a1e; background: var(--ng-bg); }
.answer-label { display: block; font-size: .8rem; font-weight: 700; margin-top: 6px; }
.correct .answer-label { color: #2b662b; }
.wrong .answer-label { color: #995010; }
.option-reason { display: block; font-size: .86rem; margin-top: 8px; color: #5f5248; }
.feedback { border-radius: 9px; padding: 18px 20px; margin: 18px 0; background: var(--ok-bg); border: 1px solid #a8c693; }
.feedback.incorrect { background: var(--ng-bg); border-color: #e0b681; }
.feedback strong { display: block; margin-bottom: 8px; }
.feedback p { font-size: 1rem; margin: 7px 0; }
.quiz-toolbar { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 18px 20px; margin-bottom: 22px; }
.field { display: grid; gap: 7px; font-size: .8rem; color: var(--muted); }
input[type="search"], input[type="text"], select, textarea { border: 1px solid #ddd0c2; border-radius: 7px; background: #fff; padding: 11px 13px; color: var(--text); min-height: 46px; max-width: 100%; }
input[type="search"], input[type="text"], textarea { width: 100%; }
textarea { min-height: 84px; resize: vertical; line-height: 1.7; }
.quiz-progress { margin-left: auto; font-size: .82rem; align-self: center; }
.question-navigation { display: flex; justify-content: space-between; gap: 12px; margin-top: 20px; }
.empty-state { padding: 40px 26px; background: #fff; border: 1px solid var(--border); border-radius: 12px; text-align: center; }
.empty-state h2 { margin: 10px 0; }
.empty-state p { margin: 14px 0; color: var(--muted); }
.review-list { display: grid; gap: 15px; }
.review-item { padding: 21px 24px; border: 1px solid var(--border); border-radius: 10px; background: #fff; display: flex; gap: 20px; align-items: center; }
.review-item .button { flex-shrink: 0; }
.review-item p { font-size: .82rem; color: var(--muted); margin-top: 6px; }
.review-item > div { flex: 1 1 0%; }

/* ---------- 用語集 ---------- */
.search-box { margin-bottom: 24px; max-width: 650px; }
.glossary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.term { padding: 24px; background: #fff; border: 1px solid var(--border); border-radius: 10px; scroll-margin-top: 20px; }
.term:target { box-shadow: 0 0 0 3px var(--sand-strong); }
.term h2 { font-size: 1.13rem; }
.term .reading { font-size: .8rem; color: var(--muted); margin: 3px 0 13px; }
.term p { font-size: 1rem; overflow-wrap: anywhere; }
.term .example { margin: 15px 0; padding-left: 14px; border-left: 3px solid var(--sand-strong); color: #6e5c4f; font-size: .88rem; }
.term-links { display: flex; gap: 10px; flex-wrap: wrap; font-size: .78rem; }

/* ---------- 演習カード・工房 ---------- */
.lab-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.lab-card { display: flex; flex-direction: column; padding: 25px; background: #fff; border: 1px solid var(--border); border-radius: 12px; }
.lab-card h2, .lab-card h3 { font-size: 1.13rem; margin: 12px 0; }
.lab-card p { font-size: .95rem; color: var(--muted); margin-bottom: 16px; }
.lab-card .button { align-self: flex-start; margin-top: auto; }
.workbench { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.panel { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 24px; min-width: 0; }
.panel h2 { font-size: 1.15rem; margin-bottom: 14px; }
.form-grid { display: grid; gap: 14px; }
.form-grid label { display: grid; gap: 6px; font-size: .86rem; font-weight: 600; }
.form-grid label small { font-weight: 400; color: var(--muted); }
.checklist { list-style: none; padding: 0; display: grid; gap: 8px; margin: 14px 0 0; }
.checklist li { margin: 0; display: flex; gap: 10px; font-size: .9rem; }
.checklist .mark { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: .7rem; flex-shrink: 0; border: 1px solid #ddd0c2; color: #8a7767; margin-top: 3px; }
.checklist .on .mark { background: #e2efd9; border-color: #e2efd9; color: #2f5d27; }
.score-meter { display: flex; align-items: baseline; gap: 6px; margin: 4px 0 10px; }
.score-meter strong { font-size: 1.8rem; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 4px; }
.chip { border: 1px solid var(--border); background: #fff; border-radius: 30px; padding: 4px 12px; font-size: .78rem; min-height: 34px; }
.chip:hover { background: var(--soft); }

/* ---------- モデル早見表 ---------- */
.model-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin: 20px 0; }
.model-card { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 20px; display: flex; flex-direction: column; gap: 8px; }
.model-card.top { border-color: var(--sand-strong); }
.model-card h3 { font-size: 1.1rem; }
.model-card .id { font-family: Consolas, monospace; font-size: .75rem; color: var(--muted); overflow-wrap: anywhere; }
.model-card p { font-size: .9rem; }
.meter { display: grid; grid-template-columns: 52px 1fr; gap: 8px; align-items: center; font-size: .74rem; color: var(--muted); }
.meter .bar { height: 7px; background: #efe6db; border-radius: 9px; overflow: hidden; }
.meter .bar span { display: block; height: 100%; background: var(--accent); }
.chooser { margin-top: 10px; }
.chooser-result { margin-top: 16px; }

/* ---------- ターミナル模擬画面 ---------- */
.terminal { background: #1f1814; color: #f3e6d8; border-radius: 12px; padding: 18px; font-family: Consolas, "Cascadia Code", monospace; font-size: .88rem; min-height: 380px; max-height: 560px; overflow-y: auto; line-height: 1.65; }
.terminal .line { white-space: pre-wrap; overflow-wrap: anywhere; }
.terminal .prompt { color: #e3b48d; }
.terminal .dim { color: #a8978a; }
.terminal .ok { color: #9fd38f; }
.terminal .warn { color: #f2c36b; }
.terminal .accent { color: #f0a77c; }
.terminal-input { display: flex; gap: 10px; margin-top: 12px; }
.terminal-input input { font-family: Consolas, monospace; }
.terminal-input .button { white-space: nowrap; flex-shrink: 0; }
.workbench.sim { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
.mission { padding: 14px 0; border-bottom: 1px solid var(--border); font-size: .92rem; }
.mission:last-child { border-bottom: 0; }
.mission.done { color: var(--muted); }
.mission.done strong::before { content: "✓ "; color: var(--ok); }

/* ---------- 共通 ---------- */
.details-box { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 25px; margin: 20px 0; }
.details-box > p + p { margin-top: 14px; }
details summary { cursor: pointer; font-weight: 600; }
details p { margin-top: 13px; }
.muted { color: var(--muted); }
.text-small { font-size: .85rem; }
.back-link { font-size: .82rem; display: inline-flex; gap: 8px; margin-bottom: 18px; }
.completion-banner { padding: 20px 24px; background: #e7f0dc; border-radius: 10px; margin: 25px 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: fixed; top: -70px; left: 16px; background: #fff; z-index: 100; padding: 12px; }
.skip:focus { top: 10px; }
footer { font-size: .7rem; color: #6a5a4e; display: flex; justify-content: space-between; gap: 20px; padding: 24px 42px; border-top: 1px solid var(--border); }
#toast:empty { display: none; }
#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); max-width: 90%; background: #3a2a20; color: #fff; padding: 12px 22px; border-radius: 9px; z-index: 100; box-shadow: 0 4px 20px rgba(0,0,0,.13); font-size: .86rem; }
.loading { padding: 40px; text-align: center; }

/* ---------- レスポンシブ ---------- */
@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 222px minmax(0, 1fr); }
  .sidebar { padding: 28px 16px; }
  .brand { font-size: 1.05rem; }
  .topbar { padding: 18px 28px; }
  main { padding: 28px; }
  .content-grid { grid-template-columns: minmax(0, 1fr); }
  .reader-side { position: static; background: var(--soft); padding: 20px; border-radius: 10px; }
  .reader-side ul { grid-template-columns: repeat(2, 1fr); }
  .reader-side .button { width: auto; }
  .lesson-list, .glossary-grid { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(3) { border-left: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--border); }
  .stat { padding: 16px; display: block; }
  .stat span { display: block; }
  .resume-card { grid-template-columns: minmax(0, 1fr) 140px; }
  .hero-illustration { transform: scale(.8); }
  .news-list { grid-template-columns: 1fr; }
  .model-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workbench { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { position: static; width: 100%; height: auto; padding: 18px 18px 0; border-right: 0; border-bottom: 1px solid var(--border); overflow: visible; }
  .brand { font-size: 1rem; line-height: 1.25; gap: 10px; }
  .brand br { display: none; }
  .brand small { font-size: .55rem; margin-top: 4px; }
  .brand-mark { width: 36px; height: 36px; border-radius: 10px; }
  .brand-mark svg { width: 22px; height: 22px; }
  .course-switch { margin-top: 16px; }
  .course-switch a { padding: 8px 12px; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; }
  .nav-caption, .sidebar-progress, .safe-note { display: none; }
  nav { display: flex; overflow-x: auto; gap: 5px; padding: 14px 0 12px; scrollbar-width: none; }
  nav::-webkit-scrollbar { display: none; }
  nav a { white-space: nowrap; flex-shrink: 0; font-size: .82rem; padding: 8px 11px; }
  nav a > span:first-child { display: none; }
  .nav-count { margin-left: 4px; font-size: .68rem; }
  .nav-lesson-title { display: none; }
  .mobile-only { display: flex; }
  .topbar { padding: 13px 20px; font-size: .6rem; flex-wrap: wrap; }
  .private-label { font-size: .6rem; }
  .topbar-divider { padding: 0 7px; }
  main { padding: 25px 18px 40px; }
  .page-heading { margin-bottom: 21px; }
  h1 { font-size: 1.6rem; }
  .heading-row { align-items: flex-start; }
  .heading-row > .pill { display: none; }
  .resume-card { display: block; padding: 24px; }
  .resume-card h2 { font-size: 1.28rem; }
  .hero-illustration { display: none; }
  .stat { padding: 14px 10px; }
  .stat strong { font-size: 1.28rem; }
  .stat span { font-size: .66rem; }
  .section-heading { margin: 26px 0 15px; align-items: flex-end; }
  .section-heading h2 { font-size: 1.2rem; }
  .section-heading p { font-size: .72rem; }
  .module-head { padding: 17px; gap: 12px; align-items: flex-start; }
  .module-head h3 { font-size: 1rem; }
  .module-head p { font-size: .76rem; }
  .module-head > .pill { display: none; }
  .lesson-list { padding: 3px 17px; }
  .reader { padding: 20px 17px; }
  .reader h2 { font-size: 1.2rem; }
  .reader-side ul { grid-template-columns: 1fr; }
  .lesson-topline { flex-wrap: wrap; }
  .question-card { padding: 21px 18px; }
  .question-card h2 { font-size: 1.08rem; }
  .option { padding: 14px 12px; gap: 9px; }
  .option-letter { display: none; }
  .question-navigation { flex-wrap: wrap; }
  .quiz-toolbar { padding: 16px; }
  .quiz-toolbar .field { width: 100%; }
  .quiz-progress { margin: 0; }
  .lab-grid, .compare, .model-grid { grid-template-columns: 1fr; }
  .review-item { align-items: flex-start; flex-direction: column; gap: 14px; }
  .term { padding: 21px; }
  .callout { padding: 16px 18px; }
  .diagram { padding: 18px 12px; }
  .diagram-connections li { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; }
  .diagram-edge { margin: 0; }
  footer { padding: 22px 18px; display: block; font-size: .66rem; }
  footer span { display: block; margin-top: 6px; }
  .question-card > .button-row .button { flex-grow: 1; }
  .terminal { min-height: 300px; font-size: .8rem; }
}
@media (prefers-reduced-motion: no-preference) {
  .button, .lesson-title, nav a { transition: background .15s, color .15s, filter .15s; }
}
@media print {
  .sidebar, .topbar, footer, .reader-side, .button, .quiz-toolbar { display: none; }
  .app-shell { display: block; }
  main { padding: 0; }
  .reader { border: 0; padding: 0; }
  .content-grid { display: block; }
}
