/* PWR Recovery Mode styles (namespaced: .pwr-rm) */

/* Inherit PWR brand tokens when available; provide sensible fallbacks */
.pwr-rm {
  /* Brand mapping */
  --pwr-rm-accent: var(--pwr-primary, #6aa9ff);
  --pwr-rm-radius: var(--pwr-radius, 16px);
  --pwr-rm-radius-lg: 20px;
  --pwr-rm-gap: 16px;
  --pwr-rm-pad: 16px;
  --pwr-rm-shadow: var(--pwr-shadow-1, 0 6px 24px rgba(0,0,0,0.25));
  --pwr-rm-bg: var(--pwr-bg, #000000);
  --pwr-rm-surface: var(--pwr-surface, #15171c);
  --pwr-rm-text: var(--pwr-text, #e8ecf1);
  --pwr-rm-text-sub: var(--pwr-text-dim, #b8bec7);
  --pwr-rm-border: var(--pwr-border, #2a2f38);
  --pwr-rm-chip: var(--pwr-surface, #15171c);
  --pwr-rm-chip-text: var(--pwr-text-dim, #b8bec7);
  --pwr-rm-success: var(--pwr-green, #2dd4bf);
  --pwr-rm-warn: var(--pwr-yellow, #f6c453);
  --pwr-rm-danger: var(--pwr-red, #ff5d6c);
  --pwr-rm-outline: var(--pwr-outline, 2px solid #2a72ff40);
  --rm-halo: rgba(165,207,255,0.25);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  color: var(--pwr-rm-text);
}

/* Theme switch support (defaults to dark brand) */
.pwr-rm[data-theme="light"] {
  --pwr-rm-bg: #ffffff;
  --pwr-rm-surface: #ffffff;
  --pwr-rm-text: #0f172a;
  --pwr-rm-text-sub: #475569;
  --pwr-rm-border: #e2e8f0;
  --pwr-rm-chip: #f1f5f9;
  --pwr-rm-chip-text: #0f172a;
  --pwr-rm-shadow: 0 6px 24px rgba(0,0,0,0.08), 0 2px 8px rgba(0,0,0,0.06);
}
.pwr-rm[data-theme="auto"] { color-scheme: light dark; }
@media (prefers-color-scheme: dark) {
  .pwr-rm[data-theme="auto"] {
    --pwr-rm-bg: var(--pwr-bg, #000000);
    --pwr-rm-surface: var(--pwr-surface, #15171c);
    --pwr-rm-text: var(--pwr-text, #e8ecf1);
    --pwr-rm-text-sub: var(--pwr-text-dim, #b8bec7);
    --pwr-rm-border: var(--pwr-border, #2a2f38);
    --pwr-rm-chip: var(--pwr-surface, #15171c);
    --pwr-rm-chip-text: var(--pwr-text-dim, #b8bec7);
    --pwr-rm-shadow: var(--pwr-shadow-1, 0 6px 24px rgba(0,0,0,0.25));
  }
}

/* Blend into existing dark canvas (section transparent) */
.pwr-rm { background: transparent; padding: 16px; border-radius: 0; margin: 0; min-height: 100dvh; }
.pwr-rm__app { max-width: none; margin: 0; }
.pwr-rm__title { margin: 0 0 12px; font-size: var(--pwr-h2, 20px); font-weight: 700; letter-spacing: 0.2px; color: var(--pwr-text, #e8ecf1); }
/* Header (logo left, centered title, avatar right) */
.pwr-rm .pwr-header { position: relative; display: flex; align-items: center; gap: 8px; }
.pwr-rm .pwr-header .pwr-logo { width: 56px; height: auto; flex: 0 0 auto; }
.pwr-rm .pwr-header-title { all: unset; position: absolute; left: 50%; transform: translateX(-50%); color: #ffffff; font-weight: 700; display: inline-flex; align-items: center; }
.pwr-rm .pwr-header-chevron { margin-left: 6px; opacity: .9; }
/* Ensure the new down arrow icon is small and aligned */
.pwr-rm .pwr-header-arrow { width: 12px; height: auto; margin-left: 6px; opacity: .9; display: inline-block; vertical-align: middle; }
.pwr-rm .pwr-indicator { display: none !important; }
/* Push avatar to far right */
.pwr-rm .pwr-header .pwr-avatar-mini { margin-left: auto; flex: 0 0 auto; }

.pwr-rm__grid { display: grid; grid-template-columns: 1fr; gap: var(--pwr-rm-gap); }
@media (min-width: 720px) { .pwr-rm__grid { grid-template-columns: 1.1fr 0.9fr; } }
@media (min-width: 1024px) { .pwr-rm__grid { grid-template-columns: 1.2fr 0.8fr; grid-auto-flow: dense; } }

.pwr-rm__card { background: var(--pwr-rm-surface); border: 1px solid var(--pwr-rm-border); border-radius: var(--pwr-rm-radius); padding: var(--pwr-rm-pad); box-shadow: var(--pwr-rm-shadow); }
.pwr-rm[data-compact="true"] .pwr-rm__card { padding: 12px; border-radius: 14px; }

/* Momentum meter */
.pwr-rm__momentum { display: flex; flex-direction: column; gap: 12px; }
.pwr-rm__meter { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; }
.pwr-rm__meter-bar { position: relative; height: 10px; border-radius: 999px; background: #1c2129; border: 1px solid var(--pwr-rm-border); overflow: hidden; }
.pwr-rm__meter-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0%; background: linear-gradient(90deg, #8bd5ff, var(--pwr-primary, #4d90f9)); box-shadow: 0 0 16px color-mix(in oklab, var(--pwr-rm-accent) 45%, transparent) inset; border-radius: 999px; transition: width 600ms ease; }
.pwr-rm[data-animate="false"] .pwr-rm__meter-fill { transition: none; }
@media (prefers-reduced-motion: reduce) { .pwr-rm__meter-fill { transition: none !important; } }

.pwr-rm__meter-info { display: flex; align-items: baseline; gap: 8px; }
.pwr-rm__meter-label { font-size: 12px; color: var(--pwr-rm-text-sub); text-transform: uppercase; letter-spacing: 0.6px; }
.pwr-rm__meter-score { font-size: clamp(18px, 3.2vw, 28px); font-weight: 800; }
.pwr-rm__meter-delta { font-size: 12px; padding: 2px 6px; border-radius: 999px; background: var(--pwr-rm-surface); color: var(--pwr-rm-chip-text); border: 1px solid var(--pwr-rm-border); }

.pwr-rm__reasons { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.pwr-rm__reason { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; background: var(--pwr-rm-surface); color: var(--pwr-rm-chip-text); border: 1px solid var(--pwr-rm-border); font-size: 13px; }
.pwr-rm__reason-emoji { font-size: 14px; }

/* Quest */
.pwr-rm__quest { display: flex; flex-direction: column; gap: 10px; }
.pwr-rm__quest-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pwr-rm__quest-title { margin: 0; font-size: clamp(16px, 2.6vw, 18px); }
.pwr-rm__quest-chip { font-size: 12px; padding: 4px 10px; border-radius: 999px; color: #0b1020; background: linear-gradient(180deg, #e0f2ff, #b3d9ff); border: 1px solid #94c9ff; }
.pwr-rm__quest-sub { margin: 0; color: var(--pwr-rm-text-sub); }
.pwr-rm__btn { align-self: start; appearance: none; border: 0; background: linear-gradient(180deg, var(--pwr-rm-accent), var(--pwr-primary-600, #4d90f9)); color: #0b1020; padding: 12px 18px; border-radius: 999px; font-weight: 700; cursor: pointer; box-shadow: 0 8px 16px rgba(77,144,249,0.25), inset 0 0 0 1px rgba(0,0,0,0.1); transition: transform 160ms ease, filter 160ms ease; }
.pwr-rm__btn:hover { transform: translateY(-1px); filter: brightness(1.05); }
.pwr-rm__btn:active { transform: translateY(0); }
.pwr-rm__btn:focus-visible { outline: var(--pwr-rm-outline); outline-offset: 2px; }
.pwr-rm[data-animate="false"] .pwr-rm__btn { transition: none; }
@media (prefers-reduced-motion: reduce) { .pwr-rm__btn { transition: none !important; } }
.pwr-rm__btn[aria-pressed="true"] { filter: brightness(0.98); }
.pwr-rm__btn-note { font-size: 12px; color: var(--pwr-rm-text-sub); }

/* Pod pulse */
.pwr-rm__pod { position: relative; overflow: hidden; display: grid; gap: 10px; }
.pwr-rm__pod-pulse { --pod-alpha: 0.20; --pod-scale: 1; position: relative; height: 120px; border-radius: 14px; background: radial-gradient( 120px 120px at 50% 50%, color-mix(in oklab, var(--pwr-rm-accent) 85%, transparent) var(--pod-alpha), transparent 60% ); border: 1px solid var(--pwr-rm-border); background-color: #0f141b; filter: blur(0.2px); }
.pwr-rm__pod .pwr-rm__pod-pulse::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: radial-gradient( 120px 120px at 50% 50%, color-mix(in oklab, var(--pwr-rm-accent) 55%, transparent) calc(var(--pod-alpha) * 1%), transparent 60% ); transform: scale(var(--pod-scale)); opacity: 0.7; }
@keyframes pwr-rm-pulse { 0%,100% { transform: scale(1); opacity: 0.7; } 50% { transform: scale(1.06); opacity: 1; } }
.pwr-rm[data-animate="true"] .pwr-rm__pod-pulse::after { animation: pwr-rm-pulse 2.4s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .pwr-rm__pod-pulse::after { animation: none !important; } }
.pwr-rm__pod-caption { font-size: 14px; color: var(--pwr-rm-text-sub); }

/* Streak */
.pwr-rm__streak-row { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; }
.pwr-rm__streak-icon { font-size: 18px; }
.pwr-rm__confetti { position: relative; height: 0; }
.pwr-rm__confetti-piece { position: absolute; width: 8px; height: 8px; will-change: transform, opacity; border-radius: 1px; opacity: 0; }
@keyframes pwr-rm-confetti { 0% { transform: translateY(0) rotate(0deg); opacity: 1; } 100% { transform: translateY(120px) rotate(540deg); opacity: 0; } }

/* Story */
.pwr-rm__story { display: block; }
.pwr-rm[data-show-story="false"] .pwr-rm__story { display: none; }
.pwr-rm__story-title { margin: 0 0 8px; font-size: var(--pwr-h3, 18px); }
.pwr-rm__story-points { margin: 0 0 8px; padding-left: 18px; }
.pwr-rm__story-meta { display: flex; flex-wrap: wrap; gap: 8px; color: var(--pwr-rm-text-sub); font-size: 13px; }
.pwr-rm__story-meta span::after { content: "•"; margin: 0 6px; color: var(--pwr-rm-border); }
.pwr-rm__story-meta span:last-child::after { content: ""; }

/* Narrative copy helpers */
.pwr-rm__identity { color: var(--pwr-rm-text-sub); font-size: 13px; margin-bottom: 4px; }
.pwr-rm__headline { margin: 0 0 10px; font-size: var(--pwr-h3, 18px); }
.pwr-rm__coach { margin: 36px 0 28px; color: var(--pwr-rm-text-sub); font-size: 30px; line-height: 1.15; text-align: center; }

/* Plain hero card (no background/border/shadow) */
.pwr-rm .card.is-plain { background: transparent; border: 0; box-shadow: none; padding: 0; }
.pwr-rm .card.is-plain .card-body { padding: 0; }

/* Dial (hero) */
.pwr-rm__dial { display:none; }
.pwr-rm .momentum-hero { position:relative; display:grid; place-items:center; margin: 24px auto 12px; width:100%; }
.pwr-rm .momentum-ring { position: relative; width: clamp(200px, 70vw, 320px); height:auto; filter: drop-shadow(0 0 18px rgba(165,207,255,0.26)); display:block; }
.pwr-rm .ring-svg { width:100%; height:100%; display:block; transform-origin:50% 50%; will-change:transform; animation: ringPulse 5s ease-in-out infinite }
.pwr-rm .ring-track { fill:none; stroke: rgba(255,255,255,0.08); stroke-width: 8; }
.pwr-rm .ring-live { fill:none; stroke: #ffffff; stroke-opacity: .95; stroke-width: 10; stroke-linecap: round; filter: url(#ringGlow); transform-origin: 100px 100px; animation: pwrSpin 8s linear infinite; }
.pwr-rm .ring-plasma { fill:none; stroke-linecap:round; filter:url(#ringGlow); transform-origin:100px 100px; will-change: transform; shape-rendering:geometricPrecision }
.pwr-rm .ring-plasma--a { stroke:#ffffff; stroke-opacity:.9; stroke-width:8; stroke-dasharray:70 430; animation: plasmaSpin 6s linear infinite, pwrThick 5s ease-in-out infinite }
.pwr-rm .ring-plasma--b { stroke:rgba(170,210,255,.8); stroke-width:6; stroke-dasharray:36 464; animation: plasmaSpinReverse 6s linear infinite }
.pwr-rm .ring-plasma--c { stroke:rgba(200,230,255,.55); stroke-width:5; stroke-dasharray:18 482; animation: plasmaSpin 5.1s linear infinite }
.pwr-rm .ring-plasma--d { stroke:rgba(150,200,255,.35); stroke-width:4; stroke-dasharray:10 490; animation: plasmaSpinReverse 9.6s linear infinite }
.pwr-rm .ring-plasma--e { stroke:rgba(210,240,255,.7); stroke-width:7; stroke-dasharray:40 460; animation: plasmaSpin 7.2s linear infinite }
@keyframes plasmaSpin { to { transform: rotate(360deg); } }
@keyframes plasmaSpinReverse { to { transform: rotate(-360deg); } }
@keyframes pwrThick { 0%,100%{ stroke-width:8 } 50%{ stroke-width:12 } }
@keyframes pwrSpin { to { transform: rotate(360deg); } }
@keyframes ringPulse { 0%,100%{ transform: scale(1) } 50%{ transform: scale(calc(1 + var(--ringPulse, 0.10))) } }
.pwr-rm__dial-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; }
.pwr-rm__dial-score { font-size: clamp(28px, 6vw, 40px); font-weight: 900; color: var(--pwr-text, #e8ecf1); text-shadow: 0 2px 10px rgba(0,0,0,.35); }
.pwr-rm__dial-sub { font-size: 12px; color: var(--pwr-rm-text-sub);margin-top:-7px; }

/* Metric chips row */
.pwr-rm__metrics { display:flex; flex-wrap:wrap; gap:8px; align-items:center; justify-content:center; margin: 6px auto 10px; max-width: 800px; }
.pwr-rm__chip { display:inline-flex; align-items:baseline; gap:6px; padding:6px 10px; border-radius:999px; background: var(--pwr-rm-surface); border:1px solid var(--pwr-rm-border); color: var(--pwr-rm-text); font-size:13px; }
.pwr-rm__chip-label { color: var(--pwr-rm-text-sub); font-weight:600; }
.pwr-rm__chip-value { font-weight:800; }

/* Extra breathing room before Pod Activity section */
.pwr-rm .pwr-pod-activity { margin-top: 36px; }
/* Extra breathing room under Challenges so bottom nav clears */
.pwr-rm .pwr-challenge-spotlight { padding-bottom: 100px; }
/* Trends */
.pwr-rm__trends-body { display: grid; gap: 10px; }
.pwr-rm__trend { display: grid; grid-template-columns: 120px 1fr auto; gap: 10px; align-items: center; }
.pwr-rm__trend-label { color: var(--pwr-rm-text-sub); font-size: 13px; }
.pwr-rm__trend-bar { position: relative; height: 8px; background: #1c2129; border: 1px solid var(--pwr-border); border-radius: 999px; overflow: hidden; }
.pwr-rm__trend-bar i { position: absolute; left: 0; top: 0; bottom: 0; width: 0%; background: linear-gradient(90deg, #8bd5ff, var(--pwr-primary, #4d90f9)); box-shadow: 0 0 16px #4d90f970 inset; display:block; }
.pwr-rm__trend-meta { color: var(--pwr-rm-text-sub); font-size: 12px; }

/* Streak badges */
.pwr-rm__streak-badges { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; }
.pwr-rm__streak-badges .badge { opacity: .45; }
.pwr-rm__streak-badges .badge.is-earned { opacity: 1; }

/* Nudges */
.pwr-rm__nudge-list { list-style: none; padding: 0; margin: 6px 0 0; display: grid; gap: 8px; }
.pwr-rm__nudge { padding: 8px 10px; border-radius: 10px; background: var(--pwr-surface, #15171c); border: 1px solid var(--pwr-border); font-size: 14px; }
.pwr-rm__disclaimer { margin: 10px 0 0; color: var(--pwr-rm-text-sub); font-size: 12px; }

/* Helpers */
.pwr-rm__sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* Compact mode tweaks */
.pwr-rm[data-compact="true"] { --pwr-rm-gap: 12px; --pwr-rm-pad: 12px; }
.pwr-rm[data-compact="true"] .pwr-rm__meter-score { font-size: 18px; }
.pwr-rm[data-compact="true"] .pwr-rm__pod-pulse { height: 100px; }

/* Pod halo (stats-style) scoped for Recovery) */
.pwr-rm .card .card-body { position: relative; }
.pwr-rm .pod-halo {
  position: absolute;
  inset: 0 0 auto 0; /* top area only */
  height: 120px;
  width: 100%;
  border-radius: 14px;
  background: radial-gradient(60% 60% at 50% 50%, var(--rm-halo), transparent 70%);
  filter: blur(8px);
  opacity: 0.0;
  pointer-events: none;
  transition: opacity .25s ease;
  z-index: 0;
}
.pwr-rm .card .card-body > *:not(.pod-halo) { position: relative; z-index: 1; }
.pwr-rm .card .card-body .btn.btn-primary {
    width: 100%;
    padding: 10px 20px;
    margin-top: 16px;
}
/* Center the clap cheer icon in Pod Activity rows */
.pwr-rm .pwr-pod-activity .btn-icon.cheer {
  display: grid;
  place-items: center;
  padding: 0;
  width: 40px;
  height: 40px;
  line-height: 1; /* remove extra text vertical metrics */
  text-align: center;
  font-size: 20px; /* slightly larger for balance */
}

/* Build Momentum buttons: remove blue haze, match sizes */
.pwr-rm .pwr-focus .focus-actions .focus-btn {
  font-size: 14px !important;
  font-weight: 500 !important;
  padding: 10px 14px !important;
  min-height: 40px;
}
.pwr-rm .pwr-focus .focus-actions .focus-primary {
  background: transparent !important;
  border: 1px solid var(--pwr-rm-border) !important;
  color: var(--pwr-rm-text) !important;
  box-shadow: none !important;
}
