:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #15181e;
  --muted: #5b6472;
  --border: #d9dde3;
  --accent: #1f6feb;
  --accent-text: #ffffff;
  --accent-soft: #e8f0fe;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --ok: #157347;
  --radius: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101317;
    --surface: #181c22;
    --text: #e8ebf0;
    --muted: #9aa4b2;
    --border: #2b323c;
    --accent: #5b9bff;
    --accent-text: #0a1220;
    --accent-soft: #1a2740;
    --danger: #ff8a80;
    --danger-soft: #3a1c1a;
    --ok: #5fd39a;
    color-scheme: dark;
  }
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

main {
  max-width: 640px;
  margin: 0 auto;
  padding: 32px 16px 64px;
}

header h1 { margin: 0 0 4px; font-size: 1.75rem; letter-spacing: -0.01em; }
header p { margin: 0 0 24px; color: var(--muted); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

.drop {
  display: block;
  text-align: center;
  padding: 32px 16px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--muted);
  transition: border-color 0.15s, background 0.15s;
}
.drop:hover, .drop.over, .drop:focus-within { border-color: var(--accent); background: var(--accent-soft); }
.drop strong { color: var(--text); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }

ul.files { list-style: none; margin: 12px 0 0; padding: 0; }
ul.files li {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 12px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
ul.files li:last-child { border-bottom: 0; }
.name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.size { color: var(--muted); font-size: 0.9rem; white-space: nowrap; }
.total { margin: 8px 0 0; color: var(--muted); font-size: 0.9rem; }

.options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.options .wide { grid-column: 1 / -1; }
label.field { display: block; font-size: 0.9rem; color: var(--muted); }
label.field > span { display: block; margin-bottom: 4px; }
input[type="text"], input[type="password"], select {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
.hint { font-size: 0.85rem; color: var(--muted); margin: 4px 0 0; }
.mt { margin-top: 16px; }

button {
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 16px;
}
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
button.primary.big { width: 100%; margin-top: 16px; padding: 14px; font-size: 1.05rem; }
button.small { padding: 6px 12px; }
button.danger { color: var(--danger); }
button.icon { padding: 2px 8px; border: 0; background: transparent; color: var(--muted); }

.error, .notice {
  border-radius: 8px;
  padding: 12px 14px;
  margin: 12px 0 0;
  font-size: 0.95rem;
}
.error { background: var(--danger-soft); color: var(--danger); }
.notice { background: var(--accent-soft); }

.gauge { display: block; width: 160px; height: 102px; margin: 12px auto 8px; overflow: visible; }
.gauge--sm { width: 100px; height: 64px; margin: 0; }
.gauge-track { fill: none; stroke: var(--border); stroke-width: 8; stroke-linecap: round; }
.gauge-fill { fill: none; stroke: var(--accent); stroke-width: 8; stroke-linecap: round; }
.gauge-needle { stroke: var(--accent); stroke-width: 3; stroke-linecap: round; }
.gauge-pivot { fill: var(--accent); }
.gauge-speed { fill: var(--text); font-size: 15px; font-weight: 600; font-family: inherit; }
.gauge.done .gauge-needle, .gauge.done .gauge-pivot { stroke: var(--ok); fill: var(--ok); }
.gauge.done .gauge-fill { stroke: var(--ok); }
.gauge.done .gauge-speed { fill: var(--ok); }
.gauge.error .gauge-needle, .gauge.error .gauge-pivot { stroke: var(--danger); fill: var(--danger); }
.gauge.error .gauge-fill { stroke: var(--danger); }
.gauge.error .gauge-speed { fill: var(--danger); }

.row { display: flex; gap: 8px; }
.row input { flex: 1; min-width: 0; }
.qr { display: block; margin: 16px auto 0; width: 176px; height: 176px; image-rendering: pixelated; border-radius: 8px; }

details { margin-top: 24px; color: var(--muted); font-size: 0.92rem; }
details summary { cursor: pointer; color: var(--text); }
details p { margin: 8px 0; }

footer { margin-top: 32px; color: var(--muted); font-size: 0.85rem; text-align: center; }

@media (max-width: 480px) {
  .options { grid-template-columns: 1fr; }
  ul.files li { grid-template-columns: 1fr auto; }
  ul.files li .size { grid-column: 1; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
