.stage-brief {
  --brief-accent: #8ceef2;
  --brief-shade: #113a49;
  position: relative;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: clamp(10px, 2.5vmin, 22px);
  width: 100%;
  min-height: 100%;
  padding: max(12px, env(safe-area-inset-top)) max(13px, env(safe-area-inset-right))
    max(12px, env(safe-area-inset-bottom)) max(13px, env(safe-area-inset-left));
  color: #f5f6ff;
  background: radial-gradient(ellipse at 50% 28%, var(--brief-shade), #071023 62%, #050b17);
  text-align: center;
}

.stage-brief[hidden], .stage-brief-art img[hidden] { display: none; }
.stage-brief:is([data-role="intruder"],[data-initial-role="intruder"]:not([data-role])) { --brief-accent: #d9aaff; --brief-shade: #2c154c; }
.stage-brief:is([data-role="defender"],[data-initial-role="defender"]:not([data-role])) { --brief-accent: #ffd990; --brief-shade: #41301e; }

.stage-brief-art {
  position: relative;
  width: min(100%, 450px);
  height: clamp(86px, 36dvh, 280px);
  overflow: hidden;
  isolation: isolate;
  border: 1px solid color-mix(in srgb, var(--brief-accent) 44%, #071023);
  border-radius: 12px;
  background: radial-gradient(ellipse at 50% 55%, var(--brief-shade), #091125 72%);
}

/* CSS-only fallback works while pictures, fonts and WebGL are waiting. */
.stage-brief-art::before {
  position: absolute;
  content: "";
  inset: 5% 15%;
  transform: perspective(250px) rotateX(38deg) rotateZ(-12deg) scale(.88);
  background:
    radial-gradient(circle, var(--brief-accent) 0 9%, transparent 11%) 0 0 / calc(100% / 7) calc(100% / 7),
    repeating-linear-gradient(to right, #f5f6ff28 0 1px, transparent 1px calc(100% / 7)),
    repeating-linear-gradient(to bottom, #f5f6ff28 0 1px, transparent 1px calc(100% / 7));
  filter: drop-shadow(0 0 8px var(--brief-accent));
}

.stage-brief:is([data-role="defender"],[data-initial-role="defender"]:not([data-role])) .stage-brief-art::before {
  background:
    linear-gradient(135deg, #fff0c02b 0 30%, transparent 31%) 0 0 / calc(100% / 7) calc(100% / 7),
    repeating-linear-gradient(to right, #ffe2a45e 0 1px, transparent 1px calc(100% / 7)),
    repeating-linear-gradient(to bottom, #ffe2a45e 0 1px, transparent 1px calc(100% / 7));
}

.stage-brief-art img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.stage-brief-copy { width: min(100%, 340px); }
.stage-brief-copy p, .stage-brief-copy h1 { margin: 0; }
.stage-brief-faction { color: var(--brief-accent); font-size: .78rem; font-weight: 750; letter-spacing: .07em; }
.stage-brief-status { margin-block: .22em !important; font-size: clamp(1rem, 4.8vmin, 1.5rem); line-height: 1.3; }
.stage-brief-rule { color: #dfe7f4; font-size: clamp(.75rem, 3.3vmin, .95rem); line-height: 1.45; }
#intro-practice-exit { min-height: 44px; margin-top: 10px; }

.stage-brief[data-start-countdown] .stage-brief-art { opacity: .25; }
.stage-brief[data-start-countdown] .stage-brief-copy { opacity: 0; pointer-events: none; }
.stage-start-count {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: grid;
  justify-items: center;
  width: min(calc(100% - 2rem), 34rem);
  gap: .45rem;
  padding: 1rem min(4vw, 1.65rem);
  border-block: 1px solid color-mix(in srgb, var(--brief-accent) 55%, transparent);
  background: linear-gradient(90deg, transparent, #0a1224d9 17% 83%, transparent);
  color: var(--brief-accent);
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
  text-shadow: 0 2px 24px #080c1c;
}
.stage-start-count[hidden] { display: none; }
.stage-start-count span { font-size: clamp(.75rem, 3vmin, 1rem); font-weight: 700; letter-spacing: .16em; }
.stage-start-count strong {
  font: 750 clamp(2.25rem, 11vmin, 5rem)/1.1 ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  color: #fff;
}
.stage-start-count small { font-size: clamp(.85rem, 3.5vmin, 1.25rem); color: #e6eefa; }

@media (orientation: landscape) and (max-height: 520px) {
  .stage-brief { grid-template-columns: minmax(0, 440px) minmax(0, 260px); align-items: center; justify-content: center; }
  .stage-brief-art { height: min(55dvh, 250px); }
  .stage-brief-copy { text-align: left; }
}
