/* Colours and font come from the brand block in config.js, applied as the --brand-* variables. */

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #000;
}

.box {
  position: fixed;
  inset: 0;
}

.stage iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Inside the iframe, vmin is the shorter side of the embedded box, so the
   end screen scales with whatever size the host page gives it. */
.end-screen,
.unavailable {
  position: absolute;
  inset: 0;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 6vmin;
  background: var(--brand-end-screen);
  color: var(--brand-end-screen-text);
  font-family: var(--brand-font), system-ui, -apple-system, 'Segoe UI', sans-serif;
  text-align: center;
}

.end-screen[hidden],
.unavailable[hidden],
.end-content [hidden] {
  display: none;
}

.end-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(6px, 3vmin, 20px);
  max-width: 40em;
}

.end-headline {
  margin: 0;
  font-size: clamp(15px, 7.5vmin, 44px);
  font-weight: 700;
  line-height: 1.15;
}

.end-message {
  margin: 0;
  max-width: 34em;
  font-size: clamp(12px, 4.2vmin, 22px);
  line-height: 1.35;
  opacity: 0.9;
}

.end-button {
  display: inline-block;
  padding: clamp(8px, 2.6vmin, 16px) clamp(18px, 6vmin, 40px);
  border-radius: 6px;
  background: var(--brand-button);
  color: var(--brand-button-text);
  font-size: clamp(12px, 4.4vmin, 21px);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-decoration: none;
  /* Takes its space from the start so nothing jumps when it appears after the delay. */
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.3s ease, background-color 0.15s ease, color 0.15s ease;
}

.end-button.is-shown {
  visibility: visible;
  opacity: 1;
}

.end-button:hover {
  background: var(--brand-button-hover);
  color: var(--brand-button-hover-text);
}

.end-replay {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.4em 0.7em;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-size: clamp(11px, 3.6vmin, 17px);
  font-weight: 600;
  opacity: 0.85;
  cursor: pointer;
}

.end-replay:hover {
  opacity: 1;
}

.end-button:focus-visible,
.end-replay:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

.unavailable {
  font-size: clamp(12px, 4.2vmin, 22px);
}

@media (prefers-reduced-motion: reduce) {
  .end-button {
    transition: none;
  }
}
