.bg-drifter {
  position: fixed;
  top: 0; 
  left: 0; 
  width: 100vw; 
  height: 100vh;
  z-index: -2;
  background-color: var(--bg-base);
  background-image: url('../bg-fluid.webp');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  filter: blur(8px) brightness(0.5); /* Softened and darkened background image */
  overflow: hidden;
}

/* Base style for the drifting blobs */
.bg-drifter::before,
.bg-drifter::after,
body::before {
  content: '';
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: -1;
  opacity: 0.65;
}

/* Blob 1: Enriched Dark Indigo */
.bg-drifter::before {
  width: 60vw;
  height: 60vw;
  background: radial-gradient(circle, rgba(30, 38, 59, 0.8) 0%, rgba(30, 38, 59, 0) 70%);
  top: -10%;
  left: -10%;
  animation: drift-1 35s ease-in-out infinite alternate;
}

/* Blob 2: Enriched Dark Violet */
.bg-drifter::after {
  width: 70vw;
  height: 70vw;
  background: radial-gradient(circle, rgba(52, 40, 71, 0.8) 0%, rgba(52, 40, 71, 0) 70%);
  bottom: -15%;
  right: -10%;
  animation: drift-2 30s ease-in-out infinite alternate;
}

/* Blob 3: Third smaller plum/violet organic blob */
body::before {
  width: 45vw;
  height: 45vw;
  background: radial-gradient(circle, rgba(35, 29, 51, 0.7) 0%, rgba(35, 29, 51, 0) 70%);
  top: 30%;
  left: 45%;
  animation: drift-3 40s ease-in-out infinite alternate;
}

@keyframes drift-1 {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(8%, 12%) scale(1.1); }
  100% { transform: translate(-4%, -8%) scale(0.95); }
}

@keyframes drift-2 {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-10%, -6%) scale(1.05); }
  100% { transform: translate(6%, 4%) scale(0.9); }
}

@keyframes drift-3 {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(5%, -12%) scale(1.15); }
  100% { transform: translate(-8%, 5%) scale(0.95); }
}

.glass-card {
  /* Extremely low opacity dark fill - lets the background bleed through */
  background: rgba(20, 22, 28, 0.4); 
  border-radius: 32px;
  
  /* Aggressive Blur with Saturation */
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  
  /* The Secret Sauce: Directional Lighting via Borders */
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  border-right: 1px solid rgba(0, 0, 0, 0.4);
  border-bottom: 1px solid rgba(0, 0, 0, 0.6);
  
  /* Multi-layer shadow depth */
  box-shadow: 
    0 32px 64px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.25), 
    inset 0 0 0 1px rgba(255, 255, 255, 0.06),
    inset 0 -1px 12px rgba(0, 0, 0, 0.15);
  
  padding: 32px;
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.glass-card:hover {
  transform: translateY(-2px);
  /* Brighter shadows and borders on hover */
  box-shadow: 
    0 40px 80px rgba(0, 0, 0, 0.7),
    inset 0 1px 0 rgba(255, 255, 255, 0.35), 
    inset 0 0 0 1px rgba(255, 255, 255, 0.12),
    inset 0 -1px 12px rgba(0, 0, 0, 0.2);
  border-top-color: rgba(255, 255, 255, 0.25);
  border-left-color: rgba(255, 255, 255, 0.15);
}

.glass-card.primary {
  /* Slightly more solid for the hero card, but still highly translucent */
  background: rgba(30, 34, 42, 0.5);
}

/* Soft accent glow behind primary/hero cards */
.glass-card.primary::before {
  content: '';
  position: absolute;
  top: 10%;
  left: 10%;
  right: 10%;
  bottom: 10%;
  background: radial-gradient(circle, rgba(var(--accent-rgb), 0.18) 0%, rgba(var(--accent-rgb), 0) 70%);
  z-index: -1;
  pointer-events: none;
  filter: blur(50px);
  border-radius: 32px;
}

.result-number {
  font-size: clamp(64px, 12vw, 120px);
  font-weight: 700;
  line-height: 1.1;
  color: var(--text-primary);
  display: block;
  letter-spacing: -0.03em;
  max-width: 100%;
  overflow-wrap: break-word;
}

.result-label {
  font-size: 13px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  display: block;
  margin-bottom: 12px;
  font-weight: 500;
}

/* Unified Drop Zone & Workspace */
.drop-zone {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 40px; border: 2px dashed rgba(255, 255, 255, 0.1);
  border-radius: 24px; background: rgba(255, 255, 255, 0.02);
  cursor: pointer; transition: all 0.2s ease;
  width: 100%; box-sizing: border-box;
}

.drop-zone:hover { 
  background: rgba(255, 255, 255, 0.06); 
  border-color: var(--accent); 
  box-shadow: 0 0 24px rgba(var(--accent-rgb), 0.1);
}

#workspace { display: none; margin-top: 32px; text-align: left; }

.status-panel { 
  margin-top: 32px; padding: 24px; border-radius: 20px; 
  background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.05); text-align: center; 
}

/* Standardized Glass Components */
:root {
  --glass-bg: rgba(255, 255, 255, 0.03);
  --glass-border: 1px solid rgba(255, 255, 255, 0.1);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

/* The Professional Action Button */
.btn-action {
  background: var(--accent); color: white; border: none;
  padding: 14px 28px; border-radius: 16px; font-weight: 700;
  cursor: pointer; transition: all 0.2s ease;
  box-shadow: 0 4px 15px rgba(var(--accent-rgb), 0.3);
}
.btn-action:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(var(--accent-rgb), 0.5); }

/* Glass Inputs */
.glass-input {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 14px 18px;
  color: white;
  font-size: 15px;
  width: 100%;
  transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.glass-input:focus { 
  background: rgba(0, 0, 0, 0.6); 
  border-color: var(--accent); 
  box-shadow: 0 0 0 4px rgba(var(--accent-rgb), 0.15);
  outline: none; 
}

/* Glass Dropdown / Select */
.glass-select {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 14px 18px;
  color: white;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 1em;
  transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.glass-select:focus {
  background: rgba(0, 0, 0, 0.6);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(var(--accent-rgb), 0.15);
  outline: none;
}
/* Glass Control Bar */
.control-bar {
  background: rgba(0, 0, 0, 0.2);
  padding: 16px;
  border-radius: 16px;
  border: var(--glass-border);
  margin-bottom: 20px;
}

.control-label {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  margin-bottom: 12px;
  text-align: center;
}

/* Styling for Cropper Preset Buttons */
.preset-row { 
  display: flex; gap: 10px; margin-bottom: 20px; overflow-x: auto; 
  justify-content: center; padding: 5px;
}

.btn-preset {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  padding: 8px 16px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-preset:hover {
  background: var(--accent);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(var(--accent-rgb), 0.3);
}

/* Add active state styling */
.btn-preset.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
/* Responsive Grid Logic */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  width: 100%;
}

/* Card Internals */
.bento-card {
  display: flex;
  flex-direction: column;
  padding: 24px;
  text-decoration: none;
  color: inherit;
  box-sizing: border-box; /* Prevents padding from blowing out the width */
}

/* Ensure images/icons scale */
.bento-card .icon-wrapper {
  margin-bottom: 16px;
}

/* Related Tools Grid & Cards */
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-top: 16px;
}
.related-card {
  text-decoration: none;
  color: inherit;
  padding: 16px;
  text-align: center;
  font-size: 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  transition: border-color 0.2s ease;
}

/* Strictly Mobile-Responsive Overrides */
@media (max-width: 1024px) {
  .bento-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .span-2x2 {
    grid-column: span 2 !important;
    grid-row: span 2 !important;
  }
  .span-2x1 {
    grid-column: span 2 !important;
    grid-row: span 1 !important;
  }
}

@media (max-width: 768px) {
  /* Reset spacing and widths of wrappers on mobile */
  .tool-wrapper,
  .category-wrapper,
  .bento-container {
    width: 100% !important;
    max-width: 100% !important;
    margin: 24px auto !important;
    padding: 0 12px !important;
  }

  /* Scale padding of glass cards down */
  .glass-card {
    padding: 16px !important;
    border-radius: 20px !important;
    width: 100% !important;
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.4) !important;
  }

  /* Force bento grids, editor layouts, and other custom grids to stack */
  .bento-grid,
  .editor-layout,
  .calc-grid,
  .stats-row,
  .input-grid,
  .preset-row {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  /* Reset spans on mobile grids to prevent horizontal overflow */
  .span-2x2,
  .span-2x1,
  .span-1x1,
  [class*="span-"] {
    grid-column: span 1 !important;
    grid-row: span 1 !important;
  }

  /* Force all inputs to fit within parent cards */
  .glass-input,
  .glass-select,
  input,
  textarea,
  select {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  /* Adjust typography sizes */
  .result-number {
    font-size: clamp(36px, 10vw, 64px) !important;
  }
}

/* ==========================================================================
   Premium Interaction & Animation Pass
   ========================================================================== */

/* 1. Tool card hover & icon scale */
a.glass-card {
  transition: transform 0.2s ease, box-shadow 0.3s ease, border-color 0.2s ease, background-color 0.2s ease !important;
}
a.glass-card:hover {
  box-shadow: 
    0 40px 80px rgba(0, 0, 0, 0.7),
    0 0 24px rgba(124, 156, 255, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.35), 
    inset 0 0 0 1px rgba(255, 255, 255, 0.12),
    inset 0 -1px 12px rgba(0, 0, 0, 0.2) !important;
}

a.glass-card .icon-wrapper svg,
a.glass-card .icon-circle svg,
a.glass-card svg:not(.faq-icon) {
  transition: transform 0.2s ease;
}
a.glass-card:hover .icon-wrapper svg,
a.glass-card:hover .icon-circle svg,
a.glass-card:hover svg:not(.faq-icon) {
  transform: scale(1.08);
}

/* 2. Click/active state tactile feedback */
a.glass-card:active,
.btn-action:active,
.btn-preset:active,
button:active {
  transform: scale(0.98) !important;
  transition: transform 0.1s ease !important;
}

/* 3. Button and input glow on focus */
input:focus,
select:focus,
textarea:focus,
.glass-input:focus,
.glass-select:focus {
  outline: none !important;
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px rgba(124, 156, 255, 0.15) !important;
}

/* 4. Result-number pulse animation */
@keyframes pulseScale {
  0% {
    opacity: 0.3;
    transform: scale(0.97);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}
.pulse-animate {
  animation: pulseScale 0.2s ease-out forwards;
}