/* ============================================================
   Ad layer for iclist.zack-studio.com
   Purely additive: touches nothing outside .ad-* and one
   desktop media query that turns <body> into a 2-column grid.
   ============================================================ */

/* ---------- side rail ---------- */

.ad-rail {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 20px 44px;
}

.ad-box {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 11px 12px 12px;
  margin: 0 0 14px;
  overflow: hidden;
}
.ad-box[hidden] { display: none; }

.ad-label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 9px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .11em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.ad-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.ad-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  overflow: hidden;
  border-radius: 8px;
  background: var(--surface-2);
}
.ad-slot > * { max-width: 100%; }
.ad-slot iframe { border: 0; display: block; max-width: 100%; }
.ad-slot-banner { min-height: 50px; }

/* collapsed until the network fills it (no empty "Sponsored" shells) */
.ad-box.is-empty,
.ad-box.is-pending { display: none; }

/* ---------- sponsored links, banner tiles ---------- */

.ad-stack {
  display: grid;
  gap: 8px;
}

.ad-banner {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: 62px;
  padding: 9px 11px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background:
    linear-gradient(135deg, rgba(79, 70, 229, .07), rgba(79, 70, 229, 0) 62%),
    var(--surface);
  color: var(--text);
  text-decoration: none;
  overflow: hidden;
  transition: border-color .12s ease, transform .12s ease, box-shadow .12s ease;
}
.ad-banner:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px -10px rgba(79, 70, 229, .5);
}
.ad-banner-top {
  display: flex;
  align-items: center;
  gap: 6px;
}
.ad-banner-tag {
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: .09em;
  padding: 1px 5px;
  border-radius: 4px;
  color: #fff;
  background: var(--primary);
}
.ad-banner-host {
  font-size: 10px;
  color: var(--text-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ad-banner-title {
  font-size: 13.5px;
  font-weight: 650;
  letter-spacing: -.01em;
  line-height: 1.25;
}

/* ---------- desktop: content + sticky rail ---------- */

@media (min-width: 1080px) {
  body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    column-gap: 4px;
    max-width: 1160px;
    margin: 0 auto;
  }
  .wrap { margin: 0 auto; }
  .ad-rail {
    max-width: none;
    margin: 0;
    padding: 32px 20px 40px 0;
    position: sticky;
    top: 0;
    align-self: start;
  }
}

/* ---------- sponsored popup (rewarded) ---------- */

.ad-pop {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(12, 14, 20, .58);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
.ad-pop[hidden] { display: none; }

.ad-pop-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 420px;
  max-height: calc(100vh - 32px);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 30px 70px -24px rgba(0, 0, 0, .55);
  overflow: hidden;
  animation: ad-pop-in .18s ease-out;
}
@keyframes ad-pop-in {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
  to   { opacity: 1; transform: none; }
}

.ad-pop-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.ad-pop-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .11em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.ad-pop-host {
  margin-left: auto;
  font-size: 10.5px;
  color: var(--text-faint);
  overflow-wrap: anywhere;
}
.ad-pop-timer {
  font-size: 11.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--primary);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 2px 9px;
}

.ad-pop-frame {
  position: relative;
  flex: 1 1 auto;
  min-height: 300px;
  max-height: 62vh;
  background: var(--surface-2);
  display: flex;
}
.ad-pop-frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: transparent;
}

.ad-pop-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px 14px;
  border-top: 1px solid var(--border);
}

.ad-pop-cta {
  flex: 1 1 auto;
  text-align: center;
  text-decoration: none;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 650;
  padding: 11px 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  transition: background .12s ease, color .12s ease, border-color .12s ease;
}
.ad-pop-cta:hover:not(:disabled) { background: var(--primary-hover); }
.ad-pop-cta:disabled {
  background: var(--surface-2);
  color: var(--text-muted);
  border-color: var(--border);
  cursor: default;
}
.ad-pop-cta.is-done { background: var(--success); }
.ad-pop-cta.is-done:hover { background: var(--success); }

.ad-pop-open {
  flex: 0 0 auto;
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
  background: var(--surface);
  white-space: nowrap;
}
.ad-pop-open:hover { color: var(--text); border-color: var(--text-muted); }

body.ad-locked { overflow: hidden; }

/* ---------- small screens ---------- */

@media (max-width: 1079px) {
  .ad-rail { padding-bottom: 52px; }
}
@media (max-width: 520px) {
  .ad-rail { padding: 0 14px 40px; }
  .ad-pop { padding: 10px; }
  .ad-pop-frame { min-height: 280px; max-height: 56vh; }
  .ad-pop-open { padding: 9px 10px; font-size: 11.5px; }
}

/* ---------- gutter banners (wide screens only) ---------- */

.ad-gutter {
  display: none;
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 150px;
  z-index: 5;
  flex-direction: column;
  gap: 10px;
}
.ad-gutter-left { left: 18px; }
.ad-gutter-right { right: 18px; }

/* taller, banner-shaped tiles for the gutters */
.ad-gutter .ad-banner {
  min-height: 110px;
  justify-content: flex-end;
  padding: 10px;
  text-align: center;
  align-items: center;
}
.ad-gutter .ad-banner-title {
  font-size: 12.5px;
  line-height: 1.3;
}
.ad-gutter .ad-gutter-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-faint);
  text-align: center;
  margin-bottom: 2px;
}

@media (min-width: 1520px) {
  .ad-gutter { display: flex; }
}
