:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --panel: #ffffff;
  --panel-soft: #eef3ef;
  --text: #17201d;
  --muted: #64706a;
  --line: #d9e0da;
  --accent: #116b5c;
  --accent-strong: #0b4f45;
  --accent-soft: #dcece8;
  --danger: #a13d35;
  --shadow: 0 18px 45px rgba(23, 32, 29, 0.08);
}

* {
  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;
}

button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
}

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

.app-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 24px;
}

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

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

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 4vw, 4.2rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.topbar p,
.queue-header p,
.empty-state span,
.drop-zone small {
  color: var(--muted);
}

.stat-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(88px, 1fr));
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  min-width: min(100%, 340px);
}

.stat-strip div {
  padding: 14px 16px;
  border-right: 1px solid var(--line);
}

.stat-strip div:last-child {
  border-right: 0;
}

.stat-strip span {
  display: block;
  font-weight: 800;
  font-size: 1.3rem;
}

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

.main-grid {
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  gap: 18px;
}

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

.control-panel {
  align-self: start;
  padding: 16px;
}

.results-panel {
  min-height: 720px;
  padding: 18px;
}

.drop-zone {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 170px;
  padding: 20px;
  border: 1.5px dashed #8fa49c;
  background: var(--panel-soft);
  text-align: center;
}

.drop-zone.dragging {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.drop-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.drop-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-size: 1.8rem;
  line-height: 1;
}

.panel-section {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.panel-section h2,
.queue-header h2 {
  font-size: 1rem;
}

.section-title,
.queue-header,
.actions,
.output-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.size-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.size-row {
  display: grid;
  grid-template-columns: 1fr 72px 72px 34px;
  gap: 7px;
  align-items: center;
}

input,
select {
  min-width: 0;
  width: 100%;
  height: 38px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  padding: 0 10px;
}

input[type="range"] {
  padding: 0;
  height: 28px;
}

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

.format-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: #fff;
}

.format-grid input {
  width: 16px;
  height: 16px;
}

.compact {
  display: grid;
  gap: 8px;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 6px;
}

.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  font-weight: 750;
}

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

.actions {
  margin-top: 18px;
}

.actions button {
  width: 100%;
  height: 42px;
  border-radius: 6px;
}

.queue-header {
  align-items: flex-start;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

progress {
  width: min(260px, 35%);
  height: 12px;
  margin-top: 8px;
  accent-color: var(--accent);
}

.empty-state {
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 520px;
  gap: 6px;
  text-align: center;
}

.file-list,
.output-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.file-card,
.output-card {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
}

.file-card img,
.output-card img {
  width: 58px;
  height: 58px;
  object-fit: cover;
  background: var(--panel-soft);
  border-radius: 6px;
}

.file-name,
.output-name {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.file-detail,
.output-detail {
  color: var(--muted);
  font-size: 0.9rem;
}

.output-card a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 92px;
  min-height: 36px;
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  text-decoration: none;
  font-weight: 750;
}

.output-card.failed {
  border-color: #e5b6b1;
}

.output-card.failed .output-detail {
  color: var(--danger);
}

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

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

  .stat-strip {
    width: 100%;
  }

  .results-panel {
    min-height: 520px;
  }
}

@media (max-width: 560px) {
  .stat-strip {
    grid-template-columns: 1fr;
  }

  .stat-strip div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .stat-strip div:last-child {
    border-bottom: 0;
  }

  .size-row {
    grid-template-columns: 1fr 1fr 34px;
  }

  .size-name {
    grid-column: 1 / -1;
  }

  .queue-header,
  .file-card,
  .output-card {
    grid-template-columns: 1fr;
  }

  progress {
    width: 100%;
  }
}
