/* ══════════════════════════════════════════════════════════════════
   ANALYSIS PAGE  –  Apple Fitness-style dark analytics
   All rules scoped to #pg-att or .an-* so zero bleed to other pages
   ══════════════════════════════════════════════════════════════════ */

/* ── Page shell ── */
#pg-att {
  background: #000;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  min-height: 100vh;
}
.an-scroll { padding: 0 0 100px; }

/* ── Scope toggle ── */
.an-scope-row {
  display: flex;
  gap: 6px;
  padding: 14px 16px 2px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.an-scope-row::-webkit-scrollbar { display: none; }
.an-scope-chip {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,.14);
  background: transparent;
  color: rgba(255,255,255,.5);
  font-size: 13px; font-weight: 700;
  cursor: pointer;
  font-family: -apple-system, sans-serif;
  transition: background .15s, color .15s, border-color .15s;
  -webkit-tap-highlight-color: transparent;
}
.an-scope-chip--on {
  background: rgba(74,222,128,.18);
  border-color: rgba(74,222,128,.45);
  color: #4ade80;
}

/* ── Hero rings ── */
.an-hero {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0;
  padding: 18px 12px 8px;
}
.an-ring-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 12px 4px 10px;
  border-radius: 18px;
  transition: background .15s;
  -webkit-tap-highlight-color: transparent;
}
.an-ring-item:active { background: rgba(255,255,255,.05); }
.an-ring-wrap { position: relative; display: flex; align-items: center; justify-content: center; }
.an-ring-val {
  position: absolute;
  font-size: 14px; font-weight: 800;
  color: #fff; letter-spacing: -.5px;
  text-align: center; line-height: 1;
}
.an-ring-val--sm { font-size: 12px; }
.an-ring-lbl {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .6px;
  color: rgba(255,255,255,.38);
  text-align: center; line-height: 1.3;
}
.an-ring-sub {
  font-size: 11px; color: rgba(255,255,255,.38);
  text-align: center; margin-top: -4px;
}

/* ── Section label ── */
.an-section { padding: 20px 16px 0; }
.an-section-hd {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .9px;
  color: rgba(255,255,255,.38);
  margin-bottom: 10px;
}

/* ── Card base ── */
.an-card {
  background: #1c1c1e;
  border-radius: 18px;
  overflow: hidden;
  margin-bottom: 10px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 4px 24px rgba(0,0,0,.55);
}
.an-card--tap {
  cursor: pointer;
  transition: background .15s;
  -webkit-tap-highlight-color: transparent;
}
.an-card--tap:active { background: #2c2c2e; }
.an-card-pad { padding: 14px 16px; }

/* ── Trend sparkline card ── */
.an-trend-card {
  padding: 14px 16px 10px;
}
.an-trend-hd {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.an-trend-title {
  font-size: 13px; font-weight: 700; color: #fff;
}
.an-trend-count {
  font-size: 12px; font-weight: 600; color: rgba(255,255,255,.38);
}
.an-trend-chart {
  display: flex; align-items: flex-end; gap: 4px;
  height: 52px; overflow: hidden;
}
.an-trend-bar-wrap {
  display: flex; flex-direction: column; align-items: center;
  gap: 3px; flex: 1; min-width: 0;
}
.an-trend-bar {
  width: 100%; min-height: 3px; border-radius: 4px 4px 0 0;
  background: rgba(74,222,128,.65);
  transition: height .3s ease;
}
.an-trend-bar--match { background: rgba(96,165,250,.75); }
.an-trend-bar--zero  { background: rgba(255,255,255,.1); }
.an-trend-lbl {
  font-size: 8px; font-weight: 600; color: rgba(255,255,255,.3);
  white-space: nowrap; text-overflow: ellipsis; overflow: hidden;
  max-width: 100%; text-align: center;
}
.an-trend-legend {
  display: flex; gap: 12px; margin-top: 10px; padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,.07);
}
.an-trend-leg-item {
  display: flex; align-items: center; gap: 5px;
  font-size: 10px; font-weight: 600; color: rgba(255,255,255,.4);
}
.an-trend-leg-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}

/* ── Summary stat strip ── */
.an-stat-strip {
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.an-stat {
  display: flex; flex-direction: column; gap: 3px;
  align-items: center; text-align: center;
}
.an-stat--left { align-items: flex-start; text-align: left; }
.an-stat-val {
  font-size: 22px; font-weight: 800; color: #fff;
  letter-spacing: -.5px; line-height: 1;
}
.an-stat-val--green { color: #4ade80; }
.an-stat-val--blue  { color: #60a5fa; }
.an-stat-val--amber { color: #fbbf24; }
.an-stat-val--red   { color: #f87171; }
.an-stat-lbl {
  font-size: 10px; font-weight: 600; color: rgba(255,255,255,.38);
  text-transform: uppercase; letter-spacing: .5px; line-height: 1.2;
}

/* ── At-risk strip ── */
.an-atrisk {
  margin: 0 0 10px;
  background: rgba(251,191,36,.1);
  border: 1px solid rgba(251,191,36,.25);
  border-radius: 14px;
  padding: 11px 14px;
}
.an-atrisk-hd {
  font-size: 12px; font-weight: 700; color: #fbbf24;
  margin-bottom: 8px;
}
.an-atrisk-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.an-atrisk-chip {
  font-size: 11px; font-weight: 700; color: #fbbf24;
  background: rgba(251,191,36,.12); border: 1px solid rgba(251,191,36,.3);
  border-radius: 20px; padding: 3px 10px;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}

/* ── Player list ── */
.an-player-list { display: flex; flex-direction: column; }
.an-player-row {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 16px;
  border-bottom: 1px solid rgba(255,255,255,.05);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background .12s;
}
.an-player-row:last-child { border-bottom: none; }
.an-player-row:active { background: rgba(255,255,255,.04); }
.an-player-rank {
  font-size: 12px; font-weight: 700; color: rgba(255,255,255,.28);
  min-width: 18px; text-align: right; flex-shrink: 0;
}
.an-player-dot {
  width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
}
.an-player-dot--g { background: #4ade80; }
.an-player-dot--w { background: #94a3b8; }
.an-player-info { flex: 1; min-width: 0; }
.an-player-name {
  font-size: 13px; font-weight: 700; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.an-player-meta {
  font-size: 11px; color: rgba(255,255,255,.38);
  margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.an-player-bar-wrap { flex: 0 0 80px; }
.an-bar-track {
  height: 4px; background: rgba(255,255,255,.1); border-radius: 3px; overflow: hidden;
}
.an-bar-fill {
  height: 100%; border-radius: 3px;
  background: #4ade80;
  transition: width .4s ease;
}
.an-bar-fill--med { background: #fbbf24; }
.an-bar-fill--low { background: #f87171; }
.an-bar-fill--blue { background: #60a5fa; }
.an-bar-fill--mins { background: #a78bfa; }
.an-player-val {
  font-size: 13px; font-weight: 800; color: #fff;
  min-width: 36px; text-align: right; flex-shrink: 0; letter-spacing: -.3px;
}
.an-player-val--green { color: #4ade80; }
.an-player-val--amber { color: #fbbf24; }
.an-player-val--red   { color: #f87171; }
.an-player-chevron { color: rgba(255,255,255,.2); flex-shrink: 0; }
.an-player-chevron [data-lucide] { width: 14px; height: 14px; }

/* ── Streak badge ── */
.an-streak {
  display: inline-block;
  font-size: 10px; font-weight: 700; color: #fbbf24;
  background: rgba(251,191,36,.15);
  border-radius: 6px; padding: 1px 5px;
  margin-left: 5px; vertical-align: middle;
}

/* ── Recent dot ── */
.an-recent-dot {
  display: inline-block;
  width: 7px; height: 7px; border-radius: 50%;
  margin-right: 5px; flex-shrink: 0; vertical-align: middle;
}
.an-recent-dot--g { background: #4ade80; }
.an-recent-dot--a { background: #fbbf24; }
.an-recent-dot--r { background: #f87171; }

/* ── "Show more" toggle ── */
.an-show-more {
  display: block; width: 100%; padding: 12px;
  background: none; border: none; border-top: 1px solid rgba(255,255,255,.06);
  color: #4ade80; font-size: 13px; font-weight: 700;
  cursor: pointer; text-align: center;
  font-family: -apple-system, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
.an-show-more:active { opacity: .7; }

/* ── Playing time equity strip ── */
.an-equity-strip {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.an-equity-label {
  font-size: 11px; font-weight: 600; color: rgba(255,255,255,.4);
  white-space: nowrap;
}
.an-equity-track {
  flex: 1; height: 6px; background: rgba(255,255,255,.1);
  border-radius: 4px; overflow: hidden;
}
.an-equity-fill {
  height: 100%; border-radius: 4px;
  background: linear-gradient(90deg, #a78bfa, #818cf8);
  transition: width .5s ease;
}
.an-equity-pct {
  font-size: 13px; font-weight: 800; color: #a78bfa;
  min-width: 36px; text-align: right;
}

/* ── Empty state ── */
.an-empty {
  text-align: center; padding: 32px 16px;
  color: rgba(255,255,255,.3); font-size: 13px;
}

/* ══════════════════════════════════════════════════════════════════
   DRILL-DOWN SHEET
   ══════════════════════════════════════════════════════════════════ */

.an-drill-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,.65);
  align-items: flex-end; justify-content: center;
}
.an-drill-overlay.open { display: flex; }

.an-drill-sheet {
  background: #1c1c1e;
  border-radius: 24px 24px 0 0;
  width: 100%; max-width: 560px;
  max-height: 88vh;
  display: flex; flex-direction: column;
  box-shadow: 0 -4px 40px rgba(0,0,0,.6);
  overflow: hidden;
}

.an-drill-hd {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px 10px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
}
.an-drill-title {
  font-size: 16px; font-weight: 800; color: #fff;
  display: flex; align-items: center; gap: 8px;
}
.an-drill-close {
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(255,255,255,.1); border: none; cursor: pointer;
  color: rgba(255,255,255,.6); display: flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.an-drill-close [data-lucide] { width: 14px; height: 14px; }

/* Tab bar inside sheet */
.an-drill-tabs {
  display: flex; gap: 0;
  padding: 10px 16px 0;
  border-bottom: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
}
.an-drill-tab {
  flex: 1; padding: 8px 4px; border: none; background: none;
  font-size: 13px; font-weight: 700; color: rgba(255,255,255,.38);
  cursor: pointer; border-bottom: 2px solid transparent;
  font-family: -apple-system, sans-serif;
  transition: color .15s, border-color .15s;
  -webkit-tap-highlight-color: transparent;
}
.an-drill-tab--on { color: #4ade80; border-bottom-color: #4ade80; }

.an-drill-body {
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  flex: 1; padding: 16px 18px 24px;
}

/* Summary ring + stats row inside sheet */
.an-drill-summary {
  display: flex; align-items: center; gap: 16px;
  margin-bottom: 18px;
}
.an-drill-stats { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.an-drill-stat { display: flex; flex-direction: column; gap: 2px; }
.an-drill-stat-val { font-size: 28px; font-weight: 800; color: #fff; line-height: 1; letter-spacing: -.5px; }
.an-drill-stat-lbl { font-size: 11px; color: rgba(255,255,255,.38); text-transform: uppercase; letter-spacing: .5px; }

/* Split pills (training % vs match %) */
.an-drill-split {
  display: flex; gap: 8px; margin-bottom: 16px;
}
.an-drill-split-pill {
  flex: 1; background: rgba(255,255,255,.06);
  border-radius: 12px; padding: 10px 12px;
  display: flex; flex-direction: column; gap: 3px;
}
.an-drill-split-val { font-size: 22px; font-weight: 800; color: #fff; line-height: 1; }
.an-drill-split-lbl { font-size: 10px; font-weight: 600; color: rgba(255,255,255,.38); text-transform: uppercase; letter-spacing: .5px; }

/* Mini session bar chart */
.an-mini-chart {
  display: flex; align-items: flex-end; gap: 4px;
  height: 40px; margin-bottom: 14px;
}
.an-mini-bar-wrap {
  display: flex; flex-direction: column; align-items: center; gap: 3px; flex: 1;
}
.an-mini-bar {
  width: 100%; border-radius: 3px 3px 0 0;
  transition: height .3s;
}
.an-mini-bar--on { background: #4ade80; }
.an-mini-bar--off { background: rgba(255,255,255,.1); height: 3px !important; }
.an-mini-bar--match-on { background: #60a5fa; }
.an-mini-lbl {
  font-size: 8px; color: rgba(255,255,255,.3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 100%; text-align: center;
}

/* Session history list */
.an-session-hd {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .7px; color: rgba(255,255,255,.38);
  margin-bottom: 8px;
}
.an-session-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 0; border-bottom: 1px solid rgba(255,255,255,.05);
}
.an-session-row:last-child { border-bottom: none; }
.an-session-icon {
  width: 20px; height: 20px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 800; flex-shrink: 0;
}
.an-session-icon--on  { background: rgba(74,222,128,.2); color: #4ade80; }
.an-session-icon--off { background: rgba(255,255,255,.07); color: rgba(255,255,255,.3); }
.an-session-info { flex: 1; min-width: 0; }
.an-session-date { font-size: 12px; font-weight: 700; color: #fff; display: block; }
.an-session-lbl  { font-size: 11px; color: rgba(255,255,255,.38); display: block; margin-top: 1px; }
.an-session-badge {
  font-size: 9px; font-weight: 800; padding: 2px 6px; border-radius: 6px;
  text-transform: uppercase; letter-spacing: .4px; flex-shrink: 0;
}
.an-session-badge--train { background: rgba(74,222,128,.15); color: #4ade80; }
.an-session-badge--match { background: rgba(96,165,250,.15); color: #60a5fa; }

/* Mins history list */
.an-mins-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 0; border-bottom: 1px solid rgba(255,255,255,.05);
}
.an-mins-row:last-child { border-bottom: none; }
.an-mins-date { font-size: 12px; font-weight: 700; color: #fff; flex: 1; }
.an-mins-sport { font-size: 11px; color: rgba(255,255,255,.38); }
.an-mins-val {
  font-size: 16px; font-weight: 800; color: #a78bfa;
  min-width: 40px; text-align: right;
}

/* ── Narrow screen adjustments ── */
@media (max-width: 380px) {
  .an-hero { padding: 14px 6px 4px; gap: 0; }
  .an-ring-val { font-size: 12px; }
  .an-ring-lbl { font-size: 9px; }
  .an-stat-val { font-size: 19px; }
}
