:root {
  color-scheme: dark;
  --ink: #090a09;
  --surface: #111210;
  --surface-2: #181a17;
  --surface-3: #20221f;
  --line: rgba(239, 241, 228, 0.14);
  --line-strong: rgba(239, 241, 228, 0.28);
  --paper: #eff1e4;
  --muted: #92988d;
  --dim: #646a61;
  --acid: #c7ff4a;
  --acid-dark: #8ab52c;
  --danger: #ff684c;
  --panel-width: clamp(370px, 31vw, 470px);
  --header-height: 58px;
  --ease: cubic-bezier(.22, .8, .22, 1);
  --display: "Arial Narrow", "Aptos Display", "Bahnschrift Condensed", sans-serif;
  --body: Inter, "Aptos", "Segoe UI", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

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

body {
  overflow: hidden;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--body);
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 2px solid var(--acid);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 1000;
  transform: translateY(-150%);
  background: var(--acid);
  color: var(--ink);
  padding: 10px 14px;
  font-weight: 800;
  text-decoration: none;
}

.skip-link:focus {
  transform: none;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.app-shell {
  min-height: 100dvh;
  background:
    linear-gradient(115deg, transparent 0 76%, rgba(199, 255, 74, .025) 76% 76.15%, transparent 76.15%),
    var(--ink);
}

.topbar {
  height: var(--header-height);
  display: grid;
  grid-template-columns: 1fr auto var(--panel-width);
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: rgba(9, 10, 9, .92);
  backdrop-filter: blur(14px);
  position: relative;
  z-index: 30;
}

.brand {
  height: 100%;
  display: inline-flex;
  align-items: center;
  gap: 11px;
  width: fit-content;
  padding: 0 22px;
  color: var(--paper);
  text-decoration: none;
  font: 800 14px/1 var(--mono);
  letter-spacing: -.04em;
}

.brand-mark {
  position: relative;
  width: 14px;
  height: 14px;
  border: 1px solid var(--acid);
  transform: rotate(45deg);
}

.brand-mark::after {
  content: "";
  position: absolute;
  inset: 3px;
  background: var(--acid);
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-right: 24px;
  color: var(--muted);
  font: 10px/1 var(--mono);
  letter-spacing: .12em;
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--acid);
  box-shadow: 0 0 14px var(--acid);
  animation: live 2.2s ease-in-out infinite;
}

.session-id {
  padding-left: 10px;
  border-left: 1px solid var(--line);
}

.session-id b {
  color: var(--paper);
  font-weight: 500;
}

.icon-button {
  justify-self: end;
  width: 56px;
  height: 100%;
  border: 0;
  border-left: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
  color: var(--muted);
  transition: color 180ms ease, background 180ms ease;
}

.icon-button span {
  width: 21px;
  height: 21px;
  border: 1px solid currentColor;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  font: 12px/1 var(--mono);
}

.icon-button:hover {
  color: var(--ink);
  background: var(--acid);
}

.workspace {
  height: calc(100dvh - var(--header-height));
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--panel-width);
  min-height: 0;
  overflow: hidden;
}

.stage {
  position: relative;
  overflow: hidden;
  min-width: 0;
  isolation: isolate;
  background:
    radial-gradient(circle at 50% 50%, #1d211c 0, #0c0e0c 42%, #070807 76%),
    var(--ink);
}

.stage::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 72px 72px;
  -webkit-mask-image: radial-gradient(circle at center, rgba(0,0,0,.6), transparent 76%);
  mask-image: radial-gradient(circle at center, rgba(0,0,0,.6), transparent 76%);
}

.stage::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(0,0,0,.28), transparent 14%, transparent 84%, rgba(0,0,0,.32)),
    linear-gradient(0deg, rgba(0,0,0,.56), transparent 20%, transparent 80%, rgba(0,0,0,.2));
}

#webglCanvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  z-index: 2;
  cursor: grab;
  touch-action: none;
}

#webglCanvas:active {
  cursor: grabbing;
}

.stage-fallback {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: grid;
  place-content: center;
  text-align: center;
  background: var(--ink);
  padding: 24px;
}

.stage-fallback[hidden] {
  display: none;
}

.stage-fallback p {
  margin: 0 0 8px;
  font: 700 clamp(24px, 4vw, 48px)/1 var(--display);
  text-transform: uppercase;
}

.stage-fallback span {
  color: var(--muted);
}

.stage-topline,
.stage-readout,
.stage-index,
.interaction-hint,
.stage-upload {
  position: absolute;
  z-index: 6;
}

.stage-topline {
  inset: 18px 22px auto;
  display: flex;
  justify-content: space-between;
  color: rgba(239,241,228,.56);
  font: 9px/1 var(--mono);
  letter-spacing: .15em;
}

.stage-topline::before,
.stage-topline::after {
  content: "";
  position: absolute;
  top: -5px;
  width: 7px;
  height: 7px;
  border-top: 1px solid var(--acid);
}

.stage-topline::before {
  left: -8px;
  border-left: 1px solid var(--acid);
}

.stage-topline::after {
  right: -8px;
  border-right: 1px solid var(--acid);
}

.stage-index {
  top: 48px;
  left: 22px;
  color: rgba(239,241,228,.12);
  font: 800 clamp(48px, 6vw, 92px)/.85 var(--display);
  letter-spacing: -.07em;
}

.stage-readout {
  left: 22px;
  bottom: 22px;
  display: flex;
  align-items: end;
  gap: 28px;
}

.readout-label,
.field-label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font: 9px/1 var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
}

.stage-readout strong {
  font: 700 16px/1 var(--display);
  letter-spacing: .06em;
}

.readout-coordinates {
  display: flex;
  gap: 10px;
  color: var(--dim);
  font: 9px/1 var(--mono);
}

.readout-coordinates b {
  color: var(--muted);
  font-weight: 400;
}

.interaction-hint {
  left: 50%;
  bottom: 25px;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: rgba(239,241,228,.45);
  font: 9px/1 var(--mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  transition: opacity 500ms ease;
}

.interaction-hint svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.3;
}

.interaction-hint.hidden {
  opacity: 0;
}

.stage-upload {
  right: 22px;
  bottom: 18px;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line-strong);
  background: rgba(10,11,10,.55);
  backdrop-filter: blur(10px);
  padding: 0 12px;
  color: var(--paper);
  font: 10px/1 var(--mono);
  letter-spacing: .05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease, color 180ms ease;
}

.stage-upload svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
}

.stage-upload:hover {
  border-color: var(--acid);
  color: var(--acid);
}

.drop-overlay {
  position: absolute;
  inset: 14px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px dashed var(--acid);
  background: rgba(8, 9, 8, .88);
  backdrop-filter: blur(18px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.stage.dragging .drop-overlay {
  opacity: 1;
}

.drop-target-icon {
  width: 50px;
  height: 50px;
  margin-bottom: 8px;
  display: grid;
  place-items: center;
  border: 1px solid var(--acid);
  color: var(--acid);
  font: 300 28px/1 var(--body);
}

.drop-overlay strong {
  font: 800 32px/1 var(--display);
  text-transform: uppercase;
}

.drop-overlay span {
  color: var(--muted);
  font: 10px/1 var(--mono);
  letter-spacing: .12em;
}

.control-panel {
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  border-left: 1px solid var(--line);
  background:
    repeating-linear-gradient(135deg, rgba(255,255,255,.012) 0 1px, transparent 1px 5px),
    var(--surface);
  position: relative;
  z-index: 10;
  overflow: hidden;
}

.panel-scroll {
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--surface-3) transparent;
}

.panel-section {
  padding: 23px 24px 25px;
  border-bottom: 1px solid var(--line);
}

.section-heading,
.export-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 17px;
}

.section-heading.compact {
  margin-bottom: 19px;
}

.eyebrow {
  display: block;
  margin-bottom: 7px;
  color: var(--acid);
  font: 9px/1 var(--mono);
  letter-spacing: .14em;
}

h1,
h2 {
  margin: 0;
  color: var(--paper);
  font-family: var(--display);
  text-transform: uppercase;
  letter-spacing: -.035em;
}

h1 {
  font-size: 22px;
  line-height: 1;
}

h2 {
  font-size: 19px;
  line-height: 1;
}

.file-state {
  margin-top: 3px;
  border: 1px solid var(--line-strong);
  padding: 5px 7px;
  color: var(--muted);
  font: 8px/1 var(--mono);
  letter-spacing: .12em;
}

.file-state.is-live {
  border-color: rgba(199,255,74,.5);
  color: var(--acid);
}

.source-card {
  width: 100%;
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr) 20px;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.02);
  text-align: left;
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease;
}

.source-card:hover {
  border-color: var(--line-strong);
  background: rgba(255,255,255,.035);
}

.source-thumb-wrap {
  height: 58px;
  position: relative;
  overflow: hidden;
  background: var(--ink);
}

#sourcePreview {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.source-scan {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 0 48%, rgba(199,255,74,.5) 50%, transparent 52%);
  transform: translateY(-100%);
  opacity: 0;
}

.source-card.is-analyzing .source-scan {
  opacity: 1;
  animation: scan 1s linear infinite;
}

.source-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.source-copy strong {
  overflow: hidden;
  color: var(--paper);
  font: 600 11px/1.1 var(--body);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-copy > span:not(.upload-help) {
  overflow: hidden;
  color: var(--dim);
  font: 8px/1.1 var(--mono);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-copy .upload-help {
  color: var(--muted);
  font: 9px/1.1 var(--body);
}

.source-action {
  color: var(--muted);
  font-size: 16px;
}

.text-button {
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  background: transparent;
  padding: 2px 0 4px;
  color: var(--muted);
  font: 8px/1 var(--mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
}

.text-button:hover {
  border-color: var(--acid);
  color: var(--acid);
}

.material-tools {
  display: flex;
  align-items: flex-end;
  gap: 11px;
}

.material-tools label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font: 8px/1 var(--mono);
  text-transform: uppercase;
}

.material-tools select {
  height: 25px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface-2);
  padding: 0 19px 0 7px;
  color: var(--paper);
  font: 8px/1 var(--mono);
  text-transform: uppercase;
}

.palette-block {
  margin-bottom: 21px;
}

.palette {
  height: 35px;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  border: 1px solid var(--line);
}

.palette-swatch {
  position: relative;
  border: 0;
  cursor: pointer;
}

.palette-swatch + .palette-swatch {
  border-left: 1px solid rgba(255,255,255,.24);
}

.palette-swatch::after {
  content: attr(data-color);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 7px);
  transform: translate(-50%, 4px);
  padding: 5px 6px;
  background: var(--paper);
  color: var(--ink);
  font: 8px/1 var(--mono);
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease, transform 140ms ease;
}

.palette-swatch:hover::after,
.palette-swatch:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

.metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 24px;
  margin: 0;
}

.metric {
  min-width: 0;
}

.metric dt {
  float: left;
  color: var(--muted);
  font: 9px/1 var(--body);
}

.metric dd {
  float: right;
  margin: -2px 0 8px;
  color: var(--paper);
  font: 15px/1 var(--mono);
}

.metric dd small {
  margin-left: 2px;
  color: var(--dim);
  font-size: 8px;
}

.metric-track {
  clear: both;
  height: 2px;
  overflow: hidden;
  background: var(--surface-3);
}

.metric-track span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--acid);
  transition: width 800ms var(--ease);
}

.slider-list {
  display: grid;
  gap: 17px;
}

.slider-control {
  display: block;
}

.slider-control > span {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 9px;
}

.slider-control b {
  color: var(--muted);
  font: 500 9px/1 var(--body);
}

.slider-control output {
  color: var(--paper);
  font: 9px/1 var(--mono);
}

input[type="range"] {
  --progress: 50%;
  width: 100%;
  height: 12px;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background: transparent;
  cursor: ew-resize;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 2px;
  background: linear-gradient(90deg, var(--acid) var(--progress), var(--surface-3) var(--progress));
}

input[type="range"]::-moz-range-track {
  height: 2px;
  background: var(--surface-3);
}

input[type="range"]::-moz-range-progress {
  height: 2px;
  background: var(--acid);
}

input[type="range"]::-webkit-slider-thumb {
  width: 9px;
  height: 13px;
  margin-top: -5.5px;
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: var(--paper);
  box-shadow: 0 0 0 1px var(--paper);
}

input[type="range"]::-moz-range-thumb {
  width: 8px;
  height: 12px;
  border: 0;
  border-radius: 0;
  background: var(--paper);
}

.export-section {
  position: relative;
  padding: 18px 24px 22px;
  border-top: 1px solid var(--line-strong);
  background: #0c0d0c;
}

.export-heading {
  align-items: end;
  margin-bottom: 14px;
}

.duration-select {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font: 8px/1 var(--mono);
  text-transform: uppercase;
}

.duration-select select {
  height: 26px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface-2);
  padding: 0 19px 0 7px;
  color: var(--paper);
  font: 9px/1 var(--mono);
}

.export-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.export-button {
  min-height: 51px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line-strong);
  padding: 8px 10px;
  text-align: left;
  cursor: pointer;
  transition: transform 180ms var(--ease), border-color 180ms ease, background 180ms ease;
}

.export-button:hover:not(:disabled) {
  transform: translateY(-2px);
}

.export-button:disabled {
  opacity: .45;
  cursor: wait;
}

.export-button.secondary {
  background: var(--surface-2);
}

.export-button.secondary:hover:not(:disabled) {
  border-color: var(--paper);
}

.export-button.primary {
  border-color: var(--acid);
  background: var(--acid);
  color: var(--ink);
}

.export-button.primary:hover:not(:disabled) {
  background: #d5ff79;
}

.export-button svg {
  flex: 0 0 auto;
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
}

.export-button > span:not(.record-icon) {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 4px;
}

.export-button b {
  font: 700 10px/1 var(--body);
  text-transform: uppercase;
}

.export-button small {
  overflow: hidden;
  font: 7px/1 var(--mono);
  letter-spacing: .03em;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: .62;
}

.record-icon {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  border: 1px solid currentColor;
  border-radius: 50%;
  position: relative;
}

.record-icon::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: currentColor;
}

.export-progress {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: 1fr auto;
  align-content: center;
  gap: 10px 12px;
  padding: 18px 24px;
  background: rgba(12,13,12,.97);
}

.export-progress[hidden] {
  display: none;
}

.export-progress span {
  font: 10px/1 var(--mono);
  color: var(--paper);
}

.export-progress > div {
  grid-column: 1 / -1;
  height: 3px;
  background: var(--surface-3);
}

.export-progress i {
  display: block;
  width: 0;
  height: 100%;
  background: var(--acid);
}

.export-progress button {
  grid-row: 1;
  grid-column: 2;
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--muted);
  font: 8px/1 var(--mono);
  text-transform: uppercase;
  cursor: pointer;
}

.about-drawer {
  position: fixed;
  inset: 0;
  z-index: 100;
  visibility: hidden;
  transition: visibility 0s linear 420ms;
}

.about-drawer.open {
  visibility: visible;
  transition-delay: 0s;
}

.drawer-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(0,0,0,.58);
  opacity: 0;
  cursor: default;
  transition: opacity 300ms ease;
}

.drawer-card {
  position: absolute;
  top: 0;
  right: 0;
  width: min(450px, 100%);
  height: 100%;
  overflow-y: auto;
  transform: translateX(100%);
  border-left: 1px solid var(--line-strong);
  background:
    linear-gradient(145deg, rgba(199,255,74,.08), transparent 35%),
    var(--surface);
  padding: clamp(80px, 12vh, 130px) clamp(28px, 6vw, 58px) 50px;
  transition: transform 420ms var(--ease);
}

.about-drawer.open .drawer-backdrop {
  opacity: 1;
}

.about-drawer.open .drawer-card {
  transform: none;
}

.drawer-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--paper);
  font: 300 24px/1 var(--body);
  cursor: pointer;
}

.drawer-card h2 {
  max-width: 300px;
  margin: 14px 0 22px;
  font-size: clamp(38px, 6vw, 68px);
  line-height: .9;
}

.drawer-card p {
  margin: 0 0 36px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.drawer-card dl {
  margin: 0;
  border-top: 1px solid var(--line);
}

.drawer-card dl div {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  font: 10px/1.2 var(--mono);
}

.drawer-card dt {
  color: var(--muted);
}

.drawer-card dd {
  margin: 0;
  color: var(--paper);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 200;
  max-width: calc(100vw - 36px);
  transform: translate(-50%, 20px);
  border: 1px solid var(--line-strong);
  background: var(--paper);
  padding: 11px 14px;
  color: var(--ink);
  font: 10px/1.3 var(--mono);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease, transform 220ms var(--ease);
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@keyframes live {
  0%, 100% { opacity: .35; }
  50% { opacity: 1; }
}

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

@media (max-width: 1050px) {
  :root {
    --panel-width: 380px;
  }

  .topbar-meta {
    display: none;
  }

  .topbar {
    grid-template-columns: 1fr var(--panel-width);
  }

  .icon-button {
    grid-column: 2;
  }
}

@media (max-width: 780px) {
  body {
    overflow: auto;
  }

  .app-shell {
    min-height: 100dvh;
  }

  .topbar {
    position: sticky;
    top: 0;
    grid-template-columns: 1fr 56px;
  }

  .workspace {
    height: auto;
    display: block;
    overflow: visible;
  }

  .stage {
    height: min(72dvh, 620px);
    min-height: 440px;
    border-bottom: 1px solid var(--line);
  }

  .control-panel {
    height: auto;
    display: block;
    border-left: 0;
    overflow: visible;
  }

  .panel-scroll {
    overflow: visible;
  }

  .export-section {
    position: sticky;
    bottom: 0;
    z-index: 25;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }

  .interaction-hint,
  .readout-coordinates {
    display: none;
  }
}

@media (max-width: 480px) {
  .brand {
    padding-left: 16px;
  }

  .stage {
    height: 59dvh;
    min-height: 400px;
  }

  .stage-index {
    top: 46px;
    left: 16px;
  }

  .stage-readout {
    left: 16px;
    bottom: 68px;
  }

  .stage-upload {
    left: 16px;
    right: auto;
    bottom: 16px;
  }

  .panel-section,
  .export-section {
    padding-left: 17px;
    padding-right: 17px;
  }

  .source-card {
    grid-template-columns: 74px minmax(0, 1fr) 16px;
  }

  .export-actions {
    gap: 6px;
  }

  .export-button {
    padding-inline: 8px;
  }
}

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

/* CosmXploreR — interface plus libre, plus simple */
:root {
  --panel-width: clamp(350px, 29vw, 410px);
  --header-height: 54px;
  --acid: #cdff57;
  --surface: #131511;
  --surface-2: #1b1e18;
  --line: rgba(239, 241, 228, .1);
  --line-strong: rgba(239, 241, 228, .2);
}

.app-shell {
  background: #080908;
}

.topbar {
  grid-template-columns: 1fr 56px;
  border: 0;
  background: #080908;
}

.brand {
  gap: 10px;
  padding-left: 18px;
  font-family: var(--body);
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -.04em;
}

.brand-mark {
  width: 15px;
  height: 15px;
  border-radius: 46% 54% 42% 58%;
  transform: rotate(18deg);
}

.brand-mark::after {
  inset: 4px;
  border-radius: 50%;
}

.topbar-meta {
  display: none;
}

.icon-button {
  grid-column: 2;
  border: 0;
  opacity: .7;
}

.workspace {
  grid-template-columns: minmax(0, 1fr) var(--panel-width);
  gap: 10px;
  padding: 0 10px 10px;
}

.stage {
  border-radius: 28px 13px 34px 18px;
}

.stage::before {
  background:
    linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px);
  background-size: 92px 92px;
  opacity: .55;
}

.stage-topline,
.stage-index,
.readout-coordinates,
.interaction-hint {
  display: none;
}

.stage-readout {
  left: 24px;
  bottom: 22px;
}

.stage-readout strong {
  font-family: var(--body);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .01em;
}

.readout-label {
  font-family: "Segoe Print", "Comic Sans MS", cursive;
  font-size: 9px;
  letter-spacing: 0;
  text-transform: lowercase;
}

.stage-upload {
  right: 22px;
  bottom: 18px;
  min-height: 42px;
  border: 0;
  border-radius: 19px 25px 17px 23px;
  background: var(--paper);
  color: var(--ink);
  padding: 0 16px;
  font-family: var(--body);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}

.stage-upload:hover {
  background: var(--acid);
  color: var(--ink);
}

.control-panel {
  border: 0;
  border-radius: 18px 31px 22px 34px;
  background: #121410;
  box-shadow: 0 16px 45px rgba(0,0,0,.24);
}

.panel-scroll {
  scrollbar-width: none;
}

.panel-scroll::-webkit-scrollbar {
  display: none;
}

.panel-section {
  position: relative;
  padding: 19px 21px 21px;
  border: 0;
}

.panel-section:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 22px;
  right: 34px;
  bottom: 0;
  height: 1px;
  background: rgba(239,241,228,.13);
  transform: rotate(-.45deg);
  transform-origin: left;
}

.section-heading,
.export-heading {
  align-items: flex-end;
  margin-bottom: 15px;
}

.eyebrow {
  margin-bottom: 5px;
  font-family: "Segoe Print", "Comic Sans MS", cursive;
  font-size: 9px;
  letter-spacing: 0;
  text-transform: lowercase;
}

h1,
h2 {
  font-family: var(--body);
  font-weight: 650;
  text-transform: none;
  letter-spacing: -.045em;
}

h1 {
  font-size: 24px;
}

h2 {
  font-size: 20px;
}

.file-state {
  display: none;
}

.source-card {
  grid-template-columns: 76px minmax(0, 1fr) 18px;
  gap: 11px;
  padding: 8px;
  border: 1px dashed rgba(239,241,228,.2);
  border-radius: 15px 24px 14px 20px;
  background: rgba(255,255,255,.018);
}

.source-card:hover {
  border-color: var(--acid);
  background: rgba(205,255,87,.035);
}

.source-thumb-wrap {
  border-radius: 13px 20px 12px 17px;
}

.source-copy > span:not(.upload-help) {
  display: none;
}

.source-copy strong {
  font-size: 10px;
  font-weight: 600;
}

.source-copy .upload-help {
  color: var(--dim);
  font-size: 9px;
}

.text-button {
  border: 0;
  padding: 4px 0;
  font-family: "Segoe Print", "Comic Sans MS", cursive;
  font-size: 8px;
  letter-spacing: 0;
  text-transform: lowercase;
}

.palette-block {
  margin-bottom: 13px;
}

.field-label {
  display: none;
}

.palette {
  width: fit-content;
  height: 35px;
  grid-template-columns: repeat(6, 35px);
  gap: 6px;
  border: 0;
}

.palette-swatch {
  border-radius: 50%;
  transform: rotate(-3deg);
}

.palette-swatch:nth-child(2n) {
  border-radius: 43% 57% 51% 49%;
  transform: rotate(5deg) scale(.92);
}

.palette-swatch:nth-child(3n) {
  border-radius: 56% 44% 38% 62%;
  transform: rotate(-8deg) scale(1.04);
}

.palette-swatch + .palette-swatch {
  border: 0;
}

.metrics-grid {
  gap: 6px;
}

.metric {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-radius: 14px 8px 13px 10px;
  background: rgba(255,255,255,.035);
  padding: 8px 10px;
}

.metric:nth-child(2n) {
  border-radius: 8px 15px 10px 13px;
}

.metric dt,
.metric dd {
  float: none;
}

.metric dt {
  color: var(--muted);
  font-size: 9px;
}

.metric dd {
  margin: 0;
  font-size: 12px;
}

.metric-track {
  display: none;
}

.material-tools {
  gap: 8px;
}

.material-tools label > span {
  display: none;
}

.material-tools select,
.duration-select select {
  border: 0;
  border-radius: 14px 18px 13px 16px;
  background: var(--surface-2);
}

.slider-list {
  gap: 14px;
}

.slider-control b {
  font-size: 10px;
  font-weight: 500;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 3px;
  border-radius: 99px;
}

input[type="range"]::-webkit-slider-thumb {
  width: 13px;
  height: 13px;
  margin-top: -5px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--acid);
  box-shadow: none;
}

input[type="range"]::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--acid);
}

.advanced-controls {
  margin-top: 14px;
}

.advanced-controls summary {
  width: fit-content;
  color: var(--muted);
  font: 9px/1.4 "Segoe Print", "Comic Sans MS", cursive;
  cursor: pointer;
  list-style: none;
}

.advanced-controls summary::-webkit-details-marker {
  display: none;
}

.advanced-controls summary::before {
  content: "+ ";
  color: var(--acid);
}

.advanced-controls[open] summary::before {
  content: "− ";
}

.advanced-controls .slider-list {
  margin-top: 15px;
}

.export-section {
  border: 0;
  background: #0e100d;
  padding: 17px 21px 20px;
}

.export-actions {
  gap: 7px;
}

.export-button {
  min-height: 52px;
  border-radius: 17px 9px 18px 12px;
}

.export-button:nth-child(2) {
  border-radius: 10px 19px 12px 17px;
}

.export-button.secondary {
  border: 0;
  background: var(--surface-2);
}

.export-button.primary {
  border: 0;
}

.about-drawer .drawer-card {
  top: 10px;
  right: 10px;
  bottom: 10px;
  height: auto;
  border: 0;
  border-radius: 32px 14px 26px 18px;
}

@media (max-width: 900px) {
  :root {
    --panel-width: 355px;
  }
}

@media (max-width: 780px) {
  .workspace {
    display: block;
    padding: 0 8px 8px;
  }

  .stage {
    height: 57dvh;
    min-height: 400px;
    border-radius: 22px 10px 28px 14px;
  }

  .control-panel {
    margin-top: 8px;
    border-radius: 16px 28px 18px 24px;
  }

  .export-section {
    position: relative;
    bottom: auto;
    border-radius: 0 0 18px 24px;
  }
}

@media (max-width: 480px) {
  .stage {
    height: 54dvh;
    min-height: 380px;
  }

  .stage-readout {
    left: 17px;
    bottom: 67px;
  }

  .stage-upload {
    left: 16px;
    bottom: 16px;
  }

  .panel-section,
  .export-section {
    padding-left: 17px;
    padding-right: 17px;
  }

  .material-section .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }
}
