/* ===== Tokens ===== */
:root {
  --bg: #1b181d;          /* ほんのり紫がかった夜色 */
  --surface: #252127;
  --surface-2: #302b33;
  --line: #3d3741;
  --text: #f4eff3;
  --muted: #a39aa6;
  --red: #e8364e;         /* ブランドアクセント（FANZA寄りの赤） */
  --red-hi: #ff5a70;
  --face: #ff6b81;        /* 顔スコア */
  --type: #b9a2ff;        /* タイプスコア */

  --font-display: "Dela Gothic One", "Hiragino Sans", "Yu Gothic", sans-serif;
  --font-body: "Zen Kaku Gothic New", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;

  --r-card: 14px;
  --r-ctrl: 10px;
  --pad: clamp(16px, 4vw, 40px);
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--red-hi); outline-offset: 2px; }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 12px; top: 12px; z-index: 100; background: var(--red); padding: 6px 12px; border-radius: 8px; }

/* ===== Header ===== */
.site-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 20px;
  padding: 10px var(--pad);
  background: rgb(27 24 29 / .86);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.logo {
  font-family: var(--font-display);
  font-size: 22px; letter-spacing: .02em;
  text-decoration: none; white-space: nowrap;
  display: flex; align-items: center; gap: 8px;
}
.logo::before {
  content: ""; width: 12px; height: 12px; border-radius: 4px;
  background: var(--red);
}
.header-search { flex: 1; max-width: 420px; margin-left: auto; }
[data-page="home"] .header-search { visibility: hidden; }

/* ===== Search ===== */
.search { position: relative; }
.search input {
  width: 100%;
  font: inherit; color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 18px 9px 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23a39aa6' stroke-width='2'%3E%3Ccircle cx='7' cy='7' r='5.5'/%3E%3Cpath d='m11 11 4 4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 16px 50%;
}
.search input::placeholder { color: var(--muted); }
.search input:focus { outline: none; border-color: var(--red); }
.suggest {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px);
  list-style: none; margin: 0; padding: 6px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-ctrl);
  box-shadow: 0 18px 40px rgb(0 0 0 / .45);
  z-index: 30;
}
.suggest li {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px; border-radius: 8px; cursor: pointer;
}
.suggest li[aria-selected="true"], .suggest li[data-id]:hover { background: var(--line); }
.suggest img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: var(--bg); }
.suggest small { display: block; color: var(--muted); font-size: 12px; line-height: 1.3; }
.suggest .empty { color: var(--muted); cursor: default; font-size: 13px; }

/* ===== Main ===== */
.site-main { flex: 1; width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 var(--pad) 64px; }
.site-main:focus { outline: none; }

/* ===== Home ===== */
.hero { padding: clamp(40px, 9vw, 96px) 0 clamp(32px, 6vw, 56px); max-width: 720px; }
.hero-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(44px, 9vw, 88px);
  line-height: 1.12;
  margin: 0 0 20px;
  letter-spacing: -.01em;
}
.hero-title .dot { color: var(--red); }
.hero-lead { color: var(--muted); margin: 0 0 28px; max-width: 34em; }
.hero .search input { font-size: 17px; padding: 15px 22px 15px 48px; background-position: 20px 50%; }
.hero-meta { color: var(--muted); font-size: 13px; margin: 14px 0 0 4px; }

.shelf { margin-top: 48px; }
.shelf-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.shelf-head h2 { font-size: 18px; margin: 0; font-weight: 700; }

/* ===== Grid & cards ===== */
.grid {
  list-style: none; margin: 0; padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 18px 14px;
}
.card a { display: block; text-decoration: none; }
.thumb {
  aspect-ratio: 1;
  border-radius: var(--r-card);
  overflow: hidden;
  background: var(--surface);
  position: relative;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s var(--ease); }
.card a:hover .thumb img { transform: scale(1.04); }
.card-name { display: block; margin-top: 8px; font-weight: 500; line-height: 1.4; }
.card-sub { display: block; color: var(--muted); font-size: 12px; }
img.broken { visibility: hidden; }

/* 類似カード: スコア表示 */
.card-score {
  position: absolute; right: 8px; bottom: 8px;
  font-family: var(--font-display);
  font-size: 20px; line-height: 1;
  padding: 6px 9px 5px;
  border-radius: 9px;
  background: rgb(27 24 29 / .82);
  backdrop-filter: blur(6px);
}
.meter { display: grid; gap: 4px; margin-top: 6px; }
.meter-row { display: grid; grid-template-columns: 3.2em 1fr; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); }
.meter-bar { height: 4px; border-radius: 2px; background: var(--surface-2); overflow: hidden; }
.meter-bar i { display: block; height: 100%; width: calc(var(--v) * 1%); border-radius: inherit; transition: width .35s var(--ease); }
.meter-face i { background: var(--face); }
.meter-type i { background: var(--type); }
.meter-na { opacity: .45; }

/* ===== Detail ===== */
.detail {
  display: grid;
  grid-template-columns: minmax(240px, 300px) 1fr;
  gap: clamp(24px, 4vw, 56px);
  padding-top: 32px;
  align-items: start;
}
.profile { display: grid; gap: 0; }
.profile-photo {
  aspect-ratio: 1;
  border-radius: 20px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--line);
}
.profile-photo img { width: 100%; height: 100%; object-fit: cover; }
.profile-name {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(28px, 4vw, 38px);
  line-height: 1.2;
  margin: 20px 0 2px;
}
.profile-ruby { color: var(--muted); margin: 0 0 14px; font-size: 13px; }
.profile-latest { color: var(--muted); font-size: 13px; margin: 12px 0 18px; }
.tags { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tags li { font-size: 12px; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); color: var(--text); }

.btn-primary, .btn-ghost {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-ctrl);
  padding: 11px 18px;
  font-weight: 700; text-decoration: none; cursor: pointer;
  border: 1px solid transparent;
  transition: background .2s, border-color .2s;
}
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-hi); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--text); font-weight: 500; padding: 7px 14px; }
.btn-ghost:hover { border-color: var(--muted); }
.profile .btn-primary { width: 100%; }

.results-head h2 { font-size: 20px; margin: 0 0 4px; }
.results-head p { margin: 0; color: var(--muted); font-size: 13px; }

/* ブレンドスライダー（このサイトの主役） */
.blend {
  margin: 20px 0 16px;
  padding: 18px 20px 16px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.blend-labels { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.blend-labels span { font-size: 13px; color: var(--muted); }
.blend-labels b { font-family: var(--font-display); font-weight: 400; font-size: 26px; margin: 0 4px; }
.lbl-type b { color: var(--type); }
.lbl-face b { color: var(--face); }
.blend input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 28px; background: transparent; margin: 0; cursor: pointer;
}
.blend input[type="range"]::-webkit-slider-runnable-track {
  height: 8px; border-radius: 4px;
  background: linear-gradient(90deg, var(--type), var(--face));
}
.blend input[type="range"]::-moz-range-track {
  height: 8px; border-radius: 4px;
  background: linear-gradient(90deg, var(--type), var(--face));
}
.blend input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 26px; height: 26px; margin-top: -9px; border-radius: 50%;
  background: #fff; border: 5px solid var(--bg);
  box-shadow: 0 0 0 2px #fff, 0 4px 14px rgb(0 0 0 / .5);
}
.blend input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff; border: 5px solid var(--bg);
  box-shadow: 0 0 0 2px #fff, 0 4px 14px rgb(0 0 0 / .5);
}
.blend input:disabled { opacity: .35; cursor: not-allowed; }
.presets { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.presets button {
  background: var(--surface-2); border: 1px solid transparent;
  border-radius: 999px; padding: 4px 14px; font-size: 13px; cursor: pointer;
}
.presets button[aria-pressed="true"] { border-color: var(--text); }
.blend-note { margin: 10px 0 0; font-size: 12px; color: var(--muted); }

.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 20px; }
.filters-label { font-size: 13px; color: var(--muted); margin: 0 4px 0 8px; }
.chip {
  background: transparent; border: 1px solid var(--line);
  border-radius: 999px; padding: 3px 12px; font-size: 13px; cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }

.count { font-size: 13px; color: var(--muted); margin: 0 0 14px; }

/* 広告表記 */
.pr {
  display: inline-block;
  font-size: 10px; font-weight: 700; line-height: 1;
  padding: 3px 5px 2px; margin-left: 6px;
  border-radius: 4px;
  border: 1px solid currentColor;
  opacity: .8; vertical-align: middle;
}

/* 類似カードのFANZAリンク */
.card-fanza {
  display: inline-flex; align-items: center;
  margin-top: 8px; font-size: 12px; color: var(--muted);
  text-decoration: none;
}
.card-fanza:hover { color: var(--text); text-decoration: underline; }

/* 最新作 */
.works { margin-top: 28px; }
.works:empty { display: none; }
.works-title { font-size: 15px; margin: 0 0 12px; display: flex; align-items: center; }
.works-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 12px; }
.works-list a { display: block; text-decoration: none; }
.work-cover {
  /* パッケージ画像は表裏が横に並んでいるので、右半分（表紙）だけ見せる */
  aspect-ratio: 400 / 538;
  border-radius: 8px; overflow: hidden; background: var(--surface);
}
.work-cover img { width: 100%; height: 100%; object-fit: cover; object-position: right center; }
.work-title {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  font-size: 12px; line-height: 1.5; margin-top: 6px;
}
.works-list a:hover .work-title { text-decoration: underline; }
.work-date { display: block; font-size: 11px; color: var(--muted); }

/* 固定ページ */
.doc { max-width: 42em; padding-top: 40px; }
.doc h1 { font-family: var(--font-display); font-weight: 400; font-size: clamp(26px, 4vw, 34px); line-height: 1.3; margin: 0 0 24px; }
.doc h2 { font-size: 17px; margin: 32px 0 8px; }
.doc p, .doc li { color: #d9d2d8; }
.doc a { color: var(--red-hi); }
.doc .btn-primary { color: #fff; margin: 8px 0; }
.doc-date { margin-top: 32px; color: var(--muted); font-size: 13px; }

/* SSR（JSが動く前・検索エンジン向けの本文） */
.ssr { padding-top: 32px; }
.ssr ol { padding-left: 1.4em; }
.ssr a { color: var(--red-hi); }

/* ===== States ===== */
.notice { padding: 80px 0; text-align: center; color: var(--muted); }
.notice p { margin: 0 0 20px; }
.placeholder .thumb { animation: none; }
.loading-line { height: 12px; width: 60%; margin-top: 10px; border-radius: 6px; background: var(--surface); }

/* ===== Footer ===== */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 24px var(--pad) 32px;
  color: var(--muted); font-size: 12px;
}
.site-footer p { margin: 0 0 6px; max-width: 60em; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 6px 20px; margin: 12px 0; }
.footer-nav a { color: var(--text); text-decoration: none; }
.footer-nav a:hover { text-decoration: underline; }
.credit a { color: var(--muted); }

/* ===== Age gate ===== */
.age-gate {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center;
  padding: 20px;
  background: rgb(15 13 16 / .9);
  backdrop-filter: blur(18px);
}
.age-gate[hidden] { display: none; }
.age-panel {
  max-width: 420px; width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 32px 28px 28px;
  text-align: center;
}
.age-mark {
  font-family: var(--font-display);
  font-size: 56px; line-height: 1; margin: 0 auto 16px;
  width: 104px; height: 104px; display: grid; place-items: center;
  border-radius: 50%; border: 5px solid var(--red); color: var(--red);
}
.age-panel h2 { font-size: 18px; margin: 0 0 8px; }
.age-panel p { color: var(--muted); margin: 0 0 22px; font-size: 14px; }
.age-actions { display: grid; gap: 10px; }
.age-actions .btn-ghost { padding: 11px 18px; }

/* ===== Responsive ===== */
@media (max-width: 860px) {
  .detail { grid-template-columns: 1fr; padding-top: 20px; }
  .profile {
    grid-template-columns: 112px 1fr; gap: 0 16px; align-items: start;
  }
  .works { grid-column: 1 / -1; margin-top: 20px; }
  /* スマホでは最新作を横スクロールの小さな列にして、類似一覧を上に保つ */
  .works-list {
    grid-template-columns: none;
    grid-auto-flow: column; grid-auto-columns: 30%;
    overflow-x: auto; scroll-snap-type: x mandatory;
    padding-bottom: 6px;
  }
  .works-list li { scroll-snap-align: start; }
  .profile-photo { border-radius: 16px; }
  .profile-name { margin-top: 0; font-size: 26px; }
  .profile-latest { margin: 8px 0 12px; }
}
@media (max-width: 560px) {
  .site-header { gap: 12px; }
  .logo { font-size: 18px; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 16px 12px; }
  .blend { padding: 14px 14px 12px; }
}

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