:root {
  --bg: #12110f;
  --paper: #1c1915;
  --paper-2: #26221c;
  --text: #f4f0e6;
  --muted: #b1a79a;
  --line: rgba(244, 240, 230, 0.12);
  --danger: #ff7a68;
  --ok: #8fd18a;
  --warn: #e6c36a;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh;
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(232, 168, 56, 0.08), transparent 50%),
    var(--bg);
  color: var(--text);
  font: 16px/1.5 "Segoe UI", sans-serif;
}
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3 { font-family: Georgia, "Iowan Old Style", Palatino, serif; font-weight: 500; letter-spacing: -0.03em; }
h1 { font-size: 2.4rem; line-height: 1.1; margin: 0 0 0.4rem; }
h2 { font-size: 1.4rem; margin: 0 0 0.4rem; }
p { margin: 0 0 0.8rem; }

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 6vw;
  border-bottom: 1px solid var(--line);
}
.brand { font-family: Georgia, serif; font-size: 1.25rem; text-decoration: none; }
nav { display: flex; gap: 1rem; align-items: center; }
nav form { margin: 0; }
nav button.ghost { padding: 0.35rem 0.8rem; }
.auth { max-width: 28rem; }
nav a { color: var(--muted); text-decoration: none; }
nav a:hover { color: var(--text); }
main { padding: 2rem 6vw 4rem; max-width: 1180px; margin: 0 auto; }
.lede { max-width: 68ch; color: var(--muted); font-size: 1.05rem; }

.flash {
  background: var(--paper);
  border: 1px solid var(--line);
  border-left: 4px solid var(--ok);
  padding: 0.8rem 1rem;
  border-radius: 10px;
  margin-bottom: 1.2rem;
}
.flash[data-type="warn"] { border-left-color: var(--warn); }
.flash[data-type="bad"] { border-left-color: var(--danger); }

.banner {
  background: #2a2116;
  border: 1px solid rgba(230, 195, 106, 0.35);
  color: #f3e2bc;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  margin: 1rem 0 1.4rem;
}

.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; margin: 1.4rem 0 2rem; }
.card, .panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.card { padding: 1.1rem 1.1rem 1.2rem; border-top: 4px solid var(--accent, var(--warn)); }
.card h2 a { color: inherit; text-decoration: none; }
.card h2 a:hover { text-decoration: underline; }
.card p, .panel p { color: var(--muted); }
.niche { color: var(--text); font-size: 0.95rem; }
.rules { min-height: 4.6rem; }

.produce, .stack { display: grid; gap: 0.7rem; }
.topic-label { margin: 0; }
.topic-label span, .topic-option small, .topic-option em { color: var(--muted); }
.topic-label span { display: block; font-size: 0.82rem; }
.topic-options { display: grid; gap: 0.45rem; }
.topic-refresh { justify-self: start; padding: 0.4rem 0.8rem; font-size: 0.82rem; }
.topic-option {
  display: grid;
  grid-template-columns: 1.1rem 1fr;
  gap: 0.65rem;
  align-items: start;
  margin: 0;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper-2);
  cursor: pointer;
}
.topic-option input[type="radio"] { margin-top: 0.28rem; }
.topic-option strong { display: block; color: var(--text); font-size: 0.92rem; line-height: 1.35; overflow-wrap: anywhere; }
.topic-option small, .topic-option em { display: block; font-size: 0.78rem; font-style: normal; margin-top: 0.15rem; }
.topic-option:has(input[type="radio"]:checked) { border-color: rgba(244, 240, 230, 0.72); }
.topic-custom input:not([type="radio"]) { margin-top: 0.45rem; }
label { display: grid; gap: 0.3rem; font-size: 0.92rem; }
label span, .hint { color: var(--muted); font-size: 0.82rem; }
input, textarea, select {
  width: 100%;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
}
textarea { min-height: 140px; resize: vertical; }
button, .button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  border: 0;
  border-radius: 999px;
  padding: 0.7rem 1rem;
  background: var(--text);
  color: #16130f;
  text-decoration: none;
  cursor: pointer;
}
button[disabled] { opacity: 0.45; cursor: not-allowed; }
button.ghost, a.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}
button.danger { background: transparent; color: var(--danger); border: 1px solid rgba(255, 122, 104, 0.45); }
.actions { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }
.actions form { margin: 0; }

.list { display: grid; gap: 0.55rem; }
.row-wrap { display: grid; grid-template-columns: 1fr auto; gap: 0.55rem; align-items: center; }
.row-wrap form { margin: 0; }
.row {
  display: grid;
  grid-template-columns: 11rem 1fr auto;
  gap: 0.8rem;
  align-items: center;
  padding: 0.85rem 1rem;
  text-decoration: none;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.row:hover { border-color: rgba(244, 240, 230, 0.28); }
.row strong { display: block; }
.row small, .meta { color: var(--muted); }
.status { font-size: 0.78rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.status[data-status="ready"], .status[data-status="approved"] { color: var(--warn); }
.status[data-status="published"] { color: var(--ok); }
.status[data-status="failed"], .status[data-status="rejected"] { color: var(--danger); }
.status[data-status="rendering"], .status[data-status="writing"], .status[data-status="researching"], .status[data-status="publishing"], .status[data-status="queued"] { color: #8ec8ff; }

.review { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 1rem; align-items: start; }
.panel { padding: 1rem; }
.stage video { width: 100%; background: #000; border-radius: 12px; aspect-ratio: 16/9; }
.phone { width: min(100%, 280px); background: #000; border-radius: 22px; padding: 0.45rem; }
.phone video { width: 100%; aspect-ratio: 9/16; border-radius: 16px; background: #000; display: block; }
.thumb { width: 100%; border-radius: 12px; display: block; background: #000; }
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chips button { background: var(--paper-2); color: var(--text); border: 1px solid var(--line); border-radius: 999px; padding: 0.35rem 0.7rem; }
pre.log {
  white-space: pre-wrap;
  background: #100e0c;
  border-radius: 10px;
  padding: 0.8rem;
  color: #d9d0c3;
  max-height: 240px;
  overflow: auto;
  font-size: 0.82rem;
}
details { margin: 0.4rem 0 1rem; }
summary { cursor: pointer; color: var(--muted); }
.script { white-space: pre-wrap; color: var(--text); }

@media (max-width: 980px) {
  .grid, .review, .row { grid-template-columns: 1fr; }
  main, .top { padding-left: 1.1rem; padding-right: 1.1rem; }
  h1 { font-size: 2rem; }
}
