/* Finish cards frame the live lift shot. The timing strip holds the score,
   while goals and actions stay on the opposite side. */
#gamePanel[data-panel="results"]:has(.result-stage) {
  background: linear-gradient(90deg, #07101da3, transparent 44%, transparent 56%, #07101d94);
}

.result-stage {
  --finish-cream: #eff2f5;
  --finish-ice: #c1cedb;
  --finish-muted: #aab9c9;
  --finish-line: #b6d0eb2e;
  --finish-accent: var(--brand-blue-hi);
  --finish-ease: cubic-bezier(.2,.76,.24,1);
  color: var(--finish-cream);
}

.result-stage .result-score-card,
.result-stage .result-progress-card {
  min-width: 0;
  background: linear-gradient(158deg, #18263af7, #0b1321f7 82%);
  border: 1px solid var(--finish-line);
  border-top-color: #adcae45e;
  border-radius: 18px;
  box-shadow: 0 18px 50px #060e1a6e, inset 0 1px #e8f4ff0b;
}

.result-stage.is-record .result-score-card {
  background: radial-gradient(ellipse at 12% -24%, #42a5ec40, transparent 65%), linear-gradient(158deg, #233146fa, #0b1321fa 82%);
  border-top-color: var(--finish-accent);
}

.result-stage :is(.result-course-label, .result-section-label) {
  color: var(--finish-muted);
}

.result-stage .result-score-card > h3 {
  margin: 8px 0 16px;
  color: #e6ebf0;
  line-height: 1;
  overflow-wrap: anywhere;
}

.result-stage .result-timing {
  position: relative;
  isolation: isolate;
  container-type: inline-size;
  overflow: hidden;
  padding: 13px 15px 10px 17px;
  border: 1px solid #a9c8e733;
  border-left: 2px solid var(--finish-accent);
  border-radius: 5px 11px 11px 5px;
  background: repeating-linear-gradient(-28deg, #aec9e615 0 1px, transparent 1px 14px) right / 45% 100% no-repeat, linear-gradient(90deg, #203148, #101c2f);
}

.result-stage.is-record .result-timing {
  border-color: #8fceff6b;
  border-left-color: var(--finish-accent);
  background: repeating-linear-gradient(-28deg, #c1e4fe16 0 1px, transparent 1px 14px) right / 52% 100% no-repeat, linear-gradient(105deg, #382b2d, #241f2b 68%, #1a2230);
}

.result-stage .result-score-label {
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 12px;
  color: var(--finish-ice);
}

.result-stage .result-score-label > span { color: #c2e4fe; }
.result-stage .result-score-value {
  margin: 4px 0 0;
  color: #f3f6f8;
  font-size: clamp(40px, 28cqw, 86px);
  font-feature-settings: 'tnum';
  line-height: .97;
  text-shadow: 0 6px 22px #050a14a8;
}
.result-stage .result-score-value.result-score-long { font-size: clamp(32px, 21cqw, 76px); }

.result-stage .result-announced-score,
.session-score-digits .score-reading {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.result-stage .result-record {
  align-items: center;
  margin-block-start: 3px;
  border-color: var(--finish-line);
  border-block-start: 0;
}

.result-stage .result-record > span {
  color: var(--finish-ice);
  background: #354a625e;
  border-color: #9ebabf4a;
}

.result-stage .result-record b { color: var(--finish-ice); }
.result-stage .result-record p { color: var(--finish-muted); }
.result-stage .result-record.new-record > span { color: #cae7ff; background: #43a6ed30; border-color: #8cccff64; }
.result-stage .result-record.new-record b { color: #c3e4fe; }

.result-stage .result-stars {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 6px;
  margin: 13px 0;
}

.result-stage .result-medal {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 4px;
  min-height: 33px;
  border: 1px solid #b2c5db29;
  border-radius: 7px;
  background: #a8c1de0b;
  color: var(--finish-muted);
}

.result-stage .result-medal[data-medal="bronze"] { --medal-color: #ffc199; --medal-fill: #ffab7220; }
.result-stage .result-medal[data-medal="silver"] { --medal-color: #dcecff; --medal-fill: #aed6ff24; }
.result-stage .result-medal[data-medal="gold"] { --medal-color: #ffe395; --medal-fill: #ffcf6326; }
.result-stage .result-medal:has(.on) { color: var(--medal-color); border-color: color-mix(in srgb, var(--medal-color) 42%, transparent); background: var(--medal-fill); }
.result-stage .result-medal small { font: 800 8px var(--body); letter-spacing: .055em; }
.result-stage .result-stars .result-medal i { font-size: 15px; color: #96a8bd; }
.result-stage .result-stars .result-medal i.on { color: var(--medal-color); text-shadow: 0 0 12px var(--medal-fill); }

.result-stage .result-rewards small { color: var(--finish-muted); }
.result-stage .result-rewards b { color: var(--finish-cream); }
.result-stage .result-share-button {
  margin-top: 16px;
  min-height: 44px;
  background: #17263b;
  border-color: #a1c3e34a;
  color: #e7eef7;
}
.result-stage .result-share-button:hover { background: #26364d; border-color: #e1eaff80; }
.result-stage .result-share-status { color: var(--finish-ice); }

.result-stage .result-lift-caption {
  align-self: end;
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 auto 7px;
  border: 1px solid #cee2fb42;
  border-radius: 30px;
  padding: 7px 10px;
  background: #101b2acc;
}

.result-stage .result-lift-caption i {
  width: 5px;
  height: 5px;
  margin: 0 2px 0 0;
  background: var(--finish-accent);
  box-shadow: 0 0 0 3px #98d4ff29;
}
.result-stage .result-lift-caption span { color: #e7edf6; }

.result-stage .result-next-goal {
  margin: 13px 0;
  padding: 12px;
  background: #91c4f50c;
  border: 1px solid #a9c8e724;
  border-radius: 9px;
}
.result-stage .result-next-goal > span { color: var(--finish-ice); }
.result-stage .result-next-goal h3 { margin: 5px 0 10px; color: #ebeff3; }
.result-stage .result-next-goal > p { color: var(--finish-muted); }
.result-stage .result-goal-track { background: #a9c8e735; }
.result-stage .result-goal-track i { background: linear-gradient(90deg,#2b91cf,var(--finish-accent)); transform-origin: left; }
.result-stage .result-highlight { padding: 11px 0; border-color: var(--finish-line); }
.result-stage .result-highlight strong { color: var(--finish-cream); }
.result-stage .result-highlight small,
.result-stage .result-highlight > span,
.result-stage .result-ride-stats b small,
.result-stage .result-ride-stats span,
.result-stage .result-next-tip { color: var(--finish-muted); }
.result-stage .result-ride-stats b { color: var(--finish-cream); }
.result-stage .result-next-tip { margin: 13px 0 0; }
.result-stage .result-next-tip > span { color: var(--finish-accent); }

.result-stage .result-actions .primary-button {
  border-color: #c4e5fe99;
  background: linear-gradient(170deg, #95d1ff, #73c1ff);
  color: var(--brand-navy);
  box-shadow: inset 0 1px #ddefff80, 0 4px 14px #64bbff2b;
}
.result-stage .result-actions .primary-button:hover { background: #aedcfe; }
.result-stage .result-actions .primary-button kbd { color: #171e25; border-color: #0f293f66; background: #ffffff39; }
.result-stage .result-actions .secondary-button { min-height: 44px; border-color: #b0c9e244; background: #19293e; color: #dce7f5; }
.result-stage .result-actions .secondary-button:hover { background: #26374e; border-color: #e1eaff80; }
.result-stage :is(button, summary):focus-visible { outline: 2px solid #a4d8fe; outline-offset: 2px; }

.result-stage .result-full-report {
  border-color: var(--finish-line);
  background: #111e30f5;
  box-shadow: 0 12px 28px #07101848;
}
.result-stage .result-full-report > summary { color: var(--finish-ice); }
.result-stage .result-full-report > summary > span:last-child { color: var(--finish-muted); }
.result-stage .result-report-content { border-color: var(--finish-line); }

.session-result-score,
.survival-finish {
  margin-bottom: 18px;
  padding: clamp(19px, 4vw, 36px);
  border: 1px solid #b6d0eb4d;
  border-radius: 15px;
  background: repeating-linear-gradient(-28deg, #aec9e61c 0 1px, transparent 1px 15px) right / 42% 100% no-repeat,
    linear-gradient(135deg, #263b54, #122237 65%, #0f1c2e);
}
.session-result-score > .eyebrow, .survival-finish > .eyebrow { color: #c4d3e3; }
.session-score-digits {
  display: flex;
  gap: 9px;
  align-items: baseline;
  font: 900 italic clamp(46px, 12vw, 104px)/1 var(--display);
  color: #deefff;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 6px 22px #050a1480;
}
.survival-score.session-score-digits { justify-content: center; }
.session-score-digits small { margin: 0; font: 800 14px var(--body); color: #c0e4fe; }
.survival-finish[data-personal-best] { border-color: #7ac4ffb5; }
.survival-record { display: inline-block; margin: 0 0 4px; color: #afddfe; font: 800 11px var(--body); letter-spacing: .13em; }

@media (max-width: 900px) {
  .result-stage .result-ride-window { min-height: clamp(98px, 21dvh, 185px); }
}

@media (max-width: 580px) {
  .result-stage .result-score-card,
  .result-stage .result-progress-card { padding: 16px; }
  .result-stage .result-medal { gap: 5px; }
}

@media (prefers-reduced-motion: no-preference) {
  :is(.session-result-score, .survival-finish).result-motion {
    animation: finish-card-settle 450ms cubic-bezier(.2,.76,.24,1) both;
  }
  .result-stage.result-motion :is(.result-score-card, .result-progress-card, .result-full-report) {
    animation: finish-card-settle 450ms var(--finish-ease) both;
  }
  .result-stage.result-motion .result-progress-card { animation-delay: 75ms; }
  .result-stage.result-motion .result-full-report { animation-delay: 115ms; }
  .result-stage.result-motion .result-goal-track i { animation: finish-goal-fill 650ms var(--finish-ease) both; }
  .result-stage.result-motion .result-medal:nth-child(2) { --medal-delay: 280ms; }
  .result-stage.result-motion .result-medal:nth-child(3) { --medal-delay: 365ms; }
  .result-stage.result-motion .result-stars .result-medal i.on { animation: finish-medal-land 355ms var(--finish-ease) var(--medal-delay, 195ms) both; }
  .result-stage.result-motion.is-record .result-timing::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(115deg, transparent 30%, #bbe2fe38 50%, transparent 71%);
    transform: translateX(-110%);
    animation: finish-record-light 680ms var(--finish-ease) 370ms both;
  }
}

@keyframes finish-card-settle {
  from { opacity: .5; transform: translateY(7px); }
  to { opacity: 1; transform: none; }
}
@keyframes finish-goal-fill {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}
@keyframes finish-medal-land {
  0% { opacity: .3; transform: translateY(4px) scale(.7); }
  66% { opacity: 1; transform: translateY(-1px) scale(1.19); }
  100% { opacity: 1; transform: none; }
}
@keyframes finish-record-light {
  to { transform: translateX(110%); }
}

/* Tiered in-run callouts: routine airs are a small, quick chip; big rotations get gold. */
.trick-callout[data-tier="minor"] .trick-overline{display:none}
.trick-callout[data-tier="minor"] #trickName{font-size:clamp(24px,2.6vw,34px);background:none;color:#f4f8fb;filter:drop-shadow(0 2px 8px rgba(0,0,0,.55))}
.trick-callout[data-tier="minor"] #trickPoints{font-size:16px;padding:2px 9px;background:#ffffffd9;color:#10202c}
.trick-callout[data-tier="minor"]{animation:callout-chip .32s cubic-bezier(.2,.8,.2,1) both}
.trick-callout[data-tier="huge"] .trick-overline{color:#80c7ff;letter-spacing:.42em}
.trick-callout[data-tier="huge"] #trickName{font-size:clamp(46px,6.4vw,92px);background-image:linear-gradient(180deg,#dceeff 20%,#55b5ff 70%,var(--brand-blue));filter:drop-shadow(0 0 18px #5bb7ff66) drop-shadow(0 4px 14px rgba(0,0,0,.6))}
.trick-callout[data-tier="huge"] #trickPoints{font-size:28px;box-shadow:0 0 22px #50b2fe88}
@keyframes callout-chip{from{opacity:0;transform:translate(-50%,8px) scale(.94)}to{opacity:1;transform:translate(-50%,0) scale(1)}}
#score.score-pulse{animation:score-pulse .55s cubic-bezier(.2,.8,.2,1)}
@keyframes score-pulse{0%{transform:scale(1)}30%{transform:scale(1.18);color:#80c7ff}100%{transform:scale(1)}}
@media(prefers-reduced-motion:reduce){.trick-callout[data-tier],#score.score-pulse{animation:none}}

/* Place announcement: each named landscape of a resort route gets an arrival card. */
.place-banner{position:fixed;z-index:6;left:50%;top:108px;transform:translateX(-50%);display:grid;justify-items:center;gap:3px;min-width:min(340px,80vw);padding:9px 22px 10px;border-radius:8px;
  background:linear-gradient(90deg,#0d1c2800,#0d1c28d9 18%,#0d1c28d9 82%,#0d1c2800);color:#ebeff3;pointer-events:none;text-align:center;animation:place-in .5s cubic-bezier(.2,.8,.2,1) both}
.place-banner.hidden{display:none}
.place-banner small{font:800 11px/1 var(--display);letter-spacing:.32em;color:#5bb7ff}
.place-banner strong{font:italic 900 clamp(26px,3vw,38px)/1 var(--display);letter-spacing:.02em;text-transform:uppercase;text-shadow:0 3px 14px #0009}
.place-banner span{font:700 11px/1 var(--display);letter-spacing:.18em;color:#b9cfdb}
.place-banner::after{content:"";width:64px;height:2px;margin-top:3px;background:linear-gradient(90deg,transparent,var(--brand-blue),transparent)}
@keyframes place-in{from{opacity:0;transform:translate(-50%,-10px)}to{opacity:1;transform:translate(-50%,0)}}
@media(orientation:portrait) and (max-width:600px){.place-banner{top:128px;padding:7px 14px}.place-banner strong{font-size:24px}}
@media(orientation:landscape) and (max-height:500px){.place-banner{top:74px;padding:5px 14px}.place-banner strong{font-size:22px}}
@media(prefers-reduced-motion:reduce){.place-banner{animation:none}}
body:not(.playing) .place-banner{display:none}

/* Short landscape phones: the score, its facts and the next action fit without scrolling. */
@media (orientation: landscape) and (max-height: 500px) {
  #gamePanel[data-panel="results"] .panel-header { padding-block: 8px; }
  #gamePanel[data-panel="results"] .panel-header h2 { font-size: 24px; }
  .survival-finish, .session-result-score { margin-bottom: 10px; padding: 12px 18px; }
  .survival-finish { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); column-gap: 18px; align-items: center; text-align: left; }
  .survival-finish > * { grid-column: 1; }
  .survival-finish > .survival-facts, .survival-finish > .result-actions, .survival-finish > .survival-retry-note { grid-column: 2; }
  .survival-finish > .survival-facts { grid-row: 1 / span 2; margin: 0; padding: 8px 0; }
  .survival-score.session-score-digits { justify-content: flex-start; margin: 4px 0; font-size: 56px; }
  .survival-facts b { font-size: 20px; }
  .session-score-digits { font-size: clamp(40px, 10vh, 64px); }
}
/* Part 164: a stomped landing's push. The speed jumps and flashes blue; BOOST sits beside STOMPED. */
#hud #speed.speed-boost{animation:speed-boost .6s cubic-bezier(.2,.8,.2,1);transform-origin:left bottom}
@keyframes speed-boost{0%{transform:scale(1)}30%{transform:scale(1.2);color:#80c7ff}100%{transform:scale(1)}}
.land-grade em{font:900 italic 15px/1 var(--display);letter-spacing:.14em;padding:5px 10px;border-radius:999px;color:#091523;background:#d9f0ff;box-shadow:0 0 18px rgba(128,199,255,.6)}
@media(max-width:640px){.land-grade em{font-size:12px;padding:4px 8px}}
@media(prefers-reduced-motion:reduce){#hud #speed.speed-boost{animation:none}}
