/* Paleta Royal Sapphire */
:root {
  --s1: #091747;
  --s2: #0D2C8E;
  --s3: #1746A2;
  --s4: #3B82F6;
  --s5: #7DB2FF;
  --s6: #E6F0FF;
  --fundo: #040b26;
  --texto: #E6F0FF;
  --texto-suave: rgba(230, 240, 255, .62);
  --vidro: rgba(125, 178, 255, .08);
  --vidro-borda: rgba(230, 240, 255, .16);
  --raio: 28px;
  --fonte: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}

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

html { color-scheme: dark; }

body {
  min-height: 100vh;
  font-family: var(--fonte);
  color: var(--texto);
  background: radial-gradient(120% 80% at 50% 0%, #0b1f66 0%, var(--fundo) 55%, #020617 100%);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ---------- Luzes de fundo ---------- */
.fundo { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.luz {
  position: absolute; border-radius: 50%;
  filter: blur(70px); opacity: .55;
  animation: flutuar 18s ease-in-out infinite alternate;
}
.luz-1 { width: 380px; height: 380px; background: var(--s4); top: 12%; left: -160px; }
.luz-2 { width: 420px; height: 420px; background: var(--s3); top: 48%; right: -200px; animation-delay: -6s; }
.luz-3 { width: 260px; height: 260px; background: var(--s5); bottom: -120px; left: 18%; opacity: .3; animation-delay: -11s; }
.luz-4 { width: 300px; height: 300px; background: var(--s2); top: -120px; right: 12%; opacity: .5; animation-delay: -3s; }

@keyframes flutuar {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(40px, -30px) scale(1.08); }
  100% { transform: translate(-30px, 30px) scale(.95); }
}

/* ---------- Estrutura ---------- */
.pagina {
  position: relative; z-index: 1;
  width: min(760px, 100% - 32px);
  margin: 0 auto;
  padding: clamp(40px, 8vh, 88px) 0 40px;
}

.vidro {
  background: linear-gradient(180deg, rgba(230, 240, 255, .12) 0%, var(--vidro) 40%, rgba(9, 23, 71, .25) 100%);
  border: 1px solid var(--vidro-borda);
  border-radius: var(--raio);
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .22),
    inset 0 -1px 0 rgba(255, 255, 255, .04),
    0 20px 60px -20px rgba(2, 6, 23, .8);
}

/* ---------- Topo ---------- */
.topo { text-align: center; margin-bottom: 36px; }
.selo-topo {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  font-size: 12px; letter-spacing: .32em; text-transform: uppercase; color: var(--texto-suave);
}
.selo-topo span { width: 56px; height: 1px; background: linear-gradient(90deg, transparent, var(--texto-suave), transparent); }
.topo h1 {
  margin-top: 14px;
  font-size: clamp(40px, 8vw, 64px); font-weight: 800; letter-spacing: -.02em; line-height: 1.05;
  text-shadow: 0 0 40px rgba(59, 130, 246, .35);
}
.topo h1 em { font-style: italic; color: var(--s5); }
.sub { margin-top: 10px; font-size: 13px; letter-spacing: .22em; text-transform: uppercase; color: var(--texto-suave); }

/* ---------- Busca ---------- */
.busca {
  display: flex; gap: 12px; align-items: stretch;
  padding: 12px; border-radius: 999px;
}

.placa {
  position: relative; flex: 1; display: flex; flex-direction: column; overflow: hidden;
  border-radius: 999px 18px 18px 999px;
  background: linear-gradient(180deg, #ffffff 0%, var(--s6) 100%);
  box-shadow: inset 0 -3px 0 rgba(9, 23, 71, .12), 0 6px 24px -8px rgba(125, 178, 255, .6);
  cursor: text;
}
.placa-faixa {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  height: 18px; background: linear-gradient(180deg, var(--s3), var(--s2));
}
.placa-pais { font-size: 10px; font-weight: 700; letter-spacing: .3em; color: #fff; }
.placa-bandeira {
  width: 16px; height: 11px; border-radius: 2px;
  background:
    radial-gradient(circle at 50% 50%, #1e3a8a 0 22%, transparent 23%),
    conic-gradient(from 45deg at 50% 50%, #facc15 0 25%, #16a34a 0 50%, #facc15 0 75%, #16a34a 0);
  background-color: #16a34a;
}
.placa input {
  width: 100%; border: 0; outline: 0; background: transparent;
  padding: 6px 24px 8px;
  font: 800 clamp(30px, 7vw, 44px)/1 "DIN Alternate", "Bahnschrift", "Arial Narrow", var(--fonte);
  letter-spacing: .14em; text-align: center; text-transform: uppercase;
  color: var(--s1);
}
.placa input::placeholder { color: rgba(9, 23, 71, .22); }
.placa:focus-within { box-shadow: inset 0 -3px 0 rgba(9, 23, 71, .12), 0 0 0 3px rgba(125, 178, 255, .55), 0 6px 30px -6px rgba(59, 130, 246, .9); }

.scanner {
  position: absolute; left: 0; right: 0; top: 18px; height: 3px; opacity: 0;
  background: linear-gradient(90deg, transparent, var(--s4), var(--s5), var(--s4), transparent);
  box-shadow: 0 0 18px 4px rgba(59, 130, 246, .7);
}
.carregando .scanner { opacity: 1; animation: escanear 1.1s ease-in-out infinite alternate; }
@keyframes escanear { from { top: 20px; } to { top: calc(100% - 4px); } }

.botao {
  display: flex; align-items: center; gap: 10px;
  padding: 0 30px; border: 0; border-radius: 18px 999px 999px 18px; cursor: pointer;
  font: 700 16px var(--fonte); color: #fff;
  background: linear-gradient(180deg, var(--s4) 0%, var(--s3) 60%, var(--s2) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 10px 30px -8px rgba(59, 130, 246, .9);
  transition: transform .15s ease, box-shadow .2s ease, filter .2s ease;
}
.botao svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s ease; }
.botao:hover { filter: brightness(1.12); }
.botao:hover svg { transform: translateX(3px); }
.botao:active { transform: scale(.97); }
.botao:focus-visible { outline: 3px solid var(--s5); outline-offset: 3px; }
.botao:disabled { cursor: progress; filter: saturate(.6) brightness(.9); }
.carregando .botao-texto::after { content: "…"; }

/* ---------- Aviso e histórico ---------- */
.aviso { min-height: 24px; margin: 14px 0 4px; text-align: center; font-size: 14px; color: var(--texto-suave); }
.aviso.erro { color: #fca5a5; }

.historico { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; min-height: 8px; }
.historico button {
  padding: 6px 14px; border-radius: 999px; cursor: pointer;
  font: 600 13px var(--fonte); letter-spacing: .08em; color: var(--s6);
  background: rgba(125, 178, 255, .1); border: 1px solid rgba(125, 178, 255, .22);
  transition: background .2s ease;
}
.historico button:hover { background: rgba(125, 178, 255, .22); }

/* ---------- Resultado ---------- */
.resultado { display: grid; gap: 16px; margin-top: 28px; }
.resultado:not([hidden]) > * { animation: subir .5s cubic-bezier(.2, .8, .2, 1) both; }
.resultado > *:nth-child(2) { animation-delay: .07s; }
.resultado > *:nth-child(3) { animation-delay: .14s; }
@keyframes subir { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.cartao { padding: 24px; }
.cartao-topo { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.cartao h3 { font-size: 13px; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; color: var(--texto-suave); }

.heroi { display: flex; align-items: center; gap: 20px; }
.tipo-icone {
  flex: none; display: grid; place-items: center; width: 72px; height: 72px; border-radius: 22px;
  background: linear-gradient(180deg, var(--s4), var(--s2));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 10px 30px -10px rgba(59, 130, 246, .9);
}
.tipo-icone svg { width: 42px; height: 42px; fill: none; stroke: #fff; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.heroi-texto { flex: 1; min-width: 0; }
.tipo-rotulo { font-size: 12px; letter-spacing: .24em; text-transform: uppercase; color: var(--s5); }
.heroi h2 { margin-top: 4px; font-size: clamp(20px, 4vw, 28px); font-weight: 800; line-height: 1.15; overflow-wrap: anywhere; }
.marca { margin-top: 4px; font-size: 15px; color: var(--texto-suave); }
.heroi-ano {
  flex: none; display: flex; flex-direction: column; align-items: center;
  padding: 12px 18px; border-radius: 20px;
  background: rgba(230, 240, 255, .08); border: 1px solid var(--vidro-borda);
}
.heroi-ano span { font-size: 28px; font-weight: 800; }
.heroi-ano small { font-size: 11px; color: var(--texto-suave); letter-spacing: .06em; }

.dados { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.dados div {
  padding: 12px 14px; border-radius: 16px;
  background: rgba(230, 240, 255, .05); border: 1px solid rgba(230, 240, 255, .08);
}
.dados dt { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--texto-suave); }
.dados dd { margin-top: 4px; font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }

.copiar {
  padding: 7px 14px; border-radius: 999px; cursor: pointer;
  font: 600 12px var(--fonte); color: var(--s6);
  background: rgba(125, 178, 255, .12); border: 1px solid rgba(125, 178, 255, .25);
}
.copiar:hover { background: rgba(125, 178, 255, .24); }

/* FIPE */
.confianca { padding: 5px 12px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.confianca.alta { color: #bbf7d0; background: rgba(34, 197, 94, .14); border: 1px solid rgba(34, 197, 94, .35); }
.confianca.baixa { color: #fde68a; background: rgba(234, 179, 8, .14); border: 1px solid rgba(234, 179, 8, .35); }

.fipe-destaque {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 20px 24px; border-radius: 999px;
  background: linear-gradient(180deg, var(--s4) 0%, var(--s3) 55%, var(--s2) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .4), inset 0 -2px 0 rgba(9, 23, 71, .3), 0 14px 40px -14px rgba(59, 130, 246, .9);
}
.fipe-destaque .nome { font-weight: 700; font-size: 16px; }
.fipe-destaque .codigo { display: block; font-size: 12px; opacity: .75; margin-top: 2px; }
.fipe-destaque .valor { font-size: clamp(22px, 5vw, 30px); font-weight: 800; white-space: nowrap; }
.fipe-legenda { margin: 14px 4px 10px; font-size: 13px; color: var(--texto-suave); }

/* Versões: pílulas em degradê como a paleta */
.versoes { list-style: none; display: grid; gap: 0; }
.versoes li {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: -10px; padding: 20px 22px 14px; border-radius: 999px;
  font-size: 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 -6px 16px -8px rgba(2, 6, 23, .7);
}
.versoes li:first-child { margin-top: 0; padding-top: 14px; }
.versoes li .v-valor { font-weight: 700; white-space: nowrap; }
.versoes li .v-codigo { font-size: 11px; opacity: .7; margin-left: 6px; }
.versoes li.sugerida { outline: 2px solid var(--s6); outline-offset: -2px; }
.versoes li.sugerida .v-nome::before { content: "★ "; }

.rodape-resultado { text-align: center; font-size: 12px; color: var(--texto-suave); }
.rodape { margin-top: 48px; text-align: center; font-size: 12px; color: rgba(230, 240, 255, .4); }

/* ---------- Celular ---------- */
@media (max-width: 560px) {
  .busca { flex-direction: column; border-radius: 32px; }
  .placa { border-radius: 22px; }
  .botao { justify-content: center; padding: 16px; border-radius: 22px; }
  .cartao { padding: 18px; }
  .heroi { flex-wrap: wrap; gap: 16px; }
  .tipo-icone { width: 60px; height: 60px; border-radius: 18px; }
  .heroi-texto { flex: 1 1 calc(100% - 80px); }
  .heroi-ano { flex: 1 1 100%; flex-direction: row; justify-content: center; gap: 8px; align-items: baseline; padding: 8px 14px; }
  .dados { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .fipe-destaque { border-radius: 28px; }
  .versoes li { border-radius: 24px; flex-direction: column; align-items: flex-start; gap: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  .luz, .resultado > *, .carregando .scanner { animation: none !important; }
}
