/* 百合ニュース — モバイルファースト。システムフォントのみ。 */
:root {
  --bg: #fbf8fa;
  --surface: #ffffff;
  --surface-2: #f3edf1;
  --text: #1f1a1d;
  --muted: #5e5459;
  --line: #e4dae0;
  --accent: #b02a63;
  --accent-ink: #ffffff;
  --accent-soft: #fbe3ee;
  --unread: #d6336c;
  --warn-bg: #fff4d6;
  --warn-ink: #5a4300;
  --err-bg: #fde2e2;
  --err-ink: #7a1414;
  --sens-bg: #f1eef6;
  --radius: 12px;
  --gutter: 16px;
  --tap: 44px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151214;
    --surface: #1f1b1e;
    --surface-2: #2a2428;
    --text: #f2ecef;
    --muted: #b7abb1;
    --line: #3a3237;
    --accent: #f07aa8;
    --accent-ink: #1a0b12;
    --accent-soft: #3d2030;
    --unread: #ff6b9a;
    --warn-bg: #3a3014;
    --warn-ink: #f4dc9a;
    --err-bg: #3f1b1b;
    --err-ink: #ffc9c9;
    --sens-bg: #221f29;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 64px; }
html.lb-open { overflow: hidden; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", Meiryo, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); }
h1, h2, h3, p { margin: 0; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.wrap {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
}
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 8px; top: 8px; z-index: 100; background: var(--surface); padding: 8px 12px; border-radius: 8px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  min-height: var(--tap); padding: 0 16px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--text);
  text-decoration: none; font-weight: 600; font-size: 15px;
  cursor: pointer; white-space: nowrap;
}
.btn:disabled { opacity: .6; cursor: progress; }

/* ---------- ヘッダー ---------- */
.site-header { padding: 20px 0 12px; }
.title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
h1 { font-size: 26px; letter-spacing: .02em; }
.updated { margin-top: 6px; color: var(--muted); font-size: 14px; }
.stale { margin-top: 6px; padding: 6px 10px; border-radius: 8px; background: var(--warn-bg); color: var(--warn-ink); font-size: 14px; }
.window { color: var(--muted); font-size: 14px; }
.window-note { margin-top: 2px; color: var(--muted); font-size: 13px; }
.window-note summary { cursor: pointer; min-height: 32px; display: inline-flex; align-items: center; }
.genre-counts { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 14px; color: var(--muted); }
.genre-counts b { color: var(--text); }

.banner { background: var(--err-bg); color: var(--err-ink); padding: 12px 0; }
.banner .wrap { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.banner p { flex: 1 1 240px; font-size: 14px; }

/* ---------- 見どころ ---------- */
.highlights { padding-top: 8px; padding-bottom: 8px; }
.highlights h2 { font-size: 18px; margin-bottom: 8px; }
.hl-row {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(220px, 72%);
  gap: 12px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x proximity;
  overscroll-behavior-x: contain;
}
.hl-row > .card { scroll-snap-align: start; }
@media (min-width: 720px) { .hl-row { grid-auto-columns: minmax(240px, 320px); } }
.hl-genre { font-size: 12px; color: var(--muted); }
.hl-label { font-size: 13px; font-weight: 700; color: var(--accent); }

/* ---------- 横スクロール（タブ・フィルタ） ---------- */
.scroll-x {
  display: flex; gap: 8px; overflow-x: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: none; padding: 4px 0;
}
.scroll-x::-webkit-scrollbar { display: none; }
.scroll-x > * { flex: 0 0 auto; }

.tabs-bar {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  padding: 6px 0;
}
.tab {
  position: relative;
  min-height: var(--tap); padding: 0 14px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 15px;
}
.tab .count { font-size: 13px; color: var(--muted); font-weight: 600; }
.tab[aria-selected="true"], .tab[aria-current="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.tab[aria-selected="true"] .count, .tab[aria-current="true"] .count { color: inherit; }
.tab.zero { color: var(--muted); }
.tab-unread { width: 8px; height: 8px; border-radius: 50%; background: var(--unread); }
.tab[aria-selected="true"] .tab-unread, .tab[aria-current="true"] .tab-unread { background: var(--accent-ink); }

.filters { padding-top: 10px; padding-bottom: 4px; display: grid; gap: 8px; }
.chip {
  min-height: 40px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 14px;
}
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--text); font-weight: 700; }
.chip[aria-pressed="true"]::before { content: "✓ "; }
.chip.ghost { border-style: dashed; }
.sep { width: 1px; background: var(--line); margin: 6px 2px; }
.search input {
  width: 100%; min-height: var(--tap); padding: 0 14px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--text);
  font-size: 16px; /* iOS で拡大されないよう 16px */
}

/* ---------- セクション ---------- */
#content { padding-top: 8px; padding-bottom: 24px; outline: none; }
.section { margin-top: 20px; }
.section > h2, .section > summary {
  display: flex; align-items: baseline; gap: 8px; font-size: 18px; font-weight: 700; margin-bottom: 10px;
}
.sec-count { font-size: 13px; color: var(--muted); font-weight: 600; }
.empty { padding: 32px 0; text-align: center; color: var(--muted); display: grid; gap: 12px; justify-items: center; }

.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
@media (min-width: 900px) { .section.news .list { grid-template-columns: 1fr 1fr; } }

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 600px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; } }
@media (min-width: 900px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* ---------- カード ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column; min-width: 0; height: 100%;
}
.card .body { padding: 10px 12px 12px; display: grid; gap: 4px; align-content: start; flex: 1; }
.card .title { font-size: 15px; font-weight: 600; line-height: 1.5; }
.card.unread .title { font-weight: 800; }
.unread-mark {
  display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--unread);
  margin-right: 6px; vertical-align: .1em;
}
.pairing { font-size: 13px; color: var(--accent); font-weight: 700; }
.note { font-size: 14px; color: var(--text); background: var(--surface-2); border-radius: 8px; padding: 4px 8px; }
.meta { display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: 13px; color: var(--muted); }
.post-link {
  display: inline-flex; align-items: center; min-height: var(--tap); margin-top: 2px;
  font-weight: 700; font-size: 14px; text-underline-offset: 3px;
}

.thumb {
  display: block; padding: 0; border: 0; margin: 0; background: var(--surface-2);
  cursor: zoom-in; width: 100%; aspect-ratio: 1 / 1; overflow: hidden;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }

/* 二次創作：画像なしはテキストカード */
.kind-art.no-image { background: var(--surface-2); }
.kind-art.no-image .body { padding-top: 14px; }

/* お知らせ：リストの行。画像があれば左に小さく */
.section.news .card.has-image { flex-direction: row; }
.section.news .card.has-image .thumb { width: 96px; flex: 0 0 96px; aspect-ratio: auto; min-height: 96px; }
@media (min-width: 600px) {
  .section.news .card.has-image .thumb { width: 140px; flex-basis: 140px; }
}

/* 見どころ：画像を横長に */
.hl-card .thumb { aspect-ratio: 16 / 10; }

/* センシティブ */
.section.sensitive { background: var(--sens-bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 0 12px; }
.section.sensitive > summary {
  cursor: pointer; list-style: none; min-height: 52px; align-items: center; margin: 0; font-size: 16px; padding: 8px 0;
}
.section.sensitive > summary .sec-title { flex: 1 1 auto; min-width: 0; }
.section.sensitive > summary .sec-count { flex: 0 0 auto; }
.section.sensitive > summary::-webkit-details-marker { display: none; }
.section.sensitive > summary::before { content: "▸"; color: var(--muted); }
.section.sensitive[open] > summary::before { content: "▾"; }
.section.sensitive[open] { padding-bottom: 12px; }
.warning { font-size: 14px; padding: 8px 10px; border-radius: 8px; background: var(--warn-bg); color: var(--warn-ink); margin-bottom: 10px; }

/* ---------- フッター ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 16px 0 calc(24px + env(safe-area-inset-bottom)); }
.site-footer .wrap { display: grid; gap: 12px; justify-items: start; }
.site-footer .tabs { width: 100%; }
.fine { font-size: 12px; color: var(--muted); }

/* ---------- ライトボックス ---------- */
.lightbox {
  width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  background: rgba(10, 6, 8, .94); color: #f5eff2;
}
.lightbox::backdrop { background: rgba(10, 6, 8, .94); }
.lb-inner { position: relative; height: 100%; display: flex; flex-direction: column; }
.lb-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 56px 8px 8px; position: relative; }
.lb-stage img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; }
.lb-error { color: #f5eff2; }
.lb-close {
  position: absolute; top: max(8px, env(safe-area-inset-top)); right: 8px; z-index: 2;
  width: var(--tap); height: var(--tap); border-radius: 50%; border: 0;
  background: rgba(255,255,255,.16); color: #fff; font-size: 26px; line-height: 1; cursor: pointer;
}
.lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  width: var(--tap); height: 64px; border: 0; border-radius: 10px;
  background: rgba(255,255,255,.14); color: #fff; font-size: 32px; cursor: pointer;
}
.lb-prev { left: 6px; }
.lb-next { right: 6px; }
.lb-caption {
  padding: 12px var(--gutter) calc(16px + env(safe-area-inset-bottom));
  display: grid; gap: 4px; max-width: 720px; width: 100%; margin: 0 auto;
}
.lb-count { font-size: 13px; color: #cbbfc5; }
.lb-title { font-weight: 700; }
.lb-meta { font-size: 14px; color: #d9ced3; }
.lb-caption .btn { justify-self: start; margin-top: 6px; background: #fff; color: #1f1a1d; border-color: #fff; }
