:root {
  --bg-deep: #0A0E17;
  --bg-panel: #11151F;
  --ink: #E8EAF0;
  --ink-soft: #9BA3B4;
  --glow-cyan: #00E5C7;
  --glow-violet: #7C4DFF;
  --danger: #F2545B;
  --sans: 'Inter', sans-serif;
  --display: 'Space Grotesk', sans-serif;
  --mono: 'IBM Plex Mono', monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg-deep);
  color: var(--ink);
  font-family: var(--sans);
  min-height: 100vh;
}

a { color: inherit; }

.hidden { display: none !important; }

/* ---------- Icons (shared sprite, see scanner/index.html's inline <symbol>s) ---------- */

.icon {
  width: 1em;
  height: 1em;
  display: inline-block;
  vertical-align: -0.15em;
  flex-shrink: 0;
}

.icon-lg { width: 40px; height: 40px; }
.icon-md { width: 22px; height: 22px; }

.btn-glow .icon,
.btn-ghost .icon {
  margin-right: 6px;
  vertical-align: -0.2em;
}

.topnav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 40px;
}

.topnav-brand {
  font-family: var(--display);
  font-weight: 700;
  font-size: 17px;
  text-decoration: none;
}

.topnav-links {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topnav-faq-link {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-soft);
  text-decoration: none;
}
.topnav-faq-link:hover { color: var(--ink); }

.badge-local {
  font-size: 12.5px;
  color: var(--glow-cyan);
  border: 1px solid rgba(0,229,199,0.35);
  padding: 5px 12px;
  border-radius: 20px;
}

.scanner-main {
  position: relative;
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 24px 80px;
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Ambient halo behind the drop-zone - a toned-down echo of the landing
   page's glowing hero, so the scanner doesn't read as a calmer, unrelated
   product. Anchored near the top rather than centered on the whole
   (tall, scrolling) .scanner-main container. */
.scanner-main::before {
  content: "";
  position: absolute;
  top: -60px;
  left: 50%;
  width: 760px;
  height: 620px;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(0,229,199,0.16) 0%, rgba(124,77,255,0.1) 38%, transparent 70%);
  pointer-events: none;
  z-index: -1;
}

/* ---------- Drop zone ---------- */

.drop-zone {
  position: relative;
  overflow: hidden;
  width: 100%;
  text-align: center;
  border: 2px dashed rgba(0,229,199,0.55);
  border-radius: 16px;
  padding: 80px 40px;
  box-shadow: 0 0 60px rgba(0,229,199,0.1), inset 0 0 60px rgba(124,77,255,0.04);
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
}

/* ---------- Scanner shield centerpiece ----------
   One recurring visual object, styled differently per real app state -
   idle (dropzone, ambient backdrop), drag-over (brighter, dropzone),
   scanning (foreground, in #scanningState), complete (foreground, in
   #resultsState). States 1 & 2 need no JS at all: they're driven by the
   existing .drop-zone / .drop-zone.drag-over classes dragenter/dragover/
   dragleave/drop already toggle (see scanner-ui.js). */

.shield-visual { width: 100%; height: 100%; overflow: visible; }

.shield-shape {
  fill: rgba(0,229,199,0.06);
  stroke: var(--glow-cyan);
  stroke-width: 0.5;
  vector-effect: non-scaling-stroke;
  transition: fill 0.25s ease, stroke 0.25s ease;
}

.shield-check {
  fill: none;
  stroke: var(--glow-cyan);
  stroke-width: 0.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  opacity: 0.6;
  transition: opacity 0.25s ease, stroke 0.25s ease;
}

.shield-ring {
  fill: none;
  stroke: var(--glow-violet);
  stroke-width: 0.4;
  stroke-dasharray: 2.2 2.6;
  vector-effect: non-scaling-stroke;
  opacity: 0.22;
}

/* IDLE (in the drop-zone, ambient backdrop behind the folder icon/text) */
.shield-stage {
  z-index: 0;
  pointer-events: none;
}

#shieldIdle.shield-stage {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 210px;
  height: 210px;
  transform: translate(-50%, -50%);
}

.shield-idle .shield-shape {
  filter: drop-shadow(0 0 16px rgba(0,229,199,0.35));
  animation: shieldIdleBreathe 3.4s ease-in-out infinite;
}

.shield-idle .shield-ring {
  animation: ringSpin 18s linear infinite;
  transform-origin: center;
}

@keyframes shieldIdleBreathe {
  0%, 100% { opacity: 0.32; filter: drop-shadow(0 0 10px rgba(0,229,199,0.22)); }
  50% { opacity: 0.55; filter: drop-shadow(0 0 20px rgba(0,229,199,0.4)); }
}

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

/* DRAG-OVER - a real dragenter/dragover on #dropZone already adds
   .drag-over (see scanner-ui.js); this is purely a CSS reaction to it. */
.drop-zone.drag-over .shield-shape {
  fill: rgba(0,229,199,0.16);
  stroke: var(--glow-cyan);
  animation: shieldDragPulse 0.9s ease-in-out infinite;
}

.drop-zone.drag-over .shield-check {
  opacity: 1;
}

.drop-zone.drag-over .shield-ring {
  opacity: 0.7;
  stroke: var(--glow-cyan);
  animation: ringSpin 6s linear infinite;
}

@keyframes shieldDragPulse {
  0%, 100% { filter: drop-shadow(0 0 22px rgba(0,229,199,0.6)); }
  50% { filter: drop-shadow(0 0 40px rgba(124,77,255,0.8)); }
}

@media (prefers-reduced-motion: reduce) {
  .shield-idle .shield-shape,
  .shield-idle .shield-ring,
  .drop-zone.drag-over .shield-shape,
  .drop-zone.drag-over .shield-ring {
    opacity: 0.85;
    filter: drop-shadow(0 0 20px rgba(0,229,199,0.45));
  }

  /* Each state still reads as visually distinct without any animation -
     scanning stays bright/active-looking (no spin/sweep), complete stays
     solid; the sweep beams are motion-only cues so they're just hidden. */
  .shield-scanning .shield-shape {
    filter: drop-shadow(0 0 24px rgba(0,229,199,0.6));
  }
  .shield-scan-beam,
  .shield-complete-sweep {
    opacity: 0 !important;
  }
}

.drop-zone.drag-over {
  border-color: var(--glow-cyan);
  background: rgba(0,229,199,0.05);
  box-shadow: 0 0 90px rgba(0,229,199,0.22), inset 0 0 60px rgba(124,77,255,0.06);
}

.drop-icon {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
  color: var(--glow-cyan);
  filter: drop-shadow(0 0 20px rgba(0,229,199,0.65));
}

.drop-zone h1 {
  font-family: var(--display);
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 10px 0;
}

.drop-zone p {
  color: var(--ink-soft);
  max-width: 420px;
  margin: 0 auto 28px;
  font-size: 14.5px;
}

.drop-note {
  margin-top: 20px !important;
  font-size: 12.5px !important;
  color: #6B7280 !important;
}

.scanner-options {
  margin-top: 28px;
  padding: 20px 24px;
  border-radius: 12px;
  background: rgba(124,77,255,0.1);
  border: 1px solid rgba(124,77,255,0.4);
  box-shadow: 0 0 32px rgba(124,77,255,0.1);
  text-align: left;
}

.folder-tree-scanner-options {
  margin-top: 16px;
}

.placeholder-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.placeholder-toggle-icon { color: var(--glow-cyan); }

.placeholder-toggle input[type="checkbox"] {
  accent-color: var(--glow-cyan);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

.placeholder-toggle code,
.placeholder-toggle-note code {
  font-family: var(--mono);
  font-size: 0.92em;
  color: var(--glow-cyan);
}

.placeholder-toggle-note {
  margin: 6px 0 0 !important;
  max-width: 440px;
  font-size: 12px !important;
  color: #6B7280 !important;
}

.remembered-folder-area,
.fs-access-area {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.remembered-folder-area {
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: flex-start;
}

.fs-access-note {
  max-width: 440px;
  margin: 0 !important;
  font-size: 12px !important;
  color: #6B7280 !important;
}

.fs-access-error {
  max-width: 440px;
  margin: 4px 0 0 !important;
  font-size: 12.5px !important;
  color: var(--danger, #F2545B) !important;
}

.btn-glow {
  padding: 13px 24px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14.5px;
  background: linear-gradient(135deg, var(--glow-cyan), var(--glow-violet));
  color: #0A0E17;
  border: none;
  cursor: pointer;
  box-shadow: 0 0 36px rgba(0,229,199,0.5), 0 0 64px rgba(124,77,255,0.28);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn-glow:hover { transform: translateY(-2px); box-shadow: 0 0 52px rgba(0,229,199,0.7), 0 0 90px rgba(124,77,255,0.42); }
.btn-glow:active { transform: translateY(0); }

.btn-ghost {
  padding: 13px 24px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14.5px;
  background: transparent;
  border: 1.5px solid rgba(255,255,255,0.28);
  color: var(--ink);
  cursor: pointer;
  margin-left: 12px;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.btn-ghost:hover { border-color: var(--glow-cyan); color: var(--ink); background: rgba(0,229,199,0.1); box-shadow: 0 0 24px rgba(0,229,199,0.22); }

/* ---------- Scanning state ---------- */

.scanning-state {
  text-align: center;
}

/* SCANNING - replaces the old plain spinner. Visible for both the brief
   "reading files" phase and the heavier regex-scanning phase (both just
   show/hide this same #scanningState element - see scanner-ui.js) - the
   .scan-heavy modifier (added only around the actual scanFiles() call)
   simplifies it specifically during the CPU-heavy part. */
#shieldScanning.shield-stage {
  display: inline-block;
  width: 130px;
  height: 130px;
  margin: 0 auto 20px;
}

.shield-scanning .shield-shape {
  fill: rgba(0,229,199,0.1);
  filter: drop-shadow(0 0 20px rgba(0,229,199,0.55));
  animation: shieldScanPulse 1.1s ease-in-out infinite;
}

.shield-scanning .shield-check {
  opacity: 0.85;
}

.shield-scanning .shield-ring {
  opacity: 0.6;
  stroke: var(--glow-violet);
  animation: ringSpin 2.2s linear infinite;
}

.shield-scan-beam {
  animation: shieldScanSweep 1.3s ease-in-out infinite;
}

@keyframes shieldScanPulse {
  0%, 100% { filter: drop-shadow(0 0 16px rgba(0,229,199,0.45)); }
  50% { filter: drop-shadow(0 0 30px rgba(0,229,199,0.75)); }
}

@keyframes shieldScanSweep {
  0% { transform: translateY(0); opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { transform: translateY(30px); opacity: 0; }
}

/* The heaviest part of file processing (the synchronous scanFiles() call
   in scanner-ui.js) gets the simplified version of this animation -
   belt-and-suspenders alongside it already being compositor-only
   (transform/opacity), which shouldn't compete with the main-thread scan
   loop regardless. */
.scanning-state.scan-heavy .shield-scan-beam {
  animation-play-state: paused;
  opacity: 0;
}
.scanning-state.scan-heavy .shield-ring {
  animation-play-state: paused;
}
.scanning-state.scan-heavy .shield-shape {
  animation-play-state: paused;
  filter: drop-shadow(0 0 16px rgba(0,229,199,0.45));
}

/* COMPLETE - a small "secured" badge inline with the results summary
   numbers, not a full-width centerpiece (resultsState is information-dense
   below it). Solid fill, no pulsing - calm/confident rather than active. */
#shieldComplete.shield-stage {
  width: 68px;
  height: 68px;
  flex-shrink: 0;
}

.shield-complete .shield-shape {
  fill: rgba(0,229,199,0.22);
  stroke: var(--glow-cyan);
  stroke-width: 0.9;
  filter: drop-shadow(0 0 14px rgba(0,229,199,0.5));
}

.shield-complete .shield-check {
  opacity: 1;
  stroke-width: 1.3;
}

/* Plays once whenever #resultsState goes from hidden -> visible (a fresh
   scan or "Scan again" completing) - the ":not(.hidden)" match itself is
   what (re)triggers the animation, same mechanism #resultsState's own
   resultsRevealIn already relies on. */
#resultsState:not(.hidden) .shield-complete-sweep {
  animation: shieldCompleteSweep 0.9s ease-out;
}

@keyframes shieldCompleteSweep {
  0% { transform: translateY(0); opacity: 0; }
  15% { opacity: 1; }
  100% { transform: translateY(32px); opacity: 0; }
}

/* ---------- Results ---------- */

/* ---------- Folder-filter tree ---------- */

.folder-tree-state {
  width: 100%;
  max-width: 720px;
  text-align: left;
}

.folder-tree-header h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--display);
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 6px;
}

.folder-tree-header p {
  color: var(--ink-soft);
  font-size: 14px;
  margin: 0 0 20px;
}

.folder-tree-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.folder-tree-summary { color: var(--ink-soft); font-size: 12.5px; }
.folder-tree-toolbar-actions { display: flex; gap: 8px; }

.folder-tree-list {
  max-height: 380px;
  overflow-y: auto;
  border: 1.5px solid rgba(0,229,199,0.3);
  border-radius: 10px;
  padding: 6px 0;
  background: var(--bg-panel);
  box-shadow: 0 0 28px rgba(0,229,199,0.08);
}

.tree-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  font-size: 13px;
  white-space: nowrap;
}

.tree-row:hover { background: rgba(255,255,255,0.03); }

.tree-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--ink-soft);
  cursor: pointer;
  padding: 0;
}

.tree-toggle .icon { transition: transform 0.15s ease; }
.tree-toggle[aria-expanded="true"] .icon { transform: rotate(90deg); }

.tree-toggle-spacer { display: inline-block; width: 18px; flex-shrink: 0; }

.tree-checkbox {
  flex-shrink: 0;
  width: 15px;
  height: 15px;
  accent-color: var(--glow-cyan);
  cursor: pointer;
}

.tree-icon { flex-shrink: 0; color: var(--ink-soft); }
.tree-folder > .tree-icon { color: var(--glow-cyan); }

.tree-name {
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink);
}

.tree-count {
  color: var(--ink-soft);
  font-size: 11px;
  margin-left: 4px;
  flex-shrink: 0;
}

/* Revealed on row hover/focus rather than shown on every folder row at
   once - a one-click "only this folder" action for the (likely) common
   case of a user expecting "select a folder" to mean "scan just this",
   which checking an already-checked folder (everything is checked by
   default) can't express on its own. */
.tree-only-btn {
  margin-left: auto;
  flex-shrink: 0;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  color: var(--glow-cyan);
  background: none;
  border: none;
  padding: 2px 6px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.12s ease;
}

.tree-row:hover .tree-only-btn,
.tree-row:focus-within .tree-only-btn,
.tree-only-btn:focus-visible {
  opacity: 1;
}

.tree-only-btn:hover {
  text-decoration: underline;
}

/* Hover-to-reveal has no equivalent on a touch device (there's no hover
   state to trigger it, and no pointer resting in place first) - always
   visible there instead of being effectively unreachable. */
@media (hover: none) {
  .tree-only-btn {
    opacity: 1;
  }
}

.folder-tree-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.results-state { width: 100%; }

.results-summary {
  display: flex;
  align-items: center;
  gap: 32px;
  flex-wrap: wrap;
  padding: 20px 24px;
  background: var(--bg-panel);
  border: 1px solid rgba(0,229,199,0.2);
  border-radius: 12px;
  margin-bottom: 24px;
}

.results-summary strong {
  display: block;
  font-family: var(--display);
  font-size: 42px;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-shadow: 0 0 26px rgba(0,229,199,0.4);
}

#redactionCount {
  color: var(--glow-violet);
  text-shadow: 0 0 26px rgba(124,77,255,0.5);
}

.results-summary span {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.results-table {
  border: 1.5px solid rgba(124,77,255,0.3);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 0 32px rgba(124,77,255,0.1);
}

.result-row {
  display: grid;
  grid-template-columns: 42px minmax(160px, 1fr) minmax(90px, 170px) minmax(110px, 200px) 84px;
  align-items: center;
  padding: 10px 16px;
  font-family: var(--mono);
  font-size: 12.5px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.result-row:nth-child(even) { background: rgba(255,255,255,0.02); }

.result-line { color: var(--ink-soft); }
.result-file { overflow-wrap: anywhere; }

.result-rule {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 11px;
  min-width: 0;
}

.result-rule-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 27px;
  height: 27px;
  border-radius: 7px;
  flex-shrink: 0;
}
.result-rule-badge .icon { width: 15px; height: 15px; }

.result-rule-badge.sev-cyan { background: rgba(0,229,199,0.22); color: var(--glow-cyan); box-shadow: 0 0 14px rgba(0,229,199,0.35); }
.result-rule-badge.sev-violet { background: rgba(124,77,255,0.24); color: var(--glow-violet); box-shadow: 0 0 14px rgba(124,77,255,0.38); }

/* Critical findings (private keys, credentials embedded in a URL) get a
   slow pulse, not just a different color - the one severity tier where
   missing it at a glance is genuinely costly. */
.result-rule-badge.sev-danger {
  background: rgba(242,84,91,0.26);
  color: var(--danger);
  animation: dangerBadgePulse 1.8s ease-in-out infinite;
}

@keyframes dangerBadgePulse {
  0%, 100% { box-shadow: 0 0 10px rgba(242,84,91,0.35); }
  50% { box-shadow: 0 0 22px rgba(242,84,91,0.8); }
}

.result-rule-text {
  color: var(--ink-soft);
  overflow-wrap: anywhere;
}

.result-key { color: var(--ink-soft); font-size: 11px; overflow-wrap: anywhere; }

.result-changed-badge {
  display: block;
  color: var(--danger, #F2545B);
  font-size: 10px;
  margin-top: 2px;
  white-space: nowrap;
}

.result-action { text-align: right; }

.ignore-btn, .restore-btn {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 6px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.18);
  color: var(--ink-soft);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
  flex-shrink: 0;
}
.ignore-btn .icon, .restore-btn .icon { width: 11px; height: 11px; margin-right: 3px; vertical-align: -0.1em; }

.ignore-btn:hover, .restore-btn:hover { border-color: var(--glow-cyan); color: var(--ink); }
.ignore-btn:disabled, .restore-btn:disabled { opacity: 0.5; cursor: default; }

.ignore-note {
  font-size: 12px;
  color: #6B7280;
  margin: 0 0 12px;
}

.stale-zip-note {
  color: var(--danger) !important;
  font-weight: 600;
}

/* A notice, not a warning - nothing here implies a real secret is at risk,
   just files the scan didn't look at at all. */
.unscanned-files-notice {
  background: var(--bg-panel);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  padding: 10px 14px;
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--ink-soft);
}

.unscanned-files-notice summary {
  cursor: pointer;
  color: var(--ink);
  font-weight: 500;
}

.unscanned-files-list {
  margin: 10px 0 0;
  padding-left: 20px;
  max-height: 220px;
  overflow-y: auto;
}

.unscanned-files-list li {
  font-family: var(--mono);
  font-size: 12px;
  padding: 2px 0;
}

.unscanned-files-list .unscanned-reason {
  color: var(--ink-soft);
  font-family: var(--sans);
}

.results-empty {
  padding: 60px 20px;
  text-align: center;
  color: var(--ink-soft);
}

/* ---------- Ignore confirmation modal ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5,7,12,0.72);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}

.modal-box {
  width: 100%;
  max-width: 440px;
  background: var(--bg-panel);
  border: 1.5px solid rgba(242,84,91,0.5);
  border-radius: 14px;
  padding: 24px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 60px rgba(242,84,91,0.15);
}

.modal-box h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--display);
  font-size: 21px;
  font-weight: 700;
  margin: 0 0 10px;
}

.modal-warn-icon { color: var(--danger); flex-shrink: 0; }

.modal-box p {
  color: var(--ink-soft);
  font-size: 13.5px;
  line-height: 1.6;
  margin: 0;
}

.modal-box p strong { color: var(--ink); }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* ---------- Ignored findings (revertible ignores) ---------- */

.ignored-findings-panel {
  width: 100%;
  max-width: 640px;
  margin: 48px auto 0;
  padding-top: 32px;
  border-top: 2px solid rgba(242,84,91,0.4);
}

.ignored-findings-panel .scan-history-row { align-items: flex-start; }

.ignored-finding-meta {
  display: block;
  color: var(--ink-soft);
  font-size: 11.5px;
  margin-top: 2px;
}

/* ---------- Scan history ---------- */

.scan-history-panel {
  width: 100%;
  max-width: 640px;
  margin: 48px auto 0;
  padding-top: 32px;
  border-top: 2px solid rgba(0,229,199,0.38);
}

.scan-history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.section-badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 11px;
  flex-shrink: 0;
}

/* Halo ring behind the badge - the same glow language as the hero,
   toned down to an accent rather than a centerpiece. */
.section-badge::before {
  content: "";
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  filter: blur(16px);
  z-index: -1;
  pointer-events: none;
}

.section-badge-cyan {
  background: rgba(0,229,199,0.18);
  border: 1.5px solid rgba(0,229,199,0.55);
  box-shadow: 0 0 22px rgba(0,229,199,0.3);
}
.section-badge-cyan::before { background: rgba(0,229,199,0.35); }
.section-badge-cyan .panel-title-icon { color: var(--glow-cyan); filter: drop-shadow(0 0 6px rgba(0,229,199,0.7)); }

.section-badge-violet {
  background: rgba(124,77,255,0.18);
  border: 1.5px solid rgba(124,77,255,0.55);
  box-shadow: 0 0 22px rgba(124,77,255,0.3);
}
.section-badge-violet::before { background: rgba(124,77,255,0.35); }
.section-badge-violet .panel-title-icon { color: var(--glow-violet); filter: drop-shadow(0 0 6px rgba(124,77,255,0.7)); }

.panel-title-icon { margin-right: 2px; }

.scan-history-header h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--display);
  font-size: 23px;
  font-weight: 700;
  margin: 0;
}

.btn-small {
  padding: 6px 14px !important;
  font-size: 12px !important;
  margin-left: 0 !important;
}

.local-only-note {
  font-size: 12px;
  color: #6B7280;
  margin: 0 0 16px;
  line-height: 1.5;
}

.scan-history-list { display: flex; flex-direction: column; gap: 6px; }

.scan-history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-panel);
  border-radius: 8px;
  font-size: 12.5px;
}

.scan-history-left { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.scan-history-row-icon { color: var(--glow-cyan); }
.scan-history-date { color: var(--ink); }
.scan-history-counts { color: var(--ink-soft); font-size: 11.5px; white-space: nowrap; }

.scan-history-empty {
  color: var(--ink-soft);
  font-size: 13px;
  padding: 12px 0;
}

/* ---------- Rule editor ---------- */

.rule-editor-panel {
  width: 100%;
  max-width: 640px;
  margin: 32px auto 0;
  padding-top: 32px;
  border-top: 2px solid rgba(124,77,255,0.4);
}

.rule-editor-group { margin-top: 20px; }

.rule-editor-group h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--display);
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 8px;
}

.rule-editor-group h3 .icon { color: var(--glow-cyan); }
.rule-editor-group h3 .icon-violet { color: var(--glow-violet); }

.rule-editor-hint {
  font-size: 12px;
  color: #6B7280;
  margin: 0 0 10px;
}

.rule-editor-add {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.rule-editor-add input[type="text"] {
  flex: 1;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.18);
  background: var(--bg-panel);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12.5px;
}

.rule-editor-add input[type="text"]:focus {
  outline: none;
  border-color: var(--glow-cyan);
}

.rule-editor-error {
  color: var(--danger, #F2545B);
  font-size: 12px;
  margin: 0 0 8px;
  min-height: 1em;
}

.rule-editor-list { display: flex; flex-direction: column; gap: 4px; max-height: 260px; overflow-y: auto; }

.rule-editor-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-panel);
  border-radius: 8px;
  font-size: 12px;
}

.rule-editor-row.is-disabled { opacity: 0.45; }

.rule-editor-text {
  flex: 1;
  font-family: var(--mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rule-editor-tag {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 10px;
  padding: 2px 8px;
}

.rule-editor-tag-custom { color: var(--glow-cyan); border-color: rgba(0,229,199,0.35); }

.rule-editor-toggle {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 6px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.18);
  color: var(--ink-soft);
  cursor: pointer;
  white-space: nowrap;
}

.rule-editor-toggle:hover { border-color: var(--glow-cyan); color: var(--ink); }

/* ---------- Known limitations ---------- */

.known-limitations-panel {
  width: 100%;
  max-width: 640px;
  margin: 32px auto 0;
  padding-top: 32px;
  border-top: 2px solid rgba(124,77,255,0.4);
}

.known-limitations-panel h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--display);
  font-size: 23px;
  font-weight: 700;
  margin: 0 0 12px;
}

.known-limitations-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.known-limitations-list li {
  padding-left: 16px;
  border-left: 2px solid rgba(255,255,255,0.15);
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.6;
}

.known-limitations-list code {
  font-family: var(--mono);
  font-size: 0.92em;
  color: var(--ink);
}

.scanner-footer {
  text-align: center;
  padding: 24px;
  color: #6B7280;
  font-size: 12.5px;
}

.scanner-footer a { color: var(--glow-cyan); }

@media (max-width: 600px) {
  .drop-zone { padding: 50px 20px; }
  .result-row { grid-template-columns: 32px minmax(90px, 1fr) minmax(60px, 100px) 60px; }
  .result-key { display: none; }
  .scan-history-row { flex-direction: column; align-items: flex-start; gap: 2px; }
}

/* ---------- Micro-interactions ---------- */

@keyframes panelFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

#dropZone:not(.hidden),
#scanningState:not(.hidden) {
  animation: panelFadeIn 0.35s ease;
}

@keyframes resultsRevealIn {
  from { opacity: 0; transform: translateY(26px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

#resultsState:not(.hidden) {
  animation: resultsRevealIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.result-row {
  animation: resultRowIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}
.result-row:nth-child(1) { animation-delay: 0.08s; }
.result-row:nth-child(2) { animation-delay: 0.13s; }
.result-row:nth-child(3) { animation-delay: 0.18s; }
.result-row:nth-child(4) { animation-delay: 0.23s; }
.result-row:nth-child(5) { animation-delay: 0.28s; }
.result-row:nth-child(6) { animation-delay: 0.33s; }
.result-row:nth-child(7) { animation-delay: 0.38s; }
.result-row:nth-child(8) { animation-delay: 0.43s; }
.result-row:nth-child(n+9) { animation-delay: 0.48s; }

@keyframes rowIgnoreFade {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0; transform: scale(0.97); }
}

.result-row.ignoring {
  animation: rowIgnoreFade 0.22s ease forwards;
  pointer-events: none;
}

.result-row { transition: background-color 0.15s ease; }

@keyframes badgePop {
  from { opacity: 0; transform: scale(0.7); }
  to { opacity: 1; transform: scale(1); }
}

.results-summary strong { animation: badgePop 0.3s ease; }

@media (prefers-reduced-motion: reduce) {
  /* The universal selector alone doesn't match ::before/::after - without
     listing them explicitly, a pseudo-element transition/animation would
     be invisible to this override (see css/style.css's identical fix). */
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
