/* ══════════════════════════════════════════════
   成就系统 / 足迹地图 / 排行榜 — 样式
   ══════════════════════════════════════════════ */

/* ── CSS Variables (extend user.html) ──────── */
:root {
  --accent: #d4a04a;
  --accent-glow: rgba(212, 160, 74, 0.35);
}

/* ── Tab Navigation ────────────────────────── */
.user-tabs {
  width: min(880px, 94vw);
  margin: clamp(0.8rem, 2vw, 1.5rem) auto 0;
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}

.user-tabs::-webkit-scrollbar { display: none; }

.user-tab {
  flex-shrink: 0;
  padding: 0.7rem 1.2rem;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--sub);
  cursor: pointer;
  position: relative;
  transition: color 200ms;
  white-space: nowrap;
}

.user-tab:hover { color: var(--ink); }

.user-tab.active {
  color: var(--brand);
  font-weight: 600;
}

.user-tab.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--brand);
  border-radius: 1px 1px 0 0;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* ── Achievement Wall ──────────────────────── */
.ach-container {
  width: min(880px, 94vw);
  margin: clamp(0.8rem, 2vw, 1.5rem) auto;
}

.ach-progress-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 2px 8px rgba(60, 64, 67, 0.12);
  padding: clamp(1rem, 2vw, 1.4rem);
  margin-bottom: 1rem;
}

.ach-progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.7rem;
}

.ach-progress-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
}

.ach-progress-count {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--brand);
}

.ach-progress-bar {
  width: 100%;
  height: 8px;
  background: #ede5d8;
  border-radius: 4px;
  overflow: hidden;
}

.ach-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand), var(--accent));
  border-radius: 4px;
  transition: width 600ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Category filter tabs */
.ach-filter {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.ach-filter-btn {
  padding: 0.3rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  font-family: inherit;
  font-size: 0.75rem;
  color: var(--sub);
  cursor: pointer;
  transition: all 200ms;
}

.ach-filter-btn:hover { border-color: var(--brand); color: var(--brand); }

.ach-filter-btn.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

/* Achievement Grid */
.ach-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.8rem;
}

.ach-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(60, 64, 67, 0.08);
  padding: 1rem;
  text-align: center;
  cursor: pointer;
  transition: transform 300ms cubic-bezier(0.25, 0.46, 0.45, 0.94),
              box-shadow 300ms, border-color 300ms;
  position: relative;
  overflow: hidden;
}

.ach-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(60, 64, 67, 0.15);
}

/* Unlocked state */
.ach-card.unlocked {
  border-color: var(--accent);
  box-shadow: 0 2px 12px var(--accent-glow);
}

.ach-card.unlocked:hover {
  box-shadow: 0 6px 24px var(--accent-glow);
}

.ach-card.unlocked::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    rgba(212, 160, 74, 0.06) 60deg,
    transparent 120deg
  );
  animation: achShimmer 4s linear infinite;
  pointer-events: none;
}

@keyframes achShimmer {
  to { transform: rotate(360deg); }
}

/* Locked state */
.ach-card.locked {
  filter: grayscale(1);
  opacity: 0.4;
}

.ach-card.locked:hover {
  opacity: 0.6;
  filter: grayscale(0.8);
}

/* Icon */
.ach-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 0.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #f6efe4;
}

.ach-card.unlocked .ach-icon {
  background: linear-gradient(135deg, #fdf2d5, #f5e0b0);
}

.ach-icon svg {
  width: 24px;
  height: 24px;
  color: var(--sub);
}

.ach-card.unlocked .ach-icon svg {
  color: var(--accent);
}

/* Lock badge */
.ach-lock {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 18px;
  height: 18px;
  color: var(--sub);
  opacity: 0.5;
}

/* Text */
.ach-name {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
}

.ach-desc {
  margin: 0.3rem 0 0;
  font-size: 0.7rem;
  color: var(--sub);
  line-height: 1.4;
}

/* Unlock time tooltip */
.ach-time {
  margin-top: 0.4rem;
  font-size: 0.65rem;
  color: var(--accent);
  display: none;
}

.ach-card.unlocked .ach-time {
  display: block;
}

/* ── Footprint Map ─────────────────────────── */
.fp-container {
  width: min(880px, 94vw);
  margin: clamp(0.8rem, 2vw, 1.5rem) auto;
}

.fp-progress-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 2px 8px rgba(60, 64, 67, 0.12);
  padding: clamp(1rem, 2vw, 1.4rem);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.fp-progress-text {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
}

.fp-progress-text span {
  color: var(--brand);
}

.fp-map-card {
  background: #f0e8d8;
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 2px 8px rgba(60, 64, 67, 0.12);
  overflow: hidden;
  position: relative;
}

.fp-map-wrap {
  position: relative;
  width: 100%;
  overflow: hidden;
}

.fp-map-img {
  width: 100%;
  display: block;
  opacity: 0.85;
}

/* Pins overlay */
.fp-pins {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.fp-pin {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: all 300ms;
}

.fp-pin.visited {
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow), 0 0 16px rgba(212, 160, 74, 0.2);
  z-index: 2;
}

.fp-pin.visited::after {
  content: '';
  position: absolute;
  top: -4px;
  left: -4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(212, 160, 74, 0.15);
  animation: fpPulse 2s ease-in-out infinite;
}

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

.fp-pin.unvisited {
  background: rgba(100, 90, 75, 0.25);
  z-index: 1;
}

/* Pin tooltip */
.fp-pin-tip {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  padding: 3px 8px;
  background: rgba(30, 20, 10, 0.85);
  color: #f5ecda;
  font-size: 0.65rem;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms;
}

.fp-pin:hover .fp-pin-tip {
  opacity: 1;
}

/* SVG glow layer */
.fp-glow-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

/* ── Leaderboard ───────────────────────────── */
.lb-container {
  width: min(880px, 94vw);
  margin: clamp(0.8rem, 2vw, 1.5rem) auto;
}

.lb-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--line);
  margin-bottom: 1rem;
}

.lb-tab {
  padding: 0.6rem 1rem;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--sub);
  cursor: pointer;
  position: relative;
  transition: color 200ms;
}

.lb-tab:hover { color: var(--ink); }

.lb-tab.active {
  color: var(--brand);
  font-weight: 600;
}

.lb-tab.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--brand);
  border-radius: 1px 1px 0 0;
}

.lb-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 2px 8px rgba(60, 64, 67, 0.12);
  overflow: hidden;
}

.lb-table {
  width: 100%;
  border-collapse: collapse;
}

.lb-table th {
  padding: 0.7rem 1rem;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--sub);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--line);
  background: #faf6f0;
}

.lb-table td {
  padding: 0.7rem 1rem;
  font-size: 0.85rem;
  border-bottom: 1px solid #f0ebe2;
}

.lb-table tr:last-child td {
  border-bottom: none;
}

.lb-table tr:hover td {
  background: #faf6f0;
}

/* Current user highlight */
.lb-table tr.lb-me td {
  background: rgba(47, 125, 92, 0.08);
  font-weight: 600;
}

.lb-table tr.lb-me {
  position: relative;
}

.lb-table tr.lb-me td:first-child {
  border-left: 3px solid var(--ok);
}

.lb-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 0.78rem;
  font-weight: 700;
}

.lb-rank.top1 { background: #fef3c7; color: #92400e; }
.lb-rank.top2 { background: #e5e7eb; color: #374151; }
.lb-rank.top3 { background: #fed7aa; color: #9a3412; }

.lb-user {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.lb-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #f0ebe2;
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--sub);
  flex-shrink: 0;
}

.lb-name {
  font-size: 0.85rem;
  font-weight: 500;
}

.lb-score {
  font-weight: 600;
  color: var(--brand);
}

/* ── Responsive ────────────────────────────── */
@media (max-width: 760px) {
  .ach-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .fp-pin {
    width: 7px;
    height: 7px;
  }

  .fp-pin.visited::after {
    width: 14px;
    height: 14px;
    top: -3.5px;
    left: -3.5px;
  }

  .lb-table th,
  .lb-table td {
    padding: 0.5rem 0.6rem;
    font-size: 0.78rem;
  }
}

@media (max-width: 480px) {
  .ach-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }

  .ach-card {
    padding: 0.7rem;
  }

  .ach-icon {
    width: 36px;
    height: 36px;
  }

  .ach-icon svg {
    width: 18px;
    height: 18px;
  }
}
