:root {
  --bg: #140a1f;
  --bg2: #1e0f2c;
  --card: #261338;
  --line: #3d2356;
  --text: #fbeefe;
  --muted: #c9b3d6;
  --pink: #ff4fa3;
  --purple: #7c5cff;
  --gold: #ffd23f;
  --c: var(--pink);
  --radius: 22px;
  --display: "Dela Gothic One", "Hiragino Sans", sans-serif;
  --body: "M PLUS Rounded 1c", "Hiragino Maru Gothic ProN", "Hiragino Sans", "Yu Gothic", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  line-height: 1.75;
  overflow-x: hidden;
}
a { color: inherit; }
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; }

.bg-deco {
  position: fixed;
  inset: -20vmax;
  z-index: -1;
  background:
    radial-gradient(circle at 20% 15%, color-mix(in srgb, var(--c) 35%, transparent), transparent 35%),
    radial-gradient(circle at 85% 75%, rgba(124, 92, 255, 0.35), transparent 40%),
    radial-gradient(circle at 60% 40%, rgba(255, 210, 63, 0.08), transparent 30%);
  animation: drift 18s ease-in-out infinite alternate;
}
@keyframes drift { to { transform: translate(3vmax, -2vmax) rotate(4deg); } }

main { width: min(640px, 100%); margin: 0 auto; padding: 20px 16px 40px; }

/* ロゴ */
.keyhole { width: 1em; height: 1em; flex: none; }
.logo, .mini-logo, .footer-logo {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 800; text-decoration: none; letter-spacing: 0.04em;
}
.logo { font-size: 1.05rem; }
.logo .keyhole { font-size: 2rem; }
.mini-logo { font-size: 0.85rem; color: var(--muted); }
.mini-logo .keyhole { font-size: 1.4rem; }

/* ボタン */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 12px 24px;
  border-radius: 999px; border: 0;
  font-weight: 800; font-size: 1rem; text-decoration: none; cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: linear-gradient(135deg, var(--pink), var(--purple));
  color: #fff;
  box-shadow: 0 8px 24px rgba(255, 79, 163, 0.35);
}
.btn-primary:hover { box-shadow: 0 10px 30px rgba(255, 79, 163, 0.55); }
.btn-xl { min-height: 64px; font-size: 1.2rem; padding: 14px 36px; width: 100%; max-width: 400px; }
.btn-x { background: #fff; color: #000; }
.btn-x svg { width: 20px; height: 20px; }
.btn-x:hover { background: #f0e6f5; }
.btn-ghost { background: transparent; border: 2px solid var(--line); color: var(--text); }
.btn-ghost:hover { border-color: var(--muted); }

/* トップ */
.hero { text-align: center; padding: 24px 0 8px; }
.hero-kicker { margin: 28px 0 0; color: var(--gold); font-weight: 800; letter-spacing: 0.08em; }
.hero-title {
  font-family: var(--display); font-weight: 400;
  font-size: clamp(2.3rem, 11vw, 3.6rem); line-height: 1.25;
  margin: 8px 0 16px;
  text-shadow: 0 4px 0 rgba(0, 0, 0, 0.4);
}
.hero-title em {
  font-style: normal; color: var(--pink);
  background: linear-gradient(transparent 62%, rgba(124, 92, 255, 0.55) 62%);
}
.sp { display: inline; }
@media (min-width: 560px) { .sp { display: none; } }
.hero-lead { color: var(--muted); margin: 0 auto 20px; max-width: 30em; }
.hero-meta { list-style: none; padding: 0; margin: 0 0 24px; display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.hero-meta li { background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 4px 16px; font-size: 0.9rem; }
.hero-meta b { color: var(--gold); font-size: 1.15rem; margin: 0 2px; }
.hero-note { font-size: 0.8rem; color: var(--muted); margin-top: 12px; }

.teaser, .how { margin-top: 40px; text-align: center; }
.teaser h2, .how h2 { font-family: var(--display); font-weight: 400; font-size: 1.35rem; margin: 0 0 16px; }
.teaser-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.teaser-list li {
  background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--c);
  border-radius: 14px; padding: 10px 14px; text-align: left; font-weight: 700; font-size: 0.95rem;
  display: flex; gap: 10px; align-items: center;
}
.teaser-list li span { font-size: 1.3rem; }
.teaser-list .more { border-left-color: var(--muted); color: var(--muted); justify-content: center; }
.how ol { list-style: none; counter-reset: s; padding: 0; margin: 0 0 24px; display: grid; gap: 10px; text-align: left; }
.how li { counter-increment: s; background: var(--card); border-radius: 14px; padding: 12px 14px 12px 56px; position: relative; color: var(--muted); font-size: 0.92rem; }
.how li::before {
  content: counter(s); position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--pink); color: #fff; font-weight: 800;
}
.how li b { display: block; color: var(--text); }

/* 診断 */
.quiz-head { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.progress { display: flex; align-items: center; gap: 12px; }
.progress-bar { flex: 1; height: 10px; border-radius: 999px; background: var(--card); overflow: hidden; }
.progress-bar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--pink), var(--gold)); transition: width 0.3s; }
.progress-text { margin: 0; font-size: 0.9rem; color: var(--muted); min-width: 4.5em; text-align: right; }
.progress-text b { color: var(--text); font-size: 1.2rem; }

.q-card { transition: opacity 0.16s, transform 0.16s; }
.q-card.enter { opacity: 0; transform: translateX(24px); }
.q-card.leave { opacity: 0; transform: translateX(-24px); }
.q-label { font-family: var(--display); color: var(--pink); font-size: 1.6rem; margin: 0; line-height: 1; }
.q-text { font-size: clamp(1.25rem, 5.6vw, 1.6rem); line-height: 1.5; margin: 10px 0 22px; min-height: 3em; }
.q-options { display: grid; gap: 12px; }
.q-option {
  display: flex; align-items: center; gap: 14px; text-align: left;
  min-height: 64px; padding: 12px 16px;
  background: var(--card); border: 2px solid var(--line); border-radius: 18px;
  font-weight: 700; font-size: 1rem; line-height: 1.5; cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.q-option:hover { border-color: var(--pink); }
.q-option:active { transform: scale(0.98); }
.q-option.chosen { border-color: var(--pink); background: color-mix(in srgb, var(--pink) 25%, var(--card)); }
.q-mark {
  flex: none; width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center; font-size: 0.85rem;
  background: var(--bg); color: var(--pink); border: 1px solid var(--line);
}
.btn-back { margin-top: 20px; background: none; border: 0; color: var(--muted); cursor: pointer; padding: 8px 0; font-size: 0.9rem; }
.analyzing { text-align: center; padding: 60px 0; }
.analyzing-key { font-size: 5rem; animation: pulse 0.9s ease-in-out infinite alternate; }
.analyzing-key .keyhole { margin: 0 auto; }
.analyzing-text { font-family: var(--display); font-size: 1.3rem; line-height: 1.6; }
@keyframes pulse { from { transform: scale(0.9) rotate(-8deg); } to { transform: scale(1.1) rotate(8deg); } }
.noscript { color: var(--gold); }

/* 結果 */
.result-card {
  margin-top: 14px; text-align: center; padding: 28px 18px 30px;
  border-radius: 28px; border: 3px solid var(--c);
  background: linear-gradient(160deg, color-mix(in srgb, var(--c) 22%, var(--bg2)), var(--bg2) 60%);
  box-shadow: 0 0 40px color-mix(in srgb, var(--c) 35%, transparent);
  animation: pop 0.6s cubic-bezier(0.2, 1.4, 0.4, 1);
}
@keyframes pop { from { opacity: 0; transform: scale(0.85); } }
.result-kicker { margin: 0; color: var(--muted); font-weight: 800; }
.result-emoji { font-size: 4.2rem; line-height: 1.3; }
.result-name {
  font-family: var(--display); font-weight: 400;
  font-size: clamp(1.7rem, 8vw, 2.4rem); line-height: 1.3; margin: 4px 0 12px;
  color: var(--c); text-shadow: 0 3px 0 rgba(0, 0, 0, 0.45);
}
.result-catch { margin: 0; font-weight: 800; font-size: 1.1rem; }

.share { display: grid; gap: 10px; margin: 16px 0; }
.share .btn-x { min-height: 58px; font-size: 1.1rem; }

.panel { margin-top: 20px; background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 18px; }
.panel h2 { font-family: var(--display); font-weight: 400; font-size: 1.25rem; margin: 0 0 12px; }
.panel h2::before { content: "◆ "; color: var(--c); }
.panel h3 { font-size: 1rem; margin: 18px 0 8px; color: var(--c); }
.panel-note { margin: -6px 0 12px; color: var(--muted); font-size: 0.85rem; }
.result-desc { margin: 0; }
.traits { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.traits li { background: var(--card); border-radius: 12px; padding: 8px 12px; font-weight: 700; }
.traits li::before { content: "✔ "; color: var(--c); }

.bars { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.bars li { display: grid; grid-template-columns: 1fr 2.6em; align-items: center; gap: 2px 10px; font-size: 0.88rem; }
.bars .bar-label { grid-column: 1 / -1; font-weight: 700; }
.bar { height: 12px; border-radius: 999px; background: var(--card); overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--c), var(--gold)); transition: width 0.8s ease; }
.bar-num { text-align: right; font-weight: 800; }

.genres { list-style: none; padding: 0; margin: 0 0 16px; display: flex; flex-wrap: wrap; gap: 8px; }
.genres li { font-size: 0.8rem; padding: 2px 12px; border-radius: 999px; background: var(--card); color: var(--muted); }
.works { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.work a {
  display: flex; flex-direction: column; height: 100%; text-decoration: none;
  background: var(--card); border: 2px solid var(--line); border-radius: 16px; overflow: hidden;
  transition: border-color 0.15s, transform 0.15s;
}
.work a:hover { border-color: var(--c); transform: translateY(-2px); }
.work-thumb { aspect-ratio: 7 / 10; background: var(--bg); overflow: hidden; }
/* FANZA のパッケージ画像は見開き（右半分が表紙）が多いので、右側に合わせて表紙を見せる */
.work-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: right center; transition: transform 0.3s; }
.work a:hover .work-thumb img { transform: scale(1.04); }
.work-title {
  padding: 8px 10px 0; font-size: 0.78rem; font-weight: 700; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.work-go { margin-top: auto; padding: 6px 10px 10px; font-size: 0.78rem; font-weight: 800; color: var(--c); }
@media (min-width: 560px) { .works { grid-template-columns: repeat(3, 1fr); } }
.works-empty { color: var(--muted); }
.works-notice { margin: 14px 0 0; font-size: 0.72rem; color: var(--muted); }

.panel-share { text-align: center; }
.panel-share h2::before { content: ""; }
.panel-share > p { color: var(--muted); margin: 0; }
.panel-share > .btn { width: 100%; }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px);
  background: var(--text); color: var(--bg); font-weight: 800; padding: 10px 22px; border-radius: 999px;
  width: max-content; max-width: calc(100% - 32px); text-align: center;
  opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; z-index: 10;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* フッター */
.site-footer { width: min(640px, 100%); margin: 0 auto; padding: 24px 16px 40px; border-top: 1px solid var(--line); text-align: center; }
.site-footer p { margin: 0 0 6px; }
.footer-logo { color: var(--muted); font-size: 0.9rem; }
.footer-logo .keyhole { font-size: 1.3rem; }
.notice { font-size: 0.72rem; color: var(--muted); }

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

/* 日本語の見出しを文節で折り返す（対応ブラウザのみ。非対応でも表示は崩れない） */
.hero-title, .q-text, .result-name, .result-catch, .teaser h2, .age-dialog-title, .result-summary { word-break: auto-phrase; text-wrap: balance; }

/* スマホで件数が奇数のとき、先頭の作品を横いっぱいに大きく見せる */
@media (max-width: 559px) {
  .works .work:first-child:nth-last-child(odd) { grid-column: 1 / -1; }
  .works .work:first-child:nth-last-child(odd) a, .works .work:first-child:nth-last-child(odd) .work-lock { display: grid; grid-template-columns: 44% 1fr; grid-template-rows: 1fr auto; }
  .works .work:first-child:nth-last-child(odd) .work-thumb { grid-row: 1 / 3; }
  .works .work:first-child:nth-last-child(odd) .work-title { font-size: 0.9rem; padding-top: 14px; -webkit-line-clamp: 5; }
}

/* 診断結果のひとこと */
.result-summary {
  margin: 0 0 14px; padding: 12px 14px; border-radius: 14px;
  background: color-mix(in srgb, var(--c) 18%, var(--card)); border: 2px solid var(--c);
  font-weight: 800; font-size: 1.1rem; line-height: 1.5;
}
.result-summary span { display: block; font-size: 0.75rem; color: var(--muted); font-weight: 700; }

/* 広告表記（作品紹介の先頭に出す） */
.pr-badge {
  display: inline-block; vertical-align: middle; margin-left: 6px;
  font-family: var(--body); font-size: 0.7rem; font-weight: 800; letter-spacing: 0.05em;
  padding: 2px 8px; border-radius: 6px; background: var(--gold); color: var(--bg);
}
.works-notice-top { margin: -4px 0 14px; }

/* 年齢確認前のモザイク風カード（本物の画像ではなく模様。3つの細かさの四角を重ねて不揃いに見せる） */
.work-lock {
  display: flex; flex-direction: column; width: 100%; height: 100%; padding: 0; text-align: left; cursor: pointer;
  background: var(--card); border: 2px solid var(--line); border-radius: 16px; overflow: hidden;
  transition: border-color 0.15s, transform 0.15s; -webkit-tap-highlight-color: transparent;
}
.work-lock:hover, .work-lock:focus-visible { border-color: var(--c); transform: translateY(-2px); }
.mosaic {
  position: relative; display: grid; place-items: center;
  background-color: color-mix(in srgb, var(--c) 45%, var(--bg2));
  background-image:
    repeating-conic-gradient(rgba(255, 255, 255, 0.10) 0 25%, rgba(0, 0, 0, 0.16) 0 50%),
    repeating-conic-gradient(rgba(255, 210, 160, 0.14) 0 25%, transparent 0 50%),
    repeating-conic-gradient(rgba(60, 20, 80, 0.22) 0 25%, transparent 0 50%);
  background-size: 22px 22px, 33px 33px, 55px 55px;
  background-position: 0 0, 11px 0, 0 22px;
}
.mosaic-label {
  padding: 6px 12px; border-radius: 999px; text-align: center; line-height: 1.35;
  background: rgba(20, 10, 31, 0.78); color: #fff; font-weight: 800; font-size: 0.78rem;
}
.work-lock .work-go { color: var(--gold); }

/* 18歳以上の確認ダイアログ */
.age-dialog {
  width: min(360px, calc(100% - 32px)); padding: 24px 20px; border: 2px solid var(--c); border-radius: 20px;
  background: var(--bg2); color: var(--text); text-align: center;
}
.age-dialog::backdrop { background: rgba(10, 4, 16, 0.75); }
.age-dialog-title { margin: 0 0 8px; font-weight: 800; font-size: 1.2rem; }
.age-dialog-text { margin: 0 0 18px; font-size: 0.85rem; color: var(--muted); }
.age-dialog-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.works-error[hidden] { display: none; }
.works-error { color: var(--gold); }

/* 説明ページ */
.doc h1 { font-family: var(--display); font-weight: 400; font-size: 1.5rem; line-height: 1.4; margin: 20px 0 12px; }
.doc h2 { font-size: 1.05rem; margin: 24px 0 8px; color: var(--pink); }
.doc p { color: var(--muted); font-size: 0.92rem; }
.doc-table { overflow-x: auto; }
.doc table { width: 100%; border-collapse: collapse; font-size: 0.8rem; min-width: 480px; }
.doc th, .doc td { border: 1px solid var(--line); padding: 8px; text-align: left; vertical-align: top; }
.doc th { background: var(--card); }
.notice a { color: var(--muted); }
