:root {
  --bg: #0a0e14;
  --bg-elev: #111721;
  --bg-elev2: #161d29;
  --border: #222c3a;
  --text: #e6edf3;
  --text-dim: #9aa7b5;
  --text-faint: #64707d;
  --accent: #4da3ff;
  --crit: #ff4d5e;
  --crit-bg: rgba(255, 77, 94, 0.12);
  --high: #ff9f43;
  --ok: #3ddc97;
  --radius: 12px;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

/* ---- Header / nav ---- */
header.site {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(10, 14, 20, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  /* clear the iPhone status bar / notch when installed as a PWA */
  padding-top: env(safe-area-inset-top);
}
.bar {
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px max(22px, env(safe-area-inset-right)) 14px max(22px, env(safe-area-inset-left));
  display: flex;
  align-items: center;
  gap: 26px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0; /* keep "ThreatWatch" as one word; dot spacing handled below */
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: 18px;
}
.brand .dot { margin-right: 10px; }
.brand .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--crit);
  box-shadow: 0 0 12px var(--crit);
  animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.35} }
nav.tabs { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
nav.tabs a {
  padding: 8px 14px;
  border-radius: 8px;
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 500;
  transition: all .15s;
  white-space: nowrap;
}
nav.tabs a:hover { color: var(--text); background: var(--bg-elev); }
nav.tabs a.active { color: var(--text); background: var(--bg-elev2); }

/* ---- Hero ---- */
main { max-width: 1100px; margin: 0 auto; padding: 34px 22px 80px; }
.hero { margin-bottom: 26px; }
.hero h1 {
  font-size: clamp(24px, 4vw, 34px);
  letter-spacing: -0.03em;
  font-weight: 700;
  margin-bottom: 8px;
}
.hero p { color: var(--text-dim); max-width: 640px; }
.meta-row {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  margin-top: 16px; font-size: 13px; color: var(--text-faint);
}
.meta-row .stat b { color: var(--text); font-weight: 600; }
button.refresh {
  font-family: inherit; font-size: 13px; font-weight: 500;
  color: var(--text-dim); background: var(--bg-elev);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 12px; cursor: pointer; transition: all .15s;
}
button.refresh:hover { color: var(--text); border-color: var(--accent); }
button.refresh:disabled { opacity: .5; cursor: wait; }

/* ---- Cards ---- */
.grid { display: flex; flex-direction: column; gap: 12px; }
.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  transition: border-color .15s, transform .15s;
}
.card:hover { border-color: #2f3d4f; }
.card .top { display: flex; align-items: flex-start; gap: 14px; }
.card h3 {
  font-size: 16px; font-weight: 600; letter-spacing: -0.01em;
  flex: 1; line-height: 1.35;
}
.card h3 a:hover { color: var(--accent); }
.card .desc { color: var(--text-dim); font-size: 14px; margin-top: 8px; }
.card .foot {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin-top: 12px; font-size: 12.5px; color: var(--text-faint);
}
.card .foot .src { color: var(--text-dim); font-weight: 500; }
.card .foot a.ext { color: var(--accent); font-weight: 500; }

/* severity badge */
.score {
  font-family: var(--mono); font-weight: 700; font-size: 15px;
  padding: 5px 10px; border-radius: 8px; white-space: nowrap;
  background: var(--crit-bg); color: var(--crit);
  border: 1px solid rgba(255,77,94,0.3);
}
.cve-id {
  font-family: var(--mono); font-size: 12px; color: var(--text-dim);
  background: var(--bg-elev2); padding: 2px 8px; border-radius: 6px;
}
.tag {
  font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-faint); border: 1px solid var(--border);
  padding: 2px 8px; border-radius: 20px;
}

/* states */
.state {
  text-align: center; padding: 60px 20px; color: var(--text-faint);
}
.spinner {
  width: 34px; height: 34px; margin: 0 auto 16px;
  border: 3px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.state.error { color: var(--high); }
.state a { color: var(--accent); text-decoration: underline; }

.thumb {
  width: 96px; height: 68px; border-radius: 8px; object-fit: cover;
  background: var(--bg-elev2); flex-shrink: 0;
}

footer.site {
  max-width: 1100px; margin: 0 auto; padding: 24px 22px 50px;
  color: var(--text-faint); font-size: 12.5px; line-height: 1.7;
  border-top: 1px solid var(--border);
}
footer.site code { font-family: var(--mono); color: var(--text-dim); }

@media (max-width: 560px) {
  .thumb { display: none; }
  /* Stack: full "ThreatWatch" logo on top, tabs on their own scrollable row */
  .bar {
    flex-wrap: wrap;
    gap: 10px;
    padding-top: 12px;
    padding-bottom: 10px;
    padding-left: max(14px, env(safe-area-inset-left));
    padding-right: max(14px, env(safe-area-inset-right));
  }
  .brand { font-size: 17px; }
  nav.tabs {
    margin-left: 0;
    width: 100%;
    flex-wrap: nowrap;
    justify-content: space-between;
    overflow-x: auto;
    gap: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  nav.tabs::-webkit-scrollbar { display: none; }
  nav.tabs a {
    padding: 7px 11px;
    font-size: 12.5px;
    white-space: nowrap;
  }
  main { padding-top: 26px; }
}

/* ------------------------------------------------- daily hit list */
.card.hit { padding: 22px; }
.hit-head {
  display: flex; align-items: center; gap: 12px;
  flex-wrap: wrap; margin-bottom: 14px;
}
.disc {
  font-family: var(--mono); font-size: 11px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase;
  padding: 4px 9px; border-radius: 6px;
  background: var(--bg-elev2); color: var(--text-dim);
  border: 1px solid var(--border);
}
.disc.control    { color: var(--accent); border-color: rgba(77, 163, 255, .35); }
.disc.governance { color: var(--high);   border-color: rgba(255, 159, 67, .35); }
.disc.hygiene    { color: var(--ok);     border-color: rgba(61, 220, 151, .35); }
.hit-date { color: var(--text-faint); font-size: 13px; }
.hit-title {
  font-size: 26px; line-height: 1.25; letter-spacing: -0.02em;
  margin-bottom: 18px;
}
.hit-body h4 {
  font-family: var(--mono); font-size: 11px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-faint); margin-bottom: 6px;
}
.hit-body p { color: var(--text-dim); font-size: 15px; }
.hit-body p + h4 { margin-top: 18px; }
.hit-foot {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--border);
  color: var(--text-faint); font-size: 13px;
}
.hit-foot b { color: var(--text-dim); font-weight: 600; }
@media (max-width: 560px) {
  .card.hit { padding: 18px; }
  .hit-title { font-size: 22px; }
}

/* hit list — framework / vendor chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-size: 12px; padding: 3px 9px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--bg-elev2);
  color: var(--text-dim); white-space: nowrap;
}
.chip.ref { font-family: var(--mono); font-size: 11px; color: var(--accent); }
.chip.vendor { color: var(--text-dim); }
.hit-body .chips + h4 { margin-top: 18px; }
