/* AWS 合格ノート:ノート共通の見た目 */
[hidden]{display:none!important}

/* Layout: 左に丸い目次、右に読みやすい幅の本文。各ページの頭に空色の帯とくも先生。 */
:root {
  --paper: #f1f7fc;
  --surface: #ffffff;
  --ink: #23344a;
  --muted: #55657a;
  --line: #dce7f1;
  --accent: #2f7fc0;
  --sky: #4a9edb;
  --accent-soft: #dceefb;
  --marker: #ffe08a;
  --sun: #ffc94d;
  --ok: #1f7a55;
  --ok-soft: #e2f4ec;
  --warn: #8a6100;
  --warn-soft: #fff6dc;
  --bad: #b2412f;
  --bad-soft: #fde9e4;
  --font-display: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "Hiragino Sans", "Yu Gothic", sans-serif;
  --font-body: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0f1a26; --surface: #172433; --ink: #e6eef6; --muted: #9db0c4; --line: #263a4f;
    --accent: #8cc4f0; --sky: #4a9edb; --accent-soft: #1c3247; --marker: #6b5a1a; --sun: #ffc94d;
    --ok: #74d6a8; --ok-soft: #143326; --warn: #f5c868; --warn-soft: #3a2f10; --bad: #f4a090; --bad-soft: #3d1f1a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0f1a26; --surface: #172433; --ink: #e6eef6; --muted: #9db0c4; --line: #263a4f;
  --accent: #8cc4f0; --sky: #4a9edb; --accent-soft: #1c3247; --marker: #6b5a1a; --sun: #ffc94d;
  --ok: #74d6a8; --ok-soft: #143326; --warn: #f5c868; --warn-soft: #3a2f10; --bad: #f4a090; --bad-soft: #3d1f1a;
  color-scheme: dark;
}

* { box-sizing: border-box; }
body {
  background: var(--paper); color: var(--ink);
  font-family: var(--font-body); font-weight: 500; font-size: 16px; line-height: 1.9;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

.shell { max-width: 1160px; margin: 0 auto; display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 40px; padding-block: 32px 64px; }

/* ---------- 目次 ---------- */
.toc { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 24px); align-self: start; display: flex; flex-direction: column; gap: 4px; }
.brand { font-family: var(--font-display); font-weight: 900; font-size: 1.15rem; line-height: 1.35; margin-bottom: 4px; }
.brand small { display: block; font-family: var(--font-body); font-weight: 400; font-size: .78rem; color: var(--muted); }
.toc-label { font-size: .72rem; letter-spacing: .12em; color: var(--muted); margin-top: 18px; margin-bottom: 2px; }
.toc button {
  all: unset; cursor: pointer; display: flex; gap: 10px; align-items: baseline;
  padding: 6px 10px; border-radius: 6px; font-size: .92rem; line-height: 1.45; color: var(--ink);
}
.toc button:hover { background: var(--accent-soft); }
.toc button[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.toc button:focus-visible { outline: 2px solid var(--accent); }
.toc .num { font-family: var(--font-mono); font-size: .78rem; color: var(--muted); min-width: 1.6em; }

/* ---------- 本文 ---------- */
main { min-width: 0; }
.view { max-width: 44em; }
.eyebrow { font-family: var(--font-mono); font-size: .8rem; color: var(--accent); letter-spacing: .06em; }
h1, h2, h3 { font-family: var(--font-display); text-wrap: balance; line-height: 1.4; }
h1 { font-size: 2rem; font-weight: 900; margin: 4px 0 12px; }
h2 { font-size: 1.35rem; font-weight: 700; margin: 48px 0 8px; padding-top: 16px; border-top: 1px solid var(--line); }
h2 .sec { font-family: var(--font-mono); font-size: .85rem; color: var(--muted); font-weight: 500; margin-right: 10px; }
h3 { font-size: 1.05rem; margin: 28px 0 4px; }
p { margin: 10px 0; }
.lead { font-size: 1.05rem; color: var(--muted); }
mark { background: linear-gradient(transparent 58%, var(--marker) 58%); color: inherit; padding: 0 1px; }
code, .mono { font-family: var(--font-mono); font-size: .9em; background: var(--accent-soft); padding: 1px 5px; border-radius: 4px; }
ul, ol { padding-left: 1.4em; margin: 8px 0; }
li { margin: 4px 0; }

.goals { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px 20px; margin: 20px 0; }
.goals strong { font-family: var(--font-display); font-size: .9rem; }
.goals ul { margin: 6px 0 0; }

.box { border-radius: 10px; padding: 14px 18px; margin: 18px 0; }
.box .tag { display: inline-block; font-size: .75rem; font-weight: 700; letter-spacing: .08em; padding: 1px 10px; border-radius: 99px; margin-bottom: 4px; }
.box p:last-child, .box ul:last-child { margin-bottom: 0; }
.analogy { background: var(--accent-soft); }
.analogy .tag { background: var(--accent); color: var(--surface); }
.exam { background: var(--warn-soft); }
.exam .tag { background: var(--warn); color: var(--surface); }

.figure { margin: 22px 0; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px; overflow-x: auto; }
.figure svg { display: block; width: 100%; min-width: 560px; height: auto; }
.figure figcaption { font-size: .82rem; color: var(--muted); margin-top: 8px; }
svg text { font-family: var(--font-body); fill: var(--ink); }
svg .t-muted { fill: var(--muted); }
svg .t-accent { fill: var(--accent); font-weight: 700; }
svg .t-mono { font-family: var(--font-mono); }
svg .frame { fill: none; stroke: var(--muted); stroke-dasharray: 6 4; }
svg .vpc { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 1.5; }
svg .az { fill: var(--surface); stroke: var(--line); stroke-dasharray: 4 3; }
svg .pub { fill: var(--ok-soft); stroke: var(--ok); }
svg .priv { fill: var(--paper); stroke: var(--muted); }
svg .node { fill: var(--surface); stroke: var(--ink); }
svg .gw { fill: var(--accent); }
svg .gw-text { fill: var(--surface); font-weight: 700; }
svg .wire { stroke: var(--accent); stroke-width: 1.5; fill: none; }
svg .wire-dash { stroke: var(--muted); stroke-width: 1.3; fill: none; stroke-dasharray: 4 3; }
svg .dot { fill: var(--warn); }

svg .bad { fill: var(--warn-soft); stroke: var(--warn); }
/* シナリオ演習 */
.scn { background: var(--surface); border-radius: 28px; padding: 22px clamp(16px, 3vw, 28px); margin: 28px 0; scroll-margin-top: 90px; }
.scn-head { display: flex; align-items: center; gap: 10px 12px; flex-wrap: wrap; }
.scn-no { font-family: var(--font-mono); font-size: .85rem; background: var(--accent); color: var(--surface); border-radius: 99px; padding: 2px 12px; }
.scn-head h2 { margin: 0; font-size: 1.25rem; }
.scn-lv { margin-left: auto; color: var(--muted); font-size: .85rem; font-weight: 700; }
.scn .box.situation { background: var(--accent-soft); }
.scn .box.situation .tag::before { content: "状"; background: var(--surface); }
.scn .box.ng { background: var(--bad-soft); }
.scn .box.ng .tag { color: var(--bad) !important; }
.scn .box.ng .tag::before { content: "×"; background: var(--surface); color: var(--bad); }
.scn .box:hover { transform: none; box-shadow: none; }
.scn details.more > summary { background: var(--paper); }
.scn details.more > :not(summary) { background: var(--paper); }
.scn details.more > .arch, .scn details.more > .box { padding-left: 20px; }
.arch .steps { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 10px; }
.arch .steps button { font: inherit; font-size: .85rem; font-weight: 700; border: none; border-radius: 99px; padding: 7px 14px; background: var(--surface); color: var(--ink); cursor: pointer; }
.arch .steps button[aria-pressed="true"] { background: var(--accent); color: var(--surface); }
.arch .steps button:focus-visible { outline: 2px solid var(--accent); }
.arch .figure { background: var(--surface); margin: 0 0 10px; }
svg [data-step] { transition: opacity .35s ease; }
svg [data-step].off { opacity: 0; }
svg [data-step].now rect { stroke-width: 2; }
.step-notes { margin: 0; padding-left: 1.4em; }
.step-notes li.off { display: none; }
.step-notes li.now { font-weight: 700; }
.scn-rel { margin: 14px 0 0; font-size: .9rem; color: var(--muted); }
.scn-rel .term { margin-right: 10px; }
.scn-rel .linkish { margin-right: 10px; font: inherit; border: none; background: none; padding: 0; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.scn-index { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; margin: 16px 0 8px; padding: 0; list-style: none; }
.scn-index button { width: 100%; text-align: left; font: inherit; border: none; background: var(--surface); border-radius: 18px; padding: 10px 14px; cursor: pointer; color: var(--ink); display: flex; gap: 10px; align-items: baseline; }
.scn-index button:hover { color: var(--accent); }
/* シナリオ演習の設問(4択) */
.scn-q { margin: 16px 0; }
.scn-q .qt { font-weight: 900; margin: 0 0 10px; line-height: 1.7; }
.scn-ch { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.scn-ch li { margin: 0; }
.scn-ch button { width: 100%; display: flex; gap: 12px; align-items: flex-start; text-align: left; font: inherit; font-weight: 700; line-height: 1.6; color: var(--ink); background: var(--surface); border: 2px solid var(--line); border-radius: 16px; padding: 12px 16px; cursor: pointer; }
.scn-ch button::before { content: ""; flex-shrink: 0; width: 18px; height: 18px; margin-top: 3px; border-radius: 50%; border: 2px solid var(--muted); box-sizing: border-box; }
.scn-ch button:hover:not(:disabled) { border-color: var(--accent); }
.scn-ch button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.scn-ch button:disabled { cursor: default; }
.scn-ch button.pick::before { border: 6px solid var(--accent); }
/* 2つ選ぶ問題は四角の印 */
.scn-ch[data-multi] button::before { border-radius: 5px; }
.scn-ch[data-multi] button.pick:not(:disabled) { border-color: var(--accent); }
.scn-ch button.ok { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.scn-ch button.ok::before { border-color: var(--ok); }
.scn-ch button.ng { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.scn-ch button.ng::before { border-color: var(--bad); }
.scn-ch .mk { font-family: var(--font-mono); flex-shrink: 0; }
.scn-res { margin: 10px 0 0; font-weight: 900; }
.scn-res.ok { color: var(--ok); }
.scn-res.ng { color: var(--bad); }
/* 用語演習 */
.drill-set { display: flex; flex-direction: column; gap: 10px; margin: 18px 0; }
.drill-set .lbl { font-size: .8rem; font-weight: 700; color: var(--muted); }
.drill-card { background: var(--surface); border: 3px solid var(--accent-soft); border-radius: 26px; padding: 20px 24px; margin: 16px 0; }
.drill-meta { display: flex; justify-content: space-between; gap: 10px; font-size: .85rem; font-weight: 700; color: var(--muted); }
.drill-q { font-weight: 900; font-size: 1.1rem; line-height: 1.7; margin: 8px 0 4px; }
.drill-q small { display: block; font-size: .8rem; color: var(--muted); font-weight: 700; }
.drill-ch { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 12px 0; padding: 0; list-style: none; }
.drill-ch li { margin: 0; }
.drill-ch button { width: 100%; text-align: left; font: inherit; font-weight: 700; line-height: 1.6; color: var(--ink); background: var(--paper); border: 2px solid var(--accent-soft); border-radius: 18px; padding: 10px 14px; cursor: pointer; }
.drill-ch button:hover:not(:disabled) { border-color: var(--accent); }
.drill-ch button:disabled { cursor: default; }
.drill-ch button.ok { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.drill-ch button.ng { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.drill-ch button.ok::before { content: "○ "; }
.drill-ch button.ng::before { content: "× "; }
.drill-ans { border-top: 2px dashed var(--accent-soft); margin-top: 6px; padding-top: 12px; display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 6px 18px; align-items: start; }
.drill-ans p { margin: 4px 0 0; line-height: 1.75; }
.drill-ans .res { font-weight: 900; }
.drill-ans .res.ok { color: var(--ok); }
.drill-ans .res.ng { color: var(--bad); }
.drill-act { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.drill-act .btn.main { background: var(--accent); color: var(--surface); }
.drill-peek { all: unset; cursor: pointer; font-size: .88rem; font-weight: 900; background: var(--sun); color: #23344a; border-radius: 99px; padding: 8px 22px; }
.drill-peek:focus-visible { outline: 2px solid var(--accent); }
.drill-score { font-size: 2rem; font-weight: 900; color: var(--accent); margin: 4px 0; }
.drill-miss { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 8px 0 0; padding: 0; list-style: none; }
/* 略語集・略語カード */
.ab-abbr { font-family: var(--font-mono); font-size: 1.1rem; color: var(--accent); }
.ab-full { font-size: .95rem; }
.ab-hl { color: var(--accent); font-weight: 900; }
.fc-face { all: unset; box-sizing: border-box; cursor: pointer; width: 100%; min-height: 200px; margin: 12px 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; background: var(--paper); border: 2px dashed var(--accent-soft); border-radius: 22px; padding: 20px; }
.fc-face:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.fc-face.is-back { cursor: default; border-style: solid; border-color: var(--accent); background: var(--surface); }
.fc-face small { font-size: .8rem; font-weight: 700; color: var(--muted); }
.fc-abbr { font-family: var(--font-mono); font-size: 2.6rem; font-weight: 700; color: var(--accent); line-height: 1.2; }
.fc-name { font-family: var(--font-display); font-size: 1.3rem; font-weight: 700; line-height: 1.5; overflow-wrap: anywhere; }
.fc-hint { font-size: .9rem; color: var(--muted); line-height: 1.7; max-width: 32em; }
.fc-tap { font-size: .75rem; color: var(--muted); margin-top: 4px; }
@media (max-width: 640px) { .fc-abbr { font-size: 2.2rem; } .fc-name { font-size: 1.15rem; } .fc-face { min-height: 180px; } }
/* シナリオ演習:難しさの絞り込みで隠したもの */
.scn[hidden], .scn-index li[hidden] { display: none; }
.scn-filter { margin: 0 0 12px; }
@media (max-width: 640px) { .drill-ch { grid-template-columns: minmax(0, 1fr); } .drill-ans { grid-template-columns: minmax(0, 1fr); } .drill-card { padding: 16px; border-radius: 22px; } }
.scn-index .scn-no { flex-shrink: 0; }
@media (prefers-reduced-motion: reduce) { svg [data-step] { transition: none; } }
/* サイトのロゴ(押すとトップへ)・講義と演習の切り替え */
.site-logo { align-self: flex-start; display: flex; align-items: center; gap: 10px; text-decoration: none; padding: 2px 8px 6px; border-radius: 18px; }
.site-logo .logo-mark { flex-shrink: 0; transition: transform .2s ease; }
.site-logo:hover .logo-mark { transform: rotate(-8deg); }
.site-logo:focus-visible { outline: 2px solid var(--accent); }
.logo-word { font-family: var(--font-display); font-weight: 900; font-size: 1.4rem; line-height: 1.1; color: var(--accent); letter-spacing: .04em; }
.logo-word small { display: block; margin-top: 4px; font-family: var(--font-body); font-weight: 700; font-size: .68rem; letter-spacing: .1em; color: var(--muted); }
.roadmap a.linkish { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.exam-switch { display: flex; gap: 4px; background: var(--surface); border-radius: 99px; padding: 5px; margin-bottom: 6px; }
.exam-switch a { flex: 1; text-align: center; text-decoration: none; color: var(--muted); font-weight: 700; font-size: .85rem; padding: 6px 10px; border-radius: 99px; line-height: 1.3; }
.exam-switch a small { display: block; font-size: .68rem; font-weight: 500; }
.exam-switch a:hover { color: var(--accent); }
.exam-switch a[aria-current="page"] { background: var(--accent); color: var(--surface); }
/* 講義は黄(差し色)、演習は青(メインの色)。トップページのボタンと同じ色にそろえる */
.exam-switch a.sw-lec { color: var(--warn); }
.exam-switch a.sw-prac { color: var(--accent); }
.exam-switch a.sw-lec:not([aria-current]):hover { background: var(--warn-soft); }
.exam-switch a.sw-prac:not([aria-current]):hover { background: var(--accent-soft); }
.exam-switch a.sw-lec[aria-current="page"] { background: var(--sun); color: #23344a; }
.exam-switch a.sw-prac[aria-current="page"] { background: var(--accent); color: var(--surface); }
.exam-switch a:focus-visible { outline: 2px solid var(--accent); }
@media (max-width: 820px) {
  .exam-switch { flex: none; margin: 0; padding: 4px; align-self: center; box-shadow: 0 4px 14px rgba(35,52,74,.08); }
  .exam-switch a { padding: 8px 10px; font-size: .8rem; min-height: 40px; display: flex; align-items: center; }
  .toc-card { flex: 1; min-width: 0; }
  .exam-switch a small { display: none; }
  .site-logo { flex: none; align-self: center; padding: 0; width: 48px; height: 48px; justify-content: center; background: var(--surface); border-radius: 99px; box-shadow: 0 4px 14px rgba(35,52,74,.08); }
  .site-logo .logo-mark { width: 34px; height: 26px; }
  .logo-word { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
.val { display: inline-block; padding: 2px 12px; border-radius: 99px; font-weight: 700; font-size: .9rem; line-height: 1.6; white-space: nowrap; }
.val.c-good { background: var(--ok-soft); color: var(--ok); }
.val.c-mid { background: var(--warn-soft); color: var(--warn); }
.val.c-bad { background: var(--bad-soft); color: var(--bad); }
.t-good { color: var(--ok); font-weight: 700; }
svg .t-bold { font-weight: 700; }
svg .t-warn { fill: var(--warn); font-weight: 700; }
svg .wire-plain { stroke: var(--muted); stroke-width: 1.4; fill: none; }
svg .head { fill: var(--accent); }
svg .head-muted { fill: var(--muted); }
.gl-item.has-fig { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 6px 20px; align-items: start; }
.gl-fig { background: var(--paper); border-radius: 8px; padding: 6px; }
.gl-fig svg, #pop .gl-fig svg { display: block; width: 100%; height: auto; }
#pop .gl-fig { margin: 8px 0 4px; }
@media (max-width: 640px) { .gl-item.has-fig { grid-template-columns: minmax(0, 1fr); } .gl-fig { max-width: 360px; } }

.table-wrap { overflow-x: auto; margin: 16px 0; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: .92rem; line-height: 1.6; }
th, td { text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-family: var(--font-display); font-size: .85rem; background: var(--paper); white-space: nowrap; }
tr:last-child td { border-bottom: none; }
td.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }

.summary { background: var(--surface); border: 2px solid var(--ink); border-radius: 10px; padding: 16px 22px; margin: 44px 0 20px; }
.summary h2 { border: none; margin: 0 0 6px; padding: 0; font-size: 1.15rem; }
.summary ol { margin: 0; }

.quiz { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.quiz .q { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px 18px; }
.quiz .qt { font-weight: 700; line-height: 1.7; margin: 0; }
.quiz .choices { list-style: none; padding: 0; margin: 8px 0 10px; }
.quiz details summary { cursor: pointer; display: inline-block; list-style: none; font-size: .88rem; color: var(--accent); border: 1px solid var(--accent); border-radius: 99px; padding: 3px 14px; }
.quiz details summary::-webkit-details-marker { display: none; }
.quiz details summary:hover { background: var(--accent-soft); }
.quiz details[open] summary { background: var(--accent-soft); }
.quiz .ans { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
.quiz .ans b { color: var(--ok); }
.hint { font-size: .85rem; color: var(--muted); }

.pager { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 40px; }
.btn { all: unset; cursor: pointer; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 10px 16px; font-size: .92rem; }
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn:focus-visible { outline: 2px solid var(--accent); }

/* ---------- ホーム ---------- */
.domains { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 16px 0; }
.domain { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.domain .pct { font-family: var(--font-mono); font-size: 1.5rem; color: var(--accent); }
.domain .bar { height: 6px; background: var(--paper); border-radius: 3px; margin: 6px 0 8px; overflow: hidden; }
.domain .bar span { display: block; height: 100%; background: var(--accent); }
.domain b { font-family: var(--font-display); }
.domain p { font-size: .88rem; color: var(--muted); margin: 4px 0 0; line-height: 1.6; }
.roadmap { list-style: none; padding: 0; margin: 12px 0; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.roadmap li { display: grid; grid-template-columns: 2.4em minmax(0, 1fr) auto; gap: 10px; align-items: baseline; padding: 10px 16px; border-bottom: 1px solid var(--line); margin: 0; }
.roadmap li:last-child { border-bottom: none; }
.roadmap .n { font-family: var(--font-mono); color: var(--muted); font-size: .85rem; }
.roadmap button.linkish { all: unset; cursor: pointer; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.roadmap button.linkish:focus-visible { outline: 2px solid var(--accent); }

/* ---------- 用語 ---------- */
.term { all: unset; cursor: pointer; color: var(--accent); border-bottom: 1px dotted var(--accent); }
.term:focus-visible { outline: 2px solid var(--accent); }
#pop {
  position: absolute; z-index: 20; max-width: min(340px, calc(100vw - 32px));
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 10px 28px rgba(0,0,0,.18); padding: 12px 14px; font-size: .9rem; line-height: 1.7;
}
#pop .pt { font-family: var(--font-display); font-weight: 700; }
#pop .pr { font-size: .78rem; color: var(--muted); }
#pop .btn { padding: 4px 10px; font-size: .8rem; margin-top: 6px; }

.gl-tools { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0; align-items: center; }
.gl-tools input {
  flex: 1 1 220px; min-width: 0; font: inherit; font-size: .95rem; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px;
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { all: unset; cursor: pointer; font-size: .82rem; padding: 4px 12px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip:focus-visible { outline: 2px solid var(--accent); }
.gl-count { font-size: .82rem; color: var(--muted); }
.gl-list { display: flex; flex-direction: column; gap: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.gl-item { padding: 14px 18px; border-bottom: 1px solid var(--line); scroll-margin-top: 24px; }
.gl-item:last-child { border-bottom: none; }
.gl-item.flash { background: var(--accent-soft); transition: background .6s; }
.gl-head { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.gl-head b { font-family: var(--font-display); font-size: 1.05rem; }
.gl-head .full { font-size: .8rem; color: var(--muted); }
.gl-head .cat { margin-left: auto; font-size: .72rem; color: var(--muted); border: 1px solid var(--line); border-radius: 99px; padding: 0 8px; }
.gl-item p { margin: 4px 0 0; font-size: .94rem; line-height: 1.75; }
.gl-item .where { font-size: .78rem; color: var(--muted); }
.empty { padding: 20px; color: var(--muted); }

footer { margin-top: 56px; font-size: .78rem; color: var(--muted); }

@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); gap: 20px; padding-block: 20px 48px; }
  .toc { position: static; flex-direction: row; overflow-x: auto; gap: 6px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
  .toc .brand, .toc .toc-label { display: none; }
  .toc button { white-space: nowrap; border: 1px solid var(--line); background: var(--surface); }
  h1 { font-size: 1.6rem; }
  .domains { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- 案F:丸み・くも先生・動き ---------- */
.toc { gap: 6px; }
.toc-card { background: var(--surface); border-radius: 26px; padding: 18px 14px; display: flex; flex-direction: column; gap: 4px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px 6px; font-size: 1rem; }
.brand svg { flex-shrink: 0; }
.toc button { border-radius: 99px; padding: 7px 14px; }
.toc-label { padding: 0 14px; }

.hero { position: relative; overflow: hidden; background: var(--accent-soft); border-radius: 34px; padding: 32px clamp(20px, 4vw, 40px); display: flex; flex-wrap: wrap; gap: 18px 24px; align-items: center; margin-bottom: 8px; }
.hero-text { flex: 999 1 380px; min-width: 0; position: relative; }
.hero .eyebrow { display: inline-block; background: var(--surface); color: var(--accent); font-family: var(--font-body); font-weight: 700; font-size: .8rem; letter-spacing: .04em; padding: 2px 14px; border-radius: 99px; }
.hero h1 { margin: 10px 0 6px; }
.hero .lead { margin: 0; color: var(--ink); }
.hero-mascot { flex: 1 1 180px; display: flex; flex-direction: column; align-items: center; gap: 6px; position: relative; }
.bubble { background: var(--surface); border-radius: 20px; padding: 8px 16px; font-weight: 700; font-size: .88rem; text-align: center; }
.mascot-name { font-size: .75rem; font-weight: 700; color: var(--accent); }
.drift { position: absolute; background: var(--surface); border-radius: 99px; opacity: .65; }
@keyframes kumo-float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes kumo-drift { 0% { transform: translateX(0); } 100% { transform: translateX(40px); } }
.kumo-float { animation: kumo-float 3.2s ease-in-out infinite; }
.drift { animation: kumo-drift 9s ease-in-out infinite alternate; }

h1 { font-weight: 900; }
h2 { border-top: none; padding-top: 0; margin-top: 44px; }
h2 .sec { display: inline-block; background: var(--accent-soft); color: var(--accent); border-radius: 99px; padding: 0 10px; font-size: .78rem; vertical-align: middle; }
code, .mono { border-radius: 8px; }
.goals { border: none; border-radius: 26px; padding: 18px 24px; }
.box { border-radius: 24px; padding: 18px 22px; }
.box .tag { display: inline-flex; align-items: center; gap: 8px; background: none !important; color: var(--accent) !important; padding: 0; font-size: .95rem; letter-spacing: .02em; font-weight: 900; }
.box .tag::before { content: "実"; width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: .8rem; background: var(--accent-soft); color: var(--accent); }
.analogy { background: var(--surface); }
.exam { background: var(--warn-soft); }
.exam .tag { color: var(--warn) !important; }
.exam .tag::before { content: "!"; background: var(--sun); color: #23344a; }
.figure, .table-wrap { border: none; border-radius: 24px; }
th { background: var(--accent-soft); }
.summary { border: 3px solid var(--accent-soft); border-radius: 28px; background: var(--surface); }
.summary h2 { color: var(--accent); }
.btn { border: none; border-radius: 99px; padding: 10px 20px; font-weight: 700; background: var(--surface); }
.btn:hover { color: var(--accent); }
.domain { border: none; border-radius: 24px; }
.domain .bar { height: 10px; border-radius: 99px; background: var(--accent-soft); }
.domain .bar span { background: var(--sky); border-radius: 99px; }
.roadmap { border: none; border-radius: 26px; }
.gl-tools input { border-radius: 99px; padding: 10px 18px; border: 2px solid var(--line); }
.gl-list { border: none; border-radius: 26px; }
.gl-fig { border-radius: 18px; }
.gl-head .cat { border: none; background: var(--accent-soft); color: var(--accent); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--surface); }
#pop { border: none; border-radius: 22px; }

.quiz .q { border: 3px solid var(--accent-soft); border-radius: 26px; padding: 20px 24px; }
.quiz .qt { color: var(--ink); }
.quiz .choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 12px 0; }
.quiz .choices li { margin: 0; background: var(--paper); border: 2px solid var(--accent-soft); border-radius: 18px; padding: 8px 14px; font-weight: 700; line-height: 1.6; }
.quiz details summary { border: none; background: var(--sun); color: #23344a; font-weight: 900; padding: 8px 22px; transition: transform .15s ease; }
.quiz details summary:hover { background: var(--sun); transform: scale(1.05); }
.quiz details[open] summary { background: var(--sun); }
.quiz .ans { border-top: 2px dashed var(--accent-soft); }

.goals, .box, .figure, .domain, .summary, .quiz .q, .gl-item { transition: transform .2s ease, box-shadow .2s ease; }
.box:hover, .domain:hover, .quiz .q:hover { transform: translateY(-3px); box-shadow: 0 12px 26px rgba(35,52,74,.10); }
@media (max-width: 820px) {
  .toc-card { flex-direction: row; overflow-x: auto; padding: 8px; border-radius: 99px; }
  .toc-card .brand { display: none; }
  .hero { border-radius: 26px; }
  .quiz .choices { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) { .kumo-float, .drift { animation: none; } .box:hover, .domain:hover, .quiz .q:hover { transform: none; } }

/* ---------- 読みやすさ:ポイント・カード・折りたたみ ---------- */
.point { display: flex; gap: 12px; align-items: center; background: var(--accent-soft); border-radius: 20px; padding: 14px 20px; font-weight: 900; font-size: 1.1rem; line-height: 1.6; margin: 14px 0 16px; }
.point::before { content: "ポイント"; flex-shrink: 0; background: var(--accent); color: var(--surface); font-size: .72rem; font-weight: 700; border-radius: 99px; padding: 2px 10px; }
.duo, .trio { display: grid; gap: 12px; margin: 16px 0; }
.duo { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.trio { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.duo > div, .trio > div { background: var(--surface); border-radius: 22px; padding: 16px 20px; line-height: 1.7; }
.duo > div.hl { box-shadow: inset 0 0 0 3px var(--accent-soft); }
.duo > div > b, .trio > div > b { display: block; font-size: 1.05rem; margin-bottom: 6px; }
.duo ul { margin: 0; padding-left: 1.2em; }
.box p { margin: 4px 0 0; }
.box ul { margin: 6px 0 0; }
details.more { margin: 14px 0; }
details.more > summary { cursor: pointer; display: inline-flex; align-items: center; gap: 8px; list-style: none; font-weight: 700; font-size: .9rem; color: var(--accent); background: var(--surface); border-radius: 99px; padding: 8px 18px; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: "+"; font-weight: 900; }
details.more[open] > summary::before { content: "−"; }
details.more > :not(summary) { background: var(--surface); border-radius: 20px; padding: 14px 20px 14px 2.2em; margin-top: 8px; }
details.more > p { padding-left: 20px; }
@media (max-width: 640px) { .duo, .trio { grid-template-columns: minmax(0, 1fr); } .point { flex-direction: column; align-items: flex-start; gap: 6px; } }

/* ---------- まちがえやすい比較 ---------- */
.vs-list { display: flex; flex-direction: column; gap: 16px; margin-top: 12px; }
.vs-card { background: var(--surface); border-radius: 26px; padding: 20px 22px; display: flex; flex-direction: column; gap: 12px; transition: transform .2s ease, box-shadow .2s ease; }
.vs-card:hover { transform: translateY(-3px); box-shadow: 0 12px 26px rgba(35,52,74,.10); }
.vs-head { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: baseline; }
.vs-head h3 { margin: 0; font-size: 1.15rem; font-weight: 900; }
.vs-cat { margin-left: auto; font-size: .72rem; background: var(--accent-soft); color: var(--accent); border-radius: 99px; padding: 0 10px; }
.vs-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; position: relative; }
.vs-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.vs-item { background: var(--paper); border-radius: 18px; padding: 12px 16px; }
.vs-item .term { font-weight: 900; font-size: 1.02rem; }
.vs-item p { margin: 4px 0 0; font-size: .92rem; line-height: 1.7; }
.vs-tip { margin: 0; background: var(--warn-soft); border-radius: 16px; padding: 10px 16px; font-weight: 700; line-height: 1.7; }
.vs-tip span { display: inline-block; background: var(--sun); color: #23344a; font-size: .72rem; border-radius: 99px; padding: 0 10px; margin-right: 10px; }
@media (max-width: 640px) { .vs-grid, .vs-grid.three { grid-template-columns: minmax(0, 1fr); } }
@media (prefers-reduced-motion: reduce) { .vs-card:hover { transform: none; } }

/* ---------- 端末ごとの調整 ---------- */
.pop-actions { display: flex; gap: 8px; align-items: center; margin-top: 6px; }
.pop-close { all: unset; cursor: pointer; font-size: .8rem; color: var(--muted); padding: 4px 10px; border-radius: 99px; }
.pop-close:focus-visible { outline: 2px solid var(--accent); }
#totop { all: unset; cursor: pointer; position: fixed; z-index: 18; right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); background: var(--surface); color: var(--accent); font-weight: 700; font-size: .85rem; padding: 10px 16px; min-height: 24px; border-radius: 99px; box-shadow: 0 6px 18px rgba(35,52,74,.18); }
#totop:focus-visible { outline: 2px solid var(--accent); }
.scroll-hint { display: none; }

/* タブレット */
@media (min-width: 821px) and (max-width: 1100px) {
  .shell { grid-template-columns: 230px minmax(0, 1fr); gap: 28px; }
  .gl-item.has-fig { grid-template-columns: minmax(0, 1fr) 230px; }
  .hero-mascot svg { width: 140px; height: auto; }
}

/* スマホ・小さいタブレット:目次は上に固定した横並び */
@media (max-width: 820px) {
  body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 16; background: var(--paper); }
  .toc { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 15; background: var(--paper); border-bottom: none; margin-inline: -4px; padding: 8px 4px; }
  .toc-card { scrollbar-width: none; box-shadow: 0 4px 14px rgba(35,52,74,.08); }
  .toc-card::-webkit-scrollbar { display: none; }
  .toc button { min-height: 40px; padding: 6px 14px; border: none; background: var(--paper); }
  .toc button[aria-current="page"] { background: var(--accent); color: var(--surface); }
  .toc button .num { display: none; }
  .gl-item, .vs-card, h2 { scroll-margin-top: 80px; }
  .figure { position: relative; }
  .figure .scroll-hint { display: block; font-size: .75rem; color: var(--muted); margin-bottom: 6px; }
}

/* スマホ */
@media (max-width: 640px) {
  body { font-size: 15.5px; line-height: 1.85; }
  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.2rem; margin-top: 36px; }
  .hero { padding: 20px 18px; gap: 10px; }
  .hero-mascot { order: -1; flex: 1 1 100%; flex-direction: row; justify-content: flex-start; gap: 10px; }
  .hero-mascot svg { width: 72px; height: auto; flex-shrink: 0; }
  .hero-mascot .mascot-name { display: none; }
  .bubble { font-size: .8rem; padding: 6px 12px; text-align: left; }
  .point { font-size: 1rem; padding: 12px 16px; }
  .box, .goals, .summary, .quiz .q, .vs-card { padding: 16px 16px; border-radius: 22px; }
  th, td { padding: 8px 10px; }
  .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 4px; }
  .chips::-webkit-scrollbar { display: none; }
  .chip { white-space: nowrap; padding: 8px 14px; }
  .pager { flex-direction: column-reverse; }
  .pager .btn { text-align: center; padding: 12px 16px; }
  #pop { position: fixed; left: 12px !important; right: 12px; top: auto !important; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); max-width: none; max-height: 62vh; overflow-y: auto; box-shadow: 0 -6px 30px rgba(35,52,74,.22); z-index: 30; }
  #totop { bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
}

/* タッチ端末では「浮く」動きを止める */
@media (hover: none) {
  .box:hover, .domain:hover, .quiz .q:hover, .vs-card:hover { transform: none; box-shadow: none; }
}

#totop[hidden] { display: none; }
@media (max-width: 640px) {
  .hero .drift { display: none; }
  .table-wrap { background: none; border-radius: 0; overflow: visible; }
  table.stack, table.stack tbody { display: block; }
  table.stack thead { display: none; }
  table.stack tr { display: block; background: var(--surface); border-radius: 18px; padding: 10px 16px; margin-bottom: 8px; }
  table.stack td { display: block; border: none; padding: 2px 0; white-space: normal; }
  table.stack td[data-label]::before { content: attr(data-label); display: block; font-size: .72rem; font-weight: 700; color: var(--muted); }
  table.stack td:first-child { font-weight: 900; font-size: 1.02rem; padding-bottom: 4px; }
  table.stack td:first-child::before { display: none; }
}
