*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #080F14;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ─── App shell ─────────────────────────────────────────── */

#app {
  width: 100%;
  height: 100vh;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ─── States ────────────────────────────────────────────── */

.state {
  display: none;
  position: fixed;
  inset: 0;
  align-items: center;
  justify-content: center;
}

.state.active {
  display: flex;
}

/* Text block positioned below the breathing circle */
.text-below-circle {
  position: absolute;
  top: calc(50% + 200px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 320px;
  text-align: center;
}

/* ─── Breathing circle ──────────────────────────────────── */

#breathing-circle {
  position: fixed;
  /* CSS handles centering; JS only animates width/height (and left/top in corner mode) */
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: #2E75B6;
  border: 3px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 0 30px rgba(46, 117, 182, 0.4);
  width: 120px;
  height: 120px;
  opacity: 0;
  z-index: 10;
  pointer-events: none;
}

/* Gentle pulse animation used during countdown.
   Must include translate(-50%,-50%) to preserve CSS centering. */
@keyframes pulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1);    }
  50%       { transform: translate(-50%, -50%) scale(1.06); }
}

.circle--pulse {
  animation: pulse 2s ease-in-out infinite;
}

/* ─── Corner breathing animation ───────────────────────────
   Runs after the circle moves to top-center. Uses transform:scale
   so it never touches width/height/left — no layout impact.
   Starts at scale(1) to match the circle's arrival size exactly. */

@keyframes cornerBreath {
  0%, 100% { transform: scale(1);   }
  50%       { transform: scale(0.6); }
}

.circle--corner-breath {
  animation: cornerBreath 8s ease-in-out infinite;
}

/* ─── Corner label ───────────────────────────────────────── */

#corner-label {
  position: fixed;
  top: 164px;  /* circle top (20) + circle height (120) + 24px gap (8 + 16 added) */
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  font-weight: 300;
  color: white;
  opacity: 0;
  letter-spacing: 0.04em;
  white-space: nowrap;
  z-index: 10;
  transition: opacity 0.6s ease;
}

#corner-label.visible {
  opacity: 0.6;
}

/* ─── Fade-in utility ───────────────────────────────────── */

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.fade-in {
  animation: fadeIn 0.8s ease forwards;
}

/* ─── Typography ────────────────────────────────────────── */

.tap-word {
  font-size: 24px;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.9);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  cursor: pointer;
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.28);
  font-family: inherit;
  padding: 6px 18px;
}

.count-number {
  font-size: 48px;
  font-weight: 200;
  color: white;
  line-height: 1;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.phase-label {
  font-size: 18px;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.8);
}

.transition-text {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 20px;
  font-weight: 300;
  color: white;
  max-width: 280px;
  line-height: 1.5;
  text-align: center;
  opacity: 0;
}

.transition-text p {
  margin: 0;
}

#btn-continue {
  opacity: 0;
  display: block;
  margin-top: 8px;
}

/* ─── Exit button (persistent) ──────────────────────────── */

#exit-button {
  position: fixed;
  top: 14px;
  left: 14px;
  background: none;
  border: none;
  color: white;
  opacity: 0.4;
  font-size: 20px;
  font-weight: 300;
  font-family: inherit;
  padding: 8px 12px;
  cursor: pointer;
  z-index: 100;
  line-height: 1;
}

/* Tap to begin — iOS Safari only, shown when autoplay is blocked */
#btn-tap-to-begin {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(123, 209, 255, 0.1);
  border: 1px solid rgba(123, 209, 255, 0.3);
  border-radius: 10px;
  color: white;
  font-family: inherit;
  font-size: 16px;
  font-weight: 300;
  padding: 18px 36px;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
  z-index: 100;
}

#btn-tap-to-begin.visible {
  opacity: 1;
  pointer-events: auto;
}

/* Skip intro / Skip session — bottom-center, low opacity; pointer-events off until .visible */
#skip-intro,
#skip-session {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: none;
  border: none;
  color: white;
  opacity: 0;
  pointer-events: none;
  font-size: 14px;
  font-weight: 300;
  font-family: inherit;
  padding: 8px 14px;
  cursor: pointer;
  z-index: 100;
  transition: opacity 0.4s ease;
}

#skip-intro.visible,
#skip-session.visible {
  opacity: 0.4;
  pointer-events: auto;
}

/* ─── Question blocks (Feature 2) ───────────────────────── */

.question-block {
  /* Corner label ends at ~178px (top 164 + line-height).
     Top 286 gives a 108px breathing gap above the first question card. */
  position: fixed;
  top: 286px;
  left: 0;
  right: 0;
  margin: 0 auto;
  max-width: 400px;
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  opacity: 0;
  pointer-events: none;
}

.question-block.centered {
  top: 38vh;
}

.question-block.active {
  pointer-events: auto;
}

.question-block.entering {
  animation: slideUpIn 0.5s ease forwards;
}

.question-block.leaving {
  animation: shrinkUpOut 0.4s ease forwards;
}

@keyframes slideUpIn {
  from { opacity: 0; transform: translateY(40px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes shrinkUpOut {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to   { opacity: 0; transform: translateY(-20px) scale(0.95); }
}

.question-text {
  font-size: 20px;
  font-weight: 300;
  color: white;
  text-align: center;
  line-height: 1.35;
}

.cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

/* Q1 sport selection: extend the block to the screen bottom so the cards
   container can scroll, clearing the browser toolbar with bottom padding. */
#q1 {
  bottom: 0;
}

#q1 .cards {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 80px;
}

.cards.hidden {
  display: none;
}

/* 2-column grid for the 6-option path selection — fixed row height makes all 6 cards equal */
.cards--2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-rows: 60px;
  gap: 10px;
}

.cards--2col .answer-card {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  font-size: 15px;
  line-height: 1.25;
}

.cards.fading {
  transition: opacity 0.3s ease;
  opacity: 0;
}

.cards.entering {
  animation: slideUpIn 0.4s ease forwards;
}

.answer-card {
  background: #1A252F;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 14px 18px;
  font-size: 16px;
  font-weight: 300;
  font-family: inherit;
  cursor: pointer;
  width: 100%;
  text-align: center;
  transition: opacity 0.3s ease;
}

.answer-card.selected {
  opacity: 0.5;
}

/* Back arrow shown above the Q1 "Other" sports list */
.back-arrow {
  align-self: flex-start;
  background: none;
  border: none;
  color: white;
  opacity: 0.5;
  font-size: 22px;
  font-family: inherit;
  padding: 4px 10px;
  margin-bottom: 2px;
  cursor: pointer;
  line-height: 1;
}

/* Free-text sport input at the bottom of the Q1 "Other" list */
.sport-input {
  background: #1A252F;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 14px 18px;
  font-size: 16px;
  font-weight: 300;
  font-family: inherit;
  width: 100%;
  text-align: center;
  outline: none;
  transition: opacity 0.3s ease;
}

.sport-input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.sport-input.selected {
  opacity: 0.5;
}

#btn-letsgo {
  opacity: 0;
  transition: opacity 0.6s ease;
  text-transform: none;     /* override .tap-word uppercase — renders title case */
  letter-spacing: normal;   /* drop the wide tracking so two-line title case sits visually centered */
  line-height: 1.2;         /* clean spacing between "Let's" and "Go" */
}

#btn-letsgo.visible {
  opacity: 1;
}

/* Build-prompt: 48px between the prompt text and the Let's Go button
   (doubled from the prior 24px). ID specificity wins over the media-query gap. */
#build-prompt {
  gap: 48px;
}

.loading-message {
  font-size: 20px;
  font-weight: 300;
  color: white;
  text-align: center;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.loading-message.visible {
  opacity: 1;
}

/* ─── Feature 4: Session player ────────────────────────── */

#state-session,
#state-congratulations,
#state-feedback,
#state-second-offer,
#state-save-prompt,
#state-account-creation,
#state-confirmed,
#state-exit,
#state-training-room-placeholder,
#state-signin {
  background-color: #040a12;
  overflow: hidden;
}

/* Two blob layers that drift at different speeds, creating a slow abstract swirl.
   Pseudo-elements extend beyond the viewport so translated edges stay hidden. */
#state-session::before,
#state-congratulations::before,
#state-feedback::before,
#state-second-offer::before,
#state-save-prompt::before,
#state-account-creation::before,
#state-confirmed::before,
#state-exit::before,
#state-training-room-placeholder::before,
#state-signin::before {
  content: '';
  position: absolute;
  inset: -200px;
  background:
    radial-gradient(ellipse 65% 55% at 20% 30%, rgba(10, 38, 95, 0.45) 0%, transparent 65%),
    radial-gradient(ellipse 50% 60% at 80% 75%, rgba(6,  24, 70, 0.38) 0%, transparent 60%);
  animation: blobDrift1 75s ease-in-out infinite;
  pointer-events: none;
}

#state-session::after,
#state-congratulations::after,
#state-feedback::after,
#state-second-offer::after,
#state-save-prompt::after,
#state-account-creation::after,
#state-confirmed::after,
#state-exit::after,
#state-training-room-placeholder::after,
#state-signin::after {
  content: '';
  position: absolute;
  inset: -200px;
  background:
    radial-gradient(ellipse 55% 45% at 70% 20%, rgba(8, 32, 88, 0.35) 0%, transparent 60%),
    radial-gradient(ellipse 45% 65% at 25% 80%, rgba(13, 45, 100, 0.3) 0%, transparent 55%);
  animation: blobDrift2 100s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes blobDrift1 {
  0%   { transform: translate(0,    0)    rotate(0deg);   }
  25%  { transform: translate(7%,   11%)  rotate(14deg);  }
  50%  { transform: translate(3%,  -9%)   rotate(27deg);  }
  75%  { transform: translate(-8%,  5%)   rotate(10deg);  }
  100% { transform: translate(0,    0)    rotate(0deg);   }
}

@keyframes blobDrift2 {
  0%   { transform: translate(0,   0)    rotate(0deg)   scale(1);    }
  35%  { transform: translate(-9%, 8%)   rotate(-18deg) scale(1.09); }
  70%  { transform: translate(6%,  -7%)  rotate(-32deg) scale(0.94); }
  100% { transform: translate(0,   0)    rotate(0deg)   scale(1);    }
}

#session-circle {
  width: 180px;
  height: 180px;
  flex-shrink: 0;
  border-radius: 50%;
  background: radial-gradient(circle, #3a7abf 0%, rgba(30, 70, 130, 0.35) 55%, transparent 100%);
  filter: blur(10px);
  animation: sessionBreath 11s ease-in-out infinite;
  pointer-events: none;
  z-index: 1;
}

@keyframes sessionBreath {
  0%, 100% { transform: scale(1);    opacity: 0.75; }
  50%       { transform: scale(1.22); opacity: 1;    }
}

.congrats-text {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: fadeIn 1.2s ease forwards;
  z-index: 1;
}

.congrats-line-1 {
  font-size: 28px;
  font-weight: 300;
  letter-spacing: 0.06em;
  color: white;
  margin: 0;
}

.congrats-line-2 {
  font-size: 18px;
  font-weight: 300;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.75);
  margin: 0;
}

/* ─── Feature 5: Post-session feedback ─────────────────── */

.feedback-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  width: 100%;
  max-width: 400px;
  padding: 0 24px;
  z-index: 1;
  animation: fadeIn 0.8s ease forwards;
}

.feedback-card-area {
  position: relative;
  width: 100%;
}

.feedback-logged {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  pointer-events: none;
}

.feedback-logged-main,
.feedback-logged-sub {
  opacity: 0;
  transition: opacity 0.6s ease;
  text-align: center;
}

.feedback-logged-main.visible,
.feedback-logged-sub.visible {
  opacity: 1;
}

.feedback-logged-main {
  font-size: 22px;
  font-weight: 300;
  color: white;
}

.feedback-logged-sub {
  font-size: 15px;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.55);
}

/* ─── Responsive ────────────────────────────────────────── */

/* Short screens (landscape phones) */
@media (max-height: 600px) {
  .text-below-circle {
    top: calc(50% + 150px);
  }
}

/* Very narrow screens */
@media (max-width: 360px) {
  .tap-word       { font-size: 20px; }
  .count-number   { font-size: 36px; }
  .phase-label    { font-size: 16px; }
  .transition-text { font-size: 18px; }
  .question-text  { font-size: 18px; }
  .answer-card    { font-size: 15px; padding: 12px 16px; }
}

/* Shorter phones — tighten question layout so 7-card sport grid fits */
@media (max-height: 700px) {
  .question-block { top: 266px; gap: 16px; }
  .cards          { gap: 8px; }
}

/* ─── Second-session offer suggestion copy ──────────────── */

.offer-suggestion {
  font-size: 15px;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.6);
  text-align: center;
  line-height: 1.5;
  max-width: 320px;
  margin: -10px 0 0;
}

/* ─── Feature 7: Save prompt + Account creation ─────────── */

.save-prompt-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  width: 100%;
  max-width: 400px;
  padding: 0 24px;
  z-index: 1;
  animation: fadeIn 0.8s ease forwards;
}

.save-prompt-headline {
  font-size: 22px;
  font-weight: 300;
  color: white;
  text-align: center;
  line-height: 1.4;
}

.btn-maybe-later {
  background: none;
  border: none;
  color: white;
  opacity: 0.5;
  font-size: 15px;
  font-weight: 200;
  font-family: inherit;
  padding: 6px 12px;
  cursor: pointer;
}

/* Disabled state for the submit button during API call */
.tap-word:disabled {
  opacity: 0.45;
  cursor: default;
}

.account-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
}

.account-input {
  background: #1A252F;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 14px 18px;
  font-size: 16px;
  font-weight: 300;
  font-family: inherit;
  width: 100%;
  text-align: left;
  outline: none;
}

.account-input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.account-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.account-label {
  font-size: 13px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.55);
  text-align: left;
}

.form-error {
  font-size: 14px;
  font-weight: 300;
  color: rgba(255, 120, 100, 0.85);
  text-align: center;
  opacity: 0;
  transition: opacity 0.4s ease;
  min-height: 20px;
  margin: 0;
}

.form-error.visible {
  opacity: 1;
}

/* ─── Feature 7: Exit screen (Path B) ──────────────────── */

.exit-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  width: 100%;
  max-width: 360px;
  padding: 0 24px;
  z-index: 1;
  animation: fadeIn 0.8s ease forwards;
}

.exit-reengage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.exit-reengage-prompt {
  font-size: 16px;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.6);
  text-align: center;
}

.exit-url {
  font-size: 13px;
  font-weight: 200;
  color: rgba(255, 255, 255, 0.35);
  text-align: center;
  letter-spacing: 0.02em;
}

.btn-exit-final {
  font-size: 13px;
  opacity: 0.35;
}

/* ─── Feature 8: Training Room ──────────────────────────── */

#state-training-room-placeholder {
  align-items: flex-start;
  justify-content: flex-start;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  /* CSS custom properties scoped to the training room */
  --tr-blue:     #7BD1FF;
  --tr-blue-dim: rgba(123,209,255,0.65);
  --tr-green:    #A6BE4B;
  --tr-card:     #1a2848;
  --tr-card-hi:  #213257;
  --tr-line:     rgba(123,209,255,0.10);
  --tr-line-2:   rgba(255,255,255,0.06);
  --tr-text:     #ECF2F8;
  --tr-text-2:   #97A4B8;
  --tr-text-3:   #586780;
  --tr-gap:      44px;
  --tr-radius:   12px;
}

.tr-wrap {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  padding: 20px 0 60px;
  font-family: 'Archivo', system-ui, sans-serif;
  animation: fadeIn 0.6s ease forwards;
}

/* App bar */
.tr-appbar {
  padding: 20px 22px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tr-brand { display: flex; align-items: center; }

.tr-brand-logo { height: 30px; width: auto; display: block; }

.tr-badge-fm {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px 6px 8px; border-radius: 4px;
  border: 1px solid rgba(166,190,75,0.45);
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; letter-spacing: 1.2px; text-transform: uppercase;
  color: var(--tr-green); font-weight: 500;
}
.tr-badge-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--tr-green); box-shadow: 0 0 0 3px rgba(166,190,75,0.18);
}

.tr-blueline {
  height: 1px; margin: 4px 22px 0;
  background: linear-gradient(90deg, transparent, var(--tr-line) 20%, var(--tr-line) 80%, transparent);
}

/* Greeting */
.tr-greet { padding: 14px 22px 0; }
.tr-greet-welcome {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.5);
  text-align: center;
  letter-spacing: 0.2px;
}
.tr-greet-h1 {
  margin: 0; padding: 20px 0 0;
  font-weight: 700; font-size: 24px; line-height: 1.2;
  letter-spacing: -0.3px; color: var(--tr-text); text-align: center;
}
.tr-accent { color: var(--tr-blue); }

/* Sections */
.tr-section {
  padding: var(--tr-gap) 22px 24px;
  position: relative;
}
.tr-section + .tr-section {
  border-top: 1px solid rgba(255,255,255,0.35);
  padding-top: 24px;
}
.tr-section-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 14px;
}
.tr-section-h2 {
  margin: 0; font-size: 13px; text-transform: uppercase;
  letter-spacing: 2px; font-weight: 700; color: var(--tr-text-2);
}
.tr-section-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; color: var(--tr-text-3); letter-spacing: 1.4px;
}

/* 2×2 focus grid */
.tr-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.tr-focus-card {
  background: var(--tr-card); border: 1px solid var(--tr-line-2);
  border-radius: var(--tr-radius); padding: 14px 14px 16px;
  min-height: 124px; display: flex; flex-direction: column;
  justify-content: space-between; position: relative;
  cursor: pointer; transition: background .15s, border-color .15s;
  -webkit-tap-highlight-color: transparent;
}
.tr-focus-card:hover,
.tr-focus-card.tr-active {
  background: var(--tr-card-hi); border-color: var(--tr-blue);
}
.tr-card-stripe {
  position: absolute; left: 14px; top: 14px; width: 18px; height: 2px;
  background: var(--tr-blue);
}
.tr-card-title {
  font-weight: 600; font-size: 15px; line-height: 1.2;
  letter-spacing: -0.2px; color: var(--tr-text); padding-top: 18px;
}
.tr-card-desc {
  font-size: 12px; line-height: 1.4; color: var(--tr-text-2); margin-top: 6px;
}
.tr-card-meta { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; }
.tr-card-coach { font-size: 11px; color: var(--tr-text-2); opacity: 0.7; }
.tr-card-arrow {
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(123,209,255,0.10);
  display: flex; align-items: center; justify-content: center;
  color: var(--tr-blue);
}

/* ─── Progress cards (in-progress + tier-complete states) ───────────────────── */

.tr-progress-card {
  background: var(--tr-card); border: 1px solid var(--tr-line-2);
  border-radius: var(--tr-radius); padding: 12px 14px 20px;
  display: flex; flex-direction: column; gap: 10px;
  cursor: pointer; transition: background .15s, border-color .15s;
  -webkit-tap-highlight-color: transparent;
}
.tr-progress-card:hover,
.tr-progress-card.tr-active {
  background: var(--tr-card-hi); border-color: var(--tr-blue);
}

/* Journey header */
.tr-card-journey-header {
  display: flex; align-items: center; justify-content: space-between;
}
.tr-card-journey-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px; letter-spacing: 1.4px; text-transform: uppercase;
  color: var(--tr-text-2);
}
.tr-card-session-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; letter-spacing: 1.2px; color: var(--tr-text-2);
}

/* Journey bar */
.tr-journey-bar { display: flex; gap: 2px; height: 3px; }
.tr-journey-seg { flex: 1; background: var(--tr-line-2); border-radius: 1px; }
.tr-journey-seg.tr-filled { background: var(--tr-blue); }

/* Progress ring */
.tr-ring { position: relative; width: 56px; height: 56px; flex-shrink: 0; }
.tr-ring svg { width: 56px; height: 56px; transform: rotate(-90deg); }
.tr-ring-label {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; letter-spacing: -0.3px; color: var(--tr-text);
}

/* Progress row: ring + text + play */
.tr-card-progress-row { display: flex; align-items: center; gap: 14px; }
.tr-card-progress-text { flex: 1; min-width: 0; }
.tr-card-tier {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; letter-spacing: 1.2px; text-transform: uppercase;
  color: var(--tr-text-3); margin-top: 3px;
}
.tr-card-tier-num { color: var(--tr-blue); }
.tr-card-upnext {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; letter-spacing: 0.8px; color: var(--tr-text-2); margin-top: 5px;
}
.tr-card-upnext-session { color: var(--tr-text); font-weight: 600; }

/* Play button */
.tr-card-play {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--tr-blue); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; color: var(--tr-card); padding: 0;
  -webkit-tap-highlight-color: transparent;
}
.tr-card-play:active { opacity: 0.85; transform: scale(0.96); }

.tr-card-play.tr-loading {
  opacity: 0.7; cursor: default; pointer-events: none;
}
.tr-card-play.tr-loading svg { display: none; }
.tr-card-play.tr-loading::after {
  content: ''; display: block; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.25); border-top-color: rgba(255,255,255,0.9);
  animation: tr-spin 0.65s linear infinite;
}
@keyframes tr-spin { to { transform: rotate(360deg); } }

.tr-focus-card.tr-active { opacity: 0.6; pointer-events: none; }


/* Upgrade button (tier-complete) */
.tr-upgrade-btn {
  display: flex; align-items: center; justify-content: center;
  padding: 8px 16px; border-radius: 6px;
  background: rgba(123,209,255,0.08); border: 1px solid rgba(123,209,255,0.28);
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; letter-spacing: 1.2px; text-transform: uppercase;
  color: var(--tr-blue); cursor: pointer; width: 100%;
}
.tr-tester-period .tr-upgrade-btn { display: none; }

/* Library buckets */
.tr-bucket { border-top: 1px solid var(--tr-line-2); }
.tr-bucket:last-child { border-bottom: 1px solid var(--tr-line-2); }

.tr-bucket-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 2px; cursor: pointer; user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.tr-bucket-left  { display: flex; align-items: center; gap: 12px; }
.tr-bucket-right { display: flex; align-items: center; gap: 10px; }
.tr-bucket-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; letter-spacing: 1.4px; color: var(--tr-text-3); width: 26px;
}
.tr-bucket-name { font-weight: 600; font-size: 16px; color: var(--tr-text); letter-spacing: -0.1px; }
.tr-bucket-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; letter-spacing: 1.2px; color: var(--tr-text-3);
}
.tr-bucket-chev {
  color: var(--tr-text-2); transition: transform .25s ease;
  display: flex; align-items: center;
}
.tr-bucket.tr-open .tr-bucket-chev { transform: rotate(180deg); }

.tr-bucket-body { display: none; padding: 0 0 16px; gap: 8px; flex-direction: column; }
.tr-bucket.tr-open .tr-bucket-body { display: flex; }

/* Session cards */
.tr-session-card {
  display: flex; align-items: stretch;
  background: var(--tr-card); border: 1px solid var(--tr-line-2);
  border-radius: calc(var(--tr-radius) - 2px); overflow: hidden;
}
.tr-sc-stripe { width: 3px; background: var(--tr-blue); flex-shrink: 0; }
.tr-session-card.tr-tier-2 .tr-sc-stripe { background: rgba(123,209,255,0.35); }

.tr-sc-body {
  flex: 1; padding: 12px 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0;
}
.tr-sc-meta { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.tr-sc-tier {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; letter-spacing: 1.4px; color: var(--tr-blue); text-transform: uppercase;
}
.tr-session-card.tr-tier-2 .tr-sc-tier { color: var(--tr-blue-dim); }
.tr-sc-title {
  font-weight: 600; font-size: 15px; color: var(--tr-text);
  letter-spacing: -0.1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tr-sc-right {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 6px; flex-shrink: 0; min-width: 40px;
}
.tr-sc-duration {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; letter-spacing: 0.5px; color: var(--tr-text-2);
}

/* Heart favorite button */
.tr-fav-btn {
  width: 44px; height: 44px; padding: 0; border: 0; background: transparent;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: rgba(255,255,255,0.40);
  transition: color .15s, transform .12s; -webkit-tap-highlight-color: transparent;
}
.tr-fav-btn:active { transform: scale(0.88); }
.tr-fav-btn svg { display: block; width: 20px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; }
.tr-fav-btn.tr-faved { color: #E8334A; }
.tr-fav-btn.tr-faved svg { fill: currentColor; stroke: currentColor; }

/* Training history */
.tr-history { display: flex; flex-direction: column; }
.tr-history-row {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 0; border-bottom: 1px solid var(--tr-line-2);
}
.tr-history-row:last-child { border-bottom: none; }
.tr-history-marker { width: 6px; height: 6px; border-radius: 50%; background: var(--tr-blue); flex-shrink: 0; }
.tr-history-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tr-history-area {
  font-weight: 600; font-size: 14px; color: var(--tr-text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -0.1px;
}
.tr-history-title {
  font-size: 12px; color: var(--tr-text-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tr-history-date {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; letter-spacing: 0.8px; color: var(--tr-text-3); white-space: nowrap;
}
.tr-history-pill {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; letter-spacing: 0.6px; color: var(--tr-text-3); white-space: nowrap; padding: 3px 4px;
}
.tr-history-empty {
  font-size: 14px; font-weight: 300; color: var(--tr-text-3);
  padding: 16px 0; text-align: center;
}

/* V2 callout */
.tr-v2 {
  border: 1px solid var(--tr-line-2); border-radius: var(--tr-radius);
  padding: 18px 18px 20px;
  background: linear-gradient(180deg, rgba(123,209,255,0.04) 0%, rgba(123,209,255,0) 100%);
}
.tr-v2-eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; letter-spacing: 1.6px; color: var(--tr-blue-dim);
  text-transform: uppercase; display: flex; align-items: center; gap: 8px; margin-bottom: 10px;
}
.tr-v2-dot {
  width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0;
  background: var(--tr-blue); box-shadow: 0 0 0 3px rgba(123,209,255,0.15);
  animation: trV2Pulse 2.4s ease-in-out infinite;
}
@keyframes trV2Pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(123,209,255,0.15); }
  50%       { box-shadow: 0 0 0 6px rgba(123,209,255,0.06); }
}
.tr-v2-h3 { margin: 0 0 8px; font-weight: 700; font-size: 18px; letter-spacing: -0.2px; color: var(--tr-text); }
.tr-v2-p  { margin: 0; font-size: 13px; line-height: 1.55; color: var(--tr-text-2); }

/* Feature 8b: Voluntary profile section */
.tr-section-sub {
  margin: -8px 0 14px; font-size: 13px; color: var(--tr-text-3); line-height: 1.45;
}
.tr-profile-fields { display: flex; flex-direction: column; gap: 14px; }
.tr-field label {
  display: block; font-family: 'JetBrains Mono', monospace;
  font-size: 10px; letter-spacing: 1.4px; color: var(--tr-text-3);
  text-transform: uppercase; margin-bottom: 6px;
}
.tr-input {
  width: 100%; background: var(--tr-card); border: 1px solid var(--tr-line-2);
  border-radius: 8px; padding: 11px 12px; color: var(--tr-text);
  font-family: 'Archivo', sans-serif; font-size: 14px; outline: none; box-sizing: border-box;
}
.tr-input::placeholder { color: var(--tr-text-3); }
.tr-input:focus { border-color: var(--tr-blue-dim); }
.tr-field-saved { display: block; font-size: 12px; color: #A6BE4B; margin-top: 5px; opacity: 0; transition: opacity 0.2s ease; }
.tr-field-saved.tr-saved-visible { opacity: 1; }

.tr-footer {
  padding: 40px 22px 36px;
  text-align: center;
}

.tr-footer p {
  margin: 0 0 6px;
  font-size: 12px;
  color: rgba(123, 209, 255, 0.35);
  font-weight: 300;
  line-height: 1.5;
}

.tr-footer p:last-child { margin-bottom: 0; }

.tr-footer-link {
  color: inherit;
  text-decoration: none;
}

.tr-footer-link:hover { text-decoration: underline; }

/* ─── Sign-in link on entry screen ─────────────────── */

#signin-link-wrapper {
  position: fixed;
  bottom: 32px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 13px;
  font-weight: 300;
  color: rgba(123, 209, 255, 0.4);
  pointer-events: none;
}

#btn-goto-signin {
  background: none;
  border: none;
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  color: inherit;
  padding: 4px 2px;
  cursor: pointer;
  pointer-events: auto;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ─── Sign-in state ─────────────────────────────────── */

#signin-view,
#forgot-view {
  width: 100%;
}

#forgot-view.hidden {
  display: none;
}

.btn-forgot-password {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 300;
  color: rgba(123, 209, 255, 0.35);
  padding: 6px 2px;
  cursor: pointer;
  text-align: center;
  width: 100%;
}

.forgot-confirm {
  font-size: 14px;
  font-weight: 300;
  color: rgba(123, 209, 255, 0.6);
  text-align: center;
  opacity: 0;
  transition: opacity 0.4s ease;
  min-height: 20px;
  margin: 0;
}

.forgot-confirm.visible {
  opacity: 1;
}

/* Tester build — skip button suppressed */
#skip-session.visible {
  opacity: 0 !important;
  pointer-events: none !important;
}

/* ─── Invite gate ───────────────────────────────────── */

.invite-gate-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 44px;
  width: 100%;
  max-width: 340px;
  padding: 0 24px;
}

.invite-gate-brand {
  font-size: 20px;
  font-weight: 300;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.85);
}

.invite-gate-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 100%;
}

.invite-gate-heading {
  font-size: 16px;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.65);
  text-align: center;
  letter-spacing: 0.02em;
  margin-bottom: 4px;
}

.invite-code-input {
  text-align: center;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.invite-gate-error {
  font-size: 13px;
  font-weight: 300;
  color: rgba(255, 120, 100, 0.85);
  text-align: center;
  min-height: 18px;
  opacity: 0;
  transition: opacity 0.3s ease;
  margin: 0;
}

.invite-gate-error.visible {
  opacity: 1;
}

.invite-gate-waitlist {
  font-size: 12px;
  font-weight: 300;
  color: rgba(123, 209, 255, 0.4);
  text-decoration: none;
  letter-spacing: 0.03em;
  padding: 4px 0;
  margin-top: 4px;
}

.invite-gate-waitlist:hover {
  color: rgba(123, 209, 255, 0.65);
}
