:root {
  color-scheme: dark;
  --ink: #070909;
  --ink-soft: #0e1211;
  --panel: rgba(12, 16, 15, 0.9);
  --paper: #fbfbf5;
  --text: #f6f7ef;
  --muted: rgba(246, 247, 239, 0.56);
  --muted-strong: rgba(246, 247, 239, 0.74);
  --line: rgba(246, 247, 239, 0.13);
  --line-strong: rgba(246, 247, 239, 0.24);
  --accent: #d9f01a;
  --accent-rgb: 217, 240, 26;
  --cyan: #22c6c5;
  --rose: #f1265f;
  --radius: 4px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--ink);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    radial-gradient(circle at 48% -12%, rgba(var(--accent-rgb), 0.12), transparent 36vw),
    var(--ink);
  background-size: 40px 40px, 40px 40px, auto, auto;
}

button,
input,
select {
  font: inherit;
}

button,
label,
a {
  -webkit-tap-highlight-color: transparent;
}

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

.ambient {
  position: fixed;
  z-index: -1;
  pointer-events: none;
  filter: blur(10px);
  opacity: 0.6;
}

.ambient-a {
  top: 18vh;
  right: -12vw;
  width: 30vw;
  height: 30vw;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(34, 198, 197, 0.12), transparent 66%);
}

.ambient-b {
  bottom: -18vw;
  left: 20vw;
  width: 42vw;
  height: 42vw;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(241, 38, 95, 0.08), transparent 68%);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 12px clamp(20px, 4vw, 64px);
  border-bottom: 1px solid var(--line);
  background: rgba(7, 9, 9, 0.86);
  backdrop-filter: blur(22px);
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  color: inherit;
  text-decoration: none;
}

.brand-link img {
  width: 42px;
  height: 44px;
  object-fit: contain;
  filter: invert(1);
}

.brand-link span {
  display: grid;
  gap: 2px;
}

.brand-link b {
  font-size: 15px;
  letter-spacing: 0.16em;
}

.brand-link small {
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.2em;
}

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

.local-badge,
.ghost-link {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 13px;
  border: 1px solid var(--line);
  color: var(--muted-strong);
  background: rgba(255, 255, 255, 0.025);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-decoration: none;
}

.local-badge i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(var(--accent-rgb), 0.72);
}

.ghost-link {
  transition: color 180ms ease, border-color 180ms ease, background 180ms ease;
}

.ghost-link:hover {
  color: var(--text);
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.06);
}

.studio-shell {
  width: min(calc(100% - 48px), 1560px);
  margin: 0 auto;
  padding: 64px 0 72px;
}

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.7fr);
  align-items: end;
  gap: 48px;
  margin-bottom: 42px;
}

.eyebrow {
  display: block;
  margin-bottom: 10px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.2em;
}

.intro h1 {
  max-width: 860px;
  margin: 0;
  font-size: clamp(42px, 6vw, 86px);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.intro p {
  max-width: 520px;
  margin: 0 0 8px;
  color: var(--muted-strong);
  font-size: 15px;
  line-height: 1.8;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(340px, 0.74fr) minmax(560px, 1.7fr);
  min-height: 760px;
  border: 1px solid var(--line);
  background: rgba(7, 9, 9, 0.54);
  box-shadow: 0 42px 120px rgba(0, 0, 0, 0.32);
}

.control-panel {
  min-width: 0;
  border-right: 1px solid var(--line);
  background: rgba(10, 13, 12, 0.84);
}

.control-section {
  padding: 28px;
  border-bottom: 1px solid var(--line);
}

.control-section:last-child {
  border-bottom: 0;
}

.section-heading {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 12px;
  margin-bottom: 22px;
}

.section-heading .step {
  padding-top: 4px;
  color: var(--accent);
  font: 800 10px/1 monospace;
  letter-spacing: 0.08em;
}

.section-heading h2 {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0.02em;
}

.section-heading p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.logo-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.logo-option {
  position: relative;
  min-width: 0;
}

.logo-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.logo-option-card {
  position: relative;
  min-height: 104px;
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  background:
    linear-gradient(rgba(255, 255, 255, 0.024) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.024) 1px, transparent 1px),
    rgba(255, 255, 255, 0.018);
  background-size: 12px 12px;
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease;
}

.logo-option-card img {
  width: 100%;
  height: 58px;
  display: block;
  object-fit: contain;
  filter: invert(1);
  opacity: 0.72;
}

.logo-option-card span {
  min-width: 0;
  overflow: hidden;
  color: var(--muted-strong);
  font-size: 10px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logo-option-card::after {
  content: "";
  position: absolute;
  top: 10px;
  right: 10px;
  width: 14px;
  height: 14px;
  border: 1px solid var(--line-strong);
  background: var(--ink);
}

.logo-option input:checked + .logo-option-card {
  border-color: rgba(var(--accent-rgb), 0.6);
  background-color: rgba(var(--accent-rgb), 0.055);
}

.logo-option input:checked + .logo-option-card::after {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: inset 0 0 0 3px var(--ink), 0 0 14px rgba(var(--accent-rgb), 0.22);
}

.logo-option input:checked + .logo-option-card img {
  opacity: 1;
}

.logo-option input:focus-visible + .logo-option-card {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.logo-remove {
  position: absolute;
  z-index: 2;
  top: 6px;
  left: 6px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 0;
  color: var(--muted);
  background: rgba(7, 9, 9, 0.78);
  cursor: pointer;
}

.logo-remove:hover {
  color: var(--text);
}

.upload-button {
  min-height: 56px;
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  gap: 1px 10px;
  margin-top: 9px;
  padding: 10px 14px;
  border: 1px dashed var(--line-strong);
  color: var(--muted-strong);
  cursor: pointer;
  transition: color 180ms ease, border-color 180ms ease, background 180ms ease;
}

.upload-button:hover {
  color: var(--text);
  border-color: rgba(var(--accent-rgb), 0.62);
  background: rgba(var(--accent-rgb), 0.04);
}

.upload-button svg {
  grid-row: 1 / span 2;
  width: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.upload-button span {
  font-size: 11px;
  font-weight: 700;
}

.upload-button small {
  color: var(--muted);
  font-size: 9px;
}

.palette-list {
  display: grid;
  gap: 8px;
}

.palette-row {
  display: grid;
  grid-template-columns: 20px 38px minmax(74px, 0.75fr) minmax(86px, 1fr) 28px;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.palette-row > input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
}

.color-well {
  position: relative;
  width: 38px;
  height: 34px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  background: var(--row-color);
}

.color-well input {
  position: absolute;
  inset: -8px;
  width: 54px;
  height: 50px;
  border: 0;
  opacity: 0;
  cursor: pointer;
}

.palette-name,
.palette-hex,
.text-field input {
  min-width: 0;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 0;
  color: var(--text);
  background: rgba(255, 255, 255, 0.028);
  padding: 0 9px;
  font-size: 10px;
}

.palette-hex {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  text-transform: uppercase;
}

.palette-delete {
  width: 28px;
  height: 28px;
  border: 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.palette-delete:hover {
  color: var(--rose);
}

.text-button {
  margin-top: 12px;
  padding: 0;
  border: 0;
  color: var(--muted-strong);
  background: transparent;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
}

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

.field-group {
  min-width: 0;
  margin: 0 0 22px;
  padding: 0;
  border: 0;
}

.field-group legend {
  margin-bottom: 10px;
  color: var(--muted-strong);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 3px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.22);
}

.segmented-three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.segmented label {
  position: relative;
  min-width: 0;
}

.segmented input {
  position: absolute;
  opacity: 0;
}

.segmented span {
  min-height: 34px;
  display: grid;
  place-items: center;
  padding: 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}

.segmented input:checked + span {
  color: var(--ink);
  background: var(--accent);
}

.segmented input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.field-help {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 9px;
}

.text-field {
  display: grid;
  gap: 7px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 9px;
}

.custom-size-field[hidden] {
  display: none;
}

.text-field input {
  width: 100%;
  height: 38px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.range-field {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.range-field span {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 9px;
}

.range-field output {
  color: var(--muted-strong);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.range-field input {
  width: 100%;
  height: 2px;
  margin: 6px 0;
  accent-color: var(--accent);
}

.background-options {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}

.background-choice {
  position: relative;
  display: grid;
  gap: 6px;
  justify-items: center;
  color: var(--muted);
  cursor: pointer;
}

.background-choice > input[type="radio"] {
  position: absolute;
  opacity: 0;
}

.background-choice > span,
.background-choice > input[type="color"] {
  width: 100%;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 0;
}

.background-choice > input[type="color"] {
  padding: 0;
  background: transparent;
  cursor: pointer;
}

.background-choice > input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.background-choice > input[type="color"]::-webkit-color-swatch {
  border: 0;
}

.transparent-choice > span {
  background:
    linear-gradient(45deg, #39403d 25%, transparent 25%, transparent 75%, #39403d 75%),
    linear-gradient(45deg, #39403d 25%, #202522 25%, #202522 75%, #39403d 75%);
  background-position: 0 0, 7px 7px;
  background-size: 14px 14px;
}

.paper-choice > span {
  background: var(--paper);
}

.ink-choice > span {
  background: var(--ink);
}

.background-choice small {
  font-size: 8px;
}

.background-choice:has(input[type="radio"]:checked) {
  color: var(--text);
}

.background-choice:has(input[type="radio"]:checked) > span,
.background-choice:has(input[type="radio"]:checked) > input[type="color"] {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.check-field {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  padding: 13px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
}

.check-field input {
  width: 16px;
  height: 16px;
  margin: 1px 0 0;
  accent-color: var(--accent);
}

.check-field span {
  display: grid;
  gap: 3px;
}

.check-field b {
  font-size: 10px;
}

.check-field small {
  color: var(--muted);
  font-size: 9px;
  line-height: 1.5;
}

.preview-panel {
  position: sticky;
  top: 78px;
  align-self: start;
  min-width: 0;
  min-height: calc(100vh - 102px);
  display: grid;
  grid-template-rows: auto auto minmax(420px, 1fr) auto;
  background:
    radial-gradient(circle at 80% 10%, rgba(var(--accent-rgb), 0.07), transparent 28%),
    rgba(5, 7, 7, 0.42);
}

.preview-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 28px 30px 20px;
}

.preview-toolbar h2 {
  margin: 0;
  font-size: clamp(20px, 2vw, 28px);
  letter-spacing: -0.02em;
}

.preview-meta {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.preview-meta span {
  padding: 7px 9px;
  border: 1px solid var(--line);
  color: var(--muted);
  font: 700 9px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.color-tabs {
  display: flex;
  gap: 8px;
  padding: 0 30px 20px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.color-tab {
  flex: none;
  min-width: 110px;
  min-height: 48px;
  display: grid;
  grid-template-columns: 13px 1fr;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.018);
  text-align: left;
  cursor: pointer;
}

.color-tab i {
  width: 13px;
  height: 24px;
  background: var(--tab-color);
}

.color-tab span {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.color-tab b {
  overflow: hidden;
  color: var(--muted-strong);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.color-tab small {
  font: 8px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.color-tab[aria-selected="true"] {
  border-color: var(--tab-color);
  color: var(--text);
  background: color-mix(in srgb, var(--tab-color) 8%, transparent);
}

.color-tab[aria-selected="true"] b {
  color: var(--text);
}

.preview-grid-wrap {
  position: relative;
  min-height: 420px;
  overflow: auto;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(rgba(255, 255, 255, 0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.022) 1px, transparent 1px);
  background-size: 24px 24px;
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  padding: 1px;
  background: var(--line);
}

.preview-card {
  min-width: 0;
  min-height: 280px;
  display: grid;
  grid-template-rows: auto minmax(170px, 1fr) auto;
  gap: 12px;
  padding: 18px;
  color: var(--preview-ink);
  background: var(--preview-bg);
}

.preview-card.transparent-preview {
  background:
    linear-gradient(45deg, var(--checker-a) 25%, transparent 25%, transparent 75%, var(--checker-a) 75%),
    linear-gradient(45deg, var(--checker-a) 25%, var(--checker-b) 25%, var(--checker-b) 75%, var(--checker-a) 75%);
  background-position: 0 0, 10px 10px;
  background-size: 20px 20px;
}

.preview-card-head,
.preview-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--preview-caption);
}

.preview-card-head b {
  overflow: hidden;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-card-head span,
.preview-card-foot span {
  flex: none;
  font: 8px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.preview-logo-stage {
  min-height: 170px;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.preview-logo-stage img {
  display: block;
  width: 82%;
  height: 82%;
  object-fit: contain;
}

.empty-state {
  min-height: 420px;
  display: grid;
  place-content: center;
  justify-items: center;
  color: var(--muted);
  text-align: center;
}

.empty-state[hidden] {
  display: none;
}

.empty-state svg {
  width: 42px;
  margin-bottom: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.2;
}

.empty-state h3 {
  margin: 0 0 6px;
  color: var(--muted-strong);
  font-size: 14px;
}

.empty-state p {
  margin: 0;
  font-size: 10px;
}

.export-dock {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  padding: 20px 28px;
  background: rgba(7, 9, 9, 0.92);
}

.export-copy {
  display: grid;
  gap: 4px;
}

.export-copy b {
  font-size: 11px;
}

.export-copy span {
  color: var(--muted);
  font-size: 9px;
}

.export-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.secondary-button,
.primary-button {
  min-height: 46px;
  border: 1px solid var(--line-strong);
  padding: 0 17px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.secondary-button {
  color: var(--muted-strong);
  background: rgba(255, 255, 255, 0.03);
}

.secondary-button:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
}

.primary-button {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  border-color: var(--accent);
  color: var(--ink);
  background: var(--accent);
  box-shadow: 0 12px 38px rgba(var(--accent-rgb), 0.16);
}

.primary-button:hover {
  filter: brightness(1.08);
}

.primary-button svg {
  width: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.secondary-button:disabled,
.primary-button:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.toast-region {
  position: fixed;
  z-index: 50;
  right: 22px;
  bottom: 22px;
  display: grid;
  gap: 8px;
}

.toast {
  max-width: 360px;
  padding: 13px 16px;
  border: 1px solid var(--line-strong);
  color: var(--text);
  background: rgba(13, 17, 16, 0.96);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.4);
  font-size: 11px;
  line-height: 1.5;
  animation: toast-in 220ms ease both;
}

.toast.error {
  border-color: rgba(241, 38, 95, 0.64);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.export-overlay {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(3, 5, 4, 0.82);
  backdrop-filter: blur(18px);
}

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

.progress-card {
  width: min(420px, 100%);
  padding: 42px;
  border: 1px solid var(--line-strong);
  background: var(--ink-soft);
  text-align: center;
  box-shadow: 0 32px 100px rgba(0, 0, 0, 0.5);
}

.progress-card h2 {
  margin: 8px 0 7px;
  font-size: 20px;
}

.progress-card p {
  min-height: 20px;
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 10px;
}

.progress-orbit {
  position: relative;
  width: 72px;
  height: 72px;
  margin: 0 auto 22px;
  border: 1px solid var(--line);
  border-radius: 50%;
  animation: orbit 4s linear infinite;
}

.progress-orbit::after {
  content: "";
  position: absolute;
  inset: 20px;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  border: 2px solid var(--accent);
}

.progress-orbit i {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

.progress-orbit i:nth-child(1) { top: -4px; left: 32px; }
.progress-orbit i:nth-child(2) { right: 4px; bottom: 10px; background: var(--rose); }
.progress-orbit i:nth-child(3) { left: 4px; bottom: 10px; background: var(--cyan); }

@keyframes orbit {
  to { transform: rotate(360deg); }
}

.progress-track {
  height: 3px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
}

.progress-track i {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--accent), var(--rose));
  transition: width 140ms ease;
}

.motion-studio {
  position: relative;
  margin-top: 72px;
  padding-top: 56px;
  border-top: 1px solid var(--line);
}

.motion-symbols {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.motion-heading {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr);
  align-items: end;
  gap: 48px;
  margin-bottom: 28px;
}

.motion-heading h2 {
  max-width: 780px;
  margin: 0;
  font-size: clamp(34px, 4.4vw, 64px);
  line-height: 1.02;
  letter-spacing: -0.045em;
}

.motion-heading p {
  max-width: 560px;
  margin: 0 0 4px;
  color: var(--muted-strong);
  font-size: 14px;
  line-height: 1.75;
}

.motion-settings {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  background: rgba(12, 16, 15, 0.78);
}

.motion-setting {
  display: grid;
  gap: 7px;
}

.motion-setting-resolution {
  min-width: 220px;
}

.motion-setting-format {
  min-width: 170px;
}

.motion-setting-fps {
  min-width: 130px;
}

.motion-setting > span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.motion-settings select {
  min-height: 42px;
  padding: 0 38px 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  color: var(--text);
  background: #101413;
  cursor: pointer;
}

.motion-settings select:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.motion-caption-toggle {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  background: #101413;
  cursor: pointer;
}

.motion-caption-toggle input {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: var(--accent);
}

.motion-caption-toggle > span {
  display: grid;
  gap: 2px;
}

.motion-caption-toggle b {
  font-size: 10px;
  letter-spacing: 0.06em;
}

.motion-caption-toggle small {
  color: var(--muted);
  font-size: 8px;
}

.motion-local-note {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 4px 11px auto;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.motion-local-note i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(var(--accent-rgb), 0.76);
}

.motion-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.motion-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  background: rgba(10, 13, 12, 0.88);
}

.motion-card-preview {
  position: relative;
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: #020303;
}

.motion-card-preview::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 28px 28px;
  mix-blend-mode: screen;
}

.motion-card-preview svg {
  position: relative;
  z-index: 2;
  width: min(48%, 340px);
  overflow: visible;
  fill: none;
  stroke: #f9faee;
  stroke-width: 9;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 9px rgba(217, 240, 26, 0.36));
}

.motion-card-preview > span {
  position: absolute;
  z-index: 3;
  right: 18px;
  bottom: 14px;
  color: rgba(249, 250, 238, 0.64);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.motion-beam {
  position: absolute;
  inset: -40%;
  background:
    radial-gradient(circle at 50% 50%, rgba(217, 240, 26, 0.12), transparent 28%),
    conic-gradient(from 110deg at 50% 50%, transparent 0 42%, rgba(217, 240, 26, 0.16) 49%, transparent 55% 100%);
  animation: motionBeam 4.8s linear infinite;
}

.motion-fluid {
  position: absolute;
  inset: -18%;
  background:
    radial-gradient(ellipse at 28% 22%, rgba(34, 198, 197, 0.9), transparent 26%),
    radial-gradient(ellipse at 70% 60%, rgba(217, 240, 26, 0.86), transparent 28%),
    radial-gradient(ellipse at 42% 88%, rgba(241, 38, 95, 0.78), transparent 25%),
    #030505;
  filter: contrast(1.4) saturate(1.18);
  animation: motionFluid 7s ease-in-out infinite alternate;
}

.motion-card-vi .motion-card-preview svg {
  stroke: #fffef4;
  filter: drop-shadow(0 0 10px rgba(34, 198, 197, 0.62));
}

.motion-card-body {
  display: grid;
  gap: 24px;
  padding: 24px;
}

.motion-kicker {
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.motion-card h3 {
  margin: 9px 0 8px;
  font-size: 22px;
  letter-spacing: -0.025em;
}

.motion-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.motion-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.motion-card-actions a {
  color: var(--muted-strong);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-decoration: none;
}

.motion-card-actions a:hover {
  color: var(--text);
}

.motion-export-button {
  min-width: 138px;
  min-height: 44px;
  border: 1px solid var(--accent);
  color: #070909;
  background: var(--accent);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: transform 160ms ease, filter 160ms ease, opacity 160ms ease;
}

.motion-export-button:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

.motion-export-button:disabled {
  opacity: 0.42;
  cursor: wait;
  transform: none;
}

@keyframes motionBeam {
  to { transform: rotate(360deg); }
}

@keyframes motionFluid {
  0% { transform: translate3d(-3%, -2%, 0) rotate(-4deg) scale(1.08); }
  55% { transform: translate3d(4%, 1%, 0) rotate(5deg) scale(1.16); }
  100% { transform: translate3d(-1%, 4%, 0) rotate(-1deg) scale(1.1); }
}

@media (max-width: 1120px) {
  .studio-shell {
    width: min(calc(100% - 32px), 980px);
  }

  .workspace {
    grid-template-columns: 380px minmax(0, 1fr);
  }

  .preview-grid {
    grid-template-columns: 1fr;
  }

  .preview-card {
    min-height: 245px;
  }

  .export-dock {
    align-items: stretch;
    flex-direction: column;
  }

  .export-actions {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
  }

  .secondary-button,
  .primary-button {
    justify-content: center;
  }

  .motion-heading {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}

@media (max-width: 820px) {
  .topbar {
    position: relative;
  }

  .local-badge,
  .ghost-link:first-of-type {
    display: none;
  }

  .studio-shell {
    width: min(calc(100% - 24px), 640px);
    padding: 38px 0 48px;
  }

  .intro {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .intro h1 {
    font-size: clamp(42px, 12vw, 70px);
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .control-panel {
    border-right: 0;
  }

  .preview-panel {
    position: relative;
    top: auto;
    min-height: 720px;
    border-top: 1px solid var(--line);
  }

  .preview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .preview-card {
    min-height: 250px;
  }

  .motion-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .topbar {
    min-height: 68px;
    padding: 10px 14px;
  }

  .brand-link img {
    width: 36px;
    height: 38px;
  }

  .brand-link b {
    font-size: 13px;
  }

  .brand-link small {
    font-size: 7px;
  }

  .ghost-link {
    min-height: 34px;
    padding: 0 9px;
    font-size: 9px;
  }

  .intro h1 {
    font-size: 42px;
  }

  .intro p {
    font-size: 13px;
  }

  .control-section {
    padding: 24px 18px;
  }

  .palette-row {
    grid-template-columns: 18px 34px minmax(68px, 0.78fr) minmax(82px, 1fr) 24px;
    gap: 6px;
  }

  .color-well {
    width: 34px;
  }

  .preview-toolbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 24px 18px 18px;
  }

  .color-tabs {
    padding: 0 18px 18px;
  }

  .preview-grid {
    grid-template-columns: 1fr;
  }

  .preview-card {
    min-height: 260px;
  }

  .export-dock {
    padding: 18px;
  }

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

  .secondary-button,
  .primary-button {
    width: 100%;
  }

  .toast-region {
    right: 12px;
    bottom: 12px;
    left: 12px;
  }

  .progress-card {
    padding: 32px 22px;
  }

  .motion-studio {
    margin-top: 48px;
    padding-top: 42px;
  }

  .motion-settings {
    display: grid;
    grid-template-columns: 1fr 0.66fr;
  }

  .motion-setting,
  .motion-setting-resolution,
  .motion-setting-format,
  .motion-setting-fps {
    min-width: 0;
  }

  .motion-caption-toggle {
    grid-column: 1 / -1;
  }

  .motion-local-note {
    grid-column: 1 / -1;
    margin: 4px 0 2px;
  }

  .motion-card-body {
    padding: 20px 18px;
  }

  .motion-card-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .motion-export-button {
    width: 100%;
  }
}

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