/* Earnings box on the result screen (earnings.js). Uses the winner's colours like the rest of the card. */
.earnings {
  --acc: var(--win-accent, #f6dc9c);
  margin: 10px 0; padding: 10px 10px 8px; border: 1px solid color-mix(in srgb, var(--acc) 40%, transparent); border-radius: 15px;
  background: linear-gradient(115deg, color-mix(in srgb, var(--win-shade, #3a1410) 92%, transparent), rgb(23 18 27 / .66));
  -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); text-align: left; color: #f4e9ee;
  animation: earn-in 520ms .45s cubic-bezier(.2, .9, .25, 1.1) backwards;
}
@keyframes earn-in { from { opacity: 0; translate: 0 10px; } }
.earn-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 2px 8px; }
/* the duel screen's general `header` padding (up to 36px) was pushing this row inwards — keep it flush with the cards below */
.earnings .earn-head { padding: 0; gap: 4px 10px; flex-wrap: wrap; }
/* no divider line under the EARNINGS / COINS EARNED row (the general header rule drew a faint one) */
.earnings .earn-head, .earnings .earn-head h3 { border: 0; box-shadow: none; background: none; }
.earnings .earn-head::before, .earnings .earn-head::after { content: none; }
.earn-head h3 { margin: 0; color: var(--acc); font: 700 11px/1 var(--ec-font-ui, system-ui); letter-spacing: .18em; text-transform: uppercase; }
/* Same size as the EARNINGS title; the coin is the menu's top-right coin (polish.css .coin-counter > b), scaled down. */
.earnings .earn-coins { display: inline-flex; align-items: center; gap: 6px; color: rgb(244 233 238 / .7); font: 700 11px/1 var(--ec-font-ui, system-ui); letter-spacing: .18em; text-transform: uppercase; white-space: nowrap; }
.earnings .earn-coins b { min-width: 2.5ch; color: var(--ec-gold-hi, #f6dc9c); font: inherit; font-variant-numeric: tabular-nums; text-align: right; }
.earn-coin { flex: none; width: 13px; height: 13px; border-radius: 50%;
  background: url("assets/ducat.svg?v=1") center / 100% no-repeat;
  filter: drop-shadow(0 1px 2px rgb(0 0 0 / .5)); }
.earn-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }

.earn-card {
  position: relative; isolation: isolate; display: grid; gap: 4px; min-width: 0; margin: 0; padding: 9px 10px 8px; overflow: hidden;
  border: 1px solid rgb(255 255 255 / .1); border-radius: 12px; background: rgb(0 0 0 / .22); color: inherit; font: inherit; letter-spacing: normal;
  text-align: left; cursor: pointer; transition: border-color 180ms, background 180ms, translate 180ms;
}
.earn-card { grid-template-columns: minmax(0, 1fr); }   /* rows never grow wider than the card */
.earn-card:hover, .earn-card:focus-visible { border-color: var(--acc); background: rgb(0 0 0 / .32); translate: 0 -1px; outline: none; }
.earn-card:focus-visible { box-shadow: 0 0 0 2px color-mix(in srgb, var(--acc) 60%, transparent); }
.earn-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.earn-label { overflow: hidden; color: rgb(244 233 238 / .7); font: 600 10px/1.2 var(--ec-font-ui, system-ui); letter-spacing: .12em; text-transform: uppercase; white-space: nowrap; text-overflow: ellipsis; }
.earn-chip { flex: none; padding: 2px 6px; border-radius: 99px; background: color-mix(in srgb, #6fe39a 22%, transparent); color: #9ff0bd; font: 700 10.5px/1.3 var(--ec-font-ui, system-ui); white-space: nowrap; }
.earn-chip.is-down { background: rgb(255 120 110 / .18); color: #ffb0a8; }
.earn-chip.is-quiet { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; background: rgb(255 255 255 / .07); color: rgb(244 233 238 / .55); font-weight: 600; }
.earn-who { display: flex; align-items: center; gap: 7px; min-width: 0; }
.earn-badge { flex: none; display: grid; place-items: center; transition: scale 300ms; }
.earn-badge .rank-badge { scale: .8; transform-origin: center; margin: -4px; }
.earn-name { overflow: hidden; color: #fff6ec; font: 650 13.5px/1.2 var(--ec-font-ui, system-ui); white-space: nowrap; text-overflow: ellipsis; }
.earn-level { display: grid; place-items: center; min-width: 26px; height: 26px; padding: 0 5px; border-radius: 8px; background: var(--acc); color: var(--win-shade, #2a1408); font: 800 13px/1 var(--ec-font-ui, system-ui); }
.earn-level-legacy { border-radius: 50%; background: conic-gradient(from 210deg, #f6dc9c, #c98a2c, #f6dc9c); color: #3a2008; }
.earn-points { display: flex; align-items: baseline; gap: 4px; min-width: 0; }
/* The +/− chip sits at the end of the points line, so a long label ("Ranked · online") can't push it out of the card. */
.earn-points .earn-chip { margin-left: auto; align-self: center; }
.earn-points b { color: #fff; font: 750 20px/1.1 var(--ec-font-ui, system-ui); font-variant-numeric: tabular-nums; }
.earn-points small { color: rgb(244 233 238 / .6); font: 600 11px var(--ec-font-ui, system-ui); }
.earn-bar { display: block; height: 5px; overflow: hidden; border-radius: 9px; background: rgb(255 255 255 / .1); }
.earn-bar i { display: block; width: var(--p, 0%); height: 100%; border-radius: inherit; background: linear-gradient(90deg, color-mix(in srgb, var(--acc) 70%, #fff), var(--acc)); transition: width 120ms linear; }
.earn-next { overflow: hidden; color: rgb(244 233 238 / .62); font: 500 10.5px/1.3 var(--ec-font-ui, system-ui); white-space: nowrap; text-overflow: ellipsis; }
/* Guest nudge, inside the box under the cards. */
.earn-keep { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; margin: 8px 0 0; padding: 8px 12px; border: 1px dashed color-mix(in srgb, var(--acc) 55%, transparent); border-radius: 12px; background: color-mix(in srgb, var(--acc) 9%, transparent); color: #fff3d6; font: inherit; text-align: left; cursor: pointer; transition: background 180ms, border-color 180ms; }
.earn-keep span { display: grid; gap: 2px; min-width: 0; }
.earn-keep b { font: 700 12.5px/1.2 var(--ec-font-ui, system-ui); }
.earn-keep small { color: rgb(244 233 238 / .62); font: 500 10.5px/1.3 var(--ec-font-ui, system-ui); }
.earn-keep i { flex: none; color: var(--acc); font-style: normal; font-weight: 700; }
.earn-keep:hover, .earn-keep:focus-visible { border-style: solid; border-color: var(--acc); background: color-mix(in srgb, var(--acc) 16%, transparent); outline: none; }
.earn-say { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

/* Rank-up moment: the card glows, the new badge drops in over it with its name, then fades back. */
.earn-burst { position: absolute; inset: 0; z-index: 2; display: grid; place-content: center; justify-items: center; gap: 2px; padding: 6px; opacity: 0; pointer-events: none;
  background: radial-gradient(circle at 50% 45%, color-mix(in srgb, var(--acc) 55%, transparent), color-mix(in srgb, var(--win-shade, #2a1408) 94%, transparent) 75%); text-align: center; }
.earn-burst small { color: var(--acc); font: 800 10px/1.2 var(--ec-font-ui, system-ui); letter-spacing: .2em; text-transform: uppercase; }
.earn-burst strong { color: #fff; font: 700 15px/1.15 var(--ec-font-display, Georgia, serif); }
.earn-burst-badge { display: grid; place-items: center; margin-bottom: 2px; }
.earn-card.is-celebrating { border-color: var(--acc); box-shadow: 0 0 26px -4px color-mix(in srgb, var(--acc) 70%, transparent); }
.earn-card.is-celebrating .earn-burst { animation: earn-burst 1500ms cubic-bezier(.2, .9, .25, 1.1) both; }
.earn-card.is-celebrating .earn-burst-badge { animation: earn-badge 1500ms cubic-bezier(.2, 1.4, .3, 1) both; }
.earn-card.is-dropping .earn-burst { animation: earn-burst 1000ms ease both; filter: grayscale(.6); }
@keyframes earn-burst { 0% { opacity: 0; scale: .7; } 18% { opacity: 1; scale: 1.04; } 30%, 78% { opacity: 1; scale: 1; } 100% { opacity: 0; scale: 1.02; } }
@keyframes earn-badge { 0% { scale: 0; rotate: -30deg; } 30% { scale: 1.35; rotate: 6deg; } 45%, 100% { scale: 1; rotate: 0deg; } }
.earnings.is-playing .earn-chip { animation: earn-pop 500ms .5s both; }
@keyframes earn-pop { from { scale: .6; opacity: 0; } }

/* Ranked notes (hot streak, rank-up held, checkpoint): slim strips in the Earnings box's style. */
.rank-notes { --acc: var(--win-accent, #f6dc9c); display: grid; gap: 6px; margin: 10px 0; text-align: left; animation: earn-in 520ms .35s cubic-bezier(.2, .9, .25, 1.1) backwards; }
.rank-note {
  display: flex; align-items: center; gap: 10px; min-width: 0; padding: 8px 10px; border: 1px solid color-mix(in srgb, var(--acc) 40%, transparent); border-radius: 13px;
  background: linear-gradient(115deg, color-mix(in srgb, var(--win-shade, #3a1410) 92%, transparent), rgb(23 18 27 / .66));
  -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); color: #f4e9ee;
}
.rank-note-icon { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: color-mix(in srgb, var(--acc) 16%, rgb(0 0 0 / .25)); color: var(--acc); }
.rank-note-icon svg { width: 17px; height: 17px; fill: currentColor; }
.rank-note-text { flex: 1; display: grid; gap: 3px; min-width: 0; }
.rank-note-text small { color: var(--acc); font: 700 10px/1 var(--ec-font-ui, system-ui); letter-spacing: .18em; text-transform: uppercase; }
.rank-note-text b { overflow: hidden; color: #fff6ec; font: 650 13.5px/1.2 var(--ec-font-ui, system-ui); white-space: nowrap; text-overflow: ellipsis; }
.rank-note-chip { flex: none; padding: 3px 8px; border-radius: 99px; background: color-mix(in srgb, #6fe39a 22%, transparent); color: #9ff0bd; font: 700 11px/1.3 var(--ec-font-ui, system-ui); white-space: nowrap; animation: earn-pop 500ms .6s both; }
/* Hot streak burns warm whatever the winner's colours are. */
.rank-note-hot { border-color: rgb(255 150 70 / .5); }
.rank-note-hot .rank-note-icon { background: radial-gradient(circle at 50% 60%, rgb(255 150 60 / .35), rgb(0 0 0 / .25)); color: #ffb35c; }
.rank-note-hot .rank-note-text small { color: #ffb35c; }
.rank-note-hot .rank-note-chip { background: rgb(255 150 60 / .2); color: #ffc98a; }
@media (max-width: 630px) { .rank-notes { margin: 8px 0; } .rank-note { padding: 7px 8px; gap: 8px; } }
@media (prefers-reduced-motion: reduce) { .rank-notes, .rank-note-chip { animation: none !important; } }

/* Room for the box: the result card starts higher and its parts get a little tighter. */
@media (min-width: 631px) {
  .duel-view .victory-result:has([data-earnings]) { top: clamp(64px, 8vh, 96px); }
  body.duel-view #app .victory-result:has([data-earnings]) .victory-graphic { min-height: 0; }
  body.duel-view #app .victory-result:has([data-earnings]) .victory-stats { padding-block: 8px; }
  body.duel-view #app .victory-result:has([data-earnings]) .victory-actions { gap: 7px; }
  body.duel-view #app .victory-result:has([data-earnings]) .victory-actions .victory-action { min-height: 50px; padding-block: 6px; }
  body.duel-view #app .victory-result:has([data-earnings]) .va-icon { width: 34px; height: 34px; }
}
@media (min-width: 631px) and (max-height: 820px) {
  body.duel-view #app .victory-result:has([data-earnings]) .victory-portrait { display: none; }
  body.duel-view #app .victory-result:has([data-earnings]) .victory-stats > div:nth-child(2) { display: none; }
}
.earn-name { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.15; }
@media (max-width: 630px) {
  .earnings { margin: 8px 0; padding: 8px; }
  .earn-points b { font-size: 17px; }
  .earn-grid { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  .earnings, .earn-card, .earn-burst, .earn-burst-badge, .earn-chip { animation: none !important; transition: none !important; }
}
