/* Экран подробностей оффера: десктоп — модальное окно, телефон — полноэкранный экран с закреплённой кнопкой */
.od-backdrop, .od-preview {
  --od-text: #14233d; --od-muted: #5b6b82; --od-line: #dce4f0; --od-soft: #f3f6fb;
  --od-accent: #2363eb; --od-accent-dark: #164fce; --od-accent-soft: #eaf1ff; --od-ok: #15803d; --od-err: #b42318;
  --od-font: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  color: var(--od-text); font-family: var(--od-font);
}
.od-backdrop {
  position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 24px;
  background: rgba(15, 23, 42, .5); animation: od-fade .18s ease-out;
}
.od {
  position: relative; display: flex; flex-direction: column; width: clamp(560px, 52vw, 680px); max-width: 100%; max-height: 90vh; max-height: 90dvh;
  background: #fff; border-radius: 20px; box-shadow: 0 30px 80px -24px rgba(15, 23, 42, .45); overflow: hidden; animation: od-rise .22s ease-out;
}
.od-content { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; }
.od-scroll { overflow-y: auto; overscroll-behavior: contain; padding: 32px 32px 24px; flex: 1 1 auto; min-height: 0; }
.od-close {
  position: absolute; top: 14px; right: 14px; z-index: 2; width: 40px; height: 40px; display: grid; place-items: center;
  border: 0; border-radius: 50%; background: rgba(243, 246, 251, .92); color: var(--od-text); cursor: pointer;
}
.od-close svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.od-close .od-arrow, .od-close .od-back-text { display: none; }
.od-close:hover { background: #e6ecf5; }
.od-close:focus-visible, .od-cta:focus-visible, .od-copy:focus-visible, .od-code:focus-visible, .od-section:focus-visible {
  outline: 2px solid var(--od-accent); outline-offset: 2px;
}

.od-hero { display: flex; align-items: center; gap: 16px; padding-right: 40px; }
.od-logo { flex: none; width: 64px; height: 64px; border-radius: 16px; object-fit: cover; background: var(--od-soft); }
.od-letter { display: grid; place-items: center; background: var(--od-accent); color: #fff; font-size: 26px; font-weight: 700; }
.od-hero-text { min-width: 0; }
.od-partner { margin: 0 0 3px; color: var(--od-muted); font-size: 15px; font-weight: 500; }
.od-title { margin: 0; font-size: 22px; line-height: 1.25; font-weight: 700; letter-spacing: -.02em; overflow-wrap: anywhere; }
.od-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.od-badge { padding: 5px 10px; border-radius: 999px; background: var(--od-soft); color: var(--od-muted); font-size: 13px; font-weight: 500; }
.od-badge-accent { background: var(--od-accent-soft); color: var(--od-accent-dark); font-weight: 650; }
.od-benefit { margin: 18px 0 0; font-size: 16px; font-weight: 600; line-height: 1.45; }
.od-text { margin: 12px 0 0; color: var(--od-muted); font-size: 15px; line-height: 1.6; overflow-wrap: anywhere; }

.od-promo { margin-top: 22px; padding: 16px; border: 1px dashed #9db8f2; border-radius: 14px; background: #f7faff; }
.od-promo-label { margin: 0 0 10px; color: var(--od-muted); font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.od-promo-row { display: flex; gap: 10px; align-items: stretch; }
.od-code {
  flex: 1 1 auto; min-width: 0; padding: 12px 14px; border-radius: 10px; background: #fff; border: 1px solid var(--od-line);
  font: 700 20px/1.2 ui-monospace, 'SF Mono', Menlo, Consolas, monospace; letter-spacing: .06em; overflow-wrap: anywhere;
  user-select: all; -webkit-user-select: all; cursor: text;
}
.od-copy {
  flex: none; min-width: 112px; padding: 0 16px; border: 1px solid var(--od-accent); border-radius: 10px; background: #fff;
  color: var(--od-accent); font: 600 15px/1 var(--od-font); cursor: pointer; transition: background .15s, color .15s;
}
.od-copy:hover { background: var(--od-accent-soft); }
.od-copy.done { background: var(--od-ok); border-color: var(--od-ok); color: #fff; }
.od-copy-status { margin: 8px 0 0; font-size: 13px; line-height: 1.5; min-height: 0; }
.od-copy-status:empty { display: none; }
.od-copy-status.err { color: var(--od-err); }
.od-confirm-go { display: inline-block; margin-top: 6px; color: var(--od-accent); font-weight: 600; }

.od-section { margin-top: 22px; outline: none; scroll-margin-top: 16px; }
.od-section h3 { margin: 0; font-size: 15px; font-weight: 700; }
.od-section .od-text { margin-top: 6px; }
.od-terms { margin: 8px 0 0; padding-left: 20px; color: var(--od-muted); font-size: 14px; line-height: 1.55; }
.od-terms li + li { margin-top: 4px; }
.od-steps { list-style: none; counter-reset: step; margin: 10px 0 0; padding: 0; display: grid; gap: 10px; }
.od-steps li { counter-increment: step; display: flex; gap: 12px; align-items: flex-start; font-size: 15px; line-height: 1.5; }
.od-steps li::before {
  content: counter(step); flex: none; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%;
  background: var(--od-accent-soft); color: var(--od-accent-dark); font-size: 13px; font-weight: 700;
}
.od-steps li span { padding-top: 2px; overflow-wrap: anywhere; }
.od-promo-locked { border-style: dashed; background: var(--od-soft); border-color: var(--od-line); }
.od-promo-hint { display: flex; align-items: center; gap: 10px; margin: 0; color: var(--od-muted); font-size: 14px; }
.od-promo-hint svg { flex: none; width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.od-note { margin: 0; text-align: center; font-size: 13px; color: var(--od-muted); }

.od-actions {
  flex: none; display: flex; flex-direction: column; gap: 10px; padding: 16px 32px 24px; border-top: 1px solid var(--od-line); background: #fff;
}
.od-cta {
  display: block; width: 100%; padding: 15px 18px; border-radius: 12px; border: 1px solid transparent;
  font: 650 16px/1.2 var(--od-font); text-align: center; text-decoration: none; cursor: pointer; transition: background .15s, transform .1s;
}
.od-cta:active { transform: scale(.99); }
.od-primary { background: var(--od-accent); color: #fff; }
.od-primary:hover { background: var(--od-accent-dark); }
.od-secondary { background: #fff; color: var(--od-text); border-color: var(--od-line); }
.od-secondary:hover { background: var(--od-soft); }
.od-cta[disabled] { background: #e8edf4; color: #8a95a5; cursor: not-allowed; }
.od-go-fallback { margin: 0; text-align: center; font-size: 13px; color: var(--od-muted); }
.od-go-fallback a { color: var(--od-accent); font-weight: 600; }

.od-state { text-align: center; padding-top: 48px; }
.od-state .od-logo { margin: 0 auto 16px; filter: grayscale(.4); opacity: .7; }
.od-loading { display: grid; place-items: center; gap: 12px; padding: 64px 32px; color: var(--od-muted); }
.od-loading p { margin: 0; }
.od-spinner { width: 28px; height: 28px; border: 3px solid var(--od-accent-soft); border-top-color: var(--od-accent); border-radius: 50%; animation: od-spin .8s linear infinite; }
.od-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.od-toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 1100; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  padding: 11px 18px; border-radius: 999px; background: #14233d; color: #fff; font: 600 14px/1.2 Inter, system-ui, sans-serif;
  transition: opacity .2s, transform .2s; box-shadow: 0 10px 30px -10px rgba(15, 23, 42, .5);
}
.od-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Телефон: полноэкранный экран, кнопка закреплена снизу с учётом safe-area */
@media (max-width: 640px) {
  .od-backdrop { padding: 0; align-items: stretch; background: #fff; }
  .od { width: 100%; max-height: none; height: 100%; border-radius: 0; box-shadow: none; animation: od-slide .22s ease-out; }
  /* телефон: отдельный экран со строкой «Назад» сверху */
  .od-scroll { padding: calc(64px + env(safe-area-inset-top)) 20px 24px; }
  .od-close {
    top: 0; left: 0; right: 0; width: auto; height: calc(52px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 12px 0;
    display: flex; align-items: center; justify-content: flex-start; gap: 4px; border-radius: 0;
    background: rgba(255, 255, 255, .94); border-bottom: 1px solid var(--od-line); color: var(--od-accent); font: 600 16px/1 var(--od-font);
    -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  }
  .od-close:hover { background: rgba(255, 255, 255, .94); }
  .od-close .od-x { display: none; }
  .od-close .od-arrow { display: block; width: 22px; height: 22px; }
  .od-close .od-back-text { display: inline; }
  .od-hero { padding-right: 0; }
  .od-logo { width: 56px; height: 56px; border-radius: 14px; }
  .od-title { font-size: 20px; }
  .od-actions { position: sticky; bottom: 0; padding: 12px 20px calc(12px + env(safe-area-inset-bottom)); box-shadow: 0 -8px 24px -18px rgba(15, 23, 42, .35); }
  .od-promo-row { flex-direction: column; }
  .od-copy { min-height: 46px; }
  .od-toast { bottom: calc(170px + env(safe-area-inset-bottom)); }
}

@keyframes od-fade { from { opacity: 0; } }
@keyframes od-rise { from { opacity: 0; transform: translateY(12px) scale(.98); } }
@keyframes od-slide { from { transform: translateY(24px); opacity: 0; } }
@keyframes od-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .od-backdrop, .od, .od-spinner { animation: none; }
  .od-toast { transition: none; }
}

/* Предпросмотр в админке: та же разметка в рамке нужного размера */
.od-preview { border: 1px solid var(--od-line); border-radius: 20px; overflow: hidden; background: #fff; display: flex; flex-direction: column; }
.od-preview.desktop { width: 100%; max-width: 620px; max-height: 560px; }
.od-preview.mobile { width: 360px; max-width: 100%; height: 640px; border-radius: 28px; border-width: 6px; border-color: #14233d; }
.od-preview .od-content { overflow: hidden; }
.od-preview.mobile .od-scroll { padding: 20px; }
.od-preview.mobile .od-actions { padding: 12px 16px 16px; }
.od-preview.mobile .od-promo-row { flex-direction: column; }
.od-preview.mobile .od-copy { min-height: 46px; }
.od-preview.mobile .od-title { font-size: 20px; }
.od-preview .od-hero { padding-right: 0; }
