/* Ad studio mock styled to match the character page */

.page.page-ads {
  --ad-header-height: 60px;
  --ad-workspace-top-gap: 10px;
  --ad-builder-width: 400px;
  --ad-builder-gap: 0px;
  --ad-rail-height: 254px;
  --btn-border: rgba(104, 66, 170, 0.62);
  --btn-border-hover: rgba(121, 170, 255, 0.76);
  --btn-bg: rgba(7, 11, 19, 0.78);
  --btn-color: #d6e1f4;
  --btn-active-bg: #6512b3;
  --btn-active-color: #ffffff;
  --btn-active-shadow: inset 0 0 0 1px rgba(151, 189, 255, 0.16);
  width: 100%;
  height: 100vh;
  max-width: none;
  min-height: 100vh;
  margin: 0;
  padding: 0 0 0 calc(var(--ad-builder-width) + var(--ad-builder-gap));
  transition: padding-left 0.3s ease;
  overflow: hidden;
  background:
    radial-gradient(circle at top left, rgba(73, 115, 172, 0.16), transparent 26%),
    #0d0d12;
}

.page.page-ads.is-builder-collapsed {
  padding-left: 0;
}
.page.page-ads.is-builder-collapsed .ad-library-card {
  left: 0;
}
.page.page-ads.is-builder-collapsed .ad-project-rail-section {
  left: 0;
}

html.is-ad-modal-open,
body.is-ad-modal-open {
  overflow: hidden;
}

.ad-studio-layout {
  display: grid;
  gap: 0;
}

.ad-builder-input,
.ad-builder-textarea {
  width: 100%;
  border: 1px solid rgba(104, 66, 170, 0.62);
  border-radius: 14px;
  background: rgba(13, 19, 31, 0.94);
  color: #eef2ff;
  font: inherit;
  font-weight: 400;
  font-size: 14px;
}

.ad-builder-input {
  min-height: 46px;
  padding: 0 14px;
}

.ad-builder-input::placeholder,
.ad-builder-textarea::placeholder {
  color: rgba(198, 210, 235, 0.56);
}

.ad-builder-input:focus,
.ad-builder-textarea:focus {
  outline: 2px solid rgba(96, 165, 250, 0.34);
  outline-offset: 1px;
}

.ad-studio-shell {
  position: relative;
  display: block;
}

.ad-builder-card {
  position: fixed;
  top: 60px;
  left: 0;
  bottom: 0;
  width: var(--ad-builder-width);
  max-height: none;
  overflow: visible;
  border: 1px solid rgba(138, 163, 196, 0.22);
  border-left: 0;
  border-radius: 0;
  padding: 0;
  background-color: #0d0d12;
  box-shadow: 0 22px 56px rgba(0, 0, 0, 0.28);
  display: flex;
  flex-direction: column;
  transition: left 0.3s ease;
  z-index: 100;
}
.ad-builder-card-inner {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 26px 20px 10px;
  display: grid;
  align-content: start;
  align-items: start;
  grid-auto-rows: max-content;
  gap: 16px;
}
.ad-builder-card.is-collapsed {
  left: calc(-1 * var(--ad-builder-width));
}

.ad-builder-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.ad-builder-kicker,
.ad-library-kicker {
  width: fit-content;
  margin: 0 0 10px;
  border: 1px solid rgba(122, 167, 255, 0.28);
  border-radius: 999px;
  min-height: 28px;
  padding: 0 10px;
  background: rgba(79, 124, 255, 0.12);
  display: inline-flex;
  align-items: center;
  color: #d7e5ff;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ad-builder-head h1,
.ad-library-head h2 {
  margin: 0;
  color: #f7f9ff;
  font-size: 1.3rem;
  line-height: 1.08;
}

.ad-builder-badge {
  border: 1px solid rgba(122, 167, 255, 0.22);
  border-radius: 999px;
  min-height: 28px;
  padding: 0 10px;
  background: rgba(79, 124, 255, 0.08);
  display: inline-flex;
  align-items: center;
  color: #d7e5ff;
  font-size: 0.72rem;
  font-weight: 500;
  white-space: nowrap;
}

.ad-builder-form {
  display: grid;
  gap: 14px;
}

.ad-builder-section {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid rgba(107, 132, 167, 0.18);
  border-radius: 18px;
}
.ad-builder-section[hidden] {
  display: none;
}

.ad-builder-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ad-builder-section-title {
  margin: 0;
  color: #f6f9ff;
  font-size: 1.0rem;
  font-weight: 500;
}

/* ── Product-only toggle ── */
.ad-product-only-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}
.ad-product-only-toggle input {
  display: none;
}
.ad-product-only-toggle-track {
  position: relative;
  width: 36px;
  height: 20px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
  transition: background 0.2s;
}
.ad-product-only-toggle-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #9fb0cc;
  transition: transform 0.2s, background 0.2s;
}
.ad-product-only-toggle input:checked ~ .ad-product-only-toggle-track {
  background: rgba(104, 66, 170, 0.7);
}
.ad-product-only-toggle input:checked ~ .ad-product-only-toggle-track::after {
  transform: translateX(16px);
  background: #e0eaff;
}
.ad-product-only-toggle-label {
  color: #9fb0cc;
  font-size: 0.85rem;
  font-weight: 400;
  transition: color 0.2s;
}
.ad-product-only-toggle input:checked ~ .ad-product-only-toggle-label {
  color: #e0eaff;
}


.ad-character-source-panels {
  display: grid;
}

.ad-character-source-panel {
  position: relative;
}
.ad-character-source-panel[hidden] {
  display: none;
}

.ad-character-clear-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  color: #9fb0cc;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.ad-character-clear-btn:hover {
  background: rgba(220, 60, 60, 0.7);
  color: #fff;
}
.ad-character-clear-btn[hidden] {
  display: none;
}

.ad-product-only-notice {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid rgba(139, 92, 246, 0.18);
  border-radius: 12px;
  background: rgba(139, 92, 246, 0.06);
  color: #b4bcd0;
  font-size: 0.82rem;
  line-height: 1.4;
}

.ad-product-only-notice svg {
  flex: 0 0 20px;
  color: #8b5cf6;
  opacity: 0.7;
}

.ad-product-picker-wrap {
  position: relative;
}

.ad-product-picker,
.ad-character-picker {
  width: 100%;
  border: 1px solid rgba(104, 66, 170, 0.62);
  border-radius: 14px;
  padding: 14px;
  background: rgba(7, 11, 19, 0.78);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
  font: inherit;
}

.ad-product-picker:hover,
.ad-character-picker:hover {
  border-color: rgba(121, 170, 255, 0.76);
  transform: translateY(-1px);
}

.ad-product-picker-visual {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 14px;
  background:
    radial-gradient(circle at top left, rgba(91, 120, 167, 0.2), transparent 50%),
    linear-gradient(180deg, rgba(12, 19, 31, 0.96), rgba(9, 14, 23, 1));
  overflow: hidden;
}

.ad-product-pack {
  position: absolute;
  display: block;
  box-shadow: 0 14px 24px rgba(4, 8, 16, 0.34);
}

.ad-product-pack.is-bottle {
  width: 24px;
  height: 42px;
  left: 15px;
  bottom: 12px;
  border-radius: 10px 10px 8px 8px;
  background: linear-gradient(180deg, #efe9ff, #c4b5fd 58%, #6d28d9 100%);
  transform: rotate(-10deg);
}

.ad-product-pack.is-bottle::before {
  content: "";
  position: absolute;
  top: -8px;
  left: 6px;
  width: 12px;
  height: 10px;
  border-radius: 6px 6px 3px 3px;
  background: #f5f3ff;
}

.ad-product-pack.is-box {
  width: 30px;
  height: 38px;
  right: 14px;
  bottom: 14px;
  border-radius: 10px;
  background: linear-gradient(180deg, #d9fbff, #67e8f9 58%, #0891b2 100%);
  transform: rotate(9deg);
}

.ad-product-pack.is-box::before {
  content: "";
  position: absolute;
  left: 7px;
  right: 7px;
  top: 8px;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.6);
}

.ad-product-picker-copy,
.ad-character-picker-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
  overflow: hidden;
}

.ad-product-picker-copy strong,
.ad-character-picker-copy strong {
  color: #f7f9ff;
  font-size: 0.92rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ad-product-picker-copy span,
.ad-character-picker-copy span,
.ad-product-picker-action,
.ad-character-picker-action {
  color: #9fb0cc;
  font-size: 0.8rem;
  line-height: 1.45;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ad-character-picker-avatar {
  width: 72px;
  height: 72px;
  border-radius: 14px;
  border: 1px solid rgba(118, 154, 212, 0.34);
  object-fit: cover;
  object-position: center top;
}

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

.ad-product-dropzone.is-dragover,
.ad-product-dropzone:focus-visible,
.ad-character-upload-picker.is-dragover,
.ad-character-upload-picker:focus-visible,
.ad-character-picker:focus-visible {
  border-color: rgba(121, 170, 255, 0.92);
  background: rgba(12, 18, 29, 0.94);
  box-shadow: 0 0 0 1px rgba(121, 170, 255, 0.18);
}

.ad-product-dropzone.has-file,
.ad-character-picker.has-file,
.ad-character-upload-picker.has-file {
  background: rgba(10, 15, 25, 0.94);
}

.ad-product-fallback {
  position: absolute;
  inset: 0;
}

.ad-product-preview-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.ad-character-picker-empty {
  width: 72px;
  height: 72px;
  border-radius: 14px;
  border: 1px dashed rgba(118, 154, 212, 0.36);
  background:
    radial-gradient(circle at top left, rgba(111, 76, 175, 0.24), transparent 50%),
    linear-gradient(180deg, rgba(12, 18, 29, 0.95), rgba(9, 13, 22, 1));
  display: grid;
  place-items: center;
}

.ad-product-fallback[hidden],
.ad-character-picker-empty[hidden],
.ad-product-picker-action[hidden],
.ad-character-picker-action[hidden] {
  display: none !important;
}

.ad-character-picker-empty-dot {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: linear-gradient(180deg, #efe9ff, #c4b5fd 58%, #6d28d9 100%);
  box-shadow: 0 12px 22px rgba(39, 14, 79, 0.34);
}

.ad-character-modal {
  position: fixed;
  inset: 0;
  z-index: 6000;
  padding: 28px;
  display: grid;
  place-items: center;
}

.ad-character-modal.is-hidden {
  display: none;
}

.ad-character-modal-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(3, 7, 14, 0.76);
  cursor: pointer;
}

.ad-character-modal-dialog {
  position: relative;
  z-index: 1;
  width: min(980px, calc(100vw - 56px));
  max-height: min(82vh, 760px);
  border: 1px solid rgba(107, 132, 167, 0.22);
  border-radius: 24px;
  background:
    radial-gradient(circle at top left, rgba(91, 120, 167, 0.16), transparent 34%),
    rgba(9, 13, 22, 0.98);
  box-shadow: 0 26px 60px rgba(0, 0, 0, 0.42);
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  overflow: hidden;
}

.ad-character-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 24px 24px 18px;
}

.ad-character-modal-kicker {
  margin: 0 0 8px;
  color: #9fb0cc;
  font-size: 0.78rem;
  font-weight: 500;
}

.ad-character-modal-head h2 {
  margin: 0;
  color: #f7f9ff;
  font-size: 1.28rem;
  line-height: 1.1;
}

.ad-character-modal-close {
  border: 1px solid rgba(104, 66, 170, 0.62);
  border-radius: 999px;
  min-height: 38px;
  padding: 0 14px;
  background: rgba(13, 19, 31, 0.88);
  color: #d7e5ff;
  font: inherit;
  cursor: pointer;
}

.ad-character-modal-search {
  padding: 0 24px;
}

.ad-character-modal-search input {
  width: 100%;
  min-height: 46px;
  border: 1px solid rgba(104, 66, 170, 0.62);
  border-radius: 14px;
  padding: 0 14px;
  background: rgba(13, 19, 31, 0.94);
  color: #eef2ff;
  font: inherit;
}

.ad-character-modal-search input:focus {
  outline: 2px solid rgba(96, 165, 250, 0.34);
  outline-offset: 1px;
}

.ad-character-modal-status {
  margin: 0;
  padding: 14px 24px 0;
  color: #9fb0cc;
  font-size: 0.84rem;
}

.ad-character-modal-grid {
  min-height: 0;
  padding: 18px 24px 24px;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(172px, 1fr));
  gap: 12px;
}

.ad-character-modal-empty {
  border: 1px dashed rgba(107, 132, 167, 0.22);
  border-radius: 18px;
  padding: 18px;
  background: rgba(10, 15, 25, 0.72);
  color: #9fb0cc;
  font-size: 0.84rem;
  line-height: 1.55;
  grid-column: 1 / -1;
}

.ad-character-card {
  border: 1px solid rgba(107, 132, 167, 0.18);
  border-radius: 18px;
  padding: 12px;
  background: rgba(10, 15, 25, 0.88);
  display: grid;
  gap: 10px;
  text-align: left;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.ad-character-card:hover {
  transform: translateY(-1px);
  border-color: rgba(121, 170, 255, 0.76);
}

.ad-character-card.is-selected {
  border-color: rgba(121, 170, 255, 0.92);
  box-shadow: 0 0 0 1px rgba(121, 170, 255, 0.18);
}

.ad-character-card.is-disabled,
.ad-character-card:disabled {
  opacity: 0.58;
  cursor: not-allowed;
  transform: none;
}

.ad-character-card-image {
  position: relative;
  aspect-ratio: 1 / 1.18;
  border-radius: 14px;
  overflow: hidden;
  background:
    radial-gradient(circle at top left, rgba(91, 120, 167, 0.22), transparent 50%),
    linear-gradient(180deg, rgba(12, 19, 31, 0.96), rgba(9, 14, 23, 1));
}

.ad-character-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
}

.ad-character-card-fallback {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: #f6f9ff;
  font-size: 1.25rem;
  font-weight: 600;
}

.ad-character-card-status {
  position: absolute;
  top: 10px;
  left: 10px;
  border-radius: 999px;
  padding: 4px 8px;
  background: rgba(7, 11, 19, 0.82);
  color: #d8e6ff;
  font-size: 0.7rem;
  font-weight: 600;
}

.ad-character-card-status.is-ready {
  color: #dcfce7;
}

.ad-character-card-status.is-generating,
.ad-character-card-status.is-queued {
  color: #fef3c7;
}

.ad-character-card-status.is-failed {
  color: #fecaca;
}

.ad-character-card-copy {
  display: grid;
  gap: 4px;
}

.ad-character-card-copy strong {
  color: #f7f9ff;
  font-size: 0.9rem;
  font-weight: 500;
}

.ad-character-card-copy span {
  color: #9fb0cc;
  font-size: 0.78rem;
  line-height: 1.45;
}

@media (max-width: 720px) {
  .ad-character-modal {
    padding: 16px;
  }

  .ad-character-modal-dialog {
    width: min(100vw - 32px, 100%);
    max-height: calc(100vh - 32px);
  }

  .ad-character-modal-head,
  .ad-character-modal-search,
  .ad-character-modal-status,
  .ad-character-modal-grid {
    padding-left: 18px;
    padding-right: 18px;
  }

  .ad-character-modal-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    padding-bottom: 18px;
  }
}

.ad-choice-group {
  display: grid;
  gap: 8px;
  padding-bottom: 15px;
}

.ad-choice-group[hidden] {
  display: none;
}

.ad-choice-label {
  color: #cdd7ec;
  font-size: 0.8rem;
  font-weight: 500;
}

.ad-choice-row,
.ad-output-count {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ad-choice-row.ad-choice-grid,
.ad-bg-sub-group.ad-choice-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.ad-choice-row.ad-choice-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
}
.ad-choice-grid-4 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 6px;
}

.ad-bg-select {
  width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid rgba(104, 66, 170, 0.62);
  background: rgba(16, 24, 36, 0.7);
  color: #d0d8e8;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  margin-bottom: 6px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='7'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23a0aec0' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.ad-bg-select:hover {
  border-color: rgba(165, 179, 203, 0.6);
}

.ad-bg-select:focus {
  outline: none;
  border-color: rgba(104, 66, 170, 0.62);
}

.ad-bg-sub-group[hidden] {
  display: none;
}

.ad-bg-sub-group {
  margin-top: 4px;
}

.ad-bg-custom-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ad-bg-custom-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(104, 66, 170, 0.62);
  background: rgba(16, 24, 36, 0.7);
  color: #d0d8e8;
  font: inherit;
  font-size: 0.85rem;
  resize: vertical;
  min-height: 56px;
}

.ad-bg-custom-input:focus {
  outline: none;
  border-color: rgba(165, 179, 203, 0.8);
}

.ad-bg-custom-input::placeholder {
  color: rgba(208, 216, 232, 0.4);
}

.ad-bg-custom-hint {
  font-size: 0.72rem;
  color: rgba(208, 216, 232, 0.55);
  margin: 0;
  line-height: 1.4;
}

.ad-choice-btn,
.ad-output-count-btn {
  border: 1px solid var(--btn-border);
  border-radius: 999px;
  min-height: 34px;
  padding: 0 12px;
  background: var(--btn-bg);
  color: var(--btn-color);
  font: inherit;
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.ad-choice-grid .ad-choice-btn {
  position: relative;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ad-choice-btn:hover,
.ad-output-count-btn:hover {
  border-color: var(--btn-border-hover);
}

.ad-choice-btn.is-active,
.ad-output-count-btn.is-active {
  border: 0;
  background-color: var(--btn-active-bg);
  color: var(--btn-active-color);
  box-shadow: var(--btn-active-shadow);
}

/* ── Choice hint tooltip ── */
.ad-choice-hint-tooltip {
  position: fixed;
  z-index: 9000;
  width: 220px;
  padding: 0;
  border: 1px solid rgba(121, 170, 255, 0.25);
  border-radius: 12px;
  background: rgba(16, 20, 36, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: rgba(205, 215, 236, 0.95);
  font-size: 0.74rem;
  line-height: 1.55;
  pointer-events: none;
  opacity: 0;
  overflow: hidden;
  transition: opacity 140ms ease;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
}

.ad-choice-hint-tooltip.is-visible {
  opacity: 1;
}

.ad-hint-preview {
  width: 100%;
  aspect-ratio: 1 / 1;
  background-size: cover;
  background-position: center;
  background-color: rgba(30, 38, 58, 0.8);
  border-bottom: 1px solid rgba(121, 170, 255, 0.12);
}

.ad-hint-text {
  padding: 10px 14px;
}

.ad-choice-btn:focus-visible,
.ad-output-count-btn:focus-visible,
.ad-builder-create-btn:focus-visible,
.ad-set-more-btn:focus-visible,
.ad-shot-action:focus-visible,
.ad-character-card:focus-visible,
.ad-character-modal-close:focus-visible,
.ad-project-rail-card:focus-visible {
  outline: 2px solid rgba(96, 165, 250, 0.42);
  outline-offset: 2px;
}

.ad-builder-field {
  display: block;
}

.ad-builder-field-stack {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.ad-builder-field-label {
  display: block;
  margin-bottom: 8px;
  color: #cdd7ec;
  font-size: 0.85rem;
  font-weight: 400;
}

.ad-builder-textarea {
  min-height: 112px;
  padding: 14px;
  resize: vertical;
  line-height: 1.56;
}

.ad-builder-textarea--compact {
  min-height: 86px;
}

.ad-builder-summary-section {
  background: linear-gradient(180deg, rgba(9, 14, 23, 0.42), rgba(9, 14, 23, 0.12));
}

.ad-builder-summary {
  padding: 14px;
  border: 1px solid rgba(104, 66, 170, 0.38);
  border-radius: 14px;
  background: rgba(7, 11, 19, 0.78);
}

.ad-builder-summary-value {
  margin: 0;
  color: #eef4ff;
  font-size: 0.86rem;
  line-height: 1.6;
}

.ad-builder-actions {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: grid;
  gap: 8px;
  padding-top: 8px;
  background: linear-gradient(180deg, rgba(8, 12, 20, 0), rgba(8, 12, 20, 0.92) 42%, rgba(8, 12, 20, 0.98));
}

.ad-builder-create-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid rgba(80, 136, 235, 0.4);
  border-radius: 16px;
  min-height: 52px;
  background: linear-gradient(120deg, rgba(228, 42, 112, 0.16), rgba(37, 244, 238, 0.15)), rgba(29, 34, 56, 0.97);
  background-color: #6d28d9 !important;
  color: #ffffff;
  font: inherit;
  font-size: 0.98rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 18px 30px rgba(19, 54, 115, 0.28);
  transition: transform 0.18s ease, filter 0.18s ease, box-shadow 0.18s ease;
}

.ad-builder-create-btn-main {
  display: block;
  flex: 0 0 auto;
  white-space: nowrap;
  line-height: 1.08;
}

.ad-builder-create-btn-meta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  gap: 7px;
  color: rgba(255, 255, 255, 1.0);
  font-size: 1.0rem;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1.08;
}

.ad-builder-create-btn-meta::after {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: #ffb01f;
  box-shadow: 0 0 0 3px rgba(255, 176, 31, 0.14);
}

.ad-builder-create-btn:hover:not(:disabled) {
  filter: brightness(1.04);
  transform: translateY(-1px);
}
.ad-builder-create-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  filter: grayscale(0.5);
  transform: none;
  box-shadow: none;
}

.ad-builder-status {
  margin: 0;
  color: #9cb0cd;
  font-size: 0.8rem;
  line-height: 1.56;
  min-height: 1.2em;
  padding: 0 4px;
}

.ad-builder-status[data-tone="error"] {
  color: #fca5a5;
}

.ad-builder-status[data-tone="success"] {
  color: #86efac;
}

.ad-builder-status[data-tone="info"] {
  color: #bfdbfe;
}

.ad-library-card {
  position: fixed;
  left: calc(var(--ad-builder-width) + var(--ad-builder-gap));
  right: 0;
  top: calc(var(--ad-header-height) + var(--ad-workspace-top-gap));
  bottom: var(--ad-rail-height);
  transition: left 0.3s ease;
  display: grid;
  gap: 0;
  min-height: 0;
  overflow: hidden;
}

.ad-workspace-stage {
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  overflow: hidden;
  display: grid;
  align-items: stretch;
  justify-items: stretch;
  box-shadow: none;
}

.ad-workspace-empty {
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  border-radius: 0;
  padding: 24px 28px;
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
}

.auth-gate-login-btn {
  font-size: 1.25rem;
  font-weight: 500;
}

.auth-gate-showcase-points span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 1.2rem;
  color: rgba(200, 215, 240, 0.65);
}

.auth-gate-showcase-desc {
  font-size: 1.3rem;
  line-height: 1.65;
  color: rgba(180, 200, 230, 0.5);
}

.ad-workspace-empty[hidden] {
  display: none !important;
}

.ad-workspace-empty h2 {
  margin: 0;
  color: #f7f9ff;
  font-size: 3.0rem;
  font-weight: 500;
  line-height: 1.08;
}

.ad-workspace-empty .ad-library-subtitle {
  max-width: 640px;
}

/* ── Ad Auth Gate ── */
.ad-auth-gate {
  width: 100%;
}

.ad-auth-gate.is-hidden {
  display: none;
}

/* ── Auth Gate entrance transitions ── */
@keyframes ad-gate-fade-up {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes ad-gate-fade-in-scale {
  from {
    opacity: 0;
    transform: scale(0.96) var(--_card-rotate, rotate(0deg));
  }
  to {
    opacity: 1;
    transform: scale(1) var(--_card-rotate, rotate(0deg));
  }
}

/* Text side: stagger each child fading up */
.ad-auth-gate.is-visible .ad-auth-gate-text > * {
  opacity: 0;
  animation: ad-gate-fade-up 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.ad-auth-gate.is-visible .ad-auth-gate-text > :nth-child(1) { animation-delay: 0.10s; }
.ad-auth-gate.is-visible .ad-auth-gate-text > :nth-child(2) { animation-delay: 0.18s; }
.ad-auth-gate.is-visible .ad-auth-gate-text > :nth-child(3) { animation-delay: 0.26s; }
.ad-auth-gate.is-visible .ad-auth-gate-text > :nth-child(4) { animation-delay: 0.34s; }
.ad-auth-gate.is-visible .ad-auth-gate-text > :nth-child(n+5) { animation-delay: 0.42s; }

/* Cards side: fade + scale, preserve rotation */
.ad-auth-gate-cards .ad-gate-card {
  opacity: 0;
}

.ad-auth-gate.is-visible .ad-gate-card-main {
  --_card-rotate: rotate(-2deg);
  animation: ad-gate-fade-in-scale 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.20s both;
}

.ad-auth-gate.is-visible .ad-gate-card-tr {
  --_card-rotate: rotate(10deg);
  animation: ad-gate-fade-in-scale 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.28s both;
}

.ad-auth-gate.is-visible .ad-gate-card-bl {
  --_card-rotate: rotate(-15deg);
  animation: ad-gate-fade-in-scale 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.36s both;
}

@media (prefers-reduced-motion: reduce) {
  .ad-auth-gate.is-visible .ad-auth-gate-text > *,
  .ad-auth-gate.is-visible .ad-gate-card {
    animation: none;
    opacity: 1;
  }
}

#ad-empty-default.is-hidden {
  display: none;
}

.ad-auth-gate-showcase {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
  max-width: 960px;
  margin: 0 auto;
}

/* Floating cards */
.ad-auth-gate-cards {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  min-height: 380px;
}

.ad-gate-card {
  position: absolute;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #111827;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

/* Main card — large, center-left */
.ad-gate-card-main {
  top: -20%;
  left:-5%;
  width: 80%;
  z-index: 1;
  transform: rotate(-2deg);
}

.ad-gate-card-main img {
  width: 100%;
  display: block;
}

/* Top-right card — overlapping */
.ad-gate-card-tr {
  top: -30%;
  right: -23%;
  width: 65%;
  z-index: 2;
  transform: rotate(10deg);
}

/* Bottom-left card — overlapping */
.ad-gate-card-bl {
  bottom: -1%;
  left: -7%;
  width: 75%;
  z-index: 3;
  transform: rotate(-15deg);
}

.ad-gate-card-header {
  padding: 12px 14px 8px;
}

.ad-gate-card-header strong {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: #e2efff;
}

.ad-gate-card-header span {
  font-size: 0.7rem;
  color: rgba(180, 200, 230, 0.4);
}

.ad-gate-card-grid {
  display: grid;
  gap: 4px;
  padding: 0 8px 8px;
}

.ad-gate-card-grid.is-2col {
  grid-template-columns: repeat(2, 1fr);
}

.ad-gate-card-grid.is-3col {
  grid-template-columns: repeat(3, 1fr);
}

.ad-gate-card-grid img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 8px;
  display: block;
}

@media (max-width: 900px) {
  .ad-auth-gate-showcase {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 32px;
  }
  .ad-auth-gate-cards {
    min-height: 280px;
  }
  .ad-gate-card-main { width: 65%; }
  .ad-gate-card-tr { width: 50%; }
  .ad-gate-card-bl { width: 45%; }
}

@media (max-width: 720px) {
  .ad-auth-gate-cards {
    position: relative;
    aspect-ratio: auto;
    min-height: 360px;
    max-width: 360px;
    margin: 0 auto;
    padding: 40px 8px 16px;
  }

  .ad-auth-gate-cards .ad-gate-card {
    position: absolute;
  }

  .ad-gate-card-main {
    top: 20px;
    left: 0;
    right: auto;
    width: 55%;
    transform: rotate(-3deg);
  }

  .ad-gate-card-tr {
    top: 0;
    right: 0;
    left: auto;
    width: 48%;
    transform: rotate(5deg);
  }

  .ad-gate-card-bl {
    bottom: 0;
    left: 18%;
    right: auto;
    width: 52%;
    transform: rotate(-8deg);
  }

  /* Keep the new scale-based entry animation rotation in sync */
  .ad-auth-gate.is-visible .ad-gate-card-main { --_card-rotate: rotate(-3deg); }
  .ad-auth-gate.is-visible .ad-gate-card-tr { --_card-rotate: rotate(5deg); }
  .ad-auth-gate.is-visible .ad-gate-card-bl { --_card-rotate: rotate(-8deg); }
}

.ad-workspace-selected {
  display: flex;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  align-items: stretch;
  justify-content: stretch;
  padding: 18px 20px 16px;
}

.ad-workspace-selected[hidden] {
  display: none !important;
}

.ad-workspace-selected .ad-project-detail-head {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  justify-self: stretch;
  justify-items: start;
}

.ad-project-rail-section {
  position: fixed;
  left: calc(var(--ad-builder-width) + var(--ad-builder-gap));
  right: 0;
  bottom: 0;
  transition: left 0.3s ease;
  z-index: 38;
  width: auto;
  min-width: 0;
  height: var(--ad-rail-height);
  min-height: var(--ad-rail-height);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 14px 12px;
  border: 0;
  border-radius: 0;
  background: rgba(7, 11, 19, 0.9);
  backdrop-filter: blur(14px);
  box-shadow: none;
}

.ad-rail-head {
  align-items: center;
  padding: 0 4px;
}

.ad-rail-head .ad-library-kicker {
  display: none;
}

.ad-rail-head .ad-library-subtitle {
  display: none;
}

.ad-rail-head h2 {
  font-size: 0.9rem;
}

.ad-project-rail {
  display: flex;
  flex: 1 1 0;
  align-items: stretch;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  min-height: 0;
  padding: 2px 2px 6px;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  scrollbar-color: rgba(103, 119, 157, 0.56) transparent;
}

.ad-rail-empty {
  min-width: min(100%, 100%);
  min-height: 96px;
  padding: 14px 16px;
  border: 1px dashed rgba(107, 132, 167, 0.22);
  border-radius: 14px;
  background: rgba(10, 15, 25, 0.72);
  color: #9fb0cc;
  font-size: 0.84rem;
  line-height: 1.55;
  display: grid;
  align-content: center;
  text-align:center;
}

.ad-project-rail::-webkit-scrollbar {
  height: 10px;
}

.ad-project-rail::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(103, 119, 157, 0.56);
}

.ad-project-rail-card {
  position: relative;
  flex: 0 0 147px;
  width: 147px;
  max-width: 147px;
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 0;
  background: rgba(12, 16, 27, 0.94);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  scroll-snap-align: start;
  transform: translateY(0) scale(1);
  will-change: transform, box-shadow, border-color;
  transition:
    border-color 220ms ease,
    background-color 220ms ease,
    transform 240ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 240ms cubic-bezier(0.22, 1, 0.36, 1);
}

.ad-project-rail-item {
  position: relative;
  flex: 0 0 125px;
  max-width: 125px;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.ad-project-rail-item.is-generating-video {
  border-radius: 14px;
  outline: 2px solid rgba(196, 181, 253, 0.4);
  outline-offset: -2px;
  animation: ad-rail-video-pulse 1.5s ease infinite;
}
@keyframes ad-rail-video-pulse {
  0%, 100% { outline-color: rgba(196, 181, 253, 0.4); }
  50% { outline-color: rgba(196, 181, 253, 0.1); }
}

.ad-rail-video-generating {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
  border-radius: 10px;
}

.ad-project-rail-item .ad-project-rail-card {
  flex: 1 1 0;
  width: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.ad-project-rail-delete-btn {
  position: absolute;
  top: 2px;
  right: 2px;
  z-index: 3;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background: rgba(10, 14, 23, 0.9);
  color: #f8fbff;
  font: inherit;
  font-size: 14px;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  opacity: 0;
  transform: translateY(-4px) scale(0.94);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease, background 180ms ease, border-color 180ms ease;
}

.ad-project-rail-item:hover .ad-project-rail-delete-btn {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.ad-project-rail-delete-btn:hover,
.ad-project-rail-delete-btn:focus-visible {
  background: rgba(96, 20, 20, 0.95);
  border-color: rgba(248, 113, 113, 0.45);
}

.ad-project-rail-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(135, 166, 255, 0.1), transparent 28%),
    radial-gradient(circle at top right, rgba(134, 92, 246, 0.16), transparent 42%);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 220ms ease, transform 260ms ease;
}

.ad-project-rail-card:hover {
  border-color: rgba(104, 143, 214, 0.38);
  background: rgba(14, 19, 32, 0.98);
  transform: translateY(-4px) scale(1.012);
  box-shadow: 0 24px 42px rgba(6, 10, 18, 0.34);
}

.ad-project-rail-card:hover::after,
.ad-project-rail-card:focus-visible::after,
.ad-project-rail-card.is-active::after {
  opacity: 1;
  transform: translateY(0);
}

.ad-project-rail-card:active {
  transform: translateY(-1px) scale(0.992);
}

.ad-project-rail-card.is-active {
  border-color: rgba(121, 170, 255, 0.82);
  background: rgba(16, 22, 38, 0.98);
  transform: translateY(-3px);
  box-shadow: 0 0 0 1px rgba(121, 170, 255, 0.16), 0 22px 40px rgba(6, 10, 18, 0.32);
}

.ad-project-rail-cover-wrap {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
  border-radius: inherit;
}

.ad-project-rail-cover-wrap > .ad-project-rail-status {
  position: absolute;
  bottom: 4px;
  left: 4px;
  z-index: 2;
  font-size: 0.58rem;
  min-height: 18px;
  padding: 0 6px;
}

.ad-project-rail-cover-wrap > .ad-project-rail-count {
  position: absolute;
  top: 4px;
  left: 4px;
  z-index: 2;
  font-size: 0.58rem;
  min-height: 18px;
  padding: 0 6px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  color: rgba(255, 255, 255, 0.9);
}

.ad-project-rail-cover {
  width: 100%;
  height: 100%;
  background-image: var(--project-cover);
  background-size: cover;
  background-position: center;
  background-color: #101624;
  box-shadow: inset 0 0 0 1px rgba(12, 18, 30, 0.92);
  transform: scale(1);
  transform-origin: center;
  transition: transform 280ms cubic-bezier(0.22, 1, 0.36, 1), filter 220ms ease;
}

.ad-project-rail-cover.is-loading,
.ad-project-rail-cover.is-empty,
.ad-project-rail-cover.is-failed {
  background-image: none;
}

.ad-project-rail-cover.is-loading {
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.02) 20%, rgba(255, 255, 255, 0.08) 40%, rgba(255, 255, 255, 0.02) 60%),
    radial-gradient(circle at 50% 18%, rgba(139, 92, 246, 0.22), rgba(255, 255, 255, 0.04) 62%),
    linear-gradient(180deg, rgba(12, 19, 31, 0.96), rgba(9, 14, 23, 1));
  background-size: 220% 100%, 100% 100%, 100% 100%;
  animation: ad-shot-shimmer 2.6s linear infinite;
}

.ad-project-rail-cover.is-empty {
  background:
    radial-gradient(circle at top left, rgba(91, 120, 167, 0.18), transparent 50%),
    linear-gradient(180deg, rgba(12, 19, 31, 0.96), rgba(9, 14, 23, 1));
}

.ad-project-rail-cover.is-failed {
  background:
    linear-gradient(180deg, rgba(83, 20, 20, 0.72), rgba(29, 10, 10, 0.96)),
    linear-gradient(135deg, rgba(239, 68, 68, 0.14), transparent 58%);
}

.ad-project-rail-card:hover .ad-project-rail-cover,
.ad-project-rail-card:focus-visible .ad-project-rail-cover,
.ad-project-rail-card.is-active .ad-project-rail-cover {
  transform: scale(1.04);
  filter: saturate(1.05) brightness(1.03);
}

.ad-project-rail-body {
  display: grid;
  gap: 6px;
  padding: 8px 9px 9px;
  min-width: 0;
  overflow: hidden;
  transition: transform 220ms ease;
}

.ad-project-rail-body .ad-project-card-head {
  min-width: 0;
  overflow: hidden;
}

.ad-project-rail-body .ad-project-card-head > div {
  min-width: 0;
  overflow: hidden;
}

.ad-project-rail-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ad-project-rail-status,
.ad-project-rail-count {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 600;
  white-space: nowrap;
}

.ad-project-rail-status {
  border: 1px solid rgba(121, 170, 255, 0.18);
  background: rgba(14, 20, 32, 0.84);
  color: #dbeafe;
}

.ad-project-rail-status.is-ready {
  border-color: rgba(34, 197, 94, 0.24);
  background: rgba(8, 31, 18, 0.84);
  color: #86efac;
}

.ad-project-rail-status.is-partial {
  border-color: rgba(245, 158, 11, 0.24);
  background: rgba(41, 25, 4, 0.84);
  color: #fcd34d;
}

.ad-project-rail-status.is-failed {
  border-color: rgba(239, 68, 68, 0.24);
  background: rgba(42, 16, 16, 0.84);
  color: #fca5a5;
}

.ad-project-rail-status.is-queued,
.ad-project-rail-status.is-generating {
  border-color: rgba(96, 165, 250, 0.24);
  background: rgba(10, 24, 41, 0.84);
  color: #93c5fd;
}

.ad-project-rail-count {
  background: rgba(255, 255, 255, 0.04);
  color: #93a7c7;
}

.ad-project-rail-card:hover .ad-project-rail-body,
.ad-project-rail-card:focus-visible .ad-project-rail-body,
.ad-project-rail-card.is-active .ad-project-rail-body {
  transform: translateY(-1px);
}

@media (prefers-reduced-motion: reduce) {
  .ad-project-rail-card,
  .ad-project-rail-card::after,
  .ad-project-rail-cover,
  .ad-project-rail-body {
    transition: none;
  }
}

.ad-project-rail-body .ad-project-card-head h3 {
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ad-project-rail-body .ad-project-card-head p {
  font-size: 0.72rem;
  line-height: 1.44;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ad-library-view {
  display: grid;
  gap: 16px;
}

.ad-library-view[hidden] {
  display: none !important;
}

.ad-library-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
}

.ad-library-subtitle {
  margin: 10px 0 0;
  color: #9fb0cc;
  font-size: 1.2rem;
  line-height: 1.6;
}

.ad-project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(292px, 1fr));
  gap: 14px;
}

.ad-project-card {
  display: grid;
  gap: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  background: rgba(12, 16, 27, 0.94);
  transition: border-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.ad-project-card:hover {
  border-color: rgba(104, 143, 214, 0.38);
  transform: translateY(-2px);
  box-shadow: 0 22px 40px rgba(6, 10, 18, 0.28);
}

.ad-project-cover {
  aspect-ratio: 16 / 10;
  background-image: var(--project-cover);
  background-size: cover;
  background-position: center;
  background-color: #101624;
  box-shadow: inset 0 0 0 1px rgba(12, 18, 30, 0.92);
}

.ad-project-card-body {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.ad-project-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.ad-project-card-head h3 {
  margin: 0 0 4px;
  color: #f7f9ff;
  font-size: 1rem;
  font-weight: 500;
}

.ad-project-card-head p {
  margin: 0;
  color: #9fb0cc;
  font-size: 0.82rem;
}

.ad-project-open-btn,
.ad-project-back-btn,
.ad-project-media-btn {
  border: 1px solid rgba(104, 66, 170, 0.42);
  border-radius: 12px;
  background: rgba(7, 11, 19, 0.82);
  color: #eef4ff;
  font: inherit;
  cursor: pointer;
}

.ad-project-open-btn,
.ad-project-back-btn {
  min-height: 40px;
  padding: 0 14px;
  justify-self: start;
}

.ad-project-media-btn {
  min-height: 36px;
  padding: 0 12px;
  white-space: nowrap;
}

.ad-project-open-btn:hover,
.ad-project-back-btn:hover,
.ad-project-media-btn:hover {
  border-color: rgba(121, 170, 255, 0.76);
}

.ad-project-media-btn.is-ghost {
  cursor: default;
  opacity: 0.82;
}

.ad-project-media-btn:disabled {
  cursor: default;
  opacity: 0.82;
}

.ad-project-media-btn.is-retry {
  background: rgba(220, 60, 60, 0.72);
  border-color: rgba(255, 100, 100, 0.56);
  color: #fff;
  cursor: pointer;
  font-weight: 500;
}

.ad-project-media-btn.is-retry:hover {
  background: rgba(230, 70, 70, 0.88);
  border-color: rgba(255, 120, 120, 0.8);
}

.ad-project-media-btn.is-retry:disabled {
  background: rgba(120, 60, 60, 0.52);
  border-color: rgba(180, 100, 100, 0.36);
  cursor: default;
  opacity: 0.72;
}

.ad-project-detail {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
  flex: 1 1 auto;
  height: 100%;
  min-height: 0;
  width: 100%;
  align-content: stretch;
}

.ad-project-detail-head {
  display: grid;
  gap: 14px;
  width: 100%;
  flex: 0 0 auto;
  align-self: start;
  justify-self: stretch;
}

.ad-project-detail-head-side {
  display: grid;
  justify-items: end;
  align-content: start;
  gap: 10px;
}

.ad-project-detail-badges {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.ad-project-detail-title h2 {
  margin: 0 0 6px;
  color: #f7f9ff;
  font-size: 1.34rem;
  line-height: 1.08;
}
.ad-project-name-editable {
  cursor: pointer;
  border-radius: 6px;
  padding: 2px 4px;
  margin: -2px -4px;
  transition: background 0.15s;
}
.ad-project-name-editable:hover {
  background: rgba(255, 255, 255, 0.06);
}
.ad-project-name-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(121, 170, 255, 0.4);
  border-radius: 6px;
  color: #f7f9ff;
  font: inherit;
  font-size: inherit;
  line-height: inherit;
  padding: 2px 6px;
  outline: none;
}
.ad-project-name-input:focus {
  border-color: rgba(121, 170, 255, 0.7);
  box-shadow: 0 0 0 2px rgba(121, 170, 255, 0.15);
}

.ad-project-detail-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.ad-project-detail-title h2 { flex: 0 0 auto; }
.ad-project-detail-title p {
  width: 100%;
  margin: 0;
  color: #9fb0cc;
  font-size: 0.88rem;
}
.ad-project-edit-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  background: rgba(255,255,255,0.04);
  color: #9fb0cc;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.ad-project-edit-btn:hover {
  background: rgba(255,255,255,0.1);
  color: #e0eaff;
}

/* ── Edit product popup ── */
.ad-edit-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
}
.ad-edit-popup-overlay[hidden] { display: none; }
.ad-edit-popup {
  width: 420px;
  max-width: 92vw;
  background: #1a1f2e;
  border: 1px solid rgba(121,170,255,0.2);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
  overflow: hidden;
}
.ad-edit-popup-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.ad-edit-popup-head h3 {
  margin: 0;
  color: #f7f9ff;
  font-size: 1.05rem;
}
.ad-edit-popup-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #9fb0cc;
  cursor: pointer;
}
.ad-edit-popup-close:hover { background: rgba(255,255,255,0.08); color: #fff; }
.ad-edit-popup-body {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ad-edit-popup-label {
  color: #9fb0cc;
  font-size: 0.82rem;
  font-weight: 500;
}
.ad-edit-popup-input,
.ad-edit-popup-textarea {
  width: 100%;
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(121,170,255,0.25);
  border-radius: 8px;
  color: #f7f9ff;
  font: inherit;
  font-size: 0.9rem;
  padding: 8px 10px;
  outline: none;
  box-sizing: border-box;
}
.ad-edit-popup-input:focus,
.ad-edit-popup-textarea:focus {
  border-color: rgba(121,170,255,0.6);
  box-shadow: 0 0 0 2px rgba(121,170,255,0.12);
}
.ad-edit-popup-textarea { resize: vertical; min-height: 80px; }
.ad-edit-popup-actions {
  display: flex;
  gap: 8px;
  padding: 12px 18px 16px;
}
.ad-edit-popup-save {
  flex: 1;
  padding: 8px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(50,80,140,0.7), rgba(80,60,160,0.6));
  color: #e0eaff;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.15s;
}
.ad-edit-popup-save:hover { filter: brightness(1.15); }
.ad-edit-popup-cancel {
  flex: 0 0 auto;
  padding: 8px 16px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  background: transparent;
  color: #9fb0cc;
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
}
.ad-edit-popup-cancel:hover { background: rgba(255,255,255,0.05); }

.ad-project-detail-info {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.ad-project-info-card {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid rgba(107, 132, 167, 0.18);
  border-radius: 16px;
  background: rgba(12, 16, 27, 0.94);
}

.ad-project-info-label {
  color: #8ca1c3;
  font-size: 0.76rem;
}

.ad-project-info-card strong {
  color: #eef4ff;
  font-size: 0.92rem;
  font-weight: 500;
}

.ad-project-detail-gallery {
  display: grid;
  width: 100%;
  flex: 1 1 auto;
  gap: 14px;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  align-content: start;
  justify-content: center;
}

.ad-project-detail-gallery.is-landscape {
  grid-template-columns: repeat(2, max-content);
  grid-auto-rows: max-content;
  justify-content: center;
}

.ad-project-detail-gallery.is-portrait,
.ad-project-detail-gallery.is-square {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-start;
  gap: 14px;
  justify-content: center;
}

.ad-project-detail-gallery.is-portrait .ad-project-media-card,
.ad-project-detail-gallery.is-square .ad-project-media-card {
  flex: 0 0 auto;
  min-height: 0;
}

.ad-project-media-card {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 0;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  background: rgba(12, 16, 27, 0.94);
  min-height: 0;
  align-content: stretch;
  overflow: hidden;
}

.ad-project-detail-gallery.is-landscape .ad-project-media-card {
  width: auto;
}

.ad-project-media-card.is-loading {
  border-color: rgba(107, 132, 167, 0.14);
}

.ad-project-media-card.is-failed {
  border-color: rgba(239, 68, 68, 0.22);
}

.ad-project-media-visual {
  display: block;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  width: 100%;
  border-radius: 0;
  background-image: var(--media-image);
  background-size: cover;
  background-position: center;
  background-color: #101624;
  box-shadow: inset 0 0 0 1px rgba(12, 18, 30, 0.92);
}

.ad-project-media-visual.is-landscape {
  aspect-ratio: 16 / 9;
  height: auto;
}

.ad-project-media-visual.is-portrait {
  aspect-ratio: 9 / 16;
  height: auto;
}

.ad-project-media-visual.is-square {
  aspect-ratio: 1 / 1;
  height: auto;
}

.ad-project-media-visual.is-loading {
  display: grid;
  place-items: center;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.02) 20%, rgba(255, 255, 255, 0.08) 40%, rgba(255, 255, 255, 0.02) 60%),
    radial-gradient(circle at 50% 18%, rgba(139, 92, 246, 0.28), rgba(255, 255, 255, 0.04) 62%),
    linear-gradient(180deg, rgba(12, 19, 31, 0.96), rgba(9, 14, 23, 1));
  background-size: 220% 100%, 100% 100%, 100% 100%;
  animation: ad-shot-shimmer 2.6s linear infinite;
}

.ad-project-media-status-text {
  color: rgba(200, 210, 235, 0.72);
  font-size: 1.5rem;
  font-weight: 500;
  text-align: center;
  padding: 0 12px;
  animation: ad-status-pulse 2s ease-in-out infinite;
}

@keyframes ad-status-pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

.ad-project-media-visual.is-failed {
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at top left, rgba(239, 68, 68, 0.12), transparent 40%),
    linear-gradient(180deg, rgba(22, 10, 15, 0.98), rgba(18, 12, 17, 1));
}

.ad-project-media-placeholder-copy {
  display: grid;
  gap: 8px;
  padding: 24px 20px;
  text-align: center;
  justify-items: center;
}

.ad-failed-icon {
  color: rgba(252, 165, 165, 0.6);
  margin-bottom: 2px;
}

.ad-project-media-placeholder-copy strong {
  color: rgba(254, 202, 202, 0.92);
  font-size: 0.88rem;
}

.ad-project-media-placeholder-copy span {
  color: rgba(200, 180, 185, 0.82);
  font-size: 0.76rem;
  line-height: 1.5;
  max-width: 260px;
}

.ad-project-media-btn.is-retry-inline {
  margin-top: 6px;
  min-height: 34px;
  padding: 0 20px;
  border-radius: 999px;
  font-size: 0.78rem;
}

/* ── Card selection ── */
.ad-project-media-card:not(.is-loading):not(.is-failed) {
  cursor: pointer;
  transition: border-color 180ms ease, transform 200ms ease, box-shadow 200ms ease;
}

.ad-project-media-card:not(.is-loading):not(.is-failed):hover {
  border-color: rgba(104, 143, 214, 0.42);
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(6, 10, 18, 0.32);
}

.ad-project-media-card.is-card-selected {
  border-color: rgba(121, 170, 255, 0.82) !important;
  box-shadow: 0 0 0 1px rgba(121, 170, 255, 0.22), 0 16px 36px rgba(6, 10, 18, 0.36) !important;
  transform: translateY(-2px) !important;
}

/* ── Image Popup Modal Overlay ── */
.ad-image-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 5000;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 280ms ease, visibility 0s linear 280ms;
}

.ad-image-popup-overlay.is-open {
  opacity: 1;
  visibility: visible;
  transition: opacity 280ms ease, visibility 0s linear 0s;
}

/* ── Popup container ── */
.ad-image-popup {
  position: relative;
  display: flex;
  max-width: 92vw;
  max-height: 88vh;
  border-radius: 18px;
  overflow: hidden;
  background: #111118;
  border: 1px solid rgba(138, 163, 196, 0.18);
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255,255,255,0.04);
  transform: scale(0.92) translateY(20px);
  transition: transform 320ms cubic-bezier(0.22, 1, 0.36, 1);
}

.ad-image-popup-overlay.is-open .ad-image-popup {
  transform: scale(1) translateY(0);
}

/* ── Close button ── */
.ad-image-popup-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 10;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  color: rgba(220, 230, 245, 0.85);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 160ms ease, border-color 160ms ease;
}

.ad-image-popup-close:hover {
  background: rgba(0, 0, 0, 0.7);
  border-color: rgba(255, 255, 255, 0.25);
  color: #fff;
}

/* ── Image preview area (left) ── */
.ad-image-popup-preview {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0a0a10;
  padding: 28px;
  position: relative;
}

.ad-popup-video-dots {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
}

.ad-image-popup-download {
  position: absolute;
  bottom: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.ad-image-popup-download:hover {
  background: rgba(0, 0, 0, 0.75);
  border-color: rgba(255, 255, 255, 0.45);
  color: #fff;
}

.ad-image-popup-img {
  max-width: 100%;
  max-height: 82vh;
  object-fit: contain;
  border-radius: 10px;
  user-select: none;
  -webkit-user-drag: none;
}
.ad-image-popup-video {
  max-width: 100%;
  max-height: 82vh;
  object-fit: contain;
  border-radius: 10px;
}
.ad-image-popup-video[hidden] {
  display: none;
}

/* ── Video tools sidebar (right) ── */
.ad-image-popup-sidebar {
  flex: 0 0 400px;
  width: 400px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background-color: #0d0d12;
  border-left: 1px solid rgba(138, 163, 196, 0.15);
  display: grid;
  align-content: start;
  grid-auto-rows: max-content;
  gap: 16px;
  padding: 24px 20px;
}

/* ── Keep workspace transitions for layout but no slide ── */
.ad-library-card,
.ad-project-rail-section {
  transition: left 340ms cubic-bezier(0.22, 1, 0.36, 1), right 340ms cubic-bezier(0.22, 1, 0.36, 1);
}

/* ── Responsive: stack + scroll together on small screens ── */
@media (max-width: 800px) {
  .ad-image-popup {
    flex-direction: column;
    max-width: 96vw;
    max-height: 94vh;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .ad-image-popup-preview {
    padding: 16px;
    flex: 0 0 auto;
  }
  .ad-image-popup-img {
    max-height: 50vh;
  }
  .ad-image-popup-sidebar {
    flex: 0 0 auto;
    width: 100%;
    max-height: none;
    overflow-y: visible;
    border-left: none;
    border-top: 1px solid rgba(138, 163, 196, 0.15);
  }
}

.ad-video-panel-head h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #f0f4fa;
  margin: 0;
}

.ad-video-panel-head p {
  font-size: 0.78rem;
  color: rgba(180, 195, 220, 0.7);
  margin: 4px 0 0;
}

/* (preview moved into popup image area) */

.ad-video-panel-form {
  display: grid;
  gap: 18px;
}

.ad-video-panel-field {
  display: grid;
  gap: 6px;
}

.ad-video-panel-field label {
  font-size: 0.90rem;
  font-weight: 400;
  color: rgba(200, 215, 240, 0.82);
}

.ad-video-panel-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

#ad-video-speech-mode,
#ad-video-concept-speech-choices,
#ad-video-concept-silent-choices,
.ad-video-filming-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

/* ── Filming style visual grid ── */
.ad-video-filming-visual-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.ad-filming-visual-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  padding: 0;
  border: 2px solid var(--btn-border, rgba(104, 66, 170, 0.35));
  border-radius: 10px;
  background: rgba(16, 24, 36, 0.6);
  color: rgba(165, 179, 203, 0.85);
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.18s, box-shadow 0.18s, transform 0.12s;
}
.ad-filming-visual-btn img,
.ad-filming-visual-btn video {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
  border-radius: 8px 8px 0 0;
  pointer-events: none;
  transition: opacity 0.18s;
}
.ad-filming-visual-btn .ad-filming-visual-video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  border-radius: 8px 8px 0 0;
}
.ad-filming-visual-btn span {
  display: block;
  width: 100%;
  padding: 5px 4px;
  font-size: 0.6rem;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}
.ad-filming-visual-btn.is-text-only {
  justify-content: center;
  padding: 8px;
}
.ad-filming-visual-btn.is-text-only span {
  font-size: 0.8rem;
  padding: 0;
}
.ad-filming-visual-btn:hover {
  border-color: rgba(165, 179, 203, 0.55);
  transform: translateY(-1px);
}
.ad-filming-visual-btn.is-active {
  border-color: var(--btn-active-bg, rgba(104, 66, 170, 0.9));
  box-shadow: 0 0 0 1px rgba(104, 66, 170, 0.5), 0 2px 8px rgba(104, 66, 170, 0.25);
  color: #fff;
}
.ad-filming-visual-btn.is-active img {
  opacity: 1;
}
.ad-filming-visual-btn:not(.is-active) img {
  opacity: 0.65;
}

.ad-video-choice-btn {
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--btn-border);
  border-radius: 999px;
  background: var(--btn-bg);
  color: var(--btn-color);
  font: inherit;
  font-size: 0.76rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.ad-video-choice-btn:hover {
  border-color: var(--btn-border-hover);
}

.ad-video-choice-btn.is-active {
  border: 0;
  background-color: var(--btn-active-bg);
  color: var(--btn-active-color);
  box-shadow: var(--btn-active-shadow);
}

.ad-video-panel-textarea {
  width: 100%;
  min-height: 72px;
  padding: 10px 12px;
  border: 1px solid rgba(130, 160, 210, 0.18);
  border-radius: 12px;
  background: rgba(12, 17, 28, 0.92);
  color: #dfe8f5;
  font: inherit;
  font-size: 0.82rem;
  line-height: 1.5;
  resize: vertical;
  transition: border-color 160ms ease;
}

.ad-video-panel-textarea:focus {
  outline: none;
  border-color: rgba(121, 170, 255, 0.55);
}

.ad-video-panel-textarea::placeholder {
  color: rgba(160, 175, 200, 0.4);
}

.ad-video-panel-field[hidden],
.ad-video-panel-group[hidden] {
  display: none;
}

.ad-video-orbit-btn[hidden] {
  display: none;
}

.ad-video-panel-actions {
  padding-top: 4px;
}

.ad-video-create-btn {
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(121, 170, 255, 0.35);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(50, 80, 140, 0.55), rgba(80, 60, 160, 0.45));
  color: #e0eaff;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: opacity 180ms ease, border-color 180ms ease, background 180ms ease;
}

.ad-video-create-btn:hover:not(:disabled) {
  border-color: rgba(121, 170, 255, 0.6);
  background: linear-gradient(135deg, rgba(60, 90, 160, 0.65), rgba(90, 70, 180, 0.55));
}

.ad-video-create-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.ad-video-create-btn-meta {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.88rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
}

.ad-video-create-btn-meta::after {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #ffb01f;
  box-shadow: 0 0 0 2px rgba(255, 176, 31, 0.14);
}

.ad-video-create-btn.is-loading {
  pointer-events: none;
  opacity: 0.7;
}

.ad-video-create-clip-btn {
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(170, 121, 255, 0.35);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(90, 50, 160, 0.50), rgba(140, 60, 120, 0.40));
  color: #e8d8ff;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: opacity 180ms ease, border-color 180ms ease, background 180ms ease;
}
.ad-video-create-clip-btn:hover:not(:disabled) {
  border-color: rgba(170, 121, 255, 0.6);
  background: linear-gradient(135deg, rgba(100, 60, 180, 0.60), rgba(150, 70, 130, 0.50));
}
.ad-video-create-clip-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.ad-video-create-clip-btn[hidden] {
  display: none;
}
.ad-video-create-clip-btn.is-loading {
  pointer-events: none;
  opacity: 0.7;
}

.ad-video-panel-actions {
  display: grid;
  gap: 8px;
}

.ad-video-panel-result {
  padding: 12px 0 0;
  border-top: 1px solid rgba(130, 160, 210, 0.15);
  margin-top: 8px;
}

.ad-video-panel-result[hidden] {
  display: none;
}

.ad-video-result-head {
  margin-bottom: 10px;
}

.ad-video-result-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: rgba(160, 200, 255, 0.9);
}

.ad-video-result-body {
  display: grid;
  gap: 10px;
}

.ad-video-result-player {
  width: 100%;
  max-height: 400px;
  border-radius: 10px;
  background: #000;
  object-fit: contain;
}
.ad-video-result-player[hidden] {
  display: none;
}

.ad-video-result-field label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: rgba(160, 180, 220, 0.7);
  margin-bottom: 3px;
}

.ad-video-result-field p {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.5;
  color: rgba(210, 225, 245, 0.92);
  background: rgba(10, 15, 30, 0.5);
  border-radius: 8px;
  padding: 8px 10px;
  word-break: break-word;
}

.ad-video-result-prompt-text {
  font-family: "Courier New", monospace;
  font-size: 0.72rem !important;
  max-height: 120px;
  overflow-y: auto;
}

.ad-video-copy-prompt-btn {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--btn-border);
  border-radius: 8px;
  background: var(--btn-bg);
  color: var(--btn-color);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: border-color 160ms ease, background 160ms ease;
}

.ad-video-copy-prompt-btn:hover {
  border-color: var(--btn-border-hover);
}

.ad-video-copy-prompt-btn.is-copied {
  border-color: rgba(80, 200, 120, 0.7);
  background: rgba(30, 140, 70, 0.4);
  color: #7afa9e;
  font-weight: 600;
}

.ad-platform-overlays {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.ad-platform-overlays[hidden] {
  display: none !important;
}

.ad-platform-overlay {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 180ms ease;
  color: #ffffff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.28);
}

.ad-project-detail[data-platform="youtube"] .ad-platform-overlay.is-youtube,
.ad-project-detail[data-platform="facebook"] .ad-platform-overlay.is-facebook,
.ad-project-detail[data-platform="tiktok"] .ad-platform-overlay.is-tiktok,
.ad-project-detail[data-platform="shopee"] .ad-platform-overlay.is-shopee {
  opacity: 1;
  visibility: visible;
}

.ad-platform-icon-btn,
.ad-platform-side-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  color: #ffffff;
}

.ad-platform-icon-btn {
  width: 24px;
  height: 24px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.28));
}

.ad-platform-side-icon {
  width: 34px;
  height: 34px;
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.28));
}

.ad-platform-icon-btn::before,
.ad-platform-side-icon::before {
  content: "";
  display: block;
  width: 100%;
  height: 100%;
  background: currentColor;
  -webkit-mask: var(--platform-icon) center / contain no-repeat;
  mask: var(--platform-icon) center / contain no-repeat;
}

.ad-platform-icon-btn.is-chevron-left,
.ad-platform-side-icon.is-chevron-left {
  --platform-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M14.7 4.3 7 12l7.7 7.7-1.4 1.4L4.2 12l9.1-9.1z'/%3E%3C/svg%3E");
}

.ad-platform-icon-btn.is-search,
.ad-platform-side-icon.is-search {
  --platform-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M10.5 3a7.5 7.5 0 1 0 4.66 13.38l4.73 4.73 1.41-1.41-4.73-4.73A7.5 7.5 0 0 0 10.5 3Zm0 2a5.5 5.5 0 1 1 0 11 5.5 5.5 0 0 1 0-11Z'/%3E%3C/svg%3E");
}

.ad-platform-icon-btn.is-dots-vertical,
.ad-platform-side-icon.is-dots-vertical {
  --platform-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='5' r='2.2' fill='black'/%3E%3Ccircle cx='12' cy='12' r='2.2' fill='black'/%3E%3Ccircle cx='12' cy='19' r='2.2' fill='black'/%3E%3C/svg%3E");
}

.ad-platform-icon-btn.is-youtube-back {
  --platform-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round' d='M15 5 8 12l7 7'/%3E%3C/svg%3E");
}

.ad-platform-icon-btn.is-youtube-search {
  --platform-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='10.5' cy='10.5' r='6' fill='none' stroke='black' stroke-width='2.2'/%3E%3Cpath fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' d='m15.5 15.5 4.5 4.5'/%3E%3C/svg%3E");
}

.ad-platform-icon-btn.is-youtube-more {
  --platform-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='5' r='1.8' fill='black'/%3E%3Ccircle cx='12' cy='12' r='1.8' fill='black'/%3E%3Ccircle cx='12' cy='19' r='1.8' fill='black'/%3E%3C/svg%3E");
}

.ad-platform-icon-btn.is-tiktok-search {
  --platform-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='10.5' cy='10.5' r='5.6' fill='none' stroke='black' stroke-width='2.1'/%3E%3Cpath fill='none' stroke='black' stroke-width='2.1' stroke-linecap='round' d='m15.1 15.1 4.2 4.2'/%3E%3C/svg%3E");
}

.ad-platform-side-icon.is-youtube-like {
  --platform-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='1.9' stroke-linejoin='round' d='M14.5 10V5.8c0-1-.8-1.8-1.8-1.8L8.3 9.3c-.2.3-.3.6-.3 1V20h9.6c.8 0 1.4-.5 1.7-1.2l2-5.9c.1-.5-.2-.9-.7-.9H14.5ZM3 10h3v10H3z'/%3E%3C/svg%3E");
}

.ad-platform-side-icon.is-youtube-dislike {
  --platform-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg transform='rotate(180 12 12)'%3E%3Cpath fill='none' stroke='black' stroke-width='1.9' stroke-linejoin='round' d='M14.5 10V5.8c0-1-.8-1.8-1.8-1.8L8.3 9.3c-.2.3-.3.6-.3 1V20h9.6c.8 0 1.4-.5 1.7-1.2l2-5.9c.1-.5-.2-.9-.7-.9H14.5ZM3 10h3v10H3z'/%3E%3C/g%3E%3C/svg%3E");
}

.ad-platform-side-icon.is-youtube-comment {
  --platform-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='1.9' stroke-linejoin='round' d='M5 5h14v10H9l-4 4V5Z'/%3E%3C/svg%3E");
}

.ad-platform-side-icon.is-youtube-share {
  --platform-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round' d='m13 5 6 7-6 7M19 12H5'/%3E%3C/svg%3E");
}

.ad-platform-side-icon.is-youtube-remix {
  --platform-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round' d='M7 7h7a3 3 0 0 1 3 3v2m0 0-2-2m2 2 2-2M17 17h-7a3 3 0 0 1-3-3v-2m0 0 2 2m-2-2-2 2'/%3E%3C/svg%3E");
}

.ad-platform-icon-btn.is-close,
.ad-platform-side-icon.is-close {
  --platform-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='m6.4 5 5.6 5.6L17.6 5 19 6.4 13.4 12l5.6 5.6-1.4 1.4-5.6-5.6L6.4 19 5 17.6l5.6-5.6L5 6.4z'/%3E%3C/svg%3E");
}

.ad-platform-icon-btn.is-profile,
.ad-platform-side-icon.is-profile {
  --platform-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8Zm0 2c-4.42 0-8 1.79-8 4v2h16v-2c0-2.21-3.58-4-8-4Z'/%3E%3C/svg%3E");
}

.ad-platform-icon-btn.is-comment,
.ad-platform-side-icon.is-comment {
  --platform-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M4 4h16v11H8l-4 4V4Zm2 2v8.17L7.17 13H18V6H6Z'/%3E%3C/svg%3E");
}

.ad-platform-icon-btn.is-share,
.ad-platform-side-icon.is-share {
  --platform-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M14 3 22 12l-8 9v-5c-5.33 0-8.67 1.67-12 5 1.33-6.67 5.33-11 12-12V3Z'/%3E%3C/svg%3E");
}

.ad-platform-icon-btn.is-bookmark,
.ad-platform-side-icon.is-bookmark {
  --platform-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M6 3h12a2 2 0 0 1 2 2v16l-8-4-8 4V5a2 2 0 0 1 2-2Z'/%3E%3C/svg%3E");
}

.ad-platform-icon-btn.is-heart,
.ad-platform-side-icon.is-heart {
  --platform-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 21s-7.2-4.58-9.6-9.09C.76 8.85 2.39 5 6.18 5c2.11 0 3.39 1.19 4.18 2.3C11.15 6.19 12.43 5 14.54 5 18.33 5 19.96 8.85 21.6 11.91 19.2 16.42 12 21 12 21Z'/%3E%3C/svg%3E");
}

.ad-platform-icon-btn.is-cart,
.ad-platform-side-icon.is-cart {
  --platform-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M7 4H3v2h2.2l2.35 9.39A2 2 0 0 0 9.5 17H18a2 2 0 0 0 1.94-1.5L22 8H8.1l-.6-2.4A2 2 0 0 0 5.56 4H7Zm3 15a2 2 0 1 0 0 4 2 2 0 0 0 0-4Zm8 0a2 2 0 1 0 0 4 2 2 0 0 0 0-4Z'/%3E%3C/svg%3E");
}

.ad-platform-side-icon.is-tiktok-heart {
  --platform-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round' d='M12 20.6s-7-4.5-9.1-8.8C1.5 8.8 3 5.6 6.3 5.6c2 0 3.4 1.1 4.4 2.5 1-1.4 2.4-2.5 4.4-2.5 3.3 0 4.8 3.2 3.4 6.2-2.1 4.3-9.1 8.8-9.1 8.8Z'/%3E%3C/svg%3E");
}

.ad-platform-side-icon.is-tiktok-comment {
  --platform-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='1.9' stroke-linejoin='round' d='M5 5.5h14v9.8H10l-4 3.7V5.5Z'/%3E%3Ccircle cx='9' cy='10.3' r='1' fill='black'/%3E%3Ccircle cx='12' cy='10.3' r='1' fill='black'/%3E%3Ccircle cx='15' cy='10.3' r='1' fill='black'/%3E%3C/svg%3E");
}

.ad-platform-side-icon.is-tiktok-bookmark {
  --platform-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='1.9' stroke-linejoin='round' d='M7 4.8h10a1.4 1.4 0 0 1 1.4 1.4v13.5L12 16.1l-6.4 3.6V6.2A1.4 1.4 0 0 1 7 4.8Z'/%3E%3C/svg%3E");
}

.ad-platform-side-icon.is-tiktok-share {
  --platform-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round' d='m13.2 4.8 6.2 6.2-6.2 6.2M19.2 11H6.6m0 0 2.8-2.8M6.6 11l2.8 2.8'/%3E%3C/svg%3E");
}

.ad-platform-icon-btn.is-thumbs-up,
.ad-platform-side-icon.is-thumbs-up,
.ad-platform-icon-btn.is-thumbs-down,
.ad-platform-side-icon.is-thumbs-down {
  --platform-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M2 10h4v12H2zM22 11c0-1.1-.9-2-2-2h-6l1-4V4c0-.41-.17-.79-.44-1.06L13 1 6.59 7.41C6.22 7.78 6 8.3 6 8.83V19c0 1.1.9 2 2 2h9c.82 0 1.54-.5 1.84-1.22l3.02-7.05c.09-.23.14-.47.14-.73v-1Z'/%3E%3C/svg%3E");
}

.ad-platform-icon-btn.is-thumbs-down::before,
.ad-platform-side-icon.is-thumbs-down::before {
  transform: rotate(180deg);
}

.ad-platform-icon-btn.is-remix,
.ad-platform-side-icon.is-remix {
  --platform-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M17 1l4 4-4 4V6H9a4 4 0 0 0-4 4v2H3v-2a6 6 0 0 1 6-6h8V1ZM7 23l-4-4 4-4v3h8a4 4 0 0 0 4-4v-2h2v2a6 6 0 0 1-6 6H7v3Z'/%3E%3C/svg%3E");
}

.ad-platform-toolbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.ad-platform-side-rail {
  position: absolute;
  right: 12px;
  z-index: 4;
  display: grid;
  justify-items: center;
  gap: 12px;
}

.ad-platform-side-item {
  display: grid;
  justify-items: center;
  gap: 5px;
}

.ad-platform-avatar-chip {
  display: grid;
  place-items: center;
  min-width: 38px;
  height: 38px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.96), rgba(59, 130, 246, 0.96));
  box-shadow: 0 10px 24px rgba(6, 10, 18, 0.2);
  font-size: 0.62rem;
  font-weight: 700;
  white-space: nowrap;
}

.ad-platform-avatar-chip.is-dark {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.96), rgba(37, 99, 235, 0.96));
}

.ad-platform-avatar-chip.is-photo {
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.96), rgba(251, 191, 36, 0.96));
}

.ad-platform-avatar-chip.is-youtube {
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(147, 51, 234, 0.98), rgba(99, 102, 241, 0.98));
}

.ad-platform-avatar-stack {
  position: relative;
  display: inline-flex;
}

.ad-platform-add-badge,
.ad-platform-cart-badge {
  position: absolute;
  right: -4px;
  bottom: -2px;
  display: grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: #ff375f;
  color: #ffffff;
  font-size: 0.6rem;
  font-weight: 800;
  box-shadow: 0 0 0 2px rgba(7, 11, 19, 0.84);
}

.ad-platform-cart-badge {
  right: -6px;
  top: -4px;
  bottom: auto;
  background: #fb923c;
}

.ad-platform-side-item strong {
  color: #ffffff;
  font-size: 0.67rem;
  line-height: 1.05;
  font-weight: 600;
  text-align: center;
}

.ad-platform-caption {
  margin: 0;
  max-width: calc(100% - 84px);
  color: rgba(255, 255, 255, 0.96);
  font-size: 0.69rem;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ad-platform-overlay.is-youtube {
  background: linear-gradient(180deg, rgba(7, 11, 19, 0.08) 0%, rgba(7, 11, 19, 0.02) 40%, rgba(7, 11, 19, 0.5) 100%);
}

.ad-platform-youtube-topbar {
  position: absolute;
  top: 18px;
  left: 18px;
  right: 18px;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.ad-platform-toolbar-actions.is-youtube {
  gap: 18px;
}

.ad-platform-overlay.is-youtube .ad-platform-icon-btn {
  width: 26px;
  height: 26px;
}

.ad-platform-overlay.is-youtube .ad-platform-side-icon {
  width: 31px;
  height: 31px;
}

.ad-platform-side-rail.is-youtube {
  top: 98px;
  right: 16px;
  bottom: 94px;
  gap: 16px;
  align-content: end;
}

.ad-platform-side-rail.is-youtube .ad-platform-side-item {
  gap: 7px;
}

.ad-platform-side-rail.is-youtube .ad-platform-side-item strong {
  font-size: 0.62rem;
}

.ad-platform-youtube-bottom {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  display: grid;
  gap: 9px;
  padding: 0 16px 18px;
  background: linear-gradient(180deg, rgba(7, 11, 19, 0) 0%, rgba(7, 11, 19, 0.22) 22%, rgba(7, 11, 19, 0.84) 100%);
}

.ad-platform-creator-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-right: 70px;
}

.ad-platform-creator-handle {
  font-size: 0.74rem;
  font-weight: 700;
}

.ad-platform-youtube-channel {
  display: grid;
  gap: 2px;
  min-width: 0;
  flex: 1 1 auto;
}

.ad-platform-caption.is-youtube {
  max-width: calc(100% - 82px);
  font-size: 0.68rem;
  line-height: 1.38;
}

.ad-platform-overlay.is-facebook {
  background: linear-gradient(180deg, rgba(7, 11, 19, 0.08) 0%, rgba(7, 11, 19, 0.02) 38%, rgba(7, 11, 19, 0.56) 100%);
}

.ad-platform-facebook-topline {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.ad-platform-facebook-topbar {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ad-platform-side-rail.is-facebook {
  top: 78px;
  bottom: 128px;
  align-content: end;
}

.ad-platform-facebook-bottom {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  display: grid;
  gap: 8px;
  padding: 0 14px 14px;
  background: linear-gradient(180deg, rgba(7, 11, 19, 0) 0%, rgba(7, 11, 19, 0.2) 22%, rgba(7, 11, 19, 0.88) 100%);
}

.ad-platform-facebook-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-right: 78px;
}

.ad-platform-facebook-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.ad-platform-facebook-copy strong {
  font-size: 0.74rem;
  font-weight: 700;
}

.ad-platform-facebook-copy span {
  color: rgba(233, 241, 255, 0.82);
  font-size: 0.66rem;
}

.ad-platform-overlay.is-tiktok {
  background: linear-gradient(180deg, rgba(7, 11, 19, 0.08) 0%, rgba(7, 11, 19, 0.02) 32%, rgba(7, 11, 19, 0.72) 100%);
}

.ad-platform-tiktok-topbar {
  position: absolute;
  top: 16px;
  left: 14px;
  right: 14px;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ad-platform-tiktok-tabs {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  flex: 1 1 auto;
  font-size: 0.66rem;
  font-weight: 600;
}

.ad-platform-tiktok-tabs .is-active {
  padding-bottom: 4px;
  border-bottom: 2px solid rgba(255, 255, 255, 0.94);
  font-weight: 700;
}

.ad-platform-overlay.is-tiktok .ad-platform-icon-btn {
  width: 25px;
  height: 25px;
}

.ad-platform-overlay.is-tiktok .ad-platform-side-icon {
  width: 31px;
  height: 31px;
}

.ad-platform-tab-live {
  flex: 0 0 auto;
  width: 35px;
  height: 30px;
  display: inline-block;
  background: url("../../icon/tiktok-live.png") center / contain no-repeat;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.24));
}

.ad-platform-side-rail.is-tiktok {
  top: 86px;
  bottom: 96px;
  align-content: end;
}

.ad-platform-tiktok-bottom {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  display: grid;
  gap: 8px;
  padding: 0 14px 14px;
  background: linear-gradient(180deg, rgba(7, 11, 19, 0) 0%, rgba(7, 11, 19, 0.28) 22%, rgba(7, 11, 19, 0.92) 100%);
}

.ad-platform-tiktok-account {
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.15;
  color: #ffffff;
}

.ad-platform-overlay.is-shopee {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02) 0%, rgba(7, 11, 19, 0.02) 40%, rgba(7, 11, 19, 0.16) 100%);
}

.ad-platform-shopee-topbar {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ad-platform-shopee-store {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
}

.ad-platform-shopee-store strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.74rem;
  font-weight: 700;
}

.ad-platform-shopee-store-badge {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  background: #26aa99;
  color: #ffffff;
  font-size: 0.58rem;
  font-weight: 700;
  white-space: nowrap;
}

.ad-platform-shopee-imgcount {
  position: absolute;
  top: 56px;
  right: 14px;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.52);
  color: #ffffff;
  font-size: 0.64rem;
  font-weight: 600;
}

.ad-platform-shopee-addcart-group {
  position: absolute;
  left: 14px;
  bottom: 210px;
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ad-platform-shopee-addcart {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: #111827;
  font-size: 0.62rem;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(6, 10, 18, 0.14);
  white-space: nowrap;
}

.ad-platform-shopee-addcart-icon {
  font-size: 0.72rem;
  line-height: 1;
}

.ad-platform-shopee-sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  display: grid;
  gap: 7px;
  padding: 14px 14px 10px;
  background: rgba(255, 255, 255, 0.98);
  color: #0f172a;
  text-shadow: none;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -18px 36px rgba(15, 23, 42, 0.18);
}

.ad-platform-shopee-price {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.ad-platform-shopee-price strong {
  color: #ee4d2d;
  font-size: 1.12rem;
  font-weight: 800;
}

.ad-platform-shopee-price > span {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 3px;
  background: #ee4d2d;
  color: #ffffff;
  font-size: 0.64rem;
  font-weight: 700;
}

.ad-platform-shopee-price em {
  margin-left: auto;
  color: #888;
  font-size: 0.66rem;
  font-style: normal;
}

.ad-platform-shopee-heart {
  color: #888;
  font-size: 0.92rem;
  font-weight: 400;
  margin-left: 4px;
  background: none !important;
  padding: 0 !important;
  min-height: 0 !important;
  border-radius: 0 !important;
}

.ad-platform-shopee-title {
  margin: 0;
  color: #111827;
  font-size: 0.76rem;
  line-height: 1.45;
  max-width: none;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ad-platform-shopee-recommend {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 3px;
  background: #ee4d2d;
  color: #ffffff;
  font-size: 0.58rem;
  font-weight: 700;
  vertical-align: middle;
  margin-right: 4px;
}

.ad-platform-shopee-tags {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.ad-platform-shopee-tags span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 3px;
  border: 1px solid #ee4d2d;
  background: transparent;
  color: #ee4d2d;
  font-size: 0.62rem;
  font-weight: 600;
}

.ad-platform-shopee-rating {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #555;
  font-size: 0.68rem;
  font-weight: 500;
  border-top: 1px solid #eee;
  padding-top: 6px;
}

.ad-platform-shopee-star {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border: 1px solid #ddd;
  border-radius: 999px;
  font-size: 0.64rem;
  font-weight: 600;
  color: #333;
}

.ad-platform-shopee-mini {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-top: 1px solid #eee;
  font-size: 1rem;
  color: #555;
  background: none;
}

.ad-platform-shopee-bottom {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  gap: 0;
  align-items: center;
  border-top: 1px solid #eee;
}

.ad-platform-shopee-buy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border-radius: 10px;
  background: #ee4d2d;
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.3;
}

.ad-project-media-foot {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
}

.ad-project-media-foot strong {
  display: block;
  margin-bottom: 3px;
  color: #eef4ff;
  font-size: 0.88rem;
  font-weight: 500;
}

.ad-project-media-foot span {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: #9fb0cc;
  font-size: 0.75rem;
  line-height: 1.3;
}

.ad-media-download-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid rgba(130, 160, 210, 0.2);
  border-radius: 50%;
  background: rgba(20, 26, 42, 0.7);
  color: rgba(190, 210, 240, 0.8);
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.ad-media-download-btn:hover {
  border-color: rgba(121, 170, 255, 0.6);
  background: rgba(40, 55, 85, 0.8);
  color: #c8dbff;
}

.ad-set-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
}

.ad-set-card {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  overflow: hidden;
  background: rgba(12, 16, 27, 0.94);
  display: grid;
  gap: 12px;
  padding: 14px;
  transition: border-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.ad-set-card.is-featured {
  grid-column: span 1;
}

.ad-set-card:hover {
  border-color: rgba(104, 143, 214, 0.38);
  transform: translateY(-2px);
  box-shadow: 0 22px 40px rgba(6, 10, 18, 0.28);
}

.ad-set-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.ad-set-card-head h3 {
  margin: 0 0 4px;
  color: #f7f9ff;
  font-size: 1rem;
  font-weight: 500;
}

.ad-set-card-head p {
  margin: 0;
  color: #9fb0cc;
  font-size: 0.82rem;
}

.ad-set-meta-pills {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.ad-set-meta-pills.is-platform-switch {
  flex-wrap: nowrap;
}

.ad-platform-switch {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.ad-platform-switch-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 11px 0 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background: rgba(10, 15, 24, 0.92);
  color: #dbeafe;
  font: inherit;
  font-size: 0.74rem;
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.ad-platform-switch-btn:hover {
  border-color: rgba(121, 170, 255, 0.52);
  transform: translateY(-1px);
}

.ad-platform-switch-btn.is-active {
  border-color: rgba(121, 170, 255, 0.78);
  background: rgba(14, 20, 32, 0.98);
  box-shadow: 0 0 0 1px rgba(121, 170, 255, 0.12), 0 16px 30px rgba(6, 10, 18, 0.24);
}

.ad-platform-switch-logo {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  color: #ffffff;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  flex: 0 0 auto;
}

.ad-platform-switch-logo.is-tiktok {
  position: relative;
  background: #08090f;
  color: transparent;
  font-size: 0;
}

.ad-platform-switch-logo.is-tiktok::before {
  content: "";
  position: absolute;
  inset: 4px;
  background: #ffffff;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M14.6 3.2v8.45a4.15 4.15 0 1 1-2.1-3.63V5.95l6.1-1.38v2.3l-4 0.88Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M14.6 3.2v8.45a4.15 4.15 0 1 1-2.1-3.63V5.95l6.1-1.38v2.3l-4 0.88Z'/%3E%3C/svg%3E") center / contain no-repeat;
  filter: drop-shadow(-1px 1px 0 #22d3ee) drop-shadow(1px -1px 0 #ff0050);
}

.ad-platform-switch-logo.is-facebook {
  background: linear-gradient(135deg, #1d4ed8, #3b82f6);
}

.ad-platform-switch-logo.is-youtube {
  background: linear-gradient(135deg, #b91c1c, #ef4444);
}

.ad-platform-switch-logo.is-shopee {
  background: linear-gradient(135deg, #ea580c, #fb923c);
}

.ad-platform-switch-logo.is-off {
  background: linear-gradient(135deg, #334155, #64748b);
}

.ad-platform-switch-label {
  font-size: 0.74rem;
  white-space: nowrap;
}

.ad-set-format-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid rgba(121, 170, 255, 0.18);
  background: rgba(14, 20, 32, 0.8);
  color: #dbeafe;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}

.ad-set-status {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 500;
  white-space: nowrap;
}

.ad-set-status.is-ready,
.ad-set-status.is-video,
.ad-set-status.is-generating {
  border: 1px solid rgba(104, 66, 170, 0.42);
  background: rgba(7, 11, 19, 0.78);
  color: #eef4ff;
}

.ad-set-status.is-queued {
  border: 1px solid rgba(96, 165, 250, 0.24);
  background: rgba(10, 24, 41, 0.84);
  color: #93c5fd;
}

.ad-set-status.is-partial {
  border: 1px solid rgba(245, 158, 11, 0.24);
  background: rgba(41, 25, 4, 0.84);
  color: #fcd34d;
}

.ad-set-status.is-failed {
  border: 1px solid rgba(239, 68, 68, 0.24);
  background: rgba(42, 16, 16, 0.84);
  color: #fca5a5;
}

.ad-shot-grid {
  display: grid;
  gap: 10px;
}

.ad-shot-grid.is-landscape-set,
.ad-shot-grid.is-square-set {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ad-shot-grid.is-portrait-set {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ad-shot,
.ad-mock-shot {
  position: relative;
  min-height: 0;
  overflow: hidden;
  border-radius: 10px;
  border: 0;
  aspect-ratio: 1 / 1;
  box-shadow: inset 0 0 0 1px rgba(12, 18, 30, 0.92);
  background-clip: padding-box;
}

.ad-shot-grid.is-portrait-set > .ad-shot,
.ad-shot-grid.is-portrait-set > .ad-mock-shot {
  aspect-ratio: 9 / 16;
}

.ad-shot-grid.is-landscape-set > .ad-shot,
.ad-shot-grid.is-landscape-set > .ad-mock-shot {
  aspect-ratio: 16 / 9;
}

.ad-shot {
  background-image: var(--shot-image);
  background-size: cover;
  background-position: center 46%;
}

.ad-shot::after {
  content: none;
}

.ad-shot-chip {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(7, 11, 19, 0.82);
  color: #f7f9ff;
  font-size: 0.68rem;
}

.ad-shot-product {
  position: absolute;
  right: 12px;
  bottom: 10px;
  z-index: 2;
  display: block;
  box-shadow: 0 20px 30px rgba(4, 8, 16, 0.28);
}

.ad-shot-product.is-bottle {
  width: 34px;
  height: 68px;
  border-radius: 16px 16px 12px 12px;
  background: linear-gradient(180deg, #efe9ff, #c4b5fd 48%, #7c3aed 88%, #4c1d95);
  transform: rotate(-9deg);
}

.ad-shot-product.is-bottle::before {
  content: "";
  position: absolute;
  top: -10px;
  left: 9px;
  width: 16px;
  height: 12px;
  border-radius: 8px 8px 4px 4px;
  background: #f5f3ff;
}

.ad-shot-product.is-bottle.is-wide {
  width: 58px;
  height: 58px;
  border-radius: 18px;
}

.ad-shot-product.is-bottle.is-wide::before {
  left: 19px;
}

.ad-shot-product.is-box {
  width: 46px;
  height: 62px;
  border-radius: 16px;
  background: linear-gradient(180deg, #d9fbff, #67e8f9 58%, #0891b2 100%);
  transform: rotate(8deg);
}

.ad-shot-product.is-box::before {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  top: 12px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.5);
}

.ad-shot-product.is-box.is-tall {
  width: 42px;
  height: 74px;
}

.ad-shot-product.is-jar {
  width: 58px;
  height: 44px;
  border-radius: 24px 24px 18px 18px;
  background: linear-gradient(180deg, #ffffff, #ddd6fe 62%, #7c3aed);
}

.ad-shot-product.is-jar::before {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  top: -11px;
  height: 16px;
  border-radius: 10px 10px 6px 6px;
  background: linear-gradient(180deg, #f5f3ff, #c4b5fd);
}

.ad-shot-action {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 2;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(104, 66, 170, 0.42);
  border-radius: 999px;
  background: rgba(7, 11, 19, 0.82);
  color: #f7f9ff;
  cursor: pointer;
  font-size: 0.72rem;
  white-space: nowrap;
}

.ad-shot-action:hover,
.ad-set-more-btn:hover {
  border-color: rgba(121, 170, 255, 0.76);
}

.ad-mock-shot {
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.02) 20%, rgba(255, 255, 255, 0.08) 40%, rgba(255, 255, 255, 0.02) 60%),
    linear-gradient(180deg, rgba(12, 19, 31, 0.96), rgba(9, 14, 23, 1));
  background-size: 220% 100%, 100% 100%;
  animation: ad-shot-shimmer 2.6s linear infinite;
}

.ad-mock-shot-glow {
  position: absolute;
  inset: auto 16px 18px 16px;
  height: 44%;
  border-radius: 999px 999px 28px 28px;
  background: radial-gradient(circle at top, rgba(168, 85, 247, 0.22), rgba(255, 255, 255, 0.02) 70%);
  filter: blur(4px);
}

@keyframes ad-shot-shimmer {
  from {
    background-position: 200% 0, 0 0;
  }
  to {
    background-position: -20% 0, 0 0;
  }
}

.ad-set-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ad-set-more-btn {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid rgba(104, 66, 170, 0.42);
  border-radius: 12px;
  background: rgba(7, 11, 19, 0.82);
  color: #eef4ff;
  cursor: pointer;
}

.ad-set-more-btn.is-ghost {
  color: #d7e5ff;
}

@media (prefers-reduced-motion: no-preference) {
  .ad-builder-card {
    animation: builderSlideInLeft 640ms cubic-bezier(0.22, 1, 0.36, 1) 120ms backwards;
  }
  .ad-workspace-empty {
    animation: ad-card-enter 520ms cubic-bezier(0.22, 1, 0.36, 1) 120ms backwards;
  }

  .ad-rail-head {
    animation: ad-card-enter 440ms cubic-bezier(0.22, 1, 0.36, 1) 220ms backwards;
  }

  .ad-project-rail-card {
    animation: ad-card-enter 500ms cubic-bezier(0.22, 1, 0.36, 1) backwards;
  }

  .ad-project-rail-card:nth-child(1) {
    animation-delay: 260ms;
  }

  .ad-project-rail-card:nth-child(2) {
    animation-delay: 310ms;
  }

  .ad-project-rail-card:nth-child(3) {
    animation-delay: 360ms;
  }

  .ad-project-rail-card:nth-child(4) {
    animation-delay: 410ms;
  }

  .ad-project-rail-card:nth-child(5) {
    animation-delay: 460ms;
  }

  .ad-project-rail-card:nth-child(6) {
    animation-delay: 510ms;
  }

  .ad-project-rail-card:nth-child(7) {
    animation-delay: 560ms;
  }

  .ad-project-rail-card:nth-child(8) {
    animation-delay: 610ms;
  }

  .ad-project-rail-card:nth-child(9) {
    animation-delay: 660ms;
  }

  .ad-project-card {
    opacity: 0;
    transform: translateY(18px) scale(0.985);
    animation: ad-card-enter 560ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
  }

  .ad-project-card:nth-child(1) {
    animation-delay: 210ms;
  }

  .ad-project-card:nth-child(2) {
    animation-delay: 300ms;
  }

  .ad-project-card:nth-child(3) {
    animation-delay: 390ms;
  }

  .ad-project-detail.is-active {
    opacity: 0;
    transform: translateY(16px);
    animation: ad-card-enter 420ms cubic-bezier(0.22, 1, 0.36, 1) 80ms forwards;
  }

  .ad-set-card {
    opacity: 0;
    transform: translateY(18px) scale(0.985);
    animation: ad-card-enter 560ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
  }

  .ad-set-card:nth-child(1) {
    animation-delay: 210ms;
  }

  .ad-set-card:nth-child(2) {
    animation-delay: 300ms;
  }

  .ad-set-card:nth-child(3) {
    animation-delay: 390ms;
  }
}


@keyframes ad-card-enter {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.985);
    filter: blur(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

/* ── Video generation overlay on media card ── */
.ad-media-video-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.6);
  color: #e0eaff;
  font-size: 0.78rem;
  font-weight: 500;
}
.ad-media-card-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0;
  z-index: 1;
}
.ad-project-media-card.has-video .ad-project-media-visual {
  background-image: none !important;
}
.ad-media-card-play-btn {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.3);
  transition: opacity 0.2s;
  cursor: pointer;
}
.ad-project-media-card.has-video:hover .ad-media-card-play-btn {
  opacity: 0;
  pointer-events: none;
}
.ad-media-card-play-btn svg {
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.5));
}
.ad-media-video-overlay.is-failed {
  background: rgba(0, 0, 0, 0.55);
  color: #f87171;
}

.ad-media-video-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: #c4b5fd;
  border-radius: 50%;
  animation: ad-spin 0.8s linear infinite;
}
@keyframes ad-spin {
  to { transform: rotate(360deg); }
}

/* ── Visual wrap (for dots overlay) ── */
.ad-project-media-visual-wrap {
  position: relative;
  overflow: hidden;
}

/* ── Video dots (carousel indicator) ── */
.ad-media-video-dots {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}
.ad-media-video-dot {
  width: 14px;
  height: 14px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
  padding: 0;
}
.ad-media-video-dot:hover {
  background: rgba(255, 255, 255, 0.4);
  transform: scale(1.2);
}
.ad-media-video-dot.is-active {
  background: #c4b5fd;
  border-color: #c4b5fd;
}
.ad-media-video-dot.is-generating {
  background: #c4b5fd;
  border-color: #c4b5fd;
  animation: ad-dot-pulse 1s ease infinite;
}
@keyframes ad-dot-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
.ad-project-media-card.is-generating-video {
  pointer-events: auto;
}

@media (max-width: 1260px) {
  .page.page-ads {
    --ad-rail-height: 238px;
    width: min(1440px, calc(100% - 44px));
    height: auto;
    max-width: none;
    min-height: 100vh;
    margin: 0 auto;
    overflow: visible;
    padding-top: 80px;
  }

  .ad-studio-shell {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .ad-builder-card {
    position: static;
    left: auto;
    bottom: auto;
    width: auto;
    max-height: none;
    overflow: visible;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    transform: none !important;
    transition: none;
  }
  .ad-builder-card.is-collapsed {
    transform: none !important;
  }
  .ad-builder-toggle {
    display: none;
  }

  .ad-builder-actions {
    position: static;
    padding-top: 0;
    background: none;
  }

  .ad-library-card {
    position: static;
    left: auto;
    right: auto;
    top: auto;
    bottom: auto;
    min-height: calc(100vh - 132px - var(--ad-rail-height));
    overflow: visible;
  }

  .ad-workspace-stage {
    height: calc(100vh - 132px - var(--ad-rail-height));
    min-height: calc(100vh - 132px - var(--ad-rail-height));
  }

  .ad-project-rail-section {
    left: 14px;
    right: 14px;
    width: auto;
    max-width: none;
    min-width: 0;
    bottom: 0;
    border-radius: 0;
  }
}

.ad-mobile-new-btn {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: calc(100% - 20px);
  margin: 10px auto 0;
  padding: 12px 16px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
  color: #ffffff;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(124, 58, 237, 0.3);
  transition: filter 0.15s, box-shadow 0.15s;
}

.ad-mobile-new-btn:hover {
  filter: brightness(1.08);
}

.ad-mobile-new-btn:active {
  filter: brightness(0.95);
}

.ad-mobile-new-btn.is-hidden {
  display: none !important;
}

.ad-project-rail-section.is-hidden {
  display: none !important;
}

.ad-builder-mobile-close {
  display: none;
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: #e2efff;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: background 0.15s, color 0.15s;
}

.ad-builder-mobile-close:hover {
  background: rgba(255, 255, 255, 0.12);
}

@media (max-width: 1024px) {
  .page.page-ads {
    width: calc(100% - 28px);
  }

  .ad-builder-card {
    display: none;
  }

  .page.page-ads,
  .page.page-ads.is-builder-collapsed {
    padding-left: 14px;
    padding-right: 14px;
  }

  .ad-library-card,
  .page.page-ads.is-builder-collapsed .ad-library-card {
    left: 0;
  }

  .ad-project-rail-section,
  .page.page-ads.is-builder-collapsed .ad-project-rail-section {
    left: 0;
  }

  .ad-set-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ad-workspace-selected .ad-project-detail-head {
    grid-template-columns: 1fr;
  }

  .ad-project-detail-head-side {
    display: none;
  }

  .ad-project-rail-card {
    flex-basis: 144px;
  }

  .ad-mobile-new-btn {
    display: flex;
  }

  .ad-builder-mobile-close {
    display: inline-flex;
  }

  #ad-builder-toggle {
    display: none;
  }

  /* Mobile builder overlay — opens when "สร้างโฆษณาใหม่" button clicked */
  .page.page-ads.is-mobile-builder-open .ad-builder-card {
    display: flex;
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    z-index: 5000;
    animation: none;
    overflow-y: auto;
  }

  .page.page-ads.is-mobile-builder-open::before {
    content: "";
    position: fixed;
    inset: 60px 0 0 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    z-index: 4900;
  }

  /* Hide underlying workspace when overlay open — prevents visual leak */
  .page.page-ads.is-mobile-builder-open .ad-library-card,
  .page.page-ads.is-mobile-builder-open .ad-project-rail-section {
    display: none;
  }

  body.ad-mobile-builder-open {
    overflow: hidden;
  }
}

@media (max-width: 720px) {
  .page.page-ads {
    --ad-rail-height: 224px;
    width: calc(100% - 20px);
  }

  .ad-builder-card {
    border-radius: 20px;
    padding: 16px;
  }

  .ad-builder-section {
    padding: 14px;
  }

  .ad-set-grid {
    grid-template-columns: 1fr;
  }

  .ad-project-grid {
    grid-template-columns: 1fr;
  }

  .ad-workspace-empty h2 {
    font-size: 2rem;
  }

  .ad-workspace-stage {
    padding: 0;
    height: calc(100vh - 60px - var(--ad-rail-height));
    min-height: calc(100vh - 60px - var(--ad-rail-height));
  }

  /* When auth gate visible (not logged in) — rail is hidden,
     so workspace can expand and scroll naturally */
  .ad-workspace-stage:has(.ad-auth-gate.is-visible) {
    height: auto;
    min-height: auto;
    overflow: visible;
  }

  .ad-workspace-empty {
    width: calc(100% - 20px);
    min-height: calc(100% - 16px);
    padding: 22px;
  }

  .ad-workspace-empty:has(.ad-auth-gate.is-visible) {
    min-height: auto;
  }

  .ad-project-rail-card {
    flex-basis: min(136px, calc(100vw - 120px));
  }

  .ad-project-rail-section {
    left: 6px;
    right: 6px;
    bottom: 0;
    padding: 8px;
    border-radius: 0;
  }

  .ad-rail-head h2 {
    font-size: 0.92rem;
  }

  .ad-library-head,
  .ad-project-card-head,
  .ad-project-media-foot,
  .ad-set-card-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .ad-product-picker,
  .ad-character-picker {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .ad-product-picker-action,
  .ad-character-picker-action {
    grid-column: 2;
    justify-self: start;
  }

  .ad-shot-grid.is-landscape-set,
  .ad-shot-grid.is-square-set,
  .ad-shot-grid.is-portrait-set {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ad-set-meta-pills {
    justify-content: flex-start;
  }

  .ad-project-media-btn {
    width: 100%;
    justify-self: stretch;
  }
}

@media (max-width: 460px) {
  .ad-shot-grid.is-landscape-set,
  .ad-shot-grid.is-square-set,
  .ad-shot-grid.is-portrait-set {
    grid-template-columns: 1fr;
  }

  .ad-builder-section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .ad-project-cover,
  .ad-project-rail-cover {
    aspect-ratio: 16 / 11;
  }
}

/* ── Full HD / smaller-screen scaling ── */

@media (max-height: 1200px) {
  .page.page-ads {
    --ad-header-height: 52px;
    --ad-rail-height: 172px;
    --ad-builder-width: 360px;
  }

  .ad-builder-card {
    top: 52px;
  }

  /* video panel is now inside popup, no top offset needed */

  .ad-project-media-status-text
  {
    font-size: 1.0rem;
  }

  .ad-builder-head h1 {
    font-size: 1.08rem;
  }

  .ad-builder-section-title {
    font-size: 1.0rem;
  }

  .ad-builder-input {
    min-height: 40px;
    font-size: 13px;
  }

  .ad-builder-textarea {
    font-size: 13px;
  }

  .ad-builder-create-btn {
    min-height: 46px;
  }

  .ad-project-rail-section {
    padding: 4px 12px 4px;
    gap: 0;
  }

  .ad-rail-head {
    display: none;
  }

  .ad-project-rail {
    gap: 8px;
    padding: 2px 2px 4px;
    overflow-y: hidden;
    align-items: stretch;
  }

  .ad-project-rail-item {
    flex: 0 0 100px;
    max-width: 100px;
    display: flex;
    flex-direction: column;
  }

  .ad-project-rail-card {
    flex: 1 1 0;
    width: 100%;
    max-width: 120px;
    min-height: 0;
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .ad-project-rail-cover {
    flex: 1 1 0;
    min-height: 0;
    aspect-ratio: auto;
    border-radius: 10px 10px 0 0;
  }

  .ad-project-rail-body {
    flex: 0 0 auto;
    padding: 4px 6px 5px;
    gap: 2px;
  }

  .ad-project-rail-body .ad-project-card-head {
    min-width: 0;
  }

  .ad-project-rail-body .ad-project-card-head h3 {
    font-size: 0.68rem;
  }

  .ad-project-rail-body .ad-project-card-head p {
    font-size: 0.54rem;
  }

  .ad-project-rail-cover-wrap > .ad-project-rail-status {
    font-size: 0.5rem;
    min-height: 14px;
    padding: 0 4px;
    bottom: 3px;
    left: 3px;
  }

  .ad-project-rail-cover-wrap > .ad-project-rail-count {
    font-size: 0.5rem;
    min-height: 14px;
    padding: 0 4px;
    top: 3px;
    left: 3px;
  }

  .ad-project-rail-delete-btn {
    top: 1px;
    right: 1px;
    width: 20px;
    height: 20px;
  }

  .ad-project-rail-delete-btn svg {
    width: 10px;
    height: 10px;
  }

  .ad-workspace-selected {
    padding: 12px 14px 10px;
  }

  .ad-project-detail-head h2 {
    font-size: 1.1rem;
  }

  .ad-project-detail-head p {
    font-size: 0.76rem;
  }

  .ad-project-media-foot {
    gap: 8px;
    padding: 8px 10px;
  }

  .ad-project-media-foot strong {
    font-size: 0.72rem;
    margin-bottom: 0;
  }

  .ad-project-media-foot span {
    font-size: 0.64rem;
  }

  .ad-project-media-btn {
    min-height: 30px;
    padding: 0 10px;
    font-size: 0.72rem;
  }

  /* Platform overlay scaling for FHD */
  .ad-platform-icon-btn {
    width: 18px;
    height: 18px;
  }

  .ad-platform-side-icon {
    width: 26px;
    height: 26px;
  }

  .ad-platform-side-rail {
    gap: 8px;
    right: 8px;
  }

  .ad-platform-side-rail.is-youtube {
    top: 62px;
    right: 10px;
    bottom: 60px;
    gap: 10px;
  }

  .ad-platform-side-rail.is-facebook {
    top: 50px;
    bottom: 82px;
  }

  .ad-platform-side-rail.is-tiktok {
    top: 56px;
    bottom: 62px;
  }

  .ad-platform-side-item {
    gap: 3px;
  }

  .ad-platform-side-item strong {
    font-size: 0.52rem;
  }

  .ad-platform-avatar-chip {
    min-width: 28px;
    height: 28px;
    font-size: 0.52rem;
    border-radius: 10px;
  }

  .ad-platform-caption {
    font-size: 0.58rem;
    max-width: calc(100% - 62px);
  }

  .ad-platform-caption.is-youtube {
    font-size: 0.56rem;
    max-width: calc(100% - 58px);
  }

  .ad-platform-creator-handle {
    font-size: 0.6rem;
  }

  .ad-platform-youtube-channel span {
    font-size: 0.54rem;
  }

  .ad-platform-facebook-copy strong {
    font-size: 0.6rem;
  }

  .ad-platform-facebook-copy span {
    font-size: 0.54rem;
  }

  .ad-platform-tiktok-account {
    font-size: 0.62rem;
  }

  .ad-platform-tiktok-tabs span {
    font-size: 0.62rem;
  }

  .ad-platform-tab-live {
    width: 28px;
    height: 28px;
  }

  .ad-platform-facebook-topline {
    font-size: 0.72rem;
  }

  .ad-platform-shopee-topbar {
    top: 10px;
    left: 10px;
    right: 10px;
  }

  .ad-platform-shopee-store-badge {
    padding: 1px 5px;
    font-size: 0.48rem;
  }

  .ad-platform-shopee-imgcount {
    top: 42px;
    right: 10px;
    min-height: 18px;
    padding: 0 7px;
    font-size: 0.52rem;
  }

  .ad-platform-shopee-addcart-group {
    left: 10px;
    bottom: 160px;
    gap: 4px;
  }

  .ad-platform-shopee-addcart {
    min-height: 22px;
    padding: 0 8px;
    font-size: 0.52rem;
    gap: 4px;
  }

  .ad-platform-shopee-addcart-icon {
    font-size: 0.56rem;
  }

  .ad-platform-shopee-sheet {
    padding: 8px 10px 6px;
    gap: 4px;
  }

  .ad-platform-shopee-price strong {
    font-size: 0.88rem;
  }

  .ad-platform-shopee-price > span {
    font-size: 0.5rem;
    padding: 0 4px;
  }

  .ad-platform-shopee-price em {
    font-size: 0.52rem;
  }

  .ad-platform-shopee-heart {
    font-size: 0.72rem;
  }

  .ad-platform-shopee-title {
    font-size: 0.6rem;
  }

  .ad-platform-shopee-recommend {
    font-size: 0.46rem;
    padding: 0 4px;
  }

  .ad-platform-shopee-tags span {
    font-size: 0.5rem;
    padding: 0 5px;
    min-height: 16px;
  }

  .ad-platform-shopee-rating {
    font-size: 0.52rem;
    padding-top: 4px;
  }

  .ad-platform-shopee-star {
    font-size: 0.5rem;
    padding: 1px 5px;
  }

  .ad-platform-shopee-mini {
    width: 32px;
    height: 32px;
    font-size: 0.76rem;
  }

  .ad-platform-shopee-buy {
    min-height: 32px;
    font-size: 0.58rem;
  }

  .ad-platform-shopee-bottom span {
    font-size: 0.56rem;
  }

  .ad-platform-shopee-store strong {
    font-size: 0.62rem;
  }

  .ad-platform-cart-badge {
    font-size: 0.48rem;
  }

  .ad-platform-switch-btn {
    min-height: 28px;
    padding: 0 8px;
    font-size: 0.62rem;
  }

  .ad-platform-switch-logo {
    width: 16px;
    height: 16px;
    font-size: 0.5rem;
  }

  .ad-video-panel {
    padding: 14px;
    padding-top: 18px;
    gap: 12px;
  }

  .ad-video-panel-head h2 {
    font-size: 1.02rem;
  }

  .ad-video-panel-head p {
    font-size: 0.7rem;
  }

  .ad-video-panel-field label {
    font-size: 0.72rem;
  }

  .ad-video-choice-btn {
    min-height: 28px;
    padding: 0 9px;
    font-size: 0.7rem;
  }

  .ad-video-panel-textarea {
    font-size: 0.76rem;
    min-height: 60px;
  }

  .ad-video-create-btn {
    min-height: 38px;
    font-size: 0.82rem;
  }
}

/* ── Image Style visual grid ── */
.ad-style-visual-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.ad-style-visual-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  padding: 0;
  border: 2px solid rgba(104, 66, 170, 0.35);
  border-radius: 10px;
  background: rgba(16, 24, 36, 0.6);
  color: rgba(165, 179, 203, 0.85);
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.18s, box-shadow 0.18s, transform 0.12s;
}

.ad-style-visual-btn img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
  border-radius: 8px 8px 0 0;
  pointer-events: none;
  transition: opacity 0.18s;
}

.ad-style-visual-btn span {
  display: block;
  width: 100%;
  padding: 5px 4px;
  font-size: 0.6rem;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.ad-style-visual-btn.is-text-only {
  /*aspect-ratio: 1 / 1;*/
  justify-content: center;
  padding: 8px;
}

.ad-style-visual-btn.is-text-only span {
  font-size: 0.8rem;
  padding: 0;
}

.ad-style-visual-btn:hover {
  border-color: rgba(165, 179, 203, 0.55);
  transform: translateY(-1px);
}

.ad-style-visual-btn.is-active {
  border-color: rgba(104, 66, 170, 0.9);
  box-shadow: 0 0 0 1px rgba(104, 66, 170, 0.5), 0 2px 8px rgba(104, 66, 170, 0.25);
  color: #fff;
}

.ad-style-visual-btn.is-active img {
  opacity: 1;
}

.ad-style-visual-btn:not(.is-active) img {
  opacity: 0.65;
}

@media (max-width: 768px) {
  .ad-style-visual-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }

  .ad-style-visual-btn span {
    font-size: 0.65rem;
    padding: 4px 2px;
  }

  .page.page-ads,
  .page.page-ads.is-builder-collapsed {
    width: 100%;
    padding-left: 14px;
    padding-right: 14px;
    margin-left: 0;
    margin-right: 0;
  }
}
