/* Fusion component kit — reusable classes lifted from the Design bundle's exact
   measurements/tokens, so every screen stays consistent and clean. */

/* Phone frame: mobile-first, fluid, centered on wider screens. */
.pg-app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Persistent header */
.pg-header {
  height: var(--header-h);
  flex: 0 0 var(--header-h);
  background: var(--blue);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
}
.pg-header__logo { height: 27px; width: auto; display: block; }
.pg-header__wordmark { color: var(--on-blue); font-size: 20px; letter-spacing: 0.5px; }
.pg-header__icons { display: flex; align-items: center; gap: 18px; color: var(--blue-icon); }

/* Title block (case header) */
.pg-titleblock {
  padding: 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--divider);
  box-shadow: 0 0 2px rgba(0,0,0,0.14), 0 2px 5px rgba(0,0,0,0.28);
  position: relative;
  overflow: hidden;
}
.pg-eyebrow { font-size: 11px; line-height: 15px; color: var(--text-muted); margin-bottom: 4px; }
.pg-title { font-size: 34px; line-height: 40px; color: var(--blue); letter-spacing: 0.1px; }
.pg-title--sm { font-size: var(--title-size); line-height: 32px; }
.pg-subtitle { font-size: 13px; line-height: 18px; color: var(--text-muted); margin-top: 4px; }

/* Scroll body + footer action bar */
.pg-body { flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; }
.pg-footer {
  flex: 0 0 auto;
  background: var(--bg);
  border-top: 1px solid var(--divider);
  padding: 20px;
}

/* Buttons */
.pg-btn {
  width: 100%;
  height: 54px;
  border: none;
  border-radius: var(--radius-pill);
  background: var(--blue);
  color: var(--on-blue);
  font-family: var(--font);
  font-weight: 400;
  font-size: 17px;
  letter-spacing: 0.3px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pg-btn:hover { background: var(--blue-hover); }
.pg-btn:active { background: var(--blue-active); }
.pg-btn[disabled], .pg-btn.is-disabled {
  background: var(--divider);
  color: var(--text-muted);
  cursor: default;
}
.pg-btn--pill-sm {
  width: auto;
  height: 40px;
  padding: 0 20px;
  font-size: 14px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--divider);
}
.pg-btn--pill-sm:hover { color: var(--blue); border-color: rgba(14,155,229,0.35); background: var(--surface); }

/* Form fields */
.pg-field { display: block; }
.pg-label { display: block; font-size: 12px; line-height: 16px; color: var(--text-muted); padding: 0 18px 6px; }
.pg-req { color: var(--blue); }
.pg-input {
  width: 100%;
  box-sizing: border-box;
  height: 48px;
  padding: 0 18px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--divider);
  background: var(--surface);
  font-family: var(--font);
  font-weight: 400;
  font-size: 16px;
  color: var(--text);
}
.pg-input::placeholder { color: #BDBDBD; }
.pg-input:focus { outline: none; border-color: var(--blue); }
.pg-input.is-error { border-color: #C25E00; }
.pg-error { display: block; font-size: 12px; line-height: 17px; color: #C25E00; padding: 6px 18px 0; }

/* Toggle switch */
.pg-toggle {
  flex: 0 0 auto;
  position: relative;
  display: block;
  width: 34px;
  height: 14px;
  border-radius: 999px;
  background: rgba(0,0,0,0.26);
  transition: background .15s;
}
.pg-toggle.is-on { background: rgba(14,155,229,0.35); }
.pg-toggle__knob {
  position: absolute;
  top: -3px;
  left: 0;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: var(--bg);
  box-shadow: 0 1px 3px rgba(0,0,0,0.28);
  transition: left .15s, background .15s;
}
.pg-toggle.is-on .pg-toggle__knob { left: 14px; background: var(--blue); }

/* Cards & lists */
.pg-card {
  box-sizing: border-box;
  background: var(--surface);
  border: 1px solid var(--divider);
  border-radius: 12px;
  padding: 22px;
}
.pg-list { background: var(--surface); border-top: 1px solid var(--divider); border-bottom: 1px solid var(--divider); }
.pg-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 20px;
  border-bottom: 1px solid var(--divider);
}
.pg-row:last-child { border-bottom: none; }
.pg-row__label { font-size: 15px; line-height: 21px; color: var(--text); }
.pg-row__meta { font-size: 13px; line-height: 19px; color: var(--text-muted); }

/* Reset-button helper (unstyled button used as a tappable region) */
.pg-plainbtn { border: none; background: none; padding: 0; margin: 0; font-family: var(--font); font-weight: 400; cursor: pointer; }

/* --- Passport ------------------------------------------------------------ */
.pg-emblem { position: absolute; top: 6px; right: 20px; width: 104px; height: 104px; object-fit: contain; opacity: 0.10; pointer-events: none; }
.pg-progress { margin-top: 12px; height: 3px; background: var(--divider); border-radius: 2px; overflow: hidden; }
.pg-progress__fill { height: 100%; background: var(--blue); }

.pg-hero-frame { border: 1px solid var(--divider); border-radius: var(--radius-card); background: var(--surface); overflow: hidden; }
.pg-hero { width: 100%; display: block; object-fit: cover; }
.pg-viewline { font-size: 12px; line-height: 16px; color: var(--text-muted); margin-top: 8px; }

.pg-caplabel { font-size: 12px; line-height: 16px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.8px; }
.pg-bodytext { font-size: 15px; line-height: 22px; color: var(--text); margin-top: 6px; }
.pg-obsrow { padding: 14px 20px; font-size: 15px; line-height: 21px; color: var(--text); }
.pg-question { font-size: 18px; line-height: 24px; color: var(--blue); }
.pg-subtle { font-size: 13px; line-height: 18px; color: var(--text-muted); }

/* Identify options */
.pg-option { width: 100%; display: flex; align-items: center; gap: 16px; text-align: left; border: none; border-bottom: 1px solid var(--divider); padding: 16px 20px; cursor: pointer; font-family: var(--font); font-weight: 400; background: var(--surface); }
.pg-option:last-child { border-bottom: none; }
.pg-option__letter { flex: 0 0 auto; width: 24px; font-size: 15px; line-height: 21px; color: var(--text-muted); }
.pg-option__label { flex: 1 1 auto; font-size: 15px; line-height: 21px; color: var(--text); }
.pg-option.is-selected { background: var(--selected); }
.pg-option.is-selected .pg-option__letter, .pg-option.is-selected .pg-option__label { color: var(--blue); }

/* Confirmation veil */
.pg-veil { position: absolute; inset: 0; z-index: 6; background: rgba(250,250,250,0.94); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 26px; padding: 40px; animation: pgFadeUp 220ms ease both; }
.pg-veil__ring { position: relative; width: 108px; height: 108px; display: flex; align-items: center; justify-content: center; color: #fff; }
.pg-veil__halo { position: absolute; inset: 0; border-radius: 999px; background: rgba(14,155,229,0.35); animation: pgRingHalo 900ms ease-out 260ms both; pointer-events: none; }
.pg-veil__disc { position: relative; width: 108px; height: 108px; border-radius: 999px; background: var(--blue); display: flex; align-items: center; justify-content: center; animation: pgRingPop 520ms cubic-bezier(0.18,0.9,0.22,1) both; }
.pg-veil__title { font-size: 26px; line-height: 32px; color: var(--blue); }
.pg-veil__barwrap { width: 220px; }

/* Feedback */
.pg-fbbanner { background: var(--surface); border-bottom: 1px solid var(--divider); padding: 24px 20px; display: flex; align-items: center; gap: 14px; }
.pg-fbmark { flex: 0 0 auto; width: 40px; height: 40px; border-radius: 999px; display: flex; align-items: center; justify-content: center; }
.pg-fbmark.is-correct { background: var(--selected); color: var(--blue); }
.pg-fbmark.is-wrong { background: rgba(0,0,0,0.06); color: var(--text-muted); }
.pg-fbtitle { font-size: 20px; line-height: 26px; }
.pg-answer { font-size: 24px; line-height: 30px; color: var(--blue); margin-top: 6px; }

/* Progress stations */
.pg-station { width: 100%; display: flex; align-items: center; gap: 14px; padding: 15px 20px; border-bottom: 1px solid var(--divider); background: var(--surface); text-align: left; border-left: none; border-right: none; border-top: none; font-family: var(--font); font-weight: 400; cursor: pointer; }
.pg-station:last-child { border-bottom: none; }
.pg-station.is-locked { cursor: default; }
.pg-station:not(.is-locked):hover { background: rgba(0,0,0,0.02); }
.pg-marker { flex: 0 0 auto; width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; border-radius: 999px; border: 1px solid rgba(0,0,0,0.18); background: var(--surface); font-size: 12px; color: #BDBDBD; }
.pg-marker.is-done { background: #43A047; border-color: #43A047; color: #fff; box-shadow: 0 0 0 4px rgba(67,160,71,0.18); }
.pg-station__body { flex: 1 1 auto; min-width: 0; }
.pg-station__title { display: block; font-size: 15px; line-height: 21px; }
.pg-station__meta { display: block; font-size: 12px; line-height: 16px; color: var(--text-muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pg-statuspill { flex: 0 0 auto; font-size: 12px; line-height: 16px; border-radius: 999px; padding: 3px 10px; }
.pg-statuspill.is-correct { color: #2E7D32; background: rgba(46,125,50,0.10); border: 1px solid rgba(46,125,50,0.30); }
.pg-statuspill.is-neutral { color: var(--text-muted); background: rgba(0,0,0,0.04); border: 1px solid var(--divider); }
.pg-statuspill.is-todo { color: #9E9E9E; background: transparent; border: 1px solid transparent; }

/* Complete */
.pg-complete { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 30px; padding: 30px 24px 40px; }
.pg-badge { position: relative; width: 180px; height: 180px; display: flex; align-items: center; justify-content: center; animation: pgBadgeIn 820ms cubic-bezier(0.18,0.9,0.22,1) both; }
.pg-badge__halo { position: absolute; width: 180px; height: 180px; border-radius: 999px; background: rgba(14,155,229,0.22); animation: pgHaloPulse 2800ms ease-in-out infinite; }
.pg-badge__img { position: relative; width: 130px; height: 130px; object-fit: contain; }
.pg-certtitle { font-size: 30px; line-height: 38px; color: var(--blue); margin-top: 8px; }
.pg-hr { height: 1px; background: var(--divider); margin: 16px 0; }

@keyframes pgBadgeIn { 0% { opacity: 0; transform: scale(0.72) translateY(18px); } 62% { opacity: 1; transform: scale(1.06); } 100% { opacity: 1; transform: scale(1); } }
@keyframes pgHaloPulse { 0%,100% { transform: scale(1); opacity: 0.26; } 50% { transform: scale(1.12); opacity: 0.10; } }
@media (prefers-reduced-motion: reduce) {
  .pg-badge, .pg-badge__halo, .pg-veil__halo, .pg-veil__disc, .pg-veil { animation: none !important; }
}

/* Offline banner (player app) */
.pg-offline {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  transform: translateY(-100%); transition: transform .2s ease;
  background: #8A6100; color: #fff; text-align: center;
  font-family: var(--font); font-size: 13px; line-height: 1.4; padding: 8px 16px;
  padding-top: calc(8px + env(safe-area-inset-top, 0px));
}
body.is-offline .pg-offline { transform: translateY(0); }
@media (prefers-reduced-motion: reduce) { .pg-offline { transition: none; } }

/* --- Sprint (phone) ------------------------------------------------------- */
.pg-app--rel { position: relative; }
.pg-sprint-case { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding: 16px 20px 14px; }
.pg-sprint-timer { flex: 0 0 auto; text-align: right; position: relative; z-index: 1; }
.pg-sprint-secs { font-size: 46px; line-height: 46px; color: var(--blue); letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.pg-sprint-secs__cap { font-size: 11px; line-height: 15px; color: var(--text-muted); margin-top: 2px; }
.pg-sprint-bar { flex: 0 0 auto; height: 4px; background: var(--divider); }
.pg-sprint-bar__fill { height: 100%; background: var(--blue); transition: width 1s linear; }

.pg-sprint-option { width: 100%; min-height: 62px; display: flex; align-items: center; gap: 14px; text-align: left; padding: 12px 18px; border-radius: var(--radius-pill); border: 1px solid var(--divider); background: var(--surface); cursor: pointer; font-family: var(--font); font-weight: 400; }
.pg-sprint-option__letter { flex: 0 0 auto; width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; border-radius: 999px; border: 1px solid var(--divider); background: var(--surface); font-size: 16px; color: var(--text-muted); }
.pg-sprint-option__label { flex: 1 1 auto; font-size: 17px; line-height: 23px; color: var(--text); }
.pg-sprint-option.is-selected { border-color: var(--blue); background: var(--selected); }
.pg-sprint-option.is-selected .pg-sprint-option__letter { background: var(--blue); border-color: var(--blue); color: #fff; }
.pg-sprint-option.is-selected .pg-sprint-option__label { color: var(--blue); }

.pg-spinnerdots { display: flex; align-items: center; gap: 10px; }
.pg-spinnerdots span { width: 10px; height: 10px; border-radius: 999px; background: var(--blue); }
.pg-spinnerdots span:nth-child(1) { animation: pgDot 1500ms ease-in-out 0ms infinite; }
.pg-spinnerdots span:nth-child(2) { animation: pgDot 1500ms ease-in-out 250ms infinite; }
.pg-spinnerdots span:nth-child(3) { animation: pgDot 1500ms ease-in-out 500ms infinite; }
@keyframes pgDot { 0%,100% { opacity: 0.25; } 50% { opacity: 1; } }

/* Sprint results (phone) */
.pg-results { display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 24px 20px; }
.pg-podium { width: 100%; display: flex; flex-direction: column; gap: 14px; align-items: center; }
.pg-place { width: 100%; display: flex; align-items: center; gap: 16px; background: var(--surface); border: 1px solid var(--divider); border-radius: 12px; padding: 16px 20px; }
.pg-place__rank { flex: 0 0 auto; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; border-radius: 999px; border: 1px solid var(--divider); background: var(--bg); font-size: 20px; color: var(--text-muted); }
.pg-place__body { flex: 1 1 auto; min-width: 0; }
.pg-place__name { display: block; font-size: 22px; line-height: 28px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pg-place__score { display: block; font-size: 14px; color: var(--text-muted); margin-top: 2px; }
.pg-winner { width: 100%; box-sizing: border-box; display: flex; flex-direction: column; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--divider); border-radius: 14px; padding: 26px 22px; box-shadow: 0 0 2px rgba(0,0,0,0.10), 0 6px 18px rgba(14,155,229,0.16); }
.pg-winner__medal { width: 80px; height: 80px; display: flex; align-items: center; justify-content: center; animation: pgMedalBob 3000ms ease-in-out infinite; }
.pg-winner__eyebrow { font-size: 13px; letter-spacing: 2px; color: var(--blue); }
.pg-winner__name { font-size: 38px; line-height: 44px; color: var(--blue); text-align: center; }
.pg-winner__score { font-size: 14px; color: var(--text-muted); }
.pg-youcard { width: 100%; box-sizing: border-box; display: flex; align-items: center; justify-content: space-between; gap: 16px; background: var(--selected); border: 1px solid rgba(14,155,229,0.35); border-radius: 12px; padding: 16px 20px; color: var(--blue); font-size: 15px; }
.pg-confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 4; }
.pg-confetti span { position: absolute; top: 90px; }

@keyframes pgSlideLeft { from { opacity: 0; transform: translateX(-320px); } to { opacity: 1; transform: translateX(0); } }
@keyframes pgSlideRight { from { opacity: 0; transform: translateX(320px); } to { opacity: 1; transform: translateX(0); } }
@keyframes pgWinnerIn { 0% { opacity: 0; transform: translateY(-160px) scale(0.9); } 70% { opacity: 1; transform: translateY(0) scale(1.04); } 100% { opacity: 1; transform: scale(1); } }
@keyframes pgMedalBob { 0%,100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-7px) rotate(3deg); } }
@keyframes pgConfetti { 0% { opacity: 0; transform: translate3d(0,-40px,0) rotate(0); } 14% { opacity: 1; } 100% { opacity: 0; transform: translate3d(var(--dx),800px,0) rotate(700deg); } }
@media (prefers-reduced-motion: reduce) { .pg-confetti { display: none; } .pg-winner__medal { animation: none; } }

/* Animations reused across screens */
@keyframes pgMarkPop { 0% { transform: scale(0.6); opacity: 0; } 60% { transform: scale(1.06); opacity: 1; } 100% { transform: scale(1); opacity: 1; } }
@keyframes pgDrawTick { from { stroke-dashoffset: 34; } to { stroke-dashoffset: 0; } }
@keyframes pgFadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pgBarFill { from { width: 0%; } to { width: 100%; } }
@keyframes pgWaitPulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.35; transform: scale(0.86); } }
@keyframes pgRingPop { 0% { transform: scale(0.5); opacity: 0; } 60% { transform: scale(1.08); opacity: 1; } 100% { transform: scale(1); opacity: 1; } }
@keyframes pgRingHalo { 0% { transform: scale(0.8); opacity: 0.45; } 100% { transform: scale(1.9); opacity: 0; } }
