/* The same hierarchy in the editor, composition, photo and account. */
:root[data-studio-page=editor]{--studio-rail:64px;--r-lg:12px;--r-xl:18px;--studio-highlight:var(--soft);--studio-highlight-ink:var(--accent-text)}
[data-studio-page=editor] .btn{border-radius:7px;background:var(--panel)}
[data-studio-page=editor] .btn.primary:not(.publication-publish){background:var(--accent)}
:root .btn.primary.publication-publish{--accent:#c62d36;--accent-hover:#ad202b;--accent-ink:#fff;background:#c62d36;border-color:#c62d36;color:#fff}
:root .btn.primary.publication-publish:hover:not(:disabled){background:#ad202b;border-color:#ad202b;color:#fff}
:root .btn.primary.publication-publish:active:not(:disabled){background:#941a24;border-color:#941a24}
[data-studio-page=editor] .workspace{padding-left:calc(var(--studio-rail) + 8px)}
.studio-navigation{position:fixed;z-index:12;top:var(--topbar-h);left:0;bottom:0;width:var(--studio-rail);display:flex;flex-direction:column;gap:8px;padding:15px 6px;background:var(--panel);border-right:1px solid var(--line)}
.studio-navigation button{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;width:100%;min-height:54px;padding:7px 2px;border-radius:8px;font-size:10px;line-height:1.2;color:var(--muted)}
.studio-navigation svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}
.studio-navigation button:hover{background:var(--sunken);color:var(--ink)}
.studio-navigation button[aria-pressed=true]{background:var(--studio-highlight);color:var(--studio-highlight-ink)}
.studio-navigation button:last-child{margin-top:auto}
.topbar>.spaces{display:none}
.topbar #projects-button,.topbar #appearance-presets-button{display:none}
[data-studio-page=editor] #setup-dialog.as-space{left:var(--studio-rail);width:calc(100vw - var(--studio-rail))}
[data-studio-page=editor] .sidebar{width:206px;padding:18px 12px}
[data-studio-page=editor] .inspector{width:292px;padding:0 18px 18px}
.setup-inspector{padding:0 18px 18px}
[data-studio-page=editor] .project-heading h2{font-size:19px}
[data-studio-page=editor] .add-button{border-radius:7px;margin:15px 0 20px}
.inspector-tabs{border:0;border-bottom:1px solid var(--line);background:var(--panel);border-radius:0;margin:0 -18px 18px;padding:0 10px;gap:2px;box-shadow:0 0 0 1px var(--panel)}
.inspector-tabs button{border-radius:0;border-bottom:2px solid transparent;padding:10px 3px 11px;gap:7px;font-size:11px;min-height:58px}
.inspector-tabs button[aria-selected=true]{background:transparent!important;box-shadow:none;border-bottom-color:var(--accent)}
.inspector-tabs span{display:block!important;white-space:normal;overflow-wrap:anywhere;line-height:1.3}
.setup-inspector .inspector-tabs{margin-inline:-18px}
.studio-panel-group,.studio-panel-details{min-width:0;margin:0 0 20px}
.studio-panel-group>h3{font-size:12px!important;font-weight:600;margin:0 0 12px!important;line-height:1.5}
.studio-panel-body{display:flow-root;min-width:0}
.studio-panel-body>section.scene-options{padding:0;border:0;margin:0}
.studio-panel-details{border-top:1px solid var(--line);padding-top:12px}
.studio-panel-details>summary{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:32px;list-style:none;font-size:12px;font-weight:500;cursor:pointer}
.studio-panel-details>summary::-webkit-details-marker{display:none}
.studio-panel-details>summary:after{content:'⌄';font-size:16px;color:var(--muted);line-height:1}
.studio-panel-details[open]>summary:after{transform:rotate(180deg)}
.studio-panel-details[open]>.studio-panel-body{padding-top:16px}
.studio-panel-body>.section-label:first-child{border:0;padding:0;margin-top:0}
.studio-panel-body>.note:last-child{margin-bottom:0}
.studio-panel-details .studio-panel-details{margin-top:12px}
.inspector>.preset-scope-bar{padding:12px;border-radius:8px;background:var(--sunken);margin:0 0 18px}
.inspector>.preset-scope-bar .preset-section-title{display:none}
.inspector>.preset-scope-bar .preset-links{margin-top:6px}
.inspector>.preset-scope-bar .preset-scope-actions{gap:5px}
.inspector>.preset-scope-bar .btn{font-size:11px;padding:6px 8px}
.studio-light-choices{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:7px;margin:0 0 18px}
.studio-light-choices button{display:flex;flex-direction:column;align-items:center;gap:9px;border:1px solid var(--line);border-radius:8px;padding:12px 5px;font-size:10.5px;line-height:1.35;text-align:center;min-width:0}
.studio-light-choices button[aria-pressed=true]{background:var(--soft);border-color:var(--accent);box-shadow:inset 0 0 0 .5px var(--accent)}
#appearance-presets-dialog .preset-library-list{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px}
#appearance-presets-dialog .preset-library-card{border-radius:9px;padding:0 14px 14px;overflow:hidden;min-width:0;display:flex;flex-direction:column}
.studio-preset-art{display:grid;place-items:center;height:114px;background:var(--sunken);margin:0 -14px 14px}
.studio-preset-art>span{width:65px;height:65px}
#appearance-presets-dialog .preset-card-actions{margin-top:auto;display:flex;flex-direction:column;align-items:stretch}
#appearance-presets-dialog .preset-card-actions>.studio-panel-details{width:100%;margin:10px 0 0}
#appearance-presets-dialog .preset-card-actions .studio-panel-body{display:grid;gap:7px}
#appearance-presets-dialog .preset-card-actions .btn{white-space:normal;text-align:center}
.studio-photo-navigation{display:flex;gap:8px;border-bottom:1px solid var(--line);margin:0 0 18px}
.studio-photo-navigation button{flex:1;padding:10px 4px;border-bottom:2px solid transparent;font-size:12px;color:var(--muted)}
.studio-photo-navigation button[aria-pressed=true]{border-bottom-color:var(--accent);color:var(--ink);font-weight:600}
.studio-photo-export{font-size:12px;color:var(--muted);line-height:1.6}
.studio-account-nav{display:flex;gap:8px;flex-wrap:wrap;margin:20px 0}
.studio-account-nav button{font:inherit;padding:10px 15px;border:1px solid var(--line,#e0e3e9);border-radius:7px;background:var(--panel,#fff);color:var(--ink,#242936);cursor:pointer}
.studio-account-nav button[aria-pressed=true]{background:var(--soft,#edf1f6);border-color:var(--accent,#57677f)}
.studio-account-content>.card[hidden]{display:none}
.studio-preset-bar{padding:0!important;border:0!important;border-top:1px solid var(--line)!important;border-radius:0!important;background:transparent!important;margin:0 0 15px!important}
.studio-preset-bar>summary{display:flex;justify-content:space-between;align-items:center;gap:8px;min-height:36px;font-size:11px;cursor:pointer;list-style:none}
.studio-preset-bar>summary::-webkit-details-marker{display:none}
.studio-preset-bar>summary:after{content:'⌄';color:var(--muted)}
.studio-preset-bar[open]>summary:after{transform:rotate(180deg)}
.studio-preset-bar>.preset-scope-actions{padding:8px 0 12px}
.studio-photo-view[hidden],.studio-photo-export[hidden]{display:none!important}
@media(max-width:1100px){:root[data-studio-page=editor]{--topbar-h:56px}[data-studio-page=editor] .topbar{padding-top:0;align-items:center;display:flex;justify-content:space-between}[data-studio-page=editor] .global-history{position:static;transform:none;margin-right:auto}}
@media(max-width:700px){
 [data-studio-page=editor] .sidebar{width:56px;padding:10px 5px}
 [data-studio-page=editor] .sidebar :is(.project-heading,.project-meta,.side-label,.etext,.elements-heading,.reorder){display:none!important}
 [data-studio-page=editor] .sidebar .add-button{font-size:0;padding:0;justify-content:center;height:38px}
 [data-studio-page=editor] .sidebar .add-button span{font-size:20px}
 [data-studio-page=editor] .sidebar .element-item{justify-content:center;padding:8px 2px}
 [data-studio-page=editor] .editor-main{overflow:auto;scrollbar-width:thin}
 [data-studio-page=editor] .scene-row{flex:none;flex-direction:column}
 [data-studio-page=editor] .canvas-area{height:340px;min-height:300px;flex:none}
 [data-studio-page=editor] .inspector{height:auto;overflow:visible;flex:none}
 [data-studio-page=editor] .element-toolbar{height:auto;min-height:64px;flex-wrap:wrap;padding:12px;gap:10px;flex-shrink:0}
 [data-studio-page=editor] .element-toolbar h2{font-size:16px}
 [data-studio-page=editor] .element-actions{flex-wrap:wrap}
 [data-studio-page=editor] .inspector-tabs{position:static;flex-wrap:wrap}
 [data-studio-page=editor] .inspector-tabs button{flex:1 1 45%;min-height:40px}
 [data-studio-page=editor] .global-history{gap:2px}
 [data-studio-page=editor] .global-history .btn{min-width:26px;width:26px;padding:5px}
}
@media(max-width:1150px){[data-studio-page=editor] .sidebar{width:180px}[data-studio-page=editor] .inspector{width:275px}.inspector-tabs button{padding-inline:2px}.inspector-tabs span{font-size:10px}}
@media(max-width:900px){:root[data-studio-page=editor]{--studio-rail:56px}[data-studio-page=editor] .sidebar{width:155px}[data-studio-page=editor] .inspector{width:256px;padding-inline:14px}.inspector-tabs{margin-inline:-14px}.studio-navigation button{font-size:9px}#appearance-presets-dialog .preset-library-list{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:700px){:root[data-studio-page=editor]{--studio-rail:0px;--studio-nav-h:58px}.studio-navigation{top:var(--topbar-h);bottom:auto;width:100%;height:var(--studio-nav-h);flex-direction:row;padding:3px 5px;gap:3px;border-right:0;border-bottom:1px solid var(--line)}.studio-navigation button{flex:1;width:auto;min-width:0;min-height:48px;padding:5px 2px;gap:5px;font-size:9px}.studio-navigation button:last-child{margin:0}.studio-navigation svg{width:17px;height:17px}[data-studio-page=editor] .workspace{padding-left:6px;padding-top:var(--studio-nav-h)}[data-studio-page=editor] #setup-dialog.as-space{top:calc(var(--topbar-h) + var(--studio-nav-h));height:calc(100dvh - var(--topbar-h) - var(--studio-nav-h));left:0;width:100%}[data-studio-page=editor] .inspector{width:100%;padding:14px 18px}.inspector-tabs{margin-inline:-18px}.inspector-tabs span{font-size:11px}.inspector-tabs button{min-height:46px;flex-direction:row;justify-content:center;gap:6px}.studio-navigation{z-index:12}#appearance-presets-dialog .preset-library-list{grid-template-columns:1fr}.studio-light-choices{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media(pointer:coarse){.studio-panel-details>summary,.studio-photo-navigation button,.studio-light-choices button{min-height:44px}.studio-account-nav button{min-height:44px}}
@media(prefers-reduced-motion:reduce){.studio-navigation *,.studio-panel-details *{transition:none!important}}
@media(max-width:700px){
 [data-studio-page=editor] .sidebar{width:56px;padding:10px 5px}
 [data-studio-page=editor] .inspector-tabs{flex-wrap:nowrap}
 [data-studio-page=editor] .inspector-tabs button{flex:1 1 0;min-width:0;min-height:56px;flex-direction:column;gap:5px}
 [data-studio-page=editor] .inspector-tabs span{font-size:10px}
}
/* Surface and lighting tiles share the original slate chrome. The sample
   colours describe the preset; selection and focus use the app palette. */
.render-preset-list,.lighting-presets,.studio-material-choices,.studio-light-choices{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin:8px 0 14px}
.render-preset-list .studio-visual-choice,.lighting-presets .studio-visual-choice,.studio-material-choices .studio-visual-choice,.studio-light-choices .studio-visual-choice{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:flex-start;gap:3px;min-width:0;min-height:120px;padding:8px 5px 12px;border:1px solid var(--line);border-radius:9px;background:var(--panel);color:var(--ink);white-space:normal;text-align:center;font-size:11px;font-weight:500;line-height:1.4;transition:background-color .16s,border-color .16s,box-shadow .16s}
.studio-visual-choice>.studio-swatch{display:block;width:100%;height:74px;max-width:118px;flex:none;overflow:visible}
.studio-visual-choice>strong,.studio-visual-choice>span{font:inherit;line-height:1.4;min-width:0;max-width:100%;white-space:normal;overflow-wrap:anywhere}
.material-library-choice span{min-width:0;overflow-wrap:anywhere}
.render-preset-list .studio-visual-choice small{display:none}
.render-preset-list .studio-visual-choice[aria-pressed=true],.lighting-presets .studio-visual-choice[aria-pressed=true],.studio-material-choices .studio-visual-choice[aria-pressed=true],.studio-light-choices .studio-visual-choice[aria-pressed=true]{border-color:var(--accent);background:var(--soft);box-shadow:inset 0 0 0 .5px var(--accent)}
.studio-visual-choice[aria-pressed=true]:after{content:'✓';position:absolute;right:5px;top:5px;display:grid;place-items:center;width:16px;height:16px;border-radius:50%;background:var(--accent);color:var(--accent-ink);font-size:10px;line-height:1}
.render-presets>.note{font-size:11px;line-height:1.6;min-height:34px;margin:8px 0 12px}
.render-presets>.mini{display:inline-flex;margin:0 10px 8px 0;white-space:normal;text-align:left}
.studio-preset-art{height:148px;background:var(--sunken)}
.studio-preset-art>.studio-swatch{width:156px;max-width:100%;height:134px}
.studio-visual-choice:hover{border-color:var(--accent-line);background:var(--sunken)}
.studio-visual-choice:focus-visible{outline:2px solid var(--accent);outline-offset:3px}
@media(pointer:coarse){.studio-visual-choice{touch-action:manipulation}}
@media(prefers-reduced-motion:reduce){.studio-visual-choice{transition:none!important}}
@media(max-width:900px){.render-preset-list,.lighting-presets,.studio-material-choices,.studio-light-choices{grid-template-columns:repeat(2,minmax(0,1fr))}}

/* Camera, layout, environment and finish witnesses. */
.studio-choice-grid{display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;background:none!important;padding:0!important;border:0!important}
.studio-choice-grid>.studio-visual-choice{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:flex-end;min-width:0;min-height:120px;padding:8px 5px 12px;border:1px solid var(--line)!important;border-radius:9px!important;background:var(--panel)!important;color:var(--ink)!important;font:inherit;font-size:11px!important;line-height:1.35;text-align:center;cursor:pointer;box-shadow:none!important}
.studio-choice-grid>.studio-visual-choice[aria-pressed=true]{border-color:var(--accent)!important;background:var(--soft)!important}
.studio-choice-grid .studio-swatch{width:100%;height:80px;max-width:130px}
.studio-choice-grid>.studio-visual-choice>span{display:block;overflow-wrap:anywhere}
.studio-visual-choice:focus-visible{outline:2px solid var(--accent)!important;outline-offset:3px!important}
.studio-visual-choice:hover{border-color:var(--accent)!important;filter:brightness(1.025)}
.studio-visual-choice:disabled{opacity:.45;cursor:default}
.studio-bases{margin-top:14px}
@media(max-width:900px){.studio-choice-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(prefers-reduced-motion:reduce){.studio-visual-choice{transition:none!important}}

/* Built-in objects on the component step. */
.studio-catalog {
  --prefab-stage: light-dark(var(--sunken), color-mix(in srgb, var(--sunken) 83%, #aeb9c8));
  container-type: inline-size;
  margin-top: 24px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.studio-catalog .studio-prefab-heading {
  margin: 0 0 7px;
  color: var(--ink);
  font-size: .93em;
  font-weight: 650;
}
.studio-catalog > section + section { margin-top: 16px; }
.studio-prefab-strip, .studio-prefab-accessories { display: grid; }
.studio-prefab-strip {
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--line);
}
.studio-prefab-accessories { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
#dialog .studio-catalog .studio-prefab-choice {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
  margin: 0;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  line-height: 1.25;
  text-align: start;
  white-space: normal;
  cursor: pointer;
}
#dialog .studio-prefab-strip > .studio-prefab-choice {
  flex-direction: column;
  align-items: stretch;
  padding: 0;
  border: 0;
  border-radius: 0;
}
#dialog .studio-prefab-accessories > .studio-prefab-choice {
  gap: 8px;
  min-height: 50px;
  padding: 4px 10px 4px 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
#dialog .studio-catalog .studio-prefab-choice:hover { background: var(--soft); border-color: var(--accent-line); }
#dialog .studio-catalog .studio-prefab-choice:focus-visible { z-index: 1; outline: 2px solid var(--accent); outline-offset: -3px; }
.studio-prefab-choice:active .studio-prefab-art { background: var(--soft); }
.studio-prefab-art {
  display: grid;
  flex: none;
  place-items: center;
  height: clamp(76px, 11cqw, 128px);
  background: linear-gradient(155deg, var(--panel), var(--prefab-stage));
}
.studio-prefab-art img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
}
.studio-prefab-accessories .studio-prefab-art {
  width: 54px;
  height: 42px;
  border-radius: 5px;
  background: var(--prefab-stage);
}
.studio-prefab-label { display: grid; gap: 3px; min-width: 0; overflow-wrap: anywhere; }
.studio-prefab-strip .studio-prefab-label { flex: 1; align-content: start; min-height: 43px; padding: 6px 8px; border-top: 1px solid var(--line); }
.studio-prefab-label strong { font-weight: 650; }
.studio-prefab-label small { color: var(--muted); font-size: .85em; }
.studio-prefab-arrow { display: grid; flex: none; width: 16px; margin-inline-start: auto; color: var(--muted); --icon-primary: currentColor; }
.studio-prefab-strip .studio-prefab-arrow { position: absolute; inset-block-start: 5px; inset-inline-end: 5px; opacity: 0; }
.studio-prefab-strip .studio-prefab-choice:is(:hover, :focus-visible) .studio-prefab-arrow { opacity: 1; }

@container (max-width: 755px) {
  .studio-prefab-strip { grid-template-columns: repeat(12, minmax(0, 1fr)); }
  .studio-prefab-strip > .studio-prefab-choice { grid-column: span 3; }
  .studio-prefab-strip > .studio-prefab-choice:nth-child(n+5) { grid-column: span 4; }
}
@container (max-width: 510px) {
  .studio-prefab-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .studio-prefab-strip > .studio-prefab-choice:nth-child(n) { grid-column: span 1; }
  #dialog .studio-prefab-strip > .studio-prefab-choice:last-child { grid-column: 1 / -1; flex-direction: row; }
  .studio-prefab-strip > .studio-prefab-choice:last-child .studio-prefab-art { width: 64px; height: 54px; }
  .studio-prefab-strip > .studio-prefab-choice:last-child .studio-prefab-label { align-content: center; border-top: 0; border-inline-start: 1px solid var(--line); }
  .studio-prefab-strip > .studio-prefab-choice:last-child .studio-prefab-arrow { inset-block-start: calc(50% - 8px); }
  .studio-prefab-accessories { grid-template-columns: 1fr; }
}

.render-preset-list .studio-swatch,.studio-material-choices .studio-swatch{height:94px;max-width:130px}
.render-preset-list .studio-visual-choice,.studio-material-choices .studio-visual-choice{min-height:146px}

/* Curated surface library: material photographs and player-rendered samples. */
.material-library{min-width:0}.material-library-filters{display:grid;grid-template-columns:1fr;gap:10px}.material-library-filters label{display:grid;gap:5px;font-size:12px}.material-library-filters input,.material-library-filters select{width:100%;min-width:0}.material-library-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;max-height:540px;overflow:auto;padding:3px}.material-library-choice{position:relative;display:flex;flex-direction:column;align-items:stretch;gap:7px;border:1px solid var(--line);border-radius:9px;padding:5px 5px 9px;background:var(--panel);color:var(--ink);cursor:pointer;min-width:0;min-height:44px;text-align:left;font:inherit}.material-library-choice img{width:100%;height:auto;aspect-ratio:4/3;object-fit:cover;border-radius:5px;background:#eceae5}.material-library-choice span{font-size:12px;line-height:1.35;padding:0 4px}.material-library-choice:hover{border-color:var(--accent)}.material-library-choice:focus-visible{outline:2px solid var(--accent);outline-offset:2px}.material-library-choice[aria-pressed=true]{border-color:var(--accent);box-shadow:inset 0 0 0 1px var(--accent)}.material-library-choice[aria-pressed=true]:after{content:'✓';position:absolute;right:9px;top:9px;background:var(--accent);color:white;border-radius:50%;width:20px;height:20px;text-align:center;line-height:20px}.preset-library-list .material-library-grid{grid-template-columns:repeat(auto-fit,minmax(140px,1fr))}.prefab-markings{margin-block:14px}

/* Grab a component directly; the insertion rule marks its future position. */
#element-list .element-item{position:relative;user-select:none}
#element-list .element-select{cursor:grab}
#element-list .element-item small{overflow-wrap:anywhere}
#element-list .element-select .obj{touch-action:none;pointer-events:auto}
#element-list .element-item.is-dragging{opacity:.35}
#element-list [data-drop-position]:before{content:'';position:absolute;z-index:2;left:0;right:0;height:3px;border-radius:2px;background:var(--accent);pointer-events:none}
#element-list [data-drop-position=before]:before{top:-4px}
#element-list [data-drop-position=after]:before{bottom:-4px}
.element-item.is-drag-ghost{position:fixed;z-index:1000;pointer-events:none!important;margin:0;background:var(--panel);border:1px solid var(--accent-line);border-radius:10px;box-shadow:0 12px 32px #17243735;opacity:.95;user-select:none}
body.is-ordering-elements,body.is-ordering-elements *{cursor:grabbing!important;user-select:none!important}

/* Macro photographs make paper grain and specular finishes readable at tile size. */
.render-preset-list,.studio-material-choices,.studio-choice-grid.studio-photo-choices{grid-template-columns:repeat(2,minmax(0,1fr))}
:is(.render-preset-list,.studio-material-choices,.studio-photo-choices)>.studio-visual-choice{padding:5px 5px 10px;gap:8px;justify-content:flex-start;min-height:0}
.studio-visual-choice>.studio-swatch.studio-material-photo,.studio-preset-art>.studio-swatch.studio-material-photo{display:block;max-width:none;width:100%;height:auto;aspect-ratio:4/3;object-fit:cover;border-radius:5px;overflow:hidden;background:var(--sunken)}
.studio-preset-art:has(>.studio-material-photo){padding:0;height:auto;aspect-ratio:4/3}
