:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #17202a;
  --muted: #667085;
  --line: #d8dee8;
  --accent: #1677ff;
  --accent-deep: #075fd4;
  --ok: #0b8f5a;
  --warn: #b25e09;
  --bad: #bf2f2f;
  --shadow: 0 18px 45px rgba(31, 45, 61, 0.11);
}

* {
  box-sizing: border-box;
}

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

button,
input,
select {
  font: inherit;
}

.app {
  display: grid;
  grid-template-columns: minmax(320px, 390px) 1fr;
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 24px;
  background: #101820;
  color: #fff;
}

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

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  line-height: 1.2;
}

.brand p {
  margin-top: 8px;
  color: #aeb9c8;
  line-height: 1.5;
}

.icon-button {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

.dropzone {
  display: grid;
  place-items: center;
  min-height: 178px;
  padding: 22px;
  border: 2px dashed rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.dropzone.dragging {
  border-color: #8cc4ff;
  background: rgba(22, 119, 255, 0.18);
}

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

.drop-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 10px;
  border-radius: 8px;
  background: #1677ff;
  font-size: 31px;
  line-height: 1;
}

.dropzone small {
  margin-top: 7px;
  color: #aeb9c8;
}

.list-head {
  display: flex;
  justify-content: space-between;
  color: #c9d3df;
  font-size: 13px;
}

.file-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: auto;
  min-height: 0;
}

.file-item {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
}

.file-item img {
  width: 54px;
  height: 54px;
  object-fit: cover;
  border-radius: 6px;
  background: #202c37;
}

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

.file-meta {
  margin-top: 5px;
  color: #aeb9c8;
  font-size: 12px;
}

.workspace {
  padding: 24px;
  overflow: auto;
}

.toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.toolbar h2 {
  font-size: 28px;
  line-height: 1.15;
}

.toolbar p {
  margin-top: 8px;
  color: var(--muted);
}

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

button,
select {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  min-height: 40px;
}

button {
  padding: 0 16px;
  cursor: pointer;
}

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

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

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

.summary,
.settings,
.output-card,
.empty {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 16px;
}

.summary div {
  padding: 18px;
}

.summary div + div {
  border-left: 1px solid var(--line);
}

.metric {
  display: block;
  font-size: 30px;
  font-weight: 750;
}

.summary small {
  color: var(--muted);
}

.settings {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr 0.9fr;
  gap: 16px;
  align-items: center;
  padding: 16px;
  margin-bottom: 18px;
}

.settings label {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  align-items: center;
  min-width: 0;
}

.settings label > span {
  color: var(--muted);
  font-size: 13px;
}

.settings input[type="range"] {
  grid-column: 1 / -1;
  width: 100%;
}

.settings select {
  padding: 0 12px;
}

.settings .checkbox {
  grid-template-columns: auto 1fr;
  justify-content: start;
}

.settings .checkbox input {
  width: 18px;
  height: 18px;
}

.settings .checkbox span {
  font-size: 14px;
  color: var(--ink);
}

.output-list {
  display: grid;
  gap: 14px;
}

.empty {
  display: grid;
  place-items: center;
  min-height: 290px;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.empty strong {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 20px;
}

.output-card {
  display: grid;
  grid-template-columns: 190px 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 14px;
}

.preview {
  width: 190px;
  height: 132px;
  object-fit: contain;
  border-radius: 7px;
  background: #eef2f6;
}

.output-info {
  min-width: 0;
}

.output-info h3 {
  margin: 0 0 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 16px;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: #eef4ff;
  color: #1959b7;
  font-size: 12px;
}

.badge.ok {
  background: #e8f7ef;
  color: var(--ok);
}

.badge.warn {
  background: #fff3e1;
  color: var(--warn);
}

.badge.bad {
  background: #ffecec;
  color: var(--bad);
}

.output-actions {
  display: flex;
  gap: 8px;
}

.output-actions button {
  min-width: 86px;
}

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

  .sidebar {
    min-height: auto;
  }

  .file-list {
    max-height: 300px;
  }

  .toolbar,
  .output-card {
    grid-template-columns: 1fr;
    display: grid;
  }

  .actions {
    justify-content: stretch;
  }

  .actions button {
    flex: 1;
  }

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

  .preview {
    width: 100%;
    height: 220px;
  }
}

@media (max-width: 560px) {
  .workspace,
  .sidebar {
    padding: 16px;
  }

  .summary,
  .settings {
    grid-template-columns: 1fr;
  }

  .summary div + div {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}
