.app-result-screen {
  min-height: 100%;
  min-height: 100dvh;
  width: 100%;
  display: grid;
  place-items: center;
  padding: 14px;
  color: #fff;
  box-sizing: border-box;
  overflow-y: auto;
}

body.standalone-result-active {
  overflow: hidden;
}

#final-results-container.app-result-host {
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  font-size: inherit !important;
  line-height: normal !important;
}

.app-result-host--fullscreen {
  position: fixed !important;
  inset: 0 !important;
  z-index: 2147483000 !important;
  display: block !important;
  width: auto !important;
  height: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  overflow: hidden !important;
}

.app-result-host--fullscreen .app-result-screen {
  min-height: 100dvh;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  background:
    radial-gradient(circle at 50% -10%, rgba(124, 58, 237, 0.34), transparent 45%),
    radial-gradient(circle at 10% 80%, rgba(59, 130, 246, 0.22), transparent 40%),
    rgba(5, 8, 22, 0.94);
  backdrop-filter: blur(18px);
}

.app-result-host--fullscreen .app-result-card {
  width: min(calc(100vw - 24px), 560px);
  max-height: calc(100dvh - 24px);
  border-radius: 24px;
  padding: clamp(14px, 3.2vw, 24px);
}

.app-result-mode {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 30px;
  margin: 0 auto 8px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(96, 165, 250, 0.11);
  border: 1px solid rgba(147, 197, 253, 0.28);
  color: rgba(226, 232, 240, 0.9);
  font-size: clamp(12px, 2.6vw, 14px);
  font-weight: 850;
}

.app-result-mode-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
  filter: drop-shadow(0 0 12px rgba(96, 165, 250, 0.42));
}

.app-result-card {
  width: min(calc(100% - 28px), 680px);
  max-height: calc(100dvh - 28px);
  box-sizing: border-box;
  overflow-y: auto;
  border-radius: clamp(24px, 6vw, 40px);
  padding: clamp(18px, 4vw, 34px);
  text-align: center;
  background:
    radial-gradient(circle at 50% 0%, rgba(128, 85, 255, 0.2), transparent 40%),
    rgba(6, 10, 35, 0.86);
  border: 2px solid rgba(151, 82, 255, 0.72);
  box-shadow:
    0 0 42px rgba(128, 74, 255, 0.28),
    inset 0 0 34px rgba(255, 255, 255, 0.035);
  backdrop-filter: blur(18px);
}

.app-result-icon {
  font-size: clamp(54px, 13vw, 96px);
  line-height: 1;
  margin-bottom: clamp(4px, 1vw, 12px);
  filter: drop-shadow(0 0 28px rgba(255, 188, 45, 0.58));
}

.app-result-icon--loss {
  filter: grayscale(1) brightness(1.35) drop-shadow(0 0 26px rgba(205, 220, 255, 0.48));
}

.app-result-icon--tie {
  font-size: clamp(48px, 10vw, 82px);
  filter: drop-shadow(0 0 24px rgba(255, 202, 88, 0.5));
}

.app-result-tie-icon {
  display: inline-flex;
  align-items: center;
  gap: clamp(8px, 2vw, 18px);
}

.app-result-tie-icon span {
  font-size: 0.72em;
  filter: drop-shadow(0 0 18px rgba(153, 90, 255, 0.72));
}

.app-result-title {
  margin: 0;
  font-size: clamp(42px, 12vw, 76px);
  line-height: 0.95;
  font-weight: 950;
  letter-spacing: 0;
}

.app-result-title--win,
.app-result-title--tie {
  color: #ffd24c;
  text-shadow: 0 0 24px rgba(255, 189, 45, 0.42);
}

.app-result-title--loss {
  color: #dfe7ff;
  text-shadow: 0 0 22px rgba(196, 211, 255, 0.34);
}

.app-result-subtitle {
  margin: clamp(6px, 1.4vw, 12px) auto clamp(18px, 3vw, 28px);
  max-width: 520px;
  color: rgba(227, 231, 255, 0.78);
  font-size: clamp(15px, 3.8vw, 22px);
  line-height: 1.25;
  font-weight: 700;
}

.app-result-versus {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(44px, 9vw, 72px) minmax(0, 1fr);
  align-items: center;
  gap: clamp(8px, 2vw, 18px);
  margin-bottom: clamp(16px, 3vw, 28px);
}

.app-result-player-card {
  min-width: 0;
  min-height: clamp(150px, 28vh, 230px);
  border-radius: clamp(24px, 5vw, 34px);
  padding: clamp(12px, 3vw, 22px);
  background:
    radial-gradient(circle at 50% 8%, rgba(255, 255, 255, 0.06), transparent 44%),
    rgba(8, 13, 43, 0.74);
  box-shadow: inset 0 0 24px rgba(255, 255, 255, 0.025);
}

.app-result-player-card--self {
  border: 2px solid rgba(75, 157, 255, 0.84);
  box-shadow: 0 0 26px rgba(66, 150, 255, 0.2), inset 0 0 24px rgba(255, 255, 255, 0.025);
}

.app-result-player-card--opponent {
  border: 2px solid rgba(255, 65, 174, 0.84);
  box-shadow: 0 0 26px rgba(255, 65, 174, 0.18), inset 0 0 24px rgba(255, 255, 255, 0.025);
}

.app-result-avatar {
  width: clamp(72px, 18vw, 120px);
  height: clamp(72px, 18vw, 120px);
  border-radius: 999px;
  margin: 0 auto clamp(8px, 2vw, 16px);
  display: block;
  border: 3px solid currentColor;
  overflow: hidden;
  position: relative;
}

/* Inner image is oversized + centered so the avatar art's built-in headroom is
   cropped and the subject fills the circle — matching the home/profile/HUD ~1.5x
   framing. The wrapper above owns size/border/clip; this never overflows it. */
.app-result-avatar-img {
  width: 150%;
  height: 150%;
  object-fit: cover;
  object-position: center center;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: block;
}

.app-result-player-card--self .app-result-avatar {
  color: #49a6ff;
  box-shadow: 0 0 24px rgba(66, 163, 255, 0.48);
}

.app-result-player-card--opponent .app-result-avatar {
  color: #ff42ad;
  box-shadow: 0 0 24px rgba(255, 66, 173, 0.46);
}

.app-result-player-name {
  font-size: clamp(20px, 4.6vw, 30px);
  line-height: 1.05;
  font-weight: 950;
  overflow-wrap: anywhere;
}

.app-result-player-score {
  margin-top: clamp(6px, 1.6vw, 12px);
  font-size: clamp(54px, 15vw, 92px);
  line-height: 0.9;
  font-weight: 950;
}

.app-result-player-card--self .app-result-player-score {
  color: #48a6ff;
}

.app-result-player-card--opponent .app-result-player-score {
  color: #ff3f9e;
}

.app-result-vs {
  width: clamp(48px, 10vw, 72px);
  height: clamp(48px, 10vw, 72px);
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(25, 18, 66, 0.9);
  border: 1px solid rgba(178, 121, 255, 0.55);
  color: #d8c5ff;
  font-size: clamp(20px, 4.5vw, 32px);
  font-weight: 950;
  box-shadow: 0 0 26px rgba(155, 86, 255, 0.45);
  z-index: 2;
}

.app-result-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(8px, 2vw, 16px);
  margin-bottom: clamp(18px, 3vw, 28px);
}

.app-result-stats--count-1 {
  grid-template-columns: minmax(0, 1fr);
}

.app-result-stats--count-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.app-result-stats--count-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.app-result-stat {
  min-width: 0;
  min-height: clamp(92px, 17vh, 140px);
  border-radius: clamp(18px, 4vw, 26px);
  padding: clamp(10px, 2.5vw, 18px);
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.app-result-stat-icon {
  width: clamp(42px, 9vw, 60px);
  height: clamp(42px, 9vw, 60px);
  margin: 0 auto 8px;
  border-radius: 999px;
  display: grid;
  place-items: center;
}

.app-result-stat-icon svg {
  width: 78%;
  height: 78%;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.35;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-result-stat--correct .app-result-stat-icon,
.app-result-stat--correct .app-result-stat-value {
  color: #35ef7d;
}

.app-result-stat--errors .app-result-stat-icon,
.app-result-stat--errors .app-result-stat-value {
  color: #ff5c7a;
}

.app-result-stat--average .app-result-stat-icon,
.app-result-stat--average .app-result-stat-value {
  color: #9657ff;
}

.app-result-stat--score .app-result-stat-icon,
.app-result-stat--score .app-result-stat-value,
.app-result-stat--rounds .app-result-stat-icon,
.app-result-stat--rounds .app-result-stat-value {
  color: #fbbf24;
}

.app-result-stat--default .app-result-stat-icon,
.app-result-stat--default .app-result-stat-value {
  color: #93c5fd;
}

.app-result-stat-emoji {
  font-size: 0.8em;
  line-height: 1;
}

.app-result-stat-label {
  color: rgba(235, 238, 255, 0.76);
  font-size: clamp(14px, 3vw, 20px);
  font-weight: 750;
}

.app-result-stat-value {
  margin-top: 4px;
  font-size: clamp(32px, 9vw, 54px);
  line-height: 1;
  font-weight: 950;
}

.app-result-actions {
  display: grid;
  grid-template-columns: 1fr 1.12fr;
  gap: clamp(10px, 3vw, 20px);
}

.app-result-actions--count-1 {
  grid-template-columns: minmax(0, 1fr);
}

.app-result-btn {
  min-width: 0;
  min-height: clamp(56px, 8vh, 78px);
  border-radius: clamp(18px, 4vw, 28px);
  border: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: #fff;
  font-size: clamp(18px, 5vw, 28px);
  font-weight: 950;
  cursor: pointer;
}

.app-result-btn--secondary {
  background: rgba(22, 15, 62, 0.78);
  border: 2px solid rgba(166, 110, 255, 0.42);
  color: #cdb8ff;
}

.app-result-btn--primary {
  background: linear-gradient(135deg, #8d28ff 0%, #7c3cff 45%, #58a9ff 100%);
  box-shadow: 0 12px 32px rgba(107, 64, 255, 0.34);
}

.app-result-btn--ghost {
  background: transparent;
  border: 2px solid rgba(148, 163, 184, 0.34);
  color: rgba(226, 232, 240, 0.82);
}

.app-result-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

@media (max-width: 480px) {
  .app-result-screen {
    padding: 10px;
    align-items: center;
  }

  .app-result-card {
    width: min(calc(100vw - 20px), 680px);
    max-height: calc(100dvh - 20px);
    padding: 16px 14px;
    border-radius: 24px;
    border-width: 1.5px;
    box-shadow:
      0 0 30px rgba(128, 74, 255, 0.24),
      inset 0 0 24px rgba(255, 255, 255, 0.03);
  }

  .app-result-host--fullscreen .app-result-screen {
    padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  }

  .app-result-host--fullscreen .app-result-card {
    width: min(calc(100vw - 16px), 560px);
    max-height: calc(100dvh - 16px);
    padding: 12px 10px;
    border-radius: 20px;
  }

  .app-result-mode {
    margin-bottom: 5px;
    min-height: 26px;
    padding: 4px 10px;
  }

  .app-result-mode-icon {
    width: 20px;
    height: 20px;
  }

  .app-result-icon {
    font-size: clamp(44px, 12vw, 58px);
    margin-bottom: 2px;
    filter: drop-shadow(0 0 18px rgba(255, 188, 45, 0.48));
  }

  .app-result-icon--tie {
    font-size: clamp(36px, 10vw, 48px);
  }

  .app-result-title {
    font-size: clamp(36px, 10.5vw, 48px);
  }

  .app-result-subtitle {
    margin: 4px auto 12px;
    font-size: clamp(13px, 3.5vw, 15px);
    line-height: 1.18;
  }

  .app-result-versus {
    grid-template-columns: minmax(0, 1fr) 38px minmax(0, 1fr);
    gap: 6px;
    margin-bottom: 12px;
  }

  .app-result-player-card {
    min-height: 132px;
    border-radius: 20px;
    padding: 10px 7px;
    border-width: 1.5px;
  }

  .app-result-avatar {
    width: clamp(54px, 15vw, 64px);
    height: clamp(54px, 15vw, 64px);
    border-width: 2px;
    margin-bottom: 7px;
  }

  .app-result-player-name {
    font-size: clamp(15px, 4.1vw, 18px);
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .app-result-player-score {
    margin-top: 6px;
    font-size: clamp(42px, 12vw, 52px);
  }

  .app-result-vs {
    width: 38px;
    height: 38px;
    font-size: 17px;
    box-shadow: 0 0 18px rgba(155, 86, 255, 0.38);
  }

  .app-result-stats {
    gap: 7px;
    margin-bottom: 14px;
  }

  .app-result-stats--count-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app-result-stat {
    min-height: 82px;
    border-radius: 16px;
    padding: 8px 5px;
  }

  .app-result-stat-icon {
    width: 34px;
    height: 34px;
    margin-bottom: 5px;
  }

  .app-result-stat-label {
    font-size: 12px;
  }

  .app-result-stat-value {
    font-size: clamp(24px, 7vw, 32px);
    margin-top: 2px;
  }

  .app-result-actions {
    grid-template-columns: 1fr 1fr;
    gap: 9px;
  }

  .app-result-btn {
    min-height: 48px;
    border-radius: 16px;
    font-size: clamp(16px, 4.4vw, 19px);
  }
}

@media (max-height: 700px) and (max-width: 480px) {
  .app-result-card {
    padding-block: 12px;
  }

  .app-result-subtitle {
    margin-bottom: 9px;
  }

  .app-result-player-card {
    min-height: 116px;
  }

  .app-result-avatar {
    width: 50px;
    height: 50px;
  }

  .app-result-player-score {
    font-size: 38px;
  }

  .app-result-stat {
    min-height: 72px;
  }

  .app-result-stat-icon {
    width: 28px;
    height: 28px;
  }

  .app-result-btn {
    min-height: 44px;
  }
}
