:root {
  color-scheme: dark;
  --bg: #0c0d0d;
  --surface: #141616;
  --surface-2: #1a1d1d;
  --ink: #f1eee9;
  --muted: #9a9690;
  --line: #292c2c;
  --line-strong: #3a3d3d;
  --accent: #c96b34;
  --accent-2: #df8955;
  --accent-soft: rgba(201, 107, 52, 0.14);
  --graphite: #202222;
  --topbar-bg: rgba(12, 13, 13, 0.94);
  --panel-bg: rgba(20, 22, 22, 0.92);
  --subtle-bg: rgba(255, 255, 255, 0.035);
  --switch-bg: rgba(255, 255, 255, 0.035);
  --preview-bg: #111313;
  --log-bg: #101111;
  --log-ink: #f1eee9;
  --scene-bg-1: #111313;
  --scene-bg-2: #0c0d0d;
  --loader-overlay-bg: rgba(12, 13, 13, 0.72);
  --loader-track: rgba(255, 255, 255, 0.08);
  --success: #138a64;
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  min-height: 2.55rem;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 780;
  cursor: pointer;
  padding: 0.55rem 0.85rem;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, color 160ms ease;
}

button:hover,
.file-button:hover {
  border-color: color-mix(in srgb, var(--accent) 62%, var(--line-strong));
  color: var(--ink);
  transform: translateY(-1px);
}

button.accent {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
  box-shadow: none;
}

button.ghost {
  background: var(--subtle-bg);
}

button.compact {
  min-height: 2.15rem;
  padding: 0.35rem 0.65rem;
  font-size: 0.82rem;
}

button:disabled {
  cursor: progress;
  opacity: 0.55;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 1.05rem;
}

h2 {
  font-size: clamp(1.65rem, 3vw, 2.8rem);
  letter-spacing: 0;
}

h3 {
  font-size: 1rem;
}

small,
.eyebrow,
.panel-copy {
  color: var(--muted);
}

.eyebrow {
  margin-bottom: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0;
  font-size: 0.72rem;
  font-weight: 850;
}

.eyebrow:empty {
  display: none;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  min-height: 4.9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem clamp(1rem, 2vw, 1.65rem);
  border-bottom: 1px solid var(--line);
  background: var(--topbar-bg);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 5;
}

.brand,
.topbar-left,
.topbar-controls,
.topbar-tabs,
.section-head,
.viewer-header,
.viewer-tools,
.action-grid {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.brand {
  gap: 0.85rem;
}

.topbar-left {
  min-width: 0;
  flex: 1;
  gap: clamp(1.8rem, 4vw, 5rem);
}

.mark {
  width: 2.3rem;
  height: 2.3rem;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--ink);
  color: var(--accent-2);
  font-weight: 900;
}

.topbar-controls {
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.nav-action,
.account-button {
  min-height: 2.25rem;
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 999px;
  padding-inline: 0.95rem;
}

.account-button.developer {
  border-color: var(--accent);
  color: var(--accent-2);
}

.account-panel {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: clamp(1rem, 3vw, 3rem);
  background:
    radial-gradient(circle at 80% 12%, rgba(201, 107, 52, 0.16), transparent 34rem),
    rgba(5, 6, 6, 0.94);
  backdrop-filter: blur(18px);
}

.account-card {
  width: min(76rem, calc(100vw - 2rem));
  min-height: min(43rem, calc(100vh - 2rem));
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(22rem, 1fr);
  gap: clamp(1.2rem, 3vw, 3rem);
  padding: clamp(1rem, 3vw, 2rem);
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.012)),
    var(--surface);
  box-shadow: var(--shadow);
}

.auth-card {
  align-items: stretch;
}

.auth-copy {
  min-height: 100%;
  display: grid;
  align-content: end;
  gap: 1rem;
  padding: clamp(1rem, 3vw, 2.6rem);
  border-radius: 14px;
  overflow: hidden;
  position: relative;
  background:
    linear-gradient(145deg, rgba(5, 6, 6, 0.1), rgba(5, 6, 6, 0.72)),
    url("./assets/frame-lab-hero.png") 62% center / cover;
}

.auth-copy::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(5, 6, 6, 0.84), rgba(5, 6, 6, 0.08));
}

.auth-copy > * {
  position: relative;
  z-index: 1;
}

.auth-copy h2 {
  max-width: 9ch;
  font-size: clamp(2.6rem, 6vw, 5.2rem);
  line-height: 0.96;
}

.auth-copy p:not(.eyebrow) {
  max-width: 28rem;
  color: rgba(241, 238, 233, 0.72);
  line-height: 1.55;
}

.auth-form,
.account-profile,
.payment-form {
  display: grid;
  align-content: center;
  gap: 0.95rem;
  padding: clamp(0.5rem, 3vw, 2rem);
}

.auth-field {
  display: grid;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.auth-mode {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
  padding: 0.25rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--subtle-bg);
}

.auth-mode button {
  min-height: 2.45rem;
  border-radius: 999px;
}

.auth-mode button.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #160b03;
}

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

.password-field {
  position: relative;
}

.password-field input {
  padding-right: 4.6rem;
}

.password-field button {
  position: absolute;
  right: 0.42rem;
  bottom: 0.42rem;
  min-height: 2.2rem;
  padding-inline: 0.75rem;
  border-radius: 999px;
  font-size: 0.75rem;
}

.plans-card {
  width: min(82rem, calc(100vw - 2rem));
  min-height: auto;
  grid-template-columns: 1fr;
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(0.85rem, 1.6vw, 1.25rem);
}

.pricing-card {
  display: grid;
  gap: 0.9rem;
  align-content: start;
  min-height: 21rem;
  padding: clamp(1rem, 2vw, 1.45rem);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--subtle-bg);
}

.pricing-card.featured {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent-soft) 70%, transparent);
}

.pricing-card span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
  text-transform: uppercase;
}

.pricing-card strong {
  font-size: clamp(2.2rem, 3.8vw, 4rem);
  line-height: 1;
}

.price-line {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.price-line small {
  min-height: 0;
  padding-bottom: 0.25rem;
}

.pricing-card small {
  min-height: 2.6rem;
  line-height: 1.35;
}

.plan-grid,
.account-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
}

.account-actions {
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
}

.oauth-actions,
.billing-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
}

.billing-switch {
  padding: 0.25rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
}

.billing-switch button {
  min-height: 2.65rem;
  border-radius: 999px;
}

.billing-switch button.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #150b04;
}

.plan-option.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-2);
}

.account-note {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--subtle-bg);
}

.profile-avatar {
  width: 3rem;
  height: 3rem;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--ink);
  color: var(--accent);
  font-weight: 900;
}

.profile-card strong,
.profile-card small {
  display: block;
}

.profile-card small {
  margin-top: 0.12rem;
  color: var(--muted);
}

.profile-details {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
  margin: 0;
}

.profile-details div {
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--subtle-bg);
}

.profile-details dt {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.profile-details dd {
  margin: 0.25rem 0 0;
  font-weight: 850;
}

.payment-card {
  width: min(72rem, calc(100vw - 2rem));
  min-height: auto;
}

.payment-copy {
  display: grid;
  align-content: end;
  gap: 1rem;
  padding: clamp(1rem, 3vw, 2.6rem);
  border-radius: 14px;
  background:
    linear-gradient(145deg, rgba(201, 107, 52, 0.22), rgba(5, 6, 6, 0.82)),
    var(--surface-2);
}

.payment-copy h2 {
  max-width: 9ch;
  font-size: clamp(2.6rem, 6vw, 5.2rem);
  line-height: 0.96;
}

.payment-copy p:not(.eyebrow) {
  max-width: 27rem;
  color: rgba(241, 238, 233, 0.72);
  line-height: 1.55;
}

.payment-total {
  display: flex;
  align-items: end;
  gap: 0.35rem;
  padding: 1rem 0;
}

.payment-total span {
  font-size: clamp(2.5rem, 5vw, 4.8rem);
  font-weight: 900;
  line-height: 1;
}

.payment-total small {
  padding-bottom: 0.35rem;
}

.payment-row {
  display: grid;
  grid-template-columns: 1fr 0.72fr;
  gap: 0.75rem;
}

.crop-card {
  width: min(78rem, calc(100vw - 2rem));
  min-height: auto;
  grid-template-columns: 1fr;
}

.crop-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(18rem, 0.38fr);
  gap: clamp(1rem, 2vw, 1.5rem);
  align-items: start;
}

.crop-stage {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--preview-bg);
}

#cropCanvas {
  width: 100%;
  display: block;
  aspect-ratio: 64 / 42;
}

.crop-controls {
  display: grid;
  gap: 0.9rem;
}

.crop-controls input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.nav-link {
  min-height: 2rem;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  position: relative;
  padding: 0.35rem 0;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 760;
  transition: color 160ms ease;
}

.nav-link:hover,
.nav-link.active {
  color: var(--ink);
}

.nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0.1rem;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 180ms ease;
}

.nav-link:hover::after,
.nav-link.active::after {
  transform: scaleX(1);
}

.file-button {
  min-height: 2.55rem;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 780;
  cursor: pointer;
  padding: 0.55rem 0.85rem;
}

.file-button input {
  display: none;
}

.accent-file {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
  box-shadow: none;
}

.accent-file:hover {
  color: white;
}

.home-page[hidden],
.workspace[hidden],
.studio-panel[hidden],
.hidden-utility {
  display: none;
}

.hidden-utility,
[hidden] {
  display: none !important;
}

.workspace {
  height: calc(100vh - 4.9rem);
  min-height: 36rem;
  position: relative;
  overflow: hidden;
  padding: 0;
}

.home-page {
  background: var(--bg);
}

.anchor-target {
  position: absolute;
  top: 0;
}

.hero-page {
  min-height: calc(100vh - 4.9rem);
  position: relative;
  display: grid;
  align-items: end;
  overflow: hidden;
  padding: clamp(5rem, 9vw, 9rem) clamp(1.2rem, 6vw, 6rem) clamp(3rem, 6vw, 5rem);
  border-bottom: 1px solid var(--line);
  background: #050606;
}

.hero-copy {
  position: relative;
  z-index: 2;
  max-width: 52rem;
  animation: heroRise 700ms ease both;
}

.hero-kicker {
  margin-bottom: 1.1rem;
  color: color-mix(in srgb, var(--accent-2) 80%, white);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero-copy h2 {
  max-width: 12ch;
  font-size: clamp(3.6rem, 9vw, 8.8rem);
  line-height: 0.96;
  font-weight: 900;
  text-wrap: balance;
}

.hero-copy p:not(.hero-kicker) {
  max-width: 35rem;
  margin-top: 1.35rem;
  color: rgba(241, 238, 233, 0.74);
  font-size: clamp(1.05rem, 1.35vw, 1.35rem);
  line-height: 1.45;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2rem;
}

.hero-actions button {
  min-width: 10.5rem;
}

.hero-product {
  position: absolute;
  inset: 0;
  min-height: 100%;
  transform: none;
  opacity: 1;
  overflow: hidden;
  border-radius: 0;
  border: 0;
  background: #050606;
}

.hero-product::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(5, 6, 6, 0.96) 0%, rgba(5, 6, 6, 0.76) 30%, rgba(5, 6, 6, 0.18) 68%, rgba(5, 6, 6, 0.52) 100%),
    linear-gradient(0deg, rgba(5, 6, 6, 0.72) 0%, transparent 42%);
}

.hero-product img {
  width: 100%;
  height: 100%;
  min-height: inherit;
  display: block;
  object-fit: cover;
  object-position: 62% center;
  animation: heroImage 1200ms ease both;
}

.viewer-panel,
.config-panel {
  min-width: 0;
  min-height: 0;
}

.viewer-panel {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: linear-gradient(140deg, var(--scene-bg-1), var(--scene-bg-2) 62%);
  box-shadow: none;
}

#scene {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 100%;
  cursor: grab;
  touch-action: none;
}

#scene:active {
  cursor: grabbing;
}

.config-panel {
  position: absolute;
  top: 1rem;
  right: 1rem;
  bottom: 1rem;
  z-index: 2;
  width: min(28rem, calc(100% - 2rem));
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 0.85rem;
  pointer-events: none;
}

.config-panel > * {
  pointer-events: auto;
}

.panel-section {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-bg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.model-card {
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
}

.panel-copy {
  margin-top: 0.65rem;
  line-height: 1.45;
  font-size: 0.9rem;
}

.section-head {
  justify-content: space-between;
  margin-bottom: 0.85rem;
}

.endpoint-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.55rem;
  margin-top: 0.9rem;
}

.endpoint-row label {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.endpoint-row input {
  min-width: 0;
}

input[type="url"],
input[type="number"],
input[type="text"],
input[type="email"],
input[type="password"] {
  min-height: 2.55rem;
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--subtle-bg);
  color: var(--ink);
  padding: 0 0.75rem;
}

.controls {
  display: grid;
  gap: 0.65rem;
}

.builder-controls {
  display: grid;
  gap: 0.7rem;
}

.component-card {
  display: grid;
  gap: 0.7rem;
  padding: 0.78rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--subtle-bg);
}

.component-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 0.65rem;
}

.component-color {
  width: 1.9rem;
  height: 1.9rem;
  flex: 0 0 auto;
  overflow: hidden;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
}

.component-color input {
  width: 2.4rem;
  height: 2.4rem;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

.component-head strong {
  display: block;
  font-size: 0.9rem;
}

.component-head small {
  display: block;
  margin-top: 0.08rem;
  font-size: 0.72rem;
  font-weight: 650;
}

.component-option-grid {
  display: grid;
  gap: 0.45rem;
  max-height: 18rem;
  overflow: auto;
  padding-right: 0.15rem;
}

.component-options {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--subtle-bg) 74%, transparent);
}

.component-options summary {
  min-height: 2.35rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.7rem;
  color: var(--ink);
  cursor: pointer;
  font-weight: 850;
}

.component-options summary::after {
  content: "⌄";
  color: var(--accent-2);
}

.component-options[open] summary {
  border-bottom: 1px solid var(--line);
}

.component-options[open] summary::after {
  transform: rotate(180deg);
}

.component-options .component-option-grid {
  padding: 0.55rem;
}

.component-option {
  height: auto;
  min-height: 4.25rem;
  display: grid;
  grid-template-columns: 4.9rem minmax(0, 1fr);
  gap: 0.6rem;
  align-items: center;
  padding: 0.45rem 0.55rem;
  border-color: var(--line);
  background: var(--subtle-bg);
  text-align: left;
}

.component-option.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 28%, transparent);
}

.component-option-canvas {
  width: 100%;
  height: 3.35rem;
  display: block;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--preview-bg);
}

.component-option-main {
  min-width: 0;
  display: grid;
  gap: 0.1rem;
}

.component-option-main strong,
.component-option-main small {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.component-option-main small {
  color: var(--muted);
  font-size: 0.72rem;
}

.component-select {
  width: 100%;
  min-height: 2.35rem;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 0.7rem;
  font: inherit;
  font-weight: 760;
}

.size-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
}

.size-chip {
  min-height: 2.15rem;
  padding: 0.35rem 0.55rem;
  border-radius: 7px;
}

.size-chip.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-2);
}

.compatibility-note {
  padding: 0.62rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--subtle-bg);
  color: var(--accent-2);
  font-size: 0.75rem;
  font-weight: 800;
}

.control {
  display: grid;
  grid-template-columns: minmax(7.5rem, 1fr) minmax(8rem, 1.15fr) 4.8rem;
  align-items: center;
  gap: 0.65rem;
  padding: 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--subtle-bg);
}

.control label {
  min-width: 0;
  display: grid;
  gap: 0.12rem;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 800;
}

.control label small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.72rem;
  font-weight: 650;
}

.control input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.control output {
  min-height: 2.1rem;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  font-weight: 850;
  font-size: 0.82rem;
}

.action-grid {
  flex-wrap: wrap;
  align-items: stretch;
  margin-bottom: 0.75rem;
}

.action-grid button {
  flex: 1 1 8rem;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-2);
  font-size: 0.75rem;
  font-weight: 850;
}

.import-log,
.scad-preview {
  width: 100%;
  margin: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--log-bg);
  color: var(--log-ink);
  font-size: 0.76rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

.import-log {
  max-height: 8rem;
  padding: 0.75rem;
}

.scad-preview {
  max-height: 22rem;
  padding: 0.85rem;
}

.code-section {
  padding-bottom: 0.75rem;
}

.gallery-panel,
.studio-panel {
  min-height: calc(100vh - 4.9rem);
  padding: clamp(1rem, 3vw, 3rem);
}

.gallery-head,
.studio-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 86rem;
  margin: 0 auto 1.2rem;
}

.gallery-head h2,
.studio-head h2 {
  font-size: clamp(2rem, 4vw, 4.4rem);
  line-height: 1;
}

.collection-section {
  max-width: 86rem;
  margin: 0 auto 2.6rem;
}

.collection-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.collection-head h3 {
  font-size: clamp(1.3rem, 2vw, 2rem);
}

.collection-head span {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 740;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr));
  gap: 0.9rem;
}

.gallery-card {
  min-height: 21rem;
  display: grid;
  grid-template-rows: 12rem auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: none;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
  animation: cardIn 520ms ease both;
}

.gallery-card:hover {
  transform: translateY(-3px);
  border-color: var(--line-strong);
}

.gallery-card.active {
  border-color: var(--accent);
}

.gallery-card.locked .gallery-thumb,
.gallery-card.locked .gallery-body {
  opacity: 0.68;
}

.gallery-thumb {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: var(--preview-bg);
}

.gallery-thumb img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform 260ms ease;
}

.gallery-card:hover .gallery-thumb img {
  transform: scale(1.035);
}

.gallery-placeholder {
  width: 5.6rem;
  height: 3.05rem;
  border: 0.48rem solid var(--graphite);
  border-radius: 1rem;
  box-shadow:
    5.6rem 0 0 -0.5rem var(--preview-bg),
    5.6rem 0 0 0 var(--graphite);
}

.gallery-placeholder-2 {
  transform: scaleX(1.08);
}

.gallery-placeholder-3 {
  transform: scaleY(0.92);
  border-radius: 0.7rem 1.4rem 1.1rem 0.9rem;
}

.gallery-placeholder-4 {
  transform: scale(0.94) rotate(-2deg);
}

.gallery-placeholder-5 {
  transform: scaleX(1.14) scaleY(1.03);
}

.gallery-body {
  display: grid;
  align-content: space-between;
  gap: 0.9rem;
  padding: 1rem;
}

.gallery-title-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
}

.gallery-body h3 {
  overflow-wrap: anywhere;
  font-size: 1.05rem;
}

.gallery-meta {
  margin-top: 0.3rem;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 750;
  line-height: 1.35;
}

.gallery-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.gallery-actions button {
  flex: 1 1 7rem;
}

.access-badge {
  display: inline-flex;
  align-items: center;
  min-height: 1.7rem;
  padding: 0.2rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
}

.access-free {
  border-color: #3d4642;
  color: #b7c2bc;
}

.access-pro {
  border-color: #c96b34;
  background: rgba(201, 107, 52, 0.12);
  color: #df8955;
}

.access-studio {
  border-color: #8a6cff;
  background: rgba(138, 108, 255, 0.13);
  color: #b9a8ff;
}

.delete-button {
  color: #9d2f11;
}

.studio-card,
.component-import-panel {
  max-width: 86rem;
  margin: 0 auto 1rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.studio-grid {
  display: grid;
  grid-template-columns: minmax(13rem, 1fr) minmax(10rem, 0.55fr);
  gap: 0.65rem;
}

.studio-grid input,
.studio-grid label,
.studio-grid button {
  min-width: 0;
}

.studio-grid #collectionDescription,
.studio-grid #addCollection {
  grid-column: 1 / -1;
}

.component-import-grid {
  display: grid;
  grid-template-columns: minmax(12rem, 1.4fr) minmax(8rem, 0.8fr) minmax(5rem, 0.5fr) minmax(7rem, 0.7fr) auto auto;
  gap: 0.65rem;
  align-items: center;
}

.component-file-list {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.9rem;
}

.component-file-row {
  display: grid;
  grid-template-columns: minmax(10rem, 1fr) auto auto auto auto auto;
  gap: 0.55rem;
  align-items: center;
  padding: 0.65rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--subtle-bg);
}

.component-file-row strong {
  overflow-wrap: anywhere;
}

.component-file-row small {
  font-weight: 750;
}

.material-swatch {
  min-height: 1.9rem;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 850;
}

.material-swatch::before {
  content: "";
  width: 1.05rem;
  height: 1.05rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--swatch);
}

.loader-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: var(--loader-overlay-bg);
  backdrop-filter: blur(12px);
}

.loader-overlay[hidden] {
  display: none;
}

.loader-card {
  width: min(24rem, calc(100% - 2rem));
  display: grid;
  justify-items: center;
  gap: 0.7rem;
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: center;
}

.loader-ring {
  width: 3rem;
  height: 3rem;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 999px;
  animation: spin 0.8s linear infinite;
}

.loader-bar {
  width: 100%;
  height: 0.45rem;
  overflow: hidden;
  border-radius: 999px;
  background: var(--loader-track);
}

.loader-bar span {
  display: block;
  width: 45%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: scan 1.15s ease-in-out infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes scan {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(230%);
  }
}

@media (max-width: 1050px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-left {
    width: 100%;
    justify-content: space-between;
  }

  .workspace {
    height: calc(100vh - 4.9rem);
    min-height: 40rem;
  }

  .config-panel {
    overflow: auto;
  }

  .account-card {
    grid-template-columns: 1fr;
    overflow: auto;
  }

  .auth-copy {
    min-height: 18rem;
  }
}

@media (max-width: 680px) {
  .topbar,
  .topbar-left,
  .gallery-head,
  .studio-head,
  .collection-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-tabs {
    width: 100%;
    flex: 1 1 auto;
  }

  .pricing-grid {
    grid-template-columns: 1fr;
  }

  .account-panel {
    padding: 0.75rem;
  }

  .account-card {
    min-height: calc(100vh - 1.5rem);
    border-radius: 14px;
  }

  .auth-copy {
    min-height: 11rem;
  }

  .auth-copy h2 {
    font-size: clamp(2.2rem, 12vw, 3.5rem);
  }

  .auth-form {
    align-content: start;
    padding: 0.25rem;
  }

  .profile-details,
  .payment-row,
  .crop-layout {
    grid-template-columns: 1fr;
  }

  .pricing-card {
    min-height: auto;
  }

  .account-actions {
    grid-template-columns: 1fr;
  }

  .nav-link {
    flex: 1;
  }

  .workspace {
    height: calc(100vh - 8.5rem);
    min-height: 43rem;
  }

  .hero-page {
    min-height: calc(100vh - 8.5rem);
    padding-block: 4rem 2.5rem;
  }

  .hero-copy h2 {
    font-size: clamp(2.8rem, 17vw, 4.5rem);
  }

  .hero-product {
    min-height: 100%;
  }

  .hero-product img {
    object-position: 68% center;
  }

  .control {
    grid-template-columns: 1fr;
  }

  .studio-grid,
  .component-import-grid,
  .component-file-row {
    grid-template-columns: 1fr;
  }

  .studio-grid #collectionDescription,
  .studio-grid #addCollection {
    grid-column: auto;
  }

  .config-panel {
    inset: auto 0.75rem 0.75rem;
    max-height: 58%;
    width: auto;
  }
}

@keyframes heroRise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes heroImage {
  from {
    opacity: 0.72;
    transform: scale(1.035);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
