.encouragement {
  display: block;
  min-height: 36px;
  margin: 16px auto 0;
  max-width: 900px;
  background: linear-gradient(105deg, var(--lime) 20%, #f5ffd9 48%, var(--lime) 72%);
  background-size: 220% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: var(--lime);
  -webkit-text-fill-color: transparent;
  font-size: clamp(17px, 1.6vw, 27px) !important;
  line-height: 1.05;
  font-weight: 800;
  letter-spacing: -.035em;
  text-shadow: 0 0 14px #c7f36b66;
  transform-origin: center;
  will-change: transform, background-position;
  animation: encouragement-shine 6s ease-in-out infinite, encouragement-pop 2.8s ease-in-out infinite;
}

.display-page.workout-active .encouragement {
  min-height: 40px;
  margin-top: 16px;
  font-size: clamp(18px, 1.8vw, 31px) !important;
}

.display-page.workout-active .next-up {
  position: absolute;
  top: 23%;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  width: clamp(175px, 17vw, 250px);
  min-height: 92px;
  margin: 0;
  padding: 15px 34px 15px 18px;
  border: 1px solid #c7f36b55;
  border-right: 0;
  border-radius: 14px 0 0 14px;
  background: linear-gradient(135deg, #283126ed, #171a1de8 80%);
  box-shadow: 0 12px 30px #0004, inset 0 1px #ffffff12;
  opacity: .84;
  text-align: left;
  transform: translateX(12px);
  z-index: 2;
  animation: next-card-float 4s ease-in-out infinite;
}

.display-page.workout-active .next-up::after {
  content: '›';
  position: absolute;
  right: 13px;
  top: 50%;
  color: var(--lime);
  font-size: 25px;
  transform: translateY(-50%);
}

.display-page.workout-active .next-up span {
  color: var(--lime);
  font-size: 9px;
  letter-spacing: .16em;
}

.display-page.workout-active .next-up strong {
  max-width: 170px;
  color: var(--text);
  font-size: clamp(13px, 1.2vw, 18px);
  line-height: 1.2;
}

@keyframes next-card-float {
  0%, 100% { transform: translateX(12px); }
  50% { transform: translateX(4px); }
}

.countdown-near .exercise-time,
.remote-countdown-near .remote-exercise-time {
  color: var(--orange);
  animation: countdown-pop .55s ease-in-out infinite alternate;
}

.countdown-near .exercise-emoji,
.remote-countdown-near .remote-exercise-emoji {
  animation: countdown-bounce .55s ease-in-out infinite alternate;
}

@keyframes countdown-pop {
  from { transform: scale(1); }
  to { transform: scale(1.07); }
}

@keyframes countdown-bounce {
  from { transform: translateY(0) rotate(-3deg); }
  to { transform: translateY(-8px) rotate(3deg); }
}

@keyframes encouragement-shine {
  from { background-position: 0% center; }
  to { background-position: 220% center; }
}

@keyframes encouragement-pop {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

@media (orientation: landscape) and (max-height: 520px) {
  .encouragement { min-height: 38px; margin-top: 9px; font-size: 28px !important; }
  .display-page.workout-active .encouragement { min-height: 44px; margin-top: 10px; font-size: 34px !important; }
  .display-page.workout-active .next-up { display: none; }
}

.reconnect-overlay {
  display: none;
}

.display-page.remote-disconnected .reconnect-overlay {
  position: absolute;
  left: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 18px 14px 12px;
  border: 1px solid #ff855c66;
  border-left: 0;
  border-bottom: 0;
  border-radius: 0 14px 0 0;
  background: linear-gradient(135deg, #2b211fe8, #171a1de8);
  box-shadow: 0 -10px 28px #0004;
  z-index: 4;
}

.reconnect-qr {
  flex: 0 0 86px;
  width: 86px;
  height: 86px;
  padding: 5px;
  background: #fff;
}

.reconnect-qr canvas,
.reconnect-qr img {
  display: block;
  width: 76px !important;
  height: 76px !important;
}

.reconnect-copy {
  display: grid;
  gap: 5px;
  text-align: left;
}

.reconnect-copy strong {
  color: var(--orange);
  font-size: clamp(13px, 1.4vw, 19px);
}

.reconnect-copy span {
  max-width: 210px;
  color: var(--muted);
  font-size: clamp(11px, 1.1vw, 15px);
  line-height: 1.3;
}

@media (orientation: landscape) and (max-height: 520px) {
  .display-page.remote-disconnected .reconnect-overlay { padding: 7px 12px 8px 8px; gap: 9px; }
  .display-page.remote-disconnected .reconnect-qr { flex-basis: 58px; width: 58px; height: 58px; padding: 3px; }
  .display-page.remote-disconnected .reconnect-qr canvas,
  .display-page.remote-disconnected .reconnect-qr img { width: 52px !important; height: 52px !important; }
}

/* Keep the upcoming exercise visible on every display size. */
@media (max-width: 650px) {
  .display-page.workout-active .next-up {
    display: flex;
    top: auto;
    right: 0;
    bottom: 12px;
    width: min(190px, 72vw);
    min-height: 58px;
    padding: 10px 28px 10px 12px;
    gap: 4px;
    border-radius: 12px 0 0 12px;
  }

  .display-page.workout-active .next-up span { font-size: 8px; }
  .display-page.workout-active .next-up strong { max-width: 145px; font-size: 12px; }
}

@media (orientation: landscape) and (max-height: 520px) {
  .display-page.workout-active .next-up {
    display: flex;
    top: auto;
    right: 0;
    bottom: 8px;
    width: 180px;
    min-height: 52px;
    padding: 8px 26px 8px 10px;
  }
}
