:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #1d1f23;
  --muted: #666b75;
  --border: #d5d8de;
  --accent: #3b5bdb;
  --accent-hover: #2f4ac0;
  --error: #c92a2a;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171b;
    --card: #1f2227;
    --text: #e8eaed;
    --muted: #9aa0a9;
    --border: #3a3e45;
    --accent: #5c7cfa;
    --accent-hover: #748ffc;
    --error: #ff6b6b;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.card {
  width: 100%;
  max-width: 440px;
  padding: 28px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.logo {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 0 20px;
  /* Pixel-art logo: nearest-neighbor scaling, with fallbacks for older browsers. */
  -ms-interpolation-mode: nearest-neighbor;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
}

h1 { margin: 0 0 4px; font-size: 1.5rem; }
.subtitle { margin: 0 0 20px; color: var(--muted); }

.dropzone {
  position: relative;
  display: block;
  padding: 28px 16px;
  text-align: center;
  border: 2px dashed var(--border);
  border-radius: 10px;
  cursor: pointer;
  color: var(--muted);
  overflow-wrap: anywhere;
  transition: border-color 0.15s;
}
.dropzone input { position: absolute; inset: 0; opacity: 0; pointer-events: none; }
.dropzone.dragging, .dropzone:hover { border-color: var(--accent); }
.dropzone.has-file { color: var(--text); border-style: solid; }
.hint { margin: 8px 0 0; font-size: 0.8rem; color: var(--muted); line-height: 1.4; }

fieldset {
  margin: 20px 0 0;
  padding: 0;
  border: 0;
  display: flex;
  gap: 8px 14px;
  flex-wrap: wrap;
}
legend { margin-bottom: 8px; font-weight: 600; }
.check { display: flex; align-items: center; gap: 6px; cursor: pointer; }

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  white-space: nowrap;
  margin-top: 16px;
  font-weight: 600;
}
select {
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  color: var(--text);
  font: inherit;
}

button {
  width: 100%;
  margin-top: 24px;
  padding: 12px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
button:hover { background: var(--accent-hover); }
button:disabled { opacity: 0.6; cursor: progress; }

.status { margin-top: 16px; }
.status p { margin: 0 0 6px; color: var(--muted); }
progress { width: 100%; height: 8px; accent-color: var(--accent); }

.error { margin: 16px 0 0; color: var(--error); white-space: pre-wrap; overflow-wrap: anywhere; }

.results { list-style: none; margin: 20px 0 0; padding: 0; display: grid; gap: 8px; }
.results a {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--accent);
  text-decoration: none;
  overflow-wrap: anywhere;
}
.results a:hover { border-color: var(--accent); }
.results span { color: var(--muted); white-space: nowrap; }

.note { margin: 20px 0 0; font-size: 0.85rem; color: var(--muted); text-align: center; }
.version { margin: 12px 0 0; font-size: 0.75rem; color: var(--muted); text-align: center; }

@media (max-width: 420px) {
  .card { padding: 20px; }
}
