/* ════════════════════════════════════════════════════════
   Spin Web - OSINT Mini Toolkit
   Dark theme with investigator aesthetic
   ════════════════════════════════════════════════════════ */

/* ─── Variables ─────────────────────────────────────────── */
:root {
  --spin-purple: #7b1feb;
  --spin-purple-light: #9b4ff0;
  --spin-purple-dark: #5a10c0;
  --spin-green: #1cdf66;
  --spin-green-dark: #15b050;
  --spin-blue: #388dff;
  --spin-red: #ff4757;
  --spin-orange: #ffa502;
  --spin-yellow: #ffd43b;
  --bg-dark: #08080d;
  --bg-card: #101018;
  --bg-input: #181825;
  --bg-hover: #1c1c30;
  --border: #28283e;
  --border-light: #35355a;
  --text: #d8d8e8;
  --text-dim: #7878a0;
  --text-bright: #f0f0ff;
  --glow-purple: 0 0 20px rgba(123, 31, 235, 0.25);
  --glow-green: 0 0 20px rgba(28, 223, 102, 0.25);
  --glow-blue: 0 0 20px rgba(56, 141, 255, 0.25);
  --glow-red: 0 0 15px rgba(255, 71, 87, 0.2);
  --radius: 8px;
  --radius-lg: 12px;
  --font-mono: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', 'Cascadia Code', monospace;
}

[data-theme="light"] {
  --spin-purple: #6f18d9;
  --spin-purple-light: #7d2de8;
  --spin-purple-dark: #4a1190;
  --spin-green: #0f9b4d;
  --spin-green-dark: #0a7a3c;
  --spin-blue: #1f67d8;
  --spin-red: #cc1f3a;
  --spin-orange: #b86a00;
  --spin-yellow: #a47f00;
  --bg-dark: #f3f5fb;
  --bg-card: #ffffff;
  --bg-input: #eef2ff;
  --bg-hover: #e8eeff;
  --border: #d3d9ef;
  --border-light: #bec8e8;
  --text: #22273b;
  --text-dim: #4d5676;
  --text-bright: #101424;
  --glow-purple: 0 0 18px rgba(111, 24, 217, 0.14);
  --glow-green: 0 0 18px rgba(15, 155, 77, 0.16);
  --glow-blue: 0 0 18px rgba(31, 103, 216, 0.14);
  --glow-red: 0 0 12px rgba(204, 31, 58, 0.16);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  background: var(--bg-dark);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background-color 0.2s ease, color 0.2s ease;
}

body.install-banner-visible {
  padding-bottom: 130px;
}

/* ─── Loading Screen ───────────────────────────────────── */
.loading-screen {
  position: fixed;
  inset: 0;
  background: #050508;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

.loading-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loading-content {
  text-align: center;
}

.loading-logo {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, var(--spin-purple), var(--spin-green));
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 44px;
  color: white;
  margin: 0 auto 1.5rem;
  animation: logoPulse 1.5s ease-in-out infinite;
  box-shadow: 0 0 40px rgba(123, 31, 235, 0.4);
}

.loading-text {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  letter-spacing: 4px;
  color: var(--spin-purple-light);
  margin-bottom: 1.5rem;
}

.loading-bar {
  width: 300px;
  height: 3px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin: 0 auto 1rem;
}

.loading-bar-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--spin-purple), var(--spin-green));
  border-radius: 3px;
  animation: loadFill 2s ease-out forwards;
}

.loading-status {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dim);
}

@keyframes loadFill {
  0% { width: 0%; }
  30% { width: 40%; }
  60% { width: 70%; }
  90% { width: 90%; }
  100% { width: 100%; }
}

@keyframes logoPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 40px rgba(123, 31, 235, 0.4); }
  50% { transform: scale(1.05); box-shadow: 0 0 60px rgba(123, 31, 235, 0.6); }
}

/* ─── Scanline Overlay ─────────────────────────────────── */
.scanline-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.03) 2px,
    rgba(0, 0, 0, 0.03) 4px
  );
}

/* ─── Header ───────────────────────────────────────────── */
.header {
  background: linear-gradient(135deg, rgba(16, 16, 24, 0.92) 0%, rgba(18, 16, 42, 0.92) 100%);
  border-bottom: 1px solid var(--border);
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

[data-theme="light"] .header {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.92) 0%, rgba(235, 241, 255, 0.92) 100%);
}

[data-theme="light"] .scanline-overlay {
  opacity: 0.12;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--spin-purple), var(--spin-green));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 22px;
  color: white;
  box-shadow: var(--glow-purple);
  animation: logoGlow 3s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes logoGlow {
  0%, 100% { box-shadow: 0 0 15px rgba(123, 31, 235, 0.3); }
  50% { box-shadow: 0 0 25px rgba(123, 31, 235, 0.5), 0 0 50px rgba(28, 223, 102, 0.15); }
}

.header-title h1 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-bright);
  line-height: 1.2;
}

.header-title .subtitle {
  color: var(--spin-purple-light);
  font-weight: 400;
  font-size: 0.8rem;
  margin-left: 6px;
}

.header-tagline {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-dim);
  margin-top: 2px;
  overflow: hidden;
  white-space: nowrap;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.badge {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
}

.version-badge { color: var(--spin-green); }
.client-badge { color: var(--spin-purple-light); }
.case-badge {
  color: var(--spin-orange);
  font-family: var(--font-mono);
  letter-spacing: 1px;
}

.btn-desktop {
  background: var(--spin-purple);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-desktop:hover {
  background: var(--spin-purple-light);
  box-shadow: var(--glow-purple);
  transform: translateY(-1px);
}

.theme-toggle {
  min-width: 72px;
  justify-content: center;
}

/* ─── Navigation ───────────────────────────────────────── */
.nav {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  display: flex;
  gap: 0;
  overflow-x: auto;
  scrollbar-width: thin;
}

.nav-tab {
  background: none;
  border: none;
  color: var(--text-dim);
  padding: 12px 18px;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-icon {
  font-size: 0.9rem;
  opacity: 0.7;
}

.nav-tab:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.nav-tab.active {
  color: var(--spin-purple-light);
  border-bottom-color: var(--spin-purple);
}

.nav-tab.active .nav-icon {
  opacity: 1;
}

.nav-tab:focus-visible,
.btn:focus-visible,
.btn-desktop:focus-visible,
.copy-btn:focus-visible,
.tool-card:focus-visible,
.bookmark-item:focus-visible,
.install-banner-close:focus-visible {
  outline: 2px solid var(--spin-blue);
  outline-offset: 2px;
}

/* ─── Main Content ─────────────────────────────────────── */
.main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

/* ─── Panels ───────────────────────────────────────────── */
.panel {
  display: none;
  animation: fadeSlideIn 0.3s ease;
}

.panel.active {
  display: block;
}

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

/* ─── Cards ────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  transition: border-color 0.2s;
}

.card:hover {
  border-color: var(--border-light);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 8px;
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-bright);
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-icon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}

.card-icon.purple { background: rgba(123, 31, 235, 0.15); color: var(--spin-purple-light); }
.card-icon.green { background: rgba(28, 223, 102, 0.15); color: var(--spin-green); }
.card-icon.blue { background: rgba(56, 141, 255, 0.15); color: var(--spin-blue); }
.card-icon.red { background: rgba(255, 71, 87, 0.15); color: var(--spin-red); }
.card-icon.orange { background: rgba(255, 165, 2, 0.15); color: var(--spin-orange); }

/* ─── Welcome Card ─────────────────────────────────────── */
.welcome-card {
  position: relative;
  overflow: hidden;
}

.welcome-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--spin-purple), var(--spin-green), var(--spin-blue));
  animation: gradientSlide 4s linear infinite;
  background-size: 200% 100%;
}

@keyframes gradientSlide {
  0% { background-position: 0% 0%; }
  100% { background-position: 200% 0%; }
}

.welcome-text {
  color: var(--text-dim);
  font-size: 0.9rem;
  line-height: 1.7;
}

.welcome-text .bright { color: var(--text-bright); }
.welcome-text .purple { color: var(--spin-purple-light); }

.link-blue {
  color: var(--spin-blue);
  text-decoration: none;
}
.link-blue:hover {
  text-decoration: underline;
}

/* ─── Classified Stamp ─────────────────────────────────── */
.classified-stamp {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--spin-red);
  border: 2px solid var(--spin-red);
  padding: 3px 10px;
  border-radius: 4px;
  transform: rotate(-3deg);
  opacity: 0.7;
  animation: stampAppear 0.4s ease;
}

@keyframes stampAppear {
  from { transform: rotate(-3deg) scale(2); opacity: 0; }
  to { transform: rotate(-3deg) scale(1); opacity: 0.7; }
}

/* ─── Joke Card ────────────────────────────────────────── */
.joke-card {
  border-left: 3px solid var(--spin-green);
  padding: 1rem 1.1rem;
  min-height: 128px;
}

.joke-display {
  padding: 0.25rem 0 0;
}

.joke-text {
  color: var(--text-bright);
  font-size: 1rem;
  line-height: 1.45;
  word-break: break-word;
}

.joke-punchline {
  color: var(--spin-green);
  font-weight: 600;
  font-size: 0.98rem;
  margin-top: 0.5rem;
  min-height: 1.3em;
  transition: opacity 0.24s ease, max-height 0.24s ease;
}

.joke-punchline.is-hidden {
  opacity: 0;
  max-height: 0;
  overflow: hidden;
}

.joke-card:hover .joke-punchline.is-hidden {
  opacity: 1;
  max-height: 180px;
}

.joke-primary-btn {
  background: var(--spin-green-dark);
}

.joke-primary-btn:hover {
  background: var(--spin-green);
  box-shadow: var(--glow-green);
}

.joke-transition-out {
  opacity: 0.35;
  transform: translateY(2px);
}

.joke-transition-in {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.22s ease, transform 0.22s ease;
}

/* ─── Tip Ticker ───────────────────────────────────────── */
.tip-ticker {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 16px;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
  flex-wrap: wrap;
}

.tip-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--spin-orange);
  background: rgba(255, 165, 2, 0.1);
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}

.tip-scroll {
  font-size: 0.84rem;
  color: var(--text);
  transition: opacity 0.18s ease;
}

.tip-scroll-wrap {
  flex: 1;
  min-width: 180px;
}

.tip-scroll.tip-fade {
  opacity: 0.35;
}

.ticker-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.ticker-controls .copy-btn {
  color: var(--text);
  border-color: var(--border-light);
}

.ticker-controls .copy-btn:hover {
  color: var(--spin-blue);
  border-color: var(--spin-blue);
}

/* ─── Collective Orchestrator ──────────────────────────── */
.collective-card {
  border-left: 3px solid var(--spin-purple);
}

.collective-card textarea {
  min-height: 92px;
}

.collective-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.collective-summary-item {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
}

.collective-summary-label {
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-size: 0.68rem;
}

.collective-summary-value {
  color: var(--text-bright);
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.2;
  margin-top: 2px;
}

.collective-agent-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 6px;
  margin: 0;
  padding: 0;
}

.collective-agent-list li {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  font-size: 0.78rem;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.collective-agent-tag {
  font-family: var(--font-mono);
  color: var(--text-dim);
  font-size: 0.7rem;
}

/* ─── Section Title ────────────────────────────────────── */
.section-title {
  font-size: 0.95rem;
  margin-bottom: 1rem;
  color: var(--text-bright);
}

/* ─── Stats Grid ───────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  text-align: center;
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  opacity: 0;
  transition: opacity 0.3s;
}

.stat-card:hover {
  transform: translateY(-2px);
}

.stat-card:hover::after {
  opacity: 1;
}

.stat-card.purple:hover { border-color: var(--spin-purple); box-shadow: var(--glow-purple); }
.stat-card.purple::after { background: var(--spin-purple); }
.stat-card.green:hover { border-color: var(--spin-green); box-shadow: var(--glow-green); }
.stat-card.green::after { background: var(--spin-green); }
.stat-card.blue:hover { border-color: var(--spin-blue); box-shadow: var(--glow-blue); }
.stat-card.blue::after { background: var(--spin-blue); }
.stat-card.orange:hover { border-color: var(--spin-orange); }
.stat-card.orange::after { background: var(--spin-orange); }

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-bright);
  line-height: 1;
  margin-bottom: 6px;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-card.purple .stat-value { color: var(--spin-purple-light); }
.stat-card.green .stat-value { color: var(--spin-green); }
.stat-card.blue .stat-value { color: var(--spin-blue); }
.stat-card.orange .stat-value { color: var(--spin-orange); }

/* ─── Tools Grid ───────────────────────────────────────── */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  cursor: pointer;
  transition: all 0.25s;
  position: relative;
  overflow: hidden;
}

.tool-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(123, 31, 235, 0.03), transparent);
  transition: left 0.5s;
}

.tool-card:hover::before {
  left: 100%;
}

.tool-card:hover {
  border-color: var(--spin-purple);
  box-shadow: var(--glow-purple);
  transform: translateY(-3px);
}

.tool-icon {
  font-size: 1.5rem;
  margin-bottom: 8px;
  display: inline-block;
}

.tool-icon.green-glow { text-shadow: 0 0 10px rgba(28, 223, 102, 0.4); }
.tool-icon.blue-glow { text-shadow: 0 0 10px rgba(56, 141, 255, 0.4); }
.tool-icon.purple-glow { text-shadow: 0 0 10px rgba(123, 31, 235, 0.4); }
.tool-icon.orange-glow { text-shadow: 0 0 10px rgba(255, 165, 2, 0.4); }
.tool-icon.red-glow { text-shadow: 0 0 10px rgba(255, 71, 87, 0.4); }

.tool-card h3 {
  font-size: 0.95rem;
  margin-bottom: 6px;
  color: var(--text-bright);
}

.tool-card p {
  font-size: 0.8rem;
  color: var(--text-dim);
  line-height: 1.5;
}

/* ─── Investigation Status ─────────────────────────────── */
.investigation-status {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.status-row:last-child {
  border-bottom: none;
}

.status-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  min-width: 140px;
}

.status-value {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text);
}

.status-green { color: var(--spin-green); }

/* ─── Privacy Meter ────────────────────────────────────── */
.privacy-meter {
  display: flex;
  gap: 4px;
  flex: 1;
  max-width: 200px;
}

.privacy-level {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--bg-input);
  transition: all 0.3s;
}

.privacy-level.active:nth-child(1) { background: var(--spin-green); box-shadow: 0 0 6px rgba(28, 223, 102, 0.3); }
.privacy-level.active:nth-child(2) { background: var(--spin-blue); box-shadow: 0 0 6px rgba(56, 141, 255, 0.3); }
.privacy-level.active:nth-child(3) { background: var(--spin-yellow); box-shadow: 0 0 6px rgba(255, 212, 59, 0.3); }
.privacy-level.active:nth-child(4) { background: var(--spin-orange); box-shadow: 0 0 6px rgba(255, 165, 2, 0.3); }
.privacy-level.active:nth-child(5) { background: var(--spin-red); box-shadow: 0 0 6px rgba(255, 71, 87, 0.3); }

/* ─── Forms ────────────────────────────────────────────── */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.tool-desc {
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-bottom: 1rem;
  line-height: 1.5;
}

.input-row {
  display: flex;
  gap: 8px;
}

.input-hint {
  margin-top: 6px;
  font-size: 0.76rem;
  min-height: 1.2em;
  color: var(--text-dim);
}

.input-hint.success {
  color: var(--spin-green);
}

.input-hint.error {
  color: var(--spin-red);
}

input[type="text"],
input[type="url"],
input[type="email"],
textarea,
select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  color: var(--text);
  font-size: 0.88rem;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--spin-purple);
  box-shadow: 0 0 0 3px rgba(123, 31, 235, 0.12);
}

textarea {
  min-height: 120px;
  resize: vertical;
}

.filter-row {
  display: flex;
  gap: 8px;
  margin-bottom: 1rem;
}

.filter-row select {
  width: 160px;
  flex-shrink: 0;
}

.filter-row input {
  flex: 1;
}

.multi-filter {
  display: grid;
  grid-template-columns: 170px minmax(160px, 1fr) minmax(160px, 1fr) 200px;
  gap: 8px;
}

.multi-filter select {
  width: 100%;
}

/* ─── Buttons ──────────────────────────────────────────── */
.btn {
  background: var(--spin-purple);
  color: white;
  border: none;
  border-radius: var(--radius);
  padding: 10px 20px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.btn:hover {
  background: var(--spin-purple-light);
  box-shadow: var(--glow-purple);
  transform: translateY(-1px);
}

.btn:active {
  transform: scale(0.98) translateY(0);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  background: var(--bg-input);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  box-shadow: none;
  border-color: var(--border-light);
}

.btn-green {
  background: var(--spin-green-dark);
}

.btn-green:hover {
  background: var(--spin-green);
  box-shadow: var(--glow-green);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.78rem;
}

.btn-danger {
  color: var(--spin-red);
}

.btn-danger:hover {
  border-color: var(--spin-red);
}

.btn-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* ─── Results ──────────────────────────────────────────── */
.results {
  margin-top: 1rem;
}

.loading-skeleton {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 11px 14px;
  margin-bottom: 8px;
  color: var(--text-dim);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.inline-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(123, 31, 235, 0.2);
  border-top-color: var(--spin-purple);
  border-radius: 50%;
  display: inline-block;
  animation: spin 0.75s linear infinite;
}

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

.result-item {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  animation: resultSlideIn 0.2s ease;
}

.result-item.result-message.error {
  border-color: rgba(255, 71, 87, 0.5);
}

.result-item.result-message.warn {
  border-color: rgba(255, 165, 2, 0.5);
}

@keyframes resultSlideIn {
  from { opacity: 0; transform: translateX(-8px); }
  to { opacity: 1; transform: translateX(0); }
}

.result-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  min-width: 110px;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  font-weight: 600;
}

.result-value {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-bright);
  word-break: break-all;
}

.result-value a {
  color: var(--spin-blue);
  text-decoration: none;
  transition: color 0.2s;
}

.result-value a:hover {
  text-decoration: underline;
  color: var(--spin-purple-light);
}

.privacy-note {
  margin: 0.6rem 0 0.9rem;
  padding: 8px 10px;
  border: 1px dashed var(--border-light);
  border-radius: var(--radius);
  color: var(--text-dim);
  font-size: 0.78rem;
  line-height: 1.45;
}

/* ─── Tags ─────────────────────────────────────────────── */
.tag {
  display: inline-block;
  background: rgba(123, 31, 235, 0.12);
  color: var(--spin-purple-light);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 0.72rem;
  font-weight: 600;
  margin-right: 4px;
}

.tag.green { background: rgba(28, 223, 102, 0.12); color: var(--spin-green); }
.tag.blue { background: rgba(56, 141, 255, 0.12); color: var(--spin-blue); }
.tag.red { background: rgba(255, 71, 87, 0.12); color: var(--spin-red); }
.tag.orange { background: rgba(255, 165, 2, 0.12); color: var(--spin-orange); }
.tag.yellow { background: rgba(255, 212, 59, 0.12); color: var(--spin-yellow); }

/* ─── Entity Table ─────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
}

.entity-table {
  width: 100%;
  border-collapse: collapse;
}

.entity-table th {
  text-align: left;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.entity-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}

.entity-table tr:hover td {
  background: var(--bg-hover);
}

.entity-table .mono {
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

/* ─── Copy Button ──────────────────────────────────────── */
.copy-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 8px;
  color: var(--text-dim);
  font-size: 0.68rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font-mono);
}

.copy-btn:hover {
  border-color: var(--spin-purple);
  color: var(--spin-purple-light);
  background: rgba(123, 31, 235, 0.08);
}

/* ─── Bookmarks ────────────────────────────────────────── */
.bookmark-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 8px;
}

.bookmark-item {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  transition: all 0.2s;
}

.bookmark-item:hover {
  border-color: var(--spin-purple);
  background: var(--bg-hover);
  transform: translateX(3px);
}

.bookmark-item a {
  color: var(--spin-blue);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
}

.bookmark-item a:hover {
  text-decoration: underline;
}

.bookmark-item .bookmark-desc {
  font-size: 0.73rem;
  color: var(--text-dim);
  margin-top: 3px;
}

.bookmark-category {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--spin-purple-light);
  margin: 1.25rem 0 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.bookmark-category::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ─── Entity Extractor ─────────────────────────────────── */
.extracted-list {
  max-height: 400px;
  overflow-y: auto;
}

.extracted-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

.extracted-item:hover {
  background: var(--bg-hover);
}

.extracted-item:last-child {
  border-bottom: none;
}

.platform-check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
}

.platform-check-card {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
}

.platform-check-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
}

.platform-icon {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--spin-blue);
}

.platform-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-bright);
}

.platform-check-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.76rem;
}

.platform-check-actions a {
  color: var(--spin-blue);
  text-decoration: none;
}

.platform-check-actions a:hover {
  text-decoration: underline;
}

.platform-status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid var(--border-light);
  padding: 2px 8px;
  line-height: 1.4;
  font-weight: 600;
  color: var(--text-dim);
}

.platform-status.pending { color: var(--text-dim); }
.platform-status.exists { color: var(--spin-green); border-color: rgba(28, 223, 102, 0.45); }
.platform-status.missing { color: var(--spin-red); border-color: rgba(255, 71, 87, 0.45); }
.platform-status.error { color: var(--spin-orange); border-color: rgba(255, 165, 2, 0.45); }

.subresult-card {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  margin: 0.5rem 0 0.8rem;
}

.subresult-card h4 {
  font-size: 0.8rem;
  color: var(--text-bright);
  margin-bottom: 8px;
}

.danger-btn {
  color: var(--spin-red);
  border-color: rgba(255, 71, 87, 0.5);
}

/* ─── Empty State ──────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--text-dim);
}

.empty-state h3 {
  color: var(--text);
  margin-bottom: 0.5rem;
}

/* ─── Toast Notification ───────────────────────────────── */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--bg-card);
  border: 1px solid var(--spin-green);
  border-radius: var(--radius);
  padding: 12px 20px;
  color: var(--spin-green);
  font-size: 0.82rem;
  font-weight: 500;
  box-shadow: var(--glow-green);
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 1000;
  max-width: 360px;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.error {
  border-color: var(--spin-red);
  color: var(--spin-red);
  box-shadow: var(--glow-red);
}

.toast.warn {
  border-color: var(--spin-orange);
  color: var(--spin-orange);
  box-shadow: none;
}

/* ─── Tip Popup ────────────────────────────────────────── */
.tip-popup {
  position: fixed;
  bottom: 2rem;
  left: 2rem;
  background: var(--bg-card);
  border: 1px solid var(--spin-orange);
  border-radius: var(--radius-lg);
  padding: 0;
  max-width: 320px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  transform: translateY(120%) scale(0.95);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 999;
  overflow: hidden;
}

.tip-popup.show {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.tip-popup-header {
  background: rgba(255, 165, 2, 0.1);
  padding: 8px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--spin-orange);
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}

.tip-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
}

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

.tip-popup p {
  padding: 12px 14px;
  font-size: 0.82rem;
  color: var(--text);
  line-height: 1.5;
}

/* ─── Footer ───────────────────────────────────────────── */
.footer {
  text-align: center;
  padding: 2.5rem 2rem;
  border-top: 1px solid var(--border);
  margin-top: 3rem;
  background: linear-gradient(180deg, transparent, rgba(123, 31, 235, 0.02));
}

.footer-brand {
  color: var(--text);
  font-size: 0.85rem;
  margin-bottom: 4px;
}

.footer-privacy {
  color: var(--spin-green);
  font-size: 0.75rem;
  font-family: var(--font-mono);
  margin-bottom: 8px;
}

.footer-links {
  color: var(--text-dim);
  font-size: 0.8rem;
  margin-bottom: 12px;
}

.footer-links a {
  color: var(--spin-purple-light);
  text-decoration: none;
}

.footer-links a:hover {
  text-decoration: underline;
}

.footer-joke {
  font-style: italic;
  color: var(--text-dim);
  font-size: 0.75rem;
  opacity: 0.7;
  transition: opacity 0.3s;
}

.footer-joke:hover {
  opacity: 1;
}

/* ─── Scrollbar ────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-dim);
}

/* ─── Responsive ───────────────────────────────────────── */
@media (max-width: 768px) {
  .header {
    padding: 0.75rem 1rem;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
  }

  .header-right {
    width: 100%;
    justify-content: flex-start;
  }

  .header-tagline {
    display: none;
  }

  .nav {
    padding: 0 1rem;
  }

  .nav-tab {
    padding: 10px 12px;
    font-size: 0.78rem;
  }

  .nav-icon {
    display: none;
  }

  .main {
    padding: 1rem;
  }

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

  .tools-grid {
    grid-template-columns: 1fr;
  }

  .input-row {
    flex-direction: column;
  }

  .joke-card {
    padding: 0.9rem 0.95rem;
  }

  .joke-text,
  .joke-punchline {
    font-size: 0.93rem;
  }

  .result-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .filter-row {
    flex-direction: column;
  }

  .filter-row select {
    width: 100%;
  }

  .multi-filter {
    grid-template-columns: 1fr;
  }

  .tip-ticker {
    align-items: stretch;
    gap: 8px;
  }

  .tip-scroll-wrap {
    min-width: 0;
  }

  .tip-scroll {
    white-space: normal;
  }

  .ticker-controls {
    width: 100%;
    justify-content: flex-start;
  }

  .card-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .tip-popup {
    left: 1rem;
    right: 1rem;
    max-width: none;
  }

  .classified-stamp {
    display: none;
  }

  .case-badge {
    display: none;
  }

  .platform-check-grid {
    grid-template-columns: 1fr;
  }

  .collective-agent-list {
    grid-template-columns: 1fr;
  }

  .collective-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.install-banner-visible {
    padding-bottom: 160px;
  }
}

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

  .badge {
    font-size: 0.65rem;
    padding: 3px 8px;
  }

  .joke-display {
    padding-top: 0.15rem;
  }

  .joke-text,
  .joke-punchline {
    font-size: 0.9rem;
    line-height: 1.4;
  }

  .ticker-controls .copy-btn {
    font-size: 0.64rem;
    padding: 2px 7px;
  }

  .collective-summary-grid {
    grid-template-columns: 1fr;
  }
}

/* ─── Security Status Dashboard ───────────────────────── */
.sec-dashboard {
  max-width: 1200px;
  margin: 3rem auto 0;
  padding: 0 2rem;
}

.sec-dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 0 2px;
}

.sec-dashboard-title {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text-dim);
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sec-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--spin-green);
  box-shadow: 0 0 6px var(--spin-green);
  animation: secPulse 2s ease-in-out infinite;
}

@keyframes secPulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 6px var(--spin-green); }
  50% { opacity: 0.5; box-shadow: 0 0 12px var(--spin-green); }
}

.sec-dashboard-subtitle {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--spin-green);
  background: rgba(28, 223, 102, 0.08);
  padding: 3px 10px;
  border-radius: 4px;
  border: 1px solid rgba(28, 223, 102, 0.15);
}

.sec-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.sec-cell {
  background: var(--bg-card);
  padding: 14px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background 0.2s;
}

.sec-cell:hover {
  background: var(--bg-hover);
}

.sec-cell-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: all 0.3s;
}

.sec-cell-indicator.green {
  background: var(--spin-green);
  box-shadow: 0 0 6px rgba(28, 223, 102, 0.4);
}

.sec-cell-indicator.orange {
  background: var(--spin-orange);
  box-shadow: 0 0 6px rgba(255, 165, 2, 0.4);
}

.sec-cell-indicator.red {
  background: var(--spin-red);
  box-shadow: 0 0 6px rgba(255, 71, 87, 0.4);
}

.sec-cell-data {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sec-cell-value {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-bright);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sec-cell-label {
  font-size: 0.62rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

@media (max-width: 768px) {
  .sec-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .sec-dashboard {
    padding: 0 1rem;
  }
}

@media (max-width: 400px) {
  .sec-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ─── PWA Standalone Mode ─────────────────────────────── */
@media (display-mode: standalone) {
  body {
    overscroll-behavior: none;
    -webkit-user-select: none;
    user-select: none;
  }

  /* Re-enable text selection on content areas */
  .results,
  .result-value,
  .entity-table td,
  .joke-text,
  .joke-punchline,
  .welcome-text,
  .tool-desc,
  textarea,
  input {
    -webkit-user-select: text;
    user-select: text;
  }

  /* Smoother touch interactions */
  .nav-tab,
  .btn,
  .btn-desktop,
  .tool-card,
  .bookmark-item,
  .copy-btn,
  .stat-card {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }

  /* Hide "Desktop App" link in standalone */
  .btn-desktop {
    display: none;
  }

  /* Pull-to-refresh prevention */
  html {
    overscroll-behavior-y: contain;
  }

  /* Safe area insets (only needed in standalone; browser handles its own) */
  .header {
    padding-top: calc(1rem + env(safe-area-inset-top, 0px));
  }

  .footer {
    padding-bottom: calc(2.5rem + env(safe-area-inset-bottom, 0px));
  }

  .toast {
    bottom: calc(2rem + env(safe-area-inset-bottom, 0px));
  }

  .tip-popup {
    bottom: calc(2rem + env(safe-area-inset-bottom, 0px));
  }

  .install-banner {
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
}

/* Standalone + mobile combined */
@media (display-mode: standalone) and (max-width: 768px) {
  .header {
    padding-top: calc(0.5rem + env(safe-area-inset-top, 0px));
  }
}

/* ─── Install Banner (iOS + Android) ─────────────────── */
.install-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border-top: 1px solid var(--spin-purple);
  z-index: 9998;
  transform: translateY(100%);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 -4px 24px rgba(123, 31, 235, 0.2);
}

.install-banner.show {
  transform: translateY(0);
  opacity: 1;
}

.install-banner-content {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px 8px;
}

.install-banner-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--spin-purple), var(--spin-green));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 24px;
  color: white;
  flex-shrink: 0;
}

.install-banner-text {
  flex: 1;
  min-width: 0;
}

.install-banner-text strong {
  display: block;
  color: var(--text-bright);
  font-size: 0.9rem;
  margin-bottom: 2px;
}

.install-banner-text span {
  font-size: 0.75rem;
  color: var(--text-dim);
  line-height: 1.4;
  display: block;
}

.install-banner-close {
  background: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  color: var(--text-dim);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
}

.install-banner-close:hover {
  border-color: var(--text);
  color: var(--text);
}

.install-banner-steps {
  padding: 8px 16px 14px;
  font-size: 0.78rem;
  color: var(--text-dim);
  line-height: 1.6;
}

.install-banner-steps .step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
}

.install-banner-steps .step-num {
  background: var(--spin-purple);
  color: white;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.install-banner-steps .step-icon {
  font-size: 1.1rem;
  display: inline-block;
  vertical-align: middle;
}
