:root {
  --verde: #2f9e44;
  --verde-escuro: #1e6b2f;
  --fundo: #f4f6f5;
  --cartao: #ffffff;
  --texto: #1a1a1a;
  --texto-fraco: #6b7280;
  --borda: #e2e5e3;
  --erro: #d64545;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--fundo);
  color: var(--texto);
}

header {
  background: var(--verde);
  color: white;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

header h1 {
  margin: 0;
  font-size: 1.3rem;
}

nav {
  display: flex;
  gap: 8px;
}

nav a {
  color: white;
  text-decoration: none;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.9rem;
}

nav a.ativo {
  background: rgba(255, 255, 255, 0.25);
}

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px;
}

.cartao {
  background: var(--cartao);
  border: 1px solid var(--borda);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
}

button {
  background: var(--verde);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 12px 20px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

button:disabled {
  background: #a8b0ac;
  cursor: not-allowed;
}

button:hover:not(:disabled) {
  background: var(--verde-escuro);
}

input[type="file"] {
  display: block;
  margin: 12px 0;
}

.preview {
  max-width: 100%;
  max-height: 300px;
  border-radius: 12px;
  margin: 12px 0;
  display: none;
}

.resultado {
  margin-top: 16px;
  padding: 16px;
  border-radius: 12px;
}

.resultado.sucesso { background: #eafaf0; border: 1px solid var(--verde); }
.resultado.aviso { background: #fff8e6; border: 1px solid #d9a017; }
.resultado.erro { background: #fdecec; border: 1px solid var(--erro); }

.grade-album {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}

.carta-item {
  background: var(--cartao);
  border: 1px solid var(--borda);
  border-radius: 12px;
  overflow: hidden;
  text-align: center;
}

.carta-item img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  background: #eee;
}

.carta-item .nome {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 4px 2px;
}

.carta-item .set {
  font-size: 0.7rem;
  color: var(--texto-fraco);
  padding: 0 4px 6px;
}

.progresso-set {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--borda);
  font-size: 0.9rem;
}

.progresso-set:last-child { border-bottom: none; }

.barra {
  flex: 1;
  height: 8px;
  background: #e2e5e3;
  border-radius: 4px;
  margin: 0 12px;
  overflow: hidden;
}

.barra-preenchida {
  height: 100%;
  background: var(--verde);
}

.vazio {
  color: var(--texto-fraco);
  text-align: center;
  padding: 40px 0;
}

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: white;
  border-radius: 50%;
  animation: girar 0.7s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}

@keyframes girar {
  to { transform: rotate(360deg); }
}
