/* The opt-in lives inside the existing board wrapper and takes no space from controls. */
.ps-opt-in {
  position: absolute;
  z-index: 3;
  bottom: max(8px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  max-width: calc(100% - 1rem);
  min-height: 44px;
  width: max-content;
  padding: .38rem .8rem;
  border: 1px solid #acbbbd;
  border-radius: 10px;
  background: #f7fffc;
  color: #18242c;
  font: 650 .83rem/1.25 system-ui, sans-serif;
  box-sizing: border-box;
  cursor: pointer;
}
.ps-opt-in input { width: 1.1rem; height: 1.1rem; margin: 0; accent-color: #235349; }
.ps-opt-in[hidden], .ps-dialog [hidden], #open-result-share[hidden],
#open-result-challenge[hidden], #player-challenge-compare-retry[hidden], #player-share-manage[hidden] { display: none !important; }
#open-result-share, #player-share-manage { margin: .35rem 0 .6rem; min-height: 44px; }
#open-result-challenge { color: inherit; border-left: 3px solid #699b28; padding: .4rem .7rem; }
dialog.ps-dialog {
  box-sizing: border-box;
  width: min(31rem, calc(100vw - 2rem - env(safe-area-inset-left) - env(safe-area-inset-right)));
  max-width: none;
  max-height: calc(100vh - 1.5rem);
  max-height: calc(100dvh - 1.5rem - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  padding: 0;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid #adb9bc;
  border-radius: 18px;
  background: #f9fffc;
  box-shadow: 0 16px 64px #0713254d;
  color: #101b27;
  color-scheme: light;
  text-align: start;
}
dialog.ps-dialog::backdrop { background: #101a2cc4; }
.ps-dialog .ps-brand {
  position: static;
  display: flex;
  align-items: center;
  padding: 11px 1.25rem;
  border: 0;
  border-top: 4px solid #65d8e8;
  background: #112132;
  color: #fff;
  font-weight: 750;
}
.ps-dialog .ps-brand .brand-wordmark { width: 128px; height: 27px; }
.ps-dialog .ps-brand .brand-wordmark text { fill: #fff; }
.ps-dialog .ps-body { padding: clamp(.85rem, 4vw, 1.5rem); }
.ps-dialog .ps-body h2 { margin: 0 0 .65rem; font-size: clamp(1.45rem, 4vw, 2rem); color: #101b27; letter-spacing: -.035em; }
.ps-dialog .ps-detail, .ps-dialog .ps-status, .ps-dialog .ps-links span { color: #394854; font-size: .9rem; line-height: 1.45; overflow-wrap: anywhere; }
.ps-dialog .ps-status:empty { margin: 0; }
.ps-dialog .ps-actions { display: flex; flex-wrap: wrap; gap: .45rem; margin: .55rem 0; }
.ps-dialog button, .ps-dialog a.ps-download {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 44px;
  max-width: 100%;
  margin: 0;
  padding: .5rem .85rem;
  border: 1px solid #899ba2;
  border-radius: 9px;
  background: #fff;
  color: #152a35;
  text-align: center;
  text-decoration: none;
  font: 650 .88rem/1.2 system-ui, sans-serif;
  cursor: pointer;
}
.ps-dialog button.primary, .ps-dialog a.ps-download { background: #d4fc82; border-color: #94aa6d; color: #122216; }
.ps-dialog button.ps-close { display: block; margin: .75rem 0 0 auto; }
.ps-dialog button:disabled { opacity: .64; cursor: wait; }
.ps-dialog :is(button,a,input):focus-visible, .ps-opt-in:focus-within { outline: 3px solid #087386; outline-offset: 2px; }
.ps-dialog .ps-score { display: block; padding: .8rem 1rem; background: #d4fc82; border-radius: 10px; color: #17281c; font-size: clamp(1.5rem, 6vw, 2.6rem); }
.ps-dialog .ps-link-label { display: grid; margin-top: .9rem; gap: .3rem; color: #152a35; font-weight: 650; }
.ps-dialog .ps-link-label input { box-sizing: border-box; min-height: 44px; width: 100%; padding: .45rem .65rem; background: white; border: 1px solid #82969d; color: #182a36; border-radius: 8px; font-size: .9rem; }
.ps-dialog .ps-preview { display: inline-block; vertical-align: top; width: min(43%, 8.7rem); height: auto; margin: .55rem .3rem 0 0; border: 1px solid #afbfbc; border-radius: 8px; }
.ps-dialog progress { display: block; margin-top: .8rem; width: 100%; accent-color: #087386; }
.ps-dialog .ps-links { padding: 0; list-style: none; }
.ps-dialog .ps-links li { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .7rem 0; border-bottom: 1px solid #cdd9d4; }
.ps-dialog .ps-links li span, .ps-dialog .ps-links li strong { display: block; }
@media (max-height: 500px) {
  .ps-dialog .ps-body { padding: .7rem 1rem; }
  .ps-dialog .ps-brand { padding: .3rem 1rem; }
  .ps-dialog .ps-preview { width: 5.4rem; }
}
