:root {
  color-scheme: dark;
  --ink: #f5f7fb;
  --muted: #8e96a8;
  --muted-2: #5f6677;
  --void: #07090e;
  --panel: #0d1018;
  --panel-2: #111520;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);
  --violet: #7c5cff;
  --violet-soft: rgba(124, 92, 255, 0.17);
  --cyan: #5ce1e6;
  --green: #61e3a5;
  --warning: #ffbd66;
  --danger: #ff6f91;
  --radius: 14px;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sans: Inter, "Segoe UI Variable", "Yu Gothic UI", "Yu Gothic", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--void);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: var(--sans);
  background:
    radial-gradient(circle at 76% -15%, rgba(124, 92, 255, 0.15), transparent 32rem),
    linear-gradient(135deg, #07090e 0%, #090c13 48%, #080a10 100%);
  overflow-x: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
.drop-panel:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

button:disabled,
input:disabled,
select:disabled {
  cursor: not-allowed;
}

.hidden {
  display: none !important;
}

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

.skip-link {
  position: fixed;
  z-index: 100;
  top: 10px;
  left: 10px;
  padding: 10px 14px;
  color: #080b12;
  background: var(--cyan);
  border-radius: 8px;
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.app-shell {
  width: min(1780px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  border-inline: 1px solid rgba(255, 255, 255, 0.04);
  background: rgba(7, 9, 14, 0.73);
  backdrop-filter: blur(18px);
}

.topbar {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(8, 10, 16, 0.88);
  backdrop-filter: blur(24px);
}

.brand-block,
.privacy-pill,
.run-button,
.section-title-row,
.status-line {
  display: flex;
  align-items: center;
}

.brand-block {
  gap: 12px;
  letter-spacing: 0.08em;
}

.brand-block > span:last-child,
.privacy-pill > span:nth-child(2),
.run-button > span:nth-child(2) {
  display: flex;
  flex-direction: column;
}

.brand-block strong {
  font-size: 15px;
  font-weight: 760;
}

.brand-block small {
  margin-top: 1px;
  color: var(--muted);
  font: 11px/1.2 var(--mono);
  letter-spacing: 0.13em;
}

.brand-mark {
  display: grid;
  width: 35px;
  height: 35px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: linear-gradient(145deg, #181d2a, #0d1018);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.06), 0 8px 30px rgba(0, 0, 0, 0.3);
}

.brand-mark svg {
  width: 24px;
  fill: var(--ink);
}

.brand-mark .accent {
  fill: var(--violet);
}

.privacy-pill {
  gap: 10px;
  min-width: 206px;
  padding: 8px 10px 8px 12px;
  border: 1px solid rgba(97, 227, 165, 0.2);
  border-radius: 10px;
  background: rgba(97, 227, 165, 0.06);
}

.privacy-pill strong {
  color: var(--green);
  font: 700 11px/1.2 var(--mono);
  letter-spacing: 0.12em;
}

.privacy-pill small {
  margin-top: 2px;
  color: #bac2cf;
  font-size: 12px;
}

.privacy-pill svg {
  width: 19px;
  margin-left: auto;
  fill: none;
  stroke: var(--green);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(97, 227, 165, 0.1), 0 0 16px var(--green);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(360px, 420px) minmax(0, 1fr);
  height: calc(100vh - 104px);
  min-height: calc(100vh - 104px);
}

.control-deck {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100%;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(16, 19, 29, 0.96), rgba(10, 13, 20, 0.96));
}

.deck-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.018);
}

.eyebrow,
.deck-state,
.count-chip,
.empty-index,
.run-summary,
.app-footer {
  font-family: var(--mono);
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.eyebrow {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.deck-state {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--green);
  font-size: 10px;
}

.deck-state::before {
  width: 5px;
  height: 5px;
  content: "";
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}

.deck-state.busy {
  color: var(--warning);
}

.import-section,
.preset-section,
.destination-section {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.preset-section {
  padding-bottom: 15px;
}

.section-title-row {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 13px;
}

.section-title-row h1,
.section-title-row h2,
.stage-toolbar h2 {
  margin: 2px 0 0;
  font-size: 17px;
  font-weight: 680;
  letter-spacing: 0.01em;
}

.section-title-row > span,
#import-count {
  color: var(--muted);
  font: 11px/1 var(--mono);
  letter-spacing: 0.08em;
}

.import-actions {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 8px;
}

.primary-button,
.secondary-button,
.add-preset-button,
.run-button,
.icon-text-button,
.icon-button,
.text-button,
.preset-toggle,
.remove-preset,
.select-check,
.file-remove {
  border: 0;
  cursor: pointer;
}

.primary-button,
.secondary-button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  gap: 8px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 670;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.primary-button {
  color: #fff;
  background: linear-gradient(135deg, #7154f2, #8a6cff);
  box-shadow: 0 8px 24px rgba(124, 92, 255, 0.2), inset 0 1px rgba(255, 255, 255, 0.16);
}

.secondary-button {
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.035);
}

.primary-button:hover:not(:disabled),
.secondary-button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.secondary-button:hover:not(:disabled) {
  border-color: rgba(124, 92, 255, 0.5);
  background: rgba(124, 92, 255, 0.08);
}

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

.microcopy {
  margin: 10px 0 0;
  color: var(--muted-2);
  font-size: 12px;
  line-height: 1.5;
}

.count-chip {
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #b9c0ce !important;
  background: rgba(255, 255, 255, 0.025);
  font-size: 11px !important;
}

.preset-list {
  display: grid;
  gap: 9px;
}

.preset-card {
  --accent: var(--violet);
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.018));
  box-shadow: inset 3px 0 var(--accent);
  transition: border-color 160ms ease, opacity 160ms ease, background 160ms ease;
}

.preset-card.accent-2 { --accent: #4cc5ea; }
.preset-card.accent-3 { --accent: #61e3a5; }
.preset-card.accent-4 { --accent: #ffbd66; }
.preset-card.accent-5 { --accent: #ff779d; }

.preset-card:hover {
  border-color: color-mix(in srgb, var(--accent) 38%, var(--line));
}

.preset-card.is-off {
  opacity: 0.47;
  box-shadow: inset 3px 0 #555b67;
}

.preset-card-header {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 8px 10px 8px 12px;
  border-bottom: 1px solid var(--line);
}

.preset-toggle {
  position: relative;
  display: inline-flex;
  width: 35px;
  height: 20px;
  padding: 2px;
  border-radius: 999px;
  background: #323744;
}

.preset-toggle::after {
  width: 16px;
  height: 16px;
  content: "";
  border-radius: 50%;
  background: #a9afbb;
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.preset-toggle[aria-pressed="true"] {
  background: color-mix(in srgb, var(--accent) 36%, #252a36);
}

.preset-toggle[aria-pressed="true"]::after {
  background: var(--accent);
  box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 65%, transparent);
  transform: translateX(15px);
}

.preset-title {
  display: flex;
  flex: 1;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.preset-title strong {
  color: #cbd0db;
  font: 700 11px/1 var(--mono);
  letter-spacing: 0.1em;
}

.preset-title span {
  overflow: hidden;
  color: var(--ink);
  font: 700 14px/1 var(--mono);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.remove-preset,
.icon-button,
.file-remove,
.select-check {
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: transparent;
}

.remove-preset {
  width: 26px;
  height: 26px;
  color: var(--muted);
}

.remove-preset:hover:not(:disabled) {
  color: var(--danger);
  background: rgba(255, 111, 145, 0.1);
}

.remove-preset svg,
.icon-button svg,
.file-remove svg {
  width: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.7;
}

.preset-editor {
  display: grid;
  gap: 10px;
  padding: 11px 12px 12px;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 14px 1fr 1.16fr;
  gap: 7px;
  align-items: end;
}

.field,
.background-field {
  display: grid;
  gap: 5px;
}

.field > span,
.background-field > span,
.format-label {
  color: var(--muted);
  font: 11px/1 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.field input[type="number"],
.hex-input {
  width: 100%;
  min-width: 0;
  height: 33px;
  padding: 0 8px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 7px;
  outline: none;
  background: rgba(0, 0, 0, 0.25);
  font: 13px/1 var(--mono);
}

.field input:hover:not(:disabled),
.hex-input:hover:not(:disabled),
.field input:focus,
.hex-input:focus {
  border-color: color-mix(in srgb, var(--accent) 55%, #5c6372);
}

.times-mark {
  display: grid;
  height: 33px;
  place-items: center;
  color: var(--muted-2);
  font-family: var(--mono);
}

.field-with-unit {
  position: relative;
}

.field-with-unit input {
  padding-right: 30px !important;
}

.field-with-unit small {
  position: absolute;
  right: 8px;
  bottom: 11px;
  color: var(--muted-2);
  font: 10px/1 var(--mono);
  pointer-events: none;
}

.format-row {
  display: grid;
  grid-template-columns: 78px 1fr;
  gap: 8px;
  align-items: center;
}

.format-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.22);
}

.format-option {
  position: relative;
}

.format-option input {
  position: absolute;
  opacity: 0;
}

.format-option span {
  display: grid;
  min-height: 27px;
  place-items: center;
  border-radius: 5px;
  color: var(--muted);
  cursor: pointer;
  font: 11px/1 var(--mono);
  transition: color 160ms ease, background 160ms ease;
}

.format-option input:checked + span {
  color: #fff;
  background: color-mix(in srgb, var(--accent) 27%, rgba(255, 255, 255, 0.06));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent);
}

.format-option input:focus-visible + span {
  outline: 2px solid var(--cyan);
  outline-offset: 1px;
}

.background-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 9px;
  align-items: end;
}

.background-field.is-disabled {
  opacity: 0.4;
  filter: grayscale(1);
}

.color-control input:disabled {
  cursor: not-allowed;
}

.color-control {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 6px;
}

.color-control input[type="color"] {
  width: 34px;
  height: 33px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.25);
  cursor: pointer;
}

.transparency-control {
  display: flex;
  align-items: center;
  min-height: 33px;
  gap: 7px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: #bbc2cf;
  background: rgba(0, 0, 0, 0.18);
  cursor: pointer;
  font-size: 12px;
}

.transparency-control input {
  width: 13px;
  height: 13px;
  margin: 0;
  accent-color: var(--accent);
}

.transparency-control.is-disabled {
  color: var(--muted-2);
  cursor: not-allowed;
}

.format-hint {
  margin: -3px 0 0;
  color: var(--muted-2);
  font-size: 11px;
  line-height: 1.45;
}

.add-preset-button {
  display: flex;
  width: 100%;
  min-height: 39px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 9px;
  color: #c8cdd7;
  border: 1px dashed rgba(124, 92, 255, 0.35);
  border-radius: 10px;
  background: rgba(124, 92, 255, 0.045);
  font: 700 11px/1 var(--mono);
  letter-spacing: 0.09em;
}

.add-preset-button .add-icon {
  color: var(--violet);
  font-size: 16px;
}

.add-preset-button strong {
  font: inherit;
}

.add-preset-button small {
  color: var(--muted-2);
  font: 11px/1 var(--sans);
}

.add-preset-button:hover:not(:disabled) {
  color: white;
  border-color: var(--violet);
  background: rgba(124, 92, 255, 0.1);
}

.download-mode-toggle {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.18);
}

.download-mode-toggle button {
  display: flex;
  min-height: 57px;
  width: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
}

.download-mode-toggle button[aria-pressed="true"] {
  color: var(--ink);
  border-color: rgba(124, 92, 255, 0.5);
  background: linear-gradient(120deg, rgba(124, 92, 255, 0.27), rgba(124, 92, 255, 0.1));
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.18);
}

.download-mode-toggle button:hover:not(:disabled):not([aria-pressed="true"]) {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.045);
}

.download-mode-toggle button:disabled {
  opacity: 0.5;
}

.download-mode-toggle strong {
  font-size: 13px;
  letter-spacing: 0.04em;
}

.download-mode-toggle small {
  font-size: 10px;
  font-weight: 400;
}

.download-mode-detail {
  min-height: 2.8em;
}

.download-results {
  margin-top: 12px;
  padding: 10px 0 2px;
  border-top: 1px solid var(--line);
  font-size: 12px;
}

.download-results summary {
  cursor: pointer;
  color: var(--ink);
}

.download-results summary span {
  margin-left: 5px;
  color: var(--cyan);
  font-family: var(--mono);
}

#download-list {
  display: grid;
  gap: 5px;
  max-height: 180px;
  margin: 8px 0 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}

.download-result-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.025);
}

.download-result-meta {
  display: grid;
  min-width: 0;
  flex: 1;
  gap: 3px;
}

.download-result-name {
  overflow: hidden;
  font-size: 11px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.download-result-meta small {
  color: var(--muted);
  font: 10px/1.2 var(--mono);
}

.download-result-row button {
  min-height: 32px;
  flex: 0 0 auto;
  padding: 0 9px;
  font-size: 11px;
}

.run-panel {
  position: sticky;
  bottom: 0;
  z-index: 5;
  margin-top: auto;
  padding: 14px 20px 18px;
  border-top: 1px solid var(--line);
  background: rgba(10, 13, 20, 0.94);
  backdrop-filter: blur(16px);
}

.run-summary {
  display: flex;
  justify-content: space-between;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 10px;
}

.run-summary strong {
  color: var(--ink);
  font-size: 13px;
}

.run-button {
  width: 100%;
  min-height: 57px;
  gap: 11px;
  padding: 8px 10px;
  text-align: left;
  border-radius: 11px;
  background: linear-gradient(135deg, #694af0, #8f6dff 60%, #7656f6);
  box-shadow: 0 12px 30px rgba(124, 92, 255, 0.24), inset 0 1px rgba(255, 255, 255, 0.2);
  transition: filter 160ms ease, transform 160ms ease, opacity 160ms ease;
}

.run-button:hover:not(:disabled) {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.run-button:disabled {
  opacity: 0.32;
  box-shadow: none;
}

.run-icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 9px;
  background: rgba(8, 5, 24, 0.2);
}

.run-icon svg {
  width: 20px;
  fill: white;
}

.run-button strong {
  font-size: 14px;
}

.run-button small {
  margin-top: 2px;
  opacity: 0.65;
  font: 10px/1 var(--mono);
  letter-spacing: 0.12em;
}

.shortcut {
  margin-left: auto;
  padding: 5px 7px;
  border: 1px solid rgba(255, 255, 255, 0.17);
  border-radius: 5px;
  color: rgba(255, 255, 255, 0.62);
  font: 10px/1 var(--mono);
}

.full-width {
  width: 100%;
  margin-top: 8px;
}

.stage {
  display: grid;
  min-width: 0;
  height: 100%;
  min-height: 0;
  grid-template-rows: auto minmax(360px, 1fr) auto;
  padding: 0 22px 18px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 34px 34px;
}

.stage-toolbar {
  display: flex;
  min-height: 71px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-text-button,
.icon-button {
  display: flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 10px;
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
  font-size: 12px;
}

.icon-button {
  width: 34px;
  padding: 0;
}

.icon-text-button svg {
  width: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.55;
}

.icon-text-button:hover:not(:disabled),
.icon-button:hover:not(:disabled),
.icon-text-button[aria-pressed="true"] {
  color: var(--ink);
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.055);
}

.icon-text-button:disabled,
.icon-button:disabled {
  opacity: 0.3;
}

.drop-panel {
  position: relative;
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(9, 12, 18, 0.81);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.025), 0 18px 50px rgba(0, 0, 0, 0.18);
}

.drop-panel::before,
.drop-panel::after {
  position: absolute;
  z-index: 2;
  width: 16px;
  height: 16px;
  content: "";
  pointer-events: none;
}

.drop-panel::before {
  top: -1px;
  left: -1px;
  border-top: 1px solid var(--violet);
  border-left: 1px solid var(--violet);
  border-radius: 14px 0 0;
}

.drop-panel::after {
  right: -1px;
  bottom: -1px;
  border-right: 1px solid var(--cyan);
  border-bottom: 1px solid var(--cyan);
  border-radius: 0 0 14px;
}

.drop-panel.is-empty {
  display: grid;
  overflow: hidden;
  place-items: center;
  cursor: pointer;
  border-style: dashed;
  border-color: rgba(124, 92, 255, 0.28);
  background: rgba(10, 13, 20, 0.63);
}

.drop-panel.is-dragging {
  border-color: var(--violet);
  box-shadow: inset 0 0 0 1px var(--violet), 0 0 42px rgba(124, 92, 255, 0.17);
}

.empty-state {
  position: relative;
  display: grid;
  width: min(460px, 88%);
  min-height: 260px;
  place-items: center;
  align-content: center;
  text-align: center;
}

.empty-state::before,
.empty-state::after {
  position: absolute;
  content: "";
  background: var(--line);
}

.empty-state::before {
  top: 28px;
  bottom: 28px;
  left: 50%;
  width: 1px;
}

.empty-state::after {
  right: 28px;
  left: 28px;
  top: 50%;
  height: 1px;
}

.empty-state > * {
  position: relative;
  z-index: 1;
}

.drop-glyph {
  display: grid;
  width: 72px;
  height: 72px;
  margin-bottom: 14px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(124, 92, 255, 0.12), rgba(255, 255, 255, 0.025));
  box-shadow: 0 16px 45px rgba(0, 0, 0, 0.28);
}

.drop-glyph svg {
  width: 45px;
  fill: none;
  stroke: #b7becd;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.3;
}

.drop-glyph .accent {
  stroke: var(--violet);
}

.empty-index {
  position: absolute;
  top: 13px;
  left: 13px;
  color: var(--muted-2);
  font-size: 10px;
}

.empty-state h3 {
  margin: 0;
  font-size: clamp(18px, 2.4vw, 26px);
  font-weight: 620;
  letter-spacing: -0.025em;
}

.empty-state p {
  margin: 7px 0 17px;
  color: var(--muted);
  font-size: 13px;
}

.privacy-note {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 9px;
  color: #aab2c1;
  border: 1px solid rgba(97, 227, 165, 0.13);
  border-radius: 6px;
  background: rgba(97, 227, 165, 0.04);
  font: 11px/1 var(--mono);
  letter-spacing: 0.04em;
}

.privacy-note span {
  color: var(--green);
  font-size: 6px;
}

.queue {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(126px, 1fr));
  gap: 10px;
  padding: 13px;
}

.queue.is-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.file-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #10141d;
  cursor: pointer;
  transition: border-color 140ms ease, opacity 140ms ease;
}

.file-card.is-selected {
  border-color: var(--violet);
  box-shadow: inset 0 0 0 1px var(--violet);
}

.file-card.is-processing {
  border-color: var(--warning);
}

.file-card.is-done {
  border-color: rgba(97, 227, 165, 0.4);
}

.file-card.is-error {
  border-color: rgba(255, 111, 145, 0.55);
}

.thumb-frame {
  position: relative;
  display: grid;
  aspect-ratio: 1;
  overflow: hidden;
  place-items: center;
  background:
    linear-gradient(45deg, #171b25 25%, transparent 25%),
    linear-gradient(-45deg, #171b25 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #171b25 75%),
    linear-gradient(-45deg, transparent 75%, #171b25 75%), #11151e;
  background-position: 0 0, 0 6px, 6px -6px, -6px 0;
  background-size: 12px 12px;
}

.thumb-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.thumb-fallback {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: var(--muted-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  font: 10px/1 var(--mono);
}

.file-badge {
  position: absolute;
  right: 6px;
  bottom: 6px;
  padding: 4px 5px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 5px;
  color: #d8dce4;
  background: rgba(5, 7, 11, 0.72);
  backdrop-filter: blur(5px);
  font: 9px/1 var(--mono);
  letter-spacing: 0.08em;
}

.select-check,
.file-remove {
  position: absolute;
  z-index: 3;
  top: 6px;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: var(--muted);
  background: rgba(6, 8, 13, 0.75);
  backdrop-filter: blur(7px);
}

.select-check {
  left: 6px;
}

.select-check::after {
  width: 7px;
  height: 4px;
  content: "";
  border-bottom: 1.5px solid currentColor;
  border-left: 1.5px solid currentColor;
  transform: rotate(-45deg) translateY(-1px);
}

.select-check[aria-pressed="true"] {
  color: white;
  border-color: var(--violet);
  background: var(--violet);
}

.file-remove {
  right: 6px;
}

.file-remove:hover {
  color: white;
  border-color: var(--danger);
  background: rgba(255, 111, 145, 0.72);
}

.file-meta {
  display: grid;
  gap: 4px;
  padding: 8px 9px 9px;
}

.file-name {
  overflow: hidden;
  font-size: 12px;
  font-weight: 620;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-detail {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  color: var(--muted-2);
  font: 10px/1.3 var(--mono);
}

.file-status {
  color: var(--muted);
  white-space: nowrap;
}

.file-card.is-processing .file-status { color: var(--warning); }
.file-card.is-done .file-status { color: var(--green); }
.file-card.is-error .file-status { color: var(--danger); }

.queue.is-list .file-card {
  display: grid;
  min-height: 52px;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
}

.queue.is-list .thumb-frame {
  width: 52px;
  height: 52px;
  aspect-ratio: auto;
  border-right: 1px solid var(--line);
}

.queue.is-list .file-meta {
  padding: 7px 10px;
}

.queue.is-list .select-check {
  position: static;
  margin-right: 10px;
}

.queue.is-list .file-remove {
  top: 13px;
  right: 44px;
}

.queue.is-list .file-badge {
  display: none;
}

.drop-overlay {
  position: absolute;
  z-index: 8;
  inset: 0;
  display: grid;
  place-items: center;
  opacity: 0;
  background: rgba(9, 8, 20, 0.78);
  backdrop-filter: blur(8px);
  pointer-events: none;
  transition: opacity 150ms ease;
}

.drop-overlay > div {
  display: grid;
  place-items: center;
  padding: 25px 38px;
  border: 1px dashed rgba(124, 92, 255, 0.62);
  border-radius: 16px;
  background: rgba(124, 92, 255, 0.08);
}

.drop-overlay svg {
  width: 43px;
  margin-bottom: 8px;
  fill: none;
  stroke: #c8ceda;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.25;
}

.drop-overlay svg .accent {
  stroke: var(--violet);
}

.drop-overlay strong {
  font-size: 19px;
}

.drop-overlay span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.drop-panel.is-dragging .drop-overlay {
  opacity: 1;
}

.drop-panel.is-empty .drop-overlay {
  display: none;
}

.status-console {
  margin-top: 12px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(10, 13, 20, 0.9);
}

.status-line {
  min-width: 0;
  gap: 8px;
}

.status-indicator {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px rgba(97, 227, 165, 0.7);
}

.status-console.is-working .status-indicator {
  background: var(--warning);
  box-shadow: 0 0 8px rgba(255, 189, 102, 0.7);
  animation: status-pulse 1.1s ease-in-out infinite;
}

.status-console.is-error .status-indicator {
  background: var(--danger);
  box-shadow: 0 0 8px rgba(255, 111, 145, 0.7);
}

.status-line strong {
  flex: 0 0 auto;
  font-size: 12px;
}

#status-detail {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#status-percent {
  margin-left: auto;
  color: #c7ccd6;
  font: 11px/1 var(--mono);
}

.progress-track {
  height: 2px;
  margin-top: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--violet), var(--cyan));
  box-shadow: 0 0 10px var(--violet);
  transition: width 180ms ease;
}

.activity-details {
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
}

.activity-details summary {
  cursor: pointer;
  user-select: none;
}

.activity-details summary span {
  display: inline-grid;
  min-width: 19px;
  height: 16px;
  margin-left: 4px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 4px;
  font: 9px/1 var(--mono);
}

.activity-details ol {
  max-height: 130px;
  padding: 7px 0 0 21px;
  margin: 0;
  overflow: auto;
  color: #8f98a9;
  font: 10px/1.55 var(--mono);
}

.activity-details li.is-error {
  color: var(--danger);
}

.app-footer {
  display: flex;
  min-height: 32px;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  color: var(--muted-2);
  border-top: 1px solid var(--line);
  background: #07090e;
  font-size: 9px;
}

.toast-stack {
  position: fixed;
  z-index: 100;
  right: 16px;
  bottom: 16px;
  display: grid;
  width: min(370px, calc(100vw - 32px));
  gap: 7px;
  pointer-events: none;
}

.toast {
  padding: 11px 13px;
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--violet);
  border-radius: 9px;
  color: #d9dde6;
  background: rgba(16, 19, 28, 0.95);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(12px);
  font-size: 12px;
  line-height: 1.5;
  animation: toast-in 180ms ease-out;
}

.toast.is-error {
  border-left-color: var(--danger);
}

.toast.is-success {
  border-left-color: var(--green);
}

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

@keyframes status-pulse {
  50% { opacity: 0.35; transform: scale(0.82); }
}

@media (max-width: 980px) {
  .workspace {
    grid-template-columns: 350px minmax(0, 1fr);
  }

  .control-deck .import-section,
  .control-deck .preset-section,
  .control-deck .destination-section,
  .run-panel {
    padding-inline: 15px;
  }

  .stage {
    padding-inline: 14px;
  }

  .toolbar-actions .icon-text-button span {
    display: none;
  }
}

@media (max-width: 760px) {
  .topbar {
    min-height: 64px;
    padding-inline: 14px;
  }

  .privacy-pill {
    min-width: auto;
    padding: 8px;
  }

  .privacy-pill small,
  .privacy-pill svg {
    display: none;
  }

  .workspace {
    display: block;
    height: auto;
    min-height: 0;
  }

  .control-deck {
    height: auto;
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .run-panel {
    position: relative;
  }

  .stage {
    min-height: 620px;
    grid-template-rows: auto minmax(420px, 1fr) auto;
  }

  .stage-toolbar {
    min-height: 66px;
  }
}

@media (max-width: 460px) {
  .brand-block strong {
    font-size: 12px;
  }

  .privacy-pill strong {
    font-size: 8px;
  }

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

  .field-grid {
    grid-template-columns: 1fr 12px 1fr;
  }

  .field-grid .field:last-child {
    grid-column: 1 / -1;
  }

  .format-row {
    grid-template-columns: 1fr;
  }

  .queue {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    padding: 9px;
  }

  .app-footer {
    justify-content: center;
  }

  .app-footer span:last-child {
    display: none;
  }
}

@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;
  }
}

/* The interface follows the browser preference. Image pixels and preset
   backgrounds are not part of the interface theme and are never recolored. */
@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --ink: #202638;
    --muted: #526174;
    --muted-2: #627085;
    --void: #f5f6fb;
    --panel: #ffffff;
    --panel-2: #eef1f7;
    --line: rgba(30, 43, 67, 0.12);
    --line-strong: rgba(30, 43, 67, 0.22);
    --violet: #6644d8;
    --violet-soft: rgba(102, 68, 216, 0.1);
    --cyan: #087a89;
    --green: #18794e;
    --warning: #925b08;
    --danger: #bd3352;
  }

  body {
    background:
      radial-gradient(circle at 76% -15%, rgba(124, 92, 255, 0.09), transparent 32rem),
      linear-gradient(135deg, #f7f8fc 0%, #edf1f8 55%, #f5f6fb 100%);
  }

  .app-shell {
    border-inline-color: var(--line);
    background: rgba(249, 250, 253, 0.8);
  }

  .topbar {
    background: rgba(255, 255, 255, 0.88);
  }

  .brand-mark {
    background: linear-gradient(145deg, #ffffff, #eef0f7);
    box-shadow: inset 0 1px #fff, 0 5px 18px rgba(38, 50, 82, 0.08);
  }

  .privacy-pill {
    border-color: rgba(24, 121, 78, 0.2);
    background: rgba(24, 121, 78, 0.05);
  }

  .privacy-pill small,
  .preset-title strong,
  .transparency-control,
  .privacy-note,
  #status-percent,
  .activity-details ol {
    color: var(--muted);
  }

  .pulse-dot,
  .deck-state::before,
  .status-indicator {
    box-shadow: 0 0 0 3px rgba(24, 121, 78, 0.08);
  }

  .control-deck {
    background: linear-gradient(180deg, #f4f5fa, #eff1f7);
  }

  .deck-heading,
  .download-result-row,
  .icon-text-button,
  .icon-button {
    background: rgba(30, 43, 67, 0.035);
  }

  .primary-button,
  .run-button {
    color: #fff;
    background: linear-gradient(135deg, #6542d5, #7551e5);
    box-shadow: 0 8px 20px rgba(102, 68, 216, 0.15), inset 0 1px rgba(255, 255, 255, 0.16);
  }

  .secondary-button {
    background: rgba(255, 255, 255, 0.8);
  }

  .count-chip {
    color: var(--muted) !important;
    background: rgba(30, 43, 67, 0.035);
  }

  .preset-card {
    background: linear-gradient(135deg, #ffffff, #fafbfe);
    box-shadow: inset 3px 0 var(--accent), 0 2px 8px rgba(38, 50, 82, 0.035);
  }

  .preset-card.accent-2 { --accent: #087da5; }
  .preset-card.accent-3 { --accent: #18794e; }
  .preset-card.accent-4 { --accent: #a36a14; }
  .preset-card.accent-5 { --accent: #c03a6b; }

  .preset-toggle {
    background: #d3d9e5;
  }

  .preset-toggle::after {
    background: #fff;
    box-shadow: 0 1px 3px rgba(30, 43, 67, 0.15);
  }

  .preset-toggle[aria-pressed="true"] {
    background: color-mix(in srgb, var(--accent) 23%, #e7eaf3);
  }

  .preset-toggle[aria-pressed="true"]::after {
    box-shadow: 0 1px 4px color-mix(in srgb, var(--accent) 25%, transparent);
  }

  .field input[type="number"],
  .hex-input,
  .color-control input[type="color"],
  .transparency-control {
    background: #f5f7fb;
  }

  .format-options,
  .download-mode-toggle {
    background: #edf0f6;
  }

  .format-option input:checked + span {
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 9%, #fff);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent);
  }

  .transparency-control.is-disabled {
    color: var(--muted-2);
  }

  .add-preset-button {
    color: var(--violet);
    border-color: rgba(102, 68, 216, 0.3);
    background: rgba(102, 68, 216, 0.035);
  }

  .add-preset-button:hover:not(:disabled) {
    color: var(--violet);
  }

  .download-mode-toggle button[aria-pressed="true"] {
    color: var(--violet);
    background: #fff;
    border-color: rgba(102, 68, 216, 0.35);
    box-shadow: 0 2px 7px rgba(38, 50, 82, 0.07);
  }

  .download-mode-toggle button:hover:not(:disabled):not([aria-pressed="true"]),
  .icon-text-button:hover:not(:disabled),
  .icon-button:hover:not(:disabled),
  .icon-text-button[aria-pressed="true"] {
    background: rgba(102, 68, 216, 0.065);
  }

  .run-panel {
    background: rgba(246, 247, 252, 0.95);
  }

  .stage {
    background-image:
      linear-gradient(rgba(30, 43, 67, 0.035) 1px, transparent 1px),
      linear-gradient(90deg, rgba(30, 43, 67, 0.035) 1px, transparent 1px);
  }

  .drop-panel {
    background: rgba(255, 255, 255, 0.83);
    box-shadow: inset 0 1px #fff, 0 12px 35px rgba(38, 50, 82, 0.06);
  }

  .drop-panel.is-empty {
    background: rgba(255, 255, 255, 0.72);
  }

  .drop-glyph {
    background: linear-gradient(145deg, #eee9ff, #fff);
    box-shadow: 0 10px 25px rgba(102, 68, 216, 0.1);
  }

  .drop-glyph svg,
  .drop-overlay svg {
    stroke: var(--muted);
  }

  .drop-glyph .accent,
  .drop-overlay svg .accent {
    stroke: var(--violet);
  }

  .privacy-note {
    border-color: rgba(24, 121, 78, 0.18);
    background: rgba(24, 121, 78, 0.045);
  }

  .file-card {
    background: #fff;
  }

  .thumb-frame {
    background-image:
      linear-gradient(45deg, #cbd2de 25%, transparent 25%),
      linear-gradient(-45deg, #cbd2de 25%, transparent 25%),
      linear-gradient(45deg, transparent 75%, #cbd2de 75%),
      linear-gradient(-45deg, transparent 75%, #cbd2de 75%);
    background-color: #e8ecf3;
  }

  .file-badge,
  .select-check,
  .file-remove {
    color: var(--muted);
    border-color: var(--line-strong);
    background: rgba(255, 255, 255, 0.9);
  }

  .select-check[aria-pressed="true"] {
    color: #fff;
    border-color: var(--violet);
    background: var(--violet);
  }

  .file-remove:hover {
    color: #fff;
    background: var(--danger);
  }

  .drop-overlay {
    background: rgba(247, 245, 255, 0.88);
  }

  .status-console {
    background: rgba(255, 255, 255, 0.9);
  }

  .progress-track {
    background: #e2e7f0;
  }

  .app-footer {
    background: #f0f2f8;
  }

  .toast {
    color: var(--ink);
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 0 12px 30px rgba(38, 50, 82, 0.13);
  }
}
