.ad-bar {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(0, 1fr) minmax(190px, .72fr);
  gap: 12px;
  margin: 0 0 18px;
  overflow: visible;
}

.ad-slot {
  min-width: 0;
  min-height: 116px;
  box-sizing: border-box;
  padding: 18px 20px;
  border: 1px solid #dce3e8;
  border-radius: 16px;
  color: #172033;
  background: rgba(255, 255, 255, .78);
  text-decoration: none;
}

.ad-slot:focus-visible { position: relative; z-index: 2; outline: 3px solid rgba(14, 165, 139, .28); outline-offset: -3px; }
.ad-shop, .ad-reset, .ad-rental { display: flex; align-items: center; gap: 14px; }
.ad-shop:hover, .ad-reset:hover { background: rgba(255, 255, 255, .96); }

.ad-avatar {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  object-fit: cover;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 4px 14px rgba(81, 61, 35, .14);
}

.ad-reset-mark {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid #dce3e8;
  border-radius: 12px;
  color: #087f68;
  background: transparent;
}

.ad-reset-mark svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ad-copy { min-width: 0; }
.ad-title { display: block; color: #172033; font-size: 16px; font-weight: 850; line-height: 1.3; }
.ad-description { display: block; margin: 4px 0 0; color: #607086; font-size: 13px; line-height: 1.35; }

.ad-reset-avatar {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  object-fit: cover;
  object-position: 44% 43%;
  border: 1px solid #dce3e8;
  border-radius: 50%;
  background: #fff7e6;
  box-shadow: 0 4px 14px rgba(81, 61, 35, .1);
}

.ad-rental {
  min-height: 116px;
  margin: 0;
  padding: 18px 20px;
  border: 1.5px dashed #aab6c3;
  border-radius: 16px;
  color: #526173;
  background: rgba(255, 255, 255, .58);
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.ad-rental:hover { border-color: #0ea58b; color: #087f68; background: rgba(255, 255, 255, .94); }
.ad-plus { display: grid; width: 44px; height: 44px; flex: 0 0 auto; place-items: center; border-radius: 50%; color: #fff; background: #f97316; font-size: 28px; line-height: 1; }

.ad-dialog {
  width: min(440px, calc(100% - 32px));
  padding: 0;
  border: 0;
  border-radius: 16px;
  color: #172033;
  background: #fff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, .24);
}

.ad-dialog::backdrop { background: rgba(15, 23, 42, .48); }
.ad-dialog-body { padding: 24px; }
.ad-dialog h2 { margin: 0 0 8px; font-size: 22px; }
.ad-dialog p { margin: 0; color: #607086; font-size: 14px; line-height: 1.65; }
.ad-contact { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 18px; padding: 13px 14px; border-radius: 12px; background: #f1f5f9; }
.ad-contact span { color: #64748b; font-size: 12px; }
.ad-contact strong { display: block; margin-top: 2px; color: #172033; font-size: 17px; font-variant-numeric: tabular-nums; }
.ad-copy-qq, .ad-dialog-close { min-height: 42px; border-radius: 10px; padding: 0 15px; font: inherit; font-size: 13px; font-weight: 800; cursor: pointer; }
.ad-copy-qq { border: 0; color: #fff; background: #f97316; }
.ad-copy-qq:hover { background: #ea580c; }
.ad-dialog-close { width: 100%; margin-top: 12px; border: 1px solid #dbe2e8; color: #334155; background: #fff; }
.ad-dialog-close:hover { background: #f8fafc; }

@media (min-width: 1280px) {
  body {
    --ad-rail-width: clamp(150px, calc((100vw - 956px) / 2 - 18px), 232px);
    --ad-rail-offset: max(14px, calc((100vw - 920px) / 2 - var(--ad-rail-width) - 18px));
  }

  body .wrap,
  body .page-shell {
    max-width: 920px;
  }

  .ad-bar {
    display: block;
    height: 0;
    margin: 0;
    overflow: visible;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .ad-shop,
  .ad-reset,
  .ad-rental {
    position: fixed;
    z-index: 900;
    width: var(--ad-rail-width);
    height: 116px;
    min-height: 116px;
    box-sizing: border-box;
    margin: 0;
    border-radius: 16px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, .1);
    background: rgba(255, 255, 255, .78);
  }

  .ad-shop,
  .ad-reset {
    padding: 16px;
    align-items: center;
    flex-direction: row;
    gap: 12px;
  }

  .ad-shop { left: var(--ad-rail-offset); bottom: 274px; }
  .ad-reset { left: var(--ad-rail-offset); bottom: 146px; }
  .ad-rental {
    left: var(--ad-rail-offset);
    bottom: 18px;
    padding: 16px;
    border: 1.5px dashed #aab6c3;
  }

  .ad-title { font-size: 15px; }
  .ad-description { font-size: 12px; line-height: 1.35; }
}

@media (min-width: 1600px) {
  body .visitor-widget {
    right: var(--ad-rail-offset);
    width: var(--ad-rail-width);
    min-width: 0;
  }
}

@media (max-width: 780px) {
  .ad-bar { grid-template-columns: 1fr; }
  .ad-slot { min-height: 116px; }
  .ad-title { font-size: 16px; }
  .ad-description { font-size: 13px; line-height: 1.35; }
}

@media (max-width: 480px) {
  .ad-slot { padding: 16px; }
  .ad-contact { align-items: stretch; flex-direction: column; }
  .ad-copy-qq { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .ad-slot, .ad-rental, .ad-copy-qq, .ad-dialog-close { transition: none; }
}
