:root {
  color-scheme: dark;
  --bg: #080808;
  --panel: #111110;
  --line: #292b27;
  --text: #e9eae5;
  --muted: #90938a;
  --accent: #c4d9b5;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font:
    14px/1.55 Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    sans-serif;
}
button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}
button,
a,
input,
textarea,
select {
  -webkit-tap-highlight-color: transparent;
}
button {
  cursor: pointer;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 13px;
}
button:hover {
  background: #1b1d18;
  border-color: #4e5545;
}
button:disabled {
  opacity: 0.45;
  cursor: default;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}
a {
  color: inherit;
  text-decoration: none;
}
input,
textarea,
select {
  background: #151612;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  width: 100%;
  min-width: 0;
}
textarea {
  resize: vertical;
}
label {
  display: block;
}
h1,
h2,
p {
  margin-top: 0;
}
[hidden] {
  display: none !important;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
.skip {
  position: fixed;
  left: 16px;
  top: -80px;
  z-index: 100;
  background: var(--accent);
  color: #151612;
  padding: 10px;
}
.skip:focus {
  top: 10px;
}
.app-shell {
  display: grid;
  grid-template-columns: 245px minmax(0, 1fr);
  min-height: 100dvh;
}
#sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: #0d0e0c;
  border-right: 1px solid #22251f;
  padding: 28px 18px 20px;
}
.brand {
  display: flex;
  gap: 9px;
  align-items: center;
  font-size: 14px;
  letter-spacing: -0.3px;
  white-space: nowrap;
  margin-bottom: 34px;
}
.brand span {
  color: var(--accent);
  font-size: 33px;
  line-height: 1;
}
.new-button {
  text-align: left;
  background: #1b1f16;
  border-color: #343d2b;
  color: var(--accent);
  padding: 11px 13px;
  margin-bottom: 19px;
}
.new-button span {
  font-size: 19px;
  margin-right: 8px;
}
.search-label input {
  background: transparent;
  font-size: 12px;
  padding: 9px 10px;
}
.sidebar-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 28px 3px 10px;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 1.5px;
}
.sidebar-heading button {
  font-size: 10px;
  letter-spacing: 0;
  padding: 3px 5px;
  border: 0;
}
.sidebar-heading button[aria-pressed="true"] {
  color: var(--accent);
}
#lab-list {
  overflow: auto;
  min-height: 80px;
  flex: 1;
}
#lab-list button {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  margin: 3px 0;
  padding: 10px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#lab-list button[aria-current="page"] {
  background: #22261d;
  border-color: #38422e;
  color: var(--accent);
}
#empty-library {
  font-size: 12px;
  color: #767e6d;
  margin: 7px 10px auto;
}
footer {
  padding-top: 22px;
  border-top: 1px solid #22251f;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
footer button,
footer a {
  font-size: 11px;
  color: #a4a99c;
  text-align: left;
  padding: 0;
  border: 0;
}
footer p {
  font-size: 10px;
  color: #6e7765;
  margin: 12px 0 0;
}
main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  padding: 0 45px 35px;
}
.workspace-top {
  height: 86px;
  display: flex;
  align-items: center;
  gap: 15px;
  font-size: 12px;
  color: var(--muted);
}
#save-state {
  margin-left: auto;
  font-size: 10px;
}
.workspace-top button {
  font-size: 11px;
}
.icon-button {
  border: 0;
  font-size: 22px;
  line-height: 1;
  padding: 8px;
}
#toggle-sidebar {
  display: none;
}
#welcome {
  text-align: center;
  margin: auto auto 40px;
  padding-top: 10vh;
}
.welcome-mark {
  font-size: 53px;
  color: var(--accent);
}
#welcome h1 {
  font-size: clamp(32px, 3.6vw, 49px);
  font-weight: 450;
  letter-spacing: -1.8px;
  line-height: 1.22;
  margin: 17px 0;
}
#welcome p {
  color: var(--muted);
  font-size: 14px;
}
#composer-wrap {
  width: 100%;
  max-width: 730px;
  margin: 0 auto auto;
}
#prompt-form {
  border: 1px solid #42483a;
  border-radius: 17px;
  background: #151713;
  padding: 16px 17px 13px;
  box-shadow: 0 8px 40px #0002;
}
#prompt-form:focus-within {
  border-color: #7e936d;
}
#prompt {
  border: 0;
  background: none;
  padding: 4px;
  resize: none;
  min-height: 70px;
  font-size: 15px;
  outline: none;
  line-height: 1.6;
}
#prompt::placeholder {
  color: #868e7d;
}
.composer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.composer-bottom button:first-child {
  font-size: 11px;
  color: #a8b29c;
  border: 0;
  padding: 6px;
}
.composer-bottom #send {
  background: var(--accent);
  color: #182112;
  border: 0;
  border-radius: 9px;
  font-size: 22px;
  width: 35px;
  height: 35px;
  padding: 0;
}
.starters {
  display: flex;
  justify-content: center;
  gap: 9px;
  flex-wrap: wrap;
  margin-top: 20px;
}
.starters button {
  font-size: 11px;
  border-radius: 20px;
  padding: 7px 13px;
  color: #a6ad9d;
}
.composer-note {
  text-align: center;
  font-size: 10px;
  color: #6f7866;
  margin: 18px 0 0;
}
#notice {
  min-height: 20px;
  font-size: 12px;
  color: var(--accent);
  margin: 14px 0;
  overflow-wrap: anywhere;
}
#notice[data-error="true"] {
  color: #e6a391;
}
#lab-workspace {
  width: 100%;
  max-width: 1000px;
  margin: 30px auto 32px;
}
.lab-heading {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 20px;
  margin-bottom: 25px;
}
.eyebrow {
  font-size: 9px;
  letter-spacing: 2px;
  color: #8b9980;
  margin-bottom: 10px;
}
.lab-heading h1 {
  font-size: 32px;
  font-weight: 500;
  letter-spacing: -1px;
  overflow-wrap: anywhere;
  margin-bottom: 10px;
}
.lab-heading p:not(.eyebrow) {
  max-width: 650px;
  color: var(--muted);
  font-size: 13px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.lab-heading button {
  white-space: nowrap;
  font-size: 11px;
}
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 245px), 1fr));
  gap: 12px;
}
.tool-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  background: #10120e;
  display: flex;
  flex-direction: column;
  align-items: start;
}
.tool-card .mark {
  color: var(--accent);
  font-size: 23px;
  margin-bottom: 16px;
}
.tool-card h2 {
  font-size: 16px;
  font-weight: 500;
  margin: 0 0 8px;
}
.tool-card p {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 22px;
}
.tool-card button {
  margin-top: auto;
  font-size: 12px;
  background: #252e1d;
  border-color: #3a492c;
  color: var(--accent);
}
#notes-section {
  margin: 23px 0;
  color: #a6b09a;
  font-size: 12px;
}
#notes-section summary {
  cursor: pointer;
}
#lab-notes {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 12px 0;
}
#conversation {
  display: flex;
  flex-direction: column;
  gap: 13px;
  margin-top: 28px;
}
.message {
  max-width: 88%;
  padding: 13px 16px;
  border-radius: 12px;
  font-size: 13px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.message.user {
  align-self: flex-end;
  background: #22271c;
  color: #d8e1cf;
}
.message.guide {
  padding-left: 0;
  color: #a8b49a;
}
.suggestions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.suggestions button {
  font-size: 11px;
}
.quiet {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}
.primary {
  background: var(--accent);
  color: #172012;
  border-color: var(--accent);
}
.primary:hover {
  background: #dae8ce;
  color: #172012;
}
dialog {
  background: #10120e;
  color: var(--text);
  border: 1px solid #3b4333;
  border-radius: 16px;
  width: min(620px, calc(100vw - 28px));
  max-height: calc(100dvh - 45px);
  padding: 27px;
  box-shadow: 0 25px 100px #0009;
}
dialog::backdrop {
  background: #000b;
  backdrop-filter: blur(4px);
}
.dialog-heading {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 20px;
}
.dialog-heading h2 {
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -0.6px;
  margin-bottom: 15px;
}
#template-list {
  margin: 15px 0;
  max-height: 47dvh;
  overflow: auto;
}
.template-option {
  display: flex;
  align-items: start;
  gap: 12px;
  padding: 14px 9px;
  border-bottom: 1px solid #242b1e;
  cursor: pointer;
}
.template-option input {
  width: 16px;
  flex: 0 0 16px;
  margin-top: 6px;
  accent-color: var(--accent);
}
.template-option strong {
  font-size: 13px;
  font-weight: 500;
}
.template-option span {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
}
.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
  font-size: 12px;
  color: var(--muted);
}
#customize-form {
  display: grid;
  gap: 16px;
}
#customize-form label {
  font-size: 12px;
  color: #b0b9a5;
}
#customize-form input,
#customize-form textarea,
#customize-form select {
  margin-top: 6px;
}
.manage-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  padding-top: 20px;
  margin: 23px 0 15px;
}
.manage-actions button {
  font-size: 11px;
}
@media (min-width: 1700px) {
  main {
    padding-left: 80px;
    padding-right: 80px;
  }
}
@media (max-width: 760px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  #sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 265px;
    z-index: 30;
    box-shadow: 20px 0 80px #000b;
    transform: translateX(-110%);
    transition: transform 0.18s;
  }
  body.sidebar-open #sidebar {
    transform: translateX(0);
  }
  main {
    padding: 0 20px 24px;
  }
  .workspace-top {
    height: 64px;
  }
  #toggle-sidebar {
    display: block;
  }
  #welcome {
    padding-top: 8vh;
    margin-bottom: 32px;
  }
  #welcome h1 {
    font-size: 35px;
  }
  #welcome p {
    font-size: 12px;
  }
  #prompt-form {
    padding: 13px;
  }
  #prompt {
    font-size: 14px;
  }
  .composer-note {
    font-size: 9px;
  }
  .lab-heading {
    flex-direction: column;
    gap: 0;
  }
  .lab-heading h1 {
    font-size: 27px;
  }
  .lab-heading button {
    align-self: flex-end;
  }
  .tools-grid {
    grid-template-columns: 1fr;
  }
  .tool-card {
    padding: 16px;
  }
  .tool-card p {
    margin-bottom: 14px;
  }
  .tool-card .mark {
    margin-bottom: 8px;
  }
  #lab-workspace {
    margin-top: 18px;
  }
  .message {
    max-width: 96%;
  }
  .dialog-actions {
    align-items: end;
  }
  dialog {
    padding: 22px;
  }
  .workspace-top #save-state {
    font-size: 9px;
  }
}

#close-sidebar {
  display: none;
}
.dialog-notice {
  color: #e6a391;
  font-size: 12px;
}
@media (max-width: 760px) {
  #close-sidebar {
    display: block;
    position: absolute;
    top: 23px;
    right: 8px;
  }
  #sidebar {
    visibility: hidden;
  }
  body.sidebar-open #sidebar {
    visibility: visible;
  }
}
@media (prefers-reduced-motion: reduce) {
  #sidebar {
    transition: none;
  }
}

#created-simulation {
  margin: 24px 0;
}
.simulation-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}
.simulation-actions span {
  flex: 1 1 300px;
  color: var(--muted);
  font-size: 13px;
}
.simulation-actions a {
  color: var(--accent);
  font-size: 12px;
}
#simulation-view iframe {
  width: 100%;
  height: 700px;
  border: 1px solid #30362c;
  border-radius: 12px;
  background: #090a09;
}
#created-simulation details {
  margin: 12px 0;
  color: var(--muted);
  font-size: 12px;
}
#simulation-evidence {
  line-height: 1.7;
}
@media (max-width: 650px) {
  #simulation-view iframe {
    height: 560px;
  }
}

#request-review {
  margin: 24px 0;
  padding: 20px;
  border: 1px solid #424b3d;
  border-radius: 12px;
  line-height: 1.6;
}
#request-review h2 {
  font-size: 17px;
  font-weight: 500;
}
#request-review p {
  color: var(--muted);
  font-size: 14px;
}

.chat-model-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 12px;
}
.chat-model-controls select {
  color: var(--text, #eee);
  background: #111;
  border: 1px solid #333;
  border-radius: 7px;
  padding: 7px;
  max-width: 100%;
}
#model-status {
  font-size: 12px;
  line-height: 1.5;
}
#chat-stream {
  white-space: pre-wrap;
  max-height: 260px;
  overflow: auto;
  overflow-wrap: anywhere;
}

.image-model-intake { display:flex; flex-wrap:wrap; align-items:center; gap:10px; padding:10px 0; font-size:12px; }
.image-model-intake label { display:flex; flex-wrap:wrap; gap:6px; align-items:center; }
.image-model-intake input { max-width:100%; width:210px; font-size:12px; }
.image-model-intake small { flex-basis:100%; opacity:.75; }

/* Chat workspace: keep the live lab and conversation within reach. */
:root { --bg:#0b0d0c; --panel:#121612; --line:#2c332c; --muted:#a0a99c; }
body { overflow:hidden; }
button, summary, a { touch-action:manipulation; }
.app-shell { grid-template-columns:216px minmax(0,1fr); height:100dvh; min-height:0; }
#sidebar { padding:24px 14px 16px; min-height:0; }
.brand { font-size:13px; margin-bottom:25px; }
main { padding:0; min-height:0; height:100dvh; }
.workspace-top { flex:none; height:64px; padding:0 24px; border-bottom:1px solid var(--line); gap:12px; }
#toggle-sidebar { display:block; }
#work-area { display:grid; grid-template-columns:minmax(0,1fr); flex:1; min-height:0; overflow:hidden; }
body.has-lab #work-area { grid-template-columns:minmax(320px,1fr) minmax(340px,400px); }
#lab-workspace { width:100%; max-width:none; min-width:0; min-height:0; margin:0; padding:24px; overflow:auto; scrollbar-gutter:stable; }
.lab-heading { margin-bottom:16px; gap:14px; align-items:center; }
.lab-heading > div { min-width:0; }
.lab-heading h1 { font-size:22px; line-height:1.3; letter-spacing:-.5px; margin:0 0 8px; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.lab-heading .eyebrow { font-size:9px; margin-bottom:7px; }
.lab-description { color:var(--muted); font-size:12px; }
.lab-description summary { cursor:pointer; }
.lab-description p { margin:10px 0 0; }
#tools-button { padding:8px 10px; flex:none; }
#created-simulation { margin:16px 0; }
.simulation-actions { gap:8px; }
.simulation-actions #simulation-summary { flex-basis:100%; font-size:12px; line-height:1.5; }
.simulation-actions button, .simulation-actions a { font-size:11px; padding:8px 10px; border:1px solid var(--line); border-radius:7px; }
.simulation-actions a { margin-left:auto; }
#simulation-view iframe { display:block; height:clamp(450px,calc(100dvh - 260px),800px); border-color:var(--line); }
#chat-panel { display:flex; flex-direction:column; min-width:0; min-height:0; width:100%; max-width:840px; margin:0 auto; }
body.has-lab #chat-panel { max-width:none; border-left:1px solid var(--line); background:#101310; }
.chat-heading { display:flex; align-items:center; gap:12px; padding:20px 22px 14px; flex:none; }
.chat-heading h2 { font-size:15px; font-weight:550; margin:0; }
.chat-heading span { color:var(--muted); font-size:11px; margin-left:auto; }
body:not(.has-lab) .chat-heading { display:none; }
#chat-history { flex:1; overflow:auto; min-height:0; padding:12px 22px; overscroll-behavior:contain; }
body:not(.has-lab) #chat-history { display:flex; flex-direction:column; justify-content:center; }
#welcome { padding:20px 0 0; margin:auto 0 16px; }
#welcome h1 { font-size:clamp(30px,3.7vw,48px); letter-spacing:-1.8px; }
#welcome p { font-size:14px; }
#conversation { margin:0; gap:16px; }
.message { font-size:13px; max-width:96%; margin:0; line-height:1.65; }
.message.user { background:#242c21; border-radius:14px 14px 4px 14px; }
.message.guide { padding:8px 0; color:#c2cbbd; }
#suggested-tools { margin:14px 0; }
#composer-wrap { flex:none; max-width:none; padding:14px 18px max(12px,env(safe-area-inset-bottom)); margin:0; background:var(--bg); border-top:1px solid var(--line); }
body:not(.has-lab) #composer-wrap { border:0; padding:16px 28px 26px; }
#agent-settings { margin:0 0 10px; font-size:12px; }
#agent-settings > summary { display:flex; align-items:center; justify-content:space-between; gap:8px; cursor:pointer; padding:4px 2px; color:var(--muted); list-style:none; }
#agent-settings > summary::-webkit-details-marker { display:none; }
#agent-state::before { content:''; display:inline-block; width:6px; height:6px; margin:0 7px 1px 0; border-radius:50%; background:#858d80; }
#agent-state[data-ready="true"]::before { background:var(--accent); }
.settings-hint { font-size:10px; white-space:nowrap; }
.settings-hint::after { content:' ⌄'; }
#agent-settings[open] { border:1px solid var(--line); border-radius:10px; padding:10px; max-height:220px; overflow:auto; }
#agent-settings[open] .chat-model-controls { padding-top:12px; }
.chat-model-controls { gap:8px; }
.chat-model-controls label { width:100%; }
.chat-model-controls select { flex:1 1 100%; }
#specialist-setting { display:flex; align-items:flex-start; gap:8px; margin-top:10px; font-size:12px; line-height:1.45; }
#allow-specialists { width:1em; height:1em; margin:2px 0 0; padding:0; flex:none; accent-color:var(--accent); }
#model-status { margin:8px 0 0; font-size:11px; }
#prompt-form { padding:12px; border-radius:14px; box-shadow:none; }
#prompt { min-height:66px; max-height:160px; font-size:14px; }
.composer-mode { display:flex; align-items:center; gap:10px; margin:8px 0; font-size:11px; color:var(--muted); }
.composer-mode select { border:0; background:#22291f; font-size:11px; padding:7px 9px; width:auto; max-width:calc(100% - 40px); color:var(--text); }
#attachment-settings { font-size:11px; margin:8px 0 4px; }
#attachment-settings > summary { cursor:pointer; color:#c4cdbd; padding:6px 0; }
#attachment-settings > summary span { color:var(--muted); font-size:10px; margin-left:6px; }
#attachment-settings[open] { max-height:260px; overflow:auto; }
#attachment-settings .image-model-intake { padding:10px 0; }
#attachment-settings select { font-size:12px; }
#attachment-settings small { font-size:10px; }
.composer-bottom { gap:10px; margin-top:6px; }
.composer-bottom #choose-tools { margin-right:auto; font-size:11px; padding:8px; }
.composer-bottom #cancel-create { color:#f0c3aa; background:#34251d; border:1px solid #72513c; padding:8px 12px; }
.composer-bottom #send { width:38px; height:38px; border-radius:10px; }
#chat-stream { margin:0 0 10px; max-height:100px; font-size:12px; }
#activity-status { margin:0 0 10px; font-size:12px; color:var(--accent); }
#notice { font-size:11px; line-height:1.5; margin:8px 0 0; min-height:0; max-height:66px; overflow:auto; }
#notice:empty { display:none; }
.composer-note { font-size:10px; margin:8px 0 0; color:var(--muted); }
.starters { margin:14px 0 0; gap:6px; }
.starters a { font-size:11px; padding:8px; }
#sidebar-backdrop { position:fixed; inset:0; z-index:25; background:#0009; border:0; border-radius:0; }
body.library-collapsed .app-shell { grid-template-columns:0 minmax(0,1fr); }
body.library-collapsed #sidebar { visibility:hidden; overflow:hidden; }
@media (max-width:1100px) and (min-width:761px) {
  body.has-lab #work-area { grid-template-columns:minmax(290px,1fr) 340px; }
  #lab-workspace { padding:18px 14px; }
  .workspace-top { padding:0 16px; }
}
@media (max-width:1000px) {
  .app-shell, body.library-collapsed .app-shell { grid-template-columns:minmax(0,1fr); }
  #sidebar { position:fixed; left:0; top:0; width:265px; z-index:30; box-shadow:20px 0 80px #0008; transform:translateX(-110%); visibility:hidden; transition:transform .18s; }
  body.sidebar-open #sidebar { transform:translateX(0); visibility:visible; }
  #close-sidebar { display:block; position:absolute; top:20px; right:8px; }
}
@media (max-width:760px) {
  .workspace-top { height:56px; padding:0 14px; gap:10px; }
  #workspace-label { font-size:11px; }
  #save-state { display:none; }
  #customize { margin-left:auto; }
  body.has-lab #work-area { display:flex; flex-direction:column; }
  #chat-panel { flex:1; }
  body.has-lab #chat-panel { border-left:0; }
  #lab-workspace { flex:1; padding:18px 14px; }
  .lab-heading { flex-direction:row; }
  .lab-heading h1 { font-size:20px; }
  .lab-heading button { align-self:center; }
  .chat-heading { padding:12px 16px 6px; }
  #chat-history { padding:12px 16px; }
  #composer-wrap, body:not(.has-lab) #composer-wrap { padding:10px 14px max(10px,env(safe-area-inset-bottom)); }
  #welcome { padding:12px 0 0; margin:auto 0; }
  #welcome h1 { font-size:33px; }
  #welcome p { font-size:12px; }
  #prompt { font-size:16px; min-height:58px; }
  .composer-note { display:none; }
  #simulation-view iframe { height:clamp(440px,calc(100dvh - 240px),720px); }
  .simulation-actions a { margin-left:0; }
  #agent-settings[open] { max-height:170px; }
}
@media (max-height:650px) { .welcome-mark, .composer-note, .chat-heading span { display:none; } #welcome h1 { font-size:28px; } #agent-settings[open] { max-height:135px; } #attachment-settings[open] { max-height:150px; } }
@media (prefers-reduced-motion:reduce) { #sidebar { transition:none; } }
/* Expanded setup and attachment panels remain scrollable on short screens. */
#composer-wrap { max-height:calc(100% - 52px); overflow-y:auto; }

/* Keep the photo composer focused while its upload controls are open. */
#attachment-settings > summary, #image-methods > summary { cursor:pointer; width:fit-content; }
#attachment-settings > label, #image-methods select { display:block; margin:8px 0; max-width:100%; }
#attachment-settings input[type=file] { max-width:100%; }
#image-methods { margin-top:8px; font-size:13px; }
#composer-wrap:has(#attachment-settings[open]) :is(#starters,.composer-note,#choose-tools,#agent-settings) { display:none; }
#prompt-form:has(#attachment-settings[open]) .composer-bottom { justify-content:flex-end; }
.composer-bottom #send[data-image] { width:auto; padding:0 14px; font-size:14px; }

/* The conversation and its simulation share one mounted renderer. */
body.has-lab #work-area { display:flex; flex-direction:column; }
body.has-lab #chat-panel, #chat-panel { width:100%; max-width:900px; margin:0 auto; border:0; background:var(--bg); }
#chat-history { padding:18px clamp(12px,3vw,32px); }
#chat-history #lab-workspace { display:block; padding:12px 0; overflow:visible; }
#chat-lab-tools { margin:14px 0; color:var(--muted); font-size:13px; }
.chat-entry { min-width:0; display:flex; flex-direction:column; gap:8px; }
.chat-entry > .message.user { align-self:flex-end; }
.chat-photo { width:100%; margin:3px 0 12px; border:1px solid var(--line); border-radius:12px; overflow:hidden; }
.chat-photo > div:first-child { padding:9px 13px; display:flex; align-items:center; justify-content:space-between; gap:10px; background:var(--panel); }
.chat-photo strong { font-size:13px; font-weight:550; overflow-wrap:anywhere; }
.chat-photo iframe { display:block; width:100%; height:clamp(300px,53dvh,600px); border:0; }
#chat-history #simulation-view iframe { height:clamp(320px,56dvh,650px); }
#composer-wrap,#composer-wrap:has(#scene-upload[open]),body:not(.has-lab) #composer-wrap { padding:10px clamp(12px,3vw,32px) max(12px,env(safe-area-inset-bottom)); }
#prompt-form { padding:10px 12px; }
.composer-bottom { display:flex; align-items:center; gap:8px; }
.composer-bottom #attach-photo { width:42px; height:42px; border-radius:50%; padding:0; font-size:24px; line-height:1; color:var(--text); }
.composer-bottom #attach-example { min-height:42px; padding:0 10px; font-size:12px; }
#example-picker { width:min(460px,calc(100% - 24px)); }
#example-picker header { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:14px; }
#example-picker h2 { margin:0; font-size:17px; }
#example-picker header button { min-width:40px; min-height:40px; padding:0; font-size:20px; }
#example-images { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
#example-images button { display:grid; gap:7px; min-width:0; padding:5px 5px 8px; text-align:left; font-size:12px; }
#example-images img { display:block; width:100%; aspect-ratio:16/10; border-radius:5px; object-fit:cover; background:var(--bg); }
.composer-bottom #chat-model { margin-left:auto; width:auto; min-width:0; max-width:min(57%,240px); font:inherit; font-size:12px; padding:8px; border:1px solid var(--line); border-radius:8px; background:var(--panel); color:inherit; }
.composer-bottom #send,.composer-bottom #send[data-image] { min-width:42px; width:auto; height:42px; padding:0 10px; border-radius:10px; }
#upload-chip:not([hidden]),#photo-context:not([hidden]) { display:flex; width:fit-content; max-width:100%; align-items:center; gap:8px; border:1px solid var(--line); border-radius:8px; padding:4px 6px; margin-bottom:7px; }
#upload-chip span,#photo-context span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:12px; }
#upload-chip img { width:34px; height:34px; border-radius:4px; object-fit:cover; }
#upload-chip button,#photo-context button { padding:2px 7px; }
#scene-upload > label,#attachment-settings > summary,#attachment-controls .image-model-intake > :is(label,img,button) { display:none; }
#attachment-settings:not([open]) { display:none; }
#composer-wrap:has(#attachment-settings[open]) #agent-settings { display:block; }
#composer-wrap:has(#upload-chip:not([hidden])) #starters { display:none; }
#photo-confirm { padding:10px; border:1px solid var(--line); border-radius:10px; }
#photo-confirm span { display:block; margin-bottom:6px; }
#photo-confirm button { padding:7px 12px; }

#chat-stage { margin:12px 0; border:1px solid var(--line); border-radius:12px; overflow:hidden; }
#chat-stage #created-simulation,#chat-stage .chat-photo { margin:0; border:0; padding:0; }
#chat-stage #simulation-view { margin:0; }
#stage-actions { padding:0 12px; background:var(--panel); }
#stage-actions > summary { padding:10px 2px; cursor:pointer; font-size:13px; }
#stage-actions[open] { padding-bottom:10px; }
#studio-shortcuts,#native-actions:not([hidden]) { display:flex; flex-wrap:wrap; align-items:center; gap:6px; margin-bottom:8px; }
#stage-actions button { margin:2px 2px 2px 0; }
#studio-shortcuts button[aria-pressed="true"] { color:var(--accent); background:#242c20; border-color:#3b4931; }
.photo-history > div { display:flex; align-items:center; gap:10px; font-size:12px; }
.photo-history strong { color:var(--muted); font-weight:500; overflow-wrap:anywhere; }
body.has-lab .composer-note { display:none; }

#stage-actions > :is(#chat-lab-tools,#agent-settings) { margin:8px 0 0; padding:6px 0; border:0; }
#stage-actions > #agent-settings > summary { width:fit-content; gap:10px; }
#stage-actions > #agent-settings:not([open]) #agent-state { display:none; }

#show-simulation { align-self:flex-start; margin:12px 0; color:var(--accent); }
dialog#chat-stage {
  position:fixed; inset:0; box-sizing:border-box; width:100%; max-width:none;
  height:100dvh; max-height:none; margin:0; padding:0; border:0; border-radius:0;
  background:var(--bg); color:var(--text);
}
#chat-stage[open] { display:flex; flex-direction:column; }
.stage-bar {
  position:relative; display:flex; align-items:center; gap:8px; padding:8px 12px;
  padding-top:max(8px,env(safe-area-inset-top)); background:var(--panel); border-bottom:1px solid var(--line);
}
#stage-title { flex:1; min-width:0; font-size:14px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
.stage-bar button { flex:none; }
#stage-camera[aria-pressed="true"] { border-color:var(--accent); color:var(--accent); }
#stage-surround-status { flex:none; margin:0; padding:6px 12px; color:var(--muted); background:var(--panel); font-size:12px; }
#chat-stage :is(#created-simulation,#photo-stage):not([hidden]), #chat-stage #simulation-view {
  flex:1; display:flex; min-height:0; flex-direction:column; border-radius:0;
}
#chat-history #chat-stage iframe { width:100%; height:100% !important; flex:1; min-height:0; border:0; border-radius:0; }
#photo-stage > :is(canvas,video), #photo-stage .scene-recording > :is(canvas,video) {
  flex:1; min-height:0; height:0; aspect-ratio:auto !important; max-height:none !important; object-fit:contain;
}
#photo-stage .scene-recording:not([hidden]) { display:flex; flex:1; min-height:0; flex-direction:column; }
#photo-stage > div:last-child, #photo-stage .scene-recording > div:last-child {
  max-height:35dvh; overflow:auto; flex-shrink:0; padding-inline:10px !important;
}
#stage-actions { flex:none; max-height:45dvh; overflow:auto; padding-bottom:env(safe-area-inset-bottom); }
.reconstruction-maps {
  box-sizing:border-box; width:min(94vw,900px); max-height:90dvh; overflow:auto;
  padding:12px; color:var(--text); background:var(--panel); border:1px solid var(--line); border-radius:8px;
}
.reconstruction-maps::backdrop { background:#0009; }
.reconstruction-maps > div { display:flex; flex-wrap:wrap; gap:6px; }
.reconstruction-maps canvas { display:block; width:100%; height:auto; margin:10px 0; }
.reconstruction-maps output { display:block; min-height:1.4em; color:var(--muted); }
#camera-steps { display:none; }
@media (pointer:coarse) {
  #camera-steps:not([hidden]) { flex:none; display:flex; flex-wrap:wrap; gap:4px; padding:4px 8px; background:var(--panel); }
  #camera-steps button { flex:1; min-width:40px; min-height:40px; padding:4px; font-size:12px; }
}

body:not(.has-lab) #chat-panel { justify-content:center; }
body:not(.has-lab) #chat-history { flex:0 1 auto; }
body:not(.has-lab) #composer-wrap { margin-inline:auto; max-width:720px; }
#workspace-options { overflow:auto; flex-shrink:1; min-height:0; font-size:13px; }
#workspace-options > summary { cursor:pointer; padding:8px 0; color:var(--muted); }
#workspace-options > :not(summary) { margin:8px 0; }
#workspace-options select { width:100%; }
#workspace-options #attachment-settings { display:block; }
#workspace-options #attachment-settings > summary { display:list-item; cursor:pointer; }
#workspace-options .composer-mode { display:block; }
#build-screen:not([hidden]) {
  --text: #f5f5f5;
  --muted: #b3b3b3;
  --accent: #f5f5f5;
  --line: #505050;
  position:absolute; inset:0; z-index:5; display:grid; place-items:center; overflow:auto;
  padding:clamp(24px,6vw,56px); text-align:left; color:var(--text);
  background:radial-gradient(ellipse at center, #202020 0%, #131313 48%, #0b0b0b 100%);
}
.build-card { width:min(100%,440px); min-width:0; }
.build-card h1 { margin:0 0 8px; font-size:clamp(26px,4vw,36px); line-height:1.15; letter-spacing:-.04em; }
#build-request { margin:0 0 32px; color:var(--muted); overflow-wrap:anywhere; display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical; overflow:hidden; }
.build-card:has(#build-preview:not([hidden])) #build-request { margin-bottom:16px; }
#build-preview { margin:0 0 20px; }
#build-preview-image {
  height:min(34dvh,290px); border:1px solid var(--line); border-radius:12px;
  overflow:hidden; background:#111;
}
#build-preview-image img { display:block; width:100%; height:100%; object-fit:contain; }
#build-preview-caption { margin-top:8px; color:var(--muted); font-size:13px; }
#build-progress {
  appearance:none; display:block; width:100%; height:6px; border:0; border-radius:6px;
  overflow:hidden; accent-color:var(--accent); background:var(--line);
}
#build-progress::-webkit-progress-bar { background:var(--line); }
#build-progress::-webkit-progress-value { background:var(--accent); border-radius:6px; }
#build-progress::-moz-progress-bar { background:var(--accent); border-radius:6px; }
.build-status { display:flex; align-items:baseline; justify-content:space-between; gap:16px; margin:10px 0 24px; }
#build-detail { margin:0; color:var(--muted); overflow-wrap:anywhere; }
#build-percent { flex:none; font-variant-numeric:tabular-nums; font-weight:600; }
#build-cancel { color:var(--text); background:#242424; }
#build-cancel:hover { background:#333; border-color:#888; }
@media (forced-colors:active) {
  #build-progress { appearance:auto; }
}
body:has(#build-screen:not([hidden])) #chat-stage > .dialog-notice { display:none; }
