:root {
  --bg-primary: #1A1A1A;
  --bg-secondary: #222222;
  --bg-card: #252525;
  --bg-input: #2c2c2c;
  --border: #3a3a3a;
  --text-primary: #FFFFFF;
  --text-secondary: #a0a0a0;
  --text-muted: #6b6b6b;
  --accent: #159DD9;
  --accent-hover: #1bb0f0;
  --risk-critical: #ef4444;
  --risk-high: #f97316;
  --risk-medium: #eab308;
  --risk-low: #22c55e;
  --risk-none: #6b6b6b;
  --badge-bg: #333333;
  --badge-text: #d4d4d4;
  --live: #22c55e;
  --down: #ef4444;
}

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

body {
  font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Search State - centered */
.search-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  transition: all 0.3s ease;
  flex: 1;
}

.search-container.has-results {
  min-height: auto;
  padding: 24px 0 16px;
}

.hero-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  font-family: 'Open Sans Condensed', 'Arial Narrow', 'Helvetica Neue', sans-serif;
  font-size: 48px;
  font-weight: 700;
  letter-spacing: 12px;
  text-transform: uppercase;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.hero-logo {
  height: 56px;
  width: auto;
  transition: height 0.3s ease;
}

.has-results .hero-title {
  font-size: 28px;
  letter-spacing: 8px;
  margin-bottom: 4px;
  cursor: pointer;
}

.has-results .hero-logo {
  height: 32px;
}

.tagline {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 32px;
  transition: all 0.3s ease;
}

.has-results .tagline {
  display: none;
}

/* Turnstile widget */
.turnstile-container {
  display: flex;
  justify-content: center;
  margin-top: 16px;
}

.has-results .turnstile-container {
  display: none;
}

/* About section */
.about {
  max-width: 720px;
  padding: 0 24px;
  margin-top: 48px;
  text-align: center;
}

.has-results .about {
  display: none;
}

.about-text {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.7;
  margin-bottom: 32px;
}

.about-features {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  text-align: left;
}

.feature {
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.feature-title {
  font-family: 'Open Sans Condensed', 'Arial Narrow', 'Helvetica Neue', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.feature-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Stats section */
.stats-section {
  margin-top: 48px;
  width: 100%;
}

.stats-title {
  font-family: 'Open Sans Condensed', 'Arial Narrow', 'Helvetica Neue', sans-serif;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 16px;
  text-align: center;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
}

.stat-icon {
  font-size: 18px;
  margin-bottom: 8px;
  color: var(--accent);
  opacity: 0.85;
}

.stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  font-family: 'SF Mono', 'Fira Code', monospace;
}

.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 4px;
}

.stat-footer {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  opacity: 0.7;
}

/* Toast */
.toast {
  position: fixed;
  top: 24px;
  right: 24px;
  transform: translateX(20px);
  background: rgba(249, 115, 22, 0.15);
  border: 1px solid var(--risk-high);
  color: var(--risk-high);
  padding: 14px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 100;
}

.toast.visible {
  opacity: 1;
  transform: translateX(0);
}

/* Footer */
.site-footer {
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.search-bar {
  display: flex;
  width: 100%;
  max-width: 640px;
  padding: 0 24px;
}

.search-bar input {
  flex: 1;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-right: none;
  border-radius: 8px 0 0 8px;
  color: var(--text-primary);
  font-size: 15px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  outline: none;
  transition: border-color 0.2s;
}

.search-bar input::placeholder {
  color: var(--text-muted);
}

.search-bar input:focus {
  border-color: var(--accent);
}

.search-bar button {
  padding: 12px 24px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 0 8px 8px 0;
  cursor: pointer;
  font-family: 'Open Sans Condensed', 'Arial Narrow', 'Helvetica Neue', sans-serif;
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: background 0.2s;
}

.search-bar button:hover {
  background: var(--accent-hover);
}

.search-bar button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Results */
.results-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px 48px;
  display: none;
}

.results-container.visible {
  display: block;
}

.results-header {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.results-header h2 {
  font-family: 'Open Sans Condensed', 'Arial Narrow', 'Helvetica Neue', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-secondary);
}

.results-header .address {
  font-family: 'SF Mono', 'Fira Code', monospace;
  color: var(--accent);
}

.card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  overflow: hidden;
}

.card.full-width {
  grid-column: 1 / -1;
}

.card-title {
  font-family: 'Open Sans Condensed', 'Arial Narrow', 'Helvetica Neue', sans-serif;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* Status badges */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
}

.badge-live {
  background: rgba(34, 197, 94, 0.15);
  color: var(--live);
}

.badge-down {
  background: rgba(239, 68, 68, 0.15);
  color: var(--down);
}

.badge-risk-critical {
  background: rgba(239, 68, 68, 0.15);
  color: var(--risk-critical);
}

.badge-risk-high {
  background: rgba(249, 115, 22, 0.15);
  color: var(--risk-high);
}

.badge-risk-medium {
  background: rgba(234, 179, 8, 0.15);
  color: var(--risk-medium);
}

.badge-risk-low {
  background: rgba(34, 197, 94, 0.15);
  color: var(--risk-low);
}

.badge-risk-none {
  background: rgba(100, 116, 139, 0.15);
  color: var(--risk-none);
}

/* Data rows */
.data-row {
  display: flex;
  padding: 6px 0;
  font-size: 14px;
  gap: 8px;
}

.data-row .label {
  color: var(--text-muted);
  white-space: nowrap;
}

.data-row .label::after {
  content: ':';
}

.data-row .value {
  color: var(--text-primary);
  word-break: break-all;
}

.data-row .value.shv-hash {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 12px;
}

/* Data label (standalone) */
.data-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

/* Endpoint list */
.endpoint-list {
  list-style: disc;
  padding-left: 20px;
  margin: 0;
}

.endpoint-list li {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 12px;
  color: var(--text-secondary);
  padding: 2px 0;
  word-break: break-all;
}

/* Tags */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.tag {
  display: inline-block;
  padding: 4px 10px;
  background: var(--badge-bg);
  color: var(--badge-text);
  border-radius: 6px;
  font-size: 12px;
}

/* Intent list */
.intent-list {
  list-style: none;
  margin-top: 12px;
}

.intent-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  font-size: 13px;
}

.intent-item .name {
  color: var(--text-secondary);
  text-transform: capitalize;
}

.intent-item .score {
  font-family: 'SF Mono', 'Fira Code', monospace;
  color: var(--text-muted);
  font-size: 12px;
}

/* Entity groups */
.entity-group {
  margin-bottom: 16px;
}

.entity-group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  user-select: none;
}

.entity-group-header:hover {
  color: var(--accent);
}

.entity-group-header .type {
  font-size: 14px;
  font-weight: 500;
}

.entity-group-header .count {
  font-size: 12px;
  color: var(--text-muted);
}

.entity-chevron {
  font-size: 10px;
  transition: transform 0.2s ease;
  margin-left: 6px;
}

.entity-group-header.expanded .entity-chevron {
  transform: rotate(180deg);
}

.entity-group-items {
  display: none;
  padding: 8px 0;
}

.entity-group-items.open {
  display: block;
}

/* Results note */
.results-note {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 12px;
  text-align: center;
  font-style: italic;
}

.entity-item {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 12px;
  color: var(--text-secondary);
  padding: 3px 0;
  word-break: break-all;
}

/* Images table */
.images-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.images-table th {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 12px;
}

.images-table td {
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 11px;
  word-break: break-all;
}

/* Error / empty */
.message {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-secondary);
  font-size: 15px;
}

.message.error {
  color: var(--risk-high);
}

/* Loading spinner */
.spinner {
  display: none;
  justify-content: center;
  padding: 64px 0;
}

.spinner.visible {
  display: flex;
}

.spinner::after {
  content: '';
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.visible {
  opacity: 1;
  visibility: visible;
}

.modal {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
  max-width: 640px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-title {
  font-family: 'Open Sans Condensed', 'Arial Narrow', 'Helvetica Neue', sans-serif;
  font-size: 22px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-primary);
  margin-bottom: 20px;
}

.modal-body {
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-secondary);
}

.modal-body p {
  margin-bottom: 12px;
}

.modal-body strong {
  color: var(--text-primary);
}

.modal-link {
  color: var(--accent);
  text-decoration: none;
}

.modal-link:hover {
  text-decoration: underline;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  transition: color 0.2s;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
  margin-top: 12px;
}

.modal-label:first-child {
  margin-top: 0;
}

.modal-input,
.modal-textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  outline: none;
  transition: border-color 0.2s;
}

.modal-input:focus,
.modal-textarea:focus {
  border-color: var(--accent);
}

.modal-textarea {
  resize: vertical;
  min-height: 80px;
}

.modal-feedback {
  font-size: 13px;
  margin-top: 12px;
  min-height: 20px;
}

.modal-feedback.success {
  color: var(--live);
}

.modal-feedback.error {
  color: var(--risk-high);
}

.modal-accept {
  display: block;
  width: 100%;
  margin-top: 20px;
  padding: 12px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-family: 'Open Sans Condensed', 'Arial Narrow', 'Helvetica Neue', sans-serif;
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: background 0.2s;
}

.modal-accept:hover {
  background: var(--accent-hover);
}

/* Footer link */
.footer-link {
  color: var(--text-muted);
  text-decoration: none;
}

.footer-link:hover {
  color: var(--accent);
}

/* Legal pages */
.legal-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 80px 24px 48px;
}

.legal-title {
  font-family: 'Open Sans Condensed', 'Arial Narrow', 'Helvetica Neue', sans-serif;
  font-size: 32px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 4px;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.legal-updated {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 32px;
}

.legal-content h2 {
  font-family: 'Open Sans Condensed', 'Arial Narrow', 'Helvetica Neue', sans-serif;
  font-size: 16px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-primary);
  margin-top: 28px;
  margin-bottom: 12px;
}

.legal-content p {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.legal-content strong {
  color: var(--text-primary);
}

.legal-content ul {
  padding-left: 20px;
  margin-bottom: 12px;
}

.legal-content li {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

/* Gated notice */
.gated-notice {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 14px;
  background: rgba(21, 157, 217, 0.06);
  border: 1px solid rgba(21, 157, 217, 0.15);
  border-radius: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.gated-notice i {
  color: var(--accent);
  opacity: 0.7;
  font-size: 11px;
  flex-shrink: 0;
}

/* Gated count display */
.gated-count {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 20px 0;
}

.gated-count > i {
  font-size: 28px;
  color: var(--accent);
  opacity: 0.7;
}

.gated-count-value {
  font-size: 32px;
  font-weight: 700;
  font-family: 'SF Mono', 'Fira Code', monospace;
  color: var(--text-primary);
}

.gated-count-label {
  font-size: 13px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Gated counts row (HTTP endpoints/links) */
.gated-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.gated-count-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--badge-bg);
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}

.gated-count-item i {
  color: var(--accent);
  opacity: 0.7;
  font-size: 11px;
}

/* Result stats grid (entities within card) */
.result-stats-grid {
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 10px;
  margin-bottom: 0;
}

.result-stats-grid .stat-card {
  padding: 12px 8px;
}

.result-stats-grid .stat-value {
  font-size: 18px;
}

.result-stats-grid .stat-label {
  font-size: 10px;
}

/* CTA card */
.cta-card {
  border-color: var(--accent);
  border-width: 1px;
  background: linear-gradient(135deg, rgba(21, 157, 217, 0.08) 0%, var(--bg-card) 100%);
}

.cta-content {
  display: flex;
  align-items: center;
  gap: 20px;
}

.cta-icon {
  font-size: 28px;
  color: var(--accent);
  flex-shrink: 0;
}

.cta-text {
  flex: 1;
}

.cta-title {
  font-family: 'Open Sans Condensed', 'Arial Narrow', 'Helvetica Neue', sans-serif;
  font-size: 16px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.cta-description {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.cta-button {
  display: inline-block;
  padding: 10px 24px;
  background: var(--accent);
  color: white;
  border-radius: 8px;
  font-family: 'Open Sans Condensed', 'Arial Narrow', 'Helvetica Neue', sans-serif;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.2s;
  flex-shrink: 0;
}

.cta-button:hover {
  background: var(--accent-hover);
}

/* Responsive */
@media (max-width: 768px) {
  .card-grid {
    grid-template-columns: 1fr;
  }

  .search-bar {
    max-width: 100%;
  }

  .about-features {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .hero-title {
    font-size: 36px;
    letter-spacing: 8px;
  }

  .cta-content {
    flex-direction: column;
    text-align: center;
  }

  .result-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
