:root {
  --bg: #0b0f19;
  --bg-elevated: #111827;
  --border: #1f2937;
  --text: #f3f4f6;
  --muted: #9ca3af;
  --dim: #6b7280;
  --accent: #3b82f6;
  --accent-hover: #60a5fa;
  --ok: #10b981;
  --warn: #d97706;
  --danger: #ef4444;
  --focus: #93c5fd;
  --radius: 8px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: Georgia, "Times New Roman", serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

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

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.wrap {
  width: min(720px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2.5rem 0 4rem;
}

.brand {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
  margin: 0 0 0.75rem;
}

h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2rem, 5vw, 2.75rem);
  line-height: 1.15;
  margin: 0 0 0.75rem;
  letter-spacing: -0.02em;
}

.lede {
  margin: 0 0 1.75rem;
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 38rem;
}

.promise {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.9rem 1rem;
  margin-bottom: 1.75rem;
  border-left: 3px solid var(--ok);
  background: color-mix(in srgb, var(--ok) 8%, transparent);
  color: #d1fae5;
  font-size: 0.95rem;
}

.promise strong {
  color: #ecfdf5;
}

.panel {
  display: grid;
  gap: 1.5rem;
}

@media (min-width: 640px) {
  .panel {
    grid-template-columns: 1.1fr 0.9fr;
    align-items: start;
  }
}

label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

textarea,
select,
input[type="range"] {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

textarea {
  min-height: 6.5rem;
  padding: 0.75rem 0.9rem;
  resize: vertical;
}

textarea:focus,
select:focus,
button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.field {
  margin-bottom: 1rem;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

select {
  padding: 0.55rem 0.7rem;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--dim) 50%),
    linear-gradient(135deg, var(--dim) 50%, transparent 50%);
  background-position: calc(100% - 16px) 55%, calc(100% - 11px) 55%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.range-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.range-wrap output {
  min-width: 3.5rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 0.9rem;
}

input[type="range"] {
  accent-color: var(--accent);
  height: 1.5rem;
  border: none;
  background: transparent;
  padding: 0;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.25rem;
}

button {
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  padding: 0.65rem 1rem;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

button:active:not(:disabled) {
  transform: translateY(1px);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
  background: #2563eb;
}

.btn-secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover:not(:disabled) {
  border-color: #374151;
  background: var(--bg-elevated);
}

.preview {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  min-height: 280px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.preview canvas {
  width: min(100%, 280px);
  height: auto;
  image-rendering: pixelated;
  background: #fff;
  border-radius: 4px;
  opacity: 0;
  transform: scale(0.96);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.preview canvas.is-ready {
  opacity: 1;
  transform: scale(1);
}

.placeholder {
  color: var(--dim);
  text-align: center;
  font-size: 0.95rem;
  max-width: 16rem;
}

.status {
  min-height: 1.25rem;
  margin-top: 0.75rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.status[data-kind="error"] {
  color: #fca5a5;
}

.status[data-kind="warn"] {
  color: #fbbf24;
}

.hint {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  color: var(--dim);
}

.footnote {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  color: var(--dim);
  font-size: 0.9rem;
}

.footnote p {
  margin: 0 0 0.65rem;
  max-width: 40rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
