/* ChronoDrawer 2026-10-03：左に年月の一覧、右に表。Claude.ai / ChatGPT のような落ち着いた作業画面と、Excelのような表 */
:root {
  color-scheme: light;
  --bg: #ffffff; --side: #f9f9f9; --ink: #171717; --sub: #6f6f6f; --faint: #9b9b9b;
  --line: #e8e8e8; --grid: #ededed; --head: #fafafa; --hover: #f4f4f4; --sel: #ececec;
  --hi: #2563eb; --hit: #fff7d6;
  --c-event: #d4493b; --c-opening: #c98a12; --c-music: #9a4fd1; --c-film: #2f7dd1; --c-tv: #1f9d6b; --c-game: #5a5ad6; --c-book: #8a6a4b;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", Meiryo, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { color-scheme: dark; --bg: #212121; --side: #171717; --ink: #ececec; --sub: #a8a8a8; --faint: #7d7d7d;
    --line: #333; --grid: #2f2f2f; --head: #262626; --hover: #2a2a2a; --sel: #2f2f2f; --hi: #7aa7ff; --hit: #3a3420; }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 17px; line-height: 1.6; -webkit-text-size-adjust: 100%; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
svg { width: 18px; height: 18px; flex-shrink: 0; }
.app { display: flex; min-height: 100vh; }

/* 左の一覧 */
.side { width: 260px; flex-shrink: 0; background: var(--side); border-right: 1px solid var(--line); height: 100vh; position: sticky; top: 0;
  display: flex; flex-direction: column; padding: 14px 10px; overflow-y: auto; }
.brand { padding: 4px 10px 12px; position: sticky; top: -14px; z-index: 1; background: var(--side); }
.brand a { font-weight: 700; font-size: 19.5px; text-decoration: none; letter-spacing: -.01em; }
.brand span { display: block; font-size: 14px; color: var(--sub); }
.newsearch { position: sticky; top: 46px; z-index: 1; background: var(--side); display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; text-decoration: none; font-weight: 500; margin-bottom: 10px; }
.newsearch:hover { background: var(--sel); }
.years { flex: 1; }
.years details { margin-bottom: 2px; }
.years summary { list-style: none; cursor: pointer; padding: 6px 10px; border-radius: 8px; font-size: 14.5px; color: var(--sub); font-weight: 600; }
.years summary::-webkit-details-marker { display: none; }
.years summary::before { content: "›"; display: inline-block; width: 14px; transition: transform .15s; }
.years details[open] > summary::before { transform: rotate(90deg); }
.years summary:hover { background: var(--hover); }
.years ul, .years ol { list-style: none; margin: 0; padding: 0; }
.years ul a { display: block; padding: 5px 10px 5px 24px; border-radius: 8px; text-decoration: none; font-size: 16px; }
.years a:hover { background: var(--hover); }
.years a[aria-current] { background: var(--sel); font-weight: 600; }
.mlist { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; padding: 2px 4px 6px 20px !important; }
.mlist a { padding: 4px 0 !important; text-align: center; font-size: 15px !important; }
.sidefoot { border-top: 1px solid var(--line); padding: 10px 10px 0; display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 14px; }
.sidefoot a { color: var(--sub); text-decoration: none; }

/* 右の作業面 */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; padding: 10px 24px; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); }
.menu { display: none; border: 0; background: none; padding: 6px; border-radius: 8px; cursor: pointer; }
.menu svg { width: 22px; height: 22px; }
.q { display: flex; align-items: center; gap: 8px; flex: 1; max-width: 560px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.q:focus-within { border-color: var(--faint); box-shadow: 0 0 0 3px color-mix(in srgb, var(--hi) 15%, transparent); }
.q svg { color: var(--faint); }
.q input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; padding: 9px 0; font-size: 17px; }
.content { padding: 8px 32px 40px; max-width: 1400px; width: 100%; }
.pagehead { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin: 6px 0 16px; }
.crumb { font-size: 15px; color: var(--sub); }
.crumb a { color: var(--sub); text-decoration: none; }
.crumb a:hover { text-decoration: underline; }
h1 { margin: 2px 0 0; font-size: 32px; font-weight: 700; letter-spacing: -.02em; line-height: 1.3; }
.sub { margin: 4px 0 0; color: var(--sub); font-size: 16px; }
.pns { display: flex; gap: 6px; }
.pn { padding: 6px 12px; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; font-size: 15.5px; white-space: nowrap; }
.pn:hover { background: var(--hover); }

/* 道具の列 */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.tabs { display: flex; flex-wrap: wrap; gap: 2px; padding: 3px; background: var(--hover); border-radius: 10px; }
.tab { border: 0; background: transparent; padding: 5px 11px; border-radius: 8px; font-size: 15.5px; cursor: pointer; color: var(--sub); }
.tab i { font-style: normal; margin-left: 5px; font-size: 14px; color: var(--faint); font-variant-numeric: tabular-nums; }
.tab:hover { color: var(--ink); }
.tab[aria-pressed="true"] { background: var(--bg); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tools select, .tools input { border: 1px solid var(--line); background: var(--bg); border-radius: 8px; padding: 6px 10px; font-size: 15.5px; }
.tools input { width: 190px; }
.count { color: var(--sub); font-size: 15px; font-variant-numeric: tabular-nums; }

/* 表 */
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
table.grid { width: 100%; border-collapse: collapse; font-size: 16px; }
.grid th, .grid td { padding: 8px 12px; border-bottom: 1px solid var(--grid); text-align: left; vertical-align: top; }
.grid thead th { position: sticky; top: 0; background: var(--head); font-size: 14.5px; font-weight: 600; color: var(--sub); white-space: nowrap; border-bottom: 1px solid var(--line); }
.grid tbody tr:hover { background: var(--hover); }
.grid tbody tr:last-child td { border-bottom: 0; }
.grid td + td, .grid th + th { border-left: 1px solid var(--grid); }
td.d { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--sub); width: 4.5em; }
td.g { white-space: nowrap; width: 7em; }
.gk { display: inline-flex; align-items: center; gap: 6px; font-size: 15px; }
.gk::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: var(--faint); }
.g-event::before { background: var(--c-event); } .g-opening::before { background: var(--c-opening); } .g-music::before { background: var(--c-music); }
.g-film::before { background: var(--c-film); } .g-tv::before { background: var(--c-tv); } .g-game::before { background: var(--c-game); } .g-book::before { background: var(--c-book); }
td.g small { display: block; color: var(--faint); font-size: 14px; padding-left: 13px; }
td.t { min-width: 220px; }
td.t a { font-weight: 600; text-decoration: none; }
td.t a:hover { color: var(--hi); text-decoration: underline; }
td.t small { display: block; color: var(--sub); font-size: 14.5px; }
td.t small.note { color: var(--hi); }
.jp { display: inline-block; margin-left: 6px; padding: 0 5px; border: 1px solid #d0485a; color: #d0485a; border-radius: 4px; font-size: 12.5px; line-height: 1.5; vertical-align: 1px; }
td.c { white-space: nowrap; color: var(--sub); font-size: 15px; max-width: 12em; overflow: hidden; text-overflow: ellipsis; }
td.i { color: var(--sub); font-size: 15px; min-width: 260px; }
td.s { white-space: nowrap; font-size: 14.5px; }
td.s a { color: var(--faint); text-decoration: none; font-variant-numeric: tabular-nums; }
td.s a:hover { color: var(--hi); text-decoration: underline; }
tr.hit { background: var(--hit) !important; }
.matrix th.m, .matrix td.n { white-space: nowrap; }
.matrix td.n { text-align: right; font-variant-numeric: tabular-nums; }
.matrix td.n a, .matrix th.m a { text-decoration: none; }
.matrix td.n a:hover, .matrix th.m a:hover { color: var(--hi); text-decoration: underline; }
.matrix td.n span { color: var(--faint); }
.matrix .sum { font-weight: 600; }
.matrix tfoot th, .matrix tfoot td { background: var(--head); font-weight: 600; border-top: 1px solid var(--line); }

/* トップ */
.home { text-align: center; padding: 9vh 0 40px; }
.home h1 { font-size: clamp(27px, 3.8vw, 36px); font-weight: 600; }
.home .sub { margin-bottom: 22px; }
.q.big { margin: 0 auto; max-width: 680px; border-radius: 22px; padding: 4px 20px; box-shadow: 0 2px 12px rgba(0,0,0,.06); }
.q.big input { padding: 12px 0; font-size: 18.5px; }
.exs { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 16px; }
.ex { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 10px; text-decoration: none; font-size: 15.5px; color: var(--sub); }
.ex svg { width: 14px; height: 14px; }
.ex:hover { background: var(--hover); color: var(--ink); }
.yearsgrid th { width: 6em; color: var(--sub); font-weight: 600; font-size: 15px; white-space: nowrap; }
.yearsgrid td a { font-weight: 600; text-decoration: none; }
.yearsgrid td a:hover { color: var(--hi); }
.yearsgrid td small { display: block; color: var(--faint); font-size: 13px; font-variant-numeric: tabular-nums; }

.doc { max-width: 46em; }
.doc h2 { font-size: 20.5px; margin: 26px 0 6px; }
.doc a { color: var(--hi); }
.foot { margin-top: 28px; color: var(--faint); font-size: 14.5px; }
.foot a { color: var(--sub); }
.scrim { display: none; }

/* スマホ */
@media (max-width: 900px) {
  .side { position: fixed; left: 0; top: 0; z-index: 20; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 24px rgba(0,0,0,.15); }
  body.open .side { transform: none; }
  body.open .scrim { display: block; position: fixed; inset: 0; z-index: 15; background: rgba(0,0,0,.3); }
  .menu { display: inline-flex; }
  .top { padding: 8px 12px; }
  .content { padding: 4px 16px 32px; }
  h1 { font-size: 27.5px; }
  .tools { width: 100%; }
  .tools input { flex: 1; width: auto; min-width: 0; }
  td.i { min-width: 200px; }
  .home { padding-top: 5vh; }
  /* スマホの表は、くわしく・出典の列を隠して、1行を短く */
  .grid th.i, .grid td.i, .grid th.s, .grid td.s { display: none; }
  td.t { min-width: 0; }
  .grid th, .grid td { padding: 8px 9px; }
  td.c { max-width: 7em; white-space: normal; }
}

/* 2026-10-03 表の枠の中全体を押せるように（髙橋さんの希望） */
.matrix tbody td.n, .matrix tbody th.m, .yearsgrid td { padding: 0; }
.matrix td.n a, .matrix th.m a, .yearsgrid td a { display: block; padding: 12px 16px; text-decoration: none; }
.matrix td.n span { display: block; padding: 12px 16px; }
.matrix td.n a:hover, .matrix th.m a:hover, .yearsgrid td a:hover { background: var(--sel); color: var(--ink); text-decoration: none; }
.matrix td.n a:active, .matrix th.m a:active, .yearsgrid td a:active { background: var(--line); }
.yearsgrid td a b { display: block; font-weight: 600; }
.yearsgrid td a:hover b { color: var(--hi); }
.matrix td.n a:hover { color: var(--hi); }
.grid th, .grid td { padding-top: 10px; padding-bottom: 10px; }
.tab { padding: 7px 13px; }
.tools select, .tools input { padding: 8px 12px; }
.pn { padding: 8px 14px; }
/* 2026-10-03 検索欄を使いやすい位置に：パソコンは上の真ん中に大きく、スマホは親指の届く画面の下に（ChatGPTの入力欄の位置） */
.top { justify-content: center; padding-top: 14px; padding-bottom: 14px; }
.top .q { max-width: 680px; border-radius: 14px; box-shadow: 0 1px 6px rgba(0,0,0,.05); }
.top .q input { padding: 12px 0; font-size: 18px; }
.top .menu { position: absolute; left: 12px; }
@media (max-width: 900px) {
  .top { justify-content: flex-start; min-height: 52px; backdrop-filter: none; background: var(--bg); }
  .tools input { flex: 1 1 100%; min-width: 0; }
  .top .q { position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 12;
    max-width: none; border-radius: 18px; box-shadow: 0 4px 20px rgba(0,0,0,.14); background: var(--bg); }
  .content { padding-bottom: 96px; }
  body.open .top .q { display: none; }
}
