:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f2f4f7;
  --text: #0f1420;
  --muted: #667085;
  --border: #e4e7ec;
  --accent: #005bff;
  --accent-ink: #ffffff;
  --ok: #12b76a;
  --warn: #f79009;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 12px 32px rgba(16, 24, 40, 0.07);
  --radius: 16px;
  --radius-sm: 12px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0e14;
    --surface: #141821;
    --surface-2: #1b212c;
    --text: #e7ecf3;
    --muted: #98a2b3;
    --border: #262d3a;
    --accent: #3d7bff;
    --accent-ink: #ffffff;
    --ok: #32d583;
    --warn: #fdb022;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 16px 40px rgba(0, 0, 0, 0.35);
  }
}

* {
  box-sizing: border-box;
}

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

.shell {
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 24px 32px;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Header */

.head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
}

.mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex: none;
  border-radius: 14px;
  background: linear-gradient(150deg, var(--accent), #4d8bff);
  color: #fff;
  box-shadow: var(--shadow);
}

.mark svg {
  width: 26px;
  height: 26px;
}

h1 {
  font-size: 22px;
  line-height: 1.25;
  margin: 0 0 2px;
  letter-spacing: -0.01em;
}

.sub {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  word-break: break-word;
}

/* Card */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.form {
  display: grid;
  gap: 14px;
  padding: 20px;
}

/* Dropzone */

.dropzone {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.dropzone:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}

.dropzone.dragging {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 7%, transparent);
  transform: scale(1.008);
}

.dropzone.has-file {
  border-style: solid;
  border-color: color-mix(in srgb, var(--ok) 55%, var(--border));
  background: color-mix(in srgb, var(--ok) 7%, transparent);
}

.dropzone:focus-within {
  border-color: var(--accent);
}

.dropzone input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.dz-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--muted);
}

.dz-icon svg {
  width: 20px;
  height: 20px;
}

.dropzone.has-file .dz-icon {
  background: color-mix(in srgb, var(--ok) 16%, transparent);
  color: var(--ok);
}

.dz-body {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.dz-body strong {
  font-size: 14px;
  font-weight: 600;
}

.dz-file {
  font-size: 13px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.dropzone.has-file .dz-file {
  color: var(--text);
}

/* Actions */

.actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 4px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  border: 0;
  border-radius: 10px;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease;
}

.btn.primary {
  background: var(--accent);
  color: var(--accent-ink);
}

.btn.primary:hover {
  background: color-mix(in srgb, var(--accent) 88%, #000);
}

.btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid color-mix(in srgb, currentColor 30%, transparent);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.htmx-indicator {
  display: none;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  display: inline-flex;
}

/* Result */

#result {
  margin-top: 18px;
}

.result {
  padding: 20px;
}

.result-head {
  display: flex;
  align-items: center;
  gap: 14px;
}

.result-head h2 {
  font-size: 16px;
  margin: 0;
}

.badge {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  flex: none;
  border-radius: 12px;
  font-size: 18px;
  font-weight: 700;
}

.badge.ok {
  background: color-mix(in srgb, var(--ok) 14%, transparent);
  color: var(--ok);
}

.badge.warn {
  background: color-mix(in srgb, var(--warn) 16%, transparent);
  color: var(--warn);
}

.result.ok {
  border-color: color-mix(in srgb, var(--ok) 40%, var(--border));
}

.result.warn {
  border-color: color-mix(in srgb, var(--warn) 45%, var(--border));
}

.label {
  margin: 20px 0 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.chips li {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 13px;
}

.result .btn {
  margin-top: 20px;
}

/* Footer */

.foot {
  margin-top: 28px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

@media (max-width: 520px) {
  .shell {
    padding: 28px 16px 24px;
  }

  .head {
    align-items: flex-start;
  }

  .chips li {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dropzone,
  .btn {
    transition: none;
  }

  .spinner {
    animation-duration: 1.6s;
  }
}
