/* figures/css/figureinfo.css (FINAL)
   Updates:
   1) Обводки контейнерів:
      - light: сірі
      - dark: темно-сірі
   2) Найбільший контейнер (.product-page) - БЕЗ обводки
   3) Коментарі: кнопка ^(n), за замовчуванням закрито (це вже в HTML),
      плюс стилі + “не рендерити зайве” (content-visibility для відкритого/закритого)
*/

:root {
  --bg: #0b0b0b;

  --panel-bg: rgba(15, 15, 15, .72);
  --panel-border: rgba(255, 255, 255, .10);

  --card-bg: rgba(20, 20, 20, .72);
  --card-border: rgba(255, 255, 255, .10);

  --text: #fff;
  --muted: rgba(255, 255, 255, .80);

  --input-bg: rgba(255, 255, 255, .06);
  --input-border: rgba(255, 255, 255, .16);

  --btn-surface: rgba(0, 0, 0, .35);
  --btn-surface-hover: rgba(0, 0, 0, .50);
  --btn-border: rgba(255, 255, 255, .16);

  --img-placeholder-bg: #2a2a2a;
  --img-placeholder-text: rgba(255, 255, 255, .55);

  --part-bg-fallback: url("/static/main_img/NoIMG/NoIMG_bg_NIGHT.webp");
}

html {
  background: var(--bg);
}

body {
  background: var(--bg);
  color: var(--text);
}

body.theme-dark,
body.dark,
html[data-guest-theme="dark"] body.anonymous-theme,
html[data-theme="dark"] body {
  --bg: #0b0b0b;

  --panel-bg: rgba(15, 15, 15, .72);
  --panel-border: rgba(255, 255, 255, .10);

  --card-bg: rgba(20, 20, 20, .72);
  --card-border: rgba(255, 255, 255, .10);

  --text: #fff;
  --muted: rgba(255, 255, 255, .80);

  --input-bg: rgba(255, 255, 255, .06);
  --input-border: rgba(255, 255, 255, .16);

  --btn-surface: rgba(0, 0, 0, .35);
  --btn-surface-hover: rgba(0, 0, 0, .50);
  --btn-border: rgba(255, 255, 255, .16);

  --img-placeholder-bg: #2a2a2a;
  --img-placeholder-text: rgba(255, 255, 255, .55);

  --part-bg-fallback: url("/static/main_img/NoIMG/NoIMG_bg_NIGHT.webp");
}

body.theme-light,
body.light,
html[data-guest-theme="light"] body.anonymous-theme,
html[data-theme="light"] body {
  --bg: #f3f4f6;

  --panel-bg: rgba(255, 255, 255, .84);
  --panel-border: rgba(0, 0, 0, .12);

  --card-bg: rgba(255, 255, 255, .88);
  --card-border: rgba(0, 0, 0, .12);

  --text: #111;
  --muted: rgba(0, 0, 0, .70);

  --input-bg: rgba(255, 255, 255, .92);
  --input-border: rgba(0, 0, 0, .16);

  --btn-surface: rgba(255, 255, 255, .78);
  --btn-surface-hover: rgba(255, 255, 255, .94);
  --btn-border: rgba(0, 0, 0, .14);

  --img-placeholder-bg: #e5e5e5;
  --img-placeholder-text: rgba(0, 0, 0, .45);

  --part-bg-fallback: url("/static/main_img/NoIMG/NoIMG_bg_LIGHT.webp");
}

/* =========================
   Fullscreen background wrap (як у part.css)
   ========================= */
.part-bg-wrap {
  min-height: 100vh;
  position: relative;
  width: 100%;

  background-color: var(--bg);
  background-image: var(--part-bg-url-light, var(--part-bg-url, var(--part-bg-fallback)));
  background-position: center center;
  background-repeat: no-repeat;
  background-size: cover;
  background-attachment: fixed;

  overflow-x: hidden;
}

body.theme-dark .part-bg-wrap,
body.dark .part-bg-wrap,
html[data-theme="dark"] body .part-bg-wrap,
html[data-guest-theme="dark"] body.anonymous-theme .part-bg-wrap {
  background-image: var(--part-bg-url-dark, var(--part-bg-url-light, var(--part-bg-url, var(--part-bg-fallback))));
}

.part-bg-wrap.bg-single {
  background-repeat: no-repeat;
  background-size: cover;
  background-attachment: fixed;
}

.part-bg-wrap.bg-repeat {
  background-repeat: repeat-y;
  background-size: 100% auto;
  background-position: center center;
  background-attachment: scroll;
}

.part-bg-wrap.bg-single {
  background-repeat: no-repeat;
  background-size: cover;
  background-attachment: fixed;
}

/* =========================
   Page container (largest) - NO BORDER (2)
   ========================= */
.product-page {
  width: min(1100px, 94vw);
  margin: 0 auto;
  padding: 14px;
  box-sizing: border-box;

  border-radius: 18px;

  background: var(--panel-bg);
  /* (2) без обводки */
  border: 0;

  color: var(--text);

  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);

  overflow-x: hidden;
}

/* =========================
   Buttons (як у part.css)
   ========================= */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;

  padding: 8px 10px;
  border-radius: 12px;

  background: var(--btn-surface);
  border: 1px solid var(--btn-border);
  color: var(--text);

  font-size: .92rem;
  cursor: pointer;
  text-decoration: none;
  user-select: none;

  transition: background-color .22s ease, color .22s ease, border-color .22s ease, box-shadow .22s ease, transform .08s ease;
}

.btn:hover {
  background: var(--btn-surface-hover);
}

.btn:active {
  transform: translateY(1px);
}

.btn:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 15);
}

.btn-outline-small {
  padding: 7px 10px;
  border-radius: 12px;
}

/* back link як "пілл" */
.back {
  display: inline-flex;
  align-items: center;
  gap: 6px;

  padding: 8px 14px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 700;
  font-size: .95rem;

  background: rgba(0, 0, 0, 55);
  border: 1px solid rgba(140, 140, 140, .45);
  color: #fff;

  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);

  transition: background-color .2s ease, border-color .2s ease, transform .08s ease;
  margin-bottom: 12px;
}

.back:hover {
  background: rgba(0, 0, 0, 72);
  border-color: rgba(170, 170, 170, .55);
}

.back:active {
  transform: translateY(1px);
}

body.theme-light .back {
  background: rgba(255, 255, 255, 70);
  border-color: rgba(140, 140, 140, .40);
  color: #111;
}

body.theme-light .back:hover {
  background: rgba(255, 255, 255, 88);
  border-color: rgba(160, 160, 160, .48);
}

/* =========================
   Layout grid
   ========================= */
.figure-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  grid-template-areas:
    "left meta"
    "quick comments";
  gap: 16px;
  align-items: start;
  min-width: 0;
}

.figure-left {
  grid-area: left;
}

.meta-top {
  grid-area: meta;
}

.quick-rows-block {
  grid-area: quick;
}

.comments-block {
  grid-area: comments;
}

@media (max-width: 1120px) {
  .figure-wrap {
    grid-template-columns: 1fr;
    grid-template-areas:
      "left"
      "meta"
      "quick"
      "comments";
  }

  .figure-left,
  .meta-top,
  .quick-rows-block,
  .comments-block,
  .hero-main {
    min-width: 0;
    max-width: 100%;
  }

  .hero {
    max-width: 100%;
  }
}

/* =========================
   Glass cards (внутрішні блоки) - with borders (1)
   ========================= */
.meta-top,
.quick-rows-block,
.comments-block {
  border-radius: 16px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  color: var(--text);

  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);

  padding: 12px 14px;
}

.meta-top h1 {
  margin: 4px 0 10px;
  font-size: clamp(1.2rem, 1.05rem + 1vw, 1.65rem);
  line-height: 1.15;
}

/* =========================
   Hero image + thumbs
   ========================= */
.hero-main {
  border-radius: 16px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);

  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);

  padding: 12px;
}

.hero {
  width: 100%;
  height: clamp(340px, 55vh, 520px);

  object-fit: contain;
  display: block;

  border-radius: 14px;
  background: rgba(0, 0, 0, 18);

  touch-action: pan-y;
}

.hero-image-shell {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
}

.hero-image-shell .hero {
  cursor: pointer;
}

body.theme-light .hero,
body.light .hero,
html[data-theme="light"] body .hero,
html[data-guest-theme="light"] body.anonymous-theme .hero {
  background: #fff;
}

.hero-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);

  width: 42px;
  height: 58px;
  border-radius: 999px;

  display: flex;
  align-items: center;
  justify-content: center;

  background: rgba(0, 0, 0, .42);
  border: 1px solid rgba(255, 255, 255, .28);
  color: #fff;

  font-size: 34px;
  line-height: 1;
  cursor: pointer;
  z-index: 3;

  opacity: 0;
  pointer-events: none;

  transition:
    opacity .18s ease,
    background-color .18s ease,
    transform .08s ease;
}

.hero-nav-left {
  left: 12px;
}

.hero-nav-right {
  right: 12px;
}

.hero-image-shell:hover .hero-nav,
.hero-image-shell:focus-within .hero-nav {
  opacity: 1;
  pointer-events: auto;
}

.hero-nav:hover {
  background: rgba(0, 0, 0, .62);
}

.hero-nav:active {
  transform: translateY(-50%) scale(.96);
}

.hero-nav-hint {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);

  padding: 6px 10px;
  border-radius: 999px;

  background: rgba(0, 0, 0, .52);
  color: #fff;

  font-size: .78rem;
  font-weight: 700;
  white-space: nowrap;

  opacity: 0;
  pointer-events: none;
  z-index: 3;

  transition: opacity .18s ease;
}

.hero-image-shell:hover .hero-nav-hint,
.hero-image-shell:focus-within .hero-nav-hint {
  opacity: 1;
}

body.theme-light .hero-nav {
  background: rgba(255, 255, 255, .74);
  border-color: rgba(0, 0, 0, .18);
  color: #111;
}

body.theme-light .hero-nav:hover {
  background: rgba(255, 255, 255, .92);
}

body.theme-light .hero-nav-hint {
  background: rgba(255, 255, 255, .82);
  color: #111;
}

@media (max-width: 640px) {
  .hero-nav {
    opacity: 1;
    pointer-events: auto;
    width: 36px;
    height: 50px;
    font-size: 28px;
  }

  .hero-nav-hint {
    display: none;
  }
}

body.theme-light .hero {
  background: #fff;
}

.hero-empty {
  width: 100%;
  min-height: 320px;
  border-radius: 14px;
  background: var(--img-placeholder-bg);
  border: 1px dashed var(--btn-border);

  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--img-placeholder-text);
  font-size: .98rem;
  text-align: center;
  padding: 12px;
}


/* =========================
   Fullscreen hero viewer
   ========================= */

.hero-fullscreen-btn {
  position: absolute;
  top: 12px;
  right: 12px;

  width: 42px;
  height: 42px;
  border-radius: 999px;

  display: flex;
  align-items: center;
  justify-content: center;

  background: rgba(0, 0, 0, .48);
  border: 1px solid rgba(255, 255, 255, .22);
  color: #fff;

  font-size: 20px;
  cursor: pointer;
  z-index: 5;

  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);

  transition:
    background-color .18s ease,
    transform .08s ease,
    opacity .18s ease;
}

.hero-fullscreen-btn:hover {
  background: rgba(0, 0, 0, .68);
}

.hero-fullscreen-btn:active {
  transform: scale(.96);
}

body.theme-light .hero-fullscreen-btn {
  background: rgba(255, 255, 255, .82);
  border-color: rgba(0, 0, 0, .14);
  color: #111;
}

body.theme-light .hero-fullscreen-btn:hover {
  background: rgba(255, 255, 255, .96);
}

/* overlay */

.hero-lightbox {
  position: fixed;
  inset: 0;

  background: rgba(0, 0, 0, .92);

  display: flex;
  align-items: center;
  justify-content: center;

  z-index: 2147483647;
}

.hero-lightbox[hidden] {
  display: none !important;
}

.hero-lightbox-image {
  width: auto;
  height: auto;

  min-width: min(72vw, 1200px);

  max-width: 96vw;
  max-height: 94vh;

  object-fit: contain;
  user-select: none;

  image-rendering: auto;
}

.hero-lightbox-close {
  position: absolute;
  top: 18px;
  right: 18px;

  width: 52px;
  height: 52px;
  border-radius: 999px;

  display: flex;
  align-items: center;
  justify-content: center;

  background: rgba(255, 255, 255, .10);
  border: 1px solid rgba(255, 255, 255, .18);
  color: #fff;

  font-size: 34px;
  cursor: pointer;

  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);

  z-index: 3;
}

.hero-lightbox-close:hover {
  background: rgba(255, 255, 255, .18);
}

.hero-lightbox-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);

  width: 64px;
  height: 92px;
  border-radius: 999px;

  display: flex;
  align-items: center;
  justify-content: center;

  background: rgba(255, 255, 255, .10);
  border: 1px solid rgba(255, 255, 255, .18);
  color: #fff;

  font-size: 52px;
  cursor: pointer;

  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);

  z-index: 3;
}

.hero-lightbox-arrow:hover {
  background: rgba(255, 255, 255, .18);
}

.hero-lightbox-arrow-left {
  left: 18px;
}

.hero-lightbox-arrow-right {
  right: 18px;
}

@media (max-width: 640px) {
  .hero-lightbox-arrow {
    width: 48px;
    height: 72px;
    font-size: 38px;
  }

  .hero-lightbox-close {
    width: 46px;
    height: 46px;
    font-size: 28px;
  }
}


.thumbs-row {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.thumb-arrow {
  flex: 0 0 auto;
  width: 28px;
  height: 64px;
  border-radius: 10px;

  background: var(--btn-surface);
  border: 1px solid var(--btn-border);
  color: var(--text);

  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  padding: 0;
  user-select: none;

  transition: background-color .22s ease, transform .08s ease;
}

.thumb-arrow:hover {
  background: var(--btn-surface-hover);
}

.thumb-arrow:active {
  transform: translateY(1px);
}

.thumbs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 4px;
  flex: 1 1 auto;
}

.thumbs::-webkit-scrollbar {
  height: 6px;
}

.thumbs::-webkit-scrollbar-thumb {
  background: rgba(127, 127, 127, .35);
  border-radius: 3px;
}

.thumb,
.thumbs img {
  flex: 0 0 auto;
  width: clamp(48px, 16%, 72px);
  aspect-ratio: 1 / 1;
  object-fit: contain;
  cursor: pointer;

  border-radius: 10px;
  border: 1px solid var(--btn-border);
  background: rgba(255, 255, 255, 0.80);

  transition: box-shadow .15s ease, transform .05s ease, background-color .22s ease;
}

.thumb.is-active,
.thumbs img.is-active {
  border-color: rgba(59, 130, 246, .85);
  box-shadow:
    0 0 0 2px rgba(59, 130, 246, .35),
    0 0 12px rgba(59, 130, 246, .22);
  transform: translateY(-1px);
}

body.theme-light .thumb.is-active,
body.theme-light .thumbs img.is-active {
  background: #fff;
}

body.theme-dark .thumb.is-active,
body.theme-dark .thumbs img.is-active {
  background: rgba(255, 255, 255, .12);
}

body.theme-dark .thumb,
body.theme-dark .thumbs img {
  background: rgba(255, 255, 255, 0.06);
}

.thumb:hover,
.thumbs img:hover {
  box-shadow: 0 0 0 2px rgba(59, 130, 246, .25) inset;
}

.thumb:active,
.thumbs img:active {
  transform: scale(.98);
}

.left-actions {
  margin-top: 10px;
}


/* =========================
   Figure tags + manufacturer
   ========================= */

.figure-meta-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 4px 0 12px;
  max-height: 24px;
  overflow: hidden;
  position: relative;
}

.figure-meta-badges.is-expanded {
  max-height: none;
}

.figure-meta-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: 3px 8px;
  border-radius: 999px;

  font-size: 0.72rem;
  line-height: 1.1;
  font-weight: 700;

  white-space: nowrap;

  border: 1px solid var(--btn-border);
  background: var(--btn-surface);
  color: var(--text);

  opacity: 0.88;
}

body.theme-dark .figure-meta-chip {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(140, 140, 140, 0.45);
  color: rgba(255, 255, 255, 0.92);
}

body.theme-light .figure-meta-chip {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(120, 120, 120, 0.32);
  color: rgba(0, 0, 0, 0.82);
}

.figure-meta-more {
  cursor: pointer;
  min-width: 28px;
}

.figure-meta-more[hidden] {
  display: none !important;
}

.figure-meta-chip.is-hidden,
.figure-meta-more.is-hidden {
  display: none !important;
}

.figure-meta-more:hover {
  opacity: 1;
}

/* =========================
   Figure description block
   ========================= */
.figure-info-text {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 14px;

  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--card-border);
  color: var(--text);

  white-space: pre-line;
  line-height: 1.45;
  font-size: .95rem;
}

body.theme-light .figure-info-text {
  background: rgba(0, 0, 0, 0.04);
}

.figure-info-empty {
  margin-top: 12px;
  color: var(--muted);
  font-size: .95rem;
}

.meta-actions {
  margin: 10px 0 0;
}

.thumb-arrow.is-hidden {
  display: none;
}

.thumbs-row--no-arrows {
  gap: 0;
}

.thumbs-row--no-arrows .thumbs {
  justify-content: center;
}

/* =========================
   Rarity card + popovers
   ========================= */

/* CARD */
.rarity-card {
  margin: 10px 0 0;
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--card-border);
  filter: none;
  opacity: 1;
}

body.theme-light .rarity-card {
  background: rgba(0, 0, 0, 0.04);
}

.rarity-summary-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 8px;
  font-size: .95rem;
}

.rarity-summary-text {
  flex: 1 1 auto;
  min-width: 0;
}

.rarity-summary-count {
  margin-left: 6px;
  color: var(--muted);
  font-size: .85rem;
}

.rarity-summary-btn {
  flex: 0 0 auto;
  white-space: nowrap;
}

.rarity-info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 8px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid var(--btn-border);
  background: var(--btn-surface);
  cursor: pointer;
  font-size: 12px;
  user-select: none;
}

.rarity-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: .88rem;
}

/* =========================
   Admin inline trigger
   ========================= */
.rarity-admin-line {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.rarity-admin-label {
  flex: 0 0 auto;
  color: var(--text);
  font-size: .95rem;
  font-weight: 700;
}

.rarity-admin-open {
  flex: 0 1 auto;
  max-width: 100%;
  justify-content: flex-start;
  text-align: left;
  white-space: normal;
  line-height: 1.25;
}

.rarity-admin-popover-form {
  margin: 0;
}

/* =========================
   Popover backdrop
   ========================= */
.rarity-modal-backdrop {
  position: fixed !important;
  inset: 0 !important;
  display: none;
  background: transparent !important;
  z-index: 2147483000 !important;
  padding: 0 !important;
  pointer-events: auto;
  transform: none !important;
  filter: none !important;
}

.rarity-modal-backdrop[style*="display:block"],
.rarity-modal-backdrop[style*="display: block"] {
  display: block !important;
}

/* =========================
   Popover box
   ========================= */
.rarity-modal {
  position: absolute !important;
  z-index: 2147483001 !important;
  width: min(520px, 96vw);
  max-width: calc(100vw - 16px);
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  opacity: 1;
  filter: none;
  box-sizing: border-box;
}

body.theme-dark .rarity-modal {
  background: rgba(10, 10, 10, 0.88);
  border: 1px solid rgba(120, 120, 120, 0.55);
  color: #fff;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

body.theme-light .rarity-modal {
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid rgba(140, 140, 140, 0.45);
  color: #111;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* компактніша ширина для user popover */
#rarity-modal .rarity-modal {
  width: min(440px, calc(100vw - 24px));
}

/* адмінський можна лишити трохи ширшим */
#fixed-rarity-modal .rarity-modal {
  width: min(500px, calc(100vw - 24px));
}

/* якщо info-popup теж юзає цей самий клас */
#admin-rarity-info .rarity-modal {
  width: min(420px, calc(100vw - 24px));
}

#quality-modal .rarity-modal {
  width: min(440px, calc(100vw - 24px));
}

#fixed-quality-modal .rarity-modal {
  width: min(500px, calc(100vw - 24px));
}

#admin-quality-info .rarity-modal {
  width: min(420px, calc(100vw - 24px));
}

.rarity-modal h3 {
  margin: 0 0 8px;
}

.rarity-modal-hint {
  margin: 0 0 10px;
  color: rgba(255, 255, 255, 0.80);
}

body.theme-light .rarity-modal-hint {
  color: rgba(0, 0, 0, 0.70);
}

/* =========================
   Options list
   ========================= */
.rarity-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.rarity-item {
  border-radius: 12px;
  border: 1px solid rgba(120, 120, 120, 0.55);
  background: rgba(255, 255, 255, 0.06);
  padding: 8px 10px;
}

body.theme-light .rarity-item {
  border-color: rgba(140, 140, 140, 0.40);
  background: rgba(0, 0, 0, 0.04);
}

.rarity-option {
  display: flex;
  align-items: center;
  gap: 10px;
}

.rarity-option input[type="radio"] {
  flex: 0 0 auto;
  margin: 0;
  transform: translateY(1px);
}

.rarity-option-body {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  line-height: 1.3;
  min-width: 0;
}

.rarity-option-title {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.rarity-count {
  flex: 0 0 auto;
  white-space: nowrap;
  opacity: 0.85;
  font-size: .9rem;
}

/* =========================
   Buttons row in popover
   ========================= */
.rarity-modal-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}

/* =========================
   Small responsive tweaks
   ========================= */
@media (max-width: 640px) {
  .rarity-summary-line {
    align-items: center;
    flex-wrap: nowrap;
    gap: 8px;
  }

  .rarity-summary-text {
    flex: 1 1 auto;
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .rarity-summary-btn {
    flex: 0 0 auto;
    width: auto;
    max-width: 45%;
    justify-content: center;
    white-space: nowrap;
  }

  .rarity-admin-line {
    align-items: center;
    flex-wrap: nowrap;
    gap: 8px;
  }

  .rarity-admin-label {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .rarity-admin-open {
    flex: 0 1 auto;
    width: auto;
    max-width: 55%;
    justify-content: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .rarity-modal-buttons {
    flex-wrap: wrap;
  }

  .rarity-modal-buttons .btn {
    flex: 1 1 auto;
    justify-content: center;
  }
}

@media (max-width: 380px) {
  .rarity-summary-line,
  .rarity-admin-line {
    flex-wrap: wrap;
  }

  .rarity-summary-btn,
  .rarity-admin-open {
    max-width: none;
    width: 100%;
  }
}

.rarity-info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 8px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid var(--btn-border);
  background: var(--btn-surface);
  cursor: pointer;
  font-size: 12px;
  user-select: none;
}

.rarity-info-icon:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .18);
}

/* =========================
   Quick rows (схожі) — виправлений варіант
   ========================= */

.quick-rows-title {
  font-weight: 800;
  margin: 0 0 14px;
  font-size: 1.08rem;
  line-height: 1.25;
}

.quick-row {
  margin-bottom: 18px;
}

.quick-row:last-child {
  margin-bottom: 0;
}

.quick-row-name {
  font-size: 1.05rem;
  /* було замале */
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text);
  line-height: 1.25;
}

.quick-row-label {
  font-size: .88rem;
  color: var(--muted);
  margin-left: 6px;
}

.quick-row-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.quick-row-arrow {
  flex: 0 0 auto;
  width: 28px;
  height: 60px;
  border-radius: 10px;

  background: var(--btn-surface);
  border: 1px solid var(--btn-border);
  color: var(--text);

  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 0;
  user-select: none;

  transition: background-color .22s ease, transform .08s ease;
}

.quick-row-arrow:hover {
  background: var(--btn-surface-hover);
}

.quick-row-arrow:active {
  transform: translateY(1px);
}

.quick-row-strip-inner {
  flex: 1 1 auto;
  min-width: 0;

  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  /* тільки в ряд */
  justify-content: flex-start;
  align-items: center;
  gap: 10px;

  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 6px;
}

/* щоб усі елементи були однаковими і не розтягувались */
.quick-row-strip-inner>* {
  flex: 0 0 auto;
}

.quick-row-strip-inner::-webkit-scrollbar {
  height: 6px;
}

.quick-row-strip-inner::-webkit-scrollbar-thumb {
  background: rgba(127, 127, 127, .35);
  border-radius: 3px;
}

.quick-row-strip-inner a {
  flex: 0 0 auto;
  display: block;
  width: 86px;
  height: 86px;
  text-decoration: none;
}

/* однаковий розмір для всіх картинок */
.quick-row-strip-inner img {
  display: block;
  width: 86px;
  height: 86px;
  object-fit: contain;

  border-radius: 12px;
  border: 1px solid var(--btn-border);
  background: rgba(255, 255, 255, 0.80);

  transition: box-shadow .15s ease, transform .05s ease, background-color .22s ease;
}

body.theme-dark .quick-row-strip-inner img {
  background: rgba(255, 255, 255, 0.06);
}

.quick-row-strip-inner img:hover {
  box-shadow: 0 0 0 2px rgba(59, 130, 246, .25) inset;
  transform: scale(1.02);
}

/* placeholder такого ж розміру, без накладання */
.quick-row-thumb-placeholder {
  width: 86px;
  height: 86px;
  flex: 0 0 auto;

  border-radius: 12px;
  border: 1px dashed rgba(127, 127, 127, .45);
  background: rgba(255, 255, 255, 0.06);

  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: var(--muted);

  box-sizing: border-box;
}

.quick-row-thumb {
  flex: 0 0 auto;
  width: 86px;
  height: 86px;
}

.quick-row-thumb a {
  display: block;
  width: 100%;
  height: 100%;
}

.quick-row-thumb img,
.quick-row-thumb-placeholder {
  width: 100%;
  height: 100%;
  box-sizing: border-box;
}


/* Floating back button - завжди зліва зверху */
.back-floating {
  position: fixed;
  top: 18px;
  left: 18px;

  display: inline-flex;
  align-items: center;
  gap: 6px;

  padding: 9px 16px;
  border-radius: 999px;

  font-weight: 800;
  font-size: .80rem;
  text-decoration: none;

  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);

  z-index: 999;

  background: rgba(0, 0, 0, .65);
  border: 1px solid rgba(120, 120, 120, .55);
  color: #fff;

  transition:
    background-color .2s ease,
    border-color .2s ease,
    transform .08s ease;
}

.back-floating:hover {
  background: rgba(0, 0, 0, .80);
  border-color: rgba(160, 160, 160, .65);
}

.back-floating:active {
  transform: translateY(1px);
}

/* LIGHT THEME */
body.theme-light .back-floating,
body.light .back-floating,
html[data-theme="light"] body .back-floating,
html[data-guest-theme="light"] body.anonymous-theme .back-floating {
  background: rgba(255, 255, 255, .85);
  border: 1px solid rgba(0, 0, 0, .16);
  color: #111;
}

body.theme-light .back-floating:hover,
body.light .back-floating:hover,
html[data-theme="light"] body .back-floating:hover,
html[data-guest-theme="light"] body.anonymous-theme .back-floating:hover {
  background: rgba(255, 255, 255, .96);
  border-color: rgba(0, 0, 0, .24);
}

/* DARK THEME */
body.theme-dark .back-floating,
body.dark .back-floating,
html[data-theme="dark"] body .back-floating,
html[data-guest-theme="dark"] body.anonymous-theme .back-floating {
  background: rgba(0, 0, 0, .65);
  border: 1px solid rgba(120, 120, 120, .55);
  color: #fff;
}

body.theme-dark .back-floating:hover,
body.dark .back-floating:hover,
html[data-theme="dark"] body .back-floating:hover,
html[data-guest-theme="dark"] body.anonymous-theme .back-floating:hover {
  background: rgba(0, 0, 0, .80);
  border-color: rgba(160, 160, 160, .65);
}



/* ===== Rarity POPover (no dim) ===== */
.rarity-modal-backdrop {
  position: fixed !important;
  inset: 0 !important;

  /* це тепер "порожній клік-ловець", без затемнення */
  background: transparent !important;

  display: none;
  z-index: 2147483000 !important;

  padding: 0 !important;
}

/* поповер-Box */
.rarity-modal {
  position: absolute !important;
  z-index: 2147483001 !important;

  /* розмір/вигляд лишаємо твої */
  width: min(520px, 96vw);
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
}

/* трохи м’якша тінь, без “modal” вайбу */
body.theme-dark .rarity-modal {
  background: rgba(10, 10, 10, .88);
  border: 1px solid rgba(120, 120, 120, .55);
  color: #fff;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

body.theme-light .rarity-modal {
  background: rgba(255, 255, 255, .97);
  border: 1px solid rgba(140, 140, 140, .45);
  color: #111;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* =========================
   REPORT POPOVER (ALWAYS ON TOP)
   ========================= */

/* екранний слой для кліку "повз" */
.report-modal-backdrop {
  position: fixed !important;
  inset: 0 !important;

  display: none;
  background: transparent;
  /* без затемнення */
  pointer-events: auto;

  z-index: 2147483646 !important;
  /* майже максимум */
  transform: none !important;
  filter: none !important;
}

/* саме вікно */
.report-modal-box {
  position: fixed !important;
  /* ключ! */
  z-index: 2147483647 !important;

  width: min(520px, calc(100vw - 24px));
  max-height: min(70vh, 560px);

  border-radius: 18px;
  padding: 14px 14px 12px;

  background: var(--card-bg, rgba(20, 20, 20, .72));
  border: 1px solid var(--card-border, rgba(70, 70, 70, .55));
  color: var(--text, #fff);

  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);

  box-shadow: 0 20px 70px rgba(0, 0, 0, .45);
  box-sizing: border-box;
  overflow: auto;

  left: 12px;
  /* фолбек */
  top: 12px;
}

/* header */
.report-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.report-modal-head h3 {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 900;
}

/* close */
.report-modal-x {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;

  background: var(--btn-surface, rgba(0, 0, 0, .35));
  border: 1px solid var(--btn-border, rgba(120, 120, 120, .55));
  color: var(--text, #fff);

  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.report-modal-x:hover {
  background: var(--btn-surface-hover, rgba(0, 0, 0, .50));
}

/* inputs */
.report-modal-box label {
  display: block;
  font-weight: 800;
  font-size: .86rem;
  margin: 10px 0 6px;
}

.report-modal-box select,
.report-modal-box textarea {
  width: 100%;
  border-radius: 14px;
  padding: 10px 12px;
  box-sizing: border-box;

  background: var(--input-bg, rgba(255, 255, 255, .06));
  border: 1px solid var(--input-border, rgba(120, 120, 120, .55));
  color: var(--text, #fff);

  font-size: .92rem;
  outline: none;
}

.report-modal-box textarea {
  min-height: 96px;
  resize: vertical;
}

.report-modal-box select:focus,
.report-modal-box textarea:focus {
  border-color: rgba(59, 130, 246, .65);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .18);
}

/* actions */
.report-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

#reportModalCancel {
  background: var(--btn-surface, rgba(0, 0, 0, .35));
  border: 1px solid var(--btn-border, rgba(120, 120, 120, .55));
  color: var(--text, #fff);
}

#reportModalCancel:hover {
  background: var(--btn-surface-hover, rgba(0, 0, 0, .50));
}

.report-modal-actions .btn-danger {
  background: rgba(239, 68, 68, .95);
  border: 1px solid rgba(239, 68, 68, .95);
  color: #fff;
}

.report-modal-actions .btn-danger:hover {
  background: rgba(220, 38, 38, .98);
  border-color: rgba(220, 38, 38, .98);
}

/* ===== report select (custom) ===== */
.report-label {
  display: block;
  font-weight: 800;
  font-size: .86rem;
  margin: 10px 0 6px;
}

/* кнопка */
.report-select {
  position: relative;
}

.report-select-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;

  border-radius: 14px;
  padding: 10px 12px;

  background: var(--input-bg, rgba(255, 255, 255, .06));
  border: 1px solid var(--input-border, rgba(120, 120, 120, .55));
  color: var(--text, #fff);

  cursor: pointer;
  user-select: none;
}

.report-select-btn:focus {
  outline: none;
  border-color: rgba(59, 130, 246, .65);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .18);
}

.report-select-caret {
  opacity: .85;
}

/* панель */
.report-select-panel {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 8px);

  background: var(--card-bg, rgba(20, 20, 20, .90));
  border: 1px solid var(--card-border, rgba(90, 90, 90, .55));
  border-radius: 14px;

  padding: 6px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .45);

  max-height: 260px;
  overflow: auto;

  display: none;
  z-index: 2147483647;
  /* щоб поверх модалки */
}

.report-select.is-open .report-select-panel {
  display: block;
}

/* option */
.report-select-opt {
  width: 100%;
  text-align: left;

  padding: 10px 10px;
  border-radius: 12px;

  background: transparent;
  border: 0;
  color: var(--text, #fff);

  cursor: pointer;
}

.report-select-opt:hover {
  background: rgba(255, 255, 255, .08);
}

.report-select-opt.is-selected {
  background: rgba(59, 130, 246, .25);
}

/* scrollbar */
.report-select-panel::-webkit-scrollbar {
  width: 8px;
}

.report-select-panel::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, .18);
  border-radius: 999px;
}

/* LIGHT */
body.theme-light .report-select-btn {
  background: rgba(255, 255, 255, .92);
  border-color: rgba(150, 150, 150, .45);
  color: #111;
}

body.theme-light .report-select-panel {
  background: rgba(255, 255, 255, .96);
  border-color: rgba(150, 150, 150, .35);
}

body.theme-light .report-select-opt {
  color: #111;
}

body.theme-light .report-select-opt:hover {
  background: rgba(0, 0, 0, .06);
}

body.theme-light .report-select-opt.is-selected {
  background: rgba(59, 130, 246, .18);
}


/* =========================================
   REPORT MODAL INPUTS: FORCE THEME COLORS
   (не залежить від токенів)
   ========================================= */

/* базово */
#reportModal .report-modal-box select,
#reportModal .report-modal-box textarea {
  width: 100%;
  border-radius: 14px;
  padding: 10px 12px;
  box-sizing: border-box;
  font-size: .92rem;
  outline: none;
}

/* DARK */
body.theme-dark #reportModal .report-modal-box select,
body.theme-dark #reportModal .report-modal-box textarea {
  background: rgba(255, 255, 255, .06) !important;
  border: 1px solid rgba(120, 120, 120, .55) !important;
  color: #fff !important;
}

body.theme-dark #reportModal .report-modal-box select:focus,
body.theme-dark #reportModal .report-modal-box textarea:focus {
  border-color: rgba(59, 130, 246, .65) !important;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .18) !important;
}

/* LIGHT */
body.theme-light #reportModal .report-modal-box select,
body.theme-light #reportModal .report-modal-box textarea {
  background: rgba(255, 255, 255, .92) !important;
  border: 1px solid rgba(150, 150, 150, .45) !important;
  color: #111 !important;
}

body.theme-light #reportModal .report-modal-box select:focus,
body.theme-light #reportModal .report-modal-box textarea:focus {
  border-color: rgba(59, 130, 246, .55) !important;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .14) !important;
}

/* placeholder */
body.theme-dark #reportModal .report-modal-box textarea::placeholder {
  color: rgba(255, 255, 255, .65) !important;
}

body.theme-light #reportModal .report-modal-box textarea::placeholder {
  color: rgba(17, 17, 17, .55) !important;
}

body.theme-dark #reportModal .report-select-btn {
  background: rgba(255, 255, 255, .06) !important;
  border-color: rgba(120, 120, 120, .55) !important;
  color: #fff !important;
}

body.theme-light #reportModal .report-select-btn {
  background: rgba(255, 255, 255, .92) !important;
  border-color: rgba(150, 150, 150, .45) !important;
  color: #111 !important;
}


/* =========================================
   Extra mobile fixes for very narrow screens
   ========================================= */
@media (max-width: 640px) {
  html,
  body {
    overflow-x: hidden;
  }

  .product-page {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 10px;
  }

  .meta-top,
  .quick-rows-block,
  .comments-block,
  .hero-main,
  .rarity-card,
  .figure-info-text {
    min-width: 0;
  }

  .thumbs-row,
  .quick-row-strip,
  .rarity-summary-line,
  .rarity-admin-line {
    min-width: 0;
  }

  .thumbs,
  .quick-row-strip-inner {
    min-width: 0;
  }

  .rarity-summary-text,
  .rarity-option-body,
  .rarity-option-title,
  .quick-row-name {
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .rarity-summary-line {
    align-items: center;
    flex-wrap: nowrap;
    gap: 8px;
  }

  .rarity-summary-text {
    flex: 1 1 auto;
  }

  .rarity-summary-btn {
    flex: 0 0 auto;
    width: auto;
    max-width: 45%;
    justify-content: center;
    white-space: nowrap;
  }

  .rarity-admin-line {
    align-items: center;
    flex-wrap: nowrap;
    gap: 8px;
  }

  .rarity-admin-label {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .rarity-admin-open {
    flex: 1 1 auto;
    width: auto;
    max-width: 55%;
    justify-content: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }


  .rarity-modal,
  #rarity-modal .rarity-modal,
  #fixed-rarity-modal .rarity-modal,
  #admin-rarity-info .rarity-modal,
  #quality-modal .rarity-modal,
  #fixed-quality-modal .rarity-modal,
  #admin-quality-info .rarity-modal,
  .report-modal-box {
    width: calc(100vw - 16px) !important;
    max-width: calc(100vw - 16px) !important;
    left: 8px !important;
    right: 8px !important;
    box-sizing: border-box;
  }

  .rarity-modal-buttons .btn,
  .left-actions .btn,
  .meta-actions .btn {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 380px) {
  .rarity-summary-line,
  .rarity-admin-line {
    flex-wrap: wrap;
  }

  .rarity-summary-btn,
  .rarity-admin-open {
    max-width: none;
    width: 100%;
  }
}


/* =========================
   Mobile suggest button
   ========================= */

.mobile-suggest-btn {
  display: none;
}

@media (max-width: 1120px) {

  .hero-main {
    position: relative;
  }

  .mobile-suggest-btn {
    position: absolute;

    top: 10px;
    right: 10px;

    width: 42px;
    height: 42px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    border-radius: 999px;

    z-index: 40;

    text-decoration: none;
    font-size: 18px;
    font-weight: 700;

    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);

    transition:
      background-color .18s ease,
      border-color .18s ease,
      transform .08s ease;
  }

  body.theme-dark .mobile-suggest-btn {
    background: rgba(0, 0, 0, .62);
    border: 1px solid rgba(120, 120, 120, .55);
    color: #fff;
  }

  body.theme-dark .mobile-suggest-btn:hover {
    background: rgba(0, 0, 0, .82);
  }

  body.theme-light .mobile-suggest-btn {
    background: rgba(255, 255, 255, .82);
    border: 1px solid rgba(140, 140, 140, .45);
    color: #111;
  }

  body.theme-light .mobile-suggest-btn:hover {
    background: rgba(255, 255, 255, .96);
  }

  .mobile-suggest-btn:active {
    transform: translateY(1px);
  }

  .left-actions a[href*="support"] {
    display: none;
  }
}