.customizer-page #content {
  --editor-bg: #0c0c0c;
  --editor-surface: #212121;
  --editor-edge: #414141;
  --editor-muted: #b4b2b0;
  --editor-active: #ff6a2e;
  width: 100%;
  max-width: 1280px;
  padding-block: 12px max(40px, env(safe-area-inset-bottom));
  color: #f5f4f2;
}
.customizer-page {background: #0c0c0c}
.customizer-layout [hidden], .heading-actions [hidden] {display:none!important}
.customizer-page #content :is(button, select, input) {font:inherit}
.customizer-page #content button {cursor:pointer}
.customizer-page #content button:disabled {opacity:.45;cursor:default}
.customizer-page #content :focus-visible {outline:2px solid var(--editor-active);outline-offset:2px}
.customizer-heading {
  display:flex;align-items:center;justify-content:space-between;gap:12px;
  padding:0 0 16px;margin-bottom:20px;border-bottom:1px solid var(--editor-edge);
}
.customizer-heading h1 {display:flex;align-items:baseline;gap:.45em;margin:0;font-size:clamp(22px,2.7vw,35px);line-height:1.18;letter-spacing:-.045em}
.customizer-heading small {color:var(--editor-muted);font-size:.55em;font-weight:500;letter-spacing:0}
.customizer-heading [data-edition] {display:none}
html[data-game=spl3] [data-edition=spl3],html[data-game=raiders] [data-edition=raiders] {display:inline}
.heading-actions,.stage-tools,.export-buttons {display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.heading-actions {justify-content:flex-end}
.heading-actions :is(button,a),.stage-tools button,.export-buttons button,.stage-status button {
  display:inline-flex;align-items:center;justify-content:center;gap:7px;
  min-height:44px;padding:7px 15px;border:1px solid var(--editor-edge);border-radius:999px;
  color:inherit;background:var(--editor-surface);text-decoration:none;line-height:1.25;
}
.customizer-page #content :is(.heading-actions,.stage-tools,.export-buttons) :is(a,button) {font-size:14px}
#open-portrait svg {display:block;width:19px;height:19px}
#open-portrait {background:#f3f2ef;color:#151515;border-color:transparent;font-weight:650}
.customizer-layout {display:grid;grid-template-columns:minmax(0,1.57fr) minmax(0,1fr);align-items:start;gap:clamp(20px,3vw,40px)}
.preview-column,.customizer-controls {min-width:0}
.preview-column {position:sticky;top:10px}
.character-stage {
  position:relative;isolation:isolate;overflow:hidden;
  width:100%;aspect-ratio:1.24;max-height:min(64svh,max(300px,calc(100svh - 325px)));
  border-radius:17px;background:#171717;
}
.character-stage canvas {position:absolute;inset:0;display:block;width:100%;height:100%;touch-action:none}
.customizer-page #content canvas:focus-visible {outline-offset:-4px}
.stage-status {
  position:absolute;z-index:1;left:50%;top:50%;transform:translate(-50%,-50%);
  width:max-content;max-width:88%;padding:9px 15px;border-radius:12px;
  color:#f3f3f3;background:#101010ed;text-align:center;font-size:14px;
}
.stage-status p {margin:0}
.stage-status button {margin-top:8px}
.stage-tools {justify-content:space-between;min-height:44px;padding:2px 0 4px}
.stage-tools button {min-height:40px;padding:5px 7px;border-color:transparent;background:transparent;color:var(--editor-muted)}
#reset-character span {display:inline-block;--pressed-transform:translateX(-2px) scale(.94)}
#randomize-character svg {flex:none}
.editor-actions {display:flex;align-items:center;gap:8px 14px;flex-wrap:wrap;border-top:1px solid var(--editor-edge);padding-top:12px}
.editor-actions h2,.head-field legend,.color-field legend,.field-label {
  margin:0;color:#f1f0ee;font-size:14px;font-weight:650;line-height:1.45;
}
.export-buttons {gap:6px}
.export-buttons .primary-export {background:var(--editor-active);border-color:transparent;color:#19120e;font-weight:650}
.primary-export span {font-size:12px}
.download-status {flex-basis:100%;margin:0;color:var(--editor-muted);font-size:13px;line-height:1.5}
.download-status:empty {display:none}
.identity-toolbar {position:relative;z-index:4;margin-bottom:10px}
.identity-picker {position:relative;width:100%}
.identity-picker .game-menu-trigger {
  display:flex;align-items:center;gap:12px;width:100%;min-height:46px;
  padding:8px 14px;border:1px solid var(--editor-edge);border-radius:10px;background:var(--editor-surface);color:inherit;
}
.identity-label {margin-right:auto;font-size:14px;font-weight:650}
#identity-value {font-size:14px}
.identity-picker .game-menu-caret {margin-left:0}
.identity-picker .identity-fields {
  left:auto;right:0;top:calc(100% + 5px);width:min(100%,252px);
  padding:10px;border:1px solid #565656;border-radius:12px;background:#242424;
}
.identity-picker::before {left:0;width:100%}
.identity-picker[data-placement=above]::before {top:auto;bottom:100%}
.identity-picker[data-placement=above] .identity-fields {top:auto;bottom:calc(100% + 5px)}
.identity-options {display:grid;grid-template-columns:auto 1fr 1fr;align-items:center;gap:5px}
.identity-options + .identity-options {margin-top:6px}
.identity-option-title {padding:0 6px;color:var(--editor-muted);font-size:13px}
.identity-options label {position:relative;cursor:pointer}
.identity-options input {position:absolute;inset:0;width:100%;height:100%;margin:0;opacity:0;cursor:pointer}
.identity-options label span {display:grid;place-items:center;min-height:42px;border:1px solid var(--editor-edge);border-radius:8px;font-size:14px}
.identity-options input:checked + span {border-color:var(--editor-active);color:var(--editor-active);background:#30211a}
.identity-options input:focus-visible + span {outline:2px solid var(--editor-active);outline-offset:1px}
.tab-toolbar {position:sticky;z-index:2;top:0;background:var(--editor-bg)}
.editor-tabs {display:flex;gap:4px;border-bottom:1px solid var(--editor-edge)}
.editor-tabs button {
  position:relative;flex:1;min-width:0;min-height:46px;padding:5px 3px;border:0;background:none;color:var(--editor-muted);
}
.editor-tabs button[aria-selected=true] {color:#fff;font-weight:700}
.editor-tabs button[aria-selected=true]::after {
  content:"";position:absolute;inset:auto 20% -1px;height:3px;border-radius:3px;background:var(--editor-active);
}
.editor-panel {min-width:0;padding:18px 0 8px}
.head-field,.color-field {min-width:0;margin:0 0 20px;padding:0;border:0}
.head-field legend,.color-field legend {margin-bottom:9px;padding:0}
.choices {
  display:grid;grid-template-columns:repeat(auto-fill,minmax(min(76px,100%),1fr));
  gap:8px;align-items:start;padding:3px;
}
.choice-button {
  position:relative;width:100%;min-width:0;aspect-ratio:1 / 1;overflow:hidden;
  padding:4px;border:2px solid transparent;border-radius:9px;background:#242424;
}
.choice-button img {position:absolute;inset:0;width:100%;height:100%;box-sizing:border-box;padding:4px;object-fit:contain}
.choice-button[aria-pressed=true] {border-color:var(--editor-active)}
.choice-none svg {width:36%;height:36%;fill:none;stroke:var(--editor-muted);stroke-width:1.4}
.wear-categories {display:flex;gap:3px;margin-bottom:12px;padding:4px;background:var(--editor-surface);border-radius:13px}
.wear-categories button {flex:1;min-width:0;min-height:40px;padding:5px;border:0;border-radius:9px;background:transparent;color:var(--editor-muted)}
.wear-categories button[aria-pressed=true] {background:#f3f2ef;color:#161616;font-weight:650}
.choice-notice {margin:0 0 12px;font-size:14px;color:var(--editor-muted)}
.swatches {display:flex;flex-wrap:wrap;gap:0}
.swatch {position:relative;width:42px;height:44px;padding:0;border:0;border-radius:50%;background:transparent}
.swatch::before {content:"";position:absolute;inset:6px 5px;border:2px solid #171717;border-radius:50%;background:var(--swatch);box-shadow:0 0 0 1px #585858}
.swatch[aria-pressed=true]::before {box-shadow:0 0 0 2px var(--editor-active)}
.color-inputs {display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.swatches + .color-inputs {margin-top:9px}
.color-inputs input,.pose-category {
  min-height:44px;min-width:0;border:1px solid #545454;border-radius:9px;background:var(--editor-surface);color:inherit;
}
.color-inputs input[type=color] {width:48px;height:44px;padding:4px;cursor:pointer}
.hex-label {font-size:13px;color:var(--editor-muted);margin-left:4px}
.color-inputs input[type=text] {width:105px;padding:7px 10px}
.field-label {display:block;margin-bottom:8px}
.pose-category {width:100%;padding:8px 10px;color-scheme:dark}
.pose-list {display:grid;gap:5px;max-height:52svh;overflow-y:auto;margin-top:12px;padding:3px;scrollbar-width:thin}
.pose-list button {
  width:100%;min-height:44px;padding:7px 12px;text-align:left;
  border:1px solid var(--editor-edge);border-radius:9px;background:var(--editor-surface);color:#ddd;
}
.pose-list button[aria-pressed=true] {border-color:var(--editor-active);color:var(--editor-active);background:#2b1d17}
.pose-list button[data-more] {color:var(--editor-active);text-align:center}
@media(hover:hover) {
  .heading-actions :is(button,a):hover:not(:disabled),.export-buttons button:hover:not(:disabled),
  .identity-picker .game-menu-trigger:hover,.pose-list button:hover:not([aria-pressed=true]) {border-color:var(--editor-active)}
  .choice-button:not([aria-pressed=true]):not(:disabled):hover {border-color:#777}
  .stage-tools button:not(:disabled):hover,.editor-tabs button:hover {color:#fff;background:#242424}
  #open-portrait:not(:disabled):hover {background:#fff}
}
@media(prefers-reduced-motion:no-preference) {
  .customizer-layout button,.heading-actions :is(a,button),.choice-button img {transition:color .16s,background-color .16s,border-color .16s,transform .18s}
  .choice-button:not(:disabled):hover img {transform:scale(1.025)}
  #reset-character:active span {transform:var(--pressed-transform)}
}
@media(max-width:760px) {
  .customizer-page #content {padding-top:8px}
  .customizer-heading {margin-bottom:12px;padding-bottom:12px;flex-wrap:wrap}
  .heading-actions {gap:6px}
  .heading-actions :is(button,a) {padding-inline:11px}
  .customizer-layout {display:block}
  .preview-column {display:contents}
  .character-stage {aspect-ratio:auto;height:clamp(200px,35svh,390px);max-height:none;border-radius:13px}
  .stage-tools button {min-height:44px}
  .editor-actions {gap:6px 9px;padding:8px 0 12px}
  .export-buttons button {padding-inline:10px}
  .identity-toolbar {margin:4px 0 5px}
  .editor-panel {padding-top:15px}
  .wear-categories button {min-height:44px}
}
@media(max-width:760px) and (min-height:620px) {
  .customizer-layout {--mobile-preview:clamp(200px,35svh,390px)}
  .preview-surface {position:sticky;top:0;z-index:6;background:var(--editor-bg)}
  .character-stage {height:var(--mobile-preview)}
  .tab-toolbar {top:calc(var(--mobile-preview) + 50px)}
  .editor-panel :is(button,select,input) {scroll-margin-top:calc(var(--mobile-preview) + 102px)}
}
@media(min-width:761px) and (max-height:640px) {
  .character-stage {max-height:55svh}
}
