*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-14);
  line-height: 1.45;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: 0;
}

button:disabled {
  cursor: not-allowed;
}

img {
  display: block;
  max-width: 100%;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0.01em;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.hidden {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Controles de teste só existem com ?debug (classe posta no <html> pelo script do index.html). */
.debug-only {
  display: none !important;
}

html.is-debug .debug-only {
  display: inline-flex !important;
}

#game-app {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
}

.app-screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
}

.app-screen.hidden {
  display: none !important;
}

.num {
  font-family: var(--font-display);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.muted {
  color: var(--text-2);
}

/* Ícone pixel art de moeda (Web/assets/ui/moedas/, gerado por scratch/gerar_icones_moedas.py). Junto de
   custos, saldos e recompensas: 18 px no texto corrido, decorativo (o nome da moeda segue escrito). */
.coin {
  display: inline-block;
  flex: none;
  width: 18px;
  height: 18px;
  vertical-align: -4px;
  margin-right: 3px;
  image-rendering: pixelated;
  user-select: none;
  -webkit-user-drag: none;
}

.wallet-coin {
  margin-right: 0;
}

/* Cartão de item (painel da fase): 48 px, o mesmo tamanho dos outros itens. */
.coin-large {
  width: 48px;
  height: 48px;
  margin-right: 0;
  vertical-align: baseline;
}

/* Ícone e valor não se separam na quebra de linha. */
.coin-amount {
  white-space: nowrap;
}

/* Botões. Primário claro (sem neon), secundário em superfície, perigo em texto vermelho claro. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  min-height: 44px;
  padding: 0 var(--s-4);
  border-radius: var(--radius-m);
  border: 1px solid var(--line-strong);
  background: var(--surface-3);
  color: var(--text);
  font-weight: 600;
  font-size: var(--fs-14);
  white-space: nowrap;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}

.btn:hover:not(:disabled) {
  background: var(--surface-4);
}

.btn:disabled {
  opacity: 0.45;
}

.btn-primary {
  background: var(--action);
  border-color: var(--action);
  color: var(--action-ink);
}

.btn-primary:hover:not(:disabled) {
  background: var(--action-hover);
}

.btn-danger {
  color: var(--danger);
}

.btn-small {
  min-height: 32px;
  padding: 0 var(--s-3);
  font-size: var(--fs-13);
}

/* Secundário: contorno claro sobre fundo vazio, entre o neutro (preenchido) e o primário. */
.btn-outline {
  background: transparent;
  border-color: var(--action);
}

.btn-outline:hover:not(:disabled) {
  background: var(--surface-3);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface-3);
}

.btn-meta {
  font-weight: 400;
  color: inherit;
  font-variant-numeric: tabular-nums;
}

.icon-btn {
  min-width: 44px;
  padding: 0 var(--s-3);
}

.debug-btn {
  border-style: dashed;
  color: var(--text-2);
  font-weight: 400;
}

/* Campo de busca. */
.search-field {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
  flex: 1 1 200px;
}

.search-field input {
  width: 100%;
  min-height: 44px;
  padding: 0 40px 0 var(--s-3);
  border-radius: var(--radius-m);
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
}

.search-field input::placeholder {
  color: var(--text-2);
}

.search-field .clear-search-btn {
  position: absolute;
  right: 2px;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-m);
  color: var(--text-2);
  font-size: var(--fs-20);
}

.search-field .clear-search-btn:hover {
  color: var(--text);
}

/* Dropdown (contrato: .custom-dropdown > botão + .dropdown-menu-pane > .dropdown-opt). */
.custom-dropdown {
  position: relative;
}

.dropdown-trigger-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  min-height: 44px;
  padding: 0 var(--s-3);
  border-radius: var(--radius-m);
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  white-space: nowrap;
}

.dropdown-trigger-btn:hover {
  background: var(--surface-3);
}

.dropdown-prefix {
  color: var(--text-2);
}

.dropdown-trigger-btn strong {
  font-weight: 600;
}

.dropdown-arrow {
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--text-2);
  border-bottom: 2px solid var(--text-2);
  transform: translateY(-2px) rotate(45deg);
  transition: transform var(--t-fast);
}

.custom-dropdown.open .dropdown-arrow {
  transform: translateY(2px) rotate(-135deg);
}

.dropdown-menu-pane {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 40;
  min-width: 100%;
  padding: var(--s-1);
  border-radius: var(--radius-m);
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  box-shadow: var(--shadow-menu);
  max-height: min(60vh, 440px);
  overflow-y: auto;
}

.dropdown-opt {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  width: 100%;
  min-height: 40px;
  padding: 0 var(--s-3);
  border-radius: var(--radius-s);
  text-align: left;
  white-space: nowrap;
}

.dropdown-opt:hover {
  background: var(--surface-3);
}

.dropdown-opt.active {
  background: var(--surface-4);
  font-weight: 600;
}

/* Marcador de universo: quadrado sólido na cor do anime. */
.universe-swatch {
  display: inline-block;
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--universe, var(--line-strong));
}

/* Chips de filtro (raridade, universo, classe). Hover e ativo vêm de css/20-selecao.css. */
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  min-height: 36px;
  padding: 0 var(--s-3);
  border-radius: var(--radius-s);
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--text);
  font-size: var(--fs-13);
  white-space: nowrap;
}

.chip .chip-count {
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

.chip[class*='rarity-'] .chip-label {
  color: var(--text);
}

.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}

/* Rótulo de raridade (texto neon). */
.rarity-label {
  color: var(--rarity);
  font-weight: 600;
  font-size: var(--fs-12);
}

/* Barra de taxas: segmentos proporcionais à chance, na cor da raridade. */
.rate-bar {
  display: flex;
  width: 100%;
  height: 8px;
  border-radius: 2px;
  overflow: hidden;
  background: var(--surface-3);
}

.rate-bar span {
  height: 100%;
  background: var(--rarity);
  min-width: 2px;
}

.rate-bar span + span {
  border-left: 2px solid var(--surface-1);
}

.rate-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2) var(--s-4);
  margin-top: var(--s-2);
  font-size: var(--fs-13);
}

.rate-legend li {
  list-style: none;
  display: inline-flex;
  gap: var(--s-1);
  align-items: baseline;
}

.rate-legend .rarity-label {
  font-size: var(--fs-13);
}

.panel {
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
}

.section-title {
  font-size: var(--fs-20);
}

.empty-state {
  grid-column: 1 / -1;
  padding: var(--s-6) var(--s-4);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-l);
  color: var(--text-2);
  text-align: center;
}

.empty-state strong {
  display: block;
  margin-bottom: var(--s-1);
  color: var(--text);
  font-size: var(--fs-16);
}

.soon-tag {
  font-size: var(--fs-12);
  color: var(--text-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-s);
  padding: 0 var(--s-1);
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0s !important;
    animation-delay: 0s !important;
    transition-duration: 0s !important;
  }
}

.custom-dropdown[class*='universe-'] .dropdown-trigger-btn {
  border-color: var(--universe);
  background: color-mix(in srgb, var(--universe) 16%, var(--surface-2));
}

.dropdown-opt .universe-swatch {
  margin-right: var(--s-1);
}
