:root {
  color-scheme: dark;
  --floor: #151719;
  --panel: #1d2023;
  --raised: #24272b;
  --line: #3a3e43;
  --text: #f0eee9;
  --muted: #b5b8bc;
  --amber: #edba82;
  --on-amber: #231811;
  --error: #f2a8a1;
  --good: #a7c6a9;
  --paper: #dedbd6;
  --ease: cubic-bezier(.2,.75,.25,1);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--floor); color: var(--text); }
h1, h2, h3, p { margin: 0; }
button, textarea, input, select { font: inherit; }
button, a, summary { -webkit-tap-highlight-color: transparent; }
button, .file-trigger { cursor: pointer; }
button:disabled { cursor: default; opacity: .5; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.quiet, .secondary, .primary, .file-trigger {
  min-height: 44px; display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; padding: 8px 12px; border: 1px solid transparent; border-radius: 4px;
  color: var(--text); background: transparent; text-align: center;
  transition: background-color 160ms var(--ease), border-color 160ms var(--ease), opacity 160ms var(--ease);
}
.quiet:hover, .file-trigger:hover { background: var(--raised); }
.secondary, .file-trigger { border-color: var(--line); }
.secondary:hover { background: var(--raised); border-color: var(--muted); }
.primary { font-weight: 660; background: var(--amber); color: var(--on-amber); border-color: var(--amber); }
.primary:hover { background: #fac893; }
.text-link { border: 0; padding: 0 3px; background: transparent; color: var(--amber); cursor: pointer; text-decoration: underline; text-underline-offset: .24em; }
.text-link:hover { color: var(--text); }
.subtle, .hint { color: var(--muted); font-size: .825rem; }
.error-text { color: var(--error); font-size: .9rem; }
input:not([type=file]):not([type=checkbox]), select, textarea {
  background: var(--floor); color: var(--text); border: 1px solid var(--line); border-radius: 4px; padding: 9px 11px; min-height: 44px;
}
input::placeholder, textarea::placeholder { color: #a2a3a5; opacity: 1; }
textarea { display: block; width: 100%; min-height: 292px; resize: vertical; line-height: 1.62; }
.topline { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px max(20px, calc((100vw - 1550px) / 2)); min-height: 66px; border-bottom: 1px solid var(--line); background: var(--panel); }
.wordmark { color: var(--text); font-size: 1.18rem; font-weight: 750; letter-spacing: -.045em; white-space: nowrap; }
.wordmark span { color: var(--amber); }
.top-actions { display: flex; justify-content: flex-end; align-items: center; gap: 5px; }
.account { position: relative; font-size: .88rem; }
.account summary { min-height: 44px; display: flex; align-items: center; gap: 6px; padding: 0 7px 0 10px; cursor: pointer; list-style: none; border-left: 1px solid var(--line); }
.account summary::after { content: ""; width: 6px; height: 6px; border: solid var(--muted); border-width: 0 1px 1px 0; transform: translateY(-2px) rotate(45deg); }
.account summary::-webkit-details-marker { display: none; }
.account div { position: absolute; top: calc(100% + 4px); right: 0; z-index: 12; width: max-content; min-width: 155px; background: var(--raised); border: 1px solid var(--line); border-radius: 4px; padding: 6px; }
.account div a { display: flex; padding: 8px 12px; min-height: 44px; align-items: center; }
.account div a:hover { background: var(--floor); }
.account div button { justify-content: flex-start; width: 100%; }
.shell { max-width: 1590px; margin: 0 auto; padding: 22px 20px 42px; }
.work-heading { min-height: 55px; display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
input.project-title:not([type=file]) { width: min(100%, 460px); border-color: transparent; background: transparent; padding-left: 0; font-size: 1.42rem; font-weight: 690; letter-spacing: -.04em; }
input.project-title:focus { padding-left: 9px !important; }
.workspace { display: grid; grid-template-columns: minmax(205px, .84fr) minmax(300px, 1.32fr) minmax(300px, 1.3fr); align-items: start; border: 1px solid var(--line); background: var(--panel); border-radius: 5px; }
.pane { min-width: 0; min-height: 560px; padding: 15px 16px 18px; }
.pane + .pane { border-left: 1px solid var(--line); }
.section-label { display: flex; align-items: center; justify-content: space-between; gap: 7px; min-height: 40px; }
.section-label h2 { font-size: 1.04rem; letter-spacing: -.025em; line-height: 1.3; }
.section-label h3 { font-size: .95rem; font-weight: 630; }
.section-label span { color: var(--muted); font-size: .78rem; }
.section-label button { font-size: .8rem; min-height: 38px; }
.upload-zone { border: 1px dashed #5b5e63; border-radius: 4px; margin: 3px 0 12px; background: var(--floor); transition: border-color 160ms, background-color 160ms; }
.upload-zone.dragging { border-color: var(--amber); background: var(--raised); }
.upload-zone label { cursor: pointer; min-height: 88px; display: grid; align-content: center; gap: 3px; justify-items: start; padding: 13px; }
.upload-zone label:hover { background: var(--raised); }
.upload-zone label span { color: var(--amber); font-weight: 660; }
.upload-zone label small { color: var(--muted); font-size: .8rem; }
.source-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px,1fr)); gap: 8px; }
.asset { min-width: 0; position: relative; }
.photo-open { display: block; width: 100%; border: 0; padding: 0; cursor: zoom-in; text-align: left; color: var(--text); background: transparent; }
.source-tile, .result-image { display: block; width: 100%; background: var(--paper); object-fit: contain; }
.source-tile { aspect-ratio: 1 / 1; border-radius: 3px; }
.asset-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: .76rem; padding: 5px 1px 2px; }
.remove-asset { position: absolute; top: 3px; right: 3px; width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 3px; background: #151719de; color: var(--text); font-size: 1.35rem; }
.remove-asset:hover { background: var(--floor); color: var(--error); }
.reference-region { margin-top: 18px; padding-top: 9px; border-top: 1px solid var(--line); }
.reference-region .file-trigger { margin-top: 10px; width: 100%; }
#reference-preview .asset { margin-top: 8px; max-width: 160px; }
#upload-state { margin-top: 9px; }
.prompt-pane > .hint { margin: 0 0 9px; }
.prompt-actions, .run-actions, .job-actions, .attempt-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.prompt-actions { margin-top: 6px; }
.prompt-actions button, .job-actions a, .job-actions button, .attempt-actions button { font-size: .78rem; }
.render-options { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 12px; border-top: 1px solid var(--line); padding-top: 10px; margin-top: 8px; }
.render-options label { font-size: .9rem; }
.model-name { color: var(--muted); font: .76rem ui-monospace, Consolas, monospace; grid-column: 1 / -1; padding: 6px 0; }
.run-actions { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); margin-top: 11px; }
.continuing { border-left: 2px solid var(--amber); margin-top: 9px; padding: 3px 0 3px 8px; font-size: .8rem; }
.continuing span { overflow-wrap: anywhere; }
.empty { padding: 24px 10px 24px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: .9rem; }
.empty p + p { margin-top: 5px; }
.live-run { border-left: 2px solid var(--amber); padding: 7px 9px; margin-bottom: 8px; background: var(--raised); color: var(--text); font-size: .84rem; }
.run-card { margin: 0 0 12px; border-top: 1px solid var(--line); padding-top: 7px; }
.run-card:first-child { animation: settle 190ms var(--ease); }
.run-title { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: .84rem; }
.run-title strong { white-space: nowrap; }
.price { text-align: right; color: var(--muted); font-size: .76rem; font-variant-numeric: tabular-nums; }
.prompt-excerpt { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--muted); font-size: .84rem; margin-top: 5px; overflow-wrap: anywhere; }
.attempt-actions { margin: 3px 0 6px; }
.attempt-actions button, .job-actions button, .job-actions a { padding: 6px 7px; }
.jobs { display: grid; grid-template-columns: repeat(auto-fill,minmax(125px,1fr)); gap: 8px; }
.job { background: var(--floor); border-radius: 3px; min-width: 0; }
.result-image { aspect-ratio: 5 / 6; border-radius: 3px 3px 0 0; }
.status-image { display: flex; flex-direction: column; justify-content: center; gap: 6px; padding: 8px; min-height: 100px; border-radius: 3px; background: var(--raised); }
.status-image strong { font-size: .85rem; }
.status-image .hint { font-size: .75rem; }
.job-body { padding: 4px 6px; }
.job-body label { display: flex; align-items: center; min-height: 44px; gap: 5px; font-size: .77rem; }
.job-body input { width: 17px; height: 17px; accent-color: var(--amber); flex: none; }
.job-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.job-body .price { text-align: left; }
.zip-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; font-size: .8rem; }
.fx { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 8px; }
.mobile-tabs { display: none; }
.notice { position: fixed; bottom: max(14px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); z-index: 20; max-width: calc(100% - 28px); width: max-content; padding: 10px 13px; border: 1px solid var(--line); border-left: 2px solid var(--amber); background: var(--raised); border-radius: 4px; font-size: .9rem; }
.notice.error { border-left-color: var(--error); }
.dialog { color: var(--text); background: var(--panel); border: 1px solid var(--line); padding: 0; border-radius: 6px; width: min(760px,calc(100vw - 24px)); max-height: min(90dvh, 900px); }
.dialog::backdrop { background: #0b0c0dcc; }
.dialog[open] { animation: settle 170ms var(--ease); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; gap: 8px; position: sticky; top: 0; z-index: 1; background: var(--panel); border-bottom: 1px solid var(--line); }
.dialog-head h2 { font-size: 1rem; overflow-wrap: anywhere; }
#dialog-content { padding: 13px; }
.dialog-intro { margin: 0 0 8px; }
.dialog-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.dialog-row > :first-child { min-width: 0; overflow-wrap: anywhere; }
.dialog-row .quiet { text-align: left; }
.dialog-row:last-child { border-bottom: 0; }
.dialog-set { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dialog-set label { display: grid; gap: 4px; font-size: .88rem; }
.dialog-set select { width: 100%; }
.detail-photo { display: block; width: 100%; max-height: 70vh; object-fit: contain; background: var(--paper); border-radius: 3px; }
.compare-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.compare-grid img { aspect-ratio: 3 / 4; }
.compare-grid figure { margin: 0; min-width: 0; }
.compare-grid figcaption { font-size: .82rem; color: var(--muted); padding-top: 4px; }
.side-by-side { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0; }
.prompt-copy, .diff { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text); background: var(--floor); border: 1px solid var(--line); border-radius: 4px; padding: 10px; font: .85rem / 1.55 ui-monospace, Consolas, monospace; }
.diff del { color: var(--error); background: #502d2a; }
.diff ins { color: #d6ead7; background: #314438; text-decoration: none; }
.dialog-form { display: grid; gap: 8px; padding-top: 8px; }
.dialog-form button { justify-self: start; }
.gate-page { min-height: 100dvh; display: grid; align-items: center; padding: 20px; }
.gate { width: min(390px,100%); margin: 0 auto; padding: 23px; border: 1px solid var(--line); border-top: 2px solid var(--amber); border-radius: 4px; background: var(--panel); }
.gate h1 { font-size: 1.52rem; letter-spacing: -.04em; margin: 18px 0 12px; }
.gate form { display: grid; gap: 7px; }
.gate form label { margin-top: 4px; font-weight: 550; }
.gate .primary { margin-top: 9px; }
.gate .text-link { padding: 8px 0; }
@keyframes settle { from { opacity: .55; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 1060px) and (min-width: 761px) {
  .workspace { grid-template-columns: minmax(205px,.85fr) minmax(0,1.5fr); }
  .results-pane { grid-column: 1 / -1; min-height: 240px; border-top: 1px solid var(--line); border-left: 0 !important; }
}
@media (max-width: 760px) {
  .topline { min-height: 55px; padding: 5px 11px; }
  .top-actions { gap: 0; }
  .top-actions button, .account summary { font-size: .8rem; padding-inline: 7px; }
  .wordmark { font-size: 1.04rem; }
  .shell { padding: 8px 10px max(29px,env(safe-area-inset-bottom)); }
  .work-heading { margin: 0; min-height: 49px; }
  input.project-title:not([type=file]) { font-size: 1.16rem; min-width: 0; }
  .work-heading .subtle { white-space: nowrap; }
  .workspace { display: block; min-height: 340px; }
  .pane { display: none; min-height: 0; padding: 10px 11px 13px; border: 0 !important; }
  [data-pane=photos] .inputs, [data-pane=prompt] .prompt-pane, [data-pane=results] .results-pane { display: block; animation: settle 170ms var(--ease); }
  .mobile-tabs { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 1px; position: sticky; top: 0; z-index: 3; padding: 2px 0 7px; background: var(--floor); }
  .mobile-tabs button { background: var(--panel); color: var(--muted); border: 1px solid var(--line); border-bottom-width: 2px; padding: 6px 3px; min-height: 44px; cursor: pointer; font-size: .89rem; }
  .mobile-tabs button[aria-current] { color: var(--text); border-bottom-color: var(--amber); }
  #mobile-count { color: var(--amber); margin-left: 2px; font-size: .72rem; }
  textarea { min-height: 205px; }
  .run-actions { position: sticky; bottom: 0; gap: 6px; padding: 8px 0 max(6px,env(safe-area-inset-bottom)); background: var(--panel); }
  .run-actions button { font-size: .9rem; padding-inline: 4px; }
  .editor-keyboard .run-actions { position: static; }
  .dialog-set { grid-template-columns: 1fr; }
  .section-label button { min-height: 44px; }
  .source-list { grid-template-columns: repeat(3,minmax(0,1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
