/* ホームページの見た目。外部のフォント・画像は使わない（端末のフォント）。色はライト・ダークの両方を定義する */
:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --text: #1f2328;
  --muted: #59616b;
  --line: #dcd8cf;
  --link: #0a58a8;
  --accent: #b4441c;
  --code-bg: #f0eee8;
  --focus: #0a58a8;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171a;
    --surface: #1d2024;
    --text: #e8e6e3;
    --muted: #a9aeb5;
    --line: #34383e;
    --link: #82b8f5;
    --accent: #f08a5d;
    --code-bg: #24272c;
    --focus: #82b8f5;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", "Meiryo", sans-serif;
  font-size: 17px;
  line-height: 1.8;
  overflow-wrap: anywhere;
}
a { color: var(--link); }
a:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
img { max-width: 100%; height: auto; }

.wrap {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
}

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 1; }

/* 上の帯: サイトの名前と、ブログ・このサイトについて・ゲーム（あるとき）へのリンク。狭い画面では折り返す */
.site-header { border-bottom: 1px solid var(--line); background: var(--surface); }
.header-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; column-gap: 8px; min-height: 56px; }
.site-name { color: var(--text); font-weight: 700; text-decoration: none; font-size: 18px; letter-spacing: 0.02em; padding: 10px 0; }
.site-header nav { display: flex; flex-wrap: wrap; gap: 4px; margin-right: -12px; }
.site-header nav a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px;
  color: var(--text); text-decoration: none; border-radius: 8px;
}
.site-header nav a:hover { background: var(--code-bg); }

main { padding-top: 24px; padding-bottom: 48px; }
h1 { font-size: 28px; line-height: 1.4; margin: 8px 0 16px; }
h2 { font-size: 22px; line-height: 1.4; margin: 40px 0 12px; }
h3 { font-size: 19px; margin: 28px 0 8px; }
h4, h5, h6 { font-size: 17px; margin: 24px 0 8px; }

/* トップページの先頭 */
.intro { padding: 16px 0 8px; }
.intro h1 { font-size: 34px; margin: 0; letter-spacing: 0.02em; }
.intro p { margin: 4px 0 0; }
.intro .tagline { color: var(--muted); }
.intro .intro-text { margin-top: 12px; }
.intro h1::after { content: ""; display: block; width: 48px; height: 4px; margin-top: 10px; background: var(--accent); border-radius: 2px; }

/* ゲームの一覧: 画像・名前・ひとこと。札全体がリンク */
.game-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.game {
  display: flex; flex-direction: column; height: 100%;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
  color: var(--text); text-decoration: none;
  transition: transform 0.15s ease;
}
.game img { display: block; width: 100%; aspect-ratio: 600 / 315; object-fit: cover; border-bottom: 1px solid var(--line); }
.game-name { font-weight: 700; font-size: 18px; padding: 12px 16px 0; }
.game-desc { color: var(--muted); font-size: 15px; padding: 2px 16px 14px; }
.game:hover .game-name { text-decoration: underline; }
.game:active { transform: scale(0.98); }
.game:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* 記事の一覧: 日付・題（一覧のページでは、本文の最初の部分も） */
.post-list { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line); }
.post-list li { border-bottom: 1px solid var(--line); }
.post-list a { display: flex; flex-direction: column; padding: 12px 4px; min-height: 44px; color: var(--text); text-decoration: none; }
.post-list a:hover .post-title { text-decoration: underline; }
.post-list time { color: var(--muted); font-size: 14px; }
.post-title { font-weight: 700; color: var(--link); }
.post-excerpt { color: var(--muted); font-size: 15px; margin-top: 2px; }
.empty { color: var(--muted); }
.more, .back { margin-top: 16px; }
.more a, .back a { display: inline-flex; align-items: center; min-height: 44px; }

/* 記事 */
.post-header { margin-bottom: 24px; }
.post-date { margin: 0; color: var(--muted); font-size: 14px; }
.post-header h1 { margin-top: 4px; margin-bottom: 4px; }
.post-author { margin: 0; color: var(--muted); font-size: 14px; }
.post-author a { display: inline-flex; align-items: center; min-height: 44px; }
.post-body > :first-child { margin-top: 0; }
.post-body p { margin: 0 0 1.2em; }
.post-body img { display: block; margin: 8px 0; border-radius: 8px; }
.post-body ul, .post-body ol { padding-left: 1.5em; margin: 0 0 1.2em; }
.post-body li + li { margin-top: 0.3em; }
.post-body li > ul, .post-body li > ol { margin: 0.3em 0 0; }
.post-body blockquote { margin: 0 0 1.2em; padding: 4px 16px; border-left: 4px solid var(--line); color: var(--muted); }
.post-body blockquote > :last-child { margin-bottom: 0; }
.post-body code { background: var(--code-bg); padding: 0.1em 0.35em; border-radius: 4px; font-size: 0.9em; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.post-body pre { background: var(--code-bg); padding: 12px 16px; border-radius: 8px; overflow-x: auto; line-height: 1.6; margin: 0 0 1.2em; }
.post-body pre code { background: none; padding: 0; font-size: 14px; overflow-wrap: normal; }
.post-body hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }

/* 記事の下の、前後の記事へのリンク */
.neighbors { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 40px; padding-top: 16px; border-top: 1px solid var(--line); }
.neighbors a { display: flex; flex-direction: column; min-height: 44px; padding: 8px 4px; text-decoration: none; }
.neighbors .newer { grid-column: 2; text-align: right; }
.neighbor-label { color: var(--muted); font-size: 14px; }
.neighbor-title { font-weight: 700; }
.neighbors a:hover .neighbor-title { text-decoration: underline; }

.site-footer { border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; padding: 20px 0 calc(20px + env(safe-area-inset-bottom)); }

@media (prefers-reduced-motion: reduce) {
  .game { transition: none; }
  .game:active { transform: none; }
}
