/* Dragon eggs scene chrome. Magazine theme: Poppins, hue 212, gold pen. */

.de-full {
  background: #02010c;
  color: hsl(212 80% 94%);
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
  overflow: hidden;
  font-family: Poppins, sans-serif;
  font-weight: 300;
}

.de-full .de-stage {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
}

.de-back {
  position: fixed;
  top: max(0.75rem, env(safe-area-inset-top));
  left: max(0.9rem, env(safe-area-inset-left));
  z-index: 6;
  color: hsl(212 80% 94%);
  text-decoration: none;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  padding: 0.45rem 0.75rem;
  border: 1px solid hsl(212 72% 74% / 0.45);
  border-radius: 999px;
  background: hsl(212 58% 14% / 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.de-back:hover, .de-back:focus-visible {
  color: hsl(212 72% 74%);
  border-color: hsl(212 72% 74%);
}

/* Embedded stage in the article */
.mag-demo {
  margin: 0 0 1.4rem;
  max-width: min(52rem, 100%);
}

.mag-demo-stage {
  position: relative;
  width: 100%;
  height: clamp(16rem, 56vw, 38rem);
  border: 1px solid hsl(212 72% 74% / 0.55);
  border-radius: 12px;
  overflow: hidden;
  background: #02010c;
  touch-action: none;
}

.mag-demo-stage .de-stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.mag-demo figcaption {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 0.55rem;
  color: hsl(212 38% 78%);
  font-size: 0.88rem;
}

.mag-demo figcaption a {
  color: hsl(212 72% 74%);
  text-decoration: none;
  white-space: nowrap;
}

.mag-demo figcaption a:hover, .mag-demo figcaption a:focus-visible {
  text-decoration: underline;
}

.de-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  outline: none;
}

.de-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  text-align: center;
  color: hsl(212 80% 94%);
  background:
    linear-gradient(180deg, hsl(212 58% 14% / 0.35), hsl(212 58% 14% / 0.7)),
    url("/magazine/dragon-eggs-harbors.jpg") center / cover no-repeat;
}

/* Panel — lil-gui-style, magazine colors, touch-friendly */
.de-gui {
  position: absolute;
  top: max(0.7rem, env(safe-area-inset-top));
  right: max(0.7rem, env(safe-area-inset-right));
  z-index: 5;
  width: min(18.5rem, calc(100% - 1.4rem));
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 11.5px;
  line-height: 1.35;
  color: hsl(212 80% 94%);
  background: hsl(212 58% 10% / 0.82);
  border: 1px solid hsl(212 72% 74% / 0.4);
  border-radius: 10px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

.de-full .de-gui {
  top: max(3.1rem, calc(env(safe-area-inset-top) + 2.6rem));
}

.de-gui header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.7rem;
  cursor: pointer;
  background: hsl(212 62% 16% / 0.7);
  border-bottom: 1px solid hsl(212 72% 74% / 0.25);
}

.de-gui header strong {
  font-family: Poppins, sans-serif;
  font-weight: 400;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.de-gui header button,
.de-toolbar button {
  font: inherit;
  color: inherit;
  background: transparent;
  border: 1px solid hsl(212 72% 74% / 0.45);
  border-radius: 999px;
  padding: 0.28rem 0.55rem;
  cursor: pointer;
}

.de-gui header button:hover,
.de-toolbar button:hover,
.de-gui header button:focus-visible,
.de-toolbar button:focus-visible {
  border-color: #f1e41c;
  color: #f1e41c;
}

.de-gui .de-body {
  padding: 0.35rem 0 0.5rem;
  max-height: min(70dvh, 32rem);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.de-gui.is-collapsed .de-body { display: none; }
.de-gui.is-collapsed { width: auto; }

.de-row {
  display: grid;
  grid-template-columns: 7.6rem 1fr 2.3rem;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.7rem;
  min-height: 2rem;
}

.de-row.tog {
  grid-template-columns: 1fr auto;
}

.de-row label { color: hsl(212 72% 74%); }

.de-row input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 1.4rem;
  background: transparent;
  margin: 0;
}

.de-row input[type="range"]::-webkit-slider-runnable-track {
  height: 3px;
  background: hsl(212 72% 74% / 0.45);
  border-radius: 99px;
}

.de-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  margin-top: -6.5px;
  border-radius: 50%;
  background: #f1e41c;
  border: 0;
}

.de-row input[type="range"]::-moz-range-track {
  height: 3px;
  background: hsl(212 72% 74% / 0.45);
  border-radius: 99px;
}

.de-row input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #f1e41c;
  border: 0;
}

.de-row .de-val { text-align: right; color: hsl(212 80% 94%); }

.de-row input[type="checkbox"] {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: #f1e41c;
}

.de-presets, .de-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.35rem 0.7rem 0.5rem;
}

.de-presets button, .de-toolbar button {
  font-family: Poppins, sans-serif;
  font-weight: 400;
  font-size: 0.72rem;
  padding: 0.42rem 0.62rem;
  border-radius: 999px;
  border: 1px solid hsl(212 72% 74% / 0.45);
  background: hsl(212 62% 22% / 0.55);
  color: inherit;
  cursor: pointer;
}

.de-presets button.is-on,
.de-presets button[aria-pressed="true"] {
  border-color: #f1e41c;
  color: #f1e41c;
}

.de-presets button:hover, .de-toolbar button:hover,
.de-presets button:focus-visible, .de-toolbar button:focus-visible {
  border-color: #f1e41c;
}

.de-hint {
  padding: 0.15rem 0.7rem 0.45rem;
  color: hsl(212 38% 78%);
  font-family: Poppins, sans-serif;
  font-size: 0.72rem;
}

@media (max-width: 640px) {
  .de-gui {
    top: auto;
    right: max(0.55rem, env(safe-area-inset-right));
    left: max(0.55rem, env(safe-area-inset-left));
    bottom: max(0.55rem, env(safe-area-inset-bottom));
    width: auto;
  }
  .de-full .de-gui {
    top: auto;
  }
  .de-gui .de-body { max-height: 42dvh; }
  .de-row { min-height: 2.25rem; }
}

@media (prefers-reduced-motion: reduce) {
  .de-stage canvas { /* camera easing respects this in JS */ }
}
