/* AgriForeX — Page /app redirection intelligente */
:root {
  --dl-bg: #020a04;
  --dl-card: rgba(0, 43, 2, 0.52);
  --dl-border: rgba(255, 255, 255, 0.1);
  --dl-text: #f7faf8;
  --dl-muted: #8fa896;
  --dl-accent: #63a800;
  --dl-accent-2: #8fd029;
  --dl-emerald: #34d399;
  --dl-radius: 1.5rem;
  --dl-shadow: 0 40px 100px -30px rgba(0, 0, 0, 0.75);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body.page-download-shell {
  margin: 0;
  min-height: 100dvh;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--dl-bg);
  color: var(--dl-text);
  overflow-x: hidden;
}

.dl-aurora {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
  contain: strict;
}

.dl-aurora span {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.55;
  animation: dl-float 16s ease-in-out infinite;
  will-change: transform;
}

.dl-aurora span:nth-child(1) {
  width: 55vw;
  height: 55vw;
  max-width: 520px;
  max-height: 520px;
  top: -15%;
  right: -10%;
  background: #4a8f00;
}

.dl-aurora span:nth-child(2) {
  width: 45vw;
  height: 45vw;
  max-width: 420px;
  max-height: 420px;
  bottom: -10%;
  left: -12%;
  background: #1a5c00;
  animation-delay: -5s;
}

.dl-aurora span:nth-child(3) {
  width: 30vw;
  height: 30vw;
  max-width: 280px;
  max-height: 280px;
  top: 40%;
  left: 35%;
  background: #63a800;
  animation-delay: -9s;
  opacity: 0.35;
}

@keyframes dl-float {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  33% {
    transform: translate(-20px, 24px) scale(1.05);
  }
  66% {
    transform: translate(18px, -16px) scale(0.96);
  }
}

.dl-grid-bg {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: clamp(32px, 5vw, 56px) clamp(32px, 5vw, 56px);
  mask-image: radial-gradient(ellipse 90% 80% at 50% 20%, black 10%, transparent 75%);
  pointer-events: none;
  z-index: 0;
}

.dl-shell-inner {
  position: relative;
  z-index: 1;
  isolation: isolate;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.dl-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: max(1rem, env(safe-area-inset-top)) clamp(1rem, 4vw, 2rem) 0.75rem;
  max-width: 76rem;
  margin: 0 auto;
  width: 100%;
}

.dl-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: inherit;
}

.dl-brand-logo {
  width: clamp(2rem, 5vw, 2.5rem);
  height: clamp(2rem, 5vw, 2.5rem);
  border-radius: 0.7rem;
  object-fit: contain;
  flex-shrink: 0;
}

.dl-brand-name {
  font-weight: 800;
  font-size: clamp(1rem, 2.5vw, 1.15rem);
  letter-spacing: -0.03em;
}

.dl-home-link {
  font-size: clamp(0.8rem, 2vw, 0.9rem);
  color: var(--dl-muted);
  text-decoration: none;
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.dl-home-link:hover {
  color: #fff;
  border-color: var(--dl-border);
  background: rgba(255, 255, 255, 0.04);
}

.dl-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 3vw, 2rem) clamp(1rem, 4vw, 2rem) max(2rem, env(safe-area-inset-bottom));
}

.dl-layout {
  width: min(100%, 26rem);
  display: flex;
  flex-direction: column;
  gap: 0;
  align-items: stretch;
  margin: 0 auto;
}

@media (min-width: 1024px) {
  .dl-layout {
    width: min(100%, 68rem);
    display: grid;
    grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
    gap: clamp(2rem, 4vw, 3.5rem);
    align-items: center;
  }
}

.dl-visual {
  display: none;
}

@media (min-width: 1024px) {
  .dl-visual {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: dl-rise 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
  }
}

.dl-showcase {
  position: relative;
  width: 100%;
  max-width: 300px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.dl-showcase-glow {
  position: absolute;
  inset: 10% 0 20%;
  background: radial-gradient(ellipse 70% 60% at 50% 45%, rgba(99, 168, 0, 0.45), transparent 70%);
  filter: blur(24px);
  pointer-events: none;
  z-index: 0;
}

.dl-device {
  position: relative;
  z-index: 1;
  width: 100%;
  padding: 0.55rem;
  border-radius: 2.35rem;
  background: linear-gradient(165deg, #0a2e08 0%, #041a04 50%, #020a04 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow:
    0 40px 80px -24px rgba(0, 0, 0, 0.85),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 1px 0 rgba(255, 255, 255, 0.08) inset;
}

.dl-device-bezel {
  position: relative;
  border-radius: 1.85rem;
  overflow: hidden;
  background: #000;
  aspect-ratio: 9 / 19.5;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dl-device-island {
  position: absolute;
  top: 0.55rem;
  left: 50%;
  transform: translateX(-50%);
  width: 28%;
  height: 0.55rem;
  border-radius: 999px;
  background: #000;
  z-index: 2;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.9);
}

.dl-device-logo {
  width: 42%;
  height: auto;
  object-fit: contain;
  border-radius: 1.5rem;
}

.dl-card {
  position: relative;
  border-radius: clamp(1.25rem, 3vw, var(--dl-radius));
  padding: clamp(1.25rem, 3.5vw, 2rem);
  background: var(--dl-card);
  border: 1px solid var(--dl-border);
  box-shadow: var(--dl-shadow);
  backdrop-filter: blur(24px) saturate(140%);
  animation: dl-rise 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.08s both;
  overflow: hidden;
}

.dl-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(143, 208, 41, 0.45), rgba(99, 168, 0, 0.15), transparent 55%);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  pointer-events: none;
}

@keyframes dl-rise {
  from {
    opacity: 0;
    transform: translateY(22px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dl-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  font-size: clamp(0.68rem, 2vw, 0.75rem);
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: rgba(99, 168, 0, 0.16);
  color: #c8f090;
  border: 1px solid rgba(143, 208, 41, 0.28);
  margin-bottom: 1rem;
}

.dl-badge svg {
  flex-shrink: 0;
}

.dl-title {
  font-size: clamp(1.55rem, 4.5vw, 2.35rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.04em;
  margin: 0 0 0.75rem;
  background: linear-gradient(180deg, #fff 0%, #b8d4b0 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.dl-subtitle {
  margin: 0 0 1.35rem;
  color: var(--dl-muted);
  font-size: clamp(0.92rem, 2.2vw, 1.02rem);
  line-height: 1.65;
}

.dl-progress-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  margin: 0.5rem 0 1.35rem;
}

.dl-progress-ring {
  --p: 0;
  position: relative;
  isolation: isolate;
  width: clamp(4.5rem, 14vw, 5.75rem);
  height: clamp(4.5rem, 14vw, 5.75rem);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--dl-accent) calc(var(--p) * 1%), rgba(255, 255, 255, 0.07) 0);
  box-shadow: 0 0 40px -10px rgba(99, 168, 0, 0.8);
}

.dl-progress-ring::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: calc(100% - 12px);
  height: calc(100% - 12px);
  border-radius: 50%;
  background: #041a04;
  z-index: 0;
}

.dl-progress-ring svg {
  position: relative;
  z-index: 1;
  color: #c8f090;
}

.dl-countdown {
  font-size: clamp(0.85rem, 2vw, 0.95rem);
  color: #cbd5e1;
  text-align: center;
}

.dl-countdown strong {
  color: #fff;
}

.dl-store-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: flex-start;
}

.dl-store-row--center {
  justify-content: center;
}

.dl-store-badge {
  display: inline-flex;
  line-height: 0;
  border-radius: 0.65rem;
  overflow: hidden;
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.22s ease;
  box-shadow: 0 8px 24px -8px rgba(0, 0, 0, 0.65);
}

.dl-store-badge:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 16px 36px -10px rgba(0, 0, 0, 0.75);
}

.dl-store-badge img {
  display: block;
  width: auto;
  height: clamp(44px, 11vw, 54px);
  max-width: min(100%, 220px);
}

.dl-store-badge--apple img {
  height: clamp(40px, 10vw, 48px);
}

.dl-store-section-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #64748b;
  margin: 0 0 0.65rem;
}

.dl-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.12), transparent);
  margin: 1.25rem 0;
}

.dl-manual {
  margin: 1rem 0 0;
  text-align: center;
  font-size: clamp(0.78rem, 2vw, 0.85rem);
  color: #64748b;
}

.dl-manual a {
  color: #c8f090;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.dl-qr-wrap {
  display: flex;
  justify-content: center;
  margin: 0.25rem 0 1rem;
}

.dl-qr-frame {
  padding: 0.85rem;
  border-radius: 1.25rem;
  background: #fff;
  box-shadow:
    0 24px 60px -24px rgba(0, 0, 0, 0.65),
    0 0 0 1px rgba(255, 255, 255, 0.08);
}

.dl-qr-frame canvas,
.dl-qr-frame img {
  display: block;
  width: clamp(180px, 52vw, 220px);
  height: auto;
}

.dl-qr-hint {
  margin: 0 0 1.1rem;
  text-align: center;
  font-size: clamp(0.82rem, 2vw, 0.92rem);
  color: var(--dl-muted);
  line-height: 1.5;
}

.dl-hidden {
  display: none !important;
}

.dl-features {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
  margin-top: 1.35rem;
  padding-top: 1.15rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.dl-feature {
  text-align: center;
  font-size: clamp(0.65rem, 1.8vw, 0.74rem);
  color: var(--dl-muted);
  line-height: 1.35;
  padding: 0.55rem 0.35rem;
  border-radius: 0.85rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.dl-feature-icon {
  display: block;
  margin: 0 auto 0.35rem;
  color: #8fd029;
}

@media (max-width: 1023px) {
  .dl-aurora span {
    filter: blur(72px);
    opacity: 0.32;
    animation-duration: 24s;
  }

  .dl-aurora span:nth-child(3) {
    display: none;
  }
}

@media (max-width: 519px) {
  .dl-features {
    grid-template-columns: 1fr;
  }

  .dl-feature {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    text-align: left;
    padding: 0.65rem 0.75rem;
  }

  .dl-feature-icon {
    margin: 0;
  }

  .dl-store-row {
    flex-direction: column;
    align-items: center;
    gap: 0.85rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dl-aurora span,
  .dl-card,
  .dl-visual {
    animation: none;
  }

  .dl-aurora span {
    opacity: 0.22;
  }

  .dl-store-badge:hover {
    transform: none;
  }
}
