/* ==========================================================================
   TRYSTONS.VIP — Milestones page
   Uses the shared design tokens from css/style.css. Load AFTER style.css.
   ========================================================================== */

.ms-page {
  position: relative;
  min-height: calc(100vh - 72px);
  background: var(--bg-bottom);
  overflow: clip;
}

.ms-backdrop {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  z-index: 0;
  height: 760px;
  max-height: 100%;
  background: var(--bg-hero);
  pointer-events: none;
  overflow: hidden;
}

.ms {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 2.5rem clamp(1rem, 3vw, 2rem) 4rem;
}

/* Header ------------------------------------------------------------------ */

.ms-header {
  margin-bottom: 1.75rem;
  padding-top: 0.35rem;
  text-align: center;
}

.ms-kicker {
  margin-bottom: 10px;
  color: #7ec4ff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.ms-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  overflow: visible;
  line-height: 1;
}

.ms-title-top {
  padding: 0.08em 0.12em 0.02em;
  font-family: var(--font-hero);
  font-size: clamp(46px, 6.85vw, 96px);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.12;
  background: var(--grad-gold);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 14px 9.6px rgba(0, 0, 0, 0.04);
}

.ms-title-text {
  margin-top: -4px;
  padding: 0 0.08em;
  font-family: var(--font-hero);
  font-size: clamp(28px, 4.5vw, 56px);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.12;
  background: var(--grad-silver);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.ms-sub {
  max-width: 52ch;
  margin: 12px auto 0;
  color: #c8d4e4;
  font-size: 15px;
  line-height: 1.55;
}

.ms-cycle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding: 0.4rem 1rem 0.45rem;
  color: #e8eef8;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--bg-pill);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
}

.ms-cycle[hidden] {
  display: none !important;
}

.ms-cycle.is-paused {
  color: #ffd65c;
}

/* Account / Discord link -------------------------------------------------- */

.ms-account {
  max-width: 640px;
  margin: 0 auto 1.75rem;
  padding: 18px 20px;
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: 18px;
}

.ms-account-copy {
  margin: 0 0 14px;
  color: #c8d4e4;
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
}

.ms-account-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border: none;
  border-radius: 10px;
  background: #5865f2;
  color: #fff;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: filter 0.15s ease;
}

.ms-account-btn:hover {
  filter: brightness(1.08);
}

.ms-account-guest {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.ms-account-error {
  margin: 12px 0 0;
  color: #ff8a8a;
  font-size: 0.9rem;
  text-align: center;
}

.ms-account-user {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.ms-account-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.ms-account-avatar {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border-soft);
  background: var(--bg-pill);
}

.ms-account-name {
  margin: 0;
  color: #f0f5fc;
  font-size: 1rem;
  font-weight: 700;
}

.ms-account-meta {
  margin: 2px 0 0;
  color: #b6c4d8;
  font-size: 0.85rem;
}

.ms-link-form {
  flex: 1 1 240px;
  min-width: 0;
}

.ms-link-label {
  display: block;
  margin-bottom: 6px;
  color: #b6c4d8;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ms-link-row {
  display: flex;
  gap: 8px;
}

.ms-link-input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-soft);
  background: #060d1a;
  color: #f0f5fc;
  font: inherit;
}

.ms-link-hint {
  margin: 8px 0 0;
  color: #9aadc4;
  font-size: 0.78rem;
  line-height: 1.4;
}

.ms-account-logout {
  margin-left: auto;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-soft);
  background: var(--bg-pill);
  color: #d5e0ef;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.ms-account-guest[hidden],
.ms-account-user[hidden],
.ms-link-form[hidden],
.ms-account-avatar[hidden],
.ms-account-error[hidden],
.ms-summary[hidden] {
  display: none !important;
}

/* Overall progress summary ------------------------------------------------ */

.ms-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(10px, 2vw, 18px);
  margin-bottom: 2rem;
}

.ms-stat {
  padding: 18px 20px 20px;
  text-align: center;
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: 18px;
}

.ms-stat-label {
  display: block;
  color: #b6c4d8;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.ms-stat-value {
  display: block;
  margin-top: 8px;
  color: #f2f6fc;
  font-family: var(--font-display);
  font-size: clamp(20px, 3vw, 28px);
  font-weight: 800;
  letter-spacing: 0.02em;
  background: var(--grad-silver);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.ms-stat-gold .ms-stat-value {
  background: var(--grad-gold);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.ms-stat-blue .ms-stat-value {
  background: var(--grad-blue);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Tier cards -------------------------------------------------------------- */

.ms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: clamp(14px, 2vw, 20px);
}

.ms-tier {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 20px 22px 20px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 40%),
    var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: 20px;
  overflow: hidden;
  isolation: isolate;
  transition:
    transform 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.ms-tier:hover {
  transform: translateY(-3px);
  border-color: rgba(85, 175, 255, 0.35);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.45);
}

.ms-tier.is-active {
  border-color: rgba(255, 202, 57, 0.42);
  background:
    radial-gradient(90% 120% at 0% 0%, rgba(255, 202, 57, 0.13), transparent 58%),
    var(--bg-panel);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.42);
}

.ms-tier.is-complete {
  border-color: rgba(83, 252, 24, 0.34);
  background:
    radial-gradient(90% 120% at 0% 0%, rgba(83, 252, 24, 0.11), transparent 58%),
    var(--bg-panel);
}

.ms-tier.is-locked {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 40%),
    var(--bg-panel);
  border-style: dashed;
  border-color: rgba(216, 247, 255, 0.12);
}

.ms-tier.is-locked .ms-tier-top {
  opacity: 0.88;
  filter: saturate(0.55);
}

/* Top row: avatar + details */
.ms-tier-top {
  display: flex;
  align-items: center;
  gap: 16px;
  transition: opacity 0.2s ease;
}

.ms-avatar {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  width: 78px;
  height: 78px;
  background:
    radial-gradient(circle at 50% 28%, #17263f, #080e1a);
  border-radius: 24px;
  overflow: hidden;
  isolation: isolate;
}

.ms-avatar-ring {
  position: absolute;
  inset: 0;
  z-index: 2;
  border: 1px solid rgba(216, 247, 255, 0.16);
  border-radius: inherit;
  pointer-events: none;
}

.ms-tier.is-active .ms-avatar-ring {
  border-color: rgba(255, 202, 57, 0.75);
  box-shadow:
    0 0 0 4px rgba(255, 202, 57, 0.09),
    inset 0 0 18px rgba(255, 202, 57, 0.14);
}

.ms-tier.is-complete .ms-avatar-ring {
  border-color: rgba(83, 252, 24, 0.7);
  box-shadow: 0 0 0 4px rgba(83, 252, 24, 0.09);
}

.ms-avatar-img {
  position: absolute;
  inset: 10px;
  z-index: 1;
  width: calc(100% - 20px);
  height: calc(100% - 20px);
  object-fit: contain;
  object-position: center;
}

.ms-tier-head {
  min-width: 0;
}

.ms-tier-index {
  color: #b4c3d8;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.ms-tier-wager {
  margin-top: 2px;
  color: #f4f7fc;
  font-family: var(--font-display);
  font-size: clamp(26px, 3.2vw, 32px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: 0.01em;
  background: var(--grad-silver);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.ms-tier-reward {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 8px;
  padding: 4px 10px 5px;
  background: rgba(255, 202, 57, 0.12);
  border: 1px solid rgba(255, 202, 57, 0.35);
  border-radius: 999px;
}

.ms-tier-reward em {
  color: #ffd65c;
  font-family: var(--font-accent);
  font-size: 15px;
  font-style: normal;
  font-weight: 700;
}

.ms-tier-reward span {
  color: #e8d9a8;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* Card footer states ------------------------------------------------------ */

.ms-tier-foot {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid rgba(216, 247, 255, 0.08);
}

.ms-tier-foot-locked,
.ms-tier-foot-done {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #c5d2e4;
  font-size: 12.5px;
  font-weight: 600;
}

.ms-tier-foot-done {
  color: #7dff4d;
}

.ms-lock,
.ms-tick {
  display: grid;
  place-items: center;
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 9px;
}

.ms-lock {
  color: #d0dced;
  background: rgba(216, 247, 255, 0.08);
  border: 1px solid rgba(216, 247, 255, 0.16);
}

.ms-tick {
  color: #06260a;
  background: var(--btn-face-green);
}

.ms-lock svg,
.ms-tick svg {
  width: 15px;
  height: 15px;
}

/* Progress bar */
.ms-progress-track {
  position: relative;
  height: 12px;
  padding: 2px;
  background: #080f1e;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  overflow: hidden;
}

.ms-progress-fill {
  position: relative;
  width: 0%;
  height: 100%;
  background: var(--grad-gold);
  border-radius: 999px;
  overflow: hidden;
  transition: width 1s cubic-bezier(0.22, 1, 0.36, 1);
}

.ms-progress-shine {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    100deg,
    transparent 20%,
    rgba(255, 255, 255, 0.45) 50%,
    transparent 80%
  );
  animation: ms-shimmer 2.2s linear infinite;
}

.ms-progress-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-top: 9px;
  color: #eef3fa;
  font-size: 12.5px;
  font-weight: 700;
}

.ms-progress-meta em {
  color: #b8c7db;
  font-style: normal;
  font-weight: 600;
}

.ms-progress-pct {
  color: #ffd65c;
  font-weight: 800;
}

.ms-tier-hint {
  margin-top: 4px;
  color: #c2d0e3;
  font-size: 11.5px;
  font-weight: 600;
}

/* States ------------------------------------------------------------------ */

.ms-note {
  margin-top: 2rem;
  color: #c5d2e4;
  font-size: 13px;
  line-height: 1.65;
  text-align: center;
}

.ms-empty {
  grid-column: 1 / -1;
  padding: 48px 20px;
  color: #d0dced;
  font-size: 14px;
  text-align: center;
  background: var(--bg-panel);
  border: 1px dashed var(--border-soft);
  border-radius: 20px;
}

/* Skeleton loading */
.ms-tier.is-skeleton {
  min-height: 300px;
  pointer-events: none;
}

.ms-tier.is-skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    100deg,
    transparent 20%,
    rgba(255, 255, 255, 0.05) 50%,
    transparent 80%
  );
  animation: ms-shimmer 1.4s linear infinite;
}

@keyframes ms-shimmer {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(100%);
  }
}

/* Responsive -------------------------------------------------------------- */

@media (max-width: 800px) {
  .ms-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .ms-stat {
    padding: 12px 8px 14px;
    border-radius: 14px;
  }

  .ms-stat-label {
    font-size: 9px;
    letter-spacing: 0.08em;
    line-height: 1.25;
  }

  .ms-stat-value {
    margin-top: 6px;
    font-size: clamp(15px, 4.2vw, 20px);
  }
}

@media (max-width: 640px) {
  .ms {
    padding: 1.75rem 1rem 3rem;
  }

  .ms-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ms-tier:hover {
    transform: none;
  }

  .ms-progress-fill {
    transition: none;
  }

  .ms-tier.is-skeleton::after {
    animation: none;
  }
}

/* How it works ------------------------------------------------------------ */

.ms-how {
  margin-top: 2.5rem;
  padding: clamp(20px, 3vw, 32px);
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: 24px;
}

.ms-how-title {
  margin-bottom: 20px;
  color: #f2f6fc;
  font-family: var(--font-display);
  font-size: clamp(20px, 2.6vw, 26px);
  font-weight: 800;
  letter-spacing: 0.01em;
  text-align: center;
  background: var(--grad-silver);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.ms-how-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(12px, 2vw, 18px);
}

.ms-how-card {
  position: relative;
  padding: 20px 18px 22px;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(255, 202, 57, 0.07), transparent 60%),
    var(--bg-pill);
  border: 1px solid var(--border-soft);
  border-radius: 18px;
  transition:
    transform 0.18s ease,
    border-color 0.18s ease;
}

.ms-how-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 202, 57, 0.3);
}

.ms-how-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-bottom: 14px;
  color: var(--gold);
  background: rgba(255, 202, 57, 0.08);
  border: 1px solid rgba(255, 202, 57, 0.22);
  border-radius: 13px;
}

.ms-how-icon svg {
  width: 20px;
  height: 20px;
}

.ms-how-card-title {
  margin-bottom: 6px;
  color: #f0f5fc;
  font-size: 15px;
  font-weight: 700;
}

.ms-how-card-text {
  color: #c8d4e4;
  font-size: 13.5px;
  line-height: 1.65;
}

.ms-how-fine {
  margin-top: 22px;
  display: grid;
  gap: 8px;
  color: #c5d2e4;
  font-size: 13px;
  line-height: 1.7;
  text-align: center;
}

.ms-how-fine strong {
  color: #eef3fa;
}

@media (max-width: 800px) {
  .ms-how-grid {
    grid-template-columns: 1fr;
  }
}
