:root {
  --background: #2a0564;
  --tint: rgb(36 39 65 / 35%);
  --brand-ink: #d4bbff;
  --footer-height: 30.5px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

body {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-block-size: 100vh;
  min-block-size: 100dvh;
  margin: 0;
  color: var(--brand-ink);
  background: var(--background);
}

/* Layer 1: crop the top on short screens; keep the bottom edge above the footer. */
.backdrop {
  position: absolute;
  z-index: -1;
  inset: 0;
  overflow: hidden;
  overflow: clip;
  pointer-events: none;
}

.backdrop video {
  position: absolute;
  left: 0;
  bottom: calc(var(--footer-height) + var(--safe-bottom));
  inline-size: 100%;
  block-size: auto;
  aspect-ratio: 720 / 544;
  object-fit: contain;
  object-position: left bottom;
}

/* Layer 2: the translucent color covers both the video and surrounding purple. */
.backdrop::after {
  position: absolute;
  inset: 0;
  background: var(--tint);
  content: "";
}

/* Layer 3: preserve the SVG's relative coordinates at a common scale. */
.message {
  inline-size: min(100%, 100vh);
  inline-size: min(100%, 100dvh);
  margin: 0;
  margin-inline-start: var(--safe-left);
  font-family: "Comic Sans MS", "Chalkboard SE", "Comic Neue", cursive;
}

main {
  position: relative;
  margin-block-start: max(6px, calc(min(100vw, 100vh) * 60 / 512 - 42px));
  margin-block-start: max(6px, calc(min(100dvw, 100dvh) * 60 / 512 - 42px));
  margin-inline-end: calc(var(--safe-left) + var(--safe-right));
}

.message svg {
  display: block;
  inline-size: 100%;
  block-size: auto;
}

.message-intro {
  fill: #cfcbc2;
  font-size: 26.6667px;
  font-weight: 400;
}

.message-emphasis {
  fill: #bcbaf8;
  stroke: #740b95;
  stroke-width: 0.3px;
  stroke-linejoin: round;
  font-size: 48px;
  font-weight: 700;
}

.visually-hidden {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Layer 4: the icon and text keep their pixel sizes as the viewport changes. */
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-block-start: calc(10px + var(--safe-top));
  margin-inline: calc(18px + var(--safe-left)) var(--safe-right);
  font: 700 16px/1.25 Calibri, system-ui, sans-serif;
}

.brand img {
  display: block;
  flex: none;
}

.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-block-size: var(--footer-height);
  padding-block-end: var(--safe-bottom);
  padding-inline: calc(13.25px + var(--safe-left)) calc(10px + var(--safe-right));
}

.footer small {
  font: 400 13.3333px/1.2 Cambria, Georgia, serif;
}

.video-toggle {
  display: inline-grid;
  place-items: center;
  min-inline-size: 30px;
  min-block-size: 30px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  color: inherit;
  background: transparent;
  fill: currentColor;
  cursor: pointer;
}

.video-toggle:hover {
  background: rgb(212 187 255 / 15%);
}

.video-toggle:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: -3px;
}

.video-toggle[hidden],
.video-toggle:not([data-playing]) .pause-icon,
.video-toggle[data-playing] .play-icon {
  display: none;
}
