@import url("https://fonts.googleapis.com/css2?family=BIZ+UDPGothic:wght@400;700&family=Space+Grotesk:wght@400;500;700&display=swap");

/* =========================================================
   社労士 択一トレーニング — KOZO-LAB デザインシステム v1.3 準拠
   色・余白・書体はトークンのみを使用（部品からHEXを直接参照しない）
   ========================================================= */
:root {
  /* palette */
  --kozo-navy: #0d2036; --structural-blue: #264c71; --action-blue: #3a74b8; --action-hover: #2c5f97;
  --sky-blue: #7faeeb; --pale-cyan: #cbe9f4; --paper-white: #f4f8ff; --white: #ffffff;
  --text-navy: #172b3f; --gray: #64748b; --line: #d5deea;
  --complement-orange: #c77732; --orange-ink: #8a461d; --orange-tint: #fff2e6;
  /* semantic */
  --surface-page: var(--paper-white); --surface-card: var(--white); --surface-tint: var(--pale-cyan);
  --surface-inverse: var(--kozo-navy); --surface-accent: var(--orange-tint);
  --text-heading: var(--kozo-navy); --text-body: var(--text-navy); --text-muted: var(--gray);
  --text-on-inverse: var(--white); --text-link: var(--action-blue); --text-link-hover: var(--action-hover); --text-accent: var(--orange-ink);
  --border-default: var(--line); --border-strong: var(--structural-blue);
  --action-primary: var(--action-blue); --action-primary-hover: var(--action-hover); --action-accent: var(--orange-ink);
  --graphic-main: var(--structural-blue); --graphic-sub: var(--sky-blue); --graphic-node: var(--pale-cyan); --graphic-accent: var(--complement-orange);
  --focus-ring: var(--action-blue); --focus-ring-inverse: var(--pale-cyan);
  /* space */
  --space-4: 4px; --space-8: 8px; --space-16: 16px; --space-24: 24px; --space-32: 32px; --space-48: 48px; --space-64: 64px;
  --radius-card: 6px; --radius-control: 4px; --control-h: 44px;
  --content-max: 1120px; --gutter: 32px;
  --font-sans: "Space Grotesk", "BIZ UDPGothic", "Noto Sans JP", sans-serif;
  --font-jp: "BIZ UDPGothic", "Noto Sans JP", sans-serif;
  --font-latin: "Space Grotesk", "BIZ UDPGothic", sans-serif;
  --header-h: 68px;
}
@media (max-width: 720px) { :root { --gutter: 20px; --header-h: 60px; } }

*, *::before, *::after { box-sizing: border-box; }
html { overflow-x: clip; -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + var(--space-16)); }
body {
  margin: 0; background: var(--white); color: var(--text-body);
  font-family: var(--font-jp); font-size: 16px; line-height: 1.8; -webkit-font-smoothing: antialiased;
  min-height: 100vh; display: flex; flex-direction: column; position: relative;
}
/* 背景模様：独立レイヤーに不透明度0.15（文字には適用しない） */

img { max-width: 100%; height: auto; }
a { color: var(--text-link); text-underline-offset: 3px; }
a:hover { color: var(--text-link-hover); text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.inverse :focus-visible { outline-color: var(--focus-ring-inverse); }
button { font: inherit; }
h1, h2, h3, h4 { color: var(--text-heading); font-weight: 700; margin: 0; text-wrap: balance; word-break: auto-phrase; }
p { margin: 0; }
[hidden] { display: none !important; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.latin, .num { font-family: var(--font-latin); font-variant-numeric: tabular-nums; }
.label-en { font-family: var(--font-latin); font-size: 12px; line-height: 1.5; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: var(--structural-blue); }
.inverse .label-en { color: var(--pale-cyan); }
.muted { color: var(--text-muted); font-size: 14px; }
.container { width: 100%; max-width: calc(var(--content-max) + var(--gutter) * 2); margin: 0 auto; padding: 0 var(--gutter); }

.skip { position: absolute; left: var(--space-16); top: -80px; z-index: 100; background: var(--white); padding: var(--space-8) var(--space-16); border: 2px solid var(--focus-ring); border-radius: var(--radius-control); }
.skip:focus { top: var(--space-8); }

/* ---------- Header ---------- */
.site-header { position: sticky; top: 0; z-index: 40; background: var(--white); }
.site-header::after { content: ""; display: block; height: 12px; margin-bottom: -12px; background: url("img/band.svg") left center / 100% 12px no-repeat; position: relative; z-index: 1; }
.site-header__inner { height: var(--header-h); display: flex; align-items: center; gap: var(--space-24); }
.brand { display: flex; align-items: center; gap: var(--space-16); text-decoration: none; color: var(--text-heading); min-width: 0; }
.brand img { width: 40px; height: 40px; flex: none; }
.brand__name { display: grid; line-height: 1.3; min-width: 0; }
.brand__ja { font-weight: 700; font-size: 17px; white-space: nowrap; }
.brand__en { font-family: var(--font-latin); font-size: 11px; letter-spacing: .16em; color: var(--structural-blue); font-weight: 500; }
.brand:hover { color: var(--text-heading); }
.nav { margin-left: auto; display: flex; align-items: center; gap: var(--space-4); }
.nav a {
  position: relative; display: inline-flex; align-items: center; gap: var(--space-8); min-height: var(--control-h); padding: 0 var(--space-16);
  color: var(--text-body); text-decoration: none; font-weight: 700; font-size: 15px; border-radius: var(--radius-control);
}
.nav a svg { width: 20px; height: 20px; color: var(--structural-blue); }
.nav a:hover { color: var(--action-hover); background: var(--paper-white); }
.nav a[aria-current="page"]::after { content: ""; position: absolute; left: var(--space-16); right: var(--space-16); bottom: 4px; height: 3px; background: var(--structural-blue); clip-path: polygon(0 0, 100% 0, calc(100% - 3px) 100%, 0 100%); }
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--structural-blue); color: var(--white); font: 500 12px/1 var(--font-latin); }
.iconbtn.menu-btn { display: none; margin-left: auto; }
.user-chip { font-size: 13px; color: var(--text-muted); padding-left: var(--space-16); border-left: 1px solid var(--border-default); margin-left: var(--space-8); max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 1100px) {
  .iconbtn.menu-btn { display: inline-flex; }
  .nav { display: none; position: fixed; top: var(--header-h); left: 0; right: 0; bottom: 0; background: var(--white); flex-direction: column; align-items: stretch; padding: var(--space-24) var(--gutter); gap: var(--space-8); border-top: 1px solid var(--border-default); overflow: auto; }
  .nav.is-open { display: flex; }
  .nav a { min-height: 52px; font-size: 17px; border: 1px solid var(--border-default); }
  .nav a[aria-current="page"] { border-color: var(--border-strong); }
  .nav a[aria-current="page"]::after { left: 0; right: auto; top: 8px; bottom: 8px; width: 3px; height: auto; }
  .user-chip { border: 0; margin: var(--space-16) 0 0; padding: 0; max-width: none; }
}
@media (max-width: 420px) { .brand__en { display: none; } .brand__ja { font-size: 15px; } }

/* ---------- Buttons / Links ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-8); min-height: var(--control-h); padding: 0 var(--space-24);
  border: 1px solid transparent; border-radius: var(--radius-control); font: 700 16px/1.2 var(--font-jp); letter-spacing: .02em; text-decoration: none; cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s; white-space: nowrap;
}
.btn svg { width: 18px; height: 18px; flex: none; transition: transform .15s; }
.btn:hover svg.i-arrow { transform: translateX(4px); }
.btn--primary { background: var(--action-primary); color: var(--white); }
.btn--primary:hover { background: var(--action-primary-hover); color: var(--white); }
.btn--secondary { background: var(--white); color: var(--structural-blue); border-color: var(--border-strong); }
.btn--secondary:hover { background: var(--paper-white); color: var(--action-hover); border-color: var(--action-hover); }
.btn--ghost { background: transparent; color: var(--structural-blue); border-color: var(--border-default); }
.btn--ghost:hover { border-color: var(--action-hover); color: var(--action-hover); }
.inverse .btn--secondary { background: transparent; color: var(--white); border-color: var(--pale-cyan); }
.inverse .btn--secondary:hover { background: rgba(203, 233, 244, .12); color: var(--white); }
.btn--sm { min-height: 36px; padding: 0 var(--space-16); font-size: 14px; }
.btn--block { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { background: var(--paper-white); color: var(--gray); border: 1px dashed var(--gray); cursor: not-allowed; }
.btn[disabled] svg { transform: none !important; }
.iconbtn { display: inline-flex; align-items: center; justify-content: center; width: var(--control-h); height: var(--control-h); border: 1px solid var(--border-strong); border-radius: var(--radius-control); background: var(--white); color: var(--structural-blue); cursor: pointer; }
.iconbtn svg { width: 22px; height: 22px; }
.link { color: var(--text-link); display: inline-flex; align-items: center; gap: var(--space-4); }
.link svg { width: 16px; height: 16px; }
.actions { display: flex; flex-wrap: wrap; gap: var(--space-16); align-items: center; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* ---------- Tags / Status ---------- */
.tag { display: inline-flex; align-items: center; gap: var(--space-4); height: 26px; padding: 0 var(--space-8); border-radius: var(--radius-control); font-size: 13px; line-height: 1; font-weight: 700; white-space: nowrap; background: var(--pale-cyan); color: var(--structural-blue); border: 1px solid transparent; }
.tag--outline { background: var(--white); color: var(--text-body); border-color: var(--border-default); font-weight: 400; }
.tag--accent { background: var(--orange-tint); color: var(--orange-ink); }
.tag--en { font-family: var(--font-latin); letter-spacing: .08em; font-weight: 500; }
.diff { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 var(--space-8); border: 1px solid var(--border-strong); border-radius: var(--radius-control); font-size: 13px; font-weight: 700; color: var(--structural-blue); background: var(--white); white-space: nowrap; }
.diff__pips { display: inline-flex; gap: 2px; }
.diff__pips i { width: 6px; height: 10px; border: 1px solid var(--structural-blue); }
.diff__pips i.on { background: var(--structural-blue); }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 700; padding: 2px var(--space-8); border-radius: var(--radius-control); border: 1px solid currentColor; white-space: nowrap; line-height: 1.6; }
.status svg { width: 16px; height: 16px; }
.status--ok { color: var(--structural-blue); background: var(--white); }
.status--ng { color: var(--text-body); background: var(--white); border-style: dashed; }
.status--p1 { color: var(--orange-ink); background: var(--orange-tint); border-style: solid; border-width: 2px; }
.status--p2 { color: var(--structural-blue); background: var(--white); border-style: dashed; }
.status--p3 { color: var(--structural-blue); background: var(--white); border-style: dotted; }
.status--p4 { color: var(--structural-blue); background: var(--paper-white); }
.status--done { color: var(--gray); background: var(--white); }

/* ---------- Card ---------- */
.card { background: var(--surface-card); border: 1px solid var(--border-default); border-radius: var(--radius-card); padding: var(--space-24); display: grid; gap: var(--space-16); align-content: start; min-width: 0; position: relative; }
.card__title { font-size: 20px; line-height: 1.6; }
/* 装飾：短いコーナーブラケット（左上・右下） */
.bracket::before, .bracket::after { content: ""; position: absolute; width: 14px; height: 14px; pointer-events: none; }
.bracket::before { top: -1px; left: -1px; border-top: 2px solid var(--graphic-main); border-left: 2px solid var(--graphic-main); border-top-left-radius: var(--radius-card); }
.bracket::after { right: -1px; bottom: -1px; border-right: 2px solid var(--graphic-sub); border-bottom: 2px solid var(--graphic-sub); border-bottom-right-radius: var(--radius-card); }
/* 45度の面取りパネル */
.chamfer { clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 16px 100%, 0 calc(100% - 16px)); }

/* ---------- Section heading（01｜…） ---------- */
.sec-head { display: grid; gap: var(--space-8); margin-bottom: var(--space-24); }
.sec-head__title { display: flex; align-items: baseline; gap: var(--space-8); font-size: 28px; line-height: 1.5; flex-wrap: wrap; }
.sec-head__num { font-family: var(--font-latin); font-weight: 500; color: var(--structural-blue); }
.sec-head__bar { color: var(--sky-blue); font-weight: 400; }
.rule { position: relative; height: 1px; background: var(--border-default); }
.rule::before { content: ""; position: absolute; left: 0; top: -1px; width: 48px; height: 3px; background: var(--structural-blue); clip-path: polygon(0 0, 100% 0, calc(100% - 3px) 100%, 0 100%); }
.rule::after { content: ""; position: absolute; left: 52px; top: -3px; width: 7px; height: 7px; border: 1px solid var(--sky-blue); background: var(--white); }
@media (max-width: 720px) { .sec-head__title { font-size: 22px; } }

main { flex: 1; padding-bottom: var(--space-64); }
.page-head { padding-top: var(--space-48); padding-bottom: var(--space-32); }
.page-head h1 { font-size: 32px; line-height: 1.45; }
@media (max-width: 720px) { .page-head { padding-top: var(--space-32); padding-bottom: var(--space-24); } .page-head h1 { font-size: 24px; } }
.crumbs { display: flex; flex-wrap: wrap; gap: var(--space-8); font-size: 14px; margin-bottom: var(--space-16); color: var(--text-muted); }
.crumbs a { color: var(--text-link); }
.crumbs span[aria-hidden] { color: var(--sky-blue); }

/* ---------- Hero（白基調） ---------- */
.hero { background: var(--white); color: var(--text-body); position: relative; overflow: hidden; border-bottom: 1px solid var(--border-default); }
.hero::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 100%; background: linear-gradient(180deg, var(--paper-white), var(--white) 70%); pointer-events: none; }
.hero .container { position: relative; }
.hero__inner { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: var(--space-32); align-items: center; padding: var(--space-64) 0 var(--space-48); min-height: 360px; }
.hero__body { display: grid; gap: var(--space-16); position: relative; z-index: 1; }
.hero h1 { font-size: 40px; line-height: 1.4; letter-spacing: .02em; }
.hero h1 .num { font-size: 56px; line-height: 1; color: var(--structural-blue); margin: 0 4px; }
.hero p { color: var(--text-body); max-width: 36em; }
.hero__art { justify-self: end; width: 100%; max-width: 520px; position: relative; }
.hero__art img { display: block; width: 100%; opacity: .85; }
.hero .actions { margin-top: var(--space-8); }
.hero__stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--border-default); border-radius: var(--radius-card); background: var(--white); margin-bottom: var(--space-48); }
.hero__stat { padding: var(--space-16) var(--space-24); display: grid; gap: 2px; }
.hero__stat + .hero__stat { border-left: 1px solid var(--border-default); }
.hero__stat b { font: 700 28px/1.2 var(--font-latin); color: var(--text-heading); }
.hero__stat span { font-size: 13px; color: var(--text-muted); }
@media (max-width: 900px) {
  .hero__inner { grid-template-columns: 1fr; padding: var(--space-48) 0 var(--space-24); min-height: 0; }
  .hero__art { justify-self: stretch; max-width: none; height: 140px; overflow: hidden; }
  .hero__art img { width: 130%; margin-left: -10%; }
  .hero h1 { font-size: 30px; } .hero h1 .num { font-size: 44px; }
  .hero__stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero__stat:nth-child(3) { border-left: 0; }
  .hero__stat:nth-child(n+3) { border-top: 1px solid var(--border-default); }
}

/* ---------- Flow（学習の流れ図） ---------- */
.flow { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0; list-style: none; margin: 0; padding: 0; counter-reset: f; }
.flow li { position: relative; display: grid; justify-items: start; align-content: start; gap: var(--space-8); padding: var(--space-16) var(--space-16) var(--space-16) 0; }
.flow__node { display: flex; align-items: center; gap: var(--space-8); width: 100%; }
.flow__node i { width: 14px; height: 14px; border: 1.5px solid var(--graphic-main); background: var(--graphic-node); flex: none; }
.flow li:nth-child(even) .flow__node i { border-radius: 50%; }
.flow__node::after { content: ""; flex: 1; height: 1px; background: var(--graphic-sub); }
.flow li:last-child .flow__node::after { background: none; }
.flow b { font-size: 15px; color: var(--text-heading); }
.flow span { font-size: 13px; color: var(--text-muted); line-height: 1.6; }
.flow .latin { font-size: 12px; color: var(--structural-blue); letter-spacing: .1em; }
@media (max-width: 900px) {
  .flow { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .flow li:nth-child(3) .flow__node::after { background: none; }
}
@media (max-width: 560px) {
  .flow { grid-template-columns: 1fr; }
  .flow li { grid-template-columns: 14px 1fr; column-gap: var(--space-16); padding: 0 0 var(--space-16); }
  .flow__node { grid-row: span 3; flex-direction: column; height: 100%; width: 14px; }
  .flow__node::after { width: 1px; height: auto; flex: 1; }
  .flow li:nth-child(3) .flow__node::after { background: var(--graphic-sub); }
}

/* ---------- Filters ---------- */
.filters { display: grid; gap: var(--space-16); padding: var(--space-24); background: var(--white); border: 1px solid var(--border-default); border-radius: var(--radius-card); margin-bottom: var(--space-24); }
.filters fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-8); min-width: 0; }
.filters legend { float: left; width: 7.5em; font-size: 14px; font-weight: 700; color: var(--text-heading); padding: 0; }
@media (max-width: 720px) { .filters legend { float: none; width: 100%; margin-bottom: var(--space-4); } .filters { padding: var(--space-16); } }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chip span { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 var(--space-16); border: 1px solid var(--border-strong); border-radius: 18px; font-size: 14px; color: var(--structural-blue); background: var(--white); cursor: pointer; }
.chip span::before { content: ""; width: 10px; height: 10px; border: 1.5px solid var(--structural-blue); border-radius: 2px; }
.chip input[type="radio"] + span::before { border-radius: 50%; }
.chip input:checked + span { background: var(--structural-blue); color: var(--white); }
.chip input:checked + span::before { background: var(--white); border-color: var(--white); }
.chip input:focus-visible + span { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.chip:hover span { border-color: var(--action-hover); }

/* ---------- Lesson cards ---------- */
.grid { display: grid; gap: var(--space-24); }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1024px) { .grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .grid--2, .grid--3 { grid-template-columns: 1fr; } }
.lcard { gap: var(--space-16); }
.lcard__top { display: flex; justify-content: space-between; align-items: center; gap: var(--space-8); flex-wrap: wrap; }
.lcard__title { font-size: 20px; line-height: 1.55; }
.lcard__title a { color: inherit; text-decoration: none; }
.lcard__title a:hover { text-decoration: underline; color: var(--action-hover); }
.lcard__meta { display: flex; flex-wrap: wrap; gap: var(--space-4) var(--space-16); font-size: 13px; color: var(--text-muted); }
.lcard__topics { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--space-4); font-size: 14px; }
.lcard__topics li { display: flex; gap: var(--space-8); align-items: baseline; }
.lcard__topics b { font: 500 12px/1 var(--font-latin); color: var(--structural-blue); border: 1px solid var(--sky-blue); padding: 3px 4px; border-radius: 2px; }
.lcard__stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--border-default); border-bottom: 1px solid var(--border-default); }
.lcard__stats div { padding: var(--space-8) 0; display: grid; gap: 0; }
.lcard__stats div + div { padding-left: var(--space-16); border-left: 1px solid var(--border-default); }
.lcard__stats b { font: 700 20px/1.3 var(--font-latin); color: var(--text-heading); }
.lcard__stats span { font-size: 12px; color: var(--text-muted); }
.dbar { display: flex; gap: 3px; align-items: center; }
.dbar i { width: 16px; height: 8px; border: 1px solid var(--structural-blue); }
.dbar i.b1 { background: var(--pale-cyan); } .dbar i.b2 { background: var(--sky-blue); } .dbar i.b3 { background: var(--structural-blue); }
.dbar small { font-size: 12px; color: var(--text-muted); margin-left: var(--space-8); }
.empty { text-align: left; padding: var(--space-48) var(--space-24); background: var(--white); border: 1px dashed var(--border-strong); border-radius: var(--radius-card); display: grid; gap: var(--space-16); justify-items: start; }

/* ---------- Lesson layout ---------- */
.lesson-head { background: linear-gradient(180deg, var(--paper-white), var(--white)); border-bottom: 1px solid var(--border-default); position: relative; overflow: hidden; }
.lesson-head::after { content: ""; position: absolute; right: -40px; top: 0; bottom: 0; width: 420px; background: url("img/structure-light.svg") right center / contain no-repeat; opacity: .15; pointer-events: none; }
.lesson-head .container { position: relative; z-index: 1; padding-top: var(--space-32); }
.lesson-head h1 { font-size: 30px; line-height: 1.45; margin: var(--space-8) 0 var(--space-16); }
.lesson-head__meta { display: flex; flex-wrap: wrap; gap: var(--space-8); margin-bottom: var(--space-24); }
@media (max-width: 720px) { .lesson-head h1 { font-size: 23px; } .lesson-head::after { display: none; } }
.tabs { display: flex; gap: 0; overflow: hidden; margin-bottom: -1px; }
.tabs a { display: inline-flex; align-items: center; gap: var(--space-8); min-height: 48px; padding: 0 var(--space-24); font-weight: 700; font-size: 15px; text-decoration: none; color: var(--text-body); border: 1px solid transparent; border-bottom: 0; border-radius: var(--radius-card) var(--radius-card) 0 0; white-space: nowrap; }
.tabs a .latin { font-size: 11px; color: var(--structural-blue); letter-spacing: .1em; }
.tabs a:hover { color: var(--action-hover); background: var(--paper-white); }
.tabs a[aria-current="page"] { background: var(--white); border-color: var(--border-default); color: var(--text-heading); box-shadow: inset 0 3px 0 var(--structural-blue); }
@media (max-width: 720px) { .tabs a { padding: 0 var(--space-16); } }

.steps { list-style: none; margin: 0 0 var(--space-24); padding: 0; display: flex; gap: 0; flex-wrap: wrap; }
.steps li { display: flex; align-items: center; gap: var(--space-8); font-size: 13px; color: var(--text-muted); }
.steps li + li::before { content: ""; width: 28px; height: 1px; background: var(--graphic-sub); margin: 0 var(--space-8); }
.steps li i { width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; border: 1.5px solid var(--sky-blue); font: 500 11px/1 var(--font-latin); color: var(--structural-blue); background: var(--white); }
.steps li.done i { background: var(--pale-cyan); border-color: var(--structural-blue); }
.steps li.now { color: var(--text-heading); font-weight: 700; }
.steps li.now i { background: var(--structural-blue); color: var(--white); border-color: var(--structural-blue); }
@media (max-width: 560px) { .steps li span { display: none; } .steps li.now span { display: inline; } .steps li + li::before { width: 14px; } }

.layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: var(--space-48); padding-top: var(--space-32); align-items: start; }
.layout--wide { grid-template-columns: minmax(0, 1fr) 300px; }
@media (max-width: 1024px) { .layout, .layout--wide { grid-template-columns: 1fr; gap: var(--space-24); } }
.side { position: sticky; top: calc(var(--header-h) + var(--space-24)); display: grid; gap: var(--space-24); }
@media (max-width: 1024px) { .side { position: static; } }
.toc { background: var(--white); border: 1px solid var(--border-default); border-radius: var(--radius-card); padding: var(--space-16) 0; }
.toc summary { list-style: none; cursor: pointer; padding: 0 var(--space-24); display: flex; justify-content: space-between; align-items: center; }
.toc summary::-webkit-details-marker { display: none; }
.toc summary svg { width: 18px; height: 18px; color: var(--structural-blue); transition: transform .15s; }
.toc[open] summary svg { transform: rotate(180deg); }
.toc ol { list-style: none; margin: var(--space-8) 0 0; padding: 0; }
.toc a { display: grid; grid-template-columns: auto 1fr auto; gap: var(--space-8); align-items: baseline; padding: var(--space-8) var(--space-24); text-decoration: none; color: var(--text-body); font-size: 14px; line-height: 1.6; border-left: 3px solid transparent; }
.toc a:hover { background: var(--paper-white); color: var(--action-hover); }
.toc a.is-active { border-left-color: var(--structural-blue); background: var(--paper-white); font-weight: 700; }
.toc a b { font: 500 12px/1.6 var(--font-latin); color: var(--structural-blue); }
.toc .mark { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
@media (min-width: 1025px) { .toc summary { pointer-events: none; } .toc summary svg { display: none; } }

/* ---------- Prose（教本・出典） ---------- */
.prose { background: var(--white); border: 1px solid var(--border-default); border-radius: var(--radius-card); padding: var(--space-48); display: grid; gap: var(--space-16); position: relative; }
.prose > * { max-width: 46em; }
.prose > .tbl, .prose > .fig, .prose > .note { max-width: none; }
.prose h2 { display: flex; align-items: center; gap: var(--space-8); font-size: 24px; line-height: 1.5; margin-top: var(--space-32); padding-bottom: var(--space-16); position: relative; flex-wrap: wrap; }
.prose h2::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: linear-gradient(90deg, var(--structural-blue) 0 48px, var(--border-default) 48px); }
.prose h2:first-child, .prose > p:first-child + h2 { margin-top: 0; }
.prose h2 .hid { font: 500 14px/1 var(--font-latin); color: var(--white); background: var(--structural-blue); padding: 6px 10px 6px 8px; clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 0 100%); letter-spacing: .06em; }
.prose h2 .hbar { display: none; }
.prose h3 { font-size: 19px; margin-top: var(--space-16); }
.prose p, .prose li { line-height: 1.9; }
.prose ul, .prose ol { margin: 0; padding-left: 1.4em; display: grid; gap: var(--space-4); }
.prose strong { color: var(--text-heading); }
.prose code { font-family: var(--font-latin); background: var(--paper-white); padding: 1px 4px; border-radius: 2px; }
.prose a.ext::after { content: "↗"; font-family: var(--font-latin); font-size: 12px; margin-left: 2px; }
.prose a { word-break: break-all; }
.prose .lead { font-size: 13px; letter-spacing: .04em; color: var(--structural-blue); font-family: var(--font-latin); }
@media (max-width: 720px) { .prose { padding: var(--space-24) var(--space-16); } .prose h2 { font-size: 20px; } }
.fig { margin: 0; position: relative; padding: var(--space-8); border: 1px solid var(--border-default); background: var(--paper-white); border-radius: var(--radius-card); }
.fig img { display: block; width: 100%; border-radius: 2px; background: var(--white); aspect-ratio: 2 / 1; object-fit: cover; }
.fig figcaption { font-size: 13px; color: var(--text-muted); padding: var(--space-8) var(--space-4) 0; background: transparent; }
.tbl { max-width: 100%; border: 1px solid var(--border-default); border-radius: var(--radius-card); background: var(--white); }
.tbl:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.tbl table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.7; }
.tbl th, .tbl td { padding: var(--space-8) var(--space-16); text-align: left; vertical-align: top; border-bottom: 1px solid var(--border-default); }
.tbl thead th { background: var(--surface-tint); color: var(--text-heading); font-size: 14px; }
.tbl tbody th { font-weight: 700; color: var(--text-heading); }
.tbl tbody tr:last-child > * { border-bottom: 0; }
.tbl .r { text-align: right; }
.note { display: grid; grid-template-columns: auto 1fr; gap: var(--space-8) var(--space-16); padding: var(--space-16) var(--space-24); border: 1px solid var(--border-strong); border-radius: var(--radius-card); background: var(--white); position: relative; }
.note__k { font-weight: 700; color: var(--structural-blue); white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.note__k::before { content: ""; width: 8px; height: 8px; border: 1.5px solid currentColor; transform: rotate(45deg); }
.note--goal { background: var(--surface-tint); border-color: transparent; }
.note--tip { border-style: dashed; }
@media (max-width: 560px) { .note { grid-template-columns: 1fr; padding: var(--space-16); } }

.cta-panel { margin-top: var(--space-32); padding: var(--space-32); background: var(--white); border: 1px solid var(--border-strong); border-radius: var(--radius-card); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-24); align-items: center; position: relative; overflow: hidden; }
.cta-panel .cta-art { position: absolute; right: -60px; top: -40px; width: 300px; height: 220px; background: url("img/structure-light.svg") center / contain no-repeat; opacity: .18; pointer-events: none; }
.cta-panel h2 { font-size: 22px; }
.cta-panel p { color: var(--text-muted); font-size: 14px; }
.cta-panel > * { position: relative; z-index: 1; }
@media (max-width: 720px) { .cta-panel { grid-template-columns: 1fr; padding: var(--space-24); } }

.sidebox { background: var(--white); border: 1px solid var(--border-default); border-radius: var(--radius-card); padding: var(--space-24); display: grid; gap: var(--space-16); }
.sidebox h2 { font-size: 16px; display: flex; align-items: center; gap: var(--space-8); }
.sidebox h2 svg { width: 20px; height: 20px; color: var(--structural-blue); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: var(--space-4) var(--space-16); font-size: 14px; margin: 0; }
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; font-family: var(--font-latin); word-break: break-all; }
.hist { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.hist li + li { border-top: 1px solid var(--border-default); }
.hist a { display: flex; justify-content: space-between; gap: var(--space-8); padding: var(--space-8) 0; text-decoration: none; font-size: 14px; color: var(--text-body); }
.hist a:hover { color: var(--action-hover); }
.hist b { font-family: var(--font-latin); color: var(--text-heading); }

/* ---------- Quiz ---------- */
.conf-legend { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; border: 1px solid var(--border-default); border-radius: var(--radius-card); background: var(--white); overflow: hidden; }
.conf-legend div { padding: var(--space-16); display: grid; gap: 2px; font-size: 13px; }
.conf-legend div + div { border-left: 1px solid var(--border-default); }
.conf-legend b { font: 700 22px/1 var(--font-latin); color: var(--structural-blue); }
.conf-legend strong { font-size: 14px; color: var(--text-heading); }
@media (max-width: 720px) { .conf-legend { grid-template-columns: repeat(2, minmax(0, 1fr)); } .conf-legend div:nth-child(3) { border-left: 0; } .conf-legend div:nth-child(n+3) { border-top: 1px solid var(--border-default); } }
.qcard { background: var(--white); border: 1px solid var(--border-default); border-radius: var(--radius-card); padding: var(--space-32); display: grid; gap: var(--space-24); position: relative; scroll-margin-top: calc(var(--header-h) + var(--space-24)); }
.qcard.is-done { border-color: var(--sky-blue); }
.qcard__head { display: flex; align-items: center; gap: var(--space-16); flex-wrap: wrap; }
.qno { font: 700 32px/1 var(--font-latin); color: var(--structural-blue); letter-spacing: .02em; display: flex; align-items: baseline; gap: 2px; }
.qno small { font-size: 14px; color: var(--sky-blue); font-weight: 500; }
.qcard__topic { font-size: 14px; color: var(--text-muted); }
.qcard__stem p { font-size: 17px; line-height: 1.9; color: var(--text-heading); }
mark.pol { background: none; color: var(--text-heading); font-weight: 700; border-bottom: 3px double var(--structural-blue); padding: 0 1px; }
.opts { display: grid; gap: var(--space-8); margin: 0; padding: 0; border: 0; min-width: 0; }
.opt { position: relative; display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: var(--space-16); align-items: start; padding: var(--space-16); border: 1px solid var(--border-default); border-radius: var(--radius-card); cursor: pointer; background: var(--white); transition: border-color .15s, background-color .15s; }
.opt:hover { border-color: var(--action-blue); }
.opt input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.opt__k { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border: 1.5px solid var(--structural-blue); border-radius: var(--radius-control); font: 700 16px/1 var(--font-latin); color: var(--structural-blue); background: var(--white); }
.opt__t { line-height: 1.85; padding-top: 4px; }
.opt:has(input:checked) { border-color: var(--structural-blue); background: var(--paper-white); box-shadow: inset 3px 0 0 var(--structural-blue); }
.opt:has(input:checked) .opt__k { background: var(--structural-blue); color: var(--white); }
.opt:has(input:focus-visible) { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.conf { border: 0; padding: 0; margin: 0; display: grid; gap: var(--space-8); min-width: 0; }
.conf legend { font-weight: 700; font-size: 14px; color: var(--text-heading); padding: 0; margin-bottom: var(--space-8); display: flex; gap: var(--space-8); align-items: center; }
.conf__row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; border: 1px solid var(--border-strong); border-radius: var(--radius-control); overflow: hidden; }
.conf__row label { position: relative; display: grid; justify-items: center; gap: 0; padding: var(--space-8) var(--space-4); cursor: pointer; text-align: center; background: var(--white); }
.conf__row label + label { border-left: 1px solid var(--border-strong); }
.conf__row input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.conf__row b { font: 700 18px/1.2 var(--font-latin); color: var(--structural-blue); }
.conf__row span { font-size: 12px; color: var(--text-body); line-height: 1.4; }
.conf__row label:hover { background: var(--paper-white); }
.conf__row label:has(input:checked) { background: var(--structural-blue); }
.conf__row label:has(input:checked) b, .conf__row label:has(input:checked) span { color: var(--white); }
.conf__row label:has(input:focus-visible) { outline: 2px solid var(--focus-ring); outline-offset: -4px; }
@media (max-width: 720px) { .qcard { padding: var(--space-24) var(--space-16); } .qno { font-size: 26px; } .qcard__stem p { font-size: 16px; } .opt { grid-template-columns: 32px minmax(0, 1fr); gap: var(--space-8); padding: var(--space-16) var(--space-8) var(--space-16) var(--space-16); } .opt__k { width: 32px; height: 32px; } }
.submitbar { position: sticky; bottom: 0; z-index: 30; background: var(--white); border-top: 1px solid var(--border-default); margin-top: var(--space-32); }
.submitbar__inner { display: flex; align-items: center; gap: var(--space-24); padding: var(--space-16) 0; flex-wrap: wrap; }
.progress { flex: 1; min-width: 200px; display: grid; gap: var(--space-4); font-size: 13px; color: var(--text-muted); }
.progress__bar { display: flex; gap: 4px; }
.progress__bar i { flex: 1; height: 8px; border: 1px solid var(--structural-blue); background: var(--white); }
.progress__bar i.half { background: linear-gradient(90deg, var(--sky-blue) 50%, var(--white) 50%); }
.progress__bar i.full { background: var(--structural-blue); }
@media (max-width: 560px) { .submitbar__inner { gap: var(--space-16); flex-wrap: nowrap; padding: var(--space-8) 0; } .progress { min-width: 0; } .submitbar .btn { flex: none; padding: 0 var(--space-16); } }

/* ---------- Result ---------- */
.score { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--space-32); align-items: center; padding: var(--space-32); background: var(--white); color: var(--text-body); border: 1px solid var(--border-strong); border-radius: var(--radius-card); position: relative; overflow: hidden; }
.score .score-art { position: absolute; right: -80px; bottom: -60px; width: 360px; height: 240px; background: url("img/structure-light.svg") center / contain no-repeat; opacity: .16; pointer-events: none; }
.score > * { position: relative; z-index: 1; }
.score__big { font: 700 64px/1 var(--font-latin); color: var(--text-heading); display: flex; align-items: baseline; gap: var(--space-8); }
.score__big small { font-size: 28px; color: var(--structural-blue); }
.score__cells { display: flex; gap: 6px; margin-top: var(--space-16); }
.score__cells span { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border: 1.5px solid var(--structural-blue); font: 700 13px/1 var(--font-latin); color: var(--structural-blue); background: var(--white); }
.score__cells span.ok { background: var(--structural-blue); color: var(--white); }
.score__cells span.ng { border-style: dashed; }
.score__info { display: grid; gap: var(--space-8); }
.score__info h2 { font-size: 24px; }
.score__info p { color: var(--text-muted); font-size: 14px; }
@media (max-width: 720px) { .score { grid-template-columns: 1fr; gap: var(--space-16); padding: var(--space-24); } .score__big { font-size: 52px; } }
.matrix td .status, .matrix td .diff { vertical-align: middle; }

.ans { display: grid; gap: var(--space-16); padding: var(--space-32); background: var(--white); border: 1px solid var(--border-default); border-radius: var(--radius-card); scroll-margin-top: calc(var(--header-h) + var(--space-24)); }
.ans__head { display: flex; align-items: center; gap: var(--space-16); flex-wrap: wrap; }
.ans__summary { display: flex; flex-wrap: wrap; gap: var(--space-8); align-items: center; font-size: 14px; }
.xopts { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-8); }
.xopt { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: var(--space-16); padding: var(--space-16); border: 1px solid var(--border-default); border-radius: var(--radius-card); }
.xopt.is-answer { border-color: var(--structural-blue); border-width: 2px; padding: calc(var(--space-16) - 1px); }
.xopt.is-chosen:not(.is-answer) { border-color: var(--structural-blue); border-style: dashed; border-width: 2px; padding: calc(var(--space-16) - 1px); }
.xopt__k { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border: 1.5px solid var(--structural-blue); border-radius: var(--radius-control); font: 700 16px/1 var(--font-latin); color: var(--structural-blue); }
.xopt.is-answer .xopt__k { background: var(--structural-blue); color: var(--white); }
.xopt__body { display: grid; gap: var(--space-8); min-width: 0; }
.xopt__flags { display: flex; flex-wrap: wrap; gap: var(--space-8); align-items: center; }
.xopt__text { line-height: 1.85; }
.xopt__text mark { background: var(--orange-tint); color: var(--orange-ink); font-weight: 700; padding: 0 2px; border-bottom: 1px solid var(--orange-ink); }
.xopt__ex { font-size: 15px; line-height: 1.85; padding: var(--space-8) var(--space-16); background: var(--paper-white); border-left: 2px solid var(--sky-blue); }
.xopt__ex .wp { font-weight: 700; color: var(--orange-ink); }
.verdict { font-weight: 700; font-size: 14px; display: inline-flex; align-items: center; gap: 4px; }
.verdict--t { color: var(--structural-blue); }
.verdict--f { color: var(--text-body); }
.verdict i { font-style: normal; font-family: var(--font-latin); font-size: 16px; }
.refs { display: flex; flex-wrap: wrap; gap: var(--space-8); }
.ref { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 var(--space-8); border: 1px solid var(--border-default); border-radius: var(--radius-control); font-size: 13px; text-decoration: none; color: var(--structural-blue); background: var(--white); }
.ref:hover { border-color: var(--action-hover); color: var(--action-hover); }
.ref em { font-style: normal; color: var(--text-muted); font-size: 12px; }
.ref svg { width: 14px; height: 14px; }
@media (max-width: 720px) { .ans { padding: var(--space-24) var(--space-16); } .xopt { grid-template-columns: 30px minmax(0, 1fr); gap: var(--space-8); padding: var(--space-8); } .xopt.is-answer, .xopt.is-chosen:not(.is-answer) { padding: calc(var(--space-8) - 1px); } .xopt__k { width: 30px; height: 30px; font-size: 14px; } .xopt__ex { padding: var(--space-8); } }

/* ---------- Review ---------- */
.rgroup { display: grid; gap: var(--space-16); margin-bottom: var(--space-48); }
.rgroup__head { display: flex; align-items: baseline; gap: var(--space-16); }
.rgroup__head h2 { font-size: 20px; }
.rcard { background: var(--white); border: 1px solid var(--border-default); border-radius: var(--radius-card); padding: var(--space-24); display: grid; gap: var(--space-16); position: relative; }
.rcard--p1 { border-color: var(--orange-ink); }
.rcard__top { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-8) var(--space-16); }
.rcard__top h3 { font-size: 19px; flex-basis: 100%; }
.rcard__lesson { font-size: 13px; color: var(--text-muted); }
.say { display: grid; gap: var(--space-8); padding: var(--space-16); background: var(--paper-white); border-radius: var(--radius-card); }
.say__k { font-size: 13px; font-weight: 700; color: var(--structural-blue); display: flex; align-items: center; gap: 6px; }
.say textarea { width: 100%; min-height: 72px; resize: vertical; font: inherit; font-size: 15px; padding: var(--space-8); border: 1px solid var(--border-strong); border-radius: var(--radius-control); background: var(--white); color: var(--text-body); }
.reveal { display: grid; gap: var(--space-8); padding: var(--space-16); border: 1px solid var(--border-strong); border-radius: var(--radius-card); }
.rcard__foot { display: flex; flex-wrap: wrap; gap: var(--space-8) var(--space-16); align-items: center; }
.rcard__done { font-size: 14px; color: var(--structural-blue); font-weight: 700; }
.legend-table td:first-child { white-space: nowrap; }

/* ---------- Admin ---------- */
.drop { display: grid; gap: var(--space-16); justify-items: start; padding: var(--space-32); border: 2px dashed var(--border-strong); border-radius: var(--radius-card); background: var(--white); }
.drop.is-over { background: var(--paper-white); border-color: var(--action-blue); }
.drop input[type=file] { font-size: 14px; }
.check { display: inline-flex; gap: var(--space-8); align-items: center; font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--structural-blue); }
.log { margin: 0; padding: var(--space-16); background: var(--paper-white); border: 1px solid var(--border-default); border-radius: var(--radius-card); font-size: 14px; display: grid; gap: var(--space-4); }
.log li { list-style: none; }
.mono { font-family: var(--font-latin); font-size: 13px; }

/* ---------- Toast / loading ---------- */
.toast { position: fixed; left: 50%; bottom: var(--space-24); transform: translateX(-50%); z-index: 60; background: var(--kozo-navy); color: var(--white); padding: var(--space-16) var(--space-24); border-radius: var(--radius-card); max-width: calc(100% - 40px); font-size: 14px; display: none; }
.toast.is-show { display: block; }
.loading { padding: var(--space-64) 0; display: grid; justify-items: start; gap: var(--space-16); color: var(--text-muted); }
.loading__bar { width: 160px; height: 3px; background: var(--border-default); position: relative; overflow: hidden; }
.loading__bar::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 48px; background: var(--structural-blue); animation: ld 1s linear infinite; }
@keyframes ld { from { transform: translateX(-48px); } to { transform: translateX(160px); } }
.alert { padding: var(--space-16) var(--space-24); border: 1px solid var(--border-strong); background: var(--white); color: var(--text-body); border-radius: var(--radius-card); display: grid; gap: var(--space-8); }
.alert b { color: var(--text-heading); }

/* ---------- Footer（白基調） ---------- */
.site-footer { background: var(--white); color: var(--text-body); position: relative; margin-top: auto; border-top: 1px solid var(--border-default); }
.site-footer::before { content: ""; position: absolute; left: 0; top: -2px; width: 120px; height: 3px; background: var(--structural-blue); clip-path: polygon(0 0, 100% 0, calc(100% - 3px) 100%, 0 100%); }
.site-footer__inner { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-32); padding: var(--space-48) 0 var(--space-32); }
.site-footer .plate { display: inline-flex; }
.site-footer .plate img { width: 44px; height: 44px; display: block; }
.fbrand { display: flex; align-items: center; gap: var(--space-16); }
.fbrand b { display: block; font-size: 16px; color: var(--text-heading); }
.fbrand span { font-size: 13px; color: var(--text-muted); }
.flinks { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-8) var(--space-24); align-items: center; }
.flinks a { font-size: 14px; }
.site-footer__bottom { border-top: 1px solid var(--border-default); padding: var(--space-16) 0 var(--space-24); font-size: 12px; color: var(--text-muted); display: flex; flex-wrap: wrap; gap: var(--space-8) var(--space-24); justify-content: space-between; }
@media (max-width: 720px) { .site-footer__inner { grid-template-columns: 1fr; } }

.mt-16 { margin-top: var(--space-16); } .mt-24 { margin-top: var(--space-24); } .mt-32 { margin-top: var(--space-32); } .mt-48 { margin-top: var(--space-48); }
.stack { display: grid; gap: var(--space-24); }
.stack > *, .stack-16 > *, .layout > *, .grid > * { min-width: 0; }
.stack-16 { display: grid; gap: var(--space-16); }
.row { display: flex; flex-wrap: wrap; gap: var(--space-8); align-items: center; }
.between { display: flex; justify-content: space-between; align-items: center; gap: var(--space-16); flex-wrap: wrap; }

@media print {
  .site-header, .site-footer, .submitbar, .tabs, .side, .cta-panel, body::before { display: none !important; }
  .layout { display: block; }
  .prose, .ans { border: 0; padding: 0; }
}

/* 装飾レイヤー（白基調パネル内の構造図） */
.cta-panel > .cta-art, .score > .score-art { position: absolute; z-index: 0; }

/* =========================================================
   可変タイポグラフィ（画面幅に応じて縮小し、1行に収める）
   ========================================================= */
:root {
  --fs-display: clamp(24px, 1.6vw + 16px, 40px);
  --fs-display-num: clamp(34px, 2.6vw + 22px, 56px);
  --fs-h1: clamp(18px, 1.1vw + 13px, 30px);
  --fs-h2: clamp(17px, .8vw + 13px, 24px);
  --fs-h3: clamp(16px, .5vw + 13px, 20px);
  --fs-brand: clamp(14px, .5vw + 11px, 17px);
  --fs-nav: clamp(14px, .3vw + 12px, 15px);
}
/* 1行に固定する要素 */
.brand__ja, .brand__en, .nav a, .tabs a, .steps li, .btn, .tag, .diff, .status, .chip span, .label-en, .crumbs, .ref, .verdict, .badge { white-space: nowrap; }
.brand__ja { font-size: var(--fs-brand); }
.nav a { font-size: var(--fs-nav); }
.hero h1 { font-size: var(--fs-display); white-space: nowrap; }
.hero h1 .num { font-size: var(--fs-display-num); }
.hero h1 br { display: none; }
.page-head h1, .lesson-head h1, .sec-head__title, .prose h2, .card__title, .lcard__title, .rcard__top h3, .score__info h2, .cta-panel h2, .rgroup__head h2 {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; max-width: 100%;
}
.sec-head__title { display: flex; flex-wrap: nowrap; }
.prose h2 { display: flex; flex-wrap: nowrap; }
.prose h2 > span:last-child, .prose h2 { min-width: 0; }
.page-head h1, .lesson-head h1 { font-size: var(--fs-h1); }
.sec-head__title { font-size: var(--fs-h1); }
.prose h2 { font-size: var(--fs-h2); }
.card__title, .lcard__title, .rcard__top h3, .cta-panel h2, .score__info h2 { font-size: var(--fs-h3); }
/* カード内はカード幅に合わせて縮小 */
.lcard, .rcard, .card { container-type: inline-size; }
.lcard__title, .rcard__top h3, .card .card__title { font-size: clamp(14px, 5.6cqi, 20px); }
.lcard__title { line-height: 1.5; }
@media (max-width: 1100px) {
  .user-chip { display: block; }
}
@media (max-width: 560px) {
  .hero .actions .btn { width: 100%; }
  .tabs a { font-size: 14px; padding: 0 12px; }
}

/* 本文見出しは省略せず、コンテナ幅に合わせて縮小して1行に収める */
.prose { container-type: inline-size; }
.prose > * { min-width: 0; }
.prose h2 { font-size: clamp(13px, 4.3cqi, 24px); overflow: visible; text-overflow: clip; }
.rcard__top h3 { font-size: clamp(13px, 4.6cqi, 20px); overflow: visible; text-overflow: clip; }
.lcard__title { overflow: visible; text-overflow: clip; }

/* =========================================================
   スマホ（720px以下）：主要機能は画面下部のタブバー
   ========================================================= */
.tabbar { display: none; }
@media (max-width: 720px) {
  :root { --tabbar-h: 64px; }
  body { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px)); }
  .tabbar {
    display: grid; grid-template-columns: repeat(var(--tabs, 3), minmax(0, 1fr));
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px); background: var(--white); border-top: 1px solid var(--border-default);
  }
  .tabbar::before { content: ""; position: absolute; left: 0; top: -1px; width: 72px; height: 2px; background: var(--structural-blue); }
  .tabbar a { position: relative; display: grid; justify-items: center; align-content: center; gap: 2px; text-decoration: none; color: var(--text-muted); min-height: 44px; }
  .tabbar a[aria-current="page"] { color: var(--structural-blue); }
  .tabbar a[aria-current="page"]::before { content: ""; position: absolute; top: 0; left: 24%; right: 24%; height: 3px; background: var(--structural-blue); clip-path: polygon(0 0, 100% 0, calc(100% - 3px) 100%, 3px 100%); }
  .tabbar__ic { position: relative; display: inline-flex; }
  .tabbar__ic svg { width: 24px; height: 24px; }
  .tabbar__ic .badge { position: absolute; top: -6px; right: -14px; min-width: 18px; height: 18px; font-size: 11px; padding: 0 4px; }
  .tabbar__lb { font-size: clamp(11px, 3vw, 13px); font-weight: 700; white-space: nowrap; }
  .tabbar a[aria-current="page"] .tabbar__lb { color: var(--text-heading); }
  /* ヘッダーのメニュー内は補助項目のみ */
  .nav .nav-main:not(.nav-admin) { display: none; }
  .submitbar { bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px)); }
  .toast { bottom: calc(var(--tabbar-h) + var(--space-16)); }
  .flinks { display: none; }
}
.ref { max-width: 100%; min-width: 0; }
.ref em { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ans > *, .xopt__body > *, .xopts > * { min-width: 0; }

/* ---------- 統計（レーダーチャート） ---------- */
.stat-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: var(--space-24); align-items: start; }
@media (max-width: 900px) { .stat-grid { grid-template-columns: 1fr; } }
.radar { width: 100%; display: flex; justify-content: center; min-height: 260px; }
.radar svg { display: block; max-width: 100%; height: auto; overflow: visible; }
.rd-ring { fill: none; stroke: var(--border-default); stroke-width: 1; }
.rd-ring--out { stroke: var(--graphic-sub); }
.rd-axis { stroke: var(--border-default); stroke-width: 1; }
.rd-tick { font: 500 10px var(--font-latin); fill: var(--text-muted); }
.rd-ci { fill: var(--pale-cyan); opacity: .55; stroke: none; }
.rd-rate { fill: rgba(38, 76, 113, .14); stroke: var(--structural-blue); stroke-width: 2; stroke-linejoin: miter; }
.rd-conf { fill: none; stroke: var(--sky-blue); stroke-width: 1.5; stroke-dasharray: 5 4; }
.rd-dot { fill: var(--white); stroke: var(--structural-blue); stroke-width: 1.5; }
.rd-weak { fill: var(--complement-orange); stroke: var(--white); stroke-width: 1.5; }
.rd-label { font: 700 13px var(--font-jp); fill: var(--text-heading); }
.rd-label--weak { fill: var(--orange-ink); }
.rd-val { font: 500 12px var(--font-latin); fill: var(--text-muted); }
@media (max-width: 420px) { .rd-label { font-size: 11px; } .rd-val { font-size: 10px; } .rd-tick { display: none; } }
.radar-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-8) var(--space-24); font-size: 13px; color: var(--text-muted); }
.radar-legend li { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.radar-legend i { width: 18px; height: 10px; display: inline-block; }
.lg-rate { border: 2px solid var(--structural-blue); background: rgba(38, 76, 113, .14); }
.lg-ci { background: var(--pale-cyan); }
.lg-conf { border-top: 2px dashed var(--sky-blue); height: 0 !important; }
.lg-weak { width: 10px !important; background: var(--complement-orange); transform: rotate(45deg); }
.stat-big { font-size: clamp(32px, 3vw + 16px, 48px); color: var(--text-heading); line-height: 1.2; }
.cibar { position: relative; display: inline-block; width: 120px; height: 10px; background: var(--paper-white); border: 1px solid var(--border-default); vertical-align: middle; }
.cibar i { position: absolute; top: 1px; bottom: 1px; background: var(--pale-cyan); border-left: 1px solid var(--structural-blue); border-right: 1px solid var(--structural-blue); }
.cibar i::after { content: ""; position: absolute; top: -2px; bottom: -2px; left: var(--p, 50%); width: 2px; background: var(--structural-blue); }
.stat-wait { grid-template-columns: 200px minmax(0, 1fr); align-items: center; gap: var(--space-32); display: grid; }
.stat-wait__art { width: 200px; height: 200px; background: url("img/radar-empty.svg") center / contain no-repeat; }
@media (max-width: 720px) { .stat-wait { grid-template-columns: 1fr; } .stat-wait__art { width: 140px; height: 140px; } }
.prog-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border-default); border-radius: var(--radius-card); background: var(--white); }
.prog-list li { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(80px, 1fr) auto auto; gap: var(--space-16); align-items: center; padding: var(--space-8) var(--space-16); min-height: 48px; }
.prog-list li + li { border-top: 1px solid var(--border-default); }
.prog-list__name { display: flex; gap: var(--space-8); align-items: baseline; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.prog-list__name b { color: var(--structural-blue); font-size: 13px; flex: none; width: 2.6em; }
.prog-list__bar { height: 8px; border: 1px solid var(--structural-blue); background: var(--white); position: relative; }
.prog-list__bar i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--structural-blue); }
.prog-list__n { font-size: 13px; color: var(--text-muted); white-space: nowrap; }
@media (max-width: 720px) { .prog-list li { grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-4) var(--space-16); padding: var(--space-8) var(--space-16); } .prog-list__bar { grid-column: 1 / -1; order: 3; } }

/* =========================================================
   横スクロールなし：スマホでは表を縦積み、タブは等分
   ========================================================= */
.tbl, .tabs, .steps, .row, .actions, .refs { max-width: 100%; }
.tbl td, .tbl th { overflow-wrap: anywhere; }
@media (max-width: 720px) {
  .tbl table, .tbl tbody, .tbl tr { display: block; width: 100%; }
  .tbl thead { display: none; }
  .tbl tr { padding: var(--space-8) var(--space-16); border-bottom: 1px solid var(--border-default); }
  .tbl tbody tr:last-child { border-bottom: 0; }
  .tbl tbody th[scope="row"] { display: block; padding: var(--space-4) 0; border: 0; font-size: 15px; }
  .tbl td { display: flex; flex-wrap: wrap; gap: var(--space-4) var(--space-8); align-items: center; padding: 3px 0; border: 0; font-size: 14px; }
  .tbl td::before { content: attr(data-l); flex: 0 0 6.5em; font-size: 12px; font-weight: 700; color: var(--text-muted); }
  .tbl td.r { text-align: left; }
  .tbl td[colspan] { display: block; }
  .tbl td[colspan]::before { content: none; }
  .tabs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .tabs a { justify-content: center; padding: 0 2px; font-size: clamp(11px, 3.1vw, 14px); min-width: 0; }
  .tabs a .latin { display: none; }
  .cibar { width: 80px; }
}
@media (max-width: 720px) { .cta-panel .cta-art, .score .score-art { right: 0; width: 60%; } }
.prose h2 { font-size: clamp(12px, 4.1cqi, 24px); overflow: hidden; text-overflow: ellipsis; }
.tbl thead th { white-space: nowrap; }
.nowrap { white-space: nowrap; }

/* ===== ログイン・アカウント（バックエンド側で追加） ===== */
.auth-card { max-width: 480px; }
.field { display: grid; gap: var(--space-8); }
.field label { font-size: 14px; font-weight: 700; color: var(--text-heading); }
.field input { width: 100%; height: var(--control-h); padding: 0 var(--space-16); font: inherit; font-size: 16px; color: var(--text-body); background: var(--white); border: 1px solid var(--border-default); border-radius: var(--radius-control); }
.field input:focus-visible { outline: 2px solid var(--border-strong); outline-offset: 1px; border-color: var(--border-strong); }
.field__err { min-height: 1.5em; margin: 0; font-size: 14px; color: var(--text-heading); font-weight: 700; }
.field__err:empty { min-height: 0; }
a.user-chip { text-decoration: none; }
a.user-chip:hover, a.user-chip[aria-current="page"] { color: var(--text-heading); text-decoration: underline; }
