#stage-container {
  --stage-grid: #ecebe9;
  --stage-hair: #99928e;
  --stage-ink: #57514d;
  --stage-accent: var(--accent);
  --stage-font: var(--mono, ui-monospace, "SFMono-Regular", Consolas, monospace);
  position: relative;
  isolation: isolate;
  overflow: hidden;
  width: 100%;
  height: clamp(475px, calc(100svh - 296px), 690px);
  background-color: var(--stage-grid);
  background-image: linear-gradient(to right, rgba(93,87,83,.085) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(93,87,83,.085) 1px, transparent 1px),
    linear-gradient(to right, rgba(100,93,88,.08) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(100,93,88,.08) 1px, transparent 1px);
  background-size: 24px 24px,24px 24px,120px 120px,120px 120px;
  background-position: center center;
  color: var(--stage-ink);
}
#stage-container:focus-visible { outline: 2px solid var(--stage-accent); outline-offset: -3px; }
#stage-container:fullscreen, #stage-container.rp-expanded {
  height:100dvh;
  max-height:none;
  border:0;
}
#stage-container.rp-expanded { position:fixed; inset:0; z-index:10000; width:100vw; }
.rp-viewport { position:absolute; inset:0; overflow:auto; overscroll-behavior:contain; scrollbar-width:thin; scrollbar-color:#b4b4b4 transparent; }
.rp-field { position:relative; min-width:100%; min-height:100%; }
.rp-zoomed .rp-field { cursor:grab; touch-action:pan-x pan-y; }
.rp-dragging .rp-field { cursor:grabbing; }
.rp-sheet {
  position:absolute; left:50%; top:50%; transform:translate(-50%, -50%);
  background:white; box-shadow:0 5px 10px -3px #3e3e3e38, 0 1px 3px #3e3e3e2e;
}
.rp-sheet canvas { height:100%; width:100%; display:block; }
.rp-guides { position:absolute; inset:0; pointer-events:none; user-select:none; }
.rp-guides[hidden] {display:none;}
.rp-width-rule,.rp-height-rule { position:absolute; color:var(--stage-ink); font:500 11px/1 var(--stage-font); white-space:nowrap; }
.rp-width-rule {left:0; right:0; top:-17px; height:1px; background:var(--stage-hair);}
.rp-width-rule::before,.rp-width-rule::after { content:""; display:block; position:absolute; width:1px; height:6px; top:-2.5px; background:var(--stage-hair); }
.rp-width-rule::before {left:0;} .rp-width-rule::after {right:0;}
.rp-width-rule span { position:absolute; left:50%; top:50%; transform: translate(-50%,-50%); padding:2px 7px; background:var(--stage-grid); }
.rp-height-rule {top:0; bottom:0; left:-26px; width:1px; background:var(--stage-hair);}
.rp-height-rule::before,.rp-height-rule::after { content:""; position:absolute; height:1px; left:-2.5px; width:6px; background:var(--stage-hair);}
.rp-height-rule::before {top:0;} .rp-height-rule::after {bottom:0;}
.rp-height-rule span {position:absolute; top:50%; left:50%; transform:translate(-50%,-50%) rotate(-90deg); padding:2px 8px; background:var(--stage-grid);}
.rp-zone {position:absolute; top:93.012704%; bottom:0; left:0; right:0; background:repeating-linear-gradient(135deg,transparent,transparent 4px,#665e5a25 4px,#665e5a25 5px);}
.rp-min-line {position:absolute; top:93.012704%; left:-4px; right:-13px; height:0; border-top:1px dashed var(--stage-accent);}
.rp-min-line span {position:absolute; left:100%; top:0; transform:translate(4px,-50%); white-space:nowrap; color:var(--accent); background:#f6f3f0eb; font:500 10px/1.3 var(--stage-font); padding:2px 3px; border-radius:2px;}
.rp-cassette-line {
  position:absolute; top:calc(100% * 2002 / 2204); left:-6px; right:0;
  border-top:1px dotted #516b76; box-shadow:0 1px 0 #ffffff60;
}
.rp-cassette-line span {
  position:absolute; right:100%; top:0; transform:translate(-2px,-50%);
  padding:1px 3px; border-radius:2px; white-space:nowrap;
  color:#465d67; background:var(--stage-grid); font:500 10px/1.3 var(--stage-font);
}
.legend .cassette-sample {height:0; border-top:2px dotted #516b76;}
.rp-crop { position:absolute; width:7px; height:7px; border-top:1px solid #737373; border-left:1px solid #737373; }
.rp-crop.tl {top:-4px; left:-4px;} .rp-crop.tr {top:-4px; right:-4px; transform:rotate(90deg);}
.rp-crop.bl {bottom:-4px; left:-4px; transform:rotate(-90deg);} .rp-crop.br {bottom:-4px; right:-4px; transform:rotate(180deg);}
.rp-hud {position:absolute; bottom:16px; display:flex; align-items:center; color:#454545; background:#fcfcfc; border:1px solid #c4c4c4; border-radius:7px; box-shadow:0 2px 4px #3c3c3c0d; overflow:hidden;}
.rp-zoom {left:16px;}
.rp-full {right:16px;}
.rp-hud button {color:inherit;background:transparent;border:0;border-radius:0;padding:0;min-height:30px;min-width:30px;display:inline-flex;align-items:center;justify-content:center;cursor:pointer;}
.rp-hud button:hover {background:#ebebeb;}
.rp-hud button:focus-visible {outline:2px solid var(--stage-accent);outline-offset:-2px;}
.rp-hud button:disabled {opacity:.35;cursor:default;}
.rp-hud button[data-rp="fit"] {font:500 11px/1 var(--stage-font);min-width:46px;border-inline:1px solid #e3e3e3;}
.rp-hud svg {width:15px;height:15px;stroke-width:1.7;flex-shrink:0;}
@media(max-width:600px) {
  #stage-container {height:clamp(370px,64svh,540px);}
  .rp-hud {bottom:10px;} .rp-zoom {left:10px;} .rp-full {right:10px;}
  .rp-height-rule {left:-20px;}
  .rp-min-line {right:-6px;}
  .rp-min-line span {font-size:9px; transform:translate(1px,-50%);}
  .rp-cassette-line span {font-size:9px;}
}
