:root {
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  color: #272a25;
  background: #fafaf8;
  font-synthesis: none;
  --muted: #62685c;
  --line: #e2e4de;
  --accent: #3e4934;
  --ease-out: cubic-bezier(0.165, 0.84, 0.44, 1);
  --column-gap: 32px;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select {
  font: inherit;
  color: inherit;
}
button,
a,
input,
select {
  -webkit-tap-highlight-color: transparent;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: default;
  opacity: 0.55;
}
a {
  color: inherit;
  text-decoration: none;
}
svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
::selection {
  background: #d5dfc9;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.intro,
.studio,
footer {
  max-width: 1680px;
  margin-inline: auto;
  padding-inline: 24px;
}
.intro {
  padding-block: 24px;
}
.url-form {
  display: flex;
  align-items: center;
  gap: 16px;
}
.source-input {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
  padding: 6px 6px 6px 16px;
  border: 1px solid #d7dbd0;
  background: #fff;
  border-radius: 8px;
}
.source-switch {
  display: flex;
  margin: 0;
  padding: 4px;
  gap: 4px;
  border: 0;
  border-radius: 8px;
  background: #eef0e9;
  flex-shrink: 0;
}
.source-switch label {
  position: relative;
  cursor: pointer;
}
.source-switch input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
}
.source-switch span {
  display: grid;
  place-items: center;
  min-height: 44px;
  min-width: 80px;
  padding: 8px 12px;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 550;
  color: var(--muted);
}
.source-switch input:checked + span {
  background: white;
  color: var(--accent);
  box-shadow: 0 1px 4px #26361518;
}
.source-switch input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.source-switch input:disabled + span {
  opacity: 0.55;
}
.url-form [hidden] {
  display: none;
}
.url-form input[type="file"] {
  font-size: 13px;
}
.source-input input {
  min-width: 0;
  flex: 1;
  border: 0;
  background: transparent;
  font-size: 16px;
  padding: 10px 0;
  caret-color: var(--accent);
}
.source-input:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.source-input input:focus-visible {
  outline: none;
}
.source-input input::placeholder {
  color: var(--muted);
}
.primary {
  border: 0;
  border-radius: 8px;
  background: #30392a;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 550;
  white-space: nowrap;
}
.primary svg {
  width: 16px;
  height: 16px;
}
.primary,
.icon-button,
.play-button,
.finish,
.segmented button,
.text-button {
  transition:
    background-color 150ms ease,
    transform 150ms var(--ease-out);
}
button:active:not(:disabled) {
  transform: scale(0.97);
}
.text-button {
  min-height: 44px;
  padding: 8px;
  border: 0;
  border-radius: 6px;
  background: none;
  font-size: 13px;
  color: var(--muted);
}
.status {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
  margin: 12px 0 0;
}
.status:empty {
  display: none;
}
.status.error {
  color: #9c3e2e;
}
.studio {
  --aspect: 1.7777777778;
  --columns: 16;
  --rows: 13;
  --cell-height: max(80px, calc((min(100vw, 1680px) - 48px) / 16));
  display: grid;
  grid-template-columns: repeat(var(--columns, 16), minmax(0, 1fr));
  grid-template-rows: repeat(var(--rows, 9), var(--cell-height, 80px));
  grid-auto-rows: var(--cell-height, 80px);
  gap: 0;
  align-items: stretch;
  position: relative;
  padding-block: 8px 24px;
  max-width: 1680px;
}
[data-panel] {
  transform-origin: top left;
  position: relative;
  margin: 8px;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: 44px minmax(0, 1fr);
  gap: 16px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}
.resize-handle {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  cursor: nwse-resize;
  touch-action: none;
}
.resize-handle:active:not(:disabled) {
  transform: none;
}
.grid-destination {
  margin: 8px;
  border: 2px dashed var(--accent);
  background: #d5dfc944;
  border-radius: 14px;
  pointer-events: none;
  z-index: 3;
}
.grid-destination[hidden] {
  display: none;
}
.rearranging {
  background-image:
    linear-gradient(to right, var(--line) 1px, transparent 1px),
    linear-gradient(var(--line) 1px, transparent 1px);
  background-size: calc((100% - 48px) / var(--columns)) var(--cell-height);
  background-position: 24px 8px;
}
.tile-body {
  min-height: 0;
  padding: 4px;
  align-self: start;
}
.studio [data-panel] > .settings-header {
  margin: 0;
}
.preview-viewport {
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  container-type: size;
}
.studio > dialog.settings {
  position: fixed;
  padding: 0;
}
.move-handle {
  order: -1;
  display: grid;
  place-items: center;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  padding: 0;
  color: var(--muted);
  border: 0;
  border-radius: 6px;
  background: transparent;
  cursor: grab;
  touch-action: none;
}
.move-handle:active:not(:disabled) {
  cursor: grabbing;
  transform: none;
}
.settings .settings-header h2,
.preview-column .settings-header h2 {
  margin-right: auto;
}
.preview-column h2 {
  font-size: 16px;
  font-weight: 550;
  margin-block: 0;
}
.settings-header:has(.move-handle) {
  gap: 8px;
  justify-content: start;
}
[data-panel]:has(.move-handle:focus-visible),
.drop-target {
  outline: 2px solid var(--accent);
  outline-offset: 8px;
  border-radius: 14px;
}
.dragging {
  z-index: 2;
  opacity: 0.92;
  cursor: grabbing;
  user-select: none;
}
.rearranging [data-panel]:not(.dragging) {
  outline: 1px dashed var(--line);
  outline-offset: 8px;
}
.rearranging .drop-target:not(.dragging) {
  outline: 2px solid var(--accent);
}
.preview-column {
  grid-template-rows: 44px minmax(0, 1fr) auto;
  grid-column: 1 / span 10;
  grid-row: 1 / span 9;
}
.appearance-panel {
  grid-column: 11 / span 6;
  grid-row: 1 / span 9;
}
.animation-panel {
  grid-column: 1 / span 8;
  grid-row: 10 / span 4;
}
.export-panel {
  grid-column: 9 / span 8;
  grid-row: 10 / span 4;
}
.player-framing {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0;
  margin: 0;
  border: 0;
  min-width: 0;
  margin-left: auto;
  flex: 0 0 180px;
}
.player-framing .segmented {
  flex: 1;
}
.stage {
  position: relative;
  transform-origin: top left;
  width: min(100cqw, calc(100cqh * var(--aspect)));
  aspect-ratio: var(--aspect);
  margin-inline: auto;
  background: #edeeeb;
  border-radius: 14px;
  overflow: hidden;
  isolation: isolate;
}
.stage:fullscreen {
  max-height: none;
  aspect-ratio: auto;
  width: 100%;
  height: 100%;
  border-radius: 0;
}
.stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: pan-y;
}
.icon-button,
.play-button {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  background: transparent;
  border: 0;
  border-radius: 8px;
}
.icon-button svg {
  width: 18px;
  height: 18px;
}
.stage-loading {
  position: absolute;
  inset: 0;
  background: #edeeebed;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 13px;
  color: var(--muted);
}
.stage-loading[hidden] {
  display: none;
}
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid #c9cfbf;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 900ms linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.playback {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.play-button {
  background: #eef0e9;
  border-radius: 50%;
}
.play-button svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
  stroke-width: 1.2;
}
.time {
  font:
    12px ui-monospace,
    SFMono-Regular,
    monospace;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.timeline-wrap {
  flex: 1;
  min-width: 48px;
}
.timeline-wrap input {
  display: block;
  width: 100%;
  height: 44px;
  margin: 0;
  appearance: none;
  background: transparent;
  cursor: pointer;
}
.timeline-wrap input::-webkit-slider-runnable-track {
  height: 4px;
  background: linear-gradient(
    to right,
    var(--accent) var(--progress, 70%),
    var(--line) var(--progress, 70%)
  );
  border-radius: 2px;
}
.timeline-wrap input::-moz-range-track {
  height: 4px;
  background: linear-gradient(
    to right,
    var(--accent) var(--progress, 70%),
    var(--line) var(--progress, 70%)
  );
  border-radius: 2px;
}
.timeline-wrap input::-webkit-slider-thumb {
  appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -5px;
  border: 2px solid #fff;
  box-shadow: 0 1px 3px #303b2830;
  border-radius: 50%;
  background: var(--accent);
}
.timeline-wrap input::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--accent);
}
.banner {
  font-size: 32px;
  font-weight: 550;
  letter-spacing: -0.03em;
  margin: 0 0 16px;
}
.range-control {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 150px;
}
.range-control input {
  width: 100%;
  min-width: 0;
}
.range-control output {
  min-width: 40px;
  text-align: right;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.settings input[type="range"] {
  accent-color: var(--accent);
  min-height: 44px;
  margin: 0;
  cursor: pointer;
}
.advanced {
  width: min(680px, calc(100% - 32px));
  max-height: calc(100dvh - 48px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fafaf8;
  color: inherit;
}
.advanced::backdrop {
  background: #0006;
}
.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: #fafaf8;
  z-index: 1;
}
.advanced-body {
  padding: 16px 24px 24px;
}
#advanced-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 28px;
}
#open-advanced {
  grid-column: 1 / -1;
  text-align: left;
  padding-left: 0;
}
.advanced input[type="number"] {
  width: 76px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  padding: 8px;
}
.advanced input[type="color"] {
  width: 44px;
  height: 44px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  cursor: pointer;
}
.advanced fieldset {
  margin-top: 20px;
}
.advanced-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  font-size: 12px;
}
.advanced-row output {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.advanced-row input {
  grid-column: 1 / -1;
  width: 100%;
}
footer {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}
.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 16px;
}
.animation-panel,
.export-panel {
  container-type: inline-size;
}
.settings h2 {
  font-size: 16px;
  font-weight: 550;
  margin: 0;
}
.settings fieldset {
  border: 0;
  padding: 0;
  margin: 0 0 24px;
  min-width: 0;
}
.settings legend {
  font-size: 13px;
  font-weight: 550;
  padding: 0;
  margin-bottom: 12px;
  width: 100%;
}
.settings legend > span {
  float: right;
  font-weight: 400;
  font-size: 12px;
  color: var(--muted);
}
.finish-options {
  display: flex;
  gap: 8px;
}
.finish {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  font-size: 12px;
  flex: 1;
}
.finish.selected {
  background: #f0f2ec;
  border-color: #748366;
}
.finish-dot {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1px solid #c8cbbf;
}
.finish-dot.white {
  background: linear-gradient(135deg, #fdfdfb, #d8d8d0);
}
.finish-dot.night {
  background: linear-gradient(135deg, #687076, #1b232a);
  border-color: #404a4f;
}
.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 3px;
}
.swatch {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  padding: 6px;
  border-radius: 50%;
  border: 0;
  background: transparent;
  position: relative;
}
.swatch::before {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: var(--swatch);
  box-shadow: inset 0 0 0 1px #00000018;
}
.swatch.selected::after {
  content: "";
  position: absolute;
  inset: 2px;
  border: 2px solid var(--accent);
  border-radius: 50%;
}
.swatch:focus-visible {
  outline-offset: -1px;
}
.segmented {
  display: flex;
  border-radius: 8px;
  padding: 3px;
  background: #eef0e9;
  gap: 3px;
}
.segmented button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  flex: 1;
  min-height: 44px;
  padding: 8px 3px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  font-size: 12px;
  color: var(--muted);
}
.segmented button svg {
  width: 15px;
  height: 15px;
}
.segmented button.selected {
  background: #fff;
  color: #35422c;
  box-shadow: 0 1px 4px #26361518;
}
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  margin-bottom: 0;
  font-size: 13px;
  gap: 8px;
}
.setting-row select,
.export-meta select {
  min-height: 44px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  padding: 4px;
  cursor: pointer;
}
.switch {
  width: 36px;
  height: 22px;
  padding: 3px;
  border: 0;
  background: #878f80;
  border-radius: 20px;
  position: relative;
  transition: background-color 150ms ease;
}
.switch::before {
  content: "";
  position: absolute;
  inset: -11px -4px;
}
.switch > span {
  display: block;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform 180ms var(--ease-out);
}
.switch[aria-checked="true"] {
  background: var(--accent);
}
.switch[aria-checked="true"] > span {
  transform: translateX(14px);
}
.animation-settings {
  display: grid;
  gap: 4px;
}
.animation-settings .setting-row {
  min-width: 0;
}
.animation-settings .range-control {
  width: 130px;
}
.export-block {
  display: grid;
  gap: 16px;
  align-content: start;
}
.export-block .export-meta {
  margin: 0;
  gap: 8px;
}
.export-block .export-meta select {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  width: 120px;
}
.export-block .export-button {
  grid-column: 1 / -1;
}
.export-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 8px;
}
.export-button {
  width: 100%;
}
@container (min-width: 400px) {
  .animation-settings {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 24px;
  }
  .animation-settings .range-control {
    width: 100%;
  }
  .animation-settings .setting-row:has(input) {
    flex-wrap: wrap;
  }
  .export-block {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .export-block .export-meta {
    flex-direction: column;
    align-items: stretch;
  }
  .export-block .export-meta select {
    width: 100%;
  }
}
footer {
  padding-block: 12px;
  row-gap: 8px;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
}
footer > span {
  margin-right: auto;
}
.footer-credit {
  display: flex;
  align-items: center;
  gap: 12px;
}
footer a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}
@media (hover: hover) and (pointer: fine) {
  .primary:hover:not(:disabled) {
    background: #46553b;
  }
  .text-button:hover:not(:disabled),
  .icon-button:hover,
  .play-button:hover {
    background: #e9ece3;
  }
  .finish:hover {
    border-color: #748366;
  }
  a:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
  }
}
@media (max-width: 1100px) {
  :root {
    --column-gap: 16px;
  }
}
@media (max-width: 1000px) {
  .studio {
    --columns: 4;
    --rows: 27;
    --cell-height: max(80px, calc((100vw - 48px) / 4));
  }
  [data-panel] {
    grid-column: 1 / span 4;
  }
  .preview-column {
    grid-row: 1 / span 6;
  }
  .appearance-panel {
    grid-row: 7 / span 12;
  }
  .animation-panel {
    grid-row: 19 / span 5;
  }
  .export-panel {
    grid-row: 24 / span 4;
  }
}
@media (max-width: 720px) {
  .intro,
  .studio,
  footer {
    padding-inline: 20px;
  }
  .range-control {
    width: 100%;
  }
  .intro {
    padding-block: 24px 20px;
  }
  .url-form {
    display: grid;
    gap: 12px;
    max-width: none;
  }
  .source-switch {
    justify-self: start;
  }
  .source-input {
    width: 100%;
    padding-left: 12px;
  }
  #advanced-controls {
    grid-template-columns: 1fr;
  }
  .url-form .primary {
    padding-inline: 12px;
  }
  .studio {
    padding-inline: 12px;
    --cell-height: max(80px, calc((100vw - 24px) / 4));
  }
  .playback {
    gap: 6px;
  }
  .time {
    font-size: 11px;
  }
  .settings-header {
    grid-column: 1/-1;
    margin-bottom: 16px;
  }
  .setting-row {
    flex-wrap: wrap;
  }
  footer > span {
    flex-basis: 100%;
  }
  footer {
    margin-top: 24px;
  }
}
@media (max-width: 360px) {
  .intro,
  .studio,
  footer {
    padding-inline: 12px;
  }
  [data-panel] {
    padding: 12px;
    gap: 12px;
  }
  .playback {
    gap: 4px;
  }
  .export-block {
    gap: 12px 8px;
  }
  .export-block .export-meta select {
    padding-inline: 4px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .primary,
  .icon-button,
  .play-button,
  .finish,
  .segmented button,
  .text-button,
  .switch,
  .switch > span {
    transition: none;
  }
  button:active:not(:disabled) {
    transform: none;
  }
  .spinner {
    animation: none;
  }
}
