/* aipx.jp - AI Stock Photo Gallery */
:root {
  --bg: #0a0a0f;
  --bg2: #12121a;
  --bg3: #1a1a26;
  --surface: #1e1e2e;
  --border: #2a2a3a;
  --text: #e8e8f0;
  --text2: #8888a0;
  --text3: #5c5c72;
  --accent: #6366f1;
  --accent2: #818cf8;
  --accent-bg: rgba(99, 102, 241, 0.1);
  --green: #22c55e;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
  --max-w: 1280px;
  --header-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', 'Noto Sans JP', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
img {
  max-width: 100%; height: auto; display: block;
  -webkit-user-drag: none;
  -khtml-user-drag: none;
  -moz-user-drag: none;
  user-drag: none;
  -webkit-user-select: none;
  user-select: none;
  pointer-events: none;
}
/* クリック・DL操作が必要な要素は pointer-events を戻す */
a img, button img, .gallery-item img, .photo-frame img, .photo-figure img, .dl-wait-thumb img,
.fav-btn img, .gallery-fav img { pointer-events: auto; }

.container { max-width: var(--max-w); margin: 0 auto; padding: 0 20px; }

/* === Header === */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  height: var(--header-h);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  height: 100%;
}

.logo {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
  white-space: nowrap;
}
.logo span { color: var(--accent); }

.search-form {
  flex: 1;
  max-width: 480px;
  position: relative;
}

.search-form input {
  width: 100%;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 10px 16px 10px 42px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search-form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}
.search-form input::placeholder { color: var(--text3); }

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text3);
  pointer-events: none;
}

.header-nav { display: flex; gap: 16px; align-items: center; margin-left: auto; }
.header-nav a {
  font-size: 13px;
  color: var(--text2);
  transition: color 0.2s;
  white-space: nowrap;
}
.header-nav a:hover { color: var(--text); }

/* === Hero === */
.hero {
  padding: 80px 0 48px;
  text-align: center;
  background: linear-gradient(180deg, var(--bg2) 0%, var(--bg) 100%);
}

.hero h1 {
  font-size: clamp(28px, 5vw, 48px);
  font-weight: 700;
  letter-spacing: -1px;
  margin-bottom: 12px;
  background: linear-gradient(135deg, var(--text) 0%, var(--accent2) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 16px;
  color: var(--text2);
  max-width: 480px;
  margin: 0 auto;
}

/* === Genre Bar === */
.genre-bar {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.genre-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
}
.genre-chips::-webkit-scrollbar { display: none; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 13px;
  color: var(--text2);
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s;
}
.chip:hover { border-color: var(--accent); color: var(--text); }
.chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.chip-count {
  font-size: 11px;
  opacity: 0.7;
}

/* === Filter Info === */
.filter-info {
  padding: 24px 0 0;
}
.filter-info h2 {
  font-size: 20px;
  font-weight: 600;
}
.result-count {
  font-size: 14px;
  color: var(--text2);
  font-weight: 400;
  margin-left: 8px;
}

/* === Gallery Grid === */
.gallery-section {
  padding: 32px 0 64px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.gallery-item {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg2);
  aspect-ratio: 1;
  cursor: pointer;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.gallery-item:hover img { transform: scale(1.05); }

.gallery-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(0,0,0,0.7) 0%, transparent 50%);
  opacity: 0;
  transition: opacity 0.3s;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 16px;
}
.gallery-item:hover .gallery-overlay { opacity: 1; }

.gallery-genre {
  font-size: 12px;
  padding: 4px 10px;
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(8px);
  border-radius: 100px;
  color: #fff;
}

.gallery-actions { display: flex; gap: 8px; }

.dl-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(8px);
  border: none;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  transition: background 0.2s;
}
.dl-btn:hover { background: var(--accent); }

/* === Empty State === */
.empty-state {
  text-align: center;
  padding: 80px 0;
  color: var(--text3);
}
.empty-state svg { margin: 0 auto 16px; color: var(--border); }
.empty-state p { font-size: 16px; margin-bottom: 20px; }

/* === Pagination === */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 48px;
}

.page-btn {
  padding: 8px 16px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text2);
  transition: all 0.2s;
}
.page-btn:hover { border-color: var(--accent); color: var(--text); }
.page-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* === Photo Page === */
.photo-page { padding: 24px 0 64px; }

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text3);
  margin-bottom: 24px;
}
.breadcrumb a { color: var(--text2); transition: color 0.2s; }
.breadcrumb a:hover { color: var(--accent); }

.photo-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 32px;
  align-items: start;
}

.photo-frame {
  background: var(--bg2);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}
.photo-frame img {
  width: 100%;
  height: auto;
}
.photo-figure {
  margin: 0;
}
.photo-figcaption {
  padding: 10px 14px;
  font-size: .82rem;
  color: var(--text2);
  line-height: 1.5;
  border-top: 1px solid var(--border);
  background: var(--bg2);
}

.photo-sidebar {
  position: sticky;
  top: calc(var(--header-h) + 24px);
}

/* === Button === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  background: var(--bg2);
  color: var(--text);
  font-family: inherit;
}

/* === Photo sidebar action group === */
.action-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

/* === Primary: Download button === */
.btn-dl {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 20px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 2px 10px rgba(99,102,241,0.25);
  transition: transform 0.15s, box-shadow 0.2s;
  font-family: inherit;
}
.btn-dl:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99,102,241,0.4);
}
.btn-dl:active { transform: translateY(0); }
.btn-dl-size {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  background: rgba(255,255,255,0.2);
  border-radius: 100px;
  letter-spacing: 0.5px;
}

/* === Photo Meta === */
.photo-meta {
  margin-top: 24px;
  padding: 20px;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.photo-meta h2 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  line-height: 1.5;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-top: 1px solid var(--border);
  font-size: 13px;
}
.meta-label { color: var(--text2); }
.meta-value { color: var(--text); font-weight: 500; }
.meta-value.link { color: var(--accent); }
.meta-value.link:hover { text-decoration: underline; }

/* === Tags === */
.photo-tags {
  margin-top: 20px;
}
.photo-tags h3 {
  font-size: 13px;
  color: var(--text2);
  margin-bottom: 10px;
  font-weight: 500;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  padding: 5px 12px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 12px;
  color: var(--text2);
  transition: all 0.2s;
}
.tag:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-bg);
}

.license-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  padding: 12px 16px;
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.2);
  border-radius: var(--radius-sm);
  font-size: 11px;
  color: var(--green);
}

/* === Related === */
.related-section {
  margin-top: 64px;
  padding-top: 48px;
  border-top: 1px solid var(--border);
}
.related-section h2 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 24px;
}

/* === About === */
.about-section {
  padding: 80px 0;
  background: var(--bg2);
  border-top: 1px solid var(--border);
}
.about-section h2 {
  font-size: 28px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 48px;
}

.about-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.about-card {
  text-align: center;
  padding: 32px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: transform 0.2s, box-shadow 0.2s;
}
.about-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }

.about-card svg {
  margin: 0 auto 16px;
  color: var(--accent);
}
.about-card h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
}
.about-card p {
  font-size: 13px;
  color: var(--text2);
  line-height: 1.7;
}

/* About mini (trust-strip直下のコンパクト版) */
.about-mini {
  padding: 32px 0;
  border-top: none;
}
.about-mini h2 {
  font-size: 16px;
  margin-bottom: 20px;
}
.about-mini .about-grid {
  gap: 12px;
}
.about-mini .about-card {
  padding: 16px 14px;
}
.about-mini .about-card h3 {
  font-size: 13px;
  margin-bottom: 4px;
}
.about-mini .about-card p {
  font-size: 11px;
  line-height: 1.6;
}
.about-mini .about-card svg {
  width: 20px; height: 20px;
  margin-bottom: 10px;
}

/* === Footer === */
.footer {
  padding: 32px 0;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.footer-brand { display: flex; align-items: center; gap: 16px; }
.footer-brand p { font-size: 13px; color: var(--text3); }
.footer-copy { font-size: 12px; color: var(--text3); }

/* === Responsive === */
@media (max-width: 768px) {
  .header-inner { gap: 12px; }
  .header-nav { display: none; }
  .search-form { max-width: none; }

  .hero { padding: 48px 0 32px; }
  .hero p { font-size: 14px; }

  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 8px;
  }

  .photo-layout {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .photo-sidebar {
    position: static;
  }

  .about-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .footer-inner { flex-direction: column; gap: 12px; text-align: center; }
}

@media (max-width: 480px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }
  .gallery-item { border-radius: 6px; }
}

/* ============================================================
   Plan A: Section Feed (Top Page)
   ============================================================ */

/* === Hero Featured (large single image) === */
.hero-feat {
  position: relative;
  width: 100%;
  max-height: 60vh;
  min-height: 360px;
  overflow: hidden;
  background: var(--bg2);
}
.hero-feat-img {
  display: block;
  position: relative;
  width: 100%;
  height: 100%;
}
.hero-feat-img img {
  width: 100%;
  height: 100%;
  max-height: 60vh;
  min-height: 360px;
  object-fit: cover;
  display: block;
}
.hero-feat-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  background: linear-gradient(180deg, rgba(0,0,0,0.15) 0%, rgba(0,0,0,0.55) 70%, rgba(10,10,15,0.85) 100%);
  padding-bottom: 40px;
}
.hero-feat-badge {
  display: inline-block;
  padding: 4px 12px;
  background: rgba(99, 102, 241, 0.9);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  border-radius: 100px;
  margin-bottom: 12px;
}
.hero-feat-title {
  font-size: clamp(24px, 4.5vw, 42px);
  font-weight: 700;
  letter-spacing: -1px;
  color: #fff;
  margin-bottom: 8px;
  text-shadow: 0 2px 20px rgba(0,0,0,0.4);
}
.hero-feat-sub {
  font-size: clamp(13px, 1.5vw, 16px);
  color: rgba(255,255,255,0.85);
  text-shadow: 0 1px 8px rgba(0,0,0,0.4);
}

/* === Section wrapper === */
.sec {
  padding: 48px 0 8px;
}
.sec + .sec { padding-top: 56px; }

.sec-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}
.sec-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.3px;
}
.sec-sub {
  font-size: 13px;
  font-weight: 400;
  color: var(--text2);
  margin-left: 8px;
}
.sec-more {
  font-size: 13px;
  color: var(--accent2);
  font-weight: 500;
  white-space: nowrap;
  transition: color 0.2s;
}
.sec-more:hover { color: var(--text); }

.sec-footer {
  display: flex;
  justify-content: center;
  margin-top: 32px;
}

/* === Horizontal Scroll (Editor Picks) === */
.hscroll-wrap {
  overflow: hidden;
}
.hscroll {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
  padding: 4px 2px 16px;
  scroll-snap-type: x mandatory;
}
.hscroll::-webkit-scrollbar { height: 6px; }
.hscroll::-webkit-scrollbar-track { background: transparent; }
.hscroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }

.hscroll-item {
  flex: 0 0 auto;
  width: 260px;
  aspect-ratio: 1;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg2);
  position: relative;
  scroll-snap-align: start;
  transition: transform 0.3s;
}
.hscroll-item:hover { transform: translateY(-4px); }
.hscroll-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.hscroll-item:hover img { transform: scale(1.05); }
.hscroll-meta {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px;
  background: linear-gradient(0deg, rgba(0,0,0,0.65), transparent);
}
.hscroll-genre {
  font-size: 11px;
  padding: 3px 10px;
  background: rgba(255,255,255,0.18);
  backdrop-filter: blur(8px);
  border-radius: 100px;
  color: #fff;
}

/* === Genre Tiles === */
.genre-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.genre-tile {
  display: block;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg2);
  border: 1px solid var(--border);
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.genre-tile:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 4px 20px rgba(99,102,241,0.15);
}
.genre-tile-imgs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  aspect-ratio: 2/1;
  background: var(--bg3);
}
.genre-tile-imgs img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.genre-tile-placeholder {
  background: var(--bg3);
}
.genre-tile-info {
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.genre-tile-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.genre-tile-count {
  font-size: 12px;
  color: var(--text3);
}

/* === Trending Grid === */
.trending-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}
.trending-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg2);
}
.trending-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s;
}
.trending-item:hover img { transform: scale(1.05); }
.trending-rank {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  font-size: 13px;
  font-weight: 700;
  padding: 3px 10px;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  color: #fff;
  border-radius: 100px;
  letter-spacing: 0.5px;
}
.trending-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 8px;
  background: linear-gradient(0deg, rgba(0,0,0,0.55) 0%, transparent 40%);
  pointer-events: none;
}
.trending-dl {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(8px);
  color: #fff;
  border-radius: 100px;
}

/* === Button outline === */
.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 32px;
}
.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-bg);
}

/* === Filter Info + Sort tabs (all.php) === */
.filter-info-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}
.sort-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 4px;
}
.sort-tab {
  padding: 6px 16px;
  font-size: 13px;
  color: var(--text2);
  border-radius: 100px;
  transition: all 0.2s;
}
.sort-tab:hover { color: var(--text); }
.sort-tab.active {
  background: var(--accent);
  color: #fff;
}

/* === Responsive: Plan A sections === */
@media (max-width: 768px) {
  .hero-feat {
    min-height: 280px;
    max-height: 50vh;
  }
  .hero-feat-img img {
    min-height: 280px;
    max-height: 50vh;
  }
  .hero-feat-overlay { padding-bottom: 24px; }

  .sec { padding: 32px 0 4px; }
  .sec + .sec { padding-top: 40px; }
  .sec-title { font-size: 18px; }

  .hscroll-item { width: 180px; }

  .genre-tiles {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .genre-tile-name { font-size: 13px; }

  .trending-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }

  .filter-info-inner {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 480px) {
  .hscroll-item { width: 150px; }
  .trending-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================
   Authentication / User Menu / Login Modal
   ============================================================ */

.btn-login {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
  font-family: inherit;
}
.btn-login:hover { background: var(--accent2); transform: translateY(-1px); }

.nav-fav {
  font-size: 13px;
  color: var(--text2);
  transition: color 0.2s;
}
.nav-fav:hover { color: var(--text); }

/* User avatar + dropdown */
.user-menu {
  position: relative;
}
.user-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
}
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  transition: border-color 0.2s;
}
.user-avatar-txt {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 13px;
}
.user-btn:hover .user-avatar { border-color: var(--accent); }

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: all 0.2s;
  z-index: 200;
}
.user-menu.open .user-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.user-info {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.user-name {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
}
.user-email {
  font-size: 12px;
  color: var(--text3);
  word-break: break-all;
}
.user-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 16px;
  font-size: 13px;
  color: var(--text);
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}
.user-menu-item:hover { background: var(--bg3); color: var(--accent); }

/* Login Modal */
.login-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-modal-bg {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(6px);
}
.login-modal-card {
  position: relative;
  width: 100%;
  max-width: 400px;
  padding: 32px 28px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  text-align: center;
}
.login-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  color: var(--text2);
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
  border-radius: 50%;
}
.login-modal-close:hover { color: var(--text); background: var(--bg3); }
.login-modal h2 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}
.login-modal-sub {
  font-size: 13px;
  color: var(--text2);
  margin-bottom: 20px;
}
.login-modal-benefits {
  list-style: none;
  text-align: left;
  margin: 0 0 24px;
  padding: 14px 18px;
  background: var(--bg2);
  border-radius: var(--radius-sm);
}
.login-modal-benefits li {
  font-size: 13px;
  color: var(--text);
  padding: 4px 0;
}
.g-signin-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
  min-height: 44px;
}
.login-modal-terms {
  font-size: 11px;
  color: var(--text3);
  line-height: 1.6;
}
.login-modal-terms a { color: var(--accent); }
.login-modal-terms a:hover { text-decoration: underline; }

/* ============================================================
   Favorites (heart button on gallery items)
   ============================================================ */

.gallery-item { position: relative; }

.gallery-fav {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(8px);
  border: none;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  opacity: 0;
  transform: scale(0.9);
  transition: all 0.2s;
}
.gallery-item:hover .gallery-fav,
.gallery-fav.is-fav {
  opacity: 1;
  transform: scale(1);
}
.gallery-fav:hover { background: rgba(244, 63, 94, 0.8); }
.gallery-fav.is-fav { color: #f43f5e; background: rgba(0,0,0,0.55); }
.gallery-fav.is-fav:hover { background: rgba(0,0,0,0.7); }

/* Favorite button in photo page sidebar (FORCE-OVERRIDE browser default button) */
button.btn-fav {
  all: unset;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 20px;
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--text2);
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
button.btn-fav:hover {
  background: rgba(244, 63, 94, 0.08);
  border-color: rgba(244, 63, 94, 0.5);
  color: #f43f5e;
}
button.btn-fav.is-fav {
  background: rgba(244, 63, 94, 0.12);
  border-color: rgba(244, 63, 94, 0.6);
  color: #f43f5e;
}

/* Upgrade prompt (anon → suggest login) */
button.btn-upgrade {
  all: unset;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 11px 18px;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: var(--accent2);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s;
}
button.btn-upgrade:hover {
  background: rgba(99, 102, 241, 0.15);
  border-color: var(--accent);
}

/* DL note (info banner) */
.dl-note {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 11px;
  color: var(--text3);
  line-height: 1.5;
  text-align: center;
  align-self: center;
  letter-spacing: 0.2px;
}
.dl-note svg { opacity: 0.7; }
.dl-note-pro {
  color: var(--accent2);
}
.dl-note-pro svg { opacity: 0.9; color: #fbbf24; }

/* ============================================================
   Ad Slots (rendered by _ads.php)
   ============================================================ */

.ad-slot {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin: 28px auto;
  max-width: 100%;
}
.ad-slot:empty { display: none; }
.ad-label {
  font-size: 10px;
  color: var(--text3);
  letter-spacing: 0.14em;
  opacity: 0.55;
  text-transform: uppercase;
}
.ad-body {
  display: flex;
  justify-content: center;
  align-items: center;
  max-width: 100%;
  overflow: hidden;
}
.ad-body a { display: inline-block; line-height: 0; }
.ad-body img { max-width: 100%; height: auto; display: block; border-radius: 4px; }
.ad-body img[width="1"][height="1"] { position: absolute; opacity: 0; pointer-events: none; }

/* スロット別の余白調整 */
.ad-slot-inline { margin: 36px auto; }
.ad-slot-side { margin: 12px 0; }
.ad-slot-footer { margin: 16px 0 0; }

/* ログインユーザーはフッター以外の広告枠を非表示 */
body.logged-in .ad-slot:not(.ad-slot-footer):not(.ad-slot-mobile-sticky) { display: none !important; }
body.logged-in .ad-slot-mobile-sticky { display: none !important; }

/* 関連ツール テキストリンク集 (記事に馴染ませる形) */
.ad-slot-toollist {
  align-items: stretch;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin: 16px 0;
}
.ad-slot-toollist .ad-label {
  align-self: flex-start;
  margin-bottom: 8px;
  opacity: 0.7;
  font-size: 10px;
}
.ad-toollist {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ad-toollist li {
  font-size: 12px;
  line-height: 1.55;
  padding-left: 14px;
  position: relative;
  color: var(--text2);
}
.ad-toollist li::before {
  content: '›';
  position: absolute;
  left: 2px;
  top: -1px;
  color: var(--accent);
  font-weight: 700;
}
.ad-toollist li a {
  color: var(--text2);
  text-decoration: none;
  border-bottom: 1px dashed var(--border);
  padding-bottom: 1px;
  transition: color 0.15s, border-color 0.15s;
}
.ad-toollist li a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* モバイル下部 sticky バナー (320×50) */
.ad-slot-mobile-sticky {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 999;
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 4px 0 env(safe-area-inset-bottom, 4px);
  margin: 0;
  gap: 0;
  display: none;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.25);
}
.ad-slot-mobile-sticky .ad-label {
  display: none;  /* sticky枠ではラベル省略（スペース優先） */
}
.ad-slot-mobile-sticky .ad-body { padding: 2px 0; }

/* PCでは sticky 非表示、スマホでのみ表示 + 本文に下パディング確保 */
@media (max-width: 768px) {
  body:not(.logged-in) .ad-slot-mobile-sticky { display: flex; }
  body:not(.logged-in) { padding-bottom: 60px; }
  .ad-slot { margin: 24px auto; }
  .ad-body img[width="728"],
  .ad-body img[width="729"] {
    /* 728×90 はスマホで縮小表示 */
    width: 100%;
    max-width: 468px;
    height: auto;
  }
}

/* ============================================================
   Legal pages (terms / privacy)
   ============================================================ */

.legal-page {
  padding: 48px 0 80px;
  max-width: 800px;
  margin: 0 auto;
}
.legal-page h1 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
}
.legal-updated {
  font-size: 13px;
  color: var(--text3);
  margin-bottom: 32px;
}
.legal-page h2 {
  font-size: 18px;
  font-weight: 600;
  margin: 32px 0 12px;
  color: var(--text);
}
.legal-page p, .legal-page li {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text2);
}
.legal-page ul {
  padding-left: 24px;
  margin: 8px 0;
}
.legal-page li { margin-bottom: 4px; }
.legal-page strong { color: var(--text); font-weight: 600; }
.legal-page a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.legal-page a:hover { color: var(--accent2); }

/* ============================================================
   About page
   ============================================================ */

.about-page { max-width: 880px; }
.about-lead {
  font-size: 16px;
  line-height: 1.9;
  color: var(--text2);
  margin: 16px 0 32px;
  padding: 20px 24px;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.08), rgba(236, 72, 153, 0.06));
  border-left: 3px solid var(--accent);
  border-radius: 8px;
}
.about-lead strong { color: var(--text); font-weight: 700; }

.about-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 24px 0 40px;
}
.about-stat {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 16px;
  text-align: center;
}
.about-stat-num {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.2;
  margin-bottom: 4px;
}
.about-stat-label {
  font-size: 12px;
  color: var(--text3);
  letter-spacing: 0.04em;
}

/* License table */
.license-table {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 16px 0 24px;
}
.license-row {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
}
.license-row.ok { border-color: rgba(34, 197, 94, 0.3); background: rgba(34, 197, 94, 0.04); }
.license-row.ng { border-color: rgba(239, 68, 68, 0.3); background: rgba(239, 68, 68, 0.04); }
.license-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}
.license-row.ok .license-icon { background: rgba(34, 197, 94, 0.2); color: #22c55e; }
.license-row.ng .license-icon { background: rgba(239, 68, 68, 0.2); color: #ef4444; }
.license-row div {
  font-size: 13px;
  line-height: 1.7;
  color: var(--text2);
}
.license-row strong {
  display: inline-block;
  font-size: 14px;
  color: var(--text);
  font-weight: 600;
  margin-bottom: 2px;
}

/* Disclaimer box */
.disclaimer-box {
  background: rgba(250, 204, 21, 0.04);
  border: 1px solid rgba(250, 204, 21, 0.25);
  border-radius: 12px;
  padding: 18px 22px;
  margin: 16px 0 24px;
}
.disclaimer-box p {
  font-size: 13px;
  line-height: 1.85;
  color: var(--text2);
  margin-bottom: 12px;
}
.disclaimer-box p:last-child { margin-bottom: 0; }
.disclaimer-box strong { color: var(--text); font-weight: 600; }

/* ============================================================
   Contact form
   ============================================================ */

.contact-page { max-width: 720px; }

.contact-form {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-row label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.form-row .req { color: #ef4444; margin-left: 2px; }
.form-row input[type="text"],
.form-row input[type="email"],
.form-row textarea {
  width: 100%;
  padding: 11px 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.6;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-row input[type="text"]:focus,
.form-row input[type="email"]:focus,
.form-row textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}
.form-row textarea {
  resize: vertical;
  min-height: 160px;
}
.form-submit {
  margin-top: 8px;
  align-items: flex-start;
}

.btn-primary {
  all: unset;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s, opacity 0.15s;
  box-shadow: 0 4px 14px rgba(139, 92, 246, 0.25);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(139, 92, 246, 0.35);
}
.btn-primary:active { transform: translateY(0); opacity: 0.9; }

/* Alerts */
.alert {
  padding: 14px 16px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.7;
  margin: 16px 0;
}
.alert-success {
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #22c55e;
}
.alert-success strong { color: #4ade80; }
.alert-error {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}
.alert-error div { margin-bottom: 4px; }
.alert-error div:last-child { margin-bottom: 0; }

@media (max-width: 640px) {
  .about-stats { grid-template-columns: 1fr; }
  .about-stat { padding: 16px; }
  .license-row { padding: 12px 14px; }
  .disclaimer-box { padding: 14px 16px; }
}

/* ============================================================
   Footer nav
   ============================================================ */

.footer-nav {
  display: flex;
  gap: 20px;
}
.footer-nav a {
  font-size: 13px;
  color: var(--text3);
  transition: color 0.2s;
}
.footer-nav a:hover { color: var(--accent); }

@media (max-width: 768px) {
  .footer-inner { flex-direction: column; gap: 16px; text-align: center; }
  .footer-nav { justify-content: center; flex-wrap: wrap; }
  .user-dropdown { right: -16px; }
}

/* === 安全性メッセージ（ブランド訴求）=== */
.trust-strip {
  padding: 20px 0 28px;
  background: linear-gradient(180deg, rgba(139,92,246,0.04) 0%, transparent 100%);
  border-bottom: 1px solid var(--border);
}
.trust-row {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px;
}
.trust-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.trust-icon { font-size: 22px; line-height: 1; flex-shrink: 0; }
.trust-text { font-size: 11px; color: var(--text2); line-height: 1.5; }
.trust-text strong { display: block; color: var(--text); font-size: 12.5px; margin-bottom: 2px; }
.trust-more { text-align: center; margin-top: 12px; }
.trust-more a { font-size: 11px; color: var(--text2); }
.trust-more a:hover { color: #ec4899; }

@media (max-width: 768px) {
  .trust-row { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .trust-item { padding: 10px; }
  .trust-text { font-size: 10px; }
  .trust-text strong { font-size: 11.5px; }
}

/* ログイン済みは広告関連バナーは消さない（信頼メッセージは全員に見せる） */

/* hero 下の小文字 */
.hero-feat-micro, .hero-micro {
  font-size: 11.5px;
  color: rgba(255,255,255,0.75);
  margin-top: 4px;
  letter-spacing: 0.02em;
}
.hero .hero-micro { color: var(--text2); }

/* about.php コールアウト */
.safety-callout {
  display: flex; gap: 16px; align-items: center;
  padding: 18px 20px;
  margin: 16px 0 24px;
  background: linear-gradient(135deg, rgba(139,92,246,0.12), rgba(236,72,153,0.08));
  border: 1px solid rgba(139,92,246,0.3);
  border-radius: 12px;
}
.safety-callout-icon { font-size: 32px; line-height: 1; flex-shrink: 0; }
.safety-callout-text { font-size: 13px; line-height: 1.6; color: var(--text); }
.safety-callout-text strong {
  display: block; margin-bottom: 2px; font-size: 14px;
  background: linear-gradient(135deg, #8b5cf6, #ec4899);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* photo.php ライセンス欄サブテキスト */
.license-note { align-items: flex-start; }
.license-note-sub {
  font-size: 10px; color: var(--text3);
  margin-top: 3px; line-height: 1.55;
}
.license-note-sub a { color: #ec4899; text-decoration: underline; }

/* dl.php 安全性バー */
.dl-safety-bar {
  margin-top: 14px; padding: 10px 12px;
  background: rgba(139,92,246,0.08);
  border: 1px solid rgba(139,92,246,0.2);
  border-radius: 8px;
  font-size: 11px; color: var(--text2); line-height: 1.4;
}
.dl-safety-bar a { color: #ec4899; margin-left: 4px; }
