:root {
  color-scheme: dark;
  font-family: "Hiragino Kaku Gothic Pro", "ヒラギノ角ゴ Pro W3", HiraginoSans-W3, "メイリオ", Meiryo, "ＭＳ Ｐゴシック", sans-serif;
  background: #000;
  color: #fff;
  --accent: #ff7a21;
  --muted: #8a8a8e;
  --nav-height: 64px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #000;
}

body {
  min-width: 280px;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

img,
video,
iframe {
  display: block;
  max-width: 100%;
}

.hidden,
[hidden] {
  display: none !important;
}

.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;
}

.app-shell {
  position: relative;
  width: min(100%, 500px);
  height: 100dvh;
  min-height: 100%;
  margin: 0 auto;
  overflow: hidden;
  background: #000;
  box-shadow: 0 0 40px rgb(0 0 0 / 50%);
  /* ピンチ拡大を止めつつ縦横スクロールは残す。noneにすると一覧が動かせなくなる */
  touch-action: pan-x pan-y;
}

/* 同意済みならJSを待たずに消す。age-boot.js が root に印を付ける */
:root[data-age-ok="1"] .age-gate {
  display: none;
}

.age-gate {
  position: absolute;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: calc(24px + env(safe-area-inset-top, 0px)) 24px calc(24px + var(--safe-bottom));
  background: #000;
}

.age-card {
  width: min(100%, 360px);
  padding: 32px 24px;
  text-align: center;
  border: 1px solid #2d2d2f;
  border-radius: 24px;
  background: #111;
}

.brand {
  margin: 0;
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.brand span {
  color: var(--accent);
}

.brand-logo {
  display: block;
  width: 132px;
  height: auto;
}

/* display:blockはUA既定のhiddenより強いので、消える指定を足す */
.brand-logo[hidden] {
  display: none;
}

.age-card .brand-logo {
  margin: 0 auto;
}

.age-card h1 {
  margin: 28px 0 16px;
  font-size: 1.5rem;
}

.age-card p {
  margin: 8px 0;
  color: #c8c8cc;
  line-height: 1.7;
}

.age-actions {
  display: grid;
  gap: 12px;
  margin-top: 28px;
}

.primary-button,
.secondary-button {
  min-height: 50px;
  border-radius: 999px;
  cursor: pointer;
}

.primary-button {
  border: 0;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

.secondary-button {
  border: 1px solid #48484c;
  background: transparent;
}

/* 回転はロックできないため横向きスマホだけ検知する。高さのあるPC・タブレット横置きは対象外 */
.rotate-notice {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
  place-content: center;
  justify-items: center;
  gap: 18px;
  padding: 32px;
  text-align: center;
  background: #000;
}

.rotate-notice svg {
  width: 56px;
  height: 56px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.rotate-notice p {
  margin: 0;
  color: #d8d8dc;
  font-size: 0.95rem;
}

@media (orientation: landscape) and (max-height: 500px) {
  .rotate-notice {
    display: grid;
  }
}

.app-loading,
.app-error {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 32px;
  text-align: center;
  background: #000;
}

.app-error {
  color: #ffb49a;
}

.spinner {
  width: 34px;
  height: 34px;
  border: 3px solid rgb(255 255 255 / 18%);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(1turn);
  }
}

@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation-duration: 2.4s;
  }
}

#main-content,
.screen {
  height: 100%;
}

.screen {
  display: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: #000;
}

.screen.active {
  display: block;
}

.screen-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  min-height: calc(64px + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) 18px 0;
  background: rgb(0 0 0 / 88%);
  backdrop-filter: blur(16px);
}

.screen-header h1 {
  margin: 0;
  font-size: 1.25rem;
}

/* ホームはスマホではロゴだけ出す（PCは左のサイドバーにロゴがあるので見出しに差し替える） */
#screen-home .screen-header h1 {
  display: none;
}

/* 見出し行の右端に置くアイコンボタン（設定・戻る） */
.header-action {
  display: inline-flex;
  margin-left: auto;
  padding: 8px;
  color: #fff;
}

.header-action.back {
  order: -1;
  margin: 0 4px 0 -8px;
}

.header-action svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.screen-content {
  padding: 12px 14px calc(var(--nav-height) + var(--safe-bottom) + 28px);
}

/* ヘッダー下の余白は36pxで揃える。ホームと設定は見出しのmargin-top 24px と
   .screen-content の padding-top 12px で既に36px。マイページは先頭が見出しでないので足りない。
   検索フォームで始まる2画面（search/people）は12pxのままにする */
#screen-mypage .screen-content {
  padding-top: 36px;
}

.settings-note {
  margin: 0 2px 18px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.7;
}

.danger-list {
  display: grid;
  gap: 12px;
}

.danger-item {
  min-height: 56px;
  padding: 0 18px;
  border: 0;
  border-radius: 14px;
  background: #1c1c1f;
  color: #fff;
  font-size: 0.92rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.danger-item.strong {
  color: #ff8a8a;
}

/* 削除の確認。ブラウザ標準のconfirmを使わずサイトの配色で出す */
.confirm-backdrop {
  position: absolute;
  inset: 0;
  z-index: 1100;
  background: rgb(0 0 0 / 65%);
}

.confirm-dialog {
  position: absolute;
  z-index: 1101;
  top: 50%;
  left: 50%;
  width: min(100% - 48px, 340px);
  padding: 24px 22px 18px;
  border: 1px solid #2d2d2f;
  border-radius: 20px;
  background: #141416;
  transform: translate(-50%, -50%);
}

.confirm-dialog p {
  margin: 0 0 22px;
  color: #d8d8dc;
  font-size: 0.88rem;
  line-height: 1.75;
}

.confirm-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.confirm-cancel,
.confirm-ok {
  min-height: 46px;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
}

.confirm-cancel {
  border: 1px solid #48484c;
  background: transparent;
  color: #fff;
}

.confirm-ok {
  border: 0;
  background: var(--accent);
  color: #fff;
}

.screen-content h2 {
  margin: 24px 2px 12px;
  font-size: 1.1rem;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 24px 2px 12px;
}

.section-heading h2 {
  margin: 0;
}

.section-heading span,
.result-count,
.empty-state {
  color: var(--muted);
  font-size: 0.82rem;
}

/* 女優一覧ハブへの導線（app.js の makeHeading と index.html の .list-link）。消さないこと */
.section-heading a,
.list-link a {
  flex: none;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
  text-decoration: none;
}

.list-link {
  margin: 24px 2px 0;
  text-align: center;
}

/* 女優ページ全件への静的リンク。畳んだ状態を既定にして画面を占有させない */
.all-actress {
  margin: 10px 2px 0;
  text-align: center;
}

.all-actress summary {
  color: var(--muted);
  font-size: 0.78rem;
  cursor: pointer;
}

.all-actress-list {
  columns: 8em;
  column-gap: 16px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  text-align: left;
}

.all-actress-list a {
  color: #6f6f75;
  font-size: 0.74rem;
  line-height: 1.9;
  text-decoration: none;
}

.all-actress-list a:hover {
  color: var(--accent);
}

/* 空表示は .thumb-grid の中に入るため、1カラム幅に潰れて不自然に折り返す。全カラムに広げる */
.empty-state {
  grid-column: 1 / -1;
}

.thumb-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 3px;
}

/* ホームのランキング。横スクロール1行 */
/* -14px は .screen-content の左右paddingと同値。端まで流して padding で内側に戻す */
.rank-row {
  display: flex;
  gap: 8px;
  margin: 0 -14px 28px;
  padding: 0 14px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}

.rank-row::-webkit-scrollbar {
  display: none;
}

.rank-row > * {
  flex: 0 0 auto;
}

.rank-row .thumb-card {
  width: 132px;
  aspect-ratio: 3 / 4;
  border-radius: 10px;
}

/* 縦型カードの形は .person-card 側で持つ。横スクロール行では幅だけ固定する */
.rank-row-people .person-card {
  width: 92px;
}

/* 名前が長いとカード幅を押し広げて隣に重なるので、小さめに丸める */
.rank-row-people .person-meta strong,
.rank-row-people .person-meta small {
  font-size: 0.74rem;
}

.thumb-card {
  position: relative;
  min-width: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 3px;
  background: #151515;
  cursor: pointer;
  aspect-ratio: 2 / 3;
}

.thumb-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb-card::after {
  content: "";
  position: absolute;
  inset: 45% 0 0;
  background: linear-gradient(transparent, rgb(0 0 0 / 85%));
}

.thumb-title,
.rank-badge {
  position: absolute;
  z-index: 1;
}

.thumb-title {
  right: 7px;
  bottom: 7px;
  left: 7px;
  display: -webkit-box;
  overflow: hidden;
  color: #fff;
  font-size: 0.72rem;
  line-height: 1.35;
  text-align: left;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.rank-badge {
  top: 6px;
  left: 6px;
  display: grid;
  min-width: 34px;
  height: 22px;
  place-items: center;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(6px);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
}

.search-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 46px;
  padding: 0 14px;
  flex: 1;
  border: 1px solid #323236;
  border-radius: 14px;
  background: #171719;
}

.filter-button {
  position: relative;
  display: grid;
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  place-items: center;
  padding: 0;
  border: 1px solid #323236;
  border-radius: 14px;
  background: #171719;
  cursor: pointer;
}

.filter-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.filter-button.active {
  border-color: var(--accent);
}

.filter-button.active svg {
  stroke: var(--accent);
}

.filter-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  display: grid;
  min-width: 18px;
  height: 18px;
  place-items: center;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.64rem;
  font-weight: 700;
}

.search-box:focus-within {
  border-color: var(--accent);
}

.search-box svg {
  width: 20px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: #fff;
}

.tag-list,
.kana-list {
  display: flex;
  gap: 8px;
  margin: 14px 0;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}

.tag-list::-webkit-scrollbar,
.kana-list::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid #3a3a3e;
  border-radius: 999px;
  background: #151517;
  color: #c8c8cc;
  cursor: pointer;
}

.filter-chip.selected {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.result-count {
  min-height: 1.2em;
  margin: 12px 2px;
}

/* マイページのフォロー中と同じ縦型カードで並べる */
.people-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 10px;
}

/* ページを持つ女優は a、持たない人は button で出る（app.js の makePersonCard） */
.person-card {
  display: flex;
  text-decoration: none;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
  padding: 12px 8px;
  border: 1px solid #252527;
  border-radius: 14px;
  background: #111;
  color: #fff;
  text-align: center;
  cursor: pointer;
}

.person-card img {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  background: #29292c;
}

.person-meta {
  display: block;
  width: 100%;
  min-width: 0;
}

.person-meta strong,
.person-meta small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.person-meta small {
  margin-top: 4px;
  color: var(--muted);
}

/* 縦型カードでは右向き矢印が意味を持たない */
.person-arrow {
  display: none;
}


.screen-reel.active {
  display: block;
  overflow: hidden;
}

/* プレイヤーは画面に重なる独立層。下部ナビ(z-index 20)より下に置き、タブのナビ選択状態を変えない */
.player {
  position: absolute;
  inset: 0;
  z-index: 15;
  display: none;
  background: #000;
}

.player.active {
  display: block;
}

.player-close {
  position: absolute;
  z-index: 22;
  top: calc(16px + env(safe-area-inset-top, 0px));
  left: max(12px, env(safe-area-inset-left, 0px));
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(6px);
  color: #fff;
  cursor: pointer;
}

.player-close svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-shell.immersive .player-close {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
}

/* dvhは.app-shellだけで使う。ここで使うとバー伸縮で高さが変わりスナップ位置がずれる */
.reel-feed {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  /* 横方向のオーバースクロールを「戻る/進む」へ渡さない。touch-actionと併せAndroid Chromeの誤発火を止める */
  overscroll-behavior: contain;
  touch-action: pan-y;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
}

/* 上下キーで送るたびに白枠が出る。操作対象は動画そのもので、枠が無くても位置は分かる */
.reel-feed:focus,
.reel-feed:focus-visible {
  outline: none;
}

.reel-feed::-webkit-scrollbar {
  display: none;
}

.reel-slide {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  /* spec.md §7の背景色に揃える。#080808だと動画のcontain余白との間に段差が見えていた */
  background: #000;
}

.slide-media {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: #000;
}

/* サムネと動画を同じマスに重ねる。gridの自動配置だと縦に並んでしまう */
.slide-media > * {
  grid-area: 1 / 1;
}

.slide-thumb {
  z-index: 0;
}

.slide-media video {
  z-index: 1;
}

.slide-media video,
.slide-media > img,
.slide-media > a,
.iframe-preview,
.slide-media iframe {
  width: 100%;
  height: 100%;
}

/* FANZA動画は16:9。coverにすると横が画面幅の3倍に伸び、中央3割しか映らない */
.slide-media video,
.slide-media > img,
.slide-media > a img,
.iframe-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  /* 16:9の動画は縦画面で上下に大きな余白が出る。少しだけ上へ寄せる */
  object-position: 50% 40%;
}

.slide-media::after {
  content: "";
  position: absolute;
  inset: 50% 0 0;
  pointer-events: none;
  background: linear-gradient(transparent, rgb(0 0 0 / 72%));
}

.iframe-preview {
  position: relative;
  padding: 0;
  border: 0;
  background: #000;
  cursor: pointer;
}

.iframe-play {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  width: 68px;
  height: 68px;
  place-items: center;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: rgb(0 0 0 / 70%);
  color: #fff;
  font-size: 1.65rem;
}

.reel-caption {
  position: absolute;
  /* z-index22: シークバー当たり判定と競合するハッシュタグを勝たせるため引き上げる */
  z-index: 22;
  right: 88px;
  /* bottomを24pxより下げない。.seek-bar::beforeの上18px拡張と重なりシークバーが掴めなくなる。下げるなら.seek-bar::beforeの上側も削ること */
  bottom: calc(var(--nav-height) + var(--safe-bottom) + 24px);
  left: max(16px, env(safe-area-inset-left, 0px));
  pointer-events: none;
  text-shadow: 0 1px 4px rgb(0 0 0 / 80%);
}

.reel-caption h2 {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  font-size: 1rem;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

/* タイトル(h2)2行+ここ1行=合計3行に収める（ハッシュタグ行はこの3行に含めない） */
.reel-caption p {
  display: -webkit-box;
  margin: 7px 0 0;
  overflow: hidden;
  color: #e1e1e3;
  font-size: 0.78rem;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
}

/* 動画に重ねるため帯は敷かずすりガラス粒（.rank-badge等と同表現）にする。個々のタグだけpointer-events:noneを打ち消す */
.reel-hashtags {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 2px 8px;
  margin-top: 8px;
  pointer-events: none;
}

/* ピルの内側余白があると1つ目のタグだけキャプションの左端からずれる。素のテキストにする */
.reel-hashtag {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 700;
  text-shadow: 0 1px 3px rgb(0 0 0 / 85%);
  cursor: pointer;
  pointer-events: auto;
}

.side-rail {
  position: absolute;
  z-index: 5;
  right: max(9px, env(safe-area-inset-right, 0px));
  bottom: calc(var(--nav-height) + var(--safe-bottom) + 18px);
  display: flex;
  width: 70px;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.rail-action,
.avatar-person,
.follow-toggle {
  border: 0;
  background: transparent;
  cursor: pointer;
}

.rail-action {
  display: grid;
  width: 70px;
  justify-items: center;
  gap: 3px;
  padding: 0;
  color: #fff;
  text-decoration: none;
  text-shadow: 0 1px 4px rgb(0 0 0 / 90%);
}

.rail-action svg {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: currentcolor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.rail-action span {
  font-size: 0.65rem;
  font-weight: 700;
}

.rail-action.favorite.active {
  color: var(--accent);
}

.rail-action.favorite.active svg {
  fill: currentcolor;
}

.rail-action.fanza-icon svg {
  width: 39px;
  height: 39px;
  padding: 8px;
  border-radius: 50%;
  background: var(--accent);
}

/* マイページの節間は同じ余白にする。行のmargin-bottomとh2のmargin-topを殺しsection側で一本化する。
   28px はホームの節間（.rank-row の margin-bottom）と同値。片方を変えたらもう片方も合わせる */
#screen-mypage .screen-content > section + section {
  margin-top: 28px;
}

#screen-mypage .screen-content > section > h2:first-child {
  margin-top: 0;
}

#screen-mypage .rank-row,
#screen-mypage .thumb-grid {
  margin-bottom: 0;
}

.info-section {
  margin-top: 64px;
  padding: 20px;
  border-radius: 16px;
  background: #141416;
}

.info-section h2 {
  margin: 0 0 16px;
  font-size: 0.95rem;
}

.info-note {
  margin: 0 0 16px;
  color: #9a9aa0;
  font-size: 0.78rem;
  line-height: 1.9;
}

.info-note b {
  display: block;
  margin-bottom: 4px;
  color: #d8d8dc;
}

.info-divider {
  height: 1px;
  margin: 20px 0;
  background: #232326;
}

.info-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.info-links a {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 700;
}

.info-owner {
  margin: 20px 0 0;
  color: #6f6f75;
  font-size: 0.74rem;
}

.info-credit-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  margin-top: 28px;
  gap: 4px 16px;
}

.info-credit-row .info-note,
.info-credit-row .info-owner {
  margin: 0;
}

/* ブラウザ既定のリンク色が浮くため、.info-links と同じ色に揃える */
.info-credit-row a {
  color: var(--accent);
  text-decoration: none;
}

/* .age-card p より詳細度を上げないと margin が効かない */
.age-card .age-note {
  margin: 44px 0 0;
  color: #7a7a80;
  font-size: 0.72rem;
  line-height: 1.8;
  text-align: left;
}

.avatar-control {
  position: relative;
  width: 58px;
  height: 63px;
}

/* 女優ページがある人は<a>で描くので、インラインだと寸法が効かない。displayを明示する */
.avatar-person {
  display: block;
  width: 54px;
  height: 54px;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 50%;
  overflow: hidden;
}

.avatar-person img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.follow-toggle {
  position: absolute;
  right: 0;
  bottom: 0;
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  padding: 0;
  border: 2px solid #000;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
}

.follow-toggle svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.follow-toggle.following {
  background: #fff;
  color: var(--accent);
}

.info-sheet {
  position: absolute;
  z-index: 31;
  right: 0;
  bottom: 0;
  left: 0;
  max-height: 72dvh;
  /* 下部ナビ(z-index 20)がシートより手前で描かれるため、その帯の裏に本文が隠れないよう分だけ空ける */
  padding: 8px 20px calc(var(--nav-height) + var(--safe-bottom) + 24px);
  overflow-y: auto;
  overscroll-behavior-y: contain;
  border-radius: 24px 24px 0 0;
  /* 背後の映像を透かす。不透明度を下げるぶん blur を強めないと文字が読めなくなる */
  background: rgb(24 24 27 / 58%);
  backdrop-filter: blur(28px) saturate(140%);
  box-shadow: 0 -12px 40px rgb(0 0 0 / 50%);
  transition: transform 0.2s ease;
}

/* backdrop-filter非対応環境では透けたままだと動画に文字が埋もれるため不透明にする */
@supports not (backdrop-filter: blur(1px)) {
  .info-sheet {
    background: #18181b;
  }
}

/* 全画面で長押し選択を止める。-webkit-無しはiOS Safariで効かない */
.app-shell,
.app-shell * {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

/* 検索欄は入力・貼り付けができないと困るので除外する */
.app-shell input {
  -webkit-user-select: text;
  user-select: text;
}

.app-shell.immersive .side-rail,
.app-shell.immersive .reel-caption,
.app-shell.immersive .mute-toggle,
.app-shell.immersive .bottom-nav,
.app-shell.immersive .reel-brand {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

.app-shell.immersive .reel-slide::after {
  opacity: 0;
}

.side-rail {
  transition: opacity 0.12s ease;
}

.reel-feed.scrolling .side-rail {
  opacity: 0.35;
}

/* 全画面中はスワイプしても右アイコンを出さない（上の .scrolling を打ち消す） */
.app-shell.immersive .reel-feed.scrolling .side-rail {
  opacity: 0;
}

/* 再生位置のシークバー。リールの最下部に細く敷く。ドラッグで移動できる */
.seek-bar {
  position: absolute;
  z-index: 21;
  right: 0;
  bottom: calc(var(--nav-height) + var(--safe-bottom));
  left: 0;
  height: 3px;
  background: rgb(255 255 255 / 18%);
  touch-action: none;
  transition: height 0.12s ease;
}

/* 当たり判定を広げる。下6pxは下部ナビの指を奪わないよう、上18pxは.reel-captionの下端と競合しないよう制限 */
.seek-bar::before {
  content: "";
  position: absolute;
  inset: -18px 0 -6px;
}

.seek-bar.scrubbing {
  height: 7px;
}

.seek-fill {
  width: 0;
  height: 100%;
  background: var(--accent);
}

/* 全画面中はナビが消えるぶん下げる */
.app-shell.immersive .seek-bar {
  bottom: var(--safe-bottom);
}

/* 全画面中は下部ナビが消える分だけ広げる。広げすぎると次の作品へ送るスワイプが掴めなくなる */
.app-shell.immersive .seek-bar::before {
  inset: -40px 0 -20px;
}

/* 動画のバッファ待ち。サムネの上に重ねる */
.reel-loading {
  position: absolute;
  z-index: 18;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

/* .mute-toggleと同じ丸。大きさだけ変える */
.pause-mark {
  position: absolute;
  z-index: 19;
  top: 50%;
  left: 50%;
  display: grid;
  width: 72px;
  height: 72px;
  place-items: center;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(6px);
  color: #fff;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%);
  transition: opacity 0.45s ease;
}

.pause-mark.visible {
  opacity: 1;
  transition-duration: 0.1s;
}

.pause-mark svg {
  width: 34px;
  height: 34px;
  fill: currentColor;
}

/* 全画面切り替えを知らせるピル */
.reel-notice {
  position: absolute;
  z-index: 41;
  top: calc(env(safe-area-inset-top, 0px) + 88px);
  left: 50%;
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: calc(100% - 40px);
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  color: #fff;
  font-size: 0.82rem;
  white-space: nowrap;
  transform: translateX(-50%);
}

.reel-notice svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* 動画に重ねるので帯は敷かず、影だけで可読性を確保する（帯だと動画を隠す） */
.reel-brand {
  position: absolute;
  z-index: 20;
  /* ホームロゴと同じ位置に揃える。20px=(ヘッダー64px-ロゴ24px)/2。ロゴ幅を変えたらここも直す */
  top: calc(20px + env(safe-area-inset-top, 0px));
  left: max(18px, env(safe-area-inset-left, 0px));
  pointer-events: none;
  /* 画像なのでtext-shadowは効かない。同じ効き目をdrop-shadowで出す */
  filter: drop-shadow(0 1px 4px rgb(0 0 0 / 85%)) drop-shadow(0 2px 14px rgb(0 0 0 / 65%));
}

.mute-toggle,
.immersive-exit {
  position: absolute;
  z-index: 20;
  top: calc(16px + env(safe-area-inset-top, 0px));
  right: max(16px, env(safe-area-inset-right, 0px));
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  /* 黒の半透明だけだと暗い映像の上で真っ黒に潰れる。白をわずかに乗せて曇りガラスにする */
  background: rgb(255 255 255 / 8%);
  backdrop-filter: blur(20px) saturate(140%);
  color: #fff;
  cursor: pointer;
}

/* 全画面の解除はPCだけの操作。スマホは長押しで戻せるので出さない */
.immersive-exit {
  display: none;
}

.mute-toggle svg,
.immersive-exit svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  z-index: 30;
  background: rgb(0 0 0 / 55%);
}

.sheet-handle {
  display: block;
  width: 48px;
  height: 20px;
  margin: 0 auto 8px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.sheet-handle::before {
  content: "";
  display: block;
  width: 38px;
  height: 4px;
  margin: auto;
  border-radius: 999px;
  background: #626267;
}

.info-sheet h2 {
  display: -webkit-box;
  overflow: hidden;
  margin: 10px 0 16px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  font-size: 1.2rem;
}

@media (min-width: 1024px) {
  .info-sheet h2 {
    -webkit-line-clamp: none;
  }
}

.info-fanza-link {
  display: block;
  margin-top: 20px;
  padding: 14px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
}

.filter-sheet-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.filter-sheet-head h2 {
  margin: 10px 0 16px;
}

.filter-clear {
  padding: 6px 2px;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.filter-axis {
  margin-bottom: 18px;
}

.filter-axis h3 {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.74rem;
}

.filter-axis .tag-list {
  margin: 0;
}

/* 「もっと見る」展開時は横スクロールでなく折り返す。縦はシート側のmax-height+scrollで捌く */
.filter-axis .tag-list.tag-list-wrap {
  flex-wrap: wrap;
  overflow-x: visible;
}

.filter-more {
  margin-top: 1px;
  padding: 6px 2px 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.info-row {
  margin: 12px 0;
  color: #d2d2d5;
  line-height: 1.6;
}

.info-row strong {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
}

.toast {
  position: absolute;
  z-index: 40;
  bottom: calc(var(--nav-height) + var(--safe-bottom) + 22px);
  left: 50%;
  max-width: calc(100% - 40px);
  padding: 9px 14px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition: opacity 160ms ease, transform 160ms ease;
  background: rgb(36 36 39 / 95%);
  font-size: 0.78rem;
  white-space: nowrap;
}

.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* 作品検索・女優検索の右下。#info-sheetと同じすりガラス表現に揃える */
.scroll-top-button {
  position: absolute;
  z-index: 19;
  right: max(16px, env(safe-area-inset-right, 0px));
  bottom: calc(var(--nav-height) + var(--safe-bottom) + 16px);
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgb(24 24 27 / 88%);
  backdrop-filter: blur(16px);
  color: #fff;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

@supports not (backdrop-filter: blur(1px)) {
  .scroll-top-button {
    background: #18181b;
  }
}

.scroll-top-button.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.scroll-top-button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bottom-nav {
  position: absolute;
  z-index: 20;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  height: calc(var(--nav-height) + var(--safe-bottom));
  grid-template-columns: repeat(5, 1fr);
  padding: 0 max(8px, env(safe-area-inset-right, 0px)) var(--safe-bottom) max(8px, env(safe-area-inset-left, 0px));
  border-top: 1px solid rgb(255 255 255 / 10%);
  background: rgb(8 8 8 / 92%);
  backdrop-filter: blur(18px);
}

.bottom-nav a {
  display: grid;
  place-items: center;
  color: var(--muted);
}

.bottom-nav a.active {
  color: #fff;
}

/* ホームだけ当たり判定をアイコン寄りに絞る。5等分セル全体だと誤爆が多い。見た目は変わらない */
.bottom-nav a[data-nav="home"] {
  justify-self: center;
  width: 52px;
}

.bottom-nav svg {
  width: 27px;
  height: 27px;
  fill: none;
  stroke: currentcolor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.bottom-nav a:first-child svg {
  fill: currentcolor;
  stroke: none;
}

@media (min-width: 501px) {
  body {
    background: #121214;
  }
}

/* タブレット幅。500px固定をやめ一覧に画面を使わせる。リールは縦動画なので広げず500pxのまま中央に置く */
@media (min-width: 501px) and (max-width: 1023px) {
  .app-shell {
    width: 100%;
    max-width: none;
  }

  .thumb-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }

  .people-list {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  }

  .screen-content {
    padding-right: max(14px, calc((100% - 900px) / 2));
    padding-left: max(14px, calc((100% - 900px) / 2));
  }

  /* 絞るのはプレイヤーごと。フィードだけ絞ると#player基準のキャプション等が画面端に取り残される */
  /* box-shadowで枠の外側を黒く埋める。埋めないと左右から背後の一覧が見える（.app-shellのoverflow:hiddenで切れる） */
  .player {
    right: auto;
    left: 50%;
    width: min(100%, 500px);
    box-shadow: 0 0 0 100vmax #000;
    transform: translateX(-50%);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

/* PCレイアウト（spec.md §7.1、1024px以上）。スマホ向け指定はこの外に足さない */

/* .side-nav の表示・幅・中身は css/side-nav.css（法務ページ・女優ページと共有） */
.shortcut-help {
  display: none;
}

/* 上下送りはPCだけの操作。スマホではスワイプを使う */
.reel-steps {
  display: none;
}

@media (min-width: 1024px) {
  .app-shell {
    width: 100%;
    max-width: none;
    padding-left: 320px;
    box-shadow: none;
  }

  .bottom-nav {
    display: none !important;
  }

  /* 左サイドバーに既にロゴがあるので、リール側では二重に出さない */
  .reel-brand {
    display: none;
  }

  .screen-content {
    max-width: 1080px;
    padding: 20px 32px 48px;
    margin: 0 auto;
  }

  /* ヘッダー下は44pxで揃える（PCは padding-top 20px + 見出しの margin-top 24px） */
  #screen-mypage .screen-content {
    padding-top: 44px;
  }

  .screen-header {
    padding: 0 32px;
  }

  #screen-home .screen-header .brand,
  #screen-home .screen-header .brand-logo {
    display: none;
  }

  #screen-home .screen-header h1 {
    display: block;
  }

  .thumb-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
  }

  .rank-row {
    margin: 0 0 32px;
    padding: 0;
    cursor: grab;
  }

  .rank-row.dragging {
    cursor: grabbing;
  }

  .rank-row .thumb-card {
    width: 176px;
  }

  .people-list {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
  }

  .people-list .person-card img {
    width: 112px;
    height: 112px;
  }

  .rank-row-people .person-card {
    width: 136px;
    gap: 10px;
  }

  .rank-row-people .person-card img {
    width: 112px;
    height: 112px;
  }

  .info-note {
    max-width: 78ch;
  }

  /* リールは中央に1件。操作アイコンは動画の外側に置き、重ねない */
  /* right:0+padding-rightで背景を左サイドバー端まで届かせる。right:320pxのままだと背後が透けて見える */
  .player {
    right: 0;
    left: 320px;
    display: none;
    place-items: center;
    padding: 20px 0;
  }

  .player.active {
    display: grid;
  }

  /* 320px=左サイドバーを差し引いた実幅を明示する。autoだとgrid列幅が縮み動画が小さくなる。320pxは.side-nav/.playerと連動 */
  .reel-feed {
    width: min(calc(100vw - 320px), 1300px);
    height: 100%;
  }

  /* rail/captionはabsolute化するので1行gridでよい。中央列1frはautoだと行が縮み動画が小さくなる（Chromium実測） */
  .reel-slide {
    display: grid;
    grid-template-areas: "spacer media rail";
    grid-template-columns: 80px minmax(0, 1fr) 80px;
    align-content: center;
    justify-content: center;
    height: 100%;
    background: transparent;
  }

  /* 動画比率(spec.md §7.1)に合わせる。max-heightはキャプション分(行の外・absolute)を差し引いて確保する */
  .slide-media {
    position: relative;
    grid-area: media;
    inset: auto;
    width: 100%;
    height: auto;
    max-width: min(70vw, 1100px);
    /* 130px = キャプションの高さ + シークバーを動画の外に置く16px */
    max-height: calc(100dvh - 146px);
    aspect-ratio: var(--media-ratio, 9 / 16);
    overflow: hidden;
    border-radius: 14px;
  }

  /* キャプションを動画の下へ出すため、動画に重ねる下半分の暗幕は不要 */
  .slide-media::after {
    display: none;
  }

  /* height:100%はmax-heightで縮む前の高さが基準になり枠からはみ出すため、positionで合わせる */
  /* > を外すと .slide-media > img の詳細度に負けて object-fit が cover のままになる */
  .slide-media video,
  .slide-media > .slide-thumb {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: 50% 40%;
  }

  /* railの高さが動画より高いことがある。grid行のstretchに任せず動画下端へ直接吸わせる */
  .side-rail {
    position: absolute;
    grid-area: rail;
    right: auto;
    left: 10px;
    bottom: 18px;
    transform: none;
  }

  /* grid-area:media(動画の枠)基準でabsolute化し動画の真下へ出す。railと同様、動画の実サイズに追随する */
  .reel-caption {
    position: absolute;
    grid-area: media;
    top: 100%;
    right: 0;
    bottom: auto;
    left: 0;
    z-index: 2;
    /* 30px = シークバーの上余白10px + 高さ6px + バーとの間隔14px */
    margin-top: 30px;
    padding: 0;
  }

  /* 動画の外に出しており余白があるので、PCでは行数を制限しない */
  .reel-caption h2,
  .reel-caption p {
    -webkit-line-clamp: none;
  }

  /* JSで.reel-slideへ移す。キャプションと同じくgrid-area:media基準で動画の真下へ出し、重ねない */
  .seek-bar,
  .app-shell.immersive .seek-bar {
    grid-area: media;
    top: 100%;
    right: 0;
    bottom: auto;
    left: 0;
    height: 6px;
    margin-top: 10px;
    overflow: hidden;
    border-radius: 3px;
  }

  .seek-bar.scrubbing,
  .app-shell.immersive .seek-bar.scrubbing {
    height: 9px;
  }

  /* マウスを乗せやすいよう上下に当たり判定を広げる。下部ナビが無いので下も広げてよい */
  .seek-bar::before,
  .app-shell.immersive .seek-bar::before {
    inset: -9px 0;
  }

  /* 右ペイン下のショートカット一覧。displayは1400px以上のブロックで出す */
  .shortcut-help {
    position: fixed;
    z-index: 25;
    right: 24px;
    bottom: 24px;
    width: 272px;
    padding: 14px 16px;
    border: 1px solid #1f1f22;
    border-radius: 14px;
    background: #101012;
  }

  .shortcut-help h2 {
    margin: 0 0 10px;
    color: #d8d8dc;
    font-size: 0.76rem;
    font-weight: 700;
  }

  .shortcut-help dl {
    display: grid;
    gap: 7px;
    margin: 0;
  }

  .shortcut-help dl > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }

  .shortcut-help dt {
    color: #85858c;
    font-size: 0.72rem;
  }

  .shortcut-help dd {
    margin: 0;
  }

  .shortcut-help kbd {
    display: inline-grid;
    min-width: 26px;
    height: 22px;
    place-items: center;
    padding: 0 6px;
    border: 1px solid #35353a;
    border-radius: 6px;
    background: #1a1a1d;
    color: #d8d8dc;
    font-family: inherit;
    font-size: 0.68rem;
  }

  /* プレイヤーは左右にペインぶんの余白があるので、画面の右端に固定する */
  .mute-toggle {
    position: fixed;
    top: 24px;
    right: 24px;
    width: 52px;
    height: 52px;
  }

  .mute-toggle svg,
  .immersive-exit svg {
    width: 26px;
    height: 26px;
  }

  /* 全画面中に出す唯一の操作。他のUIを畳むので、これだけは動画の上に置く */
  .app-shell.immersive .immersive-exit {
    display: grid;
    position: fixed;
    z-index: 26;
    top: 24px;
    right: 24px;
    width: 52px;
    height: 52px;
  }

  .player-close {
    top: 24px;
    left: 28px;
  }

  /* 下部ナビが無いぶん、nav-heightを足さずビューポート右下に固定する */
  .scroll-top-button {
    position: fixed;
    right: 24px;
    bottom: 24px;
  }

  .info-sheet {
    right: auto;
    left: 50%;
    width: min(70vw, 900px);
    border-radius: 20px 20px 0 0;
    transform: translateX(-50%);
  }

  .app-shell.immersive .reel-notice,
  .app-shell.immersive .player > .info-sheet {
    left: 50%;
  }

  /* 全画面: 左サイドバー・右ペイン・操作アイコンを畳み、動画をビューポートいっぱいに広げる */
  .app-shell.immersive .side-nav {
    display: none;
  }

  .app-shell.immersive .player {
    left: 0;
    padding: 0;
  }

  .app-shell.immersive .reel-feed {
    width: 100%;
  }

  /* アイコン列を畳むので、左右の空け幅も0にして中央列に全幅を渡す */
  .app-shell.immersive .reel-slide {
    grid-template-columns: 0 minmax(0, 1fr) 0;
  }

  /* 48px = シークバー16px + 上下の余白。動画は行の中央に置かれるので上下に均等に残る */
  .app-shell.immersive .slide-media {
    max-width: 100%;
    max-height: calc(100dvh - 48px);
    border-radius: 0;
  }

  /* ショートカット一覧は右ペインと一緒に不要 */
  .app-shell.immersive .shortcut-help {
    display: none;
  }

  /* 削除ボタンは1行の文字数ぶんあればよい。画面幅いっぱいだと間延びする */
  .danger-item {
    max-width: 420px;
  }
}


/* 読み込みに失敗した画像（js/broken-image.js）。枠は残して中身だけ消す */
.is-broken {
  visibility: hidden;
}

/* 右ペイン(ショートカット一覧)は1400px以上でだけ出す。それ未満は320pxぶんをリール動画へ回す */
@media (min-width: 1400px) {
  .shortcut-help {
    display: block;
  }

  /* right:0+padding-rightで背景を左サイドバー端まで届かせる。right:320pxのままだと背後が透けて見える */
  .player {
    padding-right: 320px;
  }

  /* 640px=320px×2(左右のペイン)。320pxは.side-nav/.playerと連動 */
  .reel-feed {
    width: min(calc(100vw - 640px), 1300px);
  }

  /* #playerのpadding-right:320pxでleft:50%が中心より右にずれる。160px=320px/2を引いて中心へ戻す */
  .reel-notice,
  .player > .info-sheet {
    left: calc(50% - 160px);
  }
}
