:root {
  color-scheme: dark;
  --bg: #121113;
  --panel: #1a181c;
  --line: #353036;
  --text: #f2eee7;
  --muted: #b0a6ab;
  --gold: #c7b18e;
  --wine: #783b4c;
  --wine-light: #a46173;
  --top: 80px;
  --sidebar: 326px;
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  font-size: 16px;
  background: var(--bg);
  color: var(--text);
}
button,
input,
select {
  font: inherit;
}
button,
a,
input,
select {
  -webkit-tap-highlight-color: transparent;
}
button {
  border: 1px solid var(--line);
  background: #272329;
  color: var(--text);
  border-radius: 8px;
  padding: 0.63rem 0.8rem;
  cursor: pointer;
  font-size: 0.875rem;
  transition:
    background 0.15s,
    border-color 0.15s;
}
button:hover {
  background: #383039;
  border-color: #76616c;
}
button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
button.active {
  color: var(--gold);
  background: #3b3034;
  border-color: #756051;
}
button.primary {
  background: var(--wine);
  border-color: var(--wine-light);
  font-weight: 600;
}
button.primary:hover {
  background: #934a60;
}
button.icon-button {
  min-width: 38px;
  padding: 0.5rem;
  font-size: 1.15rem;
  line-height: 1.15;
}
.text-button {
  background: none;
  border-color: transparent;
  color: var(--gold);
  padding: 0.4rem 0.2rem;
  font-size: 0.8rem;
}
a {
  color: var(--gold);
}
button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}
input,
select {
  width: 100%;
  border: 1px solid #4b4049;
  background: #100e12;
  color: var(--text);
  border-radius: 7px;
  padding: 0.65rem 0.7rem;
  font-size: 0.9rem;
}
input[type="range"] {
  accent-color: var(--wine-light);
  padding: 0;
  border: 0;
  height: 24px;
  background: none;
}
input[type="color"] {
  padding: 3px;
  width: 44px;
  height: 34px;
}
input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--wine-light);
}
label {
  display: block;
  font-size: 0.875rem;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h2 {
  font-size: 1.1rem;
  font-weight: 550;
}
h3 {
  font-size: 0.95rem;
  font-weight: 550;
  margin: 1rem 0 0.7rem;
}
p {
  line-height: 1.55;
}
.hidden {
  display: none !important;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
#view {
  position: absolute;
  inset: var(--top) 0 0 var(--sidebar);
  width: calc(100% - var(--sidebar));
  height: calc(100% - var(--top));
  display: block;
  touch-action: none;
  outline: none;
}
.topbar {
  height: var(--top);
  position: absolute;
  inset: 0 0 auto;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  gap: 20px;
  background: #171417;
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  text-decoration: none;
  min-width: 260px;
}
.brand img {
  width: 33px;
  height: 43px;
}
.brand span {
  font-family: Georgia, serif;
  font-size: 1.65rem;
  color: var(--text);
  letter-spacing: 0.02em;
}
.brand small {
  display: block;
  font-family: Inter, "Segoe UI", sans-serif;
  font-size: 0.6rem;
  letter-spacing: 0.23em;
  color: var(--gold);
  margin-top: 2px;
}
.mode-switch {
  display: flex;
  border: 1px solid var(--line);
  padding: 4px;
  border-radius: 10px;
  gap: 2px;
}
.mode-switch button {
  border-color: transparent;
  background: none;
  min-width: 80px;
  padding: 0.5rem 0.7rem;
}
.mode-switch button.active {
  background: #3d3036;
  border-color: #66505b;
  color: #ffe7cc;
}
.top-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
#quality-button {
  background: none;
  border-color: transparent;
  color: var(--muted);
}
#quality-label {
  color: var(--text);
  display: block;
  font-size: 0.75rem;
}
.sidebar {
  position: absolute;
  z-index: 12;
  left: 0;
  top: var(--top);
  bottom: 0;
  width: var(--sidebar);
  background: #19161a;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}
.project-heading {
  padding: 28px 24px 22px;
}
.eyebrow {
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  color: var(--gold);
  font-weight: 650;
}
.project-heading h1 {
  font-family: Georgia, serif;
  font-weight: 400;
  font-size: 1.65rem;
  margin: 0.5rem 0;
}
.project-heading p {
  font-size: 0.8rem;
  color: var(--muted);
}
.tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
}
.tabs button {
  border: 0;
  background: none;
  color: var(--muted);
  border-radius: 0;
  padding: 0.8rem 0;
  font-size: 0.8rem;
  border-bottom: 2px solid transparent;
}
.tabs button.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}
.panel {
  padding: 22px 20px;
  overflow: auto;
  flex: 1;
  scrollbar-width: thin;
  scrollbar-color: #54434e transparent;
}
.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.badge {
  border: 1px solid #5f4c43;
  color: var(--gold);
  font-size: 0.65rem;
  padding: 4px 7px;
  border-radius: 5px;
  white-space: nowrap;
}
.muted {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0.6rem 0 1rem;
}
.places-list {
  display: grid;
  gap: 9px;
  margin: 18px 0;
}
.place-card {
  display: flex;
  text-align: left;
  align-items: center;
  gap: 12px;
  padding: 13px 12px;
  background: #242026;
  border-color: #373039;
}
.place-card .place-icon {
  width: 36px;
  height: 36px;
  border-radius: 7px;
  background: #3c2b32;
  color: #d0ac9d;
  display: grid;
  place-items: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}
.place-card strong {
  font-size: 0.875rem;
  font-weight: 500;
  display: block;
}
.place-card small {
  color: var(--muted);
  font-size: 0.72rem;
  margin-top: 4px;
  display: block;
}
.quiet-note {
  color: #9f949c;
  font-size: 0.75rem;
  line-height: 1.65;
  margin-top: 20px;
}
.sidebar-footer {
  border-top: 1px solid var(--line);
  padding: 13px 20px;
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 0.7rem;
}
.sidebar-footer span:last-child {
  color: var(--gold);
}
.search {
  margin: 16px 0;
}
.group-tree details {
  border-bottom: 1px solid #322b32;
}
.group-tree summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 0;
  cursor: pointer;
  list-style: none;
}
.group-tree summary::before {
  content: "›";
  color: #a38b95;
  font-size: 1rem;
  transform: rotate(0);
}
.group-tree details[open] > summary::before {
  transform: rotate(90deg);
}
.group-tree summary .group-title {
  flex: 1;
  font-size: 0.875rem;
}
.group-count {
  color: #a398a0;
  font-size: 0.7rem;
}
.eye-button {
  background: none;
  border: 0;
  padding: 0.3rem;
  min-width: 30px;
  min-height: 30px;
  color: var(--gold);
}
.eye-button.off {
  color: #736970;
}
.object-list {
  padding: 0 0 10px 10px;
}
.object-row {
  display: flex;
  gap: 4px;
  align-items: center;
  margin-bottom: 2px;
}
.object-row > .object-name {
  flex: 1;
  border: 0;
  background: none;
  text-align: left;
  padding: 7px 5px;
  font-size: 0.78rem;
  color: #d8cfd5;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.object-row > .object-name.selected {
  background: #452e39;
  color: #ffe9d5;
}
.object-row .eye-button {
  font-size: 0.8rem;
}
.group-appearance {
  width: 100%;
  text-align: left;
  border: 0;
  background: #30252d;
  color: var(--gold);
  font-size: 0.75rem;
  margin-bottom: 7px;
}
.subgroup {
  margin-left: 12px;
}
.search-count {
  font-size: 0.75rem;
  color: var(--muted);
  margin: 10px 0;
}
.control-block {
  display: block;
  margin: 20px 0;
}
.control-block > label {
  display: flex;
  justify-content: space-between;
  gap: 5px;
  font-size: 0.85rem;
  margin-bottom: 9px;
}
.control-block output {
  color: var(--gold);
  font-size: 0.8rem;
}
.light-row .light-name {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 0.85rem;
}
.light-row {
  border-bottom: 1px solid #322b32;
  padding: 13px 0;
}
.light-row input[type="range"] {
  display: block;
}
.light-row output {
  margin-left: auto;
  color: var(--gold);
  font-size: 0.78rem;
}
.light-presets {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 16px 0;
}
.light-presets button {
  font-size: 0.75rem;
  flex: 1;
  padding: 0.6rem 0.3rem;
  white-space: nowrap;
}
hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 22px 0;
}
.subtabs {
  display: flex;
  gap: 5px;
  margin: 16px 0;
}
.subtabs button {
  flex: 1;
}
.arr-card {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 14px;
  margin-bottom: 12px;
  background: #242027;
}
.arr-card h3 {
  margin: 0 0 6px;
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}
.arr-card p {
  font-size: 0.75rem;
  color: var(--muted);
}
.arr-card .card-actions {
  display: flex;
  gap: 6px;
  margin-top: 11px;
}
.arr-card button {
  padding: 0.45rem 0.65rem;
  font-size: 0.75rem;
}
.arr-card .delete-arr {
  margin-left: auto;
  color: #de9fac;
}
.empty-state {
  padding: 22px 12px;
  border: 1px dashed #50414c;
  border-radius: 9px;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.6;
}
.file-actions {
  display: flex;
  gap: 7px;
  margin-top: 18px;
}
.file-actions button {
  flex: 1;
  font-size: 0.8rem;
}
.inspector {
  position: absolute;
  z-index: 14;
  right: 18px;
  top: calc(var(--top) + 18px);
  width: 282px;
  max-height: calc(100% - var(--top) - 120px);
  overflow: auto;
  background: #1b171dee;
  border: 1px solid #53414c;
  border-radius: 13px;
  box-shadow: 0 15px 60px #0006;
  padding: 18px;
  backdrop-filter: blur(15px);
}
.inspector-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.inspector h2 {
  font-family: Georgia, serif;
  font-size: 1.3rem;
  margin: 9px 0;
  overflow-wrap: anywhere;
}
.inspector-actions {
  display: flex;
  gap: 4px;
  margin: 15px 0;
}
.inspector-actions button {
  font-size: 0.75rem;
  padding: 0.5rem 0.6rem;
  flex: 1;
}
.transform-modes {
  display: flex;
  gap: 4px;
  margin: 20px 0 15px;
}
.transform-modes button {
  font-size: 0.75rem;
  padding: 0.5rem;
  flex: 1;
}
.field-label {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 12px 0 8px;
}
.xyz {
  display: flex;
  gap: 7px;
}
.xyz label {
  flex: 1;
  min-width: 0;
  font-size: 0.68rem;
  color: var(--muted);
}
.xyz input {
  margin-top: 5px;
  padding: 0.5rem 0.3rem;
  font-size: 0.82rem;
}
.two-fields {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}
.two-fields label {
  flex: 1;
  min-width: 0;
  font-size: 0.75rem;
  color: var(--muted);
}
.two-fields input {
  margin-top: 5px;
}
.swatches {
  display: flex;
  gap: 8px;
  align-items: center;
}
.swatch {
  border-radius: 50%;
  height: 29px;
  width: 29px;
  padding: 0;
  border: 2px solid #8a757b;
}
.swatch.black {
  background: #161316;
}
.swatch.burgundy {
  background: #501322;
}
.swatch.gold {
  background: #b7a17a;
}
.viewport-note {
  position: absolute;
  left: calc(var(--sidebar) + 24px);
  bottom: 25px;
  pointer-events: none;
  z-index: 8;
  text-shadow:
    0 2px 8px #000,
    0 1px 3px #000;
}
.viewport-note > span {
  display: block;
  font-family: Georgia, serif;
  font-size: 1.3rem;
}
.viewport-note small {
  display: block;
  font-size: 0.72rem;
  color: #e5d5cf;
  margin-top: 7px;
  max-width: 260px;
}
.bottom-tools {
  position: absolute;
  z-index: 13;
  bottom: 24px;
  left: calc(50% + var(--sidebar) / 2);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 5px;
  background: #211b22e8;
  border: 1px solid #65515c;
  border-radius: 11px;
  padding: 6px;
  backdrop-filter: blur(12px);
}
.bottom-tools button {
  background: none;
  border-color: transparent;
  white-space: nowrap;
}
.bottom-tools > span {
  height: 24px;
  width: 1px;
  background: #67525e;
}
.load-status {
  position: absolute;
  z-index: 18;
  top: calc(var(--top) + 15px);
  left: calc(var(--sidebar) + 20px);
  right: 320px;
  max-width: 450px;
  background: #29202bee;
  border: 1px solid #735365;
  border-radius: 10px;
  padding: 12px 14px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 7px;
  font-size: 0.8rem;
}
.load-status progress {
  grid-column: 1/-1;
  width: 100%;
  height: 5px;
}
.load-status button {
  grid-column: 2;
  grid-row: 1;
}
progress {
  accent-color: var(--gold);
  background: #3a3038;
  border: 0;
  border-radius: 10px;
}
progress::-webkit-progress-bar {
  background: #3a3038;
  border-radius: 10px;
}
progress::-webkit-progress-value {
  background: var(--gold);
  border-radius: 10px;
}
.welcome {
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, #100c11f8, #1e111cdf);
  z-index: 100;
  display: grid;
  place-items: center;
  backdrop-filter: blur(10px);
  padding: 25px;
}
.welcome-card {
  width: min(410px, 100%);
  text-align: center;
}
.welcome-mark {
  width: 55px;
  height: 66px;
  display: block;
  margin: 0 auto 24px;
}
.welcome h2 {
  font-family: Georgia, serif;
  font-size: 3.5rem;
  font-weight: 400;
  line-height: 1.1;
  margin: 20px 0;
}
.welcome h2 em {
  color: #d0af9f;
  font-weight: 400;
}
.welcome p {
  font-size: 0.9rem;
  color: #b9adb4;
  margin: 20px 0;
}
.welcome progress {
  width: 100%;
  height: 4px;
}
.welcome #initial-status {
  font-size: 0.78rem;
  min-height: 22px;
  margin: 8px 0 18px;
}
.welcome .primary {
  display: block;
  width: 100%;
  padding: 0.9rem;
  font-size: 0.95rem;
}
.welcome small {
  display: block;
  font-size: 0.7rem;
  color: #a3929a;
  margin-top: 22px;
}
dialog {
  border: 1px solid #6c5260;
  color: var(--text);
  background: #211a22;
  border-radius: 15px;
  width: min(470px, calc(100vw - 32px));
  padding: 24px;
  max-height: 90vh;
  box-shadow: 0 25px 100px #0008;
}
dialog::backdrop {
  background: #08070bb0;
  backdrop-filter: blur(6px);
}
.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 20px;
}
.dialog-head h2 {
  font-family: Georgia, serif;
  font-size: 1.6rem;
  font-weight: 400;
}
dialog form > label {
  margin-top: 16px;
}
dialog form > label input:not([type="checkbox"]) {
  margin-top: 8px;
}
.check-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 20px 0 !important;
}
.dialog-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 22px;
}
.help-content p {
  font-size: 0.875rem;
  color: #d3c6cf;
  line-height: 1.7;
}
.help-content .quiet-note {
  color: var(--muted);
  font-size: 0.75rem;
}
.error {
  color: #ffb4c2;
  font-size: 0.85rem;
}
.toast {
  position: absolute;
  z-index: 200;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  max-width: min(580px, 90vw);
  background: #eee5d9;
  color: #2a2328;
  border: 1px solid #fff6;
  padding: 12px 20px;
  border-radius: 9px;
  font-size: 0.875rem;
  box-shadow: 0 8px 35px #0006;
}
.mobile-only {
  display: none;
}
.touch-controls {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}
#touch-pad {
  position: absolute;
  bottom: 105px;
  left: calc(var(--sidebar) + 25px);
  width: 110px;
  height: 110px;
  border: 1px solid #cfb3be88;
  border-radius: 50%;
  background: #25152066;
  pointer-events: auto;
  touch-action: none;
  display: grid;
  place-items: center;
}
#touch-knob {
  display: block;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #c8a2b2a0;
  border: 1px solid #f9e1d0;
}
.touch-height {
  position: absolute;
  bottom: 110px;
  right: 22px;
  display: grid;
  gap: 10px;
  pointer-events: auto;
}
.touch-height button {
  min-height: 44px;
  touch-action: none;
  background: #291b27cc;
}
@media (max-width: 1150px) {
  .topbar {
    padding: 0 14px;
    gap: 10px;
  }
  .brand {
    min-width: 225px;
  }
  .mode-switch button {
    min-width: 68px;
  }
  .viewport-note {
    bottom: 85px;
  }
  .inspector {
    right: 12px;
    width: 260px;
  }
  .load-status {
    right: 25px;
  }
}
@media (max-width: 850px) {
  :root {
    --top: 68px;
    --sidebar: 0px;
  }
  .mobile-only {
    display: block;
  }
  .topbar {
    gap: 7px;
    padding: 0 12px;
  }
  .brand {
    min-width: 0;
    flex: 1;
    gap: 8px;
  }
  .brand span {
    font-size: 1.4rem;
  }
  .brand img {
    width: 26px;
    height: 34px;
  }
  .brand small {
    font-size: 0.5rem;
  }
  .top-actions {
    gap: 3px;
  }
  .top-actions .primary {
    display: none;
  }
  .mode-switch {
    position: absolute;
    top: 78px;
    left: 50%;
    transform: translateX(-50%);
    background: #211b22e8;
    z-index: 16;
  }
  .mode-switch button {
    min-width: 75px;
    padding: 0.45rem 0.8rem;
  }
  .sidebar {
    width: min(326px, 90vw);
    transform: translateX(-100%);
    transition: transform 0.2s;
    box-shadow: 20px 0 70px #0007;
    z-index: 30;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .inspector {
    right: 8px;
    left: 8px;
    top: auto;
    bottom: 84px;
    width: auto;
    max-height: 47vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 14px;
    padding: 16px;
  }
  .inspector-head,
  .inspector h2,
  .inspector .muted,
  .inspector-actions,
  #protected-note {
    grid-column: 1/-1;
  }
  .inspector h2 {
    font-size: 1.15rem;
  }
  .inspector .muted {
    margin: 0.2rem 0;
    font-size: 0.75rem;
  }
  .inspector .quiet-note {
    display: none;
  }
  .bottom-tools {
    bottom: max(14px, env(safe-area-inset-bottom));
    left: 50%;
    gap: 1px;
  }
  .bottom-tools button {
    font-size: 0.78rem;
    padding: 0.5rem 0.55rem;
  }
  .viewport-note {
    left: 18px;
    bottom: 76px;
  }
  .viewport-note > span {
    font-size: 1.1rem;
  }
  .viewport-note small {
    max-width: 270px;
    font-size: 0.68rem;
  }
  .load-status {
    left: 12px;
    right: 12px;
    top: 132px;
    max-width: none;
  }
  .project-heading {
    padding-top: 22px;
  }
  #quality-button {
    padding: 0.3rem;
    font-size: 0.7rem;
  }
  #quality-label {
    font-size: 0.6rem;
  }
  .touch-controls #touch-pad {
    left: 20px;
  }
  .touch-controls .touch-height {
    right: 20px;
  }
  .welcome h2 {
    font-size: 3rem;
  }
  .panel {
    padding-bottom: 25px;
  }
  .toast {
    bottom: 82px;
  }
  .mode-switch button.active {
    background: #633e50;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
