:root {
  color-scheme: light;
  --bg: #eef2f5;
  --panel: #ffffff;
  --text: #16212f;
  --muted: #657184;
  --line: #d9e1ea;
  --accent: #126c8c;
  --accent-strong: #0d5873;
  --soft: #e7f3f7;
  --success: #217a4d;
  --error: #b3261e;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.app {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  width: min(1180px, calc(100vw - 32px));
  margin: 24px auto;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(18, 36, 54, 0.08);
}

.workspace {
  min-height: calc(100vh - 48px);
  padding: 22px;
}

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

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 34px;
  line-height: 1.1;
}

h2 {
  font-size: 20px;
}

small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.ghost-button,
.primary-button,
.download-button {
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 16px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.ghost-button {
  background: #f7fafc;
  border-color: var(--line);
  color: var(--text);
}

.primary-button,
.download-button {
  width: 100%;
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
}

.primary-button:hover,
.download-button:hover {
  background: var(--accent-strong);
}

.primary-button:disabled,
.download-button.disabled {
  background: #b9c6d2;
  cursor: not-allowed;
  pointer-events: none;
}

.dropzone {
  display: grid;
  place-items: center;
  min-height: 260px;
  padding: 28px;
  border: 2px dashed #a9bdca;
  border-radius: 8px;
  background: #f8fbfd;
  text-align: center;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease;
}

.dropzone.dragover {
  border-color: var(--accent);
  background: var(--soft);
}

.dropzone input {
  display: none;
}

.dropzone-icon {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin-bottom: 14px;
  background: var(--accent);
  color: #ffffff;
  font-size: 34px;
  line-height: 1;
}

.dropzone-title {
  display: block;
  font-size: 19px;
  font-weight: 800;
}

.dropzone-note {
  display: block;
  max-width: 440px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.file-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.guide {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.guide h2 {
  margin-bottom: 12px;
}

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

.guide article {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid #e4ebf1;
  border-radius: 8px;
  background: #f8fbfd;
}

.guide article strong {
  font-size: 14px;
}

.guide article span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.file-item {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 78px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.file-item img {
  width: 62px;
  height: 58px;
  object-fit: cover;
  border-radius: 6px;
  background: #edf2f6;
}

.file-meta {
  min-width: 0;
}

.file-meta strong,
.file-meta span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-meta span,
.file-status {
  color: var(--muted);
  font-size: 13px;
}

.file-status.done {
  color: var(--success);
  font-weight: 700;
}

.file-status.error {
  color: var(--error);
  font-weight: 700;
}

.controls {
  position: sticky;
  top: 24px;
  align-self: start;
  display: grid;
  gap: 16px;
  padding: 20px;
}

.field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.field input,
.field select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #ffffff;
  color: var(--text);
}

.field input[type="range"] {
  padding: 0;
}

.field input[type="color"] {
  padding: 4px;
}

.quality-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 88px;
  gap: 10px;
  align-items: center;
}

.percent-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 22px;
  align-items: center;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  overflow: hidden;
}

.percent-input input {
  min-height: 40px;
  border: 0;
  border-radius: 0;
  padding: 0 4px 0 10px;
  text-align: right;
}

.percent-input span {
  color: var(--muted);
  font-size: 13px;
}

.preset-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.preset-row button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fafc;
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  line-height: 1.2;
}

.preset-row button:hover {
  border-color: var(--accent);
}

.check-field {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 10px;
  align-items: start;
  color: var(--muted);
  font-size: 14px;
}

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

.stats {
  display: grid;
  gap: 8px;
  padding-top: 4px;
  color: var(--muted);
  font-size: 14px;
}

@media (max-width: 860px) {
  .app {
    grid-template-columns: 1fr;
    width: min(100vw - 20px, 680px);
    margin: 10px auto;
  }

  .workspace {
    min-height: auto;
  }

  .controls {
    position: static;
  }

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

  h1 {
    font-size: 28px;
  }

  .file-item {
    grid-template-columns: 54px minmax(0, 1fr);
  }

  .guide-grid,
  .preset-row {
    grid-template-columns: 1fr;
  }

  .file-item img {
    width: 54px;
    height: 52px;
  }

  .file-status {
    grid-column: 2;
  }
}
