:root { --creative-accent: #c1f2e5; --panel: #1d2129; --line-soft: #d7e1ff1c; }
#composeModes { display:inline-flex; gap:3px; padding:3px; border-radius:10px; background:#14171d; margin-bottom:12px; }
#composeModes button { padding:6px 12px; font-size:13px; color:#a8b1bd; background:transparent; border-radius:7px; }
#composeModes [aria-pressed="true"] { color:#d6fff3; background:#29413e; }
#bulkHint { font-size:12px; color:#bfccc9; margin:0 0 10px; }
.reference-filename,.bulk-edit .reference-tile input { display:none; }
.bulk-edit .reference-filename,.bulk-result small { display:block; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; font-size:12px; color:#bdc8ce; }
.bulk-result { display:flex; flex-direction:column; align-items:stretch; gap:5px; min-width:0; }
.bulk-result .result { width:100%; }
.bulk-result > button:last-child:not(.result) { align-self:start; font-size:12px; }
.viewTopActions { display:flex; gap:6px; flex-shrink:0; }
#viewer .viewerTop { gap:6px; }
#viewer #viewTitle { min-width:0; }
#viewer #continueImage { color:#ccf6e8; border-color:#6a9e8d; }
#conversationDialog { width:min(920px,96vw); max-width:96vw; max-height:94dvh; padding:0; border-color:#47504f; background:#171b20; color:#edf2f3; }
#conversationDialog[open] { display:flex; flex-direction:column; }
#conversationDialog header { display:flex; align-items:center; justify-content:space-between; padding:14px 20px; border-bottom:1px solid var(--line-soft); }
#conversationDialog h2 { font-size:19px; margin:0; }
#conversationBase { color:#a8bab6; }
.conversation-body { display:grid; grid-template-columns:minmax(155px,30%) minmax(0,1fr); min-height:0; height:52dvh; }
.turn-history,.turn-work { overflow:auto; min-width:0; padding:12px; scrollbar-width:thin; }
.turn-history { border-right:1px solid var(--line-soft); }
#turns { list-style:none; display:grid; gap:5px; margin:0; padding:0; }
#turns button { display:grid; text-align:left; width:100%; gap:4px; background:transparent; }
#turns [aria-current="step"] { background:#263c38; }
#turns strong { font-size:12px; color:#ace1d2; }
#turns span,#turnBranches button { font-size:13px; overflow-wrap:anywhere; white-space:pre-wrap; }
.turn-work { background:#111519; display:flex; flex-direction:column; align-items:stretch; }
#turnImageLink { display:flex; align-items:center; justify-content:center; flex:1; padding:0; background:transparent; min-height:90px; }
#turnImage { max-width:100%; max-height:100%; height:100%; width:100%; object-fit:contain; }
#turnState { align-self:center; margin:auto; font-size:13px; color:#b4c4c3; }
#turnBranches { display:flex; flex-wrap:wrap; gap:5px; padding-top:8px; }
#turnBranches button { max-width:100%; text-align:left; }
#turnState:empty,#turnNotice:empty { display:none; }
#turnForm { padding:12px 20px; border-top:1px solid var(--line-soft); display:grid; gap:6px; }
#turnForm label { font-size:13px; color:#ccdad7; }
#turnPrompt { height:60px; min-height:42px; padding:8px 10px; background:#222932; border:1px solid #ffffff23; border-radius:8px; color:inherit; font:inherit; font-size:14px; }
#turnForm > div { display:flex; align-items:center; justify-content:flex-end; gap:12px; }
#turnForm #turnControls { position:relative; margin:0; flex-wrap:wrap; justify-content:flex-start; gap:5px; }
#turnControls .picker,#turnControls .ratioControl { position:static; }
#turnControls .menu,#turnControls #ratioPanel { left:0; bottom:calc(100% + 6px); transform:none; max-width:100%; max-height:50dvh; overflow:auto; z-index:5; }
#turnControls div { justify-content:start; }
#turnControls :is(#ratioPanel,.menu,.picker,.ratioControl) { display:block; }
#turnControls .ratioGrid { gap:1px; }
#turnVariants { display:flex; gap:6px; overflow-x:auto; padding:7px 2px; flex:none; }
#turnVariants button { display:grid; min-width:82px; flex:none; gap:3px; place-items:center; padding:4px; font-size:11px; }
#turnVariants button[aria-pressed="true"] { outline:2px solid #ace1d2; outline-offset:-2px; }
#turnVariants img { width:76px; height:44px; object-fit:contain; }
#turnNotice { font-size:12px; margin:0 auto 0 0; overflow-wrap:anywhere; }
#sendTurn { flex-shrink:0; background:#b6eddb; color:#102820; }
#sendTurn:disabled { opacity:.45; }
@media(max-width:600px) {
  #conversationDialog { max-height:96dvh; }
  .conversation-body { display:flex; flex-direction:column; height:54dvh; }
  .turn-history { flex:none; max-height:90px; padding:6px; border:0; border-bottom:1px solid var(--line-soft); }
  #turns { display:flex; }
  #turns li { flex:0 0 130px; }
  #turns span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .turn-work { flex:1; min-height:0; }
  #conversationDialog header,#turnForm { padding:9px 12px; }
  #viewer .viewTopActions { gap:3px; }
  #viewer .viewTopActions > * { padding:6px; font-size:12px; }
}
#refTray { display:flex; gap:8px; overflow:auto; padding:2px 2px 6px; scrollbar-width:thin; }
.reference-tile { flex:0 0 122px; min-width:0; position:relative; display:grid; gap:5px; }
.reference-preview { width:100%; height:73px; padding:0; overflow:hidden; background:#161820; }
.reference-preview img { width:100%; height:100%; display:block; object-fit:contain; }
.reference-tile > button:nth-child(2) { position:absolute; right:4px; top:4px; line-height:22px; width:22px; height:22px; border-radius:50%; padding:0; background:#111c; color:white; }
.reference-tile input { width:100%; min-width:0; padding:6px; border-radius:6px; border:1px solid var(--line-soft); background:#11141a; color:inherit; font:inherit; font-size:11px; }
.reference-count { display:block; color:#aeb3c1; font-size:11px; margin-bottom:6px; }
.reference-count:empty { display:none; }
#refLabel.reference-limit { opacity:.4; }
.reference-dialog { max-width:min(720px,94vw); }
.reference-dialog img { width:auto; max-width:100%; display:block; max-height:70dvh; object-fit:contain; margin-bottom:10px; }

#creative { width:min(1060px,100%); margin:auto; padding:clamp(14px,4vw,52px); }
.creative-heading h1 { font-size:clamp(24px,4vw,36px); margin:0; font-weight:600; letter-spacing:.03em; }
.creative-heading p { color:#aeb4c3; font-size:14px; margin:7px 0 24px; }
.creative-form { display:grid; gap:20px; grid-template-columns:minmax(0,1fr) minmax(0,1.04fr); align-items:start; }
.creative-inputs { display:grid; gap:14px; grid-template-columns:repeat(2,minmax(0,1fr)); }
.creative-upload { position:relative; isolation:isolate; display:grid; place-content:center; text-align:center; min-height:205px; aspect-ratio:1; border:1px dashed #9cb5cb70; border-radius:18px; padding:15px; background:#17232a; cursor:pointer; overflow:hidden; }
.creative-upload:nth-child(2) { background:#212339; }
.creative-upload strong { font-size:16px; }
.creative-upload span { color:#b6c4d4; font-size:12px; padding-top:5px; }
.creative-upload input { cursor:pointer; position:absolute; opacity:0; inset:0; width:100%; height:100%; z-index:2; }
.creative-upload img { position:absolute; width:100%; height:100%; inset:0; object-fit:contain; z-index:-1; }
.creative-upload.with-image { align-content:end; text-shadow:0 1px 3px #000; }
.creative-upload.with-image::after { content:""; position:absolute; inset:55% 0 0; background:linear-gradient(transparent,#0f131aea); z-index:-1; }
.creative-upload.with-image span { display:none; }
.creative-upload:focus-within { outline:2px solid var(--creative-accent); outline-offset:3px; }
.creative-fields { min-width:0; }
.creative-fields fieldset { padding:12px; margin:0 0 12px; border:1px solid var(--line-soft); background:#252836a0; border-radius:12px; min-width:0; }
.creative-fields legend { padding:0 5px; color:#d8dfec; }
.copy-row { display:flex; align-items:center; gap:6px; margin-bottom:7px; }
.copy-row textarea { min-height:48px; padding:8px; height:auto; resize:vertical; font-size:14px; border:1px solid var(--line-soft); border-radius:9px; background:#11151d; }
.creative-sizes { display:flex; flex-wrap:wrap; gap:5px 12px; }
.creative-sizes label { display:flex; align-items:center; gap:4px; cursor:pointer; }
.creative-sizes input { accent-color:#aeeada; }
.accent-button { color:#142721; background:var(--creative-accent); font-weight:600; }
.accent-button:hover { color:#101d17; background:#e2fff5; }
#creativeStatus { color:#c1c9d7; margin:0 0 8px; }
#creativeStatus:empty { display:none; }
#creativeWorks { margin-top:18px; }

#creativeEditor { max-width:100%; width:min(1240px,98vw); max-height:96dvh; padding:0; overflow:auto; background:#1c2029; }
#creativeEditor > header { min-height:64px; height:auto; justify-content:space-between; gap:10px; padding:12px 18px; border-bottom:1px solid var(--line-soft); color:#e6ecf5; }
#creativeEditor > header h2 { font-size:17px; margin:0; }
.editor-actions { flex-wrap:wrap; justify-content:flex-end; }
.editor-layout { display:grid; grid-template-columns:minmax(0,1fr) minmax(190px,255px); gap:0; min-height:250px; }
.editor-surface { min-width:0; display:grid; place-items:center; padding:14px; background:#101319; overflow:auto; }
#creativeCanvas { display:block; width:auto; height:auto; max-width:100%; max-height:min(72dvh,900px); touch-action:none; cursor:move; }
#creativeCanvas[data-layer=footer] { cursor:ns-resize; }
.layer-inspector { padding:12px; border-left:1px solid var(--line-soft); }
.layer-inspector h3 { margin:4px 0 8px; font-size:14px; }
.layer-inspector > div { display:grid; gap:7px; justify-content:stretch; }
.layer-inspector .layer-tabs { display:flex; justify-content:stretch; margin-bottom:14px; }
.layer-tabs button { flex:1; padding-inline:6px; white-space:nowrap; }
.layer-tabs button[aria-pressed=true] { background:#425057; color:#dbfdf4; }
.layer-inspector label { display:grid; gap:4px; font-size:12px; color:#dbe2ef; }
.layer-inspector input[type=range] { width:100%; accent-color:#9eddd0; }
.layer-inspector textarea { font-size:14px; height:auto; border:1px solid var(--line-soft); border-radius:8px; resize:vertical; padding:6px; }
#editorStatus { color:#b1c6db; font-size:12px; margin:10px 0 0; }
.creative-caption { display:block; padding:3px 0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:#bcc9dc; font-size:11px; }
.creative-tile .result { aspect-ratio:auto; }
.result .creative-thumb { width:100%; height:auto; object-fit:contain; }
#openLayers { color:#c1f2e5; }
#viewer #openLayers { grid-column:4; }
#viewer #openLayers:not([hidden]) + #editMode { grid-column:5; }

#accountManager { width:min(1040px,96vw); max-width:96vw; max-height:88dvh; padding:20px; background:#222631; }
.manager-heading, .manager-controls { display:flex; align-items:center; flex-wrap:wrap; justify-content:space-between; }
.manager-heading h2 { margin:0 0 8px; font-size:22px; }
#accountManager .manager-controls { justify-content:flex-start; margin:12px 0; }
#accountSearch, #manageName, #manageRole { background:#151923; color:#f1f4fb; border:1px solid var(--line-soft); padding:9px; border-radius:8px; font:inherit; }
#accountManager .manager-table { display:block; max-height:50dvh; overflow:auto; }
.manager-table table { width:100%; border-collapse:collapse; white-space:nowrap; }
.manager-table th, .manager-table td { text-align:left; padding:9px 7px; border-bottom:1px solid var(--line-soft); }
.manager-table th { position:sticky; top:0; background:#222631; color:#b6c6dd; }
.manager-table td:last-child { white-space:normal; }
.manager-table td button { padding:5px 7px; margin:2px; }
#managerStatus { color:#b6c6dd; }
#accountManager details { margin-top:12px; }
#accountManager summary { cursor:pointer; }
#auditRows li { margin:4px 0; }
#employeeAction { width:min(430px,92vw); }
#employeeFields { display:grid; justify-content:stretch; gap:10px; }
#employeeFields label { display:grid; gap:5px; }
#employeeResult code { display:block; user-select:all; margin-top:8px; padding:8px; background:#111820; }
@media (max-width: 760px) {
  #creative { padding:16px; }
  .creative-form { grid-template-columns:1fr; gap:12px; }
  .creative-upload { min-height:120px; max-height:170px; aspect-ratio:auto; }
  .editor-layout { grid-template-columns:1fr; }
  .layer-inspector { border-left:0; border-top:1px solid var(--line-soft); }
  #creativeCanvas { max-height:48dvh; }
  #creativeEditor header { align-items:flex-start; flex-wrap:wrap; }
  #viewer #openLayers, #viewer #openLayers:not([hidden]) + #editMode { grid-column:auto; }
  #viewer .viewerDock:has(#openLayers:not([hidden])) { grid-template-columns:repeat(4,minmax(0,1fr)); }
  .manager-table th, .manager-table td { padding:7px 5px; }
}
@media (max-width:400px) {
  .sidebar nav button { padding-inline:5px; font-size:11px; }
  .sidebar .navGlyph { display:none; }
  .sidebar nav { gap:1px; }
}


/* The ambient scene lives on a fixed, noninteractive layer below every control. */
body { isolation:isolate; }
.aurora {
  position:fixed; z-index:-1; inset:0; overflow:hidden; pointer-events:none;
  background:
    radial-gradient(ellipse at 94% 29%,#1d244c 0%,transparent 54%),
    radial-gradient(ellipse at 10% 72%,#102e32 0%,transparent 55%),#0d111b;
}
.aurora-flow {
  position:absolute; inset:0;
  background:
    radial-gradient(ellipse 52% 11% at 76% 19%,#30a4bd30,transparent 85%),
    radial-gradient(ellipse 66% 16% at 28% 73%,#6465e643,transparent 80%);
}
.aurora-flow canvas {
  display:block; width:100%; height:100%;
  filter:blur(clamp(7px,.72vw,12px));
  transform:scale(1.025);
}
main {
  background:
    radial-gradient(ellipse 42% 39% at 50% 47%,#10131d78,transparent 97%),
    linear-gradient(0deg,#1014218a 0%,transparent 35%,transparent 88%,#10142155);
}
.sidebar { background:#141925e8; }
.sidebar nav button[aria-current=page] { background:#26314b; }
#account, #accountsButton, #providerButton { background:#171d2be8; border:1px solid #c6d9ff2e; color:#f1f5ff; }
#composer { background:linear-gradient(158deg,#232a39,#171c27 70%); border-color:#adbfe75c; }
#composer:before { background:linear-gradient(122deg,#5be1dd28,transparent 45%,#8b78ec32); opacity:.85; }
#notice { color:#e0e8fa; text-shadow:0 1px 7px #101423; }
#assets .composeWrap { background:linear-gradient(transparent,#111521c4 45%,#111521 90%); }
.creative-fields fieldset { background:#202535; }
.creative-heading p, .batch small { color:#d6dfed; }
.batch h2, .creative-heading h1, #assets h1, .hero h1 { text-shadow:0 2px 10px #0a101f; }
@media(max-width:760px) {
  .aurora-flow canvas { opacity:.8; }
  main { background:linear-gradient(0deg,#1014219c,transparent 70%); }
}

.creative-card {
  min-width:0; position:relative; padding:5px;
  border-radius:15px; background:#242a39d4; border:1px solid #a9bdd52e;
  box-shadow:0 5px 20px #080d1e57;
}
.creative-card[data-kind=product] { background:#202e35d4; border-color:#82c5b641; }
.creative-card > input {
  display:block; margin-top:5px; width:100%; padding:6px 7px; color:#ebf1ff;
  background:#0f141d94; border:1px solid #a3adcd28; border-radius:8px; font:inherit; font-size:12px;
}
.creative-card > input:disabled { opacity:.55; }
.creative-card .creative-upload {
  aspect-ratio:4 / 3; min-height:118px; border-radius:10px;
  background:linear-gradient(125deg,#263244,#171d2b);
}
.creative-card[data-kind=product] .creative-upload { background:linear-gradient(125deg,#28413f,#182729); }
.creative-card .creative-upload.with-image { background:#141922; }
.creative-card .creative-upload.with-image strong { background:#141a22b3; border-radius:6px; padding:2px 6px; }
.remove-creative-card {
  position:absolute; top:10px; right:10px; z-index:3; padding:0; width:26px; height:26px;
  line-height:26px; border-radius:50%; background:#0d1519cf; border:1px solid #fff4; color:white;
}
.fusing-form { display:none; }
.fusing-form ~ #creativeWorks { display:none; }
#ceremony {
  min-height:192px; display:grid; grid-template-columns:minmax(260px,1fr) minmax(190px,1fr); align-items:center;
  gap:18px; overflow:hidden; position:relative; margin:0 0 22px; padding:19px;
  border:1px solid #b8c8ef30; border-radius:20px;
  background:radial-gradient(ellipse at 36% 20%,#57599839,transparent 65%),linear-gradient(140deg,#202739,#172628);
}
#creative #ceremony { min-height:270px; justify-items:center; margin-top:12px; }
#ceremonyDeck { position:relative; height:166px; width:100%; perspective:650px; }
#ceremonyDeck i {
  position:absolute; top:50%; left:50%; width:96px; height:123px; margin:-61px 0 0 -48px; display:block;
  border:1px solid #daeefa8c; border-radius:12px; overflow:hidden; box-shadow:0 12px 20px #0006;
  background:#233345; transform:translateX(var(--stack-x,0)) rotate(var(--stack-r,0deg));
}
#ceremonyDeck i:nth-child(1) { --spread-x:-146px; --spread-y:-19px; --spread-r:-17deg; --stack-x:-12px; --stack-r:-13deg; --deal-x:-60px; }
#ceremonyDeck i:nth-child(2) { --spread-x:-52px; --spread-y:21px; --spread-r:-9deg; --stack-x:-4px; --stack-r:-4deg; --deal-x:60px; }
#ceremonyDeck i:nth-child(3) { --spread-x:52px; --spread-y:-14px; --spread-r:11deg; --stack-x:4px; --stack-r:4deg; --deal-x:-37px; }
#ceremonyDeck i:nth-child(4) { --spread-x:146px; --spread-y:21px; --spread-r:17deg; --stack-x:12px; --stack-r:13deg; --deal-x:41px; }
#ceremonyDeck img { display:block; width:100%; height:100%; object-fit:cover; }
#ceremony[data-phase=fusing] #ceremonyDeck i { animation:card-fusion .72s cubic-bezier(.17,.84,.28,.99) both; }
#ceremony[data-phase=dealing] #ceremonyDeck i { animation:card-deal 2.65s ease-in-out infinite; }
#ceremony[data-phase=dealing] #ceremonyDeck i:nth-child(2n) { animation-delay:-.21s; }
#ceremony[data-phase=dealing] #ceremonyDeck i:nth-child(3) { animation-delay:-.47s; }
#ceremony[data-phase=dealing] #ceremonyDeck i::after {
  content:""; position:absolute; inset:0; border-radius:inherit;
  background:repeating-linear-gradient(126deg,#e6fff213 0 1px,transparent 1px 9px),linear-gradient(156deg,#2c41679c,#2b393de6);
}
#ceremony[data-phase=fusing] #ceremonyDeck::before {
  content:""; position:absolute; inset:18% 25%; border-radius:100%;
  background:radial-gradient(ellipse,#a2e1ff57,transparent 70%);
  animation:fusion-lume .72s ease both;
}
.ceremony-message h2 { font-size:clamp(16px,3vw,25px); color:#e9f6ff; margin:0 0 5px; font-weight:600; }
.ceremony-message p { color:#a7cdd1; margin:0 0 9px; font-variant-numeric:tabular-nums; }
#openReveal { background:#c4f4e7; color:#19332c; }
@keyframes card-fusion {
  from { transform:translate(var(--spread-x),var(--spread-y)) rotate(var(--spread-r)); }
  55% { opacity:1; }
  to { transform:translateX(var(--stack-x)) rotate(var(--stack-r)) scale(.90); }
}
@keyframes fusion-lume { 0%,100% { opacity:0; transform:scale(.6) } 70% { opacity:.85; transform:scale(1.7) } }
@keyframes card-deal {
  0%,25%,100% { transform:translateX(var(--stack-x)) rotate(var(--stack-r)); }
  40% { transform:translate3d(var(--deal-x),-15px,30px) rotate(var(--spread-r)) rotateY(19deg); }
  65% { transform:translate3d(calc(-1 * var(--deal-x)),8px,8px) rotate(calc(-1 * var(--spread-r))); }
  84% { transform:translateX(var(--stack-x)) rotate(var(--stack-r)); }
}

#creativeReveal {
  border:0; border-radius:0; margin:0; padding:0; position:fixed; inset:0;
  width:100vw; height:100dvh; max-width:none; max-height:none;
  background:radial-gradient(ellipse at 50% 33%,#272d3af4,#0c1115fa 78%); overflow:auto;
}
#creativeReveal .reveal-frame { width:100%; min-height:100%; padding:18px; display:grid; place-content:center; justify-items:center; }
#revealArt {
  display:block; max-width:min(86vw,1280px); max-height:77dvh; width:auto; height:auto;
  box-shadow:0 22px 80px #0008;
}
#creativeReveal.awaiting-art #revealArt { visibility:hidden; }
#creativeReveal.revealed #revealArt { animation:reveal-art .56s cubic-bezier(.15,.8,.3,1) both; }
#creativeReveal.revealed::after {
  content:""; position:absolute; inset:0; pointer-events:none;
  background:radial-gradient(ellipse 55% 48% at 50% 44%,#dbfcff3d,transparent 78%);
  animation:reveal-light .59s ease-out both;
}
#creativeReveal .reveal-footer { align-items:center; justify-content:center; flex-wrap:wrap; margin-top:10px; gap:8px; }
#creativeReveal .reveal-caption { display:grid; text-align:center; gap:0; min-width:10ch; max-width:65vw; }
#revealTitle { font-size:14px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
#revealCounter { font-size:12px; color:#b3bdd2; font-variant-numeric:tabular-nums; }
@keyframes reveal-art { from { opacity:0; transform:scale(.94) translateY(10px) } to { opacity:1; transform:none } }
@keyframes reveal-light { 0%,100% { opacity:0; } 23% { opacity:.65; } }

#editTools #editReferenceTray {
  display:flex; justify-content:flex-start; gap:6px; overflow-x:auto; padding:5px 0; scrollbar-width:thin;
}
#editReferenceTray .reference-tile { flex:0 0 105px; }
#viewer #editReferenceTray .reference-preview { height:56px; padding:0; }
#editReferenceTray .edit-reference-number {
  position:absolute; inset:34px auto auto 4px; padding:2px 5px; border-radius:4px;
  color:#eef3f3; background:#111d; font-size:11px;
}
#editReferenceTray .reference-tile > button:nth-child(2) { inset:2px 2px auto auto; }
#editRefLabel {
  background:#253d3e; border-radius:7px; color:#c7f6e5; font-size:12px;
  display:inline-flex; align-items:center; padding:0 8px; min-height:34px;
  white-space:nowrap; cursor:pointer;
}
#editRefLabel:focus-within { outline:2px solid #99f1d6; }
#editRefLabel:has(input:disabled) { opacity:.42; cursor:default; }
#editRefLabel input { position:absolute; opacity:0; width:1px; height:1px; }
@media(max-width:760px) {
  #ceremony { grid-template-columns:1fr; text-align:center; gap:3px; min-height:200px; padding:10px; }
  #ceremonyDeck { height:140px; transform:scale(.76); }
  .creative-card .creative-upload { min-height:100px; }
}
@media(prefers-reduced-motion:reduce) {
  #ceremonyDeck i, #ceremonyDeck::before, #creativeReveal.revealed #revealArt,
  #creativeReveal.revealed::after { animation:none!important; }
  #creativeReveal.revealed::after { display:none; }
}


:root {
  color-scheme:light;
  font:14px/1.55 "PingFang SC","Hiragino Sans GB","Microsoft YaHei",sans-serif;
  --serif:"Songti SC","STSong","Noto Serif CJK SC",Georgia,serif;
  --canvas:#f8f5ef;
  --surface:#fffcf8;
  --panel:#fbf7f1;
  --paper:#f0e9df;
  --vellum:#e8ded2;
  --ink:#281d19;
  --muted:#68564e;
  --subtle:#785f53;
  --line:#6b473425;
  --line-soft:#6b47342b;
  --edge:#fffdf9e8;
  --glass:#fffdf6a3;
  --glass-raised:#fffdf8e5;
  --sheen:#fffdfce6;
  --ambient:#dcc3aa56;
  --ambient-rose:#a94b4517;
  --accent:#6f2431;
  --accent-hover:#8b3444;
  --on-accent:#fff9f3;
  --accent-wash:#f1e0df;
  --accent-text:#702837;
  --danger:#982e33;
  --shadow:0 18px 44px #4b2b1c13,0 3px 12px #4b2b1c0b;
  --glass-shadow:inset 0 1px 1px var(--sheen),inset 0 -1px 2px #8969521a,0 8px 24px #4b2b1c14;
  --creative-accent:var(--accent);
  --content-width:1160px;
  background:var(--canvas);
  color:var(--ink);
}
@media (prefers-color-scheme:dark) {
  :root[data-appearance=system] {
    color-scheme:dark;
    --canvas:#1d1716;
    --surface:#2b221f;
    --panel:#2a211e;
    --paper:#342724;
    --vellum:#483630;
    --ink:#f6ede4;
    --muted:#d8c4b8;
    --subtle:#c4ad9e;
    --line:#f8dbc32e;
    --line-soft:#f8dbc32e;
    --edge:#f4d3b52b;
    --glass:#302321bb;
    --glass-raised:#3f2e2be6;
    --sheen:#f4d3b54a;
    --ambient:#81514038;
    --ambient-rose:#b5545c26;
    --accent:#e4a2aa;
    --accent-hover:#f4b1ba;
    --on-accent:#36131a;
    --accent-wash:#583138;
    --accent-text:#ffc5cd;
    --danger:#ffb2b5;
    --shadow:0 18px 44px #100b0a55,0 3px 12px #100b0a38;
    --glass-shadow:inset 0 1px 1px var(--sheen),inset 0 -1px 2px #160b0855,0 8px 24px #0c080844;
  }
}
body {
  display:block;
  color:var(--ink);
  background:
    radial-gradient(ellipse at 8% 0%,var(--ambient),transparent 48%),
    radial-gradient(ellipse at 94% 15%,var(--ambient-rose),transparent 52%),
    var(--canvas);
}
main { background:transparent; }
button,a,select { transition:background-color .18s,color .18s,border-color .18s; }
button,a { border-radius:11px; background:var(--paper); }
button:hover,select:hover,a:hover { background:var(--vellum); }
button:disabled { cursor:default; }
button:focus-visible, select:focus-visible, a:focus-visible, textarea:focus-visible,
#viewer button:focus-visible, #viewer a:focus-visible, #editTools :is(input,textarea):focus-visible {
  outline:2px solid var(--accent);
  outline-offset:3px;
}
button:active:not(:disabled) { transform:translateY(1px); }
/* Transfer the focus indicator to the shape users see as the control. */
#prompt:focus,.appearance select:focus { outline:none; }
#composer:has(#prompt:focus-visible) {
  border-color:color-mix(in srgb,var(--accent) 54%,var(--edge));
  box-shadow:inset 0 0 0 1px var(--edge),var(--glass-shadow),var(--shadow);
}
.appearance:has(select:focus-visible) {
  outline:2px solid var(--accent);
  outline-offset:2px;
}
.examples button:focus-visible {
  outline:2px solid var(--accent);
  outline-offset:-3px;
}
@media(forced-colors:active) {
  #composer:has(#prompt:focus-visible),.appearance:has(select:focus-visible) {
    outline:2px solid Highlight;
    outline-offset:2px;
  }
}
textarea::placeholder,input::placeholder { color:var(--subtle); }
option { color:var(--ink); background:var(--surface); }
input[type=checkbox],input[type=range],progress { accent-color:var(--accent); }

.studio-header {
  position:sticky;
  top:0;
  z-index:10;
  display:block;
  height:auto;
  padding:12px clamp(12px,2.2vw,32px) 0;
  color:var(--ink);
}
.studio-header-inner {
  width:min(100%,1460px);
  margin:auto;
  min-width:0;
  display:grid;
  grid-template-columns:minmax(136px,1fr) auto minmax(0,1fr);
  gap:14px;
  align-items:center;
  padding:7px clamp(14px,2.4vw,32px);
  border-radius:36px;
  border:1px solid var(--edge);
  background:linear-gradient(152deg,var(--glass-raised),var(--glass) 33%,var(--glass) 66%,var(--glass-raised));
  box-shadow:inset 0 1px 2px var(--sheen),inset 0 -1px 1px var(--sheen),0 9px 28px #4726161a;
  -webkit-backdrop-filter:saturate(145%) blur(18px);
  backdrop-filter:saturate(145%) blur(18px);
}
.studio-brand {
  display:flex;
  gap:9px;
  align-items:center;
  min-width:0;
  color:var(--ink);
  font:700 25px/1 var(--serif);
  letter-spacing:.06em;
  white-space:nowrap;
}
.studio-brand img { flex:none; object-fit:contain; }
#studioNav,.appearance,.studio-actions :is(#account,#accountsButton,#providerButton) {
  border:1px solid var(--edge);
  background:linear-gradient(160deg,var(--glass-raised),var(--glass) 64%);
  box-shadow:var(--glass-shadow);
  -webkit-backdrop-filter:saturate(165%) blur(11px);
  backdrop-filter:saturate(165%) blur(11px);
}
#studioNav {
  display:flex;
  justify-self:center;
  margin:0;
  gap:2px;
  padding:4px;
  border-radius:999px;
}
#studioNav button {
  display:flex;
  min-height:42px;
  align-items:center;
  justify-content:center;
  gap:6px;
  padding:0 clamp(10px,1.6vw,23px);
  color:var(--muted);
  font-size:13px;
  font-weight:650;
  white-space:nowrap;
  border-radius:999px;
  background:transparent;
}
#studioNav .navGlyph { display:inline-grid; width:16px; font-size:15px; }
#studioNav button:hover { background:var(--glass-raised); color:var(--ink); }
#studioNav button[aria-current=page] {
  background:linear-gradient(160deg,var(--accent-hover),var(--accent) 67%);
  color:var(--on-accent);
  box-shadow:inset 0 1px 0 #fff8f052,0 2px 7px #4827192b;
}
.studio-actions {
  display:flex;
  justify-content:flex-end;
  flex-wrap:wrap;
  align-items:center;
  gap:6px;
}
.studio-actions :is(#account,#accountsButton,#providerButton) {
  padding:0 12px;
  min-height:38px;
  border:1px solid var(--edge);
  border-radius:99px;
  color:var(--ink);
  font-size:12px;
  line-height:1.25;
  text-align:center;
  margin:0;
  white-space:nowrap;
}
.studio-actions :is(#account,#accountsButton,#providerButton):hover { background:var(--glass-raised); }
.appearance { position:relative; display:flex; align-items:center; gap:4px; min-height:38px; padding:0 8px 0 10px; border-radius:99px; color:var(--accent-text); cursor:pointer; }
.appearance::after {
  content:"";
  position:absolute;
  inset-inline-end:11px;
  width:5px;
  height:5px;
  border-inline-end:1.4px solid currentColor;
  border-block-end:1.4px solid currentColor;
  transform:translateY(-1px) rotate(45deg);
  pointer-events:none;
}
.appearance select { appearance:none; color:var(--ink); background:transparent; padding:4px 14px 4px 0; font-size:12px; border:0; border-radius:99px; }

#workspace { min-height:calc(100dvh - 79px); justify-content:flex-start; padding:0 0 18px; }
.hero,.composeWrap { width:min(var(--content-width),calc(100% - 80px)); }
.hero {
  flex:0 0 auto;
  margin:0 auto;
  padding:clamp(48px,7.4vh,92px) 0 0;
}
.hero h1 {
  margin:0 0 clamp(28px,4.7vh,48px);
  color:var(--ink);
  font:700 clamp(34px,4.8vw,58px)/1.20 var(--serif);
  letter-spacing:.025em;
  text-shadow:none;
}
.examples { gap:clamp(10px,2vw,25px); }
.examples button {
  background:var(--surface);
  color:var(--ink);
  border:1px solid var(--line);
  border-radius:12px;
  box-shadow:0 5px 18px #61351d0b;
}
.examples button:hover { background:var(--surface); border-color:var(--accent); }
.examples img { height:auto; aspect-ratio:3/2; object-position:center; }
.examples button span,
.examples button:nth-child(2) span,
.examples button:nth-child(3) span {
  margin-top:0;
  height:auto;
  min-height:40px;
  padding:11px 15px 4px;
  background:none;
  text-shadow:none;
  font:700 19px/1.2 var(--serif);
}
.examples em { background:none; color:var(--accent-text); border-color:var(--line); border-radius:99px; font:600 11px/1.4 "PingFang SC",sans-serif; padding:3px 8px; }
.examples small { color:var(--muted); padding:4px 15px 12px; }
.composeWrap { margin:clamp(20px,4vh,40px) auto 0; }
#composer {
  border:1px solid var(--edge);
  border-radius:24px;
  padding:14px 17px 13px;
  background:linear-gradient(154deg,var(--glass-raised),var(--glass) 38%,var(--glass) 71%,var(--glass-raised));
  box-shadow:inset 0 0 0 1px var(--edge),var(--glass-shadow),var(--shadow);
  -webkit-backdrop-filter:saturate(140%) blur(12px);
  backdrop-filter:saturate(140%) blur(12px);
}
#composer::before { display:none; }
#composeModes,.segments,.ratioGrid,.dimensions label { background:var(--paper); }
#composeModes { border-radius:999px; gap:2px; margin:0 0 11px; }
#composeModes button { color:var(--muted); border-radius:999px; }
#composeModes [aria-pressed=true],.segments [aria-pressed=true],.menu [aria-pressed=true],.ratioOpt[aria-pressed=true] {
  color:var(--accent-text);
  background:var(--accent-wash);
}
.inputrow { align-items:flex-start; gap:12px; }
.inputrow textarea { color:var(--ink); height:60px; font-size:15px; border-radius:12px; }
#refLabel {
  margin:0;
  width:48px; height:48px;
  transform:none;
  border:1px dashed var(--line-soft);
  border-radius:12px;
  background:var(--paper);
  color:var(--accent-text);
}
#refLabel:focus-within,#editRefLabel:focus-within { outline-color:var(--accent); }
.toolbar { margin-top:9px; gap:7px; }
.toolbar :is(select,.picker>button),#ratioTrigger {
  min-height:34px;
  color:var(--ink);
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:99px;
}
#submit,.accent-button,#login,#authSubmit,#providerSave,#sendTurn,#openReveal,#editTools #applyEdit {
  color:var(--on-accent);
  background:var(--accent);
  font-weight:650;
}
#submit { display:inline-flex; gap:8px; justify-content:center; width:auto; min-height:38px; padding:0 15px; border-radius:99px; font-size:13px; }
#submit:hover,.accent-button:hover,#login:hover,#authSubmit:hover,#providerSave:hover,#sendTurn:hover,#openReveal:hover,#editTools #applyEdit:hover {
  background:var(--accent-hover);
  color:var(--on-accent);
}
#notice { color:var(--muted); text-shadow:none; min-height:0; margin:9px 0 0; }
#notice:empty { display:none; }
.menu,#ratioPanel { color:var(--ink); background:var(--surface); border-color:var(--line-soft); box-shadow:var(--shadow); }
.menu>button:hover,.ratioOpt:hover { background:var(--paper); }
#ratioPanel p,.menu p,.dimensions,.reference-count,#bulkHint,.bulk-result small,.reference-filename { color:var(--muted); }
.dimensions input { color:var(--ink); }

#assets,#creative { width:min(var(--content-width),calc(100% - 80px)); max-width:none; padding:34px 0 16px; margin:0 auto; }
#assets { min-height:calc(100dvh - 79px); }
#assets h1,.creative-heading h1 { font:700 clamp(29px,3vw,43px)/1.22 var(--serif); color:var(--ink); text-shadow:none; margin:0 0 15px; }
#items:empty { border-top:1px solid var(--line); }
.batch { border-top:1px solid var(--line); padding-top:15px; }
.batch h2 { font-weight:650; color:var(--ink); text-shadow:none; }
.batch small,.creative-heading p,.card small,#fileInfo { color:var(--muted); }
.card,.result { background:var(--surface); border-color:var(--line); }
.card img,.reference-preview { background:var(--paper); }
.result:is(.queued,.generating,.saving):after { background:linear-gradient(140deg,var(--paper),var(--vellum),var(--accent-wash),var(--paper)); }
#assets .composeWrap { background:linear-gradient(transparent,var(--canvas) 52%); }
.creative-heading p { margin:0 0 23px; }
.creative-form { gap:24px; }
.creative-card,.creative-card[data-kind=product],.creative-fields fieldset {
  color:var(--ink);
  background:var(--surface);
  border-color:var(--line);
  box-shadow:none;
}
.creative-card .creative-upload,.creative-card[data-kind=product] .creative-upload {
  background:linear-gradient(145deg,var(--paper),var(--surface));
  color:var(--ink);
  border-color:var(--line-soft);
}
.creative-card .creative-upload span,.creative-fields legend,#creativeStatus { color:var(--muted); }
.creative-card .creative-upload.with-image strong { color:#fff9f3; }
.creative-card .creative-upload.with-image { background:var(--paper); }
.creative-upload:focus-within { outline-color:var(--accent); }
.creative-fields legend { font-weight:650; }
:is(.creative-card>input,.copy-row textarea,.reference-tile input,#turnPrompt,#credentialForm input,
    #providerForm input,#providerForm select,#accountSearch,#manageName,#manageRole,.layer-inspector textarea,#editTools textarea) {
  color:var(--ink);
  background:var(--surface);
  border-color:var(--line-soft);
}
dialog,#conversationDialog,#creativeEditor,#accountManager,#creativeReveal,#viewer[open] {
  background:var(--surface);
  color:var(--ink);
  border-color:var(--line-soft);
}
dialog::backdrop { background:#26181276; }
dialog h2,.manager-heading h2 { color:var(--ink); }
#gateText,#credentialForm label,#providerStatus,#managerStatus,#editorStatus,#turnForm label,
#conversationBase,#turnState,#viewTitle,#editStatus,#revealCounter,.creative-caption,.ceremony-message p { color:var(--muted); }
#authError { color:var(--danger); }
#accountManager .manager-table th { background:var(--panel); color:var(--muted); }
#employeeResult code,.turn-work,.editor-surface { background:var(--paper); }
#turns strong,#openLayers,#viewer #continueImage,#viewer #editMode { color:var(--accent-text); }
#turns [aria-current=step],.layer-tabs button[aria-pressed=true] { color:var(--accent-text); background:var(--accent-wash); }
#turnVariants button[aria-pressed=true],#filmstrip button[aria-pressed=true] { outline-color:var(--accent); }
#creativeEditor>header,.layer-inspector label { color:var(--ink); }
#ceremony { background:var(--paper); border-color:var(--line); }
.ceremony-message h2 { color:var(--ink); }
#ceremonyDeck i { background:var(--vellum); border-color:var(--edge); }
#ceremony[data-phase=dealing] #ceremonyDeck i::after { background:var(--accent-wash); }
#viewer #stage { background:var(--panel); border-radius:12px; }
#viewer :is(button,a) { color:var(--ink); background:var(--paper); }
#viewer :is(button,a):hover { background:var(--vellum); }
#viewer .viewerBack { background:transparent; }
#viewer .viewerDock { padding:4px 8px; border-radius:18px; border:1px solid var(--edge); background:var(--glass); box-shadow:var(--glass-shadow); }
#viewerStatus { color:var(--ink); background:var(--glass-raised); }
#editTools #selectionTools,#editTools #editRefLabel { color:var(--accent-text); background:var(--paper); }
#viewer #selectionTools [aria-pressed=true],#viewer #editRegions [aria-pressed=true],#viewer #redrawRegion[aria-pressed=true] {
  color:var(--on-accent);
  background:var(--accent);
}
#viewer #deleteRegion { color:var(--danger); }
#editTools .region-actions { border-color:var(--line-soft); }

@media(max-width:900px) {
  .studio-header-inner { grid-template-columns:auto auto 1fr; gap:8px; }
  .studio-brand { font-size:22px; }
  .studio-brand img { width:33px; height:33px; }
  #studioNav button { padding-inline:12px; }
  .hero,.composeWrap,#assets,#creative { width:calc(100% - 44px); }
}
@media(max-width:650px) {
  .studio-header { padding:7px 8px 0; }
  .studio-header-inner { grid-template-columns:auto minmax(0,1fr); row-gap:6px; padding:7px 9px; border-radius:22px; }
  .studio-brand { gap:5px; font-size:19px; }
  .studio-brand img { width:27px; height:27px; }
  #studioNav { justify-self:end; }
  #studioNav button { min-height:36px; padding:0 9px; font-size:12px; gap:3px; }
  #studioNav .navGlyph { display:none; }
  .studio-actions { grid-column:1 / -1; }
  .studio-actions :is(#account,#accountsButton,#providerButton),.appearance { min-height:34px; padding-inline:8px; }
  #workspace { min-height:calc(100dvh - 94px); }
  .hero,.composeWrap,#assets,#creative { width:calc(100% - 26px); }
  .hero { padding:39px 0 0; }
  .hero h1 { font-size:35px; margin-bottom:24px; }
  .examples { gap:10px; padding:2px 0 6px; scrollbar-width:thin; }
  .examples button span { font-size:17px; }
  .composeWrap { margin-top:20px; }
  #composer { padding:11px; border-radius:18px; }
  .toolbar { gap:5px; }
  .toolbar :is(select,.picker>button),#ratioTrigger { font-size:11px; }
  #submit { padding-inline:10px; }
  #assets,#creative { padding-top:25px; }
  .creative-form { gap:15px; }
}
@media(max-width:370px) {
  .studio-header { padding-inline:6px; }
  .studio-header-inner { padding-inline:7px; }
  #studioNav button { padding-inline:7px; }
  .hero h1 { font-size:29px; }
  .toolbar :is(select,.picker>button),#ratioTrigger { padding-inline:5px; }
  #submit { min-height:34px; }
}
@media(prefers-reduced-motion:reduce) {
  .examples button:hover,button:active:not(:disabled) { transform:none; }
}
