: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;
}

.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;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  gap: 4vh;
}

.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__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(11, 13, 18, 0.88);
  backdrop-filter: blur(8px);
}

.gate__backdrop::before,
.gate__backdrop::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* Cozy quilt / padding vibe */
.gate__backdrop::before {
  opacity: 0.22;
  filter: blur(0.4px);
  background:
    repeating-linear-gradient(
      45deg,
      rgba(255, 255, 255, 0.08) 0px,
      rgba(255, 255, 255, 0.08) 1px,
      transparent 1px,
      transparent 26px
    ),
    repeating-linear-gradient(
      -45deg,
      rgba(255, 255, 255, 0.06) 0px,
      rgba(255, 255, 255, 0.06) 1px,
      transparent 1px,
      transparent 26px
    );
  transform: scale(1.05);
}

/* Gentle drifting "bubbles" (comfort/calm) */
.gate__backdrop::after {
  opacity: 0.28;
  filter: blur(10px);
  background:
    radial-gradient(circle at 10% 110%, rgba(255, 255, 255, 0.12) 0 26px, transparent 30px),
    radial-gradient(circle at 22% 120%, rgba(255, 255, 255, 0.10) 0 18px, transparent 22px),
    radial-gradient(circle at 38% 115%, rgba(255, 255, 255, 0.09) 0 22px, transparent 26px),
    radial-gradient(circle at 55% 120%, rgba(255, 255, 255, 0.11) 0 24px, transparent 28px),
    radial-gradient(circle at 72% 110%, rgba(255, 255, 255, 0.10) 0 20px, transparent 24px),
    radial-gradient(circle at 90% 118%, rgba(255, 255, 255, 0.08) 0 26px, transparent 30px);
  animation: gateBubbles 14s linear infinite;
}

.gate__carousel {
  position: relative;
  width: 100%;
  z-index: 0;
  display: grid;
  grid-template-rows: auto auto;
  align-content: center;
  gap: 18px;
  padding: 2rem 0;
  opacity: 0.78;
  pointer-events: none;
  transform: perspective(900px) rotateX(10deg);
}

.gate__row {
  position: relative;
  overflow: hidden;
  width: min(1200px, calc(100vw - 48px));
  margin: 0 auto;
  height: 150px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  /* backdrop-filter: blur(6px);  <-- Removed for Firefox compatibility (conflicts with mask-image) */
  -webkit-mask-image: linear-gradient(
    90deg,
    transparent,
    rgba(0, 0, 0, 1) 10%,
    rgba(0, 0, 0, 1) 90%,
    transparent
  );
  mask-image: linear-gradient(
    90deg,
    transparent,
    rgba(0, 0, 0, 1) 10%,
    rgba(0, 0, 0, 1) 90%,
    transparent
  );
}

.gate__row--top {
  transform: translate3d(0, -6px, 0);
}

.gate__row--bottom {
  transform: translate3d(0, 6px, 0);
}

.gate__row::after {
  content: '';
  position: absolute;
  inset: -40% -20%;
  background: radial-gradient(closest-side at 50% 50%, rgba(255, 255, 255, 0.10), transparent 60%);
  opacity: 0.25;
  filter: blur(14px);
  animation: gateRowGlow 8s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes gateRowGlow {
  0% {
    transform: translate3d(-6%, -2%, 0);
  }
  100% {
    transform: translate3d(6%, 2%, 0);
  }
}

.gate__rowInner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  width: max-content;
  will-change: transform;
}

.gate__rowInner--top {
  animation: gateMarqueeLeft 28s linear infinite;
}

.gate__rowInner--bottom {
  animation: gateMarqueeRight 34s linear infinite;
}

@keyframes gateMarqueeLeft {
  0% {
    transform: translate3d(0, 0, 0);
  }
  100% {
    transform: translate3d(-50%, 0, 0);
  }
}

@keyframes gateMarqueeRight {
  0% {
    transform: translate3d(-50%, 0, 0);
  }
  100% {
    transform: translate3d(0, 0, 0);
  }
}

.gate__tile {
  flex: 0 0 auto;
  width: 210px;
  height: 126px;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow:
    0 10px 26px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.10);
  transform: translate3d(0, var(--y, 0px), 0) rotate(var(--r, 0deg)) scale(var(--s, 1));
  will-change: transform;
}

.gate__tile img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  filter: saturate(1.06) contrast(1.05);
}

/* Animated "screensaver" layers */
.gate::before,
.gate::after {
  content: '';
  position: absolute;
  inset: -20vh -20vw;
  pointer-events: none;
}

.gate::before {
  opacity: 0.75;
  filter: blur(18px) saturate(1.22);
  background:
    radial-gradient(640px circle at var(--mx) var(--my), rgba(255, 255, 255, 0.16), transparent 60%),
    radial-gradient(closest-side at 20% 30%, rgba(255, 255, 255, 0.12), transparent 60%),
    radial-gradient(closest-side at 80% 25%, rgba(255, 255, 255, 0.08), transparent 60%),
    radial-gradient(closest-side at 75% 80%, rgba(255, 255, 255, 0.10), transparent 55%),
    radial-gradient(closest-side at 25% 78%, rgba(255, 255, 255, 0.07), transparent 55%);
  animation: gateDrift 16s ease-in-out infinite alternate;
}

.gate::after {
  opacity: 0.22;
  background:
    repeating-linear-gradient(
      120deg,
      rgba(255, 255, 255, 0.06) 0px,
      rgba(255, 255, 255, 0.06) 1px,
      transparent 1px,
      transparent 18px
    );
  transform-origin: 50% 50%;
  animation: gateSweep 26s linear infinite;
}

@keyframes gateDrift {
  0% {
    transform: translate3d(-2%, -2%, 0) scale(1);
  }
  100% {
    transform: translate3d(2%, 2%, 0) scale(1.03);
  }
}

@keyframes gateSweep {
  0% {
    transform: rotate(0deg) translate3d(0, 0, 0);
  }
  100% {
    transform: rotate(360deg) translate3d(0, 0, 0);
  }
}

@keyframes gateBubbles {
  0% {
    transform: translate3d(0, 16vh, 0);
  }
  100% {
    transform: translate3d(0, -26vh, 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__content {
  position: relative;
  z-index: 5;
  text-align: center;
  max-width: 600px;
  width: 100%;
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 200px;
}

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


@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;
  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 {
    gap: 2vh;
  }

  .gate__logo {
    width: 160px;
    margin-bottom: 0.25rem;
  }

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

  .gate__carousel {
    padding: 0.5rem 0;
    gap: 10px;
    transform: perspective(600px) rotateX(5deg); /* reduce perspective intensity */
  }

  .gate__row {
    width: 120vw; /* Ensure no gaps */
    height: 90px;
    border-radius: 12px;
  }

  .gate__rowInner {
    padding: 8px;
    gap: 8px;
  }

  .gate__tile {
    width: 120px;
    height: 74px;
    border-radius: 10px;
  }

  /* Adjust entry button for easier tapping but less space */
  .gate__enter {
    padding: 14px 40px;
    font-size: 1.1rem;
  }
}

  .gate__content::before {
    height: 200px;
  }

  .gate__title {
    font-size: clamp(28px, 8.4vw, 40px);
    margin-bottom: 12px;
    -webkit-text-stroke: 0;
  }

  .gate__subtitle {
    font-size: 13px;
    letter-spacing: 0.04em;
    text-align: center;
  }

  .gate__text {
    font-size: 14px;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.8);
    margin: 8px 0 24px 0;
    max-width: 100%;
    text-align: center;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
  }

  .gate__enter.uPill {
    padding: 12px 18px;
    font-size: 16px;
  }
}

.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: 600px;
  text-align: center;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

.gate__enter {
  animation: gateButtonBreath 3.0s ease-in-out infinite;
}

.gate__enter:hover {
  /* hover styling provided by .uPill */
}

.gate__enter:active {
  /* active styling provided by .uPill */
}

@keyframes gateButtonBreath {
  0%,
  100% {
    transform: translateZ(0) scale(1);
    filter: drop-shadow(0 0 0 rgba(255, 255, 255, 0));
  }
  50% {
    transform: translateZ(0) scale(1.02);
    filter: drop-shadow(0 0 20px rgba(255, 255, 255, 0.10));
  }
}

.gate__enter:focus-visible {
  /* focus styling provided by .uPill */
}

@media (prefers-reduced-motion: reduce) {
  .gate::before,
  .gate::after,
  .gate__backdrop::after,
  .gate__rowInner--top,
  .gate__rowInner--bottom,
  .gate__enter {
    animation: none !important;
  }
}

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

.gate--leaving .gate__backdrop {
  animation: gateFade 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;
}

/* 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;
    align-items: center;
    padding: 6px 10px;
    gap: 8px;
  }

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

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

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

  /* Adjust sizing for mobile compactness */
  .hamburger {
    --btnSize: 38px;
  }
  
  .filterBtn {
    --btnSize: 38px;
  }
  
  .navBtn {
    --btnSize: 38px;
  }
  
  .pageLabel {
    min-width: unset;
    font-size: 11px;
    margin: 0 2px;
  }

  .page-text {
    display: none;
  }

  .syncLabel {
    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 caused issues on scroll lock */
  /* content-visibility: auto; */
  /* contain-intrinsic-size: 180px 180px; */
  will-change: transform, box-shadow;
  transition:
    transform 160ms ease,
    box-shadow 160ms 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: 20;
    transform: scale(1.08) perspective(800px) rotateY(0deg);
    box-shadow:
      0 16px 34px rgba(0, 0, 0, 0.38),
      0 0 0 1px rgba(255, 255, 255, 0.08);
    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: grid;
  place-items: center;
  padding: 16px;
  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__close {
  position: absolute;
  top: 12px;
  right: 12px;
  --btnSize: 56px;
  z-index: 5;
}

.viewer__frame {
  width: min(1240px, 100%);
  height: 100%;
  max-height: 100%;
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 56px;
  grid-template-rows: minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

/* Tag mode: add a right sidebar between the media and Next button */
.viewer.viewer--tag .viewer__frame {
  grid-template-columns: 56px minmax(0, 1fr) minmax(240px, 320px) 56px;
}

.viewer.viewer--tag #viewerNext {
  grid-column: 4;
}

.tagPanel {
  grid-column: 3;
  align-self: stretch;
  max-height: calc(100vh - 32px);
  border-radius: 14px;
  padding: 12px;
  background: rgba(11, 13, 18, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.10);
  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 {
  font-weight: 900;
  letter-spacing: 0.04em;
}

.tagPanel__icon {
  --btnSize: 40px;
  width: var(--btnSize);
  height: var(--btnSize);
  border-radius: 999px;
}

.tagPanel__list {
  overflow: auto;
  padding-right: 6px;
}

.tagPanel__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.04);
}

.tagPanel__row + .tagPanel__row {
  margin-top: 8px;
}

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

.tagPanel__toggle {
  width: 18px;
  height: 18px;
  accent-color: rgba(255, 255, 255, 0.95);
}

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

.tagPanel__input {
  height: 42px;
  border-radius: 12px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.30);
  color: rgba(255, 255, 255, 0.92);
  font-weight: 800;
  letter-spacing: 0.02em;
}

.tagPanel__input:focus {
  outline: 2px solid rgba(255, 255, 255, 0.60);
  outline-offset: 2px;
}

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

/* Mobile viewer: let the media fill the screen and overlay nav buttons.
   This avoids the image/video looking too small due to side columns + padding. */
@media (max-width: 600px), (pointer: coarse) {
  .viewer__content {
    padding: 8px;
  }

  .viewer__close {
    top: calc(8px + env(safe-area-inset-top));
    right: calc(8px + env(safe-area-inset-right));
    --btnSize: 48px;
  }

  .viewer__frame {
    width: 100%;
    max-height: 100vh;
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    position: relative;
  }

  .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__nav {
    display: none;
  }

  .viewer__body {
    height: 100vh;
    height: 100dvh; /* Use dynamic viewport height for mobile browsers */
    padding-top: calc(56px + env(safe-area-inset-top));
    padding-bottom: calc(24px + env(safe-area-inset-bottom)); /* Increase bottom padding */
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
  }

  .viewer__img,
  .viewer__video {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: calc(100dvh - 56px - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 24px);
    object-fit: contain;
  }

  .viewer.viewer--has-strip .viewer__img,
  .viewer.viewer--has-strip .viewer__video {
    max-height: calc(100dvh - 56px - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 24px - 140px);
  }

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

  /* Hide grid like buttons on mobile to prevent accidental clicks */
  .card .like-btn {
    display: none !important;
  }
  
  /* Reposition viewer like button to top-left and make always visible */
  .viewer .like-btn {
    position: fixed;
    top: calc(12px + env(safe-area-inset-top));
    left: calc(12px + env(safe-area-inset-left));
    right: auto;
    bottom: auto;
    opacity: 1 !important;
    transform: scale(1) !important;
    background: rgba(0, 0, 0, 0.4); /* Slightly lighter for visibility */
  }
}

.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: 14px;
  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);
}

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

.adminMenu__title {
  margin: 0;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.adminMenu__close {
  --btnSize: 44px;
  width: var(--btnSize);
  height: var(--btnSize);
  border-radius: 999px;
}

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

.adminMenu__item {
  all: unset;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  border-radius: 14px;
  border: 2px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.28);
  color: rgba(255, 255, 255, 0.92);
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: transform 0.1s, background 0.15s, border-color 0.15s;
  user-select: none;
}

.adminMenu__item:hover {
  background: rgba(0, 0, 0, 0.45);
  border-color: rgba(255, 255, 255, 0.35);
}

.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);
}

.viewer__nav {
  --btnSize: 56px;
  --arrow-w: 28px;
  --arrow-h: 38px;
  --arrow-thick: 3px;
  --arrow-pad: 2px;
  justify-self: center;
  z-index: 5;
}

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

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

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


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


.viewer__unstackBtn {
  position: absolute;
  top: 16px; 
  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: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 90px;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  overflow-x: auto;
  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;
}
.viewer__strip:not([hidden]) {
  opacity: 1;
  pointer-events: auto;
}

.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: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.2);
}

@media (min-width: 601px) {
  .viewer__body {
    height: 100%;
    width: 100%;
    padding: 20px;
    display: flex;
    place-items: center;
    justify-content: center;
  }
  
  .viewer__img,
  .viewer__video {
    /* Explicitly cap height based on viewport to guarantee fit */
    max-height: calc(100vh - 100px); 
    width: auto;
    max-width: 100%;
    object-fit: contain;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.2);
  }

  /* When filmstrip is visible, reduce max height so it doesn't overlap */
  .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;
}

.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;
}

/* Stack Effect for Collections/Stories */
.card.card--stack {
   overflow: visible; /* Allow stack layers to spill out */
   transform-style: preserve-3d;
   contain: none; 
}

.card.card--stack::before,
.card.card--stack::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #2a2a2a;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  z-index: -1;
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.2s ease;
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(0,0,0,0.6);
}

.card.card--stack::before {
  /* Default: Hidden behind main card */
  transform: translate(0, 0) scale(0.98);
  opacity: 0;
  /* Use variable for background image if available */
  background: var(--stack-1, #2a2a2a);
  background-size: cover;
  background-position: center;
}

.card.card--stack::after {
  /* Default: Hidden behind main card */
  transform: translate(0, 0) scale(0.96);
  opacity: 0;
  background: var(--stack-2, #2a2a2a);
  background-size: cover;
  background-position: center;
}

.card.card--stack:hover::before {
  /* Hover: Fan out left */
  transform: rotate(-6deg) translateX(-12px) translateY(2px);
  opacity: 1;
}

.card.card--stack:hover::after {
  /* Hover: Fan out right */
  transform: rotate(6deg) translateX(12px) translateY(4px);
  opacity: 1;
}

.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,
body.no-scroll {
  overflow: hidden;
  height: 100%;
  overscroll-behavior: none;
}

/* 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(11, 13, 18, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.10);
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.65);
  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.12);
    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: 18px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.filterMenu__close {
  --btnSize: 36px;
  width: var(--btnSize);
  height: var(--btnSize);
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.1);
}
.filterMenu__close:hover {
  background: rgba(255, 255, 255, 0.2);
}

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

.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: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  gap: 12px;
  justify-content: stretch;
}
.filterMenu__footer .uBtn {
  flex: 1;
  text-align: center;
  padding: 12px;
  border-radius: 12px;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.2);
}
.filterMenu__footer .uBtn:hover {
  background: rgba(255, 255, 255, 0.1);
}
.filterMenu__footer .uBtn--primary {
  background: #fff;
  color: #000;
  border-color: #fff;
}
.filterMenu__footer .uBtn--primary:hover {
  background: rgba(255, 255, 255, 0.9);
}

.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-deleting="true"] .delete-overlay {
  opacity: 1;
  pointer-events: auto;
}

/* 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;
}


/* Gate Views Overlay Fixes */
.gateContentOverlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  /* Override any previous max-width constraint to allow full centering */
  max-width: 100% !important; 
  display: flex !important;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 5;
  padding: 24px;
}

/* Ensure children are centered and distinct */
.gateContentOverlay > * {
  max-width: 600px;
  width: 100%;
  /* Reset auto margins from previous gate classes that might push content off-center */
  margin-top: 0 !important;
  margin-bottom: 24px !important; 
  flex: 0 0 auto;
}
.gateContentOverlay > .gate__actions {
   margin-bottom: 0 !important;
}

#gateAge.gateContentOverlay {
  z-index: 20;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(16px);
}

/* 1. Age Verification Improvements */
#gateAge .gate__title {
  color: #ff5e5e; /* Warning Red */
  text-shadow: 0 4px 12px rgba(255, 60, 60, 0.3);
  font-size: 36px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

#gateAge .gate__subtitle {
  color: #fff;
  opacity: 0.9;
  font-size: 16px;
  display: block;
  margin-top: 8px;
  letter-spacing: 0.05em;
  font-weight: 600;
  text-transform: none;
}

#gateAge .gate__actions {
  margin-top: 32px;
}

#gateAge #ageConfirmBtn {
  background: #ff5e5e;
  border-color: #ff5e5e;
  color: #fff;
  font-size: 18px;
  padding: 14px 28px;
  box-shadow: 0 8px 24px rgba(255, 94, 94, 0.4);
}

#gateAge #ageConfirmBtn:hover {
  background: #ff7b7b;
  transform: translateY(-2px);
}

/* 2. Entry Gate Layout (Spread) */
#gateLanding.gateContentOverlay {
  z-index: 10;
  display: flex !important;
  flex-direction: column;
  justify-content: center;
  gap: 420px; /* Increased from 360px to push title further up */
  padding: 24px;
}

#gateLanding .gate__header {
   margin: 0;
}

#gateLanding .gate__footer {
   margin: 0;
}

@media (max-width: 600px) {
  #gateLanding.gateContentOverlay {
    gap: 220px; /* Smaller gap for mobile carousel */
  }
}

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

  display: flex;
  gap: 16px;
  justify-content: center;
  margin-top: 24px;
}

.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;
}

/* 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: var(--uiverse-fill);
  color: #000;
  font-weight: 800;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  z-index: 10;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  border: 2px solid #fff;
  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.94);
    border-radius: 12px;
    box-shadow: 0 0 0 4px var(--uiverse-fill);
}

.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;
}

