/* 49.21-rc3. Only the Wheel result presentation; no spin, media or entitlement logic. */
html:not([data-studio-game]) #result[data-result-layout] {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-inline-size: 0;
  padding: 12px clamp(12px, 3vw, 48px) 24px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
html:not([data-studio-game]) #result[data-result-layout] .result-close {
  position: sticky;
  inset: auto;
  top: 0;
  align-self: flex-end;
  flex: 0 0 44px;
  margin: 0 0 12px;
  z-index: 4;
}
html:not([data-studio-game]) #result[data-result-layout] .result-display {
  box-sizing: border-box;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-auto-rows: auto;
  justify-items: center;
  align-content: center;
  gap: clamp(12px, 2.5vh, 28px);
  width: min(100%, 1120px);
  height: auto;
  min-width: 0;
  min-height: 0;
  max-height: none;
  aspect-ratio: auto;
  flex: 0 0 auto;
  margin: auto 0;
  padding: 4px 4px 12px;
  overflow: visible;
}
html:not([data-studio-game]) #result[data-result-layout] #resultImage {
  /* The base stylesheet absolutely positions every image in a small square. */
  position: static !important;
  inset: auto !important;
  width: min(100%, 320px) !important;
  height: min(38vh, 320px) !important;
  height: min(38dvh, 320px) !important;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  max-height: none;
  object-fit: contain;
  object-position: center;
}
html:not([data-studio-game]) #result[data-result-layout] #resultTitle {
  box-sizing: border-box;
  width: 100% !important;
  height: auto !important;
  max-width: 100% !important;
  max-height: none !important;
  min-width: 0;
  margin: 0;
  padding: 0 2px;
  font-size: clamp(22px, 5vw, 76px) !important;
  line-height: 1.18 !important;
  letter-spacing: -.025em;
  white-space: normal !important;
  overflow: visible !important;
  overflow-wrap: anywhere;
  word-break: normal;
  text-overflow: clip;
  text-align: center;
  text-wrap: balance;
  transform: none !important;
}
html:not([data-studio-game]) #result[data-result-layout] #resultTitle > * {
  max-width: 100%;
  white-space: inherit;
  overflow-wrap: anywhere;
}
/* Missing media or text falls back to the content actually supplied by the wheel. */
html:not([data-studio-game]) #result[data-result-layout] #resultTitle { display: none !important; }
html:not([data-studio-game]) #result[data-result-layout] #resultImage { display: none !important; }
html:not([data-studio-game]) #result[data-result-has-text="true"]:is([data-result-layout="both"], [data-result-layout="text"], [data-result-has-image="false"]) #resultTitle { display: block !important; }
html:not([data-studio-game]) #result[data-result-has-image="true"]:is([data-result-layout="both"], [data-result-layout="image"], [data-result-has-text="false"]) #resultImage { display: block !important; }
[data-wheel-result-controls] label { display: grid; gap: 8px; min-width: 0; font-size: 13px; }
[data-wheel-result-controls] select { width: 100%; min-width: 0; max-width: 100%; }
[data-wheel-result-controls][hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) {
  html:not([data-studio-game]) #result[data-result-layout] .result-display { transition: none; }
}

/* The fixed Studio toggle otherwise covers the result dialog's close button.
   Its normal visibility is restored automatically when the existing engine closes the result. */
html:not([data-studio-game]) body:has(#result[data-result-layout].show) .drawer-open {
  visibility: hidden;
  pointer-events: none;
}
