/* Tela de criação (views/html/create.html + views/js/creator/create.js) */
:root {
    --bg: #0d0d0d;
    --panel: #151515;
    --panel-2: #1c1c1c;
    --line: #2a2a2a;
    --text: #fff;
    --muted: #a3a3a3;
    --pink: #ff2d9b;
    --pink-2: #e0177f;
    --ok: #3ccf8e;
    --bad: #ff6b81;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: 'Quicksand', system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
body { min-height: 100dvh; }
button { font-family: inherit; }

.cr-top {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; gap: 16px;
    height: 64px; padding: 0 clamp(16px, 4vw, 40px);
    background: rgba(13, 13, 13, .86); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
}
.cr-logo { display: inline-flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; font-weight: 700; font-size: 18px; letter-spacing: -.01em; }
.cr-logo b { color: #ff69b4; font-weight: 700; }
.cr-logo img { height: 28px; width: 28px; display: block; }
.cr-product { flex: 1; font-weight: 600; font-size: 14px; color: var(--muted); }
.cr-product::before { content: "/"; margin-right: 12px; color: var(--line); }
.cr-help { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 600; transition: color .2s, border-color .2s; }
.cr-help:hover { color: #fff; border-color: #444; }
.cr-progress { position: sticky; top: 64px; z-index: 19; height: 2px; background: var(--line); }
.cr-progress-bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--pink-2), var(--pink)); transition: width .5s cubic-bezier(.2, .8, .2, 1); }

.cr-layout {
    display: grid; grid-template-columns: minmax(0, 1fr) 440px; gap: clamp(24px, 5vw, 72px);
    max-width: 1180px; margin: 0 auto; padding: 36px clamp(16px, 4vw, 40px) 120px;
}
.cr-form { min-width: 0; max-width: 620px; }

.cr-steps-label { margin-bottom: 26px; }
.cr-steps-label > span { display: block; margin-bottom: 10px; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--pink); }
.cr-steps-label ol { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0; padding: 0; list-style: none; font-size: 13px; color: #5d5d5d; }
.cr-steps-label li.on { color: #fff; font-weight: 700; }
.cr-steps-label li.done { color: var(--muted); }
.cr-steps-label li.done::before { content: "✓ "; color: var(--ok); }

.cr-step { opacity: 0; transform: translateY(10px); }
.cr-step.in { opacity: 1; transform: none; transition: opacity .35s ease, transform .45s cubic-bezier(.2, .8, .2, 1); }
.cr-step h2 { margin: 0 0 8px; font-size: clamp(26px, 4vw, 34px); line-height: 1.15; letter-spacing: -.01em; }
.cr-lead { margin: 0 0 26px; color: var(--muted); font-size: 16px; line-height: 1.5; }

.cr-field { display: block; margin-bottom: 18px; }
.cr-field > span { display: block; margin-bottom: 8px; font-size: 14px; font-weight: 600; color: #e6e6e6; }
.cr-field small { display: block; margin-top: 7px; font-size: 13px; color: #7d7d7d; }
.cr-field input, .cr-letter textarea, .cr-photo input {
    width: 100%; height: 52px; padding: 0 16px;
    border-radius: 14px; border: 1.5px solid var(--line); background: var(--panel); color: #fff;
    font: 500 16px 'Quicksand', sans-serif; outline: none; transition: border-color .2s, box-shadow .2s, background .2s;
    color-scheme: dark;
}
.cr-field input:focus, .cr-letter textarea:focus, .cr-photo input:focus { border-color: var(--pink); box-shadow: 0 0 0 4px rgba(255, 45, 155, .14); background: var(--panel-2); }
.cr-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.cr-date { grid-template-columns: 1.4fr 1fr; align-items: start; }

.cr-drop {
    width: 100%; display: flex; flex-direction: column; align-items: center; gap: 6px;
    padding: 28px 16px; border-radius: 18px; cursor: pointer;
    border: 1.5px dashed #3a3a3a; background: var(--panel); color: #fff;
    transition: border-color .2s, background .2s, transform .15s;
}
.cr-drop:hover, .cr-drop.over { border-color: var(--pink); background: #1a1217; }
.cr-drop:disabled { opacity: .4; cursor: not-allowed; }
.cr-drop-icon { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; background: linear-gradient(180deg, var(--pink), var(--pink-2)); font-size: 26px; line-height: 1; margin-bottom: 4px; }
.cr-drop b { font-size: 16px; }
.cr-drop small { color: var(--muted); font-size: 13px; }

.cr-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; margin: 18px 0 0; padding: 0; list-style: none; }
.cr-photo { display: flex; flex-direction: column; gap: 6px; }
.cr-photo.dragging { opacity: .4; }
.cr-photo input { height: 38px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.cr-thumb { position: relative; aspect-ratio: 4 / 5; border-radius: 14px; overflow: hidden; background: var(--panel); cursor: grab; }
.cr-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cr-photo.uploading .cr-thumb img, .cr-photo.error .cr-thumb img { filter: brightness(.45) blur(1px); }
.cr-thumb-state { position: absolute; inset: auto 0 0; padding: 10px; font-size: 12px; font-weight: 600; text-align: center; }
.cr-photo.uploading .cr-thumb::after { content: ""; position: absolute; left: 0; bottom: 0; height: 3px; width: 40%; background: var(--pink); animation: cr-load 1.1s ease-in-out infinite; }
.cr-photo.error { cursor: pointer; }
.cr-photo.error .cr-thumb-state { color: var(--bad); }
.cr-badge { position: absolute; top: 8px; left: 8px; padding: 4px 9px; border-radius: 999px; background: rgba(0, 0, 0, .6); font-size: 11px; font-weight: 700; backdrop-filter: blur(6px); }
.cr-x, .cr-move { position: absolute; top: 8px; width: 28px; height: 28px; border-radius: 50%; border: 0; display: grid; place-items: center; background: rgba(0, 0, 0, .6); color: #fff; font-size: 18px; line-height: 1; cursor: pointer; backdrop-filter: blur(6px); }
.cr-x { right: 8px; }
.cr-move { left: auto; right: 42px; }

.cr-mresults { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 8px; }
.cr-mresult { width: 100%; display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel); color: #fff; text-align: left; cursor: pointer; font: 600 14px 'Quicksand', sans-serif; transition: border-color .2s, background .2s; }
.cr-mresult:hover, .cr-mresult:focus-visible { border-color: var(--pink); background: #1a1217; outline: none; }
.cr-mresult img { flex: none; width: 88px; height: 50px; border-radius: 8px; object-fit: cover; background: #222; }
.cr-mresult span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.35; }
.cr-mchosen { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; padding: 12px; border-radius: 16px; border: 1.5px solid var(--pink); background: linear-gradient(180deg, #1d1219, #160f13); }
.cr-mchosen[hidden] { display: none; }
.cr-mchosen img { flex: none; width: 96px; height: 54px; border-radius: 10px; object-fit: cover; }
.cr-mchosen-ico { flex: none; width: 54px; height: 54px; display: grid; place-items: center; border-radius: 10px; background: #2a1420; font-size: 22px; }
.cr-mchosen-txt { flex: 1; min-width: 0; }
.cr-mchosen-txt small { display: block; color: var(--pink); font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.cr-mchosen-txt b { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 3px; font-size: 14.5px; line-height: 1.35; }
.cr-mchosen .cr-link { flex: none; }
.cr-music-status { margin: -6px 0 12px; font-size: 14px; font-weight: 600; min-height: 20px; }
.cr-music-status.ok { color: var(--ok); }
.cr-music-status.bad { color: var(--bad); }
.cr-music-embed { display: flex; align-items: center; gap: 12px; }
.cr-music-embed img { width: 120px; border-radius: 10px; }
.cr-music-embed span { font-size: 14px; font-weight: 600; }
.cr-music-embed iframe { width: 100%; border: 0; border-radius: 12px; }
.cr-tip { margin: 18px 0 10px; font-size: 13px; color: #8a8a8a; line-height: 1.5; }
.cr-link { padding: 0; border: 0; background: none; color: var(--pink); font-weight: 600; font-size: 14px; cursor: pointer; }

.cr-letter { position: relative; }
.cr-letter textarea { height: auto; min-height: 260px; padding: 18px; line-height: 1.65; resize: vertical; font-size: 16px; }
.cr-count { position: absolute; right: 14px; bottom: 12px; font-size: 12px; color: #666; }
.cr-chips { display: flex; flex-direction: column; gap: 8px; }
.cr-chip { text-align: left; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); color: #d9d9d9; font-size: 14px; cursor: pointer; transition: border-color .2s, color .2s; }
.cr-chip:hover { border-color: var(--pink); color: #fff; }

.cr-tiers { display: grid; gap: 12px; }
.cr-tier {
    position: relative; display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; text-align: left;
    padding: 20px; border-radius: 18px; cursor: pointer; color: #fff;
    border: 1.5px solid var(--line); background: var(--panel);
    transition: border-color .2s, background .2s, transform .15s;
}
.cr-tier:hover { border-color: #444; }
.cr-tier.on { border-color: var(--pink); background: linear-gradient(180deg, #1d1219, #160f13); box-shadow: 0 0 0 4px rgba(255, 45, 155, .1); }
.cr-tier em { position: absolute; top: -10px; left: 18px; padding: 4px 10px; border-radius: 999px; background: var(--pink); font-size: 11px; font-weight: 700; font-style: normal; letter-spacing: .04em; text-transform: uppercase; }
.cr-tier-name { font-size: 18px; font-weight: 700; }
.cr-tier-price { font-size: 18px; font-weight: 700; }
.cr-tier ul { grid-column: 1 / -1; margin: 6px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.cr-tier li { font-size: 14px; color: var(--muted); padding-left: 22px; position: relative; }
.cr-tier li::before { content: ""; position: absolute; left: 0; top: 4px; width: 12px; height: 7px; border-left: 2px solid var(--pink); border-bottom: 2px solid var(--pink); transform: rotate(-45deg); }

.cr-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 34px; }
.cr-btn {
    height: 54px; padding: 0 28px; border-radius: 999px; border: 0; cursor: pointer;
    background: linear-gradient(180deg, var(--pink), var(--pink-2)); color: #fff; font-size: 16px; font-weight: 700;
    box-shadow: 0 12px 26px -12px rgba(255, 45, 155, .8); transition: transform .15s, filter .2s;
}
.cr-btn:hover { filter: brightness(1.06); }
.cr-btn:active { transform: scale(.98); }
.cr-btn:disabled { opacity: .6; pointer-events: none; }
.cr-btn.ghost { background: transparent; border: 1.5px solid var(--line); box-shadow: none; color: var(--muted); }
.cr-btn.final { padding: 0 34px; }
.cr-saved { margin: 14px 0 0; font-size: 12px; color: #5f5f5f; text-align: right; min-height: 16px; }

/* Prévia: celular fixo ao lado no desktop, tela cheia no mobile */
.cr-preview { align-self: center; }
/* Desktop: só a coluna do formulário rola; a prévia fica parada ao lado */
@media (min-width: 960px) {
    html, body { height: 100%; overflow: hidden; }
    .cr-layout { height: calc(100dvh - 66px); padding-top: 0; padding-bottom: 0; align-items: center; }
    .cr-form { height: 100%; overflow-y: auto; padding: 36px 14px 48px 0; scrollbar-width: thin; scrollbar-color: #333 transparent; }
    .cr-form::-webkit-scrollbar { width: 6px; }
    .cr-form::-webkit-scrollbar-thumb { background: #333; border-radius: 6px; }
}
.cr-preview-head { display: none; }
.cr-preview-back { display: none; }
.cr-preview-close { display: none; }
.cr-phone {
    position: relative; height: min(800px, calc(100dvh - 100px)); aspect-ratio: 1 / 1.95; width: auto; max-width: 100%; margin: 0 auto;
    border-radius: 46px; padding: 9px; background: #050505;
    box-shadow: 0 0 0 1.5px #2b2b2b, 0 0 0 6px #111, 0 40px 80px -30px rgba(255, 45, 155, .22), 0 30px 60px rgba(0, 0, 0, .6);
}
.cr-phone-notch { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); width: 92px; height: 24px; border-radius: 999px; background: #050505; z-index: 2; }
.cr-phone iframe { width: 100%; height: 100%; border: 0; border-radius: 38px; background: #000; display: block; }

.cr-fab { display: none; }

.cr-toast {
    position: fixed; left: 50%; bottom: 28px; z-index: 50; transform: translate(-50%, 20px);
    padding: 12px 20px; border-radius: 999px; background: #fff; color: #111; font-weight: 600; font-size: 14px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, .4); opacity: 0; pointer-events: none; transition: opacity .25s, transform .3s;
    max-width: calc(100vw - 32px); text-align: center;
}
.cr-toast.show { opacity: 1; transform: translate(-50%, 0); }
.cr-toast.bad { background: #ffe3e8; color: #9b1530; }

@keyframes cr-load { 0% { transform: translateX(-100%); } 100% { transform: translateX(260%); } }

@media (max-width: 959px) {
    .cr-layout { grid-template-columns: 1fr; padding-top: 24px; padding-bottom: 140px; }
    .cr-form { max-width: none; }
    .cr-preview { position: fixed; inset: 0; z-index: 60; display: block; align-self: stretch; justify-self: stretch; width: 100%; height: 100dvh; padding: 0; background: #000; opacity: 0; visibility: hidden; transform: translateY(24px); transition: opacity .25s, transform .3s cubic-bezier(.2, .8, .2, 1), visibility 0s .3s; }
    body.cr-show-preview .cr-preview { opacity: 1; visibility: visible; transform: none; transition: opacity .25s, transform .3s cubic-bezier(.2, .8, .2, 1); }
    body.cr-show-preview { overflow: hidden; }
    .cr-preview-head {
        display: flex; align-items: center; justify-content: space-between; gap: 10px;
        position: absolute; top: 0; left: 0; right: 0; z-index: 3;
        padding: calc(10px + env(safe-area-inset-top)) 12px 10px;
        background: linear-gradient(180deg, rgba(0, 0, 0, .75), rgba(0, 0, 0, 0)); pointer-events: none;
    }
    .cr-preview-head > * { pointer-events: auto; }
    .cr-preview-tag { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border-radius: 999px; background: rgba(255, 255, 255, .14); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); color: #fff; font-size: 12.5px; font-weight: 700; }
    .cr-preview-tag::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #ff2d9b; box-shadow: 0 0 0 3px rgba(255, 45, 155, .3); }
    .cr-preview-close { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .14); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); color: #fff; cursor: pointer; }
    .cr-phone { width: 100%; height: 100%; aspect-ratio: auto; max-width: none; padding: 0; border-radius: 0; box-shadow: none; background: #000; }
    .cr-phone-notch { display: none; }
    .cr-phone iframe { border-radius: 0; }
    .cr-preview-back {
        position: absolute; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 3; transform: translateX(-50%);
        display: inline-flex; align-items: center; gap: 8px; height: 46px; padding: 0 20px; border-radius: 999px; border: 0;
        background: #fff; color: #111; font: 700 14px 'Quicksand', sans-serif; box-shadow: 0 12px 30px rgba(0, 0, 0, .45); cursor: pointer;
    }
    .cr-fab {
        position: fixed; z-index: 30; right: 16px; bottom: calc(96px + env(safe-area-inset-bottom));
        display: inline-flex; align-items: center; gap: 8px; height: 46px; padding: 0 18px; border-radius: 999px;
        border: 1px solid #333; background: rgba(28, 28, 28, .92); color: #fff; font-weight: 700; font-size: 14px; cursor: pointer;
        backdrop-filter: blur(10px); box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
    }
    .cr-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; margin: 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(180deg, rgba(13, 13, 13, 0), #0d0d0d 30%); }
    .cr-nav .cr-btn { flex: 1; }
    .cr-nav .cr-btn.ghost { flex: 0 0 auto; padding: 0 20px; }
    .cr-saved { text-align: left; }
}
@media (max-width: 520px) {
    .cr-grid2, .cr-date { grid-template-columns: 1fr; gap: 0; }
    .cr-photos { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .cr-help span { display: none; }
    .cr-product { font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
    .cr-step.in, .cr-progress-bar { transition: none; }
}

/* Estilo da Página do casal (clássica, Spotify, Netflix) */
.cr-themes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.cr-theme {
    position: relative; display: flex; flex-direction: column; text-align: left; padding: 8px 8px 12px;
    border-radius: 16px; border: 1.5px solid var(--line); background: var(--panel); color: var(--text);
    font: inherit; cursor: pointer; transition: border-color .2s, transform .2s, box-shadow .2s;
}
.cr-theme:hover { border-color: #444; transform: translateY(-2px); }
.cr-theme.on { border-color: var(--pink); box-shadow: 0 0 0 4px rgba(255, 45, 155, .12); }
.cr-theme.on::after {
    content: ""; position: absolute; top: 14px; right: 14px; width: 24px; height: 24px; border-radius: 50%;
    background: var(--pink) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m7 12.5 3.2 3.2L17 9' fill='none' stroke='%23fff' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 18px no-repeat;
    box-shadow: 0 4px 12px rgba(0,0,0,.4);
}
.cr-theme-shot { display: block; aspect-ratio: 9 / 14; border-radius: 10px; overflow: hidden; background: #000; }
.cr-theme-shot img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top; }
.cr-theme-txt { display: block; padding: 10px 4px 0; }
.cr-theme-txt b { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 15px; font-weight: 700; }
.cr-theme-txt em { font-style: normal; font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 2px 7px; border-radius: 999px; background: rgba(255, 45, 155, .16); color: var(--pink); }
.cr-theme-txt small { display: block; margin-top: 5px; font-size: 12.5px; line-height: 1.4; color: var(--muted); }
@media (max-width: 640px) {
    .cr-themes { grid-template-columns: 1fr; gap: 10px; }
    .cr-theme { flex-direction: row; align-items: center; gap: 14px; padding: 8px; }
    .cr-theme-shot { flex: none; width: 78px; aspect-ratio: 9 / 13; }
    .cr-theme-txt { padding: 0 34px 0 0; }
    .cr-theme.on::after { top: 50%; margin-top: -12px; }
}
