:root {
  --bg: #0d0d0d;
  --surface: #151515;
  --text: #ededed;
  --muted: #909090;
  --border: #303030;
  --accent: #ff6b35;
  --accent-hover: #e4551f;
  --accent-soft: #221712;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

a { color: var(--text); text-decoration: none; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

code { font-family: var(--mono); font-size: 0.92em; color: var(--accent); }

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(720px, calc(100% - 40px));
  margin: 0 auto;
  padding: 22px 0 18px;
  border-bottom: 1px solid var(--border);
}

.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 700; font-size: 15px; letter-spacing: -0.01em; }
.brand:hover { color: var(--text); }
.brand-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.link { font-size: 13px; color: var(--muted); }

main {
  width: min(720px, calc(100% - 40px));
  margin: 0 auto;
  padding: 40px 0 64px;
}

.intro { margin-bottom: 32px; }
.intro h1 {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 12px;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.035em;
}
.intro h1::after { content: ""; height: 1px; flex: 1; background: var(--border); }
.intro p { margin: 0; color: var(--muted); max-width: 600px; line-height: 1.65; }

.tool {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22);
  padding: 26px;
}

.tool h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 16px;
  font-size: 14px;
  font-weight: 650;
}
.tool h2::before { content: ""; width: 3px; height: 14px; border-radius: 2px; background: var(--accent); }

.settings, .results { margin-top: 28px; padding-top: 26px; border-top: 1px solid var(--border); }

.dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 170px;
  padding: 28px 20px;
  text-align: center;
  border: 1.5px dashed #3d3d3d;
  border-radius: 6px;
  background: #121212;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.dropzone:hover { border-color: #6a4030; background: #161310; }
.dropzone.dragover { border-color: var(--accent); background: var(--accent-soft); }
.dropzone span { color: var(--text); }
.dropzone small { font-size: 12px; }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop-icon {
  width: 38px;
  height: 38px;
  margin-bottom: 4px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
}
.drop-icon svg { width: 18px; height: 18px; fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

.pair-status { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

.pair-file {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 5px;
  font: 12px var(--mono);
  color: var(--muted);
}
.pair-file::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #555; }
.pair-file.ready { color: var(--text); border-color: #6b3b27; }
.pair-file.ready::before { background: var(--accent); }

.pair-error {
  padding: 10px 12px;
  border: 1px solid #6b3027;
  border-radius: 5px;
  background: #241512;
  color: #ff9b8c;
  font-size: 13px;
}

.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.settings-grid .setting:last-child { grid-column: 1 / -1; }

.setting {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #181818;
}
.setting > span:first-child, .quality-head label { font: 11px var(--mono); letter-spacing: 0.02em; color: #c9c9c9; }
.setting small { font-size: 12px; color: var(--muted); line-height: 1.5; }

.setting select {
  width: 100%;
  padding: 8px 9px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 13px;
}

.setting input[type="range"] { width: 100%; accent-color: var(--accent); cursor: pointer; }
.quality-head { display: flex; align-items: center; justify-content: space-between; }
.quality-head span { font: 12px var(--mono); color: var(--accent); }

.actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 22px;
}

.toolbar-status { font-size: 12px; color: var(--muted); }
.toolbar-status.busy { color: var(--accent); }
.action-buttons, .results-actions { display: flex; gap: 8px; }
.results-actions { justify-content: flex-end; margin-top: 16px; }

.button {
  font: inherit;
  font-size: 13px;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.button.secondary:hover { border-color: #555; background: #1c1c1c; }
.button.primary { background: var(--accent); color: #160d08; border-color: var(--accent); font-weight: 600; }
.button.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.button:disabled { opacity: 0.55; cursor: default; }

.summary {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #181818;
}

.summary strong { font-size: 18px; letter-spacing: -0.02em; color: var(--accent); }
.summary > span { font: 12px var(--mono); color: var(--muted); }
.bar { height: 3px; background: #333; border-radius: 3px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--accent); }

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

.filename, .filesize { font: 12px var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filesize { color: var(--muted); }
.saved { font: 10px var(--mono); color: var(--muted); border: 1px solid var(--border); border-radius: 4px; padding: 2px 6px; }
.hint { margin: 12px 0 0; font-size: 12px; color: var(--muted); }
.dff-notice { margin: 12px 0 0; padding: 10px 12px; border: 1px solid #5a4828; border-radius: 5px; background: #211d13; color: #e5c98c; font-size: 12px; }

.note {
  margin: 18px 0 0;
  padding: 12px 14px;
  border-left: 2px solid var(--accent);
  background: #141210;
  color: var(--muted);
  font-size: 12px;
}

.note code { color: #cfcfcf; }

footer {
  display: flex;
  justify-content: space-between;
  width: min(720px, calc(100% - 40px));
  margin: 0 auto;
  padding: 20px 0 32px;
  border-top: 1px solid var(--border);
  font: 11px var(--mono);
  color: #666;
}

@media (max-width: 600px) {
  .site-header, main, footer { width: calc(100% - 28px); }
  .settings-grid { grid-template-columns: 1fr; }
  .actions { flex-direction: column; align-items: stretch; }
  .action-buttons { width: 100%; }
  .action-buttons .button { flex: 1; }
  .file-row { grid-template-columns: 1fr auto; gap: 4px 10px; }
  .saved { grid-column: 1 / -1; justify-self: start; }
  .results-actions .button { flex: 1; }
}
