/* Victory uses the game's palette and typography, with a compact phone layout. */
.level-result-dialog {
  width: min(440px, calc(100vw - 28px));
  max-width: none;
  max-height: calc(100dvh - 28px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  margin: auto;
  padding: 24px 18px 18px;
  border: 0;
  border-radius: 22px;
  overflow-y: auto;
  background: var(--menu-panel-color, #bbd8b5);
  color: #182319;
  box-shadow: 0 12px 40px #0005;
  text-align: center;
  overscroll-behavior: contain;
}
.level-result-dialog::backdrop { background: #171b18b8; }
.level-result-heading { position: relative; padding: 0 40px; }
.level-result-heading h2 { margin: 0 0 8px; font-size: 36px; line-height: 1.1; font-weight: 400; }
.level-result-close {
  position: absolute; top: -12px; right: -10px;
  width: 44px; height: 44px; padding: 0;
  border: 0; border-radius: 12px; background: var(--menu-button-yellow, #dca34c);
  color: #182319; font-size: 32px; line-height: 1;
}
.level-result-level { margin: 0; font-size: 24px; line-height: 1.3; }
.level-result-campaign { margin: 4px 0 0; color: #40583e; font-size: 20px; line-height: 1.3; }
.level-result-stats {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 18px 0 14px; padding: 4px 0;
  background: #d3e5cc; border-radius: 16px;
}
.level-result-stat { display: flex; flex-direction: column-reverse; gap: 4px; margin: 0; padding: 10px 6px; }
.level-result-stat:nth-child(odd) { border-right: 1px solid #71896b40; }
.level-result-stat:nth-child(-n+2) { border-bottom: 1px solid #71896b40; }
.level-result-stat dt { font-size: 18px; line-height: 1.25; }
.level-result-stat dd { margin: 0; font-size: 36px; line-height: 1.15; font-variant-numeric: tabular-nums; }
.level-result-notice { margin: 0 0 16px; font-size: 18px; line-height: 1.35; color: #40583e; }
.level-result-notice.is-error { color: #7f2929; }
.level-result-retry { margin: 8px 0 16px; padding: 8px 14px; min-height: 44px; border: 1px solid #40583e; border-radius: 10px; background: transparent; color: #182319; font-size: 20px; }
.level-result-actions { display: flex; flex-direction: column; gap: 12px; }
.level-result-actions button {
  width: 100%; min-height: 64px; padding: 14px 12px; border: 0; border-radius: 16px;
  background: var(--menu-button-green, #5fa773); color: #080c09;
  font-size: 26px; line-height: 1.2; box-shadow: 0 4px 7px #0002;
}
.level-result-actions .level-result-secondary { background: var(--menu-button-olive, #aaa45b); }
.level-result-dialog button:focus-visible { outline: 3px solid #182319; outline-offset: 3px; }
.level-result-dialog button:disabled { opacity: .55; }
.level-result-rating { min-width: 0; border: 0; padding: 0; margin: 0 0 10px; }
.level-result-rating legend { display: block; width: 100%; padding: 0; font-size: 22px; line-height: 1.3; }
.level-result-stars { display: flex; justify-content: center; gap: 6px; margin-top: 6px; }
.level-result-star { display: grid; place-items: center; width: 44px; height: 48px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: #40583e; }
.level-result-star svg { width: 36px; height: 36px; fill: transparent; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; transition: fill 120ms, color 120ms; }
.level-result-star.is-filled { color: #805a22; }
.level-result-star.is-filled svg { fill: #e1ad51; }
.level-result-star:disabled { opacity: .4; }
.level-result-rating-status { min-height: 24px; margin: 4px 0 0; color: #40583e; font-size: 18px; line-height: 1.3; }
.level-results-button { pointer-events: auto; flex: 1; max-width: 260px; min-height: 60px; border: 0; border-radius: 16px; background: #5fa773; color: #080c09; font-size: 26px; padding: 10px 16px; box-shadow: 0 4px 8px #0004; }
.level-result-dialog[open] { animation: level-result-appear 220ms ease-out both; }
@keyframes level-result-appear { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@media (max-height: 640px) {
  .level-result-dialog { padding: 18px; }
  .level-result-heading { padding-top: 4px; }
  .level-result-heading h2 { font-size: 36px; }
  .level-result-stats { margin-top: 18px; margin-bottom: 12px; }
  .level-result-stat { padding: 10px 6px; }
  .level-result-stat dd { font-size: 32px; }
  .level-result-actions { gap: 10px; }
  .level-result-actions button { min-height: 58px; padding: 12px; }
}
@media (max-width: 360px) { .level-result-actions button { font-size: 24px; } .level-result-stars { gap: 4px; } }
@media (prefers-reduced-motion: reduce) { .level-result-dialog[open] { animation: none; } }
