:root {
  color-scheme: dark;
  font-family: system-ui, -apple-system, sans-serif;
  background: #15231f;
  color: #f7f5eb;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }

.scene {
  position: fixed;
  inset: 0;
  overflow: hidden;
  overflow: clip;
  isolation: isolate;
  background: radial-gradient(ellipse at 50% 30%, #31463c 0%, #1c2e28 45%, #14201d 100%);
}

#camera, .preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#camera { object-fit: cover; }

.effects {
  position: absolute;
  inset: 0;
  visibility: hidden;
  opacity: 0;
  clip-path: inset(50%);
  pointer-events: none;
}

.decoration {
  position: absolute;
  top: 0;
  left: 0;
  overflow: hidden;
  border-radius: 4px;
  transform-origin: 0 0;
  will-change: transform;
}

.decoration canvas, .world {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.world {
  display: block;
}

.hint {
  position: absolute;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  width: max-content;
  max-width: calc(100% - 32px);
  margin: 0;
  padding: 11px 17px;
  border: 1px solid #fff2;
  border-radius: 18px;
  background: #101c17eb;
  box-shadow: 0 4px 18px #0004;
  color: #f7f5eb;
  font-size: .9375rem;
  line-height: 1.45;
  text-align: center;
  transform: translateX(-50%);
}

.hint:empty { visibility: hidden; }

.preview {
  display: grid;
  place-items: center;
  perspective: 1300px;
  background:
    linear-gradient(to bottom, transparent 89%, #141c18 89.1%, #343d35 90.4%, #192420 90.5%, #101712 100%),
    radial-gradient(ellipse at 50% 30%, #687f83 0%, #3b5455 55%, #223638 100%);
}

.demo-frame {
  padding: clamp(7px, 1.8vmin, 17px);
  padding-bottom: 4px;
  border: 1px solid #a5937860;
  border-radius: 3px 3px 0 0;
  background: repeating-linear-gradient(92deg, #1b110e20 0 1px, #f4d9ac18 1px 3px, transparent 3px 6px), #6e5640;
  box-shadow: 0 22px 46px #101712a0, 0 0 1px 2px #191910a0;
}

.demo-door {
  position: relative;
  width: min(77vw, 40vh);
  aspect-ratio: 1 / 2;
  overflow: hidden;
  background:
    linear-gradient(95deg, #1c161a70, transparent 18% 68%, #31221865),
    repeating-linear-gradient(90deg, #281e1b2b 0 1px, transparent 1px 3px, #ffe1b41c 3px 4px, transparent 4px 7px),
    linear-gradient(150deg, #9d8266, #715943 75%, #5f4a38);
  box-shadow: inset 0 0 0 2px #16180d, inset 0 0 9px 3px #1e1c17;
}

.demo-window {
  position: absolute;
  border: clamp(3px, 0.8vmin, 8px) solid #8f8068;
  border-radius: 50%;
  background:
    linear-gradient(141deg, #e7f6da55 0 21%, transparent 21.5% 34%, #f9f7dc25 34.5% 38%, transparent 38.5%),
    repeating-linear-gradient(90deg, #ecf4d711 0 8%, #333d2f18 8.5% 9%, transparent 9.5% 17%),
    linear-gradient(154deg, #d2e8e5, #9fbcc0 62%, #779599);
  box-shadow: inset 0 1px 7px #111c15a0, 0 1px 6px #170e0e, 1px 1px 1px 1px #d7cdaf87;
}

.demo-handle {
  position: absolute;
  top: 50.5%;
  left: 10%;
  width: 4%;
  height: 15%;
  border-radius: 999px;
  border: 1px solid #201b14;
  background: linear-gradient(90deg, #27271f, #a4a08c 36%, #44423a 56%, #1b201a);
  box-shadow: 4px 5px 6px #2d1d12a0;
}

#demo-marker { position: absolute; }

.demo-probe {
  position: absolute;
  width: 0;
  height: 0;
  pointer-events: none;
}

.print-sheet {
  width: 100%;
  max-width: 210mm;
  margin: auto;
  padding: 18px 6px;
  color-scheme: light;
  color: #191e1b;
  text-align: center;
}

.print-mode { background: white; }
.print-sheet h1 { margin: 8px 0 18px; font-size: 1.45rem; }
.print-sheet p { margin: 12px auto; padding-inline: 6px; max-width: 56ch; overflow-wrap: anywhere; }
#print-marker {
  display: block;
  margin: 0 auto;
  width: var(--paper-width);
  max-width: 100%;
  height: auto;
  image-rendering: pixelated;
}

@page { size: A4 portrait; margin: 7mm; }

@media print {
  :root { background: white; }
  .print-sheet { padding: 6mm 0 0; }
  #print-marker { max-width: none; }
}
