:root {
  --rc-blue: #0878f9;
  --rc-blue-deep: #0458c8;
  --rc-orange: #ff5a00;
  --rc-ink: #07152b;
  --rc-muted: #5f6d82;
  --rc-line: #dce5f2;
  --rc-soft: #f4f8fd;
}

body.ride-completion-open {
  overflow: hidden !important;
}

body.ride-completion-open .bottom-nav,
body.ride-completion-open .bottom-bar,
body.ride-completion-open .gps-footer {
  visibility: hidden !important;
}

#arrivalPremium.arrival-premium {
  position: fixed !important;
  inset: 0 !important;
  z-index: 300000 !important;
  display: none !important;
  align-items: stretch !important;
  justify-content: center !important;
  padding: 0 !important;
  overflow: hidden !important;
  background: rgba(4, 15, 31, .76) !important;
  font-family: Poppins, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--rc-ink);
}

/* Le bilan vit dans #mapSection : neutraliser les règles de mise en page
   appliquées aux enfants directs hors navigation. */
body:not(.navigation-active) #mapSection.block > #arrivalPremium.arrival-premium {
  position: fixed !important;
  inset: 0 !important;
  width: auto !important;
  height: auto !important;
  margin: 0 !important;
  overflow: hidden !important;
  z-index: 300000 !important;
}

#arrivalPremium.arrival-premium.visible {
  display: flex !important;
}

.rc-shell {
  position: relative;
  width: min(100%, 430px);
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  background: #fff;
  isolation: isolate;
}

.rc-view {
  position: absolute;
  inset: 0;
  display: none;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  background: #fff;
}

.rc-view::-webkit-scrollbar { display: none; }
.rc-view.is-active { display: block; animation: rc-in .28s ease both; }

@keyframes rc-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.rc-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
}

.rc-brand img {
  width: 28px;
  height: 28px;
  border-radius: 8px;
}

.rc-icon-button {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(3, 14, 29, .44);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.rc-button {
  min-height: 48px;
  width: 100%;
  border: 1.5px solid var(--rc-blue);
  border-radius: 11px;
  background: #fff;
  color: var(--rc-blue-deep);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .2s ease, filter .2s ease, background .2s ease;
}

.rc-button:active { transform: scale(.985); }
.rc-button:focus-visible, .rc-icon-button:focus-visible, .rc-link:focus-visible, .rc-social:focus-visible, .rc-time:focus-visible {
  outline: 3px solid rgba(8, 120, 249, .28);
  outline-offset: 2px;
}

.rc-button--orange {
  border-color: var(--rc-orange);
  color: #fff;
  background: linear-gradient(135deg, #ff6a00, #ff4b00);
  box-shadow: 0 10px 24px rgba(255, 90, 0, .22);
}

.rc-button--blue {
  border-color: var(--rc-blue);
  color: #fff;
  background: linear-gradient(135deg, #0b82ff, #0868e8);
  box-shadow: 0 10px 24px rgba(8, 120, 249, .2);
}

.rc-button i { margin-right: 8px; }
.rc-link {
  min-height: 44px;
  border: 0;
  background: transparent;
  color: #075ec5;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

/* 1. Fin de balade */
.rc-summary {
  min-height: 100%;
  color: #fff;
  background: #12243a;
}

.rc-summary-hero {
  position: relative;
  min-height: 61vh;
  padding: max(20px, env(safe-area-inset-top)) 18px 150px;
  background-position: center;
  background-size: cover;
}

.rc-summary-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(180deg, rgba(3, 12, 24, .35) 0%, rgba(3, 12, 24, .06) 45%, rgba(3, 12, 24, .8) 100%);
}

.rc-summary-top, .rc-celebration { position: relative; z-index: 1; }
.rc-summary-top { display: flex; align-items: center; justify-content: space-between; }
.rc-celebration { margin-top: 32px; text-align: center; text-shadow: 0 2px 12px rgba(0,0,0,.38); }
.rc-celebration-mark {
  width: 68px;
  height: 68px;
  margin: 0 auto 12px;
  display: grid;
  place-items: center;
  border: 2px solid #ff812f;
  border-radius: 50%;
  color: #fff;
  background: rgba(255, 91, 0, .78);
  box-shadow: 0 0 0 8px rgba(255, 106, 0, .12), 0 0 32px rgba(255, 105, 0, .75);
  font-size: 34px;
}

.rc-celebration h2 { margin: 0; font-size: clamp(28px, 8vw, 35px); line-height: 1.05; color: #fff; }
.rc-route-title { margin: 7px 0 0; font-size: 20px; font-weight: 500; }
.rc-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-top: 15px; }
.rc-stat {
  min-height: 76px;
  padding: 10px 5px;
  display: grid;
  align-content: center;
  gap: 4px;
  border: 1px solid rgba(255,255,255,.55);
  border-radius: 13px;
  background: rgba(255,255,255,.88);
  color: var(--rc-ink);
  text-shadow: none;
  box-shadow: 0 10px 26px rgba(0,0,0,.16);
}
.rc-stat i { color: var(--rc-orange); font-size: 19px; }
.rc-stat strong { font-size: 13px; line-height: 1.15; }
.rc-stat span { font-size: 10px; line-height: 1.15; }

.rc-summary-card {
  position: relative;
  z-index: 2;
  width: calc(100% - 24px);
  margin: -134px auto max(12px, env(safe-area-inset-bottom));
  padding: 14px 12px 10px;
  border-radius: 22px;
  background: rgba(255,255,255,.98);
  color: var(--rc-ink);
  box-shadow: 0 18px 50px rgba(1, 14, 32, .27);
}
.rc-summary-card h3 { margin: 0 0 9px; text-align: center; font-size: 17px; }
.rc-mini-map { height: 118px; overflow: hidden; border-radius: 13px; background: #dfeef2; }
.rc-saved { margin: 8px 0 11px; text-align: center; color: #69778a; font-size: 10px; }
.rc-saved i { margin-right: 5px; }
.rc-actions { display: grid; gap: 9px; }
.rc-actions-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* 2. Badge */
.rc-badge-view { padding: max(17px, env(safe-area-inset-top)) 18px max(16px, env(safe-area-inset-bottom)); }
.rc-page-head { display: flex; align-items: center; gap: 12px; min-height: 44px; }
.rc-page-head .rc-back { background: transparent; color: var(--rc-ink); backdrop-filter: none; }
.rc-page-head h2 { margin: 0; font-size: 17px; }
.rc-progress-caption { margin-top: 9px; display: flex; justify-content: space-between; font-size: 12px; }
.rc-progress-track { position: relative; height: 12px; margin-top: 7px; overflow: hidden; border-radius: 99px; background: #e8ebef; }
.rc-progress-before, .rc-progress-after { position: absolute; inset: 0 auto 0 0; border-radius: inherit; }
.rc-progress-before { width: 38%; background: #137cf3; }
.rc-progress-after { width: 46%; background: linear-gradient(90deg, transparent 82%, var(--rc-orange) 82%); }
.rc-progress-numbers { display: flex; justify-content: space-between; margin-top: 4px; font-size: 10px; color: var(--rc-muted); }
.rc-progress-numbers strong { color: #075dc8; }
.rc-badge-main { text-align: center; padding-top: 4px; }
.rc-badge-image {
  width: min(47vw, 174px);
  aspect-ratio: 1;
  object-fit: contain;
  margin: 0 auto 7px;
  display: block;
  filter: drop-shadow(0 12px 16px rgba(8, 44, 86, .22));
}
.rc-new-badge { display: inline-block; padding: 5px 16px; border-radius: 99px; background: var(--rc-orange); color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .03em; }
.rc-badge-main h3 { margin: 8px 0 2px; font-size: 28px; line-height: 1.1; }
.rc-badge-main p { margin: 0; color: var(--rc-muted); font-size: 12px; }
.rc-discovery {
  margin: 13px 0;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid #cfe0f7;
  border-radius: 13px;
  background: #f1f7ff;
  text-align: left;
  box-shadow: 0 8px 20px rgba(28, 96, 176, .08);
}
.rc-discovery-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; background: var(--rc-blue); color: #fff; }
.rc-discovery strong { display: block; color: #075bc1; font-size: 16px; }
.rc-discovery span { font-size: 12px; }
.rc-stamps { display: flex; justify-content: center; gap: 16px; margin: 8px 0 16px; }
.rc-stamps img { width: 62px; height: 62px; object-fit: contain; }
.rc-stamp-locked { width: 62px; height: 62px; display: grid; place-items: center; border: 2px dashed #b9c0ca; border-radius: 50%; color: #8b929c; font-size: 22px; }
.rc-badge-actions { display: grid; gap: 9px; }
.rc-auto-note { margin: 8px 0 0; text-align: center; color: var(--rc-muted); font-size: 10px; }

/* 3. Partage */
.rc-share-view { background: rgba(5, 16, 31, .66); }
.rc-share-backdrop { min-height: 21vh; background-position: center; background-size: cover; filter: brightness(.55); }
.rc-share-sheet {
  min-height: 79vh;
  margin-top: -18px;
  padding: 10px 18px max(18px, env(safe-area-inset-bottom));
  border-radius: 24px 24px 0 0;
  background: #fff;
  box-shadow: 0 -16px 38px rgba(0,0,0,.19);
}
.rc-sheet-grabber { width: 54px; height: 4px; margin: 0 auto 13px; border-radius: 99px; background: #aeb4bd; }
.rc-share-sheet h2 { margin: 0 0 12px; text-align: center; font-size: 17px; }
.rc-share-preview { position: relative; width: 210px; height: 152px; margin: 0 auto 11px; overflow: hidden; border-radius: 14px; background-position: center; background-size: cover; box-shadow: 0 8px 22px rgba(6, 20, 39, .28); }
.rc-share-preview::after { content:""; position:absolute; inset:0; background: linear-gradient(180deg, transparent 40%, rgba(0,0,0,.72)); }
.rc-share-preview-copy { position: absolute; z-index: 1; left: 13px; right: 13px; bottom: 10px; color: #fff; }
.rc-share-preview-copy strong { display: block; font-size: 21px; line-height: 1.05; }
.rc-share-preview-copy span { font-size: 12px; }
.rc-share-label { margin: 0 0 8px; text-align: center; color: var(--rc-muted); font-size: 11px; }
.rc-socials { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.rc-social { min-height: 65px; border: 0; background: transparent; color: var(--rc-ink); font: inherit; font-size: 9px; cursor: pointer; }
.rc-social i { width: 39px; height: 39px; margin: 0 auto 4px; display: grid; place-items: center; border-radius: 50%; color: #fff; font-size: 22px; }
.rc-social--wa i { background: #25d366; }
.rc-social--fb i { background: #1877f2; }
.rc-social--ig i { background: linear-gradient(135deg, #7b32d7, #ff2851 58%, #ffb000); }
.rc-social--link i { background: #d9dee6; color: #263345; }
.rc-participants { margin: 8px 0 10px; padding-top: 10px; border-top: 1px solid #d9dee6; }
.rc-participants > strong { display: block; margin-bottom: 6px; font-size: 11px; }
.rc-participant-row { display: flex; align-items: center; gap: 10px; }
.rc-avatars { display: flex; }
.rc-avatar { width: 34px; height: 34px; margin-left: -7px; display: grid; place-items: center; border: 2px solid #fff; border-radius: 50%; background: linear-gradient(145deg, #ffb76b, #1967ab); color: #fff; font-size: 10px; font-weight: 700; }
.rc-avatar:first-child { margin-left: 0; }
.rc-participant-row span { color: var(--rc-muted); font-size: 11px; }
.rc-location-card { padding: 11px 12px; border: 1px solid #bcd7fb; border-radius: 12px; background: #f2f7ff; }
.rc-location-head { display: grid; grid-template-columns: 31px 1fr auto; align-items: center; gap: 8px; }
.rc-location-head > i { color: var(--rc-blue); font-size: 18px; }
.rc-location-copy strong { display: block; font-size: 12px; }
.rc-location-copy small { display: block; color: var(--rc-muted); font-size: 9px; }
.rc-switch { position: relative; width: 46px; height: 27px; }
.rc-switch input { position: absolute; opacity: 0; }
.rc-switch span { position: absolute; inset: 0; border-radius: 99px; background: #bdc6d2; transition: .2s; cursor: pointer; }
.rc-switch span::after { content:""; position:absolute; width:21px; height:21px; left:3px; top:3px; border-radius:50%; background:#fff; box-shadow:0 1px 4px rgba(0,0,0,.24); transition:.2s; }
.rc-switch input:checked + span { background: var(--rc-blue); }
.rc-switch input:checked + span::after { transform: translateX(19px); }
.rc-times { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 9px; }
.rc-time { min-height: 30px; border: 1px solid #9db1cc; border-radius: 7px; background: #fff; color: var(--rc-ink); font: inherit; font-size: 10px; cursor: pointer; }
.rc-time.is-selected { border-color: var(--rc-blue); background: var(--rc-blue); color: #fff; }
.rc-privacy { margin-top: 8px; color: var(--rc-muted); font-size: 9px; }
.rc-share-actions { display: grid; gap: 2px; margin-top: 8px; }

/* 4. Retour */
.rc-return-view { overflow: hidden; background: #dceef2; }
.rc-return-map { position: absolute; inset: 0; z-index: 0; background: #dceef2; }
.rc-return-back { position: absolute; z-index: 1001; top: max(15px, env(safe-area-inset-top)); left: 14px; background: #fff; color: var(--rc-ink); box-shadow: 0 4px 16px rgba(3,21,39,.22); backdrop-filter: none; }
.rc-shop-card { position: absolute; z-index: 1001; top: max(14px, env(safe-area-inset-top)); left: 70px; right: 14px; padding: 13px; border-radius: 13px; background: rgba(255,255,255,.96); box-shadow: 0 8px 28px rgba(3,21,39,.23); }
.rc-shop-title { display: grid; grid-template-columns: 40px 1fr; align-items: center; gap: 9px; }
.rc-shop-logo { width: 40px; height: 40px; border-radius: 10px; }
.rc-shop-title strong { display: block; font-size: 14px; }
.rc-shop-title span { display: block; margin-top: 1px; color: #39485b; font-size: 10px; }
.rc-shop-metrics { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 10px; border-top: 1px solid #e1e6ec; padding-top: 9px; }
.rc-shop-metrics span { text-align: center; font-size: 10px; }
.rc-shop-metrics span + span { border-left: 1px solid #dfe4ea; }
.rc-shop-metrics i { color: var(--rc-blue); margin-right: 4px; }
.rc-guidance-card { position: absolute; z-index: 1001; left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); padding: 0 11px 10px; border-radius: 20px; background: rgba(255,255,255,.97); box-shadow: 0 12px 36px rgba(2,17,35,.26); }
.rc-next-turn { margin: 0 -11px 10px; padding: 16px 18px; display: grid; grid-template-columns: 56px 1fr; align-items: center; gap: 10px; border-radius: 20px 20px 0 0; background: linear-gradient(135deg, #0a83ff, #0563df); color: #fff; }
.rc-next-turn i { font-size: 42px; }
.rc-next-turn small, .rc-next-turn strong, .rc-next-turn span { display: block; }
.rc-next-turn small { font-size: 12px; }
.rc-next-turn strong { font-size: 18px; }
.rc-next-turn span { font-size: 10px; opacity: .9; }
.rc-guidance-actions { display: grid; gap: 8px; }
.rc-guidance-note { margin: 6px 0 0; text-align: center; color: #55708f; font-size: 9px; }

.rc-toast {
  position: absolute;
  z-index: 2000;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  max-width: calc(100% - 32px);
  padding: 10px 14px;
  border-radius: 99px;
  background: #071a31;
  color: #fff;
  font-size: 11px;
  text-align: center;
  box-shadow: 0 8px 28px rgba(0,0,0,.28);
  transform: translate(-50%, 18px);
  opacity: 0;
  pointer-events: none;
  transition: .22s ease;
}
.rc-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 350px), (max-height: 700px) {
  .rc-summary-hero { min-height: 64vh; padding-left: 12px; padding-right: 12px; }
  .rc-celebration { margin-top: 14px; }
  .rc-celebration-mark { width: 56px; height: 56px; font-size: 28px; }
  .rc-stats { gap: 6px; }
  .rc-stat { min-height: 67px; }
  .rc-mini-map { height: 92px; }
  .rc-summary-card { margin-top: -121px; }
  .rc-badge-view { padding-left: 12px; padding-right: 12px; }
  .rc-badge-image { width: 128px; }
  .rc-badge-main h3 { font-size: 23px; }
  .rc-discovery { margin: 8px 0; }
  .rc-stamps img, .rc-stamp-locked { width: 52px; height: 52px; }
  .rc-share-backdrop { min-height: 10vh; }
  .rc-share-sheet { min-height: 90vh; padding-left: 13px; padding-right: 13px; }
  .rc-share-preview { width: 174px; height: 112px; }
  .rc-participants { margin: 4px 0 6px; }
}

@media (min-width: 431px) {
  #arrivalPremium.arrival-premium { padding: 20px !important; }
  .rc-shell { height: min(100dvh - 40px, 852px); border-radius: 30px; box-shadow: 0 28px 90px rgba(0,0,0,.38); }
}

@media (prefers-reduced-motion: reduce) {
  .rc-view.is-active { animation: none; }
  .rc-button, .rc-toast, .rc-switch span, .rc-switch span::after { transition: none; }
}
