/* Shared control materials; title artwork and game layout remain unchanged. */
body.stage-theme {
  --control-ink:#352d28; --control-edge:#8c7967; --control-paper:#fff6e7;
  --control-field:#fffcf5; --control-accent:#ff873e; --control-focus:#226b76;
  --control-raised:inset 0 1px 0 #fffef8,0 3px 0 #65503d55,0 4px 5px #352b2014;
  --control-inset:inset 0 2px 3px #66524020,0 1px 0 #ffffffb3;
  --control-panel:linear-gradient(#fff9eecc,#fff9eecc),url('/stage/paper-grain.webp');
}
body.stage-theme :is(.avatar-edit-actions button,.avatar-shapes button,.dialog-action,
  .command-icon-btn,.mobile-viewport-command-grid button,.sculpt-lab-ui button,
  .instruction-panel summary,.lobby-visibility-toggle,.gallery-feature-actions button,
  [data-feature-rename],[data-feature-rename-form] button,.gallery-pagination button,
  .reference-action-button,.mobile-builder-tools-toggle,.mobile-builder-toolbar-close) {
  background:var(--control-paper) url('/stage/paper-grain.webp') !important;
  background-size:220px 220px !important;background-blend-mode:multiply;
  border:1px solid var(--control-edge);border-radius:6px;color:var(--control-ink);
  box-shadow:var(--control-raised);font-weight:700;letter-spacing:0;text-shadow:none;
}
body.stage-theme :is(.avatar-edit-actions button,.gallery-feature-actions button,
  [data-feature-rename],[data-feature-rename-form] button) {
  min-height:44px;font-size:14px;line-height:1.35;white-space:normal;overflow-wrap:anywhere;
}
body.stage-theme :is(.avatar-edit-actions [data-save],.dialog-action-primary,button.complete-btn,
  button.match-primary-action,button.reference-footer-action,.answer-submit-form button) {
  background:var(--control-accent) url('/stage/clay-grain.webp') !important;
  background-size:192px 192px !important;background-blend-mode:multiply;
  border:1px solid #ad602f;border-radius:8px;color:var(--control-ink);
  box-shadow:var(--clay-raised);font-weight:800;text-shadow:none;
}
body.stage-theme :is(.clay-avatar-dialog,.crafting-screen,.lobby-settings-sheet,
  .gallery-screen,.work-detail-reference-main,.answer-submit-form)
  :is(input:not([type=range]):not([type=color]):not([type=checkbox]):not([type=radio]),select) {
  background:var(--control-field) !important;border:1px solid var(--control-edge);
  border-radius:5px;color:var(--control-ink);box-shadow:var(--control-inset);
  font-size:16px;line-height:1.35;letter-spacing:0;
}
body.stage-theme :is(button,input,select,summary,.gallery-card):focus-visible {
  outline:3px solid var(--control-focus);outline-offset:3px;
}
body.stage-theme :is(.sculpt-lab-ui button,.avatar-shapes button)[aria-pressed=true] {
  border-color:var(--control-focus);background:#deeeeb url('/stage/paper-grain.webp') !important;
  box-shadow:inset 0 0 0 1px var(--control-focus),var(--control-inset);
}
body.stage-theme .sculpt-lab-tools button.is-active {
  background:var(--control-accent) url('/stage/clay-grain.webp') !important;
  border-color:#a55329;box-shadow:var(--control-inset);
}
body.stage-theme .sculpt-lab-symmetry [data-lab-axis=x][aria-pressed=true] { background-color:#efb0b6 !important; }
body.stage-theme .sculpt-lab-symmetry [data-lab-axis=y][aria-pressed=true] { background-color:#c2da91 !important; }
body.stage-theme .sculpt-lab-symmetry [data-lab-axis=z][aria-pressed=true] { background-color:#b2d8ec !important; }
body.stage-theme :is(.command-icon-btn,.sculpt-lab-ui button,.avatar-edit-actions button,
  .gallery-feature-actions button):disabled { opacity:.45;box-shadow:none;transform:none; }
body.stage-theme :is(#deletePartCommand,#mobileDeletePart,[data-feature-delete],.dialog-action-danger) { color:#a33325 !important; }
body.stage-theme :is(.clay-avatar-dialog,.dialog-card) {
  background:var(--control-panel);border:1px solid var(--control-edge);
  box-shadow:inset 0 1px 0 #fffefa,0 5px 0 #79634f,0 18px 40px #201e1938;padding:24px;
}
body.stage-theme .clay-avatar-dialog h2 { font-size:22px; }
body.stage-theme .avatar-shapes button { font-size:13px; }
body.stage-theme .avatar-colors button[aria-pressed=true] { outline-color:var(--control-focus); }
body.stage-theme .avatar-edit-actions { padding-top:14px;border-top:1px solid #8c79674d; }
body.stage-theme .crafting-screen :is(.color-section,.command-toolbar) {
  background:var(--control-panel);border:1px solid #a5917a;
  border-radius:6px;box-shadow:inset 0 1px 0 #fffdfa,0 3px 0 #755d4140;
}
body.stage-theme .crafting-screen input[type=range]:not(#hueRange) {
  appearance:none;-webkit-appearance:none;background:transparent;min-height:24px;cursor:pointer;
  accent-color:var(--control-accent);border:0;box-shadow:none;
}
body.stage-theme .crafting-screen input[type=range]:not(#hueRange)::-webkit-slider-runnable-track {
  height:6px;border-radius:3px;background:var(--control-track,#dccbb4);border:1px solid #a5917a;box-shadow:inset 0 1px 2px #74604b26;
}
body.stage-theme .crafting-screen input[type=range]:not(#hueRange)::-webkit-slider-thumb {
  appearance:none;-webkit-appearance:none;width:18px;height:18px;margin-top:-7px;border-radius:50%;
  background:var(--control-accent);border:2px solid var(--control-field);box-shadow:0 0 0 1px #9a714e,0 2px 1px #755d4140;
}
body.stage-theme .crafting-screen input[type=range]:not(#hueRange)::-moz-range-track { height:5px;border-radius:3px;background:var(--control-track,#dccbb4);border:1px solid #a5917a; }
body.stage-theme .crafting-screen input[type=range]:not(#hueRange)::-moz-range-thumb { width:15px;height:15px;border-radius:50%;background:var(--control-accent);border:2px solid var(--control-field);box-shadow:0 0 0 1px #9a714e; }
body.stage-theme #redRange { --control-track:linear-gradient(to right,#fff6f4,#cf5349); }
body.stage-theme #greenRange { --control-track:linear-gradient(to right,#f3faf0,#579b53); }
body.stage-theme #blueRange { --control-track:linear-gradient(to right,#f0f7fc,#4c98c7); }
body.stage-theme .instruction-panel>span {
  width:min(540px,calc(100vw - 40px));padding:18px 20px;background:var(--control-panel);
  border:1px solid var(--control-edge);border-radius:6px;box-shadow:0 5px 0 #79634f55,0 12px 28px #201e1924;
  text-align:left;font-size:14px;line-height:1.65;font-weight:400;
}
.sculpt-help-device { display:block; }
.sculpt-help-device+.sculpt-help-device { margin-top:16px;padding-top:12px;border-top:1px solid #8c79674d; }
.sculpt-help-device>strong { display:block;color:#226b76;font-size:13px;margin-bottom:8px; }
.sculpt-help-group { display:block;margin:10px 0 0; }
.sculpt-help-group>b { display:block;font-size:15px; }
.sculpt-help-group>span { display:block;margin-top:3px; }
/* Avatar rendering puts the feet at y=344 in a 384px square. Offset only
   the lobby image by its 40px transparent bottom margin, at display scale. */
body.stage-theme .lobby-avatar { container-type:size;--lobby-ground-y:8px;--lobby-shadow-width:62; }
body.stage-theme .lobby-avatar img[data-clay-avatar][src^="data:image/png"] {
  position:absolute;left:50%;bottom:calc(-1 * var(--lobby-ground-y));
  width:min(100cqw,100cqh);height:auto;max-width:none;
  transform:translate(-50%,10.416667%);
}
body.stage-theme .lobby-avatar:has([data-avatar-shape=tall]) { --lobby-shadow-width:38; }
body.stage-theme .lobby-avatar::before {
  left:50%;right:auto;width:min(calc(var(--lobby-shadow-width) * 1cqw),calc(var(--lobby-shadow-width) * 1cqh));
  height:8px;bottom:calc(-1 * var(--lobby-ground-y) - 4px);border-radius:50%;background:#40392e;
  filter:blur(3px);opacity:.2;transform:translateX(-50%);
}
body.stage-theme .empty-lobby-player .lobby-avatar::before { content:none; }
@media(min-width:901px) and (min-height:600px) {
  /* The backdrop floor is at 67.5vh; the centered player row moves at 50vh. */
  body.stage-theme .lobby-player-list:not(:has(>:nth-child(5))) {
    position:relative;top:calc(17.5dvh - 126px);
  }
}
@media(min-width:701px) and (max-width:900px) and (min-height:600px) {
  /* The tablet header and 180px avatar slots have a different center offset. */
  body.stage-theme .lobby-player-list:not(:has(>:nth-child(5))) {
    position:relative;top:calc(17.5dvh - 161.5px);
  }
}
body.stage-theme .lobby-player-title { flex-wrap:wrap;gap:6px 16px; }
body.stage-theme .lobby-player-count { font-size:14px; }
body.stage-theme .result-score-breakdown,body.stage-theme .result-score-breakdown small { font-size:12px;opacity:1; }
@media(max-width:700px) {
  body.stage-theme .clay-avatar-dialog { padding:18px; }
  body.stage-theme .instruction-panel>span { padding:14px 16px;font-size:13px; }
  body.stage-theme .gallery-feature-actions button { flex:1 1 120px; }
  body.stage-theme .lobby-avatar { --lobby-ground-y:2px; }
  body.stage-theme .lobby-avatar::before { height:6px;bottom:calc(-1 * var(--lobby-ground-y) - 3px);filter:blur(2px); }
}
@media(any-pointer:coarse) {
  body.stage-theme .crafting-screen input[type=range]:not(#hueRange) { min-height:30px; }
  body.stage-theme .crafting-screen input[type=range]:not(#hueRange)::-webkit-slider-thumb { width:22px;height:22px;margin-top:-9px; }
}
@media(max-width:1040px),(max-width:1366px) and (orientation:portrait) {
  body.stage-theme .crafting-screen .workspace-toolbar,
  body.stage-theme .builder-color-details[open] { background:var(--control-panel); }
  body.stage-theme .workspace-toolbar.is-mobile-open :is(.color-section,.command-toolbar) {
    background:none;border:0;box-shadow:none;border-radius:0;
  }
}
