/* Shared finish cards reuse the site's palette, type and existing confetti. */
:is(.finish-band, #mot-summary, #pyr-celebrate, #search-celebrate, #room-recap) {
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
  padding: clamp(12px, 3vw, 24px);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  color: var(--ink);
  scroll-margin-block: 24px;
  overflow-wrap: anywhere;
}
.finish-band:empty { display: none; }
:is(.finish-band, #mot-summary, #pyr-celebrate, #search-celebrate, #room-recap):focus-visible {
  outline: 3px solid var(--navy);
  outline-offset: 3px;
}
:is(.finish-band, #mot-summary, #pyr-celebrate, #search-celebrate, #room-recap) :is(.win-title, h2, #room-recap-title) {
  font-family: inherit;
  font-size: clamp(1.125rem, 3vw, 1.5rem);
  font-weight: 700;
  line-height: 1.3;
}
.shared-end-actions .btn {
  min-height: 44px;
  white-space: normal;
  text-align: center;
}
@media (max-width: 600px) {
  .play-shell .shared-end-actions,
  .play-shell .shared-end-actions:has([data-replay]),
  .lr-results .shared-end-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-auto-flow: row;
    gap: 8px;
  }
  .shared-end-actions > form, .shared-end-actions .solution-help { display: contents; }
  .shared-end-actions .btn { width: 100%; box-sizing: border-box; min-width: 0; }
}
:is(.game-start-stage, .game-ready-card, .start-panel) button[aria-busy="true"]::after {
  content: '';
  display: inline-block;
  width: 1em;
  height: 1em;
  margin-inline-start: .5em;
  border: 2px solid currentColor;
  border-inline-end-color: transparent;
  border-radius: 50%;
  animation: endgame-loading .8s linear infinite;
}
@keyframes endgame-loading { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  :is(.game-start-stage, .game-ready-card, .start-panel) button[aria-busy="true"]::after { animation: none; }
}

/* Abandon confirmations and the existing guest popup remain finger-sized. */
.play-shell .abandon-confirm > summary.abandon-summary, .abandon-confirm .abandon-actions .btn,
.mot-guest-finish-x { min-height: 44px; min-width: 44px; }

/* Reserve feedback space before completion; updating it does not move the board. */
.ranking-status { min-height: 1.5em; margin: 0; font-size: .8rem; line-height: 1.5; color: var(--muted); }

/* Mot/Trouve share the same three-control geometry and retain their palette. */
.play-shell .shared-end-actions:is(.trouve-end, .mm-end-actions) { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; align-items: stretch; }
:is(.trouve-end, .mm-end-actions) > form, :is(.trouve-end, .mm-end-actions) > .solution-help { display: flex; margin: 0; min-width: 0; }
:is(.trouve-end, .mm-end-actions) .btn { width: 100%; height: 100%; box-sizing: border-box; }
:is(.trouve-end, .mm-end-actions) .end-action-note:empty { display: none; }
@media (max-width: 600px) {
  .play-shell .shared-end-actions:is(.trouve-end, .mm-end-actions) { grid-template-columns: minmax(0, 1fr); grid-auto-rows: 1fr; }
}
.room-app .room-return-actions[data-shared-navigation] .room-return-home { grid-column: 1; grid-row: 1; }
.room-app .room-return-actions[data-shared-navigation] .room-create-link { grid-column: 2; grid-row: 1; background: var(--teal-soft); color: var(--petrol-deep); border-color: var(--teal); }
/* Empty ranking feedback must not add a second gap above the ranking card. */
.play-shell[data-game-tint="trouve-mots"] .ranking-status:empty { min-height: 0; }

:is(.trouve-end, .mm-end-actions) .solution-help form { display: contents; }
