/* CSS Variables */
:root {
  --bg: #0b0b0d;
  --bg-soft: #121216;
  --card: #16161c;
  --border: rgba(255, 255, 255, 0.06);
  --text: #e8e8ee;
  --muted: #a1a1b3;
  --accent: #b48cff; /* light purple */
  --accent-soft: rgba(180, 140, 255, 0.15);
  --radius: 14px;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: radial-gradient(1200px 600px at 50% -20%, rgba(180, 140, 255, 0.08), transparent 60%), var(--bg);
  color: var(--text);
  line-height: 1.45;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 20px 80px;
}

/* Header */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-radius: var(--radius);
  background: var(--bg-soft);
  border: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #0b0b0d;
  font-weight: 900;
}

nav {
  display: flex;
  align-items: center;
  gap: 18px;
}

nav a {
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
}

.nav-cta {
  padding: 8px 14px;
  border-radius: 10px;
  background: var(--accent);
  color: #0b0b0d;
  font-weight: 700;
}

/* Hero */
.hero {
  margin-top: 64px;
  text-align: center;
}

.hero h1 {
  font-size: 44px;
  line-height: 1.05;
  margin: 0 0 16px;
  letter-spacing: -0.03em;
}

.hero p {
  max-width: 720px;
  margin: 0 auto 32px;
  color: var(--muted);
  font-size: 17px;
}

.hero-actions {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}

.btn-primary {
  padding: 14px 22px;
  border-radius: 12px;
  background: linear-gradient(180deg, #d5c3ff, var(--accent));
  color: #0b0b0d;
  font-weight: 800;
  text-decoration: none;
  transition: transform 0.3s ease, box-shadow 0.3s ease; /* Smooth transition */
}

.btn-primary:hover {
  transform: translateY(-5px); /* Lift effect */
  box-shadow: 0 4px 15px rgba(180, 140, 255, 0.5); /* Light purple glow */
}

.btn-secondary {
  padding: 14px 22px;
  border-radius: 12px;
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  background: transparent;
  transition: transform 0.3s ease, box-shadow 0.3s ease; /* Smooth transition */
}

.btn-secondary:hover {
  transform: translateY(-5px); /* Lift effect */
  box-shadow: 0 4px 15px rgba(255, 255, 255, 0.5); /* White glow */
}

/* Minimal tool flex layout */
.tools {
  margin-top: 80px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: space-between;
}

.tool {
  padding: 20px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--border);
  flex: 1 1 calc(20% - 16px);
  height: 130px; /* Fixed height for rectangular shape */
  transition: transform 0.3s ease, box-shadow 0.3s ease; /* Smooth transition */
}

.tool:hover {
  transform: translateY(-5px); /* Lift effect */
  box-shadow: 0 4px 15px rgba(180, 140, 255, 0.5); /* Light purple glow */
}

/* Apply hover animation via class */
.tool.hover-animation {
  transform: translateY(-5px); /* Lift effect */
  box-shadow: 0 4px 15px rgba(180, 140, 255, 0.5); /* Light purple glow */
}

.tools a {
  text-decoration: none;
  color: inherit;
  display: block;
  height: 100%;
  width: 100%;
}

.tools .tool {
  cursor: pointer;
}

.tool h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.tool p {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

/* Auth */
.auth-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 80vh;
  margin-top: 60px; /* Space from the header */
    margin-bottom: 60px;
}

.auth-card {
  background: var(--card);
  padding: 32px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: 0 4px 25px rgba(180, 140, 255, 0.5);
  width: 100%;
  max-width: 400px;
}

h1 {
  text-align: center;
  color: var(--text);
  margin-bottom: 24px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  color: var(--text);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-soft);
  color: var(--text);
}

.form-input:focus {
  outline: none;
  border: 1px solid var(--accent);
  box-shadow: 0 0 5px rgba(180, 140, 255, 0.8);
  transition: box-shadow 0.3s ease;
}

.btn {
  width: 100%;
  margin-top: 12px;
}

.btn-link {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
}

/* Footer */
footer {
  margin-top: 100px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 640px) {
  nav { display: none; }
  .hero h1 { font-size: 32px; }
}

.spf-good {
  color: #6ee7b7;
  font-weight: 600;
}

.spf-bad {
  color: #fb7185;
  font-weight: 600;
}

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

/* ================= RESULT STATUS HELPERS ================= */

.result-card {
  background: var(--card-bg, #111);
  border-radius: 12px;
  padding: 16px;
  margin-top: 16px;
}

.result-good {
  border-left: 4px solid #22c55e;
}

.result-warn {
  border-left: 4px solid #f59e0b;
}

.result-bad {
  border-left: 4px solid #ef4444;
}

.result-title {
  font-weight: 700;
  font-size: 18px;
  margin-bottom: 6px;
}

.result-sub {
  opacity: 0.75;
  font-size: 14px;
}

.result-row {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 14px;
}

.container.wide {
  max-width: 1400px;
}

.auth-card.wide-card {
  max-width: 1300px;
}

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

.result-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.result-row-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 16px;
}

@media (max-width: 900px) {
  .result-row-split {
    grid-template-columns: 1fr;
  }
}

/* ======================
   OUTPUT SYSTEM
   ====================== */

.output-container {
  background: #0f1115;
  border: 1px solid #1e2230;
  border-radius: 10px;
  padding: 20px;
  margin-top: 24px;
}

.output-section {
  margin-bottom: 16px;
}

.output-title {
  font-weight: 600;
  margin-bottom: 6px;
}

.output-muted {
  opacity: 0.75;
  font-size: 14px;
  line-height: 1.4;
}

/* ======================
   OUTPUT CTA (FINAL – CENTERED)
   ====================== */

/* Positioning context */
.output-wrapper {
  position: relative;
}

.gated-content {
  position: relative;
}

/* Blur only gated content */
.output-blurred > *:not(.output-overlay) {
  filter: blur(8px);
  pointer-events: none;
  user-select: none;
}

/* Overlay – CENTERED (safe now) */
.output-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;        /* center vertically */
  justify-content: center;    /* center horizontally */
  backdrop-filter: blur(2px);
}

/* Vertical CTA stack */
.cta-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 300px;
}

/* CTA card */
.output-cta {
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(18, 18, 18, 0.92);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  text-align: center;
}

/* CTA text */
.output-cta-text {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.25;
}

/* Button stack */
.output-cta > div {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Buttons – compact but tappable */
.output-cta .btn {
  padding: 5px 8px;
  font-size: 10.5px;
  border-radius: 7px;
}

/* User CTA is secondary by hierarchy */
.cta-stack .output-cta:last-child {
  opacity: 0.85;
}

/* Inline User CTA spacing (FULL state only) */
.inline-user-cta {
  margin-top: 18px;
}

.script-tool .output-overlay {
  align-items: flex-start;     /* push CTA to top */
  padding-top: 16px;           /* spacing from top */
}

/* ======================
   TOOL OUTPUT SAFETY
   ====================== */

.tool {
  max-width: 100%;
  overflow: hidden;
}

/* Handle long records / blobs */
.tool pre,
.result-card pre {
  max-width: 100%;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.45;
}

/* Lists with long strings */
.tool ul,
.tool li {
  max-width: 100%;
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* Defensive span handling */
.tool span {
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* Prevent flex children from overflowing */
.output-wrapper,
.gated-content {
  max-width: 100%;
}

.auth-card .tool {
  height: auto;
}