/* The onboarding start screen lives in start-screen.css. These rules serve the
   registration dialog, other start-input groups and the template launcher. */
.start-register-field input {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid rgba(120, 180, 255, .22);
  border-radius: 7px;
  outline: 0;
  background: rgba(5, 10, 18, .42);
  color: #f4f7fb;
  font: inherit;
  font-size: 14px;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.start-register-field input:focus {
  border-color: rgba(120, 180, 255, .62);
  background: rgba(8, 15, 27, .72);
  box-shadow: 0 0 0 2px rgba(120, 180, 255, .1);
}

.start-input-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.start-input-group[hidden] {
  display: none;
}

.start-input-group label {
  color: rgba(226, 234, 245, .47);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
}

.start-input-group input {
  box-sizing: border-box;
  width: 100%;
  min-height: 48px;
  padding: 0 2px;
  border: 0;
  border-bottom: 1px solid rgba(231, 238, 248, .22);
  border-radius: 0;
  background: transparent;
  color: #f4f7fb;
  font: inherit;
  font-size: 16px;
  letter-spacing: -.01em;
  transition: border-color 160ms ease, background 160ms ease;
}

.start-input-group input:focus {
  outline: none;
  border-color: #dfff72;
  background: linear-gradient(180deg, transparent 72%, rgba(223, 255, 114, .035));
}

.start-input-group input::placeholder {
  color: rgba(225, 233, 245, .22);
}

.start-message {
  display: none;
  margin: 0;
  padding: 10px 12px;
  border-left: 2px solid currentColor;
  background: rgba(4, 7, 13, .18);
  font-size: 11px;
  line-height: 1.45;
}

.start-message.error {
  display: block;
  color: #ffaaaa;
}

.start-message.success {
  display: block;
  color: #dfff72;
}

.start-register-modal {
  width: min(460px, calc(100vw - 32px));
  min-width: 0;
  max-width: 460px;
  border-color: rgba(117, 171, 235, .24);
  background: linear-gradient(145deg, rgba(20, 27, 40, .99), rgba(9, 13, 21, .99));
  box-shadow: 0 32px 100px rgba(0, 0, 0, .68), 0 0 0 1px rgba(118, 183, 255, .045);
}

.start-register-header {
  padding: 22px 24px;
}

.start-register-body {
  display: grid;
  gap: 15px;
  padding: 22px 24px 24px;
}

.start-register-field {
  display: grid;
  gap: 7px;
  color: rgba(226, 234, 245, .58);
  font-size: 10px;
  font-weight: 600;
}

.start-register-footer {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 18px 24px;
}

/* Template launcher utility styles retained outside onboarding. */
.start-welcome {
  margin-bottom: 20px;
  color: rgba(255,255,255,0.7);
  font-size: 13px;
  line-height: 1.5;
}

.start-welcome strong {
  color: var(--accent);
  font-weight: 600;
}

.start-links {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
}

#startOverlay.is-authenticated .start-onboarding-only {
  display: none;
}

/* Authenticated project-template launcher */
#startOverlay.is-authenticated {
  box-sizing: border-box;
  padding: 24px;
}

#startOverlay.is-authenticated #startCard {
  box-sizing: border-box;
  width: var(--project-launcher-width);
  height: min(780px, calc(100dvh - 40px));
  max-height: none;
}

#startOverlay.is-authenticated #startCardInner {
  display: block;
  box-sizing: border-box;
  height: 100%;
  min-height: 0;
  max-height: none;
  padding: 26px;
  overflow: hidden;
}

#startOverlay.is-authenticated .start-right {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  max-width: none;
  padding: 0;
}

#startOverlay.is-authenticated #startWelcome {
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.start-launcher-header {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 24px;
}

.start-launcher-header-controls {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 12px;
  min-width: 0;
  margin-left: auto;
}

.start-launcher-heading h1,
.start-launcher-heading h2 {
  font-family: var(--font-display);
  font-synthesis-weight: none;
  margin: 0;
  color: #f4f7fb;
  font-size: clamp(25px, 2.3vw, 36px);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.035em;
}

.start-launcher-heading .start-welcome {
  margin-bottom: 9px;
  color: rgba(224, 232, 245, 0.55);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.start-launcher-close {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  align-self: flex-start;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: rgba(222, 231, 243, 0.64);
  font: inherit;
  font-size: 25px;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  transition: color 140ms ease, border-color 140ms ease, background 140ms ease;
}

.start-launcher-close:hover {
  border-color: rgba(140, 169, 207, 0.24);
  background: rgba(116, 145, 185, 0.1);
  color: #f2f7fd;
}

.start-launcher-close:focus-visible {
  outline: 2px solid #8fc2ff;
  outline-offset: 2px;
}

.start-launcher-close:disabled {
  opacity: 0.4;
  cursor: default;
}

.start-template-status {
  min-height: 20px;
  margin-bottom: 8px;
  color: rgba(224, 232, 245, 0.52);
  font-size: 12px;
}

.start-template-status:empty {
  display: none;
}

.start-template-status.is-error {
  color: #ff9d9d;
}

.start-template-grid {
  position: relative;
  display: block;
  flex: 1;
  min-height: 180px;
  padding: 0;
  overflow: clip;
  perspective: 1000px;
  container-type: size;
  touch-action: pan-y;
  user-select: none;
  overscroll-behavior: contain;
}

.start-template-carousel {
  --carousel-accent: #8da8e8;
  --card-ratio: 1.777777778;
  --card-max-width: 580px;
  --card-viewport-width: 74cqw;
  position: relative;
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 270px;
  margin: 0 -26px;
  background: radial-gradient(ellipse at 50% 48%, color-mix(in srgb, var(--carousel-accent) 12%, transparent), transparent 64%);
  transition: background 400ms ease;
}

.start-template-carousel .start-template-card {
  position: absolute;
  top: 50%;
  left: 50%;
  box-sizing: border-box;
  width: min(var(--card-max-width), var(--card-viewport-width), calc(82cqh * var(--card-ratio)));
  height: min(calc(var(--card-max-width) / var(--card-ratio)), calc(var(--card-viewport-width) / var(--card-ratio)), 82cqh);
  padding: 10px;
  border-radius: 12px;
  transform: translate(-50%, -50%) translateX(calc(var(--card-offset, 0) * 87%))
    translateY(calc(var(--card-depth, 0) * 12px)) translateZ(calc(var(--card-depth, 0) * -180px))
    rotateY(calc(var(--card-direction, 0) * -22deg)) rotateZ(calc(var(--card-direction, 0) * 2deg));
  transition: transform 650ms cubic-bezier(.22,.75,.16,1), opacity 450ms ease,
    width 550ms cubic-bezier(.22,.75,.16,1), height 550ms cubic-bezier(.22,.75,.16,1);
  box-shadow: 0 24px 60px #0007;
  background: linear-gradient(145deg, #303440, #161a24 65%, #22232e);
}

.start-template-carousel .start-template-card.is-neighbor { opacity: .3; }
.start-template-carousel .start-template-card.is-distant { opacity: 0; pointer-events: none; }
.start-template-carousel .start-template-card.is-selected { border-color: #d5ddff70; box-shadow: 0 24px 60px #0007; }
.start-template-carousel .start-template-card:focus-visible { outline: none; }
.start-template-carousel .start-template-preview { position: absolute; inset: 10px; aspect-ratio: auto; border-radius: 5px; }
.start-template-carousel .start-template-preview > img,
.start-template-carousel .start-template-preview > video {
  object-position: calc(var(--preview-x, .5) * 100%) calc(var(--preview-y, .5) * 100%);
  transform: scale(var(--preview-zoom, 1));
  transform-origin: calc(var(--preview-x, .5) * 100%) calc(var(--preview-y, .5) * 100%);
}
.start-template-carousel .start-template-copy {
  position: absolute; inset: auto 10px 10px;
  padding: 40px 14px 12px;
  background: linear-gradient(transparent, #080b14e6);
  border-radius: 0 0 5px 5px;
}
.start-template-carousel .start-template-name {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
  white-space: normal; font-size: clamp(12px, 2cqw, 19px); font-weight: 500; line-height: 1.3;
}
.start-template-paper { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; }
/* WebGL owns the artwork. DOM options keep hit testing and keyboard focus,
   but legacy card hover/selection styles must never paint another surface. */
.start-template-carousel .has-paper .start-template-card { background: transparent; border-color: transparent; box-shadow: none; outline: none; }
.start-template-carousel .has-paper .start-template-card > * { visibility: hidden; }

.start-template-navigation { display: flex; align-items: center; justify-content: center; gap: 24px; padding: 12px 20px 0; }
.start-template-arrow {
  display: grid; place-items: center; width: 46px; height: 46px; flex: 0 0 auto;
  border: 1px solid #becdff30; border-radius: 50%; color: #e5e9f4;
  background: #a6b5e00a; font-size: 24px; cursor: pointer;
  transition: background 180ms ease, border-color 180ms ease;
}
.start-template-arrow:hover { background: #a6b5e022; border-color: #becdff80; }
.start-template-arrow:disabled { opacity: .3; cursor: default; }
.start-template-counter { min-width: 76px; text-align: center; color: #d9deecb0; font-size: 11px; letter-spacing: .2em; font-variant-numeric: tabular-nums; }
.start-template-arrow:focus-visible { outline: 2px solid #becdff; outline-offset: 3px; }

@media (max-width: 650px) {
  .start-template-carousel { margin: 0 -18px; min-height: 230px; }
  .start-template-navigation { gap: 12px; }
  #startOverlay.is-authenticated #startCardInner { overflow-y: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .start-template-carousel *, .start-template-carousel *::after { transition: none !important; }
}

.start-template-card {
  position: relative;
  display: block;
  min-width: 0;
  padding: 0;
  overflow: hidden;
  isolation: isolate;
  border: 1px solid rgba(140, 160, 192, .17);
  border-radius: 10px;
  background: linear-gradient(155deg, rgba(25, 33, 47, .94), rgba(12, 17, 27, .96));
  color: #edf2f9;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 130ms ease, border-color 130ms ease, background 130ms ease, box-shadow 130ms ease;
}

.start-template-grid:not(.has-paper) .start-template-card:hover {
  border-color: rgba(111, 175, 242, .42);
  background: linear-gradient(155deg, rgba(31, 43, 61, .98), rgba(13, 20, 32, .98));
}

.start-template-grid:not(.has-paper) .start-template-card:focus-visible {
  border: 2px solid #c2d8ff;
}

.start-template-grid:not(.has-paper) .start-template-card:active {
  border-color: #e0eaff;
}

.start-template-card:focus-visible {
  outline: 2px solid var(--template-accent);
  outline-offset: 2px;
}

.start-template-card.is-selected {
  border-color: rgba(111, 181, 255, .9);
  box-shadow: 0 0 0 2px rgba(74, 152, 238, .17), 0 16px 34px rgba(0, 0, 0, .25);
}

.start-template-preview {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #070b12;
}

.start-template-preview > img,
.start-template-preview > video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.01);
  transition: opacity 180ms ease, transform 220ms ease;
  z-index: 1;
}

.start-template-preview.has-image > img {
  opacity: 1;
}

.start-template-preview.has-image-error > img {
  display: none;
}

.start-template-copy {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 3px;
  min-width: 0;
  padding: 12px;
}

.start-template-name {
  display: block;
  overflow: hidden;
  margin: 0;
  color: #edf2f9;
  font-size: 12px;
  font-weight: 650;
  line-height: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.start-template-illustration {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-rows: 15px minmax(0, 1fr) 34px;
  overflow: hidden;
  background: linear-gradient(145deg, #101827, #070b13);
}

.start-template-illustration-chrome {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 8px;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
  background: rgba(4, 7, 13, .64);
}

.start-template-window-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgba(221, 232, 247, .34);
}

.start-template-illustration-stage {
  position: relative;
  overflow: hidden;
  margin: 7px 8px 5px;
  border: 1px solid rgba(170, 190, 220, .13);
  border-radius: 5px;
  background: #080d16;
}

.start-template-illustration-timeline {
  position: relative;
  display: grid;
  grid-template-rows: repeat(2, 7px);
  gap: 4px;
  padding: 6px 8px;
  border-top: 1px solid rgba(255, 255, 255, .06);
  background: rgba(3, 6, 11, .82);
}

.start-template-fake-clip {
  display: block;
  height: 7px;
  border-radius: 2px;
  background: color-mix(in srgb, var(--template-accent) 74%, #a8c5e8);
  opacity: .72;
}

.start-template-fake-clip.is-primary { width: 58%; }
.start-template-fake-clip.is-secondary { width: 37%; margin-left: 24%; opacity: .44; }
.start-template-fake-playhead {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 68%;
  width: 1px;
  background: rgba(255, 255, 255, .74);
  box-shadow: 0 0 6px rgba(255, 255, 255, .35);
}

.start-template-illustration.is-empty .start-template-illustration-stage {
  background:
    linear-gradient(rgba(117, 145, 184, .055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(117, 145, 184, .055) 1px, transparent 1px),
    #080d16;
  background-size: 17px 17px;
}

.start-template-empty-crosshair {
  position: absolute;
  top: 38%;
  left: 50%;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(172, 193, 222, .26);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.start-template-empty-crosshair::before,
.start-template-empty-crosshair::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  background: rgba(172, 193, 222, .24);
  transform: translate(-50%, -50%);
}
.start-template-empty-crosshair::before { width: 34px; height: 1px; }
.start-template-empty-crosshair::after { width: 1px; height: 34px; }
.start-template-empty-prompt {
  position: absolute;
  right: 0;
  bottom: 12px;
  left: 0;
  color: rgba(210, 221, 238, .35);
  font-size: 7px;
  letter-spacing: .12em;
  text-align: center;
  text-transform: uppercase;
}

.start-template-illustration.is-video .start-template-illustration-stage {
  background: linear-gradient(155deg, #314661 0%, #18253a 46%, #d27462 100%);
}
.start-template-video-sun {
  position: absolute;
  top: 12%;
  right: 20%;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #f9c67c;
  box-shadow: 0 0 20px rgba(250, 187, 109, .55);
}
.start-template-video-horizon {
  position: absolute;
  right: -7%;
  bottom: -34%;
  left: -7%;
  height: 74%;
  background: linear-gradient(155deg, #0d1725 0 46%, #172e3c 47% 100%);
  clip-path: polygon(0 66%, 19% 25%, 42% 58%, 63% 13%, 82% 45%, 100% 21%, 100% 100%, 0 100%);
}
.start-template-video-play {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border: 1px solid rgba(255, 255, 255, .36);
  border-radius: 50%;
  background: rgba(3, 7, 13, .42);
  color: rgba(255, 255, 255, .82);
  font-size: 8px;
  transform: translate(-50%, -50%);
}

.start-template-illustration.is-media-text .start-template-illustration-stage {
  background:
    radial-gradient(circle at 76% 22%, rgba(255, 182, 221, .8), transparent 21%),
    linear-gradient(135deg, #37225f 0%, #8b2f67 52%, #da6b72 100%);
}
.start-template-media-frame {
  position: absolute;
  top: -9%;
  right: 8%;
  width: 39%;
  height: 120%;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 40% 40% 12% 12%;
  background: linear-gradient(160deg, rgba(255, 219, 206, .68), rgba(79, 21, 72, .25));
  transform: rotate(7deg);
}
.start-template-media-kicker,
.start-template-media-title {
  position: absolute;
  left: 9%;
  color: #fff6fa;
  text-shadow: 0 2px 8px rgba(41, 7, 32, .45);
}
.start-template-media-kicker { top: 23%; font-size: 5px; letter-spacing: .2em; }
.start-template-media-title { top: 34%; font-size: 15px; font-weight: 900; line-height: .86; white-space: pre-line; }

.start-aspect-ratio {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.start-aspect-ratio legend {
  margin: 0 0 7px;
  padding: 0;
  color: rgba(224, 232, 245, 0.55);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.start-aspect-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  width: min(40vw, 390px);
}

.start-aspect-option {
  position: relative;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 50px;
  padding: 6px 9px 6px 6px;
  border: 1px solid rgba(152, 172, 202, 0.18);
  border-radius: 10px;
  background: rgba(13, 20, 32, 0.72);
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.start-aspect-option:hover {
  transform: translateY(-1px);
  border-color: rgba(120, 180, 255, 0.46);
  background: rgba(21, 31, 48, 0.9);
}

.start-aspect-option:has(input:checked) {
  border-color: rgba(120, 180, 255, 0.9);
  background: linear-gradient(135deg, rgba(64, 116, 181, 0.24), rgba(19, 29, 45, 0.92));
  box-shadow: 0 0 0 1px rgba(120, 180, 255, 0.18), 0 8px 22px rgba(0, 0, 0, 0.2);
}

.start-aspect-option:has(input:focus-visible) {
  outline: 2px solid #8fc2ff;
  outline-offset: 2px;
}

.start-aspect-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.start-aspect-preview {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 7px;
  background: rgba(3, 9, 17, 0.58);
}

.start-aspect-frame {
  display: block;
  border: 1px solid rgba(176, 204, 236, 0.48);
  border-radius: 3px;
  background:
    linear-gradient(rgba(120, 180, 255, 0.13) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 180, 255, 0.13) 1px, transparent 1px),
    linear-gradient(145deg, rgba(120, 180, 255, 0.28), rgba(82, 72, 184, 0.12));
  background-size: 7px 7px, 7px 7px, auto;
  box-shadow: inset 0 0 10px rgba(120, 180, 255, 0.08);
}

.start-aspect-frame.is-horizontal {
  width: 26px;
  height: 15px;
}

.start-aspect-frame.is-vertical {
  width: 15px;
  height: 26px;
}

.start-aspect-frame.is-square {
  width: 22px;
  height: 22px;
}

.start-aspect-option:has(input:checked) .start-aspect-frame {
  border-color: #9dcaff;
  box-shadow: 0 0 10px rgba(120, 180, 255, 0.26), inset 0 0 10px rgba(120, 180, 255, 0.16);
}

.start-aspect-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.start-aspect-copy strong {
  color: rgba(237, 244, 252, 0.8);
  font-size: 10px;
  font-weight: 650;
}

.start-aspect-copy small {
  color: rgba(213, 224, 240, 0.4);
  font-size: 8px;
}

.start-aspect-option:has(input:checked) .start-aspect-copy strong {
  color: #f3f8ff;
}

.start-launcher-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid rgba(162, 181, 210, 0.13);
}

.start-launcher-footer .start-links {
  flex-direction: row;
  align-items: center;
  margin-top: 0;
  gap: 18px;
}

.start-project-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

#startOverlay.is-authenticated .start-project-button,
.project-browser-modal .start-project-button {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 180px;
  min-width: 180px;
  height: 42px;
  min-height: 42px;
  margin: 0;
  padding: 0 16px;
  line-height: 1;
  white-space: nowrap;
}

.start-register-modal .start-register-footer .start-project-button {
  width: 100%;
  min-width: 0;
}

.start-launcher-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

#startOverlay.is-authenticated .start-launcher-actions .start-btn {
  width: auto;
  min-width: 164px;
  min-height: 42px;
  margin: 0;
  padding: 0 20px;
}

#startOverlay.is-authenticated #progressRow {
  display: none;
}

@media (max-width: 650px) {
  #startOverlay.is-authenticated {
    padding: 10px;
  }

  #startOverlay.is-authenticated #startCard {
    height: calc(100dvh - 20px);
  }

  #startOverlay.is-authenticated #startCardInner {
    padding: 18px;
  }

  .start-launcher-header,
  .start-launcher-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .start-launcher-header-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    width: 100%;
    margin-left: 0;
  }

  .start-launcher-heading {
    padding-right: 44px;
  }

  .start-launcher-header-controls .start-launcher-close {
    position: absolute;
    top: 0;
    right: 0;
  }

  .start-aspect-options {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
  }

  .start-launcher-footer .start-links {
    justify-content: space-between;
  }

  .start-project-actions {
    width: 100%;
  }

  #startOverlay.is-authenticated .start-project-button {
    flex: 1;
    width: auto;
    min-width: 0;
  }

  .project-browser-modal .start-project-button {
    flex: 1;
    width: auto;
    min-width: 0;
  }

  .start-launcher-actions > * {
    flex: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .start-continue-tooltip {
    transition: none;
  }
}

/* Progress row */
#progressRow {
  margin-top: 16px;
  width: 100%;
}

/* Responsive: stack on mobile */
@media (max-width: 800px) {
  #startCardInner {
    flex-direction: column;
    padding: 12px;
    gap: 20px;
  }
  .start-right {
    min-width: auto;
    max-width: none;
    width: 100%;
    padding: 8px 12px 12px;
  }
}

/* Settings Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}
.modal-overlay.show {
  opacity: 1;
  visibility: visible;
}
.modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  min-width: 280px;
  max-width: 90%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.modal-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.modal-title svg {
  opacity: 0.6;
}
.modal-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: var(--text);
}
.modal-row:last-of-type {
  border-bottom: none;
}
.modal-row label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.modal-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
}
.modal-row input[type="number"] {
  width: 70px;
  padding: 4px 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 12px;
}
.modal-row select {
  padding: 4px 8px;
  background: #1a1d24;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 4px;
  color: var(--text);
  font-size: 12px;
}
.modal-row select option {
  background: #1a1d24;
  color: #e0e0e0;
}
.modal-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.modal-btn {
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  transition: all 0.15s;
}
.modal-btn:hover {
  background: rgba(255,255,255,0.1);
}
.modal-btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.modal-btn.primary:hover {
  filter: brightness(1.1);
}

/* Settings Modal Rows */
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  color: var(--text);
}
.settings-row:last-child {
  border-bottom: none;
}
.settings-row label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}
.settings-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}
.settings-row input[type="number"],
.settings-row select {
  padding: 6px 10px;
  background: #1a1d24;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  min-width: 100px;
}
.settings-row input[type="number"]:focus,
.settings-row select:focus {
  outline: none;
  border-color: var(--accent);
}
.settings-row select option {
  background: #1a1d24;
  color: #e0e0e0;
}

/* Video Export Modal */
.export-modal {
  max-width: 520px;
  width: 90%;
}
.export-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  background: var(--bg);
  padding: 4px;
  border-radius: 8px;
}
.export-tab {
  flex: 1;
  padding: 10px 16px;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.export-tab:hover {
  color: var(--text);
  background: rgba(255,255,255,0.05);
}
.export-tab.active {
  background: rgba(120,180,255,0.15);
  color: var(--accent);
}
.export-tab-badge {
  display: inline-block;
  padding: 2px 6px;
  background: rgba(120,180,255,0.2);
  border-radius: 4px;
  font-size: 9px;
  margin-left: 6px;
  text-transform: uppercase;
}
.export-section {
  margin-bottom: 16px;
}
.export-section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}
.export-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--line2);
}
.export-option:last-child {
  border-bottom: none;
}
.export-option-label {
  font-size: 13px;
  color: var(--text);
}
.export-option-hint {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}
.export-select {
  padding: 8px 12px;
  background: #1a1d24;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 6px;
  color: var(--text);
  font-size: 12px;
  min-width: 140px;
  cursor: pointer;
}
.export-select:focus {
  outline: none;
  border-color: var(--accent);
}
.export-select option {
  background: #1a1d24;
  color: #e0e0e0;
}
.export-info-box {
  background: rgba(120,180,255,0.08);
  border: 1px solid rgba(120,180,255,0.2);
  border-radius: 8px;
  padding: 12px;
  margin-top: 16px;
}
.export-info-box.warning {
  background: rgba(255,200,100,0.08);
  border-color: rgba(255,200,100,0.3);
}
.export-info-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.export-info-box.warning .export-info-title {
  color: var(--gold);
}
.export-info-text {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}
.export-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.export-btn {
  flex: 1;
  padding: 12px 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.export-btn-secondary {
  background: transparent;
  color: var(--muted);
}
.export-btn-secondary:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text);
}
.export-btn-primary {
  background: linear-gradient(135deg, rgba(120,180,255,0.25), rgba(100,160,240,0.15));
  border-color: rgba(120,180,255,0.4);
  color: var(--accent);
}
.export-btn-primary:hover {
  background: linear-gradient(135deg, rgba(120,180,255,0.35), rgba(100,160,240,0.25));
}
.export-btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Interactive HTML Export */
.html-export-modal {
  width: min(680px, calc(100vw - 32px));
  max-width: 680px;
  max-height: min(90vh, calc(100dvh - 32px));
}
.html-export-eyebrow {
  margin-bottom: 4px;
  color: var(--accent);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.html-export-intro {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}
.html-export-section {
  margin: 0 0 18px;
  padding: 0 14px;
  border: 1px solid var(--line2);
  border-radius: 9px;
  background: rgba(2, 7, 14, .24);
}
.html-export-section > .export-section-title {
  margin: 0 -14px;
  padding: 10px 14px 0;
}
.html-export-section .export-option {
  gap: 20px;
}
.html-export-section .export-option > div:first-child,
.html-export-check-row > span:first-child {
  min-width: 0;
  flex: 1;
}
.html-export-check-row {
  cursor: pointer;
}
.html-export-check-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  accent-color: var(--accent);
  cursor: pointer;
}
.html-export-section .export-select {
  max-width: 240px;
}
.html-export-section .export-select:disabled,
.html-export-section input:disabled {
  opacity: .42;
  cursor: not-allowed;
}
.html-export-section.is-disabled {
  display: none;
}
.html-export-text-input {
  width: min(240px, 45%);
  min-width: 150px;
  padding: 8px 10px;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 6px;
  outline: none;
  color: var(--text);
  background: #1a1d24;
  font: 12px/1.2 inherit;
}
.html-export-text-input:focus {
  border-color: var(--accent);
}
.html-export-snippet-section {
  margin: 4px 0 0;
  padding: 14px;
  border: 1px solid rgba(120,180,255,.2);
  border-radius: 9px;
  background: rgba(5, 10, 18, .8);
}
.html-export-snippet-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}
.html-export-snippet-heading .export-section-title {
  margin-bottom: 4px;
}
.html-export-copy {
  flex: 0 0 auto;
  padding: 7px 10px;
  border: 1px solid rgba(120,180,255,.34);
  border-radius: 6px;
  color: var(--accent);
  background: rgba(120,180,255,.1);
  font: 600 11px/1 inherit;
  cursor: pointer;
}
.html-export-copy:hover {
  background: rgba(120,180,255,.18);
}
#htmlExportSnippet {
  display: block;
  width: 100%;
  min-height: 108px;
  resize: vertical;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  outline: none;
  color: #b9d8f5;
  background: #070b12;
  font: 10px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre;
}
#htmlExportSnippet:focus {
  border-color: rgba(120,180,255,.5);
}
.html-export-footer .export-btn {
  flex: 0 1 150px;
}
@media (max-width: 600px) {
  .html-export-section .export-option {
    align-items: flex-start;
    gap: 10px;
  }
  .html-export-section .export-select,
  .html-export-text-input {
    width: 46%;
    min-width: 130px;
  }
}

/* Export Progress Modal */
.export-progress-modal {
  max-width: 480px;
  width: 90%;
}
.export-progress-preview {
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 20px;
  aspect-ratio: 16/9;
  display: flex;
  align-items: center;
  justify-content: center;
}
.export-progress-preview canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.export-progress-bar-container {
  background: var(--bg);
  border-radius: 6px;
  height: 8px;
  overflow: hidden;
  margin-bottom: 12px;
}
.export-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), rgba(120,180,255,0.6));
  border-radius: 6px;
  transition: width 0.1s;
  width: 0%;
}
.export-progress-stats {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 16px;
}
.export-progress-status {
  font-size: 13px;
  color: var(--text);
  text-align: center;
  margin-bottom: 8px;
}
.export-progress-detail {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
}
.export-complete-icon {
  font-size: 48px;
  text-align: center;
  margin-bottom: 16px;
}
.export-complete-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  margin-bottom: 8px;
}
.export-complete-subtitle {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  margin-bottom: 20px;
}
.export-toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  cursor: pointer;
}
.export-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}
.export-toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 24px;
  transition: all 0.2s;
}
.export-toggle-slider:before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 2px;
  bottom: 2px;
  background: var(--muted);
  border-radius: 50%;
  transition: all 0.2s;
}
.export-toggle input:checked + .export-toggle-slider {
  background: rgba(120,180,255,0.2);
  border-color: rgba(120,180,255,0.4);
}
.export-toggle input:checked + .export-toggle-slider:before {
  transform: translateX(20px);
  background: var(--accent);
}

#startCard .btn.start-btn,
.project-browser-modal .btn.start-btn,
.start-register-modal .btn.start-btn{
  width: 100%;
  padding: 14px 24px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: normal;
  text-transform: none;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(120,180,255,0.2), rgba(100,160,240,0.1));
  border: 1px solid rgba(120,180,255,0.3);
  color: rgba(200,225,255,0.95);
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}
#startCard .btn.start-btn::before,
.project-browser-modal .btn.start-btn::before,
.start-register-modal .btn.start-btn::before{
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.1) 0%, transparent 50%);
  border-radius: 7px;
}
#startCard .btn.start-btn:hover,
.project-browser-modal .btn.start-btn:hover,
.start-register-modal .btn.start-btn:hover{
  background: linear-gradient(135deg, rgba(120,180,255,0.3), rgba(100,160,240,0.2));
  border-color: rgba(120,180,255,0.5);
  box-shadow: 0 4px 24px rgba(120,180,255,0.25);
  transform: translateY(-1px);
}
#startCard .btn.start-btn:active,
.project-browser-modal .btn.start-btn:active,
.start-register-modal .btn.start-btn:active{
  transform: translateY(0);
}
#startCard .btn.start-btn:disabled,
.project-browser-modal .btn.start-btn:disabled,
.start-register-modal .btn.start-btn:disabled{
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}
#progressRow{
  display:flex; 
  gap:10px; 
  align-items:center; 
  margin-top:14px;
  width: 100%;
  opacity: 0;
  transition: opacity 0.3s ease;
}
#progressRow.visible{
  opacity: 1;
}
#progressBar{
  flex:1;
  height:5px;
  border-radius:999px;
  background: rgba(255,255,255,.06);
  overflow:hidden;
  border:1px solid rgba(255,255,255,0.08);
}
#progressFill{
  height:100%;
  width:0%;
  background: linear-gradient(90deg, rgba(100,160,240,.6), rgba(140,200,255,.8));
  box-shadow: 0 0 12px rgba(120,180,255,0.4);
  transition: width 0.3s ease;
}
#progressText{
  font-size: 10px;
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.08);
}

/* Root-level particle preset library */
.particle-preset-selector { z-index: 2250; padding: 22px; }
.particle-preset-modal {
  width: min(1420px, calc(100vw - 44px));
  max-width: none;
  height: min(850px, calc(100dvh - 44px));
  max-height: none;
  min-width: 0;
  border-color: rgba(142, 165, 190, .26);
  background: linear-gradient(145deg, #111925, #090d15 72%);
}
.particle-preset-header { box-sizing: border-box; display: flex; align-items: center; gap: 18px; min-height: 76px; padding: 16px 20px; flex-shrink: 0; }
.particle-preset-header h2 { margin: 0; font-size: 19px; line-height: 1.3; white-space: nowrap; }
.particle-preset-header .particle-preset-search { flex: 0 1 340px; margin-left: auto; }
.particle-preset-header .particle-preset-result-count { color: var(--muted); font-size: 10px; white-space: nowrap; }
.particle-preset-header .demo-modal-close { flex: 0 0 30px; }
.cloner-preset-companion {
  margin: 0 0 12px;
  padding: 9px 11px;
  border: 1px solid rgba(139, 111, 255, .3);
  border-radius: 6px;
  background: rgba(102, 72, 196, .12);
  color: #d7ccff;
  font: 650 9px/1.45 var(--mono, monospace);
}
.particle-preset-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(4, 8, 14, .52);
}
.particle-preset-search {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 180px;
  height: 39px;
  padding: 0 8px 0 12px;
  border: 1px solid rgba(132, 173, 215, .23);
  border-radius: 7px;
  background: rgba(1, 5, 10, .72);
}
.particle-preset-search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(103, 174, 255, .12);
}
.particle-preset-search > svg { flex: 0 0 18px; display: block; color: var(--muted); }
.particle-preset-search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  box-sizing: border-box;
  display: block;
  width: 100%;
  margin: 0;
  padding: 0 10px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: 500 12px/20px var(--mono, monospace);
}
.particle-preset-search .editor-search-field { display: flex; align-items: center; height: 100%; }
.particle-preset-search button {
  width: 27px;
  height: 27px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-size: 17px;
  cursor: pointer;
}
.particle-preset-search button:hover { background: rgba(255, 255, 255, .07); color: var(--text); }
.particle-preset-toolbar > span {
  color: var(--muted);
  font: 650 9px/1 var(--mono, monospace);
  white-space: nowrap;
}
.particle-preset-layout {
  display: grid;
  grid-template-columns: 150px minmax(420px, .9fr) minmax(420px, 1.1fr);
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.particle-preset-categories {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 10px;
  border-right: 1px solid var(--line);
  background: rgba(4, 8, 14, .44);
}
.particle-preset-category {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font: 620 10px/1 var(--mono, monospace);
  text-align: left;
  cursor: pointer;
}
.particle-preset-category:hover { background: rgba(255, 255, 255, .045); color: var(--text); }
.particle-preset-category.is-active {
  border-color: rgba(126, 186, 244, .4);
  background: rgba(78, 137, 193, .16);
  color: #dcecff;
}
.particle-preset-category small {
  min-width: 22px;
  padding: 3px 5px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .28);
  color: inherit;
  font-size: 8px;
  text-align: center;
}
.particle-preset-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  gap: 8px;
  min-height: 0;
  padding: 12px;
  overflow: auto;
  overscroll-behavior: contain;
}
.particle-preset-card {
  display: grid;
  grid-template-columns: 102px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 86px;
  padding: 7px;
  border: 1px solid rgba(134, 168, 205, .18);
  border-radius: 8px;
  background: linear-gradient(145deg, rgba(24, 34, 49, .82), rgba(8, 13, 22, .92));
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .15s;
  content-visibility: auto;
  contain-intrinsic-size: auto 86px;
}
.particle-preset-card:hover {
  border-color: rgba(126, 186, 244, .52);
  background: linear-gradient(145deg, rgba(31, 49, 70, .88), rgba(10, 19, 31, .94));
  transform: translateY(-1px);
}
.particle-preset-card.is-selected {
  border-color: #7cadd6;
  box-shadow: inset 3px 0 0 #7cadd6;
  background: linear-gradient(120deg, rgba(46, 79, 109, .48), rgba(18, 25, 38, .92));
}
.particle-preset-card canvas {
  display: block;
  width: 102px;
  height: 70px;
  border: 1px solid rgba(139, 189, 236, .16);
  border-radius: 6px;
  background: #02050a;
}
.particle-preset-card > span { display: grid; gap: 4px; min-width: 0; }
.particle-preset-card small {
  color: #a8c9e6;
  font: 780 7.5px/1 var(--mono, monospace);
  letter-spacing: .11em;
  text-transform: uppercase;
}
.particle-preset-card strong {
  overflow: hidden;
  font: 680 11px/1.25 var(--mono, monospace);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.particle-preset-card em {
  overflow: hidden;
  color: var(--muted);
  font: 500 8.5px/1.25 var(--mono, monospace);
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.particle-preset-empty {
  grid-column: 1 / -1;
  padding: 36px 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  font-size: 11px;
}
.particle-preset-detail {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-left: 1px solid var(--line);
  background: #050911;
}
.particle-preset-stage {
  position: relative;
  flex: 1;
  min-height: 280px;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: #02050a;
}
.particle-preset-stage canvas { display: block; width: 100%; height: 100%; }
.procedural-preset-selector .particle-preset-detail { min-height: 0; overflow-y: auto; }
.procedural-preset-selector .particle-preset-stage { flex: 0 0 260px; min-height: 0; }
.procedural-preset-selector .particle-preset-toolbar { flex-wrap: wrap; }
.procedural-preset-selector [data-status]:empty { display: none; }
.procedural-preset-selector [data-save-form] input { max-width: 100%; }
.particle-preset-stage > span {
  position: absolute;
  top: 13px;
  left: 13px;
  padding: 6px 8px;
  border: 1px solid rgba(133, 191, 244, .25);
  border-radius: 5px;
  background: rgba(2, 7, 13, .72);
  color: #d8ecff;
  backdrop-filter: blur(8px);
  font: 700 8px/1 var(--mono, monospace);
  letter-spacing: .08em;
  text-transform: uppercase;
}
.particle-preset-detail-copy { padding: 15px 17px 17px; }
.particle-preset-detail-copy > span {
  color: #a8c9e6;
  font: 780 8px/1 var(--mono, monospace);
  letter-spacing: .12em;
  text-transform: uppercase;
}
.particle-preset-detail-copy h3 { margin: 6px 0 7px; font-size: 17px; }
.particle-preset-detail-copy p {
  margin: 0 0 12px;
  color: var(--muted);
  font: 500 10px/1.48 var(--mono, monospace);
}
.particle-preset-module-list { display: flex; flex-wrap: wrap; gap: 5px; }
.particle-preset-module-list span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 7px;
  border: 1px solid rgba(132, 173, 215, .18);
  border-radius: 5px;
  background: rgba(20, 34, 50, .5);
  color: #c9d8e8;
  font: 580 8px/1 var(--mono, monospace);
}
.particle-preset-module-list b { color: #a8c9e6; font-size: 7px; }
.particle-preset-footer { align-items: center; justify-content: flex-end; }
.particle-preset-footer > span {
  margin-right: auto;
  color: var(--muted);
  font: 500 9px/1.3 var(--mono, monospace);
}
.particle-preset-footer kbd {
  padding: 2px 5px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(0, 0, 0, .28);
}
@media (max-width: 1050px) {
  .particle-preset-layout { grid-template-columns: 130px minmax(350px, 1fr) minmax(330px, .9fr); }
  .particle-preset-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .particle-preset-selector { padding: 10px; }
  .particle-preset-modal { width: calc(100vw - 20px); height: calc(100dvh - 20px); }
  .particle-preset-layout { grid-template-columns: 1fr; overflow: auto; }
  .particle-preset-categories { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .particle-preset-category { width: auto; min-width: max-content; }
  .particle-preset-grid { min-height: 360px; overflow: visible; }
  .particle-preset-detail { min-height: 430px; border-left: 0; border-top: 1px solid var(--line); }
  .particle-preset-footer > span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .particle-preset-card { transition: none; }
}

/* Actual scene captures retain their full 4:3 framing in both library views. */
.particle-recipe-selector .particle-preset-card { grid-template-columns: 128px minmax(0, 1fr); min-height: 112px; }
.particle-recipe-selector .particle-preset-card img { display: block; width: 128px; height: 96px; object-fit: contain; border-radius: 5px; background: #101722; }
.particle-recipe-selector .particle-preset-detail { min-height: 0; overflow-y: auto; }
.particle-recipe-selector .particle-preset-stage { flex: 0 0 auto; aspect-ratio: 4 / 3; min-height: 0; background: #101722; }
.particle-recipe-selector .particle-preset-stage img { display: block; width: 100%; height: 100%; object-fit: contain; }
.particle-recipe-selector [data-particle-companions] { color: #c4d8e8; }
.particle-recipe-selector .particle-preset-detail[hidden] { display: none; }
.particle-recipe-selector .particle-preset-card strong { white-space: normal; overflow: visible; line-height: 1.35; }
.particle-recipe-selector .particle-preset-stage { flex-basis: min(36vh, 340px); height: min(36vh, 340px); aspect-ratio: auto; }

.physics-preset-selector .particle-preset-stage video {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.physics-preset-selector .particle-preset-stage [hidden] { display: none; }
.physics-preset-selector .physics-preset-try { color: #d3e5f1; padding: 12px; background: #ffffff08; border-radius: 8px; line-height: 1.5; }
.physics-preset-selector .particle-preset-stage video { object-fit: contain; }
@media (min-width: 761px) and (max-width: 1100px) {
  .particle-preset-selector .particle-preset-layout { grid-template-columns: 110px minmax(0, 1fr) minmax(0, 1fr); }
  .particle-preset-selector .particle-preset-grid { grid-template-columns: 1fr; }
  .particle-preset-selector .particle-preset-card { grid-template-columns: 90px minmax(0, 1fr); }
  .particle-preset-selector .particle-preset-card img { width: 90px; height: 80px; }
}
@media (max-width: 760px) {
  .particle-preset-selector .particle-preset-layout { display: flex; flex-direction: column; }
  .particle-preset-selector .particle-preset-categories { flex: 0 0 auto; }
  .particle-preset-selector .particle-preset-grid { flex: 0 0 260px; min-height: 0; overflow-y: auto; }
  .particle-preset-selector .particle-preset-detail { flex: 0 0 auto; overflow: visible; }
  .physics-preset-selector .particle-preset-footer { flex-wrap: wrap; }
  .physics-preset-selector .particle-preset-footer > span { display: block; flex: 1 0 100%; }
}
@media (min-width: 761px) and (max-width: 1100px) {
  .particle-preset-selector .particle-preset-category { gap: 4px; padding: 0 6px; }
  .particle-preset-selector .particle-preset-category span { min-width: 0; overflow-wrap: anywhere; line-height: 1.2; }
  .particle-preset-selector .particle-preset-category small { flex: 0 0 auto; min-width: 18px; padding: 3px; }
}

@media (max-width: 760px) {
  .particle-preset-header { gap: 12px; flex-wrap: wrap; padding: 14px 16px; }
  .particle-preset-header h2 { flex: 1; font-size: 17px; }
  .particle-preset-header .particle-preset-search { order: 3; flex: 1 0 100%; margin: 0; min-width: 0; }
  .particle-preset-toolbar { flex-wrap: wrap; }
}

/* Preview media shares the image framing in both WebGL and CSS fallback. */
.start-template-carousel .start-template-video { z-index: 2; opacity: 0; pointer-events: none; }
.start-template-carousel .has-preview-video .start-template-video { opacity: 1; }
.start-template-motion { display: block; margin: 14px auto 8px; padding: 4px 10px; border: 0; background: transparent; color: #aabbd2; font: inherit; font-size: 10px; cursor: pointer; }
.start-template-motion:hover, .start-template-motion:focus-visible { color: #e4edff; }
.start-template-motion:disabled { opacity: .5; cursor: default; }

.cloud-preset-picker {
  display: grid; gap: 5px; width: 100%; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 7px; background: var(--panel);
  color: var(--text); text-align: left; cursor: pointer; font: inherit;
}
.cloud-preset-picker strong { font-size: 11px; font-weight: 500; line-height: 1.4; }
.cloud-preset-picker small { color: var(--muted); font-size: 10px; }
.cloud-preset-picker:hover { background: rgba(255, 255, 255, .06); }
.cloud-preset-picker:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cloud-preset-selector .particle-preset-card img,
.cloud-preset-selector .particle-preset-stage { background: #7397ba; }
@media (max-width: 760px) {
  .cloud-preset-selector .particle-preset-grid { grid-template-columns: 1fr; }
  .cloud-preset-selector .particle-preset-layout { overflow-y: auto; }
  .cloud-preset-selector .particle-preset-stage { flex-basis: 180px; height: 180px; }
}

.cloner-preset-selector .particle-preset-stage video { display: block; width: 100%; height: 100%; object-fit: contain; }
.cloner-preset-selector .particle-preset-stage [hidden] { display: none; }
@media (max-width: 760px) {
  .cloner-preset-selector .particle-preset-grid { grid-template-columns: 1fr; }
  .cloner-preset-selector .particle-preset-layout { overflow-y: auto; }
  .cloner-preset-selector .particle-preset-stage { flex-basis: 180px; height: 180px; }
}
.splat-library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.splat-library-grid .splat-library-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  position: relative;
  padding: 0 0 14px;
  overflow: hidden;
  text-align: left;
}
.splat-library-image { aspect-ratio: 4 / 3; background: #101319; overflow: hidden; }
.splat-library-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.splat-library-placeholder { display: grid; place-items: center; height: 100%; font-size: 56px; color: #819aab; }
.splat-library-card .asset-item-name { padding: 12px 14px 4px; white-space: normal; font-size: 14px; }
.splat-library-description { padding: 0 14px; min-height: 34px; font-size: 12px; line-height: 1.45; color: var(--text-muted, #a5a9b2); }
.splat-library-credit { padding: 10px 14px 0; font-size: 10px; line-height: 1.4; color: var(--text-muted, #a5a9b2); }
.asset-browser-header:has(#splatSearchInput) { align-items: flex-start; }
.asset-filter-tabs:has(#splatSearchInput) { flex: 1; min-width: 0; flex-wrap: wrap; }
.asset-filter-tabs .editor-search-field:has(#splatSearchInput) { flex: 1 0 100%; width: 100%; min-width: 0; }
#splatSearchInput {
  flex: 1 0 100%; width: 100%; min-width: 0; box-sizing: border-box;
  padding: 9px 12px; border: 1px solid var(--line); border-radius: 6px;
  background: #0c1017; color: var(--text); font: inherit;
}
.asset-filter-tabs:has(#splatSearchInput) .asset-filter-tab { padding: 6px 9px; font-size: 12px; white-space: nowrap; }

/* Author styles must preserve the Local agent dialog’s conditional buttons. */
#localAgentDialog [hidden] { display: none !important; }

/* First-use local agent consent: one decision, no setup wizard. */
#agentConsentDialog {
  width: min(430px, calc(100vw - 48px));
  box-sizing: border-box;
  padding: 28px;
  border: 1px solid #44464c;
  border-radius: 16px;
  background: #202126;
  color: #f2f2f4;
  box-shadow: 0 24px 90px #0008;
}
#agentConsentDialog::backdrop { background: #08090cb3; backdrop-filter: blur(5px); }
#agentConsentDialog .agent-consent-eyebrow { color: #9da4af; font-size: 10px; letter-spacing: .12em; margin-bottom: 16px; }
#agentConsentDialog h2 { font-size: 23px; line-height: 1.3; font-weight: 600; margin: 0 0 14px; }
#agentConsentDescription { color: #b6bac4; font-size: 13px; line-height: 1.65; margin: 0; }
#agentConsentStatus { color: #b6bac4; font-size: 12px; margin: 12px 0; }
#agentConsentDialog .agent-consent-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
#agentConsentDialog .btn { min-width: 84px; min-height: 36px; }

/* Canvas formats share the same compact picker in Settings and Templates. */
.start-aspect-ratio > select { width: min(290px, 45vw); padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--fg); font: inherit; font-size: 12px; }
.viewport-dimensions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; max-width: 300px; }
.viewport-dimensions[hidden] { display: none; }
.viewport-dimensions label { display: grid; gap: 5px; color: var(--muted); font-size: 11px; }
.viewport-dimensions input { width: 100%; min-width: 0; box-sizing: border-box; background: var(--panel); color: var(--fg); border: 1px solid var(--line); border-radius: 6px; padding: 8px; font: inherit; font-variant-numeric: tabular-nums; }
.viewport-dimensions small { grid-column: 1 / -1; color: var(--muted); font-size: 10px; }
