:root { --nyadoku-ad-reserve: 0px; }
#phone-shell {
  width: min(100vw, calc((100dvh - var(--nyadoku-ad-reserve)) * 710 / 1536));
  height: min(calc(100dvh - var(--nyadoku-ad-reserve)), calc(100vw * 1536 / 710));
  max-height: calc(100dvh - var(--nyadoku-ad-reserve));
  margin-bottom: var(--nyadoku-ad-reserve);
}
@media (max-width: 767px) and (orientation: portrait) {
  #phone-shell {
    width: 100vw;
    height: calc(100dvh - var(--nyadoku-ad-reserve));
    box-shadow: none;
  }
}
.nyadoku-ad-banner {
  position: fixed; bottom: env(safe-area-inset-bottom, 0px); left: 0; right: 0;
  height: 50px; z-index: 50; display: flex; justify-content: center; background: #171414;
}
/* Yahoo sets inline width:auto on this slot; keep it full-width as a flex item. */
.nyadoku-ad-banner > div { flex: 0 0 100%; min-width: 0; width: 100%; height: 50px; }
.nyadoku-ad-overlay {
  position: fixed; inset: 0; z-index: 10000; background: rgba(0,0,0,.92);
  display: grid; place-items: center; color: #463737; touch-action: auto;
}
.nyadoku-ad-slot { position: absolute; inset: 0; display: grid; place-items: center; }
.nyadoku-ad-close {
  position: absolute; top: max(16px, env(safe-area-inset-top)); right: 16px;
  z-index: 10001; padding: 12px; border: 1px solid #777; border-radius: 8px;
  background: #fff; color: #463737; font: inherit; min-height: 44px;
}
.nyadoku-ad-close[hidden] { display: none; }
