/* ============================================
   PROFILE PAGE STYLES
   ============================================ */

/* Header */
.profile-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: var(--space-8) 0;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: var(--space-6);
}

.profile-header__left {
  display: flex;
  gap: var(--space-5);
  align-items: center;
}

.profile-header__avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--border-color);
}

.profile-header__avatar--initials {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 700;
  background: var(--bg-card);
  color: var(--text-bright);
}

.profile-header__name {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  color: var(--text-bright);
  margin-bottom: var(--space-1);
}

.profile-header__meta {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  margin-bottom: var(--space-1);
}

.profile-header__rank {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.profile-header__joined {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* ---- V3 header: name row + stat meta + XP progress bar ---- */
.profile-header--v3 .profile-header__info {
  min-width: 0;
}
.profile-header__nameRow {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: var(--space-1);
}
.profile-header__nameRow .profile-header__name {
  margin-bottom: 0;
}
.profile-header--v3 .profile-header__meta {
  flex-wrap: wrap;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: 14px;
}
.profile-header--v3 .profile-header__meta > span { white-space: nowrap; }
.pf-hdot { color: var(--text-muted); opacity: .7; }
/* streak = the single colored accent in the meta row */
.pf-hstreak {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--accent-gold);
  font-weight: var(--font-semibold);
}
.pf-flame { color: var(--accent-gold); vertical-align: -1px; }
.pf-hsolved { color: var(--text-secondary); }   /* muted, not bold */

/* XP progress block */
.pf-hxp { max-width: 360px; }
.pf-hxp__meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 7px;
}
.pf-hxp__lv {
  font-size: var(--text-sm);
  font-weight: var(--font-bold);
  color: var(--text-bright);
}
.pf-hxp__val {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-weight: var(--font-medium);
}
.pf-hxp__bar {
  height: 9px;
  border-radius: 999px;
  background: rgba(127, 134, 156, 0.16);
  overflow: hidden;
}
.pf-hxp__bar > i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width .5s cubic-bezier(.4,0,.2,1);
}

/* Cards */
.profile-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-bottom: var(--space-4);
}

.profile-card--wide {
  /* full width — no additional sizing needed */
}

.profile-card--solved {
  /* inherits base card styles */
}

.profile-card__header {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--text-secondary);
  margin-bottom: var(--space-4);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Stats Grid */
.profile-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

/* Solved Overview */
.solved-overview {
  display: flex;
  gap: var(--space-6);
  align-items: center;
}

.solved-ring {
  flex-shrink: 0;
}

.solved-ring__svg {
  width: 120px;
  height: 120px;
}

.solved-breakdown {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.solved-row {
  display: grid;
  grid-template-columns: 60px 70px 1fr;
  align-items: center;
  gap: var(--space-2);
}

.solved-row__label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.solved-row__count {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--text-bright);
}

.solved-row__total {
  color: var(--text-muted);
  font-weight: 400;
}

.solved-row__bar {
  height: 6px;
  background: var(--bg-main);
  border-radius: 3px;
  overflow: hidden;
}

.solved-row__fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.8s ease;
}

.solved-row__fill--easy { background: var(--color-easy); }
.solved-row__fill--medium { background: var(--color-medium); }
.solved-row__fill--hard { background: var(--color-hard); }

/* Badges Grid */
.badges-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: var(--space-3);
}

.badge-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 10px 12px;
  border-radius: 12px;
  text-align: center;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.badge-card:hover {
  transform: translateY(-2px);
}

/* Rarity-based gradients for unlocked badges */
.badge-card--unlocked.badge-card--common {
  background: linear-gradient(135deg, #2a2d3e 0%, #1e2030 100%);
  border: 1px solid #4a4e69;
  box-shadow: 0 2px 8px rgba(74, 78, 105, 0.2);
}
.badge-card--unlocked.badge-card--common:hover {
  box-shadow: 0 4px 16px rgba(74, 78, 105, 0.35);
}

.badge-card--unlocked.badge-card--rare {
  background: linear-gradient(135deg, #1a2a4a 0%, #142040 100%);
  border: 1px solid #4c8bf5;
  box-shadow: 0 2px 8px rgba(76, 139, 245, 0.15);
}
.badge-card--unlocked.badge-card--rare:hover {
  box-shadow: 0 4px 16px rgba(76, 139, 245, 0.3);
}

.badge-card--unlocked.badge-card--epic {
  background: linear-gradient(135deg, #2a1a4a 0%, #1e1040 100%);
  border: 1px solid #a855f7;
  box-shadow: 0 2px 8px rgba(168, 85, 247, 0.15);
}
.badge-card--unlocked.badge-card--epic:hover {
  box-shadow: 0 4px 16px rgba(168, 85, 247, 0.3);
}

.badge-card--unlocked.badge-card--legendary {
  background: linear-gradient(135deg, #3a2a0a 0%, #2a1a00 100%);
  border: 1px solid #f59e0b;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.2);
}
.badge-card--unlocked.badge-card--legendary:hover {
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.35);
}

/* Glow effect for unlocked */
.badge-card__glow {
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: conic-gradient(from 0deg, transparent, rgba(255,255,255,0.03), transparent, rgba(255,255,255,0.03), transparent);
  animation: badge-shimmer 6s linear infinite;
  pointer-events: none;
}

@keyframes badge-shimmer {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Locked badges */
.badge-card--locked {
  background: var(--bg-main);
  border: 1px dashed var(--border-color);
  opacity: 0.45;
}
.badge-card--locked:hover {
  opacity: 0.65;
}

.badge-card__icon {
  font-size: 1.75rem;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}
.badge-card__icon .ach-svg { width: 48px; height: 48px; margin: 0 auto; filter: none; }

.badge-card--locked .badge-card__icon {
  color: var(--text-muted);
}

.badge-card__name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.02em;
}

.badge-card--locked .badge-card__name {
  color: var(--text-muted);
}

.badge-card__rarity {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
}

.badge-card--common .badge-card__rarity { color: #9ca3af; }
.badge-card--rare .badge-card__rarity { color: #60a5fa; }
.badge-card--epic .badge-card__rarity { color: #c084fc; }
.badge-card--legendary .badge-card__rarity { color: #fbbf24; }
.badge-card--locked .badge-card__rarity { color: var(--text-muted); }

.badges-summary {
  margin-top: var(--space-3);
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-align: center;
}

/* Heatmap */
.heatmap-container {
  overflow-x: auto;
}

.heatmap {
  display: flex;
  gap: var(--space-2);
  padding-bottom: var(--space-2);
}

.heatmap__labels {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 0;
}

.heatmap__day-label {
  height: 13px;
  font-size: 9px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
}

.heatmap__grid {
  display: flex;
  gap: 3px;
}

.heatmap__week {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.heatmap__cell {
  width: 13px;
  height: 13px;
  border-radius: 2px;
  transition: background 0.2s;
}

.heatmap__cell--0 { background: var(--bg-main); }
.heatmap__cell--1 { background: #0e4429; }
.heatmap__cell--2 { background: #006d32; }
.heatmap__cell--3 { background: #26a641; }
.heatmap__cell--4 { background: #39d353; }

/* Light theme heatmap colors */
[data-theme="light"] .heatmap__cell--0 { background: #ebedf0; }
[data-theme="light"] .heatmap__cell--1 { background: #9be9a8; }
[data-theme="light"] .heatmap__cell--2 { background: #40c463; }
[data-theme="light"] .heatmap__cell--3 { background: #30a14e; }
[data-theme="light"] .heatmap__cell--4 { background: #216e39; }

.heatmap__legend {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: var(--space-2);
  font-size: 10px;
  color: var(--text-muted);
}

.heatmap__legend .heatmap__cell {
  width: 11px;
  height: 11px;
}

/* Community Stats */
.profile-community {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.community-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

.community-stat {
  text-align: center;
}

.community-stat__icon {
  font-size: 1.5rem;
  margin-bottom: var(--space-1);
}

.community-stat__value {
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  color: var(--text-bright);
}

.community-stat__label {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* Level Detail */
.profile-level-detail {
  margin-bottom: var(--space-4);
}

.profile-level-detail__badge {
  font-size: var(--text-lg);
  font-weight: var(--font-bold);
  color: var(--color-accent, #4c8bf5);
  margin-bottom: var(--space-1);
}

.profile-level-detail__xp {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-2);
}

.profile-level-detail__bar {
  height: 8px;
  background: var(--bg-main);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: var(--space-1);
}

.profile-level-detail__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-accent, #4c8bf5), #8b5cf6);
  border-radius: 4px;
  transition: width 1s ease;
}

.profile-level-detail__text {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* Streak Row */
.profile-streak-row {
  display: flex;
  gap: var(--space-6);
}

.profile-streak-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.profile-streak-item__icon {
  font-size: 1.2rem;
}

.profile-streak-item__value {
  font-size: var(--text-lg);
  font-weight: var(--font-bold);
  color: var(--text-bright);
}

.profile-streak-item__label {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* Skills */
.skills-section {
  margin-bottom: var(--space-4);
}

.skills-section:last-child {
  margin-bottom: 0;
}

.skills-section__title {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  margin-bottom: var(--space-2);
}

.skills-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.skill-tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 4px 10px;
  border-radius: var(--radius-full, 999px);
  border: 1px solid;
  font-size: var(--text-xs);
  color: var(--text-secondary);
  background: var(--bg-main);
}

.skill-tag__count {
  color: var(--text-muted);
  font-weight: var(--font-semibold);
}

/* Tabs */
.profile-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: var(--space-4);
}

.profile-tab {
  padding: var(--space-3) var(--space-5);
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: var(--text-sm);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  font-family: inherit;
}

.profile-tab:hover {
  color: var(--text-secondary);
}

.profile-tab--active {
  color: var(--text-bright);
  border-bottom-color: var(--color-accent, #4c8bf5);
}

/* Recent List */
.recent-list {
  display: flex;
  flex-direction: column;
}

.recent-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-2);
  border-bottom: 1px solid var(--border-subtle, var(--border-color));
  text-decoration: none;
  transition: background 0.15s;
}

.recent-item:hover {
  background: var(--bg-main);
}

.recent-item:last-child {
  border-bottom: none;
}

.recent-item__title {
  font-size: var(--text-sm);
  color: var(--text-bright);
}

/* Collections in profile */
.collections-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.collection-card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.collection-card__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-main);
  border-bottom: 1px solid var(--border-color);
}

.collection-card__name {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--text-bright);
}

.collection-card__count {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* A saved list now renders ALL its problems (was capped at 5 with a dead
   "+N more"); cap the height and let it scroll so long lists stay usable. */
.collection-card__scroll {
  max-height: 320px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* ---- Saved Lists tab: compact tiles that open the My Lists page ---- */
.collections-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}
.collections-toolbar__hint { font-size: var(--text-xs); color: var(--text-muted); }
.collections-openall {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--accent);
  text-decoration: none;
}
.collections-openall:hover { text-decoration: underline; }
.collections-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-3);
}
.collection-tile {
  display: block;
  text-decoration: none;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  padding: var(--space-4);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.collection-tile:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border-color));
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
  transform: translateY(-1px);
}
.collection-tile__top { display: flex; align-items: center; gap: 9px; margin-bottom: 6px; }
.collection-tile__icon {
  width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0;
  background: color-mix(in srgb, var(--accent) 12%, var(--bg-main)); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
}
.collection-tile__icon svg { width: 15px; height: 15px; }
.collection-tile__name {
  font-size: var(--text-sm); font-weight: var(--font-semibold); color: var(--text-bright);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.collection-tile__count { font-size: var(--text-xs); color: var(--text-muted); margin-bottom: 10px; }
.collection-tile__bar { height: 6px; border-radius: 999px; background: var(--bg-main); overflow: hidden; }
.collection-tile__fill {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 70%, #22c55e));
}
.collection-tile__meta {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 7px; font-size: var(--text-xs); color: var(--text-muted);
}
.collection-tile__open { color: var(--accent); font-weight: var(--font-semibold); }

/* ============================================
   LEARNING PATH PROGRESS — Duolingo-style
   ============================================ */
.profile-card--learning {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  position: relative;
  overflow: hidden;
}

.profile-card--learning .profile-card__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.lrn-view-all {
  font-size: var(--text-xs);
  color: var(--color-accent, #4c8bf5);
  text-decoration: none;
  font-weight: 600;
  transition: opacity 0.15s;
}
.lrn-view-all:hover { opacity: 0.8; }

/* Continue Learning CTA */
.lrn-cta {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  margin-bottom: var(--space-5);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #58cc02 0%, #46a302 100%);
  color: #fff;
  text-decoration: none;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
}
.lrn-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(88, 204, 2, 0.35);
}
.lrn-cta--complete {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  cursor: default;
}
.lrn-cta--complete:hover {
  transform: none;
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.25);
}
.lrn-cta__pulse {
  position: absolute;
  top: 50%;
  left: -20px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  transform: translateY(-50%);
  animation: lrn-pulse 2s ease-in-out infinite;
}
@keyframes lrn-pulse {
  0%, 100% { transform: translateY(-50%) scale(1); opacity: 0.4; }
  50% { transform: translateY(-50%) scale(1.4); opacity: 0; }
}
.lrn-cta__content {
  flex: 1;
  min-width: 0;
}
.lrn-cta__label {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.9;
  margin-bottom: 2px;
}
.lrn-cta__lesson {
  font-size: var(--text-xs);
  opacity: 0.75;
  margin-bottom: 2px;
}
.lrn-cta__title {
  font-size: var(--text-base);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lrn-cta__arrow {
  font-size: 1.5rem;
  font-weight: 700;
  opacity: 0.8;
  flex-shrink: 0;
  transition: transform 0.2s;
}
.lrn-cta:hover .lrn-cta__arrow {
  transform: translateX(4px);
}

/* Overview stats ring + numbers */
.lrn-overview {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-5);
  border-bottom: 1px solid var(--border-color);
}
.lrn-ring-wrap {
  flex-shrink: 0;
}
.lrn-ring__svg {
  width: 100px;
  height: 100px;
}
.lrn-overview__stats {
  display: flex;
  gap: var(--space-6);
}
.lrn-overview__stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.lrn-overview__val {
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  color: var(--text-bright);
}
.lrn-overview__lbl {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* Flame streak row */
.lrn-flames {
  display: flex;
  justify-content: center;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}
.lrn-flame {
  font-size: 1.3rem;
  transition: transform 0.2s;
}
.lrn-flame--lit {
  animation: lrn-flame-bob 1.5s ease-in-out infinite;
}
@keyframes lrn-flame-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}
.lrn-flame:nth-child(2) { animation-delay: 0.1s; }
.lrn-flame:nth-child(3) { animation-delay: 0.2s; }
.lrn-flame:nth-child(4) { animation-delay: 0.3s; }
.lrn-flame:nth-child(5) { animation-delay: 0.4s; }
.lrn-flame:nth-child(6) { animation-delay: 0.5s; }
.lrn-flame:nth-child(7) { animation-delay: 0.6s; }

/* Track sections */
.lrn-track {
  margin-bottom: var(--space-5);
}
.lrn-track:last-child { margin-bottom: 0; }

.lrn-track__header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}
.lrn-track__icon {
  font-size: 1.2rem;
}
.lrn-track__title {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--text-bright);
  flex: 1;
}
.lrn-track__stat {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-weight: 600;
}
.lrn-track__bar {
  height: 6px;
  background: var(--bg-main);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: var(--space-3);
}
.lrn-track__fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, #58cc02, #89e219);
  transition: width 0.8s ease;
}
.lrn-track__topics {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

/* Topic row */
.lrn-topic {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  transition: background 0.15s;
}
.lrn-topic:hover {
  background: var(--bg-main);
}
.lrn-topic__icon {
  font-size: 1.1rem;
  flex-shrink: 0;
  width: 28px;
  text-align: center;
}
.lrn-topic__info {
  flex: 1;
  min-width: 0;
}
.lrn-topic__name {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-bright);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lrn-topic__sub {
  font-size: 11px;
  color: var(--text-muted);
}
.lrn-topic__bar-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 130px;
  flex-shrink: 0;
}
.lrn-topic__bar {
  flex: 1;
  height: 5px;
  background: var(--bg-main);
  border-radius: 3px;
  overflow: hidden;
}
.lrn-topic__fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, #58cc02, #89e219);
  transition: width 0.6s ease;
}
.lrn-topic__fill--done {
  background: linear-gradient(90deg, #fbbf24, #f59e0b);
}
.lrn-topic__pct {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  width: 32px;
  text-align: right;
}

/* State modifiers */
.lrn-topic--done .lrn-topic__name {
  color: var(--text-muted);
}
.lrn-topic--done .lrn-topic__pct {
  color: #58cc02;
}
.lrn-topic--pending {
  opacity: 0.65;
}
.lrn-topic--active .lrn-topic__name {
  color: var(--text-bright);
}

/* Main Section Tabs (Learning / Problems) */
.profile-main-tabs {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 0;
}
.profile-main-tab {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: inherit;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.profile-main-tab:hover {
  color: var(--text-secondary);
}
.profile-main-tab--active {
  color: var(--text-bright);
  border-bottom-color: #58cc02;
}
.profile-main-tab__icon {
  font-size: 1.1rem;
}

/* Light theme overrides */
[data-theme="light"] .lrn-cta {
  box-shadow: 0 4px 16px rgba(88, 204, 2, 0.2);
}
[data-theme="light"] .lrn-cta:hover {
  box-shadow: 0 8px 24px rgba(88, 204, 2, 0.3);
}

/* Responsive */
@media (max-width: 768px) {
  .profile-header {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-4);
  }
  .profile-header__left {
    flex-direction: column;
    text-align: center;
  }
  /* name/meta block must shrink, not push the avatar offscreen */
  .profile-header__info {
    min-width: 0;
    max-width: 100%;
  }
  .profile-header__name {
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  .profile-header__meta {
    flex-wrap: wrap;
    justify-content: center;
  }
  .profile-header__nameRow { justify-content: center; }
  .profile-header--v3 .pf-hxp { margin: 0 auto; width: 100%; max-width: 360px; }
  /* "Practice Now" action: full-width pill instead of floating right */
  .profile-header__right {
    display: flex;
    justify-content: center;
  }
  .profile-stats-grid,
  .profile-community {
    grid-template-columns: 1fr;
  }
  .solved-overview {
    flex-direction: column;
    text-align: center;
  }
  .heatmap__grid {
    overflow-x: auto;
  }
  /* tab bars: never overflow — let them horizontal-scroll */
  .profile-tabs,
  .profile-main-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
  }
  .profile-tab,
  .profile-main-tab {
    flex: none;
    white-space: nowrap;
    padding-left: var(--space-3);
    padding-right: var(--space-3);
  }
  .lrn-overview {
    flex-direction: column;
    text-align: center;
  }
  .lrn-overview__stats {
    justify-content: center;
    flex-wrap: wrap;
    gap: var(--space-4);
  }
  .lrn-topic__bar-wrap {
    width: 90px;
  }
  .lrn-cta {
    padding: var(--space-3) var(--space-4);
  }
  .lrn-cta__title {
    font-size: var(--text-sm);
  }

  /* ---- Problems-Solved panel: stack hero, center ring, fit numbers ---- */
  .pf-hero {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: var(--space-3);
  }
  .pf-ring {
    width: 130px;
    height: 130px;
  }
  .pf-hs {
    width: 100%;
  }
  .pf-hs__b {
    padding: 6px 8px;
  }
  .pf-hs__n {
    font-size: 1.5rem;
  }
  .pf-grid2 {
    grid-template-columns: 1fr;
  }
  /* recommended-next CTA: stack so the button can't push past the edge */
  .pf-next {
    flex-wrap: wrap;
    padding: 16px;
    gap: 10px;
  }
  .pf-next__btn {
    margin-left: 0;
    width: 100%;
    text-align: center;
  }
  .pf-difflegend {
    flex-wrap: wrap;
    gap: 8px 14px;
  }
  /* charts / svg never exceed the card */
  .solved-ring__svg,
  .lrn-ring__svg,
  .pf-ring svg {
    max-width: 100%;
    height: auto;
  }

  /* ---- Skill / Elo diagnosis rows: keep label+bar+number on one line ---- */
  .skilldx__row {
    gap: var(--space-2);
  }
  .skilldx__name {
    width: auto;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .skilldx__bar {
    flex: none;
    width: 60px;
  }

  /* saved-round cards: single column, allow long titles to wrap */
  .saved-rounds-grid {
    grid-template-columns: 1fr;
  }
  .saved-round-card__title {
    overflow-wrap: anywhere;
  }
}

/* ============================================
   Saved Rounds tab — grid of (firm, stage) cards the user starred
   from the round.html prep page. Backed by the SavedRounds localStorage
   module (js/saved-rounds.js).
   ============================================ */

.saved-rounds-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
  gap: var(--space-3);
  padding: var(--space-3);
}
.saved-round-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  transition: border-color var(--transition-base), box-shadow var(--transition-base), transform var(--transition-base);
}
.saved-round-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.10);
  transform: translateY(-1px);
}
.saved-round-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2);
}
.saved-round-card__firm {
  font-size: 10px;
  font-weight: var(--font-bold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
}
.saved-round-card__remove {
  background: none;
  border: 1px solid transparent;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  line-height: 1;
  font-size: 16px;
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--transition-base), color var(--transition-base), border-color var(--transition-base);
}
.saved-round-card__remove:hover {
  background: var(--bg-secondary, #f8fafc);
  border-color: var(--border-color);
  color: var(--text-primary, var(--text-color));
}
.saved-round-card__title {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--text-primary, var(--text-color));
  text-decoration: none;
  line-height: 1.3;
}
.saved-round-card__title:hover { color: var(--accent); }
.saved-round-card__meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  font-size: var(--text-xs);
  color: var(--text-muted);
}
.saved-round-card__pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.10);
  color: var(--accent);
  font-weight: var(--font-semibold);
}
.saved-round-card__cta {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--accent);
  text-decoration: none;
  margin-top: var(--space-1);
}
.saved-round-card__cta:hover { text-decoration: underline; }

/* ============================================
   SKILL DIAGNOSIS (role-aware) + track selector
   ============================================ */
.skilldx__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}
.track-toggle {
  display: inline-flex;
  gap: 2px;
  background: var(--bg-subtle, rgba(127, 127, 127, 0.08));
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 3px;
}
.track-pill {
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  padding: 5px 12px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
}
.track-pill:hover { color: var(--text-bright); }
.track-pill--on {
  background: var(--bg-card, #fff);
  color: var(--accent);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.08);
}
.skilldx__empty {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  padding: var(--space-3) 0;
}
.skilldx__list { display: flex; flex-direction: column; }
.skilldx__row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 9px 2px;
  text-decoration: none;
  color: inherit;
  border-radius: 8px;
}
.skilldx__row:hover { background: var(--bg-subtle, rgba(127, 127, 127, 0.06)); }
.skilldx__name {
  width: 168px;
  flex: none;
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--text-bright);
}
.skilldx__bar {
  flex: 1;
  height: 8px;
  background: var(--border-color);
  border-radius: 5px;
  overflow: hidden;
}
.skilldx__bar i { display: block; height: 100%; border-radius: 5px; }
.skilldx__pct {
  width: 56px;
  flex: none;
  text-align: right;
  font-size: var(--text-xs);
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}
.skilldx__tag {
  width: 88px;
  flex: none;
  text-align: right;
  font-size: 10px;
  font-weight: var(--font-bold);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.skilldx__tag--good { color: #16a34a; }
.skilldx__tag--bad { color: #e0533d; }
@media (max-width: 640px) {
  .skilldx__name { width: 110px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .skilldx__tag { width: 64px; }
}

/* ============================================
   NARROW PHONES (<=480, true ~360-414px width since
   phones drop the desktop zoom:1.2). Squeeze the last
   fixed-width rows so nothing overflows horizontally.
   ============================================ */
@media (max-width: 480px) {
  /* skilldx row: drop the GOOD/WEAK tag (the bar + % already convey it),
     freeing width so name + bar + % fit without overflow */
  .skilldx__tag { display: none; }
  .skilldx__pct { width: 44px; }

  /* hero stat split: smaller numbers, tighter padding */
  .pf-hs__b { padding: 4px 6px; }
  .pf-hs__n { font-size: 1.3rem; }
  .pf-hs__l { font-size: 11px; }
  .pf-ring { width: 116px; height: 116px; }
  .pf-ring__n { font-size: 28px; }

  /* learning-path topic rows: shrink the fixed name + bar-wrap */
  .lrn-topic__bar-wrap { width: 74px; }
  .lrn-tp__n { width: 96px; }
  .lrn-tp__c { width: 44px; }

  /* difficulty legend stacks cleanly */
  .pf-difflegend { gap: 6px 12px; }

  /* pager wraps and stays inside the card */
  .pf-pager { gap: 3px; }
  .pf-pg { min-width: 28px; height: 28px; padding: 0 6px; }

  /* main section tabs: trim icon gap + padding to fit two tabs */
  .profile-main-tab { padding-left: var(--space-2); padding-right: var(--space-2); }
  .lrn-cta__content { min-width: 0; }
}

/* ============================================
   PROBLEMS-SOLVED PANEL (redesign parity)
   hero · recommended · difficulty · month heatmap
   ============================================ */
.pf-hero { display: grid; grid-template-columns: 160px 1fr; gap: var(--space-4); align-items: center; }
.pf-ring { position: relative; width: 150px; height: 150px; }
.pf-ring__c { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.pf-ring__n { font-size: 34px; font-weight: 800; line-height: 1; color: var(--text-bright); }
.pf-ring__l { font-size: 11px; color: var(--text-secondary); margin-top: 3px; text-transform: uppercase; letter-spacing: .05em; }
.pf-hs { display: grid; grid-template-columns: repeat(3, 1fr); }
.pf-hs__b { padding: 6px 20px; border-left: 1px solid var(--border-color); }
.pf-hs__b:first-child { border-left: 0; }
.pf-hs__n { font-size: 1.9rem; font-weight: 800; line-height: 1; letter-spacing: -.02em; color: var(--text-bright); }
.pf-hs__l { font-size: 12px; color: var(--text-secondary); margin-top: 6px; }
.pf-hs__d { display: block; font-size: 11px; font-weight: 700; margin-top: 4px; }
.pf-hs__d.up { color: #16a34a; }
.pf-hs__d.dn { color: #e0533d; }
.pf-hs__d.amb { color: #d97706; }
.pf-hs__d--flat { color: var(--text-muted); }
.pf-next { display: flex; align-items: center; gap: 18px; background: linear-gradient(135deg, #4f46e5, #2563eb); border-radius: 16px; padding: 18px 22px; margin: 14px 0; color: #fff; text-decoration: none; box-shadow: 0 6px 20px rgba(37, 99, 235, .28); }
.pf-next__l { font-size: 11px; color: rgba(255, 255, 255, .72); text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.pf-next__t { font-size: 17px; font-weight: 700; margin-top: 4px; color: #fff; }
.pf-next__s { font-size: 12.5px; color: rgba(255, 255, 255, .82); margin-top: 3px; }
.pf-next__btn { margin-left: auto; background: #fff; color: #2563eb; font-weight: 700; font-size: 13px; border-radius: 10px; padding: 11px 18px; white-space: nowrap; box-shadow: 0 2px 10px rgba(0, 0, 0, .14); }
.pf-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); margin-bottom: var(--space-4); }
.pf-grid2 > .profile-card { margin: 0; height: 100%; }
.pf-diffbar { display: flex; height: 30px; border-radius: 9px; overflow: hidden; margin: 2px 0 12px; }
.pf-diffbar i { display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; font-size: 13px; min-width: 0; overflow: hidden; }
.pf-diffbar--empty { background: var(--border-color); }
.pf-diffbar .de { background: #22c55e; }
.pf-diffbar .dm { background: #f59e0b; }
.pf-diffbar .dh { background: #ef5b46; }
.pf-difflegend { display: flex; gap: 18px; font-size: 12px; color: var(--text-secondary); }
.pf-difflegend b { color: var(--text-bright); }
.pf-difflegend span::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; vertical-align: middle; }
.pf-difflegend .le::before { background: #22c55e; }
.pf-difflegend .lm::before { background: #f59e0b; }
.pf-difflegend .lh::before { background: #ef5b46; }
.pf-diffnote { margin-top: 16px; font-size: 12.5px; color: var(--text-secondary); line-height: 1.5; }
.pf-heat { overflow-x: auto; }
.pf-heat .heatmap__grid { display: flex; gap: 3px; }
.pf-heat .heatmap__legend { margin-top: 10px; justify-content: flex-end; }
.pf-months { display: flex; gap: 3px; margin-bottom: 4px; }
.pf-mo { width: 13px; flex: none; font-size: 10px; color: var(--text-muted); white-space: nowrap; overflow: visible; }
.pf-pager { display: flex; align-items: center; justify-content: center; gap: 4px; padding: var(--space-4) 0 var(--space-1); flex-wrap: wrap; }
.pf-pg { min-width: 30px; height: 30px; padding: 0 8px; border: 1px solid var(--border-color); background: transparent; color: var(--text-secondary); border-radius: 8px; font-size: var(--text-sm); font-weight: var(--font-semibold); cursor: pointer; }
.pf-pg:hover { color: var(--text-bright); border-color: var(--text-muted); }
.pf-pg--on { background: var(--accent); color: #fff; border-color: var(--accent); }
.pf-pg--on:hover { color: #fff; }
.pf-pg--disabled { color: var(--text-muted); opacity: .5; cursor: default; display: inline-flex; align-items: center; justify-content: center; }
.pf-pg--gap { border: 0; background: transparent; cursor: default; color: var(--text-muted); }

/* Learning path — track bar, topic rows, up-next */
.lrn-hdr-r { font-weight: 600; color: var(--text-muted); text-transform: none; letter-spacing: 0; }
.lrn-trkbar { height: 8px; background: var(--bg-main); border-radius: 5px; overflow: hidden; margin: 0 0 14px; }
.lrn-trkbar i { display: block; height: 100%; border-radius: 5px; background: linear-gradient(90deg, #4f46e5, #2563eb); }
.lrn-tp { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border-color); }
.lrn-tp:last-child { border-bottom: 0; }
.lrn-tp__dot { width: 22px; height: 22px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; }
.lrn-tp__dot--done { background: rgba(34, 197, 94, .14); color: #15803d; }
.lrn-tp__dot--active { background: rgba(79, 70, 229, .12); color: #4f46e5; }
.lrn-tp__dot--pending { background: var(--bg-main); color: var(--text-muted); }
.lrn-tp__n { font-size: 14px; font-weight: 600; width: 190px; color: var(--text-bright); }
.lrn-tp__bar { flex: 1; height: 7px; background: var(--bg-main); border-radius: 4px; overflow: hidden; }
.lrn-tp__bar i { display: block; height: 100%; border-radius: 4px; background: var(--accent); }
.lrn-tp__bar i.full { background: #16a34a; }
.lrn-tp__c { font-size: 12px; color: var(--text-muted); width: 56px; text-align: right; font-variant-numeric: tabular-nums; }
.lrn-tp__tag { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; width: 78px; text-align: right; }
.lrn-tp__tag--done { color: #15803d; }
.lrn-tp__tag--up { color: #4f46e5; }
.lrn-un { display: flex; align-items: center; gap: 12px; padding: 11px 2px; border-bottom: 1px solid var(--border-color); text-decoration: none; }
.lrn-un:last-child { border-bottom: 0; }
.lrn-un:hover { background: var(--bg-main); }
.lrn-un__idx { width: 26px; height: 26px; border-radius: 8px; background: rgba(79, 70, 229, .10); color: #4f46e5; font-weight: 800; font-size: 12px; display: flex; align-items: center; justify-content: center; flex: none; }
.lrn-un__main { display: flex; flex-direction: column; min-width: 0; }
.lrn-un__t { font-size: 13.5px; font-weight: 600; color: var(--text-bright); }
.lrn-un__s { font-size: 11.5px; color: var(--text-muted); margin-top: 1px; }
.lrn-un__d { margin-left: auto; font-size: 11.5px; color: var(--text-muted); white-space: nowrap; }
@media (max-width: 640px) { .lrn-tp__n { width: 120px; } .lrn-tp__tag { display: none; } }
/* focus-firm selector (followed firms) above the Recommended card */
.pf-firmrow { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.pf-firmrow__l { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); margin-right: 2px; }
.pf-firmpill { border: 1px solid var(--border-color); background: var(--bg-card); color: var(--text-secondary); font-size: var(--text-xs); font-weight: var(--font-semibold); padding: 5px 12px; border-radius: 999px; cursor: pointer; text-decoration: none; line-height: 1.4; }
.pf-firmpill:hover { color: var(--text-bright); border-color: var(--accent-border); }
.pf-firmpill--on { background: var(--accent-light); color: var(--accent); border-color: var(--accent-border); }
.pf-firmpill--add { color: var(--accent); border-style: dashed; }
@media (max-width: 720px) {
  .pf-hero { grid-template-columns: 1fr; justify-items: center; gap: var(--space-3); }
  .pf-grid2 { grid-template-columns: 1fr; }
}

/* Elo priority-areas card (recommender) */
.pf-fy-chips{display:flex;flex-wrap:wrap;gap:8px;margin:6px 0 12px}
.pf-fy-chip{display:inline-flex;align-items:center;gap:7px;padding:6px 12px 6px 6px;border-radius:999px;background:var(--bg-main);border:1px solid var(--border-color);text-decoration:none;color:var(--text-primary);font-weight:600;font-size:13px}
.pf-fy-chip:hover{border-color:var(--accent)}
.pf-fy-num{width:20px;height:20px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-weight:800;font-size:11px;color:#fff}
.pf-fy-chip--1 .pf-fy-num{background:#ef4444}.pf-fy-chip--2 .pf-fy-num{background:#f59e0b}.pf-fy-chip--3 .pf-fy-num{background:#60a5fa}
.pf-fy-head{font-size:13px;color:var(--text-secondary);margin-bottom:8px}
.pf-fy-probs{display:grid;gap:7px}
.pf-fy-prob{display:flex;align-items:center;gap:10px;padding:9px 12px;background:var(--bg-main);border:1px solid var(--border-color);border-radius:9px;text-decoration:none;color:inherit}
.pf-fy-prob:hover{border-color:var(--accent)}
.pf-fy-prob__t{flex:1;min-width:0;font-size:13px;font-weight:500;color:var(--text-primary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.pf-fy-prob__cat{flex:none;font-size:11px;color:var(--text-muted)}
.pf-fy-prob__d{flex:none;font-size:11px;font-weight:700;padding:2px 8px;border-radius:999px;text-transform:capitalize}
.pf-fy-d-easy{background:#dcfce7;color:#166534}.pf-fy-d-medium{background:#fef3c7;color:#92400e}.pf-fy-d-hard{background:#fee2e2;color:#991b1b}
.pf-fy-retake{font-size:13px;font-weight:600;color:var(--accent);text-decoration:none}.pf-fy-retake:hover{text-decoration:underline}

/* Deep-link flash when arriving from the dashboard "Full ratings ->" link */
.pf-skill-flash{animation:pfSkillFlash 1.6s ease;}
@keyframes pfSkillFlash{0%,100%{box-shadow:0 0 0 0 transparent;}25%{box-shadow:0 0 0 3px color-mix(in srgb, var(--accent-primary, #4f46e5) 45%, transparent);}}

/* ===== Mobile audit fixes (2026-06-08, 20-agent sweep) — grid columns must be
   able to shrink below their min track at 390px; skill rows must shrink. ===== */
@media (max-width: 768px) {
  .badges-grid { grid-template-columns: repeat(auto-fill, minmax(min(100px, 100%), 1fr)); gap: var(--space-2); }
  .collections-grid { grid-template-columns: repeat(auto-fill, minmax(min(160px, 100%), 1fr)); }
  .skilldx__name { width: auto; flex: 1 1 auto; min-width: 0; }
  .skilldx__bar { min-width: 40px; }
  .skilldx__pct { width: 44px; flex: 0 0 auto; }
}

/* ===== Mobile audit fixes — MEDIUM (2026-06-08 sweep): readable labels + tap targets ===== */
@media (max-width: 768px) {
  .badge-card__name { font-size: 12px; }
  .badge-card__rarity { font-size: 10px; }
  .saved-round-card__remove { width: 32px; height: 32px; font-size: 20px; }
  .pf-mo { min-width: 20px; width: 20px; }
}

/* ============================================================
   Achievements shelf (profile) — earned lit, locked show progress
   Restored 2026-07 after a Pro user found the badges had no home.
   ============================================================ */
.ach-shelf__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.ach-shelf__sub { font-size: 13px; color: var(--text-muted); margin-top: 3px; max-width: 52ch; line-height: 1.5; }
.ach-shelf__count { flex: none; font-size: 26px; font-weight: 800; color: var(--text-bright); line-height: 1; }
.ach-shelf__count span { font-size: 15px; font-weight: 600; color: var(--text-muted); }
/* ---- horizontal rail: arrows on desktop, swipe + snap on touch --------
   Every badge is still here; they scroll sideways instead of stacking into a
   tall wrapping grid. The rail is a focusable region, so keyboard users can
   tab to it and arrow through; the arrow buttons are real buttons and drop
   out of the tab order when there is nothing to scroll. */
.ach-shelf__wrap { position: relative; }
.ach-shelf__rail {
  display: flex; gap: 12px;
  overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scroll-padding-left: 2px;
  scroll-behavior: auto;   /* js/achievements.js glide() owns the easing */
  padding: 2px 2px 10px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.ach-shelf__rail:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 14px; }
.ach-shelf__rail::-webkit-scrollbar { height: 6px; }
.ach-shelf__rail::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 999px; }
.ach-shelf__rail::-webkit-scrollbar-track { background: transparent; }
/* Edge fades tell you there is more in that direction (same cue the learn
   path's unit pills use). */
.ach-shelf__wrap::before,
.ach-shelf__wrap::after {
  content: ''; position: absolute; top: 0; bottom: 10px; width: 42px;
  pointer-events: none; opacity: 0; transition: opacity .2s ease; z-index: 1;
}
.ach-shelf__wrap::before { left: 0; background: linear-gradient(90deg, var(--bg-card, var(--bg-primary)), transparent); }
.ach-shelf__wrap::after { right: 0; background: linear-gradient(270deg, var(--bg-card, var(--bg-primary)), transparent); }
.ach-shelf__wrap.is-scrollable:not(.is-start)::before { opacity: 1; }
.ach-shelf__wrap.is-scrollable:not(.is-end)::after { opacity: 1; }
.ach-shelf__nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  width: 34px; height: 34px; border-radius: 50%;
  display: none; place-items: center; cursor: pointer;
  background: var(--bg-card, var(--bg-primary));
  border: 1px solid var(--border-color); color: var(--text-secondary);
  box-shadow: 0 4px 14px -8px rgba(15,23,42,.5);
  transition: opacity .18s ease, color .15s ease, border-color .15s ease;
}
.ach-shelf__wrap.is-scrollable .ach-shelf__nav { display: grid; }
.ach-shelf__nav:hover { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, var(--border-color)); }
.ach-shelf__nav:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ach-shelf__nav--prev { left: -12px; }
.ach-shelf__nav--next { right: -12px; }
.ach-shelf__wrap.is-start .ach-shelf__nav--prev,
.ach-shelf__wrap.is-end .ach-shelf__nav--next { opacity: 0; pointer-events: none; }
/* Touch / coarse pointers get swipe + snap instead of arrows. */
@media (hover: none), (max-width: 700px) {
  .ach-shelf__wrap.is-scrollable .ach-shelf__nav { display: none; }
  .ach-shelf__rail { scroll-snap-type: x mandatory; }
}
.ach-card {
  flex: 0 0 clamp(140px, 42vw, 158px);
  scroll-snap-align: start;
  border: 1px solid var(--border-color); border-radius: 14px; padding: 14px 12px 12px;
  text-align: center; background: var(--bg-primary); transition: transform .12s, box-shadow .12s;
  display: flex; flex-direction: column; align-items: center;
}
.ach-card.is-earned { border-color: color-mix(in srgb, var(--accent) 34%, var(--border-color)); }
.ach-card.is-earned:hover { transform: translateY(-2px); box-shadow: 0 8px 22px -14px rgba(15,23,42,.45); }
.ach-card.is-near { border-color: color-mix(in srgb, var(--accent-gold, #e8a31c) 45%, var(--border-color)); }
.ach-card__medal { width: 52px; height: 52px; margin-bottom: 8px; }
.ach-card__medal .ach-svg { width: 52px; height: 52px; }
.ach-card.is-locked .ach-card__medal { opacity: .85; }
.ach-card__name { font-size: 13.5px; font-weight: 700; color: var(--text-primary); }
.ach-card.is-locked .ach-card__name { color: var(--text-secondary); }
.ach-card__desc { font-size: 11.5px; color: var(--text-muted); margin-top: 3px; line-height: 1.4; min-height: 2.5em; }
.ach-card__done { margin-top: 8px; font-size: 11.5px; font-weight: 800; color: #1aa15c; letter-spacing: .02em; }
.ach-card__bar { margin-top: 9px; width: 100%; height: 6px; border-radius: 999px; background: var(--border-light); overflow: hidden; }
.ach-card__bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--accent-gold, #e8a31c)); }
.ach-card.is-near .ach-card__bar i { background: var(--accent-gold, #e8a31c); }
.ach-card__prog { margin-top: 5px; font-size: 11px; font-weight: 700; color: var(--text-muted); font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) { .ach-shelf__rail { scroll-behavior: auto; } .ach-card.is-earned:hover { transform: none; } }
