/* ===== RISO STUDIO - Win95 / Vaporwave ===== */

/* --- Custom Properties --- */
:root {
  /* Win95 chrome */
  --w95-bg: #c0c0c0;
  --w95-highlight: #dfdfdf;
  --w95-shadow: #808080;
  --w95-dark-shadow: #404040;
  --w95-window-bg: #ffffff;
  --studio-canvas-bg: #f6f5f2;

  /* Vaporwave accents */
  --vw-title-start: #2d1b69;
  --vw-title-end: #1084d0;
  --vw-glow: rgba(255, 72, 176, 0.3);
  --vw-bg-start: #1a0a2e;
  --vw-bg-end: #0d2137;
}

/* --- Reset & Viewport Lock --- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100vh;
  overflow: hidden;
  background:
    linear-gradient(rgba(255, 72, 176, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 72, 176, 0.05) 1px, transparent 1px),
    linear-gradient(135deg, var(--vw-bg-start), var(--vw-bg-end));
  background-size:
    40px 40px,
    40px 40px,
    100% 100%;
}

/* --- Win95 Utility Classes --- */
.win95-raised {
  border: 2px solid;
  border-color: var(--w95-highlight) var(--w95-dark-shadow)
    var(--w95-dark-shadow) var(--w95-highlight);
}

.win95-sunken {
  border: 2px solid;
  border-color: var(--w95-shadow) var(--w95-highlight) var(--w95-highlight)
    var(--w95-shadow);
}

.win95-btn {
  background: var(--w95-bg);
  border: 2px solid;
  border-color: var(--w95-highlight) var(--w95-dark-shadow)
    var(--w95-dark-shadow) var(--w95-highlight);
  padding: 2px 8px;
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  color: #000;
  outline: none;
}

.win95-btn:hover {
  background: #d0d0d0;
}

.win95-btn:active {
  border-color: var(--w95-dark-shadow) var(--w95-highlight) var(--w95-highlight)
    var(--w95-dark-shadow);
  padding: 3px 7px 1px 9px;
}

.win95-btn:disabled {
  color: #666;
  cursor: not-allowed;
  background: #b6b6b6;
  border-color: var(--w95-shadow) var(--w95-dark-shadow) var(--w95-dark-shadow)
    var(--w95-shadow);
}

/* --- App Shell --- */
.studio-app {
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: calc(100vh - 12px);
  width: calc(100vw - 12px);
  margin: 6px;
  font-family: "MS Sans Serif", "Microsoft Sans Serif", Geneva, sans-serif;
  font-size: 12px;
  color: #000;
  box-shadow:
    0 0 60px var(--vw-glow),
    0 0 120px rgba(45, 27, 105, 0.2);
  border: 2px solid;
  border-color: var(--w95-highlight) var(--w95-dark-shadow)
    var(--w95-dark-shadow) var(--w95-highlight);
}

/* Theme-only chrome (HyperCard skin); inert in the Win95 skin. */
.studio-card-window {
  display: contents;
}

.studio-card-titlebar,
.menubar-logo {
  display: none;
}

/* --- Menu Bar --- */
.studio-menubar {
  background: var(--w95-bg);
  padding: 2px 8px;
  display: flex;
  align-items: center;
  height: 28px;
  gap: 16px;
}

.layout-control {
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.trim-marks-control {
  margin-left: 4px;
  font-size: 12px;
  user-select: none;
}

.trim-marks-control:not([hidden]) {
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.trim-marks-control[hidden] {
  display: none !important;
}

.trim-marks-control input {
  margin: 0;
}

.layout-control {
  margin-left: 8px;
}

/* Win95-style app menus on the main toolbar. */
.studio-app-menu {
  position: relative;
  margin-left: 4px;
}

.studio-app-menu-btn {
  border: 1px solid transparent;
  background: transparent;
  padding: 2px 8px;
  height: 22px;
  font: inherit;
  font-size: 12px;
  color: #000;
  cursor: default;
}

.studio-app-menu-btn:disabled {
  color: var(--w95-shadow);
}

.studio-app-menu[data-menu="admin"] .studio-app-menu-dropdown {
  min-width: 280px;
}

/* Navy only while the dropdown is open. A softer cue marks "something is on"
 * so Filters does not look permanently selected when a screen is active. */
.studio-app-menu-btn.is-active {
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.studio-app-menu.is-open > .studio-app-menu-btn {
  background: var(--vw-title-start);
  color: #fff;
  border-color: var(--vw-title-start);
  font-weight: inherit;
  text-decoration: none;
}

.studio-app-menu-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 168px;
  background: var(--w95-bg);
  border: 2px solid;
  border-color: var(--w95-highlight) var(--w95-dark-shadow)
    var(--w95-dark-shadow) var(--w95-highlight);
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.25);
  z-index: 200;
  padding: 2px 0;
}

.studio-app-menu-dropdown[hidden] {
  display: none !important;
}

.studio-app-menu-item {
  position: relative;
  display: block;
  width: 100%;
  box-sizing: border-box;
  text-align: left;
  border: none;
  background: transparent;
  padding: 3px 12px 3px 22px;
  font: inherit;
  font-size: 11px;
  color: #000;
  cursor: default;
  white-space: nowrap;
}

.studio-app-menu-item:hover {
  background: var(--vw-title-start);
  color: #fff;
}

.studio-app-menu-item:disabled,
.studio-app-menu-item:disabled:hover {
  color: #808080;
  background: transparent;
}

.studio-app-menu-item.is-checked::before {
  content: '✓';
  position: absolute;
  left: 6px;
  top: 2px;
}

.studio-app-menu-dropdown hr {
  border: none;
  border-top: 1px solid var(--w95-shadow);
  border-bottom: 1px solid var(--w95-highlight);
  margin: 3px 2px;
}

.studio-app-menu-label {
  margin: 3px 2px 0;
  padding: 4px 12px 2px 8px;
  border-top: 1px solid var(--w95-shadow);
  box-shadow: inset 0 1px 0 var(--w95-highlight);
  font-size: 11px;
  color: #808080;
  white-space: nowrap;
  user-select: none;
}

.layout-control select {
  height: 21px;
  min-width: 82px;
  border: 2px solid;
  border-color: var(--w95-shadow) var(--w95-highlight) var(--w95-highlight)
    var(--w95-shadow);
  background: #fff;
  color: #000;
  font: inherit;
}

.studio-menubar .win95-btn {
  box-sizing: border-box;
  height: 22px;
  font-size: 12px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 10px;
  flex-shrink: 0;
}

.studio-menubar .win95-btn:active {
  padding: 3px 9px 1px 11px;
}

.save-zip-btn {
  min-width: 96px;
}

.place-order-btn {
  margin-left: 8px;
}

.reseparate-btn,
.reset-side-btn {
  margin-left: auto;
  min-width: 56px;
  padding-left: 8px;
  padding-right: 8px;
}

.reseparate-btn:disabled,
.reset-side-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* --- Middle Row --- */
.studio-middle {
  display: flex;
  min-height: 0;
}

/* --- Left Panel --- */
.studio-left {
  width: 200px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--w95-bg);
  overflow: hidden;
}

/* Ink Palette */
.ink-palette {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 10px 8px;
  justify-items: center;
  background: var(--w95-bg);
}

.ink-swatch {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.35);
  cursor: pointer;
  outline: none;
  transition:
    transform 0.1s,
    box-shadow 0.1s;
  position: relative;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.ink-swatch:hover {
  transform: scale(1.08);
}

.ink-swatch.selected {
  border-color: #000;
  box-shadow:
    0 0 0 2px var(--w95-bg),
    0 0 0 4px #000,
    0 0 10px var(--vw-glow);
}

.ink-swatch.selected::after {
  content: "";
  position: absolute;
  top: -6px;
  right: -6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #000;
  border: 2px solid var(--w95-bg);
  pointer-events: none;
}

.ink-swatch.is-out {
  cursor: default;
  pointer-events: none;
  background-image: repeating-conic-gradient(#fff 0% 25%, transparent 0% 50%);
  background-size: 2px 2px;
}

.ink-swatch.is-out:hover {
  transform: none;
}

body.maintenance-inks .ink-swatch.is-out {
  cursor: pointer;
  pointer-events: auto;
  background-image: none;
}

body.maintenance-inks .ink-swatch.is-out:hover {
  transform: scale(1.08);
}

body.maintenance-inks .ink-swatch.is-out .out-mark,
body.maintenance-inks .layer-slot.is-out .out-mark,
body.maintenance-inks .layer-slot.is-out .layer-preview::before {
  display: none;
}

body.maintenance-inks .layer-slot.is-out {
  pointer-events: auto;
}

body.maintenance-inks .layer-slot.is-out .layer-color-dot {
  background-image: none;
}

.ink-swatch.is-out .out-mark {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

/* Layer Stack */
.layer-stack {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 2px;
  gap: 2px;
}

.layer-slot {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  transition: opacity 0.2s;
}

.layer-header {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 4px;
  flex-shrink: 0;
  height: 18px;
}

.layer-slot.disabled .layer-header {
  opacity: 0.4;
}

.layer-color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid var(--w95-dark-shadow);
  flex-shrink: 0;
  opacity: 0.35;
  transition:
    opacity 0.2s,
    box-shadow 0.2s;
  cursor: pointer;
}

.layer-slot:not(.disabled) .layer-color-dot {
  opacity: 1;
  box-shadow:
    0 0 4px 1px rgba(255, 255, 255, 0.95),
    0 0 10px 3px rgba(255, 255, 255, 0.5);
}

.layer-name {
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.layer-preview {
  flex: 1;
  min-height: 0;
  background: #b0b0b0;
  margin: 0 4px 2px 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.layer-preview:has(.layer-thumb) {
  background: #fff;
}

.layer-preview.drag-over {
  outline: 2px dashed var(--vw-title-end);
  outline-offset: -2px;
}

.layer-preview.drag-over:not(:has(.layer-thumb)) {
  background: #a0a0a0;
}

.layer-thumb {
  display: block;
  max-width: 100%;
  max-height: 100%;
  cursor: grab;
}

.layer-thumb:active {
  cursor: grabbing;
}

.layer-preview.dragging-source {
  opacity: 0.4;
}

/* Off layers: still show thumbnail faintly so you know data is there (delete removes it entirely) */
.layer-slot.disabled .layer-preview .layer-thumb {
  opacity: 0.38;
  cursor: grab;
}

.layer-slot.disabled .layer-preview:has(.layer-thumb) {
  background: #fff;
}

.layer-slot.is-out {
  pointer-events: none;
}

body.help-open .layer-slot.is-out {
  pointer-events: auto;
}

.layer-slot.is-out .layer-header {
  opacity: 1;
}

.layer-slot.is-out .layer-color-dot {
  opacity: 1;
  background-image: repeating-conic-gradient(#fff 0% 25%, transparent 0% 50%);
  background-size: 2px 2px;
}

.layer-slot.is-out .layer-preview::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background-image: repeating-conic-gradient(#000 0% 25%, transparent 0% 50%);
  background-size: 2px 2px;
}

.layer-slot.is-out .out-mark {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 5;
  width: 34px;
  height: 34px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.layer-slot.is-out.disabled .layer-preview .layer-thumb {
  opacity: 1;
}

/* Layer remove (Win95 tiny x) */
.layer-delete-btn {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  padding: 0;
  margin: 0;
  font-size: 11px;
  font-weight: bold;
  line-height: 1;
  font-family: inherit;
  color: #333;
  background: var(--w95-bg);
  border: 1px solid var(--w95-dark-shadow);
  cursor: pointer;
  z-index: 2;
  opacity: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.layer-preview:hover:has(.layer-thumb) .layer-delete-btn {
  opacity: 1;
  pointer-events: auto;
  border: 2px solid;
  border-color: var(--w95-highlight) var(--w95-dark-shadow)
    var(--w95-dark-shadow) var(--w95-highlight);
}

.layer-delete-btn:hover {
  background: #d0d0d0;
}

.layer-delete-btn:active {
  border-color: var(--w95-dark-shadow) var(--w95-highlight) var(--w95-highlight)
    var(--w95-dark-shadow);
  padding: 1px 0 0 1px;
}

/* --- Design Canvas (main area) --- */
.studio-canvas {
  flex: 1;
  min-width: 0;
  background: var(--studio-canvas-bg);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.studio-canvas.canvas-drag-over {
  outline: 2px dashed var(--vw-title-end);
  outline-offset: -2px;
}

.canvas-fit-toolbar {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.canvas-fit-btn,
.canvas-margin-btn {
  box-sizing: border-box;
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  max-width: 28px;
  max-height: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  flex-shrink: 0;
}

.canvas-fit-btn:active,
.canvas-margin-btn:active,
.canvas-fit-btn.is-active,
.canvas-fit-btn[aria-pressed="true"],
.canvas-margin-btn.is-active,
.canvas-margin-btn[aria-pressed="true"] {
  border-color: var(--w95-dark-shadow) var(--w95-highlight) var(--w95-highlight)
    var(--w95-dark-shadow);
  padding: 0;
}

.canvas-tool-icon,
.canvas-fit-icon {
  display: block;
  pointer-events: none;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.canvas-margin-toolbar {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--w95-shadow);
}

#studio-main-canvas {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.32);
}

.shapes-overlay {
  position: absolute;
  z-index: 5;
  touch-action: none;
}

.shapes-overlay[hidden] {
  display: none;
}

.canvas-grid-toolbar {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 6;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.canvas-grid-toolbar[hidden] {
  display: none;
}

.shapes-popup {
  top: 72px;
  left: 220px;
  width: 336px;
}

.shapes-tools {
  display: flex;
  gap: 8px;
  padding: 8px 8px 4px;
}

.shapes-tool {
  width: 52px;
  height: 52px;
  min-width: 52px;
  padding: 6px;
}

.shapes-fill-row,
.shapes-tone {
  padding-left: 12px;
  padding-right: 12px;
}

.shapes-fill-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 8px;
  padding-bottom: 6px;
}

.shapes-field-label {
  font-family: inherit;
  font-size: inherit;
  font-weight: normal;
  line-height: 1.2;
  margin: 0;
  white-space: nowrap;
  flex-shrink: 0;
}

.shapes-fill-row select {
  flex: 1;
  min-width: 0;
}

.shapes-tone {
  padding-top: 2px;
  padding-bottom: 8px;
}

.shapes-tone .shapes-field-label {
  display: block;
  margin-bottom: 2px;
}

.shapes-tone .adjust-output-bar {
  height: 14px;
}

.shapes-tone .adjust-levels-track {
  touch-action: none;
  cursor: ew-resize;
}

.shapes-tone .adjust-handle[hidden] {
  display: none;
}

.shapes-tool svg {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.shapes-tool[aria-pressed='true'] {
  border-color: var(--w95-dark-shadow) var(--w95-highlight) var(--w95-highlight)
    var(--w95-dark-shadow);
}

.shapes-actions {
  display: flex;
  gap: 6px;
  padding: 2px 12px 10px;
}

.canvas-drop-hint {
  position: absolute;
  z-index: 2;
  display: flex;
  justify-content: center;
  pointer-events: none;
  color: #111;
  transform: translateY(-50%);
}

.canvas-drop-hint[hidden] {
  display: none;
}

.canvas-drop-hint__box {
  width: max-content;
  max-width: 88%;
  box-sizing: border-box;
  padding: 34px 40px;
  border: 1px dashed rgba(0, 0, 0, 0.4);
  border-radius: 22px;
  text-align: center;
}

.canvas-drop-hint__lead,
.canvas-drop-hint__rest {
  display: block;
}

.canvas-drop-hint__lead {
  white-space: nowrap;
}

.canvas-drop-hint__rest {
  width: 0;
  min-width: 100%;
}

.canvas-drop-hint.is-on-dark {
  color: #fff;
}

.canvas-drop-hint.is-on-dark .canvas-drop-hint__box {
  border-color: rgba(255, 255, 255, 0.45);
}

.separation-spinner {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.82);
}

.separation-spinner[hidden] {
  display: none;
}

/* Pixel hourglass while a redraw or layer swap is taking a while. */
.hc-hourglass {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 10000;
  width: 32px;
  height: 32px;
  margin: -16px 0 0 -16px;
  pointer-events: none;
  image-rendering: pixelated;
  background: url("/imgs/studio/hourglass-top.png") center / 32px 32px no-repeat;
  animation: hc-hourglass 0.7s steps(1, end) infinite;
}

.hc-hourglass[hidden] {
  display: none;
}

body.hc-busy,
body.hc-busy * {
  cursor: url("/imgs/studio/hourglass-top.png") 8 8, wait !important;
}

@keyframes hc-hourglass {
  0% {
    background-image: url("/imgs/studio/hourglass-top.png");
  }
  50% {
    background-image: url("/imgs/studio/hourglass-bottom.png");
  }
}

.spinner-ring {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid var(--w95-shadow);
  border-top-color: var(--vw-title-end);
  animation: spin-ring 0.85s linear infinite;
}

.spinner-text {
  color: #1f1f1f;
  font-size: 11px;
  font-weight: bold;
  font-family: "MS Sans Serif", "Microsoft Sans Serif", Geneva, sans-serif;
  text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.65);
}

@keyframes spin-ring {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* --- Right Panel - Page Tray --- */
.studio-right {
  width: 180px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: #c0c0c0;
  box-shadow:
    inset 0 2px 6px rgba(0, 0, 0, 0.25),
    inset 0 -1px 3px rgba(0, 0, 0, 0.1);
  position: relative;
}

.page-tray {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Scrollbar (Win95-ish) */
.page-tray::-webkit-scrollbar {
  width: 16px;
}

.page-tray::-webkit-scrollbar-track {
  background: repeating-conic-gradient(#999 0% 25%, #aaa 0% 50%) 50% / 2px 2px;
}

.page-tray::-webkit-scrollbar-thumb {
  background: var(--w95-bg);
  border: 2px solid;
  border-color: var(--w95-highlight) var(--w95-dark-shadow)
    var(--w95-dark-shadow) var(--w95-highlight);
}

/* --- Page Entry --- */
.page-entry {
  cursor: pointer;
}

.page-stack {
  position: relative;
  margin: 0 6px;
}

/* --- Paper Sheet --- */
.page-sheet {
  cursor: pointer;
  aspect-ratio: 210 / 297;
  overflow: hidden;
  position: relative;
}

.page-sheet.landscape {
  aspect-ratio: 297 / 210;
}

/* --- Page SVG (page outline) --- */
.page-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* --- Fold SVG (fold triangle + edges, on top of label) --- */
.fold-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 3;
}

.page-preview-canvas {
  position: absolute;
  top: 3%;
  left: 3%;
  width: 94%;
  height: 94%;
  z-index: 1;
  pointer-events: none;
}

.page-sheet:not(.active) .page-preview-canvas {
  opacity: 0.6;
}

.page-sheet[data-side="b"] .page-svg,
.page-sheet[data-side="b"] .fold-svg {
  transform: scaleX(-1);
}

/* --- Sheet Label --- */
.sheet-label {
  position: absolute;
  font-size: 32px;
  font-weight: 900;
  color: #222;
  z-index: 2;
  pointer-events: none;
  font-family: Arial, Helvetica, sans-serif;
}

.page-sheet[data-side="a"] .sheet-label {
  top: 6px;
  left: 19px;
}

.page-sheet[data-side="b"] .sheet-label {
  bottom: 6px;
  right: 8px;
  top: auto;
  left: auto;
}

/* A-side: relative (gives height to stack), top-left */
.page-sheet[data-side="a"] {
  position: relative;
  width: 62%;
  z-index: 2;
}

/* B-side: absolute, offset right & down behind A */
.page-sheet[data-side="b"] {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 62%;
  z-index: 1;
}

/* When B exists, pad the stack so B sits lower than A */
.page-stack.has-b {
  padding-bottom: 30%;
}

.page-stack.landscape .page-sheet[data-side="a"],
.page-stack.landscape .page-sheet[data-side="b"] {
  width: 78%;
}

.page-stack.landscape.has-b {
  padding-bottom: 28%;
}

/* Active sheet to front */
.page-sheet.active {
  z-index: 3;
}

/* Inactive sheet dimmed; the fill stays the paper colour */
.page-sheet:not(.active) .page-svg,
.page-sheet:not(.active) .fold-svg {
  opacity: 0.72;
}
.page-sheet:not(.active):hover .page-svg,
.page-sheet:not(.active):hover .fold-svg {
  opacity: 0.88;
}

/* Active page is indicated by being on top -- no outline needed */

/* --- Page Footer (label) --- */
.page-footer {
  padding: 4px 6px 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 5px;
}

.page-paper-btn {
  width: 16px;
  height: 16px;
  padding: 0;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  line-height: 1;
  font-family: inherit;
  color: #000;
  background: var(--w95-bg);
  border: 2px solid;
  border-color: var(--w95-highlight) var(--w95-dark-shadow)
    var(--w95-dark-shadow) var(--w95-highlight);
  cursor: pointer;
}

.page-paper-btn:active,
.page-paper-btn.is-open {
  border-color: var(--w95-dark-shadow) var(--w95-highlight) var(--w95-highlight)
    var(--w95-dark-shadow);
  background: #d0d0d0;
}

.page-paper-summary {
  flex-basis: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0 4px;
  font-size: 10px;
  color: #333;
}

.page-paper-summary:empty {
  display: none;
}

.page-paper-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-paper-sheets {
  grid-column: 2;
}

.paper-chip {
  display: inline-block;
  width: 10px;
  height: 10px;
  flex-shrink: 0;
  border: 1px solid var(--w95-dark-shadow);
  background: #fff;
}

/* --- Paper flyout (per page, opens left of the tray) --- */
.paper-flyout {
  position: fixed;
  z-index: 250;
  width: 244px;
  padding: 8px;
  display: grid;
  gap: 8px;
  background: var(--w95-bg);
  font-family: "MS Sans Serif", "Microsoft Sans Serif", Geneva, sans-serif;
  font-size: 12px;
  color: #000;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.25);
}

.paper-flyout[hidden] {
  display: none;
}

/* Pointer on the right edge, aimed at the page's ⏴ button. */
.paper-flyout::after {
  content: "";
  position: absolute;
  right: -9px;
  top: calc(var(--arrow-top, 24px) - 7px);
  border: 7px solid transparent;
  border-right: 0;
  border-left: 7px solid var(--w95-dark-shadow);
}

.paper-flyout-title {
  font-weight: bold;
}

.paper-field {
  display: grid;
  grid-template-columns: 48px 1fr;
  align-items: center;
  gap: 6px;
}

.paper-field-control {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.paper-field select,
.paper-table select {
  flex: 1;
  min-width: 0;
  width: 100%;
  height: 21px;
  font: inherit;
}

.paper-field input,
.paper-table input {
  width: 72px;
  height: 21px;
  padding: 0 4px;
  font: inherit;
  border: 2px solid;
  border-color: var(--w95-shadow) var(--w95-highlight) var(--w95-highlight)
    var(--w95-shadow);
  background: #fff;
}

.paper-flyout-actions {
  display: flex;
  justify-content: flex-end;
}

/* --- Paper window --- */
.adjust-popup.paper-window {
  top: 90px;
  left: calc(100vw - 740px);
  width: 520px;
  font-family: "MS Sans Serif", "Microsoft Sans Serif", Geneva, sans-serif;
}

.paper-window-body {
  padding: 8px;
  max-height: calc(100vh - 160px);
  overflow-y: auto;
}

.paper-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.paper-table th,
.paper-table td {
  padding: 3px 4px;
  text-align: left;
  white-space: nowrap;
}

.paper-table thead th {
  border-bottom: 1px solid var(--w95-shadow);
  font-weight: bold;
}

.paper-table td:nth-child(2) {
  width: 100%;
  max-width: 0;
}

.paper-table tr.is-unpriced th,
.paper-table tr.is-unpriced .paper-row-inks {
  color: #777;
}

.paper-row-inks {
  text-align: right;
}

.paper-breakdown {
  margin-top: 10px;
  padding-top: 6px;
  border-top: 1px solid var(--w95-shadow);
  display: grid;
  gap: 2px;
  font-size: 11px;
}

.paper-breakdown-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.paper-breakdown-line.is-detail {
  padding-left: 12px;
  color: #444;
}

.paper-breakdown-line.is-detail span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.paper-breakdown-line.is-total {
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid var(--w95-shadow);
  font-weight: bold;
}

.paper-quote {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--w95-shadow);
  display: grid;
  gap: 6px;
}

.paper-quote-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.paper-quote-code {
  font-family: "Courier New", Courier, monospace;
  font-size: 11px;
  word-break: break-all;
}

/* A sheet: remove A-side only if B exists (B→A), else remove whole page when 2+ pages; hidden when only Page 1 A-only remains */
.aside-delete-btn {
  position: absolute;
  bottom: 4px;
  left: 4px;
  width: 16px;
  height: 16px;
  padding: 0;
  margin: 0;
  font-size: 12px;
  font-weight: bold;
  line-height: 1;
  font-family: inherit;
  color: #333;
  background: var(--w95-bg);
  border: 1px solid var(--w95-dark-shadow);
  cursor: pointer;
  z-index: 4;
  opacity: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.page-sheet[data-side="a"]:hover .aside-delete-btn {
  opacity: 1;
  pointer-events: auto;
  border: 2px solid;
  border-color: var(--w95-highlight) var(--w95-dark-shadow)
    var(--w95-dark-shadow) var(--w95-highlight);
}

.aside-delete-btn:hover {
  background: #d0d0d0;
}

.aside-delete-btn:active {
  border-color: var(--w95-dark-shadow) var(--w95-highlight) var(--w95-highlight)
    var(--w95-dark-shadow);
}

/* B-side sheet remove */
.bside-delete-btn {
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 16px;
  height: 16px;
  padding: 0;
  margin: 0;
  font-size: 12px;
  font-weight: bold;
  line-height: 1;
  font-family: inherit;
  color: #333;
  background: var(--w95-bg);
  border: 1px solid var(--w95-dark-shadow);
  cursor: pointer;
  z-index: 4;
  opacity: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.page-sheet[data-side="b"]:hover .bside-delete-btn {
  opacity: 1;
  pointer-events: auto;
  border: 2px solid;
  border-color: var(--w95-highlight) var(--w95-dark-shadow)
    var(--w95-dark-shadow) var(--w95-highlight);
}

.bside-delete-btn:hover {
  background: #d0d0d0;
}

.bside-delete-btn:active {
  border-color: var(--w95-dark-shadow) var(--w95-highlight) var(--w95-highlight)
    var(--w95-dark-shadow);
}

.page-num {
  font-size: 10px;
  font-weight: bold;
  color: #333;
}

.add-bside-btn {
  position: absolute;
  right: 6%;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--w95-bg);
  border: 2px solid;
  border-color: var(--w95-highlight) var(--w95-dark-shadow)
    var(--w95-dark-shadow) var(--w95-highlight);
  font-size: 16px;
  font-family: inherit;
  cursor: pointer;
  color: #333;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
  z-index: 4;
}

.add-bside-btn:hover {
  background: #d0d0d0;
}

.add-bside-btn:active {
  border-color: var(--w95-dark-shadow) var(--w95-highlight) var(--w95-highlight)
    var(--w95-dark-shadow);
}

/* --- Add Page Button --- */
.add-page-btn {
  align-self: center;
  margin: 8px auto 10px;
  flex-shrink: 0;
  min-width: 88px;
}

/* --- Status Bar --- */
.studio-statusbar {
  background: var(--w95-bg);
  padding: 2px 8px;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  align-items: center;
  height: 24px;
  font-family: "Courier New", Courier, monospace;
  font-size: 11px;
  color: #1a3a1a;
}

.status-gpu {
  color: #444;
}

.status-gpu.available {
  color: #1a3a1a;
}

.status-gpu.unavailable {
  color: #8a1f1f;
  font-weight: bold;
}

.status-cost {
  margin-left: auto;
  padding: 0 4px;
  border: 0;
  background: transparent;
  font: inherit;
  font-weight: bold;
  color: inherit;
  cursor: pointer;
  white-space: nowrap;
}

.status-cost:hover {
  text-decoration: underline;
}

/* --- Per-layer adjust icon buttons (Levels / Curves) --- */
/* Hidden until the slot has a thumbnail; the `:has` rule below shows it. */
.layer-adjust-icons {
  position: absolute;
  bottom: 4px;
  right: 4px;
  gap: 2px;
  z-index: 3;
  display: none;
}

.layer-preview:has(.layer-thumb) .layer-adjust-icons {
  display: flex;
}

.layer-preview .layer-shapes-btn {
  position: absolute;
  bottom: 4px;
  left: 4px;
  z-index: 3;
  display: none;
}

.layer-preview .layer-mask-btn {
  position: absolute;
  bottom: 4px;
  left: 24px;
  z-index: 3;
  display: none;
}

.layer-preview .layer-collage-btn {
  position: absolute;
  bottom: 4px;
  left: 44px;
  z-index: 3;
  display: none;
}

.show-shapes-buttons .layer-preview .layer-shapes-btn,
.show-mask-buttons .layer-preview .layer-mask-btn,
.show-collage-buttons .layer-preview .layer-collage-btn {
  display: block;
}

.layer-slot.is-collage-current .layer-preview {
  outline: 2px solid var(--vw-title-end);
  outline-offset: -2px;
}

.menubar-cog {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  padding: 0;
}

.menubar-cog svg {
  display: block;
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
}

.menubar-cog__hole {
  fill: var(--w95-bg);
}

.studio-app-menu[data-menu="settings"] .studio-app-menu-dropdown {
  min-width: 196px;
}

.layer-adjust-btn {
  width: 18px;
  height: 18px;
  padding: 0;
  font-size: 11px;
  font-weight: bold;
  font-family: inherit;
  line-height: 14px;
  text-align: center;
  background: var(--w95-bg);
  color: #000;
  border: 2px solid;
  border-color: var(--w95-highlight) var(--w95-dark-shadow)
    var(--w95-dark-shadow) var(--w95-highlight);
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
}

.layer-adjust-btn:hover {
  background: #d0d0d0;
}

.layer-adjust-btn:active {
  border-color: var(--w95-dark-shadow) var(--w95-highlight) var(--w95-highlight)
    var(--w95-dark-shadow);
}

.layer-adjust-btn.is-active::after {
  content: "";
  position: absolute;
  top: -2px;
  right: -2px;
  width: 6px;
  height: 6px;
  background: var(--vw-title-end);
  border: 1px solid #fff;
  border-radius: 50%;
}

.layer-adjust-btn.is-open {
  background: #d0d0d0;
  border-color: var(--w95-dark-shadow) var(--w95-highlight) var(--w95-highlight)
    var(--w95-dark-shadow);
}

/* --- Adjust popup window --- */
.adjust-popup {
  position: fixed;
  top: 80px;
  left: calc(100vw - 360px);
  width: 336px;
  background: var(--w95-bg);
  z-index: 100;
  font-size: 11px;
  user-select: none;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}

.adjust-popup[hidden] {
  display: none;
}

/* Four windows: Layer Adjustments (template), Layer Filters, Global Adjustments,
   Global Filters. Starting positions stagger so they are not stacked dead-on. */
.adjust-popup.is-ink-filters {
  top: 120px;
  left: calc(100vw - 380px);
}

.adjust-popup.is-global-adjustments {
  top: 80px;
  left: calc(100vw - 720px);
}

.adjust-popup.is-global-filters {
  top: 140px;
  left: calc(100vw - 740px);
}

/* Back-compat alias used while cloning. */
.adjust-popup.is-global-scope {
  top: 120px;
  left: calc(100vw - 720px);
}

.adjust-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(
    to right,
    var(--vw-title-start),
    var(--vw-title-end)
  );
  color: #fff;
  padding: 3px 6px;
  font-weight: bold;
  cursor: move;
}

.adjust-popup-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.adjust-popup-swatch {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #888;
  border: 1px solid rgba(255, 255, 255, 0.6);
  flex-shrink: 0;
}

.adjust-popup-close {
  width: 18px;
  height: 16px;
  padding: 0;
  font-size: 12px;
  line-height: 12px;
  font-family: inherit;
  background: var(--w95-bg);
  color: #000;
  border: 1px solid;
  border-color: var(--w95-highlight) var(--w95-dark-shadow)
    var(--w95-dark-shadow) var(--w95-highlight);
  cursor: pointer;
}

.adjust-popup-close:active {
  border-color: var(--w95-dark-shadow) var(--w95-highlight) var(--w95-highlight)
    var(--w95-dark-shadow);
}

.adjust-popup-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px 4px;
  border-bottom: 1px solid var(--w95-shadow);
  background: var(--w95-bg);
}

.adjust-win-menu {
  position: relative;
}

.adjust-win-menu[hidden] {
  display: none !important;
}

.adjust-win-menu-btn {
  border: 1px solid transparent;
  background: transparent;
  padding: 2px 8px;
  font: inherit;
  font-size: 11px;
  color: #000;
  cursor: default;
}

.adjust-win-menu.is-open > .adjust-win-menu-btn {
  background: var(--vw-title-start);
  color: #fff;
  border-color: var(--vw-title-start);
}

.adjust-win-menu-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 140px;
  background: var(--w95-bg);
  border: 2px solid;
  border-color: var(--w95-highlight) var(--w95-dark-shadow)
    var(--w95-dark-shadow) var(--w95-highlight);
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.25);
  z-index: 30;
  padding: 2px 0;
}

.adjust-win-menu-dropdown[hidden] {
  display: none !important;
}

.adjust-win-menu-item {
  position: relative;
  display: block;
  width: 100%;
  box-sizing: border-box;
  text-align: left;
  border: none;
  background: transparent;
  padding: 3px 12px 3px 22px;
  font: inherit;
  font-size: 11px;
  color: #000;
  cursor: default;
  white-space: nowrap;
}

.adjust-win-menu-item[hidden] {
  display: none !important;
}

.adjust-win-menu-item:hover {
  background: var(--vw-title-start);
  color: #fff;
}

.adjust-win-menu-item.is-checked::before {
  content: '✓';
  position: absolute;
  left: 6px;
  top: 2px;
}

.adjust-win-menu-dropdown hr {
  border: none;
  border-top: 1px solid var(--w95-shadow);
  border-bottom: 1px solid var(--w95-highlight);
  margin: 3px 2px;
}

.adjust-reset-btn {
  margin-left: auto;
  padding: 1px 8px;
  font-family: inherit;
  font-size: 11px;
  background: var(--w95-bg);
  color: #000;
  border: 2px solid;
  border-color: var(--w95-highlight) var(--w95-dark-shadow)
    var(--w95-dark-shadow) var(--w95-highlight);
  cursor: pointer;
}

.adjust-reset-btn:active {
  border-color: var(--w95-dark-shadow) var(--w95-highlight) var(--w95-highlight)
    var(--w95-dark-shadow);
}

.adjust-panel {
  padding: 8px;
}

.adjust-panel[hidden] {
  display: none;
}

.adjust-section {
  margin-bottom: 10px;
}

.adjust-shuffle-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.adjust-section-label {
  display: block;
  font-size: 11px;
  font-weight: bold;
  margin-bottom: 4px;
  color: #000;
  padding: 2px 0;
}

.adjust-histogram-wrap,
.adjust-output-wrap {
  position: relative;
  background: #fff;
  border: 1px solid var(--w95-dark-shadow);
}

.adjust-histogram {
  display: block;
  width: 100%;
  height: 100px;
  background: #fff;
}

.adjust-output-bar {
  height: 22px;
  background: linear-gradient(to right, #000, #fff);
}

.adjust-levels-track {
  position: relative;
  height: 14px;
  background: transparent;
}

.adjust-handle {
  position: absolute;
  top: 0;
  width: 0;
  height: 0;
  cursor: ew-resize;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  transform: translateX(-50%);
}

.adjust-handle-black {
  border-top: 12px solid #000;
}

.adjust-handle-gamma {
  border-top: 12px solid #888;
}

/* Under a gradient bar the arrow points up at the spot it controls. */
.adjust-levels-track[data-track="output"] .adjust-handle-black,
.shapes-tone .adjust-handle-black {
  border-top: 0;
  border-bottom: 12px solid #000;
}

.adjust-levels-track[data-track="output"] .adjust-handle-white,
.shapes-tone .adjust-handle-white {
  border-top: 0;
  border-bottom: 12px solid #fff;
}

.adjust-handle-white {
  border-top: 12px solid #fff;
  filter:
    drop-shadow(1px 0 0 #000) drop-shadow(-1px 0 0 #000)
    drop-shadow(0 1px 0 #000) drop-shadow(0 -1px 0 #000);
}

.adjust-levels-numbers {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
}

.adjust-output-numbers {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
}

.adjust-levels-numbers input,
.adjust-output-numbers input {
  width: 60px;
  padding: 2px 4px;
  font-family: inherit;
  font-size: 11px;
  border: 2px solid;
  border-color: var(--w95-shadow) var(--w95-highlight) var(--w95-highlight)
    var(--w95-shadow);
  background: #fff;
  color: #000;
  text-align: center;
}

.adjust-curves-wrap {
  position: relative;
  background: #fff;
  border: 1px solid var(--w95-dark-shadow);
}

.adjust-curves-canvas {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  cursor: crosshair;
}

.adjust-curves-legend {
  display: flex;
  justify-content: space-between;
  padding: 4px 6px 0;
  color: #333;
  font-size: 10px;
}

.adjust-blur-slider {
  width: 100%;
  margin: 6px 0 4px 0;
  cursor: pointer;
}

.halftone-lpi-slider {
  position: relative;
  margin: 2px 0 0;
}

.halftone-lpi-slider .adjust-blur-slider {
  margin: 4px 0 0;
}

.halftone-lpi-marks {
  position: relative;
  height: 18px;
  margin: 0 7px;
}

.halftone-lpi-mark {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
}

.halftone-lpi-mark i {
  display: block;
  width: 1px;
  height: 6px;
  background: #555;
}

.halftone-lpi-mark b {
  margin-top: 1px;
  font-size: 9px;
  font-weight: normal;
  color: #444;
  line-height: 1;
}

.adjust-blur-numbers {
  display: flex;
  justify-content: flex-end;
  font-family: "Courier New", Courier, monospace;
  font-size: 11px;
  color: #1a3a1a;
}

.adjust-blur-readout {
  padding: 2px 6px;
  border: 2px solid;
  border-color: var(--w95-shadow) var(--w95-highlight) var(--w95-highlight)
    var(--w95-shadow);
  background: #fff;
  color: #000;
  min-width: 80px;
  text-align: right;
}

.adjust-help {
  margin-top: 8px;
  font-size: 10px;
  color: #444;
  line-height: 1.4;
}

.adjust-check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  cursor: pointer;
  padding: 2px 0;
}

.adjust-check-row[hidden] {
  display: none !important;
}

.adjust-check-row input[type='checkbox'] {
  width: 14px;
  height: 14px;
  cursor: pointer;
}

.halftone-pitch-readout {
  margin: 2px 0 0;
  font-size: 11px;
  color: #444;
  line-height: 1.3;
}

.halftone-lpi-value {
  font-weight: 800;
  font-size: 13px;
}

.halftone-angle-inline {
  display: flex;
  align-items: center;
  gap: 8px;
}

.halftone-angle-inline[hidden] {
  display: none !important;
}

.halftone-angle-inline .adjust-section-label {
  margin: 0;
  padding: 0;
}

.halftone-angle-rows {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
}

.halftone-angle-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
}

.halftone-angle-swatch {
  width: 14px;
  height: 14px;
  border: 1px solid #333;
  flex-shrink: 0;
}

.halftone-angle-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.halftone-angle-input {
  width: 52px;
  height: 20px;
  border: 2px solid;
  border-color: var(--w95-shadow) var(--w95-highlight) var(--w95-highlight)
    var(--w95-shadow);
  background: #fff;
  font: inherit;
  text-align: right;
  padding: 0 4px;
}

.halftone-angle-warn {
  color: #8a3b00;
}

.halftone-ink-enable {
  width: 14px;
  height: 14px;
  margin: 0;
  cursor: pointer;
  flex-shrink: 0;
}

/* --- Loupe (flush bottom-right of the canvas pane) --- */
.studio-canvas.is-loupe-active #studio-main-canvas {
  cursor: zoom-in;
}

.loupe-launcher {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 14;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 2px solid;
  border-color: var(--w95-highlight) var(--w95-shadow) var(--w95-shadow)
    var(--w95-highlight);
  background: var(--w95-bg);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.25);
}

.loupe-launcher:active {
  border-color: var(--w95-shadow) var(--w95-highlight) var(--w95-highlight)
    var(--w95-shadow);
}

.loupe-launcher[hidden] {
  display: none;
}

.loupe-dock {
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 15;
  width: 220px;
  height: 220px;
  pointer-events: none;
}

.loupe-dock[hidden] {
  display: none;
}

.loupe {
  width: 220px;
  height: 220px;
  border-radius: 50%;
  overflow: hidden;
  box-shadow:
    0 0 0 3px #c0c0c0,
    0 0 0 5px #808080,
    0 0 0 6px #fff,
    0 8px 24px rgba(0, 0, 0, 0.45);
  background: #fff;
  pointer-events: none;
}

.loupe-canvas {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
}

/* Sits on the rim outside the circular clip, so it is not cut off. */
.loupe-close {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 2;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 2px solid;
  border-color: var(--w95-highlight) var(--w95-shadow) var(--w95-shadow)
    var(--w95-highlight);
  background: var(--w95-bg);
  color: #000;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  pointer-events: auto;
}

.adjust-invert-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  cursor: pointer;
  padding: 4px 0;
}

.adjust-invert-label input[type="checkbox"] {
  width: 14px;
  height: 14px;
  cursor: pointer;
}

/* Print preview picker, top-right of the canvas. */
.print-preview-corner {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 16;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}

.print-preview-menu {
  position: relative;
  margin-left: 0;
}

.print-preview-menu > .studio-app-menu-btn {
  display: inline-flex;
  align-items: stretch;
  justify-content: space-between;
  width: 100%;
  height: auto;
  padding: 0;
  border: 2px solid;
  border-color: var(--w95-highlight) var(--w95-shadow) var(--w95-shadow)
    var(--w95-highlight);
  background: var(--w95-bg);
  font-size: 12px;
  line-height: 1.2;
  cursor: pointer;
  box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.25);
}

.print-preview-menu-label {
  padding: 4px 8px;
}

.print-preview-menu-caret {
  display: inline-flex;
  align-items: center;
  padding: 0 6px;
  border-left: 1px solid currentColor;
}

.print-preview-menu-caret::before {
  content: "";
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
}

.print-preview-menu > .studio-app-menu-btn.is-active {
  font-weight: 700;
  border-color: var(--w95-shadow) var(--w95-highlight) var(--w95-highlight)
    var(--w95-shadow);
}

.print-preview-menu > .studio-app-menu-btn:disabled {
  color: #808080;
  cursor: default;
  box-shadow: none;
}

.print-preview-menu .studio-app-menu-dropdown {
  left: auto;
  right: 0;
  min-width: 220px;
}

.print-preview-download,
.print-preview-split {
  padding: 4px 10px;
  border: 2px solid;
  border-color: var(--w95-highlight) var(--w95-shadow) var(--w95-shadow)
    var(--w95-highlight);
  background: var(--w95-bg);
  font: inherit;
  font-size: 12px;
  line-height: 1.2;
  cursor: pointer;
  box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.25);
}

.print-preview-split.is-active {
  border-color: var(--w95-shadow) var(--w95-highlight) var(--w95-highlight)
    var(--w95-shadow);
  font-weight: 400;
}

.print-preview-download[hidden],
.print-preview-split[hidden] {
  display: none !important;
}

/* Split between the screen preview and the print preview. */
.print-split {
  --wipe: 50%;
  position: absolute;
  z-index: 5;
  pointer-events: none;
}

.print-split[hidden] {
  display: none !important;
}

.print-split__handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--wipe);
  width: 44px;
  transform: translateX(-50%);
  touch-action: none;
  cursor: ew-resize;
  pointer-events: auto;
}

.print-split__handle::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  transform: translateX(-50%);
  background: #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45);
}

.print-split__knob {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 44px;
  height: 44px;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #111;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28);
}

.print-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
}

.print-preview-modal[hidden] {
  display: none !important;
}

.print-preview-scrim {
  position: absolute;
  inset: 0;
  background-color: transparent;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='2' height='2' shape-rendering='crispEdges'%3E%3Crect width='1' height='1' fill='%23000'/%3E%3Crect x='1' y='1' width='1' height='1' fill='%23000'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 2px 2px;
  image-rendering: pixelated;
}

.print-preview-window {
  top: 96px;
  left: 50%;
  width: 380px;
  margin-left: -190px;
  z-index: 1;
}

.riso-effect-note-window {
  width: 440px;
  margin-left: -220px;
}

.maintenance-ink-window {
  width: 440px;
  margin-left: -220px;
}

.maintenance-ink-body {
  padding: 16px 16px 14px;
}

.maintenance-ink-body p {
  margin: 0 0 16px;
  line-height: 1.35;
}

.about-lab-window {
  width: 320px;
  margin-left: -160px;
}

.about-lab-body {
  text-align: center;
  padding: 18px 16px 14px;
}

.about-lab-version,
.about-lab-copy {
  margin: 0;
}

.about-lab-version {
  margin-bottom: 8px;
  font-size: 16px;
  font-weight: bold;
}

.about-lab-copy {
  margin-bottom: 16px;
  font-size: 16px;
}

.about-lab-window .about-lab-actions {
  justify-content: center;
}

.riso-effect-note-title {
  margin: 0 0 10px;
  font-size: 16px;
  font-weight: bold;
  text-align: center;
}

.riso-effect-note-window .print-preview-actions {
  justify-content: flex-end;
}

.order-window {
  width: min(600px, calc(100vw - 32px));
  margin-left: calc(min(600px, calc(100vw - 32px)) / -2);
  top: 28px;
  max-height: calc(100vh - 16px);
  display: flex;
  flex-direction: column;
  font-family: "Courier New", Courier, monospace;
  font-size: 11px;
  line-height: 1.45;
  color: #1a3a1a;
}

/* Small is the print preview window's size. */
.order-window[data-size="small"] {
  width: min(380px, calc(100vw - 32px));
}

.order-window[data-size="wide"] {
  width: min(680px, calc(100vw - 32px));
}

.order-window .print-preview-body {
  max-height: none;
  flex: 1 1 auto;
  min-height: 0;
  padding: 18px 24px 22px;
  overflow: auto;
}

.order-window .print-preview-ask,
.order-window .print-preview-note,
.order-window .print-preview-status,
.order-window .order-maintenance,
.order-window .win95-btn {
  font-family: inherit;
  font-size: inherit;
  line-height: 1.45;
}

.order-step[hidden],
.order-error[hidden],
.order-field[hidden],
.order-maintenance[hidden],
.order-window .win95-btn[hidden] {
  display: none !important;
}

.order-maintenance {
  margin: 12px 0 14px;
  line-height: 1.35;
}

.order-line {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin: 0 0 8px;
}

.order-line.is-total {
  margin-top: 8px;
  font-weight: bold;
}

.order-line.is-subtotal {
  font-weight: 700;
  text-shadow: 1px 0 0 currentColor;
}

.order-line.is-subtotal span:last-child {
  border-top: 2px solid currentColor;
  padding-top: 3px;
  text-align: right;
}

.order-break {
  height: 10px;
}

.order-per-sheet {
  margin: 0 0 8px;
}

.order-field,
.order-delivery {
  display: block;
  margin: 0 0 14px;
}

.order-ship-limit {
  margin: 6px 0 0;
  color: #b00000;
}

.order-delivery {
  border: 0;
  padding: 0;
  min-inline-size: 0;
}

.order-delivery legend {
  padding: 0;
}

.order-grand {
  margin: 4px 0 0;
}

.order-confirm {
  display: block;
  margin: 18px 0 14px;
}

.order-required-note {
  margin: 0 0 14px;
}

.order-upload-detail {
  margin: 8px 0 14px;
  min-height: 1.45em;
}

.order-pay-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  margin-top: 22px;
}

.order-pay-btn {
  display: inline-block;
  color: #000;
  text-decoration: none;
  text-align: center;
  font-size: 16px;
  padding: 8px 32px;
}

.order-pay-frame {
  display: block;
  width: 100%;
  height: calc(100vh - 140px);
  min-height: 360px;
  border: 1px solid #000;
  background: #fff;
  margin-bottom: 14px;
}

.order-paid-sheet {
  position: relative;
  display: inline-block;
  margin: 16px 0 8px;
}

.order-paid-sheet img {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 460px;
  border: 1px solid #000;
  background: #fff;
}

.order-status-link {
  margin: 18px 0 8px;
  text-align: center;
}

.order-paid-actions {
  display: flex;
  justify-content: center;
  margin-top: 14px;
}

.order-paid-stamp {
  position: absolute;
  top: 16px;
  right: 10px;
  transform: rotate(-14deg);
  border: 4px solid #c40000;
  color: #c40000;
  font-weight: bold;
  font-size: 28px;
  letter-spacing: 0.12em;
  line-height: 1;
  padding: 4px 8px 2px;
  background: rgba(255, 255, 255, 0.88);
}

.order-field input,
.order-field textarea {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin-top: 4px;
  padding: 6px 8px;
  font: inherit;
  line-height: 1.45;
}

.order-delivery label {
  display: block;
  margin: 2px 0;
}

.order-error {
  margin: 0 0 8px;
  color: #800;
}

.order-page {
  margin: 0 0 16px;
}

.print-preview-body {
  padding: 10px 12px 12px;
}

.print-preview-confirm[hidden],
.print-preview-work[hidden] {
  display: none !important;
}

.print-preview-ask {
  margin: 0 0 8px;
}

.print-preview-note {
  margin: 0 0 12px;
  font-size: 16px;
  line-height: 1.3;
}

.print-preview-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.print-preview-status {
  margin: 0 0 8px;
  min-height: 16px;
}

.print-preview-phase {
  margin: 0 0 12px;
}

.print-preview-phase[hidden] {
  display: none !important;
}

.print-preview-phase-bar {
  display: block;
}

.print-preview-bar-fill.is-waiting {
  width: 100%;
  background: repeating-linear-gradient(-45deg, #000 0 6px, #fff 6px 12px);
  background-size: 17px 100%;
  animation: print-preview-wait 0.6s linear infinite;
}

@keyframes print-preview-wait {
  to {
    background-position: 17px 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .print-preview-bar-fill.is-waiting {
    animation: none;
  }
}

.print-preview-row {
  display: grid;
  grid-template-columns: 16px 1fr;
  column-gap: 8px;
  row-gap: 3px;
  align-items: center;
  margin: 0 0 10px;
}

.print-preview-swatch {
  grid-row: 1 / span 2;
  width: 14px;
  height: 14px;
  border: 1px solid #000;
}

.print-preview-name {
  font-size: 12px;
}

.print-preview-bar {
  display: block;
  height: 14px;
  border: 2px solid;
  border-color: var(--w95-shadow) var(--w95-highlight) var(--w95-highlight)
    var(--w95-shadow);
  background: #fff;
}

.print-preview-bar-fill {
  display: block;
  height: 100%;
  width: 0;
}

.print-preview-cancel {
  margin-top: 4px;
}

