/* ─── Phone Preview Shell ─────────────────────────────────── */
.preview-wrap {
  background: var(--surface);
  border-radius: var(--radius-card);
  padding: 14px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.preview-meta { display: flex; align-items: center; justify-content: space-between; width: 100%; }
.preview-meta-label { font-size: 10px; color: var(--secondary); font-weight: 700; letter-spacing: .5px; }
.ratio-badge {
  font-size: 10px; font-weight: 700; color: var(--near-black);
  background: var(--white); border: 1px solid var(--border);
  padding: 2px 8px; border-radius: var(--radius-badge);
  box-shadow: var(--shadow-card);
}
.phone-shell {
  position: relative;
  background: var(--near-black);
  border-radius: 20px;
  border: 3px solid var(--near-black);
  overflow: hidden;
  transition: aspect-ratio .35s cubic-bezier(.4,0,.2,1), border-radius .35s, width .35s;
  width: 160px;
  aspect-ratio: 9/16;
  flex-shrink: 0;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
}
.phone-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  background: #2a2a2a;
  position: relative;
  overflow: hidden;
}
.phone-placeholder svg { width: 32px; height: 32px; stroke: rgba(255,255,255,.2); fill: none; stroke-width: 1; }

/* Foto/video harus selalu cover penuh — absolute agar tidak terpengaruh flex alignment */
#phoneMedia img,
#phoneMedia video {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 0%;
  display: block;
}
/* Wrapper video juga absolute */
#phoneMedia > div {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
}

/* ─── Stitch Text ──────────────────────────────────────────── */
.phone-stitch {
  position: absolute;
  bottom: 23%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 10px 14px;
  border-radius: 8px;
  color: #fff;
  font-size: 8px;
  line-height: 1.45;
  font-family: var(--font);
  text-align: center;
  width: auto;
  max-width: 88%;
  cursor: move;
  user-select: none;
  white-space: pre-line;
  box-sizing: border-box;
  outline: none;
  z-index: 20;
}
.phone-stitch.editing {
  cursor: text;
  outline: 1.5px solid rgba(255,255,255,0.5);
  user-select: text;
}

/* ═══════════════════════════════════════════════════════════
   INSTAGRAM STORY / REELS CHROME
   ═══════════════════════════════════════════════════════════ */
.pf-ig-story-top {
  position: absolute; top: 0; left: 0; right: 0; z-index: 10;
  background: linear-gradient(rgba(0,0,0,0.38), transparent);
  padding: 7px 8px 12px;
}
.pf-ig-prog-row {
  display: flex; gap: 3px; margin-bottom: 6px;
}
.pf-ig-prog {
  flex: 1; height: 2px;
  background: rgba(255,255,255,0.38); border-radius: 1px;
}
.pf-ig-prog-filled {
  flex: 1.4; height: 2px;
  background: white; border-radius: 1px;
}
.pf-ig-story-profile {
  display: flex; align-items: center; gap: 4px;
}
.pf-ig-story-avatar {
  width: 18px; height: 18px; border-radius: 50%;
  background: linear-gradient(45deg,#f09433,#e6683c,#dc2743,#cc2366,#bc1888);
  border: 1.5px solid white; flex-shrink: 0;
}
.pf-ig-story-name {
  font-size: 8px; font-weight: 700; color: white;
  font-family: var(--font); flex: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pf-ig-time {
  font-size: 7px; color: rgba(255,255,255,0.72); font-family: var(--font);
}
.pf-ig-close {
  font-size: 11px; color: white; line-height: 1;
  margin-left: 3px; cursor: pointer;
}
.pf-ig-story-bottom {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 10;
  padding: 6px 8px 9px;
  background: linear-gradient(transparent, rgba(0,0,0,0.28));
}
.pf-ig-story-msg-row {
  display: flex; align-items: center; gap: 6px;
}
.pf-ig-msg-input {
  flex: 1; border: 1.5px solid rgba(255,255,255,0.65); border-radius: 20px;
  padding: 5px 10px; font-size: 7px; color: rgba(255,255,255,0.75);
  font-family: var(--font);
}
.pf-ig-story-icon {
  color: white; font-size: 14px; flex-shrink: 0; line-height: 1;
}

/* ═══════════════════════════════════════════════════════════
   INSTAGRAM FEED CHROME
   ═══════════════════════════════════════════════════════════ */
.pf-ig-feed-top {
  position: absolute; top: 0; left: 0; right: 0; height: 28px; z-index: 10;
  background: white;
  display: flex; align-items: center; padding: 0 8px; gap: 5px;
  border-bottom: 0.5px solid #e5e7eb;
}
.pf-ig-feed-avatar {
  width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(45deg,#f09433,#e6683c,#dc2743,#cc2366,#bc1888);
  padding: 1.5px;
}
.pf-ig-feed-avatar::after {
  content: ''; display: block; width: 100%; height: 100%;
  border-radius: 50%; background: white;
  /* inner circle — simulated empty photo */
}
.pf-ig-feed-user {
  font-size: 8px; font-weight: 700; color: #111;
  font-family: var(--font); flex: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pf-ig-feed-more {
  font-size: 12px; color: #333; font-weight: 700; line-height: 1;
}
.pf-ig-feed-bottom {
  position: absolute; bottom: 0; left: 0; right: 0; height: 28px; z-index: 10;
  background: white;
  display: flex; align-items: center; padding: 0 8px; gap: 7px;
  border-top: 0.5px solid #e5e7eb;
}
.pf-feed-icon {
  width: 14px; height: 14px;
  fill: none; stroke: #111; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
  flex-shrink: 0;
}
.pf-feed-spacer { flex: 1; }

/* ═══════════════════════════════════════════════════════════
   TIKTOK CHROME
   ═══════════════════════════════════════════════════════════ */
.pf-tt-top {
  position: absolute; top: 0; left: 0; right: 0; height: 30px; z-index: 10;
  background: linear-gradient(rgba(0,0,0,0.32), transparent);
  display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 0 8px;
}
.pf-tt-nav {
  font-size: 8px; font-weight: 600; color: rgba(255,255,255,0.65);
  font-family: var(--font);
}
.pf-tt-nav.pf-tt-nav-active {
  color: white; font-weight: 700;
  border-bottom: 1.5px solid white; padding-bottom: 1px;
}
.pf-tt-search {
  width: 12px; height: 12px; margin-left: auto;
}
.pf-tt-right {
  position: absolute; right: 6px; bottom: 65px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  z-index: 10;
}
.pf-tt-avatar {
  width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, #E1306C, #833AB4);
  border: 1.5px solid white; position: relative;
}
.pf-tt-plus {
  position: absolute; bottom: -5px; left: 50%; transform: translateX(-50%);
  background: #FE2C55; color: white; font-size: 8px; font-weight: 700;
  width: 11px; height: 11px; border-radius: 50%; border: 1px solid white;
  display: flex; align-items: center; justify-content: center; line-height: 1;
}
.pf-tt-icon {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
}
.pf-tt-icon svg { width: 16px; height: 16px; }
.pf-tt-icon span {
  font-size: 6.5px; color: white; font-family: var(--font);
  font-weight: 600;
}
.pf-tt-disc {
  width: 20px; height: 20px; border-radius: 50%;
  background: linear-gradient(135deg, #333, #111);
  border: 2px solid rgba(255,255,255,0.35);
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; color: white;
  animation: pf-spin 4s linear infinite;
}
@keyframes pf-spin { to { transform: rotate(360deg); } }

.pf-tt-bottom {
  position: absolute; bottom: 0; left: 0; right: 38px; z-index: 10;
  padding: 0 8px 10px;
  background: linear-gradient(transparent, rgba(0,0,0,0.55));
}
.pf-tt-user {
  font-size: 8.5px; font-weight: 700; color: white;
  font-family: var(--font); margin-bottom: 3px;
}
.pf-tt-desc {
  font-size: 7px; color: rgba(255,255,255,0.88);
  font-family: var(--font); line-height: 1.35; margin-bottom: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pf-tt-music {
  font-size: 6.5px; color: rgba(255,255,255,0.75); font-family: var(--font);
}

/* ═══════════════════════════════════════════════════════════
   YOUTUBE SHORTS CHROME
   ═══════════════════════════════════════════════════════════ */
.pf-yt-top {
  position: absolute; top: 0; left: 0; right: 0; height: 26px; z-index: 10;
  background: rgba(0,0,0,0.55);
  display: flex; align-items: center; padding: 0 8px; gap: 5px;
}
.pf-yt-logo { width: 16px; height: 16px; flex-shrink: 0; }
.pf-yt-shorts-label {
  font-size: 8.5px; font-weight: 800; color: white;
  font-family: var(--font); letter-spacing: 0.5px;
}
.pf-yt-right {
  position: absolute; right: 6px; bottom: 65px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  z-index: 10;
}
.pf-yt-avatar {
  width: 24px; height: 24px; border-radius: 50%;
  background: linear-gradient(135deg, #FF0000, #cc0000);
  border: 1.5px solid white;
}
.pf-yt-icon {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
}
.pf-yt-icon svg { width: 16px; height: 16px; fill: white; }
.pf-yt-icon span {
  font-size: 6px; color: white; font-family: var(--font); font-weight: 600;
}
.pf-yt-bottom {
  position: absolute; bottom: 0; left: 0; right: 40px; z-index: 10;
  padding: 0 8px 10px;
  background: linear-gradient(transparent, rgba(0,0,0,0.6));
}
.pf-yt-channel {
  font-size: 8px; font-weight: 700; color: white;
  font-family: var(--font); margin-bottom: 3px;
  display: flex; align-items: center; gap: 5px;
}
.pf-yt-sub {
  font-size: 6.5px; font-weight: 700; color: white; background: transparent;
  border: 1px solid rgba(255,255,255,0.7); border-radius: 4px;
  padding: 1px 5px; cursor: pointer; font-family: var(--font);
}
.pf-yt-desc {
  font-size: 7px; color: rgba(255,255,255,0.85); font-family: var(--font);
  line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ═══════════════════════════════════════════════════════════
   META / FACEBOOK FEED CHROME
   ═══════════════════════════════════════════════════════════ */
.pf-meta-top {
  position: absolute; top: 0; left: 0; right: 0; height: 30px; z-index: 10;
  background: white;
  display: flex; align-items: center; padding: 0 8px; gap: 5px;
  border-bottom: 0.5px solid #e5e7eb;
}
.pf-meta-avatar {
  width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, #1877F2, #0d5abf);
}
.pf-meta-info { flex: 1; min-width: 0; }
.pf-meta-name {
  font-size: 7.5px; font-weight: 700; color: #111;
  font-family: var(--font); line-height: 1.1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pf-meta-sponsored {
  font-size: 6.5px; color: #606770; font-family: var(--font);
  display: flex; align-items: center; gap: 2px;
}
.pf-meta-more {
  font-size: 11px; color: #606770; font-weight: 700; line-height: 1;
}
.pf-meta-bottom {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 10;
  background: white;
  border-top: 0.5px solid #e5e7eb;
  padding: 5px 8px 6px;
}
.pf-meta-actions {
  display: flex; gap: 2px; margin-bottom: 4px;
}
.pf-meta-action {
  display: flex; align-items: center; gap: 3px; flex: 1;
  justify-content: center;
}
.pf-meta-action svg { width: 12px; height: 12px; flex-shrink: 0; }
.pf-meta-action span {
  font-size: 6.5px; color: #606770; font-family: var(--font); font-weight: 600;
}
.pf-meta-boost {
  width: 100%; background: #1877F2; color: white; border: none;
  border-radius: 6px; padding: 4px 0; font-size: 7px; font-weight: 700;
  font-family: var(--font); cursor: pointer;
}

/* ═══════════════════════════════════════════════════════════
   LEGACY CLASSES (backward compat)
   ═══════════════════════════════════════════════════════════ */
.chrome-ig-story { display: none; } /* replaced by pf-ig-story-* */
.chrome-tiktok   { display: none; }
.chrome-yt       { display: none; }
.chrome-meta     { display: none; }
.chrome-ig-feed  { display: none; }

/* ─── Optimization mode row ────────────────────────────────── */
.opt-mode-row {
  display: flex; flex-direction: row; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 14px;
  background: var(--surface);
  border-radius: var(--radius-btn);
}
.opt-mode-tag { font-size: 10px; font-weight: 700; color: var(--secondary); letter-spacing: .5px; margin-bottom: 2px; }
.opt-mode-val { font-size: 11px; font-weight: 600; color: var(--near-black); letter-spacing: -0.1px; }
.preview-label-badge {
  font-size: 12px; font-weight: 700;
  color: var(--white);
  background: var(--near-black);
  padding: 8px 16px;
  border-radius: 8px;
  display: flex; align-items: center; gap: 6px;
  cursor: pointer;
  border: none;
  transition: background .15s;
  letter-spacing: -0.1px;
  white-space: nowrap;
  user-select: none;
}
.preview-label-badge:hover { background: #791ADB; }
.preview-label-badge::after {
  content: ""; display: inline-block; width: 0; height: 0;
  border-left: 4px solid transparent; border-right: 4px solid transparent;
  border-top: 5px solid #fff; vertical-align: middle; margin-top: 1px;
}

/* ─── Format selector row container ────────────────────────── */
.fmt-selector-row {
  display: flex;
  gap: 5px;
  align-items: center;
  background: var(--surface);
  border-radius: var(--radius-btn);
  padding: 5px;
}

/* ─── Format radio pills (Post / Reel / Story) ─────────────── */
.fmt-radio-label {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; color: var(--secondary);
  cursor: pointer; user-select: none;
  padding: 7px 10px;
  border-radius: var(--radius-btn);
  border: none;
  background: transparent;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.fmt-radio-label:has(input:checked) {
  background: var(--near-black);
  color: var(--white);
}
.fmt-radio-label input[type="radio"] {
  display: none;
}

/* ─── Prog bar (legacy, still used in old chrome) ────────── */
.prog-bar  { flex: 1; height: 2px; background: rgba(255,255,255,.4); border-radius: 1px; }
.prog-fill { height: 2px; width: 60%; background: #fff; border-radius: 1px; }
.ig-circle { width: 16px; height: 16px; border-radius: 50%; background: linear-gradient(45deg,#f09433,#e6683c,#dc2743,#cc2366,#bc1888); }
.fb-dot { width: 18px; height: 18px; background: #1877F2; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; color: #fff; font-weight: 700; }
