/* sportsmedicine-class — sport-themed accents
   Builds on base/layout/components/pages. Palette tokens unchanged;
   adds athletic motion lines, medal markers, track-lane decorations,
   jersey-number typography, and energy stripes on primary actions. */

/* ============================================================
   Brand mark — stopwatch silhouette
   ============================================================ */
.brand { position: relative; padding-left: 4px; }
.brand::before {
  /* keep gradient square from layout.css, sharpen to stopwatch */
  position: relative;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 55%, var(--surface) 0 5px, transparent 5px),
    linear-gradient(135deg, var(--primary) 0%, var(--amber) 100%);
  box-shadow:
    inset 0 0 0 2px rgba(255,255,255,0.7),
    0 6px 14px -2px var(--primary-ring);
}
.brand::after {
  content: '';
  position: absolute;
  left: 17px;
  top: 0;
  width: 6px; height: 5px;
  background: var(--primary-dark);
  border-radius: 2px 2px 0 0;
  transform: rotate(-12deg);
  transform-origin: bottom center;
}

/* ============================================================
   Topbar — subtle baseline of a running track
   ============================================================ */
.topbar {
  background-image:
    linear-gradient(180deg, rgba(255,255,255,0.72), rgba(255,255,255,0.72)),
    repeating-linear-gradient(
      to right,
      transparent 0 24px,
      rgba(255,107,53,0.06) 24px 26px
    );
  background-position: 0 0, 0 100%;
  background-size: 100% 100%, 100% 4px;
  background-repeat: no-repeat;
}

/* ============================================================
   Landing hero — athletic track lanes radiating from baseline
   ============================================================ */
.landing-hero {
  isolation: isolate;
}
.landing-hero::before {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -8px;
  transform: translateX(-50%);
  width: min(1100px, 130vw);
  height: 220px;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 60% 100% at 50% 100%, rgba(255,107,53,0.10), transparent 70%),
    repeating-radial-gradient(
      circle at 50% 100%,
      transparent 0 56px,
      rgba(255,107,53,0.10) 56px 58px
    );
  mask-image: linear-gradient(to top, #000 0%, transparent 90%);
  -webkit-mask-image: linear-gradient(to top, #000 0%, transparent 90%);
}

.landing-hero .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.landing-hero .eyebrow::before {
  content: '';
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
  animation: pulse-dot 2.4s ease-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 0 var(--primary-soft); }
  50%      { box-shadow: 0 0 0 8px transparent; }
}

.landing-hero h1::after {
  content: '';
  display: block;
  width: 96px;
  height: 6px;
  margin: 22px auto 0;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--primary) 0%, var(--amber) 60%, transparent 100%);
}

/* ============================================================
   PIN input — jersey-number typography
   ============================================================ */
#join-form input#pin,
input#pin-input {
  font-variant-numeric: tabular-nums;
  font-family: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg-3) 100%);
  border-width: 2px;
  letter-spacing: 0.32em;
}
#join-form input#pin:focus { transform: translateY(-1px); }

/* ============================================================
   Primary big button — energy stripes (sport jersey side panel)
   ============================================================ */
button.primary.big,
.btn.primary.big {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
button.primary.big::before,
.btn.primary.big::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    -28deg,
    transparent 0 14px,
    rgba(255,255,255,0.10) 14px 16px
  );
  pointer-events: none;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.25s ease;
}
button.primary.big:hover::before,
.btn.primary.big:hover::before {
  opacity: 1;
}

/* ============================================================
   Leaderboard — gold / silver / bronze medals for top 3
   ============================================================ */
.leaderboard li:nth-child(1)::before {
  background: radial-gradient(circle at 30% 30%, #ffe48a 0%, var(--amber-light) 45%, #d97706 100%);
  color: #6b4d00;
  box-shadow: 0 4px 10px -2px rgba(217, 119, 6, 0.45), inset 0 0 0 2px rgba(255,255,255,0.5);
  font-weight: 900;
}
.leaderboard li:nth-child(2)::before {
  background: radial-gradient(circle at 30% 30%, #f8fafc 0%, #cbd5e1 45%, #64748b 100%);
  color: #1f2937;
  box-shadow: 0 4px 10px -2px rgba(100, 116, 139, 0.4), inset 0 0 0 2px rgba(255,255,255,0.5);
  font-weight: 900;
}
.leaderboard li:nth-child(3)::before {
  background: radial-gradient(circle at 30% 30%, #fed7aa 0%, var(--light-orange) 45%, #c2410c 100%);
  color: #5a2a0a;
  box-shadow: 0 4px 10px -2px rgba(194, 65, 12, 0.4), inset 0 0 0 2px rgba(255,255,255,0.5);
  font-weight: 900;
}
.leaderboard li:nth-child(-n+3) {
  font-weight: 700;
}

/* Add a tiny ribbon for #1 */
.leaderboard li:nth-child(1) {
  background: linear-gradient(90deg, rgba(255, 196, 0, 0.06), transparent 60%);
  border-radius: var(--radius-sm);
  padding-left: 8px;
}

/* ============================================================
   Answer tiles — jersey-stripe overlay
   ============================================================ */
.opt-tile {
  position: relative;
  overflow: hidden;
}
.opt-tile::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    -45deg,
    transparent 0 32px,
    rgba(255,255,255,0.06) 32px 34px
  );
  pointer-events: none;
}
.opt-tile.correct {
  animation: tile-pop 0.5s ease-out;
}
@keyframes tile-pop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.08); }
  100% { transform: scale(1.05); }
}

/* ============================================================
   Lobby player chips — pulse on add (uses .chip-new opt-in)
   ============================================================ */
.player-chips li {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.player-chips li:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px -4px var(--primary-ring);
}

/* ============================================================
   Section headings — sport-eyebrow "MATCH" stripe
   ============================================================ */
.dashboard-head h1 small::before,
.landing-panel h2 .marker {
  position: relative;
}
.landing-panel h2 .marker {
  width: 4px;
  height: 22px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--primary), var(--amber));
}

/* ============================================================
   Question countdown — stopwatch ring (if .countdown present)
   ============================================================ */
.countdown,
.timer {
  font-variant-numeric: tabular-nums;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-weight: 900;
}

/* ============================================================
   Cards — diagonal accent corner (jersey side panel)
   ============================================================ */
.landing-panel,
.quiz-card,
.history-card {
  position: relative;
  overflow: hidden;
}
.landing-panel::after,
.quiz-card::after {
  content: '';
  position: absolute;
  right: -40px;
  top: -40px;
  width: 120px;
  height: 120px;
  background: linear-gradient(135deg, var(--primary-soft), transparent 60%);
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
}
.landing-panel > *,
.quiz-card > * {
  position: relative;
  z-index: 1;
}

/* ============================================================
   "On air" indicator for active host lobby (uses .badge.live)
   ============================================================ */
.badge.live,
.live-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.badge.live::before,
.live-dot::before {
  content: '';
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 0 0 var(--danger);
  animation: live-pulse 1.6s ease-out infinite;
}
@keyframes live-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6); }
  100% { box-shadow: 0 0 0 10px transparent; }
}

/* ============================================================
   Background music toggle (topbar)
   ============================================================ */
.bg-music-toggle {
  appearance: none;
  background: var(--primary-soft);
  border: 1px solid transparent;
  color: var(--primary-dark);
  font-size: 16px;
  line-height: 1;
  padding: 8px 12px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background 0.18s ease, transform 0.12s ease, border-color 0.18s ease;
  font-family: inherit;
}
.bg-music-toggle:hover {
  background: var(--primary-ring);
  border-color: var(--primary-soft);
}
.bg-music-toggle:active { transform: scale(0.95); }
.bg-music-toggle[aria-pressed="true"] {
  background: linear-gradient(135deg, var(--primary) 0%, var(--amber) 100%);
  color: var(--surface);
  box-shadow: 0 4px 10px -2px var(--primary-ring);
}
.bg-music-toggle--floating {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 60;
  padding: 12px 14px;
  font-size: 20px;
  box-shadow: 0 6px 16px -4px rgba(0,0,0,0.25);
}

/* ============================================================
   Mini podium (between-question top 3)
   ============================================================ */
.mini-podium {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  max-width: 720px;
  margin: 24px auto 18px;
}
.mini-step {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 12px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  position: relative;
  box-shadow: var(--shadow-sm);
}
.mini-step.mini-empty { background: transparent; border-style: dashed; opacity: 0.35; }
.mini-rank-1 {
  border-color: var(--amber);
  background: linear-gradient(180deg, #fff8e6 0%, var(--surface) 100%);
  transform: translateY(-6px);
  box-shadow: var(--shadow-card);
}
.mini-rank-2 {
  border-color: var(--border-strong);
  background: linear-gradient(180deg, #f8fafc 0%, var(--surface) 100%);
}
.mini-rank-3 {
  border-color: var(--light-orange);
  background: linear-gradient(180deg, #fff1e6 0%, var(--surface) 100%);
}
.mini-name {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mini-score {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-weight: 900;
  font-size: 20px;
  color: var(--primary-dark);
}

/* Medal pill (shared between mini-podium and full podium) */
.medal {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 18px;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.5);
}
.medal-1 {
  background: radial-gradient(circle at 30% 30%, #ffe48a 0%, var(--amber-light) 45%, #d97706 100%);
  color: #5b3a00;
}
.medal-2 {
  background: radial-gradient(circle at 30% 30%, #f8fafc 0%, #cbd5e1 45%, #64748b 100%);
  color: #1f2937;
}
.medal-3 {
  background: radial-gradient(circle at 30% 30%, #fed7aa 0%, var(--light-orange) 45%, #c2410c 100%);
  color: #5a2a0a;
}

/* ============================================================
   Full podium (game-over victory stand)
   ============================================================ */
.podium {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 18px;
  max-width: 720px;
  margin: 28px auto 36px;
  align-items: end;
}
.podium-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.podium-empty { visibility: hidden; }
.podium-figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.podium-figure .medal {
  width: 56px; height: 56px; font-size: 24px;
  box-shadow:
    inset 0 0 0 3px rgba(255,255,255,0.55),
    0 8px 20px -4px rgba(0,0,0,0.18);
}
.podium-name {
  font-weight: 800;
  font-size: 17px;
  color: var(--text);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.podium-score {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-weight: 900;
  font-size: 22px;
  color: var(--primary-dark);
}
.podium-step {
  width: 100%;
  border-radius: var(--radius) var(--radius) 0 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10px;
  color: var(--surface);
  font-weight: 900;
  font-size: 28px;
  box-shadow:
    inset 0 -8px 16px rgba(0,0,0,0.08),
    0 8px 24px -10px rgba(0,0,0,0.25);
  transform-origin: bottom center;
  animation: podium-rise 0.7s cubic-bezier(.2,.8,.2,1) both;
}
.podium-step-1 {
  height: 180px;
  background: linear-gradient(180deg, var(--amber-light) 0%, var(--amber) 100%);
  animation-delay: 0.5s;
}
.podium-step-2 {
  height: 130px;
  background: linear-gradient(180deg, #e2e8f0 0%, #94a3b8 100%);
  animation-delay: 0.2s;
}
.podium-step-3 {
  height: 95px;
  background: linear-gradient(180deg, var(--light-orange) 0%, #c2410c 100%);
  animation-delay: 0.35s;
}
.podium-step-num { opacity: 0.85; }
@keyframes podium-rise {
  0%   { transform: scaleY(0); }
  60%  { transform: scaleY(1.04); }
  100% { transform: scaleY(1); }
}

@media (max-width: 560px) {
  .podium { gap: 10px; }
  .podium-name { font-size: 14px; max-width: 100px; }
  .podium-score { font-size: 18px; }
  .podium-figure .medal { width: 44px; height: 44px; font-size: 18px; }
  .podium-step-1 { height: 130px; }
  .podium-step-2 { height: 95px; }
  .podium-step-3 { height: 70px; }
}

/* ============================================================
   Reduced motion respect
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .landing-hero .eyebrow::before,
  .badge.live::before,
  .live-dot::before,
  .opt-tile.correct,
  .podium-step {
    animation: none;
  }
  .podium-step { transform: none; }
}
