:root {
  color-scheme: light;
  font-family: "TikTok Sans", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-optical-sizing: auto;
  font-variation-settings: "slnt" 0, "wdth" 134, "opsz" 36;
  font-weight: 500;
  line-height: 1.5;
  text-rendering: geometricPrecision;
}

* {
  box-sizing: border-box;
}

body {
  background: #eeeeee;
  color: #242424;
  margin: 0;
  min-height: 100vh;
}

button,
input,
select {
  font: inherit;
}

.app {
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1fr) 380px;
  min-height: 100vh;
  padding: 24px;
}

.preview-panel {
  align-items: center;
  background:
    linear-gradient(90deg, rgba(50, 50, 50, 0.055) 1px, transparent 1px),
    linear-gradient(rgba(50, 50, 50, 0.055) 1px, transparent 1px),
    #f3f3f3;
  background-size: 28px 28px;
  display: flex;
  justify-content: center;
  min-height: calc(100vh - 48px);
  overflow: hidden;
  padding: 32px;
}

.preview-stage {
  display: grid;
  gap: 14px;
  max-width: min(860px, 100%);
  width: min(72vw, 760px);
}

dot-motion-video,
dot-motion-player {
  max-height: calc(100vh - 176px);
  width: 100%;
}

.video-controls {
  align-items: center;
  display: grid;
  gap: 12px;
  grid-template-columns: 46px minmax(0, 1fr) minmax(88px, auto);
  width: 100%;
}

.play-toggle {
  align-items: center;
  border-radius: 8px;
  display: grid;
  height: 46px;
  justify-items: center;
  min-height: 46px;
  padding: 0;
  width: 46px;
}

.play-toggle-icon {
  display: block;
}

.play-toggle.is-playing .play-toggle-icon {
  background: linear-gradient(90deg, #ffffff 0 34%, transparent 34% 66%, #ffffff 66% 100%);
  height: 18px;
  width: 14px;
}

.play-toggle:not(.is-playing) .play-toggle-icon {
  border-bottom: 9px solid transparent;
  border-left: 14px solid #ffffff;
  border-top: 9px solid transparent;
  height: 0;
  margin-left: 3px;
  width: 0;
}

.timeline-range {
  min-width: 0;
}

.time-readout {
  color: #707070;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  font-weight: 750;
  text-align: right;
  white-space: nowrap;
}

.controls {
  align-self: stretch;
  background: #ffffff;
  border-left: 1px solid rgba(50, 50, 50, 0.1);
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin: -24px -24px -24px 0;
  overflow: auto;
  padding: 28px;
}

.controls-header {
  align-items: flex-start;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.eyebrow {
  color: #707070;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  margin: 0 0 4px;
  text-transform: uppercase;
}

h1 {
  font-size: 28px;
  line-height: 1.1;
  margin: 0;
}

.language-switch {
  background: #eeeeee;
  border: 1px solid #dddddd;
  border-radius: 8px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 3px;
}

.lang-button {
  background: transparent;
  border-radius: 6px;
  color: #707070;
  font-size: 12px;
  font-weight: 750;
  min-height: 30px;
  min-width: 38px;
  padding: 4px 8px;
}

.lang-button:hover {
  background: #ffffff;
  color: #242424;
}

.lang-button.is-active {
  background: #323232;
  color: #ffffff;
}

.field {
  display: grid;
  gap: 8px;
}

.field span,
.switch span {
  color: #4a4a4a;
  font-size: 13px;
  font-weight: 650;
}

input[type="url"],
input[type="file"],
input[type="number"],
select {
  background: #f7f7f7;
  border: 1px solid #dddddd;
  border-radius: 8px;
  color: #242424;
  min-width: 0;
  padding: 10px 12px;
  width: 100%;
}

select:disabled {
  color: #9a9a9a;
}

input[type="number"]:disabled {
  color: #9a9a9a;
}

input[type="range"] {
  accent-color: #323232;
  width: 100%;
}

.control-grid {
  display: grid;
  gap: 16px;
}

output {
  color: #707070;
  float: right;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}

.color-tools {
  border-top: 1px solid #e4e4e4;
  display: grid;
  gap: 14px;
  padding-top: 16px;
}

.color-picker {
  display: grid;
  gap: 10px;
}

.color-picker[aria-disabled="true"] {
  opacity: 0.55;
}

.color-picker[aria-disabled="true"] .color-square {
  pointer-events: none;
}

.color-picker-header {
  align-items: center;
  color: #4a4a4a;
  display: flex;
  font-size: 13px;
  font-weight: 750;
  justify-content: space-between;
}

.color-chip {
  background: var(--chip-color, #111111);
  border: 1px solid #d6d6d6;
  border-radius: 999px;
  height: 22px;
  width: 22px;
}

.color-picker-body {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) 28px;
}

.color-square {
  --picker-hue: 0;
  --picker-x: 0%;
  --picker-y: 100%;
  aspect-ratio: 1 / 1;
  background:
    linear-gradient(to top, #000000, transparent),
    linear-gradient(to right, #ffffff, hsl(var(--picker-hue) 100% 50%));
  border: 1px solid #d6d6d6;
  border-radius: 8px;
  cursor: crosshair;
  min-height: 150px;
  overflow: hidden;
  position: relative;
  touch-action: none;
}

.color-handle {
  border: 2px solid #ffffff;
  border-radius: 999px;
  box-shadow: 0 0 0 1px #242424;
  height: 14px;
  left: var(--picker-x);
  pointer-events: none;
  position: absolute;
  top: var(--picker-y);
  transform: translate(-50%, -50%);
  width: 14px;
}

.hue-range {
  accent-color: #323232;
  background: linear-gradient(to top, #ff0000, #ffff00, #00ff00, #00ffff, #0000ff, #ff00ff, #ff0000);
  border-radius: 999px;
  height: 100%;
  min-height: 150px;
  writing-mode: vertical-lr;
}

.rgb-field {
  gap: 6px;
}

.rgb-field input {
  background: #f7f7f7;
  border: 1px solid #dddddd;
  border-radius: 8px;
  color: #242424;
  min-width: 0;
  padding: 9px 10px;
  width: 100%;
}

.rgb-field input.is-invalid {
  border-color: #e11d48;
  box-shadow: 0 0 0 3px rgba(225, 29, 72, 0.12);
}

.field-note {
  color: #707070;
  font-size: 12px;
  line-height: 1.35;
}

.resolution-inputs {
  align-items: end;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
}

.compact-field {
  gap: 6px;
}

.compact-field span {
  color: #707070;
  font-size: 12px;
}

.resolution-separator {
  color: #707070;
  font-size: 13px;
  font-weight: 750;
  padding-bottom: 10px;
}

.switch {
  align-items: center;
  display: flex;
  gap: 10px;
}

.switch input {
  accent-color: #323232;
  height: 18px;
  width: 18px;
}

.export-option {
  align-items: flex-start;
}

.export-option small {
  color: #707070;
  display: block;
  font-size: 12px;
  font-weight: 500;
  margin-top: 1px;
}

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

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

.export-box {
  border-top: 1px solid #e4e4e4;
  display: grid;
  gap: 12px;
  padding-top: 16px;
}

.section-title {
  color: #242424;
  font-size: 13px;
  font-weight: 750;
  margin: 0;
}

progress {
  accent-color: #323232;
  height: 8px;
  width: 100%;
}

.status-line {
  color: #707070;
  font-size: 12px;
  margin: 0;
}

button {
  background: #323232;
  border: 0;
  border-radius: 8px;
  color: #ffffff;
  cursor: pointer;
  min-height: 42px;
  padding: 10px 12px;
}

button:hover {
  background: #242424;
}

pre {
  background: #242424;
  border-radius: 8px;
  color: #f2f2f2;
  font: 12px/1.5 "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  margin: 0;
  overflow: auto;
  padding: 14px;
  white-space: pre-wrap;
}

@media (min-width: 981px) {
  html,
  body {
    height: 100%;
    overflow: hidden;
  }

  .app {
    height: 100vh;
    min-height: 0;
    overflow: hidden;
  }

  .preview-panel {
    height: calc(100vh - 48px);
    min-height: 0;
  }

  .controls {
    height: 100vh;
    max-height: 100vh;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}

@media (max-width: 980px) {
  .app {
    grid-template-columns: 1fr;
    padding: 0;
  }

  .preview-panel {
    min-height: 54vh;
    padding: 18px;
  }

  .preview-stage {
    width: min(92vw, 680px);
  }

  dot-motion-video,
  dot-motion-player {
    max-height: 44vh;
  }

  .video-controls {
    gap: 10px;
    grid-template-columns: 48px minmax(0, 1fr) minmax(76px, auto);
  }

  .play-toggle {
    height: 48px;
    min-height: 48px;
    width: 48px;
  }

  .time-readout {
    font-size: 11px;
  }

  .controls {
    border-left: 0;
    margin: 0;
  }
}
