/* Atrium — one quiet dark surface so the concept images and the office carry the colour.
   Tokens: ink ground, sand text, brass accent (the lamp over a desk), teal for live/working state. */
:root {
  --bg: #0f1514; --bg-2: #161d1c; --bg-3: #1e2726; --line: #2a3533; --line-2: #3a4846;
  --fg: #ece7dc; --fg-2: #a9b3ae; --fg-3: #75827e;
  --brass: #e9b25f; --brass-ink: #1c1407; --live: #5fd0b6; --bad: #f0806a;
  --r: 10px; --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(26px, 4vw, 38px); line-height: 1.12; letter-spacing: -0.02em; font-weight: 650; text-wrap: balance; }
h2 { font-size: 21px; letter-spacing: -0.01em; font-weight: 620; }
h3 { font-size: 15px; font-weight: 620; }
a { color: inherit; }
img { max-width: 100%; display: block; }
.muted { color: var(--fg-2); } .small { font-size: 13px; }
.eyebrow { font: 500 12px/1 var(--mono); letter-spacing: 0.09em; text-transform: uppercase; color: var(--brass); margin-bottom: 8px; }
.row { display: flex; align-items: center; gap: 10px; } .row.between { justify-content: space-between; } .row.wrap, .wrap { flex-wrap: wrap; }

button, .btn { font: inherit; color: var(--fg); background: var(--bg-3); border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 14px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
button:hover, .btn:hover { border-color: var(--fg-3); }
button:disabled { opacity: 0.5; cursor: default; }
button.primary, .btn.primary { background: var(--brass); color: var(--brass-ink); border-color: var(--brass); font-weight: 620; }
button.primary:hover, .btn.primary:hover { filter: brightness(1.08); }
button.ghost, .btn.ghost { background: transparent; border-color: var(--line); color: var(--fg-2); }
button.ghost:hover, .btn.ghost:hover { color: var(--fg); border-color: var(--line-2); }
button.icon { padding: 2px 9px; font-size: 18px; line-height: 1.3; background: transparent; border-color: transparent; color: var(--fg-2); }
button.big { padding: 12px 20px; font-size: 16px; }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
input, textarea { font: inherit; color: var(--fg); background: var(--bg); border: 1px solid var(--line-2); border-radius: 8px; padding: 10px 12px; width: 100%; }
textarea { resize: vertical; min-height: 84px; }
input::placeholder, textarea::placeholder { color: var(--fg-3); }

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 18px; }
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 680; font-size: 17px; letter-spacing: -0.01em; text-decoration: none; }
.page, .landing { max-width: 1120px; margin: 0 auto; padding-left: max(18px, env(safe-area-inset-left)); padding-right: max(18px, env(safe-area-inset-right)); padding-bottom: 80px; }
.headrow { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 18px 0 20px; }
.empty { color: var(--fg-2); padding: 28px 0; }
.notice { background: var(--bg-3); border: 1px solid var(--line-2); border-radius: var(--r); padding: 12px 14px; }

.hero { max-width: 760px; padding-top: 9vh; display: flex; flex-direction: column; gap: 18px; }
.hero h1 { font-size: clamp(34px, 6vw, 58px); }
.lead { font-size: 18px; color: var(--fg-2); max-width: 60ch; }

.newspace { display: flex; gap: 10px; margin-bottom: 22px; flex-wrap: wrap; } .newspace input { flex: 1 1 260px; }
.spaces { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.space { text-decoration: none; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--bg-2); display: flex; flex-direction: column; }
.space:hover { border-color: var(--line-2); }
.space .cover { aspect-ratio: 16 / 9; background: var(--bg-3); display: grid; place-items: center; color: var(--fg-3); }
.space .cover img { width: 100%; height: 100%; object-fit: cover; }
.space .meta { padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.space .meta .muted { font-size: 13px; }

/* studio */
.studio section { margin-bottom: 26px; }
.vibebox { background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.composer { display: flex; flex-direction: column; gap: 10px; }
.composer textarea { font-size: 17px; min-height: 96px; }
.refs { display: flex; flex-direction: column; gap: 8px; } .refs:empty { display: none; }
.ref { display: flex; align-items: center; gap: 10px; } .ref img { width: 72px; height: 48px; object-fit: cover; border-radius: 6px; flex: none; }
.parentchip { display: flex; align-items: center; gap: 10px; background: var(--bg-3); border: 1px solid var(--line-2); border-radius: 8px; padding: 6px 8px; }
.parentchip img { width: 64px; height: 36px; object-fit: cover; border-radius: 4px; } .parentchip span { flex: 1; min-width: 0; }
.examples { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chip { font-size: 13px; padding: 6px 10px; border-radius: 999px; background: transparent; border-color: var(--line); color: var(--fg-2); white-space: normal; text-align: left; }
.round { border-top: 1px solid var(--line); padding-top: 18px; }
.roundhead { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.round blockquote { margin: 0 0 10px; padding-left: 12px; border-left: 2px solid var(--line-2); color: var(--fg-2); max-width: 80ch; white-space: pre-wrap; }
.pill { font: 500 11px/1 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; padding: 5px 8px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--fg-2); }
.pill.generating, .pill.writing, .pill.queued { color: var(--live); border-color: color-mix(in srgb, var(--live) 45%, transparent); }
.pill.failed { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, transparent); }
.variants { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); gap: 16px; margin-top: 12px; }
.variant { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--bg-2); display: flex; flex-direction: column; min-width: 0; }
.variant.picked { border-color: var(--brass); }
.variant .img { aspect-ratio: 16 / 9; width: 100%; padding: 0; border: 0; border-radius: 0; background: var(--bg-3); display: grid; place-items: center; color: var(--fg-3); font-size: 13px; text-align: center; white-space: normal; }
.variant .img img { width: 100%; height: 100%; object-fit: cover; }
.variant.pending .img { background: linear-gradient(100deg, var(--bg-3) 30%, var(--line) 50%, var(--bg-3) 70%); background-size: 300% 100%; animation: shimmer 2.2s linear infinite; }
@keyframes shimmer { to { background-position: -300% 0; } }
.variant.failed .img { color: var(--bad); padding: 12px; }
.vmeta { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.vmeta p { color: var(--fg-2); font-size: 14px; }
.grades { display: flex; gap: 2px; } .grades button { padding: 2px 0; width: 24px; justify-content: center; font: 500 12px/1.6 var(--mono); border-color: transparent; background: transparent; color: var(--fg-3); }
.grades button.on { background: var(--brass); color: var(--brass-ink); }
.job { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.job.running, .job.queued { border-color: color-mix(in srgb, var(--live) 40%, var(--line)); }
.job.failed { border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
.bar { height: 4px; background: var(--bg-3); border-radius: 4px; overflow: hidden; } .bar i { display: block; height: 100%; background: var(--live); transition: width 0.6s; }
.log { margin: 8px 0 0; padding-left: 20px; font: 12.5px/1.6 var(--mono); color: var(--fg-2); max-height: 240px; overflow: auto; }
.log li.status { color: var(--fg); } .log li.fail { color: var(--bad); }
details summary { cursor: pointer; color: var(--fg-2); font-size: 13px; }
.result { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 18px; align-items: start; }
.shots { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; } .shots img { border-radius: 8px; border: 1px solid var(--line); }
.summary { white-space: pre-wrap; font: inherit; color: var(--fg-2); margin: 8px 0; }
@media (max-width: 760px) { .result { grid-template-columns: 1fr; } }

/* sheets */
.backdrop { position: fixed; inset: 0; background: rgb(5 8 8 / 0.72); display: grid; place-items: center; padding: 16px; z-index: 50; overflow: auto; }
.sheet { background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 14px; width: min(100%, 520px); max-height: calc(100vh - 32px); overflow: auto; padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 14px; }
.sheet.wide { width: min(100%, 1060px); }
.sheet header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.lightbox img { width: 100%; border-radius: 8px; } .lightbox p { margin-top: 10px; color: var(--fg-2); }
.buildsheet { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.buildsheet > div { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.buildsheet img.pick { border-radius: 10px; width: 100%; }
@media (max-width: 760px) { .buildsheet { grid-template-columns: 1fr; } }
.program { display: flex; flex-direction: column; gap: 8px; }
.program h3 { margin-top: 6px; }
.dep { display: flex; gap: 8px; align-items: center; } .dep input { flex: 1; min-width: 0; }
.stepper { display: flex; align-items: center; border: 1px solid var(--line-2); border-radius: 8px; flex: none; }
.stepper button { border: 0; background: transparent; padding: 8px 12px; } .stepper span { min-width: 70px; text-align: center; font-variant-numeric: tabular-nums; }
.toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; } .toggle input { width: auto; }

#toasts { position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 90; pointer-events: none; align-items: center; }
.toast { background: var(--fg); color: var(--bg); padding: 9px 14px; border-radius: 8px; font-weight: 550; max-width: 90vw; transition: opacity 0.3s, transform 0.3s; }
.toast.err { background: var(--bad); color: #2a0d07; } .toast.out { opacity: 0; transform: translateY(6px); }

/* the office (3D) */
body.in-world { overflow: hidden; }
#world { position: fixed; inset: 0; }
#world canvas { width: 100%; height: 100%; display: block; }
.hud { position: fixed; z-index: 10; pointer-events: none; }
.hud > * { pointer-events: auto; }
.hud.tl { top: max(12px, env(safe-area-inset-top)); left: max(12px, env(safe-area-inset-left)); display: flex; gap: 8px; align-items: center; }
.hud.tr { top: max(12px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.hud.bl { bottom: max(12px, env(safe-area-inset-bottom)); left: max(12px, env(safe-area-inset-left)); width: min(380px, calc(100vw - 24px)); }
.hud.bc { bottom: calc(max(14px, env(safe-area-inset-bottom)) + 56px); width: max-content; max-width: calc(100vw - 24px); left: 50%; transform: translateX(-50%); }
.glass { background: rgb(15 21 20 / 0.78); border: 1px solid rgb(255 255 255 / 0.1); border-radius: 10px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.hud .title { padding: 7px 12px; font-weight: 620; display: flex; gap: 8px; align-items: center; }
.hud button { background: rgb(15 21 20 / 0.78); border-color: rgb(255 255 255 / 0.12); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.hud button.on { background: var(--live); color: #06231c; border-color: var(--live); }
.people { padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; min-width: 150px; max-height: 40vh; overflow: auto; font-size: 13.5px; }
.people .p { display: flex; align-items: center; gap: 7px; } .people .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.people .p.speaking strong { color: var(--live); }
.chat { display: flex; flex-direction: column; gap: 6px; }
.chatlog { max-height: 30vh; overflow: auto; display: flex; flex-direction: column; gap: 3px; padding: 8px 10px; font-size: 13.5px; }
.chatlog:empty { display: none; }
.chatlog div b { color: var(--brass); font-weight: 600; }
.chat input { background: rgb(15 21 20 / 0.78); border-color: rgb(255 255 255 / 0.12); }
.hint { padding: 8px 14px; font-size: 13.5px; color: var(--fg-2); text-align: center; }
.hint kbd { font: 12px var(--mono); background: var(--bg-3); border: 1px solid var(--line-2); border-radius: 4px; padding: 1px 5px; color: var(--fg); }
#enter { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; background: rgb(8 12 12 / 0.55); cursor: pointer; }
#enter .card { padding: 22px 26px; text-align: center; display: flex; flex-direction: column; gap: 10px; max-width: 420px; }
#loading { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; background: var(--bg); }
#loading .bar { width: 220px; margin-top: 12px; } #loading .bar i { background: var(--brass); }
.tag { position: fixed; z-index: 5; transform: translate(-50%, -100%); pointer-events: none; font-size: 12.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: rgb(15 21 20 / 0.72); border: 1px solid rgb(255 255 255 / 0.14); white-space: nowrap; }
.tag.speaking { border-color: var(--live); color: var(--live); }
.wardrobe { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 18px; }
.wardrobe canvas { width: 220px; height: 320px; border-radius: 10px; background: var(--bg-3); }
.wardrobe .opts { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; } .swatches button { width: 34px; height: 34px; border-radius: 50%; padding: 0; border: 2px solid transparent; }
.swatches button.on { border-color: var(--fg); }
@media (max-width: 560px) { .wardrobe { grid-template-columns: 1fr; } .wardrobe canvas { width: 100%; height: 240px; } }
@media (prefers-reduced-motion: reduce) { .variant.pending .img { animation: none; } .bar i { transition: none; } }
