/* The movie's device frame and the iOS-style pieces its screens are built
   from: the iPhone, status bar, map controls, sheets, Messages, the
   off-route banner, the measure card, the elevation profile strip, the
   highlight ring and the trip map card beside the phone. Topo Sheet look:
   a dark phone with soft shadows on paper, faint contour rings only
   behind the phone. */

.movie-stage {
  position: relative;
  isolation: isolate;
  padding: 18px 0 8px;
  --scale: 0.7;
}

@media (min-width: 900px) {
  .movie-stage {
    --scale: 0.7;
    padding: 0;
  }
}

/* Taller desktop screens get a bigger phone, still above the fold. */
@media (min-width: 900px) and (min-height: 940px) {
  .movie-stage {
    --scale: 0.8;
  }
}

@media (max-width: 340px) {
  .movie-stage {
    --scale: 0.66;
  }
}

/* Contour rings behind the phone only; they fade out before the edge. */
.movie-stage.has-rings .iphone::before {
  content: '';
  position: absolute;
  z-index: -1;
  left: 50%;
  top: 50%;
  width: calc(600px * var(--scale));
  max-width: 100vw;
  height: calc(1100px * var(--scale));
  transform: translate(-50%, -50%);
  background: url('../img/rings.svg') center / 100% 100% no-repeat;
  -webkit-mask-image: radial-gradient(closest-side, #000 55%, transparent 100%);
  mask-image: radial-gradient(closest-side, #000 55%, transparent 100%);
  pointer-events: none;
}

/* iPhone frame: a 390x844 logical screen scaled with --scale (inherited
   from the stage; the satellite scene sets its own). The frame is the
   screen plus a 12px bezel on every side. */
.iphone {
  position: relative;
  width: calc(414px * var(--scale));
  /* Explicit height: the scaled screen's 844px layout box would otherwise
     stretch an aspect-ratio box (content-based minimum size). */
  height: calc(868px * var(--scale));
  border-radius: calc(60px * var(--scale));
  background: linear-gradient(150deg, #2c302d 0%, #121413 30%, #0c0d0d 70%, #1d201e 100%);
  padding: calc(12px * var(--scale));
  box-shadow:
    inset 0 0 0 1.5px #474c48,
    inset 0 0 0 4px #0b0c0c,
    0 2px 4px rgba(31, 42, 34, 0.18),
    0 28px 50px -22px rgba(31, 42, 34, 0.42),
    0 70px 120px -50px rgba(31, 42, 34, 0.5);
  margin: 0 auto;
}

/* Hardware buttons: action and volume on the left edge, side button on the
   right. Drawn as thin slabs behind the frame so only their edges show. */
.iphone::after {
  content: '';
  position: absolute;
  z-index: -1;
  top: 0;
  bottom: 0;
  left: calc(-3px * var(--scale));
  right: calc(-3px * var(--scale));
  --hw: linear-gradient(90deg, #1b1d1c, #3a3e3b 50%, #1b1d1c);
  background:
    var(--hw) left 0 top calc(150px * var(--scale)) / calc(8px * var(--scale)) calc(32px * var(--scale)) no-repeat,
    var(--hw) left 0 top calc(214px * var(--scale)) / calc(8px * var(--scale)) calc(58px * var(--scale)) no-repeat,
    var(--hw) left 0 top calc(286px * var(--scale)) / calc(8px * var(--scale)) calc(58px * var(--scale)) no-repeat,
    var(--hw) right 0 top calc(244px * var(--scale)) / calc(8px * var(--scale)) calc(96px * var(--scale)) no-repeat;
  pointer-events: none;
}

.iphone .screen {
  width: 390px;
  height: 844px;
  transform: scale(var(--scale));
  transform-origin: top left;
  border-radius: 48px;
  overflow: hidden;
  position: relative;
  background: #e9eedf;
}

.iphone .island {
  position: absolute;
  top: 11px;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 34px;
  border-radius: 20px;
  background: #000;
  z-index: 10;
}

/* The phone buzzes: a short shake when the off-route warning fires. */
.iphone.buzz {
  animation: buzz 0.6s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes buzz {
  10%, 90% { transform: translateX(-2px) rotate(-0.4deg); }
  20%, 80% { transform: translateX(4px) rotate(0.6deg); }
  30%, 50%, 70% { transform: translateX(-6px) rotate(-0.8deg); }
  40%, 60% { transform: translateX(6px) rotate(0.8deg); }
}

/* iOS system look: shared components used inside .iphone .screen. */
.glass {
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(18px);
  border-radius: 14px;
}

.sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(18px);
  border-radius: 20px 20px 0 0;
  padding: 20px;
  transform: translateY(100%);
  transition: transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.sheet.open {
  transform: translateY(0);
}

.toggle {
  position: relative;
  width: 51px;
  height: 31px;
  border-radius: 999px;
  background: #e5e5ea;
  transition: background 0.2s;
}

.toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
  transition: left 0.2s;
}

.toggle.on {
  background: #34c759;
}

.toggle.on::after {
  left: 22px;
}

.btn-round {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Tap dot: a brief pulse where the scene "taps" the mock screen. */
.tap {
  position: absolute;
  z-index: 4;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(31, 42, 34, 0.22);
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(31, 42, 34, 0.25);
  transform: translate(-50%, -50%);
  pointer-events: none;
  animation: tap-pulse 0.42s ease-out;
}

@keyframes tap-pulse {
  from {
    transform: translate(-50%, -50%) scale(0.4);
    opacity: 1;
  }
  to {
    transform: translate(-50%, -50%) scale(1.3);
    opacity: 0;
  }
}

/* A state applied "instantly" by the movie (jumping chapters): no transitions. */
.movie-stage.instant *,
.movie-stage.instant *::before,
.movie-stage.instant *::after {
  transition: none !important;
}

/* The signal flip keeps its own steady rhythm through jumps. */
.movie-stage.instant *:not(.sb-bars):not(.sb-nosvc),
.movie-stage.instant *::before,
.movie-stage.instant *::after {
  animation: none !important;
}

.iphone .screen {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', Inter, system-ui, sans-serif;
  color: #000;
  -webkit-font-smoothing: antialiased;
}

.iphone .screen svg.map {
  position: absolute;
  inset: 0;
  width: 390px;
  height: 844px;
  max-width: none;
}

.iphone .island {
  z-index: 40;
}

/* iOS status bar */
.sb {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 26px 0 48px;
  z-index: 39;
  font-weight: 600;
  font-size: 17px;
  pointer-events: none;
}

.sb-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Signal spot: "No Service" and one weak bar share a grid cell and
   cross-fade every 1.5 s (a 3 s cycle, 0.15 s fades). Never full bars. */
.sb-sig {
  display: inline-grid;
  align-items: center;
}

.sb-sig > span {
  grid-area: 1 / 1;
  justify-self: end;
}

.sb-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 12px;
  opacity: 0;
  animation: sb-bar 3s linear infinite;
}

.sb-bars i {
  width: 3.5px;
  border-radius: 1px;
  background: rgba(0, 0, 0, 0.2);
}

.sb-bars i:nth-child(1) { height: 4px; background: #000; }
.sb-bars i:nth-child(2) { height: 6.5px; }
.sb-bars i:nth-child(3) { height: 9px; }
.sb-bars i:nth-child(4) { height: 12px; }

.sb-nosvc {
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  animation: sb-text 3s linear infinite;
}

@keyframes sb-text {
  0%, 45% { opacity: 1; }
  50%, 95% { opacity: 0; }
  100% { opacity: 1; }
}

@keyframes sb-bar {
  0%, 45% { opacity: 0; }
  50%, 95% { opacity: 1; }
  100% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .sb-bars,
  .sb-nosvc {
    animation: none;
  }
}

.sb-batt {
  position: relative;
  width: 26px;
  height: 12.5px;
  border: 1.3px solid rgba(0, 0, 0, 0.45);
  border-radius: 4px;
  padding: 1.3px;
}

.sb-batt::after {
  content: '';
  position: absolute;
  right: -3.6px;
  top: 3.4px;
  width: 1.8px;
  height: 4px;
  border-radius: 0 1px 1px 0;
  background: rgba(0, 0, 0, 0.45);
}

.sb-batt i {
  display: block;
  width: 78%;
  height: 100%;
  border-radius: 2px;
  background: #000;
}

.home-ind {
  position: absolute;
  bottom: 8px;
  left: 50%;
  width: 134px;
  height: 5px;
  margin-left: -67px;
  border-radius: 3px;
  background: #000;
  z-index: 39;
  pointer-events: none;
}

/* Main-map glass controls, bottom right (MapScreen: 44pt circles, 4pt apart). */
.mapbtns {
  position: absolute;
  right: 12px;
  bottom: 160px;
  display: flex;
  gap: 4px;
  z-index: 5;
}

.mapbtns .btn-round {
  color: #000;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

.mapbtns .btn-round svg {
  width: 23px;
  height: 23px;
}

.mapbtns .btn-round.accent {
  color: #007aff;
}

.mv-screen .fireline {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

.mv-screen .perim,
.mv-screen .flame {
  opacity: 0;
}

.mv-screen.fire .fireline {
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.9s ease-out;
}

.mv-screen.fire .perim,
.mv-screen.fire .flame {
  opacity: 1;
  transition: opacity 0.4s 0.8s;
}

/* iOS sheets (Satellite check, Satellite reply): grouped form look. */
.ios-sheet {
  top: 58px;
  padding: 0;
  z-index: 10;
  background: #f2f2f7;
  border-radius: 12px 12px 0 0;
  box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  backdrop-filter: none;
}

/* In the movie the sheets float above the docked elevation strip. */
.ios-sheet.float {
  left: 8px;
  right: 8px;
  bottom: 150px;
  border-radius: 26px;
  box-shadow: 0 10px 40px -8px rgba(0, 0, 0, 0.35);
  transform: translateY(calc(100% + 170px));
}

.ios-sheet.float.open {
  transform: none;
}

.ios-sheet.result {
  top: 432px;
}

.ios-sheet.result .form {
  padding-bottom: 0;
}

.ios-sheet .grabber {
  width: 36px;
  height: 5px;
  border-radius: 3px;
  background: rgba(60, 60, 67, 0.3);
  margin: 5px auto 0;
}

.ios-sheet .navtitle {
  text-align: center;
  font-size: 17px;
  font-weight: 600;
  padding: 10px 0 8px;
}

.ios-sheet .form {
  flex: 1;
  overflow: hidden;
  padding: 0 16px 40px;
}

.ios-sheet .fhead {
  font-size: 13px;
  text-transform: uppercase;
  color: rgba(60, 60, 67, 0.73);
  padding: 12px 16px 5px;
}

.ios-sheet .fhead.big {
  text-transform: none;
  font-size: 17px;
  font-weight: 600;
  color: #000;
  padding: 12px 4px 6px;
}

.ios-sheet .fsec {
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  margin-top: 8px;
}

.ios-sheet .fhead + .fsec {
  margin-top: 0;
}

.ios-sheet .frow {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 5px 16px;
  font-size: 16px;
  border-top: 0.5px solid rgba(60, 60, 67, 0.22);
}

.ios-sheet .fsec > .frow:first-child,
.ios-sheet .fsec > div:first-child > .frow:first-child {
  border-top: none;
}

.ios-sheet .frow .flabel {
  flex: 1;
}

.ios-sheet .frow .flabel.small {
  font-size: 14px;
  color: rgba(60, 60, 67, 0.75);
}

.ios-sheet .frow.note {
  font-size: 13px;
  line-height: 1.35;
  color: rgba(60, 60, 67, 0.71);
  padding-top: 9px;
  padding-bottom: 9px;
}

.ios-sheet .toggle {
  flex: none;
}

.ios-sheet .qm {
  display: flex;
  color: rgba(60, 60, 67, 0.6);
}

.ios-sheet .qm svg,
.ios-sheet .frow > svg {
  width: 20px;
  height: 20px;
  flex: none;
}

.ios-sheet .send {
  color: #007aff;
  font-size: 16px;
  transition: color 0.2s;
}

.ios-sheet .send.dis {
  color: rgba(60, 60, 67, 0.3);
}

/* Secondary text: rgba(60,60,67,0.71) on white is 4.61:1 and
   rgba(60,60,67,0.73) on the grouped gray #f2f2f7 is 4.60:1. */

.ios-sheet .seg {
  flex: 1;
  display: flex;
  background: rgba(118, 118, 128, 0.12);
  border-radius: 9px;
  padding: 2px;
}

.ios-sheet .seg span {
  flex: 1;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 0;
  border-radius: 7px;
  transition: background 0.2s, box-shadow 0.2s;
}

.ios-sheet .seg span.on {
  background: #fff;
  font-weight: 600;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12), 0 0 0 0.5px rgba(0, 0, 0, 0.04);
}

/* Satellite reply rows */
.ios-sheet .age {
  font-size: 13px;
  color: rgba(60, 60, 67, 0.73);
  padding: 4px 4px 0;
}

.ios-sheet .wx .temp {
  font: 700 44px/1 ui-rounded, 'SF Pro Rounded', -apple-system, system-ui, sans-serif;
  letter-spacing: -1px;
}

.ios-sheet .wx .wxcol {
  flex: 1;
  display: flex;
  flex-direction: column;
  font-size: 15px;
  line-height: 1.35;
}

.ios-sheet .wx .sec {
  color: rgba(60, 60, 67, 0.71);
}

.ios-sheet .frow.fire {
  color: #e53935;
}

.ios-sheet.result .frow {
  min-height: 42px;
}

.ios-sheet.result .fhead.big {
  padding: 8px 4px 5px;
}

/* Messages (compose and thread) */
.msgscr {
  z-index: 12;
  background: #fff;
  display: flex;
  flex-direction: column;
  padding-top: 54px;
  transform: translateY(100%);
  transition: transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.msgscr.show {
  transform: none;
}

#mv-reply.msgscr {
  transform: none;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s;
}

#mv-reply.msgscr.show {
  opacity: 1;
}

.msgscr .mhead {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 8px 16px;
  font-size: 17px;
}

.msgscr .cancel {
  color: #007aff;
}

.msgscr .mtitle {
  font-weight: 600;
}

.msgscr .to {
  padding: 10px 16px;
  border-top: 0.5px solid #d1d1d6;
  border-bottom: 0.5px solid #d1d1d6;
  font-size: 16px;
  color: rgba(60, 60, 67, 0.71);
}

.msgscr .tok {
  color: #007aff;
  margin-left: 4px;
}

.msgscr .thread-head {
  border-bottom: 0.5px solid #d1d1d6;
  padding-bottom: 10px;
  background: #f7f7f7;
}

.msgscr .back {
  display: flex;
  color: #007aff;
}

.msgscr .back svg {
  width: 22px;
  height: 22px;
}

.msgscr .who {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.msgscr .who small {
  font-size: 11px;
}

.msgscr .avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(#a5abb8, #858994);
}

.msgscr .thread {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 12px 14px;
  gap: 4px;
}

.msgscr .sat {
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px 5px 9px;
  margin-bottom: 14px;
  border-radius: 999px;
  background: #1a7f37;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}

.msgscr .sat svg {
  width: 15px;
  height: 15px;
}

#mv-msg.sending .sat {
  animation: sat-pulse 0.9s ease-in-out infinite;
}

@keyframes sat-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(26, 127, 55, 0.55); }
  50% { box-shadow: 0 0 0 9px rgba(26, 127, 55, 0); }
}

.msgscr .bubble {
  max-width: 78%;
  padding: 8px 13px;
  border-radius: 18px;
  font-size: 16px;
  line-height: 1.3;
  word-break: break-word;
}

/* Sent SMS bubble: iOS SMS green, darkened so white text reaches 4.5:1
   (#198639 with #fff is 4.66:1; the bright #34c759 would be 2.22:1). */
.msgscr .bubble.out {
  align-self: flex-end;
  background: #198639;
  color: #fff;
}

.msgscr .bubble.small {
  font-size: 15px;
}

#mv-msg .bubble.out {
  display: none;
}

#mv-msg.sending .bubble.out,
#mv-msg.sent .bubble.out {
  display: block;
  animation: bubble-in 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}

#mv-msg.sent .bubble.out {
  animation: none;
}

@keyframes bubble-in {
  from { transform: translateY(40px) scale(0.9); opacity: 0.4; }
  to { transform: none; opacity: 1; }
}

.msgscr .dstatus {
  align-self: flex-end;
  font-size: 11px;
  color: rgba(60, 60, 67, 0.71);
  min-height: 14px;
  margin-bottom: 8px;
}

.msgscr .bubble.in {
  align-self: flex-start;
  background: #e9e9eb;
  color: #000;
  opacity: 0;
  transform: translateX(-30px);
  transition: opacity 0.35s, transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}

#mv-reply.arrived .bubble.in {
  opacity: 1;
  transform: none;
}

.msgscr .link {
  color: #007aff;
  text-decoration: underline;
}

.msgscr .compose {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 12px 38px;
}

.msgscr .cfield {
  flex: 1;
  border: 1px solid #d1d1d6;
  border-radius: 18px;
  padding: 7px 12px;
  font-size: 16px;
  line-height: 1.3;
  word-break: break-word;
}

.msgscr .cfield.ph {
  color: rgba(60, 60, 67, 0.3);
}

#mv-msg.sending .cfield,
#mv-msg.sent .cfield {
  color: transparent;
  height: 36px;
  overflow: hidden;
}

.msgscr .csend {
  display: flex;
  color: #007aff;
  flex: none;
}

.msgscr .csend.dim,
#mv-msg.sending .csend,
#mv-msg.sent .csend {
  color: #c7c7cc;
}

.msgscr .csend svg {
  width: 32px;
  height: 32px;
}

/* ================================================================
   Map marks: measure dot, blue along-trail section, label card,
   off-route banner and the line back. Positions are 390x844 screen px.
   ================================================================ */

.tp-me {
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.35));
}

.tp-dot {
  opacity: 0;
  transition: transform 0.6s cubic-bezier(0.3, 0.7, 0.2, 1), opacity 0.2s;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.3));
}

.dot-on .tp-dot {
  opacity: 1;
}

/* From you (F_ME 0.476) to the dot (F_DOT 0.62): a 0.144 dash. */
/* Hidden when off: a zero-length dash with a round cap would still draw a dot. */
.tp-sec {
  stroke-dasharray: 0 2;
  opacity: 0;
  transition: stroke-dasharray 1s ease-in-out, opacity 0.15s;
}

.sec-on .tp-sec {
  stroke-dasharray: 0.144 2;
  opacity: 0.95;
}

.tp-back {
  stroke-dasharray: 1 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 0.8s ease-in-out;
}

.back-on .tp-back {
  stroke-dashoffset: 0;
}

.tp-tapat {
  position: absolute;
  width: 36px;
  height: 36px;
  margin: -18px 0 0 -18px;
  pointer-events: none;
}

.tp-card {
  position: absolute;
  z-index: 6;
  padding: 10px 16px 11px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.97);
  color: #111;
  box-shadow: 0 12px 26px -10px rgba(0, 0, 0, 0.4);
  font-size: 15px;
  line-height: 1.3;
  white-space: nowrap;
  transform-origin: 50% 100%;
  transform: translate(-50%, calc(-100% - 20px)) scale(0.9);
  opacity: 0;
  transition: opacity 0.3s, transform 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

.tp-card::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -7px;
  width: 14px;
  height: 14px;
  margin-left: -7px;
  background: inherit;
  transform: rotate(45deg);
  border-radius: 2px;
}

.card-on .tp-card {
  opacity: 1;
  transform: translate(-50%, calc(-100% - 20px)) scale(1);
}

.tp-card-name,
.tp-card-sub {
  font-weight: 600;
  color: rgba(60, 60, 67, 0.85);
}

.tp-card-big {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.015em;
  margin: 1px 0 2px;
}

.tp-banner {
  position: absolute;
  z-index: 8;
  top: 58px;
  left: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.96);
  color: #111;
  box-shadow: 0 14px 30px -12px rgba(0, 0, 0, 0.4);
  font-size: 16px;
  line-height: 1.3;
  transform: translateY(-170%);
  opacity: 0;
  transition: transform 0.5s cubic-bezier(0.2, 0.9, 0.25, 1.1), opacity 0.3s;
}

.banner-on .tp-banner {
  transform: none;
  opacity: 1;
}

.tp-warn {
  flex: none;
  display: flex;
  color: #e65100;
}

.tp-warn svg {
  width: 34px;
  height: 34px;
}

/* ================================================================
   Movie phone: map world, elevation strip, highlight ring
   ================================================================ */

.mv-screen .world {
  position: absolute;
  inset: 0;
  background: #e9eedf;
  transition: transform 0.7s cubic-bezier(0.3, 0.7, 0.2, 1);
}

.mv-screen.panned .world {
  transform: translateY(var(--pan, 0px));
}

.mv-screen .msgscr {
  position: absolute;
  inset: 0;
}

/* Messages avatar for the BackpackMap contact: the app's antenna glyph. */
.msgscr .avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: linear-gradient(#3f8a4c, #2f6b3a);
}

.msgscr .avatar svg {
  width: 24px;
  height: 24px;
}

/* Elevation profile strip, docked along the bottom of the screen like the
   app's ElevationProfileView: green line and fill, mi/ft axes, a blue
   point for you and a red point for the measure dot. */
.elev {
  position: absolute;
  z-index: 9;
  left: 10px;
  right: 10px;
  bottom: 26px;
  height: 118px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 6px 22px -8px rgba(0, 0, 0, 0.3), 0 0 0 0.5px rgba(0, 0, 0, 0.06);
}

.elev svg {
  width: 100%;
  height: 100%;
  max-width: none;
}

.elev .eg {
  stroke: rgba(60, 60, 67, 0.14);
  stroke-width: 1;
}

.elev .et {
  font: 500 10.5px/1 -apple-system, BlinkMacSystemFont, 'SF Pro Text', Inter, system-ui, sans-serif;
  fill: rgba(60, 60, 67, 0.78);
}

.elev .eu {
  font-weight: 700;
}

.elev .esec {
  fill: rgba(30, 136, 229, 0.28);
  opacity: 0;
  transition: opacity 0.6s;
}

.sec-on .elev .esec {
  opacity: 1;
}

.elev .eyou {
  transition: cx 0.3s linear, cy 0.3s linear;
}

.elev .ered {
  opacity: 0;
  transition: opacity 0.4s;
}

.elev .etag {
  opacity: 0;
  transition: opacity 0.4s 0.3s;
}

.elev .etag text {
  font: 700 12px/1 -apple-system, BlinkMacSystemFont, 'SF Pro Text', Inter, system-ui, sans-serif;
  fill: #fff;
}

.dot-on .elev .ered,
.red-on .elev .ered,
.red-on .elev .etag {
  opacity: 1;
}

/* Highlight ring: a thin trail-green outline around the subject. */
.hl {
  position: absolute;
  z-index: 30;
  border-radius: 18px;
  border: 3px solid rgba(47, 107, 58, 0.9);
  box-shadow: 0 0 0 6px rgba(47, 107, 58, 0.14);
  opacity: 0;
  transition: opacity 0.35s;
  pointer-events: none;
}

.hl.on {
  opacity: 1;
}

/* ================================================================
   Trip map card: the web page at home, beside the phone
   ================================================================ */

/* Desktop: under the caption panel in the caption third. Narrow
   screens: over the phone's lower half, just above the caption panel. */
.tripcard {
  position: absolute;
  z-index: 3;
  left: 0;
  top: calc(100% + 16px);
  width: min(100%, 270px);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 2px 4px rgba(31, 42, 34, 0.12), 0 30px 60px -24px rgba(31, 42, 34, 0.5), inset 0 0 0 1px rgba(0, 0, 0, 0.06);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, system-ui, sans-serif;
  color: #222;
  opacity: 0;
  transform: translateY(16px) scale(0.97);
  transition: opacity 0.4s, transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
  pointer-events: none;
}

.tripcard.in {
  opacity: 1;
  transform: none;
}

.tc-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  background: #e4e4e8;
}

.tc-dots {
  display: flex;
  gap: 5px;
}

.tc-dots i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ff5f57;
}

.tc-dots i:nth-child(2) { background: #febc2e; }
.tc-dots i:nth-child(3) { background: #28c840; }

.tc-tab {
  font-size: 11.5px;
  font-weight: 600;
  color: #333;
  white-space: nowrap;
}

.tc-map {
  width: 100%;
  height: 118px;
  max-width: none;
}

.tc-pin {
  opacity: 0;
  transform: translateY(-40px);
  transform-box: fill-box;
}

.tripcard.in .tc-pin.old {
  opacity: 1;
  transform: none;
  transition: opacity 0.2s, transform 0.5s cubic-bezier(0.3, 1.6, 0.5, 1);
}

.tripcard.pinned .tc-pin.camp {
  opacity: 1;
  transform: none;
  transition: opacity 0.2s, transform 0.55s cubic-bezier(0.3, 1.6, 0.5, 1);
}

.tc-foot {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 9px 12px 11px;
  font-size: 12px;
  line-height: 1.35;
  color: #444;
}

.tc-foot b {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #2e7d32;
}

.tc-mail {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 4px;
  color: #1565c0;
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.4s 0.6s;
}

.tripcard.pinned .tc-mail {
  opacity: 1;
}

.tc-mail svg {
  width: 14px;
  height: 14px;
  transform: scaleX(-1);
}

@media (max-width: 899px) {
  .tripcard {
    top: auto;
    bottom: calc(100% + 340px);
    left: 50%;
    width: 250px;
    margin-left: -125px;
  }
}
