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

:root {
  --bg: #0a0a0a;
  --surface: #111;
  --text: #ccc;
  --text-muted: #777;
  --heading: #fff;
  --accent: #6c5ce7;
  --border: #333;
  --border-light: #222;
  --error-bg: #1a1010;
  --error-text: #f08080;
  --error-border: #3a2020;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "SF Mono", "JetBrains Mono", "Cascadia Code", monospace;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
  max-width: 860px;
  margin: 0 auto;
  padding: 64px 24px 96px;
}

/* ---- Typography ---- */

h1 {
  font-size: 2.8rem;
  font-weight: 700;
  color: var(--heading);
  letter-spacing: -0.03em;
}

h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--heading);
  margin: 36px 0 12px;
}

h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 12px;
}

.tagline {
  color: var(--text);
  font-size: 1.15rem;
  margin-top: 12px;
  max-width: 600px;
  line-height: 1.6;
}

.header-row {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
}

.account-area {
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: right;
  flex-shrink: 0;
}

.text-button {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font: inherit;
  padding: 0;
  text-decoration: underline;
}

.text-button:hover { color: var(--heading); }

.auth-card {
  max-width: 580px;
  margin: 36px 0 48px;
  padding: 28px;
  border: 2px solid var(--border);
  background: var(--surface);
}

.auth-card h2 { margin: 0 0 6px; }

/* ---- Public sample ---- */

.demo-section { margin: 44px 0 48px; }

.section-kicker {
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.demo-heading-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 18px;
  margin: 6px 0 14px;
}

.demo-heading-row h2 { margin: 0 0 4px; }
.demo-heading-row p { color: var(--text-muted); font-size: 0.92rem; }

.demo-badge {
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.72rem;
  padding: 2px 8px;
  white-space: nowrap;
}

.demo-result { border: 2px solid var(--border); background: var(--surface); }

.demo-source {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.demo-clip {
  display: grid;
  grid-template-columns: 26px 118px minmax(180px, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 15px 16px;
  border-bottom: 1px solid var(--border-light);
}

.demo-rank, .demo-time { font-family: var(--font-mono); color: var(--text-muted); font-size: 0.8rem; }
.demo-hook { color: var(--heading); font-size: 0.93rem; line-height: 1.45; }
.demo-category { color: var(--accent); font-size: 0.78rem; white-space: nowrap; }
.demo-download {
  border: 1px solid var(--accent);
  color: var(--heading);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 4px 7px;
  white-space: nowrap;
}
.demo-result .demo-note { margin: 0; padding: 13px 16px; line-height: 1.5; }

.stacked-form { margin-top: 20px; }

.stacked-form label {
  display: block;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 6px;
}

.inline-form { display: flex; gap: 10px; }

.inline-form input {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  border: 2px solid var(--border);
  background: var(--bg);
  color: var(--heading);
  font: inherit;
  outline: none;
}

.inline-form input:focus { border-color: var(--accent); }

.inline-form button {
  padding: 12px 16px;
  border: none;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
}

.form-message { color: var(--text-muted); font-size: 0.9rem; margin-top: 12px; }

.consent-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  color: var(--text-muted);
  font-size: 0.82rem;
  margin-bottom: 18px;
}

.consent-row input { margin-top: 6px; accent-color: var(--accent); }

.job-history { display: grid; gap: 8px; }

.job-card {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 13px 16px;
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.job-card:hover { border-color: var(--accent); }
.job-card small { color: var(--text-muted); white-space: nowrap; }

/* ---- Explainer ---- */

.output-summary {
  font-size: 0.95rem;
  max-width: 560px;
  line-height: 1.7;
}

.explainer ol,
.explainer ul {
  list-style: none;
}

.explainer ol {
  counter-reset: steps;
}

.explainer ol li {
  counter-increment: steps;
  padding: 6px 0;
  font-size: 0.95rem;
}

.explainer ol li::before {
  content: counter(steps) ".";
  color: var(--accent);
  font-weight: 600;
  margin-right: 10px;
}

.explainer ul li {
  padding: 6px 0;
  font-size: 0.95rem;
}

.explainer ul li::before {
  content: "—";
  color: var(--accent);
  margin-right: 10px;
}

/* ---- Form ---- */

#submit-form {
  display: flex;
  gap: 0;
  margin: 36px 0 16px;
  border: 2px solid var(--border);
}

#submit-form:focus-within {
  border-color: var(--accent);
}

#url-input {
  flex: 1;
  padding: 16px 20px;
  border: none;
  background: var(--surface);
  color: var(--heading);
  font-size: 1rem;
  font-family: var(--font-mono);
  outline: none;
}

#url-input::placeholder {
  color: var(--text-muted);
}

#submit-btn {
  padding: 16px 28px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-left: 2px solid var(--accent);
  font-size: 0.95rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}

#submit-btn:hover {
  background: #5a4bd1;
}

#submit-btn:disabled {
  background: var(--border);
  border-left-color: var(--border);
  color: var(--text-muted);
  cursor: not-allowed;
}

/* ---- Footnote ---- */

.footnote {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-bottom: 48px;
}

/* ---- Dividers ---- */

hr {
  border: none;
  border-top: 2px solid var(--border);
  margin: 0 0 32px;
}

/* ---- Status ---- */

#status-area {
  margin-bottom: 32px;
  padding: 16px 20px;
  border: 2px solid var(--border);
  background: var(--surface);
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 14px;
}

#status-area::before {
  content: "";
  width: 12px;
  height: 12px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

#status-area.done::before {
  display: none;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---- Error ---- */

#error-area {
  margin-bottom: 32px;
  padding: 16px 20px;
  border: 2px solid var(--error-border);
  background: var(--error-bg);
  color: var(--error-text);
  font-size: 0.95rem;
}

/* ---- Results ---- */

#results-title {
  font-size: 1.4rem;
  margin-bottom: 28px;
}

section {
  margin-bottom: 40px;
}

/* ---- Table ---- */

table {
  width: 100%;
  border-collapse: collapse;
  border: 2px solid var(--border);
}

th {
  text-align: left;
  padding: 10px 16px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 2px solid var(--border);
}

td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.9rem;
  font-family: var(--font-mono);
}

td:nth-child(3) {
  font-family: var(--font);
}

tr:last-child td {
  border-bottom: none;
}

.clip-row {
  cursor: pointer;
}

.clip-row:hover td {
  background: var(--surface);
}

.clip-row.active td {
  background: var(--surface);
  border-left: 2px solid var(--accent);
}

.score-badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 0.75rem;
  font-weight: 700;
  font-family: var(--font-mono);
}

.score-high  { color: #4ade80; }
.score-mid   { color: #facc15; }
.score-low   { color: #f87171; }

/* ---- Download link ---- */

.dl-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 1.1rem;
  font-weight: 600;
}

.dl-link:hover {
  color: var(--accent);
}

/* ---- Mono ---- */

.mono {
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

/* ---- Tweet thread ---- */

#tweet-thread {
  counter-reset: tweet;
}

.tweet-card {
  padding: 16px 20px;
  border: 2px solid var(--border);
  background: var(--surface);
  margin-bottom: -2px;
  font-size: 0.95rem;
  counter-increment: tweet;
}

.tweet-card::before {
  content: counter(tweet) "/" attr(data-total);
  display: block;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  margin-bottom: 6px;
}

/* ---- Clip Detail ---- */

#clip-detail {
  border: 2px solid var(--border);
  padding: 24px;
  background: var(--surface);
}

#clip-detail h3 {
  margin-top: 0;
}

.clip-detail-field {
  margin-bottom: 18px;
}

.clip-detail-field:last-child {
  margin-bottom: 0;
}

.clip-detail-label {
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.clip-detail-value {
  font-size: 0.95rem;
}

.social-copy-block {
  padding: 16px 20px;
  background: var(--bg);
  border: 2px solid var(--border);
  white-space: pre-wrap;
  font-size: 0.9rem;
  font-family: var(--font);
  line-height: 1.7;
}

/* ---- Short Ideas ---- */

#short-ideas {
  list-style: none;
}

#short-ideas li {
  padding: 12px 20px;
  border: 2px solid var(--border);
  background: var(--surface);
  margin-bottom: -2px;
  font-size: 0.95rem;
}

#short-ideas li::before {
  content: "→ ";
  color: var(--accent);
  font-weight: 600;
}

.demo-note {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 8px;
}

/* ---- Utility ---- */

.hidden {
  display: none;
}

#status-area.hidden {
  display: none;
}

/* ---- Responsive ---- */

@media (max-width: 600px) {
  body {
    padding: 32px 16px 64px;
  }

  h1 {
    font-size: 2rem;
  }

  .tagline {
    font-size: 1rem;
  }

  .header-row { display: block; }
  .account-area { text-align: left; margin-top: 12px; }
  .inline-form { display: block; }
  .inline-form input, .inline-form button { width: 100%; }
  .inline-form button { margin-top: 8px; }
  .job-card { display: block; }
  .job-card small { display: block; margin-top: 4px; }
  .demo-heading-row { align-items: flex-start; }
  .demo-clip { grid-template-columns: 22px 1fr; gap: 4px 10px; }
  .demo-time { grid-column: 2; }
  .demo-hook { grid-column: 2; }
  .demo-category { grid-column: 2; white-space: normal; }
  .demo-download { grid-column: 2; justify-self: start; }

  #submit-form {
    flex-direction: column;
  }

  #submit-btn {
    border-left: none;
    border-top: 2px solid var(--accent);
  }

  #submit-btn:disabled {
    border-top-color: var(--border);
  }

  table {
    font-size: 0.8rem;
  }

  th, td {
    padding: 8px 10px;
  }
}
