:root {
  color-scheme: light;
  --ink: #16181d;
  --muted: #6b7280;
  --line: #e3e5e9;
  --bg: #fafafa;
  --card: #ffffff;
  --accent: #16181d;
  --accent-fg: #ffffff;
  --error: #b42318;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--card);
}
.brand { font-weight: 700; letter-spacing: -0.01em; }
.account-pill {
  font-size: 13px;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 12px;
}

.page { max-width: 880px; margin: 0 auto; padding: 32px 24px 80px; }

.center-card {
  max-width: 420px;
  margin: 80px auto;
  text-align: center;
}
.center-card h1 { margin-bottom: 8px; }
.lede { color: var(--muted); margin-bottom: 24px; }
.stack { display: flex; flex-direction: column; gap: 10px; }

input[type="email"], input[type="text"] {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 15px;
}

button, .button {
  display: inline-block;
  background: var(--accent);
  color: var(--accent-fg);
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}
button:disabled { opacity: 0.5; cursor: default; }
.button.small, button.small { padding: 6px 12px; font-size: 13px; }

.error { color: var(--error); font-size: 14px; }
.muted, .note { color: var(--muted); font-size: 13px; }

.two-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
}
.card h2 { margin-top: 0; font-size: 16px; }
.card .sub { color: var(--muted); font-size: 13px; }

.reels-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.reel-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  text-align: center;
}
.reel-card img { width: 100%; border-radius: 6px; aspect-ratio: 9/16; object-fit: cover; }
.reel-thumb-placeholder {
  width: 100%; aspect-ratio: 9/16;
  background: var(--bg);
  border-radius: 6px;
}

.upload-row { font-size: 13px; color: var(--muted); padding: 4px 0; }

.sources-list { margin-top: 40px; }
.source-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}
.source-panel h3 { margin-top: 0; }

.questions form { margin-bottom: 20px; }
.questions-row { display: flex; flex-wrap: wrap; gap: 24px; margin-bottom: 12px; }
.question { min-width: 220px; }
.question span { display: block; font-weight: 600; margin-bottom: 4px; }
.question label { font-size: 13px; margin-right: 12px; }
.question .sub { margin: 4px 0 0; }

table { width: 100%; border-collapse: collapse; margin-bottom: 10px; }
th { text-align: left; font-size: 12px; color: var(--muted); padding: 4px 8px; }
td.cell {
  border: 1px solid var(--line);
  padding: 6px 8px;
  min-width: 120px;
  font-size: 14px;
}
td.cell:focus { outline: 2px solid var(--ink); outline-offset: -2px; }
.row-remove {
  background: none; color: var(--muted); border: none; font-size: 16px;
  padding: 0 6px; cursor: pointer;
}

.hooks-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hooks-toolbar select {
  padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px;
}
.spacer { flex: 1; }
.saved-note { font-size: 12px; color: var(--muted); }

@media (max-width: 640px) {
  .two-cards { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------- preview (§6 step 5) */

.nav { display: inline-flex; gap: 14px; margin-left: 16px; }
.nav a { color: var(--muted); text-decoration: none; font-size: 13px; }
.nav a:hover { color: var(--ink); }

.preview-head { margin-bottom: 20px; }
.preview-head .count { font-size: 15px; margin: 4px 0; }
.rate { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.rate input[type="number"] {
  width: 64px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px;
}
.acknowledgement {
  flex-basis: 100%; max-width: 620px; padding: 12px 14px; margin-top: 8px;
  border: 1px solid var(--error); border-radius: 10px; background: var(--card);
}
.acknowledgement p { margin: 0 0 8px; font-size: 13px; line-height: 1.5; }
.acknowledgement label { display: block; font-size: 13px; margin-bottom: 8px; }
[x-cloak] { display: none !important; }

.preview-panel {
  display: grid; grid-template-columns: 240px 1fr; gap: 22px;
  padding: 16px; margin-bottom: 18px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
}
.preview-controls h3 { margin: 0 0 12px; font-size: 15px; }
.preview-controls .control { display: block; margin-bottom: 16px; }
.preview-controls .control > span { display: block; font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.preview-controls select {
  width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px;
}
.segmented { display: flex; gap: 6px; }
.segmented label {
  flex: 1; text-align: center; font-size: 12px; padding: 5px 0; cursor: pointer;
  border: 1px solid var(--line); border-radius: 8px;
}
.segmented label.on { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.segmented input { display: none; }
.slider { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.slider input { width: 100%; }

.preview-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
.cell { margin: 0; }
.cell.skipped .frame { opacity: 0.32; }
/* The frame keeps the reel's own 1080x1920, so the text layer lands exactly
   where it will land in the video - the whole point of previewing at all. */
.frame {
  position: relative; aspect-ratio: 1080 / 1920; overflow: hidden;
  border-radius: 8px; background: var(--line);
}
.frame img { position: absolute; inset: 0; width: 100%; height: 100%; }
.frame .poster { object-fit: cover; }
.frame .layer { object-fit: fill; }
/* The band the hook is laid out in, so dragging the placement shows what is
   being moved rather than only its result. */
.band-guide {
  position: absolute; left: 0; right: 0; pointer-events: none;
  border-top: 1px dashed rgba(255, 255, 255, 0.55);
  border-bottom: 1px dashed rgba(255, 255, 255, 0.55);
}
.preparing {
  display: none; position: absolute; inset: 0; align-items: center; justify-content: center;
  font-size: 12px; color: var(--muted); text-align: center; padding: 0 10px;
}
.frame.nopost .preparing { display: flex; }
.frame.nopost .poster, .frame.nopost .layer, .frame.nopost .band-guide { display: none; }
.cell figcaption { margin-top: 6px; }
.thumb {
  width: 100%; font-size: 11px; padding: 4px 6px; cursor: pointer;
  background: none; color: var(--muted);
  border: 1px solid var(--line); border-radius: 8px;
}
.thumb:hover { color: var(--ink); border-color: var(--ink); }

@media (max-width: 720px) {
  .preview-panel { grid-template-columns: 1fr; }
}

.settings { max-width: 760px; }
.settings .sub { max-width: 560px; margin-bottom: 16px; }
.font-list { list-style: none; padding: 0; margin: 0 0 16px; }
.font-list li {
  display: flex; align-items: center; gap: 16px;
  padding: 8px 12px; border-bottom: 1px solid var(--line);
}
.font-list label { display: flex; align-items: center; gap: 8px; min-width: 220px; }
.font-label { font-size: 13px; color: var(--muted); }

.mode-option {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer;
}
.mode-option input { margin-top: 3px; }
.mode-option .sub { display: block; margin-top: 2px; }
button.danger { background: var(--error); }

.tomorrow-head { margin-bottom: 16px; }
.tomorrow-list { list-style: none; padding: 0; margin: 0; }
.tomorrow-item {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.tomorrow-item.empty { opacity: 0.5; }
.thumb-wrap {
  width: 54px; height: 96px; border-radius: 6px; overflow: hidden;
  background: var(--line); flex-shrink: 0;
}
.thumb-wrap img { width: 100%; height: 100%; object-fit: cover; }
.tomorrow-meta { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.fire-time { font-weight: 600; font-size: 13px; }
.hook-text {
  font-size: 14px; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; max-width: 420px;
}
.tomorrow-actions { display: flex; gap: 6px; flex-shrink: 0; }
.tomorrow-actions .inline { display: inline; }
.thumb.on { background: var(--accent); color: var(--accent-fg); }

.results-head .sub { max-width: 640px; }
.totals-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 16px 0; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 14px; text-align: center;
}
.stat strong { display: block; font-size: 22px; }
.stat span { color: var(--muted); font-size: 12px; }
.breakdown-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 8px; }
.breakdown { width: 100%; border-collapse: collapse; font-size: 13px; }
.breakdown td, .breakdown th { padding: 6px 4px; border-bottom: 1px solid var(--line); text-align: left; }

@media (max-width: 720px) {
  .totals-grid { grid-template-columns: repeat(2, 1fr); }
  .breakdown-cols { grid-template-columns: 1fr; }
}
.font-list img { height: 34px; width: auto; max-width: 460px; object-fit: contain; object-position: left; }

.plan-list .card form + form { margin-top: 8px; }
.tos-check { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--muted); text-align: left; }
.tos-check input { margin-top: 3px; }
.legal-footer {
  max-width: 880px; margin: 0 auto; padding: 24px; display: flex; gap: 16px;
  font-size: 12px; color: var(--muted); border-top: 1px solid var(--line);
}
.legal-footer a { color: var(--muted); }
