.gallery-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: 1fr;
}

@media (min-width: 480px) {
  .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
  }
}

@media (min-width: 768px) {
  .gallery-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.25rem;
  }
}

@media (min-width: 1024px) {
  .gallery-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.5rem;
  }
}


.gallery-item {
  position: relative;
  border-radius: 1rem;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--bord);
  transition: all 0.2s ease;
}

@media (min-width: 480px) {
  .gallery-item {
    border-radius: 1.5rem;
  }
}

.gallery-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.12);
}

@media (max-width: 479px) {
  .gallery-item:hover {
    transform: none;
  }
}

.gallery-item img {
  width: 100%;
  height: auto;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.gallery-item img.loaded {
  opacity: 1;
}

.gallery-item img.error {
  background: var(--muted);
}

.gallery-item:hover img {
  transform: scale(1.02);
}

@media (max-width: 479px) {
  .gallery-item:hover img {
    transform: none;
  }
}


.gallery-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, transparent 50%);
  opacity: 0;
  transition: opacity 0.3s ease;
  display: flex;
  align-items: flex-end;
  padding: 1rem;
}

.gallery-item:hover .gallery-overlay {
  opacity: 1;
}

@media (max-width: 479px) {
  .gallery-overlay {
    opacity: 1;
    background: linear-gradient(to top, rgba(0,0,0,0.5) 0%, transparent 30%);
    padding: 0.75rem;
  }
}

/* Gallery Stats */
.gallery-stats {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: white;
  font-size: 0.75rem;
}

@media (min-width: 480px) {
  .gallery-stats {
    gap: 1rem;
    font-size: 0.875rem;
  }
}

.gallery-stat {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.gallery-stat svg {
  width: 0.875rem;
  height: 0.875rem;
}

@media (min-width: 480px) {
  .gallery-stat svg {
    width: 1rem;
    height: 1rem;
  }
}

/* Like Button Styles */
.like-toggle {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  border-radius: 0.75rem;
  font-size: 0.75rem;
  font-weight: 500;
  transition: all 0.2s ease;
  border: none;
  background: transparent;
  cursor: pointer;
}

@media (min-width: 480px) {
  .like-toggle {
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 1rem;
    font-size: 0.875rem;
  }
}

.like-toggle:hover {
  background: rgba(0,0,0,0.04);
}

[data-theme="dark"] .like-toggle:hover {
  background: rgba(255,255,255,0.1);
}

.like-toggle.text-red-500 {
  color: #ef4444;
}

.like-toggle svg {
  width: 1rem;
  height: 1rem;
  transition: all 0.2s ease;
}

@media (min-width: 480px) {
  .like-toggle svg {
    width: 1.125rem;
    height: 1.125rem;
  }
}

/* Category Pills */
.pill {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  border-radius: 1rem;
  font-size: 0.75rem;
  font-weight: 500;
  border: 1px solid var(--bord);
  background: rgba(0,0,0,0.03);
  color: var(--text);
  text-decoration: none;
  transition: all 0.2s ease;
}

@media (min-width: 480px) {
  .pill {
    padding: 0.375rem 0.875rem;
    font-size: 0.875rem;
    border-radius: 1.25rem;
  }
}

[data-theme="dark"] .pill {
  background: rgba(255,255,255,0.05);
}

.pill:hover {
  background: rgba(0,0,0,0.06);
}

[data-theme="dark"] .pill:hover {
  background: rgba(255,255,255,0.1);
}

.pill.bg-primary\/15 {
  background: rgba(1,209,251,0.15);
  color: #01d1fb;
  border-color: rgba(1,209,251,0.3);
}

/* Photo Detail Styles */
.photo-detail-container {
  max-width: 6rem;
  margin: 0 auto;
  padding: 0 0.75rem;
}

@media (min-width: 480px) {
  .photo-detail-container {
    padding: 0 1rem;
  }
}

@media (min-width: 768px) {
  .photo-detail-container {
    padding: 0 1.5rem;
    max-width: none;
  }
}

.photo-detail-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: 1fr;
}

/* Community Trending Section (scoped) */
#community .imgcard {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  transition: transform 0.3s ease;
}

#community .group:hover .imgcard {
  transform: scale(1.02);
}

#community .skeleton-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
@media (min-width: 640px) { #community .skeleton-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1024px){ #community .skeleton-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

#community .skeleton-card {
  border-radius: 0.75rem;
  overflow: hidden;
  border: 1px solid var(--bord);
  background: var(--card);
}

#community .skeleton-img {
  width: 100%;
  aspect-ratio: 4 / 5;
  position: relative;
  background: linear-gradient(90deg, rgba(0,0,0,0.06) 25%, rgba(0,0,0,0.12) 37%, rgba(0,0,0,0.06) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
}

#community .skeleton-meta { height: 36px; padding: 8px; }

@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

#community .group:focus-within .card {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] #community .group:focus-within .card {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

#community .group a {
  text-decoration: none;
  color: inherit;
}

#community .group a:focus {
  outline: 2px solid #01D1FB;
  outline-offset: 2px;
  border-radius: 0.5rem;
}

/* Keep accent pill styling in community block */
#community .pill {
  background: rgba(1,209,251,0.15);
  color: #01d1fb;
  border-color: rgba(1,209,251,0.3);
}

@media (max-width: 640px) {
  #community .grid.grid-cols-2 { gap: 0.75rem; }
  #community .pill { font-size: 0.6875rem; padding: 3px 6px; }
}

@media (min-width: 1024px) {
  .photo-detail-grid {
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
  }
}

.photo-main-image {
  width: 100%;
  border-radius: 1rem;
  overflow: hidden;
}

@media (min-width: 480px) {
  .photo-main-image {
    border-radius: 1.5rem;
  }
}

.photo-main-image img {
  width: 100%;
  height: auto;
  object-fit: cover;
}

/* Photo Actions Bar */
.photo-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  background: var(--card);
  border: 1px solid var(--bord);
  border-radius: 1rem;
}

@media (min-width: 480px) {
  .photo-actions {
    padding: 1.25rem;
    border-radius: 1.5rem;
  }
}

.photo-actions-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

@media (min-width: 768px) {
  .photo-actions-left {
    gap: 1.5rem;
  }
}

/* Comments Section */
.comments-section {
  padding: 1rem;
}

@media (min-width: 480px) {
  .comments-section {
    padding: 1.5rem;
  }
}

@media (min-width: 768px) {
  .comments-section {
    padding: 2rem;
  }
}

.comment-item {
  padding: 1rem 0;
  border-bottom: 1px solid var(--bord);
}

.comment-item:last-child {
  border-bottom: none;
}

.comment-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.75rem;
}

@media (min-width: 480px) {
  .comment-avatar {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 0.875rem;
  }
}

.comment-content {
  flex: 1;
  margin-left: 0.75rem;
}

@media (min-width: 480px) {
  .comment-content {
    margin-left: 1rem;
  }
}

.comment-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  font-size: 0.75rem;
  color: var(--muted);
}

@media (min-width: 480px) {
  .comment-meta {
    font-size: 0.875rem;
  }
}

.comment-text {
  font-size: 0.875rem;
  line-height: 1.5;
  margin-bottom: 0.75rem;
}

@media (min-width: 480px) {
  .comment-text {
    font-size: 1rem;
  }
}

/* Trending Styles */
.trending-header {
  text-align: center;
  margin-bottom: 2rem;
}

@media (min-width: 768px) {
  .trending-header {
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 3rem;
  }
}

/* Loading States */
.gallery-item.loading {
  background: linear-gradient(90deg,
    var(--card) 25%,
    rgba(255,255,255,0.1) 50%,
    var(--card) 75%
  );
  background-size: 200% 100%;
  animation: loading-shimmer 1.5s infinite;
}

@keyframes loading-shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* Error States */
.gallery-item.error {
  background: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 0.875rem;
  min-height: 200px;
}

/* Print Styles */
@media print {
  .gallery-overlay,
  .photo-actions,
  .like-toggle {
    display: none !important;
  }

  .gallery-item {
    break-inside: avoid;
    margin-bottom: 1rem;
  }
}

/* ═══════════════════════════════════════════════════════
   PUBLIC GALLERY — MASONRY CARDS  (Midjourney-style)
   ═══════════════════════════════════════════════════════ */

/* Masonry container */
.pub-masonry {
  column-count: 2;
  column-gap: 0.5rem;
}
@media (min-width: 480px) {
  .pub-masonry { column-count: 3; column-gap: 0.625rem; }
}
@media (min-width: 1024px) {
  .pub-masonry { column-count: 4; column-gap: 0.75rem; }
}

/* Card */
.pub-card {
  break-inside: avoid;
  margin-bottom: 0.5rem;
  border-radius: 1rem;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  background: #1a1a1a;
  box-shadow: 0 1px 4px rgba(0,0,0,0.18);
  transition: box-shadow 0.3s ease;
  -webkit-tap-highlight-color: transparent;
}
@media (min-width: 480px) {
  .pub-card { margin-bottom: 0.625rem; border-radius: 1.125rem; }
}
:root:not([data-theme="dark"]) .pub-card {
  background: #f3f4f6;
  box-shadow: 0 1px 4px rgba(0,0,0,0.10);
}
.pub-card:hover {
  box-shadow: 0 16px 48px rgba(0,0,0,0.40);
}

/* ── Photo media ── */
.pub-card__img {
  display: block;
  width: 100%;
  height: auto;
  transition: transform 0.5s ease;
}
.pub-card:hover .pub-card__img { transform: scale(1.045); }

/* Placeholder when no image */
.pub-card__placeholder {
  width: 100%;
  aspect-ratio: 3/4;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #2a2a2a;
}
:root:not([data-theme="dark"]) .pub-card__placeholder { background: #e5e7eb; }

/* ── Video media — natural aspect ratio, no crop ── */
.pub-card__video {
  display: block;
  width: 100%;
  height: auto;
  background: #111; /* prevent white flash before poster/frame loads */
  /* aspect-ratio set via inline style (server-rendered) or JS loadedmetadata */
  transition: transform 0.5s ease;
}
.pub-card:hover .pub-card__video { transform: scale(1.045); }

/* ─── Full-card link (behind everything) ─── */
.pub-card__link {
  position: absolute; inset: 0; z-index: 5;
}

/* ─── Always-visible bottom bar: model + views ─── */
.pub-card__bar {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 2rem 0.625rem 0.5rem;
  background: linear-gradient(to top, rgba(0,0,0,0.85), rgba(0,0,0,0.25) 60%, transparent);
  display: flex; align-items: flex-end; justify-content: space-between;
  pointer-events: none; z-index: 10;
}
.pub-card__model {
  color: rgba(255,255,255,0.92); font-size: 10px; font-weight: 500;
  line-height: 1.25; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; max-width: 65%;
}
.pub-card__views {
  display: flex; align-items: center; gap: 3px;
  color: rgba(255,255,255,0.78); font-size: 10px; flex-shrink: 0;
}
.pub-card__views svg { width: 11px; height: 11px; flex-shrink: 0; }
@media (min-width: 480px) {
  .pub-card__model { font-size: 11px; }
  .pub-card__views { font-size: 11px; }
}

/* ─── Sound toggle (video, top-left on mobile only) ─── */
.pub-card__sound {
  position: absolute; top: 0.4rem; left: 0.4rem;
  display: flex; align-items: center; z-index: 20;
}
/* Desktop: hide sound button entirely — volume slider in overlay is used */
@media (hover: hover) and (pointer: fine) {
  .pub-card__sound { display: none !important; }
}

/* ════════════════════════════════════════════════════════
   DESKTOP OVERLAY — shown on :hover (mouse/fine pointer)
   Hidden on touch devices via @media (hover:none)
   ════════════════════════════════════════════════════════ */
.pub-card__overlay {
  position: absolute; inset: 0; z-index: 20;
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s ease;
  display: flex; flex-direction: column;
  padding-bottom: 2.5rem; /* leave room for .pub-card__bar */
  overflow: hidden; /* prevent buttons spilling outside card bounds */
}
/* Compact overlay buttons — fit all aspect ratios without overlap */
.pub-card__overlay .pub-btn {
  padding: 4px 7px; min-height: 28px; font-size: 10px; gap: 3px;
}
.pub-card__overlay .pub-btn svg { width: 12px; height: 12px; }
.pub-card__overlay .pub-save  { width: 28px; height: 28px; }
.pub-card__overlay .pub-use   { padding: 5px 10px; font-size: 10px; }
.pub-card__overlay .pub-author__avatar { width: 26px; height: 26px; }
.pub-card__overlay .pub-author__follow { width: 18px; height: 18px; font-size: 12px; }
.pub-ov-top  { padding: 0.5rem; gap: 3px; }
.pub-ov-top__left  { gap: 3px; }
.pub-ov-top__right { gap: 3px; }
.pub-ov-bottom { padding: 0 0.5rem 0.4rem; gap: 4px; flex-wrap: wrap; }
@media (hover: hover) and (pointer: fine) {
  .pub-card:hover .pub-card__overlay { opacity: 1; pointer-events: auto; }
  .pub-card:focus-within .pub-card__overlay { opacity: 1; pointer-events: auto; }
}

/* Dark scrim (inside overlay) */
.pub-card__scrim {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.48);
  pointer-events: none; z-index: 0;
}

/* "Просмотр" center pill */
.pub-card__view {
  display: flex; align-items: center; justify-content: center;
  transform: scale(0.90);
  transition: transform 0.25s ease;
}
@media (hover: hover) and (pointer: fine) {
  .pub-card:hover .pub-card__view { transform: scale(1); }
}
.pub-card__view span {
  padding: 0.45rem 1.25rem;
  border-radius: 0.75rem;
  background: rgba(255,255,255,0.14);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,0.28);
  color: #fff; font-weight: 600; font-size: 0.8rem;
  letter-spacing: 0.02em; box-shadow: 0 4px 20px rgba(0,0,0,0.30);
  white-space: nowrap;
  pointer-events: auto; /* enable click on the pill itself */
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.pub-card__view span:hover {
  background: rgba(255,255,255,0.24);
  border-color: rgba(255,255,255,0.45);
}

/* Top row inside overlay */
.pub-ov-top {
  flex-shrink: 0;
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 0.625rem; z-index: 30;
  transform: translateY(-6px);
  transition: transform 0.22s ease;
}
@media (hover: hover) and (pointer: fine) {
  .pub-card:hover .pub-ov-top { transform: translateY(0); }
}
.pub-ov-top__left  { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.pub-ov-top__right { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }

/* Center flex area — holds "Просмотр" pill */
.pub-ov-center {
  flex: 1; display: flex; align-items: center; justify-content: center;
  pointer-events: none; z-index: 1;
}
.pub-card__view {
  pointer-events: auto;
}

/* Bottom row inside overlay */
.pub-ov-bottom {
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between;
  gap: 6px; z-index: 30; padding: 0 0.625rem 0.5rem;
  transform: translateY(6px);
  transition: transform 0.22s ease 0.05s;
}
@media (hover: hover) and (pointer: fine) {
  .pub-card:hover .pub-ov-bottom { transform: translateY(0); }
}

/* Author block (desktop overlay bottom-left) */
.pub-author {
  display: flex; align-items: center; gap: 4px;
  text-decoration: none; flex-shrink: 0;
}
.pub-author__avatar {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 50%; overflow: hidden;
  flex-shrink: 0;
  background: rgba(255,255,255,0.18);
  border: 1.5px solid rgba(255,255,255,0.4);
}
.pub-author__avatar img { width: 100%; height: 100%; object-fit: cover; }
.pub-author__initials {
  color: #fff; font-size: 13px; font-weight: 700; line-height: 1;
}
.pub-author__follow {
  display: flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--primary, #6366f1);
  color: #fff; font-size: 14px; font-weight: 700;
  border: none; cursor: pointer; flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.40);
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.pub-author__follow:hover { transform: scale(1.12); opacity: 0.9; }
/* Vertical volume slider (desktop only, inside overlay top-right) */
.pub-vol-wrap {
  display: flex; align-items: center;
}
/* Hide volume slider on touch/mobile devices */
@media (hover: none), (pointer: coarse) {
  .pub-vol-wrap { display: none !important; }
}
.pub-vol-slider {
  width: 56px; height: 4px; border-radius: 2px;
  background: rgba(255,255,255,0.30);
  outline: none; cursor: pointer;
  accent-color: var(--primary, #7c3aed);
  -webkit-appearance: none; appearance: none;
}
@media (min-width: 768px) { .pub-vol-slider { width: 68px; } }

/* Admin overlay (staff only, top-left, always above everything) */
.pub-card__admin {
  position: absolute; top: 0.5rem; left: 0.5rem;
  display: flex; gap: 4px; z-index: 50;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease;
}
.pub-card:hover .pub-card__admin { opacity: 1; pointer-events: auto; }

/* ─── BUTTON SHARED STYLES ─── */
.pub-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 9px; min-height: 32px;
  border-radius: 0.5rem;
  background: rgba(0,0,0,0.62);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.14);
  color: #fff; font-size: 11px; font-weight: 500;
  cursor: pointer; text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}
.pub-btn:hover { background: rgba(255,255,255,0.18); border-color: rgba(255,255,255,0.28); }
.pub-btn:focus-visible { outline: 2px solid var(--primary, #6366f1); outline-offset: 2px; }
.pub-btn svg, .pub-save svg, .pub-use svg { width: 14px; height: 14px; flex-shrink: 0; }

/* Like active */
.pub-btn.like-toggle[aria-pressed="true"],
.pub-btn.liked,
.pub-btn.like-toggle:hover {
  background: rgba(239,68,68,0.88); border-color: rgba(248,113,113,0.35);
}

/* Save button (icon-only square) */
.pub-save {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 0.5rem;
  background: rgba(0,0,0,0.62);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.14);
  color: #fff; cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.pub-save:hover,
.pub-save.save-toggle[aria-pressed="true"],
.pub-save.saved {
  background: rgba(16,185,129,0.88); border-color: rgba(52,211,153,0.35);
}
.pub-save:focus-visible { outline: 2px solid #10b981; outline-offset: 2px; }

/* "Использовать" primary lightning button */
.pub-use {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 14px; border-radius: 0.75rem;
  background: var(--primary, #6366f1);
  color: #fff; font-size: 11px; font-weight: 700; letter-spacing: 0.01em;
  box-shadow: 0 4px 16px rgba(1,209,251,0.4);
  transition: opacity 0.15s ease, transform 0.1s ease;
  text-decoration: none; white-space: nowrap;
}
.pub-use:hover { opacity: 0.88; }
.pub-use:active { transform: scale(0.96); }
.pub-use:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* Admin tiny buttons */
.pub-admin-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 0.5rem; color: #fff;
  transition: background 0.15s ease;
}
.pub-admin-btn.edit { background: rgba(0,0,0,0.72); }
.pub-admin-btn.edit:hover { background: rgba(0,0,0,0.90); }
.pub-admin-btn.del  { background: rgba(239,68,68,0.80); }
.pub-admin-btn.del:hover { background: rgba(220,38,38,1); }

/* Sound toggle button */
.pub-snd-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 6px;
  background: rgba(0,0,0,0.55); border: 1px solid rgba(255,255,255,0.15);
  color: #fff; transition: background 0.15s ease; flex-shrink: 0; cursor: pointer;
}
.pub-snd-btn svg { width: 11px; height: 11px; }
.pub-snd-btn:hover { background: rgba(0,0,0,0.80); }

/* Likers dots */
.pub-dots {
  font-size: 12px; line-height: 1; letter-spacing: 2px;
  color: rgba(255,255,255,0.72); cursor: pointer; padding: 2px 6px;
  border-radius: 4px; background: rgba(0,0,0,0.28);
  transition: color 0.15s, background 0.15s; user-select: none;
}
.pub-dots:hover { color: #fff; background: rgba(0,0,0,0.50); }

/* Like/save active (explicit class variants) */
.pub-btn.liked,
.pub-btn.liked:hover { background: rgba(239,68,68,0.88); border-color: rgba(252,165,165,0.4); }
.pub-save.saved,
.pub-save.saved:hover { background: rgba(16,185,129,0.88); border-color: rgba(110,231,183,0.4); }

/* ════════════════════════════════════════════════════════
   RESPONSIVE — compact sizes for all breakpoints
   ════════════════════════════════════════════════════════ */
@media (max-width: 767px) {
  .pub-masonry { column-gap: 0.375rem; }
  .pub-card    { margin-bottom: 0.375rem; }
  /* Suppress CSS hover on touch to avoid sticky states */
  .pub-card:hover .pub-card__img,
  .pub-card:hover .pub-card__video { transform: none; }
  .pub-card:hover { box-shadow: 0 1px 6px rgba(0,0,0,0.22); }
}
@media (max-width: 480px) {
  .pub-masonry { column-count: 2; column-gap: 0.3rem; }
  .pub-card    { margin-bottom: 0.3rem; border-radius: 0.75rem; }
  .pub-card__bar { padding: 1.5rem 0.4rem 0.35rem; }
  .pub-btn     { padding: 4px 7px; font-size: 10px; min-height: 28px; gap: 3px; }
  .pub-btn svg { width: 12px; height: 12px; }
  .pub-save    { width: 28px; height: 28px; }
  .pub-use--sm { font-size: 10px; padding: 4px 8px; }
  .pub-sheet__uname { font-size: 10px; }
}
@media (max-width: 359px) {
  .pub-masonry { column-count: 2; column-gap: 0.2rem; }
  .pub-card    { margin-bottom: 0.2rem; border-radius: 0.5rem; }
  .pub-card__bar { padding: 1.1rem 0.3rem 0.25rem; }
  .pub-card__model, .pub-card__views { font-size: 9px; }
  .pub-btn     { padding: 3px 5px; font-size: 9px; min-height: 26px; }
  .pub-save    { width: 26px; height: 26px; }
  .pub-sheet__actions { flex-wrap: wrap; }
  .pub-use--sm { font-size: 9px; padding: 3px 7px; }
}

/* ══════════════════════════════════════════════════════════
   TINY ≤ 359px (320px screen) — tightest settings
   ══════════════════════════════════════════════════════════ */
@media (max-width: 359px) {
  .pub-masonry  { column-count: 2; column-gap: 0.2rem; }
  .pub-card     { border-radius: 0.5rem; margin-bottom: 0.2rem; }
  .pub-btn      { padding: 3px 5px; font-size: 9px; min-height: 24px; }
  .pub-btn svg  { width: 10px; height: 10px; }
  .pub-save     { width: 26px; height: 26px; }
  .pub-use      { font-size: 9px; padding: 4px 8px; }
  .pub-card__tl { top: 0.3rem; left: 0.3rem; gap: 2px; }
  .pub-card__tr { top: 0.3rem; right: 0.3rem; }
  .pub-card__use { bottom: 1.8rem; }
  .pub-card__bar { padding: 1.1rem 0.3rem 0.25rem; }
  .pub-card__model,
  .pub-card__views { font-size: 9px; }
  .pub-dots     { letter-spacing: 1px; padding: 1px 4px; }
}


/* Likers wrap + 3-dots button */
.pub-like-wrap { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.pub-dots {
  font-size: 13px; line-height: 1; letter-spacing: 2px;
  color: rgba(255,255,255,0.7);
  cursor: pointer; padding: 1px 6px;
  border-radius: 4px;
  background: rgba(0,0,0,0.25);
  transition: color 0.15s ease, background 0.15s ease;
  user-select: none;
}
.pub-dots:hover { color: #fff; background: rgba(0,0,0,0.45); }

/* ═══════════════════════════════════════════════════
   PUBLICATION MODAL
   ═══════════════════════════════════════════════════ */

/* Overlay */
.pub-modal {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
}
.pub-modal[hidden] { display: none; }

.pub-modal__backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.82);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  cursor: pointer;
}

/* Container */
.pub-modal__container {
  position: relative; z-index: 1;
  width: 100%; max-width: 1200px;
  max-height: 96dvh;
  margin: 0 auto;
  display: flex; flex-direction: column;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 32px 80px rgba(0,0,0,0.6);
  background: var(--bg, #0f0f0f);
}

/* Close button */
.pub-modal__close {
  position: absolute; top: 12px; right: 12px; z-index: 20;
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.5); backdrop-filter: blur(8px);
  color: #fff; border: none; cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
}
.pub-modal__close:hover { background: rgba(255,255,255,0.15); }
.pub-modal__close:active { transform: scale(0.92); }
.pub-modal__close svg { width: 20px; height: 20px; }

/* Nav arrows — positioned on the media pane via mmodal-media relative context */
.mmodal-media { position: relative; } /* needed for arrow positioning */
.pub-modal__nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 15;
  width: 48px; height: 48px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.50); backdrop-filter: blur(10px);
  color: #fff; border: 1.5px solid rgba(255,255,255,0.15);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease, background 0.2s ease, transform 0.15s ease;
}
/* Show arrows on hover — works whether parent is container or media pane */
.pub-modal__container:hover .pub-modal__nav:not([hidden]),
.mmodal-media:hover .pub-modal__nav:not([hidden]) { opacity: 1; }
.pub-modal__nav--prev { left: 14px; }
.pub-modal__nav--next { right: 14px; }
.pub-modal__nav:hover { background: rgba(255,255,255,0.20); border-color: rgba(255,255,255,0.35); }
.pub-modal__nav:active { transform: translateY(-50%) scale(0.90); }
.pub-modal__nav[hidden] { display: none !important; }
.pub-modal__nav svg { width: 22px; height: 22px; }

/* Loading */
.pub-modal__loading {
  display: flex; align-items: center; justify-content: center;
  min-height: 40vh;
}
.pub-modal__spinner {
  display: block; width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.15);
  border-top-color: var(--primary, #a78bfa);
  animation: modal-spin 0.8s linear infinite;
}
@keyframes modal-spin { to { transform: rotate(360deg); } }

/* Body area (scrollable) */
.pub-modal__body {
  flex: 1; overflow-y: auto; overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.pub-modal__body::-webkit-scrollbar { width: 4px; }
.pub-modal__body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

/* ─── Modal Content Layout ─── */
.mmodal-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) 360px;
  min-height: 60vh;
}

/* Media pane */
.mmodal-media {
  position: relative; /* nav arrows anchor here */
  background: #000;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  min-height: 300px;
  max-height: 90dvh;
}
.mmodal-img-link { display: contents; }
.mmodal-img {
  display: block;
  max-width: 100%; max-height: 90dvh;
  width: auto; height: auto;
  object-fit: contain;
}
.mmodal-media--video { align-items: stretch; background: #000; }
.mmodal-video {
  width: 100%; height: 100%;
  max-height: 90dvh;
  object-fit: contain;
  display: block;
}

/* Sidebar */
.mmodal-sidebar {
  padding: 20px 16px;
  overflow-y: auto; overscroll-behavior: contain;
  max-height: 90dvh;
  display: flex; flex-direction: column; gap: 14px;
  background: var(--bg, #111);
  border-left: 1px solid rgba(255,255,255,0.07);
  -webkit-overflow-scrolling: touch;
}
.mmodal-sidebar::-webkit-scrollbar { width: 3px; }
.mmodal-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 2px; }

/* Author */
.mmodal-author {
  display: flex; align-items: center; gap: 10px;
}
.mmodal-author__link {
  display: flex; align-items: center; gap: 8px;
  text-decoration: none; color: inherit;
  flex: 1; min-width: 0;
}
.mmodal-author__name {
  font-size: 13px; font-weight: 600;
  color: var(--text, #fff);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mmodal-avatar {
  flex-shrink: 0; width: 36px; height: 36px; border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(135deg, var(--primary, #a78bfa), #7c3aed);
  display: flex; align-items: center; justify-content: center;
}
.mmodal-avatar img { width: 100%; height: 100%; object-fit: cover; }
.mmodal-avatar__initials { font-size: 15px; font-weight: 700; color: #fff; }
.mmodal-follow {
  flex-shrink: 0; width: 32px; height: 32px; border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,0.25);
  background: transparent; color: rgba(255,255,255,0.75);
  font-size: 18px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background 0.2s, border-color 0.2s;
}
.mmodal-follow:hover { background: rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.5); }

/* Actions */
.mmodal-actions {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.mmodal-actions .pub-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 10px; border-radius: 10px; font-size: 13px; font-weight: 500;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.8);
  cursor: pointer; transition: background 0.2s, color 0.2s;
  text-decoration: none;
}
.mmodal-actions .pub-btn svg { width: 16px; height: 16px; }
.mmodal-actions .pub-btn:hover { background: rgba(255,255,255,0.14); color: #fff; }
.mmodal-actions .liked { color: #f43f5e; }
.mmodal-actions .liked svg { fill: currentColor; }
.mmodal-actions .saved { color: #a78bfa; }
.mmodal-actions .saved svg { fill: currentColor; }
.mmodal-views {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; color: rgba(255,255,255,0.5);
  margin-left: auto;
}
.mmodal-views svg { width: 14px; height: 14px; }
.mmodal-share .pub-btn svg { stroke-width: 2; }

/* Use button */
.mmodal-use {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 12px; font-size: 13px; font-weight: 600;
  background: var(--primary, #a78bfa); color: #fff;
  text-decoration: none; transition: opacity 0.2s, transform 0.15s;
  align-self: flex-start;
}
.mmodal-use:hover { opacity: 0.88; transform: translateY(-1px); }
.mmodal-use svg { width: 15px; height: 15px; }

/* Title */
.mmodal-title {
  font-size: 16px; font-weight: 700; line-height: 1.35;
  color: var(--text, #fff); margin: 0;
}

/* Labels */
.mmodal-label {
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.07em; color: rgba(255,255,255,0.4);
  display: block; margin-bottom: 4px;
}

/* Model */
.mmodal-model {
  display: flex; flex-direction: column; gap: 2px;
}
.mmodal-model__name {
  font-size: 12px; color: rgba(255,255,255,0.6);
}

/* Prompt */
.mmodal-prompt {
  background: rgba(0,0,0,0.3); border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.08);
  padding: 10px 12px;
}
.mmodal-prompt__header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px;
}
.mmodal-copy-btn {
  font-size: 11px; font-weight: 500; color: rgba(255,255,255,0.5);
  background: rgba(255,255,255,0.08); border: none;
  padding: 3px 8px; border-radius: 6px; cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.mmodal-copy-btn:hover { background: rgba(255,255,255,0.15); color: #fff; }
.mmodal-prompt__text {
  font-family: inherit; font-size: 12px; line-height: 1.55;
  color: rgba(255,255,255,0.7);
  white-space: pre-wrap; word-break: break-word;
  margin: 0; max-height: 120px; overflow-y: auto;
}

/* Comments */
.mmodal-comments-section { display: flex; flex-direction: column; gap: 8px; }
.mmodal-comments-toggle {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 500; color: rgba(255,255,255,0.7);
  background: none; border: none; cursor: pointer; padding: 0;
  transition: color 0.2s;
}
.mmodal-comments-toggle:hover { color: #fff; }
.mmodal-comments-toggle svg { width: 16px; height: 16px; }
.mmodal-chevron {
  width: 14px !important; height: 14px !important;
  margin-left: auto; transition: transform 0.2s ease;
}
.mmodal-comments-toggle[aria-expanded="true"] .mmodal-chevron { transform: rotate(180deg); }
.mmodal-comments { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.mmodal-comment {
  background: rgba(255,255,255,0.04); border-radius: 8px;
  padding: 8px 10px;
}
.mmodal-comment__user {
  font-size: 11px; font-weight: 600; color: var(--primary, #a78bfa);
  display: block; margin-bottom: 2px;
}
.mmodal-comment__text { font-size: 12px; color: rgba(255,255,255,0.7); margin: 0; }
.mmodal-no-comments { font-size: 12px; color: rgba(255,255,255,0.35); margin: 0; }
.mmodal-comment-form {
  display: flex; flex-direction: column; gap: 6px; margin-top: 4px;
}
.mmodal-comment-input {
  width: 100%; padding: 8px 10px; border-radius: 8px; font-size: 12px;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12);
  color: inherit; resize: vertical; font-family: inherit;
}
.mmodal-comment-input::placeholder { color: rgba(255,255,255,0.3); }
.mmodal-login-hint { font-size: 12px; color: rgba(255,255,255,0.4); margin: 0; }
.mmodal-login-hint a { color: var(--primary, #a78bfa); text-decoration: none; }

/* ─── Tags in modal ─── */
.mmodal-tags-block {
  margin-top: auto;
  padding-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.mmodal-tags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}
.mmodal-tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  background: rgba(1,209,251,0.13);
  border: 1px solid rgba(1,209,251,0.28);
  color: #01D1FB;
  text-decoration: none;
  transition: background 0.15s;
  white-space: nowrap;
}
.mmodal-tag:hover { background: rgba(1,209,251,0.24); }
/* Full-page link (small, secondary) */
.mmodal-fullpage {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; color: rgba(255,255,255,0.32);
  text-decoration: none;
  transition: color 0.2s;
}
.mmodal-fullpage:hover { color: rgba(255,255,255,0.58); }
.mmodal-fullpage svg { width: 11px; height: 11px; }

/* ─── Filmstrip ─── */
.pub-modal__filmstrip {
  display: flex; gap: 6px; align-items: center;
  padding: 8px 12px;
  background: rgba(0,0,0,0.7);
  border-top: 1px solid rgba(255,255,255,0.06);
  overflow-x: auto; overscroll-behavior-x: contain;
  flex-shrink: 0;
  justify-content: center; /* center items on desktop */
}
.pub-modal__filmstrip::-webkit-scrollbar { height: 3px; }
.pub-modal__filmstrip::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 2px; }
.pub-modal__filmstrip:empty { display: none; }

.pub-modal__filmstrip-item {
  flex-shrink: 0; width: 64px; height: 64px; border-radius: 8px;
  overflow: hidden; cursor: pointer; position: relative;
  border: 2.5px solid transparent;
  transition: border-color 0.2s ease, opacity 0.2s ease, transform 0.15s ease;
  opacity: 0.5;
  background: #1a1a1a;
}
.pub-modal__filmstrip-item img,
.pub-modal__filmstrip-item video {
  width: 100%; height: 100%; object-fit: cover; display: block;
  pointer-events: none;
}
.pub-modal__filmstrip-item:hover { opacity: 0.85; transform: scale(1.05); }
.pub-modal__filmstrip-item.active {
  border-color: var(--primary, #a78bfa);
  opacity: 1;
  transform: scale(1.08);
}

/* ─── Responsive ─── */
@media (max-width: 900px) {
  .pub-modal__container {
    max-width: 100%; max-height: 100dvh; border-radius: 0;
  }
  .mmodal-wrap {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    min-height: auto;
  }
  .mmodal-media {
    max-height: 55dvh;
  }
  .mmodal-media--video { max-height: 50dvh; }
  .mmodal-sidebar {
    max-height: none; overflow-y: visible;
    border-left: none; border-top: 1px solid rgba(255,255,255,0.07);
    padding: 14px 14px 24px;
  }
  .pub-modal__nav { display: none; }
}

@media (max-width: 480px) {
  .mmodal-media { max-height: 45dvh; }
  .mmodal-media--video { max-height: 40dvh; }
  .mmodal-sidebar { padding: 10px 10px 16px; gap: 8px; }
  .mmodal-title { font-size: 13px; }
  /* Filmstrip: smaller items on mobile */
  .pub-modal__filmstrip { padding: 6px 8px; gap: 4px; justify-content: flex-start; }
  .pub-modal__filmstrip-item { width: 50px; height: 50px; border-radius: 7px; }
}

@media (max-width: 380px) {
  .mmodal-media { max-height: 42dvh; }
  .mmodal-media--video { max-height: 38dvh; }
  .mmodal-sidebar { padding: 8px 8px 12px; }
  .mmodal-title { font-size: 12px; }
  .pub-modal__filmstrip { padding: 5px 6px; gap: 3px; }
  .pub-modal__filmstrip-item { width: 44px; height: 44px; border-radius: 6px; }
  .pub-modal__close { width: 34px; height: 34px; top: 8px; right: 8px; }
  .pub-modal__close svg { width: 16px; height: 16px; }
}

/* ════════════════════════════════════════════════════════
   FULL DETAIL PAGE — same style as modal, adapted for full page
   ════════════════════════════════════════════════════════ */
.detail-page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0.75rem 1rem 3rem;
}
.detail-page__nav {
  display: flex; align-items: center; gap: 10px; margin-bottom: 12px;
  font-size: 13px; color: rgba(255,255,255,0.45);
}
.detail-page__nav a {
  display: inline-flex; align-items: center; gap: 4px;
  color: rgba(255,255,255,0.45); text-decoration: none;
  transition: color 0.2s;
}
.detail-page__nav a:hover { color: rgba(255,255,255,0.85); }
.detail-page__nav span { opacity: 0.3; }

/* Override modal height constraints for page context */
.detail-page .mmodal-wrap {
  border-radius: 16px; overflow: hidden;
  background: var(--card-bg, #0e0e0f);
  box-shadow: 0 4px 48px rgba(0,0,0,0.5);
  min-height: 0;
}
.detail-page .mmodal-media {
  max-height: 88dvh;
  min-height: 320px;
}
.detail-page .mmodal-sidebar {
  max-height: none;
  overflow-y: auto;
}
@media (min-width: 901px) {
  .detail-page .mmodal-sidebar {
    position: sticky;
    top: 4.5rem;
    max-height: calc(100dvh - 5rem);
  }
}

/* Comments section on detail page — always expanded */
.detail-page .mmodal-comments-section { flex: 1; min-height: 0; }
.detail-page .mmodal-comments { max-height: none; }
.detail-page .mmodal-prompt__text { max-height: none; }

/* Comment reply indent */
.mmodal-comment-reply {
  margin-top: 6px; padding: 6px 8px;
  background: rgba(255,255,255,0.03); border-radius: 6px;
  border-left: 2px solid rgba(255,255,255,0.08);
}

/* Comments label (not a toggle on detail page) */
.mmodal-comments-toggle-label {
  display: flex; align-items: center; gap: 6px;
  color: rgba(255,255,255,0.7);
}

/* Related photos/videos section */
.detail-related { margin-top: 1.5rem; }
.detail-related__title {
  font-size: 15px; font-weight: 600; color: rgba(255,255,255,0.75);
  margin-bottom: 12px;
}
.detail-related__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}
.detail-related__item {
  border-radius: 10px; overflow: hidden;
  aspect-ratio: 1; display: block; background: #1a1a1a;
}
.detail-related__item img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform 0.3s ease;
}
.detail-related__item:hover img { transform: scale(1.04); }

/* Mobile adjustments for detail page */
@media (max-width: 900px) {
  .detail-page .mmodal-media { max-height: 60dvh; min-height: 200px; }
  .detail-related__grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
}
@media (max-width: 480px) {
  .detail-page { padding: 0.5rem 0.5rem 2rem; }
  .detail-page .mmodal-wrap { border-radius: 12px; }
  .detail-related__grid { grid-template-columns: repeat(3, 1fr); gap: 6px; }
}

/* ── Light theme overrides for modal ── */
:root:not([data-theme="dark"]) .mmodal-sidebar {
  background: #fff;
  border-left: 1px solid rgba(0,0,0,0.08);
}
:root:not([data-theme="dark"]) .mmodal-sidebar::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); }
:root:not([data-theme="dark"]) .mmodal-follow {
  border-color: rgba(0,0,0,0.2); color: rgba(0,0,0,0.65);
}
:root:not([data-theme="dark"]) .mmodal-follow:hover {
  background: rgba(0,0,0,0.06); border-color: rgba(0,0,0,0.4);
}
:root:not([data-theme="dark"]) .mmodal-actions .pub-btn {
  background: rgba(0,0,0,0.05); border-color: rgba(0,0,0,0.1); color: rgba(0,0,0,0.7);
}
:root:not([data-theme="dark"]) .mmodal-actions .pub-btn:hover {
  background: rgba(0,0,0,0.1); color: #000;
}
:root:not([data-theme="dark"]) .mmodal-views { color: rgba(0,0,0,0.45); }
:root:not([data-theme="dark"]) .mmodal-label { color: rgba(0,0,0,0.4); }
:root:not([data-theme="dark"]) .mmodal-model__name { color: rgba(0,0,0,0.6); }
:root:not([data-theme="dark"]) .mmodal-prompt {
  background: rgba(0,0,0,0.03); border-color: rgba(0,0,0,0.1);
}
:root:not([data-theme="dark"]) .mmodal-copy-btn {
  background: rgba(0,0,0,0.06); color: rgba(0,0,0,0.55);
}
:root:not([data-theme="dark"]) .mmodal-copy-btn:hover {
  background: rgba(0,0,0,0.12); color: #000;
}
:root:not([data-theme="dark"]) .mmodal-prompt__text { color: rgba(0,0,0,0.75); }
:root:not([data-theme="dark"]) .mmodal-comments-toggle { color: rgba(0,0,0,0.6); }
:root:not([data-theme="dark"]) .mmodal-comments-toggle:hover { color: #000; }
:root:not([data-theme="dark"]) .mmodal-comments-toggle-label { color: rgba(0,0,0,0.6); }
:root:not([data-theme="dark"]) .mmodal-comment { background: rgba(0,0,0,0.04); }
:root:not([data-theme="dark"]) .mmodal-comment__text { color: rgba(0,0,0,0.7); }
:root:not([data-theme="dark"]) .mmodal-no-comments { color: rgba(0,0,0,0.35); }
:root:not([data-theme="dark"]) .mmodal-comment-input {
  background: rgba(0,0,0,0.04); border-color: rgba(0,0,0,0.12); color: #111;
}
:root:not([data-theme="dark"]) .mmodal-comment-input::placeholder { color: rgba(0,0,0,0.3); }
:root:not([data-theme="dark"]) .mmodal-login-hint { color: rgba(0,0,0,0.45); }
:root:not([data-theme="dark"]) .mmodal-fullpage { color: rgba(0,0,0,0.35); }
:root:not([data-theme="dark"]) .mmodal-fullpage:hover { color: rgba(0,0,0,0.65); }
:root:not([data-theme="dark"]) .mmodal-tag { background: rgba(1,209,251,0.1); border-color: rgba(1,209,251,0.25); }
:root:not([data-theme="dark"]) .mmodal-tag:hover { background: rgba(1,209,251,0.2); }
:root:not([data-theme="dark"]) .mmodal-comment-reply {
  background: rgba(0,0,0,0.03); border-left-color: rgba(0,0,0,0.1);
}
/* Detail page light theme */
:root:not([data-theme="dark"]) .detail-page .mmodal-wrap {
  background: #fff; box-shadow: 0 4px 48px rgba(0,0,0,0.12);
}
:root:not([data-theme="dark"]) .detail-page__nav { color: rgba(0,0,0,0.45); }
:root:not([data-theme="dark"]) .detail-page__nav a { color: rgba(0,0,0,0.65); }
:root:not([data-theme="dark"]) .detail-related__title { color: rgba(0,0,0,0.7); }
:root:not([data-theme="dark"]) .detail-related__item { background: #f0f0f0; }

/* ═══════════════════════════════════════════════════
   COMMENT ITEMS — modals + detail pages, light & dark
   ═══════════════════════════════════════════════════ */
.cmt-list { display:flex; flex-direction:column; gap:14px; margin-bottom:14px; }
.cmt-item { display:flex; gap:9px; min-width:0; }
.cmt-item--reply { margin-top:0; }

/* Avatar — explicit px sizes beat any global img/width rules */
.cmt-avatar {
  flex-shrink:0 !important;
  width:30px !important; height:30px !important;
  min-width:30px !important; max-width:30px !important;
  border-radius:50%; overflow:hidden;
  background:rgba(255,255,255,0.08);
  display:flex !important; align-items:center; justify-content:center;
}
.cmt-avatar img {
  width:30px !important; height:30px !important;
  min-width:30px !important; max-width:30px !important;
  object-fit:cover !important; display:block !important; flex-shrink:0 !important;
  border-radius:50% !important;
}
.cmt-avatar span { font-size:11px; font-weight:700; color:var(--text); text-transform:uppercase; }
.cmt-avatar--sm { width:22px !important; height:22px !important; min-width:22px !important; max-width:22px !important; }
.cmt-avatar--sm img { width:22px !important; height:22px !important; min-width:22px !important; max-width:22px !important; border-radius:50% !important; }
.cmt-avatar--sm span { font-size:9px; }

/* Body */
.cmt-body { flex:1; min-width:0; }
.cmt-header { display:flex; align-items:baseline; gap:6px; flex-wrap:wrap; margin-bottom:2px; }
.cmt-username { font-size:12px; font-weight:600; color:var(--text); }
.cmt-text {
  font-size:13px; line-height:1.5; color:var(--text);
  margin:0 0 6px; word-break:break-word; white-space:pre-wrap;
}

/* Action row */
.cmt-actions { display:flex !important; align-items:center; gap:6px; flex-wrap:nowrap; }
.cmt-like-btn {
  display:inline-flex !important; align-items:center; gap:4px;
  background:none; border:none; cursor:pointer;
  padding:3px 7px; border-radius:20px;
  color:var(--muted, #9ca3af); font-size:11px;
  transition:color .15s, background .15s; line-height:1;
}
.cmt-like-btn svg { width:12px !important; height:12px !important; flex-shrink:0; transition:fill .15s; }
.cmt-like-btn:hover { color:#f43f5e; background:rgba(244,63,94,.1); }
.cmt-like-btn[aria-pressed="true"] { color:#f43f5e; }
.cmt-like-btn[aria-pressed="true"] svg { fill:currentColor; }

.cmt-reply-btn {
  background:none; border:none; cursor:pointer;
  padding:3px 7px; border-radius:20px;
  color:var(--muted, #9ca3af); font-size:11px;
  transition:color .15s, background .15s; line-height:1;
  display:inline-flex !important; align-items:center;
}
.cmt-reply-btn:hover { color:var(--text, #e5e7eb); background:rgba(255,255,255,.06); }
:root:not([data-theme="dark"]) .cmt-reply-btn:hover { background:rgba(0,0,0,.05); }

/* Reply form */
.cmt-reply-form { margin-top:8px; }
.cmt-reply-form.hidden { display:none !important; }
.cmt-reply-input {
  width:100%; padding:8px 10px; border-radius:10px;
  border:1px solid var(--bord, rgba(255,255,255,.12));
  background:rgba(255,255,255,.05); color:var(--text);
  font-size:13px; resize:none; box-sizing:border-box;
  font-family:inherit; line-height:1.4;
  transition:border-color .15s;
}
.cmt-reply-input::placeholder { color:var(--muted); }
.cmt-reply-input:focus { outline:none; border-color:var(--primary,#01D1FB); }
.cmt-reply-row { display:flex; justify-content:flex-end; gap:6px; margin-top:6px; }
.cmt-cancel-btn {
  background:none; border:1px solid var(--bord); border-radius:8px;
  padding:4px 11px; font-size:12px; color:var(--muted); cursor:pointer;
  transition:color .15s;
}
.cmt-cancel-btn:hover { color:var(--text); }
.cmt-send-btn {
  background:var(--primary,#01D1FB); border:none; border-radius:8px;
  padding:4px 14px; font-size:12px; font-weight:600; color:#000;
  cursor:pointer; transition:opacity .15s;
}
.cmt-send-btn:hover { opacity:.85; }

/* Replies indent */
.cmt-replies {
  margin-top:10px; padding-left:10px;
  border-left:2px solid rgba(255,255,255,.1);
  display:flex; flex-direction:column; gap:10px;
}

/* Light theme */
:root:not([data-theme="dark"]) .cmt-avatar { background:#e5e7eb; }
:root:not([data-theme="dark"]) .cmt-reply-input {
  background:rgba(0,0,0,.03); border-color:rgba(0,0,0,.12);
}
:root:not([data-theme="dark"]) .cmt-reply-btn:hover { background:rgba(0,0,0,.05); }
:root:not([data-theme="dark"]) .cmt-replies { border-left-color:rgba(0,0,0,.1); }
:root:not([data-theme="dark"]) .cmt-cancel-btn { border-color:rgba(0,0,0,.15); }

/* 320px */
@media (max-width:360px) {
  .cmt-text { font-size:12px; }
  .cmt-avatar { width:26px; height:26px; }
  .cmt-avatar--sm { width:20px; height:20px; }
  .cmt-item { gap:7px; }
}

/* Double-click like heart animation */
.mmodal-dbl-heart {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%) scale(0.5);
  font-size: 72px; line-height: 1;
  pointer-events: none; z-index: 100;
  animation: mmodal-heart-pop 0.85s ease forwards;
}
@keyframes mmodal-heart-pop {
  0%   { transform: translate(-50%, -50%) scale(0.5); opacity: 1; }
  30%  { transform: translate(-50%, -50%) scale(1.4); opacity: 1; }
  65%  { transform: translate(-50%, -50%) scale(1.15); opacity: 0.9; }
  100% { transform: translate(-50%, -50%) scale(1.5); opacity: 0; }
}

/* ── Generate page: balance bar & right column (added for immediate effect) ── */
.gen-balance {
  position: relative !important;
  background: linear-gradient(135deg, rgba(6,182,212,.13) 0%, rgba(99,102,241,.10) 100%) !important;
  border-bottom: 1px solid rgba(6,182,212,.28) !important;
  overflow: hidden !important;
}
.gen-balance::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, #06b6d4, #6366f1, #06b6d4);
  opacity: .85;
  pointer-events: none;
}
.gen-balance-dot {
  width: .75rem !important;
  height: .75rem !important;
  border-radius: 9999px !important;
  background: #06b6d4 !important;
  box-shadow: 0 0 10px rgba(6,182,212,.75), 0 0 0 3px rgba(6,182,212,.22) !important;
  flex-shrink: 0 !important;
  animation: gen-bal-pulse 2.4s ease-in-out infinite !important;
}
@keyframes gen-bal-pulse {
  0%,100% { box-shadow: 0 0 6px rgba(6,182,212,.60), 0 0 0 3px rgba(6,182,212,.18); }
  50%      { box-shadow: 0 0 18px rgba(6,182,212,.95), 0 0 0 6px rgba(6,182,212,.32); }
}
.gen-balance-val {
  font-size: clamp(1.125rem, 2.2vw, 1.5rem) !important;
  font-weight: 900 !important;
  letter-spacing: -.02em !important;
}
.gen-topup-btn {
  background: linear-gradient(135deg, #06b6d4 0%, #6366f1 100%) !important;
  color: #fff !important;
  font-weight: 700 !important;
  font-size: .8rem !important;
  padding: .45rem 1.1rem !important;
  border-radius: 9999px !important;
  box-shadow: 0 2px 14px rgba(6,182,212,.45) !important;
  text-decoration: none !important;
  transition: opacity .15s, transform .15s, box-shadow .15s !important;
}
.gen-topup-btn:hover {
  opacity: .88 !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 20px rgba(6,182,212,.60) !important;
}
/* Right column sticky: header h-16 = 64px, so top: 72px clears navbar */
@media (min-width: 900px) {
  .gen-right-col {
    align-self: start !important;
    position: sticky !important;
    top: 72px !important;
    max-height: calc(100vh - 80px) !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    gap: .75rem !important;
  }
  /* Button always visible at top — never shrinks */
  .gen-right-col .gen-submit-wrap {
    flex-shrink: 0 !important;
  }
  /* Queue fills remaining space — scrolls inside if content is long */
  .gen-right-col .gen-queue-card {
    flex: 1 1 auto !important;
    min-height: 200px !important;
    overflow-y: auto !important;
  }
}

/* ── Model card: soft highlight on localStorage restore ── */
.mc-card[data-selected="1"] {
  border-color: rgba(6,182,212,.35) !important;
  box-shadow: 0 0 0 1px rgba(6,182,212,.18) !important;
}
/* Full glow + badge only on explicit user click */
.mc-card[data-chosen="1"],
.mc-card.is-selected {
  border-color: #06b6d4 !important;
  box-shadow:
    0 0 0 2px #06b6d4,
    0 0 0 4px rgba(6,182,212,.25),
    0 0 24px rgba(6,182,212,.40),
    0 8px 24px rgba(0,0,0,.35) !important;
  transform: translateY(-2px) scale(1.02) !important;
  z-index: 2 !important;
}
.mc-card[data-chosen="1"] .mc-selected-badge {
  display: flex !important;
}
.mc-selected-badge {
  display: none;
  position: absolute;
  bottom: .35rem;
  right: .35rem;
  align-items: center;
  gap: .2rem;
  padding: .18rem .45rem;
  background: linear-gradient(135deg, #06b6d4, #6366f1);
  border-radius: 999px;
  font-size: .58rem;
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: .05em;
  box-shadow: 0 2px 8px rgba(6,182,212,.5);
  pointer-events: none;
  z-index: 3;
}
