:root{
  --bg:#0b0b14;
  --card:#161625;
  --input:#0f0f1a;
  --google1:#6366f1;
  --google2:#a855f7;
  --bing1:#2563eb;
  --bing2:#1e40af;
  --duck1:#f97316;
  --duck2:#ea580c;
  --text:#fff;
  --muted:#94a3b8;
  --border:#2d2d3f;
}

*{
  box-sizing:border-box;
}

body{
  margin:0;
  min-height:100vh;
  background:radial-gradient(circle at top,#111128,#07070e);
  font-family:Inter,system-ui,sans-serif;
  color:var(--text);
  display:flex;
  justify-content:center;
  padding:30px;
}

.wrapper{
  max-width:1200px;
  width:100%;
}

h1{
  font-size:52px;
  margin:0 0 10px;
  background:linear-gradient(#fff,#9aa4b2);
  -webkit-background-clip:text;
  -webkit-text-fill-color:transparent;
  text-align:center;
}

.subtitle{
  text-align:center;
  color:var(--muted);
  margin-bottom:35px;
}

.grid{
  display:grid;
  grid-template-columns:1fr 360px;
  gap:30px;
}

.card{
  background:linear-gradient(180deg,#161625,#0f0f1a);
  border:1px solid var(--border);
  border-radius:28px;
  padding:35px;
}

label{
  font-size:12px;
  color:var(--muted);
  font-weight:600;
  margin-bottom:6px;
  display:flex;
  align-items:center;
  gap:6px;
}

.info{
  cursor:pointer;
  font-size:14px;
  position:relative;
}

.info::after{
  content:attr(data-tip);
  position:absolute;
  bottom:120%;
  left:50%;
  transform:translateX(-50%);
  background:#000;
  color:#fff;
  padding:8px 10px;
  border-radius:8px;
  font-size:12px;
  width:220px;
  text-align:center;
  opacity:0;
  pointer-events:none;
  transition:.2s;
  z-index: 9999;
}

.info:hover::after{
  opacity:1;
}

/* ===============================
   RESET BOTÕES NATIVOS
================================ */

button {
  appearance: none;
  -webkit-appearance: none;
  background: none;
  border: none;
  font-family: inherit;
}

/* ===============================
   TOGGLE WEB / MOBILE
================================ */

.view-toggle {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

/* Isso garante que o botão padrão não "atropele" a cor ativa */
.view-toggle button {
  flex: 1;
  background: var(--input);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 8px;
}

/* ESTA É A LINHA MÁGICA: Usamos o ID + a CLASSE para ganhar na prioridade */
#viewWeb.active, #viewMobile.active {
  background: linear-gradient(135deg, #6366f1, #8b5cf6) !important;
  color: #ffffff !important;
  border-color: transparent !important;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4) !important;
}

.view-toggle button:hover {
  background: #1e1e32;
}

.view-toggle button.active {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  border-color: transparent;
}

/* ===============================
   TOGGLE WEB / MOBILE (FINAL)
================================ */

.view-toggle {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.view-toggle button {
  flex: 1;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.15);
  background: #161625;
  color: #c7c9ff;
  font-size: 14px;
  cursor: pointer;
  transition: all .25s ease;
}

.view-toggle button:hover {
  background: #1e1e32;
}

.view-toggle button.active {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  border-color: transparent;
}

/* ===============================
   MOBILE VIEW (SIMULAÇÃO)
================================ */

.wrapper.mobile-view {
  max-width: 420px;
  margin: 0 auto;
}


/* opcional: sensação de app */
.wrapper.mobile-view {
  background: #0b0b14;
}




/* INPUT + FAVORITO */
.input-wrap{
  position:relative;
}

.input-wrap input{
  padding-right:44px;
}

.heart{
  position:absolute;
  right:12px;
  top:50%;
  transform:translateY(-50%);
  font-size:20px;
  cursor:pointer;
  color:#555;
  transition:color .2s ease, transform .2s ease;
}

.heart.active{
  color:#ef4444;
  transform:translateY(-50%) scale(1.15);
}

.input-wrap {
  position: relative;
  z-index: 10;
}


/* INPUT */
input{
  width:100%;
  padding:14px;
  border-radius:12px;
  border:1px solid var(--border);
  background:var(--input);
  color:#fff;
}

input:focus{
  outline:none;
  border-color:#6366f1;
  box-shadow:0 0 0 2px rgba(99,102,241,.15);
}

/* PRESETS */
.presets{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  margin:12px 0 25px;
}

.preset{
  padding:7px 14px;
  border-radius:20px;
  background:var(--input);
  border:1px solid var(--border);
  cursor:pointer;
  font-size:13px;
}

.preset:hover{
  background:var(--card);
  border-color:#4f46e5;
}

.presets-label {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 600;
  font-size: inherit;
  color: inherit;
}

.field-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(255,255,255,0.7);
  margin-bottom: 0.35rem;
}

.presets-label {
  margin-top: 16px;
}

.presets-label {
  margin-bottom: 6px;
}

.presets-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.presets-label span {
  font-size: 12px;
  color: var(--muted);
}

.presets-label .info {
  font-size: 12px;
}

/* ROW */
.row{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:20px;
  margin-bottom:20px;
}

.row > div{
  position:relative;
}

/* MODOS */

.mode-static {
  background: linear-gradient(135deg,var(--google1),var(--google2));
  padding: 12px 18px;
  border-radius: 14px;
  font-weight: 700;
  text-align: center;
}


.mode-buttons{
  display:flex;
  gap:12px;
  margin-bottom:25px;
}

.mode-buttons .btn{
  padding:10px 18px;
  border-radius:14px;
  background:var(--input);
  border:1px solid var(--border);
  cursor:pointer;
  color:#fff;
}

.mode-buttons .btn.active{
  background:linear-gradient(135deg,var(--google1),var(--google2));
  border:none;
}

/* MOTORES */
.engine-buttons{
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:14px;
  margin-bottom:20px;
}

.engine{
  padding:16px;
  border-radius:18px;
  font-weight:700;
  color:#fff;
  border:1px solid var(--border);
  background:var(--input);
  cursor:pointer;
}

.engine.active.google{
  background:linear-gradient(135deg,var(--google1),var(--google2));
  border:none;
}

.engine.active.bing{
  background:linear-gradient(135deg,var(--bing1),var(--bing2));
  border:none;
}

.engine.active.duck{
  background:linear-gradient(135deg,var(--duck1),var(--duck2));
  border:none;
}

/* BOTÃO */
.spy{
  width:100%;
  padding:16px;
  border-radius:18px;
  background:linear-gradient(135deg,var(--google1),var(--google2));
  border:none;
  color:#fff;
  font-weight:700;
  cursor:pointer;
  transition:.2s;
}

.spy:hover{
  filter:brightness(1.1);
  transform:translateY(-1px);
}

.footer{
  text-align:center;
  margin-top:40px;
  font-size:13px;
  color:#4b5563;
}

/* IDIOMA */
.lang-switch{
  display:flex;
  justify-content:center;
  gap:10px;
  margin-bottom:20px;
}

.lang-switch button{
  padding:6px 12px;
  border-radius:10px;
  background:var(--input);
  border:1px solid var(--border);
  color:#fff;
  cursor:pointer;
  font-size:12px;
}

.lang-switch button.active{
  background:linear-gradient(135deg,var(--google1),var(--google2));
  border:none;
}

/* AUTOCOMPLETE */
.autocomplete-list{
  position:absolute;
  top:100%;
  left:0;
  right:0;
  background:var(--card);
  border:1px solid var(--border);
  border-radius:12px;
  margin-top:4px;
  max-height:160px;
  overflow-y:auto;
  z-index:100;
}

.autocomplete-item{
  padding:10px 14px;
  cursor:pointer;
  font-size:14px;
}

.autocomplete-item:hover{
  background:var(--input);
}

/* FAVORITOS */
.favs li{
  cursor:pointer;
  margin-bottom:6px;
}

.fav-remove{
  color:#ef4444;
  font-weight:700;
  margin-left:8px;
  cursor:pointer;
}

/* TOAST */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #0f172a; /* fundo do toast */
  color: #fff;
  padding: 12px 20px;
  border-radius: 16px;
  font-size: 14px;
  opacity: 0;
  pointer-events: auto;
  touch-action: none;
  z-index: 9999;
  text-align: center;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0,0,0,0.4);

  /* simulando borda com gradiente */
  border: 2px solid transparent;
  background-clip: padding-box, border-box;
  background-origin: padding-box, border-box;
  background-image: 
    linear-gradient(#0f172a, #0f172a), /* fundo */
    linear-gradient(270deg, #6366f1, #a855f7, #f97316, #f43f5e); /* borda */
}

/* mostrar toast com animação suave */
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  animation: pulse 0.5s ease-out;
}

/* pulse suave */
@keyframes pulse {
  0% { transform: translateX(-50%) translateY(0) scale(0.95); }
  50% { transform: translateX(-50%) translateY(0) scale(1.05); }
  100% { transform: translateX(-50%) translateY(0) scale(1); }
}

/* animação do gradiente da borda */
@keyframes gradientBorderAnim {
  0% { background-image: linear-gradient(#0f172a,#0f172a), linear-gradient(270deg, #6366f1, #a855f7, #f97316, #f43f5e); }
  50% { background-image: linear-gradient(#0f172a,#0f172a), linear-gradient(90deg, #6366f1, #a855f7, #f97316, #f43f5e); }
  100% { background-image: linear-gradient(#0f172a,#0f172a), linear-gradient(270deg, #6366f1, #a855f7, #f97316, #f43f5e); }
}

.toast.show {
  animation: pulse 0.5s ease-out, gradientBorderAnim 4s linear infinite;
}


/* mostrar toast */
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  animation: pulse 0.5s ease-out, gradientBorderAnim 4s linear infinite;
}

/* pulse leve ao aparecer */
@keyframes pulse {
  0% { transform: translateX(-50%) translateY(0) scale(0.95); }
  50% { transform: translateX(-50%) translateY(0) scale(1.05); }
  100% { transform: translateX(-50%) translateY(0) scale(1); }
}


/* CONTADOR */
.fav-counter{
  font-size:12px;
  color:var(--muted);
  margin-bottom:10px;
  text-align:right;
}

.fav-counter.limit{
  color:#ef4444;
}

/* PROGRESS */
.fav-progress{
  width:100%;
  height:6px;
  background:var(--border);
  border-radius:6px;
  overflow:hidden;
  margin-bottom:12px;
}

.fav-progress-bar{
  height:100%;
  width:0%;
  background:linear-gradient(135deg,var(--google1),var(--google2));
  transition:.3s;
}

.fav-progress-bar.limit{
  background:#ef4444;
}

/* MOBILE FAVORITOS */
.fav-toggle{
  display:none;
  width:100%;
  max-width:220px;
  margin:0 auto 20px;
  padding:12px 16px;
  border-radius:16px;
  background:var(--input);
  border:1px solid var(--border);
  color:#fff;
  font-size:14px;
  font-weight:600;
  cursor:pointer;
  justify-content:center;
  gap:8px;
}

.fav-toggle.active{
  background:linear-gradient(135deg,var(--google1),var(--google2));
  border:none;
}

.fav-mobile{
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  transform: translateY(100%);
  background: linear-gradient(180deg,#1b1b2f,#121224);
  border-top-left-radius:24px;
  border-top-right-radius:24px;
  padding:20px;
  max-height:80vh;
  overflow-y:auto;
  z-index:200;
  transition: transform 0.3s ease;
  box-shadow:0 -10px 30px rgba(0,0,0,.6);
  will-change: transform;
  touch-action: none; /* bloqueia scroll do body enquanto arrasta */
}

.fav-mobile.open{
  transform: translateY(0);
}


.fav-pill{
  width:44px;
  height:5px;
  border-radius:5px;
  background:rgba(255,255,255,.25);
  margin:0 auto 12px;
}

.fav-mobile-header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:12px;
  padding-bottom:10px;
  border-bottom:1px solid rgba(255,255,255,.08);
  
}

.favs li {
  cursor: pointer;
  margin-bottom: 6px;
  position: relative; /* essencial para o X ficar clicável */
  z-index: 5;        /* garante sobreposição */
}


.fav-remove {
  color: #ef4444;
  font-weight: 700;
  margin-left: 8px;
  cursor: pointer;
  position: relative;
  z-index: 10; /* garante que fique acima do li e do scroll */
}



.close-btn{
  width:36px;
  height:36px;
  border-radius:50%;
  background:rgba(255,255,255,.08);
  border:1px solid rgba(255,255,255,.12);
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  transition:all .2s ease;
}

.close-btn svg{
  opacity:.9;
}

.close-btn:hover{
  background:rgba(255,255,255,.16);
  transform:scale(1.05);
}

.close-btn:active{
  transform:scale(.95);
}

.site-lang-switch {
  position: absolute;
  top: 18px;
  right: 24px;
  display: flex;
  gap: 6px;
  z-index: 50;
}

.site-lang-switch button {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: all .25s ease;
}

.site-lang-switch button:hover {
  background: rgba(255,255,255,0.14);
}

.site-lang-switch button.active {
  background: #fff;
  color: #111;
  border-color: #fff;
}


/* RESPONSIVO */

@media (max-width:900px){
  .grid{
    grid-template-columns:1fr;
  }

  .sidebar{
    display:none;
  }

  .fav-toggle{
    display:flex;
  }
  
  h1 {
    font-size: 1.6rem;
    margin: 10px 0 12px;
  }
}

@media (max-width: 480px) {
  h1 {
    margin-bottom: 12px;
    display: inline-block;
  }
}

/* ==========================
   DONATE TAB
========================== */
.donate-tab {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  background: #ffdd00;
  color: #000;
  font-size: 20px;
  padding: 12px 14px;
  border-radius: 8px 0 0 8px;
  text-decoration: none;
  font-weight: bold;
  box-shadow: -2px 2px 10px rgba(0,0,0,0.15);
  z-index: 999;
  transition: all 0.25s ease;
}

.donate-tab:hover {
  padding-right: 20px;
  background: #ffd000;
}

/* Mobile: vira botão flutuante */
@media (max-width: 768px) {
  .donate-tab {
    right: 16px;
    bottom: 16px;
    top: auto;
    transform: none;
    border-radius: 50%;
    padding: 14px;
    font-size: 22px;
  }
}


.donate-tab::after {
  content: attr(data-tooltip);
  position: absolute;
  right: 100%;
  margin-right: 10px;
  background: #111;
  color: #fff;
  font-size: 12px;
  padding: 6px 8px;
  border-radius: 4px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%);
  top: 50%;
  transition: opacity 0.2s ease;
}

.donate-tab:hover::after {
  opacity: 1;
}


/* ==========================
   SITE HEADER
========================== */

.site-header {
  display: flex;
  flex-direction: column;   /* força empilhamento */
  align-items: center;      /* centraliza tudo */
  justify-content: center;
  text-align: center;
  gap: 1rem;
  width: 100%;
  margin-bottom: 1.5rem;
}

.site-logo {
  width: 70px;
  height: auto;
}

.site-titles {
  text-align: center;
}

.site-header h1 {
  margin: 0;
}

/* ==========================
   MOBILE HEADER
========================== */

@media (max-width: 600px) {

  .site-lang-switch {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 20px;
  }

  .site-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.25rem;
    margin-bottom: 12px;
  }

  .site-logo {
    width: 36px;
  }

  .site-header h1 {
    font-size: 1.5rem;
    margin: 0;
  }

  .subtitle {
    font-size: 0.85rem;
    margin: 0;
  }
  
/* ==========================
   ANIMAÇÃO SEQUENCIAL (MOBILE)
========================== */

/* LOGO — micro bounce */
@keyframes logoBounceIn {
  0% {
    opacity: 0;
    transform: translateY(18px) scale(0.95);
  }
  60% {
    opacity: 1;
    transform: translateY(-4px) scale(1.02);
  }
  100% {
    transform: translateY(0) scale(1);
  }
}

/* TÍTULO */
@keyframes titleFadeUp {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* SUBTÍTULO */
@keyframes subtitleFadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 600px) {

  /* estado inicial */
  .site-logo {
  opacity: 1;
  transform: translateY(0) scale(1);
}


  .site-logo {
    animation: logoBounceIn 0.6s ease-out forwards;
  }

  .site-titles h1 {
    animation: titleFadeUp 0.5s ease-out forwards;
    animation-delay: 0.35s;
  }

  .site-titles .subtitle {
    animation: subtitleFadeUp 0.5s ease-out forwards;
    animation-delay: 0.55s;
  }
}

.site-logo {
  display: block;
}

.lang-bounce {
  animation: langBounce 0.45s ease-out;
}

@keyframes langBounce {
  0%   { transform: translateY(0) scale(1); }
  30%  { transform: translateY(-4px) scale(1.05); }
  60%  { transform: translateY(0) scale(0.98); }
  100% { transform: translateY(0) scale(1); }
}

/* ==========================
   Fade elegante nos cards
========================== */

.card {
  opacity: 0;
  transform: translateY(12px);
  animation: cardFadeIn 0.5s ease-out forwards;
}

.card:nth-child(1) {
  animation-delay: 0.05s;
}

.card:nth-child(2) {
  animation-delay: 0.12s;
}

@keyframes cardFadeIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================
   Coracao Flutuante
========================== */

@keyframes flyHeart {
  0% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
  50% {
    transform: scale(1.5) translateY(-50px);
  }
  100% {
    opacity: 0;
    transform: scale(0.5) translateY(-100px);
  }
}

.floating-heart {
  position: absolute;
  font-size: 20px;
  color: red;
  pointer-events: none;
  animation: flyHeart 0.8s ease-out forwards;
  z-index: 9999;
}

/* Botão Palavras Favoritas */
#openFavs {
  position: relative;
  overflow: hidden; /* importante para animação dentro do botão */
}

/* efeito de brilho gradiente sutil para o botão Palavras Favoritas */
.fav-animate {
  background: linear-gradient(
    120deg,
    rgba(138, 43, 226, 0) 0%,   /* lilás transparente */
    rgba(138, 43, 226, 0.3) 50%, /* lilás translúcido no reflexo */
    rgba(138, 43, 226, 0) 100%
  );
  background-size: 200% 100%;
  animation: shine 2s ease-out; /* mais lento */
}

@keyframes shine {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.fav-heart {
  display: inline-block;
  transition: transform 0.3s ease;
}

/* animação do giro */
.heart-spin {
  animation: heartSpin 0.8s ease-in-out;
}

/* coração do botão Palavras Favoritas */
.fav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.fav-icon svg {
  display: block;
  transform-origin: center;
}

/* ===============================
   FORÇA ESTADO ATIVO (ANTI-BUG)
================================ */

button.active,
.engine.active,
.preset.active {
  background: linear-gradient(135deg, #6366f1, #8b5cf6) !important;
  color: #ffffff !important;
  border-color: transparent !important;
}
.preset {
  cursor: pointer;
  user-select: none;
  opacity: 0.6;
  transition: all 0.25s ease;
}

.preset.active {
  opacity: 1;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  color: #fff;
  box-shadow: 0 0 0 1px rgba(168,85,247,.4);
}


/* ===============================
   RECUPERA BOTÕES APÓS RESET
================================ */

button {
  cursor: pointer;
}

.engine,
.view-toggle button,
.lang-switch button {
  background: #161625;
  border: 1px solid rgba(255,255,255,0.12);
  color: #ffffff;
}

/* Força a cor ativa nos botões de Web/Mobile */
#viewWeb.active, #viewMobile.active {
  background: linear-gradient(135deg, #6366f1, #8b5cf6) !important;
  color: #ffffff !important;
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.4) !important;
  border: none !important;
}

/* Garante que o container aceite a mudança para o modo mobile */
.wrapper.mobile-view {
  max-width: 400px !important;
  margin: 0 auto;
}

/* Efeito Neon Global - Web & Mobile */
.engine.active, 
.preset.active, 
.view-toggle button.active, 
[data-site-lang].active,
#viewWeb.active, 
#viewMobile.active {
    background: linear-gradient(135deg, #6366f1, #8b5cf6) !important;
    color: #ffffff !important;
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.7) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    transform: translateY(-2px);
    opacity: 1 !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Previne que o hover na Web "apague" o efeito quando ativo */
.engine.active:hover, 
.preset.active:hover,
#viewWeb.active:hover,
#viewMobile.active:hover {
    color: #ffffff !important;
    opacity: 1 !important;
}

/* Garante que o texto não mude de cor ao passar o rato quando ativo */
.engine.active:hover, .preset.active:hover {
    color: #ffffff !important;
}

/* Efeito ao passar o rato para dar feedback */
.engine:hover, .preset:hover {
    border-color: #6a11cb;
    background: rgba(106, 17, 203, 0.05);
}

#advancedMode {
    accent-color: #6366f1;
}

#advancedMode:checked + span {
    text-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
    color: #fff !important;
}