﻿:root {
  color-scheme: light;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;

  /* Responsive gallery columns (JS reads this for pagination). */
  --grid-cols: 7;

  --btn-bg: rgba(255, 255, 255, 0.06);
  --btn-bg-hover: rgba(255, 255, 255, 0.10);
  --btn-bg-active: rgba(255, 255, 255, 0.12);
  --btn-border: rgba(255, 255, 255, 0.12);
  --btn-border-strong: rgba(255, 255, 255, 0.18);
  --btn-text: rgba(255, 255, 255, 0.92);
  --btn-shadow:
    0 10px 26px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.10);
  --btn-shadow-hover:
    0 14px 34px rgba(0, 0, 0, 0.52),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);

  /* Uiverse arrow colors */
  --uiverse-stroke: #666;
  --uiverse-fill: #fff;
}

/* Some mobile browsers can report a wide viewport (e.g. "desktop site").
   Pointer heuristics keep the grid usable on touch devices. */
@media (pointer: coarse) {
  :root {
    --grid-cols: 3;
  }
}

@media (pointer: coarse) and (min-width: 430px) {
  :root {
    --grid-cols: 4;
  }
}

@media (max-width: 900px) {
  :root {
    --grid-cols: 4;
  }
}

@media (max-width: 600px) {
  :root {
    --grid-cols: 3;
  }
}

@media (pointer: coarse) and (max-width: 600px) {
  :root {
    --grid-cols: 3;
  }
}

[hidden] {
  display: none !important;
}

/* Unified button bases */
.uBtn {
  all: unset;
  display: grid;
  place-items: center;
  position: relative;
  width: var(--btnSize, 56px);
  height: var(--btnSize, 56px);
  border-radius: 999px;
  overflow: hidden;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.10);
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.48);
  transition: transform 0.1s, background 0.15s, border-color 0.15s;
}

.uBtn:hover {
  background: rgba(0, 0, 0, 0.50);
  border-color: rgba(255, 255, 255, 0.16);
}

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

.uBtn:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.7);
  outline-offset: 2px;
}

.uBtn[disabled],
.uBtn:disabled {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}

.uX {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  color: var(--uiverse-fill);
  font-weight: 800;
  font-size: 18px;
  line-height: 1;
  pointer-events: none;
}

/* ─── Standardised button system ───────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 28px;
  font-size: 0.9rem;
  font-weight: 700;
  font-family: inherit;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
  white-space: nowrap;
  letter-spacing: 0.03em;
}
.btn:active { transform: scale(0.97); }

.btn--primary {
  background: linear-gradient(135deg, #5ee7f7, #f76eb2);
  color: #fff;
  box-shadow: 0 0 16px rgba(94, 231, 247, 0.3);
  border: 1px solid transparent;
}
.btn--primary:hover {
  background: #111;
  box-shadow: 0 0 20px rgba(94, 231, 247, 0.15);
  border-color: rgba(94, 231, 247, 0.4);
  transform: scale(1.06);
}

.btn--secondary {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.25);
}
.btn--secondary:hover {
  border-color: rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.06);
  transform: scale(1.04);
}
/* ──────────────────────────────────────────────────────────── */

.uPill {
  all: unset;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 2px solid var(--uiverse-stroke);
  background: rgba(0, 0, 0, 0.30);
  color: var(--uiverse-fill);
  font-weight: 800;
  letter-spacing: 0.06em;
  user-select: none;
  transition: transform 0.1s, background 0.15s, border-color 0.15s;
}

.uPill:hover {
  background: rgba(0, 0, 0, 0.45);
  border-color: var(--uiverse-fill);
}

.uPill:active {
  transform: scale(0.98);
}

.uPill:focus-visible,
.uPill:focus-within {
  outline: 2px solid rgba(255, 255, 255, 0.7);
  outline-offset: 2px;
}

/* Uiverse arrow */
.arrow {
  cursor: pointer;
  height: var(--arrow-h, 60px);
  left: 50%;
  position: absolute;
  top: 50%;
  transform: translateX(-50%) translateY(-50%) rotate(var(--arrow-rot, 0deg));
  transition: transform 0.1s;
  width: var(--arrow-w, 50px);
}

.uBtn:active .arrow {
  transform: translateX(-50%) translateY(-50%) rotate(var(--arrow-rot, 0deg)) scale(0.9);
}

.arrow-top,
.arrow-bottom {
  background-color: var(--uiverse-stroke);
  height: var(--arrow-thick, 4px);
  left: var(--arrow-pad, 2px);
  position: absolute;
  top: 50%;
  width: calc(100% - (var(--arrow-pad, 2px) * 2));
}

.arrow-top:after,
.arrow-bottom:after {
  background-color: var(--uiverse-fill);
  content: '';
  height: 100%;
  position: absolute;
  top: 0;
  transition: all 0.15s;
}

.arrow-top {
  transform: rotate(45deg);
  transform-origin: bottom right;
}

.arrow-top:after {
  left: 100%;
  right: 0;
  transition-delay: 0s;
}

.arrow-bottom {
  transform: rotate(-45deg);
  transform-origin: top right;
}

.arrow-bottom:after {
  left: 0;
  right: 100%;
  transition-delay: 0.15s;
}

.arrow:hover .arrow-top:after {
  left: 0;
  transition-delay: 0.15s;
}

.arrow:hover .arrow-bottom:after {
  right: 0;
  transition-delay: 0s;
}

.arrow--left {
  --arrow-rot: 180deg;
}

.arrow--right {
  --arrow-rot: 0deg;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #0b0d12;
  color: #e8e9ee;
}

/* Mobile browsers occasionally report odd layout widths; keep the app from
   shrink-wrapping or creating phantom horizontal overflow. */
html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

/* Subtle global motion defaults */
html {
  scroll-behavior: smooth;
}

.gate {
  --mx: 50%;
  --my: 45%;
  position: fixed;
  inset: 0;
  z-index: 50;
  overflow: hidden;
  background: rgba(11, 13, 18, 0.95);
}

.gate[aria-hidden='true'] {
  display: none !important;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

/* Entry screen: keep gallery controls hidden. */
.gate[aria-hidden='false'] ~ .topbar {
  display: none;
}

.gate[aria-hidden='false'] ~ #grid {
  display: none;
}

.gate__strips {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: flex;
  flex-direction: row;
  gap: 8px;
  overflow: hidden;
  pointer-events: none;
}

.gate__strip {
  flex: 0 0 180px;
  overflow: hidden;
}

.gate__stripInner {
  display: flex;
  flex-direction: column;
  gap: 8px;
  will-change: transform;
  animation-duration: 40s;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}

.gate__stripImg {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 8px;
  display: block;
  flex-shrink: 0;
}

@keyframes gateScrollUp {
  0% { transform: translateY(0); }
  100% { transform: translateY(-50%); }
}

@keyframes gateScrollDown {
  0% { transform: translateY(-50%); }
  100% { transform: translateY(0); }
}




.gate__header {
  position: relative;
  z-index: 2;
  text-align: center;
  margin-top: auto; /* Push down towards center */
}

.gate__footer {
  position: relative;
  z-index: 2;
  margin-bottom: auto; /* Push up towards center */
}

.gate__logo {
  display: block;
  margin: 0 auto 0.75rem;
  width: 240px;
  height: auto;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.6));
  animation: gateLogoEntry 1.2s cubic-bezier(0.2, 0.8, 0.2, 1) backwards;
}

.gate__box {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 100;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(20px);
  border-radius: 24px;
  padding: clamp(32px, 5vw, 48px) clamp(24px, 6vw, 64px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  width: max-content;
  max-width: min(560px, 92vw);
  text-align: center;
}

.gate__box[hidden] {
  display: none !important;
}

/* .gate__exit visual rules moved to .btn--secondary */


@keyframes gateLogoEntry {
  from { opacity: 0; transform: translateY(-30px) scale(0.8) rotate(-10deg); }
  to { opacity: 1; transform: translateY(0) scale(1) rotate(0deg); }
}

.gate__title {
  display: block;
  width: auto;
  margin: 0 0 14px 0;
  font-size: 48px;
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1.05;
  white-space: normal;
  text-align: center;
  color: rgba(255, 255, 255, 0.95);
  text-shadow:
    0 4px 22px rgba(0, 0, 0, 0.72),
    0 0 46px rgba(255, 255, 255, 0.12);
  -webkit-text-stroke: 1px rgba(0, 0, 0, 0.35);
}

/* Mobile entry: reduce typography and condense layout */
@media (max-width: 600px) {
  .gate__logo {
    width: 160px;
    margin-bottom: 0.25rem;
  }

  .gate__title {
    font-size: 2rem;
    margin-bottom: 0.5rem;
  }

  .gate__box {
    padding: 32px 24px;
  }

  /* Enter/confirm buttons scale down via .btn base on mobile */
}

@media (max-width: 480px) {
  .gate__title {
    white-space: normal;
    text-align: center;
  }
}



.gate__text {
  font-size: 16px;
  line-height: 1.5;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.85);
  margin: 0 0 24px 0;
  max-width: 100%;
  text-align: center;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

/* .gate__enter visual rules handled by .btn--primary */
/* Breath animation applied via class only */
.gate__enter {
  padding: 16px 56px;
  font-size: 1.2rem;
  letter-spacing: 0.1em;
  animation: gateButtonBreath 3.0s ease-in-out infinite;
}

.gate__enter:hover {
  animation: none;
}

@keyframes gateButtonBreath {
  0%,
  100% {
    box-shadow: 0 0 12px rgba(94, 231, 247, 0.35), 0 0 12px rgba(247, 110, 178, 0.25);
  }
  50% {
    box-shadow: 0 0 24px rgba(94, 231, 247, 0.55), 0 0 20px rgba(247, 110, 178, 0.45);
  }
}

.gate__enter:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.8);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  .gate__stripInner,
  .gate__enter,
  .btn--primary {
    animation: none !important;
  }
}

.gate--leaving {
  animation: gateFade 420ms ease forwards;
  pointer-events: none;
}

.gate--leaving .gate__box {
  animation: gatePop 420ms ease forwards;
}

@keyframes gateFade {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

@keyframes gatePop {
  from {
    transform: scale(1);
    opacity: 1;
    filter: blur(0);
  }
  to {
    transform: scale(1.06);
    opacity: 0;
    filter: blur(6px);
  }
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.95em;
}

#app {
  min-height: 100vh;
}

#app > main {
  width: 100%;
  max-width: 100%;
}

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: rgba(11, 13, 18, 0.82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

/* When the fullscreen viewer is open, don't let the sticky bar overlap it. */
.no-scroll .topbar {
  display: none;
}

.topbar__left,
.topbar__center,
.topbar__right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar__left {
  justify-self: start;
}

.topbar__center {
  justify-self: center;
}

.topbar__right {
  justify-self: end;
}

.hamburger {
  --btnSize: 44px;
  width: var(--btnSize);
  height: var(--btnSize);
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
}

.hamburger__lines {
  display: grid;
  gap: 5px;
}

.hamburger__line {
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
}

.topbar__label {
  color: rgba(255, 255, 255, 0.70);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 11px;
}

.toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 2px solid var(--uiverse-stroke);
  background: rgba(0, 0, 0, 0.30);
  color: var(--uiverse-fill);
  font-weight: 800;
  letter-spacing: 0.06em;
  user-select: none;
  transition: transform 0.1s, background 0.15s, border-color 0.15s;
}

.toggle:hover {
  background: rgba(0, 0, 0, 0.45);
  border-color: var(--uiverse-fill);
}

.toggle:active {
  transform: scale(0.98);
}

.toggle:focus-within {
  outline: 2px solid rgba(255, 255, 255, 0.7);
  outline-offset: 2px;
}

.toggle input {
  width: 16px;
  height: 16px;
  accent-color: rgba(255, 255, 255, 0.95);
}

.navBtn {
  --btnSize: 44px;
  --arrow-w: 22px;
  --arrow-h: 30px;
  --arrow-thick: 3px;
  --arrow-pad: 2px;
}

.navBtn[disabled] {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}

.pageLabel {
  min-width: 120px;
  text-align: center;
  color: rgba(255, 255, 255, 0.86);
  font-weight: 800;
  letter-spacing: 0.04em;
}

.syncLabel {
  min-width: 92px;
  text-align: right;
  color: rgba(255, 255, 255, 0.68);
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 11px;
}

.sync-progress {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  min-width: 80px;
}

.sync-progress__bar {
  width: 80px;
  height: 3px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 99px;
  overflow: hidden;
}

.sync-progress__fill {
  display: block;
  height: 100%;
  background: #fff;
  border-radius: 99px;
  transition: width 0.4s ease;
}

.sync-progress__text {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
  white-space: nowrap;
}

/* Mobile/touch topbar: avoid horizontal clipping and keep paging visible without zooming.
   Using pointer heuristics helps on devices that sometimes render with a larger layout viewport. */
@media (max-width: 520px), (pointer: coarse) {
  .topbar {
    display: flex;
    flex-wrap: nowrap;
    overflow: hidden;
    align-items: center;
    padding: 4px 8px;
    gap: 4px;
  }

  /* Move Filter (Left container) to the Far Left */
  .topbar__left {
    order: 1;
    margin-right: auto;
    width: auto;
    gap: 4px;
  }

  /* Move Admin menu (Right container) to the Right side (before paging) */
  .topbar__right {
    order: 2;
    margin-right: 4px;
    width: auto;
    gap: 4px;
  }

  /* Move Pagination (Center container) to the Far Right */
  .topbar__center {
    order: 3;
    width: auto;
    gap: 4px;
  }

  /* Uniform small button size for all topbar buttons */
  .uBtn,
  .filterBtn,
  .navBtn,
  .hamburger {
    --btnSize: 34px;
  }

  .pageLabel {
    min-width: unset;
    font-size: 0.7rem;
    margin: 0 2px;
  }

  .filterIcon {
    width: 16px;
    height: 16px;
  }

  .page-text {
    display: none;
  }

  .syncLabel:not(:empty) {
    display: block;
  }

  .syncLabel:empty {
    display: none;
  }
}



.grid {
  padding: 16px;
  padding-top: 96px; /* Compensate for fixed topbar */
  display: grid;
  width: 100%;
  max-width: 100%;
  grid-template-columns: repeat(var(--grid-cols), minmax(0, 1fr));
  gap: 8px;
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

@media (max-width: 600px) {
  .grid {
    padding: 12px;
    padding-top: 68px; /* Mobile topbar is smaller */
    gap: 6px;
  }
}

.grid.grid--fade {
  opacity: 0;
  transform: translateY(6px);
}

.card {
  all: unset;
  display: block;
  cursor: pointer;
  position: relative;
  z-index: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  transform-origin: center;
  transform-style: preserve-3d;
  /* Removed overflow: hidden to allow stack pages to protrude */
  content-visibility: auto;
  contain-intrinsic-size: 0 180px;
  will-change: transform, box-shadow;
  overflow: hidden;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    background 160ms ease;
  animation: cardIn 260ms ease;
  animation-fill-mode: backwards;
  animation-delay: calc(var(--i, 0) * 12ms);
}

/* Only apply the raised/hover effect on real mouse/trackpad devices.
   On touch devices, :hover can “stick” and cause the tile to appear above
   the fullscreen viewer (looks like a duplicate item). */
@media (hover: hover) and (pointer: fine) {
  .card:hover {
    z-index: 1;
    transform: scale(1.04);
    box-shadow:
      0 0 0 3px rgba(255, 255, 255, 0.85),
      0 8px 24px rgba(0, 0, 0, 0.6);
    background: rgba(255, 255, 255, 0.08);
  }
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.card:focus-visible {
  z-index: 20;
  outline: 2px solid rgba(255, 255, 255, 0.7);
  outline-offset: 2px;
}

.card__media {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: rgba(255, 255, 255, 0.04);
  overflow: hidden;
  border-radius: 10px;
}

.thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card__media video.thumb {
  pointer-events: none;
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 120ms linear;
}

.thumb--placeholder {
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.04);
  color: rgba(232, 233, 238, 0.75);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.badge {
  position: absolute;
  right: 8px;
  top: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 4px 6px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.55);
  color: rgba(255,  255, 255, 0.9);
}

.viewer {
  position: fixed;
  inset: 0;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 170ms ease;
}

.viewer.viewer--open {
  opacity: 1;
  pointer-events: auto;
}

.viewer__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  opacity: 0;
  transition: opacity 170ms ease;
}

.viewer.viewer--open .viewer__backdrop {
  opacity: 1;
}

.viewer__content {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  padding: 16px;
  box-sizing: border-box;
  overflow: hidden;
  transform: translateY(10px) scale(0.985);
  opacity: 0;
  transition:
    transform 190ms ease,
    opacity 190ms ease;
}

.viewer.viewer--open .viewer__content {
  transform: translateY(0) scale(1);
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .grid,
  .card,
  .viewer,
  .viewer__backdrop,
  .viewer__content {
    transition: none !important;
    animation: none !important;
  }
}

.viewer__frame {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
  width: min(1240px, 100%);
}

.viewer__bar {
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(10px);
  border-radius: 999px;
  padding: 8px 20px;
  width: fit-content;
  margin: 8px auto;
  flex-shrink: 0;
  z-index: 10;
}

.viewer__barSpacer {
  flex: 1;
  min-width: 8px;
}

.viewer__counter {
  font-size: 13px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.75);
  white-space: nowrap;
  letter-spacing: 0.04em;
  min-width: 56px;
  text-align: center;
}

.viewer__barBtn {
  all: unset;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.9);
  flex-shrink: 0;
  transition: background 0.2s ease, transform 0.2s ease;
}

.viewer__barBtn:hover {
  background: rgba(255, 255, 255, 0.18);
}

.viewer__barBtn:active {
  transform: scale(0.92);
}

.viewer__barBtn:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.7);
  outline-offset: 2px;
}

.viewer__barBtn:disabled {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}

.viewer__barBtn.liked {
  color: #ec4899;
}

.viewer__barBtn.liked svg {
  fill: currentColor;
  stroke: none;
}

.viewer__mediaArea {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Tag mode: show tag panel alongside the media */
.viewer.viewer--tag .viewer__mediaArea {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
}

.tagPanel {
  align-self: stretch;
  max-height: calc(100vh - 32px);
  border-radius: 14px;
  padding: 18px;
  width: 260px;
  flex-shrink: 0;
  background: rgba(15, 15, 15, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(12px);
  display: none;
  overflow: hidden;
  /* Ensure it sits above image/strip if they overlap */
  position: relative;
  z-index: 50;
}

.viewer.viewer--has-strip .tagPanel {
    /* Make room for the filmstrip at the bottom */
    margin-bottom: 90px;
    max-height: calc(100vh - 122px);
}

.viewer.viewer--tag .tagPanel {
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  gap: 10px;
}

.tagPanel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.tagPanel__title {
  display: inline-block;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  border-bottom: 2px solid rgba(94, 231, 247, 0.55);
  padding-bottom: 4px;
}

.tagPanel__icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  transition: background 0.15s ease;
}

.tagPanel__icon:hover {
  background: rgba(255, 255, 255, 0.18);
}

.tagPanel__list {
  overflow: auto;
  padding-right: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-content: start;
}

.tagPanel__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.tagPanel__row:hover {
  background: rgba(255, 255, 255, 0.08);
}

.tagPanel__row:has(input:checked) {
  background: rgba(94, 231, 247, 0.08);
  border-color: rgba(94, 231, 247, 0.3);
}

.tagPanel__name {
  font-size: 0.85rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.90);
  letter-spacing: 0.02em;
  word-break: break-word;
}

.tagPanel__toggle {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.tagPanel__toggle:checked {
  background: #5ee7f7;
  border-color: #5ee7f7;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 10'%3E%3Cpath d='M1 5l3.5 3.5L11 1' stroke='white' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-size: 70%;
  background-position: center;
  background-repeat: no-repeat;
}

.tagPanel__add {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.tagPanel__input {
  border-radius: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.92);
  font-weight: 700;
  letter-spacing: 0.02em;
  width: 100%;
  box-sizing: border-box;
}

.tagPanel__input:focus {
  outline: 2px solid rgba(94, 231, 247, 0.5);
  outline-offset: 2px;
}

.tagPanel__add .btn--primary {
  padding: 8px 16px;
}

.tagPanel__msg {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.70);
  min-height: 16px;
}

/* Mobile viewer */
@media (max-width: 600px), (pointer: coarse) {
  .viewer {
    overflow: hidden;
  }

  .viewer__backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
  }

  .viewer__content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    height: 100dvh;
    overflow: hidden;
    padding-top: calc(8px + env(safe-area-inset-top));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    padding-left: 8px;
    padding-right: 8px;
  }

  .viewer__bar {
    gap: 8px;
    padding: 6px 12px;
    margin-top: 8px;
    margin-bottom: 8px;
    flex-shrink: 0;
  }

  .viewer__frame {
    width: 100%;
    max-height: 100dvh;
  }

  .viewer.viewer--tag .tagPanel {
    position: absolute;
    left: calc(8px + env(safe-area-inset-left));
    right: calc(8px + env(safe-area-inset-right));
    bottom: calc(8px + env(safe-area-inset-bottom));
    max-height: min(42vh, 360px);
    grid-column: auto;
    z-index: 6;
  }

  .viewer__body {
    flex: 1;
    min-height: 0;
    width: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .viewer__img {
    display: block;
    max-width: 100vw;
    max-height: calc(100dvh - 80px);
    width: auto;
    height: auto;
    object-fit: contain;
    margin: 0 auto;
  }

  .viewer__video {
    display: block;
    max-width: 100vw;
    max-height: calc(100dvh - 80px);
    width: auto;
    height: auto;
    object-fit: contain;
    margin: 0 auto;
  }

  .viewer.viewer--has-strip .viewer__img,
  .viewer.viewer--has-strip .viewer__video {
    max-height: calc(100dvh - 170px);
  }

  .viewer.viewer--has-strip .viewer__body {
    padding-bottom: calc(90px + env(safe-area-inset-bottom, 0px));
  }

  /* Hide grid like buttons on mobile to prevent accidental clicks */
  .card .like-btn {
    display: none !important;
  }
}

.adminMenu {
  position: fixed;
  inset: 0;
  z-index: 115;
  opacity: 0;
  pointer-events: none;
  transition: opacity 170ms ease;
}

.adminMenu.adminMenu--open {
  opacity: 1;
  pointer-events: auto;
}

.adminMenu__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.60);
}

.adminMenu__content {
  position: absolute;
  right: 12px;
  top: calc(12px + env(safe-area-inset-top));
  width: min(420px, calc(100% - 24px));
  border-radius: 18px;
  padding: 18px;
  background: rgba(15, 15, 15, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(12px);
}

.adminMenu__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.adminMenu__title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  border-bottom: 2px solid rgba(94, 231, 247, 0.55);
  padding-bottom: 4px;
}

.adminMenu__close {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  transition: background 0.15s ease;
}

.adminMenu__close:hover {
  background: rgba(255, 255, 255, 0.18);
}

.adminMenu__items {
  display: grid;
  gap: 10px;
}

.adminMenu__item {
  all: unset;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: transform 0.1s, background 0.15s ease, border-color 0.15s ease;
  user-select: none;
}

.adminMenu__item:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.18);
}

.adminMenu__item--danger {
  border-color: rgba(239, 68, 68, 0.3);
}

.adminMenu__item--danger:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.5);
  color: #ef4444;
}

.adminMenu__item:active {
  transform: scale(0.99);
}

.adminMenu__item:disabled {
  opacity: 0.45;
  cursor: default;
  pointer-events: none;
}

.adminMenu__msg {
  margin-top: 10px;
  min-height: 16px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.70);
}

/* Hide the admin menu button and panel on mobile/touch devices */
@media (max-width: 768px), (pointer: coarse) {
  #adminMenuBtn {
    display: none !important;
  }
  #adminMenu {
    display: none !important;
  }
}

/* ── Stack Name Modal ─────────────────────────────────────── */
.stackNameModal__content {
  max-width: 420px;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  right: auto;
  padding: 32px 28px;
  text-align: center;
}

.stackNameModal__title {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.95);
  margin: 0 0 20px;
}

.stackNameModal__input {
  width: 100%;
  box-sizing: border-box;
  border-radius: 10px;
  padding: 12px 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.95rem;
  margin-bottom: 16px;
  display: block;
}

.stackNameModal__input:focus {
  outline: 2px solid rgba(94, 231, 247, 0.5);
  outline-offset: 2px;
}

.stackNameModal__actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.viewer__nav {
  --arrow-w: 20px;
  --arrow-h: 28px;
  --arrow-thick: 2.5px;
  --arrow-pad: 2px;
}


.viewer__body {
  flex: 1;
  min-height: 0;
  width: 100%;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1;
}


.viewer__unstackBtn {
  position: absolute;
  top: 56px;
  left: 16px;
  background: rgba(220, 38, 38, 0.9);
  color: white;
  border: none;
  border-radius: 20px;
  padding: 8px 16px;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  z-index: 30;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.viewer__unstackBtn.visible {
    opacity: 1;
    pointer-events: auto;
}
.viewer__unstackBtn:hover {
    background: rgb(220, 38, 38);
    transform: scale(1.05);
}

/* Filmstrip */
.viewer__strip {
  position: relative;
  bottom: auto;
  left: auto;
  width: 100%;
  height: 90px;
  flex-shrink: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  overflow-x: auto;
  overflow-y: hidden;
  z-index: 20;
  backdrop-filter: blur(8px);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  box-sizing: border-box;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.2) transparent;
}
.viewer__strip:not([hidden]) {
  opacity: 1;
  pointer-events: auto;
}
.viewer__strip::-webkit-scrollbar {
  height: 4px;
}
.viewer__strip::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.2);
  border-radius: 999px;
}

.viewer__stripThumb {
  flex: 0 0 auto;
  height: 70px;
  width: auto;
  border-radius: 4px;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.2s, transform 0.2s;
  border: 2px solid transparent;
}
.viewer__stripThumb:hover {
  opacity: 1;
  transform: translateY(-2px);
}
.viewer__stripThumb.active {
  opacity: 1;
  border-color: #fff;
  transform: scale(1.05);
}

.viewer__img,
.viewer__video {
  display: block;
  max-width: min(90vw, 960px);
  max-height: calc(100vh - 80px);
  width: auto;
  height: auto;
  object-fit: contain;
  margin: 0 auto;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.2);
}

@media (min-width: 601px) {
  .viewer__body {
    flex: 1;
    min-height: 0;
    width: 100%;
    padding: 20px;
    display: flex;
    place-items: center;
    justify-content: center;
  }
  
  .viewer__img,
  .viewer__video {
    display: block;
    max-width: min(90vw, 960px);
    max-height: calc(100vh - 80px);
    width: auto;
    height: auto;
    object-fit: contain;
    margin: 0 auto;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.2);
  }

  /* When filmstrip is visible, shrink image to fit above it */
  .viewer.viewer--has-strip .viewer__img,
  .viewer.viewer--has-strip .viewer__video {
    max-height: calc(100vh - 190px);
  }
}

.viewer-media-wrapper {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  /* Ensure wrapper can shrink below content size if needed */
  min-width: 0;
  min-height: 0;
  flex: 0 1 auto;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  overflow: hidden;
  border-radius: 12px;
}

/* Video wrapper: explicit size so the video isn't tiny before metadata loads. */
.viewer-media-wrapper--video {
  width: min(900px, calc(100vw - 160px));
  height: 100%;
}

.viewer-media-wrapper--video .viewer__video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

@media (max-width: 600px), (pointer: coarse) {
  .viewer-media-wrapper--video {
    width: 100vw;
    max-height: calc(100dvh - 80px);
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .viewer-media-wrapper--video .viewer__video {
    width: 100%;
    max-width: 100vw;
    max-height: calc(100dvh - 80px);
    object-fit: contain;
  }
}

.like-btn {
  position: absolute;
  bottom: 12px;
  right: 12px;
  z-index: 10;
  width: 36px;
  height: 36px;
  padding: 8px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 50%;
  border: none;
  cursor: pointer;
  color: #fff;
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.2s ease, transform 0.2s ease, background-color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (hover: none) {
  .like-btn {
    opacity: 1;
    transform: scale(1);
    background: rgba(0, 0, 0, 0.3);
  }
}

.card:hover .like-btn,
.viewer-media-wrapper:hover .like-btn {
  opacity: 1;
  transform: scale(1);
}

.like-btn:hover {
  background: rgba(0, 0, 0, 0.8);
}

.like-btn.liked {
  color: #ec4899;
}

.like-btn svg {
  width: 100%;
  height: 100%;
}

.like-btn.liked svg {
  fill: currentColor;
  stroke: none;
}

/* Hide grid like buttons entirely for guests */
body.guest .card .like-btn {
  display: none !important;
}

/* Grey out viewer like button for guests — visually disabled */
body.guest #viewerLikeBtn {
  opacity: 0.3;
  filter: grayscale(1);
  cursor: default;
}

/* Stack Effect for Collections/Stories */
.card.card--stack {
  overflow: visible !important;
  isolation: isolate;
}

/* Both page layers share these base styles */
.card__page {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 10px;
  background-size: cover;
  background-position: center;
  background-color: #222;
  border: 3px solid #ffffff;
  box-shadow:
    0 4px 16px rgba(0,0,0,0.8),
    0 1px 3px rgba(0,0,0,0.6);
  pointer-events: none;
  overflow: hidden;
  opacity: 0;
  transform: rotate(0deg) translate(0, 0);
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1),
              opacity 0.3s ease,
              box-shadow 0.4s ease;
}

/* Subtle dark tint over page images so main card stands out */
.card__page::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.2);
  border-radius: 7px;
}

/* Page 1: behind main */
.card__page--1 {
  z-index: -1;
}

/* Page 2: furthest behind */
.card__page--2 {
  z-index: -2;
}

/* Main card media — no border at rest, identical to normal card */
.card.card--stack .card__media {
  position: relative;
  z-index: 1;
  border: none;
  box-shadow: none;
  overflow: hidden;
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1),
              box-shadow 0.4s ease,
              border 0.3s ease;
}

/* Hover: fan out like spreading photos on a table */
.card.card--stack:hover {
  z-index: 10;
}

.card.card--stack:hover .card__page {
  opacity: 1;
}

.card.card--stack:hover .card__page--1 {
  transform: rotate(-8deg) translate(-12px, 4px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.9);
}

.card.card--stack:hover .card__page--2 {
  transform: rotate(8deg) translate(12px, 6px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.9);
}

.card.card--stack:hover .card__media {
  border: 3px solid #ffffff;
  border-radius: 10px;
  transform: translateY(-4px) scale(1.02);
  box-shadow:
    0 16px 40px rgba(0,0,0,0.8),
    0 0 0 3px rgba(94, 231, 247, 0.4);
}

/* Remove old ::before and ::after pseudo-elements */
.card.card--stack::before,
.card.card--stack::after {
  display: none !important;
  content: none !important;
}

.card__videoBadge {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  z-index: 5;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card__videoBadge svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.card__badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 6px;
  border-radius: 4px;
  border: 1px solid rgba(255,255, 255, 0.25);
  box-shadow: 0 4px 6px rgba(0,0,0,0.5);
  z-index: 5;
  pointer-events: none;
  letter-spacing: 0.05em;
}

.admin {
  position: fixed;
  inset: 0;
  z-index: 120;
  opacity: 0;
  pointer-events: none;
  transition: opacity 170ms ease;
}

.admin.admin--open {
  opacity: 1;
  pointer-events: auto;
}

.admin__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
}

.admin__content {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(520px, calc(100% - 28px));
  border-radius: 18px;
  padding: 18px 16px 16px;
  background: rgba(11, 13, 18, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.10);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(12px);
}

.admin__close {
  position: absolute;
  top: 10px;
  right: 10px;
  --btnSize: 48px;
}

.admin__title {
  margin: 6px 0 14px 0;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.admin__form {
  display: grid;
  gap: 10px;
}

.admin__field {
  display: grid;
  gap: 6px;
}

.admin__label {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.70);
  font-weight: 800;
}

.admin__input {
  width: 100%;
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.92);
  outline: none;
}

.admin__input:focus {
  border-color: rgba(255, 255, 255, 0.25);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.10);
}

.admin__actions {
  display: flex;
  gap: 10px;
  justify-content: flex-start;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 4px;
}

.admin__msg {
  min-height: 18px;
  color: rgba(255, 255, 255, 0.80);
  font-weight: 800;
  letter-spacing: 0.02em;
}

@media (max-width: 600px), (pointer: coarse) {
  .admin__content {
    width: calc(100% - 20px);
    border-radius: 16px;
    padding: 16px 14px 14px;
  }
}

html.no-scroll {
  overflow: hidden;
  height: 100%;
  overscroll-behavior: none;
}

body.no-scroll {
  overflow: hidden;
  overscroll-behavior: none;
  /* position: fixed intentionally omitted — it causes GPU layer repaint that blacks out thumbnails */
}

/* Filter Menu */
.filterMenu {
  position: fixed;
  inset: 0;
  z-index: 120;
  opacity: 0;
  pointer-events: none;
  transition: opacity 170ms ease;
}

.filterMenu.filterMenu--open {
  opacity: 1;
  pointer-events: auto;
}

.filterMenu__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.60);
}

.filterMenu__content {
  position: absolute;
  background: rgba(15, 15, 15, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
}

/* Mobile: Top-right dropdown style */
@media (max-width: 600px) {
  .filterMenu__content {
    right: 12px;
    top: calc(12px + env(safe-area-inset-top));
    width: min(420px, calc(100% - 24px));
    max-height: calc(100vh - 40px);
    border-radius: 18px;
  }
}

/* Desktop: Right entry drawer */
@media (min-width: 601px) {
  .filterMenu__backdrop {
    background: rgba(0, 0, 0, 0.40);
  }
  .filterMenu {
    transition: opacity 170ms ease, visibility 170ms;
  }
  .filterMenu__content {
    top: 0;
    right: 0;
    bottom: 0;
    width: 320px;
    border-radius: 0;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    border-top: none;
    border-bottom: none;
    border-right: none;
    transform: translateX(100%);
    transition: transform 0.25s cubic-bezier(0.2, 0, 0.2, 1);
  }
  .filterMenu.filterMenu--open .filterMenu__content {
    transform: translateX(0);
  }
}

.filterMenu__header {
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.filterMenu__title {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.02em;
  display: inline-block;
  padding-bottom: 5px;
  border-bottom: 2px solid rgba(94, 231, 247, 0.55);
}

.filterMenu__close {
  all: unset;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.9);
  flex-shrink: 0;
  transition: background 0.2s ease;
}
.filterMenu__close:hover {
  background: rgba(255, 255, 255, 0.18);
}

.filterMenu__body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
}

/* Options section (checkboxes / radios) */
.filterMenu__options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

/* Scoped toggle overrides inside the filter panel */
.filterMenu .toggle {
  gap: 10px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  user-select: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.filterMenu .toggle:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.22);
}

.filterMenu .toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.filterMenu .toggle:has(input[type='checkbox']:checked) {
  background: rgba(94, 231, 247, 0.12);
  border-color: rgba(94, 231, 247, 0.5);
  color: #5ee7f7;
}

.filterMenu .toggle:has(input[type='radio']:checked) {
  background: rgba(94, 231, 247, 0.10);
  border-color: rgba(94, 231, 247, 0.4);
  color: rgba(94, 231, 247, 0.9);
}

.filterMenu__tags {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filterTag {
  display: flex;
  align-items: center;
  /* gap: 12px; -> handled by ::before margin */
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid transparent; /* Prepare for border change */
  transition: background 0.1s;
  user-select: none;
}
.filterTag:hover {
  background: rgba(255, 255, 255, 0.16);
}

/* Tri-state Visuals */
.filterTag::before {
  content: '';
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  margin-right: 12px;
  font-weight: 800;
  font-size: 14px;
  line-height: 1;
  transition: all 0.1s;
}

/* State: Include (Green Check) */
.filterTag[data-state="include"] {
  background: rgba(0, 200, 83, 0.15);
  border-color: rgba(0, 200, 83, 0.5);
}
.filterTag[data-state="include"]::before {
  content: '✓';
  background: #00e676;
  border-color: #00e676;
  color: #000;
}

/* State: Exclude (Red Bang/Cross) */
.filterTag[data-state="exclude"] {
  background: rgba(255, 23, 68, 0.15);
  border-color: rgba(255, 23, 68, 0.5);
}
.filterTag[data-state="exclude"]::before {
  content: '!';
  background: #ff1744;
  border-color: #ff1744;
  color: #fff;
}

.filterTag span {
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.02em;
}

.filterMenu__footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.filterMenu__footer .uBtn {
  flex: 0 0 auto;
  width: auto;
  min-width: unset;
  margin-left: 0;
  text-align: center;
  padding: 6px 18px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
  transition: border-color 0.2s ease, background 0.2s ease;
}
.filterMenu__footer .uBtn:hover {
  border-color: rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.06);
}

/* #filterApplyBtn visual rules handled by .btn--primary */

.filterCount {
  position: absolute;
  top: 6px;
  right: 6px;
  min-width: 14px;
  height: 14px;
  border-radius: 99px;
  background: #fff;
  color: #000;
  font-size: 9px;
  line-height: 14px;
  font-weight: 800;
  text-align: center;
  padding: 0 3px;
  pointer-events: none;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* Filter Button (Icon Style) */
.filterBtn {
  --btnSize: 44px;
  width: var(--btnSize);
  height: var(--btnSize);
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  position: relative;
}
.filterBtn:hover {
  background: rgba(255, 255, 255, 0.1);
}
.filterBtn.uBtn--primary {
  background: rgba(255, 255, 255, 0.15);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1);
}
.filterBtn.uBtn--primary .filterIcon {
  color: #fff;
  fill: rgba(255, 255, 255, 0.2);
}

.filterIcon {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2px;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: rgba(255, 255, 255, 0.75);
  transition: color 0.15s;
}
.filterBtn:hover .filterIcon {
  color: #fff;
}

/* Delete Overlay */
.delete-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  background: rgba(40, 0, 0, 0.6);
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
  backdrop-filter: blur(2px);
}

.delete-overlay svg {
  width: 48px;
  height: 48px;
  color: #ff4d4d;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

.card[data-delete-selected="true"] .delete-overlay {
  opacity: 1;
  pointer-events: auto;
}

/* Hover hint while in delete mode — requires JS to add .admin-mode-delete to body */
body.admin-mode--delete .card:hover .delete-overlay {
  opacity: 0.5;
}

/* Footer */
.site-footer {
  padding: 48px 24px;
  background: rgba(0, 0, 0, 0.4);
  margin-top: 48px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  text-align: center;
}

.site-footer__content {
  max-width: 800px;
  margin: 0 auto;
  display: grid;
  gap: 16px;
}

.site-footer h2 {
  font-size: 18px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.9);
}

.site-footer p {
  font-size: 14px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.6);
}

.site-footer strong {
  color: rgba(255, 255, 255, 0.8);
}

.site-footer__meta {
  margin-top: 16px;
  font-size: 12px;
  opacity: 0.5;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}


.uBtn--secondary {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: rgba(255, 255, 255, 0.8);
  padding: 12px 24px;
  border-radius: 99px;
  font-weight: 700;
  transition: all 0.2s;
}

.uBtn--secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: #fff;
  color: #fff;
}

/* Login Prompt */
.loginPrompt {
  position: fixed;
  inset: 0;
  z-index: 160;
  display: grid;
  place-items: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.loginPrompt[aria-hidden='false'] {
  opacity: 1;
  pointer-events: auto;
}

.loginPrompt__backdrop {
  position: absolute;
  inset: 0;
}

.loginPrompt__card {
  position: relative;
  z-index: 2;
  background: #1a1d26;
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 28px 28px 24px;
  border-radius: 20px;
  max-width: 360px;
  width: 100%;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.7);
  text-align: center;
  transform: translateY(20px);
  transition: transform 0.35s cubic-bezier(0.19, 1, 0.22, 1);
}

.loginPrompt[aria-hidden='false'] .loginPrompt__card {
  transform: translateY(0);
}

.loginPrompt__close {
  position: absolute;
  top: 10px;
  right: 10px;
  opacity: 0.5;
  width: 28px;
  height: 28px;
  min-width: unset;
  padding: 0;
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}
.loginPrompt__close:hover { opacity: 1; }

.loginPrompt__title {
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 8px;
}

.loginPrompt__text {
  font-size: 14px;
  color: rgba(255,255,255,0.6);
  line-height: 1.6;
  margin-bottom: 20px;
}

/* Tutorial Modal */
.tutorial {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.tutorial[aria-hidden='false'] {
  opacity: 1;
  pointer-events: auto;
}

.tutorial__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(12px);
}

.tutorial__card {
  position: relative;
  z-index: 2;
  background: rgba(26, 29, 38, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 40px;
  border-radius: 32px;
  max-width: 460px;
  width: 100%;
  box-shadow: 0 32px 64px rgba(0, 0, 0, 0.8), 0 0 100px rgba(0, 187, 221, 0.1);
  text-align: center;
  transform: translateY(20px) scale(0.96);
  transition: transform 0.4s cubic-bezier(0.19, 1, 0.22, 1);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.tutorial[aria-hidden='false'] .tutorial__card {
  transform: translateY(0) scale(1);
}

.tutorial__header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.tutorial__logo {
  width: 64px;
  height: 64px;
  opacity: 0.9;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.4));
}

.tutorial__title {
  font-size: 32px;
  font-weight: 900;
  background: linear-gradient(135deg, #fff 0%, #a5f3fc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin: 0;
  letter-spacing: -0.02em;
}

.tutorial__divider {
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
}

.tutorial__list {
  text-align: left;
  display: grid;
  gap: 12px;
  margin: 0;
}

.tutorial__list li {
  display: grid;
  grid-template-columns: 48px 1fr;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.03);
  padding: 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  transition: background 0.2s, transform 0.2s;
}

.tutorial__list li:hover {
  background: rgba(255, 255, 255, 0.06);
  transform: translateY(-2px);
}

.tutorial__icon {
  font-size: 24px;
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  display: grid;
  place-items: center;
}

.tutorial__content strong {
  color: #fff;
  display: block;
  font-size: 15px;
  margin-bottom: 2px;
  font-weight: 700;
}

.tutorial__content div {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.65);
  line-height: 1.4;
}

#tutorialCloseBtn {
  width: 100%;
  padding: 16px;
  font-size: 16px;
  background: #fff;
  color: #000;
  border-color: #fff;
  font-weight: 800;
  margin-top: 8px;
}
#tutorialCloseBtn:hover {
  background: rgba(255, 255, 255, 0.9);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(255, 255, 255, 0.15);
}

/* Stack Selection UI */
.card__selectBadge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: linear-gradient(135deg, #5ee7f7, #f76eb2);
  color: white;
  font-weight: 800;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
  opacity: 0;
  transform: scale(0.5);
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.card[data-selecting="true"] {
    cursor: copy; /* Indicate selection */
}
.card[data-selected="true"] .card__selectBadge {
    opacity: 1;
    transform: scale(1);
}
.card[data-selected="true"] .card__media {
    transform: scale(0.97);
    border-radius: 10px;
    box-shadow: 0 0 0 3px rgba(94, 231, 247, 0.6), 0 0 20px rgba(94, 231, 247, 0.2);
}

.stack-actions {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 100;
    display: flex;
    gap: 12px;
    animation: fadeUp 0.3s;
}

.stack-btn {
    background: var(--uiverse-fill);
    color: #000;
    border: none;
    padding: 12px 24px;
    border-radius: 99px;
    font-weight: 800;
    letter-spacing: 0.04em;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    cursor: pointer;
    font-size: 15px;
    transition: transform 0.1s;
    display: flex;
    align-items: center;
    gap: 8px;
}
.stack-btn:hover { transform: scale(1.04); }
.stack-btn:active { transform: scale(0.96); }

.stack-btn--cancel {
    background: #333;
    color: #fff;
}

/* Account Button */
#accountBtn.accountBtn--authed svg {
  stroke: #5ee7f7;
  filter: drop-shadow(0 0 6px rgba(94, 231, 247, 0.5));
}

/* Auth Modal */
.authModal {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: grid;
  place-items: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.authModal[aria-hidden='false'] {
  opacity: 1;
  pointer-events: auto;
}

.authModal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
}

.authModal__card {
  position: relative;
  z-index: 2;
  background: #1a1d26;
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 28px 32px;
  border-radius: 20px;
  max-width: 380px;
  width: 100%;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  transform: translateY(16px);
  transition: transform 0.25s cubic-bezier(0.19, 1, 0.22, 1);
}

.authModal[aria-hidden='false'] .authModal__card {
  transform: translateY(0);
}

.authModal__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.authModal__close:hover {
  background: rgba(255, 255, 255, 0.15);
}

.authModal__tabs {
  display: flex;
  gap: 4px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 24px;
}

.authModal__tab {
  flex: 1;
  padding: 8px 16px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.5);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.2s;
}

.authModal__tab--active {
  background: rgba(94, 231, 247, 0.15);
  color: #5ee7f7;
  box-shadow: 0 0 8px rgba(94, 231, 247, 0.2);
}

.authModal__form {
  display: flex;
  flex-direction: column;
}

.authModal__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.authModal__label {
  font-size: 0.78rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.authModal__input {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 10px 14px;
  color: #fff;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}

.authModal__input:focus {
  border-color: rgba(94, 231, 247, 0.5);
}

.authModal__msg {
  min-height: 20px;
  font-size: 0.82rem;
  color: #f76eb2;
  margin-top: 8px;
  text-align: center;
}

.authModal__avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #5ee7f7, #f76eb2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 800;
  color: #fff;
  margin: 0 auto 12px;
  text-transform: uppercase;
}

.authModal__username {
  text-align: center;
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
}

.authModal__adminBadge {
  display: inline-block;
  margin: 6px auto 0;
  padding: 3px 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, #5ee7f7, #f76eb2);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
}

.authModal__adminBadge[hidden] { display: none; }
