:root {
  --bg0: #12100e;
  --bg1: #1c1814;
  --ink: #f4ede2;
  --muted: #b8ab9a;
  --line: rgba(244, 237, 226, 0.14);
  --accent: #c9a66b;
  --accent-strong: #e0bd7a;
  --danger: #ef9a9a;
  --card: rgba(28, 24, 20, 0.82);
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(ellipse at top, rgba(201, 166, 107, 0.16), transparent 48%),
    linear-gradient(160deg, #0f0d0b 0%, #1a1612 42%, #0c0b0a 100%);
}

.page {
  width: min(980px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 3.5rem 0 5rem;
}

.hero {
  margin-bottom: 2.25rem;
}

.eyebrow {
  margin: 0 0 0.6rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-size: 0.78rem;
  color: var(--accent);
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

h1,
h2 {
  margin: 0;
  font-weight: 500;
  letter-spacing: -0.02em;
}

h1 {
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  line-height: 1.1;
}

.lede {
  margin: 0.9rem 0 0;
  max-width: 42rem;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.55;
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

.form {
  display: grid;
  gap: 1.25rem;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 1.4rem;
  display: grid;
  gap: 1rem;
}

label {
  display: grid;
  gap: 0.45rem;
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

label span {
  font-size: 0.92rem;
  color: var(--muted);
}

label small {
  color: rgba(184, 171, 154, 0.8);
}

input[type="text"],
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(10, 9, 8, 0.55);
  color: var(--ink);
  border-radius: 0;
  padding: 0.85rem 0.95rem;
  font: inherit;
  font-size: 1rem;
}

textarea {
  resize: vertical;
  min-height: 7rem;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(201, 166, 107, 0.55);
  outline-offset: 1px;
}

.duration-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.85rem;
  align-items: center;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

#slideSecondsOut {
  min-width: 2.8rem;
  text-align: right;
  color: var(--accent-strong);
  font-variant-numeric: tabular-nums;
}

.images-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
  flex-wrap: wrap;
}

.images-header p {
  margin: 0;
  color: var(--muted);
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  font-size: 0.92rem;
}

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

.image-option {
  position: relative;
  border: 1px solid var(--line);
  background: #0c0b0a;
  cursor: pointer;
  padding: 0;
  overflow: hidden;
  aspect-ratio: 1;
}

.image-option img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0.88;
  transition: opacity 160ms ease, transform 220ms ease;
}

.image-option:hover img {
  opacity: 1;
  transform: scale(1.03);
}

.image-option.selected {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.image-option.selected::after {
  content: "✓";
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  width: 1.4rem;
  height: 1.4rem;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #1a140c;
  font-size: 0.85rem;
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

.image-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.actions {
  display: grid;
  gap: 0.75rem;
}

button[type="submit"] {
  border: 0;
  background: linear-gradient(135deg, var(--accent), #a9844f);
  color: #1a140c;
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  font-size: 1rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  padding: 1rem 1.2rem;
  cursor: pointer;
}

button[type="submit"]:disabled {
  opacity: 0.55;
  cursor: wait;
}

.status {
  margin: 0;
  min-height: 1.4rem;
  color: var(--muted);
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

.status.error {
  color: #ef9a9a;
}

.result {
  margin-top: 2rem;
  padding: 1.4rem;
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow);
}

.result.hidden {
  display: none;
}

.result video {
  width: 100%;
  margin-top: 1rem;
  background: #000;
  max-height: 520px;
}

.result-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1rem;
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

.result-links a {
  color: var(--accent-strong);
}

.props-preview {
  margin: 1rem 0 0;
  padding: 1rem;
  overflow: auto;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--line);
  color: #d8cfc0;
  font-size: 0.82rem;
  line-height: 1.45;
}

@media (max-width: 640px) {
  .page {
    padding-top: 2rem;
  }

  .panel {
    padding: 1rem;
  }
}
