/* One-screen results. Mobile browser chrome is excluded by svh; safe-area
 * insets protect standalone/PWA screens. Review and sharing never expand this
 * card. Keep the outro opacity/transform from shootout.css untouched. */
body:has(.shootout-finished) { overflow:hidden; }
body:has(.shootout-finished) > :is(.points-header,.site-footer),
.shootout-finished > .solo-heading { display:none; }
:is(body:not(.stadium-playing),body.stadium-ending) .shootout-finished .solo-questions {
  position:fixed; z-index:3; left:50%; right:auto; top:50svh; bottom:auto;
  width:min(760px,calc(100% - 32px)); height:auto; max-height:calc(100svh - 32px);
  padding:24px; overflow:visible; border:1px solid var(--border); border-radius:8px;
  background:var(--surface); transform:translate(-50%,-50%);
}
.stadium-ending .shootout-finished .solo-questions {
  transform:translate(-50%,-50%) translateY(calc((1 - var(--stadium-result,0))*24px));
}
#summary {
  display:grid; grid-template-columns:minmax(0,1fr) 184px; gap:16px;
  grid-template-areas:'heading share' 'metrics metrics' 'level level' 'actions actions' 'guest guest' 'review review' 'status status' 'advert advert';
}
#summary > * { min-width:0; }
#summary .result-heading-row { display:contents; }
.result-heading-copy { grid-area:heading; min-width:0; }
#summary .result-heading-copy h2 { margin:0; font-size:28px; line-height:1.18; text-wrap:balance; }
#summary #result-heading:focus { outline:none; }
#summary #result-completion { margin:8px 0 0; font-size:13px; line-height:1.4; }
#summary #share-result { grid-area:share; align-self:start; width:100%; max-width:none; min-height:44px; padding:10px; text-align:center; line-height:1.2; background:var(--brand-blue); border-color:var(--brand-blue); color:var(--on-accent); }
#summary #share-result img { filter:none; width:18px; height:18px; }
#summary #share-result span { text-align:center; }
#summary .metrics { grid-area:metrics; margin:0; padding:16px 0; gap:12px; border-top:1px solid var(--border); border-bottom:1px solid var(--border); }
#summary .metric strong { margin:0 0 4px; font-size:28px; line-height:1.1; font-variant-numeric:tabular-nums; overflow-wrap:anywhere; }
#summary .metric span { display:block; font-size:12px; line-height:1.3; }
#summary .metric:nth-child(2) strong { color:var(--brand-green); }
#summary .metric:nth-child(n+3) strong { color:var(--brand-pink); }
#summary #result-level { grid-area:level; margin:0; font-size:14px; }
#summary #result-level-progress { margin:8px 0; height:6px; }
#summary #result-level-remaining { margin:0; font-size:12px; }
#summary .result-actions { grid-area:actions; gap:8px; }
#summary .result-actions > * { min-height:44px; padding:10px; font-size:14px; color:var(--on-accent); }
#summary #guest-benefits { grid-area:guest; display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; gap:12px; margin:0; padding:12px 0 0; border-bottom:0; }
#summary #guest-benefits h3 { margin:0 0 4px; font-size:16px; line-height:1.2; }
#summary #guest-benefits p { margin:0; font-size:13px; line-height:1.4; }
#summary #guest-benefits a { padding:10px 12px; font-size:13px; background:var(--brand-purple); color:var(--text); }
#summary #result-review { grid-area:review; justify-self:start; margin:0; padding:10px 12px; min-height:44px; border:1px solid var(--border); font-size:13px; }
#summary #share-status { grid-area:status; margin:0; font-size:12px; line-height:1.3; }
/* No advertising inside a compact result. On tall desktop screens only, the
 * reserved banner still fits; the existing side rails remain independent. */
#summary .ad-slot { display:none; grid-area:advert; margin:0; padding-top:12px; }
@media(min-width:1101px) and (min-height:900px) {
  #summary .ad-slot:not([hidden]) { display:block; }
}

.result-dialog { width:min(600px,calc(100% - 24px)); max-height:calc(100svh - 32px); padding:20px; border:1px solid var(--border); border-radius:8px; background:var(--surface); color:var(--text); }
.result-dialog::backdrop { background:#191a1ecc; backdrop-filter:blur(5px); }
.result-dialog .drawer-heading { margin:0 0 12px; min-height:44px; }
.result-dialog h2 { margin:0; font-size:20px; line-height:1.2; }
.result-dialog button { font-family:inherit; color:var(--text); background:var(--surface-raised); border:1px solid var(--border); border-radius:6px; min-height:44px; }
.result-dialog button:disabled { opacity:.4; }
#review-dialog { height:min(520px,calc(100svh - 32px)); }
#review-dialog[open] { display:flex; flex-direction:column; }
#review { flex:1; min-height:0; overflow:auto; }
#review .review-item { margin:0; padding:8px 0; border:0; }
#review h3 { margin:0 0 14px; font-size:18px; line-height:1.4; overflow-wrap:anywhere; }
#review p { margin:0; font-size:14px; line-height:1.5; color:var(--muted); overflow-wrap:anywhere; }
.review-pagination { display:flex; align-items:center; justify-content:space-between; gap:12px; padding-top:12px; flex:none; font-size:13px; }
#review-previous img { transform:rotate(180deg); }
#share-dialog #share-options { margin:0; }
#share-dialog #share-preview { max-height:40svh; object-fit:contain; margin:0 0 12px; }
#share-dialog .actions { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
#share-dialog .actions > * { padding:10px; font-size:13px; gap:8px; justify-content:center; }
#share-dialog #share-link { width:100%; min-width:0; min-height:40px; padding:8px; margin:12px 0 0; font:inherit; font-size:13px; color:var(--text); background:var(--bg); border:1px solid var(--border); border-radius:4px; }
#share-dialog-status { margin:8px 0 0; font-size:12px; }
#share-dialog-status:empty { display:none; }

@media(max-width:800px), (max-height:540px) and (max-width:1100px) {
  :is(body:not(.stadium-playing),body.stadium-ending) .shootout-finished .solo-questions {
    width:calc(100% - 24px); max-height:calc(100svh - 24px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px));
    top:calc((100svh + env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px))/2); padding:16px;
  }
  #summary { grid-template-columns:minmax(0,1fr) minmax(0,1.25fr); gap:10px;
    grid-template-areas:'heading heading' 'metrics metrics' 'level level' 'actions actions' 'guest guest' 'review share' 'status status'; }
  #summary .result-heading-copy h2 { font-size:24px; line-height:1.15; }
  #summary #result-completion { margin-top:6px; font-size:12px; }
  #summary .metrics { grid-template-columns:repeat(2,minmax(0,1fr)); padding:12px 0; gap:12px 16px; }
  #summary .metric strong { font-size:26px; margin-bottom:3px; }
  #summary .metric span { font-size:11px; }
  #summary .result-actions { grid-template-columns:repeat(2,minmax(0,1fr)); gap:6px; }
  #summary .result-actions #another { grid-column:1/-1; }
  #summary .result-actions > * { padding:8px; font-size:13px; }
  #summary #share-result,#summary #result-review { width:100%; align-self:stretch; min-width:0; padding:8px; font-size:12px; }
  #summary #share-result { gap:6px; }
  #summary #share-result span { max-width:100px; }
  #summary #guest-benefits { padding-top:10px; gap:10px; }
  #summary #guest-benefits h3 { font-size:14px; }
  #summary #guest-benefits p { font-size:12px; line-height:1.3; }
  #summary #guest-benefits a { padding:8px; font-size:12px; max-width:100px; text-align:center; line-height:1.2; }
}
/* Smaller phones need tighter spacing, not a scrollable card or clipped text. */
@media(max-width:800px) and (max-height:700px) {
  :is(body:not(.stadium-playing),body.stadium-ending) .shootout-finished .solo-questions { padding:12px; }
  #summary { gap:6px; }
  #summary .metrics { padding:10px 0; gap:8px 12px; }
  #summary .metric strong { font-size:24px; }
  #summary #guest-benefits { padding-top:8px; }
}
@media(max-width:479px) and (max-height:500px) {
  :is(body:not(.stadium-playing),body.stadium-ending) .shootout-finished .solo-questions { padding:8px; }
  #summary { gap:4px; }
  #summary .metrics { padding:8px 0; }
  #summary #guest-benefits { padding-top:4px; }
}
/* On a landscape phone, put the summary and actions in separate columns.
 * Share keeps its own row, and every tap target stays at least 44px high. */
@media(min-width:480px) and (max-width:1100px) and (max-height:540px) {
  :is(body:not(.stadium-playing),body.stadium-ending) .shootout-finished .solo-questions { width:calc(100% - 24px); padding:10px; }
  #summary { grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:4px 16px;
    grid-template-areas:'heading actions' 'metrics actions' 'level guest' 'review share' 'status status'; }
  #summary .result-heading-copy h2 { font-size:20px; }
  #summary .metrics { padding:8px 0; gap:6px; }
  #summary .metric strong { font-size:22px; }
  #summary .result-actions { align-self:start; }
  #summary #guest-benefits { padding:0; border:0; gap:8px; }
  #summary #guest-benefits h3 { display:none; }
  #summary #guest-benefits p { font-size:11px; }
  #summary #result-level { font-size:12px; }
  #summary #result-level-progress { margin:4px 0; }
  #share-dialog { width:min(720px,calc(100% - 24px)); padding:12px; }
  #share-dialog #share-options { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:8px 16px; align-items:center; }
  #share-dialog #share-preview { grid-row:1 / span 3; margin:0; max-height:calc(100svh - 116px); }
  #share-dialog #share-link,#share-dialog-status { margin:0; }
}
@media(min-width:480px) and (max-width:1100px) and (max-height:360px) {
  :is(body:not(.stadium-playing),body.stadium-ending) .shootout-finished .solo-questions { padding:4px 8px; }
  #summary { gap:2px 12px; }
  #summary .metrics { padding:6px 0; }
}
