/* === Design Tokens === */
:root {
  --bg-gradient: radial-gradient(circle at top left, #1b2333 0, #050816 45%, #050816 100%);
  --bg-card: rgba(15, 23, 42, 0.92);
  --bg-card-soft: rgba(15, 23, 42, 0.85);
  --bg-elevated: rgba(15, 23, 42, 0.98);
  --bg-input: rgba(15, 23, 42, 0.85);
  --border-subtle: rgba(148, 163, 184, 0.25);
  --shadow-soft: 0 18px 45px rgba(15, 23, 42, 0.65);
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-pill: 999px;

  --accent-primary: linear-gradient(135deg, #facc15, #f97316);
  --accent-primary-soft: rgba(250, 204, 21, 0.22);
  --accent-banana: linear-gradient(135deg, #fde047, #facc15);
  --accent-mango: linear-gradient(135deg, #f97316, #facc15);
  --accent-orange: linear-gradient(135deg, #fb923c, #f97316);

  --text-main: #e5e7eb;
  --text-soft: #9ca3af;
  --text-muted: #6b7280;
  --text-strong: #f9fafb;

  --danger: #f97373;
  --success: #4ade80;

  --nav-height: 72px;
}

[data-theme='light'] {
  --bg-gradient: radial-gradient(circle at top left, #eff6ff 0, #e5e7eb 40%, #e5e7eb 100%);
  --bg-card: rgba(255, 255, 255, 0.9);
  --bg-card-soft: rgba(255, 255, 255, 0.85);
  --bg-elevated: rgba(255, 255, 255, 0.96);
  --bg-input: rgba(249, 250, 251, 0.96);
  --border-subtle: rgba(148, 163, 184, 0.35);
  --text-main: #111827;
  --text-soft: #4b5563;
  --text-muted: #6b7280;
  --text-strong: #020617;
  --shadow-soft: 0 18px 45px rgba(15, 23, 42, 0.15);
}

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

html,
body {
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Inter', 'SF Pro Text', sans-serif;
  color: var(--text-main);
  background: #020617;
}

body {
  min-height: 100vh;
  background-image: var(--bg-gradient);
  background-attachment: fixed;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
}

main {
  min-height: calc(100vh - var(--nav-height) - 80px);
}

/* === Layout Shell === */
.afd-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.afd-shell-inner {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3.5rem;
}

@media (min-width: 1024px) {
  .afd-shell-inner {
    padding: 2rem 0 4rem;
  }
}

/* === Navbar === */
.afd-nav {
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(18px);
  background: linear-gradient(to bottom, rgba(15, 23, 42, 0.94), rgba(15, 23, 42, 0.82));
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.afd-nav-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.afd-nav-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.afd-logo-mark {
  width: 34px;
  height: 34px;
  border-radius: 14px;
  background-image: conic-gradient(from 180deg, #facc15, #f97316, #22c55e, #facc15);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.9), 0 18px 30px rgba(15, 23, 42, 0.8);
}

.afd-logo-mark span {
  font-size: 0.9rem;
  font-weight: 700;
  color: #0b1120;
}

.afd-nav-title {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.afd-nav-title-main {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.afd-nav-title-sub {
  font-size: 0.75rem;
  color: var(--text-soft);
}

.afd-nav-links {
  display: none;
  align-items: center;
  gap: 1.5rem;
  font-size: 0.9rem;
}

.afd-nav-link {
  position: relative;
  color: var(--text-soft);
  padding: 0.25rem 0;
}

.afd-nav-link::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0;
  height: 2px;
  border-radius: 999px;
  background-image: var(--accent-primary);
  transition: width 0.22s ease;
}

.afd-nav-link:hover {
  color: var(--text-main);
}

.afd-nav-link:hover::after {
  width: 100%;
}

.afd-nav-cta {
  display: none;
  align-items: center;
  gap: 0.75rem;
}

.afd-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border-radius: var(--radius-pill);
  padding: 0.5rem 1.1rem;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(15, 23, 42, 0.85);
  color: var(--text-main);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.afd-button-primary {
  border: none;
  padding: 0.6rem 1.4rem;
  background-image: var(--accent-primary);
  color: #111827;
  box-shadow: 0 14px 35px rgba(248, 250, 252, 0.12);
}

.afd-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.65);
  border-color: rgba(248, 250, 252, 0.4);
}

.afd-button-primary:hover {
  box-shadow: 0 18px 48px rgba(234, 179, 8, 0.35);
}

.afd-nav-theme-toggle {
  width: 38px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.55);
  background: rgba(15, 23, 42, 0.9);
  padding: 2px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  cursor: pointer;
  position: relative;
}

.afd-nav-theme-thumb {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: linear-gradient(135deg, #facc15, #f97316);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.45);
  transform: translateX(0);
  transition: transform 0.2s ease;
}

body[data-theme='light'] .afd-nav-theme-thumb {
  transform: translateX(14px);
  background: linear-gradient(135deg, #22c55e, #2dd4bf);
}

.afd-nav-theme-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px;
  font-size: 0.55rem;
  color: rgba(148, 163, 184, 0.8);
  pointer-events: none;
}

.afd-nav-mobile-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(15, 23, 42, 0.8);
  cursor: pointer;
}

.afd-nav-mobile-toggle span {
  width: 14px;
  height: 1.5px;
  background: var(--text-main);
  border-radius: 999px;
  position: relative;
}

.afd-nav-mobile-toggle span::before,
.afd-nav-mobile-toggle span::after {
  content: '';
  position: absolute;
  left: 0;
  width: 14px;
  height: 1.5px;
  background: var(--text-main);
  border-radius: 999px;
}

.afd-nav-mobile-toggle span::before {
  top: -4px;
}

.afd-nav-mobile-toggle span::after {
  top: 4px;
}

.afd-nav-mobile-panel {
  display: none;
}

@media (min-width: 768px) {
  .afd-nav-links {
    display: flex;
  }
}

@media (min-width: 900px) {
  .afd-nav-cta {
    display: flex;
  }

  .afd-nav-mobile-toggle {
    display: none;
  }
}

/* === Mobile Nav Panel === */
@media (max-width: 899px) {
  .afd-nav-mobile-panel {
    display: none;
    border-bottom: 1px solid rgba(148, 163, 184, 0.28);
    background: rgba(15, 23, 42, 0.96);
  }

  .afd-nav-mobile-panel.open {
    display: block;
  }

  .afd-nav-mobile-inner {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0.5rem 1.25rem 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
  }

  .afd-nav-mobile-links {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
  }

  .afd-nav-mobile-link {
    padding: 0.45rem 0;
    font-size: 0.9rem;
    color: var(--text-soft);
  }

  .afd-nav-mobile-link span {
    opacity: 0.7;
  }

  .afd-nav-mobile-link-strong {
    color: var(--text-main);
    font-weight: 500;
  }
}

/* === Hero === */
.afd-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr);
  gap: 2rem;
  align-items: center;
  margin-top: 2.1rem;
}

.afd-hero-copy-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.18rem 0.45rem;
  border-radius: 999px;
  background: var(--bg-card-soft);
  border: 1px solid var(--border-subtle);
  font-size: 0.7rem;
  color: var(--text-soft);
  margin-bottom: 0.85rem;
}

.afd-hero-eyebrow-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background-image: var(--accent-primary);
  color: #111827;
  font-weight: 600;
  font-size: 0.65rem;
}

.afd-hero-heading {
  font-size: clamp(2.1rem, 3vh + 2.1rem, 3.2rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
  margin-bottom: 0.75rem;
}

.afd-hero-highlight {
  background-image: var(--accent-primary);
  -webkit-background-clip: text;
  color: transparent;
}

.afd-hero-subtitle {
  font-size: 0.95rem;
  max-width: 32rem;
  color: var(--text-soft);
  margin-bottom: 1.4rem;
}

/* Larger hero variant for professional landing */
.afd-hero--large {
  margin-top: 2.6rem;
  padding: 1.6rem;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255,255,255,0.02), transparent 40%);
  border: 1px solid rgba(148,163,184,0.06);
}

.afd-hero-inner {
  max-width: 760px;
}

.afd-highlight,
.afd-hero-highlight {
  background-image: var(--accent-primary);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.afd-hero-ctas {
  display: flex;
  gap: 0.8rem;
  margin-top: 1rem;
  align-items: center;
}

.afd-cta { padding: 0.7rem 1.2rem; font-size: 0.95rem; }

.afd-button-ghost {
  background: transparent;
  border: 1px solid rgba(148,163,184,0.12);
  color: var(--text-main);
}

.afd-hero-visual {
  border-radius: 14px;
  min-height: 220px;
  background: radial-gradient(circle at 10% 20%, rgba(250,204,21,0.06), transparent 25%),
              radial-gradient(circle at 80% 80%, rgba(249,115,22,0.05), transparent 30%);
  box-shadow: var(--shadow-soft);
}

.afd-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1.35rem;
}

.afd-hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.afd-hero-meta-item span:first-child {
  display: block;
  color: var(--text-soft);
}

.afd-hero-meta-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background-image: var(--accent-primary);
  box-shadow: 0 0 0 4px rgba(250, 204, 21, 0.1);
  margin-right: 0.4rem;
}

.afd-hero-visual {
  position: relative;
  display: none;
}

@media (min-width: 960px) {
  .afd-hero {
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.2fr);
  }
  .afd-hero-visual {
    display: block;
  }
}

.afd-hero-card {
  position: relative;
  border-radius: 26px;
  padding: 1.6rem 1.5rem;
  background: radial-gradient(circle at top left, rgba(250, 250, 250, 0.16), rgba(15, 23, 42, 0.96));
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.afd-hero-card-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1.05fr);
  gap: 1.25rem;
}

.afd-hero-card-pill {
  font-size: 0.65rem;
  border-radius: 999px;
  padding: 0.25rem 0.65rem;
  background: rgba(15, 23, 42, 0.85);
  color: var(--text-soft);
  border: 1px solid rgba(148, 163, 184, 0.35);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-bottom: 0.8rem;
}

.afd-hero-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.afd-hero-chip {
  font-size: 0.68rem;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.4);
  color: var(--text-soft);
}

.afd-hero-progress {
  margin-top: 0.4rem;
}

.afd-hero-progress-bar {
  height: 5px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.9);
  overflow: hidden;
}

.afd-hero-progress-fill {
  height: 100%;
  border-radius: 999px;
  background-image: var(--accent-primary);
  width: 86%;
}

.afd-hero-stats {
  display: grid;
  gap: 0.5rem;
  font-size: 0.72rem;
  color: var(--text-soft);
}

.afd-hero-stat-label {
  display: flex;
  justify-content: space-between;
}

.afd-hero-stat-value {
  font-weight: 500;
  color: var(--text-main);
}

.afd-hero-orbit {
  position: absolute;
  inset: -20%;
  opacity: 0.4;
  filter: blur(24px);
  background:
    radial-gradient(circle at 10% 20%, rgba(250, 204, 21, 0.16), transparent 55%),
    radial-gradient(circle at 75% 18%, rgba(251, 146, 60, 0.2), transparent 60%),
    radial-gradient(circle at 40% 80%, rgba(34, 197, 94, 0.18), transparent 55%);
  pointer-events: none;
}

.afd-hero-fruits {
  position: relative;
  display: grid;
  gap: 0.6rem;
}

.afd-hero-fruit-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.75rem;
  border-radius: 0.9rem;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.afd-hero-fruit-meta {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.78rem;
}

.afd-hero-fruit-tag {
  font-size: 0.7rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.4);
  color: var(--text-soft);
}

.afd-hero-fruit-score {
  font-size: 0.82rem;
  font-weight: 600;
}

.afd-hero-fruit-score-badge {
  font-size: 0.7rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: rgba(22, 163, 74, 0.1);
  color: #4ade80;
  border: 1px solid rgba(74, 222, 128, 0.5);
}

/* === Fruit Selection Cards === */
.afd-section {
  margin-top: 3rem;
}

.afd-section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 1.35rem;
}

.afd-section-title {
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.afd-section-subtitle {
  font-size: 0.9rem;
  color: var(--text-soft);
}

.afd-card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.4rem;
  max-width: 1120px;
  margin: 0 auto;
  align-items: stretch;
}

@media (min-width: 640px) {
  .afd-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.1rem;
  }
}

@media (min-width: 1024px) {
  .afd-card-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.6rem;
  }
}

.afd-fruit-card {
  position: relative;
  border-radius: 16px;
  padding: 1.25rem;
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(15,23,42,0.02));
  border: 1px solid var(--border-subtle);
  box-shadow: 0 10px 30px rgba(2,6,23,0.45);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.22s cubic-bezier(.2,.9,.3,1), box-shadow 0.22s ease, border-color 0.18s ease;
  min-height: 240px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.afd-fruit-card::before {
  /* larger, more visible fruit emblem sitting behind content */
  content: '';
  position: absolute;
  top: -18px;
  right: -6px;
  font-size: 8.6rem; /* bigger so the fruit is clearly visible */
  line-height: 1;
  display: block;
  pointer-events: none;
  opacity: 0.32; /* visible by default */
  transform: rotate(-12deg) translateZ(0);
  transition: opacity 180ms ease, transform 180ms ease;
  filter: none; /* keep crisp */
  z-index: 0;
}

.afd-fruit-card--banana::before {
  content: "🍌";
  color: rgba(250, 204, 21, 0.42);
}

.afd-fruit-card--mango::before {
  content: "🥭";
  color: rgba(249, 115, 22, 0.42);
}

.afd-fruit-card--orange::before {
  content: "🍊";
  color: rgba(251, 146, 60, 0.42);
}

.afd-fruit-card:hover {
  transform: translateY(-6px) scale(1.01);
  border-color: rgba(248, 250, 252, 0.6);
  box-shadow: 0 30px 70px rgba(2,6,23,0.45);
}

.afd-fruit-card:hover::before {
  opacity: 0.72; /* much stronger on hover */
  transform: rotate(-8deg) translateY(-6px) scale(1.08);
}

/* Ensure content sits above the emblem */
.afd-fruit-card > * {
  position: relative;
  z-index: 1;
}

.afd-fruit-chip-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.7rem;
  font-size: 0.68rem;
  color: var(--text-soft);
}

.afd-fruit-type-pill {
  padding: 0.14rem 0.55rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.35);
}

.afd-fruit-latency-pill {
  padding: 0.14rem 0.55rem;
  border-radius: 999px;
  background: rgba(22, 163, 74, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.5);
  color: #4ade80;
}

.afd-fruit-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.55rem;
}

.afd-fruit-title {
  font-size: 1.15rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.afd-fruit-icon {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  box-shadow: 0 8px 22px rgba(2,6,23,0.16);
  border: 1px solid rgba(2,6,23,0.06);
  background: transparent; /* remove filled colored box */
}
.afd-fruit-icon--banana,
.afd-fruit-icon--mango,
.afd-fruit-icon--orange {
  background-image: none;
}
  background-image: var(--accent-mango);
}

.afd-fruit-icon--orange {
  background-image: var(--accent-orange);
}

.afd-fruit-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.65rem;
  font-size: 0.78rem;
  color: var(--text-soft);
}

.afd-fruit-footer strong {
  color: var(--text-main);
}

.afd-fruit-footer button,
.afd-fruit-footer .afd-button {
  font-size: 0.86rem;
  padding: 0.6rem 0.9rem;
  border-radius: 12px;
}

/* Make CTA button more prominent on cards */
.afd-fruit-footer .afd-button-primary {
  padding: 0.6rem 1rem;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(249,115,22,0.12);
}

@media (max-width: 639px) {
  .afd-fruit-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 0.6rem;
  }
  .afd-fruit-footer .afd-button {
    width: 100%;
  }
}

/* === Detection Upload Module === */
.afd-upload-layout {
  margin-top: 2.5rem;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr);
  gap: 1.4rem;
}

@media (min-width: 900px) {
  .afd-upload-layout {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.1fr);
  }
}

/* Light-theme overrides for components that rely on dark rgba colors */
[data-theme='light'] .afd-nav {
  background: linear-gradient(to bottom, var(--bg-elevated), rgba(255,255,255,0.94));
  border-bottom: 1px solid rgba(2,6,23,0.04);
}

[data-theme='light'] .afd-nav-inner {
  background: transparent;
}

[data-theme='light'] .afd-fruit-card {
  box-shadow: 0 10px 30px rgba(2,6,23,0.06);
  border: 1px solid rgba(2,6,23,0.06);
}

[data-theme='light'] .afd-hero-copy-eyebrow {
  background: var(--bg-card-soft);
  border: 1px solid rgba(2,6,23,0.04);
  color: var(--text-soft);
}

[data-theme='light'] .afd-hero-visual {
  box-shadow: 0 12px 30px rgba(2,6,23,0.06);
}

.afd-upload-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.2rem;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-soft);
}

.afd-upload-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.9rem;
}

.afd-upload-title {
  font-size: 0.95rem;
  font-weight: 500;
}

.afd-upload-badge {
  font-size: 0.68rem;
  padding: 0.16rem 0.5rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  color: var(--text-soft);
}

.afd-upload-dropzone {
  position: relative;
  border-radius: var(--radius-md);
  border: 1px dashed rgba(148, 163, 184, 0.7);
  background: radial-gradient(circle at top left, rgba(15, 23, 42, 0.4), rgba(15, 23, 42, 0.96));
  padding: 1.4rem 1.1rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.12s ease;
}

.afd-upload-dropzone:hover {
  border-color: rgba(248, 250, 252, 0.7);
  transform: translateY(-1px);
}

.afd-upload-dropzone.afd-upload-dropzone--active {
  border-color: rgba(234, 179, 8, 0.9);
  background: radial-gradient(circle at top left, rgba(250, 204, 21, 0.2), rgba(15, 23, 42, 0.96));
}

.afd-upload-icon {
  width: 42px;
  height: 42px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.7rem;
  background-image: var(--accent-primary);
  color: #111827;
  box-shadow: 0 14px 30px rgba(250, 204, 21, 0.3);
}

.afd-upload-maintext {
  font-size: 0.9rem;
  margin-bottom: 0.15rem;
}

.afd-upload-subtext {
  font-size: 0.78rem;
  color: var(--text-soft);
}

.afd-upload-subtext span {
  color: rgba(250, 204, 21, 0.9);
}

.afd-upload-input {
  display: none;
}

.afd-upload-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.7rem;
  font-size: 0.78rem;
  color: var(--text-soft);
}

.afd-upload-filename {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 210px;
}

.afd-upload-actions {
  display: flex;
  gap: 0.5rem;
}

.afd-upload-actions button {
  font-size: 0.78rem;
}

.afd-upload-cta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  margin-top: 1.1rem;
}

.afd-upload-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.afd-upload-preview-card {
  background: var(--bg-card-soft);
  border-radius: var(--radius-md);
  border: 1px solid rgba(148, 163, 184, 0.35);
  padding: 0.75rem;
  margin-top: 0.85rem;
  display: none;
}

.afd-upload-preview-card.visible {
  display: block;
}

.afd-upload-preview-thumb {
  border-radius: 0.75rem;
  overflow: hidden;
  max-height: 340px;
}

.afd-upload-preview-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.55rem;
  font-size: 0.75rem;
  color: var(--text-soft);
}

/* === Detection Result Card (generic shell; used on webcam/about pages etc.) === */
.afd-result-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1rem;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-soft);
}

.afd-result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.8rem;
}

.afd-result-title {
  font-size: 0.95rem;
  font-weight: 500;
}

.afd-result-pill {
  font-size: 0.72rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  color: var(--text-soft);
}

.afd-result-empty {
  padding: 0.85rem;
  border-radius: 0.9rem;
  border: 1px dashed rgba(148, 163, 184, 0.5);
  font-size: 0.8rem;
  color: var(--text-soft);
}

.afd-result-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.afd-result-item {
  padding: 0.9rem 0.95rem;
  border-radius: 1rem;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.35);
  font-size: 0.9rem;
  line-height: 1.6;
}

/* === Toasts & Validation === */
.afd-toast-layer {
  position: fixed;
  bottom: 1.4rem;
  right: 1.2rem;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.afd-toast {
  min-width: 230px;
  max-width: 320px;
  padding: 0.75rem 0.9rem;
  border-radius: 0.9rem;
  background: rgba(15, 23, 42, 0.98);
  border: 1px solid rgba(148, 163, 184, 0.5);
  box-shadow: 0 18px 35px rgba(15, 23, 42, 0.9);
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  font-size: 0.78rem;
}

.afd-toast-icon {
  font-size: 1rem;
}

.afd-toast-message strong {
  display: block;
  margin-bottom: 0.1rem;
}

.afd-toast--error {
  border-color: rgba(248, 113, 113, 0.7);
}

.afd-toast--success {
  border-color: rgba(74, 222, 128, 0.7);
}

/* === Loading Overlay === */
.afd-loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

.afd-loading-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.afd-loading-card {
  border-radius: 16px;
  padding: 1.1rem 1.2rem;
  background: radial-gradient(circle at top left, rgba(248, 250, 252, 0.07), rgba(15, 23, 42, 0.98));
  border: 1px solid rgba(148, 163, 184, 0.75);
  box-shadow: 0 25px 60px rgba(15, 23, 42, 0.9);
  min-width: 260px;
}

.afd-loading-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.7rem;
}

.afd-spinner {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 2px solid rgba(148, 163, 184, 0.45);
  border-top-color: rgba(250, 204, 21, 0.95);
  animation: afd-spin 0.8s linear infinite;
}

.afd-loading-title {
  font-size: 0.9rem;
  font-weight: 500;
}

.afd-loading-sub {
  font-size: 0.75rem;
  color: var(--text-soft);
}

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

/* === Footer === */
.afd-footer {
  margin-top: auto;
  border-top: 1px solid rgba(148, 163, 184, 0.18);
  padding: 1.35rem 1.25rem 1.75rem;
  color: var(--text-soft);
  font-size: 0.78rem;
}

.afd-footer-inner {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  justify-content: space-between;
  align-items: center;
}

.afd-footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.afd-footer-link {
  color: var(--text-soft);
}

.afd-footer-link:hover {
  color: var(--text-main);
}

/* === Sections: About & Contact (Home) === */
.afd-two-col {
  margin-top: 3rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.4rem;
}

@media (min-width: 900px) {
  .afd-two-col {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.05fr);
  }
}

.afd-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-soft);
  padding: 1.1rem 1.1rem 1.25rem;
}

.afd-card-title {
  font-size: 0.98rem;
  font-weight: 500;
  margin-bottom: 0.6rem;
}

.afd-card-body {
  font-size: 0.82rem;
  color: var(--text-soft);
  line-height: 1.6;
}

.afd-contact-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.afd-contact-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
}

.afd-badge-soft {
  font-size: 0.7rem;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.4);
  color: var(--text-soft);
}

/* === Webcam / Live Detection Layout === */
.afd-live-layout {
  margin-top: 2.5rem;
  display: grid;
  grid-template-columns: minmax(0, 1.3fr);
  gap: 1.4rem;
}

@media (min-width: 900px) {
  .afd-live-layout {
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1.05fr);
  }
}

.afd-live-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 1rem;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-soft);
}

.afd-live-video-wrapper {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: radial-gradient(circle at top, rgba(15, 23, 42, 0.5), rgba(15, 23, 42, 1));
}

.afd-live-video-wrapper::after {
  content: 'Live camera stream';
  position: absolute;
  left: 0.75rem;
  top: 0.7rem;
  font-size: 0.7rem;
  color: rgba(229, 231, 235, 0.8);
  background: rgba(15, 23, 42, 0.8);
  padding: 0.15rem 0.4rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.5);
}

.afd-live-video {
  width: 100%;
  height: auto;
  display: block;
}

.afd-live-footer {
  margin-top: 0.65rem;
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-soft);
}

.afd-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  margin-right: 0.35rem;
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.18);
}

/* === Simple Utility === */
.afd-text-muted {
  color: var(--text-muted);
}

.afd-text-soft {
  color: var(--text-soft);
}

.afd-pill-inline {
  padding: 0.08rem 0.5rem;
  border-radius: 999px;
  font-size: 0.68rem;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.4);
}

