/* Geometry measured in the Unity Bicycle inspector: 56px rail, 44px header,
   330px property sheet. Both library and viewer use this same property sheet. */
:root {
  --sheet-width: 330px;
  --sheet-bg: #1a1a1a;
  --scene-bg: #121212;
}
body.has-inspection #assetInspector {
  display: flex !important;
  width: var(--sheet-width);
  background: var(--sheet-bg);
}
#assetInspector > .inspector-heading {
  display: none;
}
.has-inspection #inspectorBody {
  height: 100%;
}
@media (min-width: 681px) {
  .has-inspection #mainContent {
    margin-right: var(--sheet-width);
  }
  .has-inspection .catalog-footer {
    right: calc(var(--sheet-width) + 12px);
  }
}
body.has-inspection .selection-bar {
  background: var(--selection);
}
.asset-card-shell.selected .asset-card {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}
.asset-card .asset-visual {
  aspect-ratio: 1;
  background: radial-gradient(ellipse at 50% 35%, #444, #292929 65%, #202020);
}
.asset-card .asset-visual .payload-badge,
.asset-card .asset-visual .type-badge {
  display: none;
}
.asset-card .asset-visual::before {
  content: '';
  position: absolute;
  z-index: 1;
  left: 10px;
  top: 10px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}
.asset-card[data-current='true'] .asset-visual::before {
  background: #16a096;
}
.asset-info .card-type,
.asset-info .asset-project {
  display: none;
}
.list .asset-info .asset-project {
  display: block;
}
.asset-card .card-bottom {
  display: flex;
  font-size: 11px;
  color: var(--muted);
  margin: 4px 0 0;
}
.asset-card .asset-info {
  padding: 9px 11px;
}
.card-title-row > .ui-icon {
  color: var(--type-color, var(--link));
}
.card-status-icon {
  position: absolute;
  top: 6px;
  right: 6px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  background: #252525d9;
}
.card-status-icon .ui-icon {
  width: 13px;
  height: 13px;
}
.asset-sheet {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--sheet-bg);
  color: var(--text);
  font-size: 13px;
}
.sheet-tabs {
  display: flex;
  align-items: center;
  flex: none;
  height: 46px;
  border-bottom: 1px solid var(--line);
}
.sheet-tabs > [role='tab'] {
  height: 100%;
  flex: 1;
  font-size: 13px;
  border-bottom: 2px solid transparent;
  color: var(--muted);
}
.sheet-tabs > [aria-selected='true'] {
  border-color: var(--accent);
  color: var(--text);
}
.sheet-tabs > .icon-button {
  margin: 0 8px;
  width: 30px;
  height: 30px;
  background: var(--field-bg);
}
.sheet-tabs .ui-icon {
  width: 16px;
  height: 16px;
}
.sheet-scroll {
  overflow: auto;
  scrollbar-width: thin;
  min-height: 0;
  flex: 1;
}
.sheet-facts {
  padding: 18px 16px 8px;
}
.sheet-facts h2 {
  font-size: 17px;
  line-height: 1.35;
  margin: 0 0 6px;
  letter-spacing: 0;
}
.sheet-kind {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: var(--text-secondary);
}
.sheet-kind .ui-icon,
.dataset-entry > button .ui-icon {
  width: 15px;
  height: 15px;
  color: var(--type-color, var(--link));
}
.sheet-version {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 22px;
}
.sheet-version select {
  width: auto;
  max-width: 65%;
  padding: 5px 8px;
  font-size: 12px;
}
.sheet-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 6px;
  font-size: 11px;
}
.sheet-state:before {
  content: '';
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--muted);
}
.sheet-state.current:before {
  background: #16a096;
}
.sheet-property {
  margin: 16px 0;
  font-size: 13px;
  overflow-wrap: anywhere;
}
.sheet-property > span {
  display: block;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.sheet-tag {
  display: inline-block;
  padding: 2px 7px;
  margin: 0 4px 3px 0;
  border-radius: 12px;
  background: var(--field-bg);
  font-size: 11px;
}
.sheet-section {
  border-top: 1px solid var(--line);
  padding: 0 12px;
}
.sheet-section > summary {
  list-style: none;
  cursor: pointer;
  padding: 11px 0;
  font-size: 13px;
}
.sheet-section > summary:after {
  content: '▾';
  margin-left: 8px;
  color: var(--muted);
}
.sheet-section:not([open]) > summary:after {
  content: '▸';
}
.sheet-section > .sheet-property {
  margin: 12px 4px 18px;
}
.sheet-action {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  min-height: 32px;
  font-size: 12px;
  padding: 6px 8px;
  text-align: left;
  color: var(--text);
  text-decoration: none;
}
.sheet-action:hover,
.viewer-head .icon-button:hover {
  background: var(--surface-hover);
}
.sheet-action .ui-icon {
  width: 16px;
  height: 16px;
}
.sheet-section > .sheet-action {
  display: flex;
  width: 100%;
}
.sheet-cover {
  flex: none;
  border-top: 1px solid var(--border);
  height: clamp(150px, 32%, 320px);
  display: flex;
  flex-direction: column;
}
.sheet-cover-title {
  background: var(--field-bg);
  padding: 6px 14px;
}
.sheet-cover-image {
  position: relative;
  display: grid;
  place-items: center;
  flex: 1;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 30%, #424242, var(--scene-bg));
}
.sheet-cover-image img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.sheet-cover-image > .ui-icon {
  width: 64px;
  height: 64px;
  color: var(--muted);
}
.sheet-cover-image > span {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 5px 8px;
  background: #232323da;
  border-radius: 4px;
  color: var(--text);
  font-size: 12px;
}
.sheet-segments {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--field-bg);
  margin: 16px 16px 12px;
  overflow: hidden;
}
.sheet-segments button {
  flex: 1;
  justify-content: center;
  min-width: 0;
}
.sheet-segments button[aria-pressed='true'] {
  background: var(--selection);
  color: var(--link);
}
.dataset-tools {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 15px 14px;
}
.dataset-tools > input {
  flex: 1;
  width: 0;
  font-size: 12px;
  padding: 6px;
}
.hidden-files {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--muted);
}
.hidden-files input {
  width: auto;
}
.dataset-list .sheet-section {
  padding: 0;
  border-color: var(--line);
}
.dataset-list .sheet-section summary {
  padding: 9px 16px;
}
.dataset-entry > .sheet-action {
  width: 100%;
  min-height: 31px;
  padding: 4px 16px 4px 34px;
  overflow-wrap: anywhere;
}
.dataset-entry.chosen > button {
  background: var(--selection);
}
.file-actions {
  padding: 3px 8px 8px 40px;
}
.file-actions button {
  display: flex;
  max-width: 100%;
  font-size: 11px;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}
.sheet-muted {
  padding: 8px 14px;
  color: var(--muted);
  font-size: 12px;
}
.files-sheet > .dataset-list > select {
  margin: 10px;
  width: calc(100% - 20px);
}
.asset-sheet .dependency-workspace {
  display: block;
  padding: 0 12px;
}
.asset-sheet .dependency-add form {
  grid-template-columns: 1fr;
}
.asset-sheet .upload-panel {
  padding: 8px;
  min-width: 0;
}
#detailDialog.in-viewer {
  position: fixed;
  inset: var(--header) 0 0;
  margin: 0;
  width: 100%;
  max-width: none;
  height: calc(100dvh - var(--header));
  max-height: none;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: var(--scene-bg);
  overflow: hidden;
}
#detailDialog.in-viewer::backdrop {
  background: transparent;
}
#detailDialog.in-viewer > .dialog-header {
  display: none;
}
#detailDialog.in-viewer #detailBody {
  height: 100%;
  padding: 0;
}
.reference-viewer > .viewer-center {
  grid-column: 2;
  grid-row: 2;
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 0;
  margin: 0;
  max-width: none;
  height: auto;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 0%, #444 0%, #252525 49%, #121212 80%);
}
.reference-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.reference-stage > .preview-caption,
.reference-stage > .preview-actions,
.reference-stage > .preview-tools,
.reference-stage > .live-preview > .preview-selector,
.reference-stage > p.muted:empty {
  display: none;
}
.reference-stage .preview-poster,
.reference-stage > .live-preview,
.reference-stage .live-preview-content {
  height: 100%;
  width: 100%;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  aspect-ratio: auto;
  background: transparent;
}
.reference-stage .model-viewport,
.reference-stage .image-stage {
  position: absolute;
  inset: 0;
  height: 100%;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.reference-stage .model-controls {
  position: absolute;
  bottom: 8px;
  left: 8px;
  right: 8px;
  width: fit-content;
  max-width: calc(100% - 16px);
  margin: 0;
  padding: 4px;
  background: #202020e8;
  border: 1px solid var(--border);
  border-radius: 5px;
  gap: 2px;
  z-index: 2;
}
.reference-stage .model-controls .icon-button {
  width: 28px;
  min-height: 28px;
  height: 28px;
  padding: 5px;
}
.reference-stage .model-controls select {
  width: 115px;
  padding: 4px;
  font-size: 11px;
}
.reference-stage .viewer-stats {
  display: none;
}
.reference-stage .model-inspector {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  z-index: 3;
  background: var(--sheet-bg);
  max-height: 55%;
  overflow: auto;
}
.reference-stage .model-timeline {
  position: absolute;
  top: 4px;
  left: 4px;
  right: 4px;
}
.reference-stage .model-note:not(:empty) {
  position: absolute;
  top: 0;
  left: 8px;
  right: 8px;
  z-index: 1;
  font-size: 11px;
  pointer-events: none;
}
.reference-stage .model-note:has(~ .model-timeline) {
  top: 48px;
}
.reference-stage .media-viewer {
  height: 100%;
}
.reference-stage .media-viewer > .viewer-toolbar {
  position: absolute;
  bottom: 4px;
  left: 8px;
  right: 8px;
  background: var(--sheet-bg);
}
.reference-stage .audio-stage {
  height: calc(100% - 65px);
  background: transparent;
  border: 0;
}
.reference-stage .inline-notice {
  position: relative;
  z-index: 2;
  background: var(--sheet-bg);
  margin: 8px;
}
.reference-stage .live-preview:has(> .inline-notice),
.reference-stage .live-preview:has(.live-preview-content > .inline-notice) {
  height: auto;
}
.reference-stage .preview-start {
  min-height: 36px;
  padding: 8px 14px;
}
.reference-stage .preview-empty {
  height: 100%;
  background: transparent;
}
.viewer-management {
  overflow: auto;
  padding: 16px;
  background: var(--surface);
  height: 100%;
}
#detailBody > .inline-notice {
  position: absolute;
  top: 45px;
  left: 60px;
  z-index: 5;
}
#detailDialog.in-viewer::backdrop {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.scene-lighting {
  position: absolute;
  bottom: 68px;
  left: 8px;
  z-index: 4;
  padding: 12px;
  width: min(215px, 90%);
  background: var(--sheet-bg);
  border: 1px solid var(--border);
  border-radius: 5px;
}
.scene-lighting label {
  display: block;
  font-size: 11px;
  margin: 6px 0;
}
.scene-lighting input {
  display: block;
  width: 100%;
  padding: 0;
  accent-color: var(--accent);
}
.reference-stage > .preview-tools[open] {
  position: absolute;
  display: block;
  background: var(--sheet-bg);
  padding: 14px;
  right: 8px;
  top: 8px;
  max-width: min(330px, 95%);
  max-height: 80%;
  overflow: auto;
  border: 1px solid var(--border);
  z-index: 5;
}
.sheet-version .icon-button {
  margin-left: auto;
  color: var(--link);
  width: 28px;
  height: 28px;
}
.sheet-version .icon-button .ui-icon {
  width: 15px;
  height: 15px;
}
.reference-stage .live-preview-content[aria-busy='true']:after {
  content: 'Загружаем ресурс…';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  color: var(--text-secondary);
  font-size: 13px;
  pointer-events: none;
}
.reference-stage .model-viewport {
  background: linear-gradient(165deg, #71849b 0%, #647177 44%, #535e58 76%, #414a44 100%);
}
.scene-utility,
.scene-navigation {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  border-radius: 5px;
  background: #202020d9;
  z-index: 2;
}
.scene-navigation {
  top: 46px;
}
.scene-utility .icon-button,
.scene-navigation .icon-button {
  display: grid;
  place-items: center;
  width: 29px;
  height: 29px;
}
.scene-utility .ui-icon,
.scene-navigation .ui-icon {
  width: 16px;
  height: 16px;
}
.channel-picker {
  display: flex;
  align-items: center;
  gap: 4px;
}
.channel-picker .ui-icon {
  width: 16px;
  height: 16px;
}
.reference-stage .model-controls {
  opacity: 0.85;
}
.reference-stage:hover .model-controls,
.model-controls:focus-within {
  opacity: 1;
}
.viewer-download .ui-icon {
  width: 13px;
  height: 13px;
}
.viewer-download[aria-disabled='true'] {
  opacity: 0.5;
}
.axis-compass {
  position: absolute;
  right: 8px;
  bottom: 12px;
  width: 90px;
  height: 90px;
  z-index: 1;
  pointer-events: none;
}
.axis-compass:before {
  content: '';
  position: absolute;
  inset: 41px;
  border-radius: 50%;
  background: #c9cacc99;
}
.axis-compass button {
  position: absolute;
  left: 38px;
  top: 38px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  font-size: 10px;
  line-height: 17px;
  padding: 0;
  background: #e65464;
  color: white;
  pointer-events: auto;
}
.axis-compass [data-axis='Y'] {
  background: #22825e;
}
.axis-compass [data-axis='Z'] {
  background: #327fbd;
}
@media (max-width: 680px) {
  .has-inspection:not(.inspector-visible) #assetInspector {
    display: none !important;
  }
  .axis-compass {
    bottom: 52px;
    transform: scale(0.8);
    transform-origin: right bottom;
  }
}

body:has(#detailDialog[open]) #assetInspector { visibility: hidden; }

.reference-stage .model-note:not(:empty) { width: fit-content; max-width: 55%; padding: 3px 7px; border-radius: 4px; background: #202020dc; color: var(--text); }

/* Viewer layout: a header, one large stage and one side panel. */
.reference-viewer {
  position: relative;
  height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--sheet-width);
  grid-template-rows: 48px minmax(0, 1fr);
}
.reference-viewer.sheet-closed {
  grid-template-columns: minmax(0, 1fr) 0;
}
.reference-viewer.sheet-closed .viewer-properties {
  visibility: hidden;
}
.viewer-head {
  grid-column: 1/3;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 0 10px 0 6px;
  background: var(--sheet-bg);
  border-bottom: 1px solid var(--line);
}
.viewer-head [hidden],
.reference-stage [hidden],
.sheet-tabs [hidden] {
  display: none !important;
}
.viewer-head .icon-button {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 4px;
  color: var(--text-secondary);
}
.viewer-head .icon-button:hover {
  color: var(--text);
}
.viewer-head .ui-icon {
  width: 16px;
  height: 16px;
}
.viewer-head h2 {
  flex: 0 1 auto;
  min-width: 60px;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
  letter-spacing: 0;
}
.viewer-kind {
  display: inline-grid;
  place-items: center;
  flex: none;
  margin-left: 4px;
  color: var(--text-secondary);
}
.viewer-head > .sheet-muted {
  flex: none;
  font-size: 12px;
}
.viewer-version {
  display: flex;
  flex: none;
  margin-left: auto;
}
.viewer-version .sheet-version {
  margin: 0;
  gap: 6px;
  align-items: center;
}
.viewer-version select {
  width: auto;
  max-width: 190px;
  min-height: 30px;
  padding: 3px 6px;
  font-size: 12px;
}
.viewer-head > .viewer-download {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 4px 12px;
  border: 0;
  border-radius: 4px;
  background: var(--accent);
  color: var(--white);
  font-size: 13px;
  text-decoration: none;
}
.viewer-head .rail-nav {
  display: inline-flex;
  flex: none;
  padding: 0;
  border: 0;
}
.viewer-head .rail-nav .icon-button:disabled {
  opacity: 0.35;
}
.rail-nav [data-step='-1'] .ui-icon {
  transform: rotate(180deg);
}
.viewer-rail {
  position: absolute;
  top: 48px;
  left: 0;
  bottom: 0;
  z-index: 6;
  width: min(280px, 85%);
  overflow: auto;
  background: var(--sheet-bg);
  border-right: 1px solid var(--line);
}
.rail-list .icon-button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  padding: 6px 10px;
  text-align: left;
}
.rail-list .icon-button[aria-current='true'] {
  background: var(--selection);
}
.rail-list .icon-button img {
  flex: none;
  width: 40px;
  height: 40px;
  object-fit: contain;
  background: var(--bg);
}
.rail-list .icon-button img ~ .ui-icon {
  display: none;
}
.rail-list .icon-button span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}
.reference-viewer > .viewer-center {
  grid-column: 1;
  background: #16181c;
}
.viewer-properties {
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border-left: 1px solid var(--line);
}
.viewer-waiting {
  display: grid;
  place-items: center;
  height: 100%;
  margin: 0;
}

/* Tools float over the stage: the object keeps the room. */
.reference-stage .model-controls {
  left: 50%;
  right: auto;
  bottom: 14px;
  transform: translateX(-50%);
  flex-wrap: nowrap;
  max-width: calc(100% - 24px);
  padding: 4px 6px;
  gap: 2px;
  background: #1d2025f0;
  border-radius: 8px;
  opacity: 1;
  box-shadow: 0 6px 20px #0006;
}
.reference-stage .model-controls .icon-button,
.scene-utility .icon-button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  border-radius: 5px;
  color: var(--text-secondary);
}
.reference-stage .model-controls .icon-button:hover,
.scene-utility .icon-button:hover {
  color: var(--text);
  background: #ffffff14;
}
.reference-stage .model-controls .icon-button[aria-pressed='true'],
.reference-stage .model-controls .icon-button[aria-expanded='true'] {
  color: var(--text);
  background: var(--selection);
}
.reference-stage .model-controls select {
  width: 128px;
  min-height: 32px;
  border: 0;
  background: transparent;
  font-size: 12px;
}
.toolbar-group {
  display: contents;
}
.toolbar-gap {
  flex: none;
  width: 1px;
  height: 20px;
  margin: 0 5px;
  background: var(--line);
}
.scene-utility {
  top: 12px;
  right: 12px;
  padding: 3px;
  background: #1d2025f0;
  border-radius: 8px;
}
.scene-lighting {
  left: 50%;
  bottom: 66px;
  transform: translateX(-50%);
  border-radius: 8px;
}
.reference-stage .model-timeline {
  top: auto;
  left: 50%;
  right: auto;
  bottom: 64px;
  transform: translateX(-50%);
  width: min(720px, calc(100% - 24px));
  z-index: 3;
  padding: 4px 8px;
  background: #1d2025f0;
  border-radius: 8px;
}
.reference-stage .unity-viewer {
  position: absolute;
  inset: 0;
  height: 100%;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: #16181c;
}
.unity-viewer-status {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #16181c;
  pointer-events: none;
}
.unity-viewer-status p {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
}
.unity-viewer-status progress {
  width: min(240px, 60%);
  height: 4px;
  accent-color: var(--accent);
}
.reference-stage .unity-viewer-note {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  max-width: 55%;
  margin: 0;
  padding: 5px 10px;
  font-size: 12px;
  color: var(--text-secondary);
  background: #1d2025f0;
  border-radius: 6px;
}
.unity-viewer-hint {
  position: absolute;
  left: 50%;
  bottom: 66px;
  transform: translateX(-50%);
  z-index: 1;
  margin: 0;
  max-width: 90%;
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}
.unity-viewer-hint:has(~ .model-timeline) {
  bottom: 118px;
}
.viewer-cover-status {
  top: 58px;
  left: auto;
  right: 12px;
  transform: none;
}

/* The object tab: what the asset is made of, next to its properties and files. */
.sheet-object {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.sheet-object[hidden] {
  display: none;
}
.object-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}
.object-summary {
  flex: none;
  margin: 0;
  padding: 10px 14px 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-secondary);
}
.object-tree {
  display: flex;
  flex-direction: column;
  flex: 3 1 0;
  min-height: 120px;
  padding: 10px 14px 8px;
  border-bottom: 1px solid var(--line);
}
.object-tree input {
  flex: none;
  margin-bottom: 8px;
}
.object-tree .model-part-list {
  flex: 1;
  min-height: 0;
  max-height: none;
  overflow: auto;
}
.object-details {
  flex: 2 1 0;
  min-height: 90px;
  overflow: auto;
  padding: 10px 14px;
}
.object-details h4 {
  margin: 0 0 4px;
  font-size: 14px;
  overflow-wrap: anywhere;
}
.object-details .muted {
  margin: 0 0 4px;
  font-size: 12px;
}
.object-details .viewer-toolbar {
  margin: 6px 0;
}
.object-details .material-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 8px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}
.object-details .material-card small {
  grid-column: 1/-1;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}
.object-details .material-swatch {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  border: 1px solid var(--line);
}
.unity-part {
  display: flex;
  align-items: center;
  gap: 2px;
  min-height: 26px;
  margin: 0;
  padding: 0 0 0 calc(var(--depth, 0) * 12px);
  border-radius: 4px;
}
.unity-part.selected {
  background: var(--selection);
}
.unity-part .icon-button {
  flex: none;
  min-height: 0;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  color: var(--text-secondary);
  opacity: 0.55;
}
.unity-part .icon-button[aria-pressed='true'] {
  opacity: 0.25;
}
.unity-part:hover .icon-button {
  opacity: 1;
}
.unity-part.inactive .model-part-name {
  opacity: 0.5;
}
.unity-part .model-part-name {
  display: inline-flex;
  flex: 1;
  align-items: center;
  gap: 6px;
  min-width: 0;
  min-height: 0;
  padding: 3px 4px;
  font-size: 12px;
  text-align: left;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.unity-part .ui-icon {
  flex: none;
  width: 14px;
  height: 14px;
  color: var(--text-secondary);
}
.sheet-tabs button[aria-selected='true'] {
  color: var(--text);
}

@media (max-width: 680px) {
  .reference-viewer {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 44px minmax(220px, 1fr) minmax(190px, 40%);
  }
  .reference-viewer.sheet-closed {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 44px minmax(0, 1fr) 0;
  }
  .viewer-head {
    grid-column: 1;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .viewer-properties {
    grid-column: 1;
    grid-row: 3;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  .viewer-kind,
  .viewer-head .sheet-state,
  .viewer-head .rail-nav {
    display: none;
  }
  .viewer-version select {
    max-width: 110px;
  }
  .viewer-head > .viewer-download {
    font-size: 0;
    gap: 0;
    padding: 4px 8px;
  }
  .reference-stage .model-controls {
    overflow-x: auto;
    justify-content: flex-start;
    scrollbar-width: none;
  }
  .reference-stage .model-controls select {
    width: 104px;
  }
  .reference-stage .unity-viewer-note,
  .unity-viewer-hint {
    display: none;
  }
  .scene-utility {
    top: 8px;
    right: 8px;
  }
  .sheet-action,
  .dataset-entry > .sheet-action {
    min-height: 40px;
  }
}

/* The Scene tab: stage light, fog and physics in the order of Unity's Lighting window. */
.sheet-scene {
  overflow-y: auto;
}
.scene-panel {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 14px 18px;
  font-size: 12px;
}
.scene-section {
  border-bottom: 1px solid var(--line);
}
.scene-section > summary {
  padding: 9px 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}
.scene-section[open] > summary {
  padding-bottom: 6px;
}
.scene-row {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 30px;
  margin: 0 0 4px;
  color: var(--text-secondary);
}
.scene-row[hidden] {
  display: none;
}
.scene-row > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.scene-row select,
.scene-presets select,
.scene-hdri select {
  min-width: 0;
  width: 100%;
  min-height: 28px;
  font-size: 12px;
}
.scene-row input[type='color'] {
  width: 44px;
  height: 24px;
  padding: 0 2px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: transparent;
}
.scene-check input {
  justify-self: start;
  accent-color: var(--accent);
}
.scene-slider {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px;
  align-items: center;
  gap: 6px;
}
.scene-slider input[type='range'] {
  width: 100%;
  padding: 0;
  accent-color: var(--accent);
}
.scene-slider input[type='number'] {
  width: 100%;
  min-height: 26px;
  padding: 2px 5px;
  font-size: 12px;
}
.scene-slider output {
  font-size: 12px;
  color: var(--text-secondary);
}
.scene-presets,
.scene-hdri {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}
.scene-presets {
  margin-bottom: 6px;
}
.scene-presets .icon-button,
.scene-hdri .icon-button,
.transform-editor .icon-button {
  display: grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 4px;
  color: var(--text-secondary);
}
.scene-presets .icon-button:hover,
.scene-hdri .icon-button:hover,
.transform-editor .icon-button:hover {
  color: var(--text);
  background: #ffffff14;
}
.scene-presets .ui-icon,
.scene-hdri .ui-icon,
.transform-editor .ui-icon {
  width: 15px;
  height: 15px;
}
.scene-save {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}
.scene-save input {
  flex: 1;
  min-width: 0;
  min-height: 28px;
  font-size: 12px;
}
.scene-panel button.secondary {
  min-height: 28px;
  padding: 3px 10px;
  font-size: 12px;
}
.scene-panel > button.secondary,
.scene-section > button.secondary {
  align-self: flex-start;
  margin: 8px 0 10px;
}
.scene-muted {
  margin: 2px 0 8px;
  font-size: 11px;
  line-height: 1.45;
  color: var(--text-secondary);
}
.scene-muted.scene-error {
  color: var(--danger, #ff8a80);
}

/* Transform of the selected part, under its name in the Object tab. */
.transform-editor {
  margin: 4px 0 10px;
}
.transform-editor h5 {
  margin: 6px 0;
  font-size: 12px;
  font-weight: 600;
}
.transform-row {
  display: grid;
  grid-template-columns: 62px repeat(3, minmax(0, 1fr));
  align-items: center;
  gap: 4px;
  margin-bottom: 4px;
  font-size: 11px;
  color: var(--text-secondary);
}
.transform-row label {
  display: flex;
  align-items: center;
  gap: 3px;
  min-width: 0;
}
.transform-row input {
  width: 100%;
  min-width: 0;
  min-height: 24px;
  padding: 1px 4px;
  font-size: 11px;
}
.transform-editor .viewer-toolbar {
  display: flex;
  gap: 2px;
}

/* With the interface hidden only the asset remains; a faint eye brings everything back. */
.viewer-interface-hidden > :not(.unity-viewer):not(.viewer-show-interface) {
  display: none !important;
}
.viewer-show-interface {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 4;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 8px;
  color: var(--text-secondary);
  background: #1d2025a0;
  opacity: 0.35;
  transition: opacity 0.15s;
}
.viewer-show-interface:hover,
.viewer-show-interface:focus-visible {
  opacity: 1;
  color: var(--text);
}
.viewer-show-interface .ui-icon {
  width: 16px;
  height: 16px;
}
.reference-viewer.interface-hidden {
  grid-template-columns: minmax(0, 1fr) 0;
  grid-template-rows: 0 minmax(0, 1fr);
}
.reference-viewer.interface-hidden > .viewer-head,
.reference-viewer.interface-hidden .viewer-properties,
.reference-viewer.interface-hidden .preview-selector,
.reference-viewer.interface-hidden [data-live-fallback] {
  display: none !important;
}
/* The viewer covers the site header too, so nothing but the asset stays on screen. */
#detailDialog.in-viewer:has(.reference-viewer.interface-hidden) {
  inset: 0;
  height: 100dvh;
}
