:root {
  --bg: #14121a;
  --bg-card: #1f1c29;
  --accent: #e8a355;
  --text: #f2ede4;
  --text-muted: #a9a2b8;
  --error: #e0645a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  padding: 24px;
}

.card {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 32px;
  max-width: 480px;
  width: 100%;
  text-align: center;
}

h1 {
  font-size: 1.6rem;
  margin-bottom: 8px;
}

p.subtitle {
  color: var(--text-muted);
  margin-bottom: 24px;
}

#qrcode {
  display: inline-block;
  padding: 16px;
  background: #fff;
  border-radius: 12px;
  margin: 16px 0;
}

form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: left;
}

label {
  font-size: 0.9rem;
  color: var(--text-muted);
}

input, select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #3a3448;
  background: #211d2c;
  color: var(--text);
  font-size: 1rem;
}

button {
  margin-top: 8px;
  padding: 12px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #1a1620;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.erro {
  color: var(--error);
  font-size: 0.9rem;
  min-height: 1.2em;
}

/* Características (checkboxes agrupados) */
.caracteristicas-cabecalho {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.contador-caracteristicas {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.contador-caracteristicas.cheio {
  color: var(--accent);
}

.grupo-caracteristicas {
  border: none;
  margin: 0 0 14px;
  padding: 0;
}

.grupo-caracteristicas legend {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  padding: 0 0 6px;
}

.opcao-caracteristica {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 7px 8px;
  border-radius: 8px;
  cursor: pointer;
}

.opcao-caracteristica:hover {
  background: #211d2c;
}

.opcao-caracteristica input {
  width: auto;
  margin-top: 3px;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.opcao-caracteristica input:disabled {
  opacity: 0.4;
}

.opcao-texto {
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.3;
}

.opcao-titulo {
  font-size: 0.92rem;
  color: var(--text);
}

.opcao-apoio {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.opcao-caracteristica:has(input:disabled) .opcao-titulo,
.opcao-caracteristica:has(input:disabled) .opcao-apoio {
  opacity: 0.4;
}

.carta {
  white-space: pre-wrap;
  text-align: left;
  line-height: 1.6;
  background: #211d2c;
  border-radius: 10px;
  padding: 20px;
  margin-top: 16px;
  animation: revelar 0.5s ease-out;
}

@keyframes revelar {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.oculto {
  display: none !important;
}

/* Loader */
.loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 36px 0 16px;
}

.loader-anel {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: 3px solid rgba(232, 163, 85, 0.15);
  border-top-color: var(--accent);
  animation: girar 1s linear infinite;
  position: relative;
}

.loader-anel::before {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 3px solid transparent;
  border-bottom-color: rgba(232, 163, 85, 0.45);
  animation: girar 1.7s linear infinite reverse;
}

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

.loader-texto {
  font-family: "Courier New", monospace;
  font-size: 0.85rem;
  color: var(--accent);
  letter-spacing: 0.3px;
  min-height: 1.4em;
  margin: 0;
}

.loader-texto::after {
  content: "";
  display: inline-block;
  width: 6px;
  height: 1em;
  background: var(--accent);
  margin-left: 4px;
  vertical-align: middle;
  animation: piscar 0.8s steps(1) infinite;
}

@keyframes piscar {
  50% { opacity: 0; }
}

/* Flash de transição */
.flash {
  position: fixed;
  inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  z-index: 999;
}

.flash.ativo {
  animation: flash-anim 0.4s ease-out;
}

@keyframes flash-anim {
  0% { opacity: 0; }
  15% { opacity: 1; }
  100% { opacity: 0; }
}
