:root {
  --bg: #f3f1ea; /* warm cream */
  --surface: #ffffff;
  --text: #1a1a1a;
  --text-muted: #666;
  --primary: #d946ef; /* vivid magenta */
  --primary-dim: #f5d0fe;
  --border: #e5e5e5;
  --border-subtle: #d4d4d4;
  --danger: #ef4444;
  --radius: 4px; /* sharp corners for newspaper feel */
  --spacing: 16px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0f0f;
    --surface: #1a1a1a;
    --text: #f3f1ea;
    --text-muted: #999;
    --primary: #e879f9;
    --primary-dim: #2a1a2a;
    --border: #333;
    --border-subtle: #444;
    --danger: #fca5a5;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

/* masthead */
.masthead {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 24px 16px;
}

.masthead-inner {
  max-width: 640px;
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
}

.brand-mark {
  color: var(--primary);
  font-size: 1.75rem;
  line-height: 1;
}

.brand-name {
  color: var(--text);
}

.brand-sub {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.strap {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.strap-tag {
  background: var(--primary-dim);
  color: var(--primary);
  padding: 2px 6px;
  border-radius: 2px;
  font-weight: 600;
}

.strap-sep {
  color: var(--border-subtle);
}

/* page */
.page {
  max-width: 640px;
  margin: 0 auto;
  padding: 32px 16px;
}

/* steps */
.step {
  margin-bottom: 32px;
  animation: fadeIn 0.3s ease;
}

.step.is-hidden {
  display: none;
}

.eyebrow {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.num {
  font-weight: 700;
  color: var(--primary);
}

.lede {
  margin: 0 0 24px 0;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* dropzone */
.dropzone {
  border: 2px dashed var(--border-subtle);
  border-radius: var(--radius);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s;
}

.dropzone:hover,
.dropzone:focus {
  border-color: var(--primary);
  outline: none;
}

.dropzone-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.dropzone-art {
  width: 48px;
  height: 48px;
  fill: var(--text-muted);
}

.dropzone-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.link-btn {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  padding: 0;
  font: inherit;
}

.link-btn:hover {
  text-decoration: underline;
}

.dropzone-sub {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* grid-2 */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

@media (min-width: 600px) {
  .grid-2 {
    grid-template-columns: 1fr 1fr;
  }
}

/* panel */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.panel-title {
  font-weight: 600;
  font-size: 0.875rem;
}

.panel-actions {
  display: flex;
  gap: 8px;
}

/* frames list */
.frames {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
}

.frames li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: grab;
}

.frames li:active {
  cursor: grabbing;
}

.frames li.dragging {
  opacity: 0.5;
}

.frames img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 2px;
  background: #ccc;
}

.frames .idx {
  font-size: 0.75rem;
  color: var(--text-muted);
  width: 20px;
}

.frames .remove {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
}

.frames .remove:hover {
  color: var(--danger);
}

/* controls */
.control {
  margin-bottom: 16px;
}

.control label {
  display: block;
  font-size: 0.875rem;
  margin-bottom: 6px;
}

.control .hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.control .row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.control input[type="range"] {
  flex: 1;
}

.control output {
  width: 48px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: 0.875rem;
}

/* toggles */
.control.toggles {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  cursor: pointer;
}

.toggle input {
  margin: 0;
}

/* buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}

.btn:hover {
  border-color: var(--text-muted);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

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

.btn.primary:hover {
  background: #c026d3;
  border-color: #c026d3;
}

.btn.ghost {
  border-color: transparent;
  background: transparent;
}

.btn.ghost:hover {
  background: var(--bg);
}

.btn.ghost.danger {
  color: var(--danger);
}

.btn.ghost.danger:hover {
  background: #fee2e2;
}

/* preview */
.preview-panel {
  text-align: center;
}

.preview-frame {
  max-width: 100%;
  margin-bottom: 12px;
}

.preview-frame img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.preview-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* footer */
.footer {
  margin-top: 48px;
  padding: 16px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

/* error */
.error {
  margin-top: 12px;
  padding: 8px 12px;
  background: #fee2e2;
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  font-size: 0.875rem;
  color: #991b1b;
}

/* animation */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
