/* ============================================================
   uravid - style.css
   ダーク＆ディープ基調（単一テーマ / 絵文字不使用・アイコンはSVG）
   ============================================================ */

:root {
  --bg: #050508;
  --bg-grad:
    radial-gradient(120% 60% at 50% -10%, rgba(138, 63, 252, 0.16) 0%, rgba(5, 5, 8, 0) 55%),
    radial-gradient(90% 50% at 85% 0%, rgba(255, 45, 85, 0.10) 0%, rgba(5, 5, 8, 0) 50%),
    linear-gradient(180deg, #0a0a12 0%, #050508 220px);
  --surface: #0c0c13;
  --surface-2: #14141f;
  --surface-3: #1d1d2b;
  --text: #f4f2f8;
  --muted: #9795a8;
  --border: #303044;
  --accent: #ff2d55;
  --accent-2: #8a3ffc;
  --accent-grad: linear-gradient(135deg, #ff2d55 0%, #c81d78 55%, #8a3ffc 130%);
  --accent-soft: rgba(255, 45, 85, 0.13);
  --badge-bg: rgba(0, 0, 0, 0.74);
  --badge-text: #ffffff;
  --skeleton-base: #12121b;
  --skeleton-shine: #1f1f2d;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.75);
  --header-bg: rgba(5, 5, 9, 0.88);
  --tabbar-bg: rgba(5, 5, 9, 0.92);
  color-scheme: dark;
}

/* ---------- ベース ---------- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { scroll-behavior: smooth; touch-action: manipulation; overscroll-behavior-y: none; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN",
    "Hiragino Sans", "Noto Sans JP", sans-serif;
  background: var(--bg);
  background-image: var(--bg-grad);
  background-repeat: no-repeat;
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: clip;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }

.pressable {
  transition: transform 0.12s ease, opacity 0.12s ease, background-color 0.2s ease;
  touch-action: manipulation;
}
.pressable:active { transform: scale(0.96); }

/* ---------- ボタン ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45em;
  padding: 0.85em 1.4em;
  border-radius: 14px;
  font-weight: 700;
  font-size: 0.95rem;
  border: 1px solid transparent;
}
.btn-icon { width: 1.05em; height: 1.05em; }
.btn-primary {
  background: var(--accent-grad);
  color: #fff;
  box-shadow: 0 8px 26px rgba(255, 45, 85, 0.32), 0 2px 8px rgba(0, 0, 0, 0.5);
}
.btn-ghost {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}
.btn-wide { width: 100%; margin-top: 0.6rem; }

/* ---------- 年齢確認ゲート ---------- */
.age-gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(2, 2, 5, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.age-gate[hidden] { display: none; }
.age-card {
  width: 100%;
  max-width: 420px;
  background: linear-gradient(180deg, #10101a 0%, var(--surface) 100%);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2rem 1.5rem 1.5rem;
  text-align: center;
  box-shadow: var(--shadow);
}
.age-logo, .logo {
  font-size: 1.9rem;
  font-weight: 900;
  letter-spacing: 0.02em;
}
.age-logo span, .logo span {
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.age-badge {
  display: inline-block;
  margin: 0.8rem 0 0.4rem;
  padding: 0.15em 0.7em;
  border: 2px solid var(--accent);
  color: var(--accent);
  border-radius: 8px;
  font-weight: 900;
}
.age-title { margin: 0.4rem 0 0.6rem; font-size: 1.25rem; }
.age-text { color: var(--muted); font-size: 0.9rem; margin: 0 0 1rem; }
.age-question { font-weight: 700; margin: 0 0 0.9rem; }
.age-buttons { display: flex; flex-direction: column; gap: 0.6rem; }
.age-note { color: var(--muted); font-size: 0.72rem; margin: 1rem 0 0; }

@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-7px); }
  40%, 60% { transform: translateX(7px); }
}
.shake { animation: shake 0.5s ease both; border-color: var(--accent) !important; }

/* ---------- ヘッダー ---------- */
/* ヘッダー＋検索バーを1つのstickyブロックにして、高さ計算なしで密着させる */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
}
.site-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 1rem;
  padding-top: calc(0.6rem + env(safe-area-inset-top));
  background: var(--header-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.site-header .logo { font-size: 1.45rem; }
.header-stats {
  margin-left: auto;
  display: flex;
  gap: 0.9rem;
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
}
.header-stats strong { color: var(--text); font-size: 0.95rem; margin-left: 0.2em; }

/* ---------- 検索バー ---------- */
.searchbar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.55rem 0.9rem;
  background: var(--header-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.search-icon { width: 18px; height: 18px; color: var(--muted); flex: none; margin-left: 0.7rem; position: absolute; }
.search-input {
  width: 100%;
  padding: 0.62rem 1rem 0.62rem 2.5rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 16px; /* 16px未満だとiOSがフォーカス時に自動ズームしてレイアウトがズレる */
  outline: none;
}
.search-input:focus { border-color: var(--accent); }
.search-input::placeholder { color: var(--muted); }

/* ---------- メインビュー ---------- */
.view {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.6rem 0.9rem 6.5rem;
}
@keyframes viewIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.view-enter { animation: viewIn 0.32s ease both; }

@keyframes blurIn {
  from { opacity: 0; filter: blur(10px); transform: translateY(4px); }
  to { opacity: 1; filter: blur(0); transform: translateY(0); }
}
.blur-in { animation: blurIn 0.55s ease both; }

.page-title {
  font-size: 1.35rem;
  font-weight: 900;
  margin: 0.4rem 0 0.2rem;
}
.page-sub { color: var(--muted); font-size: 0.85rem; margin: 0 0 1rem; }

/* ---------- 並び替えバー ---------- */
.sortbar {
  display: flex;
  gap: 0.45rem;
  margin: 0 0 1rem;
}
.sort-btn {
  padding: 0.42em 1em;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}
.sort-btn.active {
  background: var(--accent-grad);
  border-color: transparent;
  color: #fff;
}

/* ---------- 動画グリッド / カード ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem 0.7rem;
}
@media (min-width: 700px) {
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1000px) {
  .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.card { cursor: pointer; min-width: 0; }
.card-thumb-wrap {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--border);
  aspect-ratio: 16 / 9;
}
.card-thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}
.card:active .card-thumb { transform: scale(1.04); }
.duration-badge {
  position: absolute;
  right: 6px;
  top: 6px;
  padding: 0.1em 0.45em;
  border-radius: 6px;
  background: var(--badge-bg);
  color: var(--badge-text);
  font-size: 0.7rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.rank-badge {
  position: absolute;
  left: 6px;
  top: 6px;
  min-width: 1.7em;
  padding: 0.15em 0.4em;
  border-radius: 8px;
  background: var(--badge-bg);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 900;
  text-align: center;
}
.rank-1 { background: linear-gradient(135deg, #ffb340, #ff7847); }
.rank-2 { background: linear-gradient(135deg, #b8c4d4, #8494ab); }
.rank-3 { background: linear-gradient(135deg, #e09a6c, #b06a3b); }

.card-body { padding: 0.5rem 0.1rem 0; }
.card-title {
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.4;
  margin: 0 0 0.3rem;
  min-height: 2.47rem; /* 常に2行分の高さを確保してカードの大きさを揃える */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-meta {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.74rem;
}
.avatar-sm {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  flex: none;
  background: var(--surface-2);
}
.card-creator { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-views { margin-left: auto; flex: none; font-variant-numeric: tabular-nums; }

/* ---------- スケルトンスクリーン ---------- */
@keyframes shimmer {
  from { background-position: -400px 0; }
  to { background-position: 400px 0; }
}
.skeleton {
  border-radius: 8px;
  background: linear-gradient(90deg,
    var(--skeleton-base) 25%, var(--skeleton-shine) 50%, var(--skeleton-base) 75%);
  background-size: 800px 100%;
  animation: shimmer 1.3s infinite linear;
}
.skel-thumb { aspect-ratio: 16 / 9; border-radius: 14px; }
.skel-line { height: 0.85rem; margin-top: 0.5rem; }
.skel-line.short { width: 55%; }
.skel-row { display: flex; align-items: center; gap: 0.8rem; padding: 0.7rem 0; }
.skel-circle { width: 52px; height: 52px; border-radius: 50%; flex: none; }

/* ---------- クリエイター一覧 ---------- */
.creator-list { display: flex; flex-direction: column; }
.creator-row {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.75rem 0.4rem;
  border-bottom: 1px solid var(--border);
  border-radius: 10px;
}
.creator-row:active { background: var(--accent-soft); }
.creator-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-2);
  flex: none;
}
.creator-info { min-width: 0; flex: 1; }
.creator-name { font-weight: 800; font-size: 0.98rem; }
.creator-handle { color: var(--muted); font-size: 0.78rem; }
.creator-count {
  color: var(--muted);
  font-size: 0.78rem;
  flex: none;
  font-variant-numeric: tabular-nums;
  text-align: right;
  line-height: 1.5;
}
.creator-sub { font-size: 0.72rem; }

/* ---------- クリエイター一覧のタグ絞り込み ---------- */
.tag-filter {
  display: flex;
  gap: 0.45rem;
  overflow-x: auto;
  padding-bottom: 0.6rem;
  margin-bottom: 0.4rem;
  scrollbar-width: none;
}
.tag-filter::-webkit-scrollbar { display: none; }
.tag-filter .chip { flex: none; }
.chip.active {
  background: var(--accent-grad);
  border-color: transparent;
  color: #fff;
}

/* ---------- 動画カードの統計行 ---------- */
.card-stats-line {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-top: 0.28rem;
  color: var(--muted);
  font-size: 0.74rem;
  font-variant-numeric: tabular-nums;
}
.csl-views { color: var(--accent); font-weight: 800; font-size: 0.82rem; }
.card-stats-line .csl { display: inline-flex; align-items: center; gap: 0.25rem; }
.card-stats-line svg { width: 12px; height: 12px; }
.csl-date { margin-left: auto; flex: none; color: var(--text); opacity: 0.72; }
.stats-box strong { color: var(--accent); }

/* ---------- カードのハート（メタ行右端） ---------- */
.card-fav {
  position: static;
  margin-left: auto;
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
}
.card-fav svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }
.card-fav.active { color: var(--accent); }
.card-fav.active svg { fill: currentColor; }
.card-creator[data-creator-link] { cursor: pointer; }

/* ---------- 今見てる演出 ---------- */
.watching-now {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.78rem;
  margin: 0.55rem 0 0;
}
.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
  animation: live-pulse 1.6s ease-in-out infinite;
}
@keyframes live-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

/* ---------- クリエイターの勢いラベル ---------- */
.mom-label {
  font-size: 0.64rem;
  font-weight: 800;
  padding: 0.12em 0.55em;
  border-radius: 999px;
  margin-left: 0.45rem;
  vertical-align: middle;
  white-space: nowrap;
}
.mom-hot { background: var(--accent-grad); color: #fff; }
.mom-stop { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }

/* ---------- ホームのTop3ランキング ---------- */
.rank-list { display: flex; flex-direction: column; }
.rank-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.5rem 0.2rem;
  border-bottom: 1px solid var(--border);
  border-radius: 10px;
}
.rank-row:active { background: var(--accent-soft); }
.rank-num { font-weight: 900; font-size: 1.05rem; width: 1.4rem; text-align: center; color: var(--muted); flex: none; }
.rank-num.top { color: var(--accent); }
.rank-thumb { width: 86px; height: 48px; object-fit: cover; border-radius: 8px; flex: none; background: var(--surface-2); }
.rank-info { min-width: 0; }
.rank-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.35;
}
.rank-meta { color: var(--muted); font-size: 0.7rem; }

/* ---------- 空の状態 ---------- */
.empty-box { text-align: center; padding: 2rem 0; }
.empty-box .btn { display: inline-flex; margin-top: 0.7rem; }

/* ---------- クリエイターページのシェア ---------- */
.creator-share { display: flex; justify-content: center; width: 100%; margin: 0 0 0.8rem; }

/* ---------- 年齢確認後のおすすめ ---------- */
.age-reco {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  text-align: left;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.55rem 0.7rem;
  margin-bottom: 0.5rem;
  color: var(--text);
}
.age-reco img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex: none; }
.age-reco-name { font-weight: 800; font-size: 0.9rem; flex: 1; min-width: 0; }
.age-reco-fol { color: var(--muted); font-size: 0.72rem; flex: none; }
#age-enter { width: 100%; margin-top: 0.4rem; }

/* ---------- ホームの人気クリエイター行 ---------- */
.crow-track {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  padding: 0.2rem 0.1rem 0.6rem;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.crow-track::-webkit-scrollbar { display: none; }
.crow-item {
  flex: 0 0 76px;
  scroll-snap-align: start;
  text-align: center;
  color: var(--text);
}
.crow-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-2);
}
.crow-name {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 0.72rem;
  font-weight: 700;
  margin-top: 0.35rem;
  line-height: 1.3;
}
.crow-fol { display: block; color: var(--muted); font-size: 0.66rem; margin-top: 0.1rem; }
.tag {
  display: inline-block;
  padding: 0.08em 0.55em;
  margin-right: 0.3rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 700;
}

/* ---------- クリエイターページ ---------- */
.creator-head {
  display: flex;
  gap: 1rem;
  align-items: center;
  padding: 0.6rem 0 1rem;
}
.creator-head .creator-avatar { width: 92px; height: 92px; }
.creator-watch { display: flex; justify-content: center; margin: 0.6rem 0 0.3rem; }
.creator-pr { color: var(--muted); font-size: 0.7rem; text-align: center; margin: 0 0 0.6rem; }
.creator-bio { color: var(--muted); font-size: 0.85rem; margin: 0 0 1rem; }
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.4rem 0;
}

/* ---------- ハッシュタグ ---------- */
.chip {
  display: inline-block;
  padding: 0.45em 1em;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 700;
}
.chip:active { background: var(--accent-soft); }
.detail-tags { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.9rem 0 0.2rem; }

.tag-rank-list { display: flex; flex-direction: column; }
.tag-rank-row {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.8rem 0.4rem;
  border-bottom: 1px solid var(--border);
  border-radius: 10px;
}
.tag-rank-row:active { background: var(--accent-soft); }
.tag-rank-num {
  flex: none;
  width: 2em;
  text-align: center;
  font-weight: 900;
  font-size: 1.05rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.tag-rank-num.top { color: var(--accent); }
.tag-rank-name { font-weight: 800; font-size: 1rem; flex: 1; min-width: 0; }
.tag-rank-meta { color: var(--muted); font-size: 0.76rem; flex: none; text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- フッター ---------- */
.site-footer {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1rem 7rem;
  color: var(--muted);
  font-size: 0.72rem;
  text-align: center;
}
.site-footer p { margin: 0.3rem 0; }

/* ---------- 下部タブバー ---------- */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: flex;
  background: var(--tabbar-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 0.5rem 0 0.55rem;
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 700;
}
.tab-icon { width: 22px; height: 22px; }
.tab.active { color: var(--accent); }

/* ---------- 動画詳細オーバーレイ ---------- */
.detail {
  position: fixed;
  inset: 0;
  z-index: 60;
}
.detail[hidden] { display: none; }
.detail-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  animation: viewIn 0.25s ease both;
}
.detail-sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-width: 640px;
  margin: 0 auto;
  background: linear-gradient(180deg, #0e0e17 0%, var(--surface) 90px);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 22px 22px 0 0;
  box-shadow: var(--shadow);
  padding-bottom: calc(1.2rem + env(safe-area-inset-bottom));
  animation: sheetUp 0.32s cubic-bezier(0.32, 0.72, 0.24, 1) both;
  max-height: 94vh;
  max-height: 94dvh;
  overflow-y: auto;
}
@keyframes sheetUp {
  from { transform: translateY(48px); }
  to { transform: translateY(0); }
}
.detail-close {
  position: absolute;
  top: calc(env(safe-area-inset-top) + 10px);
  right: 12px;
  z-index: 5;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(10, 10, 16, 0.72);
  border: 1px solid var(--border);
  color: #fff;
  font-size: 1.05rem;
}
.detail-thumb-wrap {
  position: relative;
  background: #000;
  border-radius: 22px 22px 0 0;
  overflow: hidden;
  aspect-ratio: 16 / 9;
}
.detail-thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  view-transition-name: detail-thumb;
}
.detail-video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  background: #000;
}
.detail-video[hidden] { display: none; }
.detail-body { padding: 1rem 1.1rem 0; }
.detail-title { font-size: 1.08rem; font-weight: 800; margin: 0 0 0.4rem; line-height: 1.5; }
.detail-pr {
  color: var(--muted);
  font-size: 0.74rem;
  text-align: center;
  margin: 0.55rem 0 0;
}
.detail-creator-row {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-top: 1rem;
}
.detail-creator {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex: 1;
  min-width: 0;
}
.creator-avatar-sm {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-2);
  flex: none;
}
.detail-creator-text { display: flex; flex-direction: column; min-width: 0; }
#detail-creator-name { font-weight: 800; font-size: 0.98rem; }
.detail-creator-date { color: var(--muted); font-size: 0.78rem; }

.fav-btn {
  flex: none;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.fav-btn svg { width: 21px; height: 21px; }
.fav-btn.active {
  color: #fff;
  border-color: transparent;
  background: var(--accent-grad);
}
.fav-btn.active svg { fill: currentColor; }

.stats-box {
  display: flex;
  margin-top: 1rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}
.stat-cell {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 0.7rem 0.2rem;
}
.stat-cell + .stat-cell { border-left: 1px solid var(--border); }
.stat-cell strong { font-size: 1.02rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat-cell span { color: var(--muted); font-size: 0.72rem; }

.section-head {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin: 1.4rem 0 0.6rem;
}
.section-title { font-size: 0.98rem; font-weight: 800; margin: 0; flex: 1; min-width: 0; }
.section-more { color: var(--muted); font-size: 0.8rem; font-weight: 700; flex: none; }

/* 横スクロール動画行（他の動画・おすすめ） */
.hscroll {
  display: flex;
  gap: 0.6rem;
  overflow-x: auto;
  max-width: 100%;
  padding-bottom: 0.4rem;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.hscroll::-webkit-scrollbar { display: none; }
.mini-card {
  flex: none;
  width: 118px;
  cursor: pointer;
}
.mini-thumb-wrap {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 3 / 4;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.mini-thumb { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.mini-play {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  border: 1.5px solid rgba(255, 255, 255, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
}
.mini-play svg { width: 14px; height: 14px; color: #fff; margin-left: 2px; }
.mini-likes {
  position: absolute;
  left: 7px;
  bottom: 6px;
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
  font-variant-numeric: tabular-nums;
}
.mini-likes svg { width: 12px; height: 12px; fill: currentColor; }
.mini-title {
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.35;
  margin: 0.35rem 0 0;
  min-height: 1.95rem; /* 2行分を確保して大きさを揃える */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--muted);
}

/* 共有要素遷移（対応ブラウザのみ有効） */
::view-transition-old(detail-thumb),
::view-transition-new(detail-thumb) {
  animation-duration: 0.32s;
}

/* ---------- トースト ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(84px + env(safe-area-inset-bottom));
  transform: translate(-50%, 16px);
  z-index: 120;
  max-width: min(92vw, 480px);
  padding: 0.7rem 1.1rem;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font-size: 0.85rem;
  font-weight: 700;
  text-align: center;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--accent); color: #fff; }

/* ---------- その他 ---------- */
.empty {
  text-align: center;
  color: var(--muted);
  padding: 3rem 1rem;
  font-size: 0.9rem;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- 端末サイズ別の調整 ---------- */
/* 狭い画面（小型Android・旧iPhone等）: ヘッダーを詰めてはみ出しを防ぐ */
@media (max-width: 420px) {
  .site-header { gap: 0.6rem; padding-left: 0.8rem; padding-right: 0.8rem; }
  .site-header .logo { font-size: 1.25rem; }
  .header-stats { gap: 0.55rem; font-size: 0.7rem; }
  .header-stats strong { font-size: 0.85rem; }
  .view { padding-left: 0.7rem; padding-right: 0.7rem; }
  .grid { gap: 0.8rem 0.55rem; }
  .tab { font-size: 0.6rem; }
  .detail-body { padding: 0.9rem 0.9rem 0; }
}
/* PC・タブレット: 詳細シートを中央のカードとして浮かせる */
@media (min-width: 760px) {
  .detail-sheet {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: min(640px, calc(100vw - 48px));
    bottom: 24px;
    border-radius: 22px;
    border-bottom: 1px solid var(--border);
  }
  @keyframes sheetUp {
    from { transform: translate(-50%, 48px); }
    to { transform: translate(-50%, 0); }
  }
  .detail-thumb-wrap { border-radius: 22px 22px 0 0; }
}

/* ---------- 一覧プレビュー（MissAV式） ---------- */
button.tab { appearance: none; -webkit-appearance: none; border: 0; background: none; font: inherit; cursor: pointer; }
.thumb-play {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  border: 1.5px solid rgba(255, 255, 255, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  pointer-events: none;
}
.thumb-play svg { width: 16px; height: 16px; color: #fff; margin-left: 2px; }
.card-preview-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
  z-index: 2;
}
.card-thumb-wrap.previewing .thumb-play,
.card-thumb-wrap.previewing .duration-badge,
.card-thumb-wrap.previewing .rank-badge { display: none; }
.preview-chip {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
  background: var(--accent);
  color: #fff;
  font-size: 0.64rem;
  font-weight: 800;
  padding: 0.22em 0.65em;
  border-radius: 999px;
  letter-spacing: 0.04em;
}

/* ---------- リール（全画面の縦スワイプフィード） ---------- */
.reels {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: #000;
}
.reels[hidden] { display: none; }
.reels-track {
  height: 100%;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.reels-track::-webkit-scrollbar { display: none; }
.reel-slide {
  position: relative;
  height: 100%;
  height: 100dvh;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  background: #000;
  overflow: hidden;
}
.reel-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}
.reel-grad {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 48%;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.85));
  pointer-events: none;
}
.reel-info {
  position: absolute;
  left: 0;
  right: 84px;
  bottom: 0;
  padding: 1rem 0.6rem calc(1.35rem + env(safe-area-inset-bottom)) 1rem;
  color: #fff;
  box-sizing: border-box;
}
.reel-creator {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: #fff;
  font-weight: 800;
  font-size: 0.95rem;
}
.reel-creator img {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid rgba(255, 255, 255, 0.7);
  background: var(--surface-2);
}
.reel-title {
  margin: 0.55rem 0 0;
  font-size: 0.92rem;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.reel-tags { margin-top: 0.45rem; display: flex; gap: 0.4rem; flex-wrap: wrap; }
.reel-tag {
  font-size: 0.72rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.16);
  padding: 0.15em 0.6em;
  border-radius: 999px;
}
.reel-stats { margin-top: 0.45rem; color: rgba(255, 255, 255, 0.75); font-size: 0.74rem; }
.reel-watch-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.7rem;
}
.reel-watch {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.97rem;
  padding: 0.72rem 1.2rem;
  max-width: 100%;
  box-shadow: 0 4px 14px rgba(255, 45, 85, 0.28);
}
.reel-share {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.28);
  padding: 0.72rem 1rem;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.reel-share svg { width: 16px; height: 16px; fill: currentColor; }
.reel-pr { color: rgba(255, 255, 255, 0.6); font-size: 0.68rem; margin: 0.4rem 0 0; }
.reel-actions {
  position: absolute;
  right: 0.7rem;
  bottom: calc(4.6rem + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  align-items: center;
}
.reel-fav {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(20, 20, 28, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  cursor: pointer;
}
.reel-fav svg { width: 22px; height: 22px; fill: currentColor; }
.reel-fav span { font-size: 0.52rem; font-weight: 700; }
.reel-fav.active { background: var(--accent-grad); border-color: transparent; }
.reel-source {
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
  background: rgba(20, 20, 28, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 0.55em 0.8em;
  border-radius: 999px;
}
.reels-btn {
  position: absolute;
  top: calc(0.7rem + env(safe-area-inset-top));
  z-index: 2;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(20, 20, 28, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  cursor: pointer;
}
.reels-btn svg { width: 20px; height: 20px; }
.reels-close { left: 0.8rem; }
.reels-sound { right: 0.8rem; }
.reel-tap-flash {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  animation: reelFlash 0.55s ease both;
  z-index: 3;
}
.reel-tap-flash svg { width: 34px; height: 34px; }
@keyframes reelFlash {
  from { opacity: 0.95; transform: translate(-50%, -50%) scale(0.8); }
  to { opacity: 0; transform: translate(-50%, -50%) scale(1.25); }
}

/* ---------- FAPXX式カード（縦は縦長・横はワイド、統計はサムネイルに重ねる） ---------- */
.card-stats {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.1rem 0.55rem 0.4rem;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.72));
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  z-index: 1;
}
.card-stats .cs { display: inline-flex; align-items: center; gap: 0.3rem; }
.card-stats .cs svg { width: 13px; height: 13px; }
.card-portrait .card-thumb-wrap { aspect-ratio: 3 / 4; }
.card-plain .duration-badge { top: auto; bottom: 6px; }
.card-wide { grid-column: 1 / -1; }
.card-wide .card-title { font-size: 0.98rem; }
@media (min-width: 760px) {
  .card-wide { grid-column: span 2; }
}

/* ---------- 人気の横スクロール行 ---------- */
.hrow-head {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin: 1.3rem 0 0.6rem;
}
.hrow-more { color: var(--accent-2); font-size: 0.8rem; font-weight: 700; white-space: nowrap; }
.hrow-second { margin: 1.5rem 0 0.6rem; }
.hrow-track {
  display: flex;
  gap: 0.8rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0.2rem;
}
.hrow-track::-webkit-scrollbar { display: none; }
.hcard { flex: 0 0 76%; scroll-snap-align: start; }
.hcard.card-portrait { flex-basis: 54%; }
@media (min-width: 760px) {
  .hcard { flex-basis: 40%; }
  .hcard.card-portrait { flex-basis: 28%; }
}

/* ---------- 詳細: すぐ戻れる導線と縦動画 ---------- */
.sheet-handle {
  height: 26px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 8px;
  cursor: grab;
  touch-action: none;
}
.sheet-handle::before {
  content: '';
  width: 44px;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.35);
}
.detail-thumb-wrap.portrait {
  aspect-ratio: auto;
  height: min(58vh, 540px);
  height: min(58dvh, 540px);
}
.detail-thumb-wrap.portrait .detail-thumb { object-fit: contain; }
.detail-thumb-wrap.portrait .detail-video {
  aspect-ratio: auto;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ---------- リール: 縦動画は画面いっぱい ---------- */
.reel-video.fill { object-fit: cover; }

/* ---------- 人気表示: 縦動画も横動画と同じ枠にそろえる（ぼかし背景＋全体表示） ---------- */
.card-fit { grid-column: 1 / -1; }
@media (min-width: 760px) {
  .card-fit { grid-column: span 2; }
}
.hcard.card-fit { flex-basis: 76%; }
@media (min-width: 760px) {
  .hcard.card-fit { flex-basis: 40%; }
}
.card-thumb-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: blur(16px) brightness(0.55);
  transform: scale(1.15);
}
.card-fit .card-thumb { object-fit: contain; }
.card-fit .card-preview-video { object-fit: contain; background: transparent; }
.card-fitcell .card-thumb { object-fit: contain; }
.card-fitcell .card-preview-video { object-fit: contain; background: transparent; }

/* ---------- 下部タブのサイズ統一（リールだけボタン要素でズレていた） ---------- */
.tab {
  height: 54px;
  min-height: 0;
  justify-content: flex-start;
  padding: 7px 0 0;
  box-sizing: border-box;
  line-height: 1.15;
}
button.tab {
  margin: 0;
  padding: 7px 0 0;
  line-height: 1.15;
}
.tab-icon { display: block; flex: 0 0 auto; }
.tab-label { display: block; line-height: 1.25; }

/* ---------- 詳細: サムネイルに焼き込まれた白い縁を少しズームして隠す ---------- */
.detail-thumb {
  transform: scale(1.05);
}

/* ---------- 長いグリッドの描画を軽くする（画面外カードの描画スキップ） ---------- */
.grid .card { content-visibility: auto; contain-intrinsic-size: auto 240px; }
#grid-sentinel { height: 1px; }

/* ---------- 引っ張ってランダム: インジケーター ---------- */
#pull-indicator {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 10px);
  left: 50%;
  transform: translate(-50%, -90px);
  z-index: 400;
  background: rgba(20, 20, 28, 0.92);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  pointer-events: none;
  white-space: nowrap;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
#pull-indicator.ready {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ---------- リール: サムネイル被せ（黒画面防止） ---------- */
.reel-poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  z-index: 1;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.reel-poster.fill { object-fit: cover; }
.reel-poster.hide { opacity: 0; }
.reel-grad { z-index: 2; }
.reel-info { z-index: 3; }
.reel-actions { z-index: 3; }
