/* ---- 基本 ---- */

:root {
  --bg: #0b0a12;                          /* 紫がかった黒 */
  --surface: rgba(255, 255, 255, 0.045);
  --surface-solid: #15131f;
  --surface-2: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.18);
  --fg: #f4f2fb;
  --muted: #a29fb5;
  --chip: rgba(12, 10, 20, 0.62);   /* ぼかし（backdrop-filter）は重いので使わず、濃さで読みやすくする */
  --chip-solid: rgba(255, 255, 255, 0.08);
  --accent: #ff4d7a;
  --accent-2: #8b5cf6;
  --accent-grad: linear-gradient(135deg, #ff4d7a 0%, #c45bf0 55%, #8b5cf6 100%);
  --accent-fg: #fff;
  --danger: #ff5a5f;
  --tabbar-h: 60px;
  --header-h: 60px;
  --radius: 14px;
  --gutter: 16px;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  color-scheme: dark;
}

* { box-sizing: border-box; }

/* 背景色は html にだけ付ける（body に付けると、後ろに置いた .ambient の光を覆ってしまう） */
html { background: var(--bg); }
html, body {
  margin: 0;
  min-height: 100%;
  color: var(--fg);
  /* 外部フォントは使わない（中国本土では Google Fonts が使えない）。中国語は各 OS の標準フォントへ */
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "PingFang SC", "PingFang TC",
    "Hiragino Sans GB", "Microsoft YaHei", "Microsoft JhengHei", "Noto Sans SC", "Noto Sans TC", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

a { color: inherit; }
button { font: inherit; color: inherit; }
img { max-width: 100%; }
[hidden] { display: none !important; }

.icon { width: 22px; height: 22px; flex: none; }
.icon.filled { fill: currentColor; stroke: none; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- ボタン・チップ ---- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--fg);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.btn .icon { width: 18px; height: 18px; }
.btn.small { min-height: 34px; padding: 6px 12px; font-size: 13px; }
.btn.primary {
  border-color: transparent;
  background: var(--accent-grad);
  color: var(--accent-fg);
  font-weight: 600;
  box-shadow: 0 6px 24px rgba(255, 77, 122, 0.25);
}
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { border-color: transparent; background: var(--danger); color: #fff; }
.btn.danger-text { color: var(--danger); }
.btn[aria-pressed="true"] { border-color: var(--fg); }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--border) !important;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding: 5px 12px;
  border: 0;
  border-radius: 999px;
  background: var(--chip-solid);
  color: var(--fg);
  font-size: 13px;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.chip small { color: var(--muted); }
.chip .icon { width: 14px; height: 14px; }
.chip.active { background: var(--fg); color: var(--bg); border-color: transparent !important; }
a.chip:hover { border-color: var(--border-strong) !important; background: var(--surface-2); }
.chip.ghost { background: transparent; border: 1px solid rgba(255, 255, 255, 0.5); }

.field {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--fg);
  font: inherit;
  font-size: 16px;   /* iOS で入力時にズームさせない */
}
.field:focus { outline: none; border-color: var(--fg); }

/* ---- タブバー ---- */

.tabbar {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(11, 10, 18, 0.94);
  border-top: 1px solid var(--border);
}
.tabbar a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--muted);
  font-size: 11px;
  text-decoration: none;
}
.tabbar a { position: relative; transition: color 0.2s; }
.tabbar a[aria-current="page"] { color: var(--fg); }
.tabbar a[aria-current="page"]::before {
  content: "";
  position: absolute;
  top: -1px;
  width: 28px;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--accent-grad);
  box-shadow: 0 0 12px rgba(255, 77, 122, 0.7);
}
.tabbar a[aria-current="page"] .icon { filter: drop-shadow(0 0 6px rgba(196, 91, 240, 0.6)); }

/* ---- フィード ---- */

.page-feed { overflow: hidden; }

.feed {
  height: 100dvh;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-snap-type: y mandatory;
  overscroll-behavior: contain;
  scrollbar-width: none;
}
.feed::-webkit-scrollbar { display: none; }

.card, .status-card {
  position: relative;
  height: 100dvh;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  scroll-snap-align: start;
  scroll-snap-stop: always;
  overflow: hidden;
}

/* 同じ画像をぼかして、画像の周りの余白を埋める。
   取り込み時にぼかした小さな画像（/img/blur/）を引き伸ばすだけなので、ブラウザでぼかしを計算しない */
.backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.1);
  pointer-events: none;
  animation: fade-in 0.25s ease-out both;
  transition: opacity 0.2s;
}
/* 背景を暗くして、手前の画像を引き立たせる（filter を使わず、上に半透明の黒を重ねる） */
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: rgba(8, 7, 14, 0.55);
  pointer-events: none;
}
.card > .stage { z-index: 2; }
@keyframes fade-in { from { opacity: 0; } }

/* stage: 画像と操作の列。横スワイプではこれごと動く */
.stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  margin: 0 auto;
  /* 指を離して元に戻るときは、少し行き過ぎてから戻る */
  transition: transform 0.38s cubic-bezier(0.34, 1.5, 0.64, 1), opacity 0.2s;
  will-change: transform;
}
.card.dragging .stage { transition: none; }
.card.leaving .stage {
  opacity: 0;
  transition: transform var(--fly-ms, 220ms) cubic-bezier(0.4, 0, 1, 1), opacity var(--fly-ms, 220ms) ease-in;
}
/* 飛ばした画像の次が、下からふわっと出てくる */
.card.entering .stage { animation: card-enter 0.32s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
@keyframes card-enter { from { opacity: 0; transform: translate3d(0, 28px, 0) scale(0.97); } }
.card.leaving .backdrop { opacity: 0; }

.photo {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  opacity: 0;
  transform: scale(0.985);
  transition: opacity 0.18s ease-out, transform 0.25s ease-out;
  touch-action: pan-y;          /* 縦はブラウザのスクロール、横は自前のスワイプ。ダブルタップのズームは無効 */
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;  /* iOS の長押しメニューを出さない */
}
.card.loaded .photo { opacity: 1; transform: none; }

/* 画像の読み込み中 */
.card:not(.loaded) .stage::after {
  content: "";
  position: absolute;
  width: 32px;
  height: 32px;
  border: 3px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.card-shade {
  position: absolute;
  inset: auto 0 0 0;
  height: 40%;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.55));
  pointer-events: none;
}

.card-tags {
  position: absolute;
  left: 0;
  right: 76px;
  bottom: 20px;
  /* 2 段に並べ、続きは横にスクロール */
  display: grid;
  grid-template-rows: repeat(2, auto);
  grid-auto-flow: column;
  grid-auto-columns: max-content;
  gap: 6px;
  padding: 0 var(--gutter);
  overflow-x: auto;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
  /* 右端をぼかして、続きがあることを示す */
  -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent);
  mask-image: linear-gradient(90deg, #000 85%, transparent);
}
.card-tags::-webkit-scrollbar { display: none; }
.card-tags .chip { padding: 4px 10px; font-size: 12px; }
.card-tags .chip { background: var(--chip); }

.card-actions {
  position: absolute;
  right: 12px;
  bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* 表示中の画像に切り替わったら、タグとボタンを少し遅れて出す */
.card-tags, .card-actions { transition: opacity 0.18s, transform 0.18s; }
.card:not(.active) .card-tags, .card:not(.active) .card-actions { opacity: 0; transform: translateY(4px); }
.card.dragging .card-tags, .card.dragging .card-actions { opacity: 0; transition-delay: 0s; }

.act {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 56px;
  padding: 0;
  border: 0;
  background: none;
  font-size: 12px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
  cursor: pointer;
}
.act .icon {
  width: 48px;
  height: 48px;
  padding: 12px;
  border-radius: 50%;
  background: var(--chip);
  transition: transform 0.15s;
}
.act:active .icon { transform: scale(0.9); }
.act-like[aria-pressed="true"] .icon { color: var(--accent); fill: var(--accent); animation: like-pop 0.3s; }
.act-save[aria-pressed="true"] .icon { fill: currentColor; }
@keyframes like-pop { 50% { transform: scale(1.2); } }

/* 横スワイプ中に出る「好き」「スキップ」の判子 */
.stamp {
  position: absolute;
  top: 16%;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 3px solid currentColor;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.3);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.05em;
  opacity: 0;
  pointer-events: none;
}
.stamp .icon { width: 24px; height: 24px; }
.stamp-like { left: 24px; color: var(--accent); transform: rotate(-12deg); }
.stamp-skip { right: 24px; color: #fff; transform: rotate(12deg); }

/* PC 幅: 画像の列を中央に置き、ボタンはその右外側に並べる */
@media (min-width: 900px) {
  .stage { width: min(100% - 200px, 760px); }
  .card-tags { left: 0; right: 0; padding: 0; }
  .card-actions { right: -84px; }
  .card-shade { display: none; }
}

.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) var(--gutter) 10px;
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.topbar-tags { display: flex; gap: 8px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.topbar-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.chip.glass { background: var(--chip); min-height: 32px; }
#auto[aria-pressed="true"] { background: var(--fg); color: var(--bg); }

/* 自動スワイプ: 残り時間のバー、一時停止の表示 */
.auto-progress {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 25;
  height: 3px;
  background: rgba(255, 255, 255, 0.15);
  pointer-events: none;
}
.auto-progress span { display: block; height: 100%; background: var(--fg); transform-origin: left; transform: scaleX(0); }
@keyframes auto-progress { to { transform: scaleX(1); } }
.auto-state {
  position: absolute;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  pointer-events: none;
  transform: translate(-50%, -50%);
  animation: auto-state 0.7s ease-out forwards;
}
.auto-state .icon { width: 32px; height: 32px; }
@keyframes auto-state { 0% { opacity: 0; transform: translate(-50%, -50%) scale(0.7); } 25% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 100% { opacity: 0; } }
.icon-btn.glass { background: var(--chip); }

.burst {
  position: absolute;
  z-index: 3;
  pointer-events: none;
  color: var(--accent);
  transform: translate(-50%, -50%) scale(0.6);
  animation: pop 0.7s ease-out forwards;
  filter: drop-shadow(0 4px 16px rgba(0, 0, 0, 0.4));
}
.burst .icon { width: 110px; height: 110px; }
@keyframes pop {
  30% { transform: translate(-50%, -50%) scale(1.15); opacity: 1; }
  100% { transform: translate(-50%, -65%) scale(1); opacity: 0; }
}

/* 長押し: 押した場所に輪と「好き」 */
.marker {
  position: absolute;
  z-index: 3;
  width: 48px;
  height: 48px;
  border: 3px solid var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.3), 0 0 24px rgba(255, 59, 92, 0.5);
  pointer-events: none;
  transform: translate(-50%, -50%);
  animation: ring 1.1s ease-out forwards;
}
.marker-label {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 6px);
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  transform: translateX(-50%);
}
@keyframes ring {
  0% { transform: translate(-50%, -50%) scale(0.6); opacity: 0; }
  20% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  75% { opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1.25); opacity: 0; }
}

/* ほかの人が長押しした場所から浮かぶ ♡（外側で位置、内側で動き） */
.float-heart-wrap {
  position: absolute;
  z-index: 2;
  pointer-events: none;
  width: 0;
  height: 0;
}
.float-heart {
  position: absolute;
  left: -14px;
  top: -14px;
  display: block;
  color: var(--accent);
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.45));
  opacity: 0;
  animation: float-up 2.4s ease-out forwards;
}
.float-heart .icon { width: 28px; height: 28px; }
@keyframes float-up {
  0% { transform: translate(0, 0) scale(0.4); opacity: 0; }
  15% { transform: translate(0, -6px) scale(1.05); opacity: 0.95; }
  30% { transform: translate(calc(var(--dx, 0px) * 0.4), -24px) scale(1); }
  100% { transform: translate(var(--dx, 0px), -110px) scale(0.85); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .float-heart { animation: float-fade 1.6s ease-out forwards; }
  @keyframes float-fade { 20% { opacity: 0.9; } 100% { opacity: 0; } }
}

/* 読み込み中・空・エラー */
.status-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
  color: var(--muted);
  text-align: center;
}
.status-card p { margin: 0; }
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--fg);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 使い方 */
.guide-steps { display: grid; gap: 14px; margin: 0; padding: 0; list-style: none; }
.guide-step { display: flex; align-items: center; gap: 14px; }
.guide-step strong { display: block; font-size: 15px; }
.guide-step small { color: var(--muted); font-size: 13px; }
.guide-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 50%;
  background: var(--surface-2);
}
.guide-pc { margin: 16px 0 0; }
@media (hover: none) { .guide-pc { display: none; } }
.nudge-up { animation: nudge-y 1.6s ease-in-out infinite; }
.nudge-right { animation: nudge-x 1.6s ease-in-out infinite; }
.nudge-left { animation: nudge-x 1.6s ease-in-out infinite reverse; }
@keyframes nudge-y { 50% { transform: translateY(-4px); } }
@keyframes nudge-x { 50% { transform: translateX(4px); } }
.btn.wide { width: 100%; }

/* ---- 一覧系のページ（検索・ランキング・マイページ） ---- */

.page {
  position: relative;
  max-width: 1120px;
  margin: 0 auto;
  padding: 8px var(--gutter) calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 40px);
}

.page-head {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  margin: 0 calc(-1 * var(--gutter));
  padding: 8px var(--gutter);
}
.page-head h1 {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  margin: 0;
  font-size: 20px;
}
.page-head h1 .title-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-head h1 small { font-size: 13px; font-weight: normal; }
.head-actions { display: flex; gap: 8px; margin-left: auto; }
.page-head h1 small { white-space: nowrap; }
.page-head.stacked { flex-wrap: wrap; row-gap: 4px; }
.page-head.stacked h1 { flex: 1 1 100%; }
.page-head.stacked .head-actions { margin-left: 0; }

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 32px 0 12px;
  font-size: 17px;
  letter-spacing: 0.01em;
}
.section-title::before {
  content: "";
  width: 4px;
  height: 1.1em;
  border-radius: 2px;
  background: var(--accent-grad);
}
.section-note { margin: -6px 0 12px; color: var(--muted); font-size: 13px; }
.note { margin-top: 32px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
@media (max-width: 480px) {
  .grid { grid-template-columns: repeat(3, 1fr); gap: 4px; }
}
.cell { position: relative; }
.cell-link {
  display: block;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--border);
  transition: transform 0.2s, box-shadow 0.2s;
}
@media (hover: hover) {
  .cell-link:hover { transform: translateY(-2px); box-shadow: inset 0 0 0 1px var(--border-strong), var(--shadow); }
}
@media (max-width: 480px) { .cell-link { border-radius: 8px; } }
.cell-link img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 0.2s; }
@media (hover: hover) { .cell-link:hover img { transform: scale(1.04); } }
.cell-badge, .cell-likes {
  position: absolute;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--chip);
  font-size: 11px;
  pointer-events: none;
}
.cell-badge { left: 6px; top: 6px; font-weight: 700; }
.cell-likes { right: 6px; bottom: 6px; }
.cell-likes .icon { width: 11px; height: 11px; color: var(--accent); }
/* フェードインは JS で作るグリッド（検索・マイページ）だけ。ランキングは JS の無い静的ページなので対象外 */
.cell-link img.fade { opacity: 0; transition: opacity 0.18s, transform 0.2s; }
.cell-link img.fade.ready { opacity: 1; }
.cell.skeleton .cell-link, .cell-link:has(img.fade:not(.ready)) {
  background: linear-gradient(100deg, var(--surface) 30%, var(--surface-2) 50%, var(--surface) 70%);
  background-size: 300% 100%;
  animation: shimmer 1.3s linear infinite;
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
.cell-action {
  position: absolute;
  left: 50%;
  bottom: 8px;
  padding: 5px 12px;
  border: 0;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.75);
  font-size: 12px;
  white-space: nowrap;
  transform: translateX(-50%);
  cursor: pointer;
}
.cell:has(.cell-action) .cell-likes { display: none; }
.tab-count { margin-left: 6px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }

.cell-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  display: none;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.75);
  cursor: pointer;
}
.cell-remove .icon { width: 16px; height: 16px; }
.editing .cell-remove { display: grid; }
.editing .cell-link { opacity: 0.75; }

.grid-empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 64px 16px;
  color: var(--muted);
  text-align: center;
}
.grid-empty p { margin: 0; }
.grid-empty .chips { justify-content: center; max-width: 560px; }
.sentinel { height: 1px; }

/* ---- 検索 ---- */

.search-sticky {
  position: sticky;
  top: var(--header-h);
  z-index: 9;
  margin: 0 calc(-1 * var(--gutter));
  padding: 4px var(--gutter) 8px;
  background: linear-gradient(var(--bg) 60%, transparent);
}
.searchbox-icon { color: var(--muted); width: 20px; height: 20px; }
.searchbox-clear {
  padding: 4px 8px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}
.searchbox-input::-webkit-search-cancel-button { display: none; }

.searchbox {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 48px;
  padding: 6px 8px 6px 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
}
.searchbox:focus-within { border-color: var(--fg); }
.searchbox-chips { display: contents; }
.searchbox-input {
  flex: 1 1 80px;
  min-width: 0;
  min-height: 36px;
  border: 0;
  background: transparent;
  color: var(--fg);
  font: inherit;
  font-size: 16px;
}
.searchbox-input:focus { outline: none; }
.suggest {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 15;
  margin: 0;
  padding: 6px;
  list-style: none;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}
.suggest-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
}
.suggest-item small { color: var(--muted); }
.suggest-item[aria-selected="true"], .suggest-item:hover { background: var(--surface-2); }

.results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 20px 0 10px;
}
.results-head p { margin: 0; }

.segmented {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: var(--surface-2);
}
.segmented button {
  padding: 5px 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}
.segmented button[aria-pressed="true"] { background: var(--fg); color: var(--bg); }

/* ---- マイページ ---- */

.tabs {
  display: flex;
  gap: 4px;
  margin: 4px 0 16px;
  border-bottom: 1px solid var(--border);
}
.tabs button {
  flex: 1;
  padding: 10px 0;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--muted);
  cursor: pointer;
}
.tabs button[aria-selected="true"] { color: var(--fg); border-bottom-color: var(--fg); }

.folders {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.folder { display: flex; flex-direction: column; gap: 2px; text-decoration: none; }
.folder-name { margin-top: 6px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-cover {
  display: grid;
  aspect-ratio: 1;
  gap: 2px;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--surface);
  place-items: center;
  color: var(--muted);
}
.folder-cover .icon { width: 40px; height: 40px; }
.folder-cover img { width: 100%; height: 100%; object-fit: cover; }
.folder-cover.n2 { grid-template-columns: 1fr 1fr; }
.folder-cover.n3 { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; }
.folder-cover.n3 img:first-child { grid-row: span 2; }

/* ---- 分析（管理画面） ---- */

.page.wide { max-width: 1280px; padding-bottom: 48px; }
.status-inline { display: grid; place-items: center; padding: 64px 0; }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
  margin-top: 8px;
}
.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--surface);
}
.stat-label { color: var(--muted); font-size: 12px; }
.stat-value { font-size: 22px; font-variant-numeric: tabular-nums; }
.stat-sub { color: var(--muted); font-size: 12px; }

.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.admin-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--surface);
  text-decoration: none;
}
.admin-card img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.admin-card-id { padding: 8px 10px 0; font-size: 12px; color: var(--muted); }
.admin-card-stats {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 8px;
  margin: 6px 10px 10px;
  font-size: 12px;
}
.admin-card-stats dt { color: var(--muted); }
.admin-card-stats dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
@media (hover: hover) { .admin-card:hover { outline: 1px solid var(--border); } }

.detail { display: grid; gap: 24px; }
@media (min-width: 1000px) { .detail { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; } }

.heat-figure { position: relative; width: fit-content; max-width: 100%; margin: 8px auto 0; }
.heat-image { display: block; max-width: 100%; max-height: 72vh; transition: filter 0.2s; }
.heat-figure.dimmed .heat-image { filter: grayscale(1) brightness(0.45); }
.heat-canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.heat-tip {
  position: absolute;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 150px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(18, 18, 20, 0.95);
  font-size: 12px;
  pointer-events: none;
}
.heat-legend { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.heat-legend-bar {
  width: 160px;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, #104281, #184f95, #256abf, #3987e5, #6da7ec, #9ec5f4, #cde2fb);
}
.heat-legend-note { margin-left: 8px; }

.heat-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-top: 16px; font-size: 14px; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0; padding: 0; border: 0; }
.checks legend { float: left; margin-right: 12px; color: var(--muted); font-size: 12px; }
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.check input, .range input { accent-color: var(--accent); }
.range { display: inline-flex; align-items: center; gap: 8px; }

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; }
.table th { color: var(--muted); font-weight: normal; font-size: 12px; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }

.meta { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0; font-size: 13px; }
.meta dt { color: var(--muted); white-space: nowrap; }
.meta dd { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }

/* ---- ダイアログ・ボトムシート ---- */

dialog {
  padding: 0;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg);
}
dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
.modal-body { padding: 20px; }

dialog.dialog {
  width: min(400px, calc(100% - 32px));
  border-radius: 16px;
}
.modal-title { margin: 0 0 14px; font-size: 17px; }
.modal-text { margin: -6px 0 16px; color: var(--muted); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

dialog.sheet {
  width: min(520px, 100%);
  max-width: 100%;
  max-height: min(80dvh, 640px);
  margin: auto auto 0;
  border-radius: 18px 18px 0 0;
  border-bottom: 0;
  animation: sheet-in 0.2s ease-out;
}
@media (min-width: 600px) {
  dialog.sheet { margin: auto; border-radius: 18px; border-bottom: 1px solid var(--border); }
}
@keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } }
dialog.sheet .modal-body { display: flex; flex-direction: column; max-height: inherit; padding: 8px 16px calc(16px + env(safe-area-inset-bottom)); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 0 10px; }
.sheet-head h2 { margin: 0; font-size: 17px; }
.sheet-list { flex: 1; min-height: 0; overflow-y: auto; margin: 0 -8px; padding: 0; list-style: none; }
.sheet-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 8px;
  border: 0;
  border-radius: 10px;
  background: none;
  text-align: left;
  cursor: pointer;
}
@media (hover: hover) { .sheet-item:hover { background: var(--surface-2); } }
.sheet-cover {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex: none;
  border-radius: 8px;
  background: var(--surface-2);
  object-fit: cover;
  color: var(--muted);
}
.sheet-name { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.sheet-name small { color: var(--muted); font-size: 12px; }
.sheet-check {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 2px solid var(--border);
  border-radius: 50%;
  color: transparent;
}
.sheet-check .icon { width: 16px; height: 16px; }
.sheet-item[aria-pressed="true"] .sheet-check { border-color: var(--accent); background: var(--accent); color: #fff; }
.sheet-empty { padding: 20px 8px; color: var(--muted); font-size: 14px; }
.sheet-new { display: flex; gap: 8px; padding-top: 12px; border-top: 1px solid var(--border); margin-top: 8px; }

/* ---- トースト ---- */

#toast {
  position: fixed;
  inset: calc(16px + env(safe-area-inset-top)) auto auto 50%;
  width: max-content;          /* left: 50% だと幅が画面の半分に縮むため */
  max-width: calc(100vw - 32px);
  margin: 0;
  padding: 10px 16px;
  border: 0;
  border-radius: 10px;
  background: rgba(36, 36, 40, 0.96);
  color: var(--fg);
  font-size: 14px;
  transform: translateX(-50%);
  pointer-events: none;
  animation: toast-in 0.15s ease-out;
}
#toast.has-action {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 6px 8px 6px 16px;
  pointer-events: auto;
}
.toast-action {
  padding: 6px 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--accent);
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, -6px); } }

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

/* ---- デザイン: 背景・ヘッダー・ロゴ・言語切り替え ---- */

/* 一覧系のページの背景。ピンク・紫・青の光がにじむ。うっすら粒子感を重ねる */
.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(60vmax 45vmax at 8% -5%, rgba(255, 77, 122, 0.22), transparent 60%),
    radial-gradient(55vmax 45vmax at 100% 10%, rgba(139, 92, 246, 0.24), transparent 60%),
    radial-gradient(70vmax 50vmax at 50% 110%, rgba(56, 120, 255, 0.16), transparent 60%),
    var(--bg);
}
.ambient::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.page-feed .ambient { display: none; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  height: calc(var(--header-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) var(--gutter) 0;
  background: rgba(11, 10, 18, 0.9);
  border-bottom: 1px solid var(--border);
}
.site-header-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.logo-mark { width: 32px; height: 32px; flex: none; filter: drop-shadow(0 4px 14px rgba(255, 77, 122, 0.35)); }
.logo-text {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, #fff 0%, #ffd0de 45%, #d9c8ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.page-title {
  margin: 20px 0 6px;
  font-size: clamp(24px, 4vw, 34px);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.page-head .page-title { margin: 0; }
.page-head { margin: 12px 0 4px; padding: 0; }
.more-link { margin: 12px 0 0; font-size: 14px; }
.more-link a { color: var(--muted); text-decoration: none; }
.more-link a:hover { color: var(--fg); }

/* 言語切り替え（details 要素。JS 不要） */
.lang { position: relative; }
.lang summary { list-style: none; cursor: pointer; }
.lang summary::-webkit-details-marker { display: none; }
.lang-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 40;
  min-width: 160px;
  margin: 0;
  padding: 6px;
  list-style: none;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(21, 19, 31, 0.96);
  box-shadow: var(--shadow);
}
.lang-menu a {
  display: block;
  padding: 9px 12px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 14px;
}
.lang-menu a:hover { background: var(--surface-2); }
.lang-menu a[aria-current="true"] { color: var(--accent); font-weight: 600; }
.icon-btn.glass {
  border: 1px solid var(--border);
  background: var(--chip);
}

/* ---- ホーム上部 ---- */
.topbar { flex-wrap: wrap; }
.topbar .logo { pointer-events: auto; }
.topbar .logo-mark { width: 30px; height: 30px; }
.topbar .logo-text { font-size: 17px; text-shadow: none; }
@media (max-width: 380px) { .topbar .logo-text { display: none; } }
.topbar-tags { flex: 1 1 100%; order: 3; }
.act-info { color: var(--fg); text-decoration: none; }
.act-info .icon { padding: 13px; }

/* ---- 画像ページ ---- */
.photo-page { display: grid; gap: 20px; margin-top: 16px; }
@media (min-width: 900px) {
  .photo-page { grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr); align-items: start; gap: 32px; }
  .photo-info { position: sticky; top: calc(var(--header-h) + 16px); }
}
.photo-frame {
  display: grid;
  place-items: center;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.photo-frame img { display: block; max-height: 78vh; width: auto; height: auto; border-radius: 12px; }
.photo-title { margin: 0 0 8px; font-size: clamp(20px, 3vw, 26px); font-weight: 800; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.photo-meta { display: flex; align-items: center; gap: 6px; margin: 0 0 18px; color: var(--muted); font-size: 14px; }
.photo-meta .icon { width: 16px; height: 16px; color: var(--accent); }
.photo-meta .dot { opacity: 0.5; }
.photo-info .btn.primary { min-height: 46px; padding: 10px 22px; }

/* ---- タグページ ---- */
.tag-hero {
  margin: 16px 0 20px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(255, 77, 122, 0.16), transparent 60%),
    radial-gradient(120% 140% at 100% 100%, rgba(139, 92, 246, 0.18), transparent 60%),
    var(--surface);
}
.tag-hero .page-title { margin: 0 0 4px; overflow-wrap: anywhere; }
.tag-hero p { margin: 0 0 16px; }
.tag-actions { display: flex; flex-wrap: wrap; gap: 8px; }
/* タグページ: 上の「スワイプで見る」が画面から外れたら、同じボタンを画面下（タブバーの上）に出す（tagpage.js） */
.swipe-fab {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 12px);
  z-index: 25;
  max-width: calc(100% - 32px);
  transform: translate(-50%, 16px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45), 0 6px 24px rgba(255, 77, 122, 0.3);
}
.swipe-fab.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
@media (prefers-reduced-motion: reduce) { .swipe-fab { transition: none; } }
.page-tags .chips { margin-top: 16px; }

/* ダイアログ・シートも少しガラス寄りに */
dialog { background: rgba(21, 19, 31, 0.97); border-color: var(--border); box-shadow: var(--shadow); }
.stat, .admin-card, .folder-cover { border: 1px solid var(--border); }

/* ---- R18 ---- */
.r18-badge {
  position: absolute;
  left: 6px;
  bottom: 6px;
  padding: 1px 7px;
  border-radius: 6px;
  background: #d03b3b;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  pointer-events: none;
}
.card-r18 { left: 12px; top: calc(var(--header-h) + 8px); bottom: auto; font-size: 12px; z-index: 2; }

/* 設定のスイッチ */
.setting {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
}
.setting-text { display: flex; flex: 1; flex-direction: column; gap: 2px; }
.setting-text small { color: var(--muted); font-size: 13px; }
.switch { position: relative; flex: none; width: 46px; height: 28px; }
.switch input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.switch-ui {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  transition: background 0.15s;
  pointer-events: none;
}
.switch-ui::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s;
}
.switch input:checked + .switch-ui { background: var(--accent-grad); border-color: transparent; }
.switch input:checked + .switch-ui::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-ui { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- 画像の管理（/admin/review/） ---- */
.review-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 16px 0 4px; }
.review-search { max-width: 280px; }
.review-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0 0 96px;
  list-style: none;
}
.rv-card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.rv-card.is-selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.rv-card.is-hidden .rv-thumb img { opacity: 0.35; filter: grayscale(1); }
.rv-thumb { display: block; padding: 0; border: 0; background: var(--surface-solid); cursor: zoom-in; }
.rv-thumb img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; }
.rv-check {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.6);
  cursor: pointer;
}
.rv-check input { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
.rv-badges { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px 10px 0; min-height: 8px; }
.rv-badge { padding: 1px 7px; border-radius: 6px; font-size: 11px; font-weight: 700; }
.rv-r18 { background: #d03b3b; color: #fff; }
.rv-hidden { background: #e9e6f5; color: #111; }
.rv-manual { background: var(--accent-2); color: #fff; }
.rv-notag { background: #fab219; color: #111; }
.rv-meta { display: flex; flex-direction: column; gap: 1px; padding: 6px 10px 0; min-width: 0; }
.rv-meta strong { font-size: 13px; }
.rv-meta small { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.rv-actions { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 10px 10px; margin-top: auto; }
.rv-actions .btn { min-height: 30px; padding: 4px 10px; font-size: 12px; }

.review-bar {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 30;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  padding: 12px var(--gutter) calc(12px + env(safe-area-inset-bottom));
  background: rgba(21, 19, 31, 0.97);
  border-top: 1px solid var(--border-strong);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.4);
}
.review-bar-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.page-review .tabbar { display: none; }

dialog.rv-preview { width: min(1100px, calc(100% - 24px)); border-radius: 16px; }
.rv-preview-body { display: grid; gap: 20px; }
@media (min-width: 860px) { .rv-preview-body { grid-template-columns: minmax(0, 1fr) 380px; } }
.rv-preview-img { width: 100%; max-height: 78vh; object-fit: contain; border-radius: 10px; background: var(--surface-solid); }
.rv-preview-info { min-width: 0; }
.rv-preview-info .chips { max-height: 220px; overflow-y: auto; }
.rv-prompt { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--muted); }

/* ---- 紹介ページ（/about/） ---- */
.header-link { color: var(--muted); font-size: 14px; text-decoration: none; }
.header-link:hover { color: var(--fg); }
.about-lead { max-width: 640px; margin: 8px 0 16px; line-height: 1.7; }
.about-list { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.about-list li { display: grid; gap: 2px; }
.about-list strong { font-size: 15px; }
.about-list strong a { color: inherit; }
.about-list span { color: var(--muted); font-size: 14px; line-height: 1.6; }
.faq { margin: 0; }
.faq dt { margin-top: 14px; font-weight: 600; }
.faq dd { margin: 4px 0 0; color: var(--muted); font-size: 14px; line-height: 1.6; }
.about > section { margin-top: 28px; }
.about > .tag-actions { margin: 32px 0 8px; }
.guide-about { margin: 12px 0 0; }

/* ---- フッター（規約・ポリシー・削除依頼へのリンク） ---- */
.site-footer { margin-top: 48px; padding-top: 16px; border-top: 1px solid var(--border); }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.site-footer a { color: var(--muted); font-size: 13px; text-decoration: none; }
.site-footer a:hover { color: var(--fg); }

/* ---- 利用規約・プライバシーポリシー・削除依頼 ---- */
.legal { max-width: 760px; }
.legal section { margin-top: 24px; }
.legal h2 { margin: 0 0 8px; font-size: 18px; }
.legal p, .legal li { line-height: 1.7; overflow-wrap: anywhere; }
.legal ul { margin: 8px 0; padding-left: 1.4em; }
.legal-form { display: grid; gap: 14px; margin-top: 28px; }
.legal-form label { display: grid; gap: 6px; font-size: 14px; font-weight: 600; }
.legal-form textarea { resize: vertical; font: inherit; }
.legal-form .legal-check { display: flex; align-items: flex-start; gap: 10px; font-weight: normal; line-height: 1.6; }
.legal-form .legal-check input { margin-top: 5px; flex: none; }
.legal-form .btn { justify-self: start; }

/* ---- 管理画面: 削除依頼 ---- */
.td-list { display: grid; gap: 14px; margin: 16px 0 0; padding: 0; list-style: none; }
.td-card { padding: 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2); }
.td-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.td-status { padding: 2px 10px; border-radius: 999px; font-size: 12px; background: var(--chip); }
.td-status.td-open { background: var(--accent); color: #fff; }
.td-fields { display: grid; grid-template-columns: 5em 1fr; gap: 6px 12px; margin: 12px 0; }
.td-fields dt { color: var(--muted); }
.td-fields dd { margin: 0; overflow-wrap: anywhere; }
.td-fields ul { margin: 0; padding: 0; list-style: none; }
.td-details { white-space: pre-wrap; }
.td-review { font-size: 13px; }
.td-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* 管理画面: SNS の投稿文 */
.post-controls { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
.post-list { display: grid; gap: 14px; margin: 16px 0 0; padding: 0; list-style: none; }
.post-card { display: grid; grid-template-columns: 160px 1fr; gap: 16px; padding: 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2); }
.post-thumb img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 10px; background: var(--surface-solid); }
.post-body { display: grid; gap: 10px; min-width: 0; align-content: start; }
.post-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.post-status { padding: 2px 10px; border-radius: 999px; font-size: 12px; background: var(--accent); color: #fff; }
.post-status.done { background: var(--chip); color: inherit; }
.post-text { width: 100%; resize: vertical; font: inherit; line-height: 1.5; }
.post-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
/* 管理画面: 検索された言葉 */
.admin-searches { margin: 24px 0; }
.admin-table { width: 100%; max-width: 720px; border-collapse: collapse; font-size: 14px; }
.admin-table th, .admin-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); text-align: left; overflow-wrap: anywhere; }
.admin-table .num { text-align: right; white-space: nowrap; }
.admin-table tr.zero td:first-child { color: var(--accent, #ff4d7a); font-weight: 600; }
.post-reply-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.post-reply { flex: 1 1 260px; min-width: 0; font: inherit; }
.post-reply-row small { flex-basis: 100%; }
.post-len { margin-right: auto; color: var(--muted); font-variant-numeric: tabular-nums; }
.post-len.over { color: #ff6b6b; font-weight: 700; }
@media (max-width: 600px) {
  .post-card { grid-template-columns: 1fr; }
  .post-thumb img { max-width: 240px; }
}

/* ---- 全画面表示（自動スワイプ中、しばらく操作が無いとき。feed.js が body に .immersive を付ける） ---- */
.topbar, .tabbar, .card-shade { transition: opacity 0.4s ease; }
.immersive .topbar,
.immersive .tabbar,
.immersive .card .card-tags,
.immersive .card .card-actions,
.immersive .card-shade {
  opacity: 0 !important;
  pointer-events: none !important;
  transition: opacity 0.4s ease !important;
}
.immersive .auto-progress { opacity: 0.6; }
.immersive, .immersive * { cursor: none; }

/* 設定: 縦並びの項目・3 択の切り替え・スワイプに出すタグ */
.setting + .setting { margin-top: 12px; }
.setting-col { flex-direction: column; align-items: stretch; gap: 12px; cursor: default; }
.seg { display: flex; padding: 3px; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface-2); }
.seg-option { position: relative; flex: 1; cursor: pointer; }
.seg-option input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.seg-option span { display: block; padding: 8px 6px; border-radius: 999px; text-align: center; font-size: 14px; color: var(--muted); transition: background 0.15s, color 0.15s; }
.seg-option input:checked + span { background: var(--fg); color: var(--bg); font-weight: 600; }
.seg-option input:focus-visible + span { outline: 2px solid var(--accent, #fff); outline-offset: 1px; }
/* スワイプに出すタグ: 上の枠（選んだタグ）へ、下の一覧からドラッグする */
.settings { margin-top: 8px; }
.pref-box {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 8px;
  min-height: 64px;
  padding: 10px;
  border: 2px dashed var(--border-strong);
  border-radius: 14px;
  transition: border-color 0.15s, background 0.15s;
}
.pref-box.pref-over { border-color: var(--fg); background: var(--surface-2); }
.pref-placeholder { margin: auto; }
.pref-pool { display: flex; flex-wrap: wrap; gap: 8px; max-height: 320px; overflow-y: auto; padding: 2px; }
.pref-pool-title { margin: 4px 0 -4px; }
.pref-chip { touch-action: pan-y; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; cursor: grab; font: inherit; font-size: 14px; }
.pref-chip:disabled { opacity: 0.35; cursor: default; }
.pref-chip.pref-held { transform: scale(1.08); transition: transform 0.12s; }
.pref-chip.pref-dragging { opacity: 0.3; }
.pref-x { display: inline-flex; padding: 0; margin: 0 -4px 0 2px; border: 0; background: none; color: inherit; cursor: pointer; }
.pref-ghost {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 100;
  margin: 0;
  pointer-events: none;
  cursor: grabbing;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
}
.pref-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--fg);
  font: inherit;
  font-size: 16px;
}
.setting-col > .btn { align-self: flex-start; }

/* ランキング: 全年齢 / R18 の切り替え（表示設定で R18 を含めている人だけ） */
.rank-tabs { display: flex; gap: 8px; margin: 4px 0 8px; }
.rank-tabs .chip { cursor: pointer; font: inherit; font-size: 14px; }
.rank-tabs .chip[aria-selected="true"] { background: var(--fg); color: var(--bg); border-color: transparent; }

/* SNS の投稿（Bluesky） */
.post-help { margin: 4px 0 8px; padding-left: 20px; display: grid; gap: 4px; }
.post-notice { padding: 10px 14px; border: 1px solid #ff6b6b; border-radius: 10px; background: rgba(255, 107, 107, 0.1); }
.post-field { display: grid; gap: 4px; }
.post-alt { width: 100%; resize: vertical; font: inherit; font-size: 14px; }
.post-label-row { display: inline-flex; align-items: center; gap: 6px; }
.post-label { width: auto; font: inherit; font-size: 14px; padding: 4px 8px; }
.post-label-row small { white-space: nowrap; }
.post-result { display: inline-flex; gap: 10px; align-items: center; font-size: 13px; }
.post-reactions { color: var(--muted); font-variant-numeric: tabular-nums; }
.post-text:disabled, .post-alt:disabled { opacity: 0.6; }
