:root {
  --bg: #0b0e14;
  --bg-2: #121826;
  --panel: #161d2e;
  --panel-2: #1c2438;
  --line: #263149;
  --txt: #e8edf7;
  --muted: #93a1bd;
  --brand: #7c5cff;
  --brand-2: #22d3ee;
  --q: #7c5cff;    /* perguntas */
  --p: #22d3ee;    /* preposições */
  --c: #f59e0b;    /* comparações */
  --a: #34d399;    /* alfabético */
  --r: #f472b6;    /* relacionadas */
  --radius: 14px;
  --shadow: 0 10px 40px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: radial-gradient(1200px 600px at 20% -10%, #1a2340 0%, var(--bg) 55%) fixed;
  color: var(--txt);
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.hidden { display: none !important; }
a { color: var(--brand-2); }

/* topbar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 26px; border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand .logo { font-size: 30px; filter: drop-shadow(0 0 12px rgba(124,92,255,.6)); }
.brand h1 { font-size: 20px; margin: 0; font-weight: 800; letter-spacing: -.02em; }
.tagline { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }

/* buttons */
button { font-family: inherit; cursor: pointer; border: none; border-radius: 10px; font-weight: 600; }
button.primary {
  background: linear-gradient(135deg, var(--brand), #5b3ff0);
  color: #fff; padding: 0 22px; height: 46px; font-size: 15px;
  box-shadow: 0 6px 20px rgba(124,92,255,.4);
}
button.primary:hover { filter: brightness(1.08); }
button.ghost {
  background: var(--panel-2); color: var(--txt); border: 1px solid var(--line);
  padding: 8px 14px; font-size: 13px;
}
button.ghost:hover { border-color: var(--brand); }
button.ghost.small { font-size: 12px; padding: 6px 10px; }

/* searchbar */
.searchbar { padding: 26px 26px 8px; max-width: 1200px; margin: 0 auto; width: 100%; }
#search-form { display: flex; gap: 10px; flex-wrap: wrap; }
.field { position: relative; }
.field.kw { flex: 1 1 380px; }
.field input, .field select {
  height: 46px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; color: var(--txt); padding: 0 16px; font-size: 15px; width: 100%;
  outline: none;
}
.field input:focus, .field select:focus { border-color: var(--brand); }
.field select { cursor: pointer; }
.sources { display: flex; gap: 18px; margin-top: 12px; font-size: 13px; color: var(--muted); }
.sources label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.sources input { accent-color: var(--brand); }

/* main */
#main { flex: 1; max-width: 1200px; margin: 0 auto; width: 100%; padding: 18px 26px 40px; }

/* empty */
.empty { text-align: center; padding: 60px 20px; }
.empty-art { font-size: 64px; filter: drop-shadow(0 0 30px rgba(124,92,255,.5)); animation: float 4s ease-in-out infinite; }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.empty h2 { font-size: 26px; margin: 14px 0 8px; }
.empty p { color: var(--muted); max-width: 560px; margin: 0 auto; line-height: 1.6; }
.examples { margin-top: 26px; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; align-items: center; }
.examples span { color: var(--muted); font-size: 13px; }
.chip { background: var(--panel-2); border: 1px solid var(--line); color: var(--txt); padding: 8px 14px; border-radius: 999px; font-size: 13px; }
.chip:hover { border-color: var(--brand); color: #fff; }

/* loading */
.loading { text-align: center; padding: 80px 20px; }
.loading p { color: var(--muted); margin-top: 22px; }
.radar-spin {
  width: 90px; height: 90px; margin: 0 auto; border-radius: 50%;
  border: 2px solid var(--line); position: relative;
}
.radar-spin::before {
  content: ""; position: absolute; inset: -2px; border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0deg, rgba(124,92,255,.55) 60deg, transparent 90deg);
  animation: spin 1.2s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* results head */
.results-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.results-meta h2 { margin: 0; font-size: 24px; }
.results-meta h2 span { color: var(--brand); }
#res-summary { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.results-actions { display: flex; gap: 8px; align-items: center; }
.view-toggle { display: flex; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.view-toggle button { background: transparent; color: var(--muted); padding: 8px 14px; font-size: 13px; border-radius: 0; }
.view-toggle button.active { background: var(--brand); color: #fff; }

/* tabs */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.tab { background: var(--panel); border: 1px solid var(--line); color: var(--muted); padding: 8px 16px; border-radius: 999px; font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.tab .dot { width: 9px; height: 9px; border-radius: 50%; }
.tab .cnt { background: rgba(255,255,255,.08); border-radius: 999px; padding: 1px 8px; font-size: 11px; }
.tab.active { color: #fff; border-color: transparent; }
.tab[data-cat="questions"].active { background: rgba(124,92,255,.18); border-color: var(--q); }
.tab[data-cat="prepositions"].active { background: rgba(34,211,238,.15); border-color: var(--p); }
.tab[data-cat="comparisons"].active { background: rgba(245,158,11,.15); border-color: var(--c); }
.tab[data-cat="alphabet"].active { background: rgba(52,211,153,.15); border-color: var(--a); }
.tab[data-cat="related"].active { background: rgba(244,114,182,.15); border-color: var(--r); }

/* wheel */
.wheel-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; color: var(--muted); font-size: 12px; }
.wheel-toolbar .zoom { display: flex; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.wheel-toolbar .zoom button { background: transparent; color: var(--txt); padding: 6px 12px; border-radius: 0; font-size: 14px; }
.wheel-toolbar .zoom button:hover { background: var(--panel-2); }
.wheel-toolbar .hint { margin-left: auto; }
.wheel-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; overflow: auto; max-height: 80vh; }
.wheel-wrap svg { display: block; }
.leaf-label { font-size: 11px; fill: var(--txt); cursor: pointer; }
.leaf-label:hover { fill: #fff; font-weight: 600; }
.spoke-label { font-size: 13px; font-weight: 700; }
.center-label { font-size: 15px; font-weight: 800; fill: #fff; }

/* list */
.list-wrap { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.card-head { padding: 12px 16px; font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); }
.card-head .dot { width: 10px; height: 10px; border-radius: 50%; }
.card-head .cnt { margin-left: auto; color: var(--muted); font-size: 12px; font-weight: 500; }
.subgroup { padding: 6px 16px 12px; }
.subgroup .mod { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; margin: 10px 0 4px; }
.subgroup ul { list-style: none; margin: 0; padding: 0; }
.subgroup li { padding: 5px 0; font-size: 13.5px; border-bottom: 1px dashed rgba(255,255,255,.04); display: flex; align-items: center; gap: 8px; }
.subgroup li:last-child { border-bottom: none; }
.subgroup li a { color: var(--txt); text-decoration: none; flex: 1; }
.subgroup li a:hover { color: var(--brand-2); }
.src-badge { font-size: 9px; font-weight: 700; padding: 2px 6px; border-radius: 5px; color: #fff; letter-spacing: .02em; }
.src-badge.src-google { background: #4285F4; }
.src-badge.src-bing { background: #00897B; }
.src-badge.src-youtube { background: #FF0033; }

/* footer */
.site-footer { text-align: center; padding: 20px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--line); }
.site-footer a { color: var(--brand-2); text-decoration: none; }

/* history */
.history-panel {
  position: fixed; top: 0; right: 0; width: 320px; height: 100vh; background: var(--bg-2);
  border-left: 1px solid var(--line); box-shadow: var(--shadow); padding: 18px; z-index: 50;
  display: flex; flex-direction: column; gap: 12px;
}
.history-head { display: flex; justify-content: space-between; align-items: center; }
#history-list { list-style: none; margin: 0; padding: 0; flex: 1; overflow-y: auto; }
#history-list li { padding: 10px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; cursor: pointer; font-size: 13px; }
#history-list li:hover { border-color: var(--brand); }
#history-list li small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }

@media (max-width: 640px) {
  .topbar { padding: 14px; }
  .searchbar, #main { padding-left: 14px; padding-right: 14px; }
  .history-panel { width: 100%; }
}
