:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --text: #1f2430;
  --muted: #5d6578;
  --line: #e2e5ee;
  --accent: #2b6fe0;
  --accent-text: #ffffff;
  --shadow: 0 4px 18px rgba(30, 40, 80, 0.07);
  --radius: 16px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12141a;
    --surface: #1b1e27;
    --text: #e8eaf1;
    --muted: #a0a7b8;
    --line: #2c3040;
    --accent: #6ea0ff;
    --accent-text: #0e1220;
    --shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Hiragino Sans", "Yu Gothic UI", "Meiryo", sans-serif;
  line-height: 1.8;
  word-break: auto-phrase;
  overflow-wrap: anywhere;
  line-break: strict;
}
h1, h2, h3, .lead, .site-title { text-wrap: balance; }
.ph { display: inline-block; }
a { color: var(--accent); }
a:focus-visible, button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

/* ヘッダー・フッター */
.site-header { border-bottom: 1px solid var(--line); background: var(--surface); }
.site-header .wrap { padding-top: 18px; padding-bottom: 18px; }
.site-title { margin: 0; font-size: 1.35rem; line-height: 1.4; }
.site-title a { color: var(--text); text-decoration: none; }
.site-footer { margin-top: 72px; padding: 32px 0 40px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.9rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 0 0 12px; padding: 0; list-style: none; }
.footer-links a { white-space: nowrap; }
.copy { margin: 0; }

/* トップ */
.intro { padding: 48px 0 28px; }
.intro h2 { margin: 0 0 10px; font-size: 1.9rem; line-height: 1.4; }
.lead { margin: 0; color: var(--muted); max-width: 40em; }
.grid { display: grid; grid-template-columns: 1fr; gap: 24px; padding: 0; margin: 0; list-style: none; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .grid { grid-template-columns: repeat(3, 1fr); } }
.card {
  display: flex; flex-direction: column; min-width: 0;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.card .thumb-box { aspect-ratio: 16 / 9; background: var(--line); }
.card img.thumb { display: block; width: 100%; height: 100%; object-fit: cover; }
.thumb-ph {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  padding: 12px; text-align: center; font-weight: 700; color: var(--muted);
  background: repeating-linear-gradient(135deg, var(--surface), var(--surface) 12px, var(--line) 12px, var(--line) 24px);
}
.thumb-ph span { background: var(--surface); padding: 4px 12px; border-radius: 10px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-body { display: flex; flex-direction: column; gap: 10px; padding: 18px 20px 20px; flex: 1; min-width: 0; }
.card-title { margin: 0; font-size: 1.1rem; line-height: 1.5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.genre { align-self: flex-start; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 0.78rem; padding: 1px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.desc { margin: 0; color: var(--muted); font-size: 0.93rem; flex: 1; }
.btn {
  display: inline-block; align-self: flex-start; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
  padding: 8px 22px; border-radius: 999px; border: 1px solid var(--accent);
  background: var(--accent); color: var(--accent-text); line-height: 1.6;
}
.btn:hover { filter: brightness(1.08); }
.btn[disabled], .btn.disabled { cursor: not-allowed; background: transparent; color: var(--muted); border-color: var(--line); filter: none; }
.empty { padding: 48px 20px; text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }

/* 規約ページ */
.prose { padding: 40px 0 0; max-width: 46em; }
.prose h2 { font-size: 1.6rem; margin: 0 0 20px; line-height: 1.4; }
.prose h3 { font-size: 1.1rem; margin: 32px 0 6px; }
.prose p, .prose li { color: var(--text); }
.prose ul { padding-left: 1.4em; }
.updated { margin-top: 40px; color: var(--muted); font-size: 0.9rem; }

/* play.html */
body.play { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.playbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: nowrap;
  padding: 8px 12px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.playbar .back, .playbar .tool { white-space: nowrap; font-size: 0.9rem; flex: none; }
.playbar .play-title { flex: 1; min-width: 0; margin: 0; font-size: 1rem; line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; }
.tool {
  font: inherit; color: var(--text); background: transparent; border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 12px; cursor: pointer; text-decoration: none;
}
.tool:hover { border-color: var(--accent); }
.tool[hidden] { display: none; }
.fallback { padding: 3px 12px; font-size: 0.78rem; color: var(--muted); background: var(--bg); border-bottom: 1px solid var(--line); }
.fallback.warn { color: var(--text); background: rgba(255, 190, 40, 0.25); }
.stage { flex: 1; min-height: 0; position: relative; background: #000; }
.stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #fff; }
.message { max-width: 32em; margin: 12vh auto 0; padding: 0 20px; text-align: center; overflow: auto; }
.message[hidden], .stage[hidden], .fallback[hidden] { display: none; }
@media (max-width: 520px) {
  .playbar { gap: 6px; padding: 6px 8px; }
  .playbar .tool, .playbar .back { font-size: 0.8rem; padding: 3px 8px; }
  .playbar .play-title { font-size: 0.9rem; }
}
