/* 約物（、。「」など）を半角幅にするフォント。YakuHanJP（SIL OFL 1.1）をサイト内に置いている */
@font-face { font-family: "YakuHanJP"; src: url("assets/fonts/YakuHanJP-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; unicode-range: U+3001-3002, U+3008-3011, U+3014-3015, U+30FB, U+FF01, U+FF08-FF09, U+FF1A-FF1B, U+FF1F, U+FF3B, U+FF3D, U+FF5B, U+FF5D; }
@font-face { font-family: "YakuHanJP"; src: url("assets/fonts/YakuHanJP-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; unicode-range: U+3001-3002, U+3008-3011, U+3014-3015, U+30FB, U+FF01, U+FF08-FF09, U+FF1A-FF1B, U+FF1F, U+FF3B, U+FF3D, U+FF5B, U+FF5D; }
@font-face { font-family: "Kinto Sans"; src: url("assets/fonts/KintoSans-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Kinto Sans"; src: url("assets/fonts/KintoSans-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --bg: #ffffff;
  --ink: #1b1b1b;
  --sub: #6d6d6d;
  --line: #e6e6e6;
  --font: "YakuHanJP", "Kinto Sans", "Hiragino Sans", "Noto Sans JP", sans-serif;
}

/* --- タイプ色ここから（scripts/gen-type-css.mjs が書く。手で直さない） --- */
.t-normal { --c: #9E9E9E; --fg: #1b1b1b; }
.tw-normal { color: #6d6d6d; }
.t-fire { --c: #F08030; --fg: #1b1b1b; }
.tw-fire { color: #a65821; }
.t-water { --c: #6890F0; --fg: #ffffff; }
.tw-water { color: #4c6ab0; }
.t-electric { --c: #FFE629; --fg: #1b1b1b; }
.tw-electric { color: #796d14; }
.t-grass { --c: #78C850; --fg: #1b1b1b; }
.tw-grass { color: #45732e; }
.t-ice { --c: #98D8D8; --fg: #1b1b1b; }
.tw-ice { color: #4d6d6d; }
.t-fighting { --c: #C03028; --fg: #ffffff; }
.tw-fighting { color: #c03028; }
.t-poison { --c: #A040A0; --fg: #ffffff; }
.tw-poison { color: #a040a0; }
.t-ground { --c: #C8914A; --fg: #1b1b1b; }
.tw-ground { color: #8a6433; }
.t-flying { --c: #1EC8F0; --fg: #1b1b1b; }
.tw-flying { color: #11738a; }
.t-psychic { --c: #F85888; --fg: #ffffff; }
.tw-psychic { color: #b64164; }
.t-bug { --c: #A8B820; --fg: #1b1b1b; }
.tw-bug { color: #667014; }
.t-rock { --c: #C0A530; --fg: #1b1b1b; }
.tw-rock { color: #7d6b1f; }
.t-ghost { --c: #705898; --fg: #ffffff; }
.tw-ghost { color: #705898; }
.t-dragon { --c: #7038F8; --fg: #ffffff; }
.tw-dragon { color: #7038f8; }
.t-dark { --c: #2E2E2E; --fg: #ffffff; }
.tw-dark { color: #2e2e2e; }
.t-steel { --c: #AFAFD9; --fg: #1b1b1b; }
.tw-steel { color: #6b6b84; }
.t-fairy { --c: #FFA6D5; --fg: #1b1b1b; }
.tw-fairy { color: #895973; }
/* --- タイプ色ここまで --- */

* { box-sizing: border-box; }
html { overflow-x: clip; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); line-height: 1.7; -webkit-font-smoothing: antialiased; }

.site-header { max-width: 1200px; margin: 0 auto; padding: 32px 16px 8px; }
.eyebrow { margin: 0; font-size: 11px; letter-spacing: .18em; color: var(--sub); font-weight: 700; }
h1 { margin: 4px 0 8px; font-size: clamp(26px, 6vw, 36px); line-height: 1.3; }
.lead { margin: 0; color: var(--sub); font-size: 13px; }


.nw { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* 検索窓 */
.search { position: relative; z-index: 20; max-width: 480px; margin-top: 16px; }
.search-icon { position: absolute; left: 14px; top: 50%; width: 18px; height: 18px; margin-top: -9px; color: var(--sub); pointer-events: none; }
.search input { width: 100%; height: 48px; padding: 0 14px 0 42px; font: inherit; font-size: 16px; color: var(--ink); background: #fff; border: 2px solid var(--line); border-radius: 12px; outline: none; transition: border-color .15s; -webkit-appearance: none; appearance: none; }
.search input::placeholder { color: #9a9a9a; }
.search input:focus { border-color: var(--ink); }
/* ブラウザ標準の消去ボタン（青い×）を、文字色の×にする */
.search input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; width: 18px; height: 18px; cursor: pointer; background: center / 18px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236d6d6d' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M18 6 6 18M6 6l12 12'/%3E%3C/svg%3E"); }
.search [role=listbox] { position: absolute; left: 0; right: 0; top: calc(100% + 6px); margin: 0; padding: 6px; list-style: none; background: #fff; border: 2px solid var(--ink); border-radius: 12px; box-shadow: 0 3px 10px -4px rgb(0 0 0 / .2); max-height: min(60vh, 440px); overflow-y: auto; }
.search [role=listbox] li + li { border-top: 1px solid var(--line); }
.search [role=listbox] a { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px; color: var(--ink); text-decoration: none; border-radius: 8px; transition: background-color .15s; }
.search [role=listbox] a:hover, .search [aria-selected=true] a { background: #f0f0f0; }
.sg-name { font-weight: 700; font-size: 15px; min-width: 0; }
/* タイプは2列の固定幅。1つだけのときは右の列に置き、アイコンの左端をそろえる（一番長い「フェアリー」で88px） */
.sg-types { display: grid; grid-template-columns: repeat(2, 90px); gap: 8px; flex-shrink: 0; }
.sg-types .ttag:only-child { grid-column: 2; }
.sg-empty { padding: 10px; color: var(--sub); font-size: 14px; }

/* タイプの丸＋名前（押せない表示） */
.ttag { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.ttag .disc { width: 22px; height: 22px; border-width: 2px; }
.ttag .disc svg { width: 12px; height: 12px; }

main { max-width: 1200px; margin: 0 auto; padding: 16px 16px 48px; }

/* 一覧グリッド：スマホ2列 → 3列 → 4列 → 6列 */
.grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 600px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; } }
@media (min-width: 900px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1180px) { .grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } }

.card {
  width: 100%; height: 100%; padding: 10px 4px 12px; display: flex; flex-direction: column; align-items: center; gap: 8px;
  font: inherit; color: var(--ink); background: color-mix(in srgb, var(--c) 12%, #fff); border: 2px solid color-mix(in srgb, var(--c) 28%, #fff); border-radius: 14px; cursor: pointer;
  transition: border-color .15s;
}
.card:hover { border-color: var(--c); }
.card:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.card-title { display: flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 700; }
.card-title svg { width: 16px; height: 16px; color: var(--c); }

/* 図（共通） */
.dg { position: relative; width: 100%; display: flex; flex-direction: column; align-items: center; }
.dg .arrows { position: absolute; inset: 0; z-index: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.dg .side, .dg .center, .dg .row-label { position: relative; z-index: 1; }
.dg .side { display: flex; flex-direction: column; align-items: center; width: 100%; }
.dg .row { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-end; }
.dg .side-bottom .row { align-items: flex-start; }
.dg .empty { align-self: center; color: var(--sub); }
.disc { border-radius: 50%; display: grid; place-items: center; background: var(--c); border: 2px solid var(--ink); color: var(--fg); }
.disc svg { color: var(--fg); }

/* 一覧用（小） */
.dg-mini .row { gap: 4px; min-height: 26px; padding: 0 2px; }
.dg-mini .side-top { margin-bottom: 26px; }
.dg-mini .side-bottom { margin-top: 26px; }
.dg-mini .side { gap: 16px; }
.dg-mini .disc { width: 26px; height: 26px; }
.dg-mini .disc svg { width: 14px; height: 14px; }
.dg-mini .center .disc { width: 46px; height: 46px; border-width: 3px; }
.dg-mini .center .disc svg { width: 24px; height: 24px; }
.dg-mini .empty { font-size: 11px; }

/* 拡大用（大） */
.dg-full .row-label { margin: 0; font-size: 13px; font-weight: 700; color: var(--sub); text-align: center; }
.dg-full .row-label b { color: var(--ink); }
.dg-full .row { gap: 10px 8px; min-height: 76px; margin: 6px 0; }
.dg-full .side-top { margin: 10px 0 56px; }
.dg-full .side-bottom { margin: 56px 0 10px; }
.dg-full .empty { font-size: 13px; }
.node { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 54px; padding: 0; background: none; border: 0; font: inherit; color: var(--ink); cursor: pointer; }
.side-top .node { flex-direction: column-reverse; }
.node .disc { width: 46px; height: 46px; border-width: 3px; transition: box-shadow .15s; }
.node .disc svg { width: 24px; height: 24px; }
.node .name { font-size: 11px; font-weight: 700; white-space: nowrap; }
.node:hover .disc { box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 35%, transparent); }
.node:focus-visible { outline: 3px solid var(--ink); outline-offset: 4px; border-radius: 8px; }
.dg-full .center .disc { width: 112px; height: 112px; border-width: 4px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.dg-full .center .disc svg { width: 44px; height: 44px; }
.dg-full .center .name { font-size: 16px; font-weight: 700; line-height: 1.2; }
@media (min-width: 480px) {
  .node { width: 64px; }
  .node .disc { width: 56px; height: 56px; }
  .node .disc svg { width: 28px; height: 28px; }
  .node .name { font-size: 12px; }
  .dg-full .row { gap: 12px 16px; }
}

/* 覚え方（拡大表示の図の下） */
.memo { max-width: 480px; margin: 32px auto 0; padding: 0 12px; }
.memo h3 { margin: 24px 0 8px; font-size: 13px; font-weight: 700; color: var(--sub); }
.memo h3 b { color: var(--ink); }
.memo ul { list-style: none; margin: 0; padding: 0; border-top: 1px solid color-mix(in srgb, var(--c, #ccc) 30%, #fff); }
.memo li { display: grid; gap: 2px; padding: 10px 0; border-bottom: 1px solid color-mix(in srgb, var(--c, #ccc) 30%, #fff); }
.memo .pair { font-size: 12px; font-weight: 700; color: var(--sub); }
.memo .why { font-size: 15px; line-height: 1.6; }
.memo .tw { font-weight: 700; }
.memo-empty { margin: 0; font-size: 13px; color: var(--sub); }

/* 拡大ダイアログ：スマホは全画面、PCは中央 */
.modal { width: 100%; max-width: 100%; height: 100%; max-height: 100%; margin: 0; padding: 0; border: 0; background: color-mix(in srgb, var(--c, #fff) 12%, #fff); color: var(--ink); }
.modal::backdrop { background: rgb(0 0 0 / .45); }
.modal-head { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 12px 20px; background: color-mix(in srgb, var(--c, #fff) 12%, #fff); border-bottom: 1px solid color-mix(in srgb, var(--c, #ccc) 30%, #fff); }
.modal-head h2:focus { outline: none; }
.modal-head h2:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.modal-head h2 { margin: 0; font-size: 18px; display: flex; align-items: center; gap: 6px; }
.modal-head h2 svg { width: 22px; height: 22px; color: var(--c); }
.close { width: 44px; height: 44px; display: grid; place-items: center; padding: 0; border: 2px solid var(--line); border-radius: 50%; background: #fff; color: var(--ink); cursor: pointer; transition: border-color .15s; }
.close:hover { border-color: var(--ink); }
.close svg { width: 20px; height: 20px; }
.modal-body { padding: 24px 8px 32px; }
@media (min-width: 640px) {
  .modal { width: min(640px, calc(100% - 32px)); height: auto; max-height: calc(100% - 32px); margin: auto; border-radius: 16px; }
}

/* ポケモンの詳細ページ */
body:has(.poke) { background: color-mix(in srgb, var(--c, #fff) 10%, #fff); }
.site-header-sub { padding-top: 20px; }
/* 詳細ページは見出し・本文・フッターを同じ幅の1本の列にそろえる */
body:has(.poke) .site-header, body:has(.poke) .site-footer { max-width: 640px; }
.home { font-size: 14px; font-weight: 700; color: var(--ink); text-decoration: none; }
.home::before { content: "← "; }
.home:hover { text-decoration: underline; }
.poke { max-width: 640px; padding-top: 32px; }
.poke-name { margin: 0 0 12px; font-size: clamp(30px, 8vw, 44px); }
.ptypes { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.tlink { display: inline-flex; align-items: center; gap: 2px; color: inherit; text-decoration: none; border-radius: 8px; }
.tlink-go { width: 16px; height: 16px; color: var(--sub); }
.tlink:hover .ttag-name { text-decoration: underline; }
.ptypes-lg .ttag { font-size: 18px; gap: 6px; }
.ptypes-lg .ttag .disc { width: 36px; height: 36px; border-width: 3px; }
.ptypes-lg .ttag .disc svg { width: 20px; height: 20px; }
.poke-evo { margin-top: 40px; }
.poke-evo h2 { margin: 0 0 12px; font-size: 13px; color: var(--sub); }
.evo { list-style: none; margin: 0; padding: 0; }
.evo-stage ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.evo-stage ul:has(> :only-child) { grid-template-columns: 1fr; }
.evo-item > a, .evo-item.is-current { display: flex; flex-direction: column; gap: 6px; height: 100%; padding: 12px; background: #fff; border: 2px solid var(--line); border-radius: 12px; color: var(--ink); text-decoration: none; transition: border-color .15s; }
.evo-item > a:hover { border-color: var(--ink); }
.evo-item.is-current { border-color: var(--ink); border-width: 3px; }
.evo-name { font-size: 16px; font-weight: 700; }
.evo-types { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.evo-from { font-size: 11px; color: var(--sub); }
.evo-arrow { display: flex; justify-content: center; padding: 6px 0; color: var(--sub); }
.evo-arrow svg { width: 22px; height: 22px; }
.evo-none, .poke-missing { margin: 0; color: var(--sub); font-size: 14px; }
a:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }

.site-footer { max-width: 1200px; margin: 0 auto; padding: 0 16px 40px; color: var(--sub); font-size: 11px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

.notfound-home { margin-top: 24px; }
