/* Round results live in the browser's modal layer, above every table and nav. */
html:has(.round-result-dialog[open]) { overflow: hidden; }
.round-result-dialog {
  --result-mint: #a9dfcc;
  width: min(560px, calc(100% - 32px)); max-width: none;
  max-height: calc(100dvh - 40px); margin: auto; padding: 0;
  color: var(--text); background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--accent) 50%, var(--line));
  border-radius: 28px; box-shadow: 0 32px 100px #0007;
  overflow: auto; overscroll-behavior: contain;
}
.round-result-dialog::backdrop { background: #080910cc; backdrop-filter: blur(7px); }
.round-result-dialog[open] { animation: result-arrival .24s ease-out; }
.round-result-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 22px; border-bottom: 1px solid var(--line); }
.round-result-game { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; }
.round-result-game .game-emblem { width: 36px; height: 36px; }
.round-result-game small { display: block; font-size: 9px; font-weight: 600; letter-spacing: 1.4px; margin-top: 2px; color: var(--muted); }
.round-result-top .round-button { flex-shrink: 0; width: 44px; height: 44px; }
.round-result-content { padding: 24px; background: radial-gradient(ellipse at 50% 0, color-mix(in srgb, var(--accent) 12%, transparent), transparent 64%); }
.round-result-hero { text-align: center; padding: 0 2px 23px; }
.round-result-portraits { position: relative; display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; width: fit-content; max-width: 100%; margin: 0 auto 23px; }
.round-result-portraits > img, .round-result-mark { width: 78px; height: 78px; border-radius: 25px; border: 1px solid color-mix(in srgb, var(--result-mint) 50%, transparent); background: var(--bg); padding: 3px; box-shadow: 0 5px 22px #0002; }
.round-result-portraits:has(img:nth-child(3)) > img { width: 60px; height: 60px; border-radius: 20px; }
.round-result-mark { display: grid; place-items: center; color: var(--result-mint); }
.round-result-medal { position: absolute; right: -7px; bottom: -10px; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--result-mint); color: #163e33; border: 3px solid var(--surface); }
.round-result-hero .eyebrow { font-size: 10px; letter-spacing: 1.7px; color: var(--accent); }
.round-result-hero h2 { font: 750 clamp(25px, 5vw, 34px)/1.18 Manrope, sans-serif; letter-spacing: -.9px; margin: 10px 0 12px; overflow-wrap: anywhere; text-wrap: balance; outline: none; }
.round-result-hero p { margin: 0 auto; max-width: 360px; color: var(--muted); font-size: 14px; line-height: 1.6; text-wrap: balance; }
.round-result-scores { border: 1px solid var(--line); border-radius: 17px; overflow: hidden; background: var(--surface); }
.round-result-scores table { width: 100%; table-layout: fixed; border-collapse: collapse; text-align: right; font-variant-numeric: tabular-nums; }
.round-result-scores th, .round-result-scores td { padding: 12px 10px; border-bottom: 1px solid var(--line); }
.round-result-scores th:first-child { text-align: left; width: 60%; }
.round-result-scores thead th { padding-block: 10px; color: var(--muted); font-size: 10px; font-weight: 500; }
.round-result-scores tbody tr:last-child > * { border: 0; }
.round-result-scores .is-you { background: var(--accent-soft); }
.round-result-player { display: flex; align-items: center; gap: 10px; }
.round-result-avatar { position: relative; display: inline-flex; flex-shrink: 0; }
.round-result-avatar img { border-radius: 11px; }
.round-result-player > span:last-child { min-width: 0; }
.round-result-player strong { display: block; font-size: 13px; font-weight: 650; line-height: 1.35; overflow-wrap: anywhere; }
.round-result-player small { display: block; font-weight: 400; color: var(--muted); font-size: 10px; margin-top: 3px; }
.round-result-scores td { font-size: 17px; }
.round-result-scores td:last-child strong { display: inline-block; min-width: 36px; font-size: 19px; color: var(--result-mint); }
.round-result-footer { position: sticky; bottom: 0; z-index: 2; padding: 15px 24px 20px; border-top: 1px solid var(--line); background: var(--surface); box-shadow: 0 -9px 20px #0001; }
.round-result-footer .button { min-height: 46px; font-size: 14px; padding: 11px 15px; }
.round-result-secondary { display: flex; justify-content: center; gap: 8px; margin-top: 9px; }
.round-result-secondary > .button { flex: 1; }
.round-result-secondary .text-button { font-size: 12px; }
.round-result-wait { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0 0 12px; font-size: 13px; color: var(--muted); text-align: center; }
.round-result-wait svg { flex-shrink: 0; color: var(--accent); }
.round-result-wait span { overflow-wrap: anywhere; }
.round-result-error { color: var(--text); background: var(--accent-soft); padding: 10px 12px; margin: 0 0 12px; font-size: 13px; border-radius: 12px; }
.round-result-reopen { display: flex; align-items: center; gap: 10px; width: 100%; padding: 13px 16px; margin-bottom: 14px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); text-align: left; font-size: 13px; }
.round-result-reopen > svg { color: var(--accent); flex-shrink: 0; }
.round-result-reopen > span { flex: 1; }
.round-result-reopen strong { font-size: 12px; color: var(--accent); }
.round-result-dialog.is-final .round-result-medal { background: #f1cc87; color: #664921; }
[data-theme=daylight] .round-result-dialog { --result-mint: #28695b; }
[data-theme=daylight] .round-result-medal { background: #bae2d3; }
@keyframes result-arrival { from { opacity: 0; transform: translateY(12px) scale(.985); } to { opacity: 1; transform: none; } }
@media (max-width: 600px) {
  .round-result-dialog { width: calc(100% - 24px); max-height: calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); border-radius: 23px; }
  .round-result-top { padding: 11px 15px; }
  .round-result-content { padding: 20px 14px 16px; }
  .round-result-hero { padding-bottom: 18px; }
  .round-result-hero p { font-size: 13px; }
  .round-result-scores th, .round-result-scores td { padding-inline: 8px; }
  .round-result-scores th:first-child { width: 52%; }
  .round-result-scores th:last-child { width: 26%; }
  .round-result-player { gap: 8px; }
  .round-result-player strong { font-size: 12px; }
  .round-result-avatar img { width: 30px; height: 30px; }
  .round-result-scores td { font-size: 16px; }
  .round-result-scores td:last-child strong { font-size: 18px; }
  .round-result-footer { padding: 12px 15px 15px; }
}
@media (prefers-reduced-motion: reduce) { .round-result-dialog[open] { animation: none; } }
