/* ============================================================
   4peiron — 共通スタイル
   デザイン基準: https://www.startupclub.community/
   配色: Tokyo Night（#1a1b26 系の藍地／低彩度のカード）／
   ヘアラインの区切り／詰め気味の太い見出し／
   藤・ミント・オレンジの差し色。
   グロー・ネオン・斜めカットは使わない。
   ============================================================ */

/* critical:start */
:root {
  /* surfaces — Tokyo Night */
  --bg: #1a1b26;
  --bg-band: #16161e;      /* 交互に敷くセクション背景 */
  --surface: #1f2335;      /* カード */
  --surface-2: #24283b;    /* カード内の一段沈んだ面 */
  --surface-3: #292e42;    /* 選択中・ホバー面 */
  --border: #2e3350;
  --border-2: #3b4261;     /* ホバー時の輪郭 */
  --border-soft: rgba(var(--tint-rgb), 0.08);
  /* 文字色を薄く敷くホバー面などに使う。rgba(var(--tint-rgb), 0.06) の形で使う */
  --tint-rgb: 192, 202, 245;
  /* 後ろを透かす面（ヘッダー・たたんだナビ・カバーの札）と、モーダルの下に敷く幕 */
  --glass: rgba(22, 22, 30, 0.86);
  --glass-strong: rgba(22, 22, 30, 0.98);
  --glass-soft: rgba(22, 22, 30, 0.72);
  --scrim: rgba(16, 16, 22, 0.74);
  --hl-bg: rgba(169, 177, 214, 0.18);  /* .hl の帯 */

  /* text */
  --text: #c0caf5;
  --text-hi: #d5dbf5;      /* 白の代わりに使う最明色 */
  --text-2: #a9b1d6;
  /* muted 系は、いちばん明るい面（--surface-3）の上でも WCAG AA の 4.5:1 を
     満たす明るさにしてある。Tokyo Night 本来の #787c99 / #565f89 は、
     暗い面の上では 2.2〜4.4:1 しかなく、Lighthouse のアクセシビリティで
     大きく減点されていた（issue #52） */
  --muted: #9699b7;
  --muted-2: #8a8fae;
  --text-muted: var(--muted); /* 既存ページのインラインスタイル互換 */

  /* accents */
  --primary: #bb9af7;      /* 藤色（ブランド） */
  --primary-2: #9d7cd8;
  --blue: #7aa2f7;
  --cyan: #7dcfff;
  --mint: #73daca;
  --green: #9ece6a;
  --orange: #ff9e64;
  --orange-2: #e08a4b;
  --gold: #e0af68;
  --danger: #f7768e;
  --ink: #1a1b26;          /* 明色ボタンの上に載せる文字色 */

  /* ロゴの「4」と「peiron」 */
  --logo-4: var(--text);
  --logo-rest: var(--primary);

  /* code — Tokyo Night シンタックス */
  --code-bg: #16161e;
  --code-fg: #c0caf5;
  --tok-comment: #8a8fae; /* --code-bg の上で 5.7:1（muted-2 と同じ理由） */
  --tok-keyword: #bb9af7;
  --tok-string: #9ece6a;
  --tok-number: #ff9e64;
  --tok-func: #7aa2f7;
  --tok-type: #2ac3de;
  --tok-op: #89ddff;
  --tok-prompt: #73daca;
  /* 文の中に置くコード。ライトでは、地の文になじむ色に入れ替える */
  --code-inline-bg: var(--code-bg);
  --code-inline-fg: var(--cyan);

  --radius: 14px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --radius-pill: 999px;

  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.5);

  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
    "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Noto Sans JP", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* 器の最大幅。広い画面でカードの列に余裕を持たせるため 1200px から広げた（2026-11-23）。
     本文の読む段（--read-measure・.project-body など）は別に絞っているので、行は長くならない */
  --container: 1360px;
  /* 端からの余白。狭い画面では下のメディアクエリで詰める */
  --gutter: 24px;

  /* 読む人が選べる本文の組み（#377）。既定が「標準」。html の data-read-* で下の
     ブロックが値を入れ替える。本文（レッスン・プロジェクト・コラム）の地の文だけに効かせ、
     サイドバー・エディタ・コード・表の字は変えない */
  --read-scale: 1;
  --read-lh: 1.7;
  --read-measure: 820px;
  --read-measure-article: 680px;

  /* フォームの部品やスクロールバーも暗い側で描かせる */
  color-scheme: dark;
}

/* 文字の大きさ（3 段階）・行間（2 段階）・本文の幅（2 段階）。base.html の head が
   localStorage から読んで <html> に付ける（テーマと同じ。描画前なのでちらつかない） */
:root[data-read-size="s"] { --read-scale: 0.9; }
:root[data-read-size="l"] { --read-scale: 1.15; }
:root[data-read-leading="loose"] { --read-lh: 2.05; }
:root[data-read-width="wide"] { --read-measure: 1000px; --read-measure-article: 860px; }

/* ライトモード。<html data-theme="light"> のとき（base.html の head で、
   選んだもの → OS の設定の順に決めて付ける）。
   生成りの紙に墨の文字（「紙」の案）。差し色は紙の上で 4.5:1 を超える暗さに落としてあり、
   いちばん暗い面 --surface-3 の上での最小は orange 5.4・muted-2 5.7。
   コードの面も紙に合わせて明るくし、シンタックスの色は --code-bg の上で 4.5:1 を超える
   （最小は --tok-comment の 4.5）。
   ダークで明るい文字色を背景にしているボタン（.btn-primary など）は、
   ライトでは暗い面に白い文字になる */
:root[data-theme="light"] {
  --bg: #faf8f3;
  --bg-band: #f3f0e8;
  --surface: #fffdf9;
  --surface-2: #f6f3ec;
  --surface-3: #ece7dc;
  --border: #ddd6c7;
  --border-2: #c4bba8;
  --tint-rgb: 42, 40, 51;
  --glass: rgba(255, 253, 249, 0.86);
  --glass-strong: rgba(255, 253, 249, 0.98);
  --glass-soft: rgba(255, 253, 249, 0.8);
  --scrim: rgba(42, 40, 51, 0.42);
  --hl-bg: rgba(108, 58, 173, 0.14);

  --text: #2a2833;
  --text-hi: #17161d;
  --text-2: #36343f;
  --muted: #57545f;
  --muted-2: #5e5a65;

  --primary: #6c3aad;
  --primary-2: #5c2f99;
  --blue: #245a9e;
  --cyan: #0b5e6b;
  --mint: #2a5f52;
  --green: #4a5d1b;
  --orange: #924800;
  --orange-2: #7c3d13;
  --gold: #705222;
  --danger: #a52a3a;
  --ink: #ffffff;

  --code-bg: #f4f0e6;
  --code-fg: #2a2833;
  --code-head: #ece7dc;   /* ホームのエディタの絵の見出しの帯 */
  --code-border: #ddd6c7;
  --tok-comment: #6a6672;
  --tok-keyword: #7a3aa6;
  --tok-string: #4a6418;
  --tok-number: #9b4a00;
  --tok-func: #2457a0;
  --tok-type: #0b6370;
  --tok-op: #335a86;
  --tok-prompt: #2c6355;
  --code-inline-bg: #efeadf;
  --code-inline-fg: #6c3aad;

  --shadow: 0 1px 2px rgba(42, 40, 51, 0.08);
  --shadow-lg: 0 24px 60px rgba(42, 40, 51, 0.14);

  color-scheme: light;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
  /* 内容が短いページでもフッターを最下部に置く */
  display: flex;
  flex-direction: column;
}
body > .site-footer { margin-top: auto; }

/* 中央上部のごく淡いスポットライト。派手な発光はしない */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(ellipse 60% 40% at 50% -5%, rgba(187, 154, 247, 0.08), transparent 70%),
    radial-gradient(ellipse 50% 40% at 90% 15%, rgba(122, 162, 247, 0.06), transparent 70%);
}

img, svg { max-width: 100%; display: block; }

a { color: var(--text); text-decoration: none; }
a:hover { color: var(--text-hi); }
/* 文の中のリンクは、色だけでなく下線でも見分けられるようにする。
   色だけだと、色覚によっては周りの文字と区別がつかない（issue #52） */
:where(p, label, .legal-body li) a:not(.btn) {
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px;
}

::selection { background: rgba(122, 162, 247, 0.35); color: var(--text-hi); }

.container { max-width: var(--container); margin: 0 auto; padding: 0 var(--gutter); }

/* 固定ヘッダーの下にアンカー先が潜り込まないようにする */
[id] { scroll-margin-top: 84px; }

/* ---------- 見出しの共通トーン（詰め気味・太め） ---------- */
h1, h2, h3, h4 {
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.18;
  color: var(--text);
}
h1 { font-size: clamp(2.1rem, 5vw, 3.6rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.25rem); }
h3 { font-size: 1.05rem; letter-spacing: -0.02em; line-height: 1.4; }

/* 2行目に敷くハイライト（参照サイトの特徴的な処理）。
   以前は inline-block + ::after で敷いていたが、その形だと画面が狭くて
   中の文字が折り返したときに、帯がブロック全体の幅いっぱいに伸びてしまう。
   背景のグラデーションで描いて、行ごとに帯が付くようにしてある。 */
.hl {
  --hl: var(--hl-bg);
  display: inline;
  padding: 0 4px; margin: 0 -4px;
  background-image: linear-gradient(var(--hl), var(--hl));
  background-repeat: no-repeat;
  background-size: 100% 0.34em;
  /* インライン要素の背景は行ボックスではなくフォントの上下いっぱいに描かれるので、
     旧実装と同じ位置に見えるところまで持ち上げている */
  background-position: 0 calc(100% - 0.26em);
  border-radius: 2px;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
.hl-primary { --hl: rgba(187, 154, 247, 0.38); }
.hl-mint { --hl: rgba(115, 218, 202, 0.3); }

/* 本文中の強調（太字＋下線） */
strong, .em { color: var(--text); font-weight: 700; }
.u { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.t-primary { color: var(--primary); }
.t-mint { color: var(--mint); }
.t-orange { color: var(--orange); }

.eyebrow {
  font-family: var(--mono); font-size: 0.68rem; font-weight: 500;
  letter-spacing: 0.22em; text-transform: uppercase; color: var(--muted-2);
}

/* ============================================================
   ヘッダー：中央に浮かぶバー
   ============================================================ */
.site-header {
  position: sticky; top: 0; z-index: 100;
  padding: 14px 0;
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  height: 52px; padding: 0 8px 0 18px;
  /* container 直下に置いているので、左右の余白はガターが作る */
  background: var(--glass);
  backdrop-filter: blur(14px) saturate(160%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.logo { display: block; flex: 0 0 auto; width: 100px; line-height: 0; }
.logo-wordmark { width: 100%; height: auto; }
.logo-wordmark .wm-4 { fill: var(--logo-4); }
.logo-wordmark .wm-rest { fill: var(--logo-rest); }

.main-nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }

/* ナビの右に置く道具（テーマの切り替えと、狭い画面のメニューボタン）。
   ナビをたたんでも、ここはヘッダーに出たままにする */
.header-tools { display: flex; align-items: center; gap: 6px; }
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; padding: 0; cursor: pointer;
  background: none; border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--muted);
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.theme-toggle[hidden] { display: none; }
/* 検索ページへの入口（#321）。テーマの切り替えと同じ形 */
.header-search {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--muted); transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.header-search:hover { color: var(--text-hi); background: rgba(var(--tint-rgb), 0.06); border-color: var(--border-2); }
.theme-toggle:hover { color: var(--text-hi); background: rgba(var(--tint-rgb), 0.06); border-color: var(--border-2); }
.theme-toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
/* いまのテーマから切り替わる先の絵を出す（ダークなら太陽、ライトなら月） */
.theme-toggle .icon-moon { display: none; }
[data-theme="light"] .theme-toggle .icon-sun { display: none; }
[data-theme="light"] .theme-toggle .icon-moon { display: block; }
.main-nav a {
  color: var(--muted); font-size: 0.82rem; font-weight: 500;
  padding: 7px 11px; border-radius: var(--radius-sm);
  transition: color 0.15s ease, background 0.15s ease;
  white-space: nowrap;
}
.main-nav a:hover { color: var(--text-hi); background: rgba(var(--tint-rgb), 0.06); }
.main-nav a.current { color: var(--text); }

.btn-login {
  background: var(--text-2); color: var(--ink) !important;
  font-weight: 700; font-size: 0.8rem !important;
  padding: 8px 15px !important; border-radius: var(--radius-sm);
  margin-left: 6px;
}
.btn-login:hover { background: var(--text-hi); }

.nav-toggle {
  display: none; background: none; border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  width: 36px; height: 36px; cursor: pointer; font-size: 1rem;
}

/* 表示言語の切り替え（日本語 / English）。
   ヘッダーの中では 2 つ並びのトグル、狭い画面では 1 行いっぱいに広がる */
.lang-switch { display: inline-flex; margin-left: 6px; }
.lang-switch-group {
  display: inline-flex; align-items: center;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-pill); padding: 2px;
}
.lang-btn {
  background: none; border: none; cursor: pointer;
  font-family: inherit; font-size: 0.76rem; font-weight: 600;
  color: var(--muted); padding: 5px 11px; border-radius: var(--radius-pill);
  white-space: nowrap;
  transition: color 0.15s ease, background 0.15s ease;
}
.lang-btn:hover { color: var(--text-hi); }
.lang-btn.current { background: var(--surface-3); color: var(--text); cursor: default; }
.lang-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }

/* 読み上げにだけ渡したい文字。画面には出さないが display:none とは違い、
   支援技術からは読める */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

/* critical:end */
/* ============================================================
   メンテナンス中の帯（スタッフにだけ見える）
   ============================================================ */
.maintenance-bar {
  background: rgba(255, 158, 100, 0.1);
  border-bottom: 1px solid rgba(255, 158, 100, 0.28);
  padding: 8px 0;
}

/* 帯は高さ1行ぶんで固定。折り返して header を押し下げると、
   メンテナンス中だけレイアウトが変わってしまうため。
   幅が足りないときは text-overflow に任せて末尾を削る */
.maintenance-bar-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: nowrap;
}
.maintenance-bar-text {
  flex: 1 1 auto; min-width: 0;
  font-size: 0.82rem; color: var(--text-2); line-height: 1.6;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.maintenance-bar-icon { margin-right: 4px; }
.maintenance-bar-text strong { color: var(--orange); font-weight: 700; }
.maintenance-bar-until {
  margin-left: 6px;
  font-family: var(--mono); font-size: 0.78rem; color: var(--orange-2);
}
/* 削られていいのはここだけ。見出しと再開予定より後ろに置いてある */
.maintenance-bar-note { margin-left: 8px; }
/* ボタンは何があっても縮めない（解除できないと帯の意味がない） */
.maintenance-bar-form { flex: 0 0 auto; }
.maintenance-bar-btn {
  background: var(--orange); color: var(--ink);
  border: none; border-radius: var(--radius-sm); cursor: pointer;
  font-family: inherit; font-size: 0.78rem; font-weight: 700;
  padding: 7px 14px; white-space: nowrap;
}
.maintenance-bar-btn:hover { background: var(--orange-2); }
.maintenance-bar-btn:focus-visible { outline: 2px solid var(--text-hi); outline-offset: 2px; }

/* ============================================================
   サイト全体のお知らせの帯（#373）
   ============================================================ */
.notice-bar {
  background: rgba(var(--tint-rgb), 0.05);
  border-bottom: 1px solid var(--border);
  padding: 8px 0;
}
.notice-bar-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.notice-bar-inner form { flex: 0 0 auto; }
.notice-bar-text { flex: 1 1 auto; min-width: 0; font-size: 0.84rem; color: var(--text-2); line-height: 1.6; }
.notice-bar-text a { margin-left: 6px; font-weight: 700; text-decoration: underline; }
.notice-bar-close {
  background: none; border: none; cursor: pointer; color: var(--text-2);
  font-size: 1.3rem; line-height: 1; padding: 4px 8px; border-radius: var(--radius-sm);
}
.notice-bar-close:hover { color: var(--text-hi); }
.notice-bar-close:focus-visible { outline: 2px solid var(--text-hi); outline-offset: 2px; }

/* ============================================================
   ボタン
   ============================================================ */
/* critical:start */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: var(--radius-sm);
  font-family: inherit; font-size: 0.86rem; font-weight: 700;
  letter-spacing: -0.01em; cursor: pointer; border: 1px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
  white-space: nowrap;
}
.btn-primary { background: var(--text-2); color: var(--ink); }
.btn-primary:hover { background: var(--text-hi); color: var(--ink); }

.btn-outline {
  background: rgba(var(--tint-rgb), 0.03); color: var(--text-2);
  border-color: var(--border);
}
.btn-outline:hover { background: var(--surface-3); color: var(--text); border-color: var(--border-2); }

.btn-accent { background: var(--primary); color: var(--ink); }
.btn-accent:hover { background: var(--primary-2); color: var(--ink); }

.btn-ghost { background: none; color: var(--muted); border-color: transparent; }
.btn-ghost:hover { color: var(--text-hi); background: rgba(var(--tint-rgb), 0.06); }

.btn-sm { padding: 7px 14px; font-size: 0.78rem; }
.btn-lg { padding: 13px 26px; font-size: 0.92rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ============================================================
   セクションの帯とヘアライン
   ============================================================ */
section { padding: 84px 0; border-top: 1px solid var(--border-soft); }
section.band { background: var(--bg-band); }
section.flush { border-top: none; }

.section-title { text-align: center; margin-bottom: 14px; }
.section-lead {
  color: var(--muted); max-width: 620px; margin: 0 auto 46px;
  text-align: center; font-size: 0.94rem;
}
.section-head { max-width: 560px; margin-bottom: 30px; }
.section-head p { color: var(--muted); font-size: 0.92rem; margin-top: 12px; }
/* 見出しの下に並べる行き先のボタン（ロードマップ・新着）。説明文との間は詰め、下の中身とは離す */
.section-lead:has(+ .section-actions) { margin-bottom: 28px; }
.section-actions {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 12px;
  margin: 0 auto 56px;
}
@media (max-width: 560px) {
  .section-actions { flex-direction: column; align-items: stretch; margin-bottom: 40px; }
  .section-actions .btn { white-space: normal; }
}
/* critical:end */

/* 交互配置の2カラム（参照サイトの機能紹介セクション） */
.split {
  display: grid; grid-template-columns: 1fr 1fr; gap: 56px; align-items: center;
}
.split.reverse .split-visual { order: -1; }
.split-body h2 { margin-bottom: 14px; }
.split-body > p { color: var(--muted); font-size: 0.92rem; margin-bottom: 20px; }

.check-list { list-style: none; display: flex; flex-direction: column; gap: 9px; }
.check-list li {
  display: flex; gap: 10px; align-items: flex-start;
  font-size: 0.88rem; color: var(--text-2);
}
.check-list li::before {
  content: "✓"; color: var(--mint); font-weight: 700;
  font-size: 0.82rem; line-height: 1.75; flex-shrink: 0;
}

/* ============================================================
   ヒーロー（中央寄せ）
   ============================================================ */
/* critical:start */
.hero { padding: 92px 0 72px; text-align: center; border-top: none; }
.hero h1 { margin: 0 auto 22px; max-width: 780px; }
.hero-sub {
  color: var(--muted); font-size: 0.95rem; max-width: 560px;
  margin: 0 auto 30px; line-height: 1.75;
}
.hero-ctas { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 46px; }
.hero-art {
  max-width: 860px; margin: 0 auto;
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  overflow: hidden; box-shadow: var(--shadow-lg);
  background: var(--surface);
}
/* エディタの絵（pages/home.html）。ダークは SVG に書いた色のまま、
   ライトではコードの面と同じトークンで塗り直す。左上の 3 つの丸は元の色のまま */
[data-theme="light"] .hero-art .h-bg { fill: var(--code-bg); }
[data-theme="light"] .hero-art .h-head { fill: var(--code-head); }
[data-theme="light"] .hero-art .h-line { fill: var(--code-border); }
[data-theme="light"] .hero-art .h-comment { fill: var(--tok-comment); }
[data-theme="light"] .hero-art .h-kw { fill: var(--tok-keyword); }
[data-theme="light"] .hero-art .h-fn { fill: var(--tok-func); }
[data-theme="light"] .hero-art .h-fg { fill: var(--code-fg); }
[data-theme="light"] .hero-art .h-str { fill: var(--tok-string); }
[data-theme="light"] .hero-art .h-op { fill: var(--tok-op); }
[data-theme="light"] .hero-art .h-num { fill: var(--tok-number); }
[data-theme="light"] .hero-art .h-btn { fill: var(--tok-func); }
[data-theme="light"] .hero-art .h-btn-text { fill: #ffffff; }

/* ヒーロー下のバナー */
.banner-carousel { position: relative; max-width: 620px; margin: 0 auto 44px; }
.banner-track { display: flex; overflow: hidden; border-radius: var(--radius); }
.banner {
  min-width: 100%; padding: 14px 20px;
  display: flex; align-items: center; gap: 10px; justify-content: center;
  font-size: 0.85rem; font-weight: 600; color: var(--text-2);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius);
}
.banner:hover { background: var(--surface-2); color: var(--text); }
.banner-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 28px; height: 28px; cursor: pointer; font-size: 0.9rem;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--muted); border-radius: var(--radius-pill);
}
.banner-nav:hover { color: var(--text); background: var(--surface-3); }
.banner-prev { left: -14px; } .banner-next { right: -14px; }
/* critical:end */

/* ============================================================
   数値／about
   ============================================================ */
.stats-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr));
  gap: 1px; background: var(--border-soft);
  border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; margin-bottom: 40px;
}
.stat { background: var(--surface); padding: 22px 18px; text-align: center; }
.stat b {
  display: block; font-size: 1.7rem; font-weight: 800;
  letter-spacing: -0.04em; color: var(--text);
}
.stat span { font-size: 0.74rem; color: var(--muted-2); }

.about-card {
  display: grid; grid-template-columns: 88px 1fr; gap: 24px; align-items: center;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px; max-width: 800px; margin: 0 auto;
}
.avatar {
  width: 88px; height: 88px; border-radius: var(--radius-pill);
  background: linear-gradient(150deg, var(--primary), var(--blue));
  display: flex; align-items: center; justify-content: center;
  color: var(--ink); font-size: 1.6rem; font-weight: 800; letter-spacing: -0.03em;
}
.about-card h3 { margin-bottom: 8px; }
.about-card p { font-size: 0.88rem; color: var(--muted); }

/* ============================================================
   コースカード
   ============================================================ */
.course-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); gap: 16px;
}
/* グリッドは同じ行のカードしか揃えないので、動画や英訳準備中の札・説明の長さで行ごとに高さが変わり、
   一覧がでこぼこに見えた。2 列以上になる幅では、全部の行をいちばん高いカードに合わせる。
   1 列のスマホ幅で揃えると短いカードに大きな空きができるので、中身の高さのままにする */
@media (min-width: 720px) {
  .course-grid { grid-auto-rows: 1fr; }
}
.course-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px;
  display: flex; flex-direction: column; gap: 10px;
  transition: border-color 0.18s ease, background 0.18s ease;
}
.course-card:hover { border-color: var(--border-2); background: var(--surface-2); }
.course-card h3 { font-size: 1.02rem; }
/* 行の高さをいちばん高いカードに合わせると、説明の短いカードは空きが説明の下にだけ溜まり、
   説明が見出しに張りついて上寄りに見えた。説明は伸ばさず、見出しからの距離を決めて始まりを
   どのカードでもそろえる。余った高さはタグの上とボタンの上に半分ずつ分け、1 か所が大きく空かないようにする。
   スライド一覧のカードは説明が「全 N 回・M 枚」の 1 行で、下の行を底に寄せたいので除く */
.course-card p { font-size: 0.85rem; color: var(--muted); flex: 1; }
.course-card:not(.slide-card) > p { flex: none; margin-block: 4px; }
.course-card:not(.slide-card) > :is(.tags, .course-actions) { margin-top: auto; }
.course-card .mod {
  font-family: var(--mono); font-size: 0.66rem; color: var(--muted-2);
  letter-spacing: 0.16em;
}
.course-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.card-badges { display: flex; flex-wrap: wrap; gap: 6px; }
/* トップのカテゴリー絞り込み（チップ自体はコラム／スタッフと共通） */
.course-filter { margin: -16px 0 22px; }
/* カテゴリーの下に続けて置く言語の絞り込み（#534）。2 段のあいだは詰める */
.course-filter + .course-filter-lang { margin-top: -14px; }
/* 並び順のチップも、上の絞り込みに続けて詰める */
.course-filter + .course-filter-sort { margin-top: -14px; }

/* critical:start */
.badge {
  align-self: flex-start; font-size: 0.68rem; font-weight: 700;
  padding: 3px 10px; border-radius: var(--radius-pill);
  border: 1px solid transparent; letter-spacing: 0;
}
.badge-free { background: rgba(115, 218, 202, 0.12); color: var(--mint); border-color: rgba(115, 218, 202, 0.28); }
.badge-mid { background: rgba(224, 175, 104, 0.12); color: var(--gold); border-color: rgba(224, 175, 104, 0.28); }
.badge-soon { background: var(--surface-2); color: var(--muted-2); border-color: var(--border); }
/* スタッフにだけ見える非公開の回の札と、プレビューの帯（#383） */
.badge-preview { background: transparent; color: var(--orange); border-color: var(--orange); }
.preview-bar {
  margin: 0 0 18px; padding: 10px 14px; font-size: 0.86rem; line-height: 1.6;
  border: 1px dashed var(--orange); border-radius: var(--radius);
  background: var(--surface-2); color: var(--text);
}
.preview-bar strong { color: var(--orange); margin-right: 6px; }
/* 英語で読めるコースのカード（#534） */
.badge-en { background: rgba(122, 162, 247, 0.12); color: var(--blue); border-color: rgba(122, 162, 247, 0.3); }
.badge-video { background: rgba(187, 154, 247, 0.12); color: var(--primary); border-color: rgba(187, 154, 247, 0.3); }
.badge-done { background: rgba(115, 218, 202, 0.12); color: var(--mint); border-color: rgba(115, 218, 202, 0.28); }
.badge-doing { background: rgba(224, 175, 104, 0.12); color: var(--gold); border-color: rgba(224, 175, 104, 0.28); }
/* critical:end */

/* ============================================================
   学習の進捗バー（ダッシュボード・コース概要）
   進行中は藤色、修了したらミント（Free の札・正解の文字と同じ色）。
   ============================================================ */
.progress { width: 100%; }
.progress-track {
  height: 8px; border-radius: var(--radius-pill); overflow: hidden;
  background: var(--surface-2); border: 1px solid var(--border);
}
.progress-fill {
  height: 100%; border-radius: var(--radius-pill);
  background: var(--primary); transition: width 0.4s ease;
}
.progress.is-complete .progress-fill { background: var(--mint); }
.progress-meta {
  display: flex; justify-content: space-between; gap: 12px; margin-top: 8px;
  font-size: 0.78rem; color: var(--muted);
}
.progress-percent { font-family: var(--mono); font-weight: 700; color: var(--text-2); }
.progress.is-complete .progress-percent { color: var(--mint); }

/* ダッシュボードの「学習をつづける」カード。ボタンは説明の長さによらず下端に */
.progress-card { display: flex; flex-direction: column; }
/* 新しい回（#352）。金色は有料札（badge-mid）と同じ系統で、リンクのときは下線を付けない */
.badge-new { background: rgba(224, 175, 104, 0.12); color: var(--gold); border-color: rgba(224, 175, 104, 0.28); text-decoration: none; }
a.badge-new:hover { background: rgba(224, 175, 104, 0.2); }
.progress-card > .badge-new { display: inline-block; margin: 2px 0 10px; align-self: flex-start; width: fit-content; }
.progress-card-head { display: flex; justify-content: space-between; align-items: flex-start; }
.progress-card .progress { margin: 4px 0 18px; }
.progress-card .btn { margin-top: auto; align-self: flex-start; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font-size: 0.68rem; color: var(--muted); background: var(--surface-2);
  border: 1px solid var(--border); padding: 2px 9px; border-radius: var(--radius-pill);
}

/* ============================================================
   特徴カード
   ============================================================ */
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 16px; }
.feature {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
  transition: border-color 0.18s ease;
}
.feature:hover { border-color: var(--border-2); }
.feature .icon { font-size: 1.4rem; margin-bottom: 12px; }
.feature h3 { margin-bottom: 8px; }
.feature p { font-size: 0.86rem; color: var(--muted); }

/* メンバーシップ誘導 */
.membership-teaser {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 56px 36px; text-align: center;
}
.membership-teaser h2 { margin-bottom: 14px; }
.membership-teaser p { max-width: 520px; margin: 0 auto 26px; color: var(--muted); font-size: 0.92rem; }

/* ============================================================
   料金
   ============================================================ */
.pricing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr)); gap: 16px; }
/* 2 枚だけ並べる行。auto-fit のままだと 1 枚が画面幅いっぱいに伸びて、
   上の 3 枚と大きさが揃わない。 */
.pricing-grid-narrow { max-width: 760px; }
.price-card {
  position: relative; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 26px 24px;
  display: flex; flex-direction: column; gap: 14px;
}
.price-card.featured { border-color: rgba(187, 154, 247, 0.5); background: var(--surface-2); }
.price-card .plan-tag {
  position: absolute; top: 16px; right: 16px;
  background: rgba(224, 175, 104, 0.16); color: var(--gold);
  border: 1px solid rgba(224, 175, 104, 0.32);
  font-size: 0.62rem; font-weight: 800; letter-spacing: 0.08em;
  padding: 2px 9px; border-radius: var(--radius-pill);
}
.price-card h3 { font-size: 0.95rem; }
/* 字詰めを強くしすぎると「$19.90」の数字どうしが接してしまう */
.price { font-size: 2rem; font-weight: 800; letter-spacing: -0.02em; color: var(--text); }
.price small { font-size: 0.78rem; font-weight: 500; letter-spacing: normal; color: var(--muted-2); margin-left: 6px; }
.plan-desc { font-size: 0.84rem; color: var(--muted); }
/* 年額の「月あたり・お得額」。金額のすぐ下に寄せる */
.price-card .price-note { margin-top: -10px; color: var(--gold); font-weight: 600; }
.billing-toggle { justify-content: center; margin-bottom: 20px; }
.plan-features { list-style: none; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.plan-features li {
  font-size: 0.83rem; color: var(--text-2);
  display: flex; gap: 9px; align-items: flex-start;
}
.plan-features li::before { content: "✓"; color: var(--mint); flex-shrink: 0; font-size: 0.8rem; }
.plan-features li.na { color: var(--muted-2); }
.plan-features li.na::before { content: "✓"; color: #3b4261; }

/* ============================================================
   進め方（flow）
   ============================================================ */
.flow-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 16px; }
.flow-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
}
.flow-card .cadence {
  display: inline-block; font-family: var(--mono); font-size: 0.66rem;
  color: var(--primary); background: rgba(187, 154, 247, 0.12);
  border: 1px solid rgba(187, 154, 247, 0.24);
  padding: 2px 9px; border-radius: var(--radius-pill); letter-spacing: 0.08em;
}
.flow-card h3 { margin: 12px 0 8px; }
.flow-card p { font-size: 0.86rem; color: var(--muted); }

/* ============================================================
   FAQ（左に見出し／右に一問一答のヘアライン区切り）
   ============================================================ */
.faq-layout { display: grid; grid-template-columns: 0.8fr 1.2fr; gap: 48px; align-items: start; }
.faq-list { border-top: 1px solid var(--border-soft); }
.faq-item { border-bottom: 1px solid var(--border-soft); }
.faq-q {
  width: 100%; text-align: left; background: none; border: none; cursor: pointer;
  color: var(--text); font-family: inherit; font-size: 0.9rem; font-weight: 700;
  letter-spacing: -0.01em; padding: 18px 40px 18px 0; position: relative;
}
.faq-q:hover { color: var(--text-hi); }
.faq-q::after {
  content: "+"; position: absolute; right: 6px; top: 50%;
  transform: translateY(-50%); color: var(--muted-2); font-weight: 400; font-size: 1.1rem;
}
.faq-item.open .faq-q::after { content: "−"; }
.faq-a { max-height: 0; overflow: hidden; transition: max-height 0.24s ease; }
.faq-a p { padding: 0 20px 20px 0; font-size: 0.86rem; color: var(--muted); }
.faq-a a { color: var(--primary); text-decoration: underline; }
.faq-note { margin-top: 16px; font-size: 0.82rem; color: var(--muted-2); }

/* ヘルプ（#537） */
.help-search { display: flex; gap: 8px; justify-content: center; margin: 22px auto 0; max-width: 460px; }
.help-search input { flex: 1; min-width: 0; padding: 10px 14px; border: 1px solid var(--border-soft); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; }
.help-nav { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.help-nav a { padding: 6px 14px; border: 1px solid var(--border-soft); border-radius: 999px; font-size: 0.84rem; color: var(--text); }
.help-cat { text-align: left; margin: 36px 0 12px; font-size: 1.25rem; }
.help-contact { margin-top: 48px; padding: 24px; border: 1px solid var(--border-soft); border-radius: 12px; text-align: center; }
.help-contact h2 { font-size: 1.05rem; margin-bottom: 8px; }
.help-contact p { color: var(--muted); font-size: 0.88rem; margin-bottom: 14px; }
.help-suggest { margin: 0 0 22px; padding: 14px 18px 12px; border: 1px solid var(--border-soft); border-radius: 10px; }
.help-suggest[hidden] { display: none; }
.help-suggest h3 { font-size: 0.9rem; margin-bottom: 6px; }
.help-suggest-more { margin-top: 10px; font-size: 0.82rem; }

/* ============================================================
   ニュースレター
   ============================================================ */
.newsletter-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 44px 36px; text-align: center;
}
.newsletter-box h2 { margin-bottom: 10px; }
.newsletter-box > p { color: var(--muted); font-size: 0.9rem; max-width: 460px; margin: 0 auto; }
/* お問い合わせの前の案内（#582）。英語の「Legal notice (Act on Specified Commercial Transactions)」は
   375px で 1 行に収まらないので、ここのボタンだけ折り返してよいことにする（.btn は既定で折り返さない） */
.contact-links { display: flex; gap: 10px; flex-wrap: wrap; }
.contact-links .btn { white-space: normal; text-align: center; max-width: 100%; }
.newsletter-form {
  display: flex; gap: 8px; margin: 22px auto 0; max-width: 440px; flex-wrap: wrap;
}
.newsletter-form input {
  flex: 1; min-width: 200px; padding: 11px 14px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-family: inherit; font-size: 0.88rem;
}
.newsletter-form input::placeholder { color: var(--muted-2); }
.newsletter-form input:focus { outline: none; border-color: var(--primary); }
.newsletter-art { display: none; }
.form-note { font-size: 0.8rem; color: var(--mint); margin-top: 12px; min-height: 1.2em; }

/* ============================================================
   フッター
   ============================================================ */
.site-footer {
  border-top: 1px solid var(--border-soft);
  padding: 56px 0 32px; margin-top: 0; background: var(--bg-band);
}
.footer-top {
  display: grid; grid-template-columns: 1.6fr repeat(3, 1fr); gap: 32px;
  padding-bottom: 40px;
}
.footer-brand strong { display: block; font-size: 0.95rem; font-weight: 800; margin-bottom: 12px; }
.footer-brand p { font-size: 0.82rem; color: var(--muted); max-width: 320px; }
.footer-heading {
  font-size: 0.78rem; font-weight: 700; letter-spacing: normal; line-height: inherit;
  margin-bottom: 14px; color: var(--text);
}
.footer-col a {
  display: block; font-size: 0.8rem; color: var(--muted);
  padding: 5px 0;
}
.footer-col a:hover { color: var(--text); }
.footer-bottom {
  display: flex; flex-wrap: wrap; gap: 18px; justify-content: space-between;
  border-top: 1px solid var(--border-soft); padding-top: 22px;
}
.footer-links { display: flex; flex-wrap: wrap; gap: 18px; }
.footer-links a { font-size: 0.78rem; color: var(--muted-2); }
.footer-links a:hover { color: var(--text-2); }
.copyright { font-size: 0.78rem; color: var(--muted-2); }

/* ============================================================
   下層ページのヒーロー
   ============================================================ */
/* critical:start */
.page-hero { padding: 66px 0 40px; text-align: center; border-top: none; }
/* span のままだと上下の padding が行の高さに入らず、札が見出しに接してしまう */
.page-hero .badge { display: inline-block; margin-bottom: 16px; }
.page-hero h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); margin-bottom: 14px; }
.page-hero p { color: var(--muted); max-width: 560px; margin: 0 auto; font-size: 0.92rem; }
/* critical:end */

/* 404 のページ（templates/404.html、#290） */
.error-page { padding-bottom: 72px; }
.error-page .error-code {
  font-family: var(--mono); font-size: 0.85rem; font-weight: 700; letter-spacing: 0.12em;
  color: var(--primary); margin-bottom: 10px;
}
.error-page .hero-ctas { margin: 26px 0 22px; }
.error-page .error-help { font-size: 0.82rem; }

/* ============================================================
   コース詳細（レッスン一覧）
   ============================================================ */
.lesson-list { max-width: 760px; margin: 0 auto; border-top: 1px solid var(--border-soft); }
.lesson-row {
  display: flex; align-items: center; gap: 16px;
  padding: 18px 4px; border-bottom: 1px solid var(--border-soft);
  transition: background 0.15s ease;
}
.lesson-row:hover { background: rgba(var(--tint-rgb), 0.03); }
.lesson-num {
  width: 32px; height: 32px; flex-shrink: 0; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--muted); font-family: var(--mono); font-size: 0.78rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.lesson-row .lesson-meta { flex: 1; }
.lesson-row h3 { font-size: 0.94rem; }
.lesson-row p { font-size: 0.82rem; color: var(--muted); }
/* 所要時間の目安（#353）。バッジより目立たせない */
.lesson-eta { font-size: 0.78rem; color: var(--muted); white-space: nowrap; }
.course-eta, .lesson-eta-line { color: var(--muted); font-size: 0.9rem; }
/* コースの最終確認日と対象のバージョン（#535）。狭い幅では 1 項目ずつ折り返す */
.page-hero .course-freshness { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 20px; margin: 6px 0 0; color: var(--muted); font-size: 0.9rem; }
.course-freshness-item { display: inline-block; }
.course-freshness-label { font-weight: 600; margin-right: 4px; }
.lesson-row.is-done .lesson-num {
  background: rgba(115, 218, 202, 0.12); border-color: rgba(115, 218, 202, 0.28); color: var(--mint);
}

/* コース概要のヒーローに置く全体の進捗 */
.course-progress { max-width: 420px; margin: 22px auto 0; text-align: left; }
.page-hero .badge + .badge { margin-left: 6px; }

/* ============================================================
   レッスン本文
   ============================================================ */
/* critical:start */
.lesson-layout {
  display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 40px;
  /* container と同じクラスに当てるので、左右のガターを打ち消さないこと */
  padding: 44px var(--gutter) 80px; align-items: start;
}
/* グリッドの子は既定で「中身より狭くならない（min-width: auto）」。
   コードブロックのように折り返さない中身があると、列がその行の長さまで広がり、
   レッスン全体が画面からはみ出す（body の overflow-x: hidden で右側が切れる）。
   列と子の両方を 0 まで縮められるようにして、長い行はコードブロックの中で
   横に送らせる。 */
.lesson-sidebar, .lesson-content { min-width: 0; }
.lesson-sidebar { position: sticky; top: 96px; }
.lesson-sidebar h4 {
  font-size: 0.72rem; color: var(--muted-2); margin-bottom: 12px;
  font-family: var(--mono); letter-spacing: 0.16em; text-transform: uppercase;
}
.lesson-sidebar ol { list-style: none; }
.lesson-sidebar li { margin-bottom: 2px; }
.lesson-sidebar a {
  display: block; padding: 7px 12px; border-radius: var(--radius-sm);
  font-size: 0.84rem; color: var(--muted);
}
.lesson-sidebar a:hover { color: var(--text); background: rgba(var(--tint-rgb), 0.05); }
.lesson-sidebar a.active { color: var(--text); background: var(--surface-2); }

/* 器（--container）を広げても、読む段は広げない。行が長くなるほど
   目が行頭に戻りにくくなる。サイドバーの右に余白が出るのは想定どおり。 */
.lesson-content { max-width: var(--read-measure); }
.lesson-content h1 { font-size: clamp(1.6rem, 3vw, 2rem); margin-bottom: 8px; }
.lesson-content .crumb { font-size: 0.8rem; color: var(--muted-2); margin-bottom: 20px; }
.lesson-done { margin: 4px 0 8px; }
.lesson-done[hidden] { display: none; }
.side-done { color: var(--mint); font-weight: 700; }
.lesson-content h2 { font-size: calc(1.24rem * var(--read-scale)); margin: 36px 0 12px; }
/* 見出しのリンクのコピー（static/js/heading-link.js, #617）。マウスの端末では、見出しに乗せたとき・
   フォーカスしたときだけ見せる。触る端末には乗せる動きが無いので、いつも薄く出す */
.heading-link-btn {
  font: inherit; font-size: 0.8em; font-weight: 700; line-height: 1;
  margin-left: 0.4em; padding: 2px 8px; vertical-align: baseline;
  color: var(--muted); background: transparent;
  border: 1px solid var(--border); border-radius: var(--radius-pill); cursor: pointer;
}
.heading-link-btn:hover { color: var(--text-hi); }
.heading-link-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.heading-link-btn.is-done { color: var(--tok-string); }
@media (hover: hover) {
  .heading-link-btn { opacity: 0; transition: opacity 0.15s ease; }
  .lesson-content h2:hover .heading-link-btn, .heading-link-btn:focus-visible, .heading-link-btn.is-done { opacity: 1; }
}
.lesson-content p { margin-bottom: 14px; color: var(--text-2); font-size: calc(0.94rem * var(--read-scale)); line-height: var(--read-lh); }
.lesson-content code, .article-body code, .api-note code {
  background: var(--code-inline-bg); color: var(--code-inline-fg);
  border: 1px solid var(--border); border-radius: 5px;
  padding: 1px 6px; font-family: var(--mono); font-size: 0.85em;
  /* 空白を含まない長いコード名や URL でも、狭い画面で行を押し広げない */
  overflow-wrap: anywhere;
}

/* critical:end */
/* コードランナー */
.runner {
  margin: 22px 0; border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; background: var(--surface);
}
.runner-head {
  background: var(--surface-2); color: var(--muted);
  padding: 10px 16px; font-size: 0.76rem; font-weight: 600;
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--border);
}
/* ファイル名が長くても枠を押し広げない */
.runner-head > span:first-child { min-width: 0; overflow-wrap: anywhere; }
/* ファイルのタブ（#399）。狭い画面では横に流して、指で切り替えられる大きさにする */
/* タブは縮めずに並べ、入りきらないときはコピーのボタンを次の行へ回す（どのファイル名も切れないように） */
.runner-head:has(.runner-tabs) { flex-wrap: wrap; }
.runner-tabs { display: flex; flex: 0 0 auto; max-width: 100%; gap: 2px; overflow-x: auto; scrollbar-width: none; }
/* 状態の欄が空のときは場所を取らない（タブとコピーのボタンに幅を回す） */
.runner-head:has(.runner-tabs) .runner-status:empty { display: none; }
.runner-tab {
  flex: none; min-height: 32px; padding: 4px 8px; border-radius: var(--radius-sm);
  border: 1px solid transparent; background: transparent; color: var(--muted);
  font: inherit; font-family: var(--mono); cursor: pointer;
}
.runner-tab:hover { color: var(--text); }
.runner-tab[aria-selected="true"] { background: var(--code-bg); color: var(--text); border-color: var(--border); }
.runner-tab:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.runner textarea {
  width: 100%; min-height: 180px; border: none; resize: vertical; display: block;
  background: var(--code-bg); color: var(--code-fg);
  caret-color: var(--tok-op);
  padding: 16px; font-size: 0.86rem; font-family: var(--mono); line-height: 1.7;
  tab-size: 4;
}
.runner textarea:focus { outline: none; }
.runner textarea::selection { background: rgba(122, 162, 247, 0.3); color: var(--text-hi); }
.runner-bar {
  background: var(--surface-2); padding: 10px 16px;
  display: flex; gap: 10px; align-items: center; border-top: 1px solid var(--border);
}
.runner-out {
  background: var(--code-bg); color: var(--tok-prompt); padding: 14px 16px;
  font-family: var(--mono); font-size: 0.83rem; white-space: pre-wrap; min-height: 1.4em;
  border-top: 1px solid var(--border);
}
.runner-out .err { color: var(--danger); }
/* エラーに添える一言（static/js/error-hints.js, #435）。元のエラーの下に、本文の字で出す */
.runner .runner-hint {
  margin: 0; padding: 12px 16px; border-top: 1px solid var(--border);
  background: var(--surface-2); color: var(--text);
  font-size: 0.84rem; line-height: 1.7;
}
.runner .runner-hint strong { font-family: var(--mono); font-size: 0.78rem; color: var(--danger); margin-right: 4px; }
.runner-status { font-size: 0.74rem; color: var(--muted-2); }
.runner-bar .reset-btn { margin-left: auto; }
.runner-bar .reset-btn[hidden] { display: none; }
/* Python の input()（#397）。まとめて渡す行と、出力欄の中の入力欄 */
.runner-stdin { border-top: 1px solid var(--border); background: var(--surface-2); }
.runner-stdin[hidden] { display: none; }
.runner-stdin summary {
  padding: 8px 16px; font-size: 0.76rem; color: var(--muted); cursor: pointer;
}
.runner .runner-stdin textarea { min-height: 4.5em; padding: 10px 16px; font-size: 0.83rem; }
.runner-out .runner-ask { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; vertical-align: middle; }
.runner-out .runner-in {
  min-width: 8em; width: 16em; max-width: 100%; font: inherit; color: var(--code-fg);
  background: transparent; border: none; border-bottom: 1px solid var(--tok-op);
  padding: 2px 0; caret-color: var(--tok-op);
}
.runner-out .runner-in:focus { outline: none; border-bottom-width: 2px; }
.runner-out .stopped { color: var(--muted-2); }
/* 答え合わせ（#382）。「確かめる」の結果 */
.check-result {
  border-top: 1px solid var(--border); background: var(--surface-2);
  padding: 12px 16px; font-size: 0.84rem;
}
.check-result[hidden] { display: none; }
.check-summary { margin: 0; font-weight: 700; }
.check-summary.ok { color: var(--mint); }
.check-summary.ng { color: var(--danger); }
.check-fail { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--border); }
.check-name { margin: 0 0 6px; font-weight: 600; color: var(--text-hi); }
.check-block { margin-top: 6px; }
.check-label { display: block; font-size: 0.74rem; color: var(--muted); margin-bottom: 2px; }
.check-block pre {
  margin: 0; padding: 8px 10px; border-radius: 6px; background: var(--code-bg); color: var(--code-fg);
  font-family: var(--mono); font-size: 0.8rem; white-space: pre-wrap; overflow-wrap: anywhere;
}
.check-block pre.err { color: var(--danger); }
.check-more { margin: 10px 0 0; color: var(--muted); }
/* コードを共有するリンク（#355）。上書きしてよいかを聞く帯と、コピーできなかったときの欄 */
.share-offer {
  display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center;
  background: var(--surface-2); padding: 10px 16px; border-top: 1px solid var(--border);
  font-size: 0.82rem;
}
.share-offer span { flex: 1 1 16rem; }
.runner .share-url {
  display: block; width: 100%; box-sizing: border-box; padding: 8px 16px;
  background: var(--code-bg); color: var(--text); border: 0; border-top: 1px solid var(--border);
  font-family: var(--mono); font-size: 0.78rem;
}

.preview-frame { width: 100%; height: 240px; border: none; background: #fff; display: none; }
.codeblock {
  background: var(--code-bg); color: var(--code-fg);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; margin: 20px 0; overflow-x: auto;
  font-family: var(--mono); font-size: 0.84rem; line-height: 1.7; white-space: pre;
  tab-size: 4;
}
/* コピーボタン（static/js/copy-code.js, #387）。.codeblock は横にスクロールするので、
   外側の包みに置いて一緒に流れないようにする。長い行は横に流れてボタンの下に潜るので、
   右ではなく上にボタンの帯ぶんの余白を取る */
.codeblock-wrap { position: relative; }
.codeblock-wrap > .codeblock { padding-top: 46px; }
.copy-btn {
  font: inherit; font-size: 0.72rem; font-weight: 600; line-height: 1.2;
  color: var(--muted); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius-pill);
  padding: 4px 11px; cursor: pointer; white-space: nowrap;
}
.copy-btn:hover { color: var(--text-hi); }
.copy-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.copy-btn.is-done { color: var(--tok-string); }
.codeblock-wrap > .copy-btn { position: absolute; top: 10px; right: 10px; }
/* 包んだ .codeblock の上下の余白は包みの外へ出す（中のボタンの位置がずれないように） */
.codeblock-wrap { margin: 20px 0; }
.codeblock-wrap > .codeblock { margin: 0; }

/* 自分のコードと回答例の違い（#595、static/js/code-diff.js）。
   左に自分のコード、右に回答例。両側の段の高さをそろえるので、行は折り返さず横に流す。
   違いは色に加えて記号（− / +）でも示す（色だけに頼らない。#444） */
.answer-diff { margin: -6px 0 24px; }
.answer-diff[hidden], .answer-diff-panel[hidden] { display: none; }
.answer-diff-bar { margin: 0; }
.answer-diff-panel {
  margin-top: 12px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface);
}
.answer-diff-panel p { margin: 0 0 10px; font-size: 0.86rem; line-height: 1.7; }
.answer-diff-note { color: var(--muted); }
.answer-diff-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.answer-diff-sign { display: inline-block; width: 1.4em; text-align: center; font-family: var(--mono); font-weight: 700; border-radius: 4px; }
.answer-diff-key.is-del .answer-diff-sign { background: color-mix(in srgb, var(--danger) 26%, transparent); }
.answer-diff-key.is-add .answer-diff-sign { background: color-mix(in srgb, var(--green) 26%, transparent); }
.answer-diff-option label { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; cursor: pointer; }
.answer-diff-summary { font-weight: 700; color: var(--text-hi); }
.answer-diff-summary:empty { display: none; }
.answer-diff-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.answer-diff-side {
  overflow-x: auto; background: var(--code-bg); color: var(--code-fg);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.answer-diff-side:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.answer-diff-table { border-collapse: collapse; min-width: 100%; font-family: var(--mono); font-size: 0.8rem; line-height: 1.7; }
.answer-diff-table caption {
  position: sticky; left: 0; text-align: left; padding: 8px 12px; font-family: var(--sans); font-size: 0.78rem; font-weight: 700;
  color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--border);
}
/* .visually-hidden の見出し行（絶対配置）が、横に流れる枠を押し広げないように */
.answer-diff-table thead { position: relative; }
.answer-diff-table td { padding: 0 8px; white-space: pre; vertical-align: top; tab-size: 4; }
.answer-diff-no { width: 1%; text-align: right; color: var(--muted-2); user-select: none; }
.answer-diff-mark { width: 1%; text-align: center; font-weight: 700; user-select: none; }
.answer-diff-table td.answer-diff-code { padding-right: 16px; }
.answer-diff-table tr.is-del td { background: color-mix(in srgb, var(--danger) 18%, transparent); }
.answer-diff-table tr.is-add td { background: color-mix(in srgb, var(--green) 18%, transparent); }
.answer-diff-table tr.is-del .answer-diff-mark { color: var(--danger); }
.answer-diff-table tr.is-add .answer-diff-mark { color: var(--green); }
.answer-diff-table tr.is-pad td { background: color-mix(in srgb, var(--muted) 8%, transparent); }
@media (max-width: 720px) {
  /* 狭い画面では上下に並べる。高さをそろえるための空の段は要らない */
  .answer-diff-cols { grid-template-columns: minmax(0, 1fr); }
  .answer-diff-table tr.is-pad { display: none; }
  .answer-diff-panel { padding: 12px; }
}
.runner-tools { display: inline-flex; align-items: center; gap: 10px; flex-shrink: 0; }
.codeblock-label {
  display: inline-block; font-family: var(--mono); font-size: 0.68rem;
  color: var(--muted); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius-pill);
  padding: 2px 11px; margin-bottom: 10px; letter-spacing: 0.06em;
  /* src/main/java/... のような長いパスでも、狭い画面ではみ出さずに折り返す */
  max-width: 100%; overflow-wrap: anywhere;
}

/* ---------- 表 ----------
   もとは空白で桁を揃えた文字列を .codeblock に入れていた。等幅フォントに
   日本語のグリフが無いので、全角の幅が半角ちょうど 2 つぶんにならず、
   列がまったく揃わなかった。幅の計算はブラウザに任せる。 */
.datatable-wrap { margin: 22px 0; }
.datatable-lead, .datatable-note {
  font-size: 0.88rem; color: var(--text-2); margin: 0 0 10px;
}
.datatable-note { margin: 12px 0 0; }
.datatable {
  width: 100%; border-collapse: collapse;
  font-size: 0.87rem; line-height: 1.65;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.datatable th {
  text-align: left; font-weight: 700; font-size: 0.74rem;
  letter-spacing: 0.04em; color: var(--muted);
  background: var(--surface-2); padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  /* 見出しは折り返さず、幅は中身に任せる */
  white-space: nowrap;
}
.datatable td {
  padding: 10px 14px; vertical-align: top;
  border-top: 1px solid var(--border-soft); color: var(--text-2);
}
.datatable tbody tr:first-child td { border-top: 0; }
.datatable tbody tr:nth-child(even) { background: rgba(var(--tint-rgb), 0.02); }
.datatable td:first-child { color: var(--text); font-weight: 600; }
/* 数字は右に寄せない。「1.5」と「—」が混ざる列があり、
   右寄せにすると桁がそろって見えて、比べられない値まで比べたくなる */
.datatable code {
  font-family: var(--mono); font-size: 0.92em;
  background: var(--code-inline-bg); border-radius: 5px; padding: 1px 5px;
}
/* 広い画面では列名は見出し行にあるので、セルの中のものは出さない */
.datatable-key { display: none; }

/* 狭い画面。横に振りながら読むのはつらいので、1 行 1 枚のカードに組み替える。
   列名がセルから離れるため、セルの中に持たせた列名をここで出す。 */
@media (max-width: 680px) {
  .datatable, .datatable tbody, .datatable tr, .datatable td { display: block; }
  .datatable thead { display: none; }
  .datatable { border: 0; background: none; }
  .datatable tr {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px;
  }
  .datatable tbody tr:nth-child(even) { background: var(--surface); }
  .datatable td { border: 0; padding: 3px 0; }
  .datatable tbody tr:first-child td { border-top: 0; }
  .datatable td:first-child {
    font-size: 0.95rem; margin-bottom: 4px;
    padding-bottom: 7px; border-bottom: 1px solid var(--border-soft);
  }
  /* 中身が空のセルは、列名だけが残っても読む人の役に立たない */
  .datatable td:empty { display: none; }
  .datatable-key {
    display: inline; color: var(--muted); font-weight: 400;
    font-size: 0.78rem; margin-right: 7px;
  }
  /* 1 列目はカードの見出しなので、列名を添えない */
  .datatable td:first-child .datatable-key { display: none; }
}

/* ---------- 図 ----------
   もとは `+----+` や罫線文字で枠を描いていた。枠の中に日本語が入ると
   等幅でも桁が合わず、縦線の位置がばらばらになる。枠は CSS に描かせる。 */
.figure-wrap { margin: 22px 0; }
.figure-node {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 11px 15px;
  display: flex; flex-direction: column; gap: 2px;
  min-width: 0;
}
/* 長いハッシュのような、途中で切れない文字列を入れる箱がある。
   折り返させないと枠からはみ出して、頭のほうしか読めなくなる */
.figure-label {
  font-size: 0.88rem; font-weight: 600; color: var(--text);
  overflow-wrap: anywhere;
}
.figure-sub, .figure-note {
  font-size: 0.76rem; color: var(--muted); overflow-wrap: anywhere;
}

/* 工程の流れ。1 つの「組」に 2 つ以上入れると枝分かれ・合流になる */
.figure-flow { display: flex; align-items: stretch; flex-wrap: wrap; gap: 10px 0; }
/* 矢印と、その矢印が指す段。折り返しても離れないように一組にしてある */
.figure-link {
  display: flex; align-items: center; gap: 12px;
  flex: 1 1 165px; min-width: 0;
}
.figure-flow .figure-step {
  display: flex; flex-direction: column; gap: 8px;
  flex: 1 1 auto; min-width: 0;
}
.figure-arrow { color: var(--primary); font-size: 1.1rem; flex: 0 0 auto; }

/* 対比。幅が足りなくなったところで折り返す（端末の名前では決めない） */
.figure-compare {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.figure-col {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px;
}
.figure-col-title {
  font-size: 0.86rem; font-weight: 700; color: var(--text);
  margin: 0 0 10px; padding-bottom: 9px;
  border-bottom: 1px solid var(--border-soft);
}
.figure-col ul { margin: 0; padding-left: 18px; }
.figure-col li { font-size: 0.85rem; color: var(--text-2); margin: 5px 0; }

/* 層の積み重ね。上から順に積む。箱の高さはそろえない
   （「厚み」に意味があると読まれてしまう） */
.figure-stack {
  display: grid; gap: 14px; align-items: start;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}
.figure-layer {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 9px 12px; margin-bottom: 6px;
  font-size: 0.82rem; color: var(--text-2); text-align: center;
}
.figure-col-note { font-size: 0.76rem; color: var(--muted); margin: 8px 0 0; }

/* 相手とのやり取り。誰から誰へ、を 1 行ずつ */
.figure-sequence {
  list-style: none; margin: 0; padding: 0;
  counter-reset: figure-seq;
}
.figure-sequence li {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 14px; margin-bottom: 8px;
  font-size: 0.85rem; color: var(--text-2);
}
.figure-sequence li::before {
  counter-increment: figure-seq; content: counter(figure-seq);
  font-family: var(--mono); font-size: 0.72rem; color: var(--muted);
  min-width: 1.4em;
}
.figure-party { font-weight: 600; color: var(--text); }
.figure-msg { flex: 1 1 200px; }

@media (max-width: 680px) {
  /* 縦に積む。矢印も下向きに倒す */
  .figure-flow, .figure-link { flex-direction: column; align-items: stretch; }
  .figure-flow .figure-arrow { align-self: center; transform: rotate(90deg); }
}

/* ---------- シンタックストークン（Tokyo Night） ---------- */
.codeblock .tok-comment { color: var(--tok-comment); font-style: italic; }
.codeblock .tok-string  { color: var(--tok-string); }
.codeblock .tok-number  { color: var(--tok-number); }
.codeblock .tok-keyword { color: var(--tok-keyword); }
.codeblock .tok-type    { color: var(--tok-type); }
.codeblock .tok-func    { color: var(--tok-func); }
.codeblock .tok-op      { color: var(--tok-op); }
.codeblock .tok-prompt  { color: var(--tok-prompt); }
.codeblock .tok-cmd     { color: var(--tok-func); }
.codeblock .tok-flag    { color: var(--tok-number); }

/* 写真のメタデータビューア（sec-osint）。枠は .task を使う */
/* .exif-result や .btn の display が hidden 属性に勝たないように */
.exif-viewer [hidden] { display: none; }
.exif-viewer .exif-note { color: var(--text-2); font-size: 0.88rem; }
.exif-pick { cursor: pointer; }
.exif-result { margin-top: 16px; display: grid; grid-template-columns: minmax(0, 220px) 1fr; gap: 18px; align-items: start; }
.exif-preview { width: 100%; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.exif-fields { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; font-size: 0.88rem; }
.exif-fields dt { color: var(--muted-2); }
.exif-fields dd { margin: 0; font-family: var(--mono); word-break: break-all; }
.exif-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 10px; margin: 0; }
.lesson-content .exif-status { margin: 12px 0 0; font-size: 0.88rem; color: var(--text-2); }
.lesson-content .exif-status:empty { display: none; }
@media (max-width: 640px) {
  .exif-result { grid-template-columns: 1fr; }
}

/* 演習（課題と実装手順） */
.task {
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--orange);
  border-radius: var(--radius); padding: 22px 24px; margin: 26px 0;
}
.lesson-content .task-label {
  font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.1em;
  color: var(--orange);
  margin-bottom: 10px; font-weight: 700;
}
.lesson-content .task p:last-child { margin-bottom: 0; }
.task ul {
  list-style: none; margin: 12px 0 0; display: flex; flex-direction: column; gap: 7px;
}
.task ul li {
  position: relative; padding-left: 20px;
  color: var(--text-2); font-size: calc(0.92rem * var(--read-scale)); line-height: calc(var(--read-lh) + 0.05);
}
.task ul li::before {
  content: "▸"; position: absolute; left: 2px; color: var(--orange-2);
}
/* 課題のヒント（#536）。<details> の入れ子で、前のを開くと次の「ヒント」が現れる */
.hints { margin-top: 14px; }
.hint { margin-top: 8px; border-left: 2px solid var(--border); padding-left: 12px; }
.hint > summary { cursor: pointer; width: fit-content; font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.hint > summary:hover { color: var(--text-2); }
.hint > summary:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 2px; }
.lesson-content .hint > p { margin: 8px 0 0; font-size: calc(0.92rem * var(--read-scale)); color: var(--text-2); }
.task-out {
  background: var(--code-bg); color: var(--code-fg);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 14px 16px; margin-top: 14px; overflow-x: auto;
  font-family: var(--mono); font-size: 0.8rem; line-height: 1.7; white-space: pre;
}

.steps { margin: 24px 0; }
.lesson-content .steps-label {
  font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 12px; font-weight: 700;
}
.steps ol {
  list-style: none; counter-reset: step;
  display: flex; flex-direction: column; gap: 10px; margin: 0;
}
.steps ol li {
  counter-increment: step; position: relative; padding: 11px 16px 11px 46px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-2); font-size: calc(0.9rem * var(--read-scale)); line-height: var(--read-lh);
}
.steps ol li::before {
  content: counter(step); position: absolute; left: 14px; top: 11px;
  width: 20px; height: 20px; border-radius: var(--radius-pill);
  background: var(--surface-3); color: var(--primary);
  font-family: var(--mono); font-size: 0.72rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* 解説動画。

   枠は 16:9 で高さを持たせる。iframe を素で置くと読み込み中の高さが 0 になり、
   本文が下から跳ね上がって読んでいる場所を見失う。 */
.lesson-video { margin: 26px 0; }
.lesson-video-frame {
  position: relative; aspect-ratio: 16 / 9; overflow: hidden;
  background: var(--code-bg); border: 1px solid var(--border);
  border-radius: var(--radius);
}
.lesson-video-frame iframe {
  position: absolute; inset: 0; width: 100%; height: 100%; border: 0;
}
.lesson-video figcaption {
  margin-top: 10px; font-size: 0.82rem; color: var(--muted);
  display: flex; flex-direction: column; gap: 4px;
}
.lesson-video-title { color: var(--text-2); font-weight: 700; font-size: 0.86rem; }

/* 映像プランでない人に出す案内。本文は読めるので、行き止まりには見せない */
.video-locked {
  background: var(--surface); border: 1px dashed var(--border-2);
  border-radius: var(--radius); padding: 28px 24px; margin: 26px 0;
  text-align: center;
}
.video-locked-icon { font-size: 1.6rem; margin-bottom: 8px; }
.video-locked h3 { font-size: 0.95rem; margin-bottom: 8px; }
.video-locked p { font-size: 0.84rem; color: var(--muted); }

/* クイズ */
.quiz {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; margin: 26px 0;
}
.quiz h3 { margin-bottom: 14px; }
.quiz-choices { list-style: none; display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.quiz-choices label {
  display: flex; gap: 10px; align-items: center; cursor: pointer;
  padding: 11px 14px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface-2);
  font-size: 0.88rem; transition: border-color 0.15s ease;
}
.quiz-choices label:hover { border-color: var(--border-2); }
.quiz-choices input[type="radio"] { accent-color: var(--primary); }
.quiz-result { font-weight: 700; font-size: 0.86rem; min-height: 1.4em; }
.quiz-result.ok { color: var(--mint); }
.quiz-result.ng { color: var(--danger); }
.quiz-certificate { display: inline-block; margin-top: 12px; }
.quiz-note { margin-top: 8px; font-size: 0.8rem; color: var(--muted); }
.quiz-note a { color: var(--primary); }
.quiz-explanation, .dash-explanation {
  margin-top: 10px; padding: 10px 14px; font-size: 0.88rem; line-height: 1.7;
  background: var(--surface-2); border-left: 3px solid var(--primary); border-radius: var(--radius-sm);
}
.quiz-explanation a, .dash-explanation a { color: var(--primary); text-decoration: underline; }

.lesson-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 44px; }

/* キーボードショートカットの一覧（#354）。ふだんは目立たせず、末尾に小さく置く */
.lesson-keys-hint { margin-top: 16px; text-align: right; }
.lesson-keys-open {
  background: none; border: 0; padding: 4px 0; cursor: pointer;
  font: inherit; font-size: 0.78rem; color: var(--muted); text-decoration: underline;
}
.lesson-keys-open:hover { color: var(--text-2); }
.lesson-keys-open[hidden] { display: none; }
.lesson-keys {
  margin: auto; max-width: min(460px, calc(100vw - 32px)); width: 100%;
  padding: 22px 22px 18px; border: 1px solid var(--border-2); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
}
.lesson-keys::backdrop { background: rgba(0, 0, 0, 0.55); }
.lesson-keys h2 { font-size: 1.05rem; margin: 0 0 12px; }
.lesson-keys table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.lesson-keys th, .lesson-keys td {
  text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); font-weight: 400;
}
.lesson-keys thead th { color: var(--muted); font-size: 0.76rem; }
.lesson-keys tbody th { white-space: nowrap; }
.lesson-keys kbd {
  font-family: var(--mono); font-size: 0.8rem; padding: 1px 6px;
  border: 1px solid var(--border-2); border-bottom-width: 2px; border-radius: 5px;
  background: var(--surface-2); color: var(--text-hi);
}
.lesson-keys-note { margin: 12px 0 14px; font-size: 0.8rem; color: var(--muted); }

/* 教材の誤りの報告（#322）。ふだんはたたんで、本文の邪魔をしない */
.report { margin-top: 36px; border-top: 1px solid var(--border); padding-top: 14px; }
.report summary { cursor: pointer; font-size: 0.82rem; color: var(--muted); width: fit-content; }
.report summary:hover { color: var(--text-2); }
.report[open] summary { margin-bottom: 14px; }
.report-form {
  display: flex; flex-direction: column; gap: 14px; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px;
}
.report-kinds { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px 18px; }
.report-kinds legend, .report-body { font-size: 0.78rem; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.report-kinds label { display: flex; gap: 6px; align-items: center; font-size: 0.86rem; cursor: pointer; }
.report-kinds input[type="radio"] { accent-color: var(--primary); }
.report-body { display: flex; flex-direction: column; gap: 6px; width: 100%; margin: 0; }
.report-body textarea {
  width: 100%; font: inherit; font-size: 0.88rem; font-weight: 400; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px;
}
.report-note { font-size: 0.78rem; color: var(--muted); }
.report-note a { color: var(--primary); }
.report-result { font-weight: 700; font-size: 0.86rem; margin-bottom: 12px; }
.report-result.ok { color: var(--mint); }
.report-result.ng { color: var(--danger); }

/* ============================================================
   認証まわり
   ============================================================ */
.user-chip {
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 6px 12px; font-size: 0.8rem;
}
.user-chip a { color: var(--text-2); font-weight: 600; }
/* ダッシュボードへの入口。広い画面ではアイコンだけ、メニューが縦に並ぶ狭い画面では文字も出す */
.main-nav .nav-profile {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 30px; height: 30px; padding: 0; border-radius: var(--radius-pill);
  background: var(--surface-3); color: var(--text-2);
}
.main-nav .nav-profile:hover { background: var(--border-2); color: var(--text-hi); }
.nav-profile-label {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.user-chip button {
  background: none; border: none; cursor: pointer;
  color: var(--muted-2); font-family: inherit; font-size: 0.76rem;
}
.user-chip button:hover { color: var(--text); }

.auth-card {
  max-width: 420px; margin: 0 auto; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 32px;
}
.auth-card label {
  display: block; font-size: 0.78rem; font-weight: 600;
  color: var(--muted); margin: 16px 0 6px;
}
.auth-card input {
  width: 100%; padding: 11px 14px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); font-family: inherit; font-size: 0.9rem;
}
.auth-card input::placeholder { color: var(--muted-2); }
.auth-card input:focus { outline: none; border-color: var(--primary); }
.auth-msg { font-size: 0.84rem; margin-top: 12px; min-height: 1.3em; font-weight: 600; }
.auth-msg.ok { color: var(--mint); }
.auth-msg.ng { color: var(--danger); }
.plan-pill {
  display: inline-block; background: rgba(187, 154, 247, 0.14);
  border: 1px solid rgba(187, 154, 247, 0.32); color: var(--primary);
  border-radius: var(--radius-pill); padding: 4px 14px;
  font-weight: 700; font-size: 0.8rem;
}

/* ============================================================
   API ステータス通知（バックエンド未起動時）
   ============================================================ */
.api-note {
  display: none; gap: 12px; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--border);
  border-left: 2px solid var(--gold);
  border-radius: var(--radius-sm); padding: 14px 16px; margin-bottom: 24px;
  font-size: 0.82rem; color: var(--muted); line-height: 1.7;
}
.api-note.show { display: flex; }
.api-note b { color: var(--text-2); }

/* 読み込み中 */
.skeleton {
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-3) 50%, var(--surface) 75%);
  background-size: 200% 100%; animation: shimmer 1.4s linear infinite;
  border-radius: var(--radius); color: transparent;
}
@keyframes shimmer { to { background-position: -200% 0; } }
.skeleton-card { height: 220px; border: 1px solid var(--border); }

.empty-state {
  text-align: center; padding: 64px 20px; color: var(--muted);
  border: 1px solid var(--border); border-radius: var(--radius); font-size: 0.88rem;
}
.empty-state b { display: block; color: var(--text); margin-bottom: 6px; font-size: 0.95rem; }

/* ============================================================
   ツールバー（検索＋フィルタ）— コラム／スタッフ共通
   ============================================================ */
/* 一覧のいちばん上に出る。後読みの css で高さが変わると、その下の一覧が
   まるごと押し下げられる（コラム一覧の CLS の元、issue #52） */
/* critical:start */
.toolbar {
  display: flex; flex-wrap: wrap; gap: 14px; align-items: center;
  justify-content: space-between; margin-bottom: 22px;
}
.search-box { position: relative; flex: 1; min-width: 220px; max-width: 320px; }
.search-box input {
  width: 100%; padding: 9px 14px 9px 34px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-family: inherit; font-size: 0.86rem;
}
.search-box input::placeholder { color: var(--muted-2); }
.search-box input:focus { outline: none; border-color: var(--border-2); background: var(--surface-2); }
.search-box::before {
  content: "⌕"; position: absolute; left: 13px; top: 50%;
  transform: translateY(-50%); color: var(--muted-2); font-size: 1rem; pointer-events: none;
}
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  background: var(--surface); border: 1px solid var(--border);
  color: var(--muted); cursor: pointer; font-family: inherit;
  font-size: 0.78rem; font-weight: 600; padding: 6px 13px;
  border-radius: var(--radius-pill);
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.chip:hover { color: var(--text); border-color: var(--border-2); }
.chip.active { background: var(--text-2); border-color: var(--text-2); color: var(--ink); }
.result-count { font-size: 0.78rem; color: var(--muted-2); margin-bottom: 20px; }
.result-count b { color: var(--text-2); }
/* critical:end */

/* サイト全体の検索（#321） */
.page-hero-compact { padding: 48px 0 24px; }
.site-search { display: flex; gap: 8px; max-width: 560px; margin: 8px auto 10px; }
.site-search input {
  flex: 1; min-width: 0; padding: 11px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); font-family: inherit; font-size: 0.95rem;
}
.site-search input::placeholder { color: var(--muted-2); }
.site-search input:focus { outline: none; border-color: var(--border-2); background: var(--surface-2); }
.page-hero .site-search-note { font-size: 0.78rem; color: var(--muted-2); }
.page-hero .search-lang { margin-top: 10px; justify-content: center; }
section.search-results { padding: 8px 0 64px; }
.search-results .container { max-width: 820px; }
.search-group { font-size: 1rem; margin: 28px 0 10px; color: var(--text-hi); }
.search-group small { font-size: 0.75rem; color: var(--muted-2); font-weight: 600; margin-left: 6px; }
.search-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.search-list > li {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px;
}
.search-where { display: block; font-size: 0.72rem; color: var(--muted-2); margin-bottom: 2px; }
.search-plan {
  display: inline-block; margin-left: 6px; padding: 0 7px; border-radius: var(--radius-pill);
  border: 1px solid var(--border-2); font-size: 0.66rem; color: var(--muted);
}
.search-title { font-weight: 700; color: var(--text-hi); }
.search-title:hover { color: var(--primary); }
.search-sub { font-size: 0.82rem; color: var(--muted); margin-top: 4px; }
.search-headings { list-style: none; margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.search-headings li {
  font-size: 0.74rem; color: var(--text-2); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 2px 10px;
}
.search-headings li::before { content: "§ "; color: var(--muted-2); }
.search-more, .search-empty p { font-size: 0.82rem; color: var(--muted); margin-top: 12px; }
.search-empty a { color: var(--primary); }

/* ============================================================
   コラム一覧
   ============================================================ */
/* 注目記事は一覧のいちばん上に大きく出るので、最初の画面ぶんに入れる。
   後読みの css で 2 列に組み直されると、PC で CLS が 0.3 を超えていた（issue #52） */
/* critical:start */
.column-featured {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; margin-bottom: 28px;
  transition: border-color 0.18s ease;
}
.column-featured:hover { border-color: var(--border-2); }
.column-featured .cover { min-height: 260px; border-right: 1px solid var(--border); border-bottom: none; }
.column-featured .body { padding: 34px 32px; display: flex; flex-direction: column; gap: 14px; }
.column-featured h2 { font-size: clamp(1.3rem, 2.2vw, 1.7rem); }
.column-featured p { color: var(--muted); font-size: 0.9rem; }
/* critical:end */

.column-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 16px; }
.column-card {
  display: flex; flex-direction: column; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  transition: border-color 0.18s ease, transform 0.18s ease;
}
.column-card:hover { border-color: var(--border-2); transform: translateY(-2px); }
.column-card .body { padding: 20px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.column-card h3 { font-size: 1rem; }
.column-card p { font-size: 0.84rem; color: var(--muted); flex: 1; }

/* 記事カバー：画像を持たないので低彩度のグラデーションで代用 */
/* critical:start */
.cover {
  position: relative; min-height: 148px;
  display: flex; align-items: center; justify-content: center;
  border-bottom: 1px solid var(--border);
  background: radial-gradient(ellipse 80% 100% at 50% 0%, rgba(187, 154, 247, 0.18), transparent 70%), var(--surface-2);
}
.cover.c-2 { background: radial-gradient(ellipse 80% 100% at 50% 0%, rgba(122, 162, 247, 0.16), transparent 70%), var(--surface-2); }
.cover.c-3 { background: radial-gradient(ellipse 80% 100% at 50% 0%, rgba(255, 158, 100, 0.14), transparent 70%), var(--surface-2); }
.cover .glyph { font-size: 2.4rem; opacity: 0.9; }
/* critical:end */
.cover .cat {
  position: absolute; left: 16px; top: 16px;
  background: var(--glass-soft); backdrop-filter: blur(6px);
  border: 1px solid var(--border); color: var(--text-2);
  font-size: 0.68rem; font-weight: 700; padding: 3px 10px;
  border-radius: var(--radius-pill);
}

/* プロジェクトの完了の印（#351）。一覧のカバーの右上 / 詳細の切り替えフォーム */
.cover .project-done-mark { position: absolute; right: 16px; top: 16px; }
.project-done { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 14px 0; }

/* どこから始めるか（プロジェクト一覧・ロードマップ一覧のリード）。apps/projects/guide.py の組み立てを出す */
.guide-lead {
  margin: 0 0 32px; padding: 20px 22px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.guide-lead-title { font-size: 1.05rem; font-weight: 700; color: var(--text-hi); margin: 0 0 16px; line-height: 1.5; }
/* ロードマップ一覧の大見出し。上のリードの箱やカードの列にくっつかないよう、上にも広く空ける */
.guide-section { margin: 72px 0 14px; scroll-margin-top: 80px; }
.guide-section + .section-lead { margin-bottom: 32px; }
.guide-howto { margin: 0 0 18px; padding-left: 1.4em; display: grid; gap: 6px; font-size: 0.88rem; line-height: 1.7; color: var(--muted); }
.guide-howto b { color: var(--text-2); }
.guide-routes { list-style: decimal; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px 28px; margin-bottom: 0; }
.guide-routes li { display: flex; flex-direction: column; gap: 6px; }
.guide-routes a { color: var(--primary); font-weight: 700; font-size: 0.86rem; }
.start-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; margin-bottom: 32px; }
.guide-lead .start-grid { margin-bottom: 0; }
.start-card {
  display: flex; flex-direction: column; gap: 12px; padding: 18px 20px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.start-card-cat { margin: 0; font-weight: 700; color: var(--text-hi); }
.start-card-cat a { color: inherit; }
.start-card-levels { margin: 0; display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 0.74rem; color: var(--muted-2); }
.start-card-done { color: var(--mint); }
.start-card-pick { margin: 0; display: flex; flex-direction: column; gap: 4px; font-size: 0.86rem; line-height: 1.6; }
.start-card-pick a { color: var(--text-2); font-weight: 600; }
.start-card-label { font-size: 0.7rem; font-weight: 700; color: var(--gold); }
.start-card-courses { margin: 0; padding-left: 1.3em; font-size: 0.84rem; line-height: 1.6; display: grid; gap: 4px; }
.start-card-courses a { color: var(--text-2); }
.start-card-more { margin-top: auto; padding-top: 4px; font-size: 0.8rem; font-weight: 700; line-height: 1.6; color: var(--primary); }
.start-card-more + .start-card-more { margin-top: 0; padding-top: 0; }
.guide-steps { margin: 0; padding-left: 1.4em; display: grid; gap: 14px; }
.guide-steps li { display: flex; flex-direction: column; gap: 4px; }
.guide-step-head { font-size: 0.78rem; font-weight: 700; color: var(--gold); }
.guide-step-body { font-size: 0.9rem; color: var(--text-2); line-height: 1.6; }
.guide-step-body a { color: var(--primary); font-weight: 600; }
.guide-step-note { margin-left: 8px; font-size: 0.76rem; color: var(--muted-2); }
.guide-roadmap { margin: 14px 0 0; font-size: 0.86rem; }
.guide-roadmap a { color: var(--primary); font-weight: 700; }
.doing-lead { border-color: rgba(224, 175, 104, 0.4); }
.doing-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.doing-list a { display: flex; justify-content: space-between; gap: 12px; color: var(--text-2); font-size: 0.9rem; }
.doing-go { flex-shrink: 0; color: var(--gold); font-weight: 700; font-size: 0.82rem; }
.project-filters { display: grid; gap: 8px; margin: 0 0 20px; scroll-margin-top: 80px; }
.project-filter-course { margin: 0; font-size: 0.86rem; color: var(--muted); }
.project-filter-course a { color: var(--primary); }
@media (max-width: 720px) {
  .guide-routes { grid-template-columns: 1fr; }
  .guide-lead { padding: 18px; }
  .guide-section { margin-top: 56px; }
  /* 狭い幅では注記が行の途中で折れて読みにくいので、行を改める */
  .guide-step-note { display: block; margin: 2px 0 0; }
  /* スマホでは分野のチップだけで画面が埋まるので、条件ごとに 1 行にして横へ送る */
  .project-filters .chip-row { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
  .project-filters .chip, .project-filters .chip-label { flex-shrink: 0; white-space: nowrap; }
}

.post-meta {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
  font-size: 0.74rem; color: var(--muted-2);
}
.post-meta .author { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); }
.post-meta .mini-avatar {
  width: 20px; height: 20px; border-radius: var(--radius-pill);
  background: linear-gradient(150deg, var(--primary), var(--blue));
  color: var(--ink); font-size: 0.58rem; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center;
}

.pager {
  display: flex; justify-content: center; align-items: center; gap: 14px;
  margin-top: 36px; font-size: 0.82rem;
}
.pager .page-state { color: var(--muted-2); }
.pager .page-state b { color: var(--text-2); }

/* ============================================================
   コラム記事
   ============================================================ */
/* critical:start */
.article-layout {
  /* 1fr のままだと、本文のコードブロックのように折り返さない中身が
     列を押し広げてしまう（.lesson-layout と同じ理由） */
  display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 48px;
  padding: 36px var(--gutter) 80px; align-items: start;
}
.article-layout > main { min-width: 0; }
.article-head { margin-bottom: 28px; }
.article-head .crumb { font-size: 0.8rem; color: var(--muted-2); margin-bottom: 16px; }
.article-head h1 { font-size: clamp(1.7rem, 3.4vw, 2.5rem); margin-bottom: 16px; }
.article-head .lead { color: var(--muted); font-size: 0.94rem; margin-bottom: 18px; }
/* critical:end */
/* プロジェクト本文。字の組みは .lesson-content を併用し、こちらは幅と余白だけ。
   サイドバーが無いので中央に置く。 */
.project-body { max-width: 820px; margin: 0 auto; padding: 44px 0 80px; }
/* .project-body を包む section。section の 84px と重なるとヘッダーの下に
   大きな空きができるので、余白は .project-body 側だけに持たせる */
section.detail-page { padding: 0; }

.article-body { max-width: var(--read-measure-article); }
.article-body h2 { font-size: calc(1.3rem * var(--read-scale)); margin: 40px 0 14px; }
.article-body h3 { font-size: calc(1.02rem * var(--read-scale)); margin: 26px 0 10px; }
.article-body p { margin-bottom: 16px; color: var(--text-2); font-size: calc(0.95rem * var(--read-scale)); line-height: var(--read-lh); }
/* リスト。
   以前は li を flex にして ::before で "—" を出していたが、その形だと
   入れ子のリストが親項目の横に並んでしまい、番号つきリストも "—" になった。
   マーカーを絶対配置にして、項目の中身は通常の流し込みに戻してある。 */
.article-body ul, .article-body ol { margin: 0 0 18px 0; padding-left: 0; list-style: none; }
.article-body li {
  position: relative; padding-left: 22px; margin-bottom: 8px;
  font-size: calc(0.92rem * var(--read-scale)); color: var(--text-2); line-height: var(--read-lh);
}
.article-body li::before {
  position: absolute; left: 0; top: 0; color: var(--muted-2);
}
.article-body ul > li::before { content: "—"; }

/* 番号つきリストは、実際の番号を出す（list-style を切っているので自前で数える） */
.article-body ol { counter-reset: article-ol; }
.article-body ol > li { counter-increment: article-ol; }
.article-body ol > li::before {
  content: counter(article-ol) "."; font-family: var(--mono);
  font-size: 0.85em; line-height: 1.75;
}

/* 入れ子。深さで印を変えて、階層が読み取れるようにする */
.article-body li > ul, .article-body li > ol { margin: 8px 0 0; }
.article-body li > ul > li::before { content: "·"; }
.article-body li > ul > li > ul > li::before { content: "◦"; }
.article-body li > p { margin-bottom: 8px; }
.article-body li > p:last-child { margin-bottom: 0; }

.article-body blockquote {
  border-left: 2px solid var(--primary); background: var(--surface);
  padding: 16px 20px; margin: 22px 0; color: var(--text-2); font-size: 0.92rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.article-body blockquote > p:last-child { margin-bottom: 0; }
.article-body .codeblock { margin: 20px 0; }

/* 以下は Markdown で書けるようになった記法。旧ブロック方式では出せなかったので
   スタイルが無く、そのままだと素の見た目で出てしまう。 */
.article-body a {
  color: var(--primary); text-decoration: underline;
  text-underline-offset: 2px; text-decoration-thickness: 1px;
}
.article-body a:hover { color: var(--primary-2); }
.article-body strong { color: var(--text-hi); font-weight: 700; }
.article-body em { font-style: italic; }
.article-body del, .article-body s { color: var(--muted-2); }
.article-body img { max-width: 100%; height: auto; border-radius: var(--radius-sm); margin: 20px 0; }
.article-body hr { border: none; border-top: 1px solid var(--border); margin: 32px 0; }

/* 表は横に長くなりがちなので、はみ出す分だけ表の中でスクロールさせる
   （ページ全体が横スクロールしないように、描画側で table-scroll に包んでいる）。 */
.article-body .table-scroll { overflow-x: auto; margin: 20px 0; }
.article-body table { border-collapse: collapse; width: 100%; font-size: 0.88rem; }
.article-body th, .article-body td {
  border: 1px solid var(--border); padding: 8px 12px; text-align: left;
}
.article-body th { background: var(--surface-2); color: var(--text-hi); font-weight: 600; }
.article-body td { color: var(--text-2); }

.article-toc { position: sticky; top: 96px; }
.article-toc h4 {
  font-size: 0.72rem; color: var(--muted-2); margin-bottom: 12px;
  font-family: var(--mono); letter-spacing: 0.16em; text-transform: uppercase;
}
.article-toc a {
  display: block; padding: 6px 12px; font-size: 0.82rem;
  color: var(--muted); border-radius: var(--radius-sm);
}
.article-toc a:hover { color: var(--text); background: rgba(var(--tint-rgb), 0.05); }
.article-toc a.active { color: var(--text); background: var(--surface-2); }

.article-footer {
  margin-top: 44px; padding-top: 26px; border-top: 1px solid var(--border-soft);
  display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between;
}
.like-btn {
  display: inline-flex; align-items: center; gap: 9px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-2); cursor: pointer; padding: 10px 18px;
  border-radius: var(--radius-sm); font-family: inherit;
  font-size: 0.84rem; font-weight: 700;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.like-btn:hover { background: var(--surface-2); border-color: var(--border-2); }
.like-btn.liked { background: rgba(187, 154, 247, 0.14); border-color: rgba(187, 154, 247, 0.42); color: var(--primary); }

/* 連載（#380）：記事の冒頭と末尾の「第 N 回／全 M 回」と前後の回 */
.chip-label { font-size: 0.78rem; font-weight: 700; color: var(--muted-2); padding: 6px 4px 6px 0; }
.series-nav {
  margin: 0 0 18px; padding: 14px 16px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 0.86rem;
}
.series-nav-title { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; margin: 0; }
.series-nav-title a { color: var(--primary); font-weight: 700; }
.series-nav-title b { color: var(--text-2); }
.series-nav-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 10px; margin-top: 12px; }
.series-nav-links a {
  display: block; padding: 10px 12px; border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm); color: var(--text-2); font-weight: 600; line-height: 1.5;
}
.series-nav-links a:hover { background: var(--surface-2); border-color: var(--border-2); }
.series-nav-links small { display: block; color: var(--muted-2); font-weight: 700; font-size: 0.72rem; }
.series-nav-links .next { text-align: right; }
.article-body ~ .series-nav { margin: 36px 0 0; }
.series-parts { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.series-parts li {
  display: grid; grid-template-columns: 5.5rem 1fr; gap: 14px; padding: 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.series-parts .no { font-weight: 800; color: var(--primary); font-size: 0.9rem; }
.series-parts h3 { font-size: 1.05rem; margin: 0 0 6px; }
.series-parts p { color: var(--muted); font-size: 0.88rem; margin: 0 0 8px; }
@media (max-width: 680px) { .series-parts li { grid-template-columns: 1fr; gap: 6px; } }

.author-box {
  display: grid; grid-template-columns: 56px 1fr; gap: 18px; align-items: center;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin-top: 32px;
}
.author-box .avatar { width: 56px; height: 56px; font-size: 1.1rem; }
.author-box h3 { font-size: 0.94rem; margin-bottom: 4px; }
.author-box p { font-size: 0.82rem; color: var(--muted); }

.related-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 16px; margin-top: 18px; }

/* ============================================================
   スタッフ紹介
   ============================================================ */
.staff-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 16px; }
.staff-card {
  text-align: left; cursor: pointer; color: inherit; font: inherit;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
  display: flex; flex-direction: column; gap: 14px;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}
.staff-card:hover { border-color: var(--border-2); background: var(--surface-2); transform: translateY(-2px); }
.staff-card:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.staff-head { display: flex; gap: 14px; align-items: center; }
.staff-avatar {
  width: 56px; height: 56px; flex-shrink: 0; border-radius: var(--radius-pill);
  background: linear-gradient(150deg, var(--primary), var(--blue));
  color: var(--ink); font-size: 1.05rem; font-weight: 800; letter-spacing: -0.03em;
  display: flex; align-items: center; justify-content: center;
}
.staff-avatar.a-2 { background: linear-gradient(150deg, var(--mint), #41a6b5); }
.staff-avatar.a-3 { background: linear-gradient(150deg, var(--orange), var(--gold)); }
.staff-card h3 { font-size: 1rem; }
.staff-card .romaji { font-family: var(--mono); font-size: 0.68rem; color: var(--muted-2); letter-spacing: 0.06em; }
.staff-card .role { font-size: 0.82rem; color: var(--primary); font-weight: 600; }
.staff-card .bio { font-size: 0.84rem; color: var(--muted); flex: 1; }
.staff-card .more { font-size: 0.78rem; color: var(--muted-2); font-weight: 600; }
.staff-card:hover .more { color: var(--text-2); }
.team-badge {
  align-self: flex-start; font-size: 0.68rem; font-weight: 700;
  padding: 3px 10px; border-radius: var(--radius-pill);
  background: var(--surface-2); border: 1px solid var(--border); color: var(--muted);
}

/* 詳細モーダル */
.modal {
  position: fixed; inset: 0; z-index: 200; display: none;
  align-items: center; justify-content: center; padding: 24px;
  background: var(--scrim); backdrop-filter: blur(4px);
}
.modal.open { display: flex; }
.modal-panel {
  position: relative; width: min(720px, 100%); max-height: 86vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
}
.modal-body { padding: 34px; }
.modal-close {
  position: absolute; top: 18px; right: 18px; z-index: 2;
  width: 32px; height: 32px; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--muted); border-radius: var(--radius-sm); font-family: inherit; font-size: 0.9rem;
}
.modal-close:hover { color: var(--text); background: var(--surface-3); }
/* お問い合わせの受付（_contact_form.html） */
.contact-sent .modal-panel { width: min(480px, 100%); text-align: center; }
.contact-sent h2 { font-size: 1.3rem; margin-bottom: 12px; }
.contact-sent p { color: var(--text-2); margin-bottom: 24px; }
.staff-detail-head { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.staff-detail-head .staff-avatar { width: 76px; height: 76px; font-size: 1.5rem; }
.staff-detail-head h2 { font-size: 1.5rem; margin-bottom: 4px; }
.staff-detail-head .role { color: var(--primary); font-weight: 600; font-size: 0.9rem; }
.detail-section { margin-top: 28px; }
.detail-section h4 {
  font-size: 0.72rem; font-family: var(--mono); letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--muted-2); margin-bottom: 14px;
}
.detail-section p { font-size: 0.9rem; color: var(--muted); }

.skill-list { display: flex; flex-direction: column; gap: 12px; }
.skill-row { display: grid; grid-template-columns: 130px 1fr 40px; gap: 14px; align-items: center; }
.skill-row .name { font-size: 0.84rem; color: var(--text-2); }
.skill-row .lv { font-family: var(--mono); font-size: 0.74rem; color: var(--muted-2); text-align: right; }
.skill-track {
  display: block; height: 6px; background: var(--surface-3);
  border-radius: var(--radius-pill); overflow: hidden;
}
.skill-fill {
  display: block; height: 100%; background: var(--primary);
  border-radius: var(--radius-pill);
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.timeline { list-style: none; border-left: 1px solid var(--border); margin-left: 4px; }
.timeline li { position: relative; padding: 0 0 20px 22px; }
.timeline li::before {
  content: ""; position: absolute; left: -4px; top: 9px;
  width: 7px; height: 7px; border-radius: var(--radius-pill);
  background: var(--primary);
}
.timeline .year { font-family: var(--mono); font-size: 0.74rem; color: var(--muted-2); }
.timeline .what { font-size: 0.88rem; color: var(--text-2); }
.timeline .where { font-size: 0.78rem; color: var(--muted-2); }

.quote-line {
  border-left: 2px solid var(--primary); background: var(--surface-2);
  padding: 16px 20px; font-size: 0.92rem; color: var(--text-2);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.link-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* ============================================================
   規約・ポリシーなどの文書ページ
   ============================================================ */
.legal-body { max-width: 760px; margin: 0 auto; }
.legal-body h2 {
  font-size: 1.16rem; margin: 40px 0 14px;
  padding-bottom: 10px; border-bottom: 1px solid var(--border-soft);
}
.legal-body h2:first-child { margin-top: 0; }
.legal-body h3 { font-size: 0.98rem; margin: 24px 0 10px; }
.legal-body p { margin-bottom: 14px; color: var(--text-2); font-size: 0.92rem; }
.legal-body ul, .legal-body ol { margin: 0 0 18px 20px; }
.legal-body li { margin-bottom: 7px; color: var(--text-2); font-size: 0.92rem; }
.legal-updated {
  font-family: var(--mono); font-size: 0.74rem; letter-spacing: 0.08em;
  color: var(--muted-2); margin-bottom: 30px;
}

/* 特定商取引法に基づく表記の項目一覧 */
.legal-table {
  display: grid; grid-template-columns: 210px 1fr;
  border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; margin-bottom: 24px;
}
.legal-table dt, .legal-table dd {
  padding: 15px 18px; font-size: 0.9rem;
  border-top: 1px solid var(--border-soft);
}
.legal-table dt:first-of-type, .legal-table dt:first-of-type + dd { border-top: none; }
.legal-table dt { background: var(--surface); color: var(--text-2); font-weight: 600; }
.legal-table dd { margin: 0; color: var(--text-2); }
.legal-table dd p { margin-bottom: 8px; font-size: 0.9rem; }
.legal-table dd p:last-child { margin-bottom: 0; }

/* ============================================================
   レスポンシブ
   ============================================================ */
@media (max-width: 900px) {
  .split, .faq-layout { grid-template-columns: 1fr; gap: 32px; }
  .split.reverse .split-visual { order: 0; }
  /* critical:start */
  .column-featured { grid-template-columns: 1fr; }
  .column-featured .cover { border-right: none; border-bottom: 1px solid var(--border); min-height: 180px; }
  /* critical:end */
  /* critical:start */
  .article-layout, .lesson-layout { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .article-toc, .lesson-sidebar { position: static; order: -1; }
  /* critical:end */
  .footer-top { grid-template-columns: 1fr 1fr; }
}

/* ナビをたたむ幅。横一列に並べるのに要る幅は、ブラウザで測ると
   未ログインで 870px、ログイン中は 968px（「👤 プラン名 ＋ ログアウト」の
   チップが、ログインボタンより 98px 広い）。左右の余白 48px を足すと、
   ビューポートで 1016px 要る計算になる。
   720px でたたんでいた頃は、721〜1016px のノート PC やタブレットで
   ヘッダからはみ出していた（900px 幅のとき実測 39px）。
   1080px でたたむと、収まる幅でだけ横一列になり、64px の余裕が残る。 */
@media (max-width: 1080px) {
  /* critical:start */
  .nav-toggle { display: block; }
  .main-nav {
    display: none; position: absolute; top: 72px; left: var(--gutter); right: var(--gutter);
    flex-direction: column; align-items: stretch; padding: 10px;
    background: var(--glass-strong); backdrop-filter: blur(14px);
    border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
  }
  .main-nav.open { display: flex; }
  .main-nav a { padding: 10px 12px; }
  .user-chip { justify-content: space-between; margin-top: 6px; }
  .main-nav .nav-profile { width: auto; height: auto; padding: 8px 12px 8px 8px; }
  .nav-profile-label { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
  .btn-login { margin-left: 0; text-align: center; }
  .lang-switch { margin: 6px 0 2px; }
  .lang-switch-group { width: 100%; }
  .lang-btn { flex: 1; padding: 9px 11px; }
  /* critical:end */
}

@media (max-width: 720px) {
  /* critical:start */
  section { padding: 60px 0; }
  /* critical:end */
  .legal-table { grid-template-columns: 1fr; }
  .legal-table dd { border-top: none; padding-top: 0; }
  /* critical:start */
  .hero { padding: 60px 0 48px; }
  /* critical:end */
  .about-card { grid-template-columns: 1fr; text-align: center; }
  .about-card .avatar { margin: 0 auto; }
  .footer-top { grid-template-columns: 1fr; gap: 26px; }
  .skill-row { grid-template-columns: 104px 1fr 36px; }
  .modal-body { padding: 26px 22px; }

  /* 検索は 1 行いっぱいに。右に中途半端な余りが出ないようにする */
  /* critical:start */
  .search-box { max-width: none; }
  /* critical:end */

  /* iOS は 16px 未満の入力欄にフォーカスすると画面を勝手に拡大する。
     拡大されるとレイアウトが崩れて見えるので、入力欄だけ 16px に上げる */
  .search-box input,
  .newsletter-form input,
  .auth-card input,
  .auth-card textarea,
  .contact-form input,
  .contact-form select,
  .contact-form textarea,
  .review-request input, .review-request textarea,
  .runner textarea, .runner-out .runner-in { font-size: 16px; }
}

/* ------------------------------------------------------------
   スマートフォン。ここから先はガターを詰め、
   横並びのままだと窮屈になる箇所を縦に積み直す。
   ------------------------------------------------------------ */
@media (max-width: 560px) {
  /* critical:start */
  :root { --gutter: 18px; }

  /* 下限が大きすぎると、見出しの最後の 1〜2 文字だけが次の行に落ちる */
  h1 { font-size: clamp(1.75rem, 7.4vw, 2.4rem); }
  h2 { font-size: clamp(1.35rem, 5.6vw, 1.9rem); }

  section { padding: 52px 0; }
  .hero { padding: 44px 0 40px; }
  .page-hero { padding: 44px 0 28px; }
  .page-hero .badge { padding: 5px 14px; font-size: 0.72rem; margin-bottom: 14px; }
  .hero-ctas { flex-direction: column; align-items: stretch; margin-bottom: 34px; }
  .hero-ctas .btn { width: 100%; white-space: normal; }
  /* critical:end */

  /* 3 つなど奇数個のとき、2 列だと最後に空きマスができる。
     最後の 1 つを横いっぱいに伸ばして穴を埋める */
  .stats-row > .stat:nth-child(odd):last-child { grid-column: 1 / -1; }

  /* 余白の大きいカードは、狭い画面では中身が入らなくなるので詰める */
  .membership-teaser { padding: 36px 20px; }
  .newsletter-box { padding: 32px 20px; }
  .paywall { padding: 32px 20px; margin: 24px 0; }
  .empty-state { padding: 44px 18px; }
  .price-card { padding: 22px 20px; }
  .feature, .flow-card, .staff-card { padding: 20px; }
  .course-card { padding: 18px; }
  .about-card { padding: 24px 20px; }
  .quiz { padding: 20px 18px; margin: 22px 0; }
  .task { padding: 18px 16px; margin: 22px 0; }
  .steps ol li { padding: 10px 14px 10px 42px; }
  .steps ol li::before { left: 12px; top: 10px; }
  .auth-card { padding: 26px 20px; }
  .modal { padding: 14px; }
  .modal-body { padding: 24px 18px; }

  /* コース概要のレッスン一覧。
     番号・タイトル・バッジを 1 行に並べるとタイトルが 2〜3 行に折れて
     読めなくなるので、1 行目に番号とバッジ、2 行目に本文を置く */
  .lesson-list { max-width: none; }
  .lesson-row { flex-wrap: wrap; gap: 10px; padding: 16px 2px; }
  .lesson-row .lesson-num { width: 28px; height: 28px; font-size: 0.72rem; }
  .lesson-row .badge { margin-left: auto; }
  .lesson-row .lesson-meta { flex: 1 0 100%; order: 3; }
  .lesson-row .btn { order: 3; }

  .chapter-label { margin-top: 36px; }

  /* 前後リンクは横並びのままだとタイトルが画面からはみ出す */
  .lesson-nav { flex-direction: column; margin-top: 34px; }
  .lesson-nav .btn { width: 100%; white-space: normal; }

  /* critical:start */
  .article-layout { padding-bottom: 60px; }
  .lesson-layout { padding: 28px var(--gutter) 60px; }
  .lesson-content h2 { margin-top: 30px; }
  .article-body h2 { margin-top: 32px; }
  /* critical:end */

  .codeblock, .runner textarea { padding: 14px; font-size: 0.8rem; }
  .codeblock-wrap > .codeblock { padding-top: 44px; }
  .codeblock-wrap > .copy-btn { top: 8px; right: 8px; }
  .runner-head, .runner-bar { padding: 10px 14px; }

  /* critical:start */
  .toolbar { gap: 10px; margin-bottom: 18px; }
  /* critical:end */
  .article-footer { margin-top: 34px; }
  .author-box { grid-template-columns: 1fr; gap: 12px; }
  .site-footer { padding: 44px 0 28px; }
}

/* 目次は縦に長いので、狭い画面では本文の前に全部並べない。
   枠の中で送れる高さに収めて、本文をすぐ読み始められるようにする */
@media (max-width: 900px) {
  /* critical:start */
  .lesson-sidebar, .article-toc {
    max-height: 300px; overflow-y: auto;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px 14px;
  }
  .lesson-sidebar h4, .article-toc h4 { margin-bottom: 10px; }
  .lesson-sidebar ol { margin: 0; }
  /* critical:end */
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; }
  html { scroll-behavior: auto; }
  .column-card:hover, .staff-card:hover { transform: none; }
}

/* ==========================================================================
   Django 化に伴う追加分
   旧実装では HTML に直接書いていたインラインスタイルと、
   フォームで包む必要が出た箇所のためのルール。
   ========================================================================== */

/* レイアウトの flex/grid 子要素をフォームで包んでも崩れないようにする */
form.contents { display: contents; }

/* コース概要の章見出し（旧 CH_LABEL_STYLE / CH_LEAD_STYLE） */
.chapter-label {
  max-width: 760px; margin: 52px auto 6px;
  font-family: var(--mono); font-size: 0.72rem;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted-2);
}
.chapter-label {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
}
.chapter-progress { flex-shrink: 0; letter-spacing: 0.04em; color: var(--muted); }
.chapter-progress.is-complete { color: var(--mint); }
.chapter-lead {
  max-width: 760px; margin: 0 auto 14px;
  color: var(--muted); font-size: 0.86rem;
}

/* レッスンのサイドバー、章でまとめる表示（旧 SIDE_CH_STYLE / SIDE_SUB_STYLE） */
/* critical:start */
.side-chapter {
  display: block; padding: 10px 12px 4px;
  font-family: var(--mono); font-size: 0.68rem;
  letter-spacing: 0.12em; color: var(--muted-2);
}
.side-sub { margin-left: 6px; padding-left: 6px; border-left: 1px solid var(--border-soft); }
/* critical:end */

/* プラン限定レッスンの案内 */
.paywall {
  margin: 32px 0; padding: 44px 28px; text-align: center;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.paywall-icon { font-size: 2.6rem; margin-bottom: 12px; }
/* レッスンの読み上げ音声（本文の上） */
.lesson-audio {
  margin: 14px 0 22px; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: var(--radius);
}
.lesson-audio-label { margin: 0 0 8px; font-size: 0.85rem; color: var(--muted); font-weight: 600; }
.lesson-audio audio { display: block; width: 100%; }
/* 再生速度のボタン（#376）。スマホ幅でも 5 つが折り返して収まるようにする */
.audio-speed { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
.audio-speed[hidden] { display: none; }
.audio-speed-label { font-size: 0.8rem; color: var(--muted); font-weight: 600; margin-right: 2px; }
.audio-speed-btn {
  min-width: 48px; min-height: 36px; padding: 4px 10px; font: inherit; font-size: 0.82rem;
  color: var(--muted); background: none; border: 1px solid var(--border); border-radius: var(--radius);
  cursor: pointer;
}
.audio-speed-btn:hover { color: var(--text); border-color: var(--border-2); }
.audio-speed-btn[aria-pressed="true"] { background: var(--text-2); border-color: var(--text-2); color: var(--ink); }
.audio-speed-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
/* 英訳がそろっていないページの断り書き（#128） */
.translation-note {
  margin: 12px auto 0; max-width: 640px; font-size: 0.82rem; color: var(--gold);
  border: 1px solid rgba(224, 175, 104, 0.32); border-radius: var(--radius); padding: 8px 12px;
}
/* 修了した人の感想（#439） */
.course-reviews { margin-top: 44px; }
.review-average { font-weight: 600; color: var(--text-2); }
.review-stars-label, .review-head span { color: var(--gold); letter-spacing: 1px; }
.review { margin: 14px 0; padding: 12px 16px; border-left: 3px solid var(--border); }
.review p { margin: 0; }
.review-head { margin-bottom: 4px !important; font-size: 0.86rem; color: var(--muted); }
.review-form { margin-top: 20px; display: grid; gap: 10px; max-width: 640px; }
.review-form h3 { margin: 0; font-size: 1rem; }
.review-stars { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 12px; }
.review-stars legend { font-size: 0.86rem; margin-bottom: 4px; }
.review-body { display: grid; gap: 4px; font-size: 0.86rem; }
.review-body textarea { width: 100%; }
.review-name { font-size: 0.86rem; }

/* ダッシュボードの「送った報告」（#436） */
.dash-report { padding: 10px 0; border-bottom: 1px solid var(--border); }
.dash-report:last-of-type { border-bottom: 0; }
.dash-report-head { margin: 0 0 4px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.dash-report-head a { overflow-wrap: anywhere; }
.dash-report-note { margin: 6px 0 0; font-size: 0.88rem; color: var(--text-2); }

/* コースのつながり（#434）: 先に読むとよいコースと、修了後に勧める次のコース */
.course-prereq { margin: 16px auto 0; max-width: 640px; font-size: 0.86rem; color: var(--muted); }
.course-prereq-label { display: block; font-weight: 600; margin-bottom: 6px; }
.course-prereq ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; }
.course-prereq .badge { margin-left: 4px; }
.next-courses {
  margin: 20px auto 0; max-width: 640px; text-align: left;
  border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px;
}
.next-courses-title { margin: 0 0 10px; font-weight: 600; color: var(--text-2); }
.next-courses ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.next-courses a { display: block; padding: 8px 10px; border-radius: var(--radius); text-decoration: none; }
.next-courses a:hover { background: var(--surface-3); }
.next-courses strong { display: block; }
.next-courses span { display: block; font-size: 0.82rem; color: var(--muted); }

/* 第 1 回の見本（#433）。本文の上に断り書き、最後に登録への案内 */
.sample-note {
  margin: 12px 0 0; font-size: 0.82rem; color: var(--muted);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 12px;
}
.sample-cta { margin-top: 32px; }
/* 新着のページ（#440） */
.new-kinds { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 18px; }
.new-list { list-style: none; padding: 0; margin: 0 auto; max-width: 760px; }
.new-item { padding: 16px 0; border-bottom: 1px solid var(--border); }
.new-meta { margin: 0 0 6px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 0.82rem; color: var(--muted); }
.new-item h3 { margin: 0 0 4px; font-size: 1.05rem; }
.new-summary { margin: 0; font-size: 0.88rem; color: var(--muted); }
/* 理解度チェックの穴埋め・並べ替え（#441） */
.quiz-fill { display: grid; gap: 6px; margin: 10px 0 14px; font-size: 0.86rem; color: var(--muted); max-width: 420px; }
.quiz-fill input { font-family: var(--mono, ui-monospace, monospace); font-size: 0.95rem; }
.quiz-hint { font-size: 0.82rem; color: var(--muted); }
.quiz-order { list-style: decimal; padding-left: 1.6em; margin: 10px 0 14px; display: grid; gap: 6px; }
.quiz-order li {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 8px;
}
.quiz-order li:focus { outline: 2px solid var(--primary, currentColor); outline-offset: 2px; }
.quiz-order code { overflow-wrap: anywhere; white-space: pre-wrap; }
.quiz-order-moves { display: flex; gap: 4px; flex-shrink: 0; }
/* SQL のエディタのテーブルと列（#442） */
.runner-schema { border-top: 1px solid var(--border); padding: 8px 12px; font-size: 0.82rem; }
.runner-schema summary { cursor: pointer; color: var(--muted); font-weight: 600; }
.runner-schema-body { display: flex; flex-wrap: wrap; gap: 10px 18px; margin-top: 8px; }
.runner-schema-empty { margin: 0; color: var(--muted); }
.runner-schema-table ul { list-style: none; margin: 4px 0 0; padding: 0 0 0 10px; }
.runner-schema button {
  background: none; border: 0; padding: 2px 0; color: var(--text-2); cursor: pointer;
  font-family: var(--mono); font-size: 0.82rem; text-align: left;
}
.runner-schema button:hover, .runner-schema button:focus-visible { color: var(--primary); text-decoration: underline; }
.runner-schema-name { font-weight: 700; }
.runner-schema-type { color: var(--muted); font-family: var(--mono); font-size: 0.75rem; }
/* 章のまとめ問題（#443） */
.chapter-review { max-width: 760px; }
.chapter-review-list { padding-left: 1.4em; display: grid; gap: 18px; }
.chapter-review-q fieldset { border: 0; padding: 0; margin: 0; }
.chapter-review-q legend { font-weight: 600; margin-bottom: 6px; }
.chapter-review-q.is-ok { border-left: 3px solid var(--green, #9ece6a); padding-left: 12px; }
.chapter-review-q.is-ng { border-left: 3px solid var(--red, #f7768e); padding-left: 12px; }
.chapter-review-mark { font-size: 0.86rem; color: var(--muted); }
.chapter-review-score { font-size: 1.3rem; font-weight: 700; color: var(--text-2); }
.chapter-review-link { margin: 4px 0 10px; font-size: 0.86rem; }
/* エディタのキーボードでの使い方（#444） */
.runner-help { margin: 0; padding: 4px 16px 6px; font-size: 0.75rem; color: var(--muted); background: var(--surface-2); }
@media (max-width: 600px) { .runner-help { display: none; } }
/* 学習の予定（#445） */
/* 学習の予定とカレンダー（#445）。閉じていても 1 枚の札に見え、開くと下にカードが続く */
.plan-panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  transition: border-color 0.18s ease;
}
.plan-panel:hover, .plan-panel[open] { border-color: var(--border-2); }
.plan-summary {
  display: flex; align-items: center; gap: 16px; padding: 22px 28px;
  cursor: pointer; list-style: none;
}
.plan-summary::-webkit-details-marker { display: none; }
.plan-summary::after {
  content: ""; width: 8px; height: 8px; margin-left: 4px; flex: none;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg) translateY(-3px); transition: transform 0.18s ease;
}
.plan-panel[open] > .plan-summary::after { transform: rotate(-135deg) translateY(-3px); }
.plan-summary:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; border-radius: var(--radius); }
.plan-summary-icon {
  display: grid; place-items: center; flex: none; width: 44px; height: 44px;
  border-radius: var(--radius-sm); background: var(--surface-2); font-size: 1.3rem;
}
.plan-summary-body { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.plan-summary-body b { color: var(--text); font-size: 0.98rem; }
.plan-summary-note { color: var(--muted); font-size: 0.85rem; }
.plan-summary .badge { flex: none; }

.plan-card { border-top: 1px solid var(--border-soft); padding: 28px; display: grid; gap: 28px; }
.plan-form { display: grid; gap: 24px; }
.plan-field { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.plan-label { font-size: 0.82rem; font-weight: 700; color: var(--text-2); padding: 0; }
.plan-days { display: flex; flex-wrap: wrap; gap: 8px; }
.plan-day { position: relative; }
.plan-day input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.plan-day span {
  display: grid; place-items: center; min-width: 48px; height: 44px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2);
  color: var(--text-2); font-size: 0.88rem; font-weight: 700; cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.plan-day span:hover { border-color: var(--border-2); color: var(--text); }
.plan-day input:checked + span { background: var(--primary); border-color: var(--primary); color: var(--ink); }
.plan-day input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.plan-presets { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.plan-presets-label { color: var(--muted); font-size: 0.8rem; margin-right: 4px; }
.plan-presets[hidden] { display: none; }
.plan-row { display: flex; flex-wrap: wrap; gap: 20px 24px; }
.plan-input {
  min-width: 9em; padding: 10px 14px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); font-size: 0.95rem; font-family: var(--mono);
}
.plan-input:focus { outline: none; border-color: var(--primary); }
.plan-submit { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.plan-step { display: grid; gap: 14px; padding-top: 28px; border-top: 1px solid var(--border-soft); }
.plan-heading { font-size: 1rem; }
.plan-add { display: flex; flex-wrap: wrap; gap: 10px; }
.plan-url { display: flex; gap: 8px; }
.study-plan-url {
  flex: 1; min-width: 0; padding: 9px 12px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-2); font-family: var(--mono); font-size: 0.8rem;
}
.plan-manage { gap: 10px; }
.plan-manage .dash-lead { font-size: 0.82rem; }
.plan-manage-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.plan-delete:hover { color: var(--danger); border-color: var(--danger); }

@media (max-width: 560px) {
  .plan-summary { padding: 18px 20px; gap: 12px; }
  .plan-summary-icon { width: 38px; height: 38px; font-size: 1.1rem; }
  .plan-summary .badge { display: none; }
  .plan-card { padding: 22px 20px; gap: 24px; }
  .plan-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
  .plan-day span { min-width: 0; padding: 0; }
  .plan-row > .plan-field { flex: 1 1 120px; }
  .plan-input { min-width: 0; width: 100%; }
  .plan-add .btn { flex: 1 1 100%; white-space: normal; }
  .plan-url { flex-direction: column; }
}
/* スキルチェックの結果（#446） */
.skillcheck-save { text-align: center; margin: 24px 0 0; }
.skillcheck-mini { list-style: none; padding: 0; margin: 8px 0 14px; display: grid; gap: 8px; }
.skillcheck-mini li { display: grid; grid-template-columns: minmax(8em, 14em) 1fr 3.5em; align-items: center; gap: 10px; font-size: 0.86rem; }
.skillcheck-mini .progress-track { display: block; }
.skillcheck-mini .progress-fill { display: block; }
@media (max-width: 600px) { .skillcheck-mini li { grid-template-columns: 1fr 3.5em; } .skillcheck-mini .progress-track { grid-column: 1 / -1; grid-row: 2; } }
/* ダッシュボードの「お問い合わせ」（#450） */
.dash-inquiry { padding: 10px 0; border-bottom: 1px solid var(--border); }
.dash-inquiry summary { cursor: pointer; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.dash-inquiry-body { margin: 10px 0 0; color: var(--muted); font-size: 0.88rem; overflow-wrap: anywhere; }
.dash-inquiry-reply { margin: 10px 0 0 12px; padding-left: 12px; border-left: 3px solid var(--border); font-size: 0.88rem; overflow-wrap: anywhere; }
.paywall h2 { font-size: 1.1rem; margin-bottom: 10px; }
.paywall p { color: var(--muted); font-size: 0.9rem; max-width: 460px; margin: 0 auto; }
/* 読めないレッスン: 本人の進捗と、申し込めばいくつ読めるか */
.paywall-progress { max-width: 360px; margin: 18px auto 0; text-align: left; }
.paywall .paywall-unlocks { margin-top: 14px; color: var(--text-2); font-weight: 600; }
.paywall-cta { display: flex; flex-direction: column; gap: 10px; max-width: 320px; margin: 18px auto 0; }
.paywall-cta form { display: block; }
.paywall .plan-trial { color: var(--gold); font-size: 0.8rem; }

/* ============================================================
   ログイン・登録（allauth）
   allauth のページは container を持たないので、余白はここで作る。
   ページごとの template ではなく allauth/elements/* を上書きして
   いるので、見た目の指定はここに集約されている。
   ============================================================ */
.auth-title {
  font-size: 1.5rem; text-align: center; margin: 0 0 8px;
  padding-top: 56px;
}
/* allauth のページ本体は body 直下に出るので、左右と下の余白をここで足す */
/* body は縦の flex なので、width を付けないと中身の幅まで縮む */
.auth-card {
  width: 100%; max-width: min(420px, calc(100% - 32px));
  margin-bottom: 16px;
}
.auth-card textarea {
  width: 100%; padding: 11px 14px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); font-family: var(--mono); font-size: 0.9rem;
  line-height: 1.7; letter-spacing: 0.08em; resize: none;
}
.auth-card textarea:focus { outline: none; border-color: var(--primary); }
/* 二段階認証の設定画面（allauth/elements/panel.html） */
.auth-panel .auth-lead { margin-bottom: 0; }
.auth-panel-title { font-size: 1rem; text-align: center; margin-bottom: 8px; }
/* body が縦の flex なので、ボタンの列や罫線も width を付けないと中身の幅まで縮む */
.auth-providers, .auth-actions-stack, .auth-hr, .auth-or { width: 100%; }
.auth-providers, .auth-actions-stack, .auth-lead, .auth-hr, .auth-or {
  max-width: min(420px, calc(100% - 32px));
}
.auth-subtitle {
  font-size: 0.86rem; font-weight: 700; color: var(--muted);
  text-align: center; margin: 22px 0 12px;
}
.auth-lead {
  font-size: 0.86rem; color: var(--muted); text-align: center;
  line-height: 1.8; margin: 0 auto 20px;
}
.auth-lead a { color: var(--primary); }
.auth-hr {
  border: none; border-top: 1px dashed var(--border);
  margin: 22px auto;
}
.auth-actions { margin-top: 20px; display: flex; gap: 10px; flex-wrap: wrap; }
.auth-actions > * { flex: 1; }
.auth-actions-stack {
  flex-direction: column; margin: 0 auto;
}
.auth-help {
  display: block; font-size: 0.76rem; color: var(--muted-2); margin-top: 6px;
}
.auth-check { display: flex; align-items: center; gap: 8px; margin-top: 16px; }
.auth-check label { margin: 0; }
.auth-check input { width: auto; }
.auth-card ul, .auth-card ol { font-size: 0.86rem; color: var(--muted); line-height: 1.9; }
/* allauth のページは中身が body 直下に並ぶので、最後の 1 つとフッターのあいだが詰まる
   （ログインの「ログインできないときは…」など）。見出しの上の余白（56px）と揃える */
:is(.auth-card, .auth-lead, .auth-providers, .auth-actions-stack, .auth-hr, .auth-or) + .site-footer {
  margin-top: 36px;
}
.auth-card p { font-size: 0.88rem; line-height: 1.8; }

/* SNS のボタン。メールアドレスの欄の下に置く（socialaccount/snippets/login.html） */
.auth-providers {
  display: flex; flex-direction: column; gap: 10px;
  margin: 8px auto 0;
}
/* メールアドレスの欄と SNS の間の「または」 */
.auth-or {
  display: flex; align-items: center; gap: 12px;
  margin: 22px auto; font-size: 0.78rem; color: var(--muted-2);
}
.auth-or::before, .auth-or::after {
  content: ""; flex: 1; border-top: 1px dashed var(--border);
}
/* ボタンのすぐ下に文が続くとき（登録の「利用規約に同意…」）に詰まらないように */
.auth-providers + .auth-lead { margin-top: 22px; }
.auth-provider {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding-top: 13px; padding-bottom: 13px;
}
.auth-provider-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--surface-3); font-size: 0.72rem; font-weight: 800;
}
.auth-provider-google:hover  { border-color: #4285f4; }
.auth-provider-github:hover  { border-color: var(--text-2); }
.auth-provider-line:hover    { border-color: #06c755; }
.auth-provider-twitter_oauth2:hover { border-color: var(--text-hi); }

/* ダッシュボードのプラン表示 */
.plan-note {
  display: inline-block; margin-left: 8px;
  font-size: 0.78rem; color: var(--muted);
}

/* ============================================================
   ダッシュボード
   余白は 3 段だけ使う。セクションの間 56px / 見出しと中身 20px / カードの内側 28px。
   カード同士の間はどこでも 20px。
   ============================================================ */
.dash-hero { padding-bottom: 48px; }
.dash-plan {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: 8px; margin-top: 24px;
}
.dash-plan .plan-note { margin-left: 0; }
.dash-alert { max-width: 560px; margin: 20px auto 0; text-align: left; }
.dash-sync {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: 10px 12px; margin-top: 16px;
  font-size: 0.82rem; color: var(--muted);
}

.dash-section { padding: 56px 0; }
.dash-title { font-size: 1.3rem; margin-bottom: 20px; }
.dash-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px;
}
.dash-stack { display: grid; gap: 20px; }
.dash-lead { color: var(--muted); font-size: 0.9rem; line-height: 1.8; }
.dash-lead + .dash-lead { margin-top: 12px; }
.dash-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 20px; }

/* メールの設定（#328） */
.mail-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; justify-items: start; margin-bottom: 14px; }
.mail-option { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; }
.mail-option input { margin-top: 5px; flex: none; }
.mail-option b { display: block; margin-bottom: 4px; }
/* メールの言語（#389）。select の見た目はお問い合わせのフォームに合わせる */
.mail-language { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; width: 100%; }
.mail-language select {
  justify-self: start; max-width: 100%; padding: 9px 38px 9px 14px; border-radius: var(--radius-sm);
  background-color: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); font-family: inherit; font-size: 0.9rem;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 19px) 50%, calc(100% - 14px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.mail-language select:focus { outline: none; border-color: var(--primary); }

/* 連続日数と週の目標（#327）。目標が無い人には一行だけ、控えめに */
.dash-study { padding: 32px 0; }
.study-card { display: grid; gap: 14px; }
.study-count { font-weight: 700; }
.study-count .dash-lead { font-weight: 400; margin-left: 6px; }
.study-quiet { color: var(--text-2); font-size: 0.9rem; margin-bottom: 8px; }
.study-invite { color: var(--muted); font-size: 0.85rem; }
.study-invite summary { cursor: pointer; width: fit-content; }
.goal-form { display: flex; flex-wrap: wrap; align-items: end; gap: 10px 12px; margin-top: 10px; }
.goal-form label { display: flex; flex-direction: column; gap: 4px; font-size: 0.82rem; color: var(--muted); }
.goal-form input {
  width: 6em; padding: 9px 14px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); font-size: 0.9rem;
}
.goal-form input:focus { outline: none; border-color: var(--primary); }

/* 解約の手前（#120）。理由は任意、選択肢は横に並べて狭い画面では縦に積む */
.cancel-form { display: flex; flex-direction: column; gap: 20px; }
.cancel-reasons { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.cancel-reasons legend { font-weight: 700; margin-bottom: 10px; }
.cancel-reasons label { font-size: 0.9rem; color: var(--text-2); }
.cancel-comment { display: flex; flex-direction: column; gap: 6px; font-size: 0.85rem; color: var(--muted); }
.cancel-comment textarea { width: 100%; }
.cancel-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 16px; }
.cancel-option { display: flex; flex-direction: column; gap: 10px; border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.cancel-option h2 { font-size: 1rem; }
.cancel-option .dash-lead { flex: 1; }

/* 退会（#323）。入口はダッシュボードの下に小さく置き、押し間違えにくくする */
/* 会社のドメインで参加（#455） */
.org-domains { list-style: none; margin: 12px 0; padding: 0; }
.org-domains li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; padding: 8px 0; border-top: 1px solid var(--border); overflow-wrap: anywhere; }
.org-domains li:first-child { border-top: 0; }
.org-request-actions { display: flex; gap: 6px; }
.org-domain-add { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.org-domain-add input { flex: 1 1 14rem; min-width: 0; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text); font-family: var(--mono); }
.org-subtitle { margin: 18px 0 4px; font-size: 1rem; }
.org-offer + .org-offer { margin-top: 16px; }

/* レッスンごとの質問と回答（#454） */
.qa { margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--border); scroll-margin-top: 90px; }
.qa-question { margin: 18px 0; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); scroll-margin-top: 90px; }
.qa-question h3 { margin: 0 0 4px; font-size: 1rem; overflow-wrap: anywhere; }
.qa-meta { margin: 0 0 8px; font-size: 0.8rem; }
.qa-body { overflow-wrap: anywhere; }
.qa-body p { margin: 0 0 8px; }
.qa-answer { margin: 12px 0 0 12px; padding: 10px 0 0 12px; border-left: 2px solid var(--border); scroll-margin-top: 90px; }
.qa-answer.is-solution { border-left-color: var(--mint); }
.is-hidden { opacity: 0.55; }
.qa-actions form { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 0; }
.qa-reply, .qa-ask { margin-top: 10px; }
.qa-reply textarea, .qa-ask textarea, .qa-ask input[type="text"] {
  display: block; width: 100%; margin: 6px 0 8px; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text); font: inherit;
}
.qa-ask label { display: block; margin-top: 8px; }

/* 一緒に学ぶ仲間（#453） */
.buddy { padding: 12px 0; border-bottom: 1px solid var(--border); }
.buddy-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.buddy-head form { margin-left: auto; }
.buddy-course { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; margin: 4px 0 0; overflow-wrap: anywhere; }
.buddy-invite { display: grid; grid-template-columns: minmax(0, 1fr); align-items: center; gap: 6px 10px; margin-top: 16px; }
@media (min-width: 560px) { .buddy-invite { grid-template-columns: minmax(0, 1fr) auto; } }
.buddy-invite label { grid-column: 1 / -1; }
.buddy-invite input { width: 100%; min-width: 0; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text); font-family: var(--mono); font-size: 0.8rem; }

/* 学びの節目のバッジ（#452） */
.badge-shelf { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 10px; }
.badge-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); min-width: 0; }
.badge-item > span:last-child { display: grid; min-width: 0; overflow-wrap: anywhere; }
.badge-item .dash-lead { font-size: 0.8rem; }
.badge-icon { font-size: 1.6rem; line-height: 1; flex: none; }
.badge-item.is-new { border-color: var(--primary); }
.badge-item.is-locked { opacity: 0.5; }
.badge-item.is-locked .badge-icon { filter: grayscale(1); }

/* 端末に入れたレッスン（#451） */
.offline-save-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 10px 0 0; }
.offline-save-row[hidden], .offline-status:empty { display: none; }
.offline-items { list-style: none; margin: 8px 0 0; padding: 0; }
.offline-items li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.offline-items li:first-child { border-top: 0; }
.offline-items li .dash-lead { flex: 1 1 12rem; margin: 0; }

/* 本文の用語の印と、押したときの説明（#391） */
a.term { color: inherit; text-decoration: underline dotted; text-decoration-color: var(--primary); text-underline-offset: 3px; }
a.term[aria-expanded="true"] { background: var(--surface-2); border-radius: 3px; }
.term-pop {
  margin: 8px 0 16px; padding: 12px 16px; border: 1px solid var(--border); border-left: 3px solid var(--primary);
  border-radius: var(--radius-sm); background: var(--surface); font-size: 0.92rem; overflow-wrap: anywhere;
}
.term-pop p { margin: 4px 0 8px; }
.term-pop a { display: block; margin-top: 4px; font-size: 0.86rem; }

/* 用語集のページ（#391） */
.glossary-index { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 18px; }
.glossary-index a { min-width: 36px; padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); text-align: center; text-decoration: none; }
.glossary-row { margin: 32px 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--border); font-size: 1.1rem; scroll-margin-top: 90px; }
.glossary-list { margin: 0; }
.glossary-item { padding: 12px 0; border-bottom: 1px solid var(--border-soft); scroll-margin-top: 90px; }
.glossary-item:target { background: var(--surface-2); border-radius: var(--radius-sm); padding-inline: 10px; }
.glossary-item dt { font-weight: 700; }
.glossary-reading { margin-left: 6px; color: var(--muted); font-size: 0.8rem; font-weight: 400; }
.glossary-item dd { margin: 4px 0 0; overflow-wrap: anywhere; }
.glossary-item dd p { margin: 0; }
.glossary-first { margin-top: 4px !important; font-size: 0.86rem; }

/* テックニュース（#560）。一覧と号のページ。読む段は本文と同じ幅に絞る */
.news { max-width: var(--read-measure); }
.news-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.news-list-item a {
  display: block; padding: 18px 20px; text-decoration: none; color: inherit;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.news-list-item a:hover, .news-list-item a:focus-visible { border-color: var(--primary); }
.news-list-meta { display: block; margin: 0 0 6px; font-size: 0.82rem; color: var(--muted); }
.news-list-meta a { color: inherit; }
.news-list-title { display: block; font-weight: 700; font-size: 1.05rem; line-height: 1.5; }
.news-list-intro { display: block; margin-top: 6px; color: var(--text-2); font-size: 0.92rem; line-height: 1.7; }
.news-badge {
  display: inline-block; padding: 1px 8px; border-radius: 999px;
  border: 1px solid var(--gold); color: var(--gold); font-size: 0.75rem; font-weight: 600;
}
.news-category { margin: 32px 0 4px; padding-bottom: 6px; border-bottom: 1px solid var(--border); font-size: 1.1rem; }
.news-category:first-child { margin-top: 0; }
.news-entry { padding: 16px 0; border-bottom: 1px solid var(--border); }
.news-entry h3 { margin: 0 0 6px; font-size: 1rem; line-height: 1.6; }
.news-entry p { margin: 0; line-height: 1.8; }
.news-entry .news-entry-source { margin-top: 6px; font-size: 0.8rem; color: var(--muted); overflow-wrap: anywhere; }
.news-pager { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 32px; }

/* チーム開発（#396） */
.team-card + .team-card { margin-top: 16px; }
.team-name { margin: 0 0 12px; font-size: 1.1rem; }
.team-waiting { margin: 0 0 12px; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--surface-2); }
.team-facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 16px; margin: 0; }
.team-facts dt { color: var(--muted); font-size: 0.85rem; }
.team-facts dd { margin: 0; overflow-wrap: anywhere; }
.team-goal { display: block; margin-top: 4px; color: var(--muted); font-size: 0.9rem; }
.team-members { list-style: none; margin: 0; padding: 0; }
.team-note { margin-top: 14px; }
@media (max-width: 480px) {
  .team-facts { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .team-facts dd { margin-bottom: 8px; }
}

/* 個別質問への入口（#395） */
.question-link { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 16px 0 0; }
.question-link .dash-lead { margin: 0; }
.question-about { overflow-wrap: anywhere; }

/* Discord のつなぎ（#385） */
.discord-link { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.discord-link p { margin: 0 auto 10px; }

/* ラボの動作確認（#405） */
.lab-check { scroll-margin-top: 90px; }
.lab-check-result { margin: 12px 0; padding: 12px 16px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-2); }
.lab-check-result.ok { border-color: var(--mint); color: var(--mint); }
.lab-check-result.ng { border-color: var(--danger); }
.lab-check-result p { margin: 0 0 8px; }
.lab-check-result ul { margin: 0; padding-left: 1.2em; }

/* ログイン中の端末（#384） */
.session-list { list-style: none; margin: 16px 0 0; padding: 0; }
.session-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.session-row:first-child { border-top: 0; }
.session-info { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; }
.session-info .dash-lead { flex-basis: 100%; margin: 0; overflow-wrap: anywhere; }
.dash-delete { margin-top: 18px; font-size: 0.8rem; }
.dash-delete a { color: var(--muted); }
.dash-delete a:hover { color: var(--danger); }
.delete-card h2 { font-size: 1rem; margin-bottom: 10px; }
.delete-blocked {
  border: 1px solid rgba(224, 175, 104, 0.4); background: rgba(224, 175, 104, 0.08);
  border-radius: var(--radius-sm); padding: 16px 18px; margin-bottom: 22px;
}
.delete-blocked p { color: var(--text-2); font-size: 0.88rem; margin-bottom: 12px; }
.delete-list { margin: 0 0 4px 1.2em; display: flex; flex-direction: column; gap: 6px; color: var(--text-2); font-size: 0.88rem; line-height: 1.7; }
.delete-form { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; margin-top: 24px; padding-top: 22px; border-top: 1px solid var(--border); }
.delete-confirm { display: flex; gap: 8px; align-items: center; font-size: 0.9rem; cursor: pointer; }
.delete-confirm input { accent-color: var(--danger); }
.delete-note { font-size: 0.78rem; color: var(--muted); }
.delete-warn, .delete-error { font-size: 0.86rem; font-weight: 700; }
.delete-warn { color: var(--gold); }
.delete-error { color: var(--danger); }
.delete-back { margin-top: 18px; font-size: 0.85rem; }
.delete-back a { color: var(--muted); }
.btn-danger { background: var(--danger); color: var(--ink, #1a1b26); border: 1px solid var(--danger); }
.btn-danger:hover { filter: brightness(1.08); }
.certificate-withdrawn { text-align: center; font-family: var(--cert-serif); color: var(--cert-ink-2); font-size: max(0.85rem, 1.5cqi); margin: 8px 0 4px; }

/* 友だち紹介（#125） */
.referral-card { display: flex; flex-direction: column; gap: 14px; }
.referral-field { display: flex; flex-direction: column; gap: 6px; font-size: 0.82rem; color: var(--muted); }
.referral-field input { width: 100%; font-family: var(--mono); }

/* コースカードはボタンの位置をそろえる。説明文の長さが違ってもボタンは下端に */
.dash-courses { grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); gap: 24px; }
.dash-courses .feature { display: flex; flex-direction: column; padding: 32px 28px; }
.dash-courses .feature .icon { margin-bottom: 16px; }
.dash-courses .feature h3 { margin-bottom: 12px; }
.dash-courses .feature p { margin-bottom: 24px; }
.dash-courses .feature > .btn { margin-top: auto; align-self: flex-start; }
/* ボタンが複数あるカード（おすすめ）は、ボタンの行ごと下端へ */
.dash-courses .feature .dash-actions { margin-top: auto; }
/* カードの上の行き先（3 つの質問・ロードマップ・新着）。カードとのあいだを空ける */
.dash-links { display: flex; flex-wrap: wrap; gap: 10px; margin: -4px 0 28px; }

/* 紹介コードの箱もほかのカードと同じ見た目・左寄せにそろえる */
.dash-stack .coupon-box {
  margin-top: 0; padding: 28px; border-radius: var(--radius); text-align: left;
}
.dash-stack .coupon-form { margin: 16px 0 0; }
.dash-stack .coupon-box form:not(.coupon-form) { margin-top: 16px; }

@media (max-width: 560px) {
  .dash-hero { padding-bottom: 36px; }
  .dash-section { padding: 40px 0; }
  .dash-card,
  .dash-courses .feature,
  .dash-stack .coupon-box { padding: 24px 20px; }
  .dash-courses { gap: 16px; }
  .dash-links { flex-direction: column; align-items: stretch; }
  .dash-links .btn { white-space: normal; }
}

/* ============================================================
   紹介コード
   ============================================================ */
.coupon-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px 22px; margin-top: 22px;
  text-align: center;
}
/* 単独セクションとして置くときは、上下の余白をページ共通のリズム（section の padding）に任せる。
   ダッシュボードのように他要素に続けて置く場合の margin-top はここでは邪魔になる。 */
.coupon-section .coupon-box { margin-top: 0; }
.coupon-box h3 { font-size: 0.98rem; margin-bottom: 6px; }
.coupon-form {
  display: flex; gap: 8px; margin: 14px auto 0; max-width: 380px; flex-wrap: wrap;
}
.coupon-form input {
  flex: 1; min-width: 180px; padding: 11px 14px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-family: inherit; font-size: 0.88rem; letter-spacing: 0.08em;
  text-transform: uppercase;
}
.coupon-form input::placeholder { color: var(--muted-2); letter-spacing: normal; }
.coupon-form input:focus { outline: none; border-color: var(--primary); }
.coupon-note { font-size: 0.8rem; color: var(--muted); margin-top: 12px; line-height: 1.7; }
.coupon-applied { margin-top: 10px; font-size: 0.86rem; color: var(--text-2); }
.coupon-applied .plan-pill { margin-right: 8px; }

/* ============================================================
   お問い合わせフォーム
   ============================================================ */
.contact-form-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 34px 32px;
  max-width: 720px; margin: 0 auto;
}
.contact-form-box .section-title { margin-bottom: 8px; }
/* 見出しと本文は箱の左端にそろえる。.section-lead の既定は中央寄せ＋幅 620px で、
   箱の中に置くと中途半端に寄って見える。 */
.contact-form-box .section-lead { max-width: none; margin: 0 0 24px; text-align: left; }
.contact-form { display: flex; flex-direction: column; gap: 18px; }
.contact-form .field { display: flex; flex-direction: column; gap: 6px; }
/* 2 つ並べる行。狭い画面では縦に積む */
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.contact-form label {
  font-size: 0.78rem; font-weight: 600; color: var(--muted);
}
.contact-form label .req {
  display: inline-block; margin-left: 8px; padding: 1px 7px;
  background: rgba(247, 118, 142, 0.14); color: var(--danger);
  border: 1px solid rgba(247, 118, 142, 0.3);
  border-radius: var(--radius-pill); font-size: 0.62rem; font-weight: 800;
  letter-spacing: 0.06em; vertical-align: 1px;
}
.contact-form input[type="text"],
.contact-form input[type="email"],
.contact-form input[type="tel"],
.contact-form input[type="datetime-local"],
.contact-form select,
.contact-form textarea {
  width: 100%; padding: 11px 14px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); font-family: inherit; font-size: 0.9rem; line-height: 1.7;
}
.contact-form textarea { resize: vertical; min-height: 150px; }
.contact-form ::placeholder { color: var(--muted-2); }
.contact-form input:focus,
.contact-form select:focus,
.contact-form textarea:focus { outline: none; border-color: var(--primary); }
/* select は OS 既定の下向き矢印が藍地に埋もれるので、自前で描く */
.contact-form select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 19px) 50%, calc(100% - 14px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 38px;
}
.contact-form .field-help { font-size: 0.74rem; color: var(--muted-2); line-height: 1.6; }
.contact-form .field-error { font-size: 0.78rem; color: var(--danger); font-weight: 600; }
.contact-form .field-check {
  flex-direction: row; align-items: center; flex-wrap: wrap; gap: 9px;
}
.contact-form .field-check input { width: auto; accent-color: var(--primary); }
.contact-form .field-check label { font-size: 0.84rem; color: var(--text-2); }
.contact-form .field-check .field-error { flex-basis: 100%; }
.contact-form button[type="submit"] { align-self: flex-start; }
.form-errors {
  background: rgba(247, 118, 142, 0.08);
  border: 1px solid rgba(247, 118, 142, 0.3);
  border-left: 2px solid var(--danger);
  border-radius: var(--radius-sm); padding: 14px 16px; margin-bottom: 22px;
}
.form-errors p { font-size: 0.84rem; color: var(--danger); font-weight: 600; }
/* ハニーポット。人には見せず、読み上げも aria-hidden で止めてある。
   display:none だと埋めない bot がいるので、画面の外へ追い出す。 */
.hp-field {
  position: absolute; left: -9999px; width: 1px; height: 1px;
  overflow: hidden;
}

/* 折り返しの基準はサイト共通の breakpoint に合わせる（ナビが畳まれるのと同じ幅）。
   2 列のままだと、日本語のラベルが入力欄より長くなって折れる。 */
@media (max-width: 720px) {
  .field-row { grid-template-columns: 1fr; }
  .contact-form button[type="submit"] { align-self: stretch; width: 100%; }
}
@media (max-width: 560px) {
  .contact-form-box { padding: 26px 20px; }
}

/* 種別カードの見出しは、その種別を選んだフォームへの入口。
   リンクだと分かるのは下線だけでよく、色まで変えると見出しに見えなくなる。 */
.feature h3 a { color: inherit; }
.feature h3 a:hover { color: var(--text-hi); text-decoration: underline; }

   修了証（#123）
   ============================================================ */
.certificate-wrap { padding: 48px 0 64px; }
/* 賞状の一枚。ダークでもライトでも、生成りの紙に墨の文字・金の罫で描く
   （画面で見たものと、印刷・PDF にしたものを同じにするため、テーマの色は使わない） */
.certificate {
  --cert-paper: #fdfaf2;
  --cert-ink: #1f1d26;
  --cert-ink-2: #4a4652;
  --cert-gold: #8a6a2f;
  --cert-gold-soft: #c9ad74;
  --cert-seal: #9a7533;
  --cert-serif: "Hiragino Mincho ProN", "Yu Mincho", YuMincho, "Noto Serif JP",
    "Times New Roman", serif;
  --logo-4: var(--cert-ink);
  --logo-rest: #6c3aad;
  max-width: 960px; margin: 0 auto; aspect-ratio: 297 / 210;
  background: var(--cert-paper); color: var(--cert-ink);
  padding: 18px; border-radius: 4px; box-shadow: var(--shadow-lg);
  container-type: inline-size;
}
.certificate-frame {
  position: relative; height: 100%;
  border: 2px solid var(--cert-gold); outline: 1px solid var(--cert-gold-soft); outline-offset: -8px;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  text-align: center; padding: 5cqi 7cqi 4cqi;
}
/* 背景の透かし。紙の真ん中に、証明書番号などを斜め 35 度で一行だけ薄く置く */
.certificate-watermark {
  position: absolute; inset: 0; overflow: hidden; pointer-events: none; user-select: none;
  display: grid; place-items: center;
}
.certificate-watermark p {
  white-space: nowrap; transform: rotate(-35deg);
  font-family: var(--mono); font-size: max(9px, 1.7cqi); font-weight: 600; letter-spacing: 0.08em;
  color: var(--cert-gold); opacity: 0.12;
}
.certificate-frame > :not(.certificate-watermark) { position: relative; z-index: 1; }
/* 四隅の飾り */
.certificate-frame::before, .certificate-frame::after {
  content: ""; position: absolute; inset: 14px; pointer-events: none;
  background:
    linear-gradient(var(--cert-gold), var(--cert-gold)) left top / 28px 2px,
    linear-gradient(var(--cert-gold), var(--cert-gold)) left top / 2px 28px,
    linear-gradient(var(--cert-gold), var(--cert-gold)) right top / 28px 2px,
    linear-gradient(var(--cert-gold), var(--cert-gold)) right top / 2px 28px,
    linear-gradient(var(--cert-gold), var(--cert-gold)) left bottom / 28px 2px,
    linear-gradient(var(--cert-gold), var(--cert-gold)) left bottom / 2px 28px,
    linear-gradient(var(--cert-gold), var(--cert-gold)) right bottom / 28px 2px,
    linear-gradient(var(--cert-gold), var(--cert-gold)) right bottom / 2px 28px;
  background-repeat: no-repeat;
}
.certificate-frame::after { inset: 20px; opacity: 0.45; }
.certificate-head { display: flex; flex-direction: column; align-items: center; gap: 1cqi; }
.certificate-logo .logo-wordmark { display: block; height: max(16px, 2.6cqi); width: auto; }
.certificate-logo .wm-4 { fill: var(--logo-4); }
.certificate-logo .wm-rest { fill: var(--logo-rest); }
.certificate-kicker {
  font-family: var(--cert-serif); font-size: max(0.7rem, 1.35cqi);
  letter-spacing: 0.32em; text-transform: uppercase; color: var(--cert-gold);
  margin-top: 1.2cqi;
}
.certificate-title {
  font-family: var(--cert-serif); font-weight: 600; color: var(--cert-ink);
  font-size: max(1.8rem, 5.6cqi); letter-spacing: 0.5em; margin-right: -0.5em; line-height: 1.1;
}
.certificate-name {
  font-family: var(--cert-serif); font-weight: 600;
  font-size: max(1.3rem, 3.4cqi); line-height: 1.3; color: var(--cert-ink);
  min-width: 50%; padding: 0 2cqi 0.8cqi; border-bottom: 1px solid var(--cert-gold-soft);
  overflow-wrap: anywhere;
}
.certificate-main { display: flex; flex-direction: column; align-items: center; gap: 1cqi; text-wrap: balance; word-break: auto-phrase; }
.certificate-lead, .certificate-body {
  font-family: var(--cert-serif); font-size: max(0.85rem, 1.65cqi); color: var(--cert-ink-2);
}
.certificate-course {
  font-family: var(--cert-serif); font-weight: 700; color: var(--cert-ink);
  font-size: max(1.25rem, 3.3cqi); line-height: 1.35; overflow-wrap: anywhere;
}
.certificate-course::before { content: "「"; }
.certificate-course::after { content: "」"; }
:lang(en) .certificate-course::before, :lang(en) .certificate-course::after { content: none; }
/* 英語の題は字を空けると読みにくいので詰める */
:lang(en) .certificate-title { letter-spacing: 0.02em; margin-right: 0; font-size: max(1.6rem, 4.6cqi); }
.certificate-foot {
  width: 100%; display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 3cqi;
}
.certificate-meta {
  display: flex; flex-direction: column; justify-content: flex-end; align-self: stretch;
  gap: 0.4cqi; text-align: left;
  font-size: max(0.72rem, 1.25cqi); color: var(--cert-ink-2);
  border-top: 1px solid var(--cert-gold-soft); padding-top: 0.8cqi;
}
.certificate-meta dt {
  font-size: 0.85em; letter-spacing: 0.12em; color: var(--cert-gold); font-weight: 600;
}
.certificate-meta dd { margin: 0; font-family: var(--cert-serif); font-size: 1.15em; color: var(--cert-ink); }
.certificate-meta-end { text-align: right; }
.certificate-meta .certificate-id { font-family: var(--mono); font-size: 1em; overflow-wrap: anywhere; }
.certificate-meta .certificate-verify { font-family: var(--mono); font-size: 0.82em; color: var(--cert-ink-2); overflow-wrap: anywhere; }
.certificate-seal { width: max(72px, 11cqi); height: auto; }
.certificate-seal .seal-line { fill: none; stroke: var(--cert-seal); stroke-width: 2; }
.certificate-seal .seal-thin { stroke-width: 0.8; }
.certificate-seal .seal-text {
  fill: var(--cert-seal); font-family: var(--cert-serif); font-size: 8.4px; font-weight: 600; letter-spacing: 0.9px;
}
.certificate-seal .seal-mark { fill: var(--cert-seal); }
.certificate-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 24px auto 0; }
/* コースの共有（apps/courses/share.py） */
.share-row { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; margin: 20px auto 0; }
.share-label { font-size: 0.78rem; color: var(--muted); }
.share-btn {
  display: inline-flex; align-items: center; padding: 5px 12px; border: 1px solid var(--border);
  border-radius: 999px; background: transparent; color: inherit; font: inherit; font-size: 0.78rem;
  text-decoration: none; cursor: pointer;
}
.share-btn:hover { border-color: var(--border-2); }
.share-btn[hidden] { display: none; }
.certificate-actions [hidden] { display: none; }
.certificate-settings { max-width: 720px; margin: 24px auto 0; display: flex; flex-direction: column; gap: 12px; }
.certificate-settings label { display: flex; flex-direction: column; gap: 6px; font-size: 0.85rem; color: var(--muted); }
.certificate-settings .certificate-check { flex-direction: row; align-items: center; gap: 8px; }
.certificate-settings button { align-self: flex-start; }
.certificate-private { max-width: 720px; margin: 0 auto 16px; color: var(--gold); font-size: 0.85rem; text-align: center; }
.certificate-contents { max-width: 720px; margin: 24px auto 0; }
.certificate-contents h2 { font-size: 1rem; margin: 0 0 8px; }
.certificate-contents h3, .track-cert h3 { font-size: 0.8rem; color: var(--muted); margin: 12px 0 4px; }
.certificate-contents ul, .track-cert ul { list-style: none; margin: 0; padding: 0; }
.certificate-contents li, .track-cert li { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 4px 0; }
.certificate-contents li span, .track-cert li span { color: var(--muted); font-size: 0.85rem; }
.track-cert { margin: 16px 0 24px; }
.track-cert p { margin: 0 0 8px; }
.track-cert.is-done { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.track-cert.is-done p { margin: 0; }
.dash-certificates { display: flex; flex-direction: column; gap: 10px; }
.dash-certificates a { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
/* 狭い画面では A4 の比率をやめ、縦に積む */
@media (max-width: 640px) {
  .certificate { aspect-ratio: auto; padding: 10px; }
  .certificate-frame { gap: 24px; padding: 40px 20px 48px; }
  .certificate-title { letter-spacing: 0.3em; margin-right: -0.3em; }
  .certificate-foot { grid-template-columns: 1fr; justify-items: center; gap: 16px; }
  .certificate-meta, .certificate-meta-end { text-align: center; width: 100%; }
  .certificate-seal { grid-row: 1; }
  /* 縦長の紙では斜めの一行が幅で切れるので、小さくして全部を収める */
  .certificate-watermark p { font-size: 6.5px; letter-spacing: 0; }
}
/* 印刷・PDF。紙の一枚だけを A4 横に載せる */
/* 用紙（A4 横・余白 0）は templates/courses/certificate.html の <style> が決める。
   ここに @page を書くと、レッスンなどほかのページの印刷まで横 1 枚で切れていた（#390） */
@media print {
  html:has(.certificate-wrap), html:has(.certificate-wrap) body {
    background: #fff !important; height: 210mm; overflow: hidden;
  }
  .certificate-private, .certificate-actions, .certificate-settings, .certificate-contents { display: none !important; }
  .certificate-wrap { padding: 0; }
  .certificate-wrap .container { max-width: none; padding: 0; }
  .certificate {
    width: 297mm; height: 210mm; max-width: none; aspect-ratio: auto;
    padding: 10mm; border-radius: 0; box-shadow: none;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
    break-inside: avoid;
  }
}

/* 法人契約（#122） */
.org-invite { display: flex; flex-direction: column; gap: 12px; }
.org-invite label { display: flex; flex-direction: column; gap: 6px; font-size: 0.85rem; color: var(--muted); }
.org-invite textarea { width: 100%; }
.org-members { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.org-members th, .org-members td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); }
.org-member-actions { display: flex; gap: 6px; justify-content: flex-end; }
.org-self-serve { display: flex; flex-direction: column; gap: 10px; }
.org-self-serve label { display: flex; flex-direction: column; gap: 6px; font-size: 0.82rem; color: var(--muted); text-align: left; }
/* 表の見出しの .visually-hidden（絶対配置）が枠の外を基準にすると、枠で切られずにページを押し広げる。
   枠を基準にして、375px でもページが横に動かないようにする（#582） */
.dash-section .table-scroll { overflow-x: auto; position: relative; }
/* コースの割り当て（#334） */
.org-assign { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.org-assign label { display: flex; flex-direction: column; gap: 6px; font-size: 0.85rem; color: var(--muted); }
.org-assign select, .org-assign input[type="date"] { padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--text); font: inherit; max-width: 100%; }
.org-assign-members { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow-y: auto; min-width: 0; }
.org-assign-members legend { font-size: 0.85rem; color: var(--muted); padding: 0 6px; }
.org-assign .org-check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); overflow-wrap: anywhere; }
.badge-overdue { background: rgba(247, 118, 142, 0.12); color: var(--red, #f7768e); border-color: rgba(247, 118, 142, 0.35); }
.org-due { font-size: 0.86rem; color: var(--muted); margin: 0; }
.org-due.is-overdue { color: var(--red, #f7768e); font-weight: 600; }

/* =====================================================

/* コースの買い切り（#126） */
.purchase-box { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 18px; }
.purchase-lead { font-size: 0.85rem; color: var(--muted); }
/* スライドの販売ページで「買う」の下に置くクーポン欄。ヒーローの中なので幅を絞る */
.slide-coupon { max-width: 440px; margin: 22px auto 0; padding: 18px 20px; }
.slide-coupon form:not(.coupon-form) { margin-top: 12px; }
.purchase-note { margin-top: 14px; font-size: 0.85rem; color: var(--mint); }
.purchased-courses { display: flex; flex-direction: column; gap: 10px; }
.purchased-courses a { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ギフト（#362）。選択肢は 1 行に名前と価格。名前が長いときは名前の中で折り返す */
.gift-options { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.gift-options legend { font-size: 0.78rem; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.gift-options legend .req {
  display: inline-block; margin-left: 8px; padding: 1px 7px;
  background: rgba(247, 118, 142, 0.14); color: var(--danger);
  border: 1px solid rgba(247, 118, 142, 0.3);
  border-radius: var(--radius-pill); font-size: 0.62rem; font-weight: 800;
}
.gift-options .field-help { margin-top: 6px; }
.gift-option {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); cursor: pointer;
}
.gift-option:has(input:checked) { border-color: var(--primary); }
.gift-option input { accent-color: var(--primary); }
.gift-option-name { flex: 1 1 auto; min-width: 0; }
.gift-option-price { font-weight: 700; white-space: nowrap; }
.gift-message {
  margin: 16px 0; padding: 12px 16px; border-left: 3px solid var(--primary);
  background: var(--surface-2); color: var(--text-2); font-size: 0.9rem; line-height: 1.8;
}
.gift-list { display: flex; flex-direction: column; gap: 14px; }
.gift-row { display: flex; justify-content: space-between; align-items: center; gap: 8px 12px; flex-wrap: wrap; }
.gift-row .dash-lead { display: block; font-size: 0.8rem; overflow-wrap: anywhere; }
.gift-code { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.gift-code code { font-size: 0.78rem; overflow-wrap: anywhere; word-break: break-all; }

/* 復習リスト（#271） */
.dash-review { display: flex; flex-direction: column; gap: 10px; }
.dash-review a { display: flex; flex-direction: column; gap: 2px; }

/* 今日の復習（#356）。ダッシュボードの上で解ける理解度チェック */
.review-due { display: flex; flex-direction: column; gap: 18px; }
.review-q { display: flex; flex-direction: column; gap: 8px; padding-top: 14px; border-top: 1px solid var(--border); }
.review-q-from { font-size: 0.82rem; color: var(--muted); overflow-wrap: anywhere; }
.review-q-text { font-weight: 700; overflow-wrap: anywhere; }
.review-q .btn { align-self: flex-start; }
.review-q.is-done { opacity: 0.75; }

/* レッスンの自分用メモ（#326） */
/* 「この回は分かりやすかったか」（#388） */
.lesson-feedback { margin-top: 36px; padding: 18px 22px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.lesson-feedback-q { font-weight: 700; color: var(--text-hi); margin-bottom: 10px; }
.lesson-feedback-choices { display: flex; gap: 10px; flex-wrap: wrap; }
.lesson-feedback-btn {
  font: inherit; font-size: 0.88rem; padding: 8px 16px; cursor: pointer;
  color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius-pill);
}
.lesson-feedback-btn:hover { border-color: var(--border-2); color: var(--text-hi); }
.lesson-feedback-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.lesson-feedback-btn.is-on { border-color: var(--primary); color: var(--text-hi); background: var(--surface-3); font-weight: 700; }
.lesson-feedback-label { display: block; margin: 16px 0 6px; color: var(--muted); font-size: 0.86rem; }
.lesson-feedback textarea {
  width: 100%; min-height: 80px; resize: vertical; padding: 10px 14px; box-sizing: border-box;
  border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); font: inherit; line-height: 1.7;
}
.lesson-feedback-thanks { margin-top: 12px; color: var(--muted); font-size: 0.84rem; }
@media print { .lesson-feedback { display: none !important; } }
.lesson-note { margin-top: 36px; padding: 20px 22px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.lesson-note h3 { margin-bottom: 6px; }
.lesson-note-hint { color: var(--muted); font-size: 0.86rem; margin-bottom: 12px; }
.lesson-note textarea {
  width: 100%; min-height: 120px; resize: vertical; padding: 10px 14px; box-sizing: border-box;
  border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); font: inherit; line-height: 1.7;
}
.lesson-note-actions { display: flex; align-items: center; gap: 14px; margin-top: 12px; flex-wrap: wrap; }
.lesson-note-meta { color: var(--muted); font-size: 0.8rem; }
.course-notes { display: flex; flex-direction: column; gap: 14px; margin: 18px auto 0; max-width: 760px; }
.course-note { padding: 16px 20px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.course-note h3 { font-size: 0.98rem; margin-bottom: 6px; }
.course-note p { color: var(--muted); font-size: 0.92rem; line-height: 1.8; overflow-wrap: anywhere; }

/* 「あとで読む」の印（#325） */
.bookmark-form { margin: 0 0 10px; }
.bookmark-btn {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  padding: 6px 14px; border-radius: var(--radius-sm); font: inherit; font-size: 0.82rem;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--muted);
}
.bookmark-btn:hover { background: var(--surface-3); color: var(--text); border-color: var(--border-2); }
.bookmark-btn.is-on { color: var(--text); border-color: var(--border-2); }
.dash-bookmarks { display: flex; flex-direction: column; gap: 10px; }
.dash-bookmarks a, .dash-bookmarks .is-gone { display: flex; flex-direction: column; gap: 2px; }
.dash-bookmarks .is-gone > span:first-child { color: var(--muted); }

/* セキュリティトラック（apps/labs）。フラグの提出欄は横に並べ、狭い画面では折り返す */
.flag-form { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.flag-form input[type="text"] {
  flex: 1 1 260px; min-width: 0; padding: 9px 14px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); font-family: var(--mono); font-size: 0.9rem;
}
.flag-form input[type="text"]:focus { outline: none; border-color: var(--primary); }
.flag-form ::placeholder { color: var(--muted-2); }
.lab-card + .lab-card { margin-top: 14px; }

/* 一覧ヒーローの「取得したフラグを見る」。.page-hero p は上下の余白を持たないので、
   段落に入れると説明文に貼りつく。器を分けて上に間を取る */
.page-hero-ctas { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 24px; }

.lab-back { margin-top: 40px; }

/* 利用の同意。チェックとボタンが箇条書きに貼りつかないよう間を取る */
.agree-form { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; margin-top: 20px; }
.agree-form label { display: flex; align-items: center; gap: 8px; font-size: 0.92rem; color: var(--text); cursor: pointer; }
.agree-form input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); }

/* フラグの一覧。先頭の ✅ / 🚩 が印になるので、黒丸は出さない */
.flag-list { list-style: none; padding: 0; margin: 0 0 6px; display: flex; flex-direction: column; gap: 8px; }
.flag-list li { color: var(--text-2); font-size: 0.92rem; }
.flag-list a { color: var(--primary); text-decoration: underline; text-underline-offset: 3px; }
.flag-questions { padding-left: 1.4em; margin: 0 0 8px; display: flex; flex-direction: column; gap: 14px; }
.flag-questions li > p { margin: 0 0 4px; }
.flag-questions .flag-head { color: var(--text-2); font-size: 0.92rem; }
.flag-questions .flag-format { color: var(--text-2); font-size: 0.92rem; }
.flag-hint summary { cursor: pointer; color: var(--primary); font-size: 0.9rem; width: fit-content; }
.flag-hint p { margin: 6px 0 0; padding: 8px 12px; border-left: 3px solid var(--border); color: var(--text-2); font-size: 0.92rem; }

/* トラックのコース。番号つきのカードを縦に並べ、受ける順番が読めるようにする。
   左の色は立場（基礎・レッド・ブルー・パープル）で変える */
.track-courses { --side: var(--gold); list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.track-courses.side-red { --side: var(--danger); }
.track-courses.side-blue { --side: var(--blue); }
.track-courses.side-purple { --side: var(--primary); }
.track-course {
  position: relative; display: flex; align-items: center; gap: 16px;
  padding: 18px 20px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}
.track-course::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--side);
}
a.track-course:hover { border-color: var(--border-2); background: var(--surface-2); transform: translateY(-1px); }
a.track-course:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.track-course.is-soon { background: transparent; border-style: dashed; }
.track-course.is-soon::before { opacity: 0.35; }
.track-course-num {
  flex-shrink: 0; width: 42px; height: 42px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--side); font-family: var(--mono); font-size: 0.86rem; font-weight: 700;
}
.track-course.is-soon .track-course-num { color: var(--muted-2); }
.track-course-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.track-course-name { font-size: 0.98rem; font-weight: 700; color: var(--text-hi); line-height: 1.4; }
.track-course.is-soon .track-course-name { color: var(--muted); }
.track-course-lead { font-size: 0.82rem; color: var(--muted); line-height: 1.6; }
.track-course-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 4px;
  font-size: 0.74rem; color: var(--muted-2);
}
.track-course-arrow { flex-shrink: 0; color: var(--muted-2); font-size: 1.1rem; transition: transform 0.18s ease, color 0.18s ease; }
a.track-course:hover .track-course-arrow { color: var(--side); transform: translateX(3px); }
.track-course-empty { color: var(--muted); font-size: 0.9rem; }
@media (max-width: 560px) {
  .track-course { padding: 16px; gap: 12px; align-items: flex-start; }
  .track-course-num { width: 36px; height: 36px; font-size: 0.78rem; }
  .track-course-arrow { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  a.track-course:hover, a.track-course:hover .track-course-arrow { transform: none; }
}

/* 目的別の学習ロードマップ（/roadmaps/。track-course の並びを借りて、進捗バーを足す） */
.roadmap-summary { margin: 4px 0 20px; font-size: 0.9rem; color: var(--muted); }
.roadmap-courses { margin-top: 8px; }
.roadmap-courses .progress { margin-top: 8px; }
.roadmap-next { margin: 12px 0 0; font-size: 0.9rem; }
/* コースの下の「作ってみる」。コースのあとに作るプロジェクト（Project.course） */
.roadmap-projects {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px;
  margin: 8px 0 16px 58px; font-size: 0.84rem; line-height: 1.6;
}
.roadmap-projects a { color: var(--text-2); }
.roadmap-projects a:hover { color: var(--primary); }
.roadmap-projects-label { font-size: 0.72rem; font-weight: 700; color: var(--gold); }
.roadmap-projects-meta { font-size: 0.72rem; color: var(--muted-2); }
.roadmap-projects-more { color: var(--primary) !important; font-weight: 700; font-size: 0.8rem; }
@media (max-width: 560px) { .roadmap-projects { margin-left: 8px; } }

/* ============================================================
   スライドの販売（/slides/。templates/slides/）
   ============================================================ */
.slide-includes {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 12px;
  margin-bottom: 28px;
}
.slide-includes div {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 14px 16px; display: flex; flex-direction: column; gap: 4px;
}
.slide-includes b { font-family: var(--mono); color: var(--primary); font-size: 0.85rem; }
.slide-includes span { font-size: 0.82rem; color: var(--muted); }
.slide-thumb {
  display: grid; place-items: center; aspect-ratio: 16 / 9; overflow: hidden;
  border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--code-bg);
  color: var(--muted); font-weight: 700;
}
.slide-thumb img { width: 100%; height: 100%; object-fit: cover; }
.slide-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.slide-price { font-weight: 800; color: var(--text-hi); letter-spacing: -0.02em; }
.slide-note { font-size: 0.82rem; color: var(--muted); margin-top: 18px; }
.slide-note a { text-decoration: underline; text-underline-offset: 3px; }
.slide-back { font-size: 0.85rem; margin-bottom: 10px; }
.slide-back a { color: var(--muted); }
.slide-previews {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 14px;
}
.slide-previews img {
  width: 100%; height: auto; border-radius: var(--radius-sm); border: 1px solid var(--border);
}
.slide-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(360px, 100%), 1fr)); gap: 32px; }
.slide-columns .section-title { text-align: left; font-size: 1.3rem; }
.slide-list { list-style: none; display: flex; flex-direction: column; gap: 8px; font-size: 0.9rem; }
.slide-list li { padding-left: 22px; position: relative; color: var(--text); }
.slide-list li::before { content: "・"; position: absolute; left: 4px; color: var(--muted); }
.slide-ok li::before { content: "○"; color: var(--mint); left: 0; }
.slide-ng { margin-top: 14px; }
.slide-ng li::before { content: "×"; color: var(--danger); left: 2px; }

/* ============================================================
   スキルチェック（/business/skill-check/）
   ============================================================ */
.skillcheck { max-width: 820px; }
.skillcheck-note { font-size: 0.84rem; color: var(--muted); }
.skillcheck-note a { text-decoration: underline; text-underline-offset: 3px; }
/* 4 段階の凡例。答えるあいだ見えるよう、ヘッダーの下に貼りつける */
.skillcheck-scale {
  position: sticky; top: 64px; z-index: 5;
  display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: center;
  padding: 10px 14px; margin-bottom: 18px; font-size: 0.78rem; color: var(--muted);
  background: var(--glass); backdrop-filter: blur(8px);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.skillcheck-scale b { font-family: var(--mono); color: var(--primary); }
.skillcheck-area { margin-bottom: 34px; }
.skillcheck-area h2 { font-size: 1.15rem; margin-bottom: 12px; }
.skillcheck-q {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); padding: 16px 18px; margin: 0 0 10px;
}
.skillcheck-q legend { float: left; width: 100%; font-size: 0.92rem; color: var(--text); margin-bottom: 12px; }
.skillcheck-choices { clear: both; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.skillcheck-choices label {
  display: flex; align-items: center; justify-content: center; gap: 6px; text-align: center;
  padding: 9px 6px; font-size: 0.8rem; color: var(--text-2); cursor: pointer;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  transition: background 0.15s ease, border-color 0.15s ease;
}
.skillcheck-choices label:hover { background: rgba(var(--tint-rgb), 0.06); }
.skillcheck-choices input { accent-color: var(--primary); }
.skillcheck-choices label:has(input:checked) {
  background: rgba(187, 154, 247, 0.14); border-color: rgba(187, 154, 247, 0.55); color: var(--text-hi);
}
.skillcheck-choices label:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }
.skillcheck-submit { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 26px 0 10px; }

.skillcheck-result {
  margin-top: 30px; padding: 30px 28px; outline: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
}
.skillcheck-result h3 { font-size: 1rem; margin: 28px 0 12px; }
.skillcheck-summary { text-align: center; }
.skillcheck-kicker { font-size: 0.74rem; letter-spacing: 0.08em; color: var(--muted); }
.skillcheck-summary h2 { font-size: 1.8rem; color: var(--primary); margin: 4px 0 8px; }
.skillcheck-summary p:last-child { color: var(--text-2); font-size: 0.9rem; }
.skillcheck-bars { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.skillcheck-bars li {
  display: grid; grid-template-columns: 13em 1fr 3.2em; align-items: center; gap: 12px; font-size: 0.86rem;
}
.skillcheck-bars b { font-family: var(--mono); text-align: right; color: var(--text-hi); }
.skillcheck-meter { height: 10px; border-radius: var(--radius-pill); background: var(--surface-3); overflow: hidden; }
.skillcheck-meter span { display: block; height: 100%; background: var(--primary); border-radius: inherit; }
.skillcheck-roadmap { list-style: none; display: flex; flex-direction: column; gap: 14px; margin-top: 12px; }
.skillcheck-step { border-left: 3px solid var(--primary); padding: 4px 0 4px 16px; font-size: 0.88rem; }
.skillcheck-step-title { font-family: var(--mono); font-size: 0.78rem; color: var(--primary); margin-bottom: 8px; }
.skillcheck-step ul { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.skillcheck-step li a { font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.skillcheck-step li small { display: block; margin-top: 2px; color: var(--muted); font-size: 0.78rem; }
.skillcheck-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 28px 0 14px; }

/* 法人向けページからの入口 */
.skillcheck-teaser {
  display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap;
  background: var(--surface-2); border: 1px solid rgba(187, 154, 247, 0.4);
  border-radius: var(--radius-lg); padding: 30px 32px;
}
.skillcheck-teaser h2 { font-size: 1.25rem; margin-bottom: 8px; }
.skillcheck-teaser p { color: var(--muted); font-size: 0.88rem; max-width: 520px; }

@media (max-width: 640px) {
  .skillcheck-choices { grid-template-columns: 1fr 1fr; }
  .skillcheck-bars li { grid-template-columns: 1fr 3.2em; }
  .skillcheck-bars .skillcheck-meter { grid-column: 1 / -1; grid-row: 2; }
  .skillcheck-result { padding: 24px 18px; }
  .skillcheck-teaser { padding: 24px 20px; }
}

/* 法人の管理者向け：メンバーの進捗の書き出し（#331） */
.org-overdue { margin-top: 24px; }
.org-overdue .dash-subtitle { margin: 0 0 8px; }
.org-overdue-list { margin: 0 0 16px; padding-left: 1.2em; display: grid; gap: 4px; font-size: 0.9rem; overflow-wrap: anywhere; }
.org-export { margin-top: 28px; display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.org-export .dash-subtitle, .org-export .dash-lead { flex-basis: 100%; margin: 0; }
.org-export label { display: flex; flex-direction: column; gap: 4px; font-size: 0.86rem; }
.org-export input[type="date"] { padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--text); font: inherit; }

/* =====================================================
   印刷（#390）。レッスン・プロジェクト・コラムを紙や PDF にしたとき、本文とコードだけを出す。
   - ダークテーマでも白地に黒で刷る（色の札を、紙向けの明るいものに差し替える）
   - ナビゲーション・ボタン・理解度チェック・メモ・報告のフォームは刷らない
   - コードは折り返して、右で切れないようにする
   - エディタは、いま書いている中身を static/js/print.js が <pre> に写して出す
   読めない回は、サーバーが本文を出していないので、印刷しても本文は出ない
   ============================================================ */
.print-only { display: none; }
@media print {
  /* 用紙と余白はブラウザの設定に任せる（@page を書くと修了証の指定とぶつかる） */
  :root, :root[data-theme] {
    --bg: #fff; --bg-band: #fff; --surface: #fff; --surface-2: #fff; --surface-3: #f2f2f2;
    --border: #ccc; --border-2: #aaa; --tint-rgb: 0, 0, 0;
    --text: #111; --text-hi: #000; --text-2: #222; --muted: #444; --muted-2: #555;
    --primary: #4b2a80; --blue: #1d4a85; --cyan: #0b5e6b; --mint: #2a5f52; --green: #3f5017;
    --orange: #7c3d00; --gold: #5e4519; --danger: #8f1f2e;
    --code-bg: #f6f6f6; --code-fg: #111; --code-border: #ccc;
    --tok-comment: #555; --tok-keyword: #6a2d94; --tok-string: #3f5a12; --tok-number: #8a4100;
    --tok-func: #1d4a8f; --tok-type: #0b5e6b; --tok-op: #2a4c73; --tok-prompt: #2c6355;
    --code-inline-bg: #f0f0f0; --code-inline-fg: #4b2a80;
    --shadow: none; --shadow-lg: none;
    color-scheme: light;
  }
  html, body { background: #fff !important; color: #111; }
  body { display: block; min-height: 0; overflow: visible; font-size: 11pt; }
  body::before { display: none; }

  /* サイトの枠と、紙の上では押せないもの */
  .site-header, .site-footer, .maintenance-bar, .api-note,
  .lesson-sidebar, .lesson-nav, .lesson-keys-hint, .lesson-keys, .lesson-audio,
  .lesson-note, .report, .bookmark-form, .quiz, .paywall-cta, .hero-ctas,
  .runner-head, .runner-bar, .runner textarea, .preview-frame, .runner-hint,
  .lesson-video, .exif-viewer, .copy-btn, .heading-link-btn, .article-toc, .like-btn, .related-grid,
  .column-grid, .btn, button { display: none !important; }
  /* 関連する記事・ほかのプロジェクトは、一覧と一緒に見出しも消す */
  section:has(> .related-grid), h2:has(+ .column-grid) { display: none !important; }
  .print-only { display: block; }

  .lesson-layout, .article-layout { display: block; padding: 0; max-width: none; }
  .container { max-width: none; padding: 0; }
  .lesson-content { max-width: none; }

  /* コードは折り返す。ページの境目で切れても、1 行の途中では切らない */
  .codeblock, .runner-print {
    white-space: pre-wrap; overflow-wrap: anywhere; overflow: visible;
    font-size: 9pt; line-height: 1.55; padding: 10px 12px; margin: 12px 0;
    background: var(--code-bg); color: var(--code-fg);
    border: 1px solid var(--border); border-radius: 4px;
    font-family: var(--mono); tab-size: 4;
  }
  .codeblock-wrap > .codeblock { padding-top: 10px; }
  .runner { border: none; background: none; margin: 12px 0; }
  .runner-out { border: 1px dashed var(--border); border-radius: 4px; padding: 8px 12px; font-size: 9pt; }
  .runner-out:empty { display: none; }
  .datatable-wrap, .figure-wrap { overflow: visible; }

  h1, h2, h3 { break-after: avoid; }
  .codeblock, .runner-print, figure, table, .task, .steps { break-inside: auto; }
  p, li { orphans: 3; widows: 3; }
  a { color: inherit; text-decoration: underline; }
}

/* 週 1 のセッション・ハッカソン（#335） */
.dash-events { display: flex; flex-direction: column; gap: 0; }
.dash-event { padding: 18px 0; border-top: 1px solid var(--border); }
.dash-event:first-child { padding-top: 0; border-top: 0; }
.dash-event:last-child { padding-bottom: 0; }
.dash-event h3 { font-size: 1.05rem; margin: 2px 0 6px; }
.dash-event-kind { color: var(--muted); font-size: 0.78rem; font-weight: 600; }
.dash-event .dash-actions { margin-top: 12px; }

/* 公開プロフィール（#333） */
.profile-form { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.profile-handle-field { display: flex; flex-direction: column; gap: 4px; font-size: 0.82rem; color: var(--muted); max-width: 22em; }
.profile-handle-field input {
  padding: 9px 14px; border-radius: var(--radius-sm); background: var(--surface-2);
  border: 1px solid var(--border); color: var(--text); font-size: 0.9rem;
}
.profile-handle-field input:focus { outline: none; border-color: var(--primary); }
.profile-form .check { display: flex; align-items: flex-start; gap: 8px; font-size: 0.9rem; color: var(--text-2); }
.profile-handle { overflow-wrap: anywhere; }
.profile-body { display: grid; gap: 12px; }
.profile-body .dash-title { margin: 24px 0 0; }
.profile-body .dash-title:first-child { margin-top: 0; }
.profile-lab { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* パスキー（#357）。対応していないブラウザでは隠す（static/js/passkey.js）。 */
[data-passkey-only][hidden],
[data-passkey-unsupported][hidden] { display: none; }

/* 表示の設定（#377）。本文のじゃまをしないよう、ふだんはたたんでおく */
.reading-settings { margin: 0 0 18px; font-size: 0.82rem; }
.reading-settings[hidden] { display: none; }
.reading-settings summary { cursor: pointer; color: var(--muted); width: fit-content; }
.reading-settings summary:hover { color: var(--text-2); }
.reading-settings-body {
  display: flex; flex-wrap: wrap; gap: 12px 24px; margin-top: 10px; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface);
}
.reading-settings fieldset { border: 0; min-width: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.reading-settings legend { color: var(--muted); font-size: 0.76rem; margin-bottom: 4px; padding: 0; }
.reading-settings label { display: inline-flex; align-items: center; gap: 5px; color: var(--text-2); cursor: pointer; }
.reading-settings .reading-settings-note { flex-basis: 100%; margin: 0; color: var(--muted); font-size: 0.76rem; }

/* スマホのエディタの補助キー（static/js/editor-keys.js, #400）。
   bottom は JS が visualViewport から合わせる（画面のキーボードのすぐ上） */
.editor-keys {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  display: flex; align-items: center; gap: 6px;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
  background: var(--glass-strong); border-top: 1px solid var(--border);
  backdrop-filter: blur(8px);
}
.editor-keys[hidden] { display: none; }
.editor-keys-scroll {
  display: flex; gap: 6px; overflow-x: auto; flex: 1; min-width: 0;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.editor-keys-scroll::-webkit-scrollbar { display: none; }
.editor-key {
  flex: none; min-width: 40px; height: 40px; padding: 0 10px;
  font-family: var(--mono); font-size: 1rem; color: var(--text-hi);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px;
  touch-action: manipulation; -webkit-user-select: none; user-select: none;
}
.editor-key:active { background: var(--surface-3); }
.editor-key.is-wide { min-width: 56px; font-family: var(--sans); font-size: 0.82rem; font-weight: 600; }
.editor-key.is-run {
  flex: none; font-family: var(--sans); font-size: 0.82rem; font-weight: 700;
  background: var(--primary); color: var(--ink); border-color: transparent;
}
/* 列に隠れて本文の最後が読めなくならないように */
body.has-editor-keys { padding-bottom: 64px; }
@media print { .editor-keys { display: none !important; } }

/* レッスンの改訂のメモ（#401） */
.lesson-revision {
  margin: 0 0 18px; padding: 10px 14px; font-size: 0.86rem; line-height: 1.6;
  border-left: 3px solid var(--border-2); background: var(--surface-2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--muted);
}
.lesson-revision.is-new { border-left-color: var(--mint); color: var(--text); }
.lesson-revision-mark { display: block; color: var(--mint); margin-bottom: 2px; }
.lesson-revision details { margin-top: 6px; }
.lesson-revision summary { cursor: pointer; color: var(--muted); }
.lesson-revision ul { margin: 6px 0 0 1.2em; }
.lesson-revision time { font-family: var(--mono); font-size: 0.8rem; margin-right: 6px; }
.badge-revised { background: transparent; color: var(--mint); border-color: var(--mint); }

/* 前回の続き（#594）。押すまで動かさない帯。見出しが長くても、閉じるボタンは右上に残す */
.lesson-resume {
  display: flex; align-items: flex-start; gap: 8px; margin: 0 0 18px; padding: 6px 6px 6px 14px;
  font-size: 0.9rem; line-height: 1.6; border-left: 3px solid var(--mint); background: var(--surface-2);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.lesson-resume[hidden] { display: none; }
.lesson-resume-link { flex: 1; min-width: 0; padding: 6px 0; overflow-wrap: anywhere; }
.lesson-resume-label { color: var(--muted); }
.lesson-resume-heading { font-weight: 700; }
.lesson-resume-close {
  flex: none; width: 36px; height: 36px; border: none; background: transparent; color: var(--muted);
  font-size: 1.2rem; line-height: 1; cursor: pointer; border-radius: var(--radius-sm);
}
.lesson-resume-close:hover { color: var(--text-hi); background: var(--surface); }

/* はじめの質問とおすすめ（#386） */
.start-form { margin-top: 14px; }
.start-form fieldset { border: none; margin: 0 0 16px; padding: 0; }
.start-form legend { font-weight: 700; color: var(--text-hi); margin-bottom: 8px; }
.start-choice {
  display: inline-flex; align-items: center; gap: 6px; margin: 0 8px 8px 0;
  padding: 7px 14px; border: 1px solid var(--border); border-radius: var(--radius-pill);
  background: var(--surface-2); font-size: 0.86rem; cursor: pointer;
}
.start-choice:has(input:checked) { border-color: var(--primary); background: var(--surface-3); color: var(--text-hi); }
.start-choice input:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.start-note { color: var(--muted); font-size: 0.82rem; margin: 4px 0 12px; }
.start-pick { border-color: var(--primary); }
.start-pick .badge { margin-bottom: 10px; align-self: flex-start; }

/* 紹介のその後（#403） */
.referral-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 14px 0 8px; }
.referral-stats > div { padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.referral-stats dt { font-size: 0.76rem; color: var(--muted); }
.referral-stats dd { margin: 2px 0 0; font-size: 1.05rem; font-weight: 700; color: var(--text-hi); }
.referral-rewards { list-style: none; margin: 8px 0; padding: 0; font-size: 0.86rem; color: var(--text); }
.referral-rewards li { padding: 4px 0; border-bottom: 1px solid var(--border-soft); }
.referral-rewards time { font-family: var(--mono); font-size: 0.8rem; color: var(--muted); margin-right: 8px; }

/* スライドの版（#402） */
.slide-version { color: var(--muted); font-size: 0.86rem; }
.slide-version .badge { margin-left: 6px; vertical-align: middle; }
.slide-versions { max-width: 560px; margin: 14px auto 0; text-align: left; font-size: 0.86rem; }
.slide-versions summary { cursor: pointer; color: var(--muted); text-align: center; }
.slide-versions ul { margin: 8px 0 0; padding: 0; list-style: none; }
.slide-versions li { padding: 6px 0; border-bottom: 1px solid var(--border-soft); }
.slide-version-note { display: block; color: var(--muted); font-size: 0.8rem; }

/* コードレビューの単発の依頼（#363）。コードの字下げが崩れないよう、返ってきた文章は改行と空白をそのまま出す */
.review-request { display: grid; gap: 6px; margin: 20px 0; }
.review-request label { display: block; font-weight: 600; color: var(--text-2); }
.review-request input, .review-request textarea {
  display: block; width: 100%; margin: 6px 0 4px; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text); font: inherit; font-weight: 400;
}
.review-request button { justify-self: start; margin-top: 8px; }
.review-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.8; }

/* 器を 1200px から 1360px に広げたとき（#522）、幅だけ伸びて高さが変わらず、カードや帯が
   平たく見えた。縦横比までは合わせず、広い画面のときだけ高さを少し足す。
   スマホ・タブレットの 1 段や 2 段は、これまでどおり中身と min-height で決める */
@media (min-width: 1200px) {
  .cover { min-height: 172px; }
  .column-featured .cover { min-height: 300px; }
  .column-featured .body { padding: 40px 36px; }
  .course-card { padding: 26px; }
  .stat { padding: 28px 18px; }
}
/* 列の数は 1200px の頃に合わせる。auto-fill のままだと、広げた器でカードの列が 3 → 4、
   分野のカードが 4 → 5 に増え、1 枚ずつは逆に細くなってしまう。
   本文の段（.project-body など）の中のカードの列は狭いので、器の直下だけにする */
@media (min-width: 1200px) {
  .container > .column-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .start-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* 学生割引（#364） */
.discount-note { margin-top: 20px; text-align: center; font-size: 0.875rem; color: var(--muted); line-height: 1.8; }
.discount-note a { margin-left: 6px; }
.discount-grid { display: grid; gap: 20px; max-width: 760px; }
.discount-help { margin-top: 16px; font-size: 0.8rem; }
.discount-grid .dash-card > :first-child { margin-top: 0; }
.discount-status { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0; font-size: 0.875rem; overflow-wrap: anywhere; }

