@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;700;900&family=Space+Mono:ital,wght@0,400;0,700;1,400&display=swap');

:root {
  --bg-dark: #020617;
  --slate-800: #1e293b;
  --brand-magenta: #ff008a;
  --brand-magenta-alpha: rgba(255, 0, 138, 0.2);
  --brand-magenta-glow: rgba(255, 0, 138, 0.6);
  --brand-magenta-light: #ff66b8;
  --emerald-alert: #00ff00;
  --text-main: #f8fafc;
  --text-muted: #94a3b8; 
  --critical-red: #ef4444;
  --panel-bg: rgba(15, 23, 42, 0.6);

  --font-main: 'Inter', sans-serif;
  --font-terminal: 'Space Mono', monospace;

  /* Maintain original class assignments to avoids breaking logic but remapped styling */
  --accent: var(--brand-magenta);
  --accent-strong: var(--emerald-alert);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-dark);
  /* Fallback */
  color: var(--text-main);
  font-family: var(--font-main);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}

.orbital-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(117, 160, 208, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(117, 160, 208, 0.06) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at center, black 35%, transparent 88%);
  pointer-events: none;
}

.landing-shell,
.scan-shell {
  position: relative;
  min-height: 100vh;
  padding: 24px;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  flex: 1;
}

.scan-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 24px;
  align-items: center;
}

.hud-bar,
.hero-panel {
  width: min(960px, 100%);
}

.hud-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  font-weight: 600;
}

.hud-label {
  color: var(--accent);
}

.landing-shell,
.scan-shell,
.placeholder-shell {
  z-index: 20;
  position: relative;
}

.hero-panel {
  z-index: 20;
  position: relative;
  background: var(--panel-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-top: 1px solid rgba(255, 0, 138, 0.3);
  padding: 3rem;
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8), 0 0 40px rgba(255, 0, 138, 0.05);
  text-align: center;
}

.eyebrow {
  font-family: var(--font-terminal);
  color: var(--brand-magenta);
  font-size: 0.85rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  font-weight: 600;
}

h1 {
  font-family: var(--font-terminal);
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 2px;
  color: #ffffff;
  text-shadow: 0 0 30px rgba(255, 255, 255, 0.1);
  text-transform: uppercase;
  text-align: center;
}

.hero-copy {
  color: #f0f0f0;
  font-size: 1.1rem;
  line-height: 1.6;
  max-width: 600px;
  margin: 1rem auto;
  padding: 0;
  letter-spacing: 0.3px;
}

/* Replace stats appearance */
.status-card {
  display: none;
}

.stats-row {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 2rem;
  font-family: var(--font-terminal);
  font-size: 0.85rem;
  margin-top: 1rem;
}

.stat-box {
  background: transparent;
  border: none;
  padding: 0;
  text-align: center;
}

.stat-kicker {
  display: inline-block;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-right: 5px;
  margin-bottom: 0px;
  text-transform: uppercase;
  font-weight: 600;
}

.stat-box strong {
  font-size: 0.85rem;
  color: var(--text-main);
  font-weight: bold;
}

.cta-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

/* ----- UNIFIED BUTTON SYSTEM ----- */
.primary-cta,
.secondary-cta {
  font-family: var(--font-terminal);
  font-weight: 700;
  letter-spacing: 1.5px;
  cursor: pointer;
  border-radius: 4px;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
  text-transform: uppercase;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-width: 180px;
  min-height: 52px;
  padding: 0 20px;
}

/* Primary: High Impact (Neo Magenta) */
.primary-cta {
  background: rgba(255, 0, 138, 0.1);
  color: var(--brand-magenta);
  border: 1px solid var(--brand-magenta);
  box-shadow: 0 0 15px var(--brand-magenta-glow), inset 0 0 10px rgba(255, 0, 138, 0.1);
}

.primary-cta:hover:not(:disabled) {
  background: rgba(255, 0, 138, 0.2);
  box-shadow: 0 0 30px var(--brand-magenta), inset 0 0 20px rgba(255, 0, 138, 0.2);
  text-shadow: 0 0 8px var(--brand-magenta);
  transform: translateY(-2px);
}

.primary-cta:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  border-color: rgba(255, 0, 138, 0.3);
  color: rgba(255, 0, 138, 0.5);
  box-shadow: none;
}

.button-label {
  position: relative;
  z-index: 1;
}

/* Tertiary: Action (Outline) */
.secondary-cta {
  background: transparent;
  color: var(--brand-magenta);
  border: 1px solid var(--brand-magenta-alpha);
  font-size: 0.9rem;
}

.secondary-cta:hover {
  background: var(--brand-magenta);
  color: white;
  box-shadow: 0 0 20px var(--brand-magenta-glow);
}

.scan-page,
.guard-page {
  min-height: 100vh;
}

.placeholder-shell {
  position: relative;
  min-height: 100vh;
  padding: 24px;
}

/* Radar & Error Paneles (Alineando al Plan) */
.matrix-panel,
.radar-panel,
.placeholder-shell {
  background: var(--panel-bg);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-top: 1px solid rgba(255, 0, 138, 0.3);
  border-radius: 16px;
}

.matrix-panel {
  min-height: 78vh;
  padding: 22px 18px;
}

.panel-label {
  margin: 0 0 16px;
  font-size: 0.72rem;
  color: var(--accent-strong);
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

.matrix-stream {
  color: var(--brand-magenta-light);
}

.matrix-row {
  opacity: 0.75;
}

.radar-panel,
.placeholder-shell {
  padding: 28px;
}

.radar-stage {
  position: relative;
  width: min(70vh, 100%);
  aspect-ratio: 1;
  margin: 0 auto;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    radial-gradient(circle at center, rgba(152, 245, 225, 0.08), transparent 58%),
    rgba(3, 10, 18, 0.7);
  overflow: hidden;
}

.radar-ring,
.radar-axis,
#scan-dots,
.crosshair {
  position: absolute;
}

.radar-ring {
  border: 1px dashed rgba(247, 211, 107, 0.18);
  border-radius: 50%;
}

.ring-a {
  inset: 10%;
}

.ring-b {
  inset: 24%;
}

.ring-c {
  inset: 38%;
}

.radar-axis.horizontal {
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
}

.radar-axis.vertical {
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(255, 255, 255, 0.08);
}

#scan-dots {
  inset: 0;
}

.target-dot {
  background-color: #ef4444;
  box-shadow: 0 0 10px #ef4444;
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.crosshair {
  border: 1px solid var(--brand-magenta);
  box-shadow: 0 0 30px var(--brand-magenta);
  position: absolute;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: left 0.42s ease-out, top 0.42s ease-out, transform 0.42s ease-out;
}

.crosshair::before,
.crosshair::after,
.crosshair .top,
.crosshair .bottom {
  background: var(--brand-magenta);
  content: "";
  position: absolute;
}

.crosshair::before {
  inset: 50% auto auto -14px;
  width: 18px;
  height: 2px;
}

.crosshair::after {
  inset: 50% -14px auto auto;
  width: 18px;
  height: 2px;
}

.crosshair[data-phase="locked"] {
  transform: translate(-50%, -50%) scale(1.12);
}

.low-fps-mode .orbital-grid,
.low-fps-mode .radar-ring.ring-a {
  opacity: 0.18;
}

.low-fps-mode .target-dot,
.low-fps-mode .crosshair {
  box-shadow: none;
}

.scan-readout,
.selection-card {
  margin: 20px auto 0;
  max-width: min(70vh, 100%);
}

.selection-card {
  padding: 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.selection-meta {
  display: block;
  margin-top: 8px;
  color: var(--muted);
}

.placeholder-shell {
  width: min(960px, calc(100% - 48px));
  margin: 24px auto;
  min-height: auto;
}

.placeholder-shell h1 {
  max-width: 14ch;
}

.optin-form {
  display: grid;
  gap: 12px;
  margin-top: 13px;
}

.form-label {
  color: var(--accent-strong);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.form-input {
  min-height: 52px;
  padding: 0 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.checkbox-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  color: var(--muted);
  line-height: 1.45;
  font-size: 0.95rem;
}

.optin-status-card {
  margin-top: 8px;
}

.hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.certificate-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 24px;
  margin-top: 24px;
  align-items: start;
}

.certificate-preview {
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.certificate-preview canvas {
  display: block;
  width: 100%;
  height: auto;
}

.certificate-meta {
  display: grid;
  gap: 16px;
}

.metric-list {
  display: grid;
  gap: 10px;
}

.metric-list div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
}

.metric-list span {
  color: var(--muted);
}

@media (max-width: 760px) {
  .landing-shell {
    padding: 16px;
  }

  .hero-panel {
    padding: 24px;
  }

  .stats-row {
    grid-template-columns: 1fr;
  }

  .hud-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .scan-shell {
    grid-template-columns: 1fr;
  }

  .radar-panel,
  .matrix-panel,
  .placeholder-shell {
    padding: 22px;
  }

  .certificate-layout {
    grid-template-columns: 1fr;
  }

  .brand-logo {
    top: 20px;
    width: 100px;
  }

  .sys-status-left {
    left: 18px;
    top: 24px;
    font-size: 0.68rem;
    letter-spacing: 0.12em;
    max-width: calc(100vw - 150px);
  }
}

/* -------------------------------------------------------------------------- */
/* BACKGROUND EFFECTS & LAYOUTS (From plan files) */
/* -------------------------------------------------------------------------- */

.brand-hud {
  inset: 0;
  pointer-events: none;
  position: absolute;
  z-index: 18;
}

.brand-logo {
  align-items: center;
  display: flex;
  justify-content: center;
  left: 50%;
  position: absolute;
  top: 38px;
  transform: translateX(-50%);
  width: 112px;
  z-index: 12;
}

.brand-logo img {
  display: block;
  height: auto;
  max-height: 46px;
  max-width: 180px;
  width: 100%;
}

.corners {
  position: absolute;
  width: 50px;
  height: 50px;
  border: 2px solid rgba(255, 0, 138, 0.5);
  z-index: 11;
}

.c-tl {
  top: 20px;
  left: 20px;
  border-right: none;
  border-bottom: none;
}

.c-tr {
  top: 20px;
  right: 20px;
  border-left: none;
  border-bottom: none;
}

.c-bl {
  bottom: 20px;
  left: 20px;
  border-right: none;
  border-top: none;
}

.c-br {
  bottom: 20px;
  right: 20px;
  border-left: none;
  border-top: none;
}

.sys-status {
  position: absolute;
  top: 30px;
  font-family: var(--font-terminal);
  font-size: 0.75rem;
  color: var(--brand-magenta);
  letter-spacing: 2px;
  text-transform: uppercase;
  z-index: 12;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.sys-status-left {
  left: 80px;
}

.sys-status-right {
  right: 80px;
  text-align: right;
}

.sys-status-left::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  background-color: var(--emerald-alert);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--emerald-alert);
  animation: blink 1s infinite alternate;
}

@media (max-width: 1200px) {
  .sys-status {
    display: none;
  }
}

@media (max-width: 670px) {
  .corners {
    display: none;
  }
}

@keyframes blink {
  100% {
    opacity: 0.4;
  }
}

.space-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 50% 120%, rgba(255, 0, 138, 0.15) 0%, transparent 60%),
    linear-gradient(to bottom, rgba(2, 6, 23, 1) 0%, rgba(2, 6, 23, 0.8) 100%);
}

.earth-sphere {
  position: absolute;
  bottom: -50vh;
  left: 50%;
  transform: translateX(-50%);
  width: 150vw;
  height: 150vw;
  max-width: 1400px;
  max-height: 1400px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 10%, #0f172a 0%, #020617 80%);
  box-shadow: inset 0 20px 100px rgba(255, 0, 138, 0.2), 0 -5px 50px rgba(255, 0, 138, 0.1);
  border: 1px solid rgba(255, 0, 138, 0.1);
  z-index: 1;
  pointer-events: none;
}

#orbitCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
}

.radar-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(255, 0, 138, 0.2);
  border-radius: 50%;
  z-index: 3;
}

.ring-1 {
  width: 105%;
  height: 105%;
}

.ring-2 {
  width: 115%;
  height: 115%;
  border-style: dashed;
  opacity: 0.5;
  animation: spin 60s linear infinite;
}

@keyframes spin {
  100% {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

.scanning-btn {
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(transparent, rgba(255, 0, 138, 0.4), transparent);
  transform: rotate(45deg);
  animation: scanning-btn 3s linear infinite;
  pointer-events: none;
  z-index: 10;
}

@keyframes scanning-btn {
  0% {
    top: -150%;
  }

  100% {
    top: 150%;
  }
}

/* -------------------------------------------------------------------------- */
/* CONSENT UI */
/* -------------------------------------------------------------------------- */

.consent-bar[hidden] {
  display: none;
}

.consent-bar {
  background: #020617;
  border-top: 1px solid #334155;
  bottom: 0;
  left: 0;
  position: fixed;
  right: 0;
  width: 100%;
  z-index: 95;
}

.consent-bar-inner {
  align-items: center;
  display: flex;
  gap: 0.85rem;
  min-height: 52px;
  padding: 0.62rem 1.1rem calc(0.62rem + env(safe-area-inset-bottom, 0px));
  width: 100%;
}

.consent-copy {
  align-items: center;
  color: #94a3b8;
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  font-size: 0.75rem;
  gap: 0.35rem 0.6rem;
  line-height: 1.25;
  min-width: 0;
}

.consent-bar .consent-title {
  color: #f8fafc;
  font-family: var(--font-terminal);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin: 0;
  text-transform: uppercase;
  white-space: nowrap;
}

.consent-bar .consent-body {
  color: #94a3b8;
  font-size: 0.72rem;
  line-height: 1.25;
  margin: 0;
}

.consent-bar .consent-legal-links {
  color: #94a3b8;
  font-size: 0.7rem;
  margin: 0;
  white-space: nowrap;
}

.consent-bar .consent-legal-links a {
  color: #cbd5e1;
  text-decoration: none;
}

.consent-actions {
  align-items: center;
  display: flex;
  flex-shrink: 0;
  gap: 0.52rem;
}

.consent-bar .consent-btn {
  background: #0f172a;
  border: 1px solid #475569;
  border-radius: 4px;
  color: #f8fafc;
  cursor: pointer;
  font-family: var(--font-terminal);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  min-height: 34px;
  min-width: 118px;
  padding: 0.24rem 0.7rem;
  text-transform: uppercase;
}

.consent-bar .consent-btn:hover {
  border-color: #94a3b8;
}

.consent-bar .consent-btn-accept,
.consent-bar .consent-btn-reject {
  min-width: 132px;
}

.consent-bar .consent-btn-accept {
  background: var(--brand-magenta);
  border-color: var(--brand-magenta);
  color: #ffffff;
  box-shadow: 0 0 0 1px rgba(255, 0, 138, 0.22);
}

.consent-bar .consent-btn-accept:hover {
  border-color: var(--brand-magenta-light);
  background: #ff1f9a;
  color: #ffffff;
}

.consent-bar .consent-btn-reject {
  background: #0b1222;
  border-color: #64748b;
  color: #cbd5e1;
}

.consent-bar .consent-btn-reject:hover {
  border-color: #94a3b8;
  color: #f8fafc;
}

body.consent-visible {
  padding-bottom: 52px;
}

@media (max-width: 520px) {
  .consent-bar-inner {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.5rem;
    min-height: 0;
    padding: 0.55rem 0.65rem calc(0.6rem + env(safe-area-inset-bottom, 0px));
  }

  .consent-copy {
    gap: 0.22rem 0.45rem;
  }

  .consent-actions {
    align-self: stretch;
    justify-content: flex-end;
    width: 100%;
  }

  .consent-btn {
    flex: 1 1 0;
    min-width: 0;
  }
}
