* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: var(--w);
  height: var(--h);
  overflow: hidden;
  background: var(--bg, #12080a);
}

.ad {
  position: relative;
  width: var(--w);
  height: var(--h);
  overflow: hidden;
  background: #14080c;
  color: #f6f1ea;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.loader {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #12080a;
  transition: opacity 0.35s ease;
}

.loader span {
  width: 22px;
  height: 22px;
  border: 1.5px solid rgba(201, 164, 92, 0.28);
  border-top-color: #e7c98a;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.ad.is-ready .loader { opacity: 0; pointer-events: none; }

.stage {
  position: absolute;
  top: 0;
  left: 0;
  overflow: hidden;
  background: #14080c;
}

.ad--portrait .stage { width: 100%; height: 400px; }
.ad--banner .stage { width: 200px; height: 100%; }

.frame {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.frame.is-on { opacity: 1; z-index: 1; }

.frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  display: block;
  -webkit-user-drag: none;
  pointer-events: none;
}

.drape {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    repeating-linear-gradient(90deg, rgba(231, 201, 138, 0.05) 0 1px, transparent 1px 8px),
    linear-gradient(180deg, #3a1824 0%, #1c0c12 46%, #12080a 100%);
  box-shadow: inset 0 -22px 28px rgba(0, 0, 0, 0.35);
  transform: translateY(0);
  transition: transform 1s cubic-bezier(0.7, 0.02, 0.25, 1);
  pointer-events: none;
}

.stage.is-open .drape { transform: translateY(-101%); }

.mark {
  text-align: center;
  transform: translateY(-8px);
}

.mark-word {
  display: block;
  color: #e7c98a;
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  font-size: 28px;
  line-height: 1;
}

.mark-line {
  display: block;
  margin-top: 8px;
  color: rgba(246, 241, 234, 0.82);
  font-size: 8px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.mark-line::before {
  content: "";
  display: block;
  width: 28px;
  height: 1px;
  margin: 0 auto 8px;
  background: #e7c98a;
}

.ad--banner .mark-word { font-size: 18px; }
.ad--banner .mark-line {
  margin-top: 6px;
  font-size: 6.5px;
  letter-spacing: 0.1em;
}

.hem {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 10px;
  background: linear-gradient(180deg, #f3e2b0 0%, #e7c98a 30%, #c9a45c 64%, #8d6b32 100%);
}

.hem::before {
  content: "";
  position: absolute;
  left: 16%;
  right: 16%;
  top: -8px;
  height: 1px;
  background: rgba(231, 201, 138, 0.7);
}

.rail {
  position: absolute;
  z-index: 5;
  background:
    radial-gradient(90px 48px at 100% 0%, rgba(200, 16, 46, 0.32), transparent 70%),
    linear-gradient(180deg, #2a1218 0%, #12080a 70%);
}

.ad--portrait .rail {
  left: 0;
  right: 0;
  bottom: 0;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 12px 0 16px;
}

.ad--portrait .rail::before {
  content: "";
  position: absolute;
  left: 16px;
  right: 16px;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(231, 201, 138, 0.9), transparent);
}

.ad--banner .rail {
  top: 0;
  bottom: 0;
  left: 200px;
  right: 0;
  display: flex;
  flex-direction: column;
  padding: 10px 7px 8px;
}

.ad--banner .rail::before {
  content: "";
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 1px;
  background: linear-gradient(180deg, transparent, rgba(231, 201, 138, 0.9), transparent);
}

.copy { min-width: 0; }
.ad--banner .copy { margin: auto 0; }

.actions { display: flex; align-items: center; gap: 8px; flex: none; }
.ad--banner .actions {
  width: 100%;
  margin-top: auto;
  flex-direction: column;
  gap: 8px;
}

.rule {
  display: block;
  width: 28px;
  height: 1px;
  margin-bottom: 6px;
  background: #e7c98a;
  transform: scaleX(0);
  transform-origin: left center;
}

.rule.is-in { animation: draw 0.8s ease forwards; }

.word {
  color: #e7c98a;
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  font-weight: normal;
  font-size: 24px;
  line-height: 1;
}

.word.is-in { animation: rise 0.7s ease both; }
.ad--banner .word { font-size: 15px; }

.line {
  margin-top: 5px;
  max-width: 168px;
  color: rgba(246, 241, 234, 0.86);
  font-size: 8px;
  line-height: 1.35;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.ad--banner .line {
  max-width: none;
  font-size: 7.5px;
  letter-spacing: 0.08em;
}

.next {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1.5px solid #e7c98a;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  flex: none;
}

.next span {
  display: block;
  width: 6px;
  height: 6px;
  margin: 0 auto;
  border-radius: 50%;
  background: #e7c98a;
}

.ad.is-open:not(.is-end) .next { opacity: 1; pointer-events: auto; }
.ad.is-hinted .next { animation: pulse 1.1s ease-in-out 2; }

.cta {
  position: relative;
  flex: none;
  height: 34px;
  padding: 0 14px;
  overflow: hidden;
  border: 0;
  background: var(--cta-bg, #c8102e);
  color: var(--cta-text, #fff);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
}

.ad--banner .cta {
  width: 100%;
  height: 28px;
  padding: 0;
  font-size: 8px;
  letter-spacing: 0.12em;
}

.cta::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 42%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  transform: translateX(-180%);
  animation: shimmer 2.8s ease-in-out infinite;
}

.cta:focus-visible,
.next:focus-visible { outline: 1px solid #fff; outline-offset: 1px; }

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

@keyframes draw { to { transform: scaleX(1); } }

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

@keyframes shimmer {
  0%, 42% { transform: translateX(-180%); }
  78%, 100% { transform: translateX(320%); }
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .drape,
  .word.is-in,
  .rule.is-in,
  .cta::after,
  .next,
  .loader span { animation: none; transition: none; }
  .rule.is-in { transform: scaleX(1); }
  .word.is-in { opacity: 1; }
}
