/*
 * Hero workspace — interactive product demo
 *
 * Sections: 1 tokens · 2 resets & shared controls · 3 title bar · 4 layout · 5 sidebar · 6 conversation
 * 7 turn · 8 composer · 9 workspace panel · 10 documents · 11 dialog · 12 responsive · 13 motion.
 * Class names are the contract with js/hero-demo.js and js/hero-demo/view.js.
 * Loading, step-ring and streaming primitives come from Beautiful UI (MIT), see js/beautiful-ui.js.
 */

/* ---------- 1. Tokens ---------- */
.product-demo {
  --pd-canvas: var(--token-5e2a9781-f258-43f3-ae02-0a76276a5519, #111);
  --pd-panel-bg: #0d0d0d;
  --pd-surface: var(--token-5e0b3b72-9a97-43f8-96f2-85d741f3d8ca, #1a1a1a);
  --pd-surface-2: #202020;
  --pd-surface-3: #2a2a2a;
  --pd-line: var(--token-000292f1-e507-4938-9285-b0287d36c378, #ffffff12);
  --pd-line-strong: var(--token-c534b380-e14e-4ddc-9802-ad88d1f94f8e, #ffffff1a);
  --pd-line-hover: rgba(255, 255, 255, .28);
  --pd-ink: var(--token-26e3cb56-8447-4a64-9b7d-37f16a9909d4, #fff);
  --pd-ink-2: var(--token-8f5eb515-7a13-452b-a4ab-f35e2208a3f3, #fff9);
  --pd-ink-3: var(--token-f5637926-8ee6-41cb-a320-ec3462d62cd5, #fff6);
  --pd-ink-4: rgba(255, 255, 255, .3);
  --pd-blue: var(--token-bd71055c-0a2c-4476-8cc9-4310acba652d, #09f);
  --pd-blue-ink: #7fcbff;
  --pd-blue-soft: rgba(0, 153, 255, .12);
  --pd-blue-line: rgba(0, 153, 255, .36);
  --pd-green: #4ade80;
  --pd-green-soft: rgba(74, 222, 128, .14);
  --pd-amber: #ffc857;
  --pd-red: #ff7b7b;
  --pd-red-soft: rgba(255, 107, 107, .1);
  --pd-red-line: rgba(255, 107, 107, .28);
  --pd-radius: 20px;
  --pd-radius-md: 12px;
  --pd-radius-sm: 8px;
  --pd-dur: .18s;
  --pd-dur-slow: .32s;
  --pd-ease: cubic-bezier(.22, 1, .36, 1);
  --pd-font: "Inter Variable", Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Noto Sans SC", sans-serif;
  --pd-mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --pd-titlebar: 48px;
  --pd-sidebar: 220px;
  --pd-side-panel: 320px;
  --pd-gutter: clamp(18px, 3vw, 36px);

  position: relative;
  display: flex;
  width: 100%;
  max-width: 1200px;
  height: 680px;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  isolation: isolate;
  border: 1px solid var(--pd-line-strong);
  border-radius: var(--pd-radius);
  background: var(--pd-canvas);
  color: var(--pd-ink);
  font: 400 13px/1.5 var(--pd-font);
  letter-spacing: -.005em;
  text-align: left;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05), 0 30px 90px -20px rgba(0, 0, 0, .85), 0 0 0 1px rgba(0, 0, 0, .6);
  -webkit-font-smoothing: antialiased;
}

/* ---------- 2. Resets & shared controls ---------- */
/* :where() keeps resets at zero class specificity so every single-class component rule wins. */
.product-demo *, .product-demo *::before, .product-demo *::after { box-sizing: border-box; }
.product-demo [hidden] { display: none !important; }
:where(.product-demo) :where(p, h1, h2, h3, ul, ol) { margin: 0; }
:where(.product-demo) :where(ul, ol) { padding: 0; list-style: none; }
:where(.product-demo) :where(button, select, textarea) { font: inherit; letter-spacing: inherit; color: inherit; }
:where(.product-demo) button { appearance: none; margin: 0; border: 0; background: none; cursor: pointer; }
:where(.product-demo) button:disabled { cursor: default; }
.product-demo :is(button, select, [tabindex], summary):focus-visible { outline: 2px solid var(--pd-blue); outline-offset: 2px; }
.product-demo textarea:focus, .product-demo textarea:focus-visible { outline: 0; }
.product-demo svg { display: block; }
.pd-icon { width: 18px; height: 18px; flex: 0 0 18px; }
.pd-sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
.pd-eyebrow { color: var(--pd-ink-3); font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
.product-demo ::-webkit-scrollbar { width: 8px; height: 8px; }
.product-demo ::-webkit-scrollbar-track { background: transparent; }
.product-demo ::-webkit-scrollbar-thumb { border: 2px solid transparent; border-radius: 99px; background: rgba(255, 255, 255, .14); background-clip: padding-box; }
.product-demo ::-webkit-scrollbar-thumb:hover { background-color: rgba(255, 255, 255, .24); }

.pd-pause, .pd-icon-btn, .pd-mobile-new, .pd-mobile-preset, .pd-suggestions button {
  border: 1px solid var(--pd-line-strong); border-radius: var(--pd-radius-sm); background: transparent; color: var(--pd-ink-2);
  transition: background var(--pd-dur), border-color var(--pd-dur), color var(--pd-dur);
}
.pd-pause:hover, .pd-icon-btn:hover, .pd-mobile-new:hover, .pd-mobile-preset:hover, .pd-suggestions button:hover:not(:disabled) {
  border-color: var(--pd-line-hover); background: rgba(255, 255, 255, .06); color: var(--pd-ink);
}
.pd-icon-btn { display: grid; width: 28px; height: 28px; flex: 0 0 28px; place-items: center; color: var(--pd-ink-3); }
.pd-icon-btn .pd-icon { width: 14px; height: 14px; }
.pd-primary { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 12px; border-radius: var(--pd-radius-sm); background: var(--pd-ink); color: #000; font-size: 12px; font-weight: 500; transition: background var(--pd-dur), transform var(--pd-dur); }
.pd-primary .pd-icon { width: 13px; height: 13px; }
.pd-primary:hover { background: rgba(255, 255, 255, .85); }
.pd-primary:active { transform: scale(.97); }

/* ---------- 3. Title bar ---------- */
.pd-titlebar { position: relative; display: flex; align-items: center; gap: 12px; height: var(--pd-titlebar); flex: 0 0 var(--pd-titlebar); padding: 0 12px 0 16px; border-bottom: 1px solid var(--pd-line); background: linear-gradient(rgba(255, 255, 255, .03), rgba(255, 255, 255, .01)); }
.pd-lights { display: flex; gap: 7px; }
.pd-lights i { width: 11px; height: 11px; border-radius: 50%; background: var(--pd-surface-3); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06); }
.pd-brand { display: inline-flex; align-items: center; gap: 8px; margin-left: 4px; font-size: 13px; font-weight: 600; letter-spacing: -.02em; }
.pd-brand-mark { display: grid; width: 20px; height: 20px; place-items: center; }
.pd-brand-mark svg { width: 18px; height: 14px; }
.pd-window-title { position: absolute; left: 50%; display: inline-flex; align-items: center; gap: 8px; color: var(--pd-ink-3); font-size: 12px; font-weight: 500; white-space: nowrap; transform: translateX(-50%); pointer-events: none; }
.pd-demo-badge { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border: 1px solid var(--pd-line); border-radius: 999px; color: var(--pd-ink-4); font-size: 10.5px; font-weight: 500; letter-spacing: .01em; }
.pd-top-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.pd-state { display: inline-flex; align-items: center; gap: 8px; height: 28px; padding: 0 11px 0 9px; border: 1px solid var(--pd-line); border-radius: 999px; background: rgba(255, 255, 255, .03); color: var(--pd-ink-2); font-size: 11.5px; font-weight: 500; white-space: nowrap; transition: border-color var(--pd-dur-slow), color var(--pd-dur-slow), background var(--pd-dur-slow); }
.pd-state::before { width: 6px; height: 6px; flex: 0 0 6px; border-radius: 50%; background: var(--pd-ink-4); content: ""; transition: background var(--pd-dur-slow); }
.pd-state[data-state="thinking"], .pd-state[data-state="working"], .pd-state[data-state="writing"] { border-color: var(--pd-blue-line); background: var(--pd-blue-soft); color: var(--pd-blue-ink); }
.pd-state[data-state="thinking"]::before, .pd-state[data-state="working"]::before, .pd-state[data-state="writing"]::before { background: var(--pd-blue); animation: pd-pulse 1.6s var(--pd-ease) infinite; }
.pd-state[data-state="paused"] { border-color: rgba(255, 200, 87, .3); background: rgba(255, 200, 87, .08); color: #ffd98a; }
.pd-state[data-state="paused"]::before { background: var(--pd-amber); }
.pd-state[data-state="done"] { border-color: rgba(74, 222, 128, .28); background: var(--pd-green-soft); color: #9ae6b4; }
.pd-state[data-state="done"]::before { background: var(--pd-green); }
.pd-state[data-state="error"], .pd-state[data-state="stopped"] { border-color: var(--pd-red-line); background: var(--pd-red-soft); color: var(--pd-red); }
.pd-state[data-state="error"]::before, .pd-state[data-state="stopped"]::before { background: var(--pd-red); }
.pd-pause { min-width: 64px; height: 28px; padding: 0 11px; font-size: 11.5px; font-weight: 500; }
.pd-reset .pd-icon { transition: transform .5s var(--pd-ease); }
.pd-reset:hover .pd-icon { transform: rotate(-120deg); }
.pd-panel-toggle { display: none; }

/* ---------- 4. Layout ---------- */
.pd-body { position: relative; display: grid; min-height: 0; flex: 1; grid-template-columns: var(--pd-sidebar) minmax(0, 1fr) var(--pd-side-panel); }
.pd-scrim { position: absolute; inset: 0; z-index: 4; background: rgba(0, 0, 0, .5); animation: pd-fade var(--pd-dur-slow) both; }

/* ---------- 5. Sidebar ---------- */
.pd-sidebar { display: flex; min-height: 0; flex-direction: column; gap: 4px; padding: 14px 12px 12px; border-right: 1px solid var(--pd-line); background: var(--pd-panel-bg); }
.pd-new-chat { display: flex; width: 100%; align-items: center; gap: 9px; height: 36px; padding: 0 11px; border: 1px solid var(--pd-line-strong); border-radius: 10px; background: var(--pd-surface); color: var(--pd-ink); font-size: 12.5px; font-weight: 500; transition: background var(--pd-dur), border-color var(--pd-dur), transform var(--pd-dur); }
.pd-new-chat:hover { border-color: var(--pd-line-hover); background: var(--pd-surface-2); }
.pd-new-chat:active { transform: scale(.985); }
.pd-new-chat[aria-pressed="true"] { border-color: var(--pd-blue-line); background: var(--pd-blue-soft); }
.pd-new-chat .pd-icon { width: 14px; height: 14px; color: var(--pd-ink-2); }
.pd-sidebar-label { margin: 18px 10px 6px; color: var(--pd-ink-3); font-size: 10.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
.pd-tasks { display: flex; flex-direction: column; gap: 2px; }
.pd-task { display: flex; width: 100%; align-items: flex-start; gap: 10px; padding: 9px 10px; border-radius: 10px; color: var(--pd-ink-2); text-align: left; transition: background var(--pd-dur), color var(--pd-dur); }
.pd-task:hover { background: rgba(255, 255, 255, .04); color: var(--pd-ink); }
.pd-task[aria-pressed="true"] { background: var(--pd-surface); color: var(--pd-ink); }
.pd-task > .pd-icon { width: 16px; height: 16px; flex-basis: 16px; margin-top: 1px; color: var(--pd-ink-3); transition: color var(--pd-dur); }
.pd-task[aria-pressed="true"] > .pd-icon { color: var(--pd-blue-ink); }
.pd-task-copy { display: flex; min-width: 0; flex: 1; flex-direction: column; gap: 3px; }
.pd-task-copy strong { overflow: hidden; font-size: 12.5px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.pd-task-copy small { overflow: hidden; color: var(--pd-ink-3); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.pd-sidebar-note { display: flex; flex-direction: column; gap: 5px; margin-top: auto; padding: 14px 10px 4px; border-top: 1px solid var(--pd-line); }
.pd-sidebar-note strong { display: flex; align-items: center; gap: 8px; color: var(--pd-ink-2); font-size: 11.5px; font-weight: 500; }
.pd-sidebar-note p { color: var(--pd-ink-3); font-size: 11px; line-height: 1.5; }
.pd-workspace-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--pd-green); box-shadow: 0 0 0 3px var(--pd-green-soft); }

/* ---------- 6. Conversation column ---------- */
.pd-main { position: relative; display: flex; min-width: 0; min-height: 0; flex-direction: column; }
.pd-mobile-presets { display: none; gap: 6px; overflow-x: auto; padding: 10px 14px 4px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.pd-mobile-presets::-webkit-scrollbar { display: none; }
.pd-mobile-new, .pd-mobile-preset { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 999px; font-size: 11.5px; font-weight: 500; white-space: nowrap; }
.pd-mobile-new .pd-icon { width: 13px; height: 13px; }
.pd-mobile-preset[aria-pressed="true"] { border-color: var(--pd-blue-line); background: var(--pd-blue-soft); color: var(--pd-ink); }
.pd-thread { display: flex; min-height: 0; flex: 1; flex-direction: column; gap: 22px; overflow-y: auto; padding: 26px var(--pd-gutter) 20px; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .14) transparent; }
.pd-jump { position: absolute; right: 50%; bottom: 150px; z-index: 3; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border: 1px solid var(--pd-line-strong); border-radius: 999px; background: var(--pd-surface-2); color: var(--pd-ink-2); font-size: 11.5px; font-weight: 500; box-shadow: 0 8px 24px rgba(0, 0, 0, .35); transform: translateX(50%); transition: background var(--pd-dur), color var(--pd-dur), border-color var(--pd-dur); animation: pd-fade-up var(--pd-dur-slow) var(--pd-ease) both; }
.pd-jump::before { width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; content: ""; transform: translateY(-2px) rotate(45deg); }
.pd-jump:hover { border-color: var(--pd-line-hover); background: var(--pd-surface-3); color: var(--pd-ink); }

/* welcome */
.pd-welcome { width: 100%; max-width: 720px; margin: auto; padding: 8px 0 12px; animation: pd-fade-up var(--pd-dur-slow) var(--pd-ease) both; }
.pd-welcome h2 { margin-top: 12px; color: var(--pd-ink); font-size: clamp(24px, 2.6vw, 30px); font-weight: 500; letter-spacing: -.035em; line-height: 1.15; }
.pd-welcome > p { max-width: 520px; margin-top: 10px; color: var(--pd-ink-2); font-size: 13.5px; }
.pd-preset-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 26px; }
.pd-preset-card { position: relative; display: flex; min-height: 136px; flex-direction: column; align-items: flex-start; gap: 14px; padding: 15px; border: 1px solid var(--pd-line); border-radius: 14px; background: var(--pd-surface); color: var(--pd-ink); text-align: left; overflow: hidden; transition: border-color var(--pd-dur), background var(--pd-dur), transform var(--pd-dur-slow) var(--pd-ease); }
.pd-preset-card::after { position: absolute; inset: 0; background: radial-gradient(120% 80% at 0% 0%, var(--pd-blue-soft), transparent 60%); content: ""; opacity: 0; transition: opacity var(--pd-dur-slow); pointer-events: none; }
.pd-preset-card:hover { border-color: var(--pd-line-hover); background: var(--pd-surface-2); transform: translateY(-2px); }
.pd-preset-card:hover::after { opacity: 1; }
.pd-preset-card:active { transform: translateY(0); }
.pd-preset-card > .pd-icon { width: 32px; height: 32px; flex-basis: 32px; padding: 7px; border: 1px solid var(--pd-line); border-radius: 9px; background: rgba(255, 255, 255, .04); color: var(--pd-blue-ink); }
.pd-preset-card > span:not(.pd-icon):not(.pd-card-arrow) { display: flex; min-width: 0; flex-direction: column; gap: 5px; }
.pd-preset-card strong { font-size: 13px; font-weight: 500; letter-spacing: -.01em; }
.pd-preset-card small { color: var(--pd-ink-3); font-size: 11.5px; line-height: 1.45; }
.pd-card-arrow { position: absolute; top: 14px; right: 14px; display: grid; width: 24px; height: 24px; place-items: center; border-radius: 50%; background: var(--pd-surface-3); color: var(--pd-ink-2); opacity: 0; transform: translate(-4px, 4px); transition: opacity var(--pd-dur), transform var(--pd-dur-slow) var(--pd-ease); }
.pd-card-arrow .pd-icon { width: 13px; height: 13px; }
.pd-preset-card:hover .pd-card-arrow, .pd-preset-card:focus-visible .pd-card-arrow { opacity: 1; transform: none; }

/* ---------- 7. Turn ---------- */
.pd-turn { display: flex; flex: 0 0 auto; flex-direction: column; gap: 16px; animation: pd-fade-up var(--pd-dur-slow) var(--pd-ease) both; }
.pd-user { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.pd-message-label { padding-right: 4px; color: var(--pd-ink-3); font-size: 11px; }
.pd-message-text { max-width: min(82%, 560px); padding: 10px 14px; border: 1px solid var(--pd-line); border-radius: 16px 16px 6px 16px; background: var(--pd-surface-2); color: var(--pd-ink); font-size: 13px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.pd-assistant { display: flex; min-width: 0; flex-direction: column; gap: 12px; }
.pd-assistant-label { display: flex; align-items: center; gap: 9px; color: var(--pd-ink); font-size: 12px; font-weight: 500; }
/* avatar: SVG spark tile by default; once the Murmur orb is live the canvas takes over and the tile fades out */
.pd-avatar { position: relative; display: grid; width: 28px; height: 28px; place-items: center; border-radius: 50%; background: linear-gradient(150deg, #1fa8ff, #0072c4); color: #fff; box-shadow: 0 0 0 1px rgba(0, 153, 255, .3), 0 4px 12px rgba(0, 153, 255, .25); transition: background var(--pd-dur-slow), box-shadow var(--pd-dur-slow); }
.pd-avatar .pd-icon { width: 13px; height: 13px; transition: opacity var(--pd-dur-slow); }
.pd-orb { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 50%; opacity: 0; transition: opacity var(--pd-dur-slow); }
.pd-avatar.is-live { background: #111; box-shadow: 0 0 0 1px rgba(255, 255, 255, .08), 0 4px 14px rgba(0, 153, 255, .3); }
.pd-avatar.is-live .pd-icon { opacity: 0; }
.pd-avatar.is-live .pd-orb { opacity: 1; }
.pd-assistant-label small { padding: 2px 7px; border: 1px solid var(--pd-line); border-radius: 999px; color: var(--pd-ink-3); font-size: 10.5px; font-weight: 400; }
.pd-thinking { display: inline-flex; align-items: center; gap: 10px; min-height: 26px; color: var(--pd-ink-2); font-size: 12.5px; }
.pd-thinking > span:last-child { background: linear-gradient(90deg, var(--pd-ink-3) 0%, var(--pd-ink) 50%, var(--pd-ink-3) 100%); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; animation: pd-shimmer 1.8s linear infinite; }
.bui-loading-grid { display: grid; width: 18px; height: 18px; grid-template-columns: repeat(3, 4px); grid-template-rows: repeat(3, 4px); gap: 3px; }
.bui-loading-cell { width: 4px; height: 4px; border-radius: 1.5px; background: var(--pd-blue); opacity: .28; animation: bui-cell-wave 700ms ease-in-out infinite; animation-delay: var(--bui-delay); }
@keyframes bui-cell-wave { 0%, 100% { opacity: .22; transform: scale(.7); } 45% { opacity: 1; transform: scale(1); } }

/* plan card */
.pd-plan { width: min(100%, 600px); border: 1px solid var(--pd-line); border-radius: var(--pd-radius-md); background: var(--pd-surface); overflow: hidden; }
.pd-plan summary { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 0 14px; cursor: pointer; list-style: none; color: var(--pd-ink); font-size: 12.5px; font-weight: 500; user-select: none; transition: background var(--pd-dur); }
.pd-plan summary:hover { background: rgba(255, 255, 255, .03); }
.pd-plan summary::-webkit-details-marker { display: none; }
.pd-plan summary::before { width: 6px; height: 6px; flex: 0 0 6px; margin-left: 2px; border-right: 1.5px solid var(--pd-ink-3); border-bottom: 1.5px solid var(--pd-ink-3); transform: rotate(-45deg); content: ""; transition: transform var(--pd-dur-slow) var(--pd-ease); }
.pd-plan[open] summary::before { transform: rotate(45deg) translate(-1px, -1px); }
.pd-plan-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd-plan summary small { color: var(--pd-ink-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.pd-progress-meter { height: 2px; margin: 0 14px; overflow: hidden; border-radius: 9px; background: rgba(255, 255, 255, .08); }
.pd-progress-meter span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--pd-blue); transition: width .45s var(--pd-ease); }
.pd-steps { display: flex; flex-direction: column; padding: 12px 14px; }
.pd-step { position: relative; display: flex; align-items: flex-start; gap: 12px; padding: 7px 8px; border-radius: var(--pd-radius-sm); color: var(--pd-ink-3); transition: background var(--pd-dur-slow), color var(--pd-dur-slow); }
.pd-step + .pd-step::before { position: absolute; top: -8px; left: 19px; width: 1px; height: 14px; background: var(--pd-line-strong); content: ""; }
.pd-step[data-state="running"] { background: var(--pd-blue-soft); color: var(--pd-ink); }
.pd-step[data-state="done"] { color: var(--pd-ink-2); }
.pd-step[data-state="done"] + .pd-step::before { background: rgba(74, 222, 128, .35); }
.pd-step-copy { display: flex; min-width: 0; flex: 1; flex-direction: column; gap: 2px; padding-top: 3px; }
.pd-step-copy strong { font-size: 12.5px; font-weight: 500; }
.pd-step[data-state="done"] .pd-step-copy strong { color: var(--pd-ink); }
.pd-step-copy small { color: var(--pd-ink-3); font-size: 11px; line-height: 1.45; }
.pd-step[data-state="running"] .pd-step-copy small { color: var(--pd-blue-ink); }
.pd-step-tool { display: grid; width: 24px; height: 24px; flex: 0 0 24px; place-items: center; border-radius: 6px; color: var(--pd-ink-4); }
.pd-step-tool .pd-icon { width: 13px; height: 13px; }
.pd-step[data-state="running"] .pd-step-tool { background: rgba(255, 255, 255, .06); color: var(--pd-blue-ink); }
.bui-step-indicator { position: relative; display: grid; width: 24px; height: 24px; flex: 0 0 24px; place-items: center; color: var(--pd-ink-3); transition: background var(--pd-dur-slow), color var(--pd-dur-slow); }
.bui-step-ring { position: absolute; inset: 0; width: 24px; height: 24px; transform: rotate(-90deg); }
.bui-step-track, .bui-step-progress { fill: none; stroke-width: 1.6; }
.bui-step-track { stroke: rgba(255, 255, 255, .14); }
.bui-step-progress { stroke: var(--pd-blue); stroke-linecap: round; stroke-dasharray: 16 57; opacity: 0; }
.pd-step[data-state="running"] .bui-step-indicator { color: var(--pd-blue-ink); }
.pd-step[data-state="running"] .bui-step-progress { opacity: 1; animation: bui-ring-spin 900ms linear infinite; }
.pd-step[data-state="done"] .bui-step-indicator { border-radius: 50%; background: var(--pd-green-soft); color: var(--pd-green); animation: pd-pop var(--pd-dur-slow) var(--pd-ease) both; }
.bui-step-number { position: relative; z-index: 1; font-size: 10.5px; font-weight: 500; font-variant-numeric: tabular-nums; }
.bui-step-check { width: 14px; height: 14px; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2.2; }
@keyframes bui-ring-spin { to { transform: rotate(360deg); } }

/* response */
.pd-response { max-width: 640px; color: var(--pd-ink); font-size: 13.5px; line-height: 1.7; animation: pd-fade-up var(--pd-dur-slow) var(--pd-ease) both; }
.pd-response-body { display: inline; color: inherit; font-size: inherit; line-height: inherit; }
.pd-response-body > * { display: inline; }
.pd-stream-cursor { display: inline-block; width: 2px; height: 1.05em; margin-left: 2px; vertical-align: -.15em; border-radius: 2px; background: var(--pd-blue); animation: pd-cursor 900ms step-end infinite; }
@keyframes pd-cursor { 50% { opacity: 0; } }
.pd-stopped-note { max-width: 600px; padding: 10px 12px; border: 1px solid var(--pd-red-line); border-radius: var(--pd-radius-sm); background: var(--pd-red-soft); color: var(--pd-red); font-size: 12px; line-height: 1.5; }
.pd-artifacts { display: flex; flex-wrap: wrap; gap: 8px; }
.pd-artifact { display: flex; min-width: min(280px, 100%); align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--pd-line-strong); border-radius: 10px; background: var(--pd-surface); color: var(--pd-ink-2); text-align: left; transition: border-color var(--pd-dur), background var(--pd-dur), transform var(--pd-dur-slow) var(--pd-ease); animation: pd-fade-up var(--pd-dur-slow) var(--pd-ease) both; }
.pd-artifact:hover { border-color: var(--pd-line-hover); background: var(--pd-surface-2); transform: translateY(-1px); }
.pd-artifact > .pd-icon { width: 30px; height: 30px; flex-basis: 30px; padding: 7px; border-radius: 8px; background: var(--pd-blue-soft); color: var(--pd-blue-ink); }
.pd-artifact > span:not(.pd-icon):not(.pd-artifact-arrow) { display: flex; min-width: 0; flex: 1; flex-direction: column; gap: 2px; }
.pd-artifact strong { overflow: hidden; color: var(--pd-ink); font-size: 12.5px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.pd-artifact small { overflow: hidden; color: var(--pd-ink-3); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.pd-artifact-arrow { display: block; flex: 0 0 auto; color: var(--pd-ink-3); transition: transform var(--pd-dur-slow) var(--pd-ease), color var(--pd-dur); }
.pd-artifact-arrow .pd-icon { width: 14px; height: 14px; }
.pd-artifact:hover .pd-artifact-arrow { color: var(--pd-ink); transform: translateX(2px); }
.pd-message-actions, .pd-suggestions { display: flex; flex-wrap: wrap; gap: 6px; }
.pd-message-actions button { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 9px; border: 1px solid transparent; border-radius: var(--pd-radius-sm); color: var(--pd-ink-3); font-size: 11.5px; font-weight: 500; transition: background var(--pd-dur), border-color var(--pd-dur), color var(--pd-dur); }
.pd-message-actions button:hover:not(:disabled) { border-color: var(--pd-line); background: rgba(255, 255, 255, .05); color: var(--pd-ink); }
.pd-message-actions button:disabled, .pd-suggestions button:disabled { opacity: .5; }
.pd-message-actions .pd-icon { width: 13px; height: 13px; }
.pd-suggestions button { height: 30px; padding: 0 12px; border-radius: 999px; font-size: 11.5px; font-weight: 500; }

/* ---------- 8. Composer ---------- */
.pd-composer-wrap { position: relative; flex: 0 0 auto; padding: 6px var(--pd-gutter) 12px; }
.pd-composer-wrap::before { position: absolute; inset: -26px 0 auto; height: 26px; background: linear-gradient(transparent, var(--pd-canvas)); content: ""; pointer-events: none; }
.pd-composer { display: flex; flex-direction: column; gap: 8px; padding: 12px 12px 10px; border: 1px solid var(--pd-line-strong); border-radius: 16px; background: var(--pd-surface); box-shadow: 0 12px 40px -12px rgba(0, 0, 0, .6); transition: border-color var(--pd-dur), background var(--pd-dur); }
.pd-composer:hover { border-color: var(--pd-line-hover); }
.pd-composer:focus-within { border-color: rgba(255, 255, 255, .3); background: var(--pd-surface-2); }
.pd-input { display: block; width: 100%; min-height: 24px; max-height: 120px; padding: 2px 2px 0; resize: none; overflow-y: auto; border: 0; outline: 0; background: transparent; color: var(--pd-ink); font-size: 13.5px; line-height: 1.5; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .14) transparent; }
.pd-input::placeholder { color: var(--pd-ink-3); }
.pd-composer-bottom { display: flex; align-items: center; gap: 8px; }
.pd-model { max-width: 160px; height: 28px; padding: 0 24px 0 9px; border: 1px solid transparent; border-radius: var(--pd-radius-sm); outline: 0; appearance: none; -webkit-appearance: none; background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff99' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 7px center / 12px; color: var(--pd-ink-2); font-size: 11.5px; font-weight: 500; cursor: pointer; transition: background-color var(--pd-dur), border-color var(--pd-dur), color var(--pd-dur); }
.pd-model:hover, .pd-model:focus { border-color: var(--pd-line); background-color: rgba(255, 255, 255, .05); color: var(--pd-ink); }
.pd-model option { background: var(--pd-surface-2); color: var(--pd-ink); }
.pd-key-hint { flex: 1; color: var(--pd-ink-4); font-size: 11px; }
.pd-count { color: var(--pd-ink-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.pd-count.is-over { color: var(--pd-red); }
.pd-send, .pd-stop { display: grid; width: 32px; height: 32px; flex: 0 0 32px; place-items: center; border-radius: 10px; transition: background var(--pd-dur), color var(--pd-dur), transform var(--pd-dur), box-shadow var(--pd-dur); }
.pd-send { background: var(--pd-blue); color: #fff; box-shadow: 0 4px 14px rgba(0, 153, 255, .3); }
.pd-send:hover:not(:disabled) { background: #33adff; transform: translateY(-1px); box-shadow: 0 6px 18px rgba(0, 153, 255, .4); }
.pd-send:active:not(:disabled) { transform: scale(.96); }
.pd-send:disabled { background: var(--pd-surface-3); color: var(--pd-ink-3); box-shadow: none; }
.pd-send .pd-icon, .pd-stop .pd-icon { width: 15px; height: 15px; }
.pd-stop { border: 1px solid var(--pd-red-line); background: var(--pd-red-soft); color: var(--pd-red); }
.pd-stop:hover { background: rgba(255, 107, 107, .18); }
.pd-composer-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 18px; padding: 6px 4px 0; }
.pd-note { color: var(--pd-ink-4); font-size: 11px; }
.pd-feedback { display: flex; align-items: center; gap: 6px; color: var(--pd-red); font-size: 11.5px; animation: pd-fade-up var(--pd-dur-slow) var(--pd-ease) both; }
.pd-feedback::before { width: 5px; height: 5px; flex: 0 0 5px; border-radius: 50%; background: currentColor; content: ""; }

/* ---------- 9. Workspace panel ---------- */
.pd-panel { display: flex; min-height: 0; flex-direction: column; border-left: 1px solid var(--pd-line); background: var(--pd-panel-bg); }
.pd-panel-head { display: flex; align-items: center; gap: 2px; height: 44px; flex: 0 0 44px; padding: 0 8px 0 10px; border-bottom: 1px solid var(--pd-line); }
.pd-tab { position: relative; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: var(--pd-radius-sm); color: var(--pd-ink-3); font-size: 12px; font-weight: 500; transition: background var(--pd-dur), color var(--pd-dur); }
.pd-tab:hover { background: rgba(255, 255, 255, .05); color: var(--pd-ink-2); }
.pd-tab[aria-selected="true"] { background: var(--pd-surface); color: var(--pd-ink); }
.pd-tab-badge, .pd-tab-dot { width: 6px; height: 6px; border-radius: 50%; }
.pd-tab-badge { background: var(--pd-blue); animation: pd-pulse 1.6s var(--pd-ease) infinite; }
.pd-tab-dot { background: var(--pd-green); }
.pd-panel-close { display: none; margin-left: auto; }
.pd-panel-body { position: relative; min-height: 0; flex: 1; }
.pd-activity, .pd-files, .pd-result { display: none; height: 100%; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .14) transparent; }
.pd-panel-body[data-view="activity"] .pd-activity, .pd-panel-body[data-view="files"] .pd-files, .pd-panel-body[data-view="result"] .pd-result { display: block; animation: pd-fade var(--pd-dur-slow) both; }
.pd-empty { display: flex; height: 100%; min-height: 220px; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 24px; color: var(--pd-ink-3); font-size: 12px; text-align: center; }
.pd-empty p { max-width: 200px; line-height: 1.5; }
.pd-empty-icon { display: grid; width: 40px; height: 40px; place-items: center; border: 1px dashed var(--pd-line-strong); border-radius: 12px; color: var(--pd-ink-4); }
.pd-empty-icon .pd-icon { width: 18px; height: 18px; }

/* activity log */
.pd-activity { padding: 8px; }
.pd-act { position: relative; display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 10px; padding: 8px; border-radius: var(--pd-radius-sm); color: var(--pd-ink-2); animation: pd-fade-up var(--pd-dur-slow) var(--pd-ease) both; }
.pd-act + .pd-act::before { position: absolute; top: -6px; left: 20px; width: 1px; height: 10px; background: var(--pd-line-strong); content: ""; }
.pd-act-icon { display: grid; width: 26px; height: 26px; place-items: center; border: 1px solid var(--pd-line); border-radius: 8px; background: var(--pd-surface); color: var(--pd-ink-3); transition: border-color var(--pd-dur-slow), color var(--pd-dur-slow), background var(--pd-dur-slow); }
.pd-act-icon .pd-icon { width: 13px; height: 13px; }
.pd-act[data-state="running"] { background: rgba(255, 255, 255, .03); }
.pd-act[data-state="running"] .pd-act-icon { border-color: var(--pd-blue-line); background: var(--pd-blue-soft); color: var(--pd-blue-ink); animation: pd-pulse 1.6s var(--pd-ease) infinite; }
.pd-act[data-state="done"] .pd-act-icon { color: var(--pd-green); }
.pd-act[data-state="stopped"] { color: var(--pd-ink-3); }
.pd-act[data-state="stopped"] .pd-act-icon { border-style: dashed; color: var(--pd-red); }
.pd-act-copy { display: flex; min-width: 0; flex-direction: column; gap: 2px; padding-top: 2px; }
.pd-act-tool { color: var(--pd-ink-4); font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.pd-act[data-state="running"] .pd-act-tool { color: var(--pd-blue-ink); }
.pd-act-copy strong { color: var(--pd-ink); font-size: 12px; font-weight: 500; line-height: 1.4; }
.pd-act-copy small { color: var(--pd-ink-3); font-size: 11px; line-height: 1.4; }
.pd-act-copy small:empty { display: none; }
.pd-act-time { padding-top: 4px; color: var(--pd-ink-4); font-family: var(--pd-mono); font-size: 10.5px; font-variant-numeric: tabular-nums; }

/* file tree */
.pd-files { padding: 10px; }
.pd-tree ul { margin-left: 12px; padding-left: 14px; border-left: 1px solid var(--pd-line); }
.pd-tree li { animation: pd-fade-up var(--pd-dur-slow) var(--pd-ease) both; }
.pd-tree-label { display: flex; align-items: center; gap: 8px; height: 28px; padding: 0 8px; border-radius: 6px; color: var(--pd-ink-2); font-size: 12px; transition: background var(--pd-dur); }
.pd-tree-label:hover { background: rgba(255, 255, 255, .04); }
.pd-tree-label .pd-icon { width: 14px; height: 14px; color: var(--pd-ink-4); }
.pd-tree-dir > .pd-tree-label { color: var(--pd-ink); font-weight: 500; }
.pd-tree-dir > .pd-tree-label .pd-icon { color: var(--pd-blue-ink); }
.pd-tree-file.is-new > .pd-tree-label { background: var(--pd-green-soft); color: var(--pd-ink); }
.pd-tree-file.is-new > .pd-tree-label .pd-icon { color: var(--pd-green); }
.pd-tree-badge { margin-left: auto; padding: 1px 6px; border-radius: 999px; background: rgba(74, 222, 128, .2); color: #b8f0cb; font-size: 10px; font-style: normal; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }

/* result document */
.pd-result-doc { display: flex; min-height: 100%; flex-direction: column; }
.pd-result-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px 10px 14px; border-bottom: 1px solid var(--pd-line); background: var(--pd-panel-bg); }
.pd-result-name { display: inline-flex; min-width: 0; align-items: center; gap: 8px; overflow: hidden; color: var(--pd-ink); font-family: var(--pd-mono); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.pd-result-name::before { width: 6px; height: 6px; flex: 0 0 6px; border-radius: 50%; background: var(--pd-green); content: ""; }
.pd-result-download { height: 28px; padding: 0 10px; font-size: 11.5px; }
.pd-result .pd-doc { padding: 16px 16px 24px; animation: pd-fade-up var(--pd-dur-slow) var(--pd-ease) both; }

/* ---------- 10. Documents (result panel, dialog) ---------- */
.pd-doc { color: var(--pd-ink-2); font-size: 12.5px; line-height: 1.7; }
.pd-doc h1 { margin-bottom: 12px; color: var(--pd-ink); font-size: 16px; font-weight: 600; letter-spacing: -.02em; line-height: 1.3; }
.pd-doc h2 { margin: 16px 0 4px; color: var(--pd-ink); font-size: 13px; font-weight: 600; }
.pd-doc h3 { margin: 12px 0 2px; color: var(--pd-ink); font-size: 12.5px; font-weight: 600; }
.pd-doc p + p { margin-top: 8px; }
.pd-doc ul, .pd-doc ol { display: flex; flex-direction: column; gap: 3px; margin: 4px 0 0; padding-left: 18px; }
.pd-doc ul { list-style: disc; }
.pd-doc ol { list-style: decimal; }
.pd-doc li::marker { color: var(--pd-ink-4); }
.pd-doc code { padding: 1px 5px; border-radius: 4px; background: rgba(255, 255, 255, .08); color: var(--pd-ink); font-family: var(--pd-mono); font-size: .92em; }

/* ---------- 11. Dialog (result on tablet and phone) ---------- */
.pd-preview-dialog { width: min(680px, calc(100vw - 32px)); max-height: min(720px, calc(100vh - 32px)); max-height: min(720px, calc(100dvh - 32px)); padding: 0; border: 1px solid var(--pd-line-strong); border-radius: 18px; background: var(--pd-canvas); color: var(--pd-ink); font: 400 13px/1.5 var(--pd-font); box-shadow: 0 40px 120px rgba(0, 0, 0, .7); }
.pd-preview-dialog[open] { animation: pd-dialog-in var(--pd-dur-slow) var(--pd-ease) both; }
.pd-preview-dialog::backdrop { background: rgba(0, 0, 0, .7); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.pd-preview-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 18px 18px 14px; border-bottom: 1px solid var(--pd-line); }
.pd-preview-head h2 { margin-top: 6px; font-family: var(--pd-mono); font-size: 15px; font-weight: 500; }
.pd-preview-body { max-height: 460px; overflow: auto; padding: 18px; }
.pd-preview-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px 14px; border-top: 1px solid var(--pd-line); background: var(--pd-panel-bg); }

/* ---------- 12. Responsive ---------- */
@media (max-width: 1199px) {
  .product-demo { --pd-sidebar: 204px; }
  .pd-body { grid-template-columns: var(--pd-sidebar) minmax(0, 1fr); }
  .pd-panel-toggle, .pd-panel-close { display: grid; }
  .pd-panel { position: absolute; inset: 0 0 0 auto; z-index: 5; width: min(360px, 92%); box-shadow: -20px 0 60px rgba(0, 0, 0, .5); transform: translateX(105%); visibility: hidden; transition: transform var(--pd-dur-slow) var(--pd-ease), visibility 0s var(--pd-dur-slow); }
  .product-demo[data-panel="open"] .pd-panel { transform: none; visibility: visible; transition: transform var(--pd-dur-slow) var(--pd-ease); }
  .product-demo[data-panel="open"] .pd-panel-toggle { border-color: var(--pd-blue-line); background: var(--pd-blue-soft); color: var(--pd-blue-ink); }
  .pd-window-title { display: none; }
  .pd-preset-grid { gap: 8px; }
  .pd-preset-card { min-height: 0; flex-direction: row; align-items: center; padding: 12px 14px; }
  .pd-card-arrow { top: 50%; right: 12px; transform: translate(-4px, -50%); }
  .pd-preset-card:hover .pd-card-arrow, .pd-preset-card:focus-visible .pd-card-arrow { transform: translateY(-50%); }
}
@media (max-width: 1000px) {
  .pd-preset-grid { grid-template-columns: 1fr; max-width: 440px; }
}
@media (max-width: 809px) {
  .product-demo { --pd-titlebar: 46px; --pd-gutter: 14px; height: 640px; border-radius: 18px; }
  .pd-titlebar { gap: 10px; padding: 0 10px 0 14px; }
  .pd-lights { display: none; }
  .pd-brand { margin-left: 0; }
  .pd-state { display: inline-block; max-width: 150px; overflow: hidden; font-size: 11px; line-height: 26px; text-overflow: ellipsis; }
  .pd-state::before { display: inline-block; margin-right: 6px; vertical-align: 1px; }
  .pd-pause { min-width: 0; }
  .pd-sidebar { display: none; }
  .pd-body { grid-template-columns: minmax(0, 1fr); }
  .pd-mobile-presets { display: flex; }
  .pd-thread { gap: 18px; padding-top: 18px; padding-bottom: 14px; }
  .pd-welcome { margin: auto 0; padding-block: 6px 8px; }
  .pd-welcome h2 { font-size: 25px; }
  .pd-preset-grid { max-width: none; gap: 8px; margin-top: 22px; }
  .pd-card-arrow { opacity: 1; transform: translateY(-50%); }
  .pd-message-text { max-width: 92%; }
  .pd-key-hint { display: none; }
  .pd-jump { bottom: 140px; }
  .pd-panel { width: 100%; box-shadow: none; }
  .pd-preview-head { padding: 16px 16px 12px; }
  .pd-preview-body { padding: 16px; }
  .pd-preview-actions { padding: 12px 16px 14px; }
}
@media (max-width: 480px) {
  .product-demo { height: 680px; border-radius: 16px; }
  .pd-brand { font-size: 13px; }
  .pd-state { max-width: 120px; padding-inline: 8px; }
  .pd-thread { gap: 16px; }
  .pd-welcome h2 { font-size: 23px; }
  .pd-welcome > p { font-size: 13px; }
  .pd-preset-card > .pd-icon { width: 30px; height: 30px; flex-basis: 30px; }
  .pd-plan summary { min-height: 40px; padding-inline: 12px; }
  .pd-progress-meter { margin-inline: 12px; }
  .pd-steps { padding-inline: 10px; }
  .pd-step-tool { display: none; }
  .pd-response { font-size: 13px; }
  .pd-composer { padding: 10px 10px 8px; }
  .pd-input { font-size: 16px; }
  .pd-note { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* ---------- 13. Motion ---------- */
@keyframes pd-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pd-fade-up { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes pd-pop { from { transform: scale(.6); } to { transform: none; } }
@keyframes pd-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(0, 153, 255, .45); } 60% { box-shadow: 0 0 0 5px rgba(0, 153, 255, 0); } }
@keyframes pd-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes pd-dialog-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .product-demo *, .product-demo *::before, .product-demo *::after, .pd-preview-dialog, .pd-preview-dialog * {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important;
  }
  .pd-thinking > span:last-child { animation: none; -webkit-text-fill-color: currentcolor; background: none; }
}
