/* =========================================================
   Domain Mount — dark SaaS dashboard theme
   Color roles follow the dark-mode dataviz reference palette.
   ========================================================= */

:root,
:root[data-theme="dark"] {
  --page-plane:      #202226;
  --surface-1:        #2a2d32;
  --surface-2:        #33363c;
  --surface-border:   rgba(255, 255, 255, 0.09);

  --text-primary:    #ffffff;
  --text-secondary:  #c3c2b7;
  --text-muted:      #898781;

  --accent:          #3987e5;
  --accent-soft:     rgba(57, 135, 229, 0.14);
  --accent-strong:   #6da7ec;

  --good:            #0ca30c;
  --warning:         #fab219;
  --critical:        #e66767;

  --gridline:        #2c2c2a;
  --baseline:        #383835;

  --hero-grad-start: #ffffff;
  --hero-grad-end:   #c3c2b7;
  --glow-opacity:    0.35;

  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;

  --shadow-card: 0 1px 0 rgba(255,255,255,0.04) inset, 0 20px 40px -24px rgba(0,0,0,0.6);

  --footer-bg: #1a1c20;

  --header-h: 72px;

  color-scheme: dark;
}

/* Light theme — chart chrome values follow the dataviz reference palette's
   light-mode column so charts and UI read as one system in both modes. */
:root[data-theme="light"] {
  --page-plane:      #f9f9f7;
  --surface-1:        #ffffff;
  --surface-2:        #f3f3f1;
  --surface-border:   rgba(11, 11, 11, 0.10);

  --text-primary:    #0b0b0b;
  --text-secondary:  #52514e;
  --text-muted:      #898781;

  --accent:          #2a78d6;
  --accent-soft:     rgba(42, 120, 214, 0.12);
  --accent-strong:   #1c5cab;

  --good:            #0ca30c;
  --warning:         #c98500;
  --critical:        #d03b3b;

  --gridline:        #e1e0d9;
  --baseline:        #c3c2b7;

  --hero-grad-start: #0b0b0b;
  --hero-grad-end:   #52514e;
  --glow-opacity:    0.14;

  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;

  --shadow-card: 0 1px 0 rgba(255,255,255,0.6) inset, 0 20px 40px -28px rgba(11,11,11,0.16);

  --footer-bg: #ececea;

  --header-h: 72px;

  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  max-width: 100%;
  overflow-x: hidden;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  background: var(--page-plane);
  color: var(--text-primary);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.5;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  transition: background-color 0.2s ease, color 0.2s ease;
  padding-top: var(--header-h);
}

.container {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 32px;
  width: 100%;
}

@media (max-width: 600px) {
  .container { padding: 0 16px; }
}

@media (max-width: 400px) {
  .container { padding: 0 12px; }
}

/* ---------- background glow ---------- */

.bg-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(90px);
  opacity: var(--glow-opacity);
  pointer-events: none;
  z-index: 0;
  transition: opacity 0.2s ease;
}
.bg-glow--one {
  width: 520px;
  height: 520px;
  top: -180px;
  left: -120px;
  background: radial-gradient(circle, var(--accent) 0%, transparent 70%);
}
.bg-glow--two {
  width: 480px;
  height: 480px;
  bottom: -220px;
  right: -140px;
  background: radial-gradient(circle, #9085e9 0%, transparent 70%);
  opacity: calc(var(--glow-opacity) * 0.65);
}

/* ---------- header ---------- */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  padding: 16px 0;
  background: var(--page-plane);
  border-bottom: 1px solid var(--surface-border);
  box-shadow: 0 8px 24px -18px rgba(0,0,0,0.5);
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
}

.brand-logo {
  width: 30px;
  height: 30px;
}

.brand-name {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.01em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ---------- main nav / mega menu ---------- */

.main-nav {
  position: relative;
  flex: 1;
  display: flex;
}

.nav-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 4px;
}
.nav-caret {
  width: 14px;
  height: 14px;
  transition: transform 0.15s ease;
}
.main-nav.open .nav-caret,
.nav-trigger[aria-expanded="true"] .nav-caret {
  transform: rotate(180deg);
}

.mega-menu {
  position: fixed;
  top: var(--header-h);
  left: 0;
  right: 0;
  background: var(--surface-1);
  border-bottom: 1px solid var(--surface-border);
  box-shadow: 0 24px 40px -24px rgba(0,0,0,0.5);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
  z-index: 190;
}
.main-nav.open .mega-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.mega-menu-inner {
  max-width: 1320px;
  margin: 0 auto;
  padding: 28px 32px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
  max-height: calc(100vh - var(--header-h) - 24px);
  overflow-y: auto;
}

@media (max-width: 860px) {
  .mega-menu-inner { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 520px) {
  .mega-menu-inner { grid-template-columns: 1fr; padding: 20px; gap: 20px; }
}

.mega-col-title {
  margin: 0 0 12px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.mega-col-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mega-link {
  display: inline-block;
  background: none;
  border: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  padding: 6px 0;
  text-align: left;
  text-decoration: none;
}
.mega-link:hover { color: var(--accent-strong); }
.mega-link--muted { color: var(--text-secondary); }

.mega-col-list--static li {
  font-size: 13.5px;
  color: var(--text-secondary);
  padding: 6px 0;
  line-height: 1.4;
}

/* ---------- language switcher ---------- */

.lang-switcher {
  position: relative;
}

.lang-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--surface-border);
  background: var(--surface-1);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: border-color 0.15s ease;
}
.lang-trigger:hover { border-color: var(--accent); }
.lang-icon { width: 16px; height: 16px; flex: 0 0 auto; }

.lang-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 240px;
  max-height: 340px;
  display: flex;
  flex-direction: column;
  background: var(--surface-1);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  box-shadow: 0 24px 40px -20px rgba(0,0,0,0.5);
  overflow: hidden;
  z-index: 190;
}
.lang-menu[hidden] { display: none; }

.lang-list {
  overflow-y: auto;
  flex: 1;
  padding: 6px;
}

.lang-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  background: none;
  border: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13.5px;
  text-align: left;
  padding: 8px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.lang-item:hover { background: var(--surface-2); }
.lang-item.active { color: var(--accent-strong); font-weight: 700; }
.lang-item-code {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  flex: 0 0 auto;
}
.lang-item-alt {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
}

/* ---------- mobile hamburger menu ---------- */
/* Below 768px, the nav ("Explore" mega menu) is moved (via JS reparenting,
   not duplicated) into a slide-down panel opened from a hamburger button on
   the right of the header. The logo, language switcher, and theme toggle
   stay in the header at every width. */

.mobile-menu-btn {
  display: none;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--surface-border);
  background: var(--surface-1);
  color: var(--text-primary);
  cursor: pointer;
  flex: 0 0 auto;
  transition: border-color 0.15s ease, background-color 0.2s ease;
}
.mobile-menu-btn:hover { border-color: var(--accent); }

/* Hamburger icon animates into an "X" when the panel is open, driven off
   the button's own aria-expanded state (no extra JS needed). */
.hamburger-icon {
  position: relative;
  display: inline-block;
  width: 18px;
  height: 13px;
}
.hamburger-bar {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: transform 0.22s ease, opacity 0.16s ease, top 0.22s ease;
}
.hamburger-bar:nth-child(1) { top: 0; }
.hamburger-bar:nth-child(2) { top: 5.5px; }
.hamburger-bar:nth-child(3) { top: 11px; }

.mobile-menu-btn[aria-expanded="true"] .hamburger-bar:nth-child(1) {
  top: 5.5px;
  transform: rotate(45deg);
}
.mobile-menu-btn[aria-expanded="true"] .hamburger-bar:nth-child(2) {
  opacity: 0;
}
.mobile-menu-btn[aria-expanded="true"] .hamburger-bar:nth-child(3) {
  top: 5.5px;
  transform: rotate(-45deg);
}

.mobile-menu-panel {
  position: fixed;
  top: var(--header-h);
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--page-plane);
  z-index: 195;
  overflow-y: auto;
  border-top: 1px solid var(--surface-border);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-10px);
  transition: background-color 0.2s ease, opacity 0.2s ease, transform 0.2s ease, visibility 0s linear 0.2s;
}
.mobile-menu-panel.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
  transition: background-color 0.2s ease, opacity 0.2s ease, transform 0.2s ease, visibility 0s linear 0s;
}

.mobile-menu-inner {
  padding: 20px 20px 40px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.mobile-nav-slot .main-nav {
  display: block;
  width: 100%;
}
.mobile-nav-slot .nav-trigger {
  /* No "Explore" click needed on mobile — the menu shows directly. */
  display: none;
}
.mobile-nav-slot .mega-menu {
  position: static;
  display: block;
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: none;
  box-shadow: none;
  border: none;
  background: transparent;
}
.mobile-nav-slot .mega-menu-inner {
  max-width: none;
  padding: 16px 0 0;
  grid-template-columns: 1fr;
  max-height: none;
  overflow-y: visible;
  gap: 20px;
}

@media (max-width: 767px) {
  /* Logo + language switcher + theme toggle stay in the header; the
     hamburger toggle (for the nav) sits on the far right. */
  .mobile-menu-btn { display: inline-flex; order: 5; }
  .header-actions { margin-left: auto; }
}

@media (max-width: 400px) {
  /* Very narrow screens: drop the brand wordmark and language code label
     so the logo + language switcher + theme toggle + hamburger all fit. */
  .brand-name { display: none; }
  .lang-trigger span { display: none; }
}

@media (max-width: 360px) {
  .badge-text { display: none; }
  .badge { padding: 6px 8px; }
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--surface-border);
  color: var(--text-secondary);
}
.badge-dot {
  position: relative;
  display: inline-flex;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--good);
  flex: 0 0 auto;
}
.badge-dot::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--good);
  animation: badge-pulse 1.8s ease-out infinite;
}
@keyframes badge-pulse {
  0% { transform: scale(1); opacity: 0.7; }
  70% { transform: scale(2.6); opacity: 0; }
  100% { transform: scale(2.6); opacity: 0; }
}

.theme-toggle {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--surface-border);
  background: var(--surface-1);
  color: var(--text-primary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.theme-toggle:hover { border-color: var(--accent); }
.theme-toggle:active { transform: scale(0.9); }

.theme-toggle-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  color: var(--text-primary);
}
.theme-toggle-icon svg {
  width: 17px;
  height: 17px;
}
.theme-toggle-icon .icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle-icon .icon-sun { display: block; }
:root[data-theme="light"] .theme-toggle-icon .icon-moon { display: none; }

/* ---------- hero / search ---------- */

main.container {
  position: relative;
  z-index: 1;
}

.hero {
  text-align: center;
  padding: 56px 0 40px;
}

.hero h1 {
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 14px;
  background: linear-gradient(180deg, var(--hero-grad-start) 0%, var(--hero-grad-end) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.search-form {
  display: flex;
  gap: 10px;
  max-width: 560px;
  margin: 28px auto 0;
}

.search-field {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 16px;
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
}

#domain-input {
  width: 100%;
  height: 52px;
  padding: 0 16px 0 46px;
  border-radius: var(--radius-md);
  border: 1px solid var(--surface-border);
  background: var(--surface-1);
  color: var(--text-primary);
  font-size: 16px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
#domain-input::placeholder { color: var(--text-muted); }
#domain-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.btn-primary {
  height: 52px;
  padding: 0 26px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--accent);
  color: #ffffff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.15s ease, transform 0.1s ease;
  min-width: 108px;
}
.btn-primary:hover { background: var(--accent-strong); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.7; cursor: progress; }

.btn-spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: #ffffff;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.form-error {
  max-width: 560px;
  margin: 14px auto 0;
  color: var(--critical);
  font-size: 14px;
}

.chip-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}
.chip-label {
  color: var(--text-muted);
  font-size: 13px;
  margin-right: 2px;
}
.chip {
  border: 1px solid var(--surface-border);
  background: var(--surface-1);
  color: var(--text-secondary);
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.chip:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

/* ---------- history / saved searches ---------- */

.history-section {
  margin: 8px auto 48px;
  padding-top: 32px;
  border-top: 1px solid var(--surface-border);
}

.history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.history-head h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.history-actions {
  display: flex;
  gap: 14px;
}
.link-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 12.5px;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.link-btn:hover { color: var(--text-primary); }
.link-btn--danger:hover { color: var(--critical); }

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

.history-item {
  display: flex;
  align-items: center;
  gap: 16px;
  border: 1px solid var(--surface-border);
  background: var(--surface-1);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  transition: border-color 0.15s ease;
}
.history-item:hover { border-color: var(--accent); }

.history-item-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1 1 200px;
}

.history-item button.history-open {
  background: none;
  border: none;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  padding: 0;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-item .history-updated {
  color: var(--text-muted);
  font-size: 11.5px;
}

.history-item-stats {
  display: flex;
  gap: 20px;
  flex: 0 0 auto;
}

.history-stat {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 76px;
}
.history-stat-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}
.history-stat-value {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: proportional-nums;
}

.history-item .history-pin {
  background: none;
  border: none;
  color: var(--warning);
  font-size: 15px;
  cursor: pointer;
  padding: 0 2px;
  flex: 0 0 auto;
}

.history-item .history-remove {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: var(--surface-2);
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
  flex: 0 0 auto;
}
.history-item .history-remove:hover {
  color: var(--critical);
}

@media (max-width: 640px) {
  .history-item {
    flex-wrap: wrap;
  }
  .history-item-stats {
    gap: 14px;
    flex: 1 1 100%;
  }
}

/* ---------- empty state ---------- */

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 0 100px;
  font-size: 14px;
}

/* ---------- community panels (Top Websites / Recent Searches) ----------
   Always visible — independent of whether a report is currently showing,
   so it sits between the search area and Saved Searches regardless of
   search state. */

.community-panels {
  margin: 8px auto 32px;
}

/* ---------- results ---------- */

.results {
  padding-bottom: 80px;
  animation: fade-in 0.3s ease;
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.results-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.results-heading h2 {
  margin: 0 0 4px;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.01em;
  word-break: break-word;
}

.result-sub {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
}

.btn-ghost {
  border: 1px solid var(--surface-border);
  background: var(--surface-1);
  color: var(--text-primary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  transition: border-color 0.15s ease;
}
.btn-ghost:hover { border-color: var(--accent); }

.results-heading-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-ghost--icon {
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-ghost--icon[aria-pressed="true"] {
  border-color: var(--warning);
  color: var(--warning);
}
.btn-ghost--icon[aria-pressed="true"] #save-toggle-icon {
  color: var(--warning);
}

/* stat cards */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

@media (max-width: 767px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
}

@media (max-width: 380px) {
  .stat-grid { gap: 8px; }
}

.stat-card {
  background: var(--surface-1);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-card);
}

@media (max-width: 767px) {
  .stat-card { padding: 14px; }
}

.stat-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.stat-icon {
  font-size: 16px;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--accent-soft);
}

.stat-card-head h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.stat-value {
  margin: 0 0 4px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.01em;
  font-variant-numeric: proportional-nums;
}

.stat-note {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-muted);
}

@media (max-width: 767px) {
  .stat-card-head h3 { font-size: 11.5px; }
  .stat-value { font-size: 22px; }
  .stat-note { font-size: 11.5px; }
  .stat-icon { width: 26px; height: 26px; font-size: 14px; }
}

/* panels */

.panel-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

@media (max-width: 860px) {
  .panel-grid { grid-template-columns: 1fr; }
}

.panel {
  background: var(--surface-1);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-card);
}

.panel--chart {
  margin-bottom: 20px;
}

.panel-title {
  margin: 0 0 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.detail-list { margin: 0; }

.detail-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--gridline);
}
.detail-row:last-child { border-bottom: none; }

.detail-row dt {
  color: var(--text-muted);
  font-size: 13.5px;
}

.detail-row--stack {
  align-items: flex-start;
  flex-direction: column;
  gap: 6px;
}
.detail-row--stack dd {
  text-align: left;
  width: 100%;
}

.ns-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.ns-tag {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text-secondary);
}

.detail-row dd {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  text-align: right;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
}
.status-pill--good { color: var(--good); background: rgba(12,163,12,0.14); }
.status-pill--warning { color: var(--warning); background: rgba(250,178,25,0.14); }
.status-pill--critical { color: var(--critical); background: rgba(230,103,103,0.14); }
.status-pill--muted { color: var(--text-muted); background: rgba(137,135,129,0.14); }

.panel-footnote {
  margin: 14px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}
.panel-footnote a { color: var(--accent-strong); }

.chart-wrap {
  position: relative;
}

#traffic-chart {
  width: 100%;
  height: 220px;
  display: block;
}

.chart-tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--surface-2);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 12.5px;
  color: var(--text-primary);
  transform: translate(-50%, -110%);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.1s ease;
  z-index: 2;
}
.chart-tooltip.visible { opacity: 1; }
.chart-tooltip .tt-label { color: var(--text-muted); margin-bottom: 2px; }

.disclaimer {
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text-muted);
  border: 1px dashed var(--surface-border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin: 0;
}
.disclaimer strong { color: var(--text-secondary); }

/* ---------- ad slots (Google AdSense placeholders) ---------- */

.ad-slot {
  border: 1px dashed var(--surface-border);
  border-radius: var(--radius-md);
  background: var(--surface-1);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-align: center;
  margin: 24px auto;
  overflow: hidden;
}

.ad-slot-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.ad-slot-placeholder {
  font-size: 13px;
  color: var(--text-muted);
}

.ad-slot--leaderboard {
  min-height: 90px;
  max-width: 970px;
  width: 100%;
}

.ad-slot--banner {
  min-height: 100px;
  width: 100%;
}

.ad-slot--rectangle {
  min-height: 250px;
  max-width: 336px;
  width: 100%;
}

/* ---------- misc panel helpers ---------- */

.panel--wide {
  margin-bottom: 16px;
}

.panel-loading {
  margin: 0;
  font-size: 13.5px;
  color: var(--text-muted);
}

.retry-btn {
  display: inline-block;
  margin-left: 4px;
  background: none;
  border: none;
  color: var(--accent-strong);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.retry-btn:hover { color: var(--accent); }

.muted {
  color: var(--text-muted);
}

/* ---------- data tables (DNS, nameservers) ---------- */

.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.data-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
  padding: 0 0 10px;
  border-bottom: 1px solid var(--gridline);
}
.data-table td {
  padding: 10px 12px 10px 0;
  border-bottom: 1px solid var(--gridline);
  vertical-align: top;
  word-break: break-word;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table td:first-child {
  font-weight: 600;
  white-space: nowrap;
  width: 1%;
}
.dns-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
}
.dns-value + .dns-value { margin-top: 4px; }

/* ---------- raw / code blocks (HTTP Header Analysis) ---------- */

.raw-block {
  margin: 14px 0 0;
  padding: 14px;
  background: var(--surface-2);
  border-radius: var(--radius-md);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-secondary);
  overflow-x: auto;
  max-height: 420px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
.raw-block--compact {
  max-height: 220px;
  margin-top: 0;
}

/* ---------- chip lists (Similarly Ranked, Same-IP) ---------- */

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip--link {
  text-decoration: none;
  display: inline-block;
}

/* ---------- rank lists (Top Websites) ---------- */

.rank-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.rank-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--gridline);
  font-size: 13.5px;
}
.rank-list-item:last-child { border-bottom: none; }
.rank-list-item a {
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 600;
}
.rank-list-item a:hover { color: var(--accent-strong); }
.rank-list-num {
  color: var(--text-muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  min-width: 28px;
}

/* ---------- recent searches by other visitors ---------- */

.recent-search-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.recent-search-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--gridline);
  font-size: 13.5px;
}
.recent-search-item:last-child { border-bottom: none; }
.recent-search-who {
  color: var(--text-muted);
  font-size: 12px;
  min-width: 150px;
  flex: 0 0 auto;
}
.recent-search-domain {
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 600;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.recent-search-domain:hover { color: var(--accent-strong); }
.recent-search-time {
  color: var(--text-muted);
  font-size: 12px;
  flex: 0 0 auto;
  white-space: nowrap;
}

@media (max-width: 560px) {
  .recent-search-who { min-width: 96px; font-size: 11.5px; }
  .recent-search-item { font-size: 12.5px; }
}

/* ---------- mini stats + link sample list (Homepage Links) ---------- */

.mini-stats {
  display: flex;
  gap: 24px;
  margin-bottom: 16px;
}
.mini-stat-value {
  display: block;
  font-size: 22px;
  font-weight: 700;
}
.mini-stat-label {
  display: block;
  font-size: 11.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.link-sample-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
}
.link-sample-list li {
  font-size: 13px;
  padding: 6px 0;
  border-bottom: 1px solid var(--gridline);
}
.link-sample-list li:last-child { border-bottom: none; }
.link-sample-list a {
  color: var(--accent-strong);
  text-decoration: none;
  word-break: break-all;
}
.link-sample-list a:hover { text-decoration: underline; }

/* ---------- available (vacant domain) state ---------- */

.available-state {
  max-width: 560px;
  margin: 40px auto 100px;
  text-align: center;
  padding: 36px 28px;
  background: var(--surface-1);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}
.available-badge {
  width: 56px;
  height: 56px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: rgba(12, 163, 12, 0.14);
  color: var(--good);
  font-size: 26px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}
.available-state h2 {
  margin: 0 0 8px;
  font-size: 22px;
  word-break: break-word;
}
.available-sub {
  margin: 0 0 22px;
  color: var(--text-secondary);
  font-size: 14.5px;
}
.available-links {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.available-footnote {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ---------- footer ---------- */

.site-footer {
  position: relative;
  z-index: 1;
  background: var(--footer-bg);
  padding: 48px 0 24px;
  margin-top: 24px;
  transition: background-color 0.2s ease;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1fr;
  gap: 32px;
}

.footer-col--brand .footer-brand {
  color: var(--text-primary);
  margin-bottom: 12px;
}

.footer-tagline {
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.6;
  max-width: 320px;
}

.footer-col-title {
  margin: 0 0 14px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.footer-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.footer-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13.5px;
}
.footer-links a:hover {
  color: var(--text-primary);
  text-decoration: underline;
}

.footer-bottom {
  grid-column: 1 / -1;
  border-top: 1px solid var(--surface-border);
  margin-top: 32px;
  padding-top: 20px;
}
.footer-bottom p {
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
}

@media (max-width: 860px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
  .footer-col--brand {
    grid-column: 1 / -1;
  }
}

@media (max-width: 520px) {
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}

/* ---------- RTL language support (e.g. Arabic) ---------- */
/* Flexbox "row" layouts already mirror automatically with [dir="rtl"];
   these are the few places with hard-coded left/right values. */

[dir="rtl"] .detail-row dd,
[dir="rtl"] .history-item button.history-open,
[dir="rtl"] .mega-link {
  text-align: right;
}
[dir="rtl"] .lang-menu {
  right: auto;
  left: 0;
}
[dir="rtl"] .search-icon {
  left: auto;
  right: 16px;
}
[dir="rtl"] #domain-input {
  padding: 0 46px 0 16px;
}

/* ---------- Inner content pages (About, Privacy, Terms, Contact, API,
   Guides) — a single readable column sharing the same header/footer
   chrome as the home page. ---------- */

.content-page {
  max-width: 760px;
  margin: 0 auto;
  padding: 48px 0 80px;
}

.content-page .content-eyebrow {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-strong);
  margin: 0 0 12px;
}

.content-page h1 {
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.15;
  margin: 0 0 12px;
  background: linear-gradient(180deg, var(--hero-grad-start), var(--hero-grad-end));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.content-page .content-lede {
  font-size: 17px;
  color: var(--text-secondary);
  margin: 0 0 36px;
  max-width: 60ch;
}

.content-page .content-updated {
  font-size: 13px;
  color: var(--text-muted);
  margin: -24px 0 32px;
}

.content-page h2 {
  font-size: 21px;
  margin: 40px 0 12px;
  color: var(--text-primary);
}

.content-page h3 {
  font-size: 17px;
  margin: 24px 0 8px;
  color: var(--text-primary);
}

.content-page p {
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-secondary);
  margin: 0 0 16px;
}

.content-page ul,
.content-page ol {
  margin: 0 0 16px;
  padding-left: 22px;
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.7;
}

.content-page li { margin-bottom: 6px; }

.content-page a {
  color: var(--accent-strong);
  text-decoration: underline;
  text-decoration-color: var(--surface-border);
  text-underline-offset: 3px;
}
.content-page a:hover { text-decoration-color: currentColor; }

.content-page code {
  background: var(--surface-2);
  border: 1px solid var(--surface-border);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 13px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

.content-page pre {
  background: var(--surface-1);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  padding: 16px;
  overflow-x: auto;
  margin: 0 0 20px;
}
.content-page pre code {
  background: none;
  border: none;
  padding: 0;
}

.content-page .content-card {
  background: var(--surface-1);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin: 0 0 20px;
  box-shadow: var(--shadow-card);
}

.content-page .content-card h3 { margin-top: 0; }

.content-page .content-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 0 0 24px;
}
@media (max-width: 640px) {
  .content-page .content-grid { grid-template-columns: 1fr; }
}

.content-page .btn-primary,
.content-page .btn-ghost {
  display: inline-flex;
}

.content-page .content-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  margin-bottom: 24px;
}
.content-page .content-back:hover { color: var(--accent-strong); }

.content-page .content-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  margin-bottom: 16px;
}

.content-page .content-contact-list {
  list-style: none;
  padding: 0;
  margin: 0 0 24px;
}
.content-page .content-contact-list li {
  display: flex;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--surface-border);
  font-size: 15px;
  color: var(--text-secondary);
}
.content-page .content-contact-list strong {
  color: var(--text-primary);
  min-width: 110px;
  flex: 0 0 auto;
}
