.achievements-page {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  gap: 10px;
  padding: var(--pages-frame-pad-top, clamp(12px, 2vw, 32px))
    var(--pages-frame-pad-x, clamp(10px, 2.5vw, 44px))
    var(--pages-frame-pad-bottom, clamp(14px, 2vw, 28px));
}

.achievements-header {
  flex-shrink: 0;
}

.achievements-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 8px;
}

.achievements-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: minmax(0, auto);
  align-content: start;
  gap: 8px;
}

.achievement-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 8px;
  border: 0;
  background: url("/achievements/ui/achievement-items.png") center / 100% 100% no-repeat;
  cursor: pointer;
  text-align: center;
  min-height: 0;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

.achievement-card.is-claimed {
  opacity: 0.92;
}

.achievement-card-icon {
  width: 44px;
  height: 44px;
  object-fit: contain;
  flex-shrink: 0;
  filter: grayscale(1) brightness(0.85);
}

.achievement-card.is-claimed .achievement-card-icon {
  filter: none;
}

.achievement-card-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
  width: 100%;
  flex: 1;
}

.achievement-card-title {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  color: #ededed;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.achievement-card-desc {
  margin: 0;
  font-size: 0.68rem;
  line-height: 1.35;
  color: rgba(237, 237, 237, 0.72);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.achievement-card-progress {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
  margin-top: auto;
}

.achievement-card-progress-meta {
  font-size: 0.65rem;
  color: rgba(237, 237, 237, 0.65);
}

.achievement-card-bar {
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.achievement-card-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #c9a227, #e0b83a);
}

.achievement-claim-btn {
  display: block;
  margin-top: 2px;
  align-self: stretch;
  border: 0;
  padding: 6px 8px;
  background: #2e7d32;
  color: #fff;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  pointer-events: none;
  text-align: center;
}

.achievement-card.is-claiming {
  opacity: 0.65;
  pointer-events: none;
  cursor: wait;
}

.achievement-card.is-claiming .achievement-claim-btn {
  opacity: 0.75;
}

.achievements-loading,
.achievements-empty,
.achievements-error {
  margin: 0;
  padding: 18px 8px;
  text-align: center;
  color: rgba(237, 237, 237, 0.7);
  grid-column: 1 / -1;
}

.achievements-error {
  color: #ef9a9a;
}

.achievements-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 0;
  padding: 6px 4px;
  position: relative;
  z-index: 2;
  flex-shrink: 0;
}

.achievements-pagination#achievementsPaginationBottom {
  margin: 2px 0 10px;
  padding: 8px 4px 12px;
  border-top: 1px solid rgba(224, 184, 58, 0.18);
}

.achievements-pagination#achievementsPaginationTop {
  margin: 0 0 2px;
  padding: 4px 4px 8px;
}

.achievements-pagination.is-visible {
  display: flex;
}

.achievements-pagination[hidden] {
  display: none !important;
}

.achievements-page-btn {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: 0;
  font-size: 0;
  line-height: 0;
  color: transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  z-index: 2;
}

.achievements-page-btn--prev {
  background: url("/achievements/ui/achievement-previous.png") center / contain no-repeat;
}

.achievements-page-btn--next {
  background: url("/achievements/ui/achievement-next.png") center / contain no-repeat;
}

.achievements-page-btn:hover:not(:disabled) {
  filter: brightness(1.08);
}

.achievements-page-btn:disabled {
  filter: grayscale(100%) opacity(0.45);
  cursor: default;
}

.achievements-page-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: rgba(255, 244, 216, 0.85);
  min-width: 3.2rem;
  text-align: center;
}

.achievement-detail-overlay {
  z-index: 10000001;
}

.achievement-detail-modal {
  max-width: 360px;
  width: min(92vw, 360px);
}

.achievement-detail-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  padding: 4px 0 8px;
}

.achievement-detail-icon {
  width: 128px;
  height: 128px;
  object-fit: contain;
}

.achievement-detail-icon.is-muted {
  filter: grayscale(1) brightness(0.85);
}

.achievement-detail-desc {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.55;
  color: rgba(237, 237, 237, 0.85);
}

.achievement-detail-progress {
  width: 100%;
  margin-top: 4px;
}

.profile-achievements {
  margin: 14px 0 4px;
}

.profile-achievements-title {
  margin: 0 0 8px;
  font-size: 0.95rem;
  color: rgba(237, 237, 237, 0.9);
}

.profile-achievements-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  width: 100%;
  justify-items: center;
  align-items: center;
}

.profile-achievement-btn {
  width: min(100%, 70px);
  height: auto;
  aspect-ratio: 1 / 1;
  max-width: 70px;
  max-height: 70px;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.profile-achievement-btn img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;
}

.profile-achievement-tip-overlay {
  z-index: 10000005;
}

.profile-achievement-tip-modal {
  max-width: 300px;
  width: min(90vw, 300px);
  text-align: center;
}

.profile-achievement-tip-modal img {
  width: 70px;
  height: 70px;
  object-fit: contain;
  margin: 0 auto 8px;
  display: block;
}

@media (max-width: 380px) {
  .achievements-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .achievement-detail-icon {
    width: min(128px, 40vw);
    height: min(128px, 40vw);
  }

  .profile-achievements-row {
    gap: 4px;
  }

  .profile-achievement-btn {
    max-width: 56px;
    max-height: 56px;
  }
}
