/* =============================================================
   ACHIEVEMENT UNLOCK CELEBRATION (Prompt 11 — Game Feel)
   Brief, non-blocking center-top "moment" so an earned achievement is
   actually felt. Throttled in JS so simultaneous unlocks never stack.
   ============================================================= */
.ach-celebrate {
  position: fixed;
  top: 14%;
  left: 50%;
  z-index: 9300;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 20px 11px 14px;
  background: linear-gradient(135deg, rgba(20,18,6,0.95), rgba(10,12,30,0.95));
  border: 1px solid rgba(255,208,96,0.55);
  border-radius: 14px;
  box-shadow: 0 8px 34px rgba(0,0,0,0.5), 0 0 26px rgba(255,208,96,0.28);
  animation: achCelebrateIn 2.4s cubic-bezier(0.22,1,0.36,1) forwards;
}
.ach-celebrate-rare {
  border-color: rgba(255,224,120,0.85);
  box-shadow: 0 8px 38px rgba(0,0,0,0.55),
              0 0 36px rgba(255,208,96,0.5),
              0 0 70px rgba(255,160,40,0.25);
}
.ach-celebrate-trophy {
  font-size: 2rem;
  line-height: 1;
  filter: drop-shadow(0 0 12px rgba(255,208,96,0.8));
  animation: achTrophyPop 0.5s cubic-bezier(0.34,1.56,0.64,1) 0.1s both;
}
.ach-celebrate-txt { display: flex; flex-direction: column; gap: 2px; }
.ach-celebrate-tag {
  font-family: var(--font-hd);
  font-size: 0.56rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: rgba(255,208,96,0.8);
}
.ach-celebrate-rare .ach-celebrate-tag { color: #ffe080; }
.ach-celebrate-name {
  font-family: var(--font-hd);
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #fff;
  text-shadow: 0 0 16px rgba(255,208,96,0.5);
}
@keyframes achCelebrateIn {
  0%   { opacity: 0; transform: translate(-50%, -16px) scale(0.85); }
  10%  { opacity: 1; transform: translate(-50%, 0) scale(1.04); }
  18%  { transform: translate(-50%, 0) scale(1.0); }
  82%  { opacity: 1; transform: translate(-50%, 0) scale(1.0); }
  100% { opacity: 0; transform: translate(-50%, -10px) scale(0.98); }
}
@keyframes achTrophyPop {
  0%   { transform: scale(0) rotate(-18deg); }
  65%  { transform: scale(1.2) rotate(6deg); }
  100% { transform: scale(1) rotate(0deg); }
}
.reduced-motion .ach-celebrate { animation: achCelebrateFade 2.4s ease-out forwards; }
.reduced-motion .ach-celebrate-trophy { animation: none; }
@keyframes achCelebrateFade {
  0%   { opacity: 0; transform: translate(-50%, 0); }
  8%   { opacity: 1; transform: translate(-50%, 0); }
  88%  { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, 0); }
}

/* =============================================================
   ACHIEVEMENTS SCREEN — trophy case styling
   Reuses .modal-box / .modal-title shell; everything below is
   the inner layout for #ach-modal-body.
   ============================================================= */

.ach-modal-box {
  width: min(640px, 94vw);
  max-width: min(640px, 94vw); /* beat .modal-box's 440px cap on desktop */
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#ach-modal-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px 6px 12px 2px;
  flex: 1;
}
#ach-modal-body::-webkit-scrollbar { width: 8px; }
#ach-modal-body::-webkit-scrollbar-thumb { background: rgba(255,208,96,0.30); border-radius: 4px; }
#ach-modal-body::-webkit-scrollbar-track { background: rgba(255,255,255,0.04); }

/* Completion summary banner */
.ach-summary {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  margin: 4px 0 14px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(255,208,96,0.14), rgba(255,208,96,0.04));
  border: 1px solid rgba(255,208,96,0.28);
}

.ach-summary-ring {
  position: relative;
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 800;
  color: #ffd060;
  background:
    radial-gradient(closest-side, rgba(20,22,36,0.92) 72%, transparent 73% 100%),
    conic-gradient(#ffd060 calc(var(--ach-pct, 0) * 1%), rgba(255,255,255,0.12) 0);
}

.ach-summary-text { flex: 1; min-width: 0; }
.ach-summary-title {
  font-size: 0.92rem;
  font-weight: 800;
  color: #ffe9b8;
  margin-bottom: 2px;
}
.ach-summary-sub {
  font-size: 0.74rem;
  color: rgba(255,255,255,0.62);
  line-height: 1.35;
}

/* Category groups */
.ach-category {
  margin-bottom: 16px;
}
.ach-category-title {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 800;
  color: rgba(255,255,255,0.5);
  margin: 0 0 8px 2px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.ach-category-count {
  font-size: 0.66rem;
  font-weight: 700;
  color: rgba(255,255,255,0.4);
  letter-spacing: normal;
  text-transform: none;
}

.ach-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

/* Individual achievement card */
.ach-card {
  position: relative;
  border-radius: 11px;
  padding: 11px 12px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: hidden;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}
.ach-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255,255,255,0.18);
}

.ach-card.ach-unlocked {
  background: linear-gradient(160deg, rgba(255,208,96,0.16), rgba(255,208,96,0.03));
  border-color: rgba(255,208,96,0.4);
  box-shadow: 0 0 0 1px rgba(255,208,96,0.08), 0 6px 18px -8px rgba(255,208,96,0.35);
}
.ach-card.ach-unlocked:hover {
  border-color: rgba(255,208,96,0.65);
  box-shadow: 0 0 0 1px rgba(255,208,96,0.16), 0 8px 22px -6px rgba(255,208,96,0.45);
}

.ach-card.ach-locked {
  opacity: 0.62;
}
.ach-card.ach-locked .ach-card-name { color: rgba(255,255,255,0.55); }

.ach-card-top {
  display: flex;
  align-items: center;
  gap: 9px;
}
.ach-card-icon {
  font-size: 1.35rem;
  line-height: 1;
  flex-shrink: 0;
  filter: grayscale(1) brightness(0.7);
}
.ach-card.ach-unlocked .ach-card-icon {
  filter: none;
  text-shadow: 0 0 10px rgba(255,208,96,0.55);
}
.ach-card-name {
  font-size: 0.78rem;
  font-weight: 800;
  color: #ffe9b8;
  line-height: 1.2;
}
.ach-card-desc {
  font-size: 0.68rem;
  color: rgba(255,255,255,0.5);
  line-height: 1.35;
}

/* Progress bar for numeric-threshold achievements */
.ach-card-progress {
  margin-top: 2px;
}
.ach-card-bar-track {
  height: 5px;
  border-radius: 3px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
}
.ach-card-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, #ffb347, #ffd060);
  transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
.ach-card-bar-label {
  margin-top: 3px;
  font-size: 0.62rem;
  font-weight: 700;
  color: rgba(255,255,255,0.45);
  text-align: right;
}

/* Disclosed cosmetic reward (Phase 6: reward visibility) */
.ach-card-reward {
  margin-top: 4px;
  font-size: 0.62rem;
  font-weight: 700;
  color: #ffd060;
  letter-spacing: 0.01em;
}

/* In-card guidance pointing at the system that progresses this achievement
   (Phase 7: fixes "zero in-card guidance" playtest finding) */
.ach-card-hint {
  margin-top: 4px;
  font-size: 0.62rem;
  font-style: italic;
  color: rgba(160, 200, 255, 0.75);
  line-height: 1.3;
}

/* "Next Up" section — always first, surfaces actionable next goals
   regardless of category order (Phase 7) */
.ach-nextup .ach-category-title {
  color: #ffd060;
}
.ach-card-nextup {
  opacity: 1;
  border-color: rgba(255,208,96,0.22);
  background: rgba(255,208,96,0.05);
}
.ach-card-nextup .ach-card-name {
  color: rgba(255,255,255,0.85);
}

.ach-card-badge {
  position: absolute;
  top: 8px;
  right: 9px;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #ffd060;
  text-shadow: 0 0 8px rgba(255,208,96,0.5);
}
.ach-card-lock {
  position: absolute;
  top: 9px;
  right: 10px;
  font-size: 0.72rem;
  opacity: 0.4;
}

/* Gentle reveal animation when the screen opens — scale+fade, no flashes */
@keyframes achCardIn {
  from { opacity: 0; transform: translateY(6px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.ach-card {
  animation: achCardIn 0.36s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@media (max-width: 640px) {
  .ach-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}
