:root {
  --bg: #f3f1ec; --panel: #ffffff; --ink: #1d2124; --sub: #5b6166; --line: #d9d5cc;
  --accent: #b87300; --accent-ink: #ffffff; --tag: #8a5a00; --shade: rgba(0,0,0,.06);
  --stage: #14181b; --stage-ink: #f1efe9; --stage-sub: #a9b0b5; --glow: #ffb830;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1214; --panel: #171b1e; --ink: #e8e6e1; --sub: #9aa1a6; --line: #2a3035;
    --accent: #ffb830; --accent-ink: #1a1200; --tag: #ffc861; --shade: rgba(255,255,255,.07);
    --stage: #07090a;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1214; --panel: #171b1e; --ink: #e8e6e1; --sub: #9aa1a6; --line: #2a3035;
  --accent: #ffb830; --accent-ink: #1a1200; --tag: #ffc861; --shade: rgba(255,255,255,.07);
  --stage: #07090a;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 16px; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.75 "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", "Meiryo", system-ui, sans-serif; }
a { color: inherit; }
b { color: var(--tag); font-weight: 700; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 16px; z-index: 10; background: var(--panel); padding: 8px 12px; }

.toc { position: fixed; inset: 0 auto 0 0; width: 248px; padding: 28px 20px; overflow-y: auto;
  border-right: 1px solid var(--line); background: var(--panel); }
.toc__brand { margin: 0; font-weight: 800; letter-spacing: .12em; font-size: 13px; color: var(--accent); }
.toc__page { margin: 2px 0 18px; font-size: 22px; font-weight: 800; }
.toc__list { list-style: none; margin: 18px 0 0; padding: 0; }
.toc__list a { display: flex; justify-content: space-between; padding: 8px 10px; border-radius: 6px; text-decoration: none; }
.toc__list a:hover, .toc__list a.on { background: var(--shade); }
.toc__list a.on { color: var(--accent); font-weight: 700; }
.toc__n { color: var(--sub); font-size: 13px; }
.toc__kana { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.find { display: block; }
.find__label { display: block; font-size: 12px; color: var(--sub); margin-bottom: 4px; }
.find input { width: 100%; font: inherit; font-size: 15px; padding: 8px 10px; border-radius: 6px;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink); }
.toc-open { display: none; }

main { margin-left: 248px; padding: 32px 40px 80px; max-width: 1280px; }

/* 頭：遊びの輪を動画で */
.stage { background: var(--stage); color: var(--stage-ink); border-radius: 14px; padding: 26px 22px 22px; margin-bottom: 36px; }
.stage__brand { margin: 0; font-size: 12px; letter-spacing: .16em; font-weight: 800; color: var(--glow); }
.stage__pitch { margin: 10px 0 6px; font-size: clamp(24px, 3.4vw, 38px); font-weight: 800; line-height: 1.3; }
.stage__sub { margin: 0 0 18px; color: var(--stage-sub); }
.loop { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.loop a { display: flex; flex-direction: column; gap: 4px; text-decoration: none; border-radius: 8px; }
.loop a:hover .loop__name, .loop a:focus-visible .loop__name { color: var(--glow); }
.loop video, .loop__none { display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; border-radius: 8px; background: #000; }
.loop__name { margin-top: 4px; font-weight: 800; font-size: 17px; display: flex; gap: 8px; align-items: baseline; }
.loop__n { font: 700 12px ui-monospace, "SFMono-Regular", Consolas, monospace; color: var(--glow); }
.loop__say { font-size: 13px; line-height: 1.55; color: var(--stage-sub); }

.head__index, .cat__index { margin: 0; font-size: 12px; letter-spacing: .14em; color: var(--accent); font-weight: 700; }
h1 { margin: 4px 0 8px; font-size: 32px; line-height: 1.2; }
.head__lead { max-width: 46em; margin: 0 0 4px; }
.head__wip { max-width: 46em; margin: 0; font-size: 14px; color: var(--sub); }
.cat { margin-top: 56px; scroll-margin-top: 16px; }
.cat h2, .kana h2 { margin: 4px 0 4px; font-size: 28px; }
.cat__lead { margin: 0 0 20px; color: var(--sub); }
.items { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.item { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px 18px;
  scroll-margin-top: 16px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.item:target { outline: 3px solid var(--accent); outline-offset: 2px; }
.item h3 { margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; font-size: 21px; line-height: 1.35; }
.item__en { font-size: 13px; color: var(--sub); font-weight: 400; }
.tag { margin-left: auto; font-size: 13px; font-weight: 400; color: var(--tag); text-decoration: none;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; padding: 2px 6px; border-radius: 4px; }
.tag:hover { background: var(--shade); }
.tag--cat { margin-left: 8px; font-size: 14px; }
.item p { margin: 0; }
/* 章の頭の表（相手 → 出す → 勝つと）と、相手ごとの語の組 */
.targets { margin: 0 0 28px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.thead, .trow { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, .6fr) minmax(0, 1.6fr); gap: 10px; align-items: center; padding: 8px 14px; }
.thead { font-size: 12px; color: var(--sub); background: var(--shade); }
.trow { text-decoration: none; border-top: 1px solid var(--line); font-size: 15px; line-height: 1.45; }
.trow:hover, .trow:focus-visible { background: var(--shade); }
.trow__who, .trow__win, .tnote, .grp { display: flex; align-items: center; gap: 8px; min-width: 0; }
.trow__who b { color: var(--ink); }
.trow__do { font-weight: 700; color: var(--tag); }
.mk { flex: none; width: 32px; height: 32px; border-radius: 6px; }
.mk--none { display: inline-block; }
.trow__win .mk { width: 26px; height: 26px; }
.tnote { padding: 10px 14px; border-top: 1px solid var(--line); font-size: 14px; color: var(--sub); text-decoration: none; }
.tnote:hover { background: var(--shade); }
.tnote .mk { width: 26px; height: 26px; }
.grp { grid-column: 1 / -1; margin: 10px 0 -6px; padding-bottom: 6px; border-bottom: 2px solid var(--line); font-weight: 800; font-size: 18px; }
.grp:first-child { margin-top: 0; }
.grp__do { font-size: 13px; font-weight: 700; color: var(--tag); }
.shot { position: relative; margin: 0; border-radius: 6px; overflow: hidden; background: #000;
  display: flex; justify-content: center; }
.shot img { display: block; max-width: 100%; max-height: 520px; height: auto; width: auto; cursor: zoom-in; }
.shot video { display: block; width: 100%; height: auto; cursor: zoom-in; }
.rel { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 14px; }
.rel__k { color: var(--sub); font-size: 12px; }
.chip { padding: 4px 12px; border-radius: 999px; background: var(--shade); color: var(--tag); font-weight: 700; text-decoration: none; }
.chip:hover { outline: 2px solid var(--accent); }
.where { margin-left: auto; font: inherit; font-size: 13px; padding: 4px 10px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: transparent; color: var(--sub); }
.where:hover { color: var(--ink); border-color: var(--sub); }
.next { margin-top: auto; display: flex; justify-content: space-between; gap: 8px; padding: 8px 12px; border-radius: 8px;
  border: 1px solid var(--line); color: var(--sub); font-size: 14px; text-decoration: none; }
.next:hover, .next:focus-visible { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.zoom { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.88); display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 16px; cursor: zoom-out; }
.zoom img { max-width: 100%; max-height: calc(100% - 40px); object-fit: contain; }
.zoom p { margin: 10px 0 0; color: #ddd; font-size: 14px; text-align: center; }
.zoom__clip { position: relative; width: min(100%, 720px, calc(100vh - 120px)); cursor: pointer; border-radius: 8px; overflow: hidden; background: #000; }
.zoom__clip video { display: block; width: 100%; height: auto; }
.zoom__state { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; background: rgba(0,0,0,.4); }
.zoom__clip.paused .zoom__state { display: flex; }
.zoom__state::before { content: ""; width: 84px; height: 84px; border-radius: 50%; background: rgba(0,0,0,.65); border: 3px solid #fff; }
.zoom__state::after { content: ""; position: absolute; margin-left: 8px; border-style: solid; border-width: 18px 0 18px 30px;
  border-color: transparent transparent transparent #fff; }
.calm .shot--clip::after, .calm .loop a::before { content: "▶"; position: absolute; right: 8px; bottom: 8px; padding: 2px 10px;
  border-radius: 999px; background: rgba(0,0,0,.65); color: #fff; font-size: 13px; pointer-events: none; }
.calm .loop a { position: relative; }
.calm .loop a::before { right: auto; bottom: auto; left: 8px; top: 8px; }
.shot--none { min-height: 120px; align-items: center; background: var(--shade); color: var(--sub); font-size: 14px;
  border: 1px dashed var(--line); }
.none { margin-top: 40px; color: var(--sub); }

.kana { margin-top: 64px; scroll-margin-top: 16px; }
.kana dl { margin: 12px 0 0; }
.kana__row { display: flex; gap: 14px; padding: 8px 0; border-top: 1px solid var(--line); }
.kana dt { flex: none; width: 2.2em; font-weight: 800; color: var(--accent); }
.kana dd { margin: 0; display: flex; flex-wrap: wrap; gap: 2px 16px; }
.kana a { text-decoration: none; padding: 4px 0; }
.kana a:hover { color: var(--accent); text-decoration: underline; }

.foot { margin-top: 80px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--sub); font-size: 14px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); opacity: 0;
  background: var(--ink); color: var(--bg); padding: 8px 16px; border-radius: 6px; font-size: 14px;
  transition: .2s; pointer-events: none; }
.toast.on { opacity: 1; transform: translateX(-50%); }
[hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

@media (max-width: 860px) {
  .toc { width: auto; inset: 0; z-index: 20; border: 0; padding: 24px 16px 96px; display: none; }
  body.toc-on .toc { display: block; }
  body.toc-on { overflow: hidden; }
  .toc-open { display: block; position: fixed; right: 16px; bottom: 16px; z-index: 30; min-width: 72px; min-height: 48px;
    font: inherit; font-weight: 700; border: 0; border-radius: 24px; background: var(--accent); color: var(--accent-ink);
    box-shadow: 0 4px 16px rgba(0,0,0,.3); }
  main { margin-left: 0; padding: 16px 16px 96px; }
  .stage { padding: 20px 16px 16px; margin-bottom: 28px; }
  .loop { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  h1 { font-size: 28px; }
  .items { grid-template-columns: 1fr; }
  .thead, .trow { grid-template-columns: minmax(0, 1fr) minmax(0, 2.6em) minmax(0, 1.3fr); gap: 8px; padding: 8px 10px; }
  .trow { font-size: 14px; }
  .mk { width: 28px; height: 28px; }
  .trow__win .mk { display: none; }
  .chip, .where { padding: 8px 14px; }
  .next { padding: 12px; }
  .kana a { padding: 10px 0; }
}
