/* Container */
.dg-container {
  max-width: 950px;
  margin: 20px auto;
  padding: 0 12px;
  text-align: center;
  position: relative;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial;
}

/* Controls centered */
.dg-controls {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
}

/* Inputs */
.dg-label { font-weight: 600; }
.dg-input, .dg-select {
  padding: 8px 10px;
  width: 220px;
  border-radius: 8px;
  border: 1px solid #ddd;
  text-align: center;
}

/* Buttons */
.dg-btn {
  padding: 10px 18px;
  border: none;
  cursor: pointer;
  border-radius: 999px;
  font-weight: 600;
  transition: all 220ms ease;
  box-shadow: none;
}

/* Primary generate button */
.dg-btn-primary {
  background: #ff9f1c;
  color: #fff;
}
.dg-btn-primary:hover { transform: translateY(-2px); filter: brightness(0.95); }

/* Loader overlay */
.dg-loader-overlay {
  display: none;
  align-items: center;
  justify-content: center;
  position: relative;
  margin: 8px 0;
}
.dg-spinner {
  border: 8px solid rgba(0,0,0,0.08);
  border-top: 8px solid #ff9f1c;
  border-radius: 50%;
  width: 56px;
  height: 56px;
  animation: dg-spin 1s linear infinite;
  margin: 8px auto;
}
@keyframes dg-spin { 0% { transform: rotate(0deg);} 100% { transform: rotate(360deg);} }

/* Grid */
.dg-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 40px;
}

.dg-item {
  text-align: center;
}
.dg-item img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(14,30,37,0.06);
}
.dg-caption {
  margin-top: 8px;
  font-size: 14px;
  color: #222;
  word-break: break-word;
}

/* Empty state */
.dg-empty {
  padding: 30px;
  color: #666;
  font-size: 16px;
}

/* Sentinel */
.dg-sentinel { height: 1px; }

/* Bottom button (Regenerate) - hidden by default */
.dg-bottom-btn {
  position: fixed; /* will be overridden on mobile via media query */
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  bottom: 22px;
  z-index: 9999;
  padding: 10px 22px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  background: rgba(255,159,28,0.18); /* transparent accent */
  color: #fff;
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms ease, transform 300ms ease, background 200ms ease, box-shadow 200ms ease;
  font-weight: 700;
}

/* visible state - fade-in */
.dg-bottom-btn.dg-visible {
  opacity: 0.95;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

/* sticky state when user scrolls up - stronger opaque and shadow */
.dg-bottom-btn.dg-sticky {
  background: rgba(255,159,28,1);
  box-shadow: 0 10px 30px rgba(255,159,28,0.18);
  opacity: 1;
}

/* hover */
dg-bottom-btn:hover {
  transform: translateX(-50%) translateY(-4px);
  box-shadow: 0 14px 40px rgba(255,159,28,0.22);
}

/* Make sure it's hidden for keyboard users until visible */
.dg-bottom-btn[aria-hidden="true"]{ visibility: hidden; }

/* Mobile: inline under grid, not sticky */
@media (max-width: 768px) {
  .dg-grid { grid-template-columns: repeat(2, 1fr); }
  .dg-bottom-btn {
    position: static;
    transform: none;
    margin: 12px auto 30px auto;
    display: inline-block;
    opacity: 1;
    pointer-events: auto;
    background: rgba(255,159,28,0.9);
    visibility: visible !important;
  }
  .dg-bottom-btn.dg-visible { opacity: 1; transform: none; }
  .dg-bottom-btn.dg-sticky { box-shadow: none; }
}

/* small screens adjust inputs */
@media (max-width: 520px) {
  .dg-input, .dg-select { width: 180px; }
  .dg-grid { gap: 10px; }
}
