:root {
  color-scheme: light;
  --accent: #246bfe;
  --accent-dark: #155adf;
  --bg: #f4f7fb;
  --border: #d7e0ec;
  --danger: #c83f52;
  --ink: #182133;
  --muted: #667389;
  --panel: #ffffff;
  --soft: #edf3fb;
  --success: #1f8a5b;
  --warning: #dc9b24;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(244, 247, 251, 0.96)),
    var(--bg);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

button,
select,
input[type="range"],
input[type="checkbox"] {
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled {
  cursor: not-allowed;
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.app-shell {
  min-height: 100vh;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1180px;
  margin: 0 auto 18px;
}

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

.brand-mark {
  display: grid;
  flex: 0 0 50px;
  width: 50px;
  height: 50px;
  place-items: center;
  border-radius: 8px;
  color: #ffffff;
  background: var(--accent);
}

.brand-mark svg {
  width: 28px;
  height: 28px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  font-size: 32px;
  line-height: 1.05;
}

h2 {
  font-size: 18px;
}

.top-status,
.summary {
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) 360px;
  gap: 16px;
  max-width: 1180px;
  margin: 0 auto;
}

.panel {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 18px 42px rgba(31, 47, 72, 0.07);
}

.file-panel,
.settings-panel,
.results-panel {
  padding: 18px;
}

.settings-panel {
  align-self: start;
}

.results-panel {
  grid-column: 1 / -1;
}

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

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: end;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 800;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    opacity 160ms ease;
}

.button:disabled {
  opacity: 0.5;
}

.button.primary {
  width: 100%;
  min-height: 46px;
  margin-top: 16px;
  background: var(--accent);
  color: #ffffff;
}

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

.button.secondary {
  width: 100%;
  margin-top: 8px;
  border-color: #f0cf8d;
  background: #fff8e8;
  color: #62410d;
}

.button.ghost {
  border-color: var(--border);
  background: #ffffff;
  color: var(--ink);
}

.button.ghost:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
}

.button.subtle {
  background: var(--soft);
  color: var(--muted);
}

.dropzone {
  position: relative;
  display: grid;
  min-height: 194px;
  place-items: center;
  border: 1.5px dashed #aab7c9;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(36, 107, 254, 0.08), rgba(31, 138, 91, 0.1)),
    #fbfcff;
  text-align: center;
  transition:
    border-color 160ms ease,
    background 160ms ease;
}

.dropzone.is-dragging {
  border-color: var(--accent);
  background: #f0f6ff;
}

.dropzone input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.drop-copy {
  display: grid;
  gap: 8px;
  padding: 18px;
}

.drop-copy strong {
  font-size: 21px;
}

.drop-copy span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.engine-card {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
  padding: 10px 12px;
  border-left: 4px solid var(--warning);
  border-radius: 0 8px 8px 0;
  background: #fffaf0;
}

.engine-card.is-ready {
  border-left-color: var(--success);
  background: #effaf4;
}

.engine-card strong {
  font-size: 13px;
}

.engine-card span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.install-links {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding-top: 2px;
}

.install-links a {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid #f0cf8d;
  border-radius: 8px;
  padding: 0 9px;
  background: #ffffff;
  color: #62410d;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.install-links a:hover,
.install-links a:focus-visible {
  border-color: var(--warning);
  color: #4b3108;
}

.preset-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.preset-button {
  display: grid;
  gap: 4px;
  min-height: 70px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  background: #ffffff;
  color: var(--ink);
  text-align: left;
}

.preset-button:hover,
.preset-button.is-active {
  border-color: var(--accent);
  background: #f2f7ff;
}

.preset-button strong {
  font-size: 13px;
}

.preset-button span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.range-field,
.field {
  display: grid;
  gap: 9px;
  margin-bottom: 16px;
}

.range-field > span,
.field > span {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

output {
  color: var(--accent);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: #ffffff;
}

.switch-field {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  margin-bottom: 16px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.switch-field input {
  position: absolute;
  opacity: 0;
}

.switch-ui {
  position: relative;
  flex: 0 0 44px;
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: #c9d3e2;
  transition: background 160ms ease;
}

.switch-ui::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
  content: "";
  transition: transform 160ms ease;
}

.switch-field input:checked + .switch-ui {
  background: var(--accent);
}

.switch-field input:checked + .switch-ui::after {
  transform: translateX(20px);
}

.progress-shell {
  height: 8px;
  margin-top: 16px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--soft);
}

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

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

.empty-state {
  display: grid;
  min-height: 72px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
}

.file-row,
.result-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 11px 12px;
  background: #ffffff;
}

.file-main,
.result-main {
  min-width: 0;
}

.file-name,
.result-name {
  overflow: hidden;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-meta,
.result-meta {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.row-action {
  min-width: 92px;
  min-height: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 10px;
  background: var(--soft);
  color: var(--ink);
  font-weight: 800;
}

.result-row.failed {
  border-color: #efb3bd;
  background: #fff7f8;
}

.result-row.failed .result-name {
  color: var(--danger);
}

.result-row.kept {
  border-color: #f0cf8d;
  background: #fffaf0;
}

button:focus-visible,
select:focus-visible,
input:focus-visible,
.dropzone:focus-within {
  outline: 3px solid rgba(36, 107, 254, 0.22);
  outline-offset: 2px;
}

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

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

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

@media (max-width: 560px) {
  h1 {
    font-size: 27px;
  }

  .brand-mark {
    flex-basis: 46px;
    width: 46px;
    height: 46px;
  }

  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .button-row,
  .button-row .button,
  .preset-grid {
    width: 100%;
  }

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