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

:root {
  --font-ui: "PP Neue Montreal Mono", "SF Mono", "Roboto Mono", "Menlo", monospace;
  --canvas-bg: #000000;
  --canvas-bg-rgb: 0, 0, 0;
  --gallery-bg: #000000;
  --gallery-bg-rgb: 0, 0, 0;
  --gallery-text: #ffffff;
  --text: #f5f5f5;
  --muted: #8e8e8e;
  --line: #262626;
  --field-bg: #111111;
  --primary-bg: #f5f5f5;
  --primary-text: #050505;
  --radius-sm: 10px;

  --frame-w: 1920px;
  --frame-h: 1080px;
  --frame-scale: 1;

  --card-size: 337px;
  --card-radius: 999px;
  --card-gap: 33.208px;
  --fade-width: 645px;
  --gallery-center-scale-boost: 0.3;
  --screen-fade-ms: 180ms;
  --gallery-background-fade-ms: 220ms;
  --logo-top: 34px;
  --logo-width: 60px;
  --toolbar-side-pad: 32px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --visual-viewport-height: 100dvh;
  --visual-viewport-width: 100vw;
  --visual-top-inset: 0px;
  --visual-bottom-inset: 0px;
  --visual-right-inset: 0px;
  --mobile-controls-lift: 0px;
}

@font-face {
  font-family: "PP Neue Montreal Mono";
  src: url("./pp-neue-montreal-mono-3.woff2") format("woff2"),
       url("./pp-neue-montreal-mono-3.woff") format("woff"),
       url("./pp-neue-montreal-mono-3.otf") format("opentype");
  font-display: swap;
  font-style: normal;
  font-weight: 400;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  position: fixed;
  inset: 0;
  margin: 0;
  background: var(--canvas-bg);
  color: var(--text);
  color-scheme: dark;
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: geometricPrecision;
}

a,
button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
}

body.is-transitioning {
  overflow: hidden;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.transition-layer {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #000000;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition:
    opacity var(--screen-fade-ms) ease,
    visibility 0s linear 0s;
}

.transition-layer.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity var(--screen-fade-ms) ease,
    visibility 0s linear var(--screen-fade-ms);
}

#view-gallery.view.active {
  min-height: 100svh;
  min-height: 100lvh;
  height: 100lvh;
  height: 100dvh;
}

#view-gallery.view.active {
  display: flex;
  position: relative;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--gallery-bg);
}

.gallery-stage {
  position: relative;
  z-index: 1;
  width: calc(var(--frame-w) * var(--frame-scale));
  height: calc(var(--frame-h) * var(--frame-scale));
  flex: 0 0 auto;
}

.landing-shell {
  position: absolute;
  inset: 0 auto auto 0;
  width: var(--frame-w);
  height: var(--frame-h);
  background: transparent;
  overflow: hidden;
  transform: scale(var(--frame-scale));
  transform-origin: top left;
}

.gallery-backgrounds {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background: var(--gallery-bg);
}

.gallery-backgrounds::before,
.gallery-backgrounds::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  pointer-events: none;
  opacity: 0;
  z-index: 2;
}

.gallery-backgrounds::before {
  top: 0;
  height: min(28vh, 240px);
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.92) 0%, rgba(0, 0, 0, 0.7) 38%, rgba(0, 0, 0, 0.26) 74%, rgba(0, 0, 0, 0) 100%);
}

.gallery-backgrounds::after {
  bottom: 0;
  height: min(30vh, 280px);
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.97) 0%, rgba(0, 0, 0, 0.82) 34%, rgba(0, 0, 0, 0.34) 72%, rgba(0, 0, 0, 0) 100%);
}

.gallery-background-item {
  position: absolute;
  inset: -6%;
  opacity: 0;
  transition: opacity var(--gallery-background-fade-ms) ease;
}

.gallery-background-item.is-active {
  opacity: 1;
}

.gallery-background-item::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 28%, rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0.58) 58%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0.72) 100%);
}

.gallery-background-media {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
  will-change: opacity;
  filter: brightness(0.5) saturate(0.88) blur(9px);
}

.gallery-background-media.is-preprocessed {
  filter: none;
}

.gallery-topbar {
  position: absolute;
  top: calc(var(--logo-top) + var(--safe-top));
  left: calc(var(--toolbar-side-pad) + var(--safe-left));
  right: calc(var(--toolbar-side-pad) + var(--safe-right));
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  z-index: 3;
  pointer-events: none;
}

.hero-logo {
  position: relative;
  width: var(--logo-width);
  height: auto;
  display: block;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  height: 56px;
  padding: 0 18px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: transparent;
  color: rgba(255, 255, 255, 0.94);
  font-size: 16px;
  font-weight: 560;
  line-height: 1;
  letter-spacing: -0.02em;
  text-decoration: none;
  pointer-events: auto;
  transform: scale(var(--frame-scale));
  transform-origin: top right;
  transition:
    border-color 180ms ease,
    color 180ms ease,
    background-color 180ms ease;
}

.hero-badge:hover {
  border-color: rgba(255, 255, 255, 0.28);
  color: rgba(255, 255, 255, 1);
}

.hero-badge:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.72);
}

.hero-logo-mobile,
.mobile-overlay {
  display: none;
}

.hero-logo-mobile,
.hero-description,
.mobile-overlay {
  display: none !important;
}

.hero-description {
  position: absolute;
  top: var(--description-top);
  left: var(--description-left);
  width: var(--description-width);
  margin: 0;
  color: var(--gallery-text);
  text-align: center;
  font-weight: 500;
  font-size: var(--description-size);
  line-height: 1.2223;
  letter-spacing: -0.04em;
  z-index: 3;
}

.gallery-shell {
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: 2;
}

.gallery-mobile-nav {
  display: none !important;
}

.gallery-viewport {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: calc(var(--card-size) * 1.78);
  transform: translateY(-50%);
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: none;
  scroll-behavior: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  touch-action: pan-x;
  overscroll-behavior: contain;
}

.gallery-viewport::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.gallery-grid {
  display: flex;
  flex-direction: row;
  min-height: 100%;
  align-items: center;
  gap: var(--card-gap);
  width: max-content;
  margin: 0;
  padding: 0;
}

.gallery-spacer {
  flex: 0 0 auto;
  width: 0;
  height: 1px;
}

.gallery-card {
  --dock-scale: 1;
  flex: 0 0 auto;
  position: relative;
  z-index: 1;
  width: var(--card-size);
  height: var(--card-size);
  padding: 0;
  border: none;
  border-radius: var(--card-radius);
  background: transparent;
  overflow: visible;
  appearance: none;
  box-shadow: none;
  cursor: pointer;
  scroll-snap-align: center;
  scroll-snap-stop: always;
}

.gallery-card.is-centered {
  z-index: 2;
}

.gallery-card:focus-visible {
  outline: 2px solid var(--gallery-text);
  outline-offset: 4px;
}

.gallery-card-media,
.gallery-card-media svg,
.gallery-card-media .layer-stack {
  display: block;
  width: 100%;
  height: 100%;
}

.gallery-card-media {
  border-radius: inherit;
  overflow: hidden;
  pointer-events: none;
  transform: translateZ(0) scale(var(--dock-scale));
  transform-origin: center center;
  backface-visibility: hidden;
  will-change: auto;
  transition: transform 580ms cubic-bezier(0.22, 1, 0.36, 1);
}

.gallery-mobile-nav-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(8, 8, 8, 0.22);
  color: rgba(255, 255, 255, 0.94);
  appearance: none;
  box-shadow: none;
}

.gallery-mobile-nav-icon {
  width: 10px;
  height: 10px;
  border-top: 1.5px solid currentColor;
  border-right: 1.5px solid currentColor;
}

.gallery-mobile-nav-icon.is-prev {
  transform: rotate(-135deg);
}

.gallery-mobile-nav-icon.is-next {
  transform: rotate(45deg);
}

.gallery-card-media .layer-avatar {
  object-fit: cover;
}

.gallery-editor-sheet {
  position: absolute;
  left: 50%;
  bottom: 28px;
  z-index: 4;
  width: min(1260px, calc(100% - 56px));
  max-width: calc(100% - 56px);
  transform: translate(-50%, calc(100% + 28px));
  opacity: 0;
  pointer-events: none;
  overflow: visible;
  transition:
    transform 320ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 220ms ease;
  overscroll-behavior-x: contain;
}

.gallery-editor-sheet.is-visible {
  transform: translate(-50%, 0);
  opacity: 1;
}

.gallery-editor-surface {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 0;
  overscroll-behavior-x: contain;
  transform: translateY(0) scale(1);
  opacity: 1;
  filter: blur(0);
  transition:
    transform calc(var(--gallery-background-fade-ms) + 140ms) cubic-bezier(0.22, 1, 0.36, 1),
    opacity 220ms ease,
    filter 260ms ease;
  will-change: transform, opacity, filter;
}

.controls,
.gallery-action-rail {
  transition:
    transform calc(var(--gallery-background-fade-ms) + 160ms) cubic-bezier(0.22, 1, 0.36, 1),
    opacity 220ms ease;
  will-change: transform, opacity;
}

.gallery-editor-sheet.is-switching .gallery-editor-surface {
  transform: translateY(14px) scale(0.982);
  opacity: 0.18;
  filter: blur(10px);
}

.gallery-editor-sheet.is-switching .controls {
  transform: translateY(8px);
  opacity: 0.12;
}

.gallery-editor-sheet.is-switching .gallery-action-rail {
  transform: translateY(12px);
  opacity: 0.16;
}

.gallery-fade {
  position: absolute;
  top: 0;
  bottom: 0;
  width: var(--fade-width);
  pointer-events: none;
  z-index: 2;
}

.gallery-fade-left {
  left: 0;
  background: linear-gradient(
    to right,
    var(--gallery-bg) 0%,
    rgba(var(--gallery-bg-rgb), 1) 28%,
    rgba(var(--gallery-bg-rgb), 0.96) 46%,
    rgba(var(--gallery-bg-rgb), 0.82) 62%,
    rgba(var(--gallery-bg-rgb), 0.56) 78%,
    rgba(var(--gallery-bg-rgb), 0.24) 90%,
    rgba(var(--gallery-bg-rgb), 0) 100%
  );
}

.gallery-fade-right {
  right: 0;
  background: linear-gradient(
    to left,
    var(--gallery-bg) 0%,
    rgba(var(--gallery-bg-rgb), 1) 28%,
    rgba(var(--gallery-bg-rgb), 0.96) 46%,
    rgba(var(--gallery-bg-rgb), 0.82) 62%,
    rgba(var(--gallery-bg-rgb), 0.56) 78%,
    rgba(var(--gallery-bg-rgb), 0.24) 90%,
    rgba(var(--gallery-bg-rgb), 0) 100%
  );
}

.layer-stack {
  position: relative;
}

.layer-bg,
.layer-avatar {
  position: absolute;
  inset: 0;
}

.layer-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.editor-layout {
  position: relative;
  height: 100%;
  min-height: 100dvh;
  background: var(--canvas-bg);
  overflow: hidden;
}

.editor-canvas-wrap {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    clamp(84px, 10vh, 120px)
    clamp(320px, 28vw, 420px)
    clamp(56px, 8vh, 96px)
    clamp(28px, 5vw, 56px);
  background:
    radial-gradient(circle at 50% 40%, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0) 34%),
    radial-gradient(circle at 50% 72%, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0) 42%);
}

.editor-panel {
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  background: rgba(10, 10, 10, 0.84);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(26px);
}

.btn-back {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border-radius: 999px;
  padding: 12px 16px;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}

.editor-preview {
  width: min(760px, calc(100dvh - 168px), calc(100vw - 440px));
  aspect-ratio: 1 / 1;
  height: auto;
  max-width: 100%;
  margin: 0;
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
  background: #101010;
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.45);
}

.editor-preview svg,
.editor-preview .layer-stack {
  width: 100%;
  height: 100%;
  display: block;
}

.control-row,
.controls-reset,
.btn-download {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  height: 56px;
  padding: 0 16px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  pointer-events: auto;
}

.controls {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  min-width: max-content;
  overflow: visible;
  padding-right: 0;
  pointer-events: auto;
  overscroll-behavior-x: contain;
}

.control-row {
  flex-direction: row;
  align-items: center;
  gap: 12px;
  width: fit-content;
  min-width: 0;
  max-width: 100%;
  min-height: 56px;
  height: 56px;
  padding: 0 16px;
  pointer-events: auto;
  position: relative;
  overflow: visible;
}

.control-row-color {
  width: fit-content;
  min-width: 0;
  padding-inline: 10px 12px;
  z-index: 0;
}

.control-row-color-inline {
  min-width: 276px;
  padding-inline: 14px 16px;
}

.control-row-choice {
  min-width: 246px;
}

.control-row-range {
  min-width: 196px;
}

.control-row-range-minimal {
  min-width: 186px;
  padding-inline: 12px;
}

.control-row-range-minimal .control-inner,
.control-row-choice-minimal .control-inner {
  min-width: 0;
  width: 100%;
}

.control-row-choice-minimal {
  min-width: 166px;
  padding-inline: 8px;
}

.control-row-color.is-open {
  z-index: 12;
  border-color: rgba(255, 255, 255, 0.3);
  background: transparent;
  box-shadow: none;
}

.control-label {
  color: rgba(255, 255, 255, 0.56);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.control-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 152px;
  flex: 1 1 auto;
}

.control-row-color .control-inner {
  min-width: 0;
  width: auto;
  flex: 0 0 auto;
}

.control-row-color-inline .control-inner {
  width: 244px;
  min-width: 244px;
  gap: 14px;
}

.control-row-choice .control-inner {
  min-width: 0;
}

.choice-group {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  min-width: 0;
  padding: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.control-row-choice-minimal .choice-group {
  gap: 6px;
  padding: 0;
  background: transparent;
  box-shadow: none;
}

.choice-button {
  flex: 1 1 0;
  min-width: 0;
  height: 40px;
  padding: 0 14px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: rgba(255, 255, 255, 0.76);
  font-family: inherit;
  font-size: 15px;
  font-weight: 560;
  line-height: 1;
  letter-spacing: -0.02em;
  cursor: pointer;
  white-space: nowrap;
  transition:
    background-color 180ms ease,
    color 180ms ease,
    box-shadow 180ms ease;
  touch-action: manipulation;
}

.control-row-choice-minimal .choice-button {
  height: 42px;
  padding: 0 16px;
}

.choice-button:hover {
  color: rgba(255, 255, 255, 0.94);
}

.choice-button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.72);
}

.choice-button.is-active {
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.98);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.color-trigger {
  display: flex;
  align-items: center;
  gap: 12px;
  width: auto;
  min-width: 164px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.color-inline-swatch-control {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  cursor: pointer;
  flex: 0 0 auto;
}

.color-inline-native {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.color-inline-swatch {
  width: 34px;
  height: 34px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 8px 18px rgba(0, 0, 0, 0.18);
}

.color-inline-input {
  flex: 0 0 8ch;
  min-width: 8ch;
  width: 8ch;
  padding: 0;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.96);
  font-family: inherit;
  font-size: 19px;
  font-weight: 560;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  text-transform: uppercase;
  text-align: left;
}

.color-inline-input:focus {
  outline: none;
}

.color-inline-input.is-invalid {
  color: rgba(255, 130, 130, 0.96);
}

.color-trigger:focus-visible {
  outline: none;
}

.color-trigger:focus-visible .color-swatch {
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.9),
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 8px 18px rgba(0, 0, 0, 0.18);
}

.color-trigger-value,
.controls-reset,
.btn-download {
  font-size: 16px;
  font-weight: 560;
  line-height: 1;
  letter-spacing: -0.02em;
}

.color-trigger-value {
  display: inline-block;
  flex: 0 0 7ch;
  width: 7ch;
  min-width: 7ch;
  color: rgba(255, 255, 255, 0.96);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
}

.color-swatch,
.color-swatch-preview {
  display: block;
  width: 28px;
  height: 28px;
  border-radius: 999px;
}

.color-swatch {
  position: relative;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 8px 18px rgba(0, 0, 0, 0.18);
}

.color-swatch-preview {
  position: absolute;
  inset: 0;
}

.color-trigger-caret {
  width: 10px;
  height: 10px;
  margin-left: auto;
  flex: 0 0 auto;
  border-right: 1.5px solid rgba(255, 255, 255, 0.46);
  border-bottom: 1.5px solid rgba(255, 255, 255, 0.46);
  transform: translateY(-2px) rotate(45deg);
  transition: transform 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.control-row-color.is-open .color-trigger-caret {
  transform: translateY(2px) rotate(-135deg);
}

.color-popover {
  position: absolute;
  left: 0;
  bottom: calc(100% + 12px);
  min-width: 286px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(20, 20, 20, 0.92), rgba(9, 9, 9, 0.82));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 28px 60px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(24px) saturate(145%);
  -webkit-backdrop-filter: blur(24px) saturate(145%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(10px) scale(0.98);
  transform-origin: left bottom;
  transition:
    opacity 180ms ease,
    transform 240ms cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0s linear 240ms;
  touch-action: manipulation;
  overscroll-behavior: contain;
}

.control-row-color.is-open .color-popover {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
  transition-delay: 0s;
}

.color-popover-custom {
  display: grid;
  gap: 16px;
}

.color-popover-channels {
  display: grid;
  gap: 14px;
}

.color-channel-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) 58px;
  align-items: center;
  gap: 16px;
  min-height: 56px;
  padding: 2px 0;
}

.color-channel-label,
.color-channel-value {
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
  font-weight: 560;
  line-height: 1;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.color-channel-value {
  justify-self: end;
  color: rgba(255, 255, 255, 0.82);
  text-align: right;
}

.color-channel-slider {
  --track-gradient: linear-gradient(90deg, #ffffff, #ffffff);
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 36px;
  margin: 0;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: var(--track-gradient);
  box-shadow: none;
  outline: none;
  touch-action: none;
  cursor: ew-resize;
}

.color-channel-slider::-webkit-slider-runnable-track {
  height: 34px;
  border: none;
  border-radius: 999px;
  background: transparent;
}

.color-channel-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  margin-top: 5px;
  border: 1px solid rgba(112, 112, 112, 0.72);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: none;
}

.color-channel-slider::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border: 1px solid rgba(112, 112, 112, 0.72);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: none;
}

.color-channel-slider::-moz-range-track {
  height: 34px;
  border: none;
  border-radius: 999px;
  background: var(--track-gradient);
  box-shadow: none;
}

.color-popover-hex,
.range-value {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  font-weight: 560;
  line-height: 1;
  letter-spacing: -0.02em;
  padding: 0 16px;
}

.color-popover-hex {
  width: 100%;
  height: 50px;
  touch-action: manipulation;
}

.color-popover-hex:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.24);
}

.color-popover-hex.is-invalid {
  border-color: rgba(255, 130, 130, 0.48);
  color: rgba(255, 196, 196, 0.96);
}

.range-value {
  width: 78px;
  text-align: center;
  flex-shrink: 0;
}

.controls-reset {
  justify-content: center;
  min-width: 112px;
  padding-inline: 18px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: transparent;
  color: rgba(255, 255, 255, 0.82);
  cursor: pointer;
  white-space: nowrap;
  letter-spacing: -0.02em;
  pointer-events: auto;
}

.btn-upload {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--text);
  text-align: left;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  letter-spacing: -0.01em;
}

.gallery-action-rail {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  pointer-events: auto;
}

.btn-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  height: 56px;
  min-height: 56px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: transparent;
  color: rgba(255, 255, 255, 0.96);
  padding: 0 18px;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: none;
  letter-spacing: -0.02em;
}

.btn-download.loading {
  opacity: 0.6;
  cursor: wait;
}

.editor-hint {
  margin: 0;
  text-align: left;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.05em;
}

.range-input {
  --range-progress: 50%;
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 12px;
  margin: 0;
  border: none;
  border-radius: 999px;
  background:
    linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.92) 0%,
      rgba(255, 255, 255, 0.82) var(--range-progress),
      rgba(255, 255, 255, 0.18) var(--range-progress),
      rgba(255, 255, 255, 0.08) 100%
    );
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.14),
    inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  outline: none;
  touch-action: none;
  cursor: ew-resize;
}

.range-input::-webkit-slider-runnable-track {
  height: 12px;
  border: none;
  border-radius: 999px;
  background: transparent;
}

.range-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 28px;
  height: 28px;
  margin-top: -8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(232, 232, 232, 0.94));
  box-shadow:
    0 10px 20px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.64);
}

.range-input::-moz-range-track {
  height: 12px;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.14),
    inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.range-input::-moz-range-progress {
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.82));
}

.range-input::-moz-range-thumb {
  width: 28px;
  height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(232, 232, 232, 0.94));
  box-shadow:
    0 10px 20px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.64);
}

@media (min-width: 768px) {
  :root {
    --card-size: 292px;
    --card-gap: 132px;
    --logo-top: 34px;
    --logo-width: 56px;
  }

  body[data-mode="gallery"] {
    overflow: hidden;
  }

  .gallery-fade {
    display: none;
  }

  .gallery-viewport {
    -webkit-mask-image: none;
    mask-image: none;
  }

  .gallery-editor-sheet .btn-download {
    min-width: 0;
  }

  .control-row-color-inline {
    min-width: 224px;
    padding-inline: 12px 14px;
  }

  .control-row-color-inline .control-inner {
    width: 188px;
    min-width: 188px;
    gap: 12px;
  }

  .control-row-choice-minimal {
    min-width: 0;
    padding-inline: 6px;
  }

  .control-row-choice-minimal .control-inner,
  .control-row-choice-minimal .choice-group {
    width: auto;
  }

  .control-row-choice-minimal .choice-group {
    gap: 4px;
  }

  .control-row-choice-minimal .choice-button {
    flex: 0 0 auto;
    min-width: 48px;
    height: 38px;
    padding: 0 13px;
    font-size: 14px;
  }
}

@media (max-width: 767px) {
  :root {
    --frame-w: 402px;
    --frame-h: 874px;
    --card-size: 160px;
    --card-gap: 48px;
    --gallery-center-scale-boost: 0.12;
    --logo-top: 18px;
    --logo-width: 46px;
    --toolbar-side-pad: 16px;
  }

  .gallery-backgrounds {
    inset:
      calc(-1 * var(--safe-top) - 32px)
      calc(-1 * var(--safe-right) - 24px)
      calc(-1 * var(--safe-bottom) - 72px)
      calc(-1 * var(--safe-left) - 24px);
  }

  .gallery-fade {
    display: none;
  }

  .landing-shell,
  .gallery-shell {
    inset: 0;
    overflow: visible;
    touch-action: auto;
    z-index: 2;
  }

  .gallery-viewport {
    top: 50%;
    left: calc((var(--frame-w) * 0.5) - ((50vw) / var(--frame-scale)));
    right: auto;
    width: calc(100vw / var(--frame-scale));
    max-width: none;
    height: calc(var(--card-size) * 2.4);
    box-sizing: border-box;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    scroll-padding-inline: 0;
    touch-action: pan-x;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-mask-image: none;
    mask-image: none;
    transform: translateY(-50%);
  }

  .gallery-background-item {
    inset: 0;
  }

  .gallery-backgrounds::before,
  .gallery-backgrounds::after {
    left: calc(-1 * var(--safe-left) - 120px);
    right: calc(-1 * var(--safe-right) - 120px);
    opacity: 1;
    z-index: 2;
  }

  .gallery-backgrounds::before {
    top: 0;
    height: min(30svh, 228px);
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.96) 0%, rgba(0, 0, 0, 0.78) 34%, rgba(0, 0, 0, 0.34) 70%, rgba(0, 0, 0, 0) 100%);
  }

  .gallery-backgrounds::after {
    bottom: 0;
    height: min(36svh, 320px);
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.98) 0%, rgba(0, 0, 0, 0.88) 28%, rgba(0, 0, 0, 0.46) 62%, rgba(0, 0, 0, 0) 100%);
  }

  .gallery-background-item::after {
    background:
      linear-gradient(90deg, rgba(0, 0, 0, 0.46) 0%, rgba(0, 0, 0, 0.16) 14%, rgba(0, 0, 0, 0.16) 86%, rgba(0, 0, 0, 0.46) 100%),
      radial-gradient(circle at 50% 48%, rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0.26) 56%, rgba(0, 0, 0, 0.52) 100%),
      linear-gradient(180deg, rgba(0, 0, 0, 0.12) 0%, rgba(0, 0, 0, 0.54) 100%);
  }

  .gallery-background-media {
    transform: scale(1.08);
    filter: brightness(0.5) saturate(0.86);
  }

  .gallery-background-media.is-preprocessed {
    filter: none;
  }

  .gallery-background-media.is-video {
    transform: scale(1.1);
    filter: brightness(0.5) saturate(0.82);
  }

  .gallery-background-media.is-video.is-preprocessed {
    filter: none;
  }

  .gallery-grid {
    flex-direction: row;
    gap: var(--card-gap);
    width: max-content;
    min-width: 0;
    margin: 0;
    padding: 0;
  }

  .gallery-editor-sheet {
    width: min(332px, calc(100vw - 16px));
    max-width: calc(100vw - 16px);
    bottom: calc(16px + var(--safe-bottom) + var(--mobile-controls-lift));
  }

  .gallery-editor-surface {
    display: grid;
    justify-items: center;
    gap: 6px;
    width: 100%;
    will-change: auto;
  }

  .gallery-editor-sheet.is-switching .gallery-editor-surface {
    transform: translateY(12px) scale(0.992);
    opacity: 0.24;
    filter: none;
  }

  .gallery-editor-sheet.is-switching .controls,
  .gallery-editor-sheet.is-switching .gallery-action-rail {
    transform: translateY(8px);
    opacity: 0.16;
  }

  .gallery-card-media {
    backface-visibility: hidden;
    will-change: auto;
  }

  .gallery-card.is-centered .gallery-card-media {
    transform: translateZ(0) scale(var(--dock-scale));
  }

  .controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    min-width: 0;
    width: auto;
    max-width: 100%;
  }

  .control-row {
    width: fit-content;
    max-width: 100%;
    min-width: 0;
    flex: 0 1 auto;
    min-height: 52px;
    height: 52px;
  }

  .control-row-color .control-inner {
    width: 214px;
    min-width: 214px;
  }

  .control-row-color {
    min-width: 230px;
  }

  .control-row-color-inline {
    min-width: 230px;
    padding-inline: 12px 14px;
  }

  .hero-badge {
    min-height: 50px;
    height: 50px;
    max-width: min(52vw, 184px);
    padding: 0 16px;
    font-size: 15px;
  }

  .color-popover {
    left: 50%;
    right: auto;
    min-width: 0;
    width: min(292px, calc(100vw - 24px));
    transform: translate(-50%, 10px) scale(0.98);
    transform-origin: center bottom;
  }

  .control-row-color.is-open .color-popover {
    transform: translate(-50%, 0) scale(1);
  }

  .color-channel-row {
    grid-template-columns: 84px minmax(0, 1fr) 54px;
    gap: 12px;
    min-height: 52px;
  }

  .gallery-action-rail {
    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
    gap: 5px;
    width: auto;
    max-width: 100%;
  }

  #controls-reset {
    display: flex;
  }

  .controls-reset,
  .gallery-editor-sheet .btn-download {
    min-width: 116px;
    min-height: 52px;
    height: 52px;
    padding-inline: 15px;
  }

  .editor-layout {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 100dvh;
    padding: 14px 12px 18px;
    overflow-y: auto;
  }

  .editor-canvas-wrap {
    position: relative;
    inset: auto;
    order: 2;
    padding: 0;
    background: none;
  }

  .editor-preview {
    width: min(92vw, 560px);
    max-width: 100%;
  }

  .editor-panel {
    position: relative;
    top: auto;
    right: auto;
    bottom: auto;
    left: auto;
    width: 100%;
    max-height: none;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(18px);
  }

  .editor-panel-nav {
    order: 1;
    width: fit-content;
    padding: 8px;
  }

  .editor-panel-controls {
    order: 3;
    padding: 16px 14px 14px;
  }

  .editor-panel-meta {
    order: 4;
    padding: 12px 14px;
  }
}
