#viewerActionMenu.viewer-action-menu_in-toolbar {
  position: relative;
  right: auto;
  bottom: auto;
  z-index: auto;
  flex: 0 0 auto;
}

#viewerEditorToolbar {
  --viewer-toolbar-gap: 2px;
  --viewer-toolbar-height: 58px;
  --viewer-toolbar-visible-offset: 14px;
  --viewer-toolbar-max-width: 1080px;
  --viewer-toolbar-scale: clamp(0.75, calc((98vw) / var(--viewer-toolbar-max-width)), 1);

  position: absolute;
  left: 0;
  right: 0;
  margin-inline: auto;
  width: max-content;
  bottom: 14px;
  transform:
    translate3d(
      var(--drag-x, 0px),
      var(--drag-y, 0px),
      0
    )
    scale(var(--viewer-toolbar-scale));
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 0;
  padding: 8px;
  width: fit-content;
  overflow-x: hidden;
  overflow-y: visible;
  overflow: visible;
  border-radius: 18px;
  border: 1px solid var(--viewer-panel-border);
  background: color-mix(in srgb, var(--viewer-panel-bg) 92%, transparent);
  box-shadow: var(--viewer-panel-shadow);
  backdrop-filter: blur(14px);
  scrollbar-width: none;
  touch-action: none;
  transform-origin: center bottom;
  transition:
    opacity 1.25s ease,
    transform 1.25s ease,
    scale 1.25s ease,
    padding 1.28s ease,
    box-shadow 1.28s ease,
    background 1.28s ease;
}

.viewer-editor-toolbar_handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  margin-inline-end: var(--viewer-toolbar-gap);
  border-radius: 12px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--viewer-panel-text);
  cursor: grab;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.viewer-editor-toolbar_handle:hover,
.viewer-editor-toolbar_handle:focus-visible {
  background: var(--viewer-panel-bg-hover);
  border-color: var(--viewer-panel-border);
  outline: none;
}

.viewer-editor-toolbar_handle:active {
  cursor: grabbing;
}

#viewerEditorToolbar.viewer-editor-toolbar_dragging {
  cursor: grabbing;
}

#viewerEditorToolbar > * {
  margin-inline-start: var(--viewer-toolbar-gap);
}

#viewerEditorToolbar > :first-child {
  margin-inline-start: 0;
}

.viewer-editor-toolbar_secondary-tray {
  --viewer-toolbar-secondary-width: 0px;
  display: flex;
  align-items: center;
  gap: var(--viewer-toolbar-gap);
  max-width: 0;
  min-width: 0;
  opacity: 0;
  visibility: hidden;
  overflow: hidden;
  pointer-events: none;
  margin-inline-start: 0;
  transform: translateX(-8px);
  transition:
    max-width 1s ease,
    opacity 1.6s ease,
    visibility 0s linear 1.5s,
    margin-inline-start 0.5s ease,
    transform 0.6s ease;
}

#viewerEditorToolbar.expanded .viewer-editor-toolbar_secondary-tray {
  max-width: var(--viewer-toolbar-secondary-width);
  opacity: 1;
  visibility: visible;
  overflow: visible;
  pointer-events: auto;
  margin-inline-start: var(--viewer-toolbar-gap);
  transform: translateX(0);
  transition:
    max-width 1s ease,
    opacity 0.8s ease 0.18s,
    visibility 0s linear 0s,
    margin-inline-start 0.5s ease,
    transform 0.6s ease;
}

.editorToolbar-hidden {
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px) scale(0.98);
}

.editorToolbar-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  transition:
    opacity 1.25s ease,
    transform 1.25s ease,
    visibility 0s;
}

.viewer-editor-tool-not-primary {
  flex: 0 0 auto;
}

.expanded-icon,
.expanded-icon:hover {
  transform: rotate(90deg) !important;
}

#viewerEditorToolbar.with-fullscreen {
  transform: translateY(0) scale(1);
}

.viewer-embed-page #viewerEditorToolbar {
  --viewer-toolbar-scale: clamp(0.62, calc((100vw - 48px) / var(--viewer-toolbar-max-width)), 0.9);
  left: 12px;
  bottom: 12px;
  max-width: calc(100vw - 24px);
  overflow-x: auto;
  transform: translateX(0) translateY(0) scale(var(--viewer-toolbar-scale));
  transform-origin: left bottom;
}

.viewer-embed-page #viewerEditorToolbar.editorToolbar-visible,
.viewer-embed-page #viewerEditorToolbar.with-fullscreen {
  transform: translateX(0) translateY(0) scale(var(--viewer-toolbar-scale));
}

.viewer-embed-page #viewerEditorToolbar.editorToolbar-hidden {
  transform: translateX(0) translateY(6px) scale(calc(var(--viewer-toolbar-scale) * 0.98));
}

#viewerEditorToolbar::-webkit-scrollbar {
  display: none;
}

.viewer-editor-tool {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--viewer-panel-text);
  cursor: pointer;
  transition: width 0.55s ease, height 0.55s ease, opacity 0.55s ease, transform 0.55s ease, background 0.5s ease, border-color 0.5s ease, color 0.5s ease;
}

.viewer-editor-tool:hover {
  transform: translateY(-1px);
  background: var(--viewer-panel-bg-hover);
  border-color: var(--viewer-panel-border);
}

.viewer-editor-tool.has-submenu {
  position: relative;
}

.viewer-editor-tool_submenu {
  position: absolute;
  left: 50%;
  bottom: 100%;
  transform: translateX(-50%) translateY(0);
  display: flex;
  gap: 6px;
  padding: 6px;
  border-radius: 14px;
  background: var(--viewer-panel-bg);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 10;
  min-width: max-content;
}

.viewer-editor-tool.has-submenu:hover > .viewer-editor-tool_submenu,
.viewer-editor-tool.has-submenu:focus-within > .viewer-editor-tool_submenu,
.viewer-editor-tool.has-submenu > .viewer-editor-tool_submenu:hover {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.viewer-editor-tool_submenu-button.has-submenu:hover > .viewer-editor-tool_submenu,
.viewer-editor-tool_submenu-button.has-submenu:focus-within > .viewer-editor-tool_submenu,
.viewer-editor-tool_submenu-button.has-submenu > .viewer-editor-tool_submenu:hover {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.viewer-editor-tool_submenu-button.has-submenu > .viewer-editor-tool_submenu {
  left: 100%;
  top: -125%;
  bottom: auto;
  transform: translateX(0) translateY(-125%);
}

.viewer-editor-tool_submenu-button {
  width: 34px;
  height: 34px;
  min-width: 30px;
  min-height: 30px;
  padding: 0;
  border-radius: 10px;
  background: transparent;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.viewer-editor-tool_submenu-button:hover {
  background: var(--viewer-panel-bg-hover);
  border-color: var(--viewer-panel-border);
}

.viewer-editor-tool_submenu-button.viewer-editor-tool_submenu-control {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-start;
  padding: 8px 12px;
  width: auto !important;
  min-width: 160px;
  min-height: 40px;
  max-width: 260px;
  border-radius: 12px;
  white-space: nowrap;
  flex-wrap: nowrap;
  border: 1px solid rgba(133, 133, 145, 0.39);
}

.viewer-editor-tool_submenu-button.viewer-editor-tool_submenu-toggle {
  min-width: 48px;
  min-height: 26px;
  padding: 4px 8px;
  border-radius: 10px;
  gap: 0;
  justify-content: center;
  border-color: rgba(133, 133, 145, 0.39);
}

.viewer-editor-tool_submenu-button.viewer-editor-tool_submenu-toggle .viewer-editor-tool_submenu-toggle-state {
  font-size: 0.75rem;
  line-height: 1;
  letter-spacing: 0.03em;
}

.viewer-editor-tool_label {
  margin-left: 8px;
  font-size: 0.8rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.viewer-editor-tool_submenu-button input[type="color"],
.viewer-editor-tool_submenu-button input[type="range"] {
  border: none;
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
}

.viewer-editor-tool_submenu-button input[type="color"] {
  -webkit-appearance: none;
  appearance: none;
  width: 32px;
  height: 32px;
  min-width: 32px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: transparent;
}

.viewer-editor-tool_submenu-button input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.viewer-editor-tool_submenu-button input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 10px;
}

.viewer-editor-tool_submenu-button input[type="color"]::-moz-color-swatch {
  border: none;
  border-radius: 10px;
}

.viewer-editor-tool_submenu-button input[type="range"] {
  width: 80px;
  margin-left: 5px;
}

.viewer-editor-tool_submenu-button .viewer-editor-tool_submenu-value {
  margin-left: 8px;
  font-size: 0.75rem;
  color: var(--viewer-text-color);
  min-width: 32px;
  text-align: right;
}

.viewer-editor-tool_submenu-control .viewer-editor-tool_icon {
  flex-shrink: 0;
}

.viewer-editor-tool_submenu-button.viewer-editor-tool_submenu-control .viewer-editor-tool_submenu-value {
  flex-shrink: 0;
}

.viewer-editor-tool_submenu-button.viewer-editor-tool_submenu-control {
  align-items: center;
}

.viewer-editor-tool_submenu.viewer-editor-tool_submenu-materials {
  flex-direction: column;
  align-items: stretch;
  max-height: 45vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 255, 255, 0.5) transparent;
}

.viewer-editor-tool_submenu.viewer-editor-tool_submenu-materials .viewer-editor-tool_submenu-button.viewer-editor-tool_submenu-control {
  width: 100%;
  min-width: 0;
}

.viewer-editor-tool_submenu.viewer-editor-tool_submenu-materials::-webkit-scrollbar {
  width: 6px;
}

.viewer-editor-tool_submenu.viewer-editor-tool_submenu-materials::-webkit-scrollbar-track {
  background: transparent;
}

.viewer-editor-tool_submenu.viewer-editor-tool_submenu-materials::-webkit-scrollbar-thumb {
  background: rgba(0, 255, 255, 0.35);
  border-radius: 999px;
  box-shadow:
    0 0 6px rgba(0, 255, 255, 0.4),
    0 0 12px rgba(0, 255, 255, 0.2);
}

.viewer-editor-tool_submenu.viewer-editor-tool_submenu-materials::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 255, 255, 0.6);
}

.viewer-editor-tool_submenu-materials {
  overflow: clip;
  min-width: 200px;
}

.viewer-editor-tool_submenu-button.is-active {
  background: rgba(92, 185, 255, 0.16);
  border-color: rgba(92, 185, 255, 0.4);
  color: #8fd3ff;
}

.viewer-editor-tool.is-active {
  background: rgba(92, 185, 255, 0.16);
  border-color: rgba(92, 185, 255, 0.4);
  color: #8fd3ff;
}

.viewer-wrapper[data-viewer-theme="light"] .viewer-editor-tool.is-active {
  background: rgba(64, 125, 180, 0.12);
  border-color: rgba(64, 125, 180, 0.3);
  color: #315f86;
}

.viewer-editor-tool:focus-visible {
  outline: 2px solid rgba(92, 185, 255, 0.55);
  outline-offset: 2px;
}

.viewer-editor-hierarchy-submenu {
  flex-direction: column;
  align-items: stretch;
  width: max-content;
  min-width: 160px;
  max-width: 240px;
  max-height: none;
  overflow: hidden;
}

.viewer-editor-save-submenu {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  min-width: 240px;
  padding: 10px;
  border: 1px solid rgba(133, 133, 145, 0.22);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02)),
    var(--viewer-panel-bg);
  backdrop-filter: blur(16px);
  box-shadow:
    0 18px 44px rgba(0, 0, 0, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.viewer-editor-save-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 18px;
  padding: 5px 7px;
  border-radius: 12px;
  border: 1px solid rgba(133, 133, 145, 0.16);
  color: var(--viewer-panel-text);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.02);
  transition: background 0.22s ease, border-color 0.22s ease, transform 0.22s ease;
}

.viewer-editor-save-option:hover {
  background: rgba(92, 185, 255, 0.08);
  border-color: rgba(92, 185, 255, 0.24);
  transform: translateY(-1px);
}

.viewer-editor-save-option input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
  cursor: pointer;
  inline-size: 16px;
  block-size: 16px;
  flex: 0 0 auto;
  border-radius: 5px;
  border: 1px solid rgba(133, 133, 145, 0.45);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02)),
    rgba(15, 23, 42, 0.18);
  position: relative;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.viewer-editor-save-option input[type="checkbox"]::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 4px;
  height: 8px;
  border: solid transparent;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0.85);
  opacity: 0;
  transition: opacity 0.18s ease, border-color 0.18s ease;
}

.viewer-editor-save-option input[type="checkbox"]:checked {
  border-color: rgba(92, 185, 255, 0.72);
  background: linear-gradient(180deg, #6ec8ff, #3c98d4);
  box-shadow: 0 0 0 3px rgba(92, 185, 255, 0.14);
}

.viewer-editor-save-option input[type="checkbox"]:checked::after {
  opacity: 1;
  border-color: #082032;
}

.viewer-editor-save-option input[type="checkbox"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(92, 185, 255, 0.22);
}

.viewer-editor-save-option_label {
  font-size: 0.9rem;
  line-height: 1.2;
  letter-spacing: 0.01em;
}

.viewer-editor-save-actions {
  display: flex;
  padding-top: 4px;
}

.viewer-editor-save-apply {
  width: 100%;
  min-height: 38px;
  border: 1px solid rgba(92, 185, 255, 0.28);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(92, 185, 255, 0.24), rgba(58, 140, 197, 0.24));
  color: var(--viewer-panel-text);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: transform 0.22s ease, background 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}

.viewer-editor-save-apply:hover {
  transform: translateY(-1px);
  background: linear-gradient(180deg, rgba(92, 185, 255, 0.3), rgba(58, 140, 197, 0.3));
  border-color: rgba(92, 185, 255, 0.42);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}

.viewer-editor-save-apply:focus-visible {
  outline: 2px solid rgba(92, 185, 255, 0.55);
  outline-offset: 2px;
}

.viewer-wrapper[data-viewer-theme="light"] .viewer-editor-save-submenu {
  border-color: rgba(136, 122, 102, 0.18);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.74)),
    var(--viewer-panel-bg);
  box-shadow:
    0 18px 38px rgba(129, 116, 96, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.viewer-wrapper[data-viewer-theme="light"] .viewer-editor-save-option {
  background: rgba(255, 255, 255, 0.56);
  border-color: rgba(164, 151, 132, 0.16);
}

.viewer-wrapper[data-viewer-theme="light"] .viewer-editor-save-option input[type="checkbox"] {
  border-color: rgba(136, 122, 102, 0.36);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(241, 236, 228, 0.92)),
    rgba(255, 255, 255, 0.9);
}

.viewer-wrapper[data-viewer-theme="light"] .viewer-editor-save-option input[type="checkbox"]:checked {
  border-color: rgba(64, 125, 180, 0.56);
  background: linear-gradient(180deg, #77bae4, #4f90bb);
  box-shadow: 0 0 0 3px rgba(64, 125, 180, 0.12);
}

.viewer-wrapper[data-viewer-theme="light"] .viewer-editor-save-option input[type="checkbox"]:checked::after {
  border-color: #ffffff;
}

.viewer-wrapper[data-viewer-theme="light"] .viewer-editor-save-option:hover {
  background: rgba(64, 125, 180, 0.08);
  border-color: rgba(64, 125, 180, 0.2);
}

.viewer-wrapper[data-viewer-theme="light"] .viewer-editor-save-apply {
  border-color: rgba(64, 125, 180, 0.22);
  background: linear-gradient(180deg, rgba(64, 125, 180, 0.18), rgba(64, 125, 180, 0.12));
  color: #254766;
}

.viewer-wrapper[data-viewer-theme="light"] .viewer-editor-save-apply:hover {
  background: linear-gradient(180deg, rgba(64, 125, 180, 0.24), rgba(64, 125, 180, 0.18));
  border-color: rgba(64, 125, 180, 0.3);
}

.viewer-editor-hierarchy-submenu-list {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  max-height: 132px;
  overflow-x: hidden;
  overflow-y: auto;
}

.viewer-editor-hierarchy-item {
  width: 100%;
  min-width: 160px;
  min-height: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0 6px;
  border-radius: 8px;
}

.viewer-editor-hierarchy-item .viewer-editor-tool_sr,
.viewer-editor-hierarchy-item span:last-child {
  line-height: 1.1;
}

.viewer-editor-hierarchy-submenu-label {
  display: block;
  line-height: 1;
  position: relative;
  padding-left: 8px;
}

.viewer-editor-hierarchy-submenu-label::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 2px;
  height: 12px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0;
  transform: translateY(-50%);
}

.viewer-editor-hierarchy-item.is-active .viewer-editor-hierarchy-submenu-label {
  font-weight: 600;
}

.viewer-editor-hierarchy-item.is-active .viewer-editor-hierarchy-submenu-label::before {
  opacity: 1;
}

.viewer-editor-hierarchy-clear {
  width: 100%;
  min-width: 160px;
  min-height: 24px;
  margin-top: 6px;
  justify-content: center;
  padding: 0 8px;
  border-top: 1px solid rgba(133, 133, 145, 0.2);
  border-radius: 8px;
}

.viewer-editor-hierarchy-clear[disabled] {
  opacity: 0.45;
  cursor: default;
}

.viewer-editor-hierarchy-submenu-list::-webkit-scrollbar {
  width: 6px;
}

.viewer-editor-hierarchy-submenu-list::-webkit-scrollbar-thumb {
  border-radius: 6px;
  background-color: rgba(127, 127, 127, 0.65);
}

.viewer-editor-hierarchy-submenu-list::-webkit-scrollbar {
  width: 6px;
}

.viewer-editor-hierarchy-submenu-list::-webkit-scrollbar-track {
  background: transparent;
}

.viewer-editor-hierarchy-submenu-list::-webkit-scrollbar-thumb {
  background: rgba(0, 255, 255, 0.35);
  border-radius: 999px;
  box-shadow:
    0 0 6px rgba(0, 255, 255, 0.4),
    0 0 12px rgba(0, 255, 255, 0.2);
}

.viewer-editor-hierarchy-submenu-list::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 255, 255, 0.6);
}

.viewer-editor-tool_icon {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.viewer-editor-tool_icon svg {
  width: 20px;
  height: 20px;
  display: block;
}

.viewer-editor-tool_sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.viewer-action-menu_checkbox {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

#viewerActionMenuToggle.viewer-action-menu_checkbox[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.viewer-action-menu_toggle {
  width: 36px;
  height: 36px;
  display: flex !important;
  justify-content: center;
  align-items: center;
  border-radius: 999px;
  cursor: pointer;
  background: var(--viewer-panel-bg);
  border: 1px solid var(--viewer-panel-border);
  box-shadow: var(--viewer-panel-shadow);
  backdrop-filter: blur(10px);
  color: var(--viewer-panel-text);
  transition: transform 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
  padding: 0 !important;
  margin: 0 !important;
}

.viewer-action-menu_toggle:hover {
  transform: translateY(-2px);
  background: var(--viewer-panel-bg-hover);
  box-shadow: var(--viewer-panel-shadow);
}

.viewer-action-menu_settings-icon {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: currentColor;
  flex: 0 0 auto;
}

.viewer-action-menu_settings-icon svg {
  width: 20px;
  height: 20px;
  display: block;
}

#viewerActionMenuToggle:checked + .viewer-action-menu_toggle {
  background: rgba(92, 185, 255, 0.16);
  border-color: rgba(92, 185, 255, 0.4);
  color: #8fd3ff;
}

.viewer-wrapper[data-viewer-theme="light"] #viewerActionMenuToggle:checked + .viewer-action-menu_toggle {
  background: rgba(64, 125, 180, 0.12);
  border-color: rgba(64, 125, 180, 0.3);
  color: #315f86;
}

.viewer-action-icon {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: currentColor;
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
}

.viewer-action-menu_panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 12px);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 3px;
  opacity: 0;
  transform: translateY(10px) scale(0.96);
  transform-origin: bottom right;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.viewer-action-menu_panel > [hidden] {
  display: none !important;
}

#viewerActionMenuToggle:checked ~ .viewer-action-menu_panel {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

#viewerActionMenu.viewer-action-menu_in-toolbar .viewer-action-menu_toggle {
  width: 40px;
  height: 40px;
  padding: 0 !important;
  margin: 0 !important;
  border-radius: 12px;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--viewer-panel-text);
}

#viewerActionMenu.viewer-action-menu_in-toolbar .viewer-action-menu_toggle:hover {
  transform: translateY(-1px);
  background: var(--viewer-panel-bg-hover);
  border-color: var(--viewer-panel-border);
  box-shadow: none;
}

#viewerThemeMode,
#viewEntity,
#downloadModel,
#fullscreenMode {
  min-width: 148px;
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  gap: 10px;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--viewer-panel-border);
  background: var(--viewer-panel-bg);
  color: var(--viewer-panel-text);
  text-decoration: none;
  box-shadow: var(--viewer-panel-shadow);
  cursor: pointer;
  filter: drop-shadow(0 0 1.5px rgba(0, 0, 0, 0.18));
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease, background 0.25s ease;
}

#viewerThemeMode,
#viewEntity,
#fullscreenMode {
  font: inherit;
  appearance: none;
}

#viewerThemeMode:hover,
#viewEntity:hover,
#downloadModel:hover,
#fullscreenMode:hover {
  background: var(--viewer-panel-bg-hover);
}

#viewerThemeMode > :first-child,
#viewEntity > :first-child,
#downloadModel > :first-child,
#fullscreenMode > :first-child {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  justify-self: start;
  flex: 0 0 auto;
}

#viewerThemeMode .viewer-theme-icon {
  font-size: 18px;
  line-height: 1;
}

#viewerThemeMode span,
#viewEntity span,
#downloadModel span,
#fullscreenMode span {
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.language-mode-container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-width: 148px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.language-icon {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='1.5'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M3 12h18'/%3E%3Cpath d='M12 3c3 3 3 15 0 18'/%3E%3Cpath d='M12 3c-3 3-3 15 0 18'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='1.5'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M3 12h18'/%3E%3Cpath d='M12 3c3 3 3 15 0 18'/%3E%3Cpath d='M12 3c-3 3-3 15 0 18'/%3E%3C/svg%3E");
}

#viewerActionMenuToggle:checked ~ .viewer-action-menu_panel .language-mode-container {
  opacity: 1;
  transform: translateY(0);
}

#viewerLanguageMode {
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  gap: 10px;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--viewer-panel-border);
  background: var(--viewer-panel-bg);
  color: var(--viewer-panel-text);
  text-decoration: none;
  box-shadow: var(--viewer-panel-shadow);
  cursor: pointer;
  filter: drop-shadow(0 0 1.5px rgba(0, 0, 0, 0.18));
  font: inherit;
  appearance: none;
}

#viewerLanguageMode:hover {
  background: var(--viewer-panel-bg-hover);
}

#viewerLanguageMode > :first-child {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  justify-self: start;
  flex: 0 0 auto;
}

#viewerLanguageMode span {
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

#viewerLanguageModeDropdown {
  position: absolute;
  bottom: 100%;
  right: 0;
  margin-bottom: 8px;
  background: var(--viewer-panel-bg);
  border: 1px solid var(--viewer-panel-border);
  border-radius: 6px;
  box-shadow: var(--viewer-panel-shadow), 0 -2px 8px rgba(0, 0, 0, 0.15);
  min-width: 140px;
  z-index: 120;
  overflow: hidden;
}

#viewerLanguageModeDropdown[hidden] {
  display: none !important;
}

.language-dropdown-item {
  padding: 8px 12px;
  cursor: pointer;
  color: var(--viewer-panel-text);
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s ease;
  user-select: none;
  white-space: nowrap;
}

.language-dropdown-item:hover {
  background: var(--viewer-panel-bg-hover);
}

.language-dropdown-item.active {
  background: var(--viewer-panel-bg-hover);
  font-weight: 700;
}

.language-dropdown-item.active::before {
  content: "✓ ";
  margin-right: 4px;
}

.language-dropdown-item-english::before {
  content: "🇬🇧 ";
  margin-right: 4px;
}

.language-dropdown-item-polish::before {
  content: "🇵🇱 ";
  margin-right: 4px;
}

.language-dropdown-item-german::before {
  content: "🇩🇪 ";
  margin-right: 4px;
}

#materialsDialog[hidden] {
  display: none !important;
}

#materialsDialog {
  position: fixed;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  z-index: 999999;
  overflow: hidden;
}

.materials-dialog__backdrop {
  position: absolute;
  inset: 0;
}

.materials-dialog__panel {
  position: absolute;
  left: 0;
  top: 0;
  transform: none;
  width: min(360px, calc(100% - 24px));
  max-width: calc(100% - 28px);
  max-height: min(72%, 520px);
  overflow-x: hidden;
  overflow-y: auto;
  padding: 10px 10px 12px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--viewer-panel-border) 92%, rgba(255, 255, 255, 0.08));
  background: color-mix(in srgb, var(--viewer-panel-embed-bg) 65%, rgba(255, 255, 255, 0.04));
  color: var(--viewer-panel-text);
  box-shadow: var(--viewer-panel-shadow), 0 10px 22px rgba(0, 0, 0, 0.18);
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Lucida Grande", "Segoe UI", Roboto, Arial, sans-serif;
}

.materials-dialog__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: -2px -2px 10px;
  padding: 4px 6px 10px;
  border-bottom: 1px solid color-mix(in srgb, var(--viewer-panel-border) 82%, transparent);
  cursor: grab;
  user-select: none;
}

.materials-dialog__header h3 {
  margin: 0;
  font-size: 17px;
  line-height: 1.2;
  pointer-events: none;
}

.materials-dialog__panel.is-dragging .materials-dialog__header {
  cursor: grabbing;
}

.materials-dialog__close {
  border: 1px solid var(--viewer-panel-border);
  border-radius: 6px;
  background: var(--viewer-panel-bg);
  color: var(--viewer-panel-text);
  font: inherit;
  width: 34px;
  height: 34px;
  padding: 0;
  font-size: 24px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.materials-dialog__close:hover {
  background: var(--viewer-panel-bg-hover);
}

.materials-dialog__body {
  display: grid;
  gap: 10px;
}

.materials-dialog__grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.materials-dialog__field {
  display: grid;
  gap: 6px;
  font-weight: 600;
}

.materials-dialog__field input,
.materials-dialog__field select {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  border: 1px solid var(--viewer-panel-border);
  border-radius: 6px;
  background: var(--viewer-panel-bg);
  color: var(--viewer-panel-text);
  font: inherit;
  padding: 7px 9px;
}

.materials-dialog__field input[type="color"] {
  width: 58px;
  min-width: 58px;
  min-height: 32px;
  height: 32px;
  padding: 2px;
  justify-self: start;
  border-radius: 8px;
}

.materials-dialog__field input[type="range"] {
  padding-inline: 0;
  align-self: center;
}

.materials-dialog__hint,
.materials-dialog__empty {
  margin: 0;
  color: color-mix(in srgb, var(--viewer-panel-text) 72%, transparent);
  font-size: 13px;
}

.materials-dialog__empty[hidden] {
  display: none !important;
}

.embed-icon {
  width: 28px;
  height: 28px;
  background-color: currentColor;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='black' stroke-width='1'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M8 9l-3 3 3 3M16 9l3 3-3 3M13 6l-2 12'/%3E%3C/svg%3E");
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='black' stroke-width='1'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M8 9l-3 3 3 3M16 9l3 3-3 3M13 6l-2 12'/%3E%3C/svg%3E");
  mask-size: contain;
  mask-repeat: no-repeat;
}

.embed-exit-icon {
  width: 28px;
  height: 28px;
  background-color: currentColor;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='black' stroke-width='1.8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M6 6l12 12M18 6 6 18'/%3E%3C/svg%3E");
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='black' stroke-width='1.8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M6 6l12 12M18 6 6 18'/%3E%3C/svg%3E");
  mask-size: contain;
  mask-repeat: no-repeat;
}

#viewerActionMenuToggle:checked ~ .viewer-action-menu_panel > * {
  opacity: 1;
  transform: translateY(0);
}

#viewerActionMenuToggle:checked ~ .viewer-action-menu_panel > *:nth-child(1) {
  transition-delay: 0.04s;
}

#viewerActionMenuToggle:checked ~ .viewer-action-menu_panel > *:nth-child(2) {
  transition-delay: 0.08s;
}

#viewerActionMenuToggle:checked ~ .viewer-action-menu_panel > *:nth-child(3) {
  transition-delay: 0.12s;
}


@media (max-width: 640px) {
  .materials-dialog__grid {
    grid-template-columns: 1fr;
  }

  #viewerActionMenu {
    right: 12px;
    bottom: 12px;
    font-family: -apple-system, BlinkMacSystemFont, "Lucida Grande", "Segoe UI", Roboto, Arial, sans-serif;
  }

  #viewerEditorToolbar {
    overflow-x: auto;
  }

  #viewerEditorToolbar.expanded {
    overflow-x: auto;
  }

  .viewer-action-menu_toggle {
    width: 52px;
    height: 52px;
  }

  #viewerLanguageMode,
  #viewEntity,
  #downloadModel,
  #fullscreenMode {
    min-width: 136px;
    padding: 9px 12px;
  }
}

.download-icon {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='black' stroke-width='1.75'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M12 3v10m0 0 4-4m-4 4-4-4M5 17v1a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-1'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='black' stroke-width='1.75'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M12 3v10m0 0 4-4m-4 4-4-4M5 17v1a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-1'/%3E%3C/svg%3E");
}
