.teaser-ads-root {
  position: fixed;
  z-index: 10980;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.teaser-ads-root[hidden] {
  display: none !important;
}

.teaser-ads-root .teaser-ads-stack {
  pointer-events: auto;
}

.teaser-ads-stack {
  position: fixed;
  z-index: 10981;
  top: calc(var(--site-header-sticky-offset, 96px) + 52px);
  left: max(10px, env(safe-area-inset-left, 0px) + 10px);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  box-sizing: border-box;
  width: 44px;
}

@media (min-width: 1080px) {
  .teaser-ads-stack {
    top: calc(var(--site-header-sticky-offset, 96px) + 10px);
    left: max(16px, env(safe-area-inset-left, 0px) + 16px);
  }
}

/* Как «А»/«Ч»: компактные neo-brutal кнопки 44×40 */
.teaser-ads-fab {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 100%;
  height: 40px;
  padding: 0;
  border: var(--nb-border-w, 2px) solid var(--border, #111);
  border-radius: var(--nb-radius, 4px);
  font-family: var(--nb-font, inherit);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.1;
  cursor: pointer;
  box-shadow: 3px 3px 0 0 var(--border, #111);
  transition:
    background 0.22s ease,
    box-shadow 0.15s ease,
    transform 0.15s ease;
}

.teaser-ads-fab:hover,
.teaser-ads-fab:focus-visible {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 0 var(--border, #111);
}

/* Р — реклама: янтарная (квадрат, как остальные кнопки) */
.teaser-ads-fab--r {
  background: #f59e0b;
  color: #111;
}

.teaser-ads-fab--r:hover,
.teaser-ads-fab--r:focus-visible {
  background: #d97706;
  color: #fff;
}

/* У — услуги/борды: бирюзовая, квадрат с уголками */
.teaser-ads-fab--u {
  background: #0d9488;
  color: #ecfdf5;
  border-radius: 4px;
}

.teaser-ads-fab--u:hover,
.teaser-ads-fab--u:focus-visible {
  background: #0f766e;
  color: #fff;
}

.teaser-ads-panel {
  position: fixed;
  inset: 0;
  z-index: 11020;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.teaser-ads-panel[hidden] {
  display: none !important;
}

.teaser-ads-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.55);
  cursor: pointer;
}

.teaser-ads-dialog {
  position: relative;
  z-index: 1;
  width: min(420px, calc(100vw - 24px));
  max-height: min(80vh, 640px);
  overflow: auto;
  padding: 16px;
  border: var(--nb-border-w, 2px) solid var(--border, #111);
  border-radius: var(--nb-radius, 4px);
  background: var(--card, #fff);
  color: var(--card-foreground, #111);
  box-shadow: 4px 4px 0 0 var(--primary, #f59e0b);
  font-family: var(--nb-font, inherit);
}

/* У — шире под сетку карточек */
.teaser-ads-dialog.is-services {
  width: min(520px, calc(100vw - 24px));
  box-shadow: 4px 4px 0 0 #0d9488;
}

@media (min-width: 768px) {
  .teaser-ads-dialog.is-services {
    width: min(640px, calc(100vw - 32px));
  }
}

@media (min-width: 1080px) {
  .teaser-ads-dialog.is-services {
    width: min(760px, calc(100vw - 40px));
  }
}

.teaser-ads-dialog-kicker {
  display: inline-block;
  margin: 0 0 8px;
  padding: 2px 8px;
  border: var(--nb-border-w, 2px) solid var(--border, #111);
  border-radius: var(--nb-radius, 4px);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--primary, #f59e0b);
  color: var(--primary-foreground, #111);
}

.teaser-ads-dialog.is-services .teaser-ads-dialog-kicker {
  background: #0d9488;
  color: #ecfdf5;
}

.teaser-ads-dialog-lead {
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--muted-foreground, #666);
}

.teaser-ads-dialog h3 {
  margin: 0 0 10px;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--card-foreground, #111);
}

.teaser-ads-dialog p {
  margin: 0 0 12px;
  white-space: pre-wrap;
  line-height: 1.45;
  color: var(--card-foreground, #111);
}

.teaser-ads-dialog img,
.teaser-ads-dialog .teaser-ads-media {
  display: block;
  width: 100%;
  max-height: 240px;
  object-fit: contain;
  margin: 0 0 12px;
  border-radius: var(--nb-radius, 4px);
  border: 1px solid var(--border, #111);
  background: var(--muted, #eee);
}

/* Общие теги */
.teaser-ads-tag {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 2px 7px;
  border: var(--nb-border-w, 2px) solid var(--border, #111);
  border-radius: var(--nb-radius, 4px);
  background: var(--primary, #f59e0b);
  color: var(--primary-foreground, #111);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.teaser-ads-dialog.is-services .teaser-ads-tag {
  background: #0d9488;
  color: #ecfdf5;
}

.teaser-ads-detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 10px;
}

/* Р — список рекламных предложений */
.teaser-ads-offers {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.teaser-ads-offer {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  width: 100%;
  padding: 12px;
  padding-top: 14px;
  text-align: left;
  border: var(--nb-border-w, 2px) solid var(--border, #111);
  border-radius: var(--nb-radius, 4px);
  background: var(--muted, #eee);
  color: var(--card-foreground, #111);
  font: inherit;
  cursor: pointer;
  box-shadow: var(--nb-shadow, 2px 2px 0 0 var(--border, #111));
  overflow: hidden;
}

.teaser-ads-offer:hover,
.teaser-ads-offer:focus-visible {
  background: var(--card, #fff);
  box-shadow: 3px 3px 0 0 var(--border, #111);
  transform: translate(-1px, -1px);
}

.teaser-ads-offer-tags {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
  max-width: 55%;
  pointer-events: none;
}

.teaser-ads-offer-top {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding-right: 0;
  min-width: 0;
}

.teaser-ads-offer:has(.teaser-ads-offer-tags) .teaser-ads-offer-top {
  padding-right: 42%;
}

.teaser-ads-offer-mark {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: var(--nb-border-w, 2px) solid var(--border, #111);
  border-radius: var(--nb-radius, 4px);
  background: var(--primary, #f59e0b);
  color: var(--primary-foreground, #111);
  font-size: 12px;
  font-weight: 800;
}

.teaser-ads-offer-title {
  flex: 1;
  min-width: 0;
  font-weight: 800;
  line-height: 1.3;
  word-break: break-word;
}

.teaser-ads-offer-media {
  display: block;
  width: 100%;
  border: var(--nb-border-w, 2px) solid var(--border, #111);
  border-radius: var(--nb-radius, 4px);
  overflow: hidden;
  background: var(--card, #fff);
}

.teaser-ads-offer-media img {
  display: block;
  width: 100%;
  max-height: 160px;
  object-fit: cover;
  margin: 0;
  border: 0;
}

.teaser-ads-offer-meta {
  display: block;
  font-size: 12px;
  line-height: 1.35;
  color: var(--muted-foreground, #666);
}

/* У — карточки: 2 / 3 / 4 в ряд */
.teaser-ads-boards {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

@media (min-width: 768px) {
  .teaser-ads-boards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
  }
}

@media (min-width: 1080px) {
  .teaser-ads-boards {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.teaser-ads-boards > li {
  min-width: 0;
}

.teaser-ads-board {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  box-sizing: border-box;
  width: 100%;
  min-height: 0;
  padding: 0;
  text-align: center;
  border: var(--nb-border-w, 2px) solid var(--border, #111);
  border-radius: var(--nb-radius, 4px);
  background: var(--muted, #eee);
  color: var(--card-foreground, #111);
  font: inherit;
  cursor: pointer;
  box-shadow: var(--nb-shadow, 2px 2px 0 0 var(--border, #111));
  overflow: hidden;
  transition:
    background 0.2s ease,
    box-shadow 0.15s ease,
    transform 0.15s ease;
}

.teaser-ads-board:not(.has-image) {
  min-height: 110px;
  justify-content: center;
  padding: 28px 10px 12px;
}

.teaser-ads-board:hover,
.teaser-ads-board:focus-visible {
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 0 var(--border, #111);
  background: var(--card, #fff);
}

.teaser-ads-board-tags {
  position: absolute;
  top: 6px;
  left: 50%;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  max-width: calc(100% - 12px);
  transform: translateX(-50%);
  pointer-events: none;
}

.teaser-ads-board-media {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  background: var(--card, #fff);
  border-bottom: var(--nb-border-w, 2px) solid var(--border, #111);
  overflow: hidden;
}

.teaser-ads-board-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  margin: 0;
  border: 0;
}

.teaser-ads-board-title {
  display: block;
  padding: 10px 10px 12px;
  word-break: break-word;
  white-space: normal;
  overflow: visible;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.3;
}

.teaser-ads-board.has-image .teaser-ads-board-title {
  padding-top: 10px;
}

.teaser-ads-board:not(.has-image) .teaser-ads-board-title {
  padding: 0;
}

@media (min-width: 768px) {
  .teaser-ads-board-title {
    font-size: 14px;
  }
}

.teaser-ads-dialog.is-banner {
  box-shadow: 4px 4px 0 0 var(--primary, #f59e0b);
}

.teaser-ads-dialog.is-banner .teaser-ads-dialog-kicker {
  background: var(--primary, #f59e0b);
  color: var(--primary-foreground, #111);
}

.teaser-ads-detail-nav {
  display: flex;
  align-items: center;
  margin: 0 0 12px;
}

.teaser-ads-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  margin: 0;
  padding: 6px 12px;
  border: var(--nb-border-w, 2px) solid var(--border, #111);
  border-radius: var(--nb-radius, 4px);
  background: var(--muted, #eee);
  color: var(--card-foreground, #111);
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.1;
  cursor: pointer;
  box-shadow: var(--nb-shadow, 2px 2px 0 0 var(--border, #111));
  transition:
    background 0.2s ease,
    box-shadow 0.15s ease,
    transform 0.15s ease;
}

.teaser-ads-back:hover,
.teaser-ads-back:focus-visible {
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 0 var(--border, #111);
  background: var(--primary, #f59e0b);
  color: var(--primary-foreground, #111);
  text-decoration: none;
}

.teaser-ads-dialog.is-services .teaser-ads-back:hover,
.teaser-ads-dialog.is-services .teaser-ads-back:focus-visible {
  background: #0d9488;
  color: #ecfdf5;
}

.teaser-ads-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.teaser-ads-actions a,
.teaser-ads-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 7px 12px;
  border: var(--nb-border-w, 2px) solid var(--border, #111);
  border-radius: var(--nb-radius, 4px);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--nb-shadow, 2px 2px 0 0 var(--border, #111));
}

.teaser-ads-actions .is-primary {
  background: var(--primary, #f59e0b);
  color: var(--primary-foreground, #111);
}

.teaser-ads-dialog.is-services .teaser-ads-actions .is-primary {
  background: #0d9488;
  color: #ecfdf5;
}

.teaser-ads-actions .is-secondary {
  background: var(--muted, #e5e5e5);
  color: var(--card-foreground, #111);
}
