:root {
  --bg: #0b0f14;
  --bg-2: #101620;
  --bg-3: #161e2a;
  --line: #22303f;
  --text: #e6edf3;
  --muted: #8b9bb0;
  --accent: #64d2ff;
  --accent-2: #ff9d9d;
  --ok: #4ade80;
  --warn: #fbbf24;
  --bad: #f87171;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
button, input, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--bg-2);
  gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.logo {
  width: 26px; height: 26px; border-radius: 7px; background: #0b0f14; border: 1px solid var(--line);
  position: relative; overflow: hidden;
}
.logo::before { content: ""; position: absolute; left: 3px; right: 3px; top: 12px; height: 3px; background: var(--accent-2); border-radius: 2px; }
.logo::after { content: ""; position: absolute; left: 8px; top: 3px; width: 8px; height: 8px; border: 2px solid var(--accent); border-radius: 50%; }
.name { font-weight: 700; letter-spacing: .2px; }
.tag { color: var(--muted); font-size: 12px; white-space: nowrap; }
@media (max-width: 1180px) { .tag { display: none; } }
.sibling { color: var(--accent); text-decoration: none; font-size: 12px; font-weight: 600; padding: 6px 11px; border: 1px solid var(--line); border-radius: 8px; margin-left: 8px; white-space: nowrap; }
.sibling:hover { border-color: var(--accent); }
.topbar-right { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.pdk-pick { display: flex; align-items: center; gap: 6px; background: var(--bg-3); border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; }
.pdk-pick .pdk-label { color: var(--muted); font-size: 12px; }
.pdk-pick select { background: transparent; border: 0; color: var(--text); font-weight: 500; outline: none; max-width: 220px; }
.pdk-pick select option { background: var(--bg-2); }
.pdk-pick.fab { border-color: #1f4d33; }
.pdk-pick.fab .pdk-label { color: var(--ok); }
.pill {
  font-family: var(--mono); font-size: 11px; color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px; padding: 3px 9px;
}
.pill.ok { color: var(--ok); border-color: #1f4d33; }
.pill.bad { color: var(--bad); border-color: #5a2626; }

.btn {
  background: var(--bg-3); border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 12px; cursor: pointer; font-weight: 500; transition: background .12s, border-color .12s;
}
.btn:hover { background: #1d2836; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: #05131a; border-color: transparent; font-weight: 600; }
.btn.primary:hover { background: #82dcff; }
.btn.ghost { background: transparent; }
.btn.small { padding: 4px 9px; font-size: 12px; border-radius: 6px; }
.btn.toggled { border-color: var(--accent); color: var(--accent); }

.workspace {
  flex: 1; display: grid;
  grid-template-columns: 340px 1fr 420px;
  min-height: 0;
}
.pane { min-width: 0; min-height: 0; display: flex; flex-direction: column; border-right: 1px solid var(--line); }
.pane:last-child { border-right: 0; }

/* chat */
.messages { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.msg { border-radius: 10px; padding: 10px 12px; line-height: 1.45; max-width: 100%; white-space: pre-wrap; word-wrap: break-word; }
.msg p { margin: 0 0 6px; }
.msg p:last-child { margin: 0; }
.msg.user { background: #16324a; align-self: flex-end; }
.msg.assistant { background: var(--bg-3); }
.msg.system { background: transparent; border: 1px dashed var(--line); color: var(--text); }
.msg.error { background: #3a1c1c; border: 1px solid #5a2626; font-family: var(--mono); font-size: 12px; }
.msg .meta { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; }
.status { display: flex; align-items: center; gap: 8px; padding: 8px 14px; color: var(--accent); font-size: 13px; border-top: 1px solid var(--line); }
.status #status-cancel { margin-left: auto; }
.spinner { width: 12px; height: 12px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.composer { border-top: 1px solid var(--line); padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; background: var(--bg-2); }
.composer textarea {
  width: 100%; resize: vertical; min-height: 64px; background: var(--bg); border: 1px solid var(--line);
  border-radius: 8px; padding: 9px 10px; outline: none;
}
.composer textarea:focus { border-color: var(--accent); }
.composer-row { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 6px; }
.check { color: var(--muted); font-size: 12px; display: flex; gap: 6px; align-items: center; }

/* viewer */
.viewer { position: relative; background: #070a0e; }
.viewer-tools {
  position: absolute; top: 10px; left: 10px; z-index: 2; display: flex; gap: 6px; align-items: center;
  background: rgba(16, 22, 32, .85); border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; backdrop-filter: blur(4px);
}
.coords, .dims { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-left: 6px; white-space: pre; }
.dims { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 42%; flex: 0 1 auto; }
.viewer-tools { overflow: hidden; max-width: calc(100% - 20px); }
#canvas { width: 100%; height: 100%; display: block; cursor: grab; }
#canvas.dragging { cursor: grabbing; }
.legend {
  position: absolute; right: 10px; bottom: 10px; z-index: 2; display: flex; flex-direction: column; gap: 4px;
  background: rgba(16, 22, 32, .85); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; backdrop-filter: blur(4px);
  font-size: 12px; max-height: 45%; overflow: auto;
}
.legend label { display: flex; align-items: center; gap: 7px; cursor: pointer; }
.legend .legend-head { background: transparent; border: 0; color: var(--text); font: inherit; font-weight: 600; cursor: pointer; padding: 0; text-align: left; }
.legend.collapsed label { display: none; }
.legend .sw { width: 12px; height: 12px; border-radius: 3px; border: 1px solid rgba(255,255,255,.25); }
.legend .ln { color: var(--muted); font-family: var(--mono); font-size: 11px; }
.empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); pointer-events: none; }
.empty-art { width: 140px; height: 70px; border: 1px dashed var(--line); border-radius: 10px; margin-bottom: 12px; position: relative; }
.empty-art::before { content: ""; position: absolute; left: 10px; right: 10px; top: 33px; height: 3px; background: #3a2b2b; border-radius: 2px; }
.empty-art::after { content: ""; position: absolute; left: 56px; top: 8px; width: 24px; height: 24px; border: 2px solid #234; border-radius: 50%; }

/* side */
.tabs { display: flex; border-bottom: 1px solid var(--line); background: var(--bg-2); position: relative; z-index: 3; }
.tab { flex: 1; background: transparent; border: 0; padding: 10px 6px; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; font-weight: 500; display: flex; justify-content: center; gap: 6px; align-items: center; }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.badge { background: var(--bad); color: #fff; font-size: 10px; border-radius: 999px; padding: 1px 6px; font-weight: 600; }
.badge.ok { background: var(--ok); color: #05131a; }
.tabpanel { display: none; flex: 1; min-height: 0; flex-direction: column; }
.tabpanel.active { display: flex; }
.panel-toolbar { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line); gap: 8px; font-size: 12px; }
.panel-toolbar.wrap { flex-wrap: wrap; justify-content: flex-start; }
.panel-toolbar label { display: flex; gap: 5px; align-items: center; color: var(--muted); }
.panel-toolbar input { width: 64px; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px; font-family: var(--mono); font-size: 12px; }
.code {
  flex: 1; width: 100%; resize: none; border: 0; outline: none; background: var(--bg); color: var(--text);
  font-family: var(--mono); font-size: 12.5px; line-height: 1.5; padding: 12px; tab-size: 4; white-space: pre; overflow: auto;
}
.error { margin: 0; padding: 10px 12px; background: #3a1c1c; color: #ffd0d0; font-family: var(--mono); font-size: 11.5px; white-space: pre-wrap; max-height: 40%; overflow: auto; border-top: 1px solid #5a2626; }
#sim-canvas { width: 100%; height: 360px; flex: none; display: block; background: var(--bg); }
body.sim-wide .workspace { grid-template-columns: 340px 1fr; }
body.sim-wide .viewer { display: none; }
body.sim-wide #sim-canvas { height: 480px; }
#btn-sim-wide.active { border-color: var(--accent); color: var(--accent); }
.tabs .tabs-wide { flex: none; align-self: center; margin: 0 6px; }
.msg.retry .btn { margin-top: 6px; }
.msg .errdetail { margin-top: 6px; font-size: 12px; }
/* first-run walkthrough (tour.js) */
.tour-card { position: fixed; z-index: 1200; background: #101620; border: 1px solid var(--accent); border-radius: 12px; padding: 14px 16px; box-shadow: 0 20px 50px rgba(0,0,0,.5); font-size: 14px; line-height: 1.5; }
.tour-step { color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.tour-title { font-weight: 700; font-size: 15px; margin: 2px 0 4px; }
.tour-text { color: var(--text); }
.tour-row { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.tour-glow { box-shadow: 0 0 0 3px var(--accent), 0 0 0 9px rgba(100,210,255,.18) !important; border-radius: 10px; transition: box-shadow .2s; }
/* layout-viewer legend ("What am I looking at?") */
.legend-box { position: absolute; left: 10px; right: 10px; top: 54px; z-index: 3; background: rgba(16, 22, 32, .96); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; font-size: 13px; line-height: 1.5; display: flex; flex-direction: column; gap: 6px; }
.legend-box.hidden { display: none; }
.legend-box .sw { display: inline-block; width: 11px; height: 11px; border-radius: 3px; vertical-align: -1px; }
.legend-box a { color: var(--accent); }
.msg .errdetail summary { cursor: pointer; color: var(--muted); }
.msg .errdetail pre { white-space: pre-wrap; margin: 6px 0 0; font-size: 11px; max-height: 240px; overflow: auto; }
.sim-legend { display: flex; flex-wrap: wrap; gap: 8px 14px; padding: 8px 12px; font-family: var(--mono); font-size: 11px; }
.sim-legend span::before { content: ""; display: inline-block; width: 14px; height: 3px; background: var(--c); margin-right: 6px; vertical-align: middle; border-radius: 2px; }
#sim-note { padding: 0 12px 12px; margin: 0; }
.list { padding: 12px; overflow: auto; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; justify-content: space-between; gap: 10px; padding: 8px 10px; background: var(--bg-3); border-radius: 8px; font-size: 13px; }
.row .k { color: var(--muted); }
.row .v { font-family: var(--mono); font-size: 12px; }
.row.bad { border-left: 3px solid var(--bad); }
.row.ok { border-left: 3px solid var(--ok); }
.row.warn { border-left: 3px solid var(--warn); }
.row.clickable { cursor: pointer; }
.row.clickable:hover { background: #1d2836; }
h4 { margin: 8px 0 2px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
table.ports { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 11.5px; }
table.ports th, table.ports td { text-align: left; padding: 5px 6px; border-bottom: 1px solid var(--line); }
table.ports th { color: var(--muted); font-weight: 500; }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; z-index: 10; padding: 16px; }
.modal.confirm-wrap { z-index: 1000; }
.modal-card { background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; width: min(720px, 100%); max-height: 85vh; overflow: auto; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.examples { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 14px 16px; }
.example { text-align: left; background: var(--bg-3); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer; }
.example:hover { border-color: var(--accent); }
.example strong { display: block; margin-bottom: 4px; }
.example span { color: var(--muted); font-size: 12px; }

@media (max-width: 1100px) {
  .workspace { grid-template-columns: 300px 1fr; grid-template-rows: 1fr 1fr; }
  .side { grid-column: 1 / -1; border-top: 1px solid var(--line); }
  .examples { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  body { overflow: auto; }
  .workspace { display: flex; flex-direction: column; }
  .pane { border-right: 0; border-bottom: 1px solid var(--line); flex: none; }
  .viewer { order: 1; height: 46vh; min-height: 300px; }
  .chat { order: 2; }
  .chat .messages { max-height: 26vh; }
  .side { order: 3; min-height: 480px; }
  .tag { display: none; }
  .topbar { padding: 8px 12px; }
  .topbar .pill { display: none; }
}

/* ---------- ASIC mode ---------- */
.asic-only { display: none; }
body.asic .asic-only { display: block; }
body.asic span.asic-only { display: inline-flex; }
body.asic .photonic-only { display: none !important; }
.asic-settings { gap: 10px; align-items: center; color: var(--muted); font-size: 12px; flex-wrap: wrap; }
.asic-settings label { display: inline-flex; align-items: center; gap: 4px; }
.asic-settings select { background: var(--bg-3); border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px; font-size: 12px; }
.asic-settings input { width: 62px; background: var(--bg-3); border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px; font-family: var(--mono); font-size: 12px; }
pre.report { font-family: var(--mono); font-size: 11px; line-height: 1.35; color: var(--muted); background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px; overflow: auto; max-height: 420px; white-space: pre; margin: 6px 0 0; }
.ports td.neg { color: var(--bad); }
.filelinks { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.filelinks a { color: var(--accent); font-size: 12px; border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; text-decoration: none; }
.filelinks a:hover { border-color: var(--accent); }
.msg.system.note { border-left: 2px solid var(--accent); }
.tabpanel > .photonic-only { display: flex; flex-direction: column; flex: 1; min-height: 0; }
body.asic .tabpanel > .asic-only { display: flex; flex-direction: column; flex: 1; min-height: 0; }
body.asic .panel-toolbar.asic-only { display: flex; flex: none; }

/* electronics co-sim */
.code.spice { flex: 0 0 auto; height: 150px; min-height: 90px; border-bottom: 1px solid var(--line); resize: vertical; }
.elec-out { flex: 1; }
.elec-plot { width: 100%; height: 220px; display: block; background: var(--bg); border-radius: 8px; }
table.op { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 11.5px; }
table.op th, table.op td { text-align: left; padding: 4px 6px; border-bottom: 1px solid var(--line); }
table.op th { color: var(--muted); font-weight: 500; }

.list p.muted a { color: var(--accent); }
.store-after { margin-left: auto; font-size: 12px; padding: 4px 9px; }

/* Electronics tab: the signal chain (elecviews.js) */
.elec-chain { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--line); background: var(--bg-2); }
.elec-chain .stages { display: flex; align-items: stretch; gap: 4px; flex: 1; min-width: 0; flex-wrap: wrap; }
.elec-chain .arrow { color: var(--muted); align-self: center; font-size: 16px; padding: 0 1px; }
.elec-chain .stage { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 6px; align-items: center; text-align: left; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 5px 9px; cursor: pointer; color: var(--muted); min-width: 92px; flex: 1 0 auto; }
.elec-chain .stage:hover { border-color: #33465c; }
.elec-chain .stage.active { border-color: var(--accent); color: var(--text); background: #10202b; }
.elec-chain .stage .n { grid-row: 1 / span 2; width: 18px; height: 18px; border-radius: 50%; background: var(--bg-3); color: var(--muted); font-size: 11px; font-weight: 600; display: flex; align-items: center; justify-content: center; }
.elec-chain .stage.active .n { background: var(--accent); color: #05131a; }
.elec-chain .stage .lbl { font-size: 12px; font-weight: 600; white-space: nowrap; }
.elec-chain .stage .metric { font-family: var(--mono); font-size: 11px; white-space: nowrap; }
.elec-chain .stage .metric.ok { color: var(--ok); } .elec-chain .stage .metric.warn { color: var(--warn); } .elec-chain .stage .metric.bad { color: var(--bad); }
.elec-chain .wide-toggle { flex: none; }
.elecview { display: none; flex: 1; min-height: 0; flex-direction: column; }
.elecview.active { display: flex; }
.elecview .list h4 { margin: 10px 0 4px; font-size: 13px; }
.kv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px; padding: 0 12px 8px; }
.kv-grid .cell { background: var(--bg-3); border-radius: 8px; padding: 6px 8px; font-size: 12px; }
.kv-grid .cell .k { color: var(--muted); display: block; font-size: 11px; }
.kv-grid .cell .v { font-family: var(--mono); }
/* wide mode: the layout viewer steps aside, chat stays, the side pane takes the rest */
body.elec-wide .workspace { grid-template-columns: 340px 1fr; }
body.elec-wide .viewer { display: none; }
body.elec-wide .elec-plot { height: 260px; }
body.elec-wide .elecview .two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: start; }
@media (max-width: 1100px) { body.elec-wide .workspace { grid-template-columns: 1fr; grid-template-rows: auto 1fr; } body.elec-wide .chat { max-height: 34vh; } }

.elec-schem { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 6px; }
.elec-schem svg { display: block; max-height: 320px; }

/* hero: the prompt is the whole page until a design exists */
body.hero-mode .workspace { display: none; }
/* the chat thread and the status line live inside the hero while there is no layout */
#hero-live #messages { max-height: 42vh; overflow-y: auto; padding: 0; margin: 12px 0 0; gap: 8px; }
#hero-live #messages:empty { margin: 0; }
#hero-live #messages > .msg.system:first-child { display: none; } /* the intro card is the hero itself here */
#hero-live #status { border-top: 0; padding: 10px 0 0; }
.hero-examples.hidden { display: none; }
.hero { flex: 1; display: flex; padding: 32px 16px; overflow: auto; }
.hero-card { width: 100%; max-width: 860px; margin: auto; }
.hero-eyebrow { color: var(--accent); font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; margin: 0 0 10px; }
.hero-title { font-size: clamp(28px, 4.2vw, 44px); line-height: 1.1; margin: 0 0 12px; letter-spacing: -.01em; }
.hero-sub { color: var(--muted); font-size: 16px; line-height: 1.5; margin: 0 0 22px; max-width: 700px; }
.hero-form textarea {
  width: 100%; min-height: 170px; resize: vertical; font-size: 18px; line-height: 1.45; padding: 18px 20px;
  background: var(--bg-2); border: 2px solid var(--accent); border-radius: 14px; outline: none; color: var(--text);
  box-shadow: 0 0 0 6px rgba(100, 210, 255, .10), 0 20px 60px rgba(0,0,0,.35);
}
.hero-form textarea:focus { box-shadow: 0 0 0 8px rgba(100, 210, 255, .18), 0 20px 60px rgba(0,0,0,.35); }
.hero-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.hero-fab { display: flex; align-items: center; gap: 10px; background: var(--bg-3); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
.hero-fab-label { color: var(--muted); font-size: 13px; white-space: nowrap; }
.hero-fab { flex: 1; min-width: 0; }
.hero-fab select { flex: 1; min-width: 0; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; color: var(--text); font-weight: 600; font-size: 14px; padding: 6px 8px; }
.hero-fab select option { background: var(--bg-2); }
.hero-build { font-size: 17px; padding: 12px 26px; border-radius: 10px; }
.hero-examples { margin-top: 26px; }
#hero-examples { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
#hero-examples button { background: var(--bg-3); border: 1px solid var(--line); color: var(--text); border-radius: 999px; padding: 7px 13px; cursor: pointer; font-size: 13px; }
#hero-examples button:hover { border-color: var(--accent); }
/* in hero mode the top bar keeps only History and the sibling link; the hero carries the fab picker */
body.hero-mode .topbar-right > button:not(#btn-history), body.hero-mode .topbar-right .pdk-pick, body.hero-mode .topbar-right .pill { display: none; }

/* per-panel assistant strip */
.ask-strip { display: flex; flex-direction: column; gap: 6px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: linear-gradient(90deg, rgba(100,210,255,.07), transparent); }
.ask-label { font-size: 12px; color: var(--accent); font-weight: 600; }
.ask-suggest { display: flex; flex-wrap: wrap; gap: 6px; }
.ask-suggest button { background: var(--bg-3); border: 1px solid var(--line); color: var(--text); border-radius: 999px; padding: 4px 10px; font-size: 12px; cursor: pointer; }
.ask-suggest button:hover { border-color: var(--accent); }
.ask-form { display: flex; gap: 6px; }
.ask-input { flex: 1; min-width: 0; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; font-size: 13px; outline: none; }
.ask-input:focus { border-color: var(--accent); }
.msg .using { display: inline-block; margin-top: 6px; font-size: 11px; color: var(--muted); font-family: var(--mono); }
.msg.proposal { background: #13283a; border: 1px solid #1f4d66; }
.msg.proposal .prop-title { color: var(--accent); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 4px; }
.msg.proposal .prop-actions { display: flex; gap: 8px; margin-top: 8px; }
.hero-after { margin-top: 18px; }

/* chat code fences, confirm sheet, stale banner, narrow-screen menu */
.msg pre.chatcode { margin: 8px 0 0; padding: 8px 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; font-family: var(--mono); font-size: 11.5px; white-space: pre-wrap; max-height: 220px; overflow: auto; }
.msg details.using { margin-top: 6px; font-size: 11px; color: var(--muted); font-family: var(--mono); }
.msg details.using summary { cursor: pointer; }
.modal-card.confirm { padding: 18px 20px; width: min(420px, 100%); }
.modal-card.confirm p { margin: 0 0 12px; }
#stale-banner { position: absolute; top: 56px; left: 10px; right: 10px; z-index: 3; background: #3a2c14; border: 1px solid #7a5a1e; color: #ffd68a; border-radius: 8px; padding: 8px 12px; font-size: 13px; }
body.stale .tab[data-tab="drc"], body.stale .tab[data-tab="tapeout"], body.stale .tab[data-tab="sim"] { opacity: .55; }
.menu-toggle { display: none; }
@media (max-width: 720px) {
  .menu-toggle { display: inline-block; margin-left: auto; }
  .topbar { flex-wrap: wrap; }
  .topbar-right { display: none; flex-basis: 100%; width: 100%; min-width: 0; flex-direction: column; align-items: stretch; gap: 6px; padding-top: 8px; box-sizing: border-box; }
  body.menu-open .topbar-right { display: flex; }
  .topbar-right > * { width: 100%; min-width: 0; box-sizing: border-box; }
  .pdk-pick select { max-width: 100%; width: 100%; }
  .tabs { overflow-x: auto; scrollbar-width: none; }
  .tab { white-space: nowrap; flex: 1 0 auto; padding: 10px 12px; }
  html, body { overflow-x: hidden; }
  .viewer-tools { flex-wrap: wrap; max-width: calc(100% - 16px); }
  .coords { display: none; }
  .tabs .tab { flex: 0 0 auto; }
}

/* after the hero, the prompt stays the most important thing in the chat pane: it shrinks, it does not vanish */
.composer { padding: 12px 12px 14px; gap: 8px; box-shadow: 0 -14px 30px rgba(0,0,0,.28); }
.composer-label { color: var(--accent); font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.composer textarea { min-height: 124px; font-size: 15px; line-height: 1.45; padding: 12px 14px; border-radius: 12px; border: 1px solid rgba(100, 210, 255, .55); box-shadow: 0 0 0 4px rgba(100, 210, 255, .10); }
.composer textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 6px rgba(100, 210, 255, .18); }
.composer #send { font-size: 15px; padding: 10px 22px; border-radius: 10px; }
/* first build: Code and Simulate say what they are waiting for */
.draft-wait { display: none; align-items: center; gap: 10px; padding: 14px 12px; color: var(--accent); font-size: 13px; border-bottom: 1px solid var(--line); }
body.drafting:not(.has-code) [data-panel="code"] .draft-wait, body.drafting [data-panel="sim"] .draft-wait { display: flex; }
.draft-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: draft-pulse 1.2s ease-in-out infinite; }
@keyframes draft-pulse { 0%, 100% { opacity: .35; transform: scale(.8); } 50% { opacity: 1; transform: scale(1.1); } }
@media (prefers-reduced-motion: reduce) { .draft-dot { animation: none; } }
