/* Workspace panel visibility, resize affordances, and responsive reflow. */
.panel-menu-btn {
  flex: 0 0 30px;
}
.panel-hide-btn {
  flex: 0 0 26px;
  color: #b7bcc1;
  font-size: 16px;
}
.panel-menu-item {
  text-align: left;
}
.panel-menu-item[aria-pressed="false"] {
  color: #858a90;
}

.panel-resizer {
  appearance: none;
  position: absolute;
  z-index: 5;
  display: block;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  touch-action: none;
  user-select: none;
  transition: background 120ms ease, opacity 120ms ease;
  opacity: 0.38;
}
.panel-resizer::after {
  content: "";
  position: absolute;
  display: block;
  border-radius: 8px;
  background: #757b82;
  transition: background 120ms ease, box-shadow 120ms ease;
}
.panel-resizer:hover,
.panel-resizer:focus-visible,
.panel-resizer.is-dragging {
  opacity: 1;
  background: #ffffff0c;
}
.panel-resizer:hover::after,
.panel-resizer:focus-visible::after,
.panel-resizer.is-dragging::after {
  background: #d1d6db;
  box-shadow: 0 0 0 2px #202226, 0 0 0 3px #d1d6db55;
}
.panel-resizer-right,
.panel-resizer-left {
  top: 0;
  bottom: 0;
  width: 14px;
  cursor: col-resize;
}
.panel-resizer-right {
  right: -7px;
}
.panel-resizer-left {
  left: -7px;
}
.panel-resizer-right::after,
.panel-resizer-left::after {
  top: 50%;
  left: 6px;
  width: 2px;
  height: 42px;
  transform: translateY(-50%);
}
.panel-resizer-top {
  top: -7px;
  left: 0;
  right: 0;
  height: 14px;
  cursor: row-resize;
}
.panel-resizer-top::after {
  left: 50%;
  top: 6px;
  width: 44px;
  height: 2px;
  transform: translateX(-50%);
}

@media (min-width: 821px) {
  .app-shell.hide-layers:not(.hide-inspector) {
    grid-template-columns: 0 minmax(320px, 1fr) var(--inspector-width);
  }
  .app-shell.hide-inspector:not(.hide-layers) {
    grid-template-columns: var(--layers-width) minmax(320px, 1fr) 0;
  }
  .app-shell.hide-layers.hide-inspector {
    grid-template-columns: minmax(320px, 1fr);
  }
  .app-shell.hide-timeline {
    grid-template-rows: minmax(180px, 1fr) 0;
  }
  .app-shell.hide-layers > .layers-panel,
  .app-shell.hide-inspector > .inspector-panel,
  .app-shell.hide-timeline > .timeline-panel {
    display: none;
  }
  .app-shell.hide-layers:not(.hide-inspector) > .viewport-panel {
    grid-column: 1;
  }
  .app-shell.hide-layers:not(.hide-inspector) > .timeline-panel {
    grid-column: 1 / 3;
  }
  .app-shell.hide-inspector:not(.hide-layers) > .viewport-panel {
    grid-column: 2;
  }
  .app-shell.hide-layers.hide-inspector > .viewport-panel,
  .app-shell.hide-layers.hide-inspector > .timeline-panel {
    grid-column: 1;
  }
}

/* The preset library can be tucked away when users need more inspector room. */
.motion-section {
  display: block;
}
.motion-section > summary {
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.motion-section > summary::-webkit-details-marker {
  display: none;
}
.motion-section > summary::after {
  content: "▾";
  color: #8b9095;
  margin-left: auto;
  font-size: 10px;
}
.motion-section:not([open]) > summary::after {
  content: "›";
}
.motion-section > summary small {
  margin-left: auto;
  padding-right: 8px;
}
.motion-section[open] > summary small {
  color: #777d83;
}
.motion-help {
  margin: 3px 0 8px;
  color: #858b91;
  font-size: 8px;
  line-height: 1.45;
}
.motion-card {
  min-height: 48px;
  height: auto;
  padding: 7px 8px 6px 29px;
}
.motion-card .motion-icon {
  position: absolute;
  left: 8px;
  top: 12px;
  font-size: 13px;
  line-height: 1;
}
.motion-card span:last-child {
  display: block;
  padding-right: 34px;
  font-size: 8px;
  line-height: 1.2;
}
.motion-card small {
  top: auto;
  right: 7px;
  bottom: 7px;
  max-width: 52px;
  text-align: right;
  line-height: 1.15;
}

/* The object nudge pad owns the lower-right corner while it is active. */
.viewport-wrap:has(#objectMovePad:not([hidden])) .scene-right-hud {
  display: none;
}

@media (max-width: 820px), (max-width: 1024px) and (max-height: 500px) {
  .panel-menu-btn {
    display: none;
  }
  #timelineHideBtn {
    display: none;
  }
  .panel-hide-btn {
    min-width: 30px;
    min-height: 30px;
  }
  .panel-resizer {
    opacity: 0.7;
  }
  .panel-resizer-right,
  .panel-resizer-left {
    width: 22px;
  }
  .panel-resizer-right {
    right: -11px;
  }
  .panel-resizer-left {
    left: -11px;
  }
  .panel-resizer-right::after,
  .panel-resizer-left::after {
    left: 10px;
    width: 3px;
    height: 54px;
  }
  .panel-resizer-top {
    top: -9px;
    height: 18px;
  }
  .panel-resizer-top::after {
    top: 7px;
    width: 52px;
    height: 3px;
  }
  .motion-card {
    min-height: 48px;
  }
}

.motion-section > summary {
  margin-bottom: 0;
}
.motion-section[open] > summary {
  margin-bottom: 9px;
}

@media (max-width: 1120px) and (min-width: 821px) {
  .topbar {
    gap: 9px;
    padding-left: 10px;
    padding-right: 10px;
  }
  .brand {
    min-width: 180px;
  }
  .project-title {
    max-width: 165px;
  }
  .project-name {
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .tutorial-open-btn {
    min-width: 68px;
  }
}

.focus-help {
  margin: 8px 0 2px;
  color: #9299a0;
  font-size: 9px;
  line-height: 1.5;
}
.camera-height-inspector + .focus-help {
  margin-top: 0;
}

.timeline-add-camera {
  height: 23px;
  flex: 0 0 auto;
  padding: 0 7px;
  border: 1px solid #596168;
  border-radius: 4px;
  background: #25282c;
  color: #e4e8eb;
  font-size: 8px;
  font-weight: 650;
  white-space: nowrap;
}
.timeline-add-camera:hover {
  background: #353a3f;
  border-color: #a0a8af;
}
.camera-shot-label .timeline-layer-glyph,
.camera-property-label .timeline-layer-glyph {
  color: #e0e5e9;
}
.camera-shot-track {
  background-color: #1d2023;
  border-bottom-color: #3a3e42;
}
.camera-shot-span {
  border-color: #8c969e;
  background: linear-gradient(90deg, #4a5259, #30363b);
}
.camera-shot-span.selected {
  border-color: #e3e8ec;
  background: linear-gradient(90deg, #707b84, #424a51);
}
.camera-property-label {
  color: #d1d6da;
}
.camera-property-label .timeline-layer-type {
  color: #a8b0b7;
}
.camera-property-track {
  background-color: #1c1e21;
}
.timeline-group-start {
  border-top: 1px solid #3a3d41 !important;
}
@media (max-width: 480px) {
  .timeline-add-camera {
    height: 22px;
    padding: 0 5px;
    font-size: 7px;
  }
}

/* Explicit layer actions stay above the independently scrolling stack. */
.layers-panel > .panel-head {
  height: auto;
  min-height: 44px;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 5px 8px;
  padding-top: 7px;
  padding-bottom: 7px;
}
.layers-panel > .panel-head .head-tools {
  margin-left: auto;
  gap: 2px;
}
.layer-management {
  flex: 0 0 auto;
  padding: 11px 12px 0;
}
.layer-management-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(102px, 1fr));
  gap: 6px;
}
.layer-manage-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 44px;
  min-width: 0;
  padding: 7px 6px;
  border: 1px solid #555b61;
  border-radius: 6px;
  background: #24272b;
  color: #eceff1;
  font-size: 10px;
  font-weight: 650;
  white-space: nowrap;
  touch-action: manipulation;
}
.layer-manage-btn > span {
  font-size: 19px;
  line-height: 1;
}
.layer-add-btn {
  background: #dce1e5;
  border-color: #dce1e5;
  color: #17191c;
}
.layer-manage-btn:hover:not(:disabled) {
  border-color: #dce1e5;
  background: #363b40;
}
.layer-add-btn:hover:not(:disabled) {
  background: #fff;
}
.layer-manage-btn:active:not(:disabled) {
  transform: translateY(1px);
}
.layer-selection-hint {
  margin: 8px 0 0;
  padding-bottom: 3px;
  color: #a0a7ad;
  font-size: 9px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  max-height: 30px;
  overflow: auto;
}
.layers-panel .searchbox {
  flex-shrink: 0;
}
.layers-panel .layer-list {
  min-height: 0;
}
.layers-panel .layers-footer {
  flex-shrink: 0;
}
@media (max-width: 820px), (max-width: 1024px) and (max-height: 500px) {
  .layer-manage-btn {
    min-height: 46px;
    font-size: 12px;
  }
  .layer-selection-hint {
    font-size: 11px;
    max-height: 36px;
  }
}

/* Feature controls belong to the selected main layer, not separate items. */
.selected-layer-options {
  margin: 0 3px 9px 20px;
  padding: 10px;
  border: 1px solid #3b4046;
  border-left: 2px solid #a9b1b8;
  border-radius: 0 0 6px 6px;
  background: #202226;
}
.layer-options-title {
  color: #c0c7ce;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .1em;
  margin-bottom: 8px;
}
.selected-layer-options label {
  display: block;
  font-size: 10px;
  color: #a8b0b7;
  margin-bottom: 9px;
}
.selected-layer-options select {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 36px;
  margin-top: 4px;
  padding: 6px;
  border: 1px solid #51575e;
  border-radius: 5px;
  background: #181a1d;
  color: #e2e6ea;
  font-size: 11px;
}
.layer-record-btn, .layer-settings-btn {
  width: 100%;
  min-height: 36px;
  padding: 7px;
  border: 1px solid #51575e;
  border-radius: 5px;
  color: #b8c0c8;
  background: #25282d;
  font-size: 10px;
  touch-action: manipulation;
}
.layer-record-btn.active {
  color: #eef1f4;
  border-color: #a1abb4;
}
.selected-layer-options p {
  font-size: 9px;
  line-height: 1.6;
  color: #969fa8;
  margin: 8px 0;
}
.layer-property-row {
  padding-left: 24px;
  border-left: 3px solid #42484f;
  background: #17191c;
}
.layer-property-lane {
  background-color: #17191c;
}
@media (max-width: 820px), (max-width: 1024px) and (max-height: 500px) {
  .selected-layer-options select {
    font-size: 16px;
    min-height: 44px;
  }
  .layer-record-btn, .layer-settings-btn {
    min-height: 44px;
    font-size: 12px;
  }
  .selected-layer-options label, .selected-layer-options p {
    font-size: 11px;
  }
  #addLayerBtn.layer-manage-btn {
    width: auto;
    height: auto;
    min-height: 46px;
  }
}

.layer-transform-details {
  border-top: 1px solid #3b4046;
  margin: 9px 0;
  padding-top: 9px;
}
.layer-transform-details summary {
  cursor: pointer;
  color: #d5dce2;
  font-size: 10px;
  min-height: 28px;
}
.layer-transform-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}
.layer-transform-fields label {
  min-width: 0;
  font-size: 9px;
}
.layer-transform-fields input {
  width: 100%;
  min-width: 0;
  min-height: 34px;
  margin-top: 4px;
  padding: 5px;
  border: 1px solid #4d555d;
  border-radius: 4px;
  background: #16181b;
  color: #eef1f4;
  font-size: 11px;
}
.layer-undo-btn { display: none; }
@media (max-width: 820px), (max-width: 1024px) and (max-height: 500px) {
  .layer-transform-details summary {
    min-height: 40px;
    font-size: 12px;
  }
  .layer-transform-fields input {
    min-height: 44px;
    font-size: 16px;
  }
  .layer-undo-btn {
    display: block;
    width: 100%;
    min-height: 36px;
    margin-top: 6px;
    border: 1px solid #4c535a;
    border-radius: 5px;
    background: #24272b;
    color: #cbd2d8;
    font-size: 11px;
  }
}

.viewport-guides-btn {
  position: absolute;
  left: 12px;
  top: 68px;
  z-index: 7;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 7px 10px;
  border: 1px solid #ffffff45;
  border-radius: 6px;
  background: #171a1edf;
  color: #e6ebef;
  font-size: 10px;
  box-shadow: 0 2px 8px #0003;
  touch-action: manipulation;
}
.viewport-guides-btn[aria-pressed="false"] {
  color: #a3aab1;
  border-color: #ffffff25;
}
.axis-x { color: #ef7070; }
.axis-y { color: #63db92; }
.axis-z { color: #79b4ff; }
@media (max-width: 820px), (max-width: 1024px) and (max-height: 500px) {
  .viewport-guides-btn {
    top: 52px;
    left: 9px;
    min-height: 44px;
    font-size: 11px;
    padding: 7px 9px;
  }
}
@media (max-height: 500px) and (orientation: landscape) {
  .viewport-guides-btn { top: 6px; left: 8px; }
}

.layer-shortcut-hint {
  display: grid;
  gap: 5px;
  margin: 9px 0;
  padding: 9px 0;
  border-top: 1px solid #3b4046;
  color: #a7b0b9;
  font-size: 9px;
  line-height: 1.5;
}
.layer-shortcut-hint strong { color: #d5dde4; font-size: 9px; }
.layer-shortcut-hint kbd {
  display: inline-block;
  min-width: 17px;
  padding: 1px 3px;
  margin-right: 2px;
  border: 1px solid #515b65;
  border-radius: 3px;
  background: #171a1e;
  color: #e1e7ed;
  font: inherit;
  text-align: center;
}
@media (max-width: 820px), (max-width: 1024px) and (max-height: 500px) {
  .layer-shortcut-hint { display: none; }
}

@media (max-height: 500px) and (max-width: 1024px) {
  .app-shell.mobile-layers-open .layers-panel {
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .layers-panel > .layer-list {
    flex: 0 0 auto;
    overflow: visible;
  }
  .layers-panel > .layers-footer {
    margin-top: 0;
  }
}
