:root {
  color-scheme: light;
  --bg: #f3f5f1;
  --panel: #ffffff;
  --panel-strong: #eef3ea;
  --text: #17201b;
  --muted: #637064;
  --line: #d9dfd8;
  --accent: #236f62;
  --accent-dark: #174d45;
  --warn: #9a5b1f;
  --shadow: 0 16px 40px rgba(21, 35, 29, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
}

button,
input,
select {
  font: inherit;
}

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

.workspace,
.control-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 26px;
  line-height: 1.25;
}

h2 {
  font-size: 16px;
  line-height: 1.35;
}

.topbar p,
.panel-head span,
.drop-zone span,
.file-list,
.field span,
.check-field {
  color: var(--muted);
}

.topbar p {
  margin-top: 5px;
  font-size: 14px;
}

.status-pill {
  flex: 0 0 auto;
  max-width: 220px;
  padding: 8px 11px;
  border-radius: 999px;
  background: var(--panel-strong);
  color: var(--accent-dark);
  font-size: 13px;
  text-align: center;
  overflow-wrap: anywhere;
}

.drop-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 16px;
  min-height: 0;
  flex: 1;
}

.drop-panel {
  display: grid;
  grid-template-rows: auto 190px minmax(180px, 1fr);
  min-width: 0;
  border: 1px solid var(--line);
  background: #fbfcfa;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.ghost-button,
.primary-button {
  border: 0;
  cursor: pointer;
}

.ghost-button {
  flex: 0 0 auto;
  padding: 7px 10px;
  background: transparent;
  color: var(--accent-dark);
  border: 1px solid var(--line);
}

.drop-zone {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 7px;
  margin: 14px;
  border: 2px dashed #aab8ad;
  background: #f7faf6;
  min-height: 150px;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.drop-zone input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.drop-zone strong {
  font-size: 18px;
}

.drop-zone.is-over {
  border-color: var(--accent);
  background: #e8f3ee;
  transform: translateY(-1px);
}

.file-list {
  min-height: 0;
  margin: 0;
  padding: 0 14px 14px 38px;
  overflow: auto;
  font-size: 13px;
}

.file-list li {
  padding: 7px 0;
  border-bottom: 1px solid #edf0ec;
}

.control-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
  min-width: 0;
}

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

.segmented {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  border: 1px solid var(--line);
  background: #f8faf7;
}

.segmented label {
  min-width: 0;
  cursor: pointer;
}

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

.segmented span {
  display: grid;
  place-items: center;
  min-height: 42px;
  padding: 8px;
  color: var(--muted);
}

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

.field {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.field input[type="text"],
.field select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  padding: 8px 10px;
}

.field input[type="range"] {
  width: 100%;
}

.check-field {
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.35;
}

#previewCanvas {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  border: 1px solid var(--line);
  background: #edf0ec;
}

.action-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: auto;
}

.primary-button {
  min-height: 44px;
  padding: 10px;
  background: var(--accent);
  color: #fff;
}

.primary-button:hover,
.primary-button:focus-visible {
  background: var(--accent-dark);
}

.ghost-button:hover,
.ghost-button:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

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

  .control-panel {
    order: -1;
  }
}

@media (max-width: 680px) {
  .app-shell {
    padding: 10px;
  }

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

  .topbar {
    display: grid;
  }

  .drop-panel {
    grid-template-rows: auto 160px 180px;
  }

  .status-pill {
    max-width: none;
  }
}
