/* 作品の索引（/index/）。使いやすさが主役: 上の帯だけ表の世界の色、本体は落ち着いた地の 1 行 1 件の表。
   書体はシステムの物（毎日使う道具の画面で、読み慣れた字形と速さを取る）。文字は 12px 以上、押せる物は 44px 以上。 */
:root {
  --ink: #1d2230;
  --muted: #565c6c;   /* 地 #f7f6f2 に対して 6.4:1 */
  --line: #e1dfd7;
  --ground: #f7f6f2;
  --paper: #fffdf8;
  --hover: #efede5;
  --pick: #e6ebf8;
  --accent: #2b3d94;  /* リンク・フォーカス・選んだ行の印（地に対して 9:1） */
  --night: #171b32;   /* 上の帯（表の世界の夜の色） */
  --gold: #ffdf7d;
  --bar-top: 0px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 15px/1.5 system-ui, -apple-system, "Hiragino Sans", "Yu Gothic UI", "Meiryo", sans-serif; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
a { color: var(--accent); }

/* ---- 上の帯（表の世界の色と、小さなカワウソの顔だけ） ---- */
.ix-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 4px 16px; background: var(--night); color: #fff; border-bottom: 3px solid var(--gold); }
.ix-brand { display: flex; align-items: center; gap: 10px; }
.ix-brand img { border-radius: 8px; background: #2a3058; }
.ix-brand h1 { margin: 0; font-size: 18px; font-weight: 800; letter-spacing: .04em; color: var(--gold); }
.ix-back { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border-radius: 22px; color: #fff; text-decoration: none; font-weight: 700; font-size: 14px; border: 1px solid #ffffff55; }
.ix-back:hover { background: #ffffff1a; }

/* ---- 2 列（PC）: 左に一覧、右に作品の頁 ---- */
.ix-main { display: block; }
.ix-list { min-width: 0; }
.ix-work { display: none; }
@media (min-width: 1000px) {
  .ix-main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(380px, 38%); align-items: start; }
  .ix-work { display: block; position: sticky; top: 0; height: 100vh; overflow: auto; background: var(--paper); border-left: 1px solid var(--line); }
  .ix-work-bar { display: none; }
}

/* ---- 上に残る絞り込みの帯 ---- */
.ix-bar { position: sticky; top: 0; z-index: 5; background: var(--ground); border-bottom: 1px solid var(--line); padding: 10px 16px 0; }
.ix-search { display: flex; gap: 8px; align-items: center; margin: 0; }
.ix-q { flex: 1; min-width: 0; }
.ix-q input, .ix-f select, .ix-f input, .ix-sort select { width: 100%; min-height: 44px; padding: 0 12px; border: 1px solid #b9b6aa; border-radius: 8px; background: #fff; font-size: 16px; }
.ix-sort { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.ix-sort select { width: auto; font-size: 14px; }
.ix-toggle { display: none; min-height: 44px; min-width: 44px; padding: 0 14px; border: 1px solid #b9b6aa; border-radius: 8px; background: #fff; font-weight: 700; font-size: 14px; cursor: pointer; }
.ix-n[hidden] { display: none; }
.ix-n { display: inline-block; min-width: 20px; margin-left: 6px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: #fff; font-size: 12px; line-height: 20px; text-align: center; }
.ix-filters { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; padding: 8px 0 2px; }
.ix-f { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.ix-f-name { white-space: nowrap; }
.ix-f select { width: auto; max-width: 13em; font-size: 14px; color: var(--ink); }
.ix-f input { width: 9em; font-size: 14px; color: var(--ink); }
.ix-f-years select { width: 6.6em; }
.ix-check { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 4px; font-size: 14px; cursor: pointer; }
.ix-check input { width: 20px; height: 20px; accent-color: var(--accent); }
select:disabled { opacity: .45; }
.ix-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 0; }
.ix-chips:empty { display: none; }
.ix-chip { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 0 6px 0 12px; border: 1px solid #c9c6ba; border-radius: 22px; background: #fff; font-size: 13px; cursor: pointer; }
.ix-chip span[aria-hidden] { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 14px; color: var(--muted); font-size: 16px; }
.ix-chip:hover span[aria-hidden] { background: var(--hover); }
.ix-chip.clear { border-style: dashed; padding: 0 12px; color: var(--muted); }
.ix-status { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.ix-status .ix-chips { flex: 1 1 auto; min-width: 0; }
.ix-count { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; margin-left: auto; }
.ix-status .ix-chips:empty + .ix-count { flex: 1; }
.ix-count p { margin: 0; font-size: 14px; font-variant-numeric: tabular-nums; }
.ix-count p b { font-size: 15px; }
.ix-count[aria-busy="true"] p { color: var(--muted); }
.ix-pager { display: flex; gap: 6px; }
.ix-pager button { min-width: 44px; min-height: 44px; padding: 0 12px; border: 1px solid #c9c6ba; border-radius: 8px; background: #fff; font-size: 14px; cursor: pointer; }
.ix-pager button:disabled { opacity: .4; cursor: default; }
.ix-head { display: grid; grid-template-columns: var(--cols); border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.ix-head > * { display: flex; align-items: center; min-height: 44px; padding: 0 8px; border: 0; background: none; font-size: 12px; font-weight: 700; color: var(--muted); text-align: left; }
.ix-head button { cursor: pointer; }
.ix-head button:hover { color: var(--ink); }
.ix-head button[data-on]::after { content: attr(data-on); margin-left: 4px; color: var(--accent); }

/* PC: 題の検索・絞り込み・並べ替えを 1 つの流れに並べ、上に残る帯を低くする（一覧が一度に多く見える） */
@media (min-width: 720px) {
  .ix-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding-bottom: 4px; }
  .ix-controls .ix-search, .ix-controls .ix-filters { display: contents; }
  .ix-q { flex: 1 1 220px; }
  /* 並べ替えは列の見出し（題・年・機種）で。選ぶ欄はスマホだけ */
  .ix-sort { display: none; }
}

/* ---- 1 行 1 件の表 ---- */
.ix-list { --cols: minmax(0, 1fr) 5.4em minmax(7em, 22%) minmax(6em, 16%) 5.6em; }
.ix-rows { list-style: none; margin: 0; padding: 0 16px 8px; }
.ix-rows li { border-bottom: 1px solid var(--line); }
.ix-open { display: grid; grid-template-columns: var(--cols); align-items: center; width: 100%; min-height: 44px; padding: 0; border: 0; background: none; text-align: left; cursor: pointer; }
.ix-open > span { min-width: 0; padding: 6px 8px; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ix-open .c-t { color: var(--ink); white-space: normal; }
.ix-open .c-t b { font-weight: 600; font-size: 15px; overflow-wrap: anywhere; }
.ix-open .c-t small { display: block; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ix-open .c-y { font-variant-numeric: tabular-nums; color: var(--ink); }
.ix-open .c-k i { font-style: normal; }
.ix-open .rep { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 4px; background: #fff1c2; color: #5a4300; font-size: 12px; font-weight: 700; vertical-align: 1px; }
.ix-open:hover { background: var(--hover); }
.ix-open[aria-current="true"] { background: var(--pick); box-shadow: inset 3px 0 0 var(--accent); }
.ix-rows[aria-busy="true"] { opacity: .55; }
.ix-more-rows { display: flex; align-items: center; min-height: 88px; padding: 0 12px; color: var(--muted); font-size: 13px; }
.ix-note { margin: 8px 16px 0; font-size: 13px; color: var(--muted); }
.ix-empty, .ix-error { padding: 32px 16px; text-align: center; }
.ix-empty button, .ix-error button, .ix-about-btn { min-height: 44px; padding: 0 18px; border: 1px solid #b9b6aa; border-radius: 8px; background: #fff; font-weight: 700; cursor: pointer; }
.ix-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px 40px; }

/* ---- 作品の頁 ---- */
.ix-work-body { padding: 20px 24px 48px; }
.ix-placeholder { display: grid; place-content: center; justify-items: center; gap: 16px; min-height: 40vh; color: var(--muted); font-size: 14px; text-align: center; }
.ix-kicker { margin: 0 0 4px; font-size: 13px; color: var(--muted); }
.ix-kicker .rep { display: inline-block; padding: 0 8px; border-radius: 4px; background: #fff1c2; color: #5a4300; font-weight: 700; }
.ix-work h2 { margin: 0; font-size: 26px; line-height: 1.35; overflow-wrap: anywhere; }
.ix-work h2:focus { outline: none; }
.ix-work .sub { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.ix-facts { display: grid; grid-template-columns: 5em minmax(0, 1fr); gap: 0; margin: 16px 0; border-top: 1px solid var(--line); }
.ix-facts dt, .ix-facts dd { margin: 0; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.ix-facts dt { color: var(--muted); font-size: 13px; padding-top: 10px; }
.ix-facts small { display: block; color: var(--muted); font-size: 13px; }
.ix-facts a { overflow-wrap: anywhere; }
.ix-desc { margin: 12px 0; font-size: 15px; line-height: 1.7; }
.ix-wnote { margin: 8px 0; padding: 8px 12px; border-radius: 6px; background: #f1efe7; font-size: 13px; color: var(--muted); }
.ix-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 4px; }
.ix-go { display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px; border-radius: 22px; background: var(--night); color: #fff; font-weight: 700; text-decoration: none; }
.ix-go:hover { background: #262c52; }
.ix-work h3 { margin: 24px 0 8px; font-size: 16px; }
.ix-work .play p, .ix-work .play li { font-size: 14px; line-height: 1.7; }
.ix-work .play-meta { font-size: 13px; color: var(--muted); }
.buy-links { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0; }
.buy-link { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border: 1px solid #b9b6aa; border-radius: 22px; background: #fff; text-decoration: none; font-weight: 700; font-size: 14px; }
.ix-work .meta { font-size: 13px; color: var(--muted); }
.ix-rel section { margin: 0 0 16px; }
.ix-rel ul { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.ix-rel li { border-bottom: 1px solid var(--line); }
.ix-rel-item { display: flex; flex-direction: column; justify-content: center; width: 100%; min-height: 48px; padding: 6px 8px; border: 0; background: none; text-align: left; cursor: pointer; }
.ix-rel-item:hover { background: var(--hover); }
/* カタログの外の相手（押せない）: 押せる行と見分けがつくよう、地の色を付けず、文字を薄く */
.ix-rel-item.is-out { cursor: default; }
.ix-rel-item.is-out:hover { background: none; }
.ix-rel-item.is-out b { font-weight: 400; color: var(--muted); }
.ix-rel-src { margin: 12px 0 0; font-size: 13px; color: var(--muted); line-height: 1.6; }
.ix-rel-title { margin: 12px 0 4px; }
.ix-rel-item b { font-weight: 600; font-size: 15px; overflow-wrap: anywhere; }
.ix-rel-item small { font-size: 13px; color: var(--muted); }
.ix-rel-item .kind { display: inline-block; margin-right: 6px; padding: 0 6px; border-radius: 4px; background: #eef0f7; color: var(--accent); font-size: 12px; font-weight: 700; }
.ix-more { min-height: 44px; margin-top: 6px; padding: 0 14px; border: 1px solid #c9c6ba; border-radius: 8px; background: #fff; font-size: 14px; cursor: pointer; }
.ix-about h2 { font-size: 22px; }
.ix-about p, .ix-about li { font-size: 14px; line-height: 1.75; }
.ix-about table { border-collapse: collapse; margin: 8px 0; font-size: 14px; }
.ix-about td, .ix-about th { padding: 6px 12px 6px 0; border-bottom: 1px solid var(--line); text-align: left; font-variant-numeric: tabular-nums; }
.ix-about td:last-child { text-align: right; }

/* ---- スマホ・狭い画面: 列を 2 行の組（題／年・機種）に畳み、作品の頁は一覧の上に重ねる ---- */
@media (max-width: 999px) {
  .ix-work { display: block; position: fixed; inset: 0; z-index: 20; overflow: auto; background: var(--paper); visibility: hidden; transform: translateX(100%); transition: transform .22s ease, visibility 0s linear .22s; overscroll-behavior: contain; }
  .ix-work[data-open="true"] { visibility: visible; transform: none; transition: transform .22s ease; }
  .ix-work-bar { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; min-height: 52px; padding: 4px 8px; background: var(--paper); border-bottom: 1px solid var(--line); }
  .ix-work-close { min-height: 44px; padding: 0 12px; border: 0; background: none; font-weight: 700; font-size: 15px; color: var(--accent); cursor: pointer; }
  .ix-work-body { padding: 16px 16px 48px; }
  body.ix-locked { overflow: hidden; }
}
@media (max-width: 719px) {
  .ix-top { padding: 4px 8px 4px 12px; }
  .ix-bar { padding: 8px 12px 0; }
  .ix-toggle { display: inline-flex; align-items: center; }
  .ix-sort span { display: none; }
  .ix-search { flex-wrap: wrap; }
  .ix-q { flex: 1 1 100%; }
  .ix-sort { flex: 1; }
  .ix-sort select { width: 100%; }
  .ix-filters { display: none; max-height: 52vh; overflow: auto; }
  .ix-filters[data-open="true"] { display: grid; grid-template-columns: 1fr; gap: 8px; }
  .ix-f { display: grid; grid-template-columns: 5em minmax(0, 1fr); }
  .ix-f select, .ix-f input { max-width: none; width: 100%; }
  .ix-f-years { grid-template-columns: 5em minmax(0, 1fr) auto minmax(0, 1fr); }
  .ix-f-years select { width: 100%; }
  .ix-head { display: none; }
  .ix-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .ix-status .ix-chips { flex-basis: 100%; }
  .ix-count { flex: 1; }
  .ix-chip { flex: none; }
  .ix-rows { padding: 0 12px 8px; }
  .ix-open { grid-template-columns: minmax(0, 1fr); padding: 6px 4px; }
  .ix-open > span { padding: 0 4px; }
  .ix-open .c-t { grid-row: 1; }
  .ix-open .c-y, .ix-open .c-p { display: inline; grid-row: 2; }
  .ix-open .c-yp { display: block; }
  .ix-open .c-g, .ix-open .c-k { display: none; }
  .ix-work h2 { font-size: 24px; }
}
/* 2 行の組の 2 行目（スマホだけ。PC は列の方を出す） */
.ix-open .c-yp { display: none; font-size: 13px; color: var(--muted); }
@media (max-width: 719px) {
  .ix-open .c-y, .ix-open .c-p { display: none; }
  .ix-open .c-yp { display: block; padding: 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* PC: 題と別表記を 1 行に並べ、1 行 1 件を 44px にそろえる（長い題は … で切り、作品の頁で全部読む） */
@media (min-width: 720px) {
  .ix-open .c-t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .ix-open .c-t small { display: inline; margin-left: 8px; }
}

/* 出典のリンク（文の中ではなく単独の物）は、指で押せる高さに */
.ix-facts dd > a, .ix-src-list a { display: inline-flex; align-items: center; min-height: 44px; }
.ix-src-list { margin: 0; padding-left: 1.2em; }

/* 出典つきの影響の根拠・注意・出典（系譜の段） */
.ix-rel-basis, .ix-rel-caveat, .ix-rel-cite { margin: 4px 8px 8px; font-size: 13px; line-height: 1.6; color: var(--muted); }
.ix-rel-cite a { display: inline-flex; align-items: center; min-height: 44px; }
.ix-rel-lower { min-height: 48px; }

/* 似ている作品の理由の札（押せる札は 44px の高さ、見た目は小さな札） */
.ix-tags { display: flex; flex-wrap: wrap; gap: 0 6px; margin: -4px 8px 4px; }
.ix-tag { display: inline-flex; align-items: center; min-height: 44px; padding: 0; border: 0; background: none; font-size: 12px; color: var(--accent); cursor: pointer; }
.ix-tag > span { padding: 3px 9px; border: 1px solid #c3c9e3; border-radius: 12px; background: #f3f5fc; }
.ix-tag:hover > span { background: #e6ebf8; }
.ix-tag.is-plain { cursor: default; color: var(--muted); min-height: 32px; }
.ix-tag.is-plain > span { border-color: var(--line); background: #f4f2ec; }

/* 遊び方の出典のリンク（指で押せる高さに） */
.ix-work .play-meta a { display: inline-flex; align-items: center; min-height: 44px; }

/* 収益の入口（PR の印・紹介料の一文・応援・制作のご依頼） */
.pr { display: inline-block; margin-left: 6px; padding: 0 4px; border: 1px solid currentColor; border-radius: 3px; font-size: 12px; font-weight: 700; line-height: 1.4; opacity: .75; }
.pr-note { margin: 6px 0 0; font-size: 13px; }
.pr-note a { display: inline-flex; align-items: center; min-height: 44px; }
