/* ============================================================
   障害者手帳サービスナビ ─ スタイル（index.html 専用）
   ------------------------------------------------------------
   ・assets/style_old.css（旧デザイン・index_old.html 用）とは独立。互いに影響しません。
   ・ライト／ダークの両対応。自動・明るい・暗いを手動でも切替可能。
   ・「モダン」を理由に読みやすさを犠牲にしない。
     十分なコントラスト、大きめの行間、44px以上のタップ領域、
     ふりがな、文字サイズ3段階、prefers-reduced-motion を維持する。
   ============================================================ */

/* ---------- トークン ---------- */
:root {
  /* 面と文字 */
  --bg:        #f6f7fb;
  --bg-2:      #eef0f7;
  --surface:   #ffffff;
  --surface-2: #f4f5fa;
  --line:      #e3e6f0;
  --line-2:    #eceef6;
  --text:      #12141f;
  --text-2:    #3d4257;
  --text-mute: #6b7189;
  --text-dim:  #686e84;

  /* ブランド */
  --brand:      #5b53e0;
  --brand-2:    #9333ea;
  --brand-ink:  #4a43c9;
  --brand-soft: #eeecfd;
  --brand-line: #d6d1fa;
  --grad: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);

  /* 判定の色 */
  --ok:      #0f7a52;  --ok-bg:   #e6f6ee;  --ok-line: #a9dfc5;
  --warn:    #9a5b0a;  --warn-bg: #fdf2e2;  --warn-line: #f0cf9c;
  --info:    #1f5f9e;  --info-bg: #e8f1fb;  --info-line: #b8d5f0;
  --off:     #6b7189;  --off-bg:  #f1f2f7;  --off-line: #dcdfe9;

  /* 形 */
  --r-sm: 8px;
  --r:    12px;
  --r-lg: 18px;
  --r-xl: 24px;
  --shadow-s: 0 1px 2px rgba(16, 20, 40, .06), 0 1px 3px rgba(16, 20, 40, .04);
  --shadow:   0 2px 6px rgba(16, 20, 40, .06), 0 8px 24px rgba(16, 20, 40, .06);
  --shadow-l: 0 4px 12px rgba(16, 20, 40, .08), 0 16px 40px rgba(16, 20, 40, .10);

  --side-w: 15rem;
  --fs: 1;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:        #0c0e15;
    --bg-2:      #12141d;
    --surface:   #171a24;
    --surface-2: #1e2230;
    --line:      #2a2f3f;
    --line-2:    #232735;
    --text:      #eaecf5;
    --text-2:    #c3c7d6;
    --text-mute: #9298ad;
    --text-dim:  #8b91a8;

    --brand:      #8b85f5;
    --brand-2:    #c084fc;
    --brand-ink:  #a5a0f8;
    --brand-soft: #1f1d3a;
    --brand-line: #38336b;

    --ok:      #5cd4a0;  --ok-bg:   #10281f;  --ok-line: #2c6b52;
    --warn:    #e8b168;  --warn-bg: #2a2114;  --warn-line: #6b5330;
    --info:    #7db8ec;  --info-bg: #12212f;  --info-line: #2f5madd;
    --info-line: #2f5a80;
    --off:     #9298ad;  --off-bg:  #1c202c;  --off-line: #333949;

    --shadow-s: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow:   0 2px 8px rgba(0, 0, 0, .45);
    --shadow-l: 0 8px 32px rgba(0, 0, 0, .55);
  }
}

:root[data-theme="dark"] {
  --bg:        #0c0e15;
  --bg-2:      #12141d;
  --surface:   #171a24;
  --surface-2: #1e2230;
  --line:      #2a2f3f;
  --line-2:    #232735;
  --text:      #eaecf5;
  --text-2:    #c3c7d6;
  --text-mute: #9298ad;
  --text-dim:  #8b91a8;

  --brand:      #8b85f5;
  --brand-2:    #c084fc;
  --brand-ink:  #a5a0f8;
  --brand-soft: #1f1d3a;
  --brand-line: #38336b;

  --ok:      #5cd4a0;  --ok-bg:   #10281f;  --ok-line: #2c6b52;
  --warn:    #e8b168;  --warn-bg: #2a2114;  --warn-line: #6b5330;
  --info:    #7db8ec;  --info-bg: #12212f;  --info-line: #2f5a80;
  --off:     #9298ad;  --off-bg:  #1c202c;  --off-line: #333949;

  --shadow-s: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow:   0 2px 8px rgba(0, 0, 0, .45);
  --shadow-l: 0 8px 32px rgba(0, 0, 0, .55);
}

/* ---------- ベース ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { font-size: calc(16px * var(--fs)); }
html[data-fs="lg"] { --fs: 1.13; }
html[data-fs="xl"] { --fs: 1.3; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Noto Sans JP', system-ui, -apple-system, 'Hiragino Sans', Meiryo, sans-serif;
  font-feature-settings: "palt";
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

button, input, select { font-family: inherit; }
a { color: var(--brand-ink); text-underline-offset: .2em; }

rt { font-weight: 400; color: var(--text-dim); font-size: .55em; }
html[data-furigana="off"] rt { display: none; }

:focus-visible { outline: 2.5px solid var(--brand); outline-offset: 2px; border-radius: 6px; }

.skip { position: absolute; left: -9999px; background: var(--surface); padding: .75rem 1rem; z-index: 60; }
.skip:focus { left: 1rem; top: 1rem; }

/* ---------- レイアウト ---------- */
.shell { display: flex; min-height: 100dvh; }

.col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.main {
  flex: 1; width: 100%; max-width: 60rem;
  margin: 0 auto; padding: 1.75rem 1.5rem 6rem;
}

/* ---------- サイドバー ---------- */
.side {
  width: var(--side-w); flex: none;
  position: sticky; top: 0; height: 100dvh;
  display: flex; flex-direction: column; gap: 1.25rem;
  padding: 1.25rem 1rem;
  background: var(--surface);
  border-right: 1px solid var(--line);
  overflow-y: auto;
}

.brand {
  display: flex; align-items: center; gap: .7rem;
  background: none; border: none; padding: .4rem; margin: -.4rem;
  cursor: pointer; color: inherit; text-align: left;
  border-radius: var(--r);
}
.brand:hover { background: var(--surface-2); }
.brand-mark {
  width: 2.4rem; height: 2.4rem; flex: none;
  border-radius: .7rem; background: var(--grad);
  display: grid; place-items: center;
  box-shadow: var(--shadow-s);
}
.brand-mark svg { width: 1.55rem; height: 1.55rem; }
.mark-badge { fill: #7c3aed; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font-size: .95rem; font-weight: 900; line-height: 1.35; letter-spacing: -.01em; }
.brand-sub { font-size: .68rem; color: var(--text-dim); font-weight: 500; }

.nav { display: flex; flex-direction: column; gap: .2rem; }
.nav-item {
  display: flex; align-items: center; gap: .7rem;
  padding: .7rem .8rem; min-height: 2.9rem;
  border: none; background: none; border-radius: var(--r);
  color: var(--text-2); font-size: .92rem; font-weight: 700;
  cursor: pointer; text-align: left; position: relative;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.is-active { background: var(--brand-soft); color: var(--brand-ink); }
.nav-ico { font-size: 1rem; width: 1.2rem; text-align: center; opacity: .85; }
.nav-label { flex: 1; }
.nav-badge, .bt-badge {
  min-width: 1.35rem; height: 1.35rem; padding: 0 .35rem;
  display: grid; place-items: center;
  background: var(--brand); color: #fff;
  border-radius: 999px; font-size: .7rem; font-weight: 700;
}

.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: .8rem; }
.pref-row { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.pref-col { flex-direction: column; align-items: stretch; gap: .35rem; }
.pref-label { font-size: .75rem; font-weight: 700; color: var(--text-mute); }

/* トグルスイッチ */
.switch {
  width: 2.9rem; height: 1.7rem; flex: none;
  border-radius: 999px; border: none; cursor: pointer;
  background: var(--off-line); position: relative; padding: 0;
  transition: background .15s;
}
.switch[aria-pressed="true"] { background: var(--brand); }
.switch-knob {
  position: absolute; top: .2rem; left: .2rem;
  width: 1.3rem; height: 1.3rem; border-radius: 50%;
  background: #fff; box-shadow: var(--shadow-s);
  transition: transform .15s;
}
.switch[aria-pressed="true"] .switch-knob { transform: translateX(1.2rem); }

/* セグメント */
.seg {
  display: flex; gap: .15rem; padding: .2rem;
  background: var(--surface-2); border-radius: var(--r);
}
.seg-btn {
  flex: 1; min-height: 2.2rem; padding: .35rem .5rem;
  border: none; background: none; border-radius: calc(var(--r) - .2rem);
  color: var(--text-mute); font-size: .78rem; font-weight: 700; cursor: pointer;
  white-space: nowrap;
}
.seg-btn:hover { color: var(--text); }
.seg-btn[aria-pressed="true"] {
  background: var(--surface); color: var(--brand-ink); box-shadow: var(--shadow-s);
}

.ghost-btn {
  min-height: 2.6rem; padding: .5rem .9rem;
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface); color: var(--text-2);
  font-size: .82rem; font-weight: 700; cursor: pointer;
}
.ghost-btn:hover { background: var(--surface-2); border-color: var(--brand-line); }

.checked-at { font-size: .68rem; color: var(--text-dim); margin: 0; text-align: center; }

/* ---------- トップバー（狭い画面用）---------- */
.topbar {
  display: none;
  position: sticky; top: 0; z-index: 30;
  align-items: center; gap: .6rem;
  padding: .7rem 1rem;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}
/* 狭い画面のタイトル。プロフィールが長いときも縦積みに潰れないよう、
   ロゴだけを残してタイトル文字は隠す */
.brand-sm { flex: 0 0 auto; min-width: 0; gap: .5rem; }
.brand-name-sm {
  font-size: .88rem; font-weight: 900; letter-spacing: -.02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
@media (max-width: 32rem) {
  .brand-name-sm { display: none; }
}
.topbar .chip-profile { flex: 1; min-width: 0; justify-content: center; }
.icon-btn {
  width: 2.6rem; height: 2.6rem; flex: none;
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface); color: var(--text-2);
  font-size: .85rem; font-weight: 800; cursor: pointer;
}
.icon-btn[aria-expanded="true"] { background: var(--brand-soft); color: var(--brand-ink); border-color: var(--brand-line); }

.sheet {
  display: none; flex-direction: column; gap: .8rem;
  padding: 1rem; margin: 0 1rem;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow);
}

.chip-profile {
  display: inline-flex; align-items: center; gap: .45rem;
  max-width: 100%; padding: .45rem .75rem;
  background: var(--brand-soft); border: 1px solid var(--brand-line);
  border-radius: 999px; color: var(--brand-ink);
  font-size: .78rem; font-weight: 700; cursor: pointer;
}
.chip-profile > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-edit { font-weight: 500; opacity: .75; flex: none; }

/* ---------- ボトムナビ ---------- */
.bottom {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.bt {
  flex: 1; min-height: 3.4rem; padding: .4rem .2rem;
  display: flex; flex-direction: column; align-items: center; gap: .1rem;
  border: none; background: none; cursor: pointer; position: relative;
  color: var(--text-mute); font-size: .66rem; font-weight: 700;
}
.bt span[aria-hidden] { font-size: 1.05rem; line-height: 1.2; }
.bt.is-active { color: var(--brand-ink); }
.bt-badge { position: absolute; top: .25rem; right: 22%; height: 1.1rem; min-width: 1.1rem; font-size: .62rem; }

/* ---------- 見出し・共通 ---------- */
.h1 { font-size: 1.5rem; font-weight: 900; letter-spacing: -.02em; margin: 0 0 .35rem; line-height: 1.4; }
.h2 { font-size: 1.12rem; font-weight: 800; letter-spacing: -.01em; margin: 0; }
.lead { font-size: .88rem; color: var(--text-mute); margin: 0 0 1.5rem; }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-s);
}

/* ---------- ヒーロー ---------- */
.hero {
  position: relative; overflow: hidden;
  border-radius: var(--r-xl); padding: 1.75rem;
  background: var(--grad); color: #fff;
  box-shadow: var(--shadow-l);
  margin-bottom: 1.5rem;
}
.hero::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(80% 120% at 100% 0%, rgba(255,255,255,.22), transparent 60%);
  pointer-events: none;
}
.hero-title { font-size: 1.3rem; font-weight: 900; letter-spacing: -.02em; margin: 0 0 .4rem; }
.hero-sub { font-size: .86rem; opacity: .92; margin: 0 0 1.1rem; line-height: 1.7; }
.hero-btn {
  position: relative; z-index: 1;
  min-height: 3rem; padding: .8rem 1.6rem;
  border: none; border-radius: 999px;
  background: #fff; color: var(--brand-ink);
  font-size: .95rem; font-weight: 800; cursor: pointer;
  box-shadow: var(--shadow);
}
.hero-btn:hover { transform: translateY(-1px); }

/* ---------- 進捗 ---------- */
.steps { display: flex; gap: .35rem; margin: 0 0 1.5rem; }
.steps i { flex: 1; height: .3rem; border-radius: 999px; background: var(--line); }
.steps i.on { background: var(--grad); }

/* ---------- 選択カード ---------- */
.pick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(13.5rem, 1fr)); gap: .8rem; }
.pick {
  text-align: left; padding: 1.15rem;
  background: var(--surface); border: 1.5px solid var(--line);
  border-radius: var(--r-lg); cursor: pointer; color: inherit;
  box-shadow: var(--shadow-s);
}
.pick:hover { border-color: var(--brand); box-shadow: var(--shadow); transform: translateY(-2px); }
.pick-name { font-size: .98rem; font-weight: 800; letter-spacing: -.01em; }
.pick-yomi { font-size: .68rem; color: var(--text-dim); margin-top: .1rem; }
html[data-furigana="off"] .pick-yomi { display: none; }
.pick-lead { font-size: .8rem; color: var(--text-mute); margin-top: .55rem; line-height: 1.65; }

.rows { display: flex; flex-direction: column; gap: .5rem; }
.row-btn {
  display: flex; align-items: center; gap: .9rem;
  padding: .9rem 1.1rem; min-height: 3.2rem;
  background: var(--surface); border: 1.5px solid var(--line);
  border-radius: var(--r); cursor: pointer; color: inherit; text-align: left;
}
.row-btn:hover { border-color: var(--brand); background: var(--brand-soft); }
.row-key { font-size: 1rem; font-weight: 900; color: var(--brand-ink); min-width: 3.2rem; }
.row-sub { font-size: .82rem; color: var(--text-mute); flex: 1; }
.row-tag {
  font-size: .68rem; font-weight: 800; padding: .15rem .5rem;
  border-radius: 999px; background: var(--ok-bg); color: var(--ok);
  border: 1px solid var(--ok-line); white-space: nowrap;
}

/* 手帳の一覧 */
.cert-box {
  padding: 1rem 1.15rem; margin-bottom: 1.5rem;
  background: var(--brand-soft); border: 1px solid var(--brand-line);
  border-radius: var(--r-lg);
}
.cert-box-t { font-size: .74rem; font-weight: 800; color: var(--brand-ink); margin-bottom: .55rem; }
.cert-item {
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
  padding: .55rem 0; border-top: 1px solid var(--brand-line);
}
.cert-item:first-of-type { border-top: none; }
.cert-name { flex: 1; min-width: 9rem; font-size: .92rem; font-weight: 700; }
.mini-btn {
  min-height: 2.2rem; padding: .35rem .7rem;
  border-radius: var(--r-sm); border: 1px solid var(--line);
  background: var(--surface); color: var(--text-2);
  font-size: .74rem; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.mini-btn:hover { border-color: var(--brand); color: var(--brand-ink); }
.mini-btn.danger { color: #b4405f; border-color: #f0d3dc; }
.mini-btn.danger:hover { background: #fdeff3; }
/* 「自動」でOSがライトのときにダーク用の色が当たらないよう、
   メディアクエリの中に入れる（外に置くと data-theme 無指定＝自動で常時適用される） */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .mini-btn.danger { border-color: #4d2534; color: #f0899f; }
  :root:not([data-theme="light"]) .mini-btn.danger:hover { background: #33202a; }
}
:root[data-theme="dark"] .mini-btn.danger { border-color: #4d2534; color: #f0899f; }
:root[data-theme="dark"] .mini-btn.danger:hover { background: #33202a; }

.link-btn {
  background: none; border: none; color: var(--text-mute);
  font-size: .82rem; cursor: pointer; padding: .6rem .2rem; margin-top: .9rem;
  text-decoration: underline; text-underline-offset: .2em;
}
.link-btn:hover { color: var(--brand-ink); }

.primary {
  min-height: 3rem; padding: .8rem 1.6rem; margin-top: 1.25rem;
  border: none; border-radius: 999px; background: var(--grad); color: #fff;
  font-size: .95rem; font-weight: 800; cursor: pointer; box-shadow: var(--shadow);
}
.primary:hover { transform: translateY(-1px); box-shadow: var(--shadow-l); }

/* 目立たせたい代替導線 */
.alt-card {
  display: flex; flex-direction: column; gap: .2rem;
  width: 100%; margin-top: 1.25rem; padding: .95rem 1.15rem;
  background: var(--warn-bg); border: 1.5px solid var(--warn-line);
  border-radius: var(--r-lg); color: var(--warn);
  text-align: left; cursor: pointer;
}
.alt-card:hover { filter: brightness(.98); }
.alt-t { font-size: .88rem; font-weight: 800; }
.alt-s { font-size: .76rem; opacity: .9; line-height: 1.6; }

/* ---------- 自治体えらび ---------- */
.field {
  width: 100%; padding: .8rem 1rem; min-height: 3rem;
  background: var(--surface); border: 1.5px solid var(--line);
  border-radius: var(--r); color: var(--text); font-size: .92rem;
}
.field:focus { border-color: var(--brand); }
.hint { font-size: .76rem; color: var(--text-dim); margin: .6rem 0 1rem; line-height: 1.7; }

.kana-jump { display: flex; gap: .25rem; flex-wrap: wrap; margin-bottom: 1rem; }
.kana-jump a {
  min-width: 2.2rem; min-height: 2.2rem; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text-2);
  font-size: .8rem; font-weight: 700; text-decoration: none;
}
.kana-jump a:hover { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-ink); }

.muni-group { margin-bottom: 1.1rem; scroll-margin-top: 5rem; }
.muni-head {
  display: inline-grid; place-items: center;
  width: 1.8rem; height: 1.8rem; margin-bottom: .5rem;
  background: var(--brand-soft); color: var(--brand-ink);
  border-radius: var(--r-sm); font-size: .85rem; font-weight: 900;
}
.muni-grid { display: grid; gap: .45rem; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); }
.muni {
  display: flex; flex-direction: column; gap: .1rem;
  padding: .6rem .7rem; min-height: 3rem; text-align: left;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); cursor: pointer; color: inherit;
}
.muni:hover { border-color: var(--brand); box-shadow: var(--shadow-s); }
.muni.on { border-color: var(--ok-line); background: var(--ok-bg); }
.muni-n { font-size: .86rem; font-weight: 700; line-height: 1.3; }
.muni-y { font-size: .64rem; color: var(--text-dim); }
html[data-furigana="off"] .muni-y { display: none; }
.muni-tag {
  align-self: flex-start; margin-top: .1rem;
  font-size: .62rem; font-weight: 800; padding: .04rem .35rem;
  border-radius: 999px; background: var(--ok); color: #fff;
}

/* ---------- 結果まとめ ---------- */
.done { text-align: center; padding: 2.25rem 1.5rem; }
.done-mark {
  width: 3.6rem; height: 3.6rem; margin: 0 auto 1rem;
  border-radius: 50%; background: var(--ok-bg); color: var(--ok);
  display: grid; place-items: center; font-size: 1.6rem; font-weight: 900;
  border: 2px solid var(--ok-line);
}
.done-label { font-size: 1.05rem; font-weight: 800; letter-spacing: -.01em; margin: 0; }
.done-label[tabindex="-1"]:focus { outline: none; }
.stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; margin: 1.25rem 0 1.5rem; }
.stat { padding: 1rem .8rem; border-radius: var(--r-lg); background: var(--surface-2); }
.stat-n { font-size: 1.75rem; font-weight: 900; line-height: 1.2; letter-spacing: -.03em; }
.stat-n.ok { color: var(--ok); }
.stat-n.warn { color: var(--warn); }
.stat-l { font-size: .72rem; color: var(--text-mute); font-weight: 700; }

/* ---------- 検索・絞り込み ---------- */
.toolbar { display: flex; gap: .6rem; flex-wrap: wrap; margin-bottom: .8rem; }
.search-wrap { flex: 1; min-width: 12rem; position: relative; }
.chips { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.chip {
  padding: .45rem .85rem; min-height: 2.4rem;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--text-2);
  font-size: .78rem; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.chip:hover { border-color: var(--brand-line); background: var(--brand-soft); }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip-check { display: inline-flex; align-items: center; gap: .4rem; }
.chip-box {
  width: 1rem; height: 1rem; border-radius: 4px;
  border: 1.5px solid var(--off-line); display: grid; place-items: center;
  font-size: .68rem; color: transparent;
}
.chip.on .chip-box { background: #fff; border-color: #fff; color: var(--brand); }

.count { font-size: .78rem; color: var(--text-mute); margin-bottom: .7rem; }

/* ---------- 収録状況バナー ---------- */
.notice {
  padding: .85rem 1.05rem; margin-bottom: 1.25rem;
  border-radius: var(--r-lg); font-size: .82rem; line-height: 1.7;
  border: 1px solid var(--warn-line); background: var(--warn-bg); color: var(--warn);
}
.notice.ok { border-color: var(--ok-line); background: var(--ok-bg); color: var(--ok); }
.notice b { display: block; font-weight: 800; margin-bottom: .1rem; }
.notice a { color: inherit; }

/* ---------- くわしく答える ---------- */
.panel { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); margin-bottom: 1.25rem; overflow: hidden; }
.panel > summary {
  padding: .9rem 1.1rem; cursor: pointer; list-style: none;
  font-size: .86rem; font-weight: 800; color: var(--brand-ink);
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
}
.panel > summary::-webkit-details-marker { display: none; }
.panel > summary::after { content: '⌄'; font-size: 1rem; transition: transform .15s; }
.panel[open] > summary::after { transform: rotate(180deg); }
.panel[open] > summary { border-bottom: 1px solid var(--line-2); }
.panel-body { padding: 1.1rem; }

.who {
  padding: .8rem 1rem; margin-bottom: 1.25rem;
  border-radius: var(--r); font-size: .8rem; line-height: 1.7;
  background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn);
}
.who b { display: block; font-weight: 800; }

.q { margin-bottom: 1.25rem; }
.q:last-child { margin-bottom: 0; }
.q-l { display: block; font-size: .86rem; font-weight: 700; margin-bottom: .45rem; }
.q-help {
  background: var(--info-bg); color: var(--info); border: 1px solid var(--info-line);
  border-radius: var(--r); padding: .65rem .8rem; margin-bottom: .55rem;
  font-size: .78rem; line-height: 1.75;
}
.q-help p { margin: 0 0 .25rem; }
.q-help p:last-child { margin: 0; }
.q-n { font-size: .74rem; color: var(--text-dim); margin: .4rem 0 0; line-height: 1.65; }
.opts { display: flex; gap: .4rem; flex-wrap: wrap; }
.opt {
  padding: .45rem .85rem; min-height: 2.4rem;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--text-2);
  font-size: .78rem; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.opt:hover { border-color: var(--brand-line); }
.opt.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-ink); }
.age-in { width: 6.5rem; padding: .55rem .7rem; border: 1.5px solid var(--line); border-radius: var(--r-sm); background: var(--surface); color: var(--text); font-size: .9rem; }

/* ---------- グループ見出し ---------- */
.grp { display: flex; align-items: center; gap: .55rem; margin: 1.75rem 0 .3rem; }
.grp:first-child { margin-top: 0; }
.grp-t { font-size: 1rem; font-weight: 800; letter-spacing: -.01em; }
.grp-n {
  font-size: .7rem; font-weight: 800; padding: .1rem .5rem;
  border-radius: 999px; background: var(--surface-2); color: var(--text-mute);
}
.grp-lead { font-size: .78rem; color: var(--text-mute); margin: 0 0 .9rem; line-height: 1.7; }

/* ---------- サービスカード ---------- */
.list { display: flex; flex-direction: column; gap: .55rem; }
.svc {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-s);
  scroll-margin-top: 5rem;
  border-left: 3px solid var(--line);
}
.svc:hover { box-shadow: var(--shadow); }
.svc.v-eligible    { border-left-color: var(--ok); }
.svc.v-needs_check { border-left-color: var(--warn); }
.svc.v-near_miss   { border-left-color: var(--warn); }
.svc.v-ineligible  { border-left-color: var(--off-line); }
.svc.v-entry       { border-left-color: var(--brand); }
.svc.hl { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }

.svc-head { display: flex; align-items: center; }
.svc-toggle {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: .7rem;
  padding: .95rem .6rem .95rem 1rem;
  border: none; background: none; cursor: pointer; color: inherit; text-align: left;
}
.svc-toggle:hover { background: var(--surface-2); }
.tag {
  font-size: .66rem; font-weight: 800; padding: .18rem .5rem;
  border-radius: 999px; white-space: nowrap; flex: none; border: 1px solid transparent;
}
.svc-body-main { flex: 1; min-width: 0; }
.svc-name { font-size: .92rem; font-weight: 700; line-height: 1.45; letter-spacing: -.01em; }
.svc-yomi { font-size: .66rem; color: var(--text-dim); margin-top: .05rem; }
html[data-furigana="off"] .svc-yomi { display: none; }

.st { font-size: .7rem; font-weight: 800; padding: .22rem .55rem; border-radius: 999px; white-space: nowrap; flex: none; }
.st-eligible    { background: var(--ok-bg);    color: var(--ok);    border: 1px solid var(--ok-line); }
.st-needs_check { background: var(--warn-bg);  color: var(--warn);  border: 1px solid var(--warn-line); }
.st-near_miss   { background: var(--warn-bg);  color: var(--warn);  border: 1px solid var(--warn-line); }
.st-ineligible  { background: var(--off-bg);   color: var(--off);   border: 1px solid var(--off-line); }
.st-entry       { background: var(--brand-soft); color: var(--brand-ink); border: 1px solid var(--brand-line); }
.st-unknown     { background: var(--surface-2); color: var(--text-mute); border: 1px solid var(--line); }

.star {
  border: none; background: none; cursor: pointer; flex: none;
  font-size: 1.15rem; padding: .5rem .8rem .5rem .3rem; line-height: 1; color: var(--text-dim);
}
.star.on { color: #f0a824; }
.chev { color: var(--text-dim); font-size: .75rem; flex: none; }

.svc-open {
  border-top: 1px solid var(--line-2); background: var(--surface-2);
  padding: 1.1rem; display: flex; flex-direction: column; gap: .75rem;
}
.svc-desc { font-size: .86rem; line-height: 1.85; color: var(--text-2); }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: .55rem; }
.fact { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: .7rem .85rem; }
.fact-l { font-size: .66rem; font-weight: 800; color: var(--text-dim); margin-bottom: .2rem; letter-spacing: .02em; }
.fact-v { font-size: .82rem; line-height: 1.7; }

.box { border-radius: var(--r); padding: .7rem .85rem; font-size: .8rem; line-height: 1.75; border: 1px solid transparent; }
.box b { font-weight: 800; }
.box ul { margin: .3rem 0 0; padding-left: 1.15rem; }
.box li { margin-bottom: .2rem; }
.box-info { background: var(--info-bg); color: var(--info); border-color: var(--info-line); }
.box-warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-line); }
.box-off  { background: var(--off-bg);  color: var(--off);  border-color: var(--off-line); }

.src { font-size: .72rem; color: var(--text-dim); line-height: 1.75; }
.src b { display: block; font-weight: 800; margin-bottom: .15rem; }
.src ul { margin: 0; padding-left: 1.15rem; }
.src li { word-break: break-word; }

.empty {
  text-align: center; padding: 3rem 1.25rem;
  color: var(--text-dim); font-size: .85rem; line-height: 1.9;
}
.foot { margin-top: 1.75rem; font-size: .72rem; color: var(--text-dim); line-height: 1.85; }

/* ---------- 等級くらべ ---------- */
.legend { font-size: .78rem; color: var(--text-mute); margin-bottom: 1rem; }
.tablewrap {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); overflow-x: auto; box-shadow: var(--shadow-s);
}
.tbl { min-width: 36rem; }
.trow { display: grid; border-bottom: 1px solid var(--line-2); }
.trow:last-child { border-bottom: none; }
.trow.head { background: var(--surface-2); position: sticky; top: 0; }
.tname {
  display: flex; align-items: center; gap: .5rem;
  padding: .65rem .9rem; font-size: .8rem; font-weight: 700;
  width: 100%; border: none; background: none; color: inherit; text-align: left; cursor: pointer;
}
.tname:hover { background: var(--brand-soft); color: var(--brand-ink); }
.trow.head .tname { font-size: .72rem; font-weight: 800; color: var(--text-mute); cursor: default; }
.trow.head .tname:hover { background: none; color: var(--text-mute); }
.tdot { width: .45rem; height: .45rem; border-radius: 2px; flex: none; }
.tname-t { flex: 1; min-width: 0; }
.tcell { padding: .65rem .4rem; text-align: center; font-size: .9rem; font-weight: 800; }
.trow.head .tcell { font-size: .74rem; color: var(--brand-ink); }
.m-yes { color: var(--ok); }
.m-may { color: var(--warn); }
.m-no  { color: var(--off-line); }

/* ---------- 地域くらべ ---------- */
.sum {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 1rem 1.15rem; margin-bottom: 1.25rem;
  box-shadow: var(--shadow-s);
}
.sum-t { font-size: .76rem; font-weight: 800; color: var(--text-mute); margin-bottom: .7rem; }
.sum-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.sum-cell { background: var(--surface-2); border-radius: var(--r); padding: .65rem .7rem; }
.sum-l { font-size: .68rem; color: var(--text-mute); font-weight: 700; }
.sum-v { font-size: 1.02rem; font-weight: 900; color: var(--brand-ink); letter-spacing: -.02em; }
.sum-note { font-size: .8rem; color: var(--text-2); margin: .75rem 0 0; line-height: 1.75; }

.bars { display: flex; flex-direction: column; gap: .3rem; margin-bottom: 1.25rem; }
.bar {
  display: flex; align-items: center; gap: .7rem;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: .55rem .85rem;
}
.bar.mine { border-color: var(--brand); background: var(--brand-soft); border-width: 1.5px; }
.bar-rank { min-width: 1.6rem; text-align: right; font-size: .76rem; font-weight: 800; color: var(--text-dim); flex: none; }
.bar.mine .bar-rank { color: var(--brand-ink); }
.bar-mid { flex: 1; min-width: 0; }
.bar-n { font-size: .82rem; font-weight: 700; display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; }
.bar-me { font-size: .62rem; font-weight: 800; padding: .04rem .4rem; border-radius: 999px; background: var(--brand); color: #fff; }
.bar-track { height: .35rem; background: var(--surface-2); border-radius: 999px; margin-top: .3rem; overflow: hidden; }
.bar-fill { height: 100%; background: var(--grad); border-radius: 999px; }
.bar-v { flex: none; min-width: 5rem; text-align: right; font-size: .88rem; font-weight: 900; letter-spacing: -.02em; }

/* ---------- マイリスト ---------- */
.prog {
  display: flex; align-items: center; gap: .85rem;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: .85rem 1.05rem; margin-bottom: .85rem;
}
.prog-track { flex: 1; height: .5rem; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.prog-fill { height: 100%; background: var(--ok); border-radius: 999px; }
.prog-t { font-size: .8rem; font-weight: 800; color: var(--ok); white-space: nowrap; }

.fav {
  display: flex; align-items: center; gap: .8rem;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: .8rem 1rem;
}
.check {
  width: 1.6rem; height: 1.6rem; flex: none;
  border-radius: .45rem; border: 1.5px solid var(--off-line);
  background: var(--surface); color: #fff;
  font-size: .85rem; font-weight: 800; cursor: pointer; display: grid; place-items: center;
}
.check.on { background: var(--ok); border-color: var(--ok); }
.fav-mid { flex: 1; min-width: 0; }
.fav-n { font-size: .86rem; font-weight: 700; }
.fav.done .fav-n { text-decoration: line-through; color: var(--text-dim); }
.fav-w { font-size: .72rem; color: var(--text-dim); margin-top: .1rem; }
.x-btn { border: none; background: none; color: var(--text-dim); font-size: .8rem; cursor: pointer; padding: .4rem; }

/* ---------- 上にもどる ---------- */
.to-top {
  position: fixed; right: 1.1rem; bottom: 1.1rem; z-index: 45;
  width: 3rem; height: 3rem; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface); color: var(--text-2);
  font-size: 1.1rem; font-weight: 800; cursor: pointer; box-shadow: var(--shadow);
}
.to-top:hover { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ---------- レスポンシブ ---------- */
@media (max-width: 60rem) {
  .side { display: none; }
  .topbar { display: flex; }
  .sheet { display: flex; }
  .bottom { display: flex; }
  .main { padding: 1.25rem 1rem 6.5rem; }
  .to-top { bottom: 4.9rem; }
  .stat-row { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 30rem) {
  .sum-grid { grid-template-columns: 1fr; }
  .hero { padding: 1.35rem; }
}

/* ---------- モーション ---------- */
.pick, .primary, .hero-btn, .svc, .switch, .switch-knob { transition: transform .15s, box-shadow .15s, background .15s, border-color .15s; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .pick:hover, .primary:hover, .hero-btn:hover { transform: none; }
}

/* ---------- 印刷 ---------- */
@media print {
  .side, .topbar, .sheet, .bottom, .to-top, .toolbar, .chips, .panel, .star, .chev, .hero { display: none !important; }
  body { background: #fff; color: #000; }
  .main { padding: 0; max-width: none; }
  .svc { break-inside: avoid; box-shadow: none; border-color: #999; }
  .svc-open { display: flex !important; background: #fff; }
  .src a::after { content: " (" attr(href) ")"; word-break: break-all; }
}

/* 手帳を選ばずに進む選択肢（持っていない／わからない）を縦に並べる */
.alt-picks { display: flex; flex-direction: column; align-items: flex-start; gap: .1rem; margin-top: .4rem; }
.alt-picks .link-btn { margin-top: 0; }

/* 年齢入力のエラー表示 */
.age-err { color: #b4405f; font-size: .78rem; font-weight: 700; margin: .4rem 0 0; }
:root[data-theme="dark"] .age-err { color: #f0899f; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .age-err { color: #f0899f; }
}
/* 見出しへプログラム的にフォーカスしたとき、枠を出さない（読み上げ位置の移動が目的） */
h1[tabindex="-1"]:focus { outline: none; }

/* 目には見えないが読み上げには届く見出し。
   「探す」画面は視覚的な見出しを持たないため、構造上の見出しをここで補う。 */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}
.sr-only:focus { outline: none; }
