:root {
  --bg: #0b0b0f;
  --surface: #16161d;
  --surface2: #1f1f28;
  --text: #f2f2f5;
  --muted: #a7a7b3;
  --accent: #ff2e63;
  --accent2: #ff7a9e;
  --border: #2a2a35;
  --nav-h: 56px;
  --header-h: 52px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", sans-serif;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--accent2); }
h2 { font-size: 1.15rem; margin: 0.6em 0 0.8em; }
h3 { font-size: 1rem; margin: 1.2em 0 0.5em; }

/* ロゴ */
.logo { font-size: 2rem; font-weight: 800; letter-spacing: 0.02em; }
.logo span { color: var(--accent); }
.logo.small { font-size: 1.25rem; }

/* 年齢ゲート */
.age-gate {
  position: fixed; inset: 0; z-index: 100;
  background: radial-gradient(120% 100% at 50% 0%, #241019 0%, var(--bg) 60%);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.age-gate[hidden] { display: none; }
.age-card { max-width: 420px; width: 100%; text-align: center; }
.age-card h1 { font-size: 1.3rem; margin: 18px 0 10px; }
.age-card p { color: var(--muted); line-height: 1.7; font-size: 0.92rem; }
.age-links { margin-top: 18px; font-size: 0.8rem; }

/* ボタン */
.btn-primary {
  display: block; width: 100%; margin: 14px 0 8px; padding: 14px;
  background: var(--accent); color: #fff; border: 0; border-radius: 999px;
  font-size: 1rem; font-weight: 700; cursor: pointer;
}
.btn-primary:active { opacity: 0.85; }
.btn-ghost {
  display: block; width: 100%; margin: 8px 0; padding: 12px;
  background: transparent; color: var(--muted); border: 1px solid var(--border);
  border-radius: 999px; font-size: 0.92rem; cursor: pointer;
}
.icon-btn {
  background: var(--surface2); color: var(--text); border: 1px solid var(--border);
  width: 38px; height: 38px; border-radius: 50%; font-size: 1rem; cursor: pointer;
}

/* ヘッダー */
.app-header {
  position: fixed; top: 0; left: 0; right: 0; height: var(--header-h); z-index: 40;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 14px; padding-top: env(safe-area-inset-top);
  background: rgba(11, 11, 15, 0.82); backdrop-filter: blur(10px);
}
.header-actions { display: flex; gap: 8px; }
main { padding-top: var(--header-h); }
.view.pad { padding: 12px 14px 30px; max-width: 720px; margin: 0 auto; }

/* フィード */
.feed-toolbar {
  position: sticky; top: var(--header-h); z-index: 30;
  display: flex; gap: 8px; padding: 8px 12px;
  background: rgba(11, 11, 15, 0.85); backdrop-filter: blur(8px);
}
.feed-toolbar select {
  flex: 1; min-width: 0; background: var(--surface2); color: var(--text);
  border: 1px solid var(--border); border-radius: 999px; padding: 8px 10px; font-size: 0.85rem;
}
.feed-progress { height: 3px; background: var(--surface2); position: sticky; top: calc(var(--header-h) + 49px); z-index: 30; }
.feed-progress > div { height: 100%; width: 0%; background: var(--accent); transition: width 0.2s; }
.feed {
  height: calc(100dvh - var(--header-h) - var(--nav-h) - 52px);
  overflow-y: auto; scroll-snap-type: y mandatory; overscroll-behavior: contain;
}
.card {
  position: relative; height: 100%; scroll-snap-align: start; scroll-snap-stop: always;
  display: flex; flex-direction: column; background: #000; overflow: hidden;
  animation: cardIn 0.35s ease;
}
@keyframes cardIn { from { opacity: 0.4; transform: scale(0.99); } to { opacity: 1; transform: none; } }
.card-media { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; background: #000; }
.card-media img { width: 100%; height: 100%; object-fit: contain; display: block; }
.card-media video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.card-actions {
  position: absolute; right: 10px; bottom: 12px; display: flex; flex-direction: column; gap: 12px; z-index: 3;
}
.card-actions button {
  width: 48px; height: 48px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(30, 30, 40, 0.8); color: #fff; font-size: 1.25rem; line-height: 1;
}
.card-actions button.active { color: var(--accent); }
.card-actions button small { display: block; font-size: 0.55rem; color: var(--muted); margin-top: 2px; }
.card-info { padding: 12px 14px 16px; background: linear-gradient(180deg, #101016, #0b0b0f); }
.card-info h3 { margin: 0 0 6px; font-size: 1rem; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.meta { color: var(--muted); font-size: 0.8rem; display: flex; flex-wrap: wrap; gap: 8px; }
.price { color: var(--accent2); font-weight: 700; }
.rating { color: #ffd166; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag {
  background: var(--surface2); color: var(--text); border: 1px solid var(--border);
  border-radius: 999px; padding: 4px 10px; font-size: 0.72rem; cursor: pointer;
}
.btn-fanza {
  display: block; text-align: center; margin-top: 12px; padding: 13px;
  background: var(--accent); color: #fff; border-radius: 999px; font-weight: 700;
  text-decoration: none; font-size: 0.95rem;
}

/* スケルトン / 状態表示 */
.skeleton { height: 100%; min-height: 320px; background: linear-gradient(100deg, #14141b 40%, #1d1d27 50%, #14141b 60%); background-size: 200% 100%; animation: sk 1.2s infinite; }
@keyframes sk { from { background-position: 120% 0; } to { background-position: -80% 0; } }
.state-box { padding: 48px 22px; text-align: center; color: var(--muted); line-height: 1.8; }
.state-box h3 { color: var(--text); }
.state-box .btn-primary { max-width: 320px; margin-left: auto; margin-right: auto; }
.feed-sentinel { height: 2px; }

/* グリッド / リスト */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 12px; }
@media (min-width: 560px) { .grid { grid-template-columns: repeat(3, 1fr); } }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; cursor: pointer; }
.tile img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; background: #000; }
.tile .t-body { padding: 8px 10px 10px; }
.tile .t-title { font-size: 0.82rem; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile .t-meta { color: var(--muted); font-size: 0.72rem; margin-top: 4px; }
.list { display: flex; flex-direction: column; gap: 10px; }
.rank-row { display: flex; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 8px; cursor: pointer; }
.rank-no { font-size: 1.3rem; font-weight: 800; color: var(--accent); width: 2em; text-align: center; flex: none; }
.rank-row img { width: 96px; height: 72px; object-fit: cover; border-radius: 8px; background: #000; flex: none; }
.rank-row .r-title { font-size: 0.88rem; line-height: 1.45; }
.rank-row .r-meta { color: var(--muted); font-size: 0.74rem; }

/* 探す */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs button {
  background: var(--surface2); color: var(--muted); border: 1px solid var(--border);
  border-radius: 999px; padding: 8px 14px; font-size: 0.85rem; cursor: pointer;
}
.tabs button.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.chip-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chip-list .tag { font-size: 0.82rem; padding: 7px 13px; }

/* 検索 */
.search-form { display: flex; gap: 8px; }
.search-form input {
  flex: 1; min-width: 0; background: var(--surface2); border: 1px solid var(--border);
  border-radius: 999px; padding: 12px 16px; color: var(--text); font-size: 0.95rem;
}
.search-form .btn-primary { width: auto; margin: 0; padding: 12px 22px; }

/* 詳細シート */
.sheet { position: fixed; inset: 0; z-index: 90; }
.sheet[hidden] { display: none; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.6); }
.sheet-body {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 88dvh; overflow-y: auto;
  background: var(--surface); border-radius: 18px 18px 0 0; padding: 18px 16px calc(20px + env(safe-area-inset-bottom));
  animation: sheetUp 0.25s ease; max-width: 720px; margin: 0 auto;
}
@keyframes sheetUp { from { transform: translateY(30px); opacity: 0.5; } to { transform: none; opacity: 1; } }
.sheet-close { position: absolute; top: 10px; right: 12px; background: var(--surface2); color: var(--text); border: 0; width: 34px; height: 34px; border-radius: 50%; cursor: pointer; z-index: 2; }
.sheet-body img.hero { width: 100%; border-radius: 12px; display: block; background: #000; }
.sheet-body video { width: 100%; border-radius: 12px; background: #000; margin-top: 10px; }
.sheet-body h3 { font-size: 1.05rem; line-height: 1.5; margin: 12px 0 6px; }
.desc { color: var(--muted); font-size: 0.86rem; line-height: 1.7; white-space: pre-wrap; }
.sample-imgs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 10px; }
.sample-imgs img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; background: #000; }
.sheet-actions { display: flex; gap: 8px; margin-top: 12px; }
.sheet-actions .btn-ghost { margin: 0; }

/* 設定 */
.settings-form label { display: block; margin: 10px 0; font-size: 0.9rem; color: var(--muted); }
.settings-form input[type="text"], .settings-form input[type="email"] {
  display: block; width: 100%; margin-top: 6px; background: var(--surface2);
  border: 1px solid var(--border); border-radius: 10px; padding: 12px; color: var(--text); font-size: 0.95rem;
}
.settings-form label.check { display: flex; gap: 8px; align-items: center; color: var(--text); }
.hint { color: var(--muted); font-size: 0.8rem; line-height: 1.6; }
.test-result { font-size: 0.88rem; min-height: 1.2em; }
.test-result.ok { color: #5fd68b; }
.test-result.ng { color: #ff6b81; }

/* 情報ページ */
.doc p, .doc dd { color: var(--muted); line-height: 1.8; font-size: 0.92rem; }
.doc dt { color: var(--text); font-weight: 700; margin-top: 10px; }
.doc dd { margin: 2px 0 0; }

/* フッター / ナビ */
.site-footer { padding: 26px 16px 20px; text-align: center; border-top: 1px solid var(--border); margin-top: 10px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: center; margin-bottom: 12px; }
.footer-links a { color: var(--muted); font-size: 0.8rem; text-decoration: none; }
.credit { color: var(--muted); font-size: 0.72rem; line-height: 1.6; }
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom); z-index: 50;
  display: flex; background: rgba(15, 15, 20, 0.95); backdrop-filter: blur(10px); border-top: 1px solid var(--border);
}
.bottom-nav button {
  flex: 1; background: none; border: 0; color: var(--muted); font-size: 1.05rem;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; cursor: pointer;
}
.bottom-nav button span { font-size: 0.62rem; }
.bottom-nav button.active { color: var(--accent); }
