/* ========== DOWNLOAD GATE OVERLAY ========== */
/* Full-screen ad + timer overlay shown before mod download */

.dl-gate-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.75);
  /* PERF: backdrop-filter removed */
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.dl-gate {
  background: var(--color-surface);
  border: var(--border-subtle);
  border-radius: var(--radius-xl);
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
  max-width: 480px;
  width: 92%;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: dl-gate-in 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

@keyframes dl-gate-in {
  from { opacity: 0; transform: scale(0.92) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* Header */
.dl-gate__header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: var(--border-subtle);
  background: linear-gradient(135deg, rgba(var(--accent-r), var(--accent-g), var(--accent-b), 0.06), transparent);
}

.dl-gate__title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--fs-base);
  font-weight: var(--fw-bold);
  margin: 0;
}

.dl-gate__close {
  background: none;
  border: none;
  font-size: var(--fs-lg);
  color: var(--color-text-tertiary);
  cursor: pointer;
  padding: var(--space-1);
  border-radius: var(--radius-sm);
  transition: background 0.2s, color 0.2s;
  line-height: 1;
}

.dl-gate__close:hover {
  background: var(--color-surface-2);
  color: var(--color-text-primary);
}

/* Mod info */
.dl-gate__info {
  padding: var(--space-3) var(--space-5);
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: var(--color-surface-2);
  border-bottom: var(--border-subtle);
}

.dl-gate__info-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 18px;
  flex-shrink: 0;
}

.dl-gate__info-text {
  flex: 1;
  min-width: 0;
}

.dl-gate__mod-name {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dl-gate__platform {
  font-size: var(--fs-xs);
  color: var(--color-text-tertiary);
  text-transform: capitalize;
}

/* Ad container */
.dl-gate__ad {
  width: 100%;
  min-height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-3);
  background: var(--color-surface-2);
  position: relative;
}

.dl-gate__ad-label {
  position: absolute;
  top: var(--space-2);
  right: var(--space-3);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-tertiary);
  opacity: 0.6;
}

/* Timer + progress section */
.dl-gate__timer-section {
  width: 100%;
  padding: var(--space-4) var(--space-5);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
}

/* Circular timer */
.dl-gate__timer {
  position: relative;
  width: 80px;
  height: 80px;
}

.dl-gate__timer-svg {
  transform: rotate(-90deg);
  width: 80px;
  height: 80px;
}

.dl-gate__timer-bg {
  fill: none;
  stroke: var(--color-surface-2);
  stroke-width: 5;
}

.dl-gate__timer-ring {
  fill: none;
  stroke: var(--color-primary);
  stroke-width: 5;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s linear;
  filter: drop-shadow(0 0 4px rgba(var(--accent-r), var(--accent-g), var(--accent-b), 0.4));
}

.dl-gate__timer-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-xl);
  font-weight: var(--fw-bold);
  color: var(--color-primary);
  font-variant-numeric: tabular-nums;
}

.dl-gate__timer-label {
  font-size: var(--fs-xs);
  color: var(--color-text-secondary);
}

/* Progress bar */
.dl-gate__progress {
  width: 100%;
  height: 4px;
  background: var(--color-surface-2);
  border-radius: 4px;
  overflow: hidden;
}

.dl-gate__progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary), var(--color-primary-light));
  border-radius: 4px;
  transition: width 1s linear;
  box-shadow: 0 0 8px rgba(var(--accent-r), var(--accent-g), var(--accent-b), 0.3);
}

/* Download button (hidden until timer ends) */
.dl-gate__download-btn {
  width: 100%;
  padding: var(--space-3) var(--space-5);
  border-top: var(--border-subtle);
}

.dl-gate__download-btn .btn {
  width: 100%;
  font-size: var(--fs-base);
  padding: var(--space-3);
  animation: dl-gate-btn-appear 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes dl-gate-btn-appear {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Pulse animation for ready state */
.dl-gate__timer-text--ready {
  color: #22c55e;
  animation: dl-gate-pulse 1.5s ease infinite;
}

@keyframes dl-gate-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* Dark theme */
[data-theme="dark"] .dl-gate {
  background: var(--color-surface);
  border-color: rgba(129, 140, 248, 0.14);
}

[data-theme="dark"] .dl-gate__ad {
  background: rgba(0, 0, 0, 0.2);
}

/* Responsive */
@media (max-width: 480px) {
  .dl-gate {
    width: 96%;
    border-radius: var(--radius-lg);
  }

  .dl-gate__timer {
    width: 64px;
    height: 64px;
  }

  .dl-gate__timer-svg {
    width: 64px;
    height: 64px;
  }

  .dl-gate__ad {
    min-height: 200px;
  }
}
