/* j-learning — やさしく、明るく、読みやすい。スマホ優先 */
:root {
  /* セクションの色（文・語・絵・問・読・字） */
  --c-video: #166e7a; --c-phrase: #ec5a4f; --c-voca: #ee8a12; --c-diapo: #2b9b5c; --c-question: #2f78d8; --c-reading: #8257e6; --c-kanji: #d9407a;
  --bg: #fff8ee; --bg-2: #fff1de; --surface: #ffffff; --surface-2: #fbf3e8; --ink: #2d2a3a; --muted: #77707f; --line: #f0e4d2;
  --accent: #ec5a4f; --accent-ink: #ffffff;
  --ok: #1f9d55; --ng: #e0453a;
  --rt: #d6455b; --hl: #ffe9a8;
  --radius: 20px; --radius-s: 14px;
  --shadow: 0 1px 0 rgba(120, 80, 30, .05), 0 6px 18px -6px rgba(120, 80, 30, .16);
  --shadow-lg: 0 14px 34px -10px rgba(120, 70, 20, .28);
  --tabbar-h: 64px; --top-h: 58px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", system-ui, sans-serif;
  color-scheme: light;
}
/* ダーク：OS の設定に従う。設定シートで ライト／ダーク を選ぶと html[data-theme] で上書き */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --c-video: #3fb7c7; --c-phrase: #ff7a6e; --c-voca: #ffa63d; --c-diapo: #4cc485; --c-question: #5b9cf5; --c-reading: #a585ff; --c-kanji: #f26b9e;
    --bg: #1b1a22; --bg-2: #22202b; --surface: #26242f; --surface-2: #302d3a; --ink: #f1edf5; --muted: #aaa3b5; --line: #3a3646;
    --accent: #ff7a6e; --accent-ink: #1b1a22;
    --ok: #4fd18b; --ng: #ff7a6e; --rt: #ff96a6; --hl: #5a4a14;
    --shadow: 0 1px 0 rgba(0, 0, 0, .25); --shadow-lg: 0 14px 34px -10px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    --c-video: #3fb7c7; --c-phrase: #ff7a6e; --c-voca: #ffa63d; --c-diapo: #4cc485; --c-question: #5b9cf5; --c-reading: #a585ff; --c-kanji: #f26b9e;
    --bg: #1b1a22; --bg-2: #22202b; --surface: #26242f; --surface-2: #302d3a; --ink: #f1edf5; --muted: #aaa3b5; --line: #3a3646;
    --accent: #ff7a6e; --accent-ink: #1b1a22;
    --ok: #4fd18b; --ng: #ff7a6e; --rt: #ff96a6; --hl: #5a4a14;
    --shadow: 0 1px 0 rgba(0, 0, 0, .25); --shadow-lg: 0 14px 34px -10px rgba(0, 0, 0, .6);
    color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }
/* いまのセクションの色をアクセントに */
.sec-phrase { --accent: var(--c-phrase); } .sec-voca { --accent: var(--c-voca); } .sec-diapo { --accent: var(--c-diapo); }
.sec-question { --accent: var(--c-question); } .sec-reading { --accent: var(--c-reading); } .sec-kanji { --accent: var(--c-kanji); }
.t-video { --c: var(--c-video); } .t-phrase { --c: var(--c-phrase); } .t-voca { --c: var(--c-voca); } .t-diapo { --c: var(--c-diapo); }
.t-question { --c: var(--c-question); } .t-reading { --c: var(--c-reading); } .t-kanji { --c: var(--c-kanji); }
:root { --accent-soft: color-mix(in srgb, var(--accent) 13%, var(--surface)); }
body { --accent-soft: color-mix(in srgb, var(--accent) 13%, var(--surface)); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) body { --accent-soft: color-mix(in srgb, var(--accent) 24%, var(--surface)); } }
:root[data-theme="dark"] body { --accent-soft: color-mix(in srgb, var(--accent) 24%, var(--surface)); }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; font-size: calc(16px * var(--fs, 1)); }
/* 文字の大きさ：小さい文字（rem）も 本文も いっしょに 変わる。スマホは 少し 大きめ（2026-11-23） */
@media (max-width: 640px) { html { --fs: 1.08; } }
html[data-size="l"] { --fs: 1.15; }
html[data-size="xl"] { --fs: 1.3; }
@media (max-width: 640px) { html[data-size="l"] { --fs: 1.22; } html[data-size="xl"] { --fs: 1.38; } }
/* 上の帯・下のタブ・タブの上の切りかえは 今までの 大きさのまま（大きくすると 課の名前が 切れた） */
header.top, .tabbar, .tab-more > div { zoom: calc(1 / var(--fs, 1)); }
body {
  margin: 0; color: var(--ink); font-family: var(--font); font-weight: 500; font-size: 1.0625rem; line-height: 1.8;
  background: var(--bg);
  background-image: radial-gradient(circle at 100% 0, color-mix(in srgb, var(--accent) 9%, transparent) 0, transparent 340px);
  background-repeat: no-repeat;
  -webkit-tap-highlight-color: transparent;
}
body.has-tabs { padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 8px); }
body.has-player { padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 84px); }
a { color: var(--accent); }
img { max-width: 100%; height: auto; }
button { font: inherit; color: inherit; }
h1 { font-size: 1.6rem; line-height: 1.5; margin: .2em 0 .4em; font-weight: 900; letter-spacing: .02em; }
h2 { font-size: 1.05rem; margin: 0 0 .6em; font-weight: 700; }
main { max-width: 760px; margin: 0 auto; padding: 14px 16px 8px; }
main.wide { max-width: 1000px; }
svg { width: 1em; height: 1em; fill: currentColor; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 2px; }

/* 言語切り替え：日本語の訳がないところは英語（.l-fb）を出す */
[data-ui] { display: none; }
html[data-lang="ja"] [data-ui="ja"], html[data-lang="fr"] [data-ui="fr"], html[data-lang="en"] [data-ui="en"], html[data-lang="es"] [data-ui="es"] { display: inline; }
html[data-lang="fr"] [data-l="en"], html[data-lang="fr"] [data-l="ja"], html[data-lang="fr"] [data-l="es"],
html[data-lang="en"] [data-l="fr"], html[data-lang="en"] [data-l="ja"], html[data-lang="en"] [data-l="es"],
html[data-lang="es"] [data-l="fr"], html[data-lang="es"] [data-l="ja"], html[data-lang="es"] [data-l="en"]:not(.l-fb-es),
html[data-lang="ja"] [data-l="fr"], html[data-lang="ja"] [data-l="es"], html[data-lang="ja"] [data-l="en"]:not(.l-fb) { display: none !important; }

/* ふりがな */
ruby { ruby-position: over; }
/* ふりがな：0.5 倍だと スマホで 8〜9px になり 読めなかった（2026-11-23）。0.6 倍、いちばん小さくても 11px（文字の大きさの設定に合わせて 大きく） */
rt { color: var(--rt); font-size: max(.6em, calc(11px * var(--fs, 1))); letter-spacing: 0; font-weight: 500; }
ruby.known rt { visibility: hidden; }
ruby.known { cursor: pointer; }
ruby.known.peek rt { visibility: visible; }

/* ---------- ヘッダー ---------- */
header.top {
  position: sticky; top: 0; z-index: 20; height: var(--top-h);
  display: flex; align-items: center; gap: 6px; padding: 0 10px 0 8px;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  -webkit-backdrop-filter: saturate(1.6) blur(14px); backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.brand { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding-left: 6px; text-decoration: none; color: var(--ink); font-weight: 900; font-size: 1.2rem; letter-spacing: .01em; }
.brand::before {
  content: "J"; flex: none; width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--c-phrase), var(--c-voca)); color: #fff; font-size: 1.1rem; box-shadow: 0 4px 10px -4px var(--c-phrase);
}
.brand small { display: none; }
.back { flex: none; width: 40px; height: 40px; display: grid; place-items: center; font-size: 1.9rem; line-height: 1; color: var(--ink); text-decoration: none; border-radius: 50%; }
.back:active { background: var(--surface-2); }
.top-title { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; text-decoration: none; color: var(--ink); }
.top-title small { font-size: .72rem; color: var(--accent); font-weight: 700; }
.top-title b { font-size: 1.05rem; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.langsw { flex: none; display: flex; padding: 3px; gap: 2px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); }
.langsw button {
  border: 0; background: none; cursor: pointer; height: 30px; min-width: 30px; padding: 0 6px; border-radius: 99px;
  font-size: .78rem; font-weight: 700; color: var(--muted); letter-spacing: .02em;
}
html[data-lang="ja"] [data-setlang="ja"], html[data-lang="fr"] [data-setlang="fr"], html[data-lang="en"] [data-setlang="en"], html[data-lang="es"] [data-setlang="es"] {
  background: var(--ink); color: var(--bg);
}
.settings-btn {
  flex: none; width: 42px; height: 42px; border-radius: 14px; border: 0; cursor: pointer; padding: 0;
  background: var(--accent); color: var(--accent-ink); font-size: 1.15rem; font-weight: 900; line-height: 1;
  display: grid; place-items: center; box-shadow: 0 6px 14px -6px var(--accent);
}
.settings-btn rt { color: inherit; opacity: .85; font-size: .45em; }

/* ---------- タブバー（スマホは下、PC は上） ---------- */
.tabbar {
  position: fixed; left: 10px; right: 10px; bottom: calc(8px + var(--safe-b)); z-index: 20;
  max-width: 560px; margin: 0 auto; height: var(--tabbar-h);
  display: flex; justify-content: space-around; padding: 6px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  -webkit-backdrop-filter: saturate(1.6) blur(14px); backdrop-filter: saturate(1.6) blur(14px);
  border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow-lg);
}
.tabbar a { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; text-decoration: none; color: var(--muted); font-size: .62rem; font-weight: 700; line-height: 1.2; border-radius: 18px; }
.tabbar a i { font-style: normal; font-size: 1.2rem; font-weight: 900; line-height: 1; width: 32px; height: 28px; display: grid; place-items: center; border-radius: 10px; color: var(--c); transition: transform .15s; }
.tabbar a span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.tabbar a[aria-current] { color: var(--c); background: color-mix(in srgb, var(--c) 12%, transparent); }
.tabbar a[aria-current] i { background: var(--c); color: #fff; transform: translateY(-1px); }
@media (min-width: 900px) {
  body.has-tabs { padding-bottom: 0; }
  body.has-player { padding-bottom: 96px; }
  .tabbar { position: sticky; top: calc(var(--top-h) + 10px); bottom: auto; margin: 10px auto 0; max-width: 720px; height: 56px; }
  .tabbar a { flex-direction: row; gap: 8px; font-size: .9rem; }
  .tabbar a i { width: 30px; height: 30px; font-size: 1rem; }
}

footer.site { max-width: 760px; margin: 28px auto 0; padding: 16px 20px 24px; color: var(--muted); font-size: .75rem; line-height: 1.7; text-align: center; }
footer.site a { color: inherit; }
footer.site .report { margin: 0 0 10px; }
footer.site .report { display: flex; flex-wrap: wrap; gap: 8px 16px; justify-content: center; align-items: center; }
.dl-old { font-size: .72rem; color: var(--muted); white-space: nowrap; } .dl-old a { color: inherit; margin: 0 .15em; }   /* 前のサイトの PDF：控えめに */
.report-btn { border: 1px solid var(--line, color-mix(in srgb, var(--muted) 35%, transparent)); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 8px 16px; font: inherit; font-size: .85rem; font-weight: 700; cursor: pointer; }
.report-btn:hover { border-color: var(--accent); }

/* ---------- 共通部品 ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin: 16px 0; box-shadow: var(--shadow); }
.card h2 { display: flex; align-items: center; gap: 8px; }
.card h2::before { content: ""; width: 8px; height: 20px; border-radius: 4px; background: var(--accent); }
.eyebrow { margin: 0; color: var(--accent); font-weight: 900; font-size: .82rem; letter-spacing: .08em; }
.hint, .count { color: var(--muted); font-size: .85rem; }
.count { margin: 6px 4px 10px; font-weight: 700; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 16px; border-radius: 99px;
  border: 1.5px solid var(--line); background: var(--surface); font-size: .85rem; font-weight: 700; cursor: pointer; white-space: nowrap; user-select: none;
}
.pill.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); box-shadow: 0 6px 14px -8px var(--accent); }
.pill.primary.playing { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.pill input { position: absolute; opacity: 0; pointer-events: none; }
.pill:has(input:checked) { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.pill:has(input:focus-visible) { outline: 3px solid color-mix(in srgb, var(--accent) 50%, transparent); }
button.play {
  flex: none; display: inline-grid; place-items: center; border-radius: 50%; cursor: pointer; padding: 0;
  width: 32px; height: 32px; border: 0; background: var(--accent-soft); color: var(--accent); vertical-align: middle;
  transition: transform .12s, background-color .15s;
}
button.play:active { transform: scale(.9); }
button.play svg { width: 14px; height: 14px; margin-left: 2px; }
button.play.big { width: 52px; height: 52px; background: var(--accent); color: var(--accent-ink); box-shadow: 0 8px 16px -8px var(--accent); }
button.play.big svg { width: 22px; height: 22px; }
button.play.small { width: 30px; height: 30px; margin-right: 10px; }
button.play.playing { background: var(--ink); color: var(--bg); animation: pulse 1s ease-in-out infinite; }
button.play:disabled { opacity: .3; cursor: default; animation: none; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--accent) 22%, transparent); } }
.pager { display: flex; justify-content: space-between; gap: 12px; margin: 30px 0 8px; }
.pager a { padding: 12px 18px; border-radius: 99px; background: var(--surface); border: 1.5px solid var(--line); text-decoration: none; color: var(--ink); font-size: .9rem; font-weight: 700; box-shadow: var(--shadow); }
.pager a[rel="next"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* ---------- トップページ ---------- */
.hero {
  position: relative; overflow: hidden; margin: 4px 0 8px; padding: 26px 22px 22px; border-radius: 28px;
  background: linear-gradient(140deg, #fff3e2 0%, #ffe3dc 55%, #f3e3ff 100%);
  box-shadow: var(--shadow);
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .hero { background: linear-gradient(140deg, #2d2531 0%, #33262c 55%, #2a2540 100%); } }
:root[data-theme="dark"] .hero { background: linear-gradient(140deg, #2d2531 0%, #33262c 55%, #2a2540 100%); }
.hero::after { content: "あ"; position: absolute; right: -14px; bottom: -48px; font-size: 11rem; font-weight: 900; line-height: 1; color: color-mix(in srgb, var(--c-phrase) 10%, transparent); pointer-events: none; }
.hero-word { display: flex; gap: 6px; margin-bottom: 6px; }
.hero-word b {
  width: 46px; height: 46px; border-radius: 15px; display: grid; place-items: center; color: #fff; font-size: 1.5rem; font-weight: 900;
  box-shadow: 0 6px 12px -6px rgba(0, 0, 0, .35); animation: bob 3s ease-in-out infinite;
}
.hero-word b:nth-child(1) { background: var(--c-phrase); transform: rotate(-6deg); }
.hero-word b:nth-child(2) { background: var(--c-voca); transform: rotate(4deg); animation-delay: .2s; }
.hero-word b:nth-child(3) { background: var(--c-diapo); transform: rotate(-3deg); animation-delay: .4s; }
.hero-word b:nth-child(4) { background: var(--c-question); transform: rotate(5deg); animation-delay: .6s; }
@keyframes bob { 50% { translate: 0 -4px; } }
@media (prefers-reduced-motion: reduce) { .hero-word b, button.play.playing { animation: none; } }
.hero h1 { font-size: 1.75rem; position: relative; z-index: 1; }
.hero p { position: relative; z-index: 1; margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.7; }
.hero-tags { position: relative; z-index: 1; list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.hero-tags li { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px 3px 4px; border-radius: 99px; background: var(--surface); font-size: .75rem; font-weight: 700; color: var(--c); box-shadow: var(--shadow); }
.hero-tags i { font-style: normal; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--c); color: #fff; font-size: .75rem; }
.group { margin: 26px 0; }
.group h2 { display: flex; align-items: center; gap: 10px; font-size: 1rem; font-weight: 900; padding-left: 4px; }
.group h2::after { content: ""; flex: 1; height: 2px; border-radius: 2px; background: var(--line); }
.lesson-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
@media (min-width: 640px) { .lesson-list { grid-template-columns: 1fr 1fr; } }
.lesson-list li { --c: var(--c-phrase); }
/* 課の色は 2 つだけ：はじめましょう・初級 1 と、初級 2 */
.lv1 .lesson-list li { --c: var(--c-phrase); }
.lv2 .lesson-list li { --c: var(--c-question); }
.lesson-list a {
  height: 100%; display: flex; gap: 14px; align-items: flex-start; padding: 14px; text-decoration: none; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s;
}
.lesson-list a:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.lesson-list a:active { transform: scale(.98); }
.num {
  flex: none; width: 46px; height: 46px; border-radius: 15px; display: grid; place-items: center;
  background: var(--c); color: #fff; font-weight: 900; font-size: 1.15rem; font-variant-numeric: tabular-nums;
  box-shadow: 0 6px 12px -6px var(--c);
}
.txt { min-width: 0; display: flex; flex-direction: column; line-height: 1.6; }
.txt b { font-size: 1rem; font-weight: 900; }
.sum { font-size: .84rem; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sum.sub { font-size: .8rem; }
.sum rt { font-size: max(.6em, calc(10.5px * var(--fs, 1))); }

/* ---------- 課のトップ ---------- */
.lesson-hero { padding: 10px 4px 4px; }
.lesson-hero h1 { font-size: 1.5rem; }
.lesson-hero .sum { -webkit-line-clamp: unset; display: block; font-size: .92rem; }
.page-grid { list-style: none; padding: 0; margin: 16px 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.page-grid a {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 18px 6px 14px; text-decoration: none;
  color: var(--c); font-size: .85rem; font-weight: 700; border-radius: var(--radius);
  background: color-mix(in srgb, var(--c) 10%, var(--surface)); border: 1.5px solid color-mix(in srgb, var(--c) 22%, transparent);
  transition: transform .15s;
}
.page-grid a:active { transform: scale(.96); }
.page-grid i { font-style: normal; width: 54px; height: 54px; border-radius: 18px; display: grid; place-items: center; background: var(--c); color: #fff; font-size: 1.7rem; font-weight: 900; box-shadow: 0 8px 16px -8px var(--c); }
.cando { margin: 0; padding-left: 1.3em; }
.cando li { margin: .35em 0; }
.cando li::marker { content: "✓  "; color: var(--accent); font-weight: 900; }
.downloads { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.downloads a { display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 99px; text-decoration: none; color: var(--ink); background: var(--surface-2); font-size: .88rem; font-weight: 700; }
.downloads small { color: #fff; background: var(--accent); border-radius: 6px; padding: 0 5px; font-weight: 900; font-size: .65rem; }

/* ---------- ぶん ---------- */
.phrase-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin: 0 0 14px; box-shadow: var(--shadow); border-top: 5px solid var(--accent); }
.phrase-card p { margin: 0; }
.phrase-card p.ja { font-size: 1.15rem; display: flex; align-items: flex-start; margin-top: 10px; line-height: 2.05; font-weight: 700; }
.phrase-card p.ja:first-child { margin-top: 0; }
.phrase-card p.ja button.play { margin-top: 7px; }
.phrase-card p[data-l] {
  color: var(--ink); font-size: .9rem; line-height: 1.7; margin: 6px 0 2px 40px; padding: 6px 12px;
  background: var(--surface-2); border-radius: 12px; position: relative;
}
.phrase-card p[data-l]::before { content: attr(data-l); text-transform: uppercase; font-size: .6rem; font-weight: 900; color: var(--accent); margin-right: 8px; letter-spacing: .06em; }
.phrase-card .thumb { margin-top: 12px; }
.phrase-card .thumb img { width: 100%; max-width: 380px; border-radius: 14px; border: 1px solid var(--line); background: #fff; display: block; }
.insist { color: var(--accent); font-weight: 900; }

/* ---------- ことば ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 4px; margin: -6px -4px 0; } /* 狭い画面では 2 行に折り返す（ボタンが隠れないように） */
.toolbar::-webkit-scrollbar { display: none; }
.toolbar.sticky { position: sticky; top: var(--top-h); z-index: 10; background: color-mix(in srgb, var(--bg) 92%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
@media (min-width: 900px) { .toolbar.sticky { top: calc(var(--top-h) + 72px); } }
.toolbar .pill svg { width: 12px; height: 12px; }
.hide-label { color: var(--muted); font-size: .8rem; font-weight: 700; margin-left: 6px; white-space: nowrap; }
.words { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
@media (min-width: 900px) { .words { grid-template-columns: 1fr 1fr; } }
.word { display: flex; gap: 14px; align-items: flex-start; background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); scroll-margin: 130px; transition: border-color .2s, box-shadow .2s; }
.word.current { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft), var(--shadow); }
.w-body { min-width: 0; flex: 1; }
.w-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; line-height: 1.45; }
.w-kanji { font-size: 1.6rem; font-weight: 900; }
.w-kana { font-size: 1rem; color: var(--accent); font-weight: 700; }
.w-kana.solo { font-size: 1.5rem; font-weight: 900; color: var(--ink); }
.w-romaji { font-size: .85rem; color: var(--muted); }
.w-imi { margin-top: 4px; font-size: .95rem; }
.w-imi .form { margin-left: 8px; font-size: .68rem; font-weight: 700; color: var(--accent); background: var(--accent-soft); border-radius: 99px; padding: 1px 8px; white-space: nowrap; }
.w-rei { margin: 10px 0 0; padding: 8px 10px; border-radius: 12px; background: var(--surface-2); display: flex; align-items: flex-start; font-size: .95rem; line-height: 2; }
.w-rei button.play { margin-top: 3px; background: var(--surface); }
.w-tr { display: block; font-size: .82rem; line-height: 1.6; color: var(--muted); margin-bottom: 4px; }
.cover { border-radius: 8px; transition: background-color .15s; }
.hide-w-kana .w-kana, .hide-w-kanji .w-kanji, .hide-w-imi .w-imi, .hide-w-imi .w-tr, .hide-w-rj .w-rj { background: repeating-linear-gradient(-45deg, var(--surface-2) 0 8px, color-mix(in srgb, var(--accent) 10%, var(--surface-2)) 8px 16px); color: transparent !important; cursor: pointer; user-select: none; min-width: 3em; }
.hide-w-kana .w-kana *, .hide-w-kanji .w-kanji *, .hide-w-imi .w-imi *, .hide-w-imi .w-tr *, .hide-w-rj .w-rj * { visibility: hidden; }
.hide-w-kana .w-kana.peek, .hide-w-kanji .w-kanji.peek, .hide-w-imi .w-imi.peek, .hide-w-imi .w-tr.peek, .hide-w-rj .w-rj.peek { background: none; color: inherit !important; }
.hide-w-kana .w-kana.peek *, .hide-w-kanji .w-kanji.peek *, .hide-w-imi .w-imi.peek *, .hide-w-imi .w-tr.peek *, .hide-w-rj .w-rj.peek * { visibility: visible; }
.hide-w-kana .w-kana.solo { color: transparent !important; }
.hide-w-kana .w-kana.solo.peek { color: var(--ink) !important; }

/* ---------- もんだい ---------- */
.quiz { list-style: none; counter-reset: q; padding: 0; margin: 0; display: grid; gap: 14px; }
.quiz > li { counter-increment: q; position: relative; background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); line-height: 2.1; transition: border-color .2s; }
.quiz > li::before { content: counter(q); display: grid; place-items: center; width: fit-content; min-width: 28px; height: 28px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-size: .85rem; font-weight: 900; margin: 0 0 8px; line-height: 1; } /* 番号は 1 行目、文は次の行から */
.quiz > li:has([data-result="ok"]) { border-color: var(--ok); }
.quiz > li:has([data-result="ng"]) { border-color: var(--ng); }
.quiz .q-audio { position: absolute; top: 14px; right: 14px; margin: 0; display: inline-grid; }
.quiz > li:has(.q-audio) { padding-right: 56px; }
.quiz > li.answered .q-audio { animation: pop .3s ease-out; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } }
.qbody { display: inline; }
.q { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 2px; }
.q button {
  min-height: 48px; padding: 6px 16px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface-2);
  cursor: pointer; line-height: 1.9; text-align: left; flex: 1 1 auto; font-weight: 700; box-shadow: 0 3px 0 var(--line);
  transition: transform .1s, box-shadow .1s;
}
.q-bool button { flex: 0 0 76px; text-align: center; font-size: 1.4rem; font-weight: 900; }
.q button:active { transform: translateY(3px); box-shadow: none; }
.q button.right { background: color-mix(in srgb, var(--ok) 14%, var(--surface)); border-color: var(--ok); color: var(--ok); box-shadow: 0 3px 0 var(--ok); animation: pop .25s ease-out; }
.q button.right::after { content: " ◎"; }
.q button.wrong { background: color-mix(in srgb, var(--ng) 12%, var(--surface)); border-color: var(--ng); color: var(--ng); box-shadow: 0 3px 0 var(--ng); text-decoration: line-through; }
.q button.answer { border-color: var(--ok); border-style: dashed; color: var(--ok); }
.q[data-done] button:not(.right):not(.wrong):not(.answer) { opacity: .45; }
.scorebar {
  position: sticky; bottom: calc(var(--tabbar-h) + var(--safe-b) + 20px); margin: 18px auto 0; width: fit-content;
  display: flex; align-items: center; gap: 12px; padding: 6px 6px 6px 20px; border-radius: 99px;
  background: var(--ink); color: var(--bg); box-shadow: var(--shadow-lg);
}
.scorebar[hidden] { display: none; }
.scorebar .score { font-weight: 900; font-variant-numeric: tabular-nums; }
.scorebar .pill { height: 34px; background: var(--accent); color: var(--accent-ink); border: 0; }
@media (min-width: 900px) { .scorebar { bottom: 16px; } }

/* ---------- よみもの ---------- */
.subtitle { color: var(--muted); margin: 0 4px 10px; font-size: .9rem; font-weight: 700; }
.reading-text { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 20px 26px; font-size: 1.2rem; line-height: 2.35; box-shadow: var(--shadow); }
.reading-text .title { font-size: 1.45rem; font-weight: 900; line-height: 1.8; color: var(--accent); }
.reading-text .name { text-align: right; color: var(--muted); font-size: 1rem; margin-bottom: 10px; }
.reading-text p { margin: 0 0 .3em; }
.reading-text table { border-collapse: collapse; font-size: 1rem; }
.reading-text td { padding: 2px 8px; vertical-align: top; }
[data-seg] { border-radius: 8px; transition: background-color .25s; padding: 4px 0; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.player-on [data-seg] { cursor: pointer; }
[data-seg].now { background: var(--hl); box-shadow: 0 0 0 3px var(--hl); }
.player {
  position: fixed; left: 14px; right: 14px; bottom: calc(var(--tabbar-h) + var(--safe-b) + 18px); z-index: 19;
  max-width: 540px; margin: 0 auto; display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 8px;
  background: var(--ink); color: var(--bg); border-radius: 99px; box-shadow: var(--shadow-lg);
}
@media (min-width: 900px) { .player { bottom: 18px; } }
.player .pp { width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; cursor: pointer; flex: none; }
.player .pp svg { width: 20px; height: 20px; }
.player .i-pause, .player.playing .i-play { display: none; }
.player.playing .i-pause { display: block; }
.player .seek { flex: 1; min-width: 0; accent-color: var(--accent); }
.player .time { font-size: .8rem; font-variant-numeric: tabular-nums; min-width: 2.8em; text-align: right; opacity: .8; }
.player .rate { border: 1.5px solid color-mix(in srgb, var(--bg) 35%, transparent); background: transparent; color: inherit; border-radius: 99px; height: 34px; min-width: 54px; font-size: .8rem; font-weight: 700; cursor: pointer; }

/* ---------- スライド ---------- */
.slides { display: grid; gap: 12px; }
.slide-stage { position: relative; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: grid; place-items: center; aspect-ratio: 4 / 3; touch-action: pan-y; user-select: none; cursor: pointer; box-shadow: var(--shadow-lg); }
.slide-stage img { width: 100%; height: 100%; object-fit: contain; }
.slide { margin: 0; position: absolute; inset: 0; display: grid; place-items: center; }
.slide[hidden] { display: none; }
/* 新しいスライド：絵の上に文字の層。幅に合わせて文字も大きさが変わる（cqw） */
.sv2 { position: relative; width: 100%; aspect-ratio: 4 / 3; max-height: 100%; container-type: inline-size; background: #fff; }
.sv2 .sv-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
/* 最初は旧版。上の「ベータ版を試す」（html[data-beta]）で新しい版に */
.slide .sv2 { display: none; }
html[data-beta] .slide .sv2 { display: block; }
html[data-beta] .slide:has(.sv2) .v-old { display: none; }
/* 旧版の絵は 4:3 の枠に（右下のアドレスを絵に合わせて重ねるため） */
.slide .v-old { position: relative; height: 100%; max-width: 100%; aspect-ratio: 4 / 3; container-type: inline-size; }
/* 右下のアドレス：元の「http://www.nihongo.fr/」（右下 約30%×4.5%）を白い帯で隠して上に書く */
.slide-url { position: absolute; right: 0; bottom: 0; width: 31%; height: 5%; z-index: 4; display: flex; align-items: center; justify-content: flex-end; padding-right: 1.2%; box-sizing: border-box; background: #fff; border-top-left-radius: 1.2cqw; font: 600 2.1cqw/1 "Zen Maru Gothic", system-ui, sans-serif; color: #8a8295; letter-spacing: .02em; pointer-events: none; }
.sv2 .slide-url { background: rgba(255, 255, 255, .82); width: auto; padding: 0 1.2%; }
.betasw { font: inherit; font-size: .78rem; font-weight: 700; padding: .3em .8em; border-radius: 999px; border: 1.5px dashed var(--accent); background: transparent; color: var(--accent); cursor: pointer; white-space: nowrap; }
.betasw .b-on, html[data-beta] .betasw .b-off { display: none; }
html[data-beta] .betasw .b-on { display: inline; }
html[data-beta] .betasw { background: var(--accent); color: #fff; border-style: solid; }
.betasw .b-ic { display: none; }
@media (max-width: 640px) { .betasw .b-off, html[data-beta] .betasw .b-on { display: none; } .betasw .b-ic { display: inline; } }
/* 部品を組み合わせた場面：人物は高さで大きさを決め、x は中心 */
.sv2 .sv-actor { position: absolute; width: auto; max-width: none; object-fit: fill; transform: translateX(-50%); pointer-events: none; }
.sv-actor.flip { transform: translateX(-50%) scaleX(-1); }
.sv2 .sv-shadow { position: absolute; transform: translateX(-50%); border-radius: 50%; background: radial-gradient(closest-side, rgba(40, 30, 20, .28), rgba(40, 30, 20, 0)); pointer-events: none; }
.sv2 .sv-icon { background: #fff; border-radius: 22%; padding: .6cqw; box-sizing: content-box; box-shadow: 0 .3cqw 1cqw rgba(0, 0, 0, .18); }
.sv-face { position: absolute; z-index: 3; overflow: hidden; border-radius: 50%; background: #fff; border: .3cqw solid #555; }
.sv2 .sv-face img { position: absolute; left: 50%; top: 3%; height: 560%; width: auto; max-width: none; object-fit: fill; transform: translateX(-50%); }
.sv-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.sv-box, .sv-bubble, .sv-text { position: absolute; display: flex; color: #222; font-family: var(--font); font-weight: 700; }
.sv-box { align-items: flex-start; padding: 1.2cqw 1.6cqw; }
.sv-bubble { align-items: center; justify-content: center; text-align: center; padding: 1.5cqw 3cqw; }
.sv-text { align-items: center; }
/* 中間版：文字の行の場所にそのまま置く（余白なし・左上から） */
.sv-box.over, .sv-bubble.over, .sv-text.over { padding: 0; align-items: flex-start; justify-content: flex-start; text-align: left; }
.sv-bubble.over { justify-content: center; text-align: center; }
/* 描き直した絵（背景あり）の上に枠なしで置く文字は、白いふちで読みやすく */
.sv-text.full .sv-t { -webkit-text-stroke: 0; text-shadow: 0 0 .5cqw #fff, 0 0 .5cqw #fff, 0 0 .8cqw #fff, 0 0 1.2cqw #fff; }
.sv-box.full { background: var(--fill, #ffffd2); border: .35cqw solid #555; border-radius: 1.6cqw; }
.sv-bubble.full { background: var(--fill, #fff); border: .35cqw solid #333; border-radius: 1.6cqw; }
.sv-blank { position: absolute; border-radius: .8cqw; border: .3cqw solid #c77; }
.sv-t { font-size: calc(var(--fs) * 0.06cqw); line-height: 1.32; white-space: pre; letter-spacing: .02em; }
.sv-t rt { font-size: .45em; color: #c33; }
.m-r { color: #d61f1f; } .m-b { color: #1d4fd8; } .m-g { color: #138a3e; }
.m-u { text-decoration: underline; text-decoration-thickness: .12em; text-underline-offset: .15em; }
.slide-ver { text-align: center; margin: 0; }
.slide-bar { display: flex; align-items: center; justify-content: center; gap: 18px; }
.slide-bar button { width: 56px; height: 46px; border-radius: 99px; border: 0; background: var(--accent); color: var(--accent-ink); font-size: 1.6rem; font-weight: 900; line-height: 1; cursor: pointer; box-shadow: 0 6px 14px -8px var(--accent); }
.slide-bar button:active { transform: scale(.94); }
.slide-no { font-variant-numeric: tabular-nums; font-weight: 900; min-width: 5em; text-align: center; }
.slide-audio { display: flex; align-items: center; justify-content: center; gap: 8px 12px; flex-wrap: wrap; }
.slide-audio .play { width: 48px; height: 48px; background: var(--accent-soft); }
.slide-audio .play svg { width: 20px; height: 20px; }
.slide-range { width: 100%; accent-color: var(--accent); }
.slides .hint { text-align: center; margin: 0; }
.slide-stage { width: 100%; justify-self: center; }
/* 画面が大きいときは高さに合わせて幅をしぼり、中央に（4:3 のまま） */
@media (min-width: 900px) { .slide-stage, .slide-range { max-width: calc((100vh - 300px) * 4 / 3); justify-self: center; } }

/* ---------- かんじ ---------- */
.kanji-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
@media (min-width: 640px) { .kanji-list { grid-template-columns: 1fr 1fr; } }
.kanji-card { display: flex; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.kanji-big {
  flex: none; width: 88px; height: 88px; display: grid; place-items: center; font-size: 3.5rem; line-height: 1; border-radius: 18px; color: var(--accent);
  background: var(--accent-soft); font-family: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", serif;
  background-image: linear-gradient(color-mix(in srgb, var(--accent) 18%, transparent) 1px, transparent 1px), linear-gradient(90deg, color-mix(in srgb, var(--accent) 18%, transparent) 1px, transparent 1px);
  background-size: 50% 50%; background-position: center;
}
.kanji-info { min-width: 0; }
.kanji-info p { margin: 0; }
.yomi { display: flex; flex-wrap: wrap; gap: 0 10px; font-size: .95rem; font-weight: 700; }
.yomi .on { color: var(--accent); }
.mean { font-size: .88rem; color: var(--muted); }
.kw { margin-top: 4px !important; display: flex; flex-wrap: wrap; gap: 0 14px; font-size: 1.05rem; line-height: 2.1; }
ruby.always rt { visibility: visible !important; }
button.kanji-big { border: 0; cursor: pointer; padding: 0; position: relative; color: var(--accent); transition: transform .12s; }
button.kanji-big:active { transform: scale(.95); }
.kanji-big small { position: absolute; left: 0; right: 0; bottom: 3px; font-family: var(--font); font-size: .55rem; font-weight: 700; line-height: 1; opacity: .75; }

/* ---------- 書き順 ---------- */
.stroke-sheet .sheet-head b { display: flex; align-items: baseline; gap: 10px; }
.sk-char { font-size: 1.6rem; font-weight: 900; color: var(--accent); }
.sk-count { color: var(--muted); font-size: .85rem; font-weight: 700; }
.sk-stage { margin: 6px auto 0; width: min(280px, 72vw); aspect-ratio: 1; border-radius: 22px; background: #fffdf8; border: 2px solid var(--line); overflow: hidden; }
.sk-svg { width: 100%; height: 100%; display: block; }
.sk-grid { stroke: #e9c9c3; stroke-width: .5; stroke-dasharray: 2 2; fill: none; }
.sk-ghost path { stroke: #ece6dc; }
.sk-ink path, .sk-ghost path { fill: none; stroke-width: 4.2; stroke-linecap: round; stroke-linejoin: round; }
.sk-ink path { stroke: #2d2a3a; }
.sk-ink path.cur { stroke: var(--accent); }
.sk-num { font: 700 7px var(--font); fill: var(--accent); }
.sk-num.done { fill: #b9b1a6; }
.sk-ctrl { display: flex; justify-content: center; align-items: center; gap: 12px; margin: 12px 0 4px; }
.sk-ctrl button { width: 48px; height: 44px; border-radius: 99px; border: 0; background: var(--surface-2); font-size: 1.5rem; font-weight: 900; line-height: 1; cursor: pointer; color: var(--ink); display: grid; place-items: center; }
.sk-ctrl .sk-play { width: 58px; height: 58px; background: var(--accent); color: var(--accent-ink); box-shadow: 0 8px 16px -8px var(--accent); }
.sk-play svg { width: 24px; height: 24px; }
.sk-play .i-replay, .sk-play.done .i-play { display: none; }
.sk-play.done .i-replay { display: block; }
.sk-ctrl .sk-speed { font-size: .85rem; width: 54px; }
.sk-frames { list-style: none; padding: 4px 2px; margin: 8px 0 0; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: thin; }
.sk-frames li { flex: none; width: 52px; text-align: center; font-size: .65rem; font-weight: 700; color: var(--muted); cursor: pointer; }
.sk-frames svg { width: 52px; height: 52px; display: block; border-radius: 10px; background: #fffdf8; border: 1.5px solid var(--line); }
.sk-frames li.on svg { border-color: var(--accent); }
.sk-frames path { fill: none; stroke: #2d2a3a; stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.sk-frames path.cur { stroke: var(--accent); }
.credit { margin: 10px 0 0; text-align: center; font-size: .68rem; color: var(--muted); line-height: 1.5; }
.credit a { color: inherit; }

/* ---------- ふりがな設定シート ---------- */
dialog.sheet {
  border: 0; padding: 0; margin: auto auto 0; width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto;   /* 低い画面でも 下の項目（文字の大きさ）まで 届く */
  background: var(--surface); color: var(--ink); border-radius: 28px 28px 0 0; box-shadow: 0 -10px 40px rgba(0, 0, 0, .25);
}
@media (min-width: 640px) { dialog.sheet { margin: auto; border-radius: 28px; } }
dialog.sheet::backdrop { background: rgba(30, 20, 40, .45); }
dialog.sheet[open] { animation: up .22s ease-out; }
@keyframes up { from { transform: translateY(30px); opacity: 0; } }
.sheet form { padding: 10px 20px calc(20px + var(--safe-b)); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 0 4px; }
.sheet-head b { font-size: 1.15rem; font-weight: 900; }
.sheet .close { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--surface-2); cursor: pointer; }
.sheet h3 { font-size: .8rem; color: var(--muted); margin: 16px 0 6px; font-weight: 700; }
.seg { display: flex; background: var(--surface-2); border-radius: 16px; padding: 4px; gap: 2px; margin-top: 8px; }
.seg label { flex: 1; position: relative; }
.seg input { position: absolute; opacity: 0; }
.seg label > span { display: block; text-align: center; padding: 9px 4px; border-radius: 12px; font-size: .9rem; font-weight: 700; cursor: pointer; white-space: nowrap; color: var(--muted); }
.seg input:checked + span { background: var(--accent); color: var(--accent-ink); box-shadow: 0 4px 10px -6px var(--accent); }
.seg input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--accent) 50%, transparent); }
.help { color: var(--muted); font-size: .8rem; margin: 8px 2px 0; line-height: 1.6; }
.level-row { margin-top: 10px; }
.level-row select { font: inherit; font-size: .9rem; padding: 8px 10px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface-2); color: var(--ink); width: 100%; }
.range { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.range input { flex: 1; accent-color: var(--accent); }
.range output { min-width: 3em; font-weight: 900; font-variant-numeric: tabular-nums; color: var(--accent); }
.sheet [data-for] { display: none; }
.sheet[data-mode="auto"] [data-for="auto"], .sheet[data-mode="level"] [data-for="level"] { display: block; }
.preview { margin: 16px 0 0; padding: 14px 16px; background: var(--hl); border-radius: 16px; font-size: 1.15rem; line-height: 2.2; font-weight: 700; }

/* ---------- はじめましょう：入門ページ ---------- */
.t-moji { --c: var(--c-phrase); } .t-kana { --c: var(--c-voca); } .t-suji { --c: var(--c-question); } .t-kakikata { --c: var(--c-reading); }
.sec-moji { --accent: var(--c-phrase); } .sec-kana { --accent: var(--c-voca); } .sec-suji { --accent: var(--c-question); } .sec-kakikata { --accent: var(--c-reading); }
.lead { font-size: 1.02rem; margin: 6px 4px 12px; }
.help[data-l], .moji-exp .help { margin: 0; }

/* かな */
.kana-switch { max-width: 320px; margin: 4px auto 6px; }
.kana-sec h2 { margin: 18px 4px 8px; }
.kana-grid { display: grid; gap: 6px; container-type: inline-size; }
.kana-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.kana-row.yoon { grid-template-columns: repeat(3, 1fr); }
.kana-cell {
  aspect-ratio: 1; border: 0; border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; padding: 0;
  font-family: "UD Digi Kyokasho N-B", "UDDigiKyokashoN-B", "UD デジタル 教科書体 N-B", "Klee One", "YuKyokasho", var(--font, sans-serif);   /* 教科書体 */
  font-size: clamp(1.7rem, 9.5cqi, 4.2rem); font-weight: 600; line-height: 1.1; color: var(--ink); transition: transform .1s;
}
.kana-row.yoon .kana-cell { aspect-ratio: auto; height: clamp(64px, 15cqi, 130px); font-size: clamp(1.5rem, 7.5cqi, 3.4rem); }
.kana-cell small { font-family: var(--font, sans-serif); font-size: clamp(.72rem, 3.6cqi, 1.5rem); font-weight: 700; color: var(--muted); letter-spacing: .02em; }   /* 枠の幅に合わせて かな・ローマ字も大きく */
.kana-cell.empty { background: none; box-shadow: none; }
.kana-cell:active { transform: scale(.92); }
.kana-cell.playing { background: var(--accent); color: var(--accent-ink); }
.kana-cell.playing small { color: inherit; }
.kana-tables .kata, .kana-tables.show-kata .hira { display: none; }
.kana-tables.show-kata .kata { display: flex; }
.kana-quiz { margin-top: 26px; }
.kq-opts { display: grid; gap: 10px; }
.kq-groups { display: flex; flex-wrap: wrap; gap: 6px; }
.kq-stage { display: grid; place-items: center; margin: 16px 0 10px; }
.kq-q { min-width: 120px; height: 120px; padding: 0 20px; border-radius: 28px; border: 0; background: var(--accent-soft); color: var(--accent); font-size: 3.2rem; font-weight: 900; cursor: pointer; }
.kq-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kq-choices button { min-height: 56px; border-radius: 16px; border: 2px solid var(--line); background: var(--surface-2); font-size: 1.3rem; font-weight: 700; cursor: pointer; box-shadow: 0 3px 0 var(--line); }
.kq-choices button.right { border-color: var(--ok); color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, var(--surface)); box-shadow: 0 3px 0 var(--ok); }
.kq-choices button.wrong { border-color: var(--ng); color: var(--ng); background: color-mix(in srgb, var(--ng) 12%, var(--surface)); box-shadow: 0 3px 0 var(--ng); }
.mini-quiz { margin-top: 26px; scroll-margin-top: 80px; }
.mq-stage { display: grid; place-items: center; margin: 16px 0 10px; text-align: center; }
.mq-q { min-width: 140px; min-height: 100px; padding: 6px 22px; border-radius: 28px; border: 0; background: var(--accent-soft); color: var(--accent); font-size: 2.4rem; font-weight: 900; cursor: pointer; line-height: 1.3; }
.mq-sub { margin: 8px 0 0; color: var(--muted); font-size: .9rem; min-height: 1.4em; }
.mq-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mq-choices button { min-height: 56px; border-radius: 16px; border: 2px solid var(--line); background: var(--surface-2); font-size: 1.05rem; font-weight: 700; cursor: pointer; box-shadow: 0 3px 0 var(--line); padding: 6px 10px; line-height: 1.4; }
.mq-choices button[lang="ja"] { font-size: 1.3rem; }
.mq-choices button.right { border-color: var(--ok); color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, var(--surface)); box-shadow: 0 3px 0 var(--ok); }
.mq-choices button.wrong { border-color: var(--ng); color: var(--ng); background: color-mix(in srgb, var(--ng) 12%, var(--surface)); box-shadow: 0 3px 0 var(--ng); }
.mq-score { text-align: center; font-weight: 900; color: var(--muted); margin: 10px 0 0; min-height: 1.5em; }
.kq-score { text-align: center; font-weight: 900; color: var(--muted); margin: 10px 0 0; min-height: 1.5em; }

/* すうじ */
.num-grid { list-style: none; padding: 0; margin: 8px 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.play-cell { width: 100%; border: 0; border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); padding: 10px 6px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; line-height: 1.3; }
.play-cell b { font-size: 1.4rem; font-weight: 900; color: var(--accent); font-variant-numeric: tabular-nums; }
.play-cell span { font-size: .85rem; font-weight: 700; }
.play-cell.playing { background: var(--accent); color: var(--accent-ink); }
.play-cell.playing b { color: inherit; }
.num-grid.special .play-cell { background: var(--hl); }
.num-conv-row { display: flex; gap: 8px; }
.num-conv-row input { flex: 1; min-width: 0; font: inherit; font-size: 1.3rem; font-weight: 700; padding: 8px 14px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface-2); color: var(--ink); }
.num-out { font-size: 1.3rem; font-weight: 700; color: var(--accent); min-height: 1.8em; margin: 10px 4px 0; word-break: break-all; }

/* もじ */
.moji-kinds { list-style: none; padding: 0; margin: 0 0 8px; display: grid; gap: 10px; }
@media (min-width: 640px) { .moji-kinds { grid-template-columns: 1fr 1fr; } }
.moji-kinds li { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.moji-kinds i { flex: none; font-style: normal; width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--k); color: #fff; font-size: 1.5rem; font-weight: 900; }
.moji-kinds b { color: var(--k); }
.mk-d { display: block; font-size: .88rem; line-height: 1.6; color: var(--muted); }
.mk-hira { --k: var(--c-phrase); } .mk-kata { --k: var(--c-question); } .mk-kanji { --k: var(--c-reading); } .mk-roma { --k: var(--c-diapo); }
.moji-sentence { font-size: 1.5rem; line-height: 2.4; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 4px 0 10px; }
.mw { font: inherit; font-weight: 700; border: 0; cursor: pointer; padding: 0 6px; border-radius: 10px; background: color-mix(in srgb, var(--k) 14%, var(--surface)); color: var(--k); border-bottom: 3px solid var(--k); line-height: 1.7; }
.mw.on { background: var(--k); color: #fff; }
.mw.on rt { color: #fff; }
.moji-sentence .play { margin-left: 8px; }
.moji-sentence .mw-kuten { margin-left: -4px; line-height: 1.7; padding-bottom: 3px; }   /* 「。」を ボタンの 字と 同じ 高さに */
.moji-exp { background: var(--surface-2); border-radius: 16px; padding: 12px 14px; min-height: 90px; }
.moji-exp p { margin: 0 0 4px; }
.me-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.me-head b { font-size: 1.4rem; }
.me-type { font-size: .75rem; font-weight: 900; color: #fff; background: var(--k); border-radius: 99px; padding: 1px 10px; }
.me-yomi { color: var(--muted); font-size: .9rem; }

/* かきかた */
.font-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
@media (min-width: 640px) { .font-list { grid-template-columns: 1fr 1fr; } }
.font-card { background: var(--surface); border-radius: var(--radius); padding: 12px 16px; box-shadow: var(--shadow); }
.font-name { margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.font-name b { font-size: 1.05rem; color: var(--accent); }
.font-name span[lang] { color: var(--muted); font-size: .8rem; }
.font-use { font-size: .8rem; color: var(--muted); }
.font-use::before { content: "— "; }
.font-sample { margin: 2px 0 0; font-size: 2.6rem; line-height: 1.5; letter-spacing: .08em; font-weight: 400; }
.f-mincho { font-family: "Zen Old Mincho", "Hiragino Mincho ProN", serif; font-weight: 600; }
.f-gothic { font-family: "Zen Kaku Gothic New", "Hiragino Sans", sans-serif; font-weight: 500; }
.f-kyokasho { font-family: "Klee One", "YuKyokasho", cursive; font-weight: 600; }
.f-fude { font-family: "Yuji Syuku", serif; }

/* このサイトについて */
.hero-link { margin: 10px 0 0 !important; position: relative; z-index: 1; }
.hero-link a { font-weight: 900; color: var(--accent); text-decoration: none; }
.about-hero h1 { margin-top: 0; }
.about-list { margin: 0; padding-left: 1.3em; display: grid; gap: 8px; }
.about-list li::marker { color: var(--accent); font-weight: 900; }
.about-list.credits { list-style: none; padding: 0; font-size: .9rem; }
.about-list.credits li { padding: 8px 12px; background: var(--surface-2); border-radius: 12px; }
.contact-mail { font-size: 1.1rem; font-weight: 900; margin: 6px 0 0; }

/* ---------- スタート画面のタイトル画（京子さん＋ j-learning.com） ---------- */
.title-art { position: relative; overflow: hidden; border-radius: var(--radius); margin-bottom: 16px; aspect-ratio: 16 / 7; min-height: 250px; box-shadow: var(--shadow-lg); isolation: isolate; color: #2b2733; }
.ta-sky { position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, #bfe6ff 0%, #e9f7ff 58%, #fff6e3 100%); }
.ta-sky .cloud { position: absolute; width: 120px; height: 34px; background: #fff; border-radius: 40px; opacity: .92; animation: ta-drift 46s linear infinite; }
.ta-sky .cloud::before, .ta-sky .cloud::after { content: ""; position: absolute; background: #fff; border-radius: 50%; }
.ta-sky .cloud::before { width: 50px; height: 50px; left: 18px; top: -24px; }
.ta-sky .cloud::after { width: 38px; height: 38px; left: 58px; top: -16px; }
.ta-sky .c1 { top: 14%; left: 4%; }
.ta-sky .c2 { top: 8%; left: 46%; scale: .75; animation-duration: 60s; }
.ta-sky .c3 { top: 28%; left: 70%; scale: .6; animation-duration: 52s; }
.ta-sky .hill { position: absolute; border-radius: 50%; }
.ta-sky .h1 { left: -12%; bottom: -55%; width: 75%; height: 85%; background: #c4e6a8; }
.ta-sky .h2 { right: -18%; bottom: -62%; width: 85%; height: 95%; background: #a9d98d; }
.ta-sky .petal { position: absolute; top: -8%; width: 12px; height: 9px; background: #ffbfd2; border-radius: 80% 0 80% 0; animation: ta-fall 10s linear infinite; }
.ta-sky .p0 { left: 5%; animation-delay: -0.0s; animation-duration: 8s; scale: 0.7; }
.ta-sky .p1 { left: 42%; animation-delay: -1.7s; animation-duration: 11s; scale: 0.9; }
.ta-sky .p2 { left: 79%; animation-delay: -3.4s; animation-duration: 8s; scale: 1.1; }
.ta-sky .p3 { left: 16%; animation-delay: -5.1s; animation-duration: 11s; scale: 0.7; }
.ta-sky .p4 { left: 53%; animation-delay: -6.8s; animation-duration: 8s; scale: 0.9; }
.ta-sky .p5 { left: 90%; animation-delay: -8.5s; animation-duration: 11s; scale: 1.1; }
.ta-sky .p6 { left: 27%; animation-delay: -0.2s; animation-duration: 8s; scale: 0.7; }
.ta-sky .p7 { left: 64%; animation-delay: -1.9s; animation-duration: 11s; scale: 0.9; }
.ta-sky .p8 { left: 1%; animation-delay: -3.6s; animation-duration: 8s; scale: 1.1; }
.ta-sky .p9 { left: 38%; animation-delay: -5.3s; animation-duration: 11s; scale: 0.7; }
.ta-sky .p10 { left: 75%; animation-delay: -7.0s; animation-duration: 8s; scale: 0.9; }
.ta-sky .p11 { left: 12%; animation-delay: -8.7s; animation-duration: 11s; scale: 1.1; }

.ta-tiles { position: absolute; inset: 0; pointer-events: none; }
.ta-tiles b { position: absolute; display: grid; place-items: center; width: 2.3em; height: 2.3em; border-radius: .55em; color: #fff; font-weight: 900; font-size: clamp(14px, 2.6vw, 24px); box-shadow: 0 4px 0 rgba(0, 0, 0, .12); animation: ta-bob 3.2s ease-in-out infinite; }
.ta-tiles b:nth-child(1) { left: 40%; top: 66%; background: var(--c-phrase); rotate: -8deg; }
.ta-tiles b:nth-child(2) { left: 52%; top: 80%; background: var(--c-voca); rotate: 6deg; animation-delay: .4s; }
.ta-tiles b:nth-child(3) { left: 76%; top: 70%; background: var(--c-kanji, #e2557a); rotate: -5deg; animation-delay: .8s; }
.ta-tiles b:nth-child(4) { left: 65%; top: 84%; background: var(--c-diapo); rotate: 7deg; animation-delay: 1.2s; }
.ta-tiles b:nth-child(5) { left: 90%; top: 62%; background: var(--c-question); rotate: 8deg; animation-delay: 1.6s; }
.ta-tiles b:nth-child(6) { left: 88%; top: 6%; background: var(--c-reading, #8c6ad8); rotate: -4deg; animation-delay: 2s; }
.ta-text { position: absolute; left: 40%; top: 15%; width: 58%; }
.ta-logo { margin: 0; font-weight: 900; font-size: clamp(28px, 6vw, 66px); line-height: 1; letter-spacing: -.01em; white-space: nowrap; }
.ta-logo span { display: inline-block; color: #fff; -webkit-text-stroke: .09em #2b2733; paint-order: stroke fill; text-shadow: 0 .06em 0 #2b2733; animation: ta-hop 2.8s ease-in-out infinite; }
.ta-logo .l0 { color: #ff6b5e; } .ta-logo .l1 { color: #ffb238; } .ta-logo .l2 { color: #4cc38a; } .ta-logo .l3 { color: #4aa3ff; } .ta-logo .l4 { color: #b07cf0; }
.ta-logo span:nth-child(1) { animation-delay: 0.00s; }
.ta-logo span:nth-child(2) { animation-delay: 0.08s; }
.ta-logo span:nth-child(3) { animation-delay: 0.16s; }
.ta-logo span:nth-child(4) { animation-delay: 0.24s; }
.ta-logo span:nth-child(5) { animation-delay: 0.32s; }
.ta-logo span:nth-child(6) { animation-delay: 0.40s; }
.ta-logo span:nth-child(7) { animation-delay: 0.48s; }
.ta-logo span:nth-child(8) { animation-delay: 0.56s; }
.ta-logo span:nth-child(9) { animation-delay: 0.64s; }
.ta-logo span:nth-child(10) { animation-delay: 0.72s; }

.ta-logo small { font-size: .42em; color: #2b2733; margin-left: .08em; font-weight: 800; }
.ta-sub { margin: .5em 0 0; display: inline-block; padding: .3em .9em; border-radius: 999px; background: #fff; font-weight: 800; font-size: clamp(13px, 2.4vw, 22px); color: var(--accent); box-shadow: 0 3px 0 rgba(0, 0, 0, .08); }
.ta-kyoko { position: absolute; left: 5%; bottom: 4%; height: 90%; }
.ta-kyoko::before { content: ""; position: absolute; left: 50%; bottom: -1.5%; width: 80%; height: 5%; translate: -50% 0; border-radius: 50%; background: radial-gradient(closest-side, rgba(40, 60, 20, .35), rgba(40, 60, 20, 0)); }
.ta-kyoko img { height: 100%; width: auto; display: block; filter: drop-shadow(0 6px 6px rgba(0, 0, 0, .15)); }
.ta-bubble { position: absolute; left: 104%; top: 22%; padding: .55em .9em; background: #fff; border: 2.5px solid #2b2733; border-radius: 1.2em; font-weight: 800; font-size: clamp(11px, 1.9vw, 17px); line-height: 1.35; white-space: nowrap; animation: ta-bob 3s ease-in-out infinite; }
.ta-bubble::after { content: ""; position: absolute; left: -11px; top: 58%; border: 8px solid transparent; border-right: 11px solid #2b2733; border-left: 0; }
@keyframes ta-drift { from { translate: -30vw 0; } to { translate: 110vw 0; } }
@keyframes ta-fall { from { translate: 0 0; rotate: 0deg; } to { translate: -40px 340px; rotate: 300deg; } }
@keyframes ta-bob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -6px; } }
@keyframes ta-hop { 0%, 80%, 100% { translate: 0 0; } 88% { translate: 0 -.12em; } }
@media (prefers-reduced-motion: reduce) { .title-art *, .title-art *::before { animation: none !important; } }
@media (max-width: 560px) {
  .title-art { aspect-ratio: 4 / 3; }
  .ta-text { left: 5%; top: 8%; width: 92%; }
  .ta-kyoko { left: 3%; bottom: 3%; height: 66%; }
  .ta-bubble { left: 104%; top: 24%; }
  .ta-tiles b:nth-child(6) { left: 84%; top: 46%; }
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ta-sky { filter: brightness(.88) saturate(.9); } }
:root[data-theme="dark"] .ta-sky { filter: brightness(.88) saturate(.9); }

/* ---------- Can-do（スタート画面の課の一覧・課のトップ） ---------- */
.cd-badge { display: inline-block; font-style: normal; font-weight: 900; font-size: .68rem; letter-spacing: .03em; padding: .15em .55em; border-radius: 999px; background: #2fa86b; color: #fff; vertical-align: .1em; white-space: nowrap; }
.cando-mini { display: flex; gap: .45em; align-items: flex-start; margin-top: .35em; font-size: .8rem; line-height: 1.5; }
.cando-mini .cd-items { display: flex; flex-direction: column; color: var(--text); }
.cando-mini .cd::before { content: "✓ "; color: #2fa86b; font-weight: 900; }
.cando-card h2 { display: flex; align-items: center; gap: .5em; flex-wrap: wrap; }
.cando-card .cd-badge { font-size: .8rem; }
.cando-mini .cd { padding-left: 1.1em; text-indent: -1.1em; }

/* ---------- スタート画面のアイコン（リンク） ---------- */
.hero-tags a { display: inline-flex; align-items: center; gap: 5px; color: inherit; text-decoration: none; }
.hero-tags li { cursor: pointer; transition: transform .15s; }
.hero-tags li:hover { transform: translateY(-2px); }

/* ---------- ローマ字モード（ヘッダーの「Rômaji」） ---------- */
.romasw { font: inherit; font-size: .72rem; font-weight: 800; border: 0; background: transparent; color: var(--muted); padding: .35em .6em; border-radius: 999px; cursor: pointer; border-left: 1px solid var(--line); border-radius: 0 999px 999px 0; }
.romasw[aria-pressed="true"] { background: var(--accent); color: #fff; }
.romasw .r-short { display: none; }
@media (max-width: 640px) { .romasw .r-long { display: none; } .romasw .r-short { display: inline; } }
html[data-romaji] .w { text-indent: 0; display: inline-flex; flex-direction: column-reverse; align-items: center; vertical-align: bottom; margin: 0 .1em; line-height: 1.35; }
html[data-romaji] .w::after { content: attr(data-ro); font: 500 .58em/1.15 system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--muted); white-space: nowrap; letter-spacing: .01em; font-style: normal; }
html[data-romaji] .w rt { display: none; }
.w-ro { display: none; }
html[data-romaji] .w-ro { display: inline; margin-left: .5em; font: 600 .95rem/1 system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--muted); }

/* スタート画面のタイトル画（画像） */
.title-img { margin: 0 0 16px; line-height: 0; }
.title-img img { width: 100%; height: auto; border-radius: var(--radius); box-shadow: var(--shadow-lg); display: block; }

/* ---------- スライドの解説 ---------- */
.note-btn { font: inherit; font-size: .85rem; font-weight: 700; cursor: pointer; border: 1.5px solid var(--line); background: var(--surface); color: var(--text); }
.note-btn[aria-expanded="true"] { background: var(--c-diapo, #2fa86b); color: #fff; border-color: transparent; }
.slide-notes { margin: 12px auto 0; max-width: 760px; }
.slide-notes .note { position: relative; background: var(--surface); border-radius: var(--radius); padding: 14px 18px; box-shadow: var(--shadow); line-height: 1.7; }
.slide-notes .note-play { display: inline-flex; align-items: center; gap: .45em; width: auto; height: auto; padding: .45em 1em .45em .7em; margin: 0 0 10px; border-radius: 999px; background: var(--c-diapo, #2fa86b); color: #fff; font: inherit; font-size: .88rem; font-weight: 800; box-shadow: 0 3px 0 rgba(0, 0, 0, .15); }
.slide-notes .note-play svg { width: 1.1em; height: 1.1em; fill: currentColor; }
.slide-notes .note-play.playing { filter: brightness(1.1); outline: 3px solid color-mix(in srgb, var(--c-diapo, #2fa86b) 40%, transparent); }
.note-h { margin: 0 0 2px; font-size: .72rem; font-weight: 800; letter-spacing: .04em; color: var(--c-diapo, #2fa86b); text-transform: uppercase; }
.note-ja { margin: 0; font-size: 1.05rem; }
.note-tr { margin: 2px 0 10px; color: var(--muted); }
.note-pt { margin: 0; }
.note-none { margin: 0; color: var(--muted); }
/* メニュー・ヘッダーでは、ローマ字を出さない */
html[data-romaji] :is(.top, .tabbar, .page-grid) .w { display: inline; margin: 0; }
html[data-romaji] :is(.top, .tabbar, .page-grid) .w::after { content: none; }
html[data-romaji] :is(.top, .tabbar, .page-grid) .w rt { display: revert; }
/* トップページの課の一覧：行がくずれないよう、語の間をつめて、行の高さをそろえる */
html[data-romaji] .lesson-list .w { margin: 0 .04em; line-height: 1.25; }
html[data-romaji] .lesson-list .sum, html[data-romaji] .lesson-list .cd { line-height: 1.9; }
.sv2 .sv-oval.full { border-radius: 1.6cqw; background: #ffd7a8; border-color: #b9824f; }
.sv2 .sv-oval.full { display: grid; place-items: center; } .sv2 .sv-oval .sv-t { text-align: center; }

/* 描き直した絵：重なる枠は絵の外（下の帯）に。絵は上 76% に小さくする */
.sv2.has-band { background: #fdf8ef; }
.sv2 .sv-pic { position: absolute; left: 12%; top: 0; width: 76%; height: 76%; container-type: inline-size; }
.sv2 .sv-band { position: absolute; left: 0; right: 0; bottom: 4%; height: 21%; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 1.2cqw; padding: 0 2cqw; box-sizing: border-box; overflow: hidden; }
.sv2 .sv-band .sv-out { position: static; width: auto; height: auto; max-width: 46%; padding: .6cqw 1.4cqw; }
.sv2 .sv-band .sv-out .sv-t { position: static; white-space: pre; }
.sv2 { overflow: hidden; }

/* 矢印・丸（1 つずつ別の要素） */
.sv2 .sv-arrow { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; z-index: 2; }
.sv2 .sv-ring { position: absolute; border: .5cqw solid #e0302a; border-radius: 50%; box-sizing: border-box; z-index: 2; }

/* 各課のトップページの絵（その課の Can-do の場面） */
.lesson-cover { margin: 0 0 14px; line-height: 0; }
.lesson-cover img { width: 100%; height: auto; border-radius: var(--radius); box-shadow: var(--shadow-lg); display: block; }

/* トップページ：リニューアル中のお知らせ */
.renew-note { margin: 10px 0 0 !important; padding: 8px 12px; border-radius: 10px; background: color-mix(in srgb, var(--accent) 12%, var(--surface, #fff)); border-left: 4px solid var(--accent); font-size: .95rem; position: relative; z-index: 1; }

/* 話している人の顔アイコン（描き直した絵の上に置く） */
.sv2 .sv-who { position: absolute; z-index: 3; border-radius: 50%; overflow: hidden; background: #fff; border: .35cqw solid #555; box-sizing: border-box; box-shadow: 0 .2cqw .8cqw rgba(0, 0, 0, .18); }
.sv2 .sv-who img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- ありさまと じゅぎょう ---------- */
.lp { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 12px; margin: 12px 0; box-shadow: 0 10px 24px -18px rgba(0, 0, 0, .35); }
.lp-head { display: flex; align-items: center; gap: 8px; }
.lp-head .seg { flex: 1; margin: 0; }
.lp-close { flex: none; width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--surface-2); color: var(--ink); font-size: 1.2rem; cursor: pointer; }
.lp-main { display: flex; gap: 10px; align-items: flex-end; margin-top: 10px; }
.lp-ari { flex: none; width: 64px; }
.lp-ari img { width: 100%; height: auto; display: block; }
.lp-bubble { flex: 1; position: relative; background: var(--surface-2); border-radius: 16px; padding: 10px 14px; align-self: center; }
.lp-bubble::before { content: ""; position: absolute; left: -9px; bottom: 18px; border: 9px solid transparent; border-left: 0; border-right-color: var(--surface-2); }
.lp-say { margin: 0; font-size: 1.08rem; font-weight: 800; line-height: 1.6; }
.lp-tr { display: none; margin: 6px 0 0; font-size: .82rem; color: var(--muted); line-height: 1.5; }
.lp.tr-on .lp-tr { display: block; }
.lp-ans { display: grid; gap: 8px; margin-top: 10px; }
.lp-ans:empty { display: none; }
.lp-row { display: flex; flex-wrap: wrap; gap: 6px; }
.lp-row .lp-go { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.lp-choices { display: grid; gap: 6px; }
.lp-choice { text-align: left; font-size: 1.05rem; padding: 10px 14px; border-radius: 14px; line-height: 1.5; }
.lp-choice.ok { background: #2e9d5b; border-color: #2e9d5b; color: #fff; }
.lp-choice.ng { opacity: .45; text-decoration: line-through; }
.lp-input { width: 100%; box-sizing: border-box; font: inherit; font-size: 1.15rem; padding: 10px 12px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface); color: var(--ink); }
.lp-input:focus { outline: none; border-color: var(--accent); }
.lp-answer { margin: 0; font-size: 1.15rem; font-weight: 800; color: var(--accent); line-height: 1.6; }
.lp-hinttext { margin: 0; padding: 6px 10px; border-radius: 10px; background: #fff3c4; color: #5a4500; font-weight: 700; }
.lp-ctl { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.lp-ctl .lp-next { margin-left: auto; }
/* パソコン：スライドの横に（スライドの下のものは左の列のまま） */
@media (min-width: 900px) {
  main.wide:has(.slides.lp-on) { max-width: 1360px; }
  .slides.lp-on { display: grid; grid-template-columns: minmax(0, 1fr) 340px; column-gap: 18px; align-items: start; }
  .slides.lp-on > * { grid-column: 1; }
  .slides.lp-on > .lp { grid-column: 2; grid-row: 1 / span 9; position: sticky; top: 76px; margin: 0; }
  .lp-main { flex-direction: column; align-items: stretch; }
  .lp-ari { width: 130px; align-self: flex-start; order: 2; margin-top: 4px; }
  .lp-bubble { order: 1; }
  .lp-bubble::before { left: 46px; bottom: -9px; border: 9px solid transparent; border-bottom: 0; border-top-color: var(--surface-2); }
  .lp-say { font-size: 1.15rem; }
}
.lp-ari img[hidden] { display: none; }
.slides.lp-on .lp-btn { background: var(--accent); color: var(--accent-ink); }
.lp, .lp * { min-width: 0; }
.lp-say, .lp-tr, .lp-answer, .lp-choice { overflow-wrap: anywhere; }

/* ---------- ビデオ（課の中心。Can-do ごとに 1 本） ---------- */
body.has-tabs[data-lesson] .vhub { --accent: var(--c-video); }
.vhub { margin: 8px 0 6px; }
.vplayer { border-radius: var(--radius); overflow: hidden; background: #000; box-shadow: var(--shadow-lg); }
.vplayer video { display: block; width: 100%; aspect-ratio: 16 / 9; background: #000; }
.vplayer video::cue { color: transparent; background: transparent; }   /* 動画の上には字幕を重ねない（日本語は動画の中、訳は下に出す） */
.vcap { min-height: 3.6em; margin: 10px 0 4px; padding: 10px 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); text-align: center; }
.vcap p { margin: 0; line-height: 1.5; }
.vcap-tr { font-size: 1.02rem; font-weight: 700; }
.vcap-ro { display: none; color: var(--c-video); font-size: .98rem; }
html[data-romaji] .vcap-ro { display: block; }
.vcap p:empty { display: none; }
.vhint { margin: 0 0 14px; color: var(--muted); font-size: .78rem; text-align: center; }
.vlist-h { font-size: 1.05rem; margin: 18px 0 8px; }
.vlist { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.vlist a { display: flex; gap: 12px; align-items: center; padding: 8px; border-radius: var(--radius); text-decoration: none; color: var(--ink);
  background: var(--surface); border: 1.5px solid var(--line); transition: transform .15s; }
.vlist a:active { transform: scale(.98); }
.vlist a[aria-current] { border-color: var(--c-video); background: color-mix(in srgb, var(--c-video) 10%, var(--surface)); }
.vlist img { width: 132px; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 10px; flex: none; }
.vl-txt { display: flex; flex-direction: column; gap: 3px; min-width: 0; font-size: .9rem; }
.vl-txt b { font-size: .85rem; color: var(--c-video); }
.vl-txt small { color: var(--muted); font-weight: 700; }
.vl-txt .cd[data-l="ja"] { font-weight: 700; }
.sub-h { font-size: 1.05rem; margin: 26px 0 4px; }
.page-grid.sub { grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.page-grid.sub a { padding: 12px 6px 10px; font-size: .8rem; }
.page-grid.sub i { width: 40px; height: 40px; border-radius: 13px; font-size: 1.25rem; }
@media (min-width: 640px) { .page-grid.sub { grid-template-columns: repeat(6, 1fr); } }
/* タブバー：ビデオが中心、ほかは「教材」のサブメニュー */
.vtabbar { overflow: visible; }
.vtabbar > a.t-video { flex: 1.4; }
.tab-more { flex: 1; min-width: 0; position: relative; display: flex; }
.tab-more > summary { list-style: none; flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; cursor: pointer;
  color: var(--muted); font-size: .62rem; font-weight: 700; line-height: 1.2; border-radius: 18px; }
.tab-more > summary::-webkit-details-marker { display: none; }
.tab-more > summary i { font-style: normal; font-size: 1.2rem; font-weight: 900; line-height: 1; width: 32px; height: 28px; display: grid; place-items: center; border-radius: 10px; color: var(--c, var(--ink)); }
.tab-more > summary span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.tab-more > summary .caret { font-size: .7rem; color: var(--muted); }
.tab-more > summary[aria-current] { color: var(--c); background: color-mix(in srgb, var(--c) 12%, transparent); }
.tab-more > summary[aria-current] i { background: var(--c); color: #fff; }
.submenu { position: absolute; right: 0; bottom: calc(100% + 10px); min-width: 190px; display: grid; gap: 2px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-lg); z-index: 30; }
.submenu a { flex-direction: row !important; justify-content: flex-start !important; gap: 10px !important; padding: 8px 10px; font-size: .9rem !important; }
.submenu a i { width: 30px !important; height: 30px !important; font-size: 1rem !important; }
@media (min-width: 900px) {
  .tab-more > summary { flex-direction: row; gap: 8px; font-size: .9rem; }
  .tab-more > summary i { width: 30px; height: 30px; font-size: 1rem; }
  .submenu { bottom: auto; top: calc(100% + 10px); }
}

/* ---------- お知らせ（トップ） ---------- */
.news { margin: 14px 0 6px; padding: 12px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); font-size: .9rem; }
.news h2 { font-size: .95rem; margin: 0 0 6px; color: var(--muted); }
.news ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.news li { display: flex; gap: 10px; align-items: baseline; line-height: 1.5; }
.news time { flex: none; font-size: .78rem; font-weight: 700; color: var(--accent); min-width: 6.2em; }
.news a { font-weight: 700; white-space: nowrap; }
.news details { margin-top: 6px; }
.news summary { cursor: pointer; color: var(--muted); font-size: .8rem; }
.news details ul { margin-top: 6px; }

/* ---------- 検索（このページの中・ことば・かんじ） ---------- */
.search-btn {
  flex: none; width: 42px; height: 42px; border-radius: 14px; border: 1px solid var(--line); cursor: pointer; padding: 0;
  background: var(--surface-2); color: var(--ink); display: grid; place-items: center;
}
.search-btn svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.search-sheet { max-width: 640px; }
.search-sheet form { max-height: 82vh; overflow-y: auto; }
.sr-q {
  width: 100%; box-sizing: border-box; margin: 6px 0 4px; padding: 12px 16px; font: inherit; font-size: 1.05rem;
  border: 2px solid var(--line); border-radius: 16px; background: var(--bg); color: var(--ink);
}
.sr-q:focus { outline: none; border-color: var(--accent); }
.sr-page { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 8px 0; padding: 8px 12px; border-radius: 14px; background: var(--surface-2); font-size: .92rem; }
.sr-kanji, .sr-words { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.sr-k, .sr-w { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.sr-kc {
  flex: none; width: 64px; height: 64px; border-radius: 14px; border: 0; background: var(--accent-soft); color: var(--ink);
  font: inherit; font-size: 2.3rem; font-weight: 700; line-height: 1; display: grid; place-items: center;
}
.sr-kc:not([data-stroke]) { cursor: default; }
.sr-ki, .sr-wh { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; line-height: 1.5; }
.sr-on { color: var(--accent); font-size: .9rem; }
.sr-kun { font-size: .9rem; }
.sr-m { flex-basis: 100%; color: var(--muted); font-size: .9rem; }
.sr-meta { flex-basis: 100%; color: var(--muted); font-size: .78rem; }
.sr-ja { font-size: 1.2rem; font-weight: 700; }
.sr-kana { font-size: .95rem; }
.sr-ro { font-size: .82rem; color: var(--muted); }
.sr-l {
  flex: none; min-width: 34px; height: 34px; padding: 0 8px; box-sizing: border-box; border-radius: 99px; display: grid; place-items: center;
  background: var(--surface-2); color: var(--ink); text-decoration: none; font-size: .85rem; font-weight: 700;
}
.sr-l::before { content: "L"; font-size: .7em; opacity: .6; margin-right: 1px; }
.sr-none { color: var(--muted); }
mark.find-hit { background: #ffe066; color: #2d2a3a; border-radius: 3px; padding: 0 1px; }
mark.find-hit.cur { background: #ff9f43; outline: 2px solid #ff9f43; }
.findbar {
  position: fixed; z-index: 60; left: 50%; transform: translateX(-50%); bottom: calc(16px + var(--safe-b, 0px));
  display: flex; align-items: center; gap: 6px; padding: 6px 8px 6px 16px; border-radius: 99px;
  background: var(--ink); color: var(--bg); box-shadow: 0 10px 30px rgba(0, 0, 0, .3); font-size: .9rem;
}
.findbar button { width: 36px; height: 36px; border: 0; border-radius: 50%; background: transparent; color: inherit; font-size: 1.2rem; cursor: pointer; }
.findbar .fb-count { min-width: 56px; text-align: center; font-weight: 700; }
@media (max-width: 420px) { .search-btn { width: 38px; height: 38px; } }
.findbar[hidden] { display: none; }

.w-rj { display: inline-block; }
.hide-w-rj .w-rj, .hide-w-imi .w-tr { min-width: 6em; }

/* ---------- スマートボタン（ビデオの場面の ことば・文法・漢字） ---------- */
.vstage { position: relative; }
.smart-btn {
  display: inline-flex; align-items: center; gap: 6px; margin: 10px 0 0; padding: 8px 16px; border-radius: 99px; cursor: pointer;
  border: 1.5px solid var(--accent); background: var(--accent-soft); color: var(--ink); font: inherit; font-size: .92rem; font-weight: 700;
}
.smart-btn i { font-style: normal; }
.smart-btn[aria-expanded="true"] { background: var(--accent); color: var(--accent-ink); }
.smart-panel {
  margin: 10px 0 0; padding: 12px 16px 14px; border-radius: var(--radius); background: var(--surface); border: 1.5px solid var(--accent);
  box-shadow: var(--shadow); animation: sp-in .2s ease-out;
}
@keyframes sp-in { from { opacity: 0; transform: translateY(-6px); } }
.sp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.sp-head b { font-size: .95rem; }
.sp-close { width: 32px; height: 32px; border-radius: 50%; border: 0; background: var(--surface-2); color: var(--ink); cursor: pointer; }
.smart-panel h4 { margin: 10px 0 4px; font-size: .75rem; color: var(--muted); font-weight: 700; letter-spacing: .03em; }
.sp-pt p { margin: 0; font-size: .92rem; line-height: 1.6; }
.sp-w ul, .sp-u ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.sp-w li, .sp-u li { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 8px; line-height: 1.5; }
.sp-w li .play, .sp-u li .play { align-self: center; }
.sp-ja { font-weight: 700; font-size: 1.05rem; }
.sp-kana { font-size: .85rem; }
.sp-m { color: var(--muted); font-size: .88rem; }
.sp-kl { display: flex; flex-wrap: wrap; gap: 6px; }
.sp-kc { width: 46px; height: 46px; border-radius: 12px; border: 0; background: var(--accent-soft); color: var(--ink); font: inherit; font-size: 1.6rem; font-weight: 700; cursor: pointer; }
.sp-none { margin: 6px 0 0; color: var(--muted); font-size: .88rem; }
/* 広い画面：ボタンはビデオの左横。パネルはビデオに重ねず、左隣に並べる（ページの左の余白を使い、足りなければビデオを少し小さく） */
@media (min-width: 1000px) {
  .smart-btn { position: absolute; left: -76px; top: 0; width: 64px; margin: 0; padding: 12px 4px; flex-direction: column; border-radius: 18px; font-size: .72rem; line-height: 1.2; text-align: center; }
  .smart-btn i { font-size: 1.5rem; }
  .vhub.smart-open .vstage { display: flex; gap: 12px; align-items: stretch; margin-left: calc(-1 * min(332px, max(0px, (100vw - 100%) / 2 - 28px))); }
  .vhub.smart-open .vplayer { flex: 1 1 auto; min-width: 0; }
  .vhub.smart-open .smart-btn { display: none; }
  .smart-panel { order: -1; flex: 0 0 320px; position: relative; margin: 0; padding: 0; animation: sp-slide .22s ease-out; }
  .sp-inner { position: absolute; inset: 0; overflow-y: auto; padding: 12px 16px 14px; }
  @keyframes sp-slide { from { opacity: 0; transform: translateX(-24px); } }
}

.sp-link { cursor: pointer; border-radius: 10px; padding: 2px 6px; margin: 0 -6px; }
.sp-link:hover { background: var(--accent-soft); }

/* 押すと辞書が開く所 */
.dict-link { cursor: pointer; border-radius: 8px; }
.dict-link:hover { background: var(--accent-soft); }
.kanji-col { flex: none; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.kanji-so { border: 0; border-radius: 99px; padding: 3px 10px; background: var(--surface-2); color: var(--ink); font: inherit; font-size: .72rem; font-weight: 700; cursor: pointer; }

.sr-kcol { flex: none; display: flex; flex-direction: column; align-items: center; gap: 5px; }

/* 使えることば：2 列の札 */
.sp-u ul { display: grid !important; grid-template-columns: 1fr 1fr; gap: 6px !important; }
.sp-chip { display: flex !important; flex-direction: column; gap: 0 !important; padding: 5px 9px; border-radius: 10px; background: var(--surface-2); cursor: pointer; line-height: 1.3 !important; min-width: 0; }
.sp-chip:hover { background: var(--accent-soft); }
.sp-cj { font-weight: 700; font-size: .95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-cm { color: var(--muted); font-size: .74rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 使えることば：広い画面のパネルでは 3 列に詰める。文法の説明も少し小さく。下の端をぼかして、続きがあるとわかるように */
@media (min-width: 1000px) {
  .sp-u ul { grid-template-columns: 1fr 1fr 1fr; gap: 5px !important; }
  .sp-chip { padding: 4px 7px; }
  .sp-cj { font-size: .88rem; }
  .sp-cm { font-size: .68rem; }
  .sp-pt p { font-size: .84rem; line-height: 1.5; }
  .smart-panel h4 { margin: 7px 0 3px; }
  .sp-inner { -webkit-mask-image: linear-gradient(#000 calc(100% - 26px), transparent); mask-image: linear-gradient(#000 calc(100% - 26px), transparent); padding-bottom: 26px; }
}

/* パネルの見出しと ✕ は、中をスクロールしても上に残す */
.sp-head { position: sticky; top: 0; z-index: 1; background: var(--surface); margin: -12px -16px 4px; padding: 10px 16px 6px; }

/* ---------- YouTube と Coming soon ---------- */
.vbox { aspect-ratio: 16 / 9; background: #000; }
.vbox > div, .vbox iframe, .vbox video { display: block; width: 100%; height: 100%; border: 0; }
.vsoon { aspect-ratio: 16 / 9; background-size: cover; background-position: center; position: relative; display: grid; place-items: center; }
.vsoon[hidden] { display: none; }
.vsoon::before { content: ""; position: absolute; inset: 0; background: linear-gradient(rgba(10, 30, 40, .25), rgba(10, 30, 40, .62)); }
.vsoon-in { position: relative; text-align: center; color: #fff; padding: 0 16px; }
.vsoon-in b { display: block; font-size: clamp(2rem, 7vw, 3.8rem); font-weight: 900; letter-spacing: .04em; text-shadow: 0 4px 18px rgba(0, 0, 0, .45); }
.vsoon-in small { display: block; margin-top: 6px; font-size: clamp(.8rem, 2.2vw, 1.05rem); font-weight: 700; text-shadow: 0 2px 8px rgba(0, 0, 0, .5); }
.soon-badge, .dev-badge { font-style: normal; font-size: .7rem; font-weight: 800; padding: 1px 8px; border-radius: 99px; }
.soon-badge { background: var(--accent-soft); color: var(--accent); }
.dev-badge { background: #ffe8a3; color: #7a5200; margin-left: 4px; }
