:root {
  --bg: #fafafa;
  --card: #ffffff;
  --text: #1a1a1a;
  --muted: #666;
  --border: #e5e5e5;
  --primary: #0a66c2;
  --primary-hover: #084c93;
  --danger: #c0392b;
  --success: #1d6e3a;
  --accent: #14a085;
}

* { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  line-height: 1.5;
}

.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 1.5rem 2rem;
}

.topbar h1 { margin: 0; font-size: 1.5rem; }
.tagline { margin: 0.25rem 0 0; color: var(--muted); font-size: 0.95rem; }
.badge {
  display: inline-block;
  background: var(--accent);
  color: white;
  padding: 0.15rem 0.6rem;
  border-radius: 12px;
  font-size: 0.75rem;
  margin-left: 0.5rem;
}

.container {
  max-width: 1100px;
  margin: 2rem auto;
  padding: 0 1.5rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

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

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
}

.card h2 { margin: 0 0 1rem; font-size: 1.15rem; }

.field { margin-bottom: 1.25rem; }
.field label { display: block; font-weight: 600; margin-bottom: 0.35rem; font-size: 0.9rem; }
.field input[type="url"],
.field input[type="file"],
.field textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.95rem;
}
.field textarea { resize: vertical; min-height: 6rem; }
.hint { font-size: 0.8rem; color: var(--muted); margin: 0.25rem 0 0; }

#optimize-btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  width: 100%;
  margin-top: 0.5rem;
}
#optimize-btn:hover:not(:disabled) { background: var(--primary-hover); }
#optimize-btn:disabled { background: #ccc; cursor: not-allowed; }

#print-btn {
  background: var(--accent);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
}

.banner {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  font-size: 0.9rem;
}
.banner.hidden { display: none; }
#error-banner { background: #fdecea; color: var(--danger); border: 1px solid #f5b7b1; }
#status-banner { background: #e8f4f8; color: var(--primary); border: 1px solid #aed6f1; }

.preview-card { padding-top: 1rem; }
.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.preview-header h2 { margin: 0; }
#preview-iframe {
  width: 100%;
  min-height: 800px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
}

/* PRINT STYLES — these only apply when the user prints. */
@media print {
  @page { size: A4; margin: 1.5cm 1.7cm; }
  body * { visibility: hidden; }
  #preview-iframe, #preview-iframe * { visibility: visible; }
  #preview-iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: none; }
}
