/* でじらぼ 診断（T6・T6-3 で デザイン仕上げ 2026/10/23・T8 で 結果の 絵を アプリの 絵に 2026/10/24）
   ・色は 先生サイト（Framer）の Styles と 同じ番号（T7_引き継ぎメモ.md 3-2）。:root だけ 直せば 全体が かわる
   ・フォント：見出し・ボタン・タグ＝M PLUS Rounded 1c（同梱 ../assets/fonts/）、
     本文（ひと言・ジェムえもんの ふきだし）＝BIZ UDPGothic（同梱なし → 端末の フォントに まかせる。外の 読みこみ 0）
   ・Desktop（Framer の 埋めこみ 幅いっぱい × 640）で Q1〜結果が 中で スクロールしない 大きさに してある */
:root {
  /* 先生サイトの 色（Framer の Styles → Color） */
  --ink: #1C2433;            /* Ink/900：見出し・本文 */
  --ink-soft: #4E5768;       /* Ink/600：説明文・補足 */
  --ink-faint: #646C7C;      /* Ink/400：注記（これより うすい 文字色は 使わない） */
  --line: #E6E1D7;           /* Line：枠線・区切り線 */
  --bg: #FAF7F2;             /* Bg/Base：ページの 背景 */
  --bg-alt: #F3EEE5;         /* Bg/Alt：帯・タグの 地 */
  --paper: #FFFFFF;          /* Surface：カード・ふきだし */
  --primary: #2A68B8;        /* Primary：メインボタン・リンク・えらんだ 印 */
  --primary-dark: #174A8C;   /* Primary/Dark：押したとき・印の 文字 */
  --primary-tint: #E8F1FB;   /* Primary/Tint：うすい 地 */
  --accent: #FFC940;         /* Accent：「近い学年向け」の 印だけ */
  --class: #E8604C;          /* 学級づくり（アイコン・線・うすい地だけ。白い文字は のせない） */
  --class-text: #B8402F;
  --class-tint: #FDEBE7;
  --lesson: #1E9E6A;         /* 授業 */
  --lesson-text: #157A51;
  --lesson-tint: #E3F5EC;
  --koumu: #7B5CD6;          /* 校務 */
  --koumu-text: #5B3FB3;
  --koumu-tint: #EFEAFB;

  /* 角の 丸み（Pill・L・M・S） */
  --radius-pill: 999px;
  --radius-l: 24px;
  --radius-m: 16px;
  --radius-s: 12px;

  /* フォント（同梱 → 端末 → 総称。dejilab_app_rules.md 2-5 の 並び） */
  --font-head: "M PLUS Rounded 1c", "Gowun Dodum", "Hiragino Maru Gothic ProN", "Hiragino Sans", "BIZ UDPGothic", "Meiryo", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --font-body: "BIZ UDPGothic", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", "Noto Sans JP", "M PLUS Rounded 1c", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --font-head-ko: "Gowun Dodum", "M PLUS Rounded 1c", "Apple SD Gothic Neo", "Malgun Gothic", "Hiragino Maru Gothic ProN", "Hiragino Sans", "BIZ UDPGothic", "Meiryo", sans-serif;
  --font-body-ko: "Gowun Dodum", "Apple SD Gothic Neo", "Malgun Gothic", "BIZ UDPGothic", "Hiragino Sans", "Meiryo", "M PLUS Rounded 1c", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-head);
  font-weight: 700;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
html[lang="ko"] body { font-family: var(--font-head-ko); }

button, a { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
a { touch-action: manipulation; }
img { display: block; max-width: 100%; }

:focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; }

/* UI要塞化：見えない 画面・ボタンは、押せない・読み上げない・場所を とらない（8つの 指定） */
.hidden {
  opacity: 0 !important;
  pointer-events: none !important;
  visibility: hidden !important;
  z-index: -1 !important;
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  max-height: 0 !important;
  max-width: 0 !important;
  overflow: hidden !important;
}

/* 日本語を ことばの 切れ目で 折る（shindan.js が ことばの かたまりを .sd-ph に 入れる。かたまりの とちゅうでは 折らない）
   韓国語・英語は 空白で 折る（keep-all）。どうしても 入らない 長い ことばだけ、とちゅうで 折る（anywhere） */
.sd-ph { display: inline-block; }
.sd-ona-txt, .sd-opt, .sd-name, .sd-catch, .sd-say, .sd-more, .sd-q, .sd-rttl, .sd-answers li, .sd-tags li,
.sd-loading, .sd-error {
  word-break: keep-all;
  overflow-wrap: anywhere;
  line-break: strict;
}

/* ===== 全体 ===== */
.sd {
  position: relative;
  max-width: 1120px;
  min-height: 100%;
  margin: 0 auto;
  padding: 8px 24px 12px;
  display: flex;
  flex-direction: column;
}

/* 1枚の ページとして ひらいたとき（iframe の 中で ない）だけ 出る「← でじらぼ」 */
.sd-site {
  display: flex;
  align-items: center;
  min-height: 44px;
  margin: 0 0 4px;
}
.sd-site-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 4px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink);
  text-decoration: none;
}
.sd-site-link:active { color: var(--primary-dark); }

/* ===== 上の 帯：もどる・ジェムえもん・進み具合 ===== */
.sd-bar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px 16px;
  min-height: 60px;
}
.sd-back {
  flex: 0 0 auto;
  min-height: 48px;
  padding: 0 20px;
  border: 1.5px solid var(--ink);
  border-radius: var(--radius-pill);
  background: var(--paper);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.sd-back:active { background: var(--bg-alt); }

.sd-guide {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}
.sd-gem {
  position: relative;
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
}
.sd-gem-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
/* ふだんは 色鉛筆の ジェムえもん、結果では 両手を あげた ジェムえもん */
.sd-gem-img--joy { display: none; }
.sd-gem[data-mood="joy"] .sd-gem-img--talk { display: none; }
.sd-gem[data-mood="joy"] .sd-gem-img--joy { display: block; }

.sd-say {
  position: relative;
  min-width: 0;
  margin: 0;
  padding: 9px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  background: var(--paper);
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.55;
  letter-spacing: 0.04em;
  color: var(--ink);
  text-wrap: pretty;
}
html[lang="ko"] .sd-say { font-family: var(--font-body-ko); }
/* ふきだしの しっぽ（ジェムえもんの ほうへ） */
.sd-say::before {
  content: "";
  position: absolute;
  top: 50%;
  left: -7px;
  width: 12px;
  height: 12px;
  margin-top: -6px;
  background: var(--paper);
  border-left: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  transform: rotate(45deg);
}
.sd-say:empty { display: none; }

/* 画面が かわったときの ふわっと（下から 16px・0.4秒・1回だけ。T7 3-6） */
@keyframes sd-pop { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.sd-guide.is-pop .sd-say,
.sd-guide.is-pop .sd-gem { animation: sd-pop 0.4s ease-out both; }

/* 進み具合の 点 */
.sd-prog {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}
.sd-dots {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.sd-dots li {
  width: 12px;
  height: 12px;
  border: 2px solid var(--ink-faint);
  border-radius: var(--radius-pill);
  background: transparent;
  transition: width 0.25s ease, background-color 0.25s ease, border-color 0.25s ease;
}
.sd-dots li.is-done { border-color: var(--primary); background: var(--primary); }
.sd-dots li.is-now { width: 28px; border-color: var(--primary); background: var(--primary); }
.sd-dots li.is-maybe { opacity: 0.45; }
.sd-left {
  margin: 0;
  min-width: 4.5em;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  white-space: nowrap;
  text-align: right;
}
.sd-left:empty { min-width: 0; }

/* ===== 画面 ===== */
.sd-screen { position: relative; flex: 1 1 auto; }
/* 隠れた 画面が 下に はみ出して、スクロールの 長さを 増やさないように */
.sd-screen.hidden { height: 0 !important; overflow: hidden !important; }

/* 画面が 変わったときに 見出しへ 移す 焦点（キーボード・読み上げ用）は、枠を 出さない */
[tabindex="-1"]:focus { outline: none; }

.sd-q {
  margin: 10px 0 18px;
  font-size: 28px;
  font-weight: 800;
  line-height: 1.4;
  letter-spacing: 0.02em;
  text-wrap: balance;
}

/* ===== Q1：まとまりごとの 3列 ===== */
.sd-q1 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  align-items: start;
}
.sd-col { display: flex; flex-direction: column; gap: 12px; }
.sd-col[data-group="class"]  { --g: var(--class);  --gx: var(--class-text);  --gt: var(--class-tint); }
.sd-col[data-group="lesson"] { --g: var(--lesson); --gx: var(--lesson-text); --gt: var(--lesson-tint); }
.sd-col[data-group="koumu"]  { --g: var(--koumu);  --gx: var(--koumu-text);  --gt: var(--koumu-tint); }
.sd-col-ttl {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--gx);
}
.sd-col-ttl::before {
  content: "";
  width: 32px;
  height: 4px;
  border-radius: var(--radius-pill);
  background: var(--g);
}

.sd-ona {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 88px;
  padding: 10px 14px 10px 12px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-m);
  background: var(--paper);
  text-align: left;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0.02em;
  transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.1s ease;
}
.sd-ona-ico {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-pill);
  background: var(--gt);
  font-size: 26px;
  line-height: 1;
}
.sd-ona-txt { min-width: 0; text-wrap: balance; }
.sd-ona:active { background: var(--gt); transform: scale(0.98); }
.sd-ona[aria-pressed="true"] { border-color: var(--g); box-shadow: inset 0 0 0 1px var(--g); background: var(--gt); }
.sd-ona[aria-pressed="true"] .sd-ona-ico { background: var(--paper); }

/* ===== Q2〜Q4 の 選択肢 ===== */
.sd-opts { display: grid; gap: 16px; }
.sd-opts--grade { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.sd-opts--wide { grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr)); }

.sd-opt {
  min-height: 104px;
  padding: 12px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-m);
  background: var(--paper);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: 0.02em;
  transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.1s ease;
}
.sd-opts--wide .sd-opt {
  min-height: 176px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 20px;
}
.sd-opt-icon { font-size: 40px; line-height: 1; }
.sd-opt:active { background: var(--primary-tint); transform: scale(0.98); }
.sd-opt[aria-pressed="true"] { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); background: var(--primary-tint); color: var(--primary-dark); }
.sd-opt--quiet { color: var(--ink-soft); background: transparent; border-style: dashed; border-color: var(--ink-faint); }

/* マウスの とき だけの ホバー（指の 端末では 出さない） */
@media (hover: hover) and (pointer: fine) {
  .sd-ona:hover { border-color: var(--g); }
  .sd-opt:hover { border-color: var(--primary); }
  .sd-back:hover, .sd-more:hover { background: var(--bg-alt); }
  .sd-card:hover { border-color: var(--primary); transform: translateY(-4px); }
  .sd-site-link:hover { color: var(--primary); }
  .sd-again:hover { color: var(--primary); }
}

/* ===== 結果 ===== */
.sd-rhead {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin: 4px 0 12px;
}
.sd-rttl {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
  line-height: 1.4;
  letter-spacing: 0.02em;
}
.sd-answers {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.sd-answers li {
  padding: 4px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--paper);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
}

.sd-cards {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  grid-template-rows: auto auto;
  gap: 16px;
}
.sd-cards[data-group="class"]  { --g: var(--class);  --gx: var(--class-text);  --gt: var(--class-tint); }
.sd-cards[data-group="lesson"] { --g: var(--lesson); --gx: var(--lesson-text); --gt: var(--lesson-tint); }
.sd-cards[data-group="koumu"]  { --g: var(--koumu);  --gx: var(--koumu-text);  --gt: var(--koumu-tint); }

.sd-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  background: var(--paper);
  color: inherit;
  text-decoration: none;
  overflow: hidden;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.sd-card:active { border-color: var(--primary); transform: scale(0.98); }
.sd-card--big { grid-row: 1 / span 2; }
.sd-card--small { flex-direction: column; }

/* いちばんの おすすめの 絵（T8）：まとまりの うすい 色の 帯に、16:9 の 絵を 切らずに 額のように のせる（contain）。
   帯の 高さは --thumb-h。2位・3位の カードの ほうが 高いときは、帯が のびて 絵が 大きく なる（下の 文字の 場所は かわらない）。
   絵が ない・読めない ときは 同じ 高さの 帯に アプリの 絵文字（T6-3） */
.sd-thumb {
  --thumb-h: 156px;
  --thumb-pad: 12px;
  position: relative;
  flex: 1 0 auto;
  height: var(--thumb-h);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gt, var(--bg-alt));
  font-size: 68px;
  line-height: 1;
  overflow: hidden;
}
.sd-thumb img {
  position: absolute;
  top: var(--thumb-pad);
  bottom: var(--thumb-pad);
  left: 50%;
  width: auto;
  height: calc(100% - var(--thumb-pad) * 2);
  max-width: calc(100% - var(--thumb-pad) * 2);
  aspect-ratio: 16 / 9;
  object-fit: contain;
  transform: translateX(-50%);
  border-radius: var(--radius-s);
  box-shadow: 0 2px 8px rgba(28, 36, 51, 0.12);
}
.sd-card--big { position: relative; }
.sd-card--big .sd-body { flex: 0 0 auto; }
/* 「いちばんのおすすめ」は 絵の 左上の 札に（T8。文字の 行を へらして、絵を 大きく。読み上げの 順は 名前の 前の まま） */
.sd-card--big .sd-rank {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 1;
  max-width: calc(100% - 24px);
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  background: var(--paper);
  box-shadow: 0 1px 4px rgba(28, 36, 51, 0.16);
  line-height: 1.4;
}

/* 2位・3位の 小さな 絵（T8）：16:9 の 96×54 に 切りぬく（cover）。名前の 左に ならべる。
   絵が ない・読めない ときは 64×64 の 四角に アプリの 絵文字（T6-3） */
.sd-shead {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding-right: 36px;   /* 右上の「→」の 丸ボタンの 場所 */
}
.sd-shead .sd-name { flex: 1 1 auto; min-width: 0; }
.sd-tile {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: var(--radius-s);
  background: var(--gt, var(--bg-alt));
  font-size: 36px;
  line-height: 1;
  overflow: hidden;
}
.sd-tile--img { width: 96px; height: 54px; }
.sd-tile img { width: 100%; height: 100%; object-fit: cover; }

.sd-body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 20px 16px;
}
.sd-card--small .sd-body { padding: 12px 14px 12px 12px; }   /* T8：上下を 2px ずつ へらして 640 の 余裕に */
.sd-rank {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--gx, var(--ink-soft));
}
.sd-name {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0.02em;
  text-wrap: balance;
}
.sd-card--big .sd-name { font-size: 24px; font-weight: 800; }
.sd-catch {
  margin: 0;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.6;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  text-wrap: balance;
}
html[lang="ko"] .sd-catch { font-family: var(--font-body-ko); }
.sd-card--big .sd-catch { font-size: 16px; }

.sd-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.sd-tags li {
  padding: 3px 10px;
  border-radius: 8px;
  background: var(--bg-alt);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: 0.04em;
  color: var(--ink);
}
.sd-tags .sd-tag-match { background: var(--primary-tint); color: var(--primary-dark); }
.sd-tags .sd-tag-near { background: var(--accent); color: var(--ink); }
.sd-tags .sd-tag-soon { background: transparent; border: 1px dashed var(--ink-faint); color: var(--ink-soft); }

.sd-go {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 18px;
  border-radius: var(--radius-pill);
  background: var(--primary);
  color: #FFFFFF;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.sd-card:active .sd-go { background: var(--primary-dark); }
.sd-card--big .sd-go { margin-top: auto; align-self: stretch; min-height: 44px; font-size: 17px; }

/* 2位・3位：タグと「使い方を見る」を 1行に（高さを 640 に おさめる） */
.sd-foot {
  margin-top: auto;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 6px 10px;
}
.sd-foot .sd-tags { flex: 1 1 auto; min-width: 0; }
.sd-card--small { position: relative; }
.sd-foot .sd-go {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  min-height: 36px;
  height: 36px;
  padding: 0;
  font-size: 17px;
}

.sd-rfoot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  margin-top: 12px;
}
.sd-more {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 8px 24px;
  border: 1.5px solid var(--ink);
  border-radius: var(--radius-pill);
  background: var(--paper);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0.04em;
  text-decoration: none;
  text-wrap: balance;
}
.sd-more:active { background: var(--bg-alt); }
.sd-again {
  min-height: 48px;
  padding: 0 12px;
  border: 0;
  background: transparent;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.sd-loading, .sd-error {
  margin: 32px 0 20px;
  font-family: var(--font-body);
  font-size: 18px;
  font-weight: 400;
  line-height: 1.8;
}
html[lang="ko"] .sd-loading, html[lang="ko"] .sd-error { font-family: var(--font-body-ko); }

/* 結果が 出たときの 1回だけの 動き */
@keyframes sd-rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.sd-cards .sd-card { animation: sd-rise 0.4s ease-out both; }
.sd-cards .sd-card:nth-child(2) { animation-delay: 0.08s; }
.sd-cards .sd-card:nth-child(3) { animation-delay: 0.16s; }
@media (prefers-reduced-motion: reduce) {
  .sd-cards .sd-card,
  .sd-guide.is-pop .sd-say,
  .sd-guide.is-pop .sd-gem { animation: none; }
  .sd-dots li, .sd-card, .sd-ona, .sd-opt { transition: none; }
}

/* ===== 埋めこみ（Framer の Desktop・高さ 640）：Q2〜Q4・結果は 上下の まんなかに・ボタンを 大きく ===== */
@media (min-width: 821px) {
  html.is-embed #scr-q2:not(.hidden),
  html.is-embed #scr-q3:not(.hidden),
  html.is-embed #scr-q4:not(.hidden) {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-bottom: 40px;
  }
  html.is-embed #scr-result:not(.hidden) {
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
  html.is-embed .sd-opts--grade .sd-opt { min-height: 120px; font-size: 24px; }
  html.is-embed .sd-opts--wide .sd-opt { min-height: 200px; }
}

/* T8：幅に 余裕が ある 埋めこみ（Framer 1200 以上・iPad 横 1180）は 絵の 帯を 高く */
@media (min-width: 1060px) {
  .sd-thumb { --thumb-h: 180px; }
}

/* ===== iPad 縦・画面分割（Framer の Tablet：768〜1023 の うち 820 まで） ===== */
@media (max-width: 820px) {
  .sd { padding: 8px 20px 24px; }
  .sd-q { font-size: 24px; margin: 8px 0 16px; }
  .sd-q1 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas: "class lesson" "koumu lesson";
    gap: 20px 16px;
  }
  .sd-col[data-group="class"]  { grid-area: class; }
  .sd-col[data-group="lesson"] { grid-area: lesson; }
  .sd-col[data-group="koumu"]  { grid-area: koumu; }
  .sd-opts--wide .sd-opt { min-height: 112px; }
  .sd-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: auto; }
  .sd-card--big { grid-row: auto; grid-column: 1 / -1; }
  .sd-thumb { --thumb-h: 200px; }
}

/* ===== スマホ（Framer の Phone・390） ===== */
@media (max-width: 600px) {
  .sd { padding: 6px 16px 24px; }
  .sd-bar { flex-wrap: wrap; min-height: 0; padding-top: 4px; }
  .sd-guide { order: 3; flex: 1 1 100%; }
  .sd-gem { width: 52px; height: 52px; }
  .sd-say { font-size: 15px; padding: 8px 14px; }
  .sd-prog { min-height: 48px; }
  .sd-q { font-size: 22px; margin: 10px 0 14px; }
  .sd-q1 { grid-template-columns: minmax(0, 1fr); grid-template-areas: "class" "lesson" "koumu"; gap: 18px; }
  .sd-ona { min-height: 68px; font-size: 17px; }
  .sd-ona-ico { width: 44px; height: 44px; font-size: 24px; }
  .sd-opts { gap: 12px; }
  .sd-opts--grade { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sd-opt { min-height: 72px; font-size: 20px; }
  .sd-opts--wide { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sd-opts--wide .sd-opt { min-height: 104px; font-size: 18px; }
  .sd-opt-icon { font-size: 34px; }
  .sd-rttl { font-size: 22px; }
  .sd-cards { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .sd-thumb { --thumb-h: 150px; --thumb-pad: 10px; font-size: 52px; }
  .sd-card--big .sd-name { font-size: 22px; }
  .sd-tile { width: 56px; height: 56px; font-size: 30px; }
  .sd-tile--img { width: 80px; height: 45px; }
  .sd-more { width: 100%; justify-content: center; text-align: center; }
  .sd-rfoot { justify-content: center; }
}

/* T8（2026/10/24）：日本語の 文（shindan.js の fill() が is-ja を つける）は、行の 長さを そろえる 指定（balance・pretty）を 外す。
   iPad の Safari で、ことばの かたまり（inline-block）と balance を いっしょに 使うと、1行に 入る 見出しまで
   「何年生で／使う？」「どう／使う？」と 折れた。折れる 場所は 今までどおり ことばの 切れ目だけ。英語・韓国語は balance の まま */
.sd .is-ja { text-wrap: wrap; }
