:root {
  --bg: #fdfcf9;
  --bg-alt: #f4f1ea;
  --fg: #1f1f1f;
  --fg-muted: #6b6b6b;
  --border: #d9d4c7;
  --accent: #2f6f4f;
  --accent-fg: #ffffff;
  --error-bg: #fdecea;
  --error-fg: #8c1d1d;
  --radius: 6px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
}

main {
  max-width: 580px;
  margin: 0 auto;
  padding: 48px 24px 24px;
}

header h1 {
  font-size: 2rem;
  font-weight: 600;
  margin: 0 0 4px;
  letter-spacing: -0.02em;
}

header .tagline {
  color: var(--fg-muted);
  margin: 0 0 32px;
}

form {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}

.field {
  margin-bottom: 20px;
}

.field label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
}

.field input[type="file"],
.field textarea {
  width: 100%;
  font-family: inherit;
  font-size: 0.95rem;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--fg);
}

.field textarea {
  resize: vertical;
  min-height: 72px;
}

.field input[type="file"] {
  padding: 6px 8px;
}

.field .hint {
  margin: 6px 0 0;
  color: var(--fg-muted);
  font-size: 0.875rem;
}

.concept-preview {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 10px;
  padding: 10px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

/* The `hidden` HTML attribute relies on UA `display: none`; our
   `display: flex` above otherwise overrides it. */
.concept-preview[hidden] { display: none; }

.concept-preview img {
  display: block;
  max-width: 96px;
  max-height: 96px;
  width: auto;
  height: auto;
  border-radius: 4px;
  background:
    linear-gradient(45deg, #eee 25%, transparent 25%) 0 0/12px 12px,
    linear-gradient(-45deg, #eee 25%, transparent 25%) 0 6px/12px 12px,
    linear-gradient(45deg, transparent 75%, #eee 75%) 6px -6px/12px 12px,
    linear-gradient(-45deg, transparent 75%, #eee 75%) -6px 0/12px 12px;
}

.concept-preview__clear {
  margin-left: auto;
  background: transparent;
  color: var(--fg-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 10px;
  font-size: 0.8125rem;
  cursor: pointer;
}

.concept-preview__clear:hover {
  background: var(--bg-alt);
  color: var(--fg);
}

button[type="submit"] {
  background: var(--accent);
  color: var(--accent-fg);
  border: 0;
  border-radius: var(--radius);
  padding: 10px 18px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

button[type="submit"]:hover { filter: brightness(1.05); }
button[type="submit"]:disabled,
form:has([disabled]) {
  opacity: 0.55;
  cursor: not-allowed;
}

form input:disabled,
form textarea:disabled {
  background: var(--bg-alt);
}

#status-panel { margin-top: 8px; }

.start-new {
  margin: 0 0 24px;
  font-size: 0.9375rem;
}

.start-new a {
  color: var(--accent);
  text-decoration: none;
}

.start-new a:hover { text-decoration: underline; }

.status {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 8px;
}

.status-label {
  margin: 0 0 12px;
  font-weight: 500;
}

progress {
  width: 100%;
  height: 8px;
  border: 0;
  border-radius: 4px;
  background: var(--bg);
  overflow: hidden;
  appearance: none;
  -webkit-appearance: none;
}

progress::-webkit-progress-bar {
  background: var(--bg);
  border-radius: 4px;
}

progress::-webkit-progress-value {
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.3s ease;
}

progress::-moz-progress-bar {
  background: var(--accent);
  border-radius: 4px;
}

.status--done { text-align: center; }

/* Mock browser-tab preview. Shows the favicon at its real 16×16 size,
   alongside a few placeholder tabs, so users get an honest sense of
   what their favicon will look like where it actually lives. */
.browser-mock {
  margin: 0 0 20px;
  background: #e8e5dd;
  border: 1px solid var(--border);
  border-radius: 10px 10px var(--radius) var(--radius);
  overflow: hidden;
  text-align: left;
}

.browser-mock__chrome {
  display: flex;
  align-items: flex-end;
  padding: 10px 10px 0 10px;
  gap: 12px;
  background: #e8e5dd;
}

.browser-mock__dots {
  display: flex;
  gap: 6px;
  padding-bottom: 10px;
  flex-shrink: 0;
}

.browser-mock__dots span {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #c9c4ba;
}
.browser-mock__dots span:nth-child(1) { background: #ed6a5e; }
.browser-mock__dots span:nth-child(2) { background: #f5be4f; }
.browser-mock__dots span:nth-child(3) { background: #62c554; }

.browser-mock__tabs {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  min-width: 0;
  flex: 1;
  overflow: hidden;
}

.tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px 8px;
  border-radius: 6px 6px 0 0;
  font-size: 0.75rem;
  color: var(--fg-muted);
  min-width: 0;
  max-width: 130px;
  background: transparent;
}

.tab--active {
  background: var(--bg);
  color: var(--fg);
  font-weight: 500;
  box-shadow: 0 -1px 0 var(--border), 1px 0 0 var(--border), -1px 0 0 var(--border);
}

.tab__title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tab__favicon {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.tab__favicon--gen {
  border-radius: 3px;
  background: #b3aea1;
}
.tab__favicon--gen[data-color="a"] { background: #4a7eb8; }
.tab__favicon--gen[data-color="b"] { background: #cf6c47; border-radius: 50%; }
.tab__favicon--gen[data-color="c"] { background: #6b8e4e; border-radius: 2px; }

.browser-mock__address {
  padding: 6px 12px 10px;
  background: var(--bg);
  border-top: 1px solid var(--border);
}

.browser-mock__url {
  display: inline-block;
  background: var(--bg-alt);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.75rem;
  color: var(--fg-muted);
  font-family: var(--font-mono);
}

/* The simulated page area inside the browser chrome. Shows the user's
   concept image as the site's "logo" and their brief as the tagline,
   so the favicon sits in a recognizable context. */
.browser-mock__page {
  background: var(--bg);
  padding: 28px 20px 32px;
  text-align: center;
}

.page-logo {
  display: block;
  width: auto;
  height: auto;
  max-width: 180px;
  max-height: 180px;
  margin: 0 auto;
  object-fit: contain;
}

.page-tagline {
  margin: 14px auto 0;
  max-width: 360px;
  font-size: 0.875rem;
  color: var(--fg-muted);
  line-height: 1.45;
  white-space: pre-wrap;
}

.result-preview {
  display: flex;
  justify-content: center;
  padding: 16px 0;
}

img.favicon {
  width: 160px;
  height: 160px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 4px;
  padding: 8px;
}

a.download-button {
  display: inline-block;
  background: var(--accent);
  color: var(--accent-fg);
  text-decoration: none;
  padding: 10px 18px;
  border-radius: var(--radius);
  font-weight: 600;
  margin: 12px 0 16px;
}

a.download-button:hover { filter: brightness(1.05); }

.snippet { text-align: left; margin-top: 12px; }

.snippet summary {
  cursor: pointer;
  font-weight: 500;
  padding: 4px 0;
}

.snippet pre {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  margin: 8px 0;
}

.snippet button {
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 12px;
  font-size: 0.875rem;
  cursor: pointer;
}

.snippet button:hover { background: var(--bg-alt); }

.status--error {
  background: var(--error-bg);
  border-color: #f3c4c0;
}

.error-message {
  color: var(--error-fg);
  font-weight: 500;
  margin: 0 0 4px;
}

footer {
  max-width: 580px;
  margin: 32px auto 24px;
  padding: 0 24px;
  color: var(--fg-muted);
  font-size: 0.875rem;
}

.htmx-request button[type="submit"] {
  opacity: 0.7;
  cursor: progress;
}
