/* Chao Face / Part Editor */
#chao-face-editor-panel {
  z-index: 9060;
  width: 1520px;
  height: 900px;
  max-width: min(1520px, calc(var(--app-authored-width) - 24px));
  max-height: min(900px, calc(var(--app-authored-height) - 24px));
}
#chao-face-editor-create-panel {
  width: 1520px;
  height: 900px;
  max-width: min(1520px, calc(var(--app-authored-width) - 24px));
  max-height: min(900px, calc(var(--app-authored-height) - 24px));
}
#chao-face-editor-create-panel > .panel-body.face-editor-body {
  padding: 10px;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  max-height: 100%;
  min-height: 0;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable both-edges;
  touch-action: pan-y pinch-zoom;
}
#chao-face-editor-create-panel,
#chao-face-editor-create-panel > .panel-body.face-editor-body,
#chao-face-editor-create-panel .face-editor-create-shell,
#chao-face-editor-create-panel .face-editor-card,
#chao-face-editor-create-panel .face-editor-toolbar-row,
#chao-face-editor-create-panel label,
#chao-face-editor-create-panel button,
#chao-face-editor-create-panel select,
#chao-face-editor-create-panel input,
#chao-face-editor-create-panel textarea {
  min-height: 0;
  touch-action: pan-y pinch-zoom;
}
.face-editor-create-shell {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 100%;
}
#chao-face-editor-create-panel #face-editor-create-new-card {
  display: flex;
}
#chao-face-editor-create-panel #face-editor-create-canvas,
#chao-face-editor-create-panel #face-editor-create-onion-canvas {
  touch-action: none;
}

#chao-face-editor-panel > .panel-body.face-editor-body {
  padding: 10px;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  max-height: 100%;
  min-height: 0;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable both-edges;
  touch-action: pan-y pinch-zoom;
}
#chao-face-editor-panel,
#chao-face-editor-panel > .panel-body.face-editor-body,
#chao-face-editor-panel .face-editor-shell,
#chao-face-editor-panel .face-editor-left,
#chao-face-editor-panel .face-editor-right {
  min-height: 0;
}
#chao-face-editor-panel .face-editor-shell,
#chao-face-editor-panel .face-editor-toolbar-row,
#chao-face-editor-panel .face-editor-card,
#chao-face-editor-panel .face-editor-browser-row,
#chao-face-editor-panel .face-editor-targeted-row,
#chao-face-editor-panel .face-editor-meta,
#chao-face-editor-panel .face-editor-hint,
#chao-face-editor-panel .face-editor-colors-list,
#chao-face-editor-panel label,
#chao-face-editor-panel button,
#chao-face-editor-panel select,
#chao-face-editor-panel input,
#chao-face-editor-panel textarea {
  touch-action: pan-y pinch-zoom;
}
.face-editor-shell {
  display: grid;
  grid-template-columns: minmax(620px, 1.4fr) minmax(320px, 0.8fr);
  gap: 12px;
  min-height: 100%;
  height: auto;
  align-items: start;
}
.face-editor-left,
.face-editor-right {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.face-editor-right {
  padding-bottom: 12px;
}

@media (max-width: 1360px) {
  .face-editor-shell {
    grid-template-columns: 1fr;
  }
}
.face-editor-toolbar-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
}
.face-editor-toolbar-row.compact { gap: 6px; }
.face-editor-toolbar-row label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: #d8eef4;
}
.face-editor-toggle {
  flex-direction: row !important;
  align-items: center !important;
  gap: 6px !important;
  padding: 6px 10px;
  border: 1px solid rgba(132, 209, 235, 0.2);
  border-radius: 10px;
  background: rgba(10, 24, 36, 0.52);
}
.face-editor-toggle input {
  margin: 0;
}
.face-editor-toolbar-row select,
.face-editor-toolbar-row input[type="text"],
.face-editor-offset-grid input,
#face-editor-export {
  background: rgba(10, 24, 36, 0.82);
  color: #eefbff;
  border: 1px solid rgba(132, 209, 235, 0.28);
  border-radius: 8px;
  padding: 6px 8px;
}
.face-editor-compare-wrap {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  flex: 1;
  min-height: 0;
}
.face-editor-preview-pane {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.face-editor-preview-pane-title,
.face-editor-subsection-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(186, 232, 248, 0.9);
}
.face-editor-preview-pane-title {
  padding-left: 2px;
}
.face-editor-nav-row {
  justify-content: flex-start;
}
.face-editor-stage-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
}
.face-editor-stage {
  position: relative;
  flex: 1;
  min-height: 420px;
  border-radius: 16px;
  border: 1px solid rgba(132, 209, 235, 0.24);
  background:
    linear-gradient(rgba(255,255,255,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.05) 1px, transparent 1px),
    radial-gradient(circle at center, rgba(29, 67, 94, 0.55), rgba(8, 16, 26, 0.95));
  background-size: 24px 24px, 24px 24px, cover;
  overflow: hidden;
}
.face-editor-crosshair {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.face-editor-crosshair::before,
.face-editor-crosshair::after {
  content: "";
  position: absolute;
  background: rgba(255,255,255,0.18);
}
.face-editor-crosshair::before { left: 50%; top: 0; width: 1px; height: 100%; }
.face-editor-crosshair::after { top: 50%; left: 0; height: 1px; width: 100%; }
.face-editor-preview-anchor {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 0;
  height: 0;
}
.face-editor-preview-scale {
  position: absolute;
  left: 0;
  top: 0;
  transform: scale(6) translate(-24px, -24px);
  transform-origin: top left;
  width: 48px;
  height: 48px;
}
.face-editor-preview-scale .local {
  position: absolute !important;
  left: 0 !important;
  top: 0 !important;
}
.face-editor-preview-scale .chao-part,
.face-editor-preview-scale .spriteImage,
.face-editor-preview-scale .local > div,
.face-editor-preview-scale .local img {
  image-rendering: pixelated;
}
.face-editor-meta,
.face-editor-hint {
  font-size: 12px;
  color: rgba(221, 244, 255, 0.82);
}

.face-editor-toolbar-row label[for],
#face-editor-part-key-wrap {
  min-width: 0;
}
#face-editor-part-key-input {
  min-width: 220px;
}

.face-editor-target-summary {
  position: sticky;
  top: 0;
  z-index: 6;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: #eefbff;
  background: rgba(6, 16, 24, 0.92);
  border: 1px solid rgba(132, 209, 235, 0.2);
  border-radius: 10px;
  padding: 9px 10px;
  box-shadow: 0 8px 18px rgba(0,0,0,0.18);
}
.face-editor-target-summary .muted { opacity: .75; }
.face-editor-override-tools {
  justify-content: space-between;
  align-items: center;
}
.face-editor-override-legend {
  display:flex;
  align-items:center;
  gap:8px;
  font-size:12px;
  color: rgba(221, 244, 255, 0.82);
}
.face-editor-legend-dot {
  width:10px;
  height:10px;
  border-radius:999px;
  display:inline-block;
  border:1px solid rgba(255,255,255,0.16);
  vertical-align:middle;
}
.face-editor-legend-dot-exact { background: rgba(255, 212, 0, 0.95); }
.face-editor-legend-dot-current { background: rgba(132, 209, 235, 0.95); }

.face-editor-legend-dot-dirty { background: rgba(255, 128, 190, 0.98); }
.face-editor-dirty-session::before {
  content:'';
  position:absolute;
  top:5px;
  left:5px;
  width:8px;
  height:8px;
  border-radius:999px;
  background: rgba(255, 128, 190, 0.98);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.25);
}
.face-editor-override-summary {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: rgba(221, 244, 255, 0.86);
  background: rgba(8, 18, 28, 0.42);
  border: 1px solid rgba(132, 209, 235, 0.12);
  border-radius: 10px;
  padding: 8px 10px;
}
.face-editor-nav-row { flex-wrap: wrap; }
.face-editor-nav-row button { flex: 1 1 140px; }
.face-editor-has-exact::after {
  content:'';
  position:absolute;
  top:5px;
  right:5px;
  width:8px;
  height:8px;
  border-radius:999px;
  background: rgba(255, 212, 0, 0.98);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.25);
}
.face-editor-frame-thumb,
.face-editor-dir-chip,
.face-editor-frame-chip-wrap,
.face-editor-part-chip,
.face-editor-dir-preview-thumb { position: relative; }
.face-editor-is-hidden-by-filter { display:none !important; }
.face-editor-template-preview {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: rgba(221, 244, 255, 0.88);
  background: rgba(8, 18, 28, 0.5);
  border: 1px solid rgba(132, 209, 235, 0.14);
  border-radius: 10px;
  padding: 8px 10px;
}
.face-editor-meta {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: rgba(8, 18, 28, 0.5);
  border: 1px solid rgba(132, 209, 235, 0.14);
  border-radius: 10px;
  padding: 8px 10px;
}
.face-editor-card {
  background: rgba(8, 18, 28, 0.72);
  border: 1px solid rgba(132, 209, 235, 0.2);
  border-radius: 14px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.face-editor-card-title {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
}
.face-editor-offset-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.face-editor-offset-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: #d8eef4;
}
.face-editor-flags {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
}
.face-editor-toggle.small {
  padding: 4px 8px;
  font-size: 12px;
}
.face-editor-piece-hover {
  outline: 2px solid #ffd400 !important;
  outline-offset: 1px;
}
.face-editor-piece-selected {
  outline: 2px solid #ffd400 !important;
  outline-offset: 1px;
  box-shadow: 0 0 0 2px rgba(255,212,0,0.35);
}
.face-editor-nudge-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.face-editor-nudge-grid button[data-nudge="up"] { grid-column: 2; }
.face-editor-nudge-grid button[data-nudge="left"] { grid-column: 1; }
.face-editor-nudge-grid button[data-nudge="right"] { grid-column: 3; }
.face-editor-nudge-grid button[data-nudge="down"] { grid-column: 2; }
.face-editor-card button {
  background: rgba(42, 108, 146, 0.9);
  color: #fff;
  border: 0;
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
}
.face-editor-batch-row {
  flex-wrap: wrap;
}
.face-editor-batch-row button {
  flex: 1 1 120px;
}
#face-editor-scope-hint {
  margin-top: 8px;
  min-height: 18px;
}
#face-editor-part-key-list {
  display: none;
}
.face-editor-browser-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.face-editor-frame-strip,
.face-editor-part-browser {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 0;
}
.face-editor-frame-thumb,
.face-editor-part-chip {
  background: rgba(8, 18, 28, 0.72);
  border: 1px solid rgba(132, 209, 235, 0.18);
  border-radius: 10px;
  color: #eefbff;
}
.face-editor-frame-thumb {
  width: 64px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
}
.face-editor-frame-thumb.is-active,
.face-editor-part-chip.is-active {
  border-color: rgba(255, 212, 0, 0.95);
  box-shadow: 0 0 0 2px rgba(255,212,0,0.28);
}
.face-editor-frame-thumb-preview {
  width: 48px;
  height: 48px;
  align-self: center;
  image-rendering: pixelated;
  background-repeat: no-repeat;
  background-position: 0 0;
}
.face-editor-frame-thumb-label {
  font-size: 11px;
  text-align: center;
}
.face-editor-part-browser {
  max-height: 140px;
  overflow: auto;
  padding-right: 4px;
}
.face-editor-part-chip {
  padding: 6px 10px;
  cursor: pointer;
  font-size: 12px;
}
.face-editor-targeted-row {
  flex-wrap: wrap;
  align-items: center;
}
.face-editor-targeted-row label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #d8eef4;
}
.face-editor-targeted-row input[type="number"] {
  width: 70px;
}

.face-editor-dir-selection,
.face-editor-frame-selection {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.face-editor-dir-chip,
.face-editor-frame-chip,
.face-editor-frame-chip-clear {
  border: 1px solid rgba(132, 209, 235, 0.18);
  background: rgba(8, 18, 28, 0.72);
  color: #eefbff;
  cursor: pointer;
  font-size: 12px;
}
.face-editor-dir-chip {
  padding: 4px 10px;
  border-radius: 999px;
}
.face-editor-dir-chip.is-active,
.face-editor-frame-chip-wrap.is-active {
  border-color: rgba(255, 212, 0, 0.95);
  box-shadow: 0 0 0 2px rgba(255,212,0,0.28);
}
.face-editor-dir-chip.is-current,
.face-editor-frame-chip-wrap.is-current {
  outline: 1px dashed rgba(132, 209, 235, 0.55);
  outline-offset: 1px;
}
.face-editor-frame-chip-wrap {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(132, 209, 235, 0.18);
  background: rgba(8, 18, 28, 0.72);
  border-radius: 999px;
  overflow: hidden;
}
.face-editor-frame-chip {
  padding: 4px 8px;
  border: 0;
  background: transparent;
}
.face-editor-frame-chip-clear {
  width: 22px;
  min-width: 22px;
  height: 22px;
  border: 0;
  border-left: 1px solid rgba(132, 209, 235, 0.18);
  background: rgba(255,255,255,0.05);
  line-height: 1;
}
.face-editor-part-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
}
.face-editor-part-chip-preview {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: rgba(255,255,255,0.04);
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  image-rendering: pixelated;
  flex: 0 0 auto;
}
.face-editor-part-chip-label {
  text-align: left;
}
.face-editor-inline-toggle {
  flex-direction: row !important;
  align-items: center;
  gap: 8px !important;
}
.face-editor-colors-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 220px;
  overflow: auto;
  padding-right: 4px;
}
.face-editor-color-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: #eefbff;
}
.face-editor-color-row input[type="color"] {
  width: 48px;
  height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
}
#face-editor-export {
  width: 100%;
  min-height: 240px;
  resize: none;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  line-height: 1.4;
}


.face-editor-create-launch {
  align-self: end;
  min-width: 110px;
}

.face-editor-create-card {
  gap: 10px;
}

.face-editor-create-stage-wrap {
  width: 100%;
  min-height: 320px;
  max-height: 420px;
  overflow: auto;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 10px;
  background: rgba(0,0,0,0.2);
  padding: 10px;
}

.face-editor-create-stage {
  position: relative;
  display: inline-block;
  line-height: 0;
}

#face-editor-create-onion-canvas {
  position: absolute;
  inset: 0;
  display: block;
  image-rendering: pixelated;
  pointer-events: none;
  z-index: 1;
}

#face-editor-create-canvas {
  position: relative;
  display: block;
  image-rendering: pixelated;
  z-index: 2;
  background:
    linear-gradient(45deg, rgba(255,255,255,0.08) 25%, transparent 25%, transparent 75%, rgba(255,255,255,0.08) 75%, rgba(255,255,255,0.08)),
    linear-gradient(45deg, rgba(255,255,255,0.08) 25%, transparent 25%, transparent 75%, rgba(255,255,255,0.08) 75%, rgba(255,255,255,0.08));
  background-position: 0 0, 8px 8px;
  background-size: 16px 16px;
  border: 1px solid rgba(255,255,255,0.18);
  cursor: crosshair;
}

.face-editor-create-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  background-image:
    linear-gradient(to right, rgba(255,255,255,0.12) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.12) 1px, transparent 1px);
}

.face-editor-create-card input[type="text"] {
  min-width: 180px;
}

.face-editor-create-card .face-editor-toolbar-row label {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stats-subscription-front {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}
button.stats-subscription-front {
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(13, 27, 42, 0.72);
  color: inherit;
  padding: 8px 10px;
  border-radius: 10px;
  text-align: left;
}
button.stats-subscription-front:hover {
  background: rgba(27, 38, 59, 0.92);
  border-color: rgba(255,255,255,0.24);
}
.ui-toolbar-appearance-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.ui-inline-link-btn {
  padding: 0;
  border: 0;
  background: transparent;
  color: #a9d6ff;
  text-decoration: underline;
  cursor: pointer;
  font: inherit;
}
.ui-help-current-notes {
  margin: 0;
  padding-left: 20px;
}

.ui-panel-bg-row select,
.ui-toolbar-appearance-grid .ui-panel-bg-row select {
  width: 140px;
  max-width: 140px;
  min-width: 140px;
  flex: 0 0 140px;
}
.stats-subscription-front-secondary {
  margin-top: 6px;
  width: 100%;
}
#chao-alignment-subscription.hidden {
  display: none !important;
}


.face-editor-dir-preview-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.face-editor-dir-preview-thumb {
  width: 64px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  background: rgba(8, 18, 28, 0.72);
  border: 1px solid rgba(132, 209, 235, 0.18);
  border-radius: 10px;
  color: #eefbff;
}
.face-editor-dir-preview-thumb.is-active {
  border-color: rgba(255, 212, 0, 0.95);
  box-shadow: 0 0 0 2px rgba(255,212,0,0.28);
}
.face-editor-dir-preview-thumb.is-current {
  outline: 1px dashed rgba(132, 209, 235, 0.55);
  outline-offset: 1px;
}
.face-editor-part-browser-tools {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 2px;
}
.face-editor-part-filter-chip {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(132, 209, 235, 0.18);
  background: rgba(8, 18, 28, 0.72);
  color: #eefbff;
  cursor: pointer;
  font-size: 12px;
}
.face-editor-part-filter-chip.is-active {
  border-color: rgba(255, 212, 0, 0.95);
  box-shadow: 0 0 0 2px rgba(255,212,0,0.28);
}
.face-editor-part-browser-empty {
  width: 100%;
  padding: 8px 10px;
  border: 1px dashed rgba(132, 209, 235, 0.18);
  border-radius: 10px;
  color: #d8eef4;
  font-size: 12px;
  background: rgba(8, 18, 28, 0.42);
}


.face-editor-dir-chip{display:flex;flex-direction:column;align-items:center;gap:4px;min-width:56px;padding:6px;}
.face-editor-dir-chip-preview{width:40px;height:40px;border:1px solid rgba(255,255,255,.14);background-repeat:no-repeat;background-position:center;background-size:contain;border-radius:6px;image-rendering:pixelated;}
.face-editor-dir-chip-label{font-size:11px;line-height:1;}
.face-editor-sheet-tools input{width:56px;}


.face-editor-sheet-naming-tools input{min-width:180px;width:220px;}
.face-editor-sheet-preview{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(120px,1fr));
  gap:8px;
  max-height:280px;
  overflow:auto;
  padding:4px 2px 2px;
}
.face-editor-sheet-preview-card{
  display:flex;
  flex-direction:column;
  gap:4px;
  padding:8px;
  border-radius:10px;
  border:1px solid rgba(132,209,235,.18);
  background:rgba(8,18,28,.72);
  color:#eefbff;
  text-align:left;
  cursor:pointer;
}
.face-editor-sheet-preview-card.is-active{
  border-color:rgba(255,212,0,.95);
  box-shadow:0 0 0 2px rgba(255,212,0,.28);
}
.face-editor-sheet-preview-thumb{
  width:100%;
  aspect-ratio:1/1;
  border:1px solid rgba(255,255,255,.14);
  border-radius:8px;
  background:rgba(255,255,255,.04);
  background-repeat:no-repeat;
  background-position:center;
  background-size:contain;
  image-rendering:pixelated;
}
.face-editor-sheet-preview-label{font-size:11px;opacity:.9;}
.face-editor-sheet-preview-name{font-size:12px;font-weight:600;word-break:break-word;}
.face-editor-sheet-preview-sub{font-size:11px;opacity:.78;word-break:break-word;}
.face-editor-sheet-preview-empty{
  padding:10px 12px;
  border:1px dashed rgba(132,209,235,.18);
  border-radius:10px;
  color:#d8eef4;
  background:rgba(8,18,28,.42);
}

@media (max-width: 1100px) {
  .face-editor-compare-wrap { grid-template-columns: 1fr; }
}


#face-editor-override-jump-select { min-width: 220px; max-width: 280px; }
.face-editor-summary-jump { background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.14); color: inherit; border-radius: 999px; padding: 2px 8px; cursor: pointer; }
.face-editor-summary-jump:hover { background: rgba(255,255,255,0.14); }
.face-editor-session-modified { box-shadow: inset 0 0 0 2px rgba(90, 200, 120, 0.9); }
.face-editor-session-cleared { box-shadow: inset 0 0 0 2px rgba(255, 120, 120, 0.95); }
.face-editor-override-legend .face-editor-legend-dot-modified, .face-editor-override-legend .face-editor-legend-dot-cleared { display:inline-block; width:10px; height:10px; border-radius:50%; margin:0 4px 0 10px; vertical-align:middle; }
.face-editor-override-legend .face-editor-legend-dot-modified { background: rgba(90, 200, 120, 0.95); }
.face-editor-override-legend .face-editor-legend-dot-cleared { background: rgba(255, 120, 120, 0.95); }


/* Phase 10 duplicate root-shell block removed. The stronger Phase 11 contract below is authoritative. */

/* ============================================================
   RACE REFACTOR PHASE 11 — root-shell authority cleanup
   Remove another layer of legacy ID ownership and let the root
   shell classes drive arenas/results consistently.
   ============================================================ */
.race-arena-root {
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}

.race-arena-root > .panel-header {
  flex: 0 0 auto !important;
}

.race-arena-root > .panel-body,
.race-arena-root .race-panel-body {
  position: relative !important;
  display: block !important;
  flex: 1 1 auto !important;
  width: 100% !important;
  height: auto !important;
  min-width: 0 !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  background: transparent !important;
}

.race-arena-root :is(canvas, [id$="-chao-container"]) {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  margin: 0 !important;
}

.race-arena-root :is(#race3-result, #race4-result, #race-multiplayer-result) {
  position: absolute !important;
  left: 12px !important;
  bottom: 10px !important;
  right: auto !important;
  margin: 0 !important;
  z-index: 5 !important;
  text-align: left !important;
  pointer-events: none !important;
}

.race-arena-root .arena-footer {
  position: absolute !important;
  inset-inline: 0 !important;
  bottom: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 8px 12px !important;
  box-sizing: border-box !important;
  z-index: 6 !important;
  pointer-events: none !important;
}

.race-arena-root .arena-footer > * {
  pointer-events: auto !important;
}

.results-shell-root {
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}

.results-shell-root > .panel-header {
  flex: 0 0 auto !important;
}

.results-shell-root > .panel-body.global-results-panel-body {
  display: flex !important;
  flex: 1 1 auto !important;
  flex-direction: column !important;
  min-width: 0 !important;
  min-height: 0 !important;
  height: auto !important;
  padding: 12px !important;
  overflow: hidden !important;
}

.results-shell-root #global-results-banner,
.results-shell-root #global-results-title,
.results-shell-root #global-results-page-indicator,
.results-shell-root #global-results-footer {
  flex: 0 0 auto;
}

.results-shell-root #global-results-body {
  display: flex !important;
  flex: 1 1 auto !important;
  flex-direction: column !important;
  justify-content: flex-start !important;
  align-items: stretch !important;
  width: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 18px 16px !important;
  overflow: auto !important;
  box-sizing: border-box !important;
}

.results-shell-root #global-results-list {
  width: 100% !important;
  max-width: 1180px !important;
  margin: 0 auto !important;
  box-sizing: border-box !important;
}

.results-shell-root .results-page {
  width: min(100%, 1180px) !important;
  max-width: 1180px !important;
  min-width: 0 !important;
  min-height: 0 !important;
  margin: 0 auto !important;
  flex: 0 0 auto !important;
}

.results-shell-root #results-page-overview:not(.hidden) {
  display: grid !important;
}

.results-shell-root #results-page-chao-rewards:not(.hidden) {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  justify-content: flex-start !important;
}

.results-shell-root #results-reward-nav {
  width: auto !important;
  max-width: 100% !important;
  justify-content: center !important;
}

.results-shell-root #results-reward-content {
  display: grid !important;
  width: min(100%, 1040px) !important;
  max-width: 1040px !important;
  margin: 0 auto !important;
  grid-template-columns: minmax(320px, 0.9fr) minmax(0, 1.1fr) !important;
  gap: 16px !important;
  align-content: start !important;
}

.results-shell-root #results-page-summary:not(.hidden) {
  display: flex !important;
  align-items: flex-start !important;
  justify-content: center !important;
}

.results-shell-root #results-page-summary > #results-summary-list {
  width: 100% !important;
  max-width: 980px !important;
  margin: 0 auto !important;
}

.results-shell-root .results-page.hidden,
.results-shell-root .legacy-results-hidden {
  display: none !important;
}


.results-shell-root #results-page-overview {
  align-content: start !important;
}

.results-shell-root #results-overview-stage,
.results-shell-root #results-overview-sidebar,
.results-shell-root #results-reward-stage,
.results-shell-root #results-reward-feed,
.results-shell-root #results-summary-list {
  min-width: 0 !important;
}

.results-shell-root #results-overview-stage,
.results-shell-root #results-reward-stage {
  min-height: 420px !important;
}

.results-shell-root #results-overview-sidebar,
.results-shell-root #results-reward-feed,
.results-shell-root #results-summary-list {
  max-height: 100% !important;
}

.results-shell-root #global-results-footer {
  justify-content: center !important;
  gap: 18px !important;
}

/* Face editor basic/advanced mode */
#chao-face-editor-panel.face-editor-mode-basic [data-face-editor-advanced] {
  display: none !important;
}
.face-editor-mode-row {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.face-editor-mode-btn {
  background: rgba(42, 108, 146, 0.6);
  color: #fff;
  border: 1px solid rgba(132, 209, 235, 0.24);
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
}
.face-editor-mode-btn.is-active {
  border-color: rgba(255, 212, 0, 0.95);
  box-shadow: 0 0 0 2px rgba(255,212,0,0.22);
  background: rgba(70, 124, 44, 0.78);
}
.face-editor-mode-hint {
  font-size: 12px;
  color: rgba(221, 244, 255, 0.82);
}
#face-editor-project-store-status {
  min-height: 18px;
}
