/* Plenty: caption rules + per-platform preview. Everything is prefixed cx-. */

/* caption section in the destination sheet */
.cx-group{margin-top:18px}
.cx-pick{padding:8px}
.cx-seg{display:flex;width:100%}
.cx-seg label{flex:1 1 0;min-width:0}
.cx-seg span{text-align:center;overflow:hidden;text-overflow:ellipsis;padding:6px 8px}
body:has(.main) .cx-seg{background:var(--fill-2);border-radius:6px;box-shadow:0 0 0 1px var(--edge);padding:2px}
body:has(.main) .cx-seg span{border-radius:4px;font-size:13px;color:var(--ink-2)}
body:has(.main) .cx-seg input:checked+span{background:var(--surface);color:var(--ink);font-weight:600;box-shadow:0 1px 1px rgba(0,0,0,.06),0 0 0 1px var(--edge)}
.cx-x{font-style:normal}
.cx-rules{border-top:1px solid var(--sep)}
.cx-rules .field input[type=text]::placeholder{color:var(--ink-3)}
.cx-rules .field input[type=number]::placeholder{color:var(--ink-3)}

/* preview: a phone on the left, the full text on the right; stacked on phones */
.cx-prev{margin:14px 0 18px;min-height:40px;transition:opacity .2s}
.cx-prev.is-loading{opacity:.6}
.cx{display:flex;gap:20px;align-items:flex-start}
.cx-none{margin:0;padding:18px;text-align:center;font-size:14px;color:var(--ink-2);border-radius:8px;box-shadow:0 0 0 1px var(--edge)}
.cx-side{flex:1;min-width:0}
.cx-k{margin:0 0 4px;font-size:12px;font-weight:600;color:var(--ink-2)}
.cx-k~.cx-k{margin-top:14px}
.cx-full{margin:0;padding:10px 12px;border-radius:8px;background:var(--surface);box-shadow:0 0 0 1px var(--edge);font-size:14px;line-height:1.45;white-space:pre-wrap;overflow-wrap:anywhere;max-height:220px;overflow:auto}
.cx-n{margin:6px 0 0;font-size:12px;color:var(--ink-2);text-align:right;font-variant-numeric:tabular-nums}
.cx-warn{margin:0 0 14px;font-size:13px;color:var(--ink-2);line-height:1.45}

/* the phone: generic shapes only, no platform artwork */
.cx-phone{flex:none;width:184px;aspect-ratio:9/19;border-radius:26px;padding:6px;background:#0b0d12;box-shadow:0 0 0 1px var(--edge),0 10px 30px rgba(10,14,25,.12)}
.cx-screen{position:relative;width:100%;height:100%;border-radius:20px;overflow:hidden;background:#000;color:#fff;font-size:10.5px;line-height:1.35;letter-spacing:0}
.cx-media{position:relative;background:#1c2029;overflow:hidden}
.cx-media img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}
.cx-play{position:absolute;left:50%;top:50%;width:28px;height:28px;margin:-14px 0 0 -14px;border-radius:50%;background:rgba(0,0,0,.35);display:grid;place-items:center;opacity:.85}
.cx-play svg{width:14px;height:14px}
.cx-who{display:flex;align-items:center;gap:6px;font-weight:600;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.cx-av{width:18px;height:18px;border-radius:50%;flex:none;background:rgba(255,255,255,.28)}
.cx-title{display:block;font-weight:600;margin-top:4px;overflow-wrap:anywhere}
.cx-cap{display:block;margin-top:3px;white-space:pre-line;overflow-wrap:anywhere}
.cx-cap em{font-style:normal;opacity:.65}

/* caption over the video (Reels, Shorts, TikTok) */
.cx-phone.overlay .cx-media{position:absolute;inset:0;height:100%}
.cx-phone.overlay .cx-media::after{content:"";position:absolute;inset:auto 0 0;height:55%;background:linear-gradient(transparent,rgba(0,0,0,.6))}
.cx-over{position:absolute;left:10px;right:40px;bottom:16px;max-height:55%;overflow:hidden}
.cx-rail{position:absolute;right:8px;bottom:22px;display:flex;flex-direction:column;gap:12px}
.cx-rail i{width:20px;height:20px;border-radius:50%;background:rgba(255,255,255,.3)}
.cx-bar{position:absolute;left:0;right:0;bottom:0;height:2px;background:rgba(255,255,255,.25)}
.cx-bar::before{content:"";display:block;width:32%;height:100%;background:#fff}

/* caption above the video (X, Threads, LinkedIn, Bluesky) */
.cx-phone.card .cx-screen{background:#fff;color:#1a1f36}
.cx-post{padding:22px 10px 10px}
.cx-phone.card .cx-av{background:#d9dee6}
.cx-phone.card .cx-who span{font-weight:400;color:#6b7383;overflow:hidden;text-overflow:ellipsis}
.cx-phone.card .cx-media{margin-top:8px;border-radius:8px}
.cx-phone.card .cx-play{background:rgba(0,0,0,.45)}
.cx-acts{display:flex;justify-content:space-between;padding:8px 6px 0}
.cx-acts i{width:16px;height:6px;border-radius:3px;background:#dfe3ea}

@media (prefers-color-scheme:dark){
  .cx-phone{background:#000;box-shadow:0 0 0 1px var(--edge)}
  .cx-phone.card .cx-screen{background:#0e1117;color:#e7eaef}
  .cx-phone.card .cx-av{background:#2a313d}
  .cx-phone.card .cx-who span{color:#9ba4b1}
  .cx-acts i{background:#262d38}
}

@media (max-width:480px){.cx-x{display:none}}
@media (max-width:560px){
  .cx{flex-direction:column;align-items:center}
  .cx-side{width:100%}
  .cx-phone{width:200px}
}
