/* ────────────────────────────────────────────────────────────────
   Climb Collector — Achievements panel
   Scoped to .ach-pop and its children.
   Tokens from tokens.css: --pink, --surface, --surface2, --border,
     --text, --muted, --green, --amber, --blue, --radius, --radius-sm
   ──────────────────────────────────────────────────────────────── */

/* ── Panel container ─────────────────────────────────────────── */
/* Force solid opaque background — overrides any rgba/blur in .ctl-pop base */
.ctl-pop.ach-pop.open {
  display: flex !important;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  width: min(480px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  height: min(640px, calc(100dvh - 120px));
  max-height: calc(100dvh - 120px);
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(100% + 10px + var(--fb-h, 0px) + 10px);
  /* Force solid — override any semi-transparent base */
  background: #181c27 !important;
  background-color: #181c27 !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  opacity: 1 !important;
  border: 1px solid #2a3045;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.7);
}

/* ── Summary row (ring + stat pills) ─────────────────────────── */
.ach-summary-row {
  display: flex;
  gap: 12px;
  align-items: stretch;
  padding: 14px 14px 12px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border, #2a3045);
  background: #181c27;
}

.ach-ring-card {
  flex: 0 0 auto;
  background: #1f2535;
  border: 1px solid #2a3045;
  border-radius: 14px;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.ach-ring-wrap {
  position: relative;
  width: 88px;
  height: 88px;
}

.ach-ring-svg {
  width: 88px;
  height: 88px;
  transform: rotate(-90deg);
}

#achRingFill {
  transition: stroke-dashoffset 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.ach-ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1px;
}

.ach-ring-val {
  font-family: 'Bebas Neue', 'IBM Plex Mono', monospace;
  font-size: 26px;
  color: #f0f2f8;
  line-height: 1;
}

.ach-ring-unit {
  font-size: 12px;
  color: #7a8399;
  align-self: flex-end;
  padding-bottom: 4px;
}

.ach-ring-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #7a8399;
  text-align: center;
  line-height: 1.3;
}

/* Stat pills stack */
.ach-stats-stack {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
  justify-content: space-between;
  min-width: 0;
}

.ach-stat-pill {
  background: #1f2535;
  border: 1px solid #2a3045;
  border-radius: 8px;
  padding: 6px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ach-stat-pill-label {
  font-size: 10px;
  color: #7a8399;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.ach-stat-pill-value {
  font-family: 'Bebas Neue', 'IBM Plex Mono', monospace;
  font-size: 18px;
  color: #f0f2f8;
  letter-spacing: 0.5px;
}
.ach-stat-pill-value.pink  { color: #e8417a; }
.ach-stat-pill-value.green { color: #3ddc84; }
.ach-stat-pill-value.amber { color: #f5a623; }

/* ── Tab bar ─────────────────────────────────────────────────── */
.ach-tabs {
  display: flex;
  border-bottom: 1px solid #2a3045;
  background: #181c27;
  flex-shrink: 0;
  padding: 8px 10px 0;
  gap: 6px;
  overflow-x: auto;
  overflow-y: visible; /* prevent active tab border from being clipped */
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.ach-tabs::-webkit-scrollbar { display: none; }

.ach-tab {
  flex: 1;
  padding: 8px 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #7a8399;
  background: none;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  white-space: nowrap;
}

.ach-tab--active {
  color: #e8417a;
  border-color: #e8417a;
  background: rgba(232, 65, 122, 0.1);
}

.ach-tab:not(.ach-tab--active):hover {
  color: #f0f2f8;
}

/* ── Scrollable panel body ───────────────────────────────────── */
.ach-panel[hidden] { display: none !important; }
 
.ach-panel {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 28px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  -webkit-overflow-scrolling: touch;
  background: #181c27;
}

/* ── Local list rows with mini ring ───────────────────────────── */
.ach-local-item{
  display: flex;
  align-items: center;
  gap: 12px;
}

.ach-local-main{
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
}

.ach-local-text{
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  align-items: flex-start;
  text-align: left;
}

.ach-mini-ring{
  position: relative;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
}

.ach-mini-ring-svg{
  width: 44px;
  height: 44px;
  transform: rotate(-90deg);
}

.ach-mini-ring-fill{
  transition: stroke-dashoffset 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.ach-mini-ring-center{
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1px;
}

.ach-mini-ring-val{
  font-family: 'Bebas Neue', 'IBM Plex Mono', monospace;
  font-size: 14px;
  color: #f0f2f8;
  line-height: 1;
}

.ach-mini-ring-unit{
  font-size: 9px;
  color: #7a8399;
  align-self: flex-end;
  padding-bottom: 2px;
}

/* Ensure tab bar is never visually clipped by the scrollable panel */
.ach-summary-row + .ach-tabs { margin-bottom: 2px; }

/* ── Section headings ────────────────────────────────────────── */
.ach-section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-bottom: 6px;
  border-bottom: 1px solid #2a3045;
  margin-top: 4px;
}

/* First heading in a panel should sit tighter to the tabs */
.ach-panel > .ach-section-head:first-child { margin-top: 0; }

.ach-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #7a8399;
}

.ach-section-link {
  font-size: 11px;
  color: #e8417a;
  cursor: pointer;
}

/* ── Milestone horizontal strip ──────────────────────────────── */
.ach-milestone-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overflow-y: visible;
  padding: 6px 2px 12px;   /* top/side padding prevents border clip */
  margin: 0 -2px;           /* compensate side padding so chips align with section */
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.ach-milestone-strip::-webkit-scrollbar { display: none; }

.ach-milestone-chip {
  flex: 0 0 auto;
  background: #1f2535;
  border: 1px solid #2a3045;
  border-radius: 10px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  position: relative;
  min-width: 76px;
  cursor: default;
  transition: border-color 0.2s;
}

.ach-milestone-chip.earned {
  border-color: #e8417a;
  background: linear-gradient(160deg, #2a1530 0%, #1f2535 100%);
}

.ach-milestone-chip.earned::after {
  content: '';
  position: absolute;
  top: 6px; right: 6px;
  width: 6px; height: 6px;
  background: #e8417a;
  border-radius: 50%;
}

/* Locked: visible but clearly not earned */
.ach-milestone-chip.locked {
  opacity: 0.6;
}
.ach-milestone-chip.locked .ach-milestone-emoji {
  filter: grayscale(0.5) brightness(0.7);
}
.ach-milestone-chip.locked .ach-milestone-name {
  color: #7a8399;
}

.ach-milestone-emoji {
  font-size: 26px;
  line-height: 1;
}

.ach-milestone-name {
  font-size: 9px;
  font-weight: 600;
  color: #f0f2f8;
  text-align: center;
  line-height: 1.2;
  white-space: nowrap;
}

/* ── Next milestone bar ──────────────────────────────────────── */
.ach-next {
  background: #1f2535;
  border: 1px solid #2a3045;
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ach-next-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.ach-next-label {
  font-size: 12px;
  font-weight: 600;
  color: #f0f2f8;
}

.ach-next-count {
  font-size: 12px;
  color: #7a8399;
}

/* ── Shared progress bar ─────────────────────────────────────── */
.ach-bar-track {
  height: 5px;
  background: #0f1117;
  border-radius: 3px;
  overflow: hidden;
}

.ach-bar-fill {
  height: 100%;
  background: #e8417a;
  border-radius: 3px;
  transition: width 0.5s ease;
}

/* Pink progress fill (used for local/area lists until complete) */
.ach-bar-fill--pink {
  background: linear-gradient(90deg, #7a1f3d, #e8417a);
}

.ach-bar-fill--gradient {
  background: linear-gradient(90deg, #7a1f3d, #e8417a);
}

.ach-bar-fill--geo {
  background: linear-gradient(90deg, #1a4a2a, #3ddc84);
}

/* ── Badge grid ──────────────────────────────────────────────── */
.ach-badge-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.ach-badge-card {
  background: #1f2535;
  border: 1px solid #2a3045;
  border-radius: 14px;
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  cursor: default;
  transition: border-color 0.2s, transform 0.1s;
}

.ach-badge-card:active { transform: scale(0.97); }

.ach-badge-card.earned {
  border-color: #e8417a;
  background: linear-gradient(160deg, #2a1530 0%, #1f2535 100%);
}

/* Locked: still clearly visible, just not earned */
.ach-badge-card.locked {
  opacity: 0.65;
}
.ach-badge-card.locked .ach-badge-icon {
  filter: grayscale(0.6) brightness(0.7);
}
.ach-badge-card.locked .ach-badge-name {
  color: #7a8399;
}

.ach-badge-icon { font-size: 32px; line-height: 1; }

.ach-badge-name {
  font-size: 10px;
  font-weight: 600;
  color: #f0f2f8;
  line-height: 1.3;
}

.ach-badge-tag {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #7a8399;
}

/* ── Challenge cards ─────────────────────────────────────────── */
.ach-challenge-card {
  background: #1f2535;
  border: 1px solid #2a3045;
  border-radius: 14px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ach-challenge-card.completed { border-color: #3ddc84; }

.ach-challenge-top {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.ach-challenge-icon { font-size: 28px; flex-shrink: 0; line-height: 1; }

.ach-challenge-info { flex: 1; }

.ach-challenge-name {
  font-size: 13px;
  font-weight: 700;
  color: #f0f2f8;
  margin-bottom: 3px;
}

.ach-challenge-desc {
  font-size: 11px;
  color: #7a8399;
  line-height: 1.4;
}

.ach-challenge-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.ach-challenge-count {
  font-size: 12px;
  color: #7a8399;
}

.ach-challenge-count span {
  font-weight: 700;
  color: #f0f2f8;
}

.ach-challenge-pct {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  font-weight: 700;
  color: #f0f2f8;
}

/* ── Pioneer tab ─────────────────────────────────────────────── */
.ach-pioneer-intro {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: #2e2010;
  border: 1px solid #5a3a10;
  border-radius: 14px;
  padding: 14px;
}

.ach-pioneer-icon { font-size: 28px; flex-shrink: 0; }

.ach-pioneer-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 18px;
  color: #f5a623;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.ach-pioneer-sub {
  font-size: 11px;
  color: #c8a060;
  line-height: 1.5;
}

.ach-pioneer-count-val {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 20px;
  color: #f5a623;
}

.ach-pioneer-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ach-pioneer-item {
  background: #1f2535;
  border: 1px solid #2a3045;
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.ach-pioneer-badge-icon { font-size: 24px; flex-shrink: 0; }

.ach-pioneer-info { flex: 1; min-width: 0; }

.ach-pioneer-climb {
  font-size: 12px;
  font-weight: 600;
  color: #f0f2f8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ach-pioneer-meta {
  font-size: 11px;
  color: #7a8399;
  margin-top: 2px;
  text-transform: capitalize;
}

.ach-pioneer-rank {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 20px;
  color: #f5a623;
  flex-shrink: 0;
}

.ach-pioneer-hunt {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(245, 166, 35, 0.1);
  border: 1px solid rgba(245, 166, 35, 0.3);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 12px;
  color: #f5a623;
}

/* ── County tab ──────────────────────────────────────────────── */
.ach-county-item {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 4px 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #2a3045;
}

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

.ach-county-name {
  font-size: 13px;
  font-weight: 600;
  color: #f0f2f8;
  grid-column: 1;
}

.ach-county-meta {
  grid-column: 1;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  color: #7a8399;
}

.ach-county-pct {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  color: #f0f2f8;
  grid-column: 2;
  grid-row: 2;
  text-align: right;
}

/* Completed rows keep the same white % for readability */
.ach-county-item.completed .ach-county-pct {
  color: #f0f2f8;
}

.ach-county-tier {
  font-size: 11px;
  color: #f5a623;
  grid-column: 2;
}

.ach-county-bar {
  grid-column: 1 / -1;
  height: 4px;
}

/* ── Local list rows ─────────────────────────────────────────── */
.ach-local-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ach-local-item {
  background: #1f2535;
  border: 1px solid #2a3045;
  border-radius: 10px;
  padding: 10px 12px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.ach-local-name {
  font-size: 12px;
  font-weight: 700;
  color: #f0f2f8;
}

.ach-local-meta {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  color: #7a8399;
  text-align: left;
}

/* ── Empty state ─────────────────────────────────────────────── */
.ach-empty {
  font-size: 12px;
  color: #7a8399;
  text-align: center;
  padding: 24px 0;
}

/* ── Areas segmented control ─────────────────────────────────── */
.ach-seg {
  display: flex;
  gap: 8px;
  background: #1f2535;
  border: 1px solid #2a3045;
  border-radius: 12px;
  padding: 6px;
}

.ach-seg-btn {
  flex: 1;
  border: 1px solid transparent;
  background: transparent;
  color: #7a8399;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
}

.ach-seg-btn--active {
  background: rgba(232, 65, 122, 0.12);
  border-color: rgba(232, 65, 122, 0.35);
  color: #e8417a;
}

/* ── Milestone strip wrapper — prevents overflow-y clip from .ach-panel ── */
.ach-milestone-wrap {
  /* explicit height = chip height (12+26+6+9+12 padding+emoji+gap+label+padding ≈ 90px) */
  min-height: 96px;
  overflow: hidden;
  margin: 0 -2px;
  padding: 0 2px;
}
