: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:
    radial-gradient(900px 500px at 88% -8%, rgba(233, 185, 73, 0.06), transparent 60%),
    radial-gradient(700px 600px at 0% 0%, rgba(255, 255, 255, 0.025), transparent 55%),
    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: 11px; }
.brand-mark {
  width: 13px; height: 13px; border-radius: 4px;
  background: linear-gradient(150deg, var(--accent), #b8862a);
  box-shadow: 0 0 18px rgba(233, 185, 73, 0.35);
}
.brand-name { font-weight: 600; font-size: 16px; letter-spacing: -0.02em; }
.brand-sub { font-size: 12.5px; color: var(--muted); font-weight: 400; }

/* ---- 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; }

.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-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; }

.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; }
}
