.dreamengine-page {
  --guide-text: #d7d0c8;
  --guide-rule: #484039;
  --guide-panel: #211e1b;
  --guide-accent: #91d8c8;
  background: var(--desk-background);
  color: white;
  font-family: var(--font-futura);
}

.dreamengine-intro {
  text-align: center;
}
.dreamengine-media {
  position: relative;
  mask-image: linear-gradient(to bottom, black 56%, rgba(0, 0, 0, .85) 68%, rgba(0, 0, 0, .26) 88%, transparent);
}
.dreamengine-media::after {
  content: "";
  position: absolute;
  inset: 78% 0 0;
  pointer-events: none;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  mask-image: linear-gradient(transparent, black);
}
.dreamengine-scene {
  display: block;
  width: 100%;
  /* The approved frame shows the bottom ~534 of the video's 620 rows at any width. */
  height: min(41.691vw, max(62svh, 140svh - 25vw));
  max-height: max(0px, calc(100svh - clamp(1.5rem, 4svh, 3.5rem) - 1.2 * var(--dreamengine-title-size)));
  object-fit: cover;
  object-position: center clamp(100%, -11.778vw, 28%);
  pointer-events: none;
}
.dreamengine-scene::-webkit-media-controls { display: none; }
.dreamengine-caption {
  position: relative;
  margin-top: calc(-1 * min(.9 * var(--dreamengine-title-size), 12svh) - 14px);
  padding: 0 5% 4rem;
}
.dreamengine-caption .dreamengine-title { font-weight: 700; }
@media (orientation: portrait) and (max-width: 18.75rem) {
  /* Ease the caption out of the gameplay as the video gets shallower. */
  .dreamengine-caption { padding-top: min(3rem, (18.75rem - 100vw) / 2); }
}
@media (orientation: portrait) and (max-width: 25rem) {
  .dreamengine-caption .dreamengine-title { font-size: min(var(--dreamengine-title-size), 12.8vw); }
}
.dreamengine-caption p {
  margin: 0 auto;
  color: #e2dcd6;
  font-size: clamp(1.125rem, 2vw, 2rem);
  line-height: 1.4;
  text-wrap: balance;
}
.source-links a:not(.liquid-glass) { background: #e9e2d9; color: var(--desk-background); }
.source-links a:not(.liquid-glass):hover { background: white; }
.source-links a:focus-visible { outline-color: white; }

/* The guide continues the dark surface of the hero. */
.engine-guide h2 {
  margin: 0;
  font-size: clamp(2.25rem, 4vw, 3.5rem);
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: -.035em;
  text-wrap: balance;
}
.engine-guide code { font-family: var(--font-mono); }
.engine-guide > section {
  padding-block: clamp(3.25rem, 7vw, 6rem);
}
.engine-feature {
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
  gap: clamp(2rem, 7vw, 6rem);
  align-items: center;
}
.engine-feature p, .engine-overview p, .component-list .card-description, .scene-hooks .card-description > span {
  color: var(--guide-text);
  font-family: var(--font);
  line-height: 1.55;
}
.engine-feature p, .engine-overview p { margin: 1.1rem 0 0; font-size: 1.125rem; }
.engine-guide p code { font-size: .92em; }
/* Warm clear capsules above smoked panels keep the hierarchy on the dark page. */
.dreamengine-page main .liquid-glass {
  --glass-focus: var(--guide-accent);
  --glass-shadow: .32;
}
.source-links .liquid-glass {
  --glass-tint: #f2e8d8;
  --glass-opacity: 78%;
  --glass-ink: #231e19;
}
.engine-card, .code-glass {
  --glass-radius: 16px;
  --glass-tint: var(--guide-panel);
  background-color: var(--glass-tint);
  display: block;
  place-items: stretch;
  min-width: 0;
}
.engine-card::before, .code-glass::before { content: none; }
.engine-card::after, .code-glass::after {
  background-image: none;
  opacity: .24;
}
.engine-card {
  --glass-edge: var(--glass-panel-bevel);
  --glass-surface-shadow: var(--glass-panel-shadow);
  --glass-padding: clamp(1rem, 2vw, 1.5rem);
  height: 100%;
}
.scene-hooks, .component-list { list-style: none; padding: 0; }
.scene-hooks { display: grid; gap: .75rem; margin: 0; }
.engine-card .glass-content { display: grid; align-content: start; }
.scene-hooks .glass-content {
  grid-template-columns: minmax(7rem, .8fr) minmax(0, 1.4fr);
  gap: 1rem;
  align-items: baseline;
}
.scene-hooks .card-title { font: .92rem/1.5 var(--font-mono); }
.scene-hooks .card-description > span { display: block; margin-top: .35rem; }
.code-glass { --glass-padding: 0; }
.code-glass .cpp-card { background: transparent; border: 0; border-radius: inherit; }

.cpp-card {
  background: var(--guide-panel);
  border-radius: .75rem;
  margin: 0;
  padding: var(--code-block-padding);
  overflow-x: auto;
  border: 1px solid var(--guide-rule);
  font: var(--code-block-font-size)/1.65 var(--font-mono);
}
.cpp-card:focus-visible { outline: 2px solid var(--guide-accent); outline-offset: -3px; }
.cpp-card .cpp-keyword { color: #ff79b3; }
.cpp-card .cpp-string { color: #ff8170; }
.cpp-card .cpp-class { color: #dabaff; }
.cpp-card .cpp-number { color: #d9c97c; }
.cpp-card .cpp-function { color: #56b6c2; }
.cpp-card .cpp-field { color: #98CDC2; }

.component-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
  gap: 1rem;
  margin: 2.5rem 0 0;
}
.component-list .card-title { font: 1.15rem/1.4 var(--font-mono); }
.component-list .glass-content { gap: .75rem; }

.engine-overview { text-align: center; }
.engine-overview p { max-width: 58ch; margin-inline: auto; text-wrap: pretty; }
.game-demo .source-links { margin-top: 1.75rem; }
.game-demo video {
  display: block;
  width: 100%;
  height: auto;
  margin-top: clamp(2rem, 4vw, 3rem);
  border-radius: .75rem;
  background: black;
}

.dreamengine-page .site-footer {
  --muted: var(--guide-text);
  border-top: 1px solid var(--guide-rule);
}
.dreamengine-page .site-footer ul { color: var(--guide-text); font-family: var(--font); }
.dreamengine-page .site-footer a:is(:hover, :focus-visible) {
  color: var(--guide-accent);
  outline-color: currentColor;
}

@media (orientation: landscape) {
  .source-links { column-gap: clamp(2rem, 5vw, 5rem); }
  .engine-overview p { max-width: 80ch; }
}
@media (max-width: 54rem) {
  .engine-feature { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 26rem) {
  .scene-hooks .glass-content { grid-template-columns: 1fr; gap: .3rem; }
}
