/* 宅建 基礎から合格 styles.css。配色トークンは gyosei の「ミント＆サクラ」（D8-3）を流用。
   流用元: ~/dev/gyosei-exam-app/public/app/styles.css の 01〜08・11・15・16・19〜24
   （多肢選択・記述・ヒートマップ・模試の部品は本PJの M2 に無いので持ち込まない。M3/M5 で足す）
   動き・強調・使いやすさの値は docs/SPEC-v1.md §4-2 の表が正本（時間は public/app/motion.js と同じ値
   ＝tests/unit/motion-css.test.mjs が突合する）。インライン style は使わない（CSP default-src 'self'）。 */

/* 01. デザイントークン */
:root {
  color-scheme: light;
  --bg: #f8fafc;
  --panel: #ffffff;
  --panel-dim: #f1f5f9;
  --surface: #f1f5f9;
  --surface-high: #e2e8f0;
  --fg: #0f172a;
  --sub: #475569;
  --muted: #5f6f85;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --acc: #047857;
  --acc-hover: #065f46;
  --acc-light: #ecfdf5;
  --acc-tint: #a7f3d0;
  --acc-ink: #065f46;
  --on-acc: #ffffff;
  --sakura: #be123c;
  --sakura-light: #fff1f2;
  --sakura-tint: #fecdd3;
  --sakura-ink: #9f1239;
  --on-sakura: #ffffff;
  --ok: #047857;
  --ok-bg: #ecfdf5;
  --ok-line: #6ee7b7;
  --ng: #b91c1c;
  --ng-bg: #fef2f2;
  --ng-line: #fca5a5;
  --warn: #92400e;
  --warn-bg: #fffbeb;
  --chip-ink: #334155;
  --focus: #047857;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 12px -2px rgba(15, 23, 42, 0.08);
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, "Noto Sans JP", sans-serif;
  --radius: 16px;
  --radius-sm: 12px;
  --nav-h: 60px;
  --header-h: 64px;
  --tap: 46px; /* 44px 以上＋小数誤差の余裕（SPEC §4-2） */
  --ease-out: cubic-bezier(0.25, 1, 0.5, 1);
  --press-ms: 120ms;
}

/* 02. ダークモード（端末設定 と data-theme の両方） */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b1315;
    --panel: #132224;
    --panel-dim: #182e30;
    --surface: #182e30;
    --surface-high: #203a3d;
    --fg: #f1f5f9;
    --sub: #b6c4d4;
    --muted: #a6b5c7;
    --line: #203a3d;
    --line-strong: #2a4c50;
    --acc: #34d399;
    --acc-hover: #6ee7b7;
    --acc-light: #13332c;
    --acc-tint: #1d4f43;
    --acc-ink: #6ee7b7;
    --on-acc: #0b1315;
    --sakura: #fb7185;
    --sakura-light: #3b1721;
    --sakura-tint: #6b2435;
    --sakura-ink: #fda4af;
    --on-sakura: #0b1315;
    --ok: #34d399;
    --ok-bg: #13332c;
    --ok-line: #1d7a5e;
    --ng: #fca5a5;
    --ng-bg: #3a1a1a;
    --ng-line: #7f3030;
    --warn: #fcd34d;
    --warn-bg: #3a2e12;
    --chip-ink: #cbd5e1;
    --focus: #6ee7b7;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1315;
  --panel: #132224;
  --panel-dim: #182e30;
  --surface: #182e30;
  --surface-high: #203a3d;
  --fg: #f1f5f9;
  --sub: #b6c4d4;
  --muted: #a6b5c7;
  --line: #203a3d;
  --line-strong: #2a4c50;
  --acc: #34d399;
  --acc-hover: #6ee7b7;
  --acc-light: #13332c;
  --acc-tint: #1d4f43;
  --acc-ink: #6ee7b7;
  --on-acc: #0b1315;
  --sakura: #fb7185;
  --sakura-light: #3b1721;
  --sakura-tint: #6b2435;
  --sakura-ink: #fda4af;
  --on-sakura: #0b1315;
  --ok: #34d399;
  --ok-bg: #13332c;
  --ok-line: #1d7a5e;
  --ng: #fca5a5;
  --ng-bg: #3a1a1a;
  --ng-line: #7f3030;
  --warn: #fcd34d;
  --warn-bg: #3a2e12;
  --chip-ink: #cbd5e1;
  --focus: #6ee7b7;
}

/* 03. ベース（和文組版: 行間 1.8・字送りは既定・禁則はブラウザ既定） */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.8;
  color: var(--fg);
  background: var(--bg);
  overflow-wrap: anywhere;
  line-break: strict;
  /* 下部ナビ（var(--nav-h) ＋ 上の境界線 1px ＋ ホームバーの安全領域）の分だけ本文の下に場所を空ける
     ＝一番下の要素がナビの裏に隠れない（E2E が CDP で安全領域を入れて実測する） */
  padding-bottom: calc(var(--nav-h) + 1px + env(safe-area-inset-bottom, 0px));
}
h1, h2, h3, h4 { line-height: 1.4; margin: 0 0 0.5em; font-feature-settings: "palt"; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
h4 { font-size: 0.95rem; }
p { margin: 0 0 0.75em; }
a { color: var(--acc-ink); }
ul, ol { padding-left: 1.2em; }

/* 04. ユーティリティ・アクセシビリティ */
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 0.8125rem; color: var(--sub); }
.nobr { white-space: nowrap; }
/* 数字のまとまり: ふだんは折らず、1 行に収まらないときだけ折る（行頭に「）。」が来る禁則破れを避ける） */
.keep { word-break: keep-all; }
.phrase { display: inline-block; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.skip-link {
  position: absolute; left: 8px; top: -100px; background: var(--fg); color: var(--bg);
  padding: 8px 12px; border-radius: 8px; z-index: 1001; font-weight: 700; text-decoration: none;
}
.skip-link:focus { top: 8px; }
/* 重要語の強調（下線＋太字＝色だけに頼らない・SPEC §4-2） */
.em, mark {
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: var(--sakura);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
  text-decoration-skip-ink: none;
  color: var(--fg);
  background: none;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
mark { background: var(--sakura-light); }
.stem .em-directive { background: var(--sakura-light); color: var(--sakura-ink); border-radius: 9999px; padding: 0.05em 0.45em; }

/* 05. アイコン（Material Symbols の SVG を mask で文字色に塗る・飾り＝読み上げない） */
.icon {
  display: inline-block; flex: none; width: 1.25em; height: 1.25em; vertical-align: -0.25em;
  background-color: currentColor;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-position: center; mask-position: center;
  -webkit-mask-size: contain; mask-size: contain;
}
.i-cottage { -webkit-mask-image: url("/app/icons/cottage.svg"); mask-image: url("/app/icons/cottage.svg"); }
.i-menu_book { -webkit-mask-image: url("/app/icons/menu_book.svg"); mask-image: url("/app/icons/menu_book.svg"); }
.i-timelapse { -webkit-mask-image: url("/app/icons/timelapse.svg"); mask-image: url("/app/icons/timelapse.svg"); }
.i-track_changes { -webkit-mask-image: url("/app/icons/track_changes.svg"); mask-image: url("/app/icons/track_changes.svg"); }
.i-event_available { -webkit-mask-image: url("/app/icons/event_available.svg"); mask-image: url("/app/icons/event_available.svg"); }
.i-settings { -webkit-mask-image: url("/app/icons/settings.svg"); mask-image: url("/app/icons/settings.svg"); }
.i-bolt { -webkit-mask-image: url("/app/icons/bolt.svg"); mask-image: url("/app/icons/bolt.svg"); }
.i-arrow_forward { -webkit-mask-image: url("/app/icons/arrow_forward.svg"); mask-image: url("/app/icons/arrow_forward.svg"); }
.i-calendar_month { -webkit-mask-image: url("/app/icons/calendar_month.svg"); mask-image: url("/app/icons/calendar_month.svg"); }
.i-approval { -webkit-mask-image: url("/app/icons/approval.svg"); mask-image: url("/app/icons/approval.svg"); }
.i-task_alt { -webkit-mask-image: url("/app/icons/task_alt.svg"); mask-image: url("/app/icons/task_alt.svg"); }
.i-play_arrow { -webkit-mask-image: url("/app/icons/play_arrow.svg"); mask-image: url("/app/icons/play_arrow.svg"); }
.i-gavel { -webkit-mask-image: url("/app/icons/gavel.svg"); mask-image: url("/app/icons/gavel.svg"); }
.i-flag { -webkit-mask-image: url("/app/icons/flag.svg"); mask-image: url("/app/icons/flag.svg"); }
.i-timer { -webkit-mask-image: url("/app/icons/timer.svg"); mask-image: url("/app/icons/timer.svg"); }

/* 06. 外枠（ヘッダ・本文・下部ナビ・フッタ）。安全領域（Dynamic Island・ホームバー・横向き）を避ける */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top, 0px);
}
.site-header .inner, .site-footer .inner, main#app {
  max-width: 720px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.site-header .inner { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: var(--header-h); }
.brand { margin: 0; font-size: 1rem; min-width: 0; }
.brand-link { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--fg); min-height: var(--tap); min-width: 0; }
.brand-mark {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; flex: none;
  background: #1a1613; color: #fff; font-weight: 700; box-shadow: inset 0 0 0 3px #d9533c;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.brand-over { font-size: 0.72rem; color: var(--muted); white-space: nowrap; }
.brand-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.header-tools { display: flex; align-items: center; gap: 8px; flex: none; }
.streak-pill {
  display: inline-flex; align-items: center; gap: 4px; min-height: 30px; padding: 0 0.6em;
  border-radius: 999px; background: var(--sakura-light); color: var(--sakura-ink);
  font-size: 0.78rem; font-weight: 700; white-space: nowrap;
}
.streak-pill .icon { width: 15px; height: 15px; }
.streak-word { font-size: 0.72rem; margin-left: 2px; }
.avatar {
  display: inline-grid; place-items: center; width: var(--tap); height: var(--tap); border-radius: 50%;
  background: var(--panel-dim); color: var(--fg); text-decoration: none; flex: none;
  transition: transform var(--press-ms) var(--ease-out), background-color 0.15s ease;
}
.avatar .icon { width: 22px; height: 22px; }
.avatar[aria-current="page"] { background: var(--acc-light); color: var(--acc-ink); }
.avatar:active { transform: scale(0.9); }
main#app { padding-top: 16px; padding-bottom: 16px; min-height: 50vh; }
.site-footer { font-size: 0.8rem; color: var(--muted); padding: 16px 0 24px; border-top: 1px solid var(--line); }
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 100;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--panel); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}
.nav a {
  display: grid; place-items: center; gap: 1px; min-height: var(--nav-h); text-decoration: none; color: var(--muted);
  font-size: 0.72rem; font-weight: 600;
  transition: transform var(--press-ms) var(--ease-out), color 0.15s ease, box-shadow 0.15s ease;
}
.nav a .icon { width: 22px; height: 22px; }
.nav a[aria-current="page"] { color: var(--acc-ink); box-shadow: inset 0 3px 0 var(--acc); }
.nav a:active { transform: scale(0.94); }

/* 07. カード・札・チップ */
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow-sm);
}
.card > h2 .icon, .card-head h2 .icon, .section-head h2 .icon { width: 20px; height: 20px; color: var(--acc); margin-right: 0.3rem; }
.card-head, .section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.25rem 0.5rem; }
.card-head h2, .section-head h2 { margin: 0 0 0.35em; }
.card-aside { font-size: 0.8125rem; font-weight: 700; color: var(--sub); white-space: nowrap; }
.home-block { margin-bottom: 16px; }
.pill, .chip {
  display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.1em 0.7em; border-radius: 999px;
  font-size: 0.75rem; font-weight: 700; line-height: 1.6;
}
.chip { background: var(--surface-high); color: var(--chip-ink); }
.pill.mint { background: var(--acc-light); color: var(--acc-ink); }
.pill.sakura { background: var(--sakura-light); color: var(--sakura-ink); }
.pill.lavender { background: var(--surface-high); color: var(--chip-ink); }
.notice {
  background: var(--warn-bg); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px 14px; margin-bottom: 12px; font-size: 0.9rem;
}
.notice p { margin: 0 0 0.25rem; }
.notice p:last-child { margin-bottom: 0; }
.empty h2 { margin-bottom: 0.35em; }

/* 08. ボタン・入力（タップ対象 44px 以上厳守・押した反応は transform/opacity だけ） */
button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.3rem;
  min-height: var(--tap); min-width: var(--tap);
  padding: 0.6rem 1.15rem; border-radius: 999px;
  font-size: 0.9375rem; font-weight: 700; font-family: inherit;
  border: 1px solid var(--line); background: var(--panel); color: var(--fg);
  text-decoration: none; cursor: pointer; user-select: none;
  transition: transform var(--press-ms) var(--ease-out), opacity var(--press-ms) ease, background-color 0.15s ease;
}
button:not(:disabled):active, .btn:active { transform: scale(0.94); }
button:disabled, .btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
button.primary, .btn.primary { background: var(--acc); color: var(--on-acc); border-color: var(--acc); }
button.primary .icon, .btn.primary .icon { width: 18px; height: 18px; }
@media (hover: hover) {
  button.primary:not(:disabled):hover, .btn.primary:hover { background: var(--acc-hover); border-color: var(--acc-hover); }
}
button.ghost { background: transparent; border-color: var(--line); color: var(--sub); }
button.danger { background: var(--sakura); color: var(--on-sakura); border-color: var(--sakura); }
button.danger-outline { background: transparent; color: var(--sakura-ink); border-color: var(--sakura-tint); }
.actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 0.85rem; }
.field { margin-bottom: 1.1rem; }
.field > label { display: block; font-size: 0.875rem; font-weight: 700; color: var(--fg); margin-bottom: 0.4rem; }
input[type="date"], input[type="number"], select, textarea {
  width: 100%; min-height: var(--tap); padding: 0.6rem 0.9rem; border-radius: var(--radius-sm);
  border: 1.5px solid var(--line-strong); background: var(--panel); color: var(--fg);
  font-family: inherit; font-size: 1rem;
}
textarea { line-height: 1.6; font-size: 0.875rem; }
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--focus); }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { font-weight: 700; margin-bottom: 8px; }
fieldset.modes {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 0.85rem 1rem; margin-bottom: 1.1rem;
}
fieldset.modes legend { padding: 0 0.4rem; font-size: 0.875rem; color: var(--sub); }
label.radio {
  display: flex; align-items: flex-start; gap: 0.65rem; min-height: var(--tap); padding: 0.2rem 0;
  cursor: pointer; font-weight: 600;
}
label.radio input { width: 22px; height: 22px; margin-top: 0.45rem; flex: none; accent-color: var(--acc); transition: transform var(--press-ms) var(--ease-out); }
label.radio:active input { transform: scale(0.86); }
label.radio small { display: block; margin-top: 0.1rem; font-weight: 400; line-height: 1.6; }
.status { min-height: 1.6em; margin: 0 0 0.6rem; font-size: 0.875rem; font-weight: 700; color: var(--acc-ink); }
.field-msg { min-height: 1.6em; margin: 0.25rem 0 0; color: var(--sub); }
.field-msg.is-ng { color: var(--ng); font-weight: 700; }
.export-slot { margin-top: 0.85rem; }
.confirm { background: var(--ng-bg); border: 1px solid var(--ng-line); border-radius: var(--radius-sm); padding: 12px; }
.legal ul { margin: 0; padding-left: 1.1em; font-size: 0.875rem; line-height: 1.75; }
.legal li { margin-bottom: 0.35em; }

/* 09. 画面下部の操作バー（親指圏・主要操作はここ） */
.sticky-actions {
  /* 下部ナビ（高さ var(--nav-h) ＋ 上の境界線 1px）の真上に貼り付く。1px を足さないとバーの下端が
     ナビの線に乗る（E2E が実測して赤にする＝tests/e2e/screens.spec.mjs「主要操作は下部の操作バー」） */
  position: sticky; bottom: calc(var(--nav-h) + 1px + env(safe-area-inset-bottom, 0px));
  margin: 0.75rem -16px 0; padding: 0.7rem max(16px, env(safe-area-inset-left, 0px));
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem;
  background: var(--panel); border-top: 1px solid var(--line); z-index: 90;
}
.sticky-actions .primary, .sticky-actions .next-slot { flex: 2 1 55%; }
.sticky-actions .next-slot { display: flex; }
.sticky-actions .next-slot > button { width: 100%; }
.sticky-actions .ghost { flex: 1 1 35%; }
.bar-hint { display: flex; align-items: center; justify-content: center; width: 100%; min-height: var(--tap); }
.bar-verdict {
  flex-basis: 100%; margin: 0; font-size: 0.875rem; font-weight: 800; text-align: center;
}
.bar-verdict.ok { color: var(--ok); }
.bar-verdict.ng { color: var(--ng); }
.bar-verdict:empty { display: none; }
.bar-confirm { flex-basis: 100%; display: grid; gap: 0.5rem; }
.bar-confirm-head { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; }
.bar-confirm-head p { margin: 0; font-size: 0.9rem; font-weight: 700; }
.bar-confirm > button { width: 100%; }

/* 10. ホーム */
.quick-start {
  display: flex; align-items: center; gap: 0.75rem; min-height: 68px; padding: 0.8rem 1rem; margin-bottom: 12px;
  border-radius: var(--radius); background: var(--acc); color: var(--on-acc); text-decoration: none;
  transition: transform var(--press-ms) var(--ease-out), opacity var(--press-ms) ease;
}
.quick-start:active { transform: scale(0.98); }
.quick-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: rgba(255, 255, 255, 0.2); flex: none; }
.quick-icon .icon { width: 22px; height: 22px; }
.quick-body { display: flex; flex-direction: column; line-height: 1.35; flex: 1; min-width: 0; }
.quick-over { font-size: 0.75rem; opacity: 0.85; }
.quick-title { font-size: 1.05rem; font-weight: 800; }
.quick-go { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.8125rem; font-weight: 700; white-space: nowrap; }
.quick-go .icon { width: 16px; height: 16px; }
.hero-top { margin-bottom: 0.5rem; }
.hero-main { margin-bottom: 0.35rem; }
.countdown { font-size: 1.4rem; font-weight: 800; line-height: 1.35; margin: 0 0 0.2rem; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 0.2rem 0.75rem; margin: 0 0 0.35rem; font-size: 0.8125rem; color: var(--sub); font-weight: 600; }
.hero-date { display: inline-flex; align-items: center; gap: 0.3rem; }
.hero-date .icon { width: 17px; height: 17px; color: var(--acc); }
.hero-pass { color: var(--sakura-ink); }
.hero-note { margin: 0; line-height: 1.65; }

.stamps { position: relative; }
.stamp-row { list-style: none; display: grid; grid-template-columns: repeat(7, 1fr); gap: 0.3rem; margin: 0.5rem 0 0.4rem; padding: 0; }
.stamp-day { display: grid; justify-items: center; gap: 0.15rem; }
.stamp-dow { font-size: 0.7rem; color: var(--muted); font-weight: 700; }
.stamp {
  position: relative; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  border: 1.5px dashed var(--line-strong); background: var(--panel-dim); color: var(--muted);
  font-size: 0.95rem; font-weight: 800;
}
.stamp-day.is-on .stamp { border: 2px solid var(--acc); border-style: solid; background: var(--acc-light); color: var(--acc-ink); }
.stamp-day.is-today.is-on .stamp { border-color: var(--sakura); background: var(--sakura-light); color: var(--sakura-ink); }
.stamp-day.is-rest .stamp { border-style: solid; border-color: var(--line-strong); background: var(--panel-dim); color: var(--sub); }
.stamp-n { font-size: 0.68rem; color: var(--muted); }
.stamp-day.is-rest .stamp-n { color: var(--sub); }
.stamps-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.25rem 0.5rem; margin: 0; }
.rest-note { margin: 0.35rem 0 0; line-height: 1.6; }
.streak-days { display: inline-block; font-weight: 800; color: var(--fg); }

.week-goal { position: relative; }
.week-goal .goal-range { color: var(--muted); }
.goal-presets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem; margin-top: 0.5rem; }
.goal-preset {
  flex-direction: column; gap: 0.1rem; min-width: 0; padding: 0.4rem 0.2rem; border-radius: var(--radius-sm);
  background: var(--acc-light); border-color: var(--acc-tint); color: var(--acc-ink); line-height: 1.25;
}
.goal-preset-n { font-size: 0.9rem; font-weight: 800; white-space: nowrap; }
.goal-preset-sub { font-size: 0.72rem; font-weight: 600; color: var(--sub); white-space: nowrap; }
.goal-more { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 0.75rem; margin: 0.25rem 0 0; }
.goal-skip { min-width: 0; padding: 0 0.3rem; border: 0; background: none; color: var(--sub); font-size: inherit; font-weight: 600; }
.goal-nums { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; margin-top: 0.5rem; }
.goal-count { margin: 0; font-size: 0.9rem; color: var(--sub); white-space: nowrap; }
.goal-count strong { font-size: 1.7rem; font-weight: 800; color: var(--fg); margin-right: 0.15rem; }
.goal-left { font-size: 0.8125rem; font-weight: 700; color: var(--sub); white-space: nowrap; }
.goal-progress { margin: 0.5rem 0 0.25rem; }
.goal-note { margin: 0.4rem 0 0; line-height: 1.6; }

.subj-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; }
.subj-card {
  display: flex; flex-direction: column; gap: 0.1rem; min-height: 86px; padding: 0.7rem 0.8rem;
  border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--panel);
  color: var(--fg); text-decoration: none;
  transition: transform var(--press-ms) var(--ease-out), background-color 0.15s ease;
}
.subj-card:active { transform: scale(0.96); background-color: var(--panel-dim); }
.subj-top { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0 0.4rem; }
.subj-name { font-weight: 800; font-size: 0.95rem; line-height: 1.4; }
.subj-weight { font-size: 0.7rem; color: var(--acc-ink); font-weight: 700; white-space: nowrap; }
.subj-count { line-height: 1.4; }
.subj-progress { height: 6px; margin: 0.4rem 0 0; }

.tasks { list-style: none; display: grid; gap: 0.5rem; margin: 0.5rem 0 0.6rem; padding: 0; }
.task-link {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  min-height: 62px; padding: 0.6rem 0.9rem; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--panel); color: var(--fg); text-decoration: none;
  transition: transform var(--press-ms) var(--ease-out), background-color 0.15s ease;
}
.task-link:active { transform: scale(0.98); }
.task-link.is-zero { opacity: 0.72; }
.task-body { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.task-top { display: flex; align-items: center; gap: 0.4rem; }
.task-hint { line-height: 1.4; }
.task-go { display: inline-flex; align-items: center; gap: 0.3rem; flex: none; }
.task-n { font-weight: 800; }
.task-go .icon { width: 16px; height: 16px; color: var(--acc); }
.task-link.is-zero .task-go .icon { display: none; }

/* 11. 出題条件（科目のカード・論点のチップ） */
.setup .pick { margin-bottom: 1.1rem; }
.subject-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; }
.subject-card, .topic-chip {
  position: relative; display: flex; align-items: center; gap: 0.3rem; cursor: pointer;
  border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: var(--panel);
  transition: transform var(--press-ms) var(--ease-out), background-color 0.15s ease, border-color 0.15s ease;
}
.subject-card { flex-direction: column; align-items: flex-start; gap: 0.1rem; min-height: 56px; padding: 0.5rem 0.7rem; }
.topic-chip { min-height: var(--tap); padding: 0.3rem 0.8rem; border-radius: 999px; }
.subject-card:active, .topic-chip:active { transform: scale(0.96); }
.chip-input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.chip-input:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.chip-name { font-weight: 700; font-size: 0.9rem; line-height: 1.4; }
.chip-count { font-size: 0.72rem; color: var(--muted); font-weight: 700; white-space: nowrap; }
.subject-card:has(.chip-input:checked), .topic-chip:has(.chip-input:checked) {
  border-color: var(--acc); background: var(--acc-light); color: var(--acc-ink);
}
.subject-card:has(.chip-input:checked) .chip-count, .topic-chip:has(.chip-input:checked) .chip-count { color: var(--acc-ink); }
.topic-groups { display: grid; gap: 0.6rem; }
.topic-group-name { margin: 0 0 0.25rem; font-size: 0.78rem; font-weight: 800; color: var(--sub); }
.chip-row { display: flex; flex-wrap: wrap; gap: 0.4rem; }

/* 12. 出題（問題ヘッダ・設問・肢・判定） */
.qhead { padding: 12px 16px; }
.qhead-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.5rem; }
.qhead-count h2 { margin: 0; font-size: 1.05rem; }
.qhead-n { margin: 0; font-size: 0.8125rem; color: var(--sub); font-weight: 700; }
.qhead-big { font-size: 1.3rem; font-weight: 800; color: var(--fg); }
.qhead .progress { margin: 0.5rem 0 0.4rem; }
.qhead-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; margin: 0; }
.qhead-tags .chip { background: var(--acc-light); color: var(--acc-ink); }
.qhead-rate { white-space: nowrap; }
.streak-badge { font-size: 0.75rem; font-weight: 800; color: var(--sakura-ink); white-space: nowrap; }
.streak-badge:empty { display: none; }
.stem-card { padding: 14px 16px; }
.stem-label { display: flex; align-items: center; gap: 0.3rem; margin: 0 0 0.4rem; font-size: 0.78rem; font-weight: 800; color: var(--sub); }
.stem-label .icon { width: 17px; height: 17px; color: var(--acc); }
.stem { margin: 0; font-size: 1rem; line-height: 1.85; white-space: pre-wrap; }
.choices { list-style: none; display: flex; flex-direction: column; gap: 0.6rem; margin: 0 0 1rem; padding: 0; }
.choice {
  display: flex; align-items: flex-start; gap: 0.7rem; width: 100%;
  min-height: 54px; padding: 0.8rem 1rem; border-radius: var(--radius);
  background: var(--panel); border: 1.5px solid var(--line); color: var(--fg);
  text-align: left; font-weight: 400; border-radius: var(--radius);
  transition: transform var(--press-ms) var(--ease-out), background-color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}
.choice:not(:disabled):active { transform: scale(0.98); }
.choice-key {
  display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; flex: none;
  border-radius: 50%; background: var(--panel-dim); color: var(--sub); font-size: 0.85rem; font-weight: 800;
}
.choice-text { flex: 1; font-size: 0.9375rem; line-height: 1.75; min-width: 0; }
.choice-mark { flex: none; font-size: 0.8125rem; font-weight: 800; }
.choice[aria-pressed="true"] { border-color: var(--fg); background: var(--panel); }
.choice[aria-pressed="true"] .choice-key { background: var(--fg); color: var(--panel); }
.choice.is-holding { opacity: 0.72; }
.choice.is-correct { border-color: var(--ok); background: var(--ok-bg); }
.choice.is-correct .choice-key { background: var(--ok); color: var(--on-acc); }
.choice.is-correct .choice-mark { color: var(--ok); }
.choice.is-wrong { border-color: var(--ng-line); background: var(--ng-bg); }
.choice.is-wrong .choice-key { background: var(--ng); color: var(--on-sakura); }
.choice.is-wrong .choice-mark { color: var(--ng); }
.choice:disabled { opacity: 1; cursor: default; }

.feedback { border-radius: var(--radius); padding: 1rem 1.1rem; margin-bottom: 1rem; border: 1.5px solid var(--line); }
.feedback.ok { background: var(--ok-bg); border-color: var(--ok-line); }
.feedback.ng { background: var(--ng-bg); border-color: var(--ng-line); }
.feedback .verdict { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.4rem; font-size: 1.2rem; font-weight: 800; margin-bottom: 0.4rem; }
.feedback.ok .verdict { color: var(--ok); }
.feedback.ng .verdict { color: var(--ng); }
.feedback .verdict .muted { font-size: 0.875rem; }
.srs-note {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem; font-size: 0.8125rem; color: var(--sub); margin: 0 0 0.75rem;
}
.notes { list-style: none; display: grid; gap: 0.4rem; margin: 0.6rem 0; padding: 0; font-size: 0.875rem; }
.notes li { padding: 0.5rem 0.7rem; border-radius: var(--radius-sm); background: var(--panel); line-height: 1.65; }
.notes li.is-chosen { box-shadow: inset 0 0 0 2px var(--ng-line); }
.source { margin-top: 0.85rem; font-size: 0.8125rem; color: var(--sub); }
.source h3 { font-size: 0.85rem; margin-bottom: 0.3rem; }
.source .ref { margin: 0 0 0.4rem; }
.source .caption { margin: 0 0 0.2rem; font-weight: 700; }
.law-text {
  background: var(--panel); border-left: 3px solid var(--acc); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 0.7rem 0.85rem; margin: 0 0 0.5rem; font-size: 0.85rem; line-height: 1.8; color: var(--fg);
}
.quote { padding-left: 0.8rem; border-left: 3px solid var(--line-strong); margin: 0.5rem 0; }
.source a { overflow-wrap: anywhere; }

/* 13. 結果 */
.result .perfect { margin: 0.2rem 0 0.5rem; }
.result .score { font-size: 1.6rem; font-weight: 800; margin-bottom: 0.4rem; }
.result .score .muted { font-size: 1rem; }
.wrong-list { margin: 0.4rem 0 0.6rem; padding-left: 1.2em; font-size: 0.875rem; line-height: 1.7; }

/* 14. 進捗バー（幅は 5% 刻みのクラス＝インライン style を使わない） */
.progress { width: 100%; height: 8px; background: var(--surface-high); border-radius: 999px; overflow: hidden; margin: 0.6rem 0; }
.progress-fill { width: 0; height: 100%; background: var(--acc); border-radius: 999px; transition: width 300ms var(--ease-out); }
.progress-fill.p0 { width: 0; }
.progress-fill.p5 { width: 5%; }
.progress-fill.p10 { width: 10%; }
.progress-fill.p15 { width: 15%; }
.progress-fill.p20 { width: 20%; }
.progress-fill.p25 { width: 25%; }
.progress-fill.p30 { width: 30%; }
.progress-fill.p35 { width: 35%; }
.progress-fill.p40 { width: 40%; }
.progress-fill.p45 { width: 45%; }
.progress-fill.p50 { width: 50%; }
.progress-fill.p55 { width: 55%; }
.progress-fill.p60 { width: 60%; }
.progress-fill.p65 { width: 65%; }
.progress-fill.p70 { width: 70%; }
.progress-fill.p75 { width: 75%; }
.progress-fill.p80 { width: 80%; }
.progress-fill.p85 { width: 85%; }
.progress-fill.p90 { width: 90%; }
.progress-fill.p95 { width: 95%; }
.progress-fill.p100 { width: 100%; }

/* 15. 安全領域の測り台（E2E が CDP で入れた env(safe-area-inset-*) を読むための見えない要素）。
      これが無いと「安全領域を検査したつもり」になる＝値が 0 のままでも緑になってしまう（tests/e2e/iphone.spec.mjs） */
.sai-probe {
  position: fixed; top: 0; left: 0; width: 0; height: 0; pointer-events: none; visibility: hidden;
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px);
}

/* 16. 404 */
.notfound { max-width: 720px; margin: 0 auto; padding: 48px 16px; text-align: center; }
.notfound .code { font-size: 3rem; font-weight: 800; color: var(--sakura); margin: 0; }

/* 17. 画面遷移と軽い動き（transform / opacity だけ・1 回は 1.2 秒以内・曲線の y は 0〜1＝行き過ぎない）
      時間は public/app/motion.js の定数と同じ値（tests/unit/motion-css.test.mjs が突合） */
#app.view-in > * { animation: view-in 180ms var(--ease-out) backwards; }
@keyframes view-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
#app.view-next > :not(.sticky-actions) { animation: view-next 200ms var(--ease-out) backwards; }
#app.view-prev > :not(.sticky-actions) { animation: view-prev 200ms var(--ease-out) backwards; }
@keyframes view-next { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: none; } }
@keyframes view-prev { from { opacity: 0; transform: translateX(-12px); } to { opacity: 1; transform: none; } }

[data-fx="bounce"] { animation: fx-bounce 220ms var(--ease-out) backwards; }
@keyframes fx-bounce {
  0% { transform: scale(1); }
  45% { transform: scale(1.04); }
  100% { transform: scale(1); }
}
[data-fx="shake"] { animation: fx-shake 250ms ease-in-out backwards; }
@keyframes fx-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  50% { transform: translateX(4px); }
  75% { transform: translateX(-2px); }
}
[data-fx="pop"] { animation: fx-pop 260ms var(--ease-out) backwards; }
@keyframes fx-pop {
  0% { transform: translateY(6px) scale(0.96); opacity: 0; }
  70% { transform: translateY(0) scale(1.015); opacity: 1; }
  100% { transform: none; opacity: 1; }
}
.stamp { position: relative; }
.stamp[data-fx="stamp"] { animation: fx-stamp 480ms backwards; }
@keyframes fx-stamp {
  0% { opacity: 0; transform: scale(1.8) rotate(-16deg); animation-timing-function: cubic-bezier(0.5, 0, 0.75, 0); }
  55% { opacity: 1; transform: scale(0.92) rotate(2deg); animation-timing-function: cubic-bezier(0.25, 1, 0.5, 1); }
  100% { opacity: 1; transform: scale(1.05) rotate(0deg); }
}
.stamp[data-fx="stamp"]::after {
  content: ""; position: absolute; inset: -3px; border-radius: 50%; border: 2px solid var(--sakura);
  opacity: 0; pointer-events: none; animation: fx-stamp-ring 700ms ease-out backwards;
}
@keyframes fx-stamp-ring {
  0%, 40% { opacity: 0; transform: scale(1); }
  45% { opacity: 0.7; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.5); }
}
[data-fx="alert"] { animation: fx-alert 600ms ease-in-out backwards; }
@keyframes fx-alert { 0%, 50%, 100% { transform: scale(1); } 25%, 75% { transform: scale(1.1); } }
.pill.is-waiting { opacity: 0; }

/* 押した反応: 全てのタップ対象（リンク・summary・ラジオの行・入力欄も）に transform か opacity で反応を付ける。
   E2E（tests/e2e/screens.spec.mjs）が全画面のタップ対象を探索し、transition に transform/opacity が
   入っていることを実測する＝新しい部品を足したときに反応の付け忘れが赤になる */
:where(a[href]:not(.btn, .quick-start, .task-link, .subj-card, .nav a, .avatar, .brand-link)):active,
summary:active { opacity: 0.72; }
.brand-link, summary, label.radio, .subject-card, .topic-chip,
input[type="date"], input[type="number"], select, textarea {
  transition: transform var(--press-ms) var(--ease-out), opacity var(--press-ms) ease, border-color 0.15s ease;
}
.brand-link:active, label.radio:active { opacity: 0.8; }
a[href]:not(.btn) { transition: transform var(--press-ms) var(--ease-out), opacity var(--press-ms) ease; }

/* 紙吹雪（軌道は :nth-child の CSS だけで固定＝インライン style を使わない） */
.confetti { position: fixed; top: 0; left: 0; right: 0; height: 0; pointer-events: none; z-index: 1000; }
.confetti .piece { position: absolute; width: 8px; height: 8px; border-radius: 2px; animation: confetti-fall 600ms linear forwards; }
.confetti .piece:nth-child(3n) { background: var(--sakura); }
.confetti .piece:nth-child(3n+1) { background: var(--acc); }
.confetti .piece:nth-child(3n+2) { background: #38bdf8; }
.confetti .piece:nth-child(1) { left: 10%; animation-delay: 50ms; }
.confetti .piece:nth-child(2) { left: 20%; animation-delay: 120ms; }
.confetti .piece:nth-child(3) { left: 30%; animation-delay: 20ms; }
.confetti .piece:nth-child(4) { left: 40%; animation-delay: 180ms; }
.confetti .piece:nth-child(5) { left: 50%; animation-delay: 80ms; }
.confetti .piece:nth-child(6) { left: 60%; animation-delay: 150ms; }
.confetti .piece:nth-child(7) { left: 70%; animation-delay: 30ms; }
.confetti .piece:nth-child(8) { left: 80%; animation-delay: 100ms; }
.confetti .piece:nth-child(9) { left: 90%; animation-delay: 160ms; }
.confetti .piece:nth-child(10) { left: 15%; animation-delay: 220ms; }
.confetti .piece:nth-child(11) { left: 25%; animation-delay: 70ms; }
.confetti .piece:nth-child(12) { left: 35%; animation-delay: 250ms; }
.confetti .piece:nth-child(13) { left: 45%; animation-delay: 110ms; }
.confetti .piece:nth-child(14) { left: 55%; animation-delay: 190ms; }
.confetti .piece:nth-child(15) { left: 65%; animation-delay: 40ms; }
.confetti .piece:nth-child(16) { left: 75%; animation-delay: 210ms; }
.confetti .piece:nth-child(17) { left: 85%; animation-delay: 140ms; }
.confetti .piece:nth-child(18) { left: 95%; animation-delay: 90ms; }
.confetti .piece:nth-child(19) { left: 18%; animation-delay: 260ms; }
.confetti .piece:nth-child(20) { left: 38%; animation-delay: 170ms; }
.confetti .piece:nth-child(21) { left: 58%; animation-delay: 230ms; }
.confetti .piece:nth-child(22) { left: 78%; animation-delay: 130ms; }
.confetti .piece:nth-child(23) { left: 88%; animation-delay: 200ms; }
.confetti .piece:nth-child(24) { left: 48%; animation-delay: 60ms; }
@keyframes confetti-fall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(220px) rotate(360deg); opacity: 0; }
}
.confetti.is-local { position: absolute; }
.confetti.is-local .piece { animation-name: confetti-fall-local; }
@keyframes confetti-fall-local {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(150px) rotate(360deg); opacity: 0; }
}

/* 18. 動きを控えめに（設定 data-motion="off" と端末の prefers-reduced-motion の両方で即時・揺れと紙吹雪は出さない） */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0s !important; animation-delay: 0s !important; transition-duration: 0s !important; }
  html { scroll-behavior: auto; }
  .confetti { display: none !important; }
}
:root[data-motion="off"] *, :root[data-motion="off"] *::before, :root[data-motion="off"] *::after {
  animation-duration: 0s !important; animation-delay: 0s !important; transition-duration: 0s !important;
}
:root[data-motion="off"] { scroll-behavior: auto; }
:root[data-motion="off"] .confetti { display: none !important; }

/* 19. 画面の幅（360px の折返し・600px 以上の 2 段） */
@media (max-width: 374px) {
  .subj-grid, .subject-cards { grid-template-columns: 1fr; }
  .goal-preset-n { font-size: 0.82rem; }
}
@media (max-width: 359px) {
  .brand-name { white-space: normal; word-break: keep-all; line-height: 1.2; }
}
@media (min-width: 600px) {
  .subj-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
