:root {
  color-scheme: light dark;
  --bg: #f6f7f5;
  --body-glow-start: rgba(255, 255, 255, 0.7);
  --body-glow-end: rgba(246, 247, 245, 0.94);
  --panel: #ffffff;
  --panel-soft: #fbfcfd;
  --control-bg: #ffffff;
  --control-hover: #fff8f2;
  --text: #20242a;
  --muted: #66717f;
  --line: #d8dee4;
  --line-strong: #b7c0ca;
  --table-head: #f2f5f8;
  --table-head-text: #394452;
  --progress-track: #edf1f5;
  --drop-warm: rgba(216, 107, 36, 0.08);
  --drop-cool: rgba(22, 135, 90, 0.06);
  --focus-ring: rgba(216, 107, 36, 0.14);
  --selected-ring: rgba(216, 107, 36, 0.36);
  --accent: #d86b24;
  --accent-dark: #ad5119;
  --accent-soft: #fff3ea;
  --red: #c2413d;
  --shadow: 0 18px 45px rgba(30, 41, 59, 0.09);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101316;
    --body-glow-start: rgba(28, 32, 36, 0.84);
    --body-glow-end: rgba(16, 19, 22, 0.96);
    --panel: #181d22;
    --panel-soft: #11161a;
    --control-bg: #151a1f;
    --control-hover: #231b16;
    --text: #eef2f6;
    --muted: #9aa7b5;
    --line: #2c343d;
    --line-strong: #485461;
    --table-head: #202730;
    --table-head-text: #d4dce5;
    --progress-track: #252d35;
    --drop-warm: rgba(240, 122, 44, 0.14);
    --drop-cool: rgba(70, 170, 122, 0.08);
    --focus-ring: rgba(240, 122, 44, 0.22);
    --selected-ring: rgba(240, 122, 44, 0.46);
    --accent: #f07a2c;
    --accent-dark: #c96322;
    --accent-soft: #2a1d14;
    --red: #f87171;
    --shadow: 0 18px 45px rgba(0, 0, 0, 0.34);
  }
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(180deg, var(--body-glow-start), var(--body-glow-end)),
    var(--bg);
  font-family: Inter, "Segoe UI", "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

button,
input,
select {
  font: inherit;
}

button,
input,
select {
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--control-bg);
  color: var(--text);
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 14px;
  cursor: pointer;
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    transform 120ms ease;
}

button:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--control-hover);
}

button:active:not(:disabled) {
  transform: translateY(1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
  transform: none;
}

button svg {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

h1,
h2,
p {
  margin: 0;
}

.app-shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 32px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 0 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-icon {
  width: 52px;
  height: 52px;
  object-fit: contain;
}

h1 {
  font-size: 24px;
  line-height: 1.15;
  letter-spacing: 0;
}

h2 {
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: 0;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
  align-items: stretch;
}

.drop-panel,
.controls-panel,
.queue-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.drop-panel {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  padding: 16px;
  align-items: stretch;
}

.drop-zone {
  display: grid;
  height: 174px;
  min-height: 174px;
  place-items: center;
  border: 2px dashed var(--line-strong);
  border-radius: 8px;
  background:
    linear-gradient(135deg, var(--drop-warm), var(--drop-cool)),
    var(--panel-soft);
  text-align: center;
  outline: none;
}

.drop-zone.drag-over,
.drop-zone:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--focus-ring);
}

.drop-copy {
  display: grid;
  justify-items: center;
  gap: 10px;
  max-width: 500px;
  padding: 18px;
}

.drop-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  width: min(360px, 100%);
  margin-top: 2px;
}

.drop-actions button {
  flex: 1 1 150px;
  min-width: 150px;
  padding-inline: 14px;
}

.queue-head p,
.legal {
  color: var(--muted);
}

.drop-symbol {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
}

.drop-symbol::before,
.drop-symbol::after {
  content: "";
  position: absolute;
  inset: 50% auto auto 50%;
  width: 18px;
  height: 3px;
  border-radius: 999px;
  background: #fff;
  transform: translate(-50%, -50%);
}

.drop-symbol::after {
  transform: translate(-50%, -50%) rotate(90deg);
}

.preview-panel {
  display: grid;
  grid-template-columns: 1fr;
  place-items: center;
  min-width: 0;
  height: 174px;
  min-height: 174px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.preview-card {
  display: grid;
  width: 100%;
  height: 144px;
  place-items: center;
  min-width: 0;
  min-height: 0;
}

.preview-canvas {
  display: block;
  width: 100%;
  height: 144px;
  max-height: 144px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--control-bg);
  object-fit: contain;
}

.controls-panel {
  grid-column: 2;
  grid-row: 2;
  align-self: start;
  display: grid;
  gap: 18px;
  padding: 16px;
  align-content: start;
}

.control-group,
.action-row {
  display: grid;
  gap: 10px;
}

.label,
.control-group label span {
  font-weight: 700;
}

.control-group label {
  display: grid;
  gap: 6px;
}

input,
select {
  width: 100%;
  min-height: 38px;
  padding: 0 10px;
}

input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-height: 0;
  padding: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.primary-button {
  color: #fff;
  border-color: var(--accent-dark);
  background: var(--accent);
  font-weight: 700;
}

.primary-button:hover:not(:disabled) {
  background: var(--accent-dark);
}

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

.progress-shell {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--progress-track);
}

.progress-bar {
  width: 0%;
  height: 100%;
  background: var(--accent);
  transition: width 120ms ease;
}

.queue-panel {
  grid-column: 1;
  grid-row: 2;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 16px;
}

.queue-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.queue-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.queue-actions button {
  min-width: 148px;
}

.table-wrap {
  flex: 1;
  min-height: 168px;
  overflow-x: auto;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: var(--panel-soft);
}

table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  padding: 10px 9px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

th {
  background: var(--table-head);
  color: var(--table-head-text);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

td {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 70px;
  max-width: 100%;
  padding: 3px 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 34%, transparent);
  border-radius: 999px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}

.status-active {
  color: var(--text);
  background: color-mix(in srgb, var(--accent) 24%, transparent);
}

.status-done {
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.status-failed {
  color: var(--red);
  border-color: color-mix(in srgb, var(--red) 34%, transparent);
  background: color-mix(in srgb, var(--red) 12%, transparent);
}

tbody tr {
  background: var(--control-bg);
  cursor: pointer;
}

.check-column,
.check-cell {
  width: 42px;
  max-width: 42px;
  text-align: center;
}

.check-column {
  cursor: default;
}

.check-cell {
  padding-inline: 8px;
}

tbody tr:nth-child(even) {
  background: var(--panel-soft);
}

tbody tr.selected {
  outline: 2px solid var(--selected-ring);
  outline-offset: -2px;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.empty-cell {
  height: 150px;
  color: var(--muted);
  text-align: center;
}

.legal {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  padding: 18px 2px 0;
  font-size: 12px;
}

@media (max-width: 940px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .drop-panel,
  .controls-panel,
  .queue-panel {
    grid-column: auto;
    grid-row: auto;
  }
}

@media (max-width: 680px) {
  .app-shell {
    width: min(100vw - 20px, 1180px);
    padding-top: 12px;
  }

  .topbar,
  .queue-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .drop-panel {
    grid-template-columns: 1fr;
  }

  .queue-actions {
    width: 100%;
    justify-content: flex-start;
  }
}
