/* Nanba Toolkit — Responsive & Blogger-Compatible Ad Widgets CSS */
.nanba-ad-widget {
  box-sizing: border-box;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  margin-right: auto;
  padding: 8px 12px 10px;
  border: 1px solid #e2eaf4;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 4px 14px rgba(20, 40, 64, 0.04);
  overflow: hidden;
  max-width: 100%;
}

.nanba-ad-widget[hidden] {
  display: none !important;
}

.nanba-ad-badge {
  display: inline-block;
  margin: 0 0 6px;
  padding: 1px 8px;
  font: 700 9px/1.3 Inter, system-ui, -apple-system, sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #7b8da4;
  background: #f4f8fc;
  border-radius: 999px;
}

/* 2-Ad Side-by-Side Horizontal Banner Grid */
.nanba-ad-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
  align-items: center;
}

.nanba-ad-slot-item {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  width: 100%;
}

.nanba-ad-slot-item.nanba-ad-slot-2 {
  border-left: 1px solid #e2eaf4;
  padding-left: 12px;
}

.nanba-ad-link,
.nanba-ad-media {
  display: block;
  width: 100%;
  text-align: center;
  text-decoration: none;
  line-height: 0;
}

.nanba-ad-img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  border: 0;
  border-radius: 8px;
  object-fit: contain;
}

/* 0. Top Scrolling Ad Ticker Bar */
.nanba-scrolling-bar {
  box-sizing: border-box;
  width: 100%;
  background: linear-gradient(90deg, #f5b100, #ffc107, #f5b100);
  color: #111827;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  overflow: hidden;
  position: relative;
  z-index: 30;
  padding: 8px 0;
  font: 700 14px/1.35 Inter, system-ui, -apple-system, sans-serif;
}

.nanba-scrolling-link {
  display: block;
  color: #111827;
  text-decoration: none;
  width: 100%;
}

.nanba-scrolling-link:hover {
  text-decoration: underline;
}

.nanba-scrolling-track {
  display: inline-flex;
  align-items: center;
  gap: 48px;
  white-space: nowrap;
  padding-left: 100%;
  animation: nanba-marquee 24s linear infinite;
}

.nanba-scrolling-bar:hover .nanba-scrolling-track {
  animation-play-state: paused;
}

.nanba-scrolling-item {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.nanba-scrolling-icon {
  height: 22px;
  width: auto;
  border-radius: 4px;
  object-fit: contain;
  vertical-align: middle;
}

@keyframes nanba-marquee {
  0% { transform: translateX(0); }
  100% { transform: translateX(-100%); }
}

/* 1 & 2. Top Banner & Bottom Banner (2-Ad Row) */
.nanba-ad-placement-topBanner {
  width: 100%;
  max-width: 1240px;
  margin: 4px auto 20px;
}

.nanba-ad-placement-bottomBanner {
  width: 100%;
  max-width: 1240px;
  margin: 28px auto 18px;
}

.nanba-ad-placement-topBanner .nanba-ad-img,
.nanba-ad-placement-bottomBanner .nanba-ad-img {
  max-height: 96px;
}

/* 5 & 6. Homepage Banner & Internal Pages Banner (2-Ad Row) */
.nanba-ad-placement-homepageBanner,
.nanba-ad-placement-internalPages {
  width: 100%;
  max-width: 1240px;
  margin: 24px auto;
}

.nanba-ad-placement-homepageBanner .nanba-ad-img,
.nanba-ad-placement-internalPages .nanba-ad-img {
  max-height: 96px;
}

/* 3 & 4. Left Rail & Right Rail (160x600) */
.nanba-ad-placement-leftRail,
.nanba-ad-placement-rightRail {
  width: 172px;
  max-width: 100%;
  margin: 12px auto;
  padding: 6px;
}

.nanba-ad-placement-leftRail .nanba-ad-img,
.nanba-ad-placement-rightRail .nanba-ad-img {
  width: 160px;
  max-width: 100%;
  max-height: 600px;
}

/* Fixed Desktop Rails on Nanba Toolkit Website */
.nanba-ad-rail-fixed {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 20;
  margin: 0;
}

.nanba-ad-rail-fixed.nanba-ad-placement-leftRail {
  left: max(12px, calc((100vw - 1240px) / 2 - 186px));
}

.nanba-ad-rail-fixed.nanba-ad-placement-rightRail {
  right: max(12px, calc((100vw - 1240px) / 2 - 186px));
}

@media (max-width: 1620px) {
  .nanba-ad-rail-fixed {
    display: none !important;
  }
}

@media (max-width: 1024px) {
  .nanba-ad-placement-leftRail,
  .nanba-ad-placement-rightRail {
    display: none !important;
  }
}

@media (max-width: 768px) {
  .nanba-ad-widget {
    padding: 6px 8px;
    border-radius: 10px;
  }
  .nanba-ad-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .nanba-ad-slot-item.nanba-ad-slot-2 {
    border-left: 0;
    border-top: 1px solid #e2eaf4;
    padding-left: 0;
    padding-top: 8px;
  }
  .nanba-ad-placement-topBanner {
    margin: 6px auto 16px;
  }
  .nanba-ad-placement-bottomBanner,
  .nanba-ad-placement-homepageBanner,
  .nanba-ad-placement-internalPages {
    margin: 18px auto;
  }
  .nanba-scrolling-bar {
    font-size: 13px;
    padding: 7px 0;
  }
}
