/* Keep selection text legible over both bright and dark artwork. */
.screen:is([data-phase=intro], [data-phase=keys], [data-phase=keyselecting], [data-phase=choose], [data-phase=selecting]) .scene-heading {
  --selection-heading-top: calc(64px + env(safe-area-inset-top));
  --selection-heading-gutter: max(14px, env(safe-area-inset-left), env(safe-area-inset-right));
  top: var(--selection-heading-top);
  inset-inline: 0;
  width: fit-content;
  max-width: calc(100% - var(--selection-heading-gutter) - var(--selection-heading-gutter));
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 9px clamp(15px, 3vw, 26px);
  border: 1px solid #b89257;
  border-radius: 15px;
  background: #101d28;
  box-shadow: 0 5px 16px #050a1173, inset 0 1px #ffe5a81a;
  text-shadow: none;
}

.screen:is([data-phase=intro], [data-phase=keys], [data-phase=keyselecting]) .scene-heading {
  background: #11251e;
}

.screen:is([data-phase=intro], [data-phase=keys], [data-phase=keyselecting], [data-phase=choose], [data-phase=selecting]) .scene-heading :is(h1, h2) {
  color: #fff3d5;
  font-size: clamp(28px, 3.4vw, 39px);
  font-style: normal;
  line-height: 1.08;
  letter-spacing: normal;
}

.screen:is([data-phase=intro], [data-phase=keys], [data-phase=keyselecting], [data-phase=choose], [data-phase=selecting]) .heading-ornament {
  display: none;
}

.screen:is([data-phase=intro], [data-phase=keys], [data-phase=keyselecting]) .atlas-brand {
  margin: 0 0 3px;
  color: #ffdb94;
  font-size: clamp(13px, 1.2vw, 16px);
}

.screen:is([data-phase=choose], [data-phase=selecting]) .scene-heading .chosen-key {
  gap: 5px;
  margin: 0;
  padding: 2px 9px 2px 4px;
  border-color: #b8925775;
  background: #172b34;
  color: #ffe4ac;
  font-size: 13px;
  line-height: 1.3;
  font-weight: 700;
  text-shadow: none;
}

.screen:is([data-phase=choose], [data-phase=selecting]) .chosen-key .antique-key {
  flex: 0 0 auto;
  width: 27px;
  height: 27px;
}

.key-scene .key-caption,
.mansion-scene .door-nameplate {
  width: max-content;
  min-width: 0;
  max-width: 120%;
  padding: 4px clamp(6px, 1vw, 12px);
  border-color: #b89257;
  border-radius: 10px;
  background: #101d28;
  color: #fff3d5;
  font-size: clamp(13px, 1.25vw, 16px);
  font-weight: 700;
  line-height: 1.25;
  white-space: normal;
  text-shadow: none;
  pointer-events: none;
}

.key-scene .key-caption {
  background: #11251e;
}

@media (min-width: 560px) and (min-aspect-ratio: 1/1) {
  .screen:is([data-phase=intro], [data-phase=keys], [data-phase=keyselecting], [data-phase=choose], [data-phase=selecting]) .scene-heading {
    --selection-heading-top: calc(24px + env(safe-area-inset-top));
    --selection-heading-gutter: calc(110px + max(env(safe-area-inset-left), env(safe-area-inset-right)));
    flex-direction: row;
    gap: 14px;
  }
}

@media (max-height: 550px) and (min-aspect-ratio: 1/1) {
  .screen:is([data-phase=intro], [data-phase=keys], [data-phase=keyselecting], [data-phase=choose], [data-phase=selecting]) .scene-heading {
    /* Older short-screen rules also mark this position important. */
    top: var(--selection-heading-top) !important;
    padding-block: 6px;
  }

  .screen:is([data-phase=intro], [data-phase=keys], [data-phase=keyselecting]) .atlas-brand {
    display: inline-block;
    margin: 0 .6em 0 0;
    vertical-align: .18em;
  }
}
