/* ============================================================================
   508 Ministry Compass & Dove Social - Reels, Stories & Creator Tool Ad Slots
   Self-hosted Cormorant + Figtree palette; zero third-party ad networks.
   ============================================================================ */

.rs-rail-card {
  background: #ffffff;
  border: 1px solid #d9e2ef;
  border-radius: 18px;
  padding: 14px 14px 12px;
  margin-bottom: 14px;
  box-shadow: 0 8px 24px rgba(23, 32, 64, 0.06);
  overflow: hidden;
}

.rs-rail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 11px;
  flex-wrap: wrap;
}

.rs-rail-title-wrap {
  display: flex;
  align-items: center;
  gap: 9px;
}

.rs-rail-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  background: #172040;
  color: #f3d58c;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.rs-rail-title {
  margin: 0;
  font-family: 'Cormorant', Georgia, serif;
  font-size: 22px;
  font-weight: 700;
  color: #172040;
  line-height: 1.1;
}

.rs-rail-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.rs-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid #d4a84b;
  background: linear-gradient(135deg, #172040, #233262);
  color: #fff6dc;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  min-height: 36px;
}

.rs-pill-btn:hover {
  background: linear-gradient(135deg, #1e2a54, #2d3f7a);
}

.rs-nav-arrow {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid #d9e2ef;
  background: #f6f9fd;
  color: #172040;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.rs-nav-arrow:hover {
  background: #eaf1fb;
}

.rs-strip {
  display: flex;
  gap: 11px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x proximity;
  padding: 2px 2px 6px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.rs-strip::-webkit-scrollbar {
  height: 6px;
}

.rs-strip::-webkit-scrollbar-thumb {
  background: rgba(23, 32, 64, 0.22);
  border-radius: 999px;
}

.rs-card {
  position: relative;
  flex: 0 0 144px;
  width: 144px;
  height: 248px;
  border-radius: 16px;
  overflow: hidden;
  background: #101830;
  border: 1.5px solid #d9e2ef;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  color: #ffffff;
  text-align: left;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.rs-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.18);
  border-color: #d4a84b;
}

/* Create / Upload First Card */
.rs-card-create {
  background: linear-gradient(165deg, #172040 0%, #243462 55%, #0e162e 100%);
  border: 1.5px dashed #d4a84b;
  cursor: pointer;
  padding: 12px;
  justify-content: space-between;
}

.rs-create-plus {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e7c166, #c6922c);
  color: #131b35;
  font-size: 28px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 16px rgba(212, 168, 75, 0.36);
}

.rs-create-title {
  font-size: 13.5px;
  font-weight: 800;
  line-height: 1.25;
  color: #fff8e6;
}

.rs-create-sub {
  font-size: 11px;
  line-height: 1.35;
  color: rgba(244, 240, 228, 0.82);
  margin-top: 4px;
}

.rs-create-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}

.rs-create-chip {
  font-size: 9.5px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #f3d58c;
  border: 1px solid rgba(212, 168, 75, 0.35);
}

/* Story Card (Tap Opens Lightbox) */
.rs-card-story {
  cursor: pointer;
  border-color: #d4a84b;
}

.rs-card-media-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 18%;
  display: block;
}

.rs-card-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(10, 16, 34, 0.56) 0%, rgba(10, 16, 34, 0.08) 42%, rgba(10, 16, 34, 0.88) 100%);
  pointer-events: none;
}

/* Reel Card (Plays Inline Vertically, Tap Opens Shared Full-Screen Panel) */
.rs-card-reel {
  flex: 0 0 154px;
  width: 154px;
  border-color: #36578f;
  cursor: pointer;
}

.rs-reel-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 18%;
  background: #0b1122;
}

.rs-card-top {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.rs-kind-pill {
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: rgba(12, 18, 38, 0.82);
  color: #f3d58c;
  border: 1px solid rgba(212, 168, 75, 0.72);
}

.rs-kind-pill.is-reel {
  color: #d5f0ff;
  border-color: rgba(125, 211, 252, 0.75);
}

.rs-card-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #d4a84b;
  background: #172040;
  flex-shrink: 0;
}

.rs-reel-play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 4;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid rgba(243, 213, 140, 0.9);
  background: rgba(15, 23, 42, 0.72);
  color: #fff6dc;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.rs-card-reel.is-playing .rs-reel-play-btn {
  opacity: 0;
  pointer-events: none;
}

.rs-reel-tools {
  position: absolute;
  top: 38px;
  right: 7px;
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.rs-reel-tool-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(12, 18, 38, 0.78);
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rs-reel-tool-btn:hover {
  background: #172040;
  border-color: #d4a84b;
}

.rs-card-foot {
  position: relative;
  z-index: 3;
  padding: 8px 9px 9px;
}

.rs-card-title {
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
  color: #ffffff;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

.rs-card-author {
  font-size: 10.5px;
  color: rgba(246, 240, 224, 0.86);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Native 508 Creator Tool Ad Cards (Interleaved in Row + Feed) */
.rs-card-ad {
  flex: 0 0 184px;
  width: 184px;
  padding: 11px;
  background: linear-gradient(160deg, #162246 0%, #243564 55%, #111a34 100%);
  border: 1.5px solid #d4a84b;
  justify-content: space-between;
  text-decoration: none;
  color: #ffffff;
}

.rs-card-ad-kicker {
  display: inline-block;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(212, 168, 75, 0.18);
  border: 1px solid rgba(212, 168, 75, 0.65);
  color: #f3d58c;
  align-self: flex-start;
}

.rs-card-ad-h {
  font-family: 'Cormorant', Georgia, serif;
  font-size: 16.5px;
  font-weight: 700;
  line-height: 1.18;
  color: #fff9ec;
  margin: 8px 0 6px;
}

.rs-card-ad-p {
  font-size: 11px;
  line-height: 1.38;
  color: rgba(245, 241, 232, 0.86);
  margin: 0;
}

.rs-card-ad-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin-top: 10px;
  padding: 7px 10px;
  border-radius: 10px;
  background: linear-gradient(135deg, #e7c166, #c6922c);
  color: #131b35;
  font-size: 11.5px;
  font-weight: 800;
  text-decoration: none;
  text-align: center;
}

/* Feed-Interleaved Native Ad Card */
.m508-creator-ad-card {
  background: linear-gradient(135deg, #15203f 0%, #1e2e5a 65%, #121b35 100%);
  border: 1.5px solid rgba(212, 168, 75, 0.72);
  border-radius: 18px;
  padding: 18px 20px;
  color: #f7f3ea;
  box-shadow: 0 10px 28px rgba(17, 26, 52, 0.16);
  position: relative;
  overflow: hidden;
}

.m508-creator-ad-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.m508-creator-ad-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #f3d58c;
}

.m508-creator-ad-brand img {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid #d4a84b;
}

.m508-creator-ad-tag {
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(212, 168, 75, 0.45);
  color: #fff6dc;
}

.m508-creator-ad-title {
  margin: 0 0 7px;
  font-family: 'Cormorant', Georgia, serif;
  font-size: 25px;
  font-weight: 700;
  line-height: 1.15;
  color: #ffffff;
}

.m508-creator-ad-body {
  margin: 0 0 14px;
  font-size: 14px;
  line-height: 1.5;
  color: rgba(247, 243, 234, 0.9);
}

.m508-creator-ad-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.m508-creator-ad-cta {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 18px;
  border-radius: 999px;
  background: linear-gradient(135deg, #e7c166, #c6922c);
  color: #131b35;
  font-size: 13.5px;
  font-weight: 800;
  text-decoration: none;
  min-height: 44px;
}

.m508-creator-ad-cta:hover {
  filter: brightness(1.06);
}

.m508-creator-ad-note {
  font-size: 11.5px;
  color: rgba(243, 213, 140, 0.84);
}


/* Sunlit New-Vibe Strip Accent for Alongside+ Studio Tile */
.rs-card-ad[data-creator-ad="creator-ad:alongside-studio-free"] {
  background: linear-gradient(164deg, #fffdf8 0%, #fdf6e3 58%, #f1f6ff 100%);
  border: 1.5px solid rgba(204, 164, 78, 0.78);
  color: #0a213c;
  box-shadow: 0 8px 22px rgba(15, 29, 58, 0.08);
}
.rs-card-ad[data-creator-ad="creator-ad:alongside-studio-free"] .rs-card-ad-kicker {
  background: rgba(212, 168, 75, 0.16);
  border-color: rgba(185, 135, 50, 0.45);
  color: #8c6015;
}
.rs-card-ad[data-creator-ad="creator-ad:alongside-studio-free"] .rs-card-ad-h {
  color: #0a213c;
}
.rs-card-ad[data-creator-ad="creator-ad:alongside-studio-free"] .rs-card-ad-p {
  color: #3b4c62;
}

/* Sunlit New-Vibe Interactive Live Alongside+ Studio Prompt Box (Inline Feed) */
.m508-studio-prompt-card {
  background: linear-gradient(166deg, #fffdf8 0%, #fdf8ec 54%, #f4f8ff 100%);
  border: 1.5px solid rgba(204, 164, 78, 0.62);
  border-radius: 20px;
  padding: 20px 22px 19px;
  color: #0a213c;
  box-shadow: 0 14px 34px -14px rgba(15, 29, 58, 0.14), 0 2px 8px rgba(185, 135, 50, 0.10);
  position: relative;
  overflow: hidden;
  font-family: 'Figtree', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.m508-studio-prompt-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #b98732 0%, #f2cf7e 48%, #d4a84b 78%, #2563eb 100%);
}

.m508-sp-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.m508-sp-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.m508-sp-seal {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  padding: 2px;
  background: linear-gradient(135deg, #f4d583, #c6922c);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(185, 135, 50, 0.28);
}

.m508-sp-seal img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  background: #101b36;
}

.m508-sp-kicker {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.085em;
  text-transform: uppercase;
  color: #8c6015;
}

.m508-sp-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 800;
  padding: 5px 11px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ffffff 0%, #fef6de 100%);
  border: 1px solid rgba(204, 164, 78, 0.65);
  color: #1e3a8a;
  box-shadow: 0 2px 6px rgba(185, 135, 50, 0.12);
  white-space: nowrap;
}

.m508-sp-pill-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #16a34a;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.18);
}

.m508-sp-title {
  margin: 0 0 5px;
  font-family: 'Cormorant', Georgia, serif;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.12;
  color: #0a213c;
  letter-spacing: -0.01em;
}

.m508-sp-sub {
  margin: 0 0 14px;
  font-size: 13.8px;
  line-height: 1.48;
  color: #3b4c62;
}

.m508-sp-console {
  background: #ffffff;
  border: 1.5px solid rgba(204, 164, 78, 0.56);
  border-radius: 16px;
  box-shadow: 0 8px 24px -10px rgba(10, 33, 60, 0.11), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  overflow: hidden;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.m508-sp-console:focus-within {
  border-color: #b88b32;
  box-shadow: 0 12px 28px -10px rgba(10, 33, 60, 0.15), 0 0 0 3px rgba(212, 168, 75, 0.22);
}

.m508-sp-modes {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 10px 12px;
  background: linear-gradient(180deg, #fdf9ef 0%, #f9f3e3 100%);
  border-bottom: 1px solid rgba(204, 164, 78, 0.28);
}

.m508-sp-mode-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(30, 58, 138, 0.14);
  background: #ffffff;
  color: #243754;
  font-family: 'Figtree', sans-serif;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
  min-height: 34px;
}

.m508-sp-mode-btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: #9a6d1c;
}

.m508-sp-mode-btn:hover {
  border-color: rgba(185, 135, 50, 0.72);
  background: #fffcf3;
  color: #0a213c;
}

.m508-sp-mode-btn.is-active {
  background: linear-gradient(135deg, #1d4ed8 0%, #1e3a8a 100%);
  border-color: #d4a84b;
  color: #ffffff;
  box-shadow: 0 4px 12px -4px rgba(29, 78, 216, 0.45), 0 0 0 1px rgba(242, 207, 126, 0.42);
}

.m508-sp-mode-btn.is-active svg {
  color: #f4d583;
}

.m508-sp-input-wrap {
  padding: 12px 14px 8px;
  background: #ffffff;
}

.m508-sp-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.m508-sp-textarea {
  width: 100%;
  min-height: 76px;
  max-height: 148px;
  padding: 2px 0;
  border: 0;
  outline: none;
  resize: none;
  background: transparent;
  color: #0a213c;
  font-family: 'Figtree', sans-serif;
  font-size: 15px;
  line-height: 1.48;
  box-sizing: border-box;
  display: block;
}

.m508-sp-textarea::placeholder {
  color: #6b7a90;
}

@keyframes m508SpFlash {
  0% { background-color: rgba(244, 213, 131, 0.34); }
  100% { background-color: transparent; }
}

.m508-sp-textarea.is-populated {
  animation: m508SpFlash 0.65s ease-out;
  border-radius: 8px;
}

.m508-sp-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 6px;
  font-size: 11.5px;
  color: #6b7a90;
}

.m508-sp-hint {
  font-weight: 600;
  color: #51627b;
}

.m508-sp-count {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.m508-sp-chips-row {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  padding: 8px 14px 10px;
  border-top: 1px dashed rgba(204, 164, 78, 0.28);
  background: #fffefb;
}

.m508-sp-chips-lbl {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #8c6015;
  flex-shrink: 0;
}

.m508-sp-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1 1 auto;
}

.m508-sp-chip {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(30, 58, 138, 0.14);
  background: #f5f8ff;
  color: #1e3a8a;
  font-family: 'Figtree', sans-serif;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease, transform 0.12s ease;
}

.m508-sp-chip-plus {
  font-weight: 800;
  color: #b98732;
}

.m508-sp-chip:hover {
  background: #fef6de;
  border-color: rgba(185, 135, 50, 0.68);
  color: #0a213c;
  transform: translateY(-1px);
}

.m508-sp-chip.is-picked {
  background: #fef3c7;
  border-color: #c6922c;
  color: #0a213c;
}

.m508-sp-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 11px 14px;
  background: linear-gradient(180deg, #faf6eb 0%, #f5efe0 100%);
  border-top: 1px solid rgba(204, 164, 78, 0.3);
}

.m508-sp-submit {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 20px;
  min-height: 44px;
  border-radius: 999px;
  border: 1px solid #b88b32;
  background: linear-gradient(135deg, #f6da8a 0%, #e1ae4c 55%, #c8912d 100%);
  color: #0a213c;
  font-family: 'Figtree', sans-serif;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 6px 16px -6px rgba(185, 135, 50, 0.58), inset 0 1px 0 rgba(255, 255, 255, 0.55);
  transition: filter 0.15s ease, transform 0.14s ease, box-shadow 0.15s ease;
}

.m508-sp-submit:hover {
  filter: brightness(1.04);
  transform: translateY(-1px);
  box-shadow: 0 10px 20px -8px rgba(185, 135, 50, 0.68), inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.m508-sp-submit:active {
  transform: translateY(0);
}

.m508-sp-submit-spark {
  font-size: 14px;
  line-height: 1;
}

.m508-sp-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 14px;
  min-height: 42px;
  border-radius: 999px;
  border: 1px solid rgba(30, 58, 138, 0.22);
  background: #ffffff;
  color: #1e3a8a;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.14s ease, border-color 0.14s ease;
}

.m508-sp-secondary:hover {
  background: #eff6ff;
  border-color: #1d4ed8;
}

.m508-sp-note {
  margin-left: auto;
  font-size: 11.5px;
  font-weight: 600;
  color: #66758a;
}

@media (max-width: 640px) {
  .m508-studio-prompt-card {
    padding: 16px 14px 15px;
    border-radius: 18px;
  }
  .m508-sp-title {
    font-size: 22.5px;
  }
  .m508-sp-sub {
    font-size: 13px;
    margin-bottom: 12px;
  }
  .m508-sp-modes {
    padding: 8px 10px;
    gap: 5px;
  }
  .m508-sp-mode-btn {
    padding: 6px 10px;
    font-size: 12px;
    flex: 1 1 calc(50% - 5px);
    justify-content: center;
  }
  .m508-sp-input-wrap {
    padding: 10px 12px 7px;
  }
  .m508-sp-textarea {
    font-size: 15px;
    min-height: 74px;
  }
  .m508-sp-meta-row {
    flex-wrap: wrap;
    gap: 4px;
  }
  .m508-sp-chips-row {
    padding: 8px 12px 9px;
  }
  .m508-sp-chip {
    font-size: 11.5px;
    padding: 5px 9px;
  }
  .m508-sp-actions {
    padding: 10px 12px;
    gap: 8px;
  }
  .m508-sp-submit {
    width: 100%;
    min-height: 46px;
    font-size: 14.5px;
  }
  .m508-sp-secondary {
    width: 100%;
    min-height: 40px;
  }
  .m508-sp-note {
    margin-left: 0;
    width: 100%;
    text-align: center;
  }
}

/* Shared Lightbox-Compliant Modal Base (Upload/Create + Story Viewer) */
.rs-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483500;
  background: rgba(8, 12, 24, 0.88);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.rs-overlay[hidden] {
  display: none !important;
}

.rs-close-x {
  position: fixed;
  top: max(14px, env(safe-area-inset-top, 14px));
  right: max(14px, env(safe-area-inset-right, 14px));
  z-index: 2147483520;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1.5px solid rgba(243, 213, 140, 0.85);
  background: rgba(15, 23, 42, 0.92);
  color: #ffffff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rs-close-x:hover {
  background: #1e2d5a;
}

/* Upload & Create Dialog */
.rs-modal-card {
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  background: #ffffff;
  color: #172040;
  border-radius: 20px;
  border: 1.5px solid #d4a84b;
  padding: 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.rs-modal-h {
  margin: 0 0 4px;
  font-family: 'Cormorant', Georgia, serif;
  font-size: 27px;
  font-weight: 700;
  color: #172040;
}

.rs-modal-sub {
  margin: 0 0 14px;
  font-size: 13px;
  color: #51607a;
  line-height: 1.45;
}

.rs-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.rs-tab-btn {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1.5px solid #d9e2ef;
  background: #f5f8fd;
  color: #172040;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  min-height: 44px;
}

.rs-tab-btn.active {
  background: #172040;
  color: #f3d58c;
  border-color: #d4a84b;
}

.rs-field {
  margin-bottom: 11px;
}

.rs-field label {
  display: block;
  font-size: 12px;
  font-weight: 800;
  color: #172040;
  margin-bottom: 4px;
}

.rs-input,
.rs-select,
.rs-textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1.5px solid #cfd9e8;
  border-radius: 11px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  color: #172040;
  background: #fafbfd;
}

.rs-textarea {
  min-height: 76px;
  resize: vertical;
}

.rs-dropzone {
  border: 2px dashed #9eb3d4;
  border-radius: 14px;
  padding: 16px;
  text-align: center;
  background: #f5f9ff;
  cursor: pointer;
}

.rs-dropzone strong {
  display: block;
  font-size: 14px;
  color: #172040;
  margin-bottom: 4px;
}

.rs-dropzone span {
  font-size: 12px;
  color: #51607a;
}

.rs-preview-box {
  margin-top: 10px;
  border-radius: 12px;
  overflow: hidden;
  background: #0d152a;
  max-height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rs-preview-box img,
.rs-preview-box video {
  max-width: 100%;
  max-height: 240px;
  display: block;
}

.rs-theme-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.rs-theme-swatch {
  padding: 6px 11px;
  border-radius: 999px;
  border: 1.5px solid #cfd9e8;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  background: #f7f9fc;
  color: #172040;
}

.rs-theme-swatch.active {
  border-color: #d4a84b;
  background: #172040;
  color: #f3d58c;
}

.rs-canvas-preview {
  width: 100%;
  max-width: 210px;
  aspect-ratio: 9 / 16;
  border-radius: 14px;
  border: 1.5px solid #d4a84b;
  margin: 8px auto 0;
  display: block;
}

.rs-alert {
  padding: 10px 12px;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 12px;
  line-height: 1.4;
}

.rs-alert.is-warn {
  background: #fef3c7;
  border: 1.5px solid #d97706;
  color: #92400e;
}

.rs-alert.is-ok {
  background: #dcfce7;
  border: 1.5px solid #16a34a;
  color: #166534;
}

.rs-submit-btn {
  width: 100%;
  min-height: 46px;
  border-radius: 12px;
  border: 1px solid #c6922c;
  background: linear-gradient(135deg, #172040, #233364);
  color: #fff6dc;
  font-size: 14.5px;
  font-weight: 800;
  cursor: pointer;
}

.rs-submit-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

/* Story Viewer Lightbox */
.rs-story-stage {
  position: relative;
  width: 100%;
  max-width: 420px;
  max-height: 88vh;
  background: #0d1428;
  border-radius: 20px;
  border: 1.5px solid rgba(212, 168, 75, 0.78);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
}

.rs-story-bar {
  display: flex;
  gap: 4px;
  padding: 10px 12px 6px;
  background: rgba(8, 12, 24, 0.72);
}

.rs-story-seg {
  flex: 1;
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.25);
  overflow: hidden;
}

.rs-story-seg.active > span {
  display: block;
  height: 100%;
  background: #e7c166;
  width: 100%;
}

.rs-story-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 14px 10px;
  color: #ffffff;
}

.rs-story-author {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.rs-story-author img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid #d4a84b;
  object-fit: cover;
}

.rs-story-media-wrap {
  position: relative;
  flex: 1;
  min-height: 280px;
  max-height: 58vh;
  background: #070b16;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.rs-story-media-wrap img,
.rs-story-media-wrap video {
  width: 100%;
  height: 100%;
  max-height: 58vh;
  object-fit: contain;
  display: block;
}

.rs-story-caption-box {
  padding: 13px 15px 15px;
  background: #121c38;
  color: #f7f3ea;
}

.rs-story-caption-title {
  margin: 0 0 4px;
  font-family: 'Cormorant', Georgia, serif;
  font-size: 22px;
  font-weight: 700;
  color: #fff8e6;
}

.rs-story-caption-text {
  margin: 0 0 12px;
  font-size: 13.5px;
  line-height: 1.45;
  color: rgba(247, 243, 234, 0.9);
}

.rs-story-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.rs-story-btn {
  flex: 1;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(212, 168, 75, 0.72);
  background: rgba(255, 255, 255, 0.08);
  color: #fff6dc;
  font-size: 12.5px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.rs-story-btn.is-gold {
  background: linear-gradient(135deg, #e7c166, #c6922c);
  color: #131b35;
}

@media (max-width: 640px) {
  .rs-rail-card {
    padding: 12px 10px 10px;
    border-radius: 14px;
  }
  .rs-rail-title {
    font-size: 19px;
  }
  .rs-card {
    flex: 0 0 132px;
    width: 132px;
    height: 228px;
  }
  .rs-card-reel {
    flex: 0 0 142px;
    width: 142px;
  }
  .rs-card-ad {
    flex: 0 0 168px;
    width: 168px;
  }
  .m508-creator-ad-card {
    padding: 15px;
  }
  .m508-creator-ad-title {
    font-size: 21px;
  }
}

/* m508-rs-aspect-3x4 */
.rs-card.rs-aspect-3x4 {
  flex: 0 0 186px;
  width: 186px;
}
.rs-card.rs-aspect-3x4 .rs-reel-video,
.rs-card.rs-aspect-3x4 .rs-card-media-img {
  object-fit: cover;
  object-position: 50% 15%;
}
.rs-story-media-wrap video,
.rs-story-media-wrap img {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
}
@media (max-width: 520px) {
  .rs-card.rs-aspect-3x4 {
    flex: 0 0 172px;
    width: 172px;
  }
}
