:root {
  font-family: ui-monospace, "Inter", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 12px;
  --page-bg: #f5f5f5;
  --page-gradient: radial-gradient(circle at center, #ffffff 0%, #f4f4f4 55%, #dcdcdc 100%);
  --text-color: #0d0d0d;
  --muted-text: #555555;
  --control-label-color: #777777;
  --panel: #ffffff;
  --control-surface: color-mix(in srgb, var(--panel) 35%, transparent);
  --preview-surface: color-mix(in srgb, var(--panel) 60%, transparent);
  --canvas-surface: color-mix(in srgb, var(--panel) 4%, transparent);
  --input-text-color: #000;
  --input-bg-color: rgba(255, 255, 255, 0.4);
  --input-border-color: rgba(255, 255, 255, 0.2);
  --input-placeholder-color: rgba(255, 255, 255, 0.4);
  --empty-color: #999;
  --secondary-button-bg: #111111;
  --secondary-button-bg-hover: #1f1f1f;
  --secondary-button-color: #ffffff;
  --secondary-button-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  --ghost-button-color: #111111;
  --ghost-button-hover-bg: rgba(0, 0, 0, 0.05);
  --ghost-button-hover-border: rgba(0, 0, 0, 0.5);
  --glyph-fill: #050505;
  --glyph-stroke: #050505;
  color: var(--text-color);
  background: var(--page-bg);
  color-scheme: light dark;
  --accent: #ffffff;
  --accent-soft: color-mix(in srgb, var(--accent), transparent 80%);
  --stroke: #757575;
  --radius: .6rem;
  --toolbar-height: clamp(180px, 27vh, 260px);
  --control-height: 32px;
}

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

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--page-bg);
  color: var(--text-color);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  overflow: hidden;
  /* overflow-y: scroll; */
  padding: clamp(1rem, 3vw, 3rem);
}

body.immersive-mode {
  padding: 0;
  justify-content: stretch;
  align-items: stretch;
}

body.immersive-mode .app-shell {
  min-height: 100vh;
  height: 100vh;
  max-width: none;
}

#root {
  /* width: min(1800px, 100%); */
}

.app-shell {
  width: 100%;
  /* max-width: 1200px; */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  /* padding-bottom: clamp(5rem, 14vh, 7rem); */
  --ui-fade-in-duration: 0.22s;
  --ui-fade-out-duration: 2.2grid5s;
  --ui-fade-in-ease: cubic-bezier(0.45, 0, 0.4, 1);
  --ui-fade-out-ease: cubic-bezier(0.22, 0, 0.05, 1);
  --immersive-transition-duration: var(--ui-fade-out-duration);
  --immersive-transition-ease: var(--ui-fade-out-ease);
}

.ui-hideable {
  --ui-base-transform: translateY(0);
  --ui-translate-offset: 0px;
  transition:
    opacity var(--ui-fade-in-duration) var(--ui-fade-in-ease),
    transform var(--ui-fade-in-duration) var(--ui-fade-in-ease);
  opacity: 1;
  transform: var(--ui-base-transform) translateY(var(--ui-translate-offset));
}

.app-shell.ui-hidden .ui-hideable {
  opacity: 0;
  --ui-translate-offset: 10px;
  pointer-events: none;
  transition-duration: 1.2s;
  transition-timing-function: var(--ui-fade-out-ease);
}

.app-shell.ui-hidden .left-toolbar {
  --ui-base-transform: translateX(130%);
}

.app {
  /* padding: clamp(1.25rem, 3vw, 2.5rem); */
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  width: 90vw;
}

header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: baseline;
  justify-content: space-between;
}

header h1 {
  margin: 0;
  font-size: clamp(1.2rem, 2vw, 1.75rem);
}

header p {
  margin: 0;
  color: var(--muted-text);
  max-width: 30ch;
  font-size: 0.95rem;
}

.toolbar-controls {
  display: flex;
  flex-direction: row;
  justify-content: center;
  /* grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); */
  gap: 1rem;
}

.left-toolbar {
  position: fixed;
  top: clamp(1rem, 4vh, 2.5rem);
  /* bottom: clamp(1rem, 4vh, 3rem); */
  right: clamp(1rem, 3vw, 3rem);
  width: 250px;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  /* padding: 1.25rem; */
  /* border-radius: calc(var(--radius) * 1.3); */
  /* background: color-mix(in srgb, var(--panel) 88%, transparent); */
  /* border: 1px solid color-mix(in srgb, var(--stroke), transparent 30%); */
  /* box-shadow: 0 24px 50px rgba(0, 0, 0, 0.2); */
  /* backdrop-filter: blur(18px); */
  /* backdrop-filter: blur(18px); */
  /* -webkit-backdrop-filter: blur(18px); */
  overflow-y: hidden;
  z-index: 15;
  --ui-base-transform: translateX(0);
}

.top-left-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  border-radius: calc(var(--radius) * 1.1);
  background: color-mix(in srgb, var(--control-surface) 80%, transparent);
  /* border: 1px solid color-mix(in srgb, var(--stroke), transparent 20%); */
}

.group-copy {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.group-copy .eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.65rem;
  color: var(--muted-text);
}

.group-copy h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 400;
}

.group-copy p {
  margin: 0;
  color: var(--muted-text);
  font-size: 0.85rem;
}

.autoplay-switch {
  position: relative;
  width: 52px;
  height: 28px;
  display: inline-flex;
}

.autoplay-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.autoplay-switch .slider {
  position: absolute;
  inset: 0;
  cursor: pointer;
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted-text) 35%, transparent);
  transition: background 0.2s ease;
  /* box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--stroke), transparent 20%); */
}

.autoplay-switch .slider::before {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  left: 3px;
  top: 3px;
  border-radius: 999px;
  background: #fff;
  /* box-shadow: 0 6px 14px rgba(0, 0, 0, 0.2); */
  transition: transform 0.2s ease;
}

.autoplay-switch input:checked + .slider {
  background: var(--accent);
  box-shadow: none;
}

.autoplay-switch input:checked + .slider::before {
  transform: translateX(24px);
}

.panel {
  width: 100%;
  padding: 1rem;
  /* background: color-mix(in srgb, var(--control-surface) 80%, transparent); */
  background: #000;
  border-radius: var(--radius);
  /* border: 1px solid color-mix(in srgb, var(--stroke), transparent 20%); */
  /* backdrop-filter: blur(18px); */
  /* -webkit-backdrop-filter: blur(18px); */
  /* box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12); */
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.layer-panel-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

.layer-panel-header h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 400;
  /* letter-spacing: 0.02em; */
}

.layer-panel-header p {
  margin: 0;
  color: var(--muted-text);
  font-size: 0.85rem;
}

.layer-panel-actions {
  display: inline-flex;
  gap: 0.35rem;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.layer-panel-actions button {
  /* font-size: 0.8rem; */
  width: 100%;
  padding: 0rem 8px;
  border-radius: 4px;
  justify-content: center;
  align-items: center;
}

.layer-panel-footer {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 0.75rem;
  padding-left: 27px;
}

.layer-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  max-height: none;
  overflow-y: auto;
  padding-right: 0.25rem;
  /* min-height: 160px; */
  flex: 1 1 auto;
}

.layer-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.35rem 0.6rem;
  border-radius: calc(var(--radius) / 1.3);
  background: color-mix(in srgb, var(--control-surface) 25%, transparent);
  border: 1px solid rgba(0, 0, 0, 0.08);
  cursor: pointer;
}

.layer-item[data-active="true"] {
  border-color: var(--accent);
  /* box-shadow: 0 0 0 1px var(--accent-soft); */
}

.layer-drag-handle {
  border: none;
  background: none;
  color: var(--muted-text);
  cursor: grab;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.layer-drag-handle:active {
  cursor: grabbing;
}

.layer-label-input {
  border: none;
  background: transparent;
  font: inherit;
  color: inherit;
  padding: 0.2rem 0.4rem;
  border-radius: calc(var(--radius) / 1.5);
  outline: none;
  width: 100%;
  min-width: 0;
  flex: 1;
}

.layer-label-input:focus {
  background: rgba(0, 0, 0, 0.04);
}

.layer-label-wrapper {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex: 1;
}

.layer-link-toggle {
  /* border: 1px solid rgba(0, 0, 0, 0.15); */
  /* background: rgba(255, 255, 255, 0.3); */
  background: none;
  color: var(--muted-text);
  border-radius: 4px;
  /* width: 22px; */
  width: 0%;
  /* height: 22px; */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.layer-link-toggle[data-linked="true"] {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  /* background: var(--accent); */
  color: var(--accent);
  /* border-color: color-mix(in srgb, var(--accent) 25%, transparent); */
}

.layer-link-toggle:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.layer-type-chip {
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 999px;
  padding: 0.05rem 0.55rem;
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-text);
  /* background: rgba(0, 0, 0, 0.05); */
  background: none;
}

.layer-remove-btn {
  border: none;
  background: none;
  color: var(--muted-text);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0.15rem;
}

.layer-remove-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.layer-color-picker {
  position: relative;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
  width: var(--control-height);
  height: var(--control-height);
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
  overflow: hidden;
}

/* .layer-color-picker input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
} */

.layer-color-picker span {
  width: 60%;
  height: 60%;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.1);
  display: block;
  pointer-events: none;
}

.text-input-panel {
  width: 100%;
  max-width: 640px;
  padding: 0 1rem;
  margin: 0 auto;
}

.text-inputs-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  /* margin: 0.4rem; */
  width: 100%;
  gap: 10px;
  align-content: center;
}

.text-inputs-header span {
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  color: var(--control-label-color);
}

.text-inputs-actions {
  display: inline-flex;
  gap: 0.5rem;
}

.text-inputs-list {
  display: flex;
  flex-direction: row;
  gap: 0.4rem;
  max-height: 180px;
  overflow-y: auto;
}


.text-input-row {
  display: flex;
  grid-template-columns: 1fr auto;
  gap: 0.4rem;
  align-items: center;
}

.text-input-row input {
  display: flex;
  flex-direction: row;
  width: 100%;
  border-radius: calc(var(--radius) / 1.3);
  border: 1px solid var(--input-border-color);
  padding: 0.45rem 0.75rem;
  background: var(--input-bg-color);
  color: var(--input-text-color);
  font: inherit;
}

.text-input-row button {
  border: none;
  background: none;
  color: var(--muted-text);
  cursor: pointer;
  font-size: 1rem;
  padding: 0.25rem;
}

.text-input-row button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.linked-layer-notice {
  font-size: 0.85rem;
  margin: 0.2rem 0 0.4rem;
  color: var(--muted-text);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.text-inputs-list .empty-state {
  font-size: 0.9rem;
  color: var(--muted-text);
  padding: 0.5rem 0;
}

.group-shake {
  min-height: var(--control-height);
  transform-origin: center;
  transition: transform 0.2s ease;
}

.floating-shake {
  position: fixed;
  bottom: clamp(1rem, 4vh, 3rem);
  right: clamp(1rem, 4vw, 3rem);
  z-index: 25;
  box-shadow: 0 18px 30px rgba(0, 0, 0, 0.25);
}

.group-shake.is-shaking {
  animation: shake-button-spin 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes shake-button-spin {
  0% {
    transform: rotate(0deg);
  }
  20% {
    transform: rotate(-12deg);
  }
  40% {
    transform: rotate(12deg);
  }
  60% {
    transform: rotate(-8deg);
  }
  80% {
    transform: rotate(6deg);
  }
  100% {
    transform: rotate(0deg);
  }
}

.color-toggle {
  display: inline-flex;
  align-items: stretch;
  height: var(--control-height);
  border-radius: calc(var(--radius) / 1.2);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.1);
}

.color-toggle + .color-toggle {
  margin-left: 0.6rem;
}

.color-dot {
  width: var(--control-height);
  height: var(--control-height);
  border-radius: 50%;
  border: none;
  position: relative;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  padding: 0;
  background: rgba(255, 255, 255, 0.15);
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25) inset;
  appearance: none;
  outline: none;
}

.color-dot:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.8);
  outline-offset: 2px;
}

.color-dot span {
  width: 50%;
  height: 50%;
  border-radius: 50%;
  display: block;
  border: 1px solid rgba(0, 0, 0, 0.1);
  pointer-events: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.color-dot:active span {
  transform: scale(0.92);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.4);
}

.color-toggle .color-dot {
  border-radius: 0;
  border: none;
  border-right: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.22);
}

.color-toggle .color-dot span {
  width: 65%;
  height: 65%;
  border-radius: 50%;
}

.color-toggle .group-toggle,
.color-toggle .group-shake {
  border-radius: 0;
  border-left: none;
  min-height: 100%;
  display: inline-flex;
  align-items: center;
}

.color-picker-popover {
  position: fixed;
  top: 0;
  left: 0;
  min-width: 220px;
  background: rgba(10, 12, 26, 0.95);
  border-radius: calc(var(--radius) * 1.25);
  padding: 0.9rem;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.08);
  opacity: 0;
  transform: translateY(6px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 120;
  color: #fff;
  backdrop-filter: blur(20px);
}

.color-picker-popover.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.color-picker-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.8rem;
}

.color-picker-preview {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
  display: inline-flex;
}

.color-picker-hex-input {
  flex: 1;
  border-radius: calc(var(--radius) / 1.5);
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font: inherit;
  padding: 0.4rem 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.color-picker-slider {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.65rem;
}

.color-picker-slider span {
  opacity: 0.75;
}

.color-picker-slider input[type="range"] {
  appearance: none;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  outline: none;
  cursor: pointer;
}

.color-picker-slider input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid rgba(0, 0, 0, 0.4);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.color-picker-slider input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.4);
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.control {
  /* border: 1px solid var(--stroke); */
  background: var(--control-surface);
  padding: 0.35rem 1rem;
  border-radius: calc(var(--radius) / 1.5);
  display: flex;
  flex-direction: row;
  gap: 0.65rem;
  justify-content: space-between;
  align-items: center;
  min-height: var(--control-height);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.control label span {
  /* font-size: 0.75rem; */
  /* text-transform: uppercase; */
  /* letter-spacing: 0.08em; */
  color: var(--control-label-color);
}

.text-inputs-control {
  /* width: 100%; */
  padding: 0;
}

input[type="text"] {
  border: none;
  font-size: 1.2rem;
  background: transparent;
  /* border-bottom: 1px solid var(--stroke); */
  /* padding: 0.25rem 0; */
  outline: none;
  /* padding: 0.15rem 0.5rem; */
  min-height: calc(var(--control-height) - 14px);
  z-index: 90;
}

.slider-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.fixed-control-row {
  position: fixed;
  left: 50%;
  right: auto;
  bottom: clamp(1.5rem, 13vh, 16rem);
  /* width: min(500px, calc(100% - 2rem)); */
  transform: translateX(-50%);
  display: flex;
  justify-content: center;
  z-index: 11;
}

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

.slider-value {
  font-variant-numeric: tabular-nums;
  min-width: 2.5ch;
  text-align: right;
  /* font-size: 11px; */
  /* font-weight: 600; */
}

/* .shape-panel { */
  /* padding: 1rem; */
  /* border-radius: calc(var(--radius) * 1.1); */
  /* border: 1px solid color-mix(in srgb, var(--stroke), transparent 20%); */
  /* background: color-mix(in srgb, var(--control-surface) 80%, transparent); */
  /* backdrop-filter: blur(18px); */
  /* -webkit-backdrop-filter: blur(18px); */
  /* display: flex; */
  /* flex-direction: column; */
  /* gap: 0.75rem; */
  /* box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12); */
/* } */

.shape-panel-header h2 {
  margin: 0;
  font-size: 1rem;
  /* letter-spacing: 0.04em; */
  font-weight: 400;
}

.shape-panel-header p {
  margin: 0.15rem 0 0;
  font-size: 0.8rem;
  color: var(--muted-text);
}

.shape-tray {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.4rem;
  max-height: none;
  overflow: none;
  padding-right: 0.25rem;
  --shape-chip-bg: color-mix(in srgb, var(--panel) 78%, transparent);
  --shape-chip-border: rgba(0, 0, 0, 0.12);
  --shape-chip-hover-bg: color-mix(in srgb, var(--panel) 60%, white 20%);
  --shape-chip-hover-border: rgba(0, 0, 0, 0.35);
  --shape-chip-active-bg: color-mix(in srgb, var(--accent-soft), white 75%);
  --shape-chip-active-border: rgba(0, 0, 0, 0.55);
  --shape-chip-text: rgba(0, 0, 0, 0.65);
  --shape-chip-strong: rgba(0, 0, 0, 0.95);
  --shape-chip-focus: color-mix(in srgb, var(--accent), transparent 65%);
}

.shape-tray label {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.45rem;
  padding: 0.35rem 0.75rem;
  min-width: 20px;
  min-height: 32px;
  border-radius: 4px;
  border: 1px solid var(--shape-chip-border);
  background: var(--shape-chip-bg);
  color: var(--shape-chip-text);
  position: relative;
  cursor: pointer;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.2s ease;
  width: 100%;
  user-select: none;
}

.shape-tray label[data-active="true"] {
  border-color: var(--shape-chip-active-border);
  background: var(--shape-chip-active-bg);
  color: var(--shape-active-color, var(--shape-chip-strong));
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.shape-tray label:hover {
  border-color: var(--shape-chip-hover-border);
  background: var(--shape-chip-hover-bg);
  color: var(--shape-chip-strong);
}

.shape-tray label:focus-visible {
  outline: 2px solid var(--shape-chip-focus);
  outline-offset: 2px;
}

.shape-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  pointer-events: none;
  transition: color 0.2s ease;
  color: inherit;
}

.shape-icon svg {
  width: 16px;
  height: 16px;
  color: inherit;
}

.shape-icon svg * {
  fill: currentColor !important;
  stroke: currentColor !important;
}

.shape-label {
  /* font-size: 0.8rem; */
  /* letter-spacing: 0.04em; */
  pointer-events: none;
  color: rgba(255, 255, 255, 0.75);
}

.preview-cluster {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  padding-right: clamp(110px, 18vw, 240px);
}

.preview-panel {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border: none;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  margin: 0;
  background: var(--canvas-surface);
  box-shadow: none;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  z-index: 0;
}

.svg-shell {
  width: 100%;
  height: 100vh;
  border-radius: 0;
  position: relative;
  display: block;
  overflow-y: hidden;
  overflow-x: hidden;
  background-color: var(--dynamic-bg, var(--canvas-surface));
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  --grid-size: var(--cell-size, 50px);
  --sub-grid-size: var(--sub-cell-size, var(--grid-size));
  --grid-line-color: color-mix(in srgb, var(--stroke), transparent 65%);
  --sub-grid-line-color: color-mix(in srgb, var(--stroke), transparent 65%);
  --grid-major-highlight: 6%;
  --grid-minor-highlight: 4%;
  --grid-camera-offset-x: 0px;
  --grid-camera-offset-y: 0px;
}

.grid-overlay {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 99;
  /* mix-blend-mode: difference; */
  opacity: 0.3;
  transition: opacity 1.8s var(--immersive-transition-ease);
  background-image:
    linear-gradient(
      to right,
      color-mix(in srgb, var(--sub-grid-line-color), white var(--grid-minor-highlight)) 1px,
      transparent 1px
    ),
    linear-gradient(
      to bottom,
      color-mix(in srgb, var(--sub-grid-line-color), white var(--grid-minor-highlight)) 1px,
      transparent 1px
    );
  background-size:
    var(--sub-grid-size, 40px) var(--sub-grid-size, 40px),
    var(--sub-grid-size, 40px) var(--sub-grid-size, 40px),
    var(--grid-size, 80px) var(--grid-size, 80px),
    var(--grid-size, 80px) var(--grid-size, 80px);
  background-position:
    calc(var(--grid-offset-x, 0px) + var(--grid-camera-offset-x, 0px))
      calc(var(--grid-offset-y, 0px) + var(--grid-camera-offset-y, 0px)),
    calc(var(--grid-offset-x, 0px) + var(--grid-camera-offset-x, 0px))
      calc(var(--grid-offset-y, 0px) + var(--grid-camera-offset-y, 0px)),
    calc(var(--grid-offset-x, 0px) + var(--grid-camera-offset-x, 0px))
      calc(var(--grid-offset-y, 0px) + var(--grid-camera-offset-y, 0px)),
    calc(var(--grid-offset-x, 0px) + var(--grid-camera-offset-x, 0px))
      calc(var(--grid-offset-y, 0px) + var(--grid-camera-offset-y, 0px));
}

.app-shell.grid-hidden .grid-overlay {
  opacity: 0;
}

.svg-shell > :not(.grid-overlay) {
  position: relative;
  z-index: 1;
}



.scroll-filler {
  width: 100%;
  min-height: 1px;
  pointer-events: none;
  visibility: hidden;
}

.svg-shell canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  z-index: 2;
}

.empty {
  font-size: 0.95rem;
  color: var(--empty-color);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  z-index: 3;
}

.perf-overlay {
  display: none;
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.82);
  color: #fff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;
  font-size: 11px;
  line-height: 1.4;
  padding: 8px 10px;
  border-radius: 6px;
  pointer-events: none;
  max-width: 240px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}
.perf-overlay > div + div {
  margin-top: 4px;
}
.perf-overlay strong {
  color: #6bd9ff;
  font-weight: 600;
  margin-right: 4px;
}

.toolbar-trigger {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: max(18vh, 180px);
  z-index: 9;
}

.toolbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  color: #f6f6f6;
  /* background: var(--preview-surface); */
  /* backdrop-filter: blur(22px); */
  -webkit-backdrop-filter: blur(22px);
  padding: clamp(1rem, 2vw, 1.75rem) clamp(1.25rem, 4vw, 3rem)
  clamp(1.25rem, 4vw, 2.25rem);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  z-index: 10;
  transform: translateY(100%);
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.toolbar-trigger:hover + .toolbar,
.toolbar:hover {
  transform: translateY(0);
}

.toolbar-controls article{
  background: transparent;
}

.toolbar .control {
  border-color: rgba(255, 255, 255, 0.15);
  background: color-mix(in srgb, var(--panel) 15%, transparent);
}

.toolbar .control label span {
  color: rgba(0, 0, 0, 0.65);
}

input[type="text"] {
  color: var(--input-text-color);
  /* background: var(--input-bg-color); */
  border-color: var(--input-border-color);
}

input[type="text"]::placeholder {
  color: var(--input-placeholder-color);
}

.toolbar .slider-value {
  color: #000;
}

.actions {
  display: flex;
  justify-content: center;
  /* flex-wrap: wrap; */
  flex-direction: row;
  gap: 0.75rem;
}

button {
  border: none;
  padding: 0px 1.4rem;
  height:20px;
  border-radius: calc(var(--radius) / 1.25);
  font-size: inherit;
  cursor: pointer;
  transition: color 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
  min-height: var(--control-height);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

button.primary {
  background: var(--accent);
  color: black;
  box-shadow: 0 5px 10px color-mix(in srgb, var(--accent), transparent 60%);
}

button.primary:hover {
  background: color-mix(in srgb, var(--accent), white 12%);
  box-shadow: 0 5px 13px color-mix(in srgb, var(--accent), transparent 45%);
}

button.secondary {
  background: var(--secondary-button-bg);
  color: var(--secondary-button-color);
}

button.secondary:hover {
  background: var(--secondary-button-bg-hover);
  box-shadow: var(--secondary-button-shadow);
}

button.ghost {
  background: transparent;
  border: 1px solid var(--stroke);
  color: var(--ghost-button-color);
}

button.ghost:hover {
  background: var(--ghost-button-hover-bg);
  border-color: var(--ghost-button-hover-border);
}

button:active {
  transform: none;
}

@media (prefers-color-scheme: dark) {
  :root {
    --page-bg: #05050a;
    --page-gradient: radial-gradient(circle at center, #000000 0%, #0d0d0d 55%, #1b1b1b 100%);
    --text-color: #f4f4f4;
    --muted-text: #c0c0c0;
    --control-label-color: #c8c8c8;
    --panel: #0f0f0f;
    --stroke: #484848;
    --control-surface: color-mix(in srgb, var(--panel) 35%, transparent);
    --preview-surface: color-mix(in srgb, var(--panel) 30%, transparent);
    --canvas-surface: color-mix(in srgb, var(--panel) 10%, transparent);
    --grid-line-color: color-mix(in srgb, var(--stroke), transparent 94%);
    --sub-grid-line-color: color-mix(in srgb, var(--stroke), transparent 98%);
    --grid-major-highlight: 4%;
    --grid-minor-highlight: 2%;
    --input-text-color: #f2f2f2;
    --input-bg-color: rgba(5, 5, 5, 0.6);
    --input-border-color: rgba(255, 255, 255, 0.18);
    --input-placeholder-color: rgba(255, 255, 255, 0.45);
    --empty-color: #c9c9c9;
    --secondary-button-bg: #f4f4f4;
    --secondary-button-bg-hover: #dedede;
    --secondary-button-color: #050505;
    --secondary-button-shadow: 0 6px 18px rgba(5, 5, 5, 0.55);
    --ghost-button-color: #f4f4f4;
    --ghost-button-hover-bg: rgba(255, 255, 255, 0.1);
    --ghost-button-hover-border: rgba(255, 255, 255, 0.65);
    --glyph-fill: #ffffff;
    --glyph-stroke: #ffffff;
  }

  .shape-tray {
    --shape-chip-bg: rgba(255, 255, 255, 0.06);
    --shape-chip-border: rgba(255, 255, 255, 0.18);
    --shape-chip-hover-bg: rgba(255, 255, 255, 0.14);
    --shape-chip-hover-border: rgba(255, 255, 255, 0.45);
    --shape-chip-active-bg: color-mix(in srgb, var(--accent-soft), transparent 35%);
    --shape-chip-active-border: rgba(255, 255, 255, 0.65);
    --shape-chip-text: rgba(255, 255, 255, 0.85);
    --shape-chip-strong: rgba(255, 255, 255, 0.98);
    --shape-chip-focus: color-mix(in srgb, var(--accent), transparent 30%);
  }

  button.ghost {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.35);
  }

  .toolbar .control label span {
    color: rgba(255, 255, 255, 0.35);
  }

.toolbar .slider-value {
    color: #fff;
  }
}

@media (max-width: 1024px) {
  body {
    padding: clamp(0.5rem, 2vw, 1.5rem);
  }

  /* .app {
    flex-direction: column;
    align-items: stretch;
    gap: 1.25rem;
  }

  .left-toolbar {
    position: relative;
    top: 0;
    right: 0;
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 1rem;
    overflow: visible;
  }

  .left-toolbar .panel {
    flex: 1 1 260px;
    min-width: min(320px, 100%);
  }

  .preview-panel {
    width: 100%;
    min-height: 480px;
  }

  .toolbar {
    position: sticky;
    bottom: 0;
    width: 100%;
    margin-top: 0;
  }

  .toolbar-controls {
    flex-direction: column;
  } */
}

@media (max-width: 640px) {
  :root {
    --toolbar-height: clamp(140px, 24vh, 220px);
  }

  body {
    padding: clamp(0.5rem, 2vw, 1rem);
  }

  .toolbar-controls {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }

  .left-toolbar {
    flex-direction: column;
  }

  .preview-panel {
    min-height: 60vh;
  }

  .shape-label {
    display: none;
  }
}
.autoplay-inline,
.text-input-panel {
  display: flex;
  flex-direction: row;
  align-items: center;
  /* padding: 0px 20px; */
  gap:10px;
}

.text-inputs-actions button {
  display: none;
  background: color-mix(in srgb, var(--control-surface) 80%, transparent);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  
}
