@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
  color-scheme: light;
  --paper: #f2f2ed;
  --panel: #fbfbf7;
  --ink: #202b29;
  --muted: #7e8880;
  --line: #dedfd7;
  --green: #245c4b;
  --green-bright: #83d2a3;
  --orange: #e6764f;
  --mono: 'DM Mono', 'Courier New', monospace;
  --sans: 'Manrope', 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body { background: var(--paper); color: var(--ink); font-family: var(--sans); }
button, input, textarea { font: inherit; }
button { color: inherit; }

.workspace { width: 100%; height: 100%; display: flex; flex-direction: column; }
.topbar { height: 58px; flex: 0 0 58px; display: flex; align-items: center; padding: 0 26px; border-bottom: 1px solid var(--line); background: var(--panel); }
.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; font-size: 13px; font-weight: 800; letter-spacing: 0; }
.brand-light { color: var(--green); font-weight: 500; }
.brand-mark { width: 19px; height: 19px; position: relative; display: inline-block; transform: rotate(-30deg); }
.brand-mark i { position: absolute; width: 8px; height: 8px; background: var(--green); }
.brand-mark i:nth-child(1) { left: 1px; top: 5px; }
.brand-mark i:nth-child(2) { right: 1px; top: 1px; background: var(--orange); }
.brand-mark i:nth-child(3) { right: 1px; bottom: 1px; background: #88a78e; }
.project-name { margin-left: 52px; font: 10px var(--mono); letter-spacing: 0; color: #65716a; }
.live-dot, .hud-live { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #64a983; vertical-align: 1px; }
.top-separator { color: #c5c9c0; padding: 0 8px; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 15px; font: 10px var(--mono); }
.model-select { max-width: 205px; height: 28px; padding: 0 7px; border: 1px solid var(--line); border-radius: 0; outline: 0; background: var(--panel); color: var(--green); font: 9px var(--mono); }
.model-select:focus { border-color: #749d87; }
.top-divider { height: 14px; width: 1px; background: var(--line); }
.status-pill { color: #65716a; }

.workbench { min-height: 0; flex: 1; display: grid; grid-template-columns: 330px minmax(0, 1fr); }
.prompt-panel { position: relative; display: flex; flex-direction: column; padding: 31px 27px 20px; overflow-y: auto; background: var(--panel); border-right: 1px solid var(--line); }
.panel-kicker, .field-label, .viewport-overline, .prompt-meta, .panel-footer, .viewport-footer { font-family: var(--mono); font-size: 9px; letter-spacing: 0; }
.panel-kicker { color: #65716a; }
.panel-kicker span { color: var(--orange); margin-right: 8px; }
.prompt-panel h1 { margin: 27px 0 31px; font-size: 43px; line-height: 0.99; font-weight: 600; letter-spacing: 0; }
.prompt-panel h1 em { color: var(--green); font-family: Georgia, serif; font-weight: 400; }
.field-label { display: flex; justify-content: space-between; color: #52615a; }
.unit { color: #98a098; }
.dimensions { display: flex; align-items: center; gap: 11px; margin-top: 11px; }
.dimension-input { display: flex; height: 43px; flex: 1; align-items: center; border: 1px solid var(--line); background: #fff; }
.dimension-input:focus-within { border-color: #749d87; }
.dimension-input input { min-width: 0; width: 100%; padding: 0 0 0 12px; border: 0; outline: 0; color: var(--ink); background: transparent; font: 17px var(--mono); appearance: textfield; }
.dimension-input input::-webkit-inner-spin-button, .dimension-input input::-webkit-outer-spin-button { appearance: none; margin: 0; }
.dimension-input span { padding: 0 11px; color: #8d978f; font: 9px var(--mono); }
.dimension-cross { color: #9aa198; font: 13px var(--mono); }
.saved-scenes { display: grid; gap: 7px; margin-top: 17px; padding-top: 12px; border-top: 1px solid var(--line); }
.object-name-input, .saved-object-picker select { min-width: 0; width: 100%; height: 34px; padding: 0 9px; border: 1px solid var(--line); border-radius: 0; outline: 0; background: #fff; color: var(--ink); font-size: 11px; }
.object-name-input:focus, .saved-object-picker select:focus { border-color: #749d87; }
.object-name-input::placeholder { color: #9da69f; }
.saved-object-picker { display: flex; min-width: 0; gap: 6px; }
.saved-object-picker select { flex: 1; text-overflow: ellipsis; }
.refresh-objects-button { flex: 0 0 34px; height: 34px; padding: 0; border: 1px solid var(--line); background: transparent; color: var(--green); font: 16px var(--mono); cursor: pointer; }
.refresh-objects-button:hover { border-color: #749d87; background: #f0f5ef; }
.saved-object-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.saved-object-actions button { min-width: 0; height: 32px; border: 1px solid #cfd7ce; background: transparent; color: #52615a; font: 9px var(--mono); cursor: pointer; }
.saved-object-actions button:hover { border-color: #749d87; background: #f0f5ef; color: var(--green); }
.saved-object-actions button:disabled { opacity: .55; cursor: progress; }
.prompt-form { margin-top: 31px; }
.prompt-form textarea { width: 100%; min-height: 123px; margin-top: 11px; padding: 13px 13px; resize: vertical; outline: 0; border: 1px solid var(--line); border-radius: 0; background: #fff; color: var(--ink); font: 13px/1.65 var(--sans); }
.prompt-form textarea:focus { border-color: #749d87; }
.prompt-form textarea::placeholder { color: #9da69f; }
.reference-block { margin-top: 13px; }
.custom-texture-picker { display: flex; align-items: center; gap: 6px; margin-top: 7px; }
.custom-texture-picker input { flex: 1; min-width: 0; font-size: 11px; }
.custom-texture-picker button:disabled { opacity: .5; cursor: default; }
.reference-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.reference-heading .field-label { flex: 1; }
.upload-button { height: 27px; padding: 0 8px; border: 1px solid var(--line); background: transparent; color: var(--green); font: 9px var(--mono); cursor: pointer; }
.upload-button:hover { border-color: #749d87; background: #f0f5ef; }
.upload-button span { margin-right: 3px; font-size: 13px; }
.reference-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.reference-list:empty { display: none; }
.reference-thumb { position: relative; width: 42px; height: 42px; border: 1px solid var(--line); background: #e7e9e2; }
.reference-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.remove-reference { position: absolute; top: 1px; right: 1px; width: 17px; height: 17px; padding: 0; border: 0; background: rgba(25, 34, 30, .84); color: #fff; font: 14px/17px var(--sans); cursor: pointer; }
.remove-reference:hover { background: var(--orange); }
.prompt-meta { display: flex; justify-content: space-between; margin-top: 9px; color: #89938b; font-size: 8px; }
.generate-button { width: 100%; height: 46px; display: flex; align-items: center; gap: 10px; margin-top: 18px; padding: 0 13px; border: 0; background: var(--green); color: white; text-align: left; cursor: pointer; transition: background 160ms ease; }
.generate-button:hover { background: #1b4b3b; }
.generate-button:disabled { opacity: .66; cursor: not-allowed; }
.button-symbol { color: #b6e2c6; font-size: 19px; line-height: 1; }
.generate-button #buttonLabel { font-size: 12px; font-weight: 700; }
.button-shortcut { margin-left: auto; color: #b6cec1; font: 9px var(--mono); }
.material-library { margin-top: 20px; padding-top: 12px; border-top: 1px solid var(--line); }
.material-library[hidden] { display: none; }
.material-library-heading { display: flex; justify-content: space-between; color: #65716a; font: 8px var(--mono); }
.material-library-heading span:last-child { color: #98a098; }
.material-list { display: grid; gap: 4px; max-height: 194px; overflow-y: auto; margin-top: 8px; }
.material-item { display: flex; width: 100%; min-width: 0; align-items: center; gap: 9px; padding: 4px; border: 1px solid transparent; background: transparent; text-align: left; cursor: pointer; }
.material-item:hover, .material-item:focus-visible { border-color: #b7c8b9; background: #f0f3ed; outline: 0; }
.material-swatch { flex: 0 0 42px; width: 42px; height: 34px; border: 1px solid #d5d9d0; object-fit: cover; }
.material-labels { display: flex; min-width: 0; flex-direction: column; gap: 3px; }
.material-name { overflow: hidden; color: var(--ink); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.material-type-label, .material-empty { color: #89938b; font: 8px var(--mono); text-transform: uppercase; }
.material-empty { padding: 8px 4px; text-transform: none; }
.panel-footer { display: flex; align-items: center; gap: 8px; margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line); color: #879188; font-size: 8px; }
.geometry-counts { display: flex; gap: 9px; color: #89938b; font: 8px var(--mono); white-space: nowrap; }
.geometry-counts b { color: #405048; font-weight: 500; }
.footer-mark { width: 7px; height: 7px; border: 1px solid #9fa99f; }
.clear-button { margin-left: auto; padding: 5px 0 5px 8px; border: 0; background: transparent; color: #68756c; font: 9px var(--mono); cursor: pointer; }
.clear-button:hover { color: var(--orange); }

.viewport-panel { min-width: 0; min-height: 0; display: flex; flex-direction: column; padding: 0 23px 15px; background: var(--paper); }
.viewport-head { height: 68px; flex: 0 0 68px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.viewport-heading { display: flex; flex-direction: column; gap: 4px; }
.viewport-overline { color: #88938a; font-size: 8px; }
.viewport-title { font-size: 14px; font-weight: 700; }
.render-mode { display: flex; align-items: center; border: 1px solid #d5d9d0; background: #f8f8f3; }
.render-mode button { height: 29px; padding: 0 9px; border: 0; border-right: 1px solid #d5d9d0; background: transparent; color: #65716a; font: 8px var(--mono); cursor: pointer; }
.render-mode button:last-child { border-right: 0; }
.render-mode button[aria-pressed="true"] { background: var(--green); color: #fff; }
.render-mode button:hover:not([aria-pressed="true"]) { background: #e8eee7; color: var(--green); }
.viewport-actions { display: flex; align-items: center; gap: 7px; }
.settings-button { width: 34px; height: 32px; padding: 0; border: 1px solid #d5d9d0; background: transparent; color: #5b6860; font-size: 15px; cursor: pointer; }
.settings-button:hover { border-color: #82978a; color: var(--green); }
.reset-button { padding: 8px 10px; border: 1px solid #d5d9d0; background: transparent; color: #5b6860; font: 9px var(--mono); cursor: pointer; }
.reset-button:hover { border-color: #82978a; color: var(--green); }
.reset-button span { margin-left: 7px; font-size: 13px; }
.canvas-wrap { position: relative; min-height: 0; flex: 1; overflow: hidden; background: #202a28; }
#sceneCanvas { width: 100%; height: 100%; display: block; outline: 0; }
.canvas-hud { position: absolute; top: 14px; left: 14px; display: flex; gap: 9px; align-items: center; padding: 8px 10px; background: rgba(15, 23, 21, .78); color: #cfdbd0; font: 9px var(--mono); pointer-events: none; }
.hud-live { background: var(--green-bright); box-shadow: 0 0 8px rgba(131, 210, 163, .65); }
.canvas-axis { position: absolute; bottom: 16px; left: 17px; width: 45px; height: 45px; border-left: 1px solid #e67954; border-bottom: 1px solid #8ad2a4; pointer-events: none; font: 9px var(--mono); }
.axis-x { position: absolute; left: 48px; bottom: -5px; color: #f09977; }
.axis-z { position: absolute; left: -5px; bottom: 48px; color: #9de0b4; }
.axis-y { position: absolute; left: -6px; bottom: -13px; color: #d6ddd4; }
.toast { position: absolute; left: 50%; bottom: 24px; max-width: min(520px, calc(100% - 32px)); padding: 11px 15px; transform: translate(-50%, 12px); opacity: 0; background: #f8f6ef; color: #33423a; font-size: 12px; line-height: 1.5; box-shadow: 0 5px 24px #10171444; pointer-events: none; transition: opacity 180ms ease, transform 180ms ease; }
.toast.visible { transform: translate(-50%, 0); opacity: 1; }
.toast.error { border-left: 3px solid var(--orange); }
.texture-dialog { width: min(560px, calc(100% - 32px)); max-width: 560px; padding: 20px; border: 1px solid #cfd4ca; background: var(--panel); color: var(--ink); box-shadow: 0 20px 70px #10171466; }
.texture-dialog::backdrop { background: rgba(15, 23, 21, .68); }
.texture-dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.texture-dialog-heading h2 { margin: 4px 0 0; font-size: 18px; font-weight: 600; }
.texture-type { color: var(--green); font: 9px var(--mono); text-transform: uppercase; }
.close-texture-dialog { width: 30px; height: 30px; padding: 0; border: 1px solid var(--line); background: transparent; color: var(--ink); font: 20px/1 var(--sans); cursor: pointer; }
.close-texture-dialog:hover { border-color: var(--orange); color: var(--orange); }
.texture-preview { display: grid; min-height: 220px; place-items: center; overflow: hidden; background: #e7e9e2; }
.texture-preview img { display: block; width: min(100%, 512px); aspect-ratio: 1; object-fit: contain; image-rendering: pixelated; }
.texture-dialog-footer { margin-top: 12px; color: #89938b; font: 8px var(--mono); }
.scene-settings-dialog { width: min(390px, calc(100% - 32px)); }
.scene-settings-dialog .texture-dialog-heading { margin-bottom: 20px; }
.settings-field { display: flex; align-items: center; justify-content: space-between; gap: 16px; color: #52615a; font-size: 12px; }
.settings-field + .settings-field { margin-top: 18px; }
.settings-field input[type="color"] { width: 48px; height: 34px; padding: 2px; border: 1px solid var(--line); background: #fff; cursor: pointer; }
.fog-strength-field { flex-wrap: wrap; }
.fog-strength-field > span { display: flex; width: 100%; justify-content: space-between; }
.fog-strength-field b { color: var(--green); font: 10px var(--mono); }
.fog-strength-field input[type="range"] { width: 100%; accent-color: var(--green); }
.viewport-footer { height: 35px; flex: 0 0 35px; display: flex; align-items: end; justify-content: space-between; color: #7d8981; font-size: 8px; }
.viewport-footer b { color: #405048; font-weight: 500; }
.footer-center { margin-left: 42px; }

@media (max-width: 760px) {
  html, body { min-height: 100%; height: 100%; overflow: auto; }
  .workspace { min-height: 100%; height: auto; }
  .topbar { height: 52px; flex-basis: 52px; padding: 0 16px; }
  .project-name { margin-left: 18px; font-size: 8px; }
  .top-right { gap: 9px; font-size: 9px; }
  .model-select { max-width: 150px; height: 26px; font-size: 8px; }
  .workbench { flex: 1; grid-template-columns: 1fr; grid-template-rows: auto minmax(390px, 58vh); }
  .prompt-panel { padding: 21px 19px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .prompt-panel h1 { margin: 17px 0 20px; font-size: 35px; }
  .prompt-form { margin-top: 20px; }
  .prompt-form textarea { min-height: 82px; }
  .panel-footer { margin-top: 18px; }
  .viewport-panel { padding: 0 12px 12px; }
  .viewport-head { display: grid; height: 82px; flex-basis: 82px; grid-template-columns: 1fr auto; grid-template-rows: 1fr 1fr; gap: 2px 8px; padding: 7px 0; }
  .viewport-heading { grid-column: 1; grid-row: 1; }
  .render-mode { grid-column: 1; grid-row: 2; justify-self: start; }
  .render-mode button { height: 25px; padding: 0 7px; font-size: 7px; }
  .viewport-actions { grid-column: 2; grid-row: 1 / 3; flex-direction: column; align-items: flex-end; justify-content: center; gap: 4px; }
  .footer-center { margin-left: 0; }
}

@media (max-width: 390px) {
  .project-name { margin-left: 11px; font-size: 7px; }
  .top-right { gap: 6px; font-size: 8px; }
  .model-select { max-width: 122px; padding: 0 4px; font-size: 7px; }
  .brand { gap: 7px; font-size: 11px; }
  .viewport-footer { font-size: 7px; }
}
