/* Dreamcast web — Scribe "Conversation" design system, ported from the
   desktop app's class C tokens + QSS (dreamcast.py). Deliberately dark. */

:root {
  /* Surface ladder */
  --bg-0: #07090E; --bg-1: #0B1118; --bg-2: #0F1620;
  --bg-3: #141C28; --bg-4: #1A2330; --bg-5: #232E3F;
  /* Foreground */
  --fg-1: #E8ECF1; --fg-2: #A4B0C0; --fg-3: #6A788C; --fg-4: #475669;
  /* Borders */
  --border-soft: rgba(255,255,255,0.05);
  --border: rgba(255,255,255,0.09);
  --border-strong: rgba(255,255,255,0.18);
  /* Accent — brand orange */
  --accent: #DC6D2C; --accent-hi: #F08947; --accent-dim: #A84A14;
  /* Error red + status */
  --rec: #EA4D52; --rec-hi: #FF6B6F; --ok: #4DC58A;
  /* Status-pill washes (bg / border) */
  --wash-ok-bg: #0F2018; --wash-ok-br: #1F4030;
  --wash-acc-bg: #1C1612; --wash-acc-br: #A84A14;
  --wash-err-bg: #1F0F11; --wash-err-br: #4A1D20;

  --font: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Inter', system-ui, sans-serif;
  --mono: Consolas, 'SF Mono', 'Cascadia Mono', ui-monospace, monospace;
}

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

html, body {
  background: var(--bg-0);
  color: var(--fg-1);
  font-family: var(--font);
  font-size: 14px;
  min-height: 100%;
}

.wrap { max-width: 880px; margin: 0 auto; padding: 0 16px 48px; }

/* ── Eyebrow labels ─────────────────────────────────────────────────────── */
.eyebrow {
  color: var(--fg-3);
  font-size: 10px; font-weight: 700;
  letter-spacing: 1.4px; text-transform: uppercase;
  margin-bottom: 6px;
}
.eyebrow.accent { color: var(--accent-hi); }

/* ── App header ─────────────────────────────────────────────────────────── */
header.app {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 0 14px;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 18px;
}
header.app img { width: 30px; height: 30px; }
header.app .title { font-size: 17px; font-weight: 700; letter-spacing: 2.5px; }
header.app .version { color: var(--fg-4); font-size: 11px; margin-top: 3px; }
header.app .spacer { flex: 1; }

/* ── Status pill ────────────────────────────────────────────────────────── */
.pill {
  display: inline-flex; align-items: center; gap: 7px;
  border-radius: 999px; padding: 4px 12px 4px 10px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.4px;
  background: var(--bg-3); border: 1px solid var(--border); color: var(--fg-2);
  white-space: nowrap;
}
.pill::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--fg-3);
}
.pill.ready::before { background: var(--ok); }
.pill.busy  { background: var(--wash-acc-bg); border-color: var(--wash-acc-br); color: var(--accent-hi); }
.pill.busy::before  { background: var(--accent-hi); animation: pulse 1.2s ease-in-out infinite; }
.pill.done  { background: var(--wash-ok-bg); border-color: var(--wash-ok-br); color: var(--ok); }
.pill.done::before  { background: var(--ok); }
.pill.error { background: var(--wash-err-bg); border-color: var(--wash-err-br); color: var(--rec-hi); }
.pill.error::before { background: var(--rec-hi); }
@keyframes pulse { 50% { opacity: 0.35; } }

/* ── Cards / sections ───────────────────────────────────────────────────── */
.card {
  background: var(--bg-1);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 14px;
}

/* ── Inputs ─────────────────────────────────────────────────────────────── */
input[type=text], input[type=password], input[type=url], select, textarea {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--fg-1);
  font-family: var(--font);
  font-size: 14px;
  padding: 9px 11px;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent-dim);
}
input::placeholder, textarea::placeholder { color: var(--fg-4); }
textarea {
  min-height: 320px; resize: vertical; line-height: 1.55;
}
select { appearance: auto; }
input:disabled, select:disabled, textarea:disabled, button:disabled {
  opacity: 0.45; cursor: not-allowed;
}
label.field { display: block; margin-bottom: 12px; }
label.field .eyebrow { margin-bottom: 5px; }
.hint { color: var(--fg-4); font-size: 11.5px; margin-top: 4px; line-height: 1.4; }

/* ── Buttons ────────────────────────────────────────────────────────────── */
button {
  font-family: var(--font); font-size: 13.5px; font-weight: 600;
  border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg-3); color: var(--fg-1);
  padding: 9px 16px; cursor: pointer; white-space: nowrap;
}
button:hover:not(:disabled) { background: var(--bg-4); border-color: var(--border-strong); }
button.primary {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
button.primary:hover:not(:disabled) { background: var(--accent-hi); border-color: var(--accent-hi); }
button.ghost {
  background: transparent; border-color: transparent; color: var(--fg-3);
}
button.ghost:hover:not(:disabled) { color: var(--fg-1); background: var(--bg-2); border-color: transparent; }
button.danger:hover:not(:disabled) { border-color: var(--rec); color: var(--rec-hi); }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row .grow { flex: 1 1 200px; }

/* ── Progress bar ───────────────────────────────────────────────────────── */
.bar { height: 5px; background: var(--bg-3); border-radius: 999px; overflow: hidden; margin-top: 12px; }
.bar > div { height: 100%; width: 0%; background: var(--accent); border-radius: 999px; transition: width 0.4s ease; }

/* ── Log dock ───────────────────────────────────────────────────────────── */
.log {
  background: var(--bg-0);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 10px 12px;
  min-height: 72px; max-height: 200px; overflow-y: auto;
  font-family: var(--mono); font-size: 11px; line-height: 1.7;
}
.log .ts { color: var(--fg-4); margin-right: 8px; }
.log .info    { color: var(--fg-3); }
.log .active  { color: var(--accent-hi); }
.log .success { color: var(--ok); }
.log .error   { color: var(--rec-hi); }

/* ── Episodes ───────────────────────────────────────────────────────────── */
.episode {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 2px; border-bottom: 1px solid var(--border-soft);
}
.episode:last-child { border-bottom: none; }
.episode .name { flex: 2 1 240px; font-size: 13px; overflow-wrap: anywhere; }
.episode .meta { color: var(--fg-4); font-size: 11px; }
.episode .badge {
  font-size: 10px; font-weight: 700; letter-spacing: 0.8px;
  color: var(--ok); border: 1px solid var(--wash-ok-br);
  background: var(--wash-ok-bg); border-radius: 999px; padding: 2px 8px;
}
.episode audio { width: 100%; height: 34px; }

/* ── Overlays (login + settings + post dialog) ──────────────────────────── */
.overlay {
  position: fixed; inset: 0; background: rgba(4,6,10,0.82);
  display: flex; align-items: center; justify-content: center;
  padding: 16px; z-index: 50;
}
.modal {
  background: var(--bg-1); border: 1px solid var(--border);
  border-radius: 14px; padding: 22px;
  width: 100%; max-width: 480px;
  max-height: 92vh; overflow-y: auto;   /* dialogs stay capped to the screen */
}
.modal h2 { font-size: 15px; letter-spacing: 1px; margin-bottom: 16px; }
.modal .section {
  color: var(--accent-hi); font-size: 10px; font-weight: 700;
  letter-spacing: 1.4px; text-transform: uppercase;
  margin: 18px 0 10px; padding-top: 14px;
  border-top: 1px solid var(--border-soft);
}
.modal .section:first-of-type { border-top: none; margin-top: 4px; padding-top: 0; }
.modal .actions {
  display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px;
  position: sticky; bottom: -22px; background: var(--bg-1); padding: 12px 0 2px;
}

/* ── Footer ─────────────────────────────────────────────────────────────── */
footer {
  color: var(--fg-4); font-size: 11px; text-align: center;
  padding-top: 10px; border-top: 1px solid var(--border-soft);
}

.hidden { display: none !important; }
.error-text { color: var(--rec-hi); font-size: 12.5px; margin-top: 8px; min-height: 16px; }
