:root {
  --bg: #0a0a0b;
  --bg-soft: #0e0e10;
  --surface: #131316;
  --surface-2: #17171b;
  --surface-3: #1c1c21;
  --border: rgba(255, 255, 255, 0.07);
  --border-2: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(255, 255, 255, 0.18);
  --text: #f4f4f6;
  --muted: #8c8c95;
  --faint: #5e5e67;
  --accent: #e9b949;
  --accent-dim: rgba(233, 185, 73, 0.14);
  --accent-line: rgba(233, 185, 73, 0.32);
  --good: #74d39a;
  --sans: 'Hanken Grotesk', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --r: 14px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-weight: 400;
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Fine grain overlay for depth */
.grain {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

main, .topbar, .foot { position: relative; z-index: 1; }

/* ---- header ---- */
.topbar {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 20px; padding: 22px 32px; border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.brand-mark { width: 13px; height: 13px; border-radius: 3px; background: var(--accent); }
.brand-name { font-weight: 600; font-size: 16px; letter-spacing: -0.02em; }

.nav { display: flex; align-items: center; gap: 18px; }
.nav-link { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: var(--muted); text-decoration: none; transition: color .15s; }
.nav-link:hover { color: var(--text); }
.soon { font-size: 9px; letter-spacing: 0.09em; text-transform: uppercase; color: var(--accent); border: 1px solid var(--accent-line); border-radius: 999px; padding: 2px 6px; font-weight: 600; }

/* ---- layout ---- */
main { max-width: 980px; margin: 0 auto; padding: 56px 24px 40px; }

.hero { margin-bottom: 34px; max-width: 680px; }
.hero h1 {
  font-size: clamp(28px, 4.4vw, 42px); line-height: 1.08; font-weight: 700;
  letter-spacing: -0.03em; margin: 0 0 16px;
}
.hero h1 span { color: var(--muted); }
.hero p { font-size: 15px; line-height: 1.65; color: var(--muted); max-width: 600px; margin: 0; }

/* reveal-on-load */
.reveal { opacity: 0; transform: translateY(14px); animation: rise 0.7s cubic-bezier(.2,.7,.2,1) forwards; animation-delay: calc(var(--d) * 90ms + 60ms); }
@keyframes rise { to { opacity: 1; transform: none; } }

/* ---- tool card ---- */
.tool {
  background: linear-gradient(180deg, var(--surface), var(--bg-soft));
  border: 1px solid var(--border); border-radius: var(--r);
  box-shadow: 0 1px 0 rgba(255,255,255,0.03) inset, 0 24px 60px -30px rgba(0,0,0,0.8);
  overflow: hidden;
}
.tool-head { padding: 14px 16px; border-bottom: 1px solid var(--border); }
.steps { display: flex; gap: 6px; }
.step {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--sans); font-size: 13px; font-weight: 500; color: var(--muted);
  background: transparent; border: 1px solid transparent; padding: 9px 14px; border-radius: 9px;
  cursor: pointer; transition: color .18s, background .18s, border-color .18s;
}
.step:hover:not(:disabled) { color: var(--text); background: var(--surface-2); }
.step.active { color: var(--text); background: var(--surface-3); border-color: var(--border-2); }
.step-no { font-family: var(--mono); font-size: 11px; color: var(--faint); }
.step.active .step-no { color: var(--accent); }
.step:disabled { opacity: 0.45; cursor: not-allowed; }

.panel { padding: 26px 24px 28px; }
.panel.hidden { display: none; }
.lede { color: var(--muted); font-size: 14px; line-height: 1.62; max-width: 600px; margin: 0 0 22px; }
.lede b { color: var(--text); font-weight: 600; }

.dropgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 22px; }
.dropgrid.single { grid-template-columns: 1fr; max-width: 360px; }
.drop {
  position: relative; display: flex; align-items: center; gap: 13px;
  padding: 16px 17px; border: 1px solid var(--border); border-radius: 11px;
  cursor: pointer; transition: border-color .18s, background .18s, transform .18s;
  background: var(--surface-2);
}
.drop:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dicon { color: var(--muted); flex: none; transition: color .18s, transform .18s; }
.drop:hover .dicon { color: var(--text); transform: translateY(-1px); }
.drop.filled .dicon { color: var(--accent); }
.dtext { display: flex; flex-direction: column; gap: 3px; min-width: 0; padding-right: 18px; }
.drop .dk { font-weight: 600; font-size: 14px; }
.drop .dn { font-size: 11px; color: var(--faint); font-family: var(--mono); letter-spacing: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dcheck { position: absolute; top: 14px; right: 14px; width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--border-2); transition: .2s; }
.drop.filled { border-color: var(--accent-line); background: linear-gradient(180deg, var(--accent-dim), var(--surface-2)); }
.drop.filled .dn { color: var(--accent); }
.drop.filled .dcheck { border-color: var(--accent); background: var(--accent); }
.drop.filled .dcheck::after { content: ""; position: absolute; left: 5px; top: 2px; width: 4px; height: 8px; border: solid #0a0a0b; border-width: 0 1.6px 1.6px 0; transform: rotate(43deg); }

/* primary button: light, high contrast */
.go {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--sans); font-weight: 600; font-size: 14.5px; letter-spacing: -0.01em;
  color: #0a0a0b; background: #f4f4f6; border: 1px solid #ffffff;
  padding: 12px 20px; border-radius: 10px; cursor: pointer;
  transition: transform .16s, box-shadow .16s, opacity .16s;
  box-shadow: 0 8px 24px -12px rgba(0,0,0,0.9);
}
.go .arr { transition: transform .2s; }
.go:not(:disabled):hover { transform: translateY(-1px); box-shadow: 0 12px 30px -12px rgba(0,0,0,0.9); }
.go:not(:disabled):hover .arr { transform: translateX(3px); }
.go:disabled { opacity: 0.32; cursor: not-allowed; }

.opts { display: flex; gap: 10px; margin: 0 0 18px; }
.toggle {
  display: inline-flex; align-items: center; gap: 9px; cursor: pointer;
  background: transparent; border: none; padding: 0; font-family: var(--sans);
}
.tg-track {
  position: relative; width: 38px; height: 22px; border-radius: 999px;
  background: var(--surface-3); border: 1px solid var(--border-2); transition: background .18s, border-color .18s;
}
.tg-thumb {
  position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--muted); transition: transform .18s, background .18s;
}
.toggle.on .tg-track { background: var(--accent-dim); border-color: var(--accent-line); }
.toggle.on .tg-thumb { transform: translateX(16px); background: var(--accent); }
.tg-text { font-size: 13.5px; font-weight: 500; color: var(--muted); }
.toggle.on .tg-text { color: var(--text); }

.output { margin-top: 26px; }
.output.hidden { display: none; }
#player { width: 100%; max-height: 440px; border-radius: 11px; background: #000; border: 1px solid var(--border); display: block; }
.download {
  display: inline-flex; align-items: center; gap: 7px; margin-top: 13px;
  font-size: 13px; color: var(--muted); text-decoration: none; font-weight: 500;
  transition: color .15s;
}
.download:hover { color: var(--text); }

/* ---- agent console ---- */
.ai {
  margin-top: 14px; border: 1px solid var(--border); border-radius: var(--r);
  background: linear-gradient(180deg, var(--surface), var(--bg-soft)); overflow: hidden;
}
.ai-bar {
  width: 100%; display: flex; align-items: center; gap: 16px; padding: 15px 18px;
  background: transparent; border: none; color: var(--text); cursor: pointer; text-align: left;
}
.ai-label { display: inline-flex; align-items: center; gap: 9px; font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); flex: none; }
.ai-pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); transition: background .2s; }
.ai.live .ai-pulse { background: var(--accent); animation: pulse 1.3s ease-in-out infinite; }
.ai.done .ai-pulse { background: var(--good); }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(233,185,73,.45); } 50% { box-shadow: 0 0 0 6px rgba(233,185,73,0); } }
.ai-now { flex: 1; color: var(--muted); font-family: var(--mono); font-size: 12.5px; letter-spacing: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai.live .ai-now, .ai.done .ai-now { color: var(--text); }
.ai-chevron { color: var(--faint); transition: transform .25s; flex: none; }
.ai-bar[aria-expanded="true"] .ai-chevron { transform: rotate(90deg); }

.ai-body { border-top: 1px solid var(--border); }
.ai-cols { display: grid; grid-template-columns: 1.12fr 1fr; }
.ai-col { padding: 18px 18px 20px; }
.ai-col:first-child { border-right: 1px solid var(--border); }
.ai-h { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--faint); margin-bottom: 12px; font-weight: 600; }

.ai-thoughts-wrap { position: relative; }
.ai-thoughts-wrap::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 26px; background: linear-gradient(transparent, var(--surface)); pointer-events: none; }
.ai-thoughts {
  font-family: var(--mono); font-size: 12.5px; line-height: 1.65; color: var(--text);
  white-space: pre-wrap; word-break: break-word; max-height: 320px; overflow-y: auto; margin: 0;
}
.ai-thoughts:empty::before { content: "Reasoning will stream here once a step is running."; color: var(--faint); }

.ai-plan { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-family: var(--mono); font-size: 11.5px; padding: 5px 9px; border-radius: 7px;
  background: var(--surface-2); border: 1px solid var(--border-2); color: var(--muted);
}
.chip b { color: var(--accent); font-weight: 500; }

.ai-h-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.ai-h-row .ai-h { margin-bottom: 0; }
.mini-edit { font-family: var(--sans); font-size: 11.5px; font-weight: 500; color: var(--muted); background: transparent; border: 1px solid var(--border-2); border-radius: 7px; padding: 3px 11px; cursor: pointer; transition: color .15s, border-color .15s; }
.mini-edit:hover { color: var(--text); border-color: var(--border-strong); }
.mini-edit[hidden] { display: none; }

.prompt-editor { margin: 12px 0 4px; }
.prompt-editor[hidden] { display: none; }
.prompt-editor textarea { width: 100%; min-height: 210px; resize: vertical; font-family: var(--mono); font-size: 11px; line-height: 1.55; color: var(--text); background: var(--bg); border: 1px solid var(--border-2); border-radius: 9px; padding: 12px; }
.prompt-editor textarea:focus { outline: none; border-color: var(--accent-line); }
.pe-actions { display: flex; align-items: center; gap: 8px; margin-top: 9px; }
.pe-save { font-family: var(--sans); font-weight: 600; font-size: 12.5px; color: #0a0a0b; background: var(--accent); border: none; border-radius: 8px; padding: 7px 14px; cursor: pointer; }
.pe-cancel { font-family: var(--sans); font-size: 12.5px; color: var(--muted); background: transparent; border: 1px solid var(--border-2); border-radius: 8px; padding: 7px 12px; cursor: pointer; }
.pe-cancel:hover { color: var(--text); }
.pe-err { font-size: 11px; color: #ff7a6b; font-family: var(--mono); }

.ai-det { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 14px; }
.ai-det summary { cursor: pointer; font-size: 12px; color: var(--muted); font-family: var(--mono); list-style: none; display: flex; align-items: center; gap: 6px; }
.ai-det summary::-webkit-details-marker { display: none; }
.ai-det summary::before { content: "+"; color: var(--faint); width: 10px; }
.ai-det[open] summary::before { content: "\2013"; }
.ai-det summary:hover { color: var(--text); }
.ai-det summary .cnt { color: var(--accent); }
.ai-transcript { margin-top: 12px; max-height: 230px; overflow-y: auto; display: flex; flex-direction: column; gap: 7px; }
.ai-transcript .seg { font-size: 12px; line-height: 1.5; color: var(--text); }
.ai-transcript .seg .t { font-family: var(--mono); color: var(--faint); font-size: 10.5px; margin-right: 9px; }
.ai-recipe { font-family: var(--mono); font-size: 11px; line-height: 1.55; color: var(--muted); white-space: pre-wrap; max-height: 250px; overflow-y: auto; margin: 12px 0 0; }
.muted { color: var(--faint); }
.note { font-size: 11.5px; color: var(--accent); margin-top: 10px; font-family: var(--mono); line-height: 1.5; }

/* scrollbars */
.ai-thoughts::-webkit-scrollbar, .ai-transcript::-webkit-scrollbar, .ai-recipe::-webkit-scrollbar { width: 8px; }
.ai-thoughts::-webkit-scrollbar-thumb, .ai-transcript::-webkit-scrollbar-thumb, .ai-recipe::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 8px; }

/* ---- Learn from YouTube page ---- */
.eyebrow { display: inline-flex; align-items: center; gap: 10px; font-size: 12px; font-weight: 600; letter-spacing: 0.02em; color: var(--muted); margin-bottom: 16px; }
.yt-input { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 1px solid var(--border-2); border-radius: 11px; background: var(--surface-2); }
.yt-ic { color: var(--accent); font-size: 12px; }
.yt-placeholder { flex: 1; color: var(--faint); font-family: var(--mono); font-size: 13px; }
.yt-go { font-size: 13px; font-weight: 600; color: #0a0a0b; background: var(--accent); border-radius: 8px; padding: 7px 14px; }
.yt-suggest { display: flex; align-items: flex-start; gap: 10px; margin: 18px 0 16px; font-size: 13.5px; line-height: 1.6; color: var(--text); }
.yt-suggest .yt-pulse { margin-top: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; }
.yt-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.yt-card { display: flex; flex-direction: column; gap: 9px; padding: 9px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); opacity: 0.55; }
.yt-card.sel { opacity: 1; border-color: var(--accent-line); background: linear-gradient(180deg, var(--accent-dim), var(--surface-2)); }
.yt-thumb { aspect-ratio: 16/9; border-radius: 6px; background: linear-gradient(135deg, var(--surface-3), #0c0c0e); }
.yt-meta { display: flex; flex-direction: column; gap: 2px; }
.yt-title { font-size: 12.5px; font-weight: 600; line-height: 1.25; }
.yt-sub { font-size: 10.5px; color: var(--faint); font-family: var(--mono); }
.yt-card.sel .yt-sub { color: var(--accent); }
.style-prompt { font-size: 14px; line-height: 1.7; color: var(--text); max-width: 640px; margin: 10px 0 14px; }

.how { margin-top: 40px; }
.how h2 { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 22px; }
.steps-list { list-style: none; padding: 0; margin: 0; max-width: 680px; display: flex; flex-direction: column; gap: 16px; }
.steps-list li { display: flex; gap: 14px; font-size: 14.5px; line-height: 1.6; color: var(--muted); }
.steps-list li b { color: var(--text); font-weight: 600; }
.steps-list .n { flex: none; width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--accent-line); color: var(--accent); display: grid; place-items: center; font-size: 12px; font-weight: 600; font-family: var(--mono); }
.back { display: inline-block; margin-top: 28px; font-size: 13px; color: var(--muted); text-decoration: none; }
.back:hover { color: var(--text); }

.foot { max-width: 980px; margin: 0 auto; padding: 28px 24px 48px; color: var(--faint); font-size: 12px; font-family: var(--mono); }

@media (max-width: 720px) {
  .topbar { flex-direction: column; align-items: flex-start; gap: 4px; padding: 18px 20px; }
  .dropgrid { grid-template-columns: 1fr; }
  .ai-cols { grid-template-columns: 1fr; }
  .ai-col:first-child { border-right: none; border-bottom: 1px solid var(--border); }
  main { padding-top: 38px; }
}

/* ===== cinematic hero (film light-streaks) — additive overrides ===== */
.hero {
  position: relative; max-width: none; margin: 0 0 46px;
  padding: 40px 0 8px; isolation: isolate; overflow: visible;
}
.ebe-film {
  position: absolute; left: 50%; top: -70px; transform: translateX(-50%);
  width: 100vw; height: calc(100% + 140px); z-index: -1; pointer-events: none; opacity: 0.9;
  -webkit-mask-image: radial-gradient(115% 78% at 40% 40%, #000 26%, transparent 78%);
  mask-image: radial-gradient(115% 78% at 40% 40%, #000 26%, transparent 78%);
}
.hero-kicker {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--mono); font-size: 11px; font-weight: 500;
  letter-spacing: 0.24em; text-transform: uppercase; color: var(--accent);
}
.hero-kicker::before { content: ""; width: 22px; height: 1px; background: var(--accent); opacity: 0.6; }
.hero h1 {
  font-size: clamp(38px, 6.4vw, 76px); line-height: 1.02; font-weight: 700;
  letter-spacing: -0.035em; margin: 20px 0 20px; max-width: 15ch;
}
.hero h1 span { color: inherit; }
.hero .hero-em { color: var(--accent); }
.hero .hero-grad {
  background: linear-gradient(100deg, var(--accent), #ffe6a8 60%, var(--accent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p { font-size: clamp(15px, 1.5vw, 18px); max-width: 40em; }
/* soft vignette bloom behind hero */
.hero::after {
  content: ""; position: absolute; z-index: -2; left: 50%; top: -8%;
  width: 70vw; height: 78%; transform: translateX(-50%);
  background: radial-gradient(45% 45% at 40% 40%, rgba(233,185,73,0.10), transparent 70%);
  filter: blur(40px); pointer-events: none;
}
@media (prefers-reduced-motion: reduce) { .ebe-film { display: none; } }

/* ===== Accounts + library ===== */
.acct { display: inline-flex; align-items: center; gap: 10px; margin-left: 14px; }
.acct-email { font-size: 12.5px; color: var(--muted); max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-btn {
  font-family: var(--sans); font-size: 12.5px; font-weight: 600; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 999px;
  padding: 6px 14px; cursor: pointer; transition: border-color .15s, color .15s;
}
.acct-btn:hover { border-color: var(--accent-line); color: var(--accent); }

.library {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  background: var(--bg-soft);
}
.library.hidden { display: none; }
@media (max-width: 640px) { .library { grid-template-columns: 1fr; } }
.lib-h { font-size: 11px; font-family: var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--faint); margin-bottom: 8px; }
.lib-list { display: flex; flex-direction: column; gap: 6px; max-height: 180px; overflow-y: auto; }
.lib-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 8px 10px;
}
.lib-main { min-width: 0; display: flex; flex-direction: column; }
.lib-name { font-size: 13px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-meta { font-size: 11px; font-family: var(--mono); color: var(--faint); }
.lib-actions { display: inline-flex; align-items: center; gap: 6px; flex: none; }
.lib-use {
  font-family: var(--sans); font-size: 12px; font-weight: 600; color: var(--accent);
  background: var(--accent-dim); border: 1px solid var(--accent-line); border-radius: 8px;
  padding: 5px 12px; cursor: pointer; text-decoration: none; min-height: 28px; display: inline-flex; align-items: center;
}
.lib-use:hover { filter: brightness(1.15); }
.lib-mini {
  font-size: 13px; color: var(--muted); background: transparent; border: 1px solid var(--border);
  border-radius: 8px; width: 28px; height: 28px; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center;
}
.lib-mini:hover { color: var(--text); border-color: var(--border-strong); }

.modal {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center;
  background: rgba(0, 0, 0, 0.65); backdrop-filter: blur(4px); padding: 16px;
}
.modal.hidden { display: none; }
.modal-card {
  position: relative; width: 100%; max-width: 380px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r);
  padding: 26px 24px 22px;
}
.modal-card h2 { font-size: 20px; margin: 0 0 6px; }
.modal-sub { font-size: 13px; color: var(--muted); margin: 0 0 16px; line-height: 1.5; }
.modal-x {
  position: absolute; top: 10px; right: 12px; font-size: 20px; line-height: 1;
  color: var(--faint); background: none; border: none; cursor: pointer; padding: 6px;
}
.modal-x:hover { color: var(--text); }
.field {
  width: 100%; box-sizing: border-box; height: 44px; margin-bottom: 10px;
  background: var(--bg-soft); border: 1px solid var(--border-strong); border-radius: 10px;
  color: var(--text); font-family: var(--sans); font-size: 14px; padding: 0 13px; outline: none;
}
.field:focus { border-color: var(--accent-line); }
.field.hidden { display: none; }
.modal-go { width: 100%; justify-content: center; margin-top: 4px; }
.auth-err { min-height: 18px; font-size: 12.5px; color: #e77; margin-top: 8px; }
.auth-switch {
  display: block; width: 100%; text-align: center; margin-top: 10px;
  font-size: 12.5px; color: var(--muted); background: none; border: none; cursor: pointer;
}
.auth-switch:hover { color: var(--accent); }
