:root {
  --bg: #f6f5f3;
  --ink: #1c1c1c;
  --muted: #6b6b6b;
  --accent: #2d6cdf;
  --accent-ink: #ffffff;
  --border: #dcdad5;
  --card: #ffffff;
  --warn-bg: #fff7e6;
  --warn-border: #f0c36d;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17181a;
    --ink: #f1f0ee;
    --muted: #a0a0a0;
    --accent: #5b8def;
    --accent-ink: #0b0b0b;
    --border: #33342f;
    --card: #212226;
    --warn-bg: #3a2f14;
    --warn-border: #7a5b1f;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

.wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}

header h1 {
  margin: 0 0 8px;
  font-size: 28px;
  letter-spacing: -0.02em;
}

.subtitle {
  margin: 0 0 32px;
  color: var(--muted);
  font-size: 15px;
}

.dropzone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 56px 24px;
  text-align: center;
  background: var(--card);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.dropzone.dragover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--card));
}

.dropzone-title {
  font-size: 17px;
  margin: 0 0 6px;
}

.dropzone-sub {
  color: var(--muted);
  margin: 0 0 16px;
  font-size: 13px;
}

button {
  font: inherit;
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  font-size: 14px;
}

button:hover { opacity: 0.9; }

button.secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--border);
}

.status {
  margin-top: 20px;
  font-size: 14px;
  color: var(--muted);
}

.status.error { color: #c0392b; }

.results {
  margin-top: 40px;
}

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.results-header h2 {
  font-size: 16px;
  margin: 0;
  color: var(--muted);
  font-weight: 500;
  word-break: break-all;
}

.results-actions {
  display: flex;
  gap: 10px;
}

.warnings {
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 13px;
  margin-bottom: 20px;
}

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

.report-form label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
}

.report-form textarea {
  width: 100%;
  font: inherit;
  font-size: 13.5px;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  resize: vertical;
}

.report-form-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.panes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 720px) {
  .panes { grid-template-columns: 1fr; }
}

.pane h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 0 0 8px;
}

.preview, .html-source {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  height: 480px;
  overflow-y: auto;
}

.preview h1, .preview h2, .preview h3 {
  line-height: 1.25;
}

.preview p { line-height: 1.6; }

.preview table {
  border-collapse: collapse;
  width: 100%;
  margin: 12px 0 20px;
  font-size: 13px;
}

.preview th, .preview td {
  border: 1px solid var(--border);
  padding: 6px 10px;
  text-align: left;
}

.preview th {
  background: color-mix(in srgb, var(--accent) 10%, var(--card));
}

.preview img {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 6px;
  margin: 12px 0;
}

.html-source {
  width: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  line-height: 1.5;
  resize: none;
  color: var(--ink);
}

.image-gallery {
  margin-top: 28px;
}

.image-gallery h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 0 0 8px;
}

.image-gallery-note {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
  margin: 0 0 16px;
}

.image-gallery-note code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 12px;
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}

.image-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.image-card img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  display: block;
  background: var(--bg);
}

.image-card-footer {
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.image-card-filename {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-card-footer a {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  flex-shrink: 0;
}

.image-card-footer a:hover {
  text-decoration: underline;
}
