/* Progression — profile screen, XP bar, badge grid, badge toasts.
   Uses the shared felt/gold palette and the global .page/.btn/.stat-row classes. */

#screen-profile {
  background: radial-gradient(120% 90% at 50% 0%, var(--felt-dark) 0%, #04220f 100%);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Scoped so the shared .page rules are left untouched for other screens. */
#screen-profile .page {
  flex: none;
  padding-bottom: calc(40px + env(safe-area-inset-bottom));
}

.prog-section { display: flex; flex-direction: column; gap: 10px; }

.prog-h {
  font-size: 16px;
  color: var(--gold);
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.prog-h small {
  font-size: 11px;
  font-weight: 400;
  color: #fff;
  opacity: .55;
  text-transform: uppercase;
  letter-spacing: .8px;
}

/* ---- Identity: avatar + display name ---- */

.prog-identity {
  background: rgba(0, 0, 0, .25);
  border-radius: 14px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.prog-identity-top { display: flex; align-items: center; gap: 14px; }

.prog-avatar-big {
  width: 62px; height: 62px;
  flex: none;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px;
  line-height: 1;
  background: linear-gradient(var(--felt), var(--felt-dark));
  box-shadow: 0 2px 6px rgba(0, 0, 0, .45), inset 0 0 0 2px rgba(243, 193, 75, .75);
}

.prog-identity-fields { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }

.prog-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: .6;
}

.prog-name-input {
  appearance: none;
  width: 100%;
  border: none;
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  font-size: 17px;
  font-weight: 600;
  color: #fff;
  background: rgba(255, 255, 255, .12);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18);
  user-select: text;
  -webkit-user-select: text;
}
.prog-name-input:focus {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--gold);
}

.prog-avatar-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.prog-avatar-opt {
  appearance: none;
  border: none;
  width: 40px; height: 40px;
  border-radius: 10px;
  font-size: 21px;
  line-height: 1;
  background: rgba(255, 255, 255, .1);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .15);
  cursor: pointer;
  flex: none;
}
.prog-avatar-opt:active { transform: translateY(1px); }
.prog-avatar-opt.selected {
  background: rgba(243, 193, 75, .22);
  box-shadow: inset 0 0 0 2px var(--gold);
}

/* ---- Level & XP ---- */

.prog-level {
  background: rgba(0, 0, 0, .25);
  border-radius: 14px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.prog-level-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

.prog-level-tag {
  font-size: 17px;
  font-weight: 800;
  color: #4a3403;
  background: linear-gradient(#ffd35e, #e8a825);
  border-radius: 999px;
  padding: 4px 14px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .3);
}

.prog-xp { font-size: 13px; font-weight: 600; opacity: .8; }

.prog-bar {
  height: 10px;
  border-radius: 5px;
  background: rgba(0, 0, 0, .45);
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12);
}
.prog-bar-fill {
  height: 100%;
  min-width: 2px;
  border-radius: 5px;
  background: linear-gradient(90deg, #e8a825, var(--gold));
  transition: width .35s ease;
}

.prog-level-note { font-size: 12px; opacity: .6; }

/* ---- Weekly history ---- */

.prog-history {
  display: flex;
  flex-direction: column;
  background: rgba(0, 0, 0, .18);
  border-radius: 12px;
  overflow: hidden;
}

.prog-history-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 9px 14px;
  font-size: 13px;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}
.prog-history-row:last-child { border-bottom: none; }
.prog-history-row span { flex: 1; opacity: .75; }
.prog-history-row b { color: var(--gold); }
.prog-history-row i { font-style: normal; opacity: .55; font-size: 12px; min-width: 62px; text-align: right; }

/* ---- Badges ---- */

.prog-badge-group { display: flex; flex-direction: column; gap: 8px; }

.prog-group-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  opacity: .55;
}

.prog-badge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 8px;
}

.prog-badge {
  appearance: none;
  border: none;
  text-align: center;
  font: inherit;
  color: #fff;
  cursor: pointer;
  padding: 10px 6px 9px;
  border-radius: 12px;
  background: rgba(0, 0, 0, .28);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-height: 92px;
  opacity: .42;
}
.prog-badge:active { transform: translateY(1px); }

.prog-badge-icon { font-size: 26px; line-height: 1.1; }
.prog-badge-name { font-size: 11.5px; font-weight: 700; line-height: 1.2; }
.prog-badge-sub {
  font-size: 10px;
  line-height: 1.25;
  opacity: .7;
  min-height: 12px;
}

.prog-badge.earned {
  opacity: 1;
  background: linear-gradient(rgba(18, 58, 36, .95), rgba(11, 39, 22, .95));
  box-shadow: inset 0 0 0 1px rgba(243, 193, 75, .45), 0 2px 6px rgba(0, 0, 0, .3);
}
.prog-badge.earned .prog-badge-name { color: var(--gold); }

/* Earned badges hide their date until hovered or tapped; unearned tiles keep
   their "how to earn" hint visible at all times. */
.prog-badge.earned .prog-badge-sub { opacity: 0; transition: opacity .15s ease; }
.prog-badge.earned:hover .prog-badge-sub,
.prog-badge.earned.revealed .prog-badge-sub { opacity: .75; }

/* Rare / late badges get the full gold treatment. */
.prog-badge.earned.rare {
  background: linear-gradient(rgba(93, 66, 12, .95), rgba(48, 33, 6, .95));
  box-shadow: inset 0 0 0 2px var(--gold), 0 0 12px rgba(243, 193, 75, .35), 0 2px 6px rgba(0, 0, 0, .35);
}
.prog-badge.earned.rare .prog-badge-icon {
  filter: drop-shadow(0 0 6px rgba(243, 193, 75, .8));
}
.prog-badge.earned.rare .prog-badge-name { color: #ffe9a8; }

/* ---- Badge toasts ---- */

.prog-toasts {
  position: fixed;
  top: calc(8px + env(safe-area-inset-top));
  left: 0; right: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none; /* never blocks play */
}

.prog-toast {
  width: min(88vw, 320px);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 14px;
  background: linear-gradient(rgba(18, 58, 36, .97), rgba(9, 34, 19, .97));
  box-shadow: inset 0 0 0 1.5px var(--gold), 0 8px 24px rgba(0, 0, 0, .5);
  transform: translateY(-140%);
  opacity: 0;
  transition: transform .28s cubic-bezier(.2, .9, .3, 1.2), opacity .28s ease;
}
.prog-toast.in { transform: translateY(0); opacity: 1; }
.prog-toast.out { transform: translateY(-140%); opacity: 0; }

.prog-toast-icon { font-size: 26px; line-height: 1; flex: none; }
.prog-toast-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.prog-toast-kicker {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .8px;
  opacity: .75;
}
.prog-toast-name {
  font-size: 16px;
  font-weight: 800;
  color: var(--gold);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prog-toast.rare {
  background: linear-gradient(rgba(93, 66, 12, .97), rgba(40, 27, 5, .97));
  box-shadow: inset 0 0 0 2px var(--gold), 0 0 18px rgba(243, 193, 75, .45), 0 8px 24px rgba(0, 0, 0, .5);
}

@media (prefers-reduced-motion: reduce) {
  .prog-toast { transition: opacity .2s ease; transform: none; }
  .prog-toast.in, .prog-toast.out { transform: none; }
  .prog-bar-fill { transition: none; }
}

@media (min-width: 700px) {
  .prog-badge-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
}
