/* The same measured shell is used for selection, rolling and the final result. */
body#top[data-page='play'] #game-screen > .row-popup {
  --prompt-safe-left:env(safe-area-inset-left,0px); --prompt-safe-right:env(safe-area-inset-right,0px);
  --prompt-safe-top:env(safe-area-inset-top,0px); --prompt-safe-bottom:env(safe-area-inset-bottom,0px);
  --prompt-width:220px; --prompt-height:212px;
  position:fixed!important; left:var(--deploy-popup-left,8px)!important; top:var(--deploy-popup-top,8px)!important;
  right:auto!important; bottom:auto!important; transform:none!important;
  width:min(var(--prompt-width),var(--prompt-available-width,calc(100vw - 16px)))!important;
  height:min(var(--prompt-height),var(--prompt-available-height,calc(100dvh - 16px)))!important;
  min-width:0!important; min-height:0!important; max-width:none!important; max-height:none!important;
  box-sizing:border-box; padding:10px!important; margin:0!important;
  display:grid!important; grid-template-columns:minmax(0,1fr); grid-template-rows:16px minmax(0,1fr) 28px 44px!important;
  align-items:stretch; justify-items:stretch; gap:6px!important; overflow:hidden!important;
}
body#top[data-page='play'] #game-screen > .row-popup .row-popup-lbl {
  position:static; grid-area:1 / 1; font-size:11px; line-height:16px; letter-spacing:1px;
}
body#top[data-page='play'] #game-screen > .row-popup .popup-big-val {
  grid-area:2 / 1; display:flex!important; justify-content:center; align-items:center;
  width:100%; height:100%; min-width:0; min-height:0; aspect-ratio:auto; margin:0; padding:0;
  font-size:44px; line-height:1;
}
body#top[data-page='play'] #game-screen > .row-popup .popup-die-preview svg { width:56px; height:56px; }
body#top[data-page='play'] #game-screen > .row-popup .popup-roll-note {
  grid-area:3 / 1; margin:0; align-self:center; font:500 11px/1.2 Inter,sans-serif; text-align:center;
}
body#top[data-page='play'] #game-screen > .row-popup .popup-actions {
  grid-area:4 / 1; display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:6px; margin:0; padding:0;
}
body#top[data-page='play'] #game-screen > .row-popup .popup-actions .btn {
  min-width:0; min-height:44px!important; height:44px!important; margin:0; padding:4px 6px!important;
  font-size:12px; display:flex; justify-content:center; align-items:center;
}
body#top[data-page='play'].phone-match-active #game-screen > .row-popup {
  --prompt-width:max(112px,var(--phone-roll-width,140px));
  --prompt-height:96px;
  padding:4px!important; gap:4px!important; grid-template-rows:minmax(0,1fr) 44px!important;
}
/* The local roll prompt opens toward the field instead of using the footer.
   Selection and result keep the same shell and generous paired touch targets. */
body#top[data-page='play'].phone-match-active #game-screen > .row-popup:not(.popup-observer) {
  --prompt-width:clamp(152px,21vw,184px);
}
body#top[data-page='play'].phone-match-active #game-screen > .row-popup .row-popup-lbl {
  position:absolute; grid-area:auto; inset:4px auto auto 6px; max-width:calc(100% - 48px);
  font-size:9px; line-height:10px; letter-spacing:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
body#top[data-page='play'].phone-match-active #game-screen > .row-popup .popup-big-val {
  grid-area:1 / 1; font-size:28px; padding-top:10px; box-sizing:border-box;
}
body#top[data-page='play'].phone-match-active #game-screen > .row-popup .popup-die-preview svg { width:28px; height:28px; }
body#top[data-page='play'].phone-match-active #game-screen > .row-popup .popup-roll-note {
  position:absolute; grid-area:auto; inset:4px 6px auto auto; font-size:0; line-height:10px;
}
body#top[data-page='play'].phone-match-active #game-screen > .row-popup .popup-roll-note::before { content:'1 action'; font-size:8px; }
body#top[data-page='play'].phone-match-active #game-screen > .row-popup .popup-actions { grid-area:2 / 1; gap:4px; }

/* Watching a committed remote roll is a status card, not an empty action form. */
body#top[data-page='play'] #game-screen > .row-popup.popup-observer {
  --prompt-height:128px;
  grid-template-rows:20px minmax(0,1fr) 32px!important;
}
body#top[data-page='play'] #game-screen > .row-popup.popup-observer .row-popup-lbl {
  position:static; grid-area:1 / 1; max-width:none; text-align:center;
}
body#top[data-page='play'] #game-screen > .row-popup.popup-observer .popup-big-val { grid-area:2 / 1; padding:0; }
body#top[data-page='play'] #game-screen > .row-popup.popup-observer .popup-roll-note {
  position:static; grid-area:3 / 1; font-size:11px; line-height:1.25; opacity:1;
}
body#top[data-page='play'] #game-screen > .row-popup.popup-observer .popup-roll-note::before { content:none; }
body#top[data-page='play'].phone-match-active #game-screen > .row-popup.popup-observer {
  --prompt-height:44px;
  grid-template-columns:minmax(0,1fr) 40px;
  grid-template-rows:12px minmax(0,1fr)!important;
}
body#top[data-page='play'].phone-match-active #game-screen > .row-popup.popup-observer .row-popup-lbl {
  grid-area:1 / 1; font-size:9px; line-height:12px; text-align:left;
}
body#top[data-page='play'].phone-match-active #game-screen > .row-popup.popup-observer .popup-big-val {
  grid-area:1 / 2 / 3; font-size:26px;
}
body#top[data-page='play'].phone-match-active #game-screen > .row-popup.popup-observer .popup-roll-note {
  grid-area:2 / 1; font-size:10px; line-height:12px; text-align:left; white-space:nowrap;
}
