/* v3.8.1 appearance with only the canvas view/action dock modernized. */
.preview-shell {
  background: var(--bg);
  color: var(--text);
}

.preview-shell .preview-stage {
  background-color: var(--preview-grid-bg);
  background-image:
    linear-gradient(45deg, var(--preview-grid-line) 25%, transparent 25%),
    linear-gradient(-45deg, var(--preview-grid-line) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--preview-grid-line) 75%),
    linear-gradient(-45deg, transparent 75%, var(--preview-grid-line) 75%);
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-size: 20px 20px;
}

.preview-shell .canvas-command-dock {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 12;
  display: flex;
  width: 48px;
  max-height: calc(100% - 20px);
  flex-direction: column;
  gap: 7px;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: none;
}

.preview-shell .canvas-command-dock::-webkit-scrollbar {
  display: none;
}

.preview-shell .canvas-tool-group {
  flex: 0 0 auto;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  box-shadow: 0 8px 22px color-mix(in srgb, var(--text) 11%, transparent);
}

.preview-shell .canvas-tool-heading {
  display: block;
  padding: 2px 0 4px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  text-align: center;
}

.preview-shell :where(.canvas-tool-rail, .canvas-action-rail) {
  position: static;
  inset: auto;
  z-index: auto;
  display: flex;
  width: 100%;
  flex-direction: column;
  gap: 2px;
  padding: 0;
  border: 0 !important;
  border-radius: 0;
  background: transparent !important;
  box-shadow: none !important;
}

html[data-theme="light"] .preview-shell .canvas-command-dock .canvas-tool-rail {
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

@media (prefers-color-scheme: light) {
  html:not([data-theme]) .preview-shell .canvas-command-dock .canvas-tool-rail {
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }
}

.preview-shell :where(.preview-source-toggle, .preview-zoom) {
  display: contents;
}

.preview-shell :where(.canvas-tool-rail, .canvas-action-rail) button {
  display: flex;
  width: 40px;
  min-width: 40px;
  height: 49px;
  min-height: 49px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 3px 1px;
  border-color: transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  line-height: 1;
  text-align: center;
}

.preview-shell :where(.canvas-tool-rail, .canvas-action-rail) button[hidden] {
  display: none !important;
}

.preview-shell :where(.canvas-tool-rail, .canvas-action-rail) button svg {
  display: block;
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  margin: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.preview-shell .canvas-tool-label {
  display: block;
  width: 100%;
  overflow: hidden;
  font-size: 9px;
  font-weight: 650;
  line-height: 1.05;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-shell .canvas-tool-rail button.active,
.preview-shell .canvas-tool-rail button[aria-pressed="true"],
.preview-shell .canvas-action-rail #mirrorCanvasBtn[aria-pressed="true"] {
  color: var(--accent);
  background: var(--accent-soft);
}

.preview-shell .canvas-action-rail .canvas-primary-action {
  color: #fff;
  background: var(--accent);
}

.preview-shell .canvas-action-rail button:disabled {
  opacity: .42;
}

@media (hover: hover) and (pointer: fine) {
  .preview-shell :where(.canvas-tool-rail, .canvas-action-rail) button:hover:not(:disabled) {
    color: var(--text);
    background: var(--surface-2);
    transform: none;
  }

  .preview-shell .canvas-action-rail .canvas-primary-action:hover:not(:disabled) {
    color: #fff;
    background: var(--accent);
  }
}

@media (orientation: portrait) {
  .preview-shell .canvas-command-dock {
    top: 8px;
    right: 8px;
    width: 44px;
    max-height: calc(100% - 16px);
  }

  .preview-shell .canvas-tool-group {
    padding: 2px;
  }

  .preview-shell :where(.canvas-tool-rail, .canvas-action-rail) button {
    width: 38px;
    min-width: 38px;
    height: 50px;
    min-height: 50px;
  }
}
