:root {
  --bg: #08090d; --panel: #0e1017; --panel-2: #131621; --line: #1f2230; --line-2: #2a2e40;
  --text: #e8e9f0; --muted: #8a8ea3; --faint: #5b5f74;
  --cyan: #2fd9f5; --violet: #a78bfa; --green: #4ade80; --amber: #fbbf24; --red: #f87171;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Inter", system-ui, -apple-system, Segoe UI, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 15px; line-height: 1.5; }
body { min-height: 100vh; background-image: radial-gradient(1200px 500px at 50% -10%, #17132b 0%, transparent 60%); }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
.mono { font-family: var(--mono); }
.label { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); }

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 20px 80px; }
.nav { display: flex; align-items: center; gap: 10px; padding: 18px 0; flex-wrap: wrap; }
.nav .sp { flex: 1; }
.story { font-size: 13px; color: var(--muted); }
.story:hover, .foot a:hover { color: var(--cyan); }
.foot { margin-top: 56px; padding-top: 18px; border-top: 1px solid var(--line); text-align: center; font-size: 13px; color: var(--faint); }
.foot a { color: var(--muted); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: -.01em; }
.brand .dot { width: 18px; height: 18px; border-radius: 50%; background: conic-gradient(from 200deg, var(--cyan), var(--violet), var(--cyan)); box-shadow: 0 0 18px #2fd9f555; }
.tag { font-family: var(--mono); font-size: 11px; color: var(--muted); border: 1px solid var(--line-2); padding: 2px 8px; border-radius: 99px; }

.hero { padding: 56px 0 28px; }
.hero h1 { font-size: clamp(30px, 5vw, 46px); line-height: 1.1; letter-spacing: -.03em; margin: 0 0 14px; font-weight: 600; max-width: 14em; }
.hero h1 span { background: linear-gradient(90deg, var(--cyan), var(--violet)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { color: var(--muted); max-width: 40em; margin: 0 0 26px; font-size: 16px; }

.urlbar { display: flex; gap: 10px; max-width: 640px; }
.urlbar input { flex: 1; min-width: 0; background: var(--panel); border: 1px solid var(--line-2); border-radius: 10px; color: var(--text); padding: 13px 14px; font: inherit; outline: none; }
.urlbar input:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px #2fd9f522; }
.err { color: var(--red); font-size: 13px; min-height: 20px; margin-top: 8px; }

.btn { border: 1px solid var(--line-2); background: var(--panel-2); border-radius: 10px; padding: 11px 16px; font-weight: 500; transition: .15s; white-space: nowrap; }
.btn:hover { border-color: var(--faint); }
.btn.primary { background: var(--cyan); color: #04141a; border-color: var(--cyan); font-weight: 600; }
.btn.primary:hover { box-shadow: 0 0 22px #2fd9f566; }
.btn.danger { background: #2a1416; border-color: #5b2227; color: #fca5a5; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.section { margin-top: 34px; }
.section h2 { margin: 0 0 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line-2); background: var(--panel); border-radius: 99px; padding: 7px 14px; }
.chip:hover { border-color: var(--cyan); }
.chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--line-2); }
.chip i.on { background: var(--green); box-shadow: 0 0 8px #4ade8099; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: block; transition: .15s; }
a.card:hover { border-color: var(--line-2); transform: translateY(-1px); }
.card h3 { margin: 0 0 2px; font-size: 16px; }
.card p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.meta { font-family: var(--mono); font-size: 12px; color: var(--faint); }
.badge { font-family: var(--mono); font-size: 11px; padding: 2px 8px; border-radius: 99px; border: 1px solid var(--line-2); color: var(--muted); }
.badge.warn { color: var(--amber); border-color: #5b4513; }
.badge.ok { color: var(--green); border-color: #1d4a2e; }

.back { color: var(--muted); font-size: 14px; display: inline-block; margin: 8px 0 18px; }
.back:hover { color: var(--text); }
.title { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.title h1 { margin: 0; font-size: 30px; letter-spacing: -.02em; }
.title p { margin: 4px 0 0; color: var(--muted); max-width: 40em; }
.cta-card { margin-top: 22px; display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap;
  background: linear-gradient(120deg, #0e2a33, #1a1536); border: 1px solid #25405a; border-radius: 14px; padding: 18px 20px; }
.cta-card .note { color: var(--muted); font-size: 14px; }
.cta-row { display: flex; gap: 10px; flex-wrap: wrap; }

.stepper { display: flex; gap: 6px; margin: 22px 0 14px; flex-wrap: wrap; }
.step { flex: 1; min-width: 110px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--faint); font-size: 13px; }
.step.active { border-color: var(--cyan); color: var(--text); box-shadow: 0 0 0 3px #2fd9f518; }
.step.done { color: var(--muted); border-color: #1d4a2e; }
.step .label { display: block; margin-bottom: 2px; }
.two { display: grid; grid-template-columns: 1.1fr 1fr; gap: 14px; }
@media (max-width: 820px) { .two { grid-template-columns: 1fr; } }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.panel .label { margin-bottom: 10px; }
.log { max-height: 420px; overflow-y: auto; font-size: 13.5px; display: flex; flex-direction: column; gap: 6px; }
.log div { color: var(--muted); animation: fade .3s; }
.log div.hot { color: var(--text); }
.log div.bad { color: var(--red); }
.log time { font-family: var(--mono); font-size: 11px; color: var(--faint); margin-right: 8px; }
.pages { display: flex; flex-direction: column; gap: 2px; max-height: 460px; overflow-y: auto; }
.page { display: grid; grid-template-columns: 20px 1fr auto; gap: 10px; align-items: center; padding: 8px 4px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.page:last-child { border: 0; }
.page .u { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page .u small { display: block; color: var(--faint); font-family: var(--mono); font-size: 11px; overflow: hidden; text-overflow: ellipsis; }
.page .cat { font-family: var(--mono); font-size: 11px; color: var(--violet); }
.st { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-2); }
.st.reading { border-color: var(--cyan) transparent var(--cyan) transparent; animation: spin .8s linear infinite; }
.st.done { background: var(--green); border-color: var(--green); }
.st.failed, .st.skipped { background: var(--red); border-color: var(--red); }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade { from { opacity: 0; transform: translateY(3px); } }

/* ---------- console (talk page) ---------- */
.console { height: 100vh; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 14px; padding: 12px 20px; border-bottom: 1px solid var(--line); background: #0a0b10cc; backdrop-filter: blur(8px); }
.topbar .who { font-weight: 600; font-size: 17px; }
.topbar .sp { flex: 1; }
.pill { display: inline-flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.pill i { width: 8px; height: 8px; border-radius: 2px; background: var(--faint); }
.pill.listening i { background: var(--cyan); }
.pill.thinking i { background: var(--amber); }
.pill.speaking i { background: var(--violet); }
.pill.live i { background: var(--green); }
.cgrid { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 340px; gap: 16px; padding: 16px 20px 20px; }
@media (max-width: 900px) { .cgrid { grid-template-columns: 1fr; overflow-y: auto; } .console { height: auto; min-height: 100vh; } }
.left { min-height: 0; display: flex; flex-direction: column; gap: 12px; }
.viz { position: relative; height: 210px; flex: none; border: 1px solid var(--line); border-radius: 14px; background: radial-gradient(400px 160px at 50% 50%, #12102a, var(--panel)); overflow: hidden; }
.viz canvas { width: 100%; height: 100%; display: block; }
.viz .legend { position: absolute; left: 14px; bottom: 10px; display: flex; gap: 14px; }
.viz .legend span { display: inline-flex; align-items: center; gap: 6px; }
.viz .legend i { width: 8px; height: 8px; border-radius: 50%; }
.transcript { flex: 1; min-height: 0; overflow-y: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); padding: 18px 22px; display: flex; flex-direction: column; gap: 14px; }
.empty { margin: auto; text-align: center; color: var(--faint); max-width: 24em; }
.msg { max-width: 80%; animation: fade .25s; }
.msg.you { align-self: flex-end; background: #1b1f2d; border-radius: 18px; padding: 9px 16px; }
.msg.agent .who { color: var(--violet); font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; margin-bottom: 2px; }
.msg.interim { opacity: .6; }
.composer { flex: none; display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); padding: 10px; }
.composer input { flex: 1; background: transparent; border: 0; color: var(--text); font: inherit; padding: 6px 8px; }
.composer input:disabled { cursor: not-allowed; }
.icon-btn { border: 1px solid var(--line-2); background: var(--panel-2); border-radius: 9px; padding: 7px 12px; font-size: 13px; }
.icon-btn.off { color: var(--red); border-color: #5b2227; }
.right { min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; padding-right: 2px; }
.rp { border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.rp:last-child { border: 0; }
.rp .label { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.rp .label::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; font-size: 13px; }
.kv span:first-child { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); align-self: center; }
.kv span:last-child { font-family: var(--mono); text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.big { font-family: var(--mono); font-size: 22px; color: var(--cyan); }
.big small { font-size: 12px; color: var(--faint); margin-left: 3px; }
.spark { width: 100%; height: 36px; display: block; margin-top: 6px; }
.hl { display: flex; flex-direction: column; gap: 8px; }
.hl div { font-size: 13px; border-left: 2px solid var(--line-2); padding-left: 10px; animation: fade .3s; }
.hl div b { display: block; font-weight: 500; }
.hl div span { color: var(--muted); }
.hl .tool { border-color: var(--cyan); } .hl .lead { border-color: var(--green); }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: #2a1416; border: 1px solid #5b2227; color: #fecaca; padding: 10px 16px; border-radius: 10px; opacity: 0; pointer-events: none; transition: .25s; max-width: 90vw; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

.voicebar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; flex: none; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; background: var(--panel); }
.seg button { border: 0; background: transparent; padding: 7px 14px; font-size: 13px; color: var(--muted); border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: #12303a; color: var(--cyan); }
.seg button:disabled { opacity: .45; cursor: not-allowed; }
.seg button em { font-style: normal; font-family: var(--mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--amber); margin-left: 4px; }
.vhint { color: var(--faint); font-size: 12.5px; flex: 1; min-width: 160px; }
.snip { display: flex; gap: 10px; align-items: center; background: #07080c; border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 12px; }
.snip code { flex: 1; font-family: var(--mono); font-size: 12.5px; color: #b9f1fb; overflow-x: auto; white-space: nowrap; }
.embed-panel code { font-family: var(--mono); }

/* compact widget mode (inside the iframe opened by embed.js) */
body.embed { background: var(--bg); background-image: none; }
.embed .console { height: 100vh; }
.embed .topbar { padding: 10px 46px 10px 14px; gap: 10px; }
.embed .topbar .who .meta { display: none; }
.embed .topbar .who { font-size: 15px; }
.embed .cgrid { grid-template-columns: 1fr; padding: 10px 12px 12px; }
.embed .right { display: none; }
.embed .viz { height: 140px; }
.embed .composer input { font-size: 13px; }

/* build progress: make "working" visible */
#result:not(:empty) { margin-bottom: 16px; }
.step { position: relative; overflow: hidden; }
.step .tm { position: absolute; right: 12px; top: 10px; font-style: normal; font-family: var(--mono); font-size: 11px; color: var(--cyan); }
.step.active { animation: pulse 1.6s ease-in-out infinite; }
.step.active::after { content: ""; position: absolute; left: 0; bottom: 0; height: 2px; width: 40%; background: linear-gradient(90deg, transparent, var(--cyan), transparent); animation: slide 1.4s linear infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 #2fd9f544; } 50% { box-shadow: 0 0 0 4px #2fd9f511, 0 0 18px #2fd9f533; } }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
.log .live { display: flex; align-items: center; gap: 10px; color: var(--cyan); font-size: 13.5px; padding-top: 4px; }
.log .live[hidden] { display: none; }
.spin { flex: none; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--cyan); border-color: var(--cyan) transparent var(--cyan) transparent; animation: spin .8s linear infinite; }
.evbox { display: inline-flex; gap: 8px; align-items: center; }
.evbox[hidden] { display: none; }
.evbox select { background: var(--panel); color: var(--text); border: 1px solid var(--line-2); border-radius: 9px; padding: 6px 10px; font: inherit; font-size: 13px; max-width: 240px; }
.evbox select:disabled { opacity: .5; }
.st.waiting { border-color: var(--amber) transparent var(--amber) transparent; animation: spin 1.6s linear infinite; }
