/* Premium final-match popup; scoped so other modals remain unchanged. */
#match-modal {
  padding: max(52px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom));
  background: rgba(1, 2, 10, .9);
  backdrop-filter: blur(7px);
}

#match-modal .match-result {
  width: min(90vw, 600px);
  max-height: 90dvh;
  min-height: 600px;
  padding: 102px 48px 38px;
  overflow: visible;
  border: 4px solid #e7b83c;
  border-radius: 36px;
  background:
    radial-gradient(circle at 50% 17%, rgba(143, 33, 190, .31), transparent 36%),
    repeating-radial-gradient(ellipse at 50% 31%, rgba(255,255,255,.025) 0 1px, transparent 1px 7px),
    linear-gradient(155deg, #3d075b, #230437 50%, #12021e);
  box-shadow:
    inset 0 0 0 3px #5f2703,
    inset 0 0 0 7px #ffdf65,
    inset 0 0 0 10px #713509,
    inset 0 0 54px rgba(0,0,0,.78),
    0 0 34px rgba(119,28,175,.48),
    0 26px 80px rgba(0,0,0,.82);
}

.match-result::before,
.match-result::after {
  content: '';
  position: absolute;
  left: 34px;
  right: 34px;
  height: 24px;
  background: url('../assets/setup/setup-ornament.webp') center / min(78%, 420px) 22px no-repeat;
  pointer-events: none;
}
.match-result::before { top: 50px; }
.match-result::after { bottom: 8px; transform: scaleX(-1); }

.match-result__crown {
  position: absolute;
  z-index: 2;
  top: -82px;
  left: 50%;
  width: 160px;
  height: 160px;
  object-fit: contain;
  transform: translateX(-50%);
  filter: drop-shadow(0 11px 10px rgba(0,0,0,.68)) drop-shadow(0 0 16px rgba(255,178,33,.45));
}

.match-result__corner { position: absolute; width: 58px; height: 58px; border-color: #ffd864; pointer-events: none; }
.match-result__corner--tl { left: 21px; top: 20px; border-left: 3px solid; border-top: 3px solid; border-radius: 22px 0 0; }
.match-result__corner--tr { right: 21px; top: 20px; border-right: 3px solid; border-top: 3px solid; border-radius: 0 22px 0 0; }
.match-result__corner--bl { left: 21px; bottom: 20px; border-left: 3px solid; border-bottom: 3px solid; border-radius: 0 0 0 22px; }
.match-result__corner--br { right: 21px; bottom: 20px; border-right: 3px solid; border-bottom: 3px solid; border-radius: 0 0 22px; }

.match-result__brand { margin-bottom: 18px; color: #f4cf58; font: 700 13px/1 var(--font-display); letter-spacing: .2em; text-transform: uppercase; }
.match-result__eyebrow { color: #fff5d4; font: 700 20px/1 var(--font-display); letter-spacing: .1em; }
.match-result__title {
  margin: 10px 0 4px;
  font: 700 64px/.95 var(--font-display);
  letter-spacing: 0;
  background: linear-gradient(180deg, #fff3a3, #ffc627 37%, #b96c05 74%, #ffe77d);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 4px 0 #6a3000) drop-shadow(0 0 13px rgba(255,189,44,.42));
}
.match-result--loss .match-result__title { font-size: 52px; background: linear-gradient(180deg, #fff1d1, #e3af66 52%, #9e6031); -webkit-background-clip: text; background-clip: text; }
.match-result__divider { display: block; width: min(80%, 360px); height: 38px; margin: 4px auto 11px; object-fit: contain; }

.match-result__score {
  position: relative;
  width: min(100%, 420px);
  min-height: 126px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1px 1fr;
  align-items: center;
  border: 2px solid #9f6720;
  border-radius: 26px;
  background: linear-gradient(180deg, rgba(61,13,83,.94), rgba(27,4,48,.96));
  box-shadow: inset 0 10px 30px rgba(99,30,119,.24), 0 8px 18px rgba(0,0,0,.38);
}
.match-result__score-cell { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.match-result__score-cell span { color: #fff6df; font: 700 22px/1 var(--font-display); }
.match-result__score-cell strong { color: #ffd34a; font: 700 49px/.9 var(--font-display); text-shadow: 0 3px 0 #7b3a00; }
.match-result__score-divider { width: 1px; height: 76px; background: linear-gradient(transparent, #d59d33 16%, #d59d33 84%, transparent); }
.match-result__target { position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); color: #cdbdd5; font: 800 9px/1 var(--font-body); text-transform: uppercase; }

.match-result__rewards { display: flex; justify-content: center; gap: 10px; margin: 14px auto 0; }
.match-result__rewards span { padding: 7px 12px; border: 1px solid #b98225; border-radius: 5px; background: rgba(44,7,65,.8); color: #ffe36e; font: 800 11px/1 var(--font-body); }

.match-result__button {
  position: relative;
  width: 84%;
  height: 76px;
  margin: 20px auto 0;
  padding: 19px 28px 9px;
  border: 4px solid #e5b940;
  border-radius: 23px;
  background: linear-gradient(180deg, #a420bd, #5a087d 43%, #31034f);
  color: #fff4cf;
  box-shadow: inset 0 0 0 2px #622008, inset 0 5px 13px rgba(255,95,231,.3), 0 9px 18px rgba(0,0,0,.48);
  cursor: pointer;
  touch-action: manipulation;
}
.match-result__button-crown { position: absolute; left: 50%; top: 5px; width: 22px; height: 13px; transform: translateX(-50%); background: url('../assets/setup/setup-crown.webp') center 24% / 34px auto no-repeat; }
.match-result__button-text { font: 700 25px/1 var(--font-display); letter-spacing: .08em; }
.match-result__button:hover,
.match-result__button.is-pressed { filter: brightness(1.12); }

@media (max-height: 700px) and (orientation: landscape) {
  #match-modal { padding-block: 30px 12px; }
  #match-modal .match-result { width: min(86vw, 490px); min-height: 490px; padding: 76px 38px 25px; border-radius: 27px; }
  .match-result__crown { top: -57px; width: 112px; height: 112px; }
  .match-result::before { top: 35px; }
  .match-result__brand { margin-bottom: 10px; font-size: 10px; }
  .match-result__eyebrow { font-size: 17px; }
  .match-result__title { margin-top: 6px; font-size: 48px; }
  .match-result--loss .match-result__title { font-size: 38px; }
  .match-result__divider { height: 26px; margin-block: 0 6px; }
  .match-result__score { min-height: 90px; border-radius: 19px; }
  .match-result__score-cell span { font-size: 17px; }
  .match-result__score-cell strong { font-size: 35px; }
  .match-result__score-divider { height: 56px; }
  .match-result__rewards { margin-top: 8px; }
  .match-result__button { height: 56px; margin-top: 11px; padding-top: 13px; }
  .match-result__button-text { font-size: 20px; }
}

@media (max-width: 540px) and (orientation: portrait) {
  #match-modal { padding: max(58px, env(safe-area-inset-top)) 14px max(18px, env(safe-area-inset-bottom)); }
  #match-modal .match-result { width: calc(100vw - 28px); min-height: 560px; padding: 83px 25px 30px; border-radius: 28px; }
  .match-result__crown { top: -62px; width: 120px; height: 120px; }
  .match-result::before { top: 40px; }
  .match-result__brand { margin-bottom: 16px; font-size: 10px; letter-spacing: .14em; }
  .match-result__eyebrow { font-size: 18px; }
  .match-result__title { font-size: 55px; }
  .match-result--loss .match-result__title { font-size: 39px; }
  .match-result__score { min-height: 112px; }
  .match-result__score-cell span { font-size: 19px; }
  .match-result__score-cell strong { font-size: 42px; }
  .match-result__rewards { flex-wrap: wrap; margin-top: 11px; }
  .match-result__button { width: 90%; height: 66px; margin-top: 16px; padding-top: 16px; }
  .match-result__button-text { font-size: 21px; }
}

@media (max-height: 820px) and (max-width: 540px) and (orientation: portrait) {
  #match-modal .match-result { min-height: 520px; padding-top: 74px; padding-bottom: 24px; }
  .match-result__crown { top: -54px; width: 104px; height: 104px; }
  .match-result__brand { margin-bottom: 10px; }
  .match-result__title { font-size: 48px; }
  .match-result--loss .match-result__title { font-size: 34px; }
  .match-result__divider { height: 27px; margin-bottom: 5px; }
  .match-result__score { min-height: 98px; }
  .match-result__button { height: 60px; margin-top: 12px; }
}
