/* ============================================================
   POP'N'TOP v4 — Parcours de création (create.html)
   Dépend de css/v4.css
   ============================================================ */

.cr-body { min-height: 100vh; min-height: 100dvh; }
.cr-screen { max-width: 560px; margin: 0 auto; min-height: 100vh; min-height: 100dvh;
             display: flex; flex-direction: column; }

/* ── Barre du haut ───────────────────────────────────────── */
.cr-topbar { display: flex; align-items: center; gap: 14px; padding: 14px 16px 6px;
             position: sticky; top: 0; z-index: 10; background: var(--v4-ground); }
.cr-round { flex: none; width: 44px; height: 44px; border-radius: 999px; padding: 0;
            background: var(--v4-surface); border: 1px solid var(--v4-line);
            display: inline-flex; align-items: center; justify-content: center; color: var(--v4-ink); }
.cr-round .v4-icon { width: 20px; height: 20px; }
.cr-progress { flex: 1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.cr-progress span { height: 6px; border-radius: 999px; background: #E8DCCB; transition: background-color .2s ease; }
.cr-progress span.is-done { background: var(--v4-ink); }
.cr-progress__label { flex: none; font-size: 13px; font-weight: 600; color: var(--v4-muted); }

/* ── Étapes (glissement horizontal, sans défilement libre) ── */
/* overflow-x: clip empêche tout défilement horizontal (doigt, molette, focus) ;
   repli overflow: hidden pour les navigateurs qui ne connaissent pas clip */
.cr-steps { flex: 1; display: flex; overflow: hidden; overflow-x: clip; overflow-y: visible; }
.cr-steps__track { flex: none; width: 100%; display: flex; align-items: flex-start;
                   transition: transform .38s cubic-bezier(.22, .8, .24, 1); will-change: transform; }
.cr-step { flex: 0 0 100%; min-width: 0; display: flex; flex-direction: column; padding: 24px 20px 0;
           min-height: calc(100vh - 64px); min-height: calc(100dvh - 64px); }
/* Étapes hors écran : hauteur limitée pour ne pas allonger la page */
.cr-step:not(.is-active) { max-height: calc(100vh - 64px); max-height: calc(100dvh - 64px); overflow: hidden; }
.cr-h1 { margin: 0; font-size: 30px; line-height: 1.15; font-weight: 800; letter-spacing: -0.01em; }
/* Le titre reçoit le focus à chaque étape (lecteurs d'écran) : pas de cadre visible */
.v4 .cr-h1:focus, .v4 .cr-h1:focus-visible { outline: none; }
.cr-sub { margin: 8px 0 0; font-size: 15px; color: var(--v4-muted); }
.cr-footer { margin-top: auto; padding: 20px 0 calc(24px + env(safe-area-inset-bottom, 0px));
             position: sticky; bottom: 0; background: linear-gradient(0deg, var(--v4-ground) 75%, rgba(255,248,240,0)); }

/* Visibilité */
.cr-vis { display: flex; flex-direction: column; gap: 14px; margin-top: 28px; }
.cr-vis__opt { position: relative; text-align: left; display: flex; align-items: center; gap: 16px;
               padding: 22px 20px; border-radius: 24px; background: var(--v4-surface);
               border: 1.5px solid var(--v4-line); transition: border-color .15s ease; }
.cr-vis__opt[aria-checked="true"] { border: 2.5px solid var(--v4-ink); padding: 21px 19px; }
.cr-vis__icon { flex: none; width: 64px; height: 64px; border-radius: 20px; background: var(--v4-gold-soft);
                color: var(--v4-gold); display: flex; align-items: center; justify-content: center; }
.cr-vis__icon .v4-icon { width: 30px; height: 30px; }
.cr-vis__opt[aria-checked="true"] .cr-vis__icon { background: var(--v4-ink); color: #fff; }
.cr-vis__txt { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.cr-vis__txt strong { font-size: 20px; }
.cr-vis__txt span { font-size: 14px; line-height: 1.4; color: var(--v4-muted); }
.cr-vis__check { position: absolute; top: 14px; right: 14px; width: 28px; height: 28px; border-radius: 999px;
                 background: var(--v4-ink); color: #fff; display: none; align-items: center; justify-content: center; }
.cr-vis__check .v4-icon { width: 16px; height: 16px; stroke-width: 3; }
.cr-vis__opt[aria-checked="true"] .cr-vis__check { display: flex; }

/* Catégories */
.cr-cats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 22px; }
.cr-cat { min-height: 104px; border-radius: 22px; background: var(--v4-surface); border: 1.5px solid var(--v4-line);
          display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 8px 4px; }
.cr-cat__icon { width: 44px; height: 44px; border-radius: 14px; display: flex; align-items: center; justify-content: center; }
.cr-cat__icon img { width: 34px; height: 34px; }
.cr-cat__label { font-size: 13px; font-weight: 600; line-height: 1.15; text-align: center; }
.cr-cat[aria-checked="true"] { background: var(--v4-ink); border-color: var(--v4-ink); color: #fff; }
.cr-cat[aria-checked="true"] .cr-cat__icon { background: #fff; }
.cr-cat[aria-checked="true"] .cr-cat__icon img { width: 28px; height: 28px; }
.cr-cat--wide { grid-column: 1 / -1; min-height: 76px; flex-direction: row; justify-content: flex-start;
                gap: 14px; padding: 0 18px; text-align: left; }
.cr-cat--wide .cr-cat__label { text-align: left; display: flex; flex-direction: column; gap: 2px; font-size: 15px; font-weight: 700; flex: 1; }
.cr-cat--wide .cr-cat__label small { font-size: 13px; font-weight: 400; color: var(--v4-muted); }
.cr-cat--wide[aria-checked="true"] .cr-cat__label small { color: #D9D8E8; }

/* Titre */
.cr-recap { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.cr-pill { min-height: 40px; padding: 0 14px; border-radius: 999px; background: var(--v4-surface);
           border: 1px solid var(--v4-line); font-size: 13px; font-weight: 600;
           display: inline-flex; align-items: center; gap: 6px; }
.cr-pill img, .cr-pill .v4-icon { width: 16px; height: 16px; }
.cr-title { display: flex; flex-direction: column; flex: 1; margin-top: 20px; }
.cr-title__input { height: 72px; padding: 0 20px; border-radius: 22px; border: 2.5px solid var(--v4-ink);
                   background: #fff; font: inherit; font-size: 20px; font-weight: 600; color: var(--v4-ink); width: 100%; }
.cr-title__input:focus { outline: none; box-shadow: 0 0 0 4px rgba(0,0,60,.12); }
.cr-title__input::placeholder { color: #9A97A8; font-weight: 500; }
.cr-title__count { align-self: flex-end; font-size: 12px; color: var(--v4-muted); margin-top: 6px; }
.cr-title__label { margin: 14px 0 10px; font-size: 14px; font-weight: 600; color: var(--v4-muted); }
.cr-ideas { display: flex; flex-wrap: wrap; gap: 8px; }
.cr-idea { min-height: 44px; padding: 0 14px; border-radius: 999px; border: 1px dashed #C9B48A;
           background: transparent; font-size: 14px; }
.cr-idea:hover { background: var(--v4-gold-soft); }

/* ── Éditeur : barre de titre ────────────────────────────── */
.cr-topbar--editor { gap: 12px; padding-bottom: 10px; }
.cr-ed-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cr-ed-title strong { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cr-ed-title span { font-size: 12px; color: var(--v4-muted); display: inline-flex; align-items: center; gap: 5px; }
.cr-ed-title span img { width: 13px; height: 13px; }

/* ── Éditeur : recherche ─────────────────────────────────── */
.cr-search { flex: 1; display: flex; flex-direction: column; padding: 4px 16px calc(110px + env(safe-area-inset-bottom, 0px)); }
.cr-search__intro { display: none; flex-direction: column; align-items: center; gap: 12px; text-align: center; margin-bottom: 22px; }
.cr-search.is-centered { justify-content: center; padding-top: 0; }
.cr-search.is-centered .cr-search__intro { display: flex; }
.cr-search__intro .cr-h1 { font-size: 26px; line-height: 1.2; }
.cr-search__badge { width: 88px; height: 88px; border-radius: 28px; background: var(--v4-gold-soft);
                    display: flex; align-items: center; justify-content: center; }

.cr-searchbox { position: relative; margin: 0; }
.cr-searchbox__icon { position: absolute; left: 20px; top: 50%; transform: translateY(-50%);
                      width: 24px; height: 24px; stroke-width: 2.4; pointer-events: none; }
.cr-searchbox input { width: 100%; height: 64px; padding: 0 60px 0 56px; border-radius: 22px;
                      border: 2.5px solid var(--v4-ink); background: #fff; font: inherit;
                      font-size: 18px; font-weight: 500; color: var(--v4-ink); -webkit-appearance: none; appearance: none; }
.cr-searchbox input::-webkit-search-cancel-button { display: none; }
.cr-searchbox input:focus { outline: none; box-shadow: 0 0 0 4px rgba(0,0,60,.12); }
.cr-searchbox input::placeholder { color: #8A879A; }
.cr-search.is-centered .cr-searchbox input { height: 76px; border-radius: 26px; font-size: 19px; padding-left: 62px;
                                              box-shadow: 0 10px 30px rgba(0,0,60,.10); }
.cr-search.is-centered .cr-searchbox__icon { left: 22px; width: 26px; height: 26px; }
.cr-searchbox__clear { position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
                       width: 44px; height: 44px; border: 0; border-radius: 999px; background: #F3EADC;
                       display: flex; align-items: center; justify-content: center; }
.cr-searchbox__clear .v4-icon { width: 18px; height: 18px; stroke-width: 2.4; }

.cr-results-head { display: flex; align-items: center; justify-content: space-between; gap: 8px;
                   padding: 14px 4px 10px; font-size: 14px; font-weight: 600; }
.cr-results-head.is-hint { justify-content: center; font-weight: 500; color: var(--v4-muted); }
.cr-loading { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 400; color: var(--v4-muted); }
.cr-loading .v4-icon { width: 16px; height: 16px; color: var(--v4-gold); stroke-width: 2.4; }
.cr-spin { animation: cr-spin .9s linear infinite; }
@keyframes cr-spin { to { transform: rotate(360deg); } }

.cr-results { list-style: none; margin: 0; padding: 0; display: grid;
              grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 12px; }
.cr-card { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.cr-card__media { position: relative; aspect-ratio: 2 / 3; border-radius: 20px; overflow: hidden; background: #EFE4D4;
                  display: flex; align-items: center; justify-content: center; }
.cr-card__media img.cr-card__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
                                   opacity: 0; transition: opacity .3s ease; }
.cr-card__media img.cr-card__img.is-logo { object-fit: contain; padding: 18px; background: #fff; }
.cr-card__media img.is-loaded { opacity: 1; }
.cr-card__spinner { width: 30px; height: 30px; color: #B49A66; stroke-width: 2.4; }
.cr-card__media.is-loaded .cr-card__spinner { display: none; }
.cr-card__noimg { color: #B49A66; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; }
.cr-card__noimg .v4-icon { width: 30px; height: 30px; }
.cr-card__added { position: absolute; top: 10px; right: 10px; width: 32px; height: 32px; border-radius: 999px;
                  background: var(--v4-gold); color: #fff; display: flex; align-items: center; justify-content: center; z-index: 2; }
.cr-card__added .v4-icon { width: 18px; height: 18px; stroke-width: 3; }
.cr-card__label { font-size: 15px; font-weight: 700; line-height: 1.25; padding: 0 2px;
                  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cr-card__meta { font-size: 12px; color: var(--v4-muted); padding: 0 2px; margin-top: -6px;
                 display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cr-card__btn { margin-top: auto; min-height: 46px; border-radius: 14px; border: 0; background: var(--v4-ink);
                color: #fff !important; font-size: 14px; font-weight: 600;
                display: flex; align-items: center; justify-content: center; gap: 6px; }
.cr-card__btn .v4-icon { width: 18px; height: 18px; stroke-width: 2.5; }
.cr-card__btn.is-added { background: #fff; color: var(--v4-gold) !important; border: 1.5px solid var(--v4-gold); }
.cr-card--free .cr-card__media { border: 2px dashed #C9B48A; background: var(--v4-surface); }

.cr-empty { grid-column: 1 / -1; text-align: center; color: var(--v4-muted); font-size: 15px; padding: 24px 8px; }

/* ── Éditeur : liste à classer ───────────────────────────── */
.cr-list { flex: 1; padding: 8px 16px calc(110px + env(safe-area-inset-bottom, 0px)); }
.cr-list__head { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.cr-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.cr-item { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 20px;
           background: var(--v4-surface); border: 1px solid var(--v4-line); }
.cr-item__thumb { flex: none; width: 60px; height: 86px; border-radius: 12px; background: #EFE4D4 center / cover no-repeat;
                  display: flex; align-items: center; justify-content: center; color: #B49A66; }
.cr-item__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cr-item__rank { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--v4-gold); }
.cr-item__rank img { width: 18px; height: 15px; object-fit: contain; }
.cr-item__label { font-size: 15px; font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.cr-item__meta { font-size: 12px; color: var(--v4-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cr-item__btn { flex: none; width: 44px; height: 44px; border: 0; border-radius: 12px; background: transparent;
                display: flex; align-items: center; justify-content: center; color: var(--v4-muted); }
.cr-item__btn:hover { background: var(--v4-gold-soft); color: var(--v4-ink); }
.cr-item__grip { cursor: grab; touch-action: none; }
.cr-item.sortable-ghost { opacity: .4; }
.cr-item.sortable-chosen { box-shadow: 0 10px 28px rgba(0,0,60,.18); }

/* ── Barre du bas de l'éditeur ───────────────────────────── */
.cr-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
          padding: 12px 16px calc(14px + env(safe-area-inset-bottom, 0px));
          background: var(--v4-surface); border-top: 1px solid var(--v4-line);
          display: flex; align-items: center; gap: 12px; }
@media (min-width: 600px) { .cr-bar { left: 50%; right: auto; width: 560px; transform: translateX(-50%);
                                      border: 1px solid var(--v4-line); border-bottom: 0; border-radius: 22px 22px 0 0; } }
.cr-bar__list { flex: 1; min-width: 0; min-height: 52px; display: flex; align-items: center; gap: 10px;
                background: none; border: 0; padding: 0; text-align: left; }
.cr-bar__thumbs { display: flex; flex: none; }
.cr-bar__thumbs span { width: 34px; height: 46px; border-radius: 8px; background: #EFE4D4 center / cover no-repeat;
                       border: 2px solid #fff; }
.cr-bar__thumbs span + span { margin-left: -14px; }
.cr-bar__txt { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.cr-bar__txt strong { font-size: 15px; }
.cr-bar__txt span { font-size: 12px; color: var(--v4-muted); }
.cr-bar .v4-btn { min-height: 52px; padding: 0 20px; font-size: 15px; flex: none; }
.cr-bar .v4-btn .v4-icon { width: 18px; height: 18px; stroke-width: 2.5; }

/* ── Fenêtre du bas (compte) ─────────────────────────────── */
.cr-sheet { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.cr-sheet[hidden] { display: none; }
.cr-sheet__backdrop { position: absolute; inset: 0; background: rgba(0,0,40,.55); animation: cr-fade .2s ease; }
.cr-sheet__panel { position: relative; width: 100%; max-width: 560px; background: #fff;
                   border-radius: 32px 32px 0 0; padding: 12px 20px calc(28px + env(safe-area-inset-bottom, 0px));
                   display: flex; flex-direction: column; gap: 12px; animation: cr-up .25s ease; }
.cr-sheet__handle { align-self: center; width: 44px; height: 5px; border-radius: 999px; background: #E3D8C8; }
.cr-sheet__close { position: absolute; top: 16px; right: 16px; background: #F5EEE3; border: 0; }
.cr-sheet__intro { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 10px 0 6px; }
.cr-sheet__intro .cr-search__badge { width: 80px; height: 80px; border-radius: 26px; }
.cr-sheet__intro h2 { margin: 0; font-size: 26px; line-height: 1.2; font-weight: 800; }
.cr-sheet__intro p { margin: 0; font-size: 15px; color: var(--v4-muted); }
.cr-sheet .v4-btn { min-height: 60px; font-size: 16px; font-weight: 600; }
.cr-g { width: 26px; height: 26px; border-radius: 999px; border: 1.5px solid currentColor;
        display: inline-flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; }
.cr-sheet__safe { margin: 2px 0 0; display: flex; align-items: center; justify-content: center; gap: 8px;
                  font-size: 13px; color: var(--v4-ok); }
.cr-sheet__safe .v4-icon { width: 16px; height: 16px; stroke-width: 2.5; }
.cr-sheet__login { margin: 0; text-align: center; font-size: 15px; color: var(--v4-muted); }
.cr-sheet__login a { display: inline-block; min-height: 44px; line-height: 44px; font-weight: 700; color: var(--v4-ink); }
@media (min-width: 600px) { .cr-sheet { align-items: center; }
                            .cr-sheet__panel { border-radius: 32px; max-width: 440px; } }
@keyframes cr-fade { from { opacity: 0; } }
@keyframes cr-up { from { transform: translateY(40px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
    .cr-spin, .cr-sheet__backdrop, .cr-sheet__panel { animation: none; }
    .cr-steps__track { transition: none; }
}
