:root {
  --bg: #0b0b0c;
  --surface: #1c1c1f;
  --text: #f5f5f7;
  --muted: #b8b8be;
  --accent: #ff3b6b;
  --accent-text: #ffffff;
  --chip-on-bg: #f5f5f7;
  --chip-on-text: #0b0b0c;
  --radius: 999px;
  --tap: 48px;
  --topbar: 100px;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); overflow: hidden; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 10;
  padding: env(safe-area-inset-top) 0 0;
  background: linear-gradient(var(--bg), transparent);
}
.sorts { display: flex; justify-content: center; gap: 4px; padding: 4px 16px 0; }
.sort {
  min-height: 44px; padding: 0 12px; border: 0; background: none; cursor: pointer;
  color: var(--muted); font-size: 16px; font-weight: 700; border-bottom: 3px solid transparent;
}
.sort[aria-pressed="true"] { color: var(--text); border-bottom-color: var(--text); }
.chips {
  display: flex; gap: 8px; overflow-x: auto; padding: 4px 16px 8px;
  scrollbar-width: none; align-items: center;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; min-height: 40px; padding: 0 16px; border-radius: var(--radius);
  border: 0; background: var(--surface); color: var(--text); font-size: 14px; font-weight: 600;
}
.chip[aria-pressed="true"] { background: var(--chip-on-bg); color: var(--chip-on-text); }

.feed {
  height: 100dvh; overflow-y: auto; scroll-snap-type: y mandatory;
  overscroll-behavior: contain; scrollbar-width: none;
}
.feed::-webkit-scrollbar { display: none; }
.slide {
  position: relative; height: 100dvh; scroll-snap-align: start; scroll-snap-stop: always;
  display: flex; align-items: center; justify-content: center;
}
.stage { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.stage img, .stage video { width: 100%; height: 100%; object-fit: contain; background: var(--bg); }
.stage img:not([src]) { visibility: hidden; }
.play {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 80px; height: 80px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(11, 11, 12, .6); display: grid; place-items: center;
}
.play svg { width: 40px; height: 40px; fill: var(--text); margin-left: 4px; }
.slide.playing .play { display: none; }
.slide.playing .meta { pointer-events: none; background: none; }
.slide.playing .meta .cta { pointer-events: auto; }
.caption { font-size: 13px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.placeholder { color: var(--muted); font-size: 14px; }

.actions {
  position: absolute; right: 8px; bottom: 180px;
  display: flex; flex-direction: column; gap: 16px;
}
.act {
  width: 56px; min-height: var(--tap); display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: none; border: 0; color: var(--text); font-size: 11px; text-decoration: none; cursor: pointer;
}
.act svg { width: 30px; height: 30px; fill: var(--text); }
.act.fav[aria-pressed="true"] svg { fill: var(--accent); }

.meta {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 0 16px calc(16px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, var(--bg) 40%);
}
.meta p { margin: 0 0 6px; padding-right: 72px; } /* 右の操作ボタン列を避ける */
.creator { font-weight: 700; font-size: 16px; }
.tags { color: var(--muted); font-size: 13px; }
.cta {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); margin-top: 8px; border-radius: 12px;
  background: var(--accent); color: var(--accent-text); font-weight: 700; text-decoration: none;
}
.cta small { font-size: 10px; border: 1px solid var(--accent-text); border-radius: 4px; padding: 0 4px; }
.cta[hidden], .cta small[hidden], .cta-sub[hidden] { display: none; }
.cta-sub {
  display: flex; align-items: center; justify-content: center; min-height: var(--tap);
  color: var(--text); font-size: 14px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px;
}

.empty { height: 100dvh; display: grid; place-items: center; padding: 16px; text-align: center; color: var(--muted); }

.gate { position: fixed; inset: 0; z-index: 50; background: var(--bg); display: grid; place-items: center; padding: 16px; }
.gate[hidden] { display: none; }
.gate-card { width: 100%; max-width: 360px; text-align: center; }
.gate-card h1 { font-size: 22px; margin: 0 0 8px; }
.gate-card p { color: var(--muted); margin: 0 0 24px; }
.gate-actions { display: grid; gap: 12px; }
.btn {
  min-height: var(--tap); display: flex; align-items: center; justify-content: center;
  border-radius: 12px; border: 0; background: var(--surface); color: var(--text);
  font-size: 16px; font-weight: 700; text-decoration: none; cursor: pointer;
}
.btn.primary { background: var(--accent); color: var(--accent-text); }

.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;
}
.menu-link {
  position: absolute; right: 8px; top: calc(4px + env(safe-area-inset-top));
  width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px;
}
.menu-link svg { width: 24px; height: 24px; fill: var(--text); }
.gate-card .gate-title { font-size: 22px; font-weight: 700; margin: 0 0 8px; color: var(--text); }
.gate-card .gate-links { margin: 16px 0 0; font-size: 13px; }
.gate-links a { color: var(--muted); display: inline-flex; align-items: center; min-height: var(--tap); }
.meta .cta-note { margin: 6px 0 0; padding-right: 0; color: var(--muted); font-size: 12px; text-align: center; }
.cta-note[hidden] { display: none; }
