:root {
  color-scheme: light;
  --ink: #292921;
  --muted: #58584d;
  --deep: #302d24;
  --cream: #fff5e7;
  --serif: "Iowan Old Style", "Baskerville", "Palatino Linotype", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ease: cubic-bezier(.22,.72,.18,1);
  --gutter: clamp(20px,4vw,66px);
  --mast: 86px;
  font-family: var(--sans);
  color: var(--ink);
  background: #8e775b;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100dvh; }
h1,h2,h3,p { margin: 0; }
button,input,textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .66; }
button:focus-visible, input:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 2px solid #374c47; outline-offset: 4px;
}
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.backdrop {
  position: fixed; z-index: -1; inset: 0; pointer-events: none;
  background: #927152 url("studio-light.svg") center / cover no-repeat;
}
.backdrop::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg,#48271a40,transparent 57%),linear-gradient(0deg,#262d2348,transparent 20%,transparent 82%,#2b251b36);
}
.masthead {
  height: var(--mast); margin: 0 var(--gutter); display: flex; align-items: center;
  justify-content: space-between; gap: 16px; border-bottom: 1px solid #ffecda47;
  color: var(--cream);
}
.brand { display: flex; align-items: center; gap: 11px; font: 29px/1 var(--serif); white-space: nowrap; letter-spacing: -.035em; }
.brand-mark { flex: 0 0 auto; opacity: .94; }
.brand i { font-weight: 400; }
.mast-actions { display: flex; align-items: center; gap: 10px; }
.private {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px;
  border: 1px solid #fff4e84f; border-radius: 100px; background: #332e262e;
  font-size: 11px; font-weight: 600; letter-spacing: .03em; white-space: nowrap;
}
.private span,.dot { width: 6px; height: 6px; border-radius: 50%; background: #e7cd90; }
.quiet {
  border: 1px solid #4b403526; border-radius: 100px; padding: 8px 13px;
  color: var(--ink); background: #fff9eb54; font-size: 12px; font-weight: 650;
  transition: background .2s, border-color .2s;
}
.quiet:hover { background: #fff9eba0; border-color: #4b403554; }
.mast-actions .quiet, #retry { border-color: #fff4e857; background: #352e2770; color: var(--cream); }
.mast-actions .quiet:hover, #retry:hover { background: #352e27ae; }
.stage {
  min-height: calc(100dvh - var(--mast) - 58px); max-width: 1380px; margin: auto;
  padding: clamp(40px,7vh,90px) var(--gutter); align-items: center;
}
.stage:not(#boot) { display: grid; grid-template-columns: minmax(0,1fr) minmax(320px,425px); gap: clamp(34px,9vw,146px); }
#boot { display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--cream); }
.boot-label { font-family: var(--serif); font-style: italic; font-size: 22px; }
.editorial { color: var(--cream); max-width: 800px; text-shadow: 0 2px 28px #3b292839; }
.eyebrow {
  display: flex; align-items: center; gap: 10px; font-size: 10px; font-weight: 750;
  letter-spacing: .17em; text-transform: uppercase; line-height: 1.45;
}
.rule { display: inline-block; width: 32px; height: 1px; background: currentColor; opacity: .64; }
.editorial h1 {
  margin: 17px 0 21px; font: 400 clamp(78px,9.4vw,151px)/.83 var(--serif);
  letter-spacing: -.075em;
}
.editorial h1 em { font-weight: 400; color: #fff1d2; }
.stage-welcome h1 { font-size: clamp(64px,7.6vw,121px); line-height: .88; }
.lede { max-width: 390px; color: #fff4e8; font-size: clamp(15px,1.4vw,19px); line-height: 1.56; }
.glass {
  color: var(--ink); border: 1px solid #fff7e9a8;
  background: linear-gradient(154deg,#fff4debb,#f1eee3a8 59%,#dddfd2a6);
  box-shadow: 0 26px 76px #30211525, inset 0 1px 0 #fff9ef86;
  -webkit-backdrop-filter: blur(25px) saturate(.87);
  backdrop-filter: blur(25px) saturate(.87);
}
.signin,.import { padding: clamp(27px,3.6vw,46px); border-radius: 23px; }
.form-index { color: #4f4b3d; margin-bottom: 28px; }
.form-index span { display: inline-block; width: 17px; height: 1px; background: #686150; opacity: .7; }
.glass h2 { font: 400 clamp(35px,3.6vw,50px)/1 var(--serif); letter-spacing: -.065em; }
.support { color: #48463a; margin-top: 11px; line-height: 1.5; font-size: 14px; }
.field { display: grid; gap: 8px; margin-top: 29px; }
.field label { color: var(--ink); font-size: 12px; font-weight: 720; }
.field input, textarea {
  min-width: 0; width: 100%; border: 1px solid #544a3835; border-radius: 11px;
  padding: 12px 14px; color: var(--ink); background: #fffdf461;
}
.field input { min-height: 47px; font-size: 16px; }
.primary {
  display: inline-flex; justify-content: space-between; align-items: center; gap: 9px;
  background: var(--deep); color: #fff6e7; font-weight: 680; font-size: 13px; padding: 13px 16px;
  border: 1px solid #322d24; border-radius: 11px; transition: background .2s, transform .25s var(--ease);
}
.primary:hover { background: #53483a; }
.primary:active { transform: translateY(1px); }
#login-submit { width: 100%; margin-top: 12px; min-height: 47px; }
#login-submit span { font-size: 17px; font-weight: 400; }
.fine { color: #504e40; font-size: 11px; line-height: 1.5; }
.start-blank { display: block; width: 100%; margin-top: 14px; }
.signin .fine { margin-top: 18px; }
.upload-target {
  display: grid; justify-items: center; gap: 9px; width: 100%; text-align: center; padding: 22px 12px;
  margin: 21px 0 13px; border: 1px dashed #5e614d8f; border-radius: 15px; background: #fff8e74f;
  color: var(--ink); transition: background .25s,border-color .25s;
}
.upload-target svg { margin-bottom: 2px; color: #5f5d46; }
.upload-target strong { font-size: 14px; }
.upload-target span { color: #484a3b; font-size: 11px; }
.upload-target:hover,.drop-ready .upload-target { background: #fff8ebc9; border-color: #525d49; }
.error { color: #782c27; font-size: 12px; line-height: 1.4; margin-top: 10px; }
.error:empty { display: none; }
.stage-footer {
  height: 58px; margin: 0 var(--gutter);
  display: flex; align-items: center; gap: 14px; color: #fff3e4; letter-spacing: .14em;
  font-size: 9px; font-weight: 650; white-space: nowrap;
}
.footer-line { height: 1px; background: #fff2e241; flex: 1; }
body[data-screen="workspace"] .stage-footer { display: none; }
.reveal { animation: reveal .63s var(--ease) both; }
.second { animation-delay: .08s; }
@keyframes reveal { from { opacity: 0; transform: translateY(15px) scale(.99); } to { opacity: 1; transform: none; } }
.studio-workspace {
  padding: 0; display: grid; gap: 0; grid-template-columns: clamp(340px,30vw,500px) minmax(0,1fr);
  height: calc(100dvh - var(--mast));
}
/* Workspace: slim top bar, then chat and preview edge to edge. */
body[data-screen="workspace"] { --mast: 46px; }
body[data-screen="workspace"] .masthead { margin: 0; padding: 0 14px; border-bottom: 0; }
body[data-screen="workspace"] .brand { font-size: 19px; gap: 8px; }
body[data-screen="workspace"] .brand-mark { width: 24px; height: 24px; }
body[data-screen="workspace"] .private { padding: 5px 10px; font-size: 10px; }
body[data-screen="workspace"] .mast-actions .quiet { padding: 5px 11px; font-size: 11px; }
#chat,#workspace .preview { min-width: 0; min-height: 0; border-radius: 0; position: relative; box-shadow: none; }
#workspace .glass { border-width: 1px 0 0; }
#chat { border-right: 1px solid #4b403533 !important; }
#chat {
  display: flex; flex-direction: column; padding: 0;
  animation: chat-in .66s .06s var(--ease) both;
}
@keyframes chat-in { from { opacity: 0; transform: translateX(-14px); } to { opacity: 1; transform: none; } }
.panel-head { padding: 15px 20px 11px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel-head .eyebrow { color: #504b3c; font-size: 9px; margin-bottom: 5px; }
.panel-head h2 { font-size: 27px; }
.chat-empty {
  flex: 1; display: grid; align-content: center; justify-items: start; padding: 18px;
  color: var(--ink);
}
.chat-empty h3 { font: 400 23px/1.15 var(--serif); margin: 9px 0 5px; }
.chat-empty p { color: var(--muted); font-size: 13px; line-height: 1.48; }
.chat-orbit { display: grid; place-items: center; width: 33px; height: 33px; border: 1px solid #544a3845; border-radius: 50%; font-size: 19px; }
#chat-empty:not([hidden]) + #history:empty { display: none; }
#older { margin: 0 14px 8px; align-self: start; }
#history { list-style: none; flex: 1; min-height: 0; overflow: auto; margin: 0; padding: 0 20px 8px; }
#history li { border-top: 1px solid #4b403529; padding: 12px 1px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.5; }
#history strong { display: block; font-size: 9px; letter-spacing: .08em; color: #575445; margin-bottom: 4px; }
#history time { float: right; color: #575445; font-weight: 400; font-size: 9px; letter-spacing: 0; }
#history .reply { white-space: normal; }
#history .reply > * { margin: 0 0 7px; }
#history .reply > :last-child { margin-bottom: 0; }
#history .reply ul,#history .reply ol { padding-left: 17px; }
#history .reply ul { list-style: disc; }
#history .reply ol { list-style: decimal; }
#history .reply li { border: 0; padding: 0 0 3px; white-space: normal; font-size: inherit; }
#history .reply .heading { font-weight: 650; }
#history .reply b { font-weight: 650; }
#history .reply code { font: 11.5px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; background: #4b40351a; border-radius: 4px; padding: 1px 4px; }
#history .reply pre { overflow: auto; background: #4b403514; border-radius: 8px; padding: 8px 10px; }
#history .reply pre code { background: none; padding: 0; white-space: pre; }
.gallery { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 7px; }
.gallery img { display: block; width: 53px; height: 53px; border-radius: 7px; object-fit: cover; border: 1px solid #4b40353c; }
#composer { padding: 12px 16px 14px; border-top: 1px solid #4b403525; background: #fff9ee34; }
#composer textarea { display: block; border-radius: 10px; padding: 10px; resize: vertical; min-height: 62px; max-height: 150px; font-size: 14px; }
#composer textarea::placeholder { color: #656353; }
.composer-actions { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 8px; }
.attachment-picker { display: flex; gap: 4px; align-items: center; position: relative; }
.attachment-picker input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.attach { display: inline-flex; align-items: center; gap: 3px; padding: 6px 3px; font-size: 11px; font-weight: 650; cursor: pointer; }
.attachment-picker:focus-within .attach { outline: 2px solid #374c47; outline-offset: 1px; border-radius: 4px; }
#clear-images { padding: 4px 6px; font-size: 10px; }
.send-change { width: 36px; height: 36px; padding: 0; justify-content: center; line-height: 1; font-size: 21px; border-radius: 9px; }
#selected-images { margin-top: 6px; font-size: 10px; color: var(--muted); overflow-wrap: anywhere; }
#selected-images:empty { display: none; }
#chat > .error { padding: 0 14px 10px; }
#chat.drop-ready::after {
  position: absolute; z-index: 2; inset: 6px; display: grid; place-items: center; content: "Drop images here";
  border: 1px dashed #5e614d; border-radius: 13px; background: #fbf3e3ed;
  color: var(--ink); pointer-events: none; font-size: 13px; font-weight: 650;
}
.preview { display: flex; flex-direction: column; overflow: hidden; animation: reveal .6s var(--ease) both; }
.preview-head {
  min-height: 44px; display: flex; align-items: center; gap: 9px; border-bottom: 1px solid #4b40352e;
  font-size: 12px; padding: 9px 15px;
}
.preview-head .dot { background: #5f7660; }
#preview-state { margin-left: auto; color: var(--muted); font-size: 11px; }
iframe { width: 100%; flex: 1; min-height: 0; border: 0; background: #fffcf4; }
#chat-close,#chat-toggle,#chat-backdrop { display: none; }
@media (max-width: 920px) {
  .stage:not(#boot) { gap: 34px; }
  .editorial h1 { font-size: clamp(70px,11vw,112px); }
  .stage-welcome h1 { font-size: clamp(57px,8vw,94px); }
  .studio-workspace { grid-template-columns: minmax(300px,38%) minmax(0,1fr); }
}
@media (max-width: 720px) {
  :root { --mast: 63px; --gutter: 21px; }
  .backdrop { background-position: 39% center; }
  .masthead { gap: 8px; }
  .brand { font-size: 24px; gap: 7px; }
  .brand-mark { width: 30px; height: 30px; }
  .private { display: none; }
  .mast-actions { gap: 6px; }
  .mast-actions .quiet { padding: 7px 10px; font-size: 11px; }
  .stage:not(#boot) { grid-template-columns: 1fr; gap: 23px; align-content: center; padding-block: 26px 30px; }
  .editorial h1 { font-size: clamp(61px,15vw,100px); margin: 10px 0 12px; }
  .stage-welcome h1 { font-size: clamp(57px,12vw,83px); }
  .lede { font-size: 14px; max-width: 310px; }
  .signin,.import { padding: 22px; border-radius: 18px; }
  .form-index { margin-bottom: 14px; }
  .glass h2 { font-size: 37px; }
  .support { margin-top: 7px; font-size: 13px; }
  .field { margin-top: 17px; }
  .signin .fine { margin-top: 12px; }
  .upload-target { padding: 15px 8px; margin-top: 15px; }
  .stage-footer { height: 42px; font-size: 8px; }
  .stage { min-height: calc(100dvh - var(--mast) - 42px); }
  body[data-screen="workspace"] { --mast: 50px; }
  .studio-workspace { display: block; position: relative; overflow: hidden; padding: 0; }
  #chat-toggle,#workspace.show-chat #chat-backdrop { display: block; }
  #workspace .preview { height: 100%; border-radius: 0; }
  #chat { border-right: 0 !important; }
  #chat {
    position: absolute; z-index: 3; bottom: 0; left: 0; right: 0; height: min(68dvh,100%);
    padding-bottom: env(safe-area-inset-bottom); border-radius: 20px 20px 0 0;
    background: linear-gradient(145deg,#fff2dfed,#e4e4d8f6);
    transform: translateY(calc(100% + 10px)); visibility: hidden; animation: none;
    transition: transform .28s var(--ease), visibility 0s linear .28s;
  }
  #workspace.show-chat #chat { transform: translateY(0); visibility: visible; transition-delay: 0s; }
  #chat-backdrop {
    position: absolute; z-index: 2; inset: 0; width: 100%; height: 100%;
    border: 0; background: #29261b57;
  }
  #chat-close { display: block; }
  #composer textarea { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .reveal,#chat,.preview { animation: none !important; }
  #chat,.primary,.quiet { transition: none !important; }
  ::view-transition-group(*) { animation-duration: 0s !important; }
}
::view-transition-old(root) { animation-duration: .18s; }
::view-transition-new(root) { animation-duration: .32s; }
