/* Structural wrappers are transparent to the existing portrait/desktop layout. */
.resolution-summary { display: contents; }

/* Short landscape viewports: group the outcome instead of stretching every
   item across the full height. Only player selection may scroll at 12 players. */
@media (orientation: landscape) and (min-width: 568px) and (max-height: 560px) {
  body[data-view="match"] :is(#boom-view, #result-view) {
    grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
    grid-template-rows: minmax(0, 1fr) 48px;
    gap: 8px 20px;
    padding: 4px 0 6px;
    overflow: hidden;
    box-sizing: border-box;
  }
  body[data-view="match"] :is(#boom-view, #result-view) .resolution-summary {
    grid-area: 1 / 1 / 3 / 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 0;
    min-height: 0;
  }
  body[data-view="match"] :is(#boom-view, #result-view) .resolution-summary > * {
    margin: 0;
    flex: 0 0 auto;
    max-width: 100%;
  }
  body[data-view="match"] :is(#boom-view, #result-view) .eyebrow { font-size: 10px; }
  body[data-view="match"] :is(#boom-view, #result-view) h1 {
    font-size: clamp(22px, 6svh, 30px);
    line-height: 1.1;
  }
  body[data-view="match"] :is(#boom-view, #result-view) .resolution-note {
    font-size: 12px;
    line-height: 1.35;
    max-width: 32em;
  }
  body[data-view="match"] #boom-view .resolution-icon { font-size: 32px; line-height: 1; }
  body[data-view="match"] #boom-view #loss-players {
    grid-area: 1 / 2;
    align-self: stretch;
    align-content: center;
    grid-auto-rows: 52px;
    gap: 6px;
    margin: 0;
    padding: 2px;
    min-height: 0;
    overflow-y: auto;
    /* Safe centering: overflowing grids start at the first selectable player. */
    align-content: safe center;
  }
  body[data-view="match"] #boom-view .loss-player {
    grid-template-columns: 28px minmax(0, 1fr);
    justify-items: start;
    min-height: 44px;
    padding: 4px 6px;
  }
  body[data-view="match"] #boom-view .loss-player[aria-pressed="true"] { padding: 4px 6px; }
  body[data-view="match"] #boom-view .loss-avatar { align-self: center; }
  body[data-view="match"] #boom-view #confirm-loss { grid-area: 2 / 2; }
  body[data-view="match"] #result-view {
    grid-template-rows: minmax(0, 1fr) auto auto minmax(0, 1fr);
  }
  body[data-view="match"] #result-view .resolution-summary { grid-area: 1 / 1 / 5 / 2; gap: 6px; }
  body[data-view="match"] #result-view .result-avatar { font-size: clamp(36px, 12svh, 60px); line-height: 1; }
  body[data-view="match"] #result-view .result-hearts { gap: 3px; font-size: 14px; flex-wrap: wrap; }
  body[data-view="match"] #result-view #next-round { grid-area: 2 / 2; }
  body[data-view="match"] #result-view #undo-loss { grid-area: 3 / 2; }
  body[data-view="match"] :is(#confirm-loss, #next-round, #undo-loss) {
    width: 100%;
    max-width: 395px;
    justify-self: center;
    min-height: 44px;
    margin: 0;
  }
  @media (max-height: 330px) {
    body[data-view="match"] :is(#boom-view, #result-view) .resolution-summary { gap: 3px; }
    body[data-view="match"] #result-view .result-avatar { font-size: 30px; }
    body[data-view="match"] :is(#boom-view, #result-view) h1 { font-size: 20px; }
  }
}
