:root {
  --bg: #faf8f4;
  --fg: #22201c;
  --muted: #6b665d;
  --line: #ddd7cc;
  --accent: #8a5a1f;
  --card: #ffffff;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17161a;
    --fg: #ebe7df;
    --muted: #a39d92;
    --line: #36333a;
    --accent: #e0b070;
    --card: #1f1e23;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "Hiragino Sans", "Noto Sans JP", sans-serif;
  line-height: 1.8;
}
.site-header, main, .site-footer {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px;
}
.site-header h1 { font-size: 1.5rem; margin: 4px 0 8px; line-height: 1.5; }
h2 { font-size: 1.25rem; border-bottom: 2px solid var(--accent); padding-bottom: 4px; margin-top: 48px; }
h3 { font-size: 1.1rem; margin: 0 0 4px; }
a { color: var(--accent); }
a:hover { opacity: 0.75; }
.key-list li { font-size: 1.1rem; }
.phrase {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  margin: 16px 0;
  scroll-margin-top: 64px;
}
.usage { margin: 0 0 8px; }
.counts { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.counts th, .counts td { border-top: 1px solid var(--line); padding: 4px 6px; text-align: left; }
.counts th { color: var(--muted); font-weight: normal; }
.counts th:first-child, .counts td:first-child, .counts td:nth-child(2) { white-space: nowrap; }
.example { border-left: 3px solid var(--accent); padding-left: 12px; margin-top: 2px; }
.example p { margin: 0; }
.speaker { color: var(--muted); margin-right: 4px; }
.site-footer { color: var(--muted); font-size: 0.85rem; padding-top: 32px; padding-bottom: 48px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.refs { font-size: 0.85rem; color: var(--muted); margin: 8px 0 0; }
.works { list-style: none; padding: 0; margin: 8px 0 0; }
.work { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.work-name small { display: block; color: var(--muted); font-size: 0.8rem; line-height: 1.4; }
.buy { display: flex; gap: 6px; flex-wrap: wrap; }
.btn { display: inline-block; padding: 2px 12px; border: 1px solid var(--accent); border-radius: 999px; font-size: 0.85rem; text-decoration: none; line-height: 1.8; transition: box-shadow .12s, background-color .12s, color .12s; }
.btn:hover { opacity: 1; background: var(--accent); color: var(--bg); box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.source-site { font-size: 1rem; margin: 20px 0 4px; }
.quote { margin: 2px 0 0; padding: 6px 12px; border-left: 3px solid var(--line); color: var(--fg); }
.quote p { margin: 0; }
.quote cite { display: block; font-size: 0.8rem; color: var(--muted); font-style: normal; }
.label { margin: 12px 0 2px; font-size: 0.8rem; font-weight: bold; color: var(--muted); }
.in-game { margin: 0; }
.bouten { font-style: normal; -webkit-text-emphasis: filled dot; text-emphasis: filled dot; text-emphasis-position: over right; }
#henkan textarea { width: 100%; font: inherit; color: var(--fg); background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; resize: vertical; }
#henkan textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.henkan-buttons { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
button.btn { font: inherit; font-size: 0.9rem; color: var(--accent); background: transparent; cursor: pointer; padding: 4px 16px; }
button.btn-solid { background: var(--accent); color: var(--bg); font-weight: bold; }
button.btn-solid:hover { opacity: 0.85; }
.henkan-output { background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 8px; padding: 10px 12px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 1.05rem; }
.henkan-used { margin: 0; padding-left: 1.2em; }
.topbar { position: sticky; top: 0; z-index: 10; background: var(--bg); border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 720px; margin: 0 auto; padding: 10px 16px; }
.topbar-name { color: var(--fg); font-weight: bold; text-decoration: none; }
.topbar-nav { display: flex; gap: 6px; }
.topbar-nav a { padding: 2px 12px; border: 1px solid var(--accent); border-radius: 999px; font-size: 0.85rem; text-decoration: none; transition: box-shadow .12s, background-color .12s, color .12s; }
.topbar-nav a:hover { opacity: 1; background: var(--accent); color: var(--bg); box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.topbar-nav a[aria-current="page"] { background: var(--accent); color: var(--bg); }
.site-header h1 { margin-top: 20px; }
[id] { scroll-margin-top: 64px; }
.release td { vertical-align: top; }
.release td:first-child { color: var(--muted); width: 2em; }
.release td:last-child { white-space: nowrap; }
.release small { display: block; color: var(--muted); font-size: 0.8rem; }
.release .buy { margin-top: 4px; }
.play-log { padding-left: 1.6em; }
.play-log li { padding: 2px 0; }
.play-log .platform { color: var(--muted); font-size: 0.85rem; margin-left: 8px; }
.play-log .now { font-weight: bold; }
.now-label { margin-left: 8px; padding: 0 8px; border-radius: 999px; background: var(--accent); color: var(--bg); font-size: 0.75rem; }
.now-label { display: inline-block; white-space: nowrap; }
@media (max-width: 560px) {
  .topbar-inner { flex-wrap: wrap; gap: 6px 8px; padding: 8px 12px; }
  .topbar-name { font-size: 0.85rem; white-space: nowrap; }
  .topbar-nav { flex-basis: 100%; gap: 6px; overflow-x: auto; scrollbar-width: none; }
  .topbar-nav a { padding: 2px 10px; font-size: 0.8rem; white-space: nowrap; }
}
.release { table-layout: fixed; }
.release th:first-child { width: 2em; }
.release th:last-child { width: 6.5em; }
.release td:nth-child(2) { overflow-wrap: anywhere; }
.play-log .when { display: block; color: var(--muted); font-size: 0.8rem; font-weight: normal; line-height: 1.4; }
.release td:nth-child(2) { white-space: normal; }
.chronology { table-layout: fixed; }
.chronology th:first-child { width: 8em; }
.chronology td:nth-child(2) { white-space: normal; overflow-wrap: anywhere; }
.edition { display: block; margin-top: 4px; }
.edition small { display: block; color: var(--muted); font-size: 0.8rem; line-height: 1.4; }
.edition .buy { margin-top: 2px; }
.work .editions { display: block; flex-basis: 100%; }
.edition { margin-top: 14px; }
.edition:first-child { margin-top: 6px; }
.edition small { margin-bottom: 4px; }
#platform h3 { margin-top: 20px; }
.platform-list { padding-left: 1.6em; margin: 4px 0 0; }
.platform-list .platform { color: var(--muted); font-size: 0.85rem; margin-left: 8px; }
.release td { padding-top: 10px; padding-bottom: 14px; }
.release td > small + .edition { margin-top: 6px; }
.work { padding-bottom: 14px; }
.play-buy { margin: 4px 0 6px; font-weight: normal; }

/* 辞書のページの目次（static/toc.js が作る）。PC は右に固定、スマホは右下のボタンで開く */
.side-toc, .toc-fab, .toc-sheet { display: none; }
.side-toc ol { list-style: none; margin: 0; padding: 0; }
.side-toc a, .toc-sheet a { display: block; padding: 4px 8px; border-radius: 6px; color: var(--fg); text-decoration: none; line-height: 1.5; transition: background-color .15s, color .15s; }
.side-toc a:hover, .toc-sheet a:hover { opacity: 1; background: var(--bg); color: var(--accent); }
.side-toc a.on, .toc-sheet a.on { color: var(--accent); font-weight: bold; background: color-mix(in srgb, var(--accent) 12%, transparent); }
.side-toc .sub { display: none; margin: 2px 0 6px 10px; padding-left: 8px; border-left: 2px solid var(--line); }
.side-toc li.open > .sub { display: block; }
.side-toc .sub a { font-size: 0.82rem; padding: 2px 8px; }
.toc-t { margin: 0 0 6px; font-weight: bold; color: var(--accent); font-size: 0.95rem; }
@media (min-width: 1180px) {
  .has-side-toc .site-header, .has-side-toc main, .has-side-toc .site-footer { margin-left: calc(50% - 520px); }
  .has-side-toc .topbar-inner { max-width: 1040px; }
  .side-toc { display: block; position: fixed; top: 72px; left: calc(50% + 220px); width: 280px; max-height: calc(100vh - 92px); overflow-y: auto; background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 10px; padding: 12px 12px; font-size: 0.9rem; }
}
@media (max-width: 1179px) {
  .toc-fab { display: block; position: fixed; right: 16px; bottom: 16px; z-index: 40; font: inherit; font-size: 0.9rem; font-weight: bold; padding: 8px 18px; border-radius: 999px; border: 1px solid var(--accent); background: var(--accent); color: var(--bg); box-shadow: 0 4px 12px rgba(0,0,0,.2); cursor: pointer; transition: box-shadow .12s; }
  .toc-fab:hover { box-shadow: 0 6px 18px rgba(0,0,0,.35); }
  .toc-sheet.open { display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; max-height: 70vh; overflow-y: auto; background: var(--card); border-top: 2px solid var(--accent); border-radius: 14px 14px 0 0; padding: 14px 16px 72px; box-shadow: 0 -6px 20px rgba(0,0,0,.2); }
  .toc-sheet ol { list-style: none; margin: 0; padding: 0; }
  .toc-sheet .now { color: var(--muted); font-size: 0.8rem; margin-left: 6px; font-weight: normal; }
}

/* 動画の一覧（/douga/） */
.video { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin: 16px 0; }
.video-embed { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 8px; background: #000; }
.video h3 { margin: 12px 0 2px; }
.video-meta { margin: 0; color: var(--muted); font-size: 0.85rem; }
.video-meta .platform { margin-left: 8px; }
.video-summary { margin: 6px 0 10px; }
.video .buy { margin: 0; }
a.btn-solid { background: var(--accent); color: var(--bg); font-weight: bold; padding: 4px 16px; font-size: 0.9rem; }
a.btn-solid:hover { opacity: 0.85; box-shadow: 0 2px 8px rgba(0,0,0,.25); }

/* LINE スタンプの枠（_stamp.html）と、辞書の項のスタンプの行 */
.stamp-box { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px 16px; margin: 24px 0; }
.stamp-box h2 { margin: 0; font-size: 1.1rem; border: 0; padding: 0; }
.stamp-meta { margin: 2px 0 10px; color: var(--muted); font-size: 0.85rem; }
.stamp-strip { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; text-decoration: none; margin-bottom: 10px; border-radius: 8px; transition: box-shadow .12s; }
.stamp-strip:hover { box-shadow: 0 2px 10px rgba(0,0,0,.18); }
.stamp-strip img { width: 100%; height: auto; display: block; }
@media (max-width: 600px) { .stamp-strip { grid-template-columns: repeat(3, 1fr); } }
.stamp-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 4px 0 12px; }
.stamp-row img { width: 111px; height: 96px; display: block; border-radius: 6px; transition: box-shadow .12s; }
.stamp-row a:hover img { box-shadow: 0 2px 8px rgba(0,0,0,.25); }

/* 押せるものはすべて指のカーソルにする */
a[href], button, .btn { cursor: pointer; }
.to-top { position: fixed; right: 16px; bottom: 16px; z-index: 40; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--accent); background: var(--bg); color: var(--accent); font: inherit; font-size: 1.2rem; font-weight: bold; cursor: pointer; box-shadow: 0 4px 12px rgba(0,0,0,.2); opacity: 0; visibility: hidden; transition: opacity .15s, box-shadow .12s, background-color .12s, color .12s; }
.to-top.show { opacity: 1; visibility: visible; }
.to-top:hover { background: var(--accent); color: var(--bg); box-shadow: 0 6px 18px rgba(0,0,0,.35); }
@media (max-width: 1179px) { .has-side-toc .to-top { bottom: 72px; } }
