/* ========================================================
   THE INTERNET'S MOST UNNECESSARY SEARCH ENGINE
   Design System: Premium Absurdism
   ======================================================== */

:root {
  --bg-dark: #080b13;
  --bg-card: rgba(16, 22, 36, 0.75);
  --bg-card-hover: rgba(24, 33, 54, 0.9);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-active: rgba(99, 102, 241, 0.45);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --accent-primary: #6366f1;
  --accent-glow: rgba(99, 102, 241, 0.35);
  --accent-secondary: #ec4899;
  --accent-cyan: #06b6d4;
  --accent-amber: #f59e0b;
  --accent-emerald: #10b981;
  --accent-rose: #f43f5e;
  --accent-purple: #a855f7;

  --tier-1: #10b981;
  --tier-2: #06b6d4;
  --tier-3: #f59e0b;
  --tier-4: #f97316;
  --tier-5: #ec4899;

  --font-display: 'Outfit', sans-serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-full: 9999px;

  --shadow-glow: 0 0 35px rgba(99, 102, 241, 0.22);
}

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

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-body);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle at 12% 18%, rgba(99, 102, 241, 0.14) 0%, transparent 40%),
    radial-gradient(circle at 88% 62%, rgba(236, 72, 153, 0.12) 0%, transparent 45%),
    radial-gradient(circle at 50% 88%, rgba(6, 182, 212, 0.08) 0%, transparent 50%);
  background-attachment: fixed;
}

/* Ambient noise grid overlay */
.grid-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-size: 44px 44px;
  background-image: 
    linear-gradient(to right, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  z-index: 0;
}

/* Header */
header {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 2.25rem;
  border-bottom: 1px solid var(--border-subtle);
  backdrop-filter: blur(14px);
  background: rgba(8, 11, 19, 0.75);
}

.logo-group {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  text-decoration: none;
}

.radar-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--accent-primary);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 16px var(--accent-glow);
}

.radar-icon::before {
  content: '';
  position: absolute;
  width: 10px;
  height: 10px;
  background: var(--accent-secondary);
  border-radius: 50%;
  animation: radarBlip 2.2s infinite ease-out;
}

.radar-sweep {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0deg, rgba(99, 102, 241, 0.45) 60deg, transparent 75deg);
  animation: radarSpin 3.5s linear infinite;
}

@keyframes radarSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes radarBlip {
  0% { transform: scale(0.6); opacity: 0.9; }
  50% { transform: scale(1.4); opacity: 0.4; }
  100% { transform: scale(0.6); opacity: 0.9; }
}

.logo-text {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #fff 0%, #cbd5e1 50%, var(--accent-primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.badge-tag {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-full);
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.35);
  color: #a5b4fc;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: #94a3b8;
  padding: 0.4rem 0.85rem;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  letter-spacing: 0.06em;
  font-weight: 500;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  background: var(--accent-emerald);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--accent-emerald);
  animation: pulseDot 2.2s infinite ease-in-out;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.75); }
}

.btn-icon {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.09);
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.2);
}

/* Main Container */
main {
  flex: 1;
  position: relative;
  z-index: 5;
  width: 100%;
  max-width: 940px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Hero Section */
.hero-section {
  text-align: center;
  margin-bottom: 2.5rem;
  width: 100%;
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 1.1rem;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.28);
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: #c7d2fe;
  margin-bottom: 1.5rem;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 5.2vw, 3.8rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.035em;
  margin-bottom: 1.1rem;
}

.hero-title span.gradient {
  background: linear-gradient(135deg, #6366f1 0%, #ec4899 50%, #06b6d4 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: clamp(1rem, 2vw, 1.15rem);
  color: var(--text-muted);
  max-width: 580px;
  margin: 0 auto;
  line-height: 1.6;
}

/* Search Box Container */
.search-wrapper {
  width: 100%;
  max-width: 760px;
  margin-bottom: 2rem;
  position: relative;
}

.search-box {
  background: rgba(16, 22, 38, 0.85);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 0.65rem 0.85rem 0.65rem 1.4rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(16px);
}

.search-box:focus-within {
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-glow), 0 14px 45px rgba(0, 0, 0, 0.6);
  transform: translateY(-2px);
}

.search-icon-symbol {
  font-size: 1.25rem;
  color: var(--text-dim);
}

.search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 1.1rem;
  font-family: var(--font-body);
  color: var(--text-main);
  font-weight: 500;
}

.search-input::placeholder {
  color: var(--text-dim);
  font-weight: 400;
}

.search-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-search {
  background: linear-gradient(135deg, var(--accent-primary) 0%, #4f46e5 100%);
  color: white;
  border: none;
  padding: 0.8rem 1.6rem;
  border-radius: var(--radius-md);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 4px 18px var(--accent-glow);
  transition: all 0.2s ease;
}

.btn-search:hover {
  background: linear-gradient(135deg, #7174ff 0%, #5850ec 100%);
  box-shadow: 0 6px 24px rgba(99, 102, 241, 0.5);
  transform: scale(1.02);
}

.btn-search:active {
  transform: scale(0.98);
}

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

.search-meta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.5rem 0;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* Suggestion Chips */
.suggestions-wrap {
  width: 100%;
  max-width: 760px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 2rem;
}

.suggestions-title {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}

.chips-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.55rem;
}

.chip {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 0.45rem 0.95rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chip:hover {
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.35);
  color: var(--text-main);
  transform: translateY(-1px);
}

/* Loading Analysis Sequence */
.loading-box {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border-active);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 760px;
  text-align: center;
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow-glow);
  margin-top: 1rem;
}

.spinner-orbit {
  width: 68px;
  height: 68px;
  border: 3px solid rgba(99, 102, 241, 0.2);
  border-top-color: var(--accent-primary);
  border-right-color: var(--accent-secondary);
  border-radius: 50%;
  animation: spinOrbit 1.2s cubic-bezier(0.5, 0.1, 0.5, 0.9) infinite;
  margin-bottom: 1.5rem;
}

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

.loading-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.loading-subtext {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent-cyan);
  margin-bottom: 1.5rem;
}

.loading-progress-track {
  width: 100%;
  max-width: 380px;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.loading-progress-bar {
  height: 100%;
  width: 15%;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary), var(--accent-cyan));
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
}

/* Results Section */
.results-section {
  display: none;
  flex-direction: column;
  width: 100%;
  max-width: 760px;
  gap: 1.6rem;
  margin-top: 0.5rem;
  animation: fadeIn 0.45s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

/* Dossier Meta Bar */
.dossier-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.dossier-query {
  color: #e2e8f0;
  font-weight: 600;
}

.dossier-engine-pill {
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.12);
  border: 1px solid rgba(6, 182, 212, 0.25);
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
}

/* Results Cards */
.possibilities-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.possibility-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.4rem;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(12px);
}

.possibility-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.16);
  transform: translateX(3px);
}

.possibility-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 4px;
  background: var(--tier-color, var(--accent-primary));
}

.card-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tier-badge-group {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.tier-number {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

.tier-title {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--tier-color, #fff);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.absurdity-badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-muted);
}

.probability-display {
  display: flex;
  align-items: baseline;
  gap: 0.15rem;
  font-family: var(--font-mono);
}

.probability-number {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--tier-color, #fff);
  line-height: 1;
}

.probability-unit {
  font-size: 0.9rem;
  color: var(--text-dim);
}

.possibility-text {
  font-size: 1.02rem;
  line-height: 1.55;
  color: #e2e8f0;
  margin-bottom: 1rem;
}

/* Meter Bar */
.meter-track {
  width: 100%;
  height: 5px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.meter-fill {
  height: 100%;
  width: 0%;
  background: var(--tier-color, var(--accent-primary));
  border-radius: var(--radius-full);
  transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Summary Grid: Recommendation & Uselessness Score */
.summary-grid {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: 1rem;
}

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

.recommendation-box {
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.12) 0%, rgba(99, 102, 241, 0.14) 100%);
  border: 1px solid rgba(236, 72, 153, 0.35);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.rec-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--accent-secondary);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.rec-value {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.35;
  margin-bottom: 0.85rem;
}

.rec-subtext {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Score Card */
.score-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.score-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.5rem;
}

.score-value {
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 800;
  color: var(--accent-cyan);
  line-height: 1;
  margin-bottom: 0.3rem;
}

.score-badge {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: #67e8f9;
  background: rgba(6, 182, 212, 0.12);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-full);
}

/* Actions Bottom Row */
.actions-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.8rem;
  padding-top: 0.5rem;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.22);
  transform: translateY(-1px);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: #1e293b;
  border: 1px solid var(--border-active);
  color: var(--text-main);
  padding: 0.85rem 1.4rem;
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 100;
  pointer-events: none;
}

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

/* Footer */
footer {
  text-align: center;
  padding: 2rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dim);
  border-top: 1px solid var(--border-subtle);
  background: rgba(8, 11, 19, 0.6);
  position: relative;
  z-index: 5;
}

footer a {
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}

footer a:hover {
  color: var(--accent-primary);
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
