/* Reusable glassmorphism components: cards, buttons, badges, nav, stat tiles. */

.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: var(--space-5);
}

.glass-card--tight {
  padding: var(--space-4);
}

.glass-card--interactive {
  transition: transform 0.22s var(--ease-out-soft), box-shadow 0.22s var(--ease-out-soft);
}
.glass-card--interactive:active {
  transform: scale(0.98);
  box-shadow: var(--shadow-soft);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  border: none;
  cursor: pointer;
  font-weight: 700;
  font-size: 15px;
  border-radius: var(--radius-pill);
  padding: 14px 22px;
  transition: transform 0.18s var(--ease-spring), box-shadow 0.18s var(--ease-out-soft), opacity 0.18s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.btn:active {
  transform: scale(0.96);
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
}

.btn--primary {
  color: var(--text-inverse);
  background: linear-gradient(135deg, var(--accent-400), var(--accent-600));
  box-shadow: var(--shadow-glow-accent);
}

.btn--gold {
  color: #201400;
  background: linear-gradient(135deg, var(--gold-400), var(--gold-600));
  box-shadow: var(--shadow-glow-gold);
}

.btn--ghost {
  color: var(--text-primary);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
}

.btn--danger {
  color: #fff;
  background: linear-gradient(135deg, #ff7a8a, var(--danger-500));
}

.btn--block {
  width: 100%;
}

.btn--sm {
  padding: 9px 16px;
  font-size: 13px;
}

.btn--icon {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: var(--radius-pill);
}

/* --- Section headers --- */
.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2);
}
.section-title h2 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.section-title a, .section-title button.link {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-500);
  background: none;
  border: none;
  cursor: pointer;
}

/* --- Badges / rarity tags --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.badge[data-rarity="common"] { background: color-mix(in srgb, var(--rarity-common) 22%, transparent); color: var(--rarity-common); }
.badge[data-rarity="uncommon"] { background: color-mix(in srgb, var(--rarity-uncommon) 22%, transparent); color: var(--rarity-uncommon); }
.badge[data-rarity="rare"] { background: color-mix(in srgb, var(--rarity-rare) 22%, transparent); color: var(--rarity-rare); }
.badge[data-rarity="epic"] { background: color-mix(in srgb, var(--rarity-epic) 24%, transparent); color: var(--rarity-epic); }
.badge[data-rarity="legendary"] { background: color-mix(in srgb, var(--rarity-legendary) 26%, transparent); color: var(--rarity-legendary); }
.badge[data-rarity="mythical"] { background: color-mix(in srgb, var(--rarity-mythical) 26%, transparent); color: var(--rarity-mythical); }

.badge--soft {
  background: var(--bg-elevated);
  color: var(--text-secondary);
}

/* --- Stat tiles --- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
}
.stat-grid--3 { grid-template-columns: repeat(3, 1fr); }

.stat-tile {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.stat-tile__label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.stat-tile__value {
  font-size: 20px;
  font-weight: 800;
}
.stat-tile__value .unit {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-left: 2px;
}

/* --- Progress bars --- */
.progress {
  height: 10px;
  border-radius: var(--radius-pill);
  background: var(--bg-elevated);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}
.progress__fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-500), var(--accent-400));
  transition: width 0.4s var(--ease-out-soft);
}
.progress__fill--gold {
  background: linear-gradient(90deg, var(--gold-600), var(--gold-400));
}
.progress__fill--energy {
  background: linear-gradient(90deg, var(--success-500), #6ee7b7);
}

/* --- Bottom tab navigation --- */
.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 10px);
  transform: translateX(-50%);
  width: min(94vw, 540px);
  height: var(--nav-height);
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  align-items: center;
  gap: 2px;
  padding: 6px;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--bg-surface-solid) 78%, transparent);
  border: 1px solid var(--border-subtle);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  box-shadow: var(--shadow-lift);
  z-index: 30;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: 100%;
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
  font-size: 9px;
  font-weight: 700;
  transition: color 0.2s, background 0.2s;
}
.nav-item svg {
  width: 20px;
  height: 20px;
}
.nav-item.is-active {
  color: var(--accent-400);
  background: color-mix(in srgb, var(--accent-500) 14%, transparent);
}

/* --- Item / catalog cards --- */
.item-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
}
.item-card__thumb {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  overflow: hidden;
}
.item-card__thumb img { width: 100%; height: 100%; object-fit: contain; }
.item-card__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.item-card__title {
  font-weight: 700;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.item-card__meta {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-6) var(--space-4);
  text-align: center;
  color: var(--text-secondary);
}
.empty-state__emoji {
  font-size: 40px;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.chip {
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
}
.chip.is-active {
  color: var(--text-inverse);
  background: linear-gradient(135deg, var(--accent-400), var(--accent-600));
  border-color: transparent;
}

.coin-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--gold-500) 16%, transparent);
  color: var(--gold-400);
  font-weight: 800;
  font-size: 13px;
}

.energy-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--success-500) 16%, transparent);
  color: var(--success-500);
  font-weight: 800;
  font-size: 13px;
}

.avatar {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-pill);
  object-fit: cover;
  border: 2px solid var(--border-strong);
  background: var(--bg-elevated);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 8, 16, 0.55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s var(--ease-out-soft);
}
.modal-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}
.modal-sheet {
  width: 100%;
  max-width: 560px;
  background: var(--bg-surface-solid);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: var(--space-5);
  padding-bottom: calc(var(--space-6) + env(safe-area-inset-bottom, 0px));
  transform: translateY(100%);
  transition: transform 0.32s var(--ease-out-soft);
  box-shadow: 0 -16px 40px rgba(0,0,0,0.4);
  max-height: 84vh;
  overflow-y: auto;
}
.modal-overlay.is-open .modal-sheet {
  transform: translateY(0);
}
.modal-sheet__handle {
  width: 40px;
  height: 4px;
  border-radius: var(--radius-pill);
  background: var(--border-strong);
  margin: 0 auto var(--space-4);
}
