/* ─── Toast notifications ─── */
.ach-toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--bg-raised, #1e1e2e);
  border: 1px solid var(--border, #333);
  border-radius: 10px;
  padding: 12px 16px;
  min-width: 260px;
  max-width: 360px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  opacity: 0;
  transform: translateX(40px);
  transition: opacity 0.3s, transform 0.3s;
}
.ach-toast.ach-toast-enter {
  opacity: 1;
  transform: translateX(0);
}
.ach-toast.ach-toast-exit {
  opacity: 0;
  transform: translateX(40px);
}
.ach-toast-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
  margin-top: 2px;
}
.ach-toast-body {
  flex: 1;
}
.ach-toast-title {
  font-weight: 600;
  font-size: 0.85rem;
  color: #ffcc00;
  margin-bottom: 2px;
}
.ach-toast-msg {
  font-size: 0.78rem;
  color: var(--text-muted, #aaa);
  line-height: 1.3;
}
.ach-toast.ach-toast-bronze  { border-left: 3px solid #cd7f32; }
.ach-toast.ach-toast-silver  { border-left: 3px solid #c0c0c0; }
.ach-toast.ach-toast-gold    { border-left: 3px solid #ffd700; }
.ach-toast.ach-toast-platinum{ border-left: 3px solid #e5e4e2; }
.ach-toast.ach-toast-special { border-left: 3px solid #ff00ff; }

/* ─── Badge in header ─── */
.ach-badge-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}
.ach-header-points {
  font-size: 0.7rem;
  font-weight: 600;
  color: #ffcc00;
  opacity: 0.85;
}
.ach-badge-btn {
  position: relative;
  font-size: 1.1rem;
  color: #ffcc00;
}
.ach-badge-count {
  position: absolute;
  top: -2px;
  right: -4px;
  background: #ff4444;
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* ─── Modal ─── */
.ach-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 9000;
  justify-content: center;
  align-items: flex-start;
  padding-top: 8vh;
}
.ach-backdrop-active {
  display: flex;
}
.ach-modal {
  background: var(--bg-raised, #1e1e2e);
  border: 1px solid var(--border, #333);
  border-radius: 14px;
  width: 90vw;
  max-width: 640px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 20px 24px 28px;
  position: relative;
}
.ach-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-muted, #888);
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
}
.ach-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}
.ach-title {
  margin: 0;
  font-size: 1.2rem;
  color: var(--text-secondary, #eee);
}
.ach-header-stats {
  display: flex;
  gap: 14px;
  font-size: 0.82rem;
  color: var(--text-muted, #888);
}
.ach-points {
  color: #ffcc00;
  font-weight: 600;
}

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

/* ─── Card ─── */
.ach-card {
  background: var(--bg-surface, #161626);
  border: 1px solid var(--border, #2a2a3a);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
  opacity: 0.55;
  filter: grayscale(0.8);
  transition: opacity 0.3s, filter 0.3s;
}
.ach-card.ach-unlocked {
  opacity: 1;
  filter: grayscale(0);
}
.ach-card.ach-secret {
  opacity: 0.55;
}
.ach-icon {
  font-size: 1.4rem;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--bg-raised, #1a1a2e);
  margin-bottom: 4px;
}
.ach-name {
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--text-secondary, #eee);
}
.ach-desc {
  font-size: 0.68rem;
  color: var(--text-muted, #888);
  line-height: 1.25;
  flex: 1;
}
.ach-progress {
  width: 100%;
  height: 4px;
  background: var(--border, #2a2a3a);
  border-radius: 2px;
  margin-top: 2px;
  overflow: hidden;
}
.ach-progress-fill {
  height: 100%;
  background: #ffcc00;
  border-radius: 2px;
  transition: width 0.5s;
}
.ach-progress-text {
  font-size: 0.6rem;
  color: var(--text-muted, #666);
}
.ach-bottom {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  justify-content: center;
  margin-top: 4px;
}
.ach-rarity {
  font-size: 0.58rem;
  font-weight: 600;
  text-transform: uppercase;
  opacity: 0.8;
}
.ach-date {
  font-size: 0.58rem;
  color: var(--text-muted, #666);
}
.ach-pts {
  font-size: 0.58rem;
  font-weight: 700;
  color: #ffcc00;
}

/* ─── Rarity colors ─── */
.ach-bronze  .ach-icon { color: #cd7f32; }
.ach-bronze  .ach-rarity { color: #cd7f32; }
.ach-bronze.ach-unlocked { border-color: rgba(205,127,50,0.3); }

.ach-silver  .ach-icon { color: #c0c0c0; }
.ach-silver  .ach-rarity { color: #c0c0c0; }
.ach-silver.ach-unlocked { border-color: rgba(192,192,192,0.3); }

.ach-gold    .ach-icon { color: #ffd700; }
.ach-gold    .ach-rarity { color: #ffd700; }
.ach-gold.ach-unlocked { border-color: rgba(255,215,0,0.3); }

.ach-platinum .ach-icon { color: #e5e4e2; }
.ach-platinum .ach-rarity { color: #e5e4e2; }
.ach-platinum.ach-unlocked { border-color: rgba(229,228,226,0.3); }

.ach-special .ach-icon {
  background: linear-gradient(135deg, #ff0000, #ff8800, #ffff00, #00ff00, #0088ff, #8800ff, #ff00ff);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.ach-special .ach-rarity { color: #ff88cc; }
.ach-special.ach-unlocked { border-color: rgba(255,136,204,0.3); }

/* ─── Tabs ─── */
.ach-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border, #333);
}
.ach-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted, #888);
  font-size: 0.82rem;
  font-weight: 500;
  padding: 8px 16px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.ach-tab:hover { color: var(--text-secondary, #aaa); }
.ach-tab.active {
  color: #ffcc00;
  border-bottom-color: #ffcc00;
}

/* ─── History ─── */
.ach-history {
  max-height: 50vh;
  overflow-y: auto;
}
.ach-history-total {
  font-size: 0.85rem;
  color: var(--text-secondary, #ccc);
  margin-bottom: 12px;
  padding: 8px 12px;
  background: var(--bg-surface, #161626);
  border-radius: 8px;
}
.ach-history-total strong {
  color: #ffcc00;
  font-size: 1rem;
}
.ach-history-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ach-history-entry {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 0.78rem;
}
.ach-history-entry:nth-child(odd) {
  background: var(--bg-surface, #161626);
}
.ach-h-icon {
  width: 28px;
  text-align: center;
  color: var(--text-muted, #888);
  flex-shrink: 0;
}
.ach-h-desc {
  flex: 1;
  color: var(--text-secondary, #ccc);
}
.ach-h-date {
  color: var(--text-muted, #666);
  font-size: 0.68rem;
  white-space: nowrap;
}
.ach-h-amount {
  font-weight: 600;
  white-space: nowrap;
  min-width: 55px;
  text-align: right;
}
.ach-h-positive { color: #4caf50; }
.ach-h-negative { color: #ff5252; }

.ach-empty {
  text-align: center;
  color: var(--text-muted, #888);
  padding: 32px 16px;
  font-size: 0.85rem;
}

/* ─── Export/Import buttons ─── */
.ei-btn-wrap {
  display: flex;
  align-items: center;
  gap: 2px;
}
.ei-btn {
  font-size: 0.95rem;
  color: var(--text-muted, #888);
  opacity: 0.75;
}
.ei-btn:hover {
  color: var(--text-secondary, #ccc);
  opacity: 1;
}
