.mymil-ach-badge {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
}

.mymil-ach-badge__ring {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5%;
}

.mymil-ach-badge__inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mymil-ach-badge__icon {
  width: 52%;
  height: 52%;
  display: flex;
}

.mymil-ach-badge__icon svg {
  width: 100%;
  height: 100%;
}

/* ---------- Tier colors ---------- */
.mymil-ach-badge--bronze .mymil-ach-badge__ring { background: linear-gradient(135deg, #cd8a4e, #a4622c); }
.mymil-ach-badge--bronze .mymil-ach-badge__icon { color: #a4622c; }

.mymil-ach-badge--silver .mymil-ach-badge__ring { background: linear-gradient(135deg, #d7dde2, #9aa3ac); }
.mymil-ach-badge--silver .mymil-ach-badge__icon { color: #737b83; }

.mymil-ach-badge--gold .mymil-ach-badge__ring { background: linear-gradient(135deg, #f4cc5b, #d4a017); }
.mymil-ach-badge--gold .mymil-ach-badge__icon { color: #b8860b; }

.mymil-ach-badge--platinum .mymil-ach-badge__ring { background: linear-gradient(135deg, #bfeaf5, #6ec6d9); }
.mymil-ach-badge--platinum .mymil-ach-badge__icon { color: #3f8fa3; }

.mymil-ach-badge--legend .mymil-ach-badge__ring,
.mymil-ach-badge--legend_repeat .mymil-ach-badge__ring {
  background: linear-gradient(135deg, #f4cc5b 0%, var(--mymil-purple-dark, #9a7fd6) 55%, #6a4fc7 100%);
}
.mymil-ach-badge--legend .mymil-ach-badge__icon,
.mymil-ach-badge--legend_repeat .mymil-ach-badge__icon {
  color: var(--mymil-purple-dark, #9a7fd6);
}

/* ---------- Locked state ---------- */
.mymil-ach-badge--locked .mymil-ach-badge__ring {
  background: #e2e2e6;
  filter: grayscale(1);
}

.mymil-ach-badge--locked .mymil-ach-badge__icon {
  color: #b3b3b8;
}

.mymil-ach-badge__lock {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 26%;
  height: 26%;
  min-width: 18px;
  min-height: 18px;
  background: #6b6775;
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  box-shadow: 0 0 0 2px #fff;
}

.mymil-ach-badge__lock svg {
  width: 100%;
  height: 100%;
}

/* ---------- Repeat level counter ---------- */
.mymil-ach-badge__level {
  position: absolute;
  top: -4px;
  right: -6px;
  background: #6a4fc7;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 999px;
  box-shadow: 0 0 0 2px #fff;
}

/* ---------- Achievements page ---------- */
.mymil-ach-page {
  max-width: var(--mymil-container-wide, 1100px);
  margin: 0 auto;
  padding: 0 20px 60px;
}

.mymil-ach-summary {
  color: var(--mymil-gray, #6b6775);
  font-size: 14px;
  margin: -8px 0 24px;
}

.mymil-ach-links {
  display: flex;
  gap: 16px;
  margin: -12px 0 24px;
}

.mymil-ach-links a {
  font-size: 13px;
  font-weight: 700;
  color: var(--mymil-purple-dark, #9a7fd6);
  text-decoration: none;
}

.mymil-ach-links a:hover {
  text-decoration: underline;
}

.mymil-ach-category {
  margin-bottom: 32px;
}

.mymil-ach-category h2 {
  font-size: 18px;
  margin: 0 0 14px;
}

.mymil-ach-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

@media (min-width: 640px) {
  .mymil-ach-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 960px) {
  .mymil-ach-grid { grid-template-columns: repeat(3, 1fr); }
}

.mymil-ach-card {
  display: flex;
  gap: 14px;
  padding: 16px;
  background: #fff;
  border-radius: var(--mymil-radius, 16px);
  box-shadow: var(--mymil-shadow, 0 4px 20px rgba(183, 159, 234, 0.25));
  opacity: 0.85;
}

.mymil-ach-card.is-unlocked {
  opacity: 1;
}

.mymil-ach-card__body {
  flex: 1;
  min-width: 0;
}

.mymil-ach-card__body h3 {
  font-size: 14px;
  margin: 0 0 4px;
}

.mymil-ach-card__body p {
  font-size: 12px;
  color: var(--mymil-gray, #6b6775);
  margin: 0 0 8px;
}

.mymil-ach-progress {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: var(--mymil-purple-light, #f3eefc);
  overflow: hidden;
  margin-bottom: 4px;
}

.mymil-ach-progress__bar {
  height: 100%;
  background: var(--mymil-purple-dark, #9a7fd6);
  border-radius: 999px;
}

.mymil-ach-card__status {
  display: block;
  font-size: 11px;
  color: var(--mymil-gray, #6b6775);
}

.mymil-ach-card__status--done {
  color: #2f8f52;
  font-weight: 600;
}

.mymil-ach-card__points {
  display: inline-block;
  margin-top: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--mymil-purple-dark, #9a7fd6);
}

/* ---------- Collection tabs ---------- */
.mymil-collection-tabs {
  display: flex;
  gap: 4px;
  margin: 16px 0 24px;
  border-bottom: 1px solid var(--mymil-purple-light, #f3eefc);
}

.mymil-collection-tabs a {
  padding: 10px 16px;
  color: var(--mymil-gray, #6b6775);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  border-bottom: 2px solid transparent;
}

.mymil-collection-tabs a.is-active {
  color: var(--mymil-purple-dark, #9a7fd6);
  border-bottom-color: var(--mymil-purple-dark, #9a7fd6);
}

/* ---------- Collection grid ---------- */
.mymil-collection-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

@media (min-width: 640px) {
  .mymil-collection-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (min-width: 960px) {
  .mymil-collection-grid { grid-template-columns: repeat(6, 1fr); }
}

.mymil-collection-card {
  background: #fff;
  border-radius: var(--mymil-radius, 16px);
  overflow: hidden;
  box-shadow: var(--mymil-shadow, 0 4px 20px rgba(183, 159, 234, 0.25));
}

.mymil-collection-card__img-wrap {
  display: block;
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--mymil-purple-light, #f3eefc);
}

.mymil-collection-card__rare {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  background: linear-gradient(135deg, #f4cc5b, #6a4fc7);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  box-shadow: 0 0 0 2px #fff;
}

.mymil-collection-card__rare svg {
  width: 100%;
  height: 100%;
}

.mymil-collection-card__img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.mymil-collection-card__img-wrap--placeholder {
  display: flex;
}

.mymil-collection-card__body {
  padding: 10px;
}

.mymil-collection-card__name {
  font-size: 12px;
  font-weight: 600;
  margin: 0 0 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mymil-collection-card__qty {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  color: var(--mymil-purple-dark, #9a7fd6);
  background: var(--mymil-purple-light, #f3eefc);
  padding: 1px 6px;
  border-radius: 999px;
  margin-right: 4px;
}

.mymil-collection-card__date {
  display: block;
  font-size: 10px;
  color: var(--mymil-gray, #6b6775);
  margin-top: 4px;
}

/* ---------- Public profile ---------- */
.mymil-profile-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.mymil-profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--mymil-purple-dark, #9a7fd6), var(--mymil-purple, #b79fea));
  color: #fff;
  font-size: 26px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.mymil-profile-header h1 {
  margin: 0 0 4px;
  font-size: 22px;
}

.mymil-profile-stats {
  display: flex;
  gap: 12px;
  margin-bottom: 28px;
}

.mymil-profile-stat {
  flex: 1;
  background: #fff;
  border-radius: var(--mymil-radius, 16px);
  box-shadow: var(--mymil-shadow, 0 4px 20px rgba(183, 159, 234, 0.25));
  padding: 16px;
  text-align: center;
}

.mymil-profile-stat__value {
  display: block;
  font-size: 24px;
  font-weight: 800;
  color: var(--mymil-purple-dark, #9a7fd6);
}

.mymil-profile-stat__label {
  display: block;
  font-size: 12px;
  color: var(--mymil-gray, #6b6775);
  margin-top: 2px;
}

/* ---------- Leaderboard ---------- */
.mymil-leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: var(--mymil-radius, 16px);
  overflow: hidden;
  box-shadow: var(--mymil-shadow, 0 4px 20px rgba(183, 159, 234, 0.25));
}

.mymil-leaderboard-table th,
.mymil-leaderboard-table td {
  text-align: left;
  padding: 12px 16px;
  font-size: 14px;
}

.mymil-leaderboard-table th {
  color: var(--mymil-gray, #6b6775);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--mymil-purple-light, #f3eefc);
}

.mymil-leaderboard-table tbody tr:not(:last-child) td {
  border-bottom: 1px solid var(--mymil-purple-light, #f3eefc);
}

.mymil-leaderboard-table tbody tr.is-me {
  background: var(--mymil-purple-light, #f3eefc);
}

.mymil-leaderboard-table a {
  color: inherit;
  text-decoration: none;
  font-weight: 600;
}

.mymil-leaderboard-table a:hover {
  color: var(--mymil-purple-dark, #9a7fd6);
}

.mymil-leaderboard-table__rank {
  width: 50px;
}

.mymil-leaderboard-medal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  color: #fff;
  font-weight: 800;
  font-size: 12px;
}

.mymil-leaderboard-medal--1 { background: linear-gradient(135deg, #f4cc5b, #d4a017); }
.mymil-leaderboard-medal--2 { background: linear-gradient(135deg, #d7dde2, #9aa3ac); }
.mymil-leaderboard-medal--3 { background: linear-gradient(135deg, #cd8a4e, #a4622c); }

.mymil-leaderboard-you {
  display: inline-block;
  margin-left: 6px;
  font-size: 10px;
  font-weight: 700;
  color: var(--mymil-purple-dark, #9a7fd6);
  background: var(--mymil-purple-light, #f3eefc);
  padding: 1px 8px;
  border-radius: 999px;
}

/* ---------- Trade propose form (on public profile) ---------- */
.mymil-trade-propose-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

.mymil-trade-propose-form select {
  font-size: 11px;
  padding: 4px;
  border-radius: 6px;
  border: 1px solid var(--mymil-purple-light, #f3eefc);
}

.mymil-trade-propose-form button {
  font-size: 11px;
  font-weight: 700;
  padding: 5px 8px;
  border-radius: 999px;
  border: none;
  background: var(--mymil-purple-dark, #9a7fd6);
  color: #fff;
  cursor: pointer;
}

/* ---------- Trades inbox ---------- */
.mymil-trade-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #fff;
  border-radius: var(--mymil-radius, 16px);
  box-shadow: var(--mymil-shadow, 0 4px 20px rgba(183, 159, 234, 0.25));
  padding: 14px 18px;
  margin-bottom: 10px;
  font-size: 13px;
}

.mymil-trade-row p {
  margin: 0;
  flex: 1;
}

.mymil-trade-row--history {
  opacity: 0.8;
}

.mymil-trade-row__actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.mymil-trade-btn {
  font-size: 12px;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
}

.mymil-trade-btn--accept {
  background: #2f8f52;
  color: #fff;
}

.mymil-trade-btn--decline {
  background: #e2e2e6;
  color: #6b6775;
}

.mymil-trade-status {
  display: inline-block;
  margin-left: 8px;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 999px;
  text-transform: uppercase;
}

.mymil-trade-status--accepted { background: #d9f0e1; color: #2f8f52; }
.mymil-trade-status--declined,
.mymil-trade-status--cancelled,
.mymil-trade-status--invalid { background: #e2e2e6; color: #6b6775; }
