/* ── Fonte customizada ── */
@font-face {
    font-family: 'MDNichrome';
    src: url('../lib/font/MDNichromeVariable-Infra.ttf') format('truetype');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

/* ── Reset & base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --brand:     #7c3aed;
    --brand-dark:#5b21b6;
    --brand-light:#ede9fe;
    --success:   #16a34a;
    --danger:    #dc2626;
    --gray-50:   #f9fafb;
    --gray-100:  #f3f4f6;
    --gray-200:  #e5e7eb;
    --gray-400:  #9ca3af;
    --gray-600:  #4b5563;
    --gray-900:  #111827;
    --radius:    10px;
    --shadow:    0 4px 24px rgba(0,0,0,.08);
}

body {
    font-family: 'MDNichrome', 'Inter', system-ui, -apple-system, sans-serif;
    background: #f0ebe4;
    color: var(--gray-900);
    min-height: 100vh;
}

/* ── Header ── */
.header {
    background: #fff;
    border-bottom: 1px solid var(--gray-200);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.header-logo {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--brand);
    letter-spacing: -.5px;
}

.header-logo span { color: var(--gray-900); }

.header-logo-img {
    height: 24px;
    width: auto;
    display: block;
}

/* ── Card de álbum (listagem) ── */
.album-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius);
    background: #fff;
    text-align: left;
    overflow: hidden;
}

.album-card-thumb {
    width: 72px;
    max-width: 72px;
    height: auto;
    flex-shrink: 0;
    border-radius: 8px;
    display: block;
    box-shadow: 0 2px 8px rgba(0,0,0,.12);
}

.album-card-body {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 16px;
}

.album-card-info {
    flex: 1;
    min-width: 0;
}

.album-card-action {
    flex-shrink: 0;
}

/* Mobile: botão vai para baixo */
@media (max-width: 600px) {
    .album-card-body {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    .album-card-action {
        width: 100%;
    }
}

.header-back-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--gray-600);
    text-decoration: none;
    font-size: .88rem;
    font-weight: 600;
    padding: 6px 10px;
    border-radius: 8px;
    transition: background .15s, color .15s;
    position: absolute;
    left: 16px;
}
.header-back-btn:hover { background: var(--gray-100); color: var(--gray-900); }

.header-back-label { display: none; }

@media (min-width: 640px) {
    .header-back-label { display: inline; }
}

/* ── Container ── */
.container {
    max-width: 520px;
    margin: 0 auto;
    padding: 24px 20px 40px;
}

/* ── Stepper ── */
.stepper {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: 40px;
}

.step {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.step-num {
    width: 34px; height: 34px;
    border-radius: 50%;
    border: 2px solid var(--gray-200);
    background: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
    font-size: .9rem;
    color: var(--gray-400);
    flex-shrink: 0;
    transition: all .2s;
}

.step-label {
    font-size: .85rem;
    color: var(--gray-400);
    font-weight: 500;
    transition: color .2s;
}

.step.active .step-num {
    background: #e8624a;
    border-color: #e8624a;
    color: #fff;
}

.step.active .step-label { color: #e8624a; font-weight: 600; }

.step.done .step-num {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}

.step-line {
    flex: 1;
    height: 2px;
    background: var(--gray-200);
    margin: 0 8px;
}

/* ── Card ── */
.card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 36px 32px;
    text-align: center;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.card-subtitle {
    color: var(--gray-600);
    font-size: .95rem;
    margin-bottom: 28px;
    line-height: 1.5;
}

/* ── Form pedido ── */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; }

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 1rem;
    outline: none;
    transition: border-color .2s;
}

.form-input:focus { border-color: #e8624a; box-shadow: 0 0 0 3px rgba(232,98,74,.12); }
.form-input::placeholder { font-family: inherit; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 28px;
    border-radius: var(--radius);
    font-family: inherit;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: background .15s, transform .1s;
}

.btn:active { transform: scale(.98); }

.btn-primary { background: #e8624a; color: #fff; box-shadow: 0 4px 14px rgba(232,98,74,.30); }
.btn-primary:hover { background: #d4513a; }

.btn-success { background: var(--success); color: #fff; }
.btn-outline {
    background: #fff;
    color: var(--brand);
    border: 2px solid var(--brand);
}

.btn-lg { padding: 14px 36px; font-size: 1.05rem; }

/* ── Progresso ── */
.progresso-bar-wrap {
    background: var(--gray-100);
    border-radius: 99px;
    height: 8px;
    margin-bottom: 8px;
    overflow: hidden;
}

.progresso-bar {
    height: 100%;
    background: var(--brand);
    border-radius: 99px;
    width: 0%;
    transition: width .3s;
}

#contador {
    font-size: .85rem;
    color: var(--gray-600);
    font-weight: 600;
    margin-bottom: 24px;
}

/* ── Grade de slots ── */
.slots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 12px;
    margin-bottom: 32px;
}

.slot {
    position: relative;
    aspect-ratio: 65/90;
    border-radius: 8px;
    border: 2px dashed var(--gray-200);
    background: var(--gray-50);
    cursor: pointer;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: border-color .2s, background .2s;
}

.slot:hover { border-color: var(--brand); background: var(--brand-light); }

.slot-num {
    font-size: .7rem;
    font-weight: 700;
    color: var(--gray-400);
    position: absolute;
    top: 5px;
    left: 7px;
}

.slot-icon {
    font-size: 1.6rem;
    color: var(--gray-400);
    line-height: 1;
}

.slot.ok .slot-icon,
.slot.enviando .slot-icon { display: none; }

.slot-thumb {
    display: none;
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    inset: 0;
}

.slot.ok .slot-thumb { display: block; }

.slot-check {
    display: none;
    position: absolute;
    bottom: 5px;
    right: 6px;
    background: var(--success);
    color: #fff;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: .7rem;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.slot.ok .slot-check { display: flex; }

/* Spinner */
.slot-spinner {
    display: none;
    width: 22px;
    height: 22px;
    border: 3px solid var(--brand-light);
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

.slot.enviando .slot-spinner { display: block; }
.slot.enviando { border-color: var(--brand); cursor: default; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Modal de corte ── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.6);
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay[style*="flex"] { display: flex !important; }

.modal-box {
    background: #fff;
    border-radius: 14px;
    padding: 24px;
    max-width: 560px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 16px;
}

.modal-crop-area {
    flex: 1;
    min-height: 0;
    max-height: 60vh;
    overflow: hidden;
    border-radius: 8px;
    background: #000;
}

.modal-crop-area img { display: block; max-width: 100%; }

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    justify-content: flex-end;
}

.btn-ghost {
    background: transparent;
    color: var(--gray-600);
    border: 1.5px solid var(--gray-200);
}

/* ── Finalizar ── */
.finalizar-wrap {
    text-align: center;
    margin-top: 8px;
}

#btn-finalizar {
    display: none;
    background: var(--success);
    color: #fff;
}

/* ── Toasts ── */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    border-radius: 10px;
    font-size: .88rem;
    font-weight: 600;
    box-shadow: 0 4px 20px rgba(0,0,0,.18);
    max-width: 320px;
    animation: toastIn .28s ease forwards;
    pointer-events: auto;
}

.toast-success { background: #16a34a; color: #fff; }
.toast-error   { background: #dc2626; color: #fff; }
.toast-info    { background: #2563eb; color: #fff; }
.toast-warn    { background: #d97706; color: #fff; }

@keyframes toastIn  { from { transform: translateX(110%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes toastOut { to   { transform: translateX(110%); opacity: 0; } }

/* ── Banners ── */
.banner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 10px;
    font-size: .9rem;
    line-height: 1.5;
    margin-bottom: 20px;
}

.banner-icon { font-size: 1.15rem; flex-shrink: 0; margin-top: 1px; }
.banner strong { font-weight: 700; }

.banner-info    { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }
.banner-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #15803d; }
.banner-warn    { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.banner-lock    { background: #f3f4f6; border: 1px solid var(--gray-200); color: var(--gray-600); }

/* ── Empty state ── */
.empty-state {
    text-align: center;
    padding: 40px 20px 24px;
}

.empty-state-icon  { font-size: 2.8rem; margin-bottom: 14px; }
.empty-state-title { font-size: 1.05rem; font-weight: 700; margin-bottom: 6px; }
.empty-state-desc  { color: var(--gray-600); font-size: .88rem; line-height: 1.6; }

/* ── Enviar para produção ── */
.producao-section {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1.5px dashed var(--gray-200);
    text-align: center;
}

.btn-producao {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--brand);
    color: #fff;
    font-size: 1rem;
    padding: 14px 32px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    font-weight: 700;
    font-family: inherit;
    transition: background .15s, transform .1s;
}

.btn-producao:hover   { background: var(--brand-dark); }
.btn-producao:active  { transform: scale(.98); }
.btn-producao:disabled {
    background: var(--gray-200);
    color: var(--gray-400);
    cursor: not-allowed;
    transform: none;
}

/* ── Modal de confirmação ── */
.confirm-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 500;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.confirm-overlay.open { display: flex; }

.confirm-box {
    background: #fff;
    border-radius: 14px;
    padding: 32px 28px 24px;
    max-width: 460px;
    width: 100%;
    box-shadow: 0 8px 40px rgba(0,0,0,.2);
    text-align: center;
}

.confirm-box h3  { font-size: 1.15rem; font-weight: 800; margin-bottom: 12px; }
.confirm-box p   { color: var(--gray-600); font-size: .9rem; line-height: 1.65; margin-bottom: 24px; }
.confirm-actions { display: flex; flex-direction: row; gap: 10px; justify-content: center; }

/* ── Tela de produção (sucesso / bloqueio) ── */
.producao-final {
    text-align: center;
    padding: 52px 24px 40px;
}

.producao-final-icon  { font-size: 3.5rem; margin-bottom: 18px; }
.producao-final-title { font-size: 1.3rem; font-weight: 800; margin-bottom: 10px; }
.producao-final-desc  {
    color: var(--gray-600);
    font-size: .93rem;
    line-height: 1.7;
    max-width: 440px;
    margin: 0 auto 28px;
}

/* Fotos readonly */
.slot.readonly        { cursor: default; }
.slot.readonly:hover  { border-color: var(--gray-200); background: var(--gray-50); }
.slot.readonly.ok:hover { border-color: transparent; }

/* ── Blocos de fotos — abas ── */
.blocos-tabs {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin: 20px 0 0;
    border-bottom: 2px solid var(--gray-200);
    padding-bottom: 0;
}

.bloco-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: .88rem;
    font-weight: 600;
    color: var(--gray-600);
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    border-radius: 0;
    transition: color .15s, border-color .15s;
    font-family: inherit;
    white-space: nowrap;
}

.bloco-tab:hover { color: var(--brand); }
.bloco-tab.active { color: var(--brand); border-bottom-color: var(--brand); }
.bloco-tab.done .bloco-tab-prog { color: var(--success); background: #dcfce7; }

.bloco-tab-idx {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--gray-200);
    color: var(--gray-600);
    font-size: .72rem;
    font-weight: 700;
    flex-shrink: 0;
}

.bloco-tab.active .bloco-tab-idx { background: var(--brand); color: #fff; }
.bloco-tab.done   .bloco-tab-idx { background: var(--success); color: #fff; }

.bloco-tab-prog {
    font-size: .75rem;
    font-weight: 500;
    color: var(--gray-400);
    background: var(--gray-100);
    padding: 2px 7px;
    border-radius: 99px;
    transition: background .2s, color .2s;
}

/* ── Painel do bloco ── */
.bloco-panel { margin-top: 24px; }

.bloco-panel-header { margin-bottom: 20px; }

.bloco-panel-titulo {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.bloco-panel-desc {
    color: var(--gray-600);
    font-size: .91rem;
    background: var(--brand-light);
    padding: 10px 14px;
    border-radius: 8px;
    border-left: 3px solid var(--brand);
    line-height: 1.5;
}

.bloco-nav-btns {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 4px;
    margin-bottom: 20px;
}

/* ── Responsivo ── */
@media (max-width: 520px) {
    .card { padding: 24px 16px; }
    .slots-grid { grid-template-columns: repeat(5, 1fr); gap: 8px; }
    .stepper .step-label { display: none; }
    .bloco-tab { padding: 8px 10px; font-size: .82rem; }
    .bloco-tab-titulo { max-width: 80px; overflow: hidden; text-overflow: ellipsis; }
}

/* ════════════════════════════════════════════════════════════════════════
   MODO ÁLBUM IMERSIVO
   ═══════════════════════════════════════════════════════════════════════ */
body.album-mode {
    background: #f0ebe4;
    overflow: hidden;
    height: 100dvh;
}

.av-layout {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    overflow: hidden;
}

/* Header */
.av-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    flex-shrink: 0;
    background: #fff;
    box-shadow: 0 2px 12px rgba(0,0,0,.08);
}

.av-back {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: transparent;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem; font-weight: 700;
    color: #444;
    text-decoration: none;
    flex-shrink: 0;
    transition: background .15s;
}
.av-back:hover { background: rgba(0,0,0,.07); }

.av-header-mid {
    flex: 1;
    min-width: 0;
}

.av-counter {
    font-size: .82rem;
    font-weight: 700;
    color: #333;
    white-space: nowrap;
}

.av-prog-wrap {
    height: 5px;
    background: rgba(0,0,0,.12);
    border-radius: 99px;
    overflow: hidden;
}

.av-prog-bar {
    height: 100%;
    background: #e8624a;
    border-radius: 99px;
    width: 0%;
    transition: width .4s ease;
}

.av-btn-send {
    background: #e8624a;
    color: #fff;
    border: none;
    border-radius: 18px;
    padding: 10px 18px;
    font-size: .88rem;
    font-weight: 800;
    font-family: inherit;
    cursor: pointer;
    flex-shrink: 0;
    line-height: 1;
    white-space: nowrap;
    text-align: center;
    transition: background .15s, opacity .15s, transform .1s;
    letter-spacing: .01em;
    box-shadow: 0 4px 14px rgba(232,98,74,.35);
}
.av-btn-send:hover   { background: #d4513a; }
.av-btn-send:active  { transform: scale(.96); }
.av-btn-send:disabled {
    background: var(--gray-300);
    color: var(--gray-500);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.av-readonly-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #dcfce7;
    color: #15803d;
    border-radius: 99px;
    padding: 8px 16px;
    font-size: .82rem;
    font-weight: 700;
    flex-shrink: 0;
    white-space: nowrap;
}

/* Slots em modo readonly: sem hover */
body.readonly .fig-slot.vazio:hover,
body.readonly .fig-slot.vazio:active {
    background: rgba(0,0,0,.15);
    box-shadow: inset 0 0 0 2px rgba(255,255,255,.55);
}

/* Carousel */
.av-carousel {
    flex: 1;
    min-height: 0;
    display: flex;
    overflow-x: scroll;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 8px 9%;
    gap: 6%;
    align-items: center;
}
.av-carousel::-webkit-scrollbar { display: none; }

.av-card {
    flex: 0 0 82%;
    scroll-snap-align: center;
    scroll-snap-stop: always;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 12px 0;
    box-sizing: border-box;
}

.av-card-inner {
    position: relative;
    height: 100%;
    width: auto;
    max-width: 100%;
    display: inline-flex;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(0,0,0,.28);
}

.av-page-img {
    display: block;
    height: 100%;
    width: auto;
    max-width: 82vw;
    user-select: none;
    pointer-events: none;
    -webkit-user-drag: none;
}

/* Mobile: evita distorção quando max-width corta a largura mas não a altura */
@media (max-width: 767px) {
    .av-card-inner {
        height: auto;
        max-height: 100%;
        max-width: 82vw;
    }
    .av-page-img {
        height: auto;
        width: 82vw;
        max-width: 82vw;
        max-height: calc(82vw * 297 / 210); /* proporção A4 */
    }
}

.av-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

/* Footer */
.av-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px max(16px, env(safe-area-inset-bottom));
    flex-shrink: 0;
}

.av-nav-btn {
    width: 56px; height: 56px;
    border-radius: 50%;
    background: #e8624a;
    color: #fff;
    font-size: 1.3rem;
    border: none;
    outline: none;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: background .15s;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 0 4px 14px rgba(232,98,74,.35);
    user-select: none;
}
.av-nav-btn:hover        { background: #d4513a; }
.av-nav-btn:focus        { outline: none; }
.av-nav-btn:focus-visible { outline: none; }
.av-nav-btn:disabled     { background: #ddd; box-shadow: none; cursor: default; }

.av-page-label {
    font-size: .88rem;
    font-weight: 700;
    color: #444;
    background: #e8e0d6;
    border-radius: 99px;
    padding: 8px 22px;
}

/* Fig-slot (sobre a imagem da página) */
.fig-slot {
    position: absolute;
    box-sizing: border-box;
    border-radius: 6px;
    cursor: pointer;
    pointer-events: all;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
}

.fig-slot.vazio {
    box-shadow: inset 0 0 0 2px rgba(255,255,255,.55);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    background: rgba(255,255,255,.18);
}
.fig-slot.vazio:hover,
.fig-slot.vazio:active {
    background: rgba(255,255,255,.32);
    box-shadow: inset 0 0 0 2.5px rgba(255,255,255,.9);
}

.fig-slot-badge {
    position: relative;
    z-index: 2;
    background: rgba(0,0,0,.60);
    color: #fff;
    border-radius: 50%;
    width: 1.9rem;
    height: 1.9rem;
    font-size: .9rem;
    font-weight: 800;
    letter-spacing: .02em;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.fig-slot.vazio .fig-slot-badge::after { content: ''; }
.fig-slot.ok::after {
    content: '';
    position: absolute;
    inset: 0;
    border: 5px solid #fff;
    border-radius: 4px;
    z-index: 3;
    pointer-events: none;
}

.fig-slot.ok    .fig-slot-badge {
    background: rgba(22,163,74,.85);
}
.fig-slot.ok    .fig-slot-badge::after { content: ' ✓'; }
.fig-slot.enviando .fig-slot-badge { background: rgba(202,138,4,.85); }
.fig-slot.enviando .fig-slot-badge::after { content: ''; }

.fig-slot-thumb {
    position: absolute;
    inset: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    display: none;
    z-index: 1;
}
.fig-slot.ok .fig-slot-thumb { display: block; }

.fig-slot-spinner {
    position: absolute;
    z-index: 2;
    width: 20px; height: 20px;
    border: 2.5px solid rgba(255,255,255,.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .6s linear infinite;
    display: none;
}
.fig-slot.enviando .fig-slot-spinner { display: block; }

/* ── Página oculta ───────────────────────────────────────────────────────── */
.av-card-oculta .av-page-img {
    filter: blur(18px) brightness(.85);
    transform: scale(1.05); /* evita bordas brancas do blur */
}
.av-oculta-overlay {
    position: absolute; inset: 0;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    text-align: center;
    gap: 8px;
    padding: 16%;
    box-sizing: border-box;
    pointer-events: none;
    z-index: 3;
}
.av-oculta-icon  { font-size: 2.8em; line-height: 1; margin-bottom: 4px; }
.av-oculta-label {
    font-size: .82em; font-weight: 700;
    color: #fff; text-shadow: 0 2px 8px rgba(0,0,0,.5);
    line-height: 1.3;
}
.av-oculta-desc {
    font-size: .68em; color: rgba(255,255,255,.8);
    text-shadow: 0 1px 4px rgba(0,0,0,.4);
    line-height: 1.4;
}

/* ── Slot surpresa ───────────────────────────────────────────────────────── */
@keyframes surpresa-star-float {
    0%   { transform: translate(0,0) scale(0) rotate(0deg);   opacity:0; }
    20%  { opacity: 1; }
    80%  { opacity: .8; }
    100% { transform: translate(var(--sx), var(--sy)) scale(1) rotate(var(--sr)); opacity:0; }
}
@keyframes surpresa-star-pulse {
    0%,100% { transform: scale(1) rotate(0deg); opacity:.7; }
    50%      { transform: scale(1.3) rotate(20deg); opacity:1; }
}

.fig-slot.surpresa {
    border: 2px dashed rgba(245,158,11,.7);
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    cursor: pointer;
    overflow: visible; /* permite estrelas saírem do slot */
}

.surpresa-star {
    position: absolute;
    pointer-events: none;
    font-size: .7em;
    z-index: 3;
    color: #fff;
    animation: surpresa-star-float 2.4s ease-out infinite;
}
.surpresa-star:nth-child(1) { --sx:-120%; --sy:-130%; --sr:30deg;  animation-delay:0s;    top:20%; left:50%; }
.surpresa-star:nth-child(2) { --sx: 130%; --sy:-110%; --sr:-20deg; animation-delay:.6s;   top:30%; left:40%; }
.surpresa-star:nth-child(3) { --sx:-110%; --sy: 120%; --sr:45deg;  animation-delay:1.2s;  top:60%; left:55%; }
.surpresa-star:nth-child(4) { --sx: 120%; --sy: 130%; --sr:-35deg; animation-delay:1.8s;  top:50%; left:45%; }
.surpresa-star:nth-child(5) { --sx:  10%; --sy:-140%; --sr:15deg;  animation-delay:.3s;   top:15%; left:55%; }
.surpresa-star:nth-child(6) { --sx:-130%; --sy:  10%; --sr:-50deg; animation-delay:.9s;   top:45%; left:20%; }
.fig-slot.surpresa::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(254,243,199,.55);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    z-index: 0;
}
.fig-slot-surpresa-icon,
.fig-slot-surpresa-label { position: relative; z-index: 1; }
.fig-slot-surpresa-icon  { font-size: 1.3em; line-height: 1; }
.fig-slot-surpresa-label {
    font-size: .55em;
    font-weight: 700;
    color: #fff;
    text-align: center;
    line-height: 1.2;
    text-transform: uppercase;
    letter-spacing: .03em;
}

/* ── Modal surpresa ──────────────────────────────────────────────────────── */
.surpresa-modal-backdrop {
    position: fixed; inset: 0; z-index: 9990;
    background: rgba(0,0,0,.45);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    animation: fadeIn .15s ease;
}
.surpresa-modal {
    background: #fff;
    border-radius: 18px;
    padding: 32px 28px 24px;
    max-width: 320px; width: 100%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
    animation: slideUp .2s ease;
}
.surpresa-modal-emoji { font-size: 3rem; line-height: 1; margin-bottom: 12px; }
.surpresa-modal h3 {
    font-size: 1.1rem; font-weight: 800;
    color: #92400e; margin: 0 0 8px;
}
.surpresa-modal p {
    font-size: .9rem; color: #6b7280;
    line-height: 1.5; margin: 0 0 20px;
}
.surpresa-modal-btn {
    display: inline-block;
    background: #f59e0b; color: #fff;
    border: none; border-radius: 10px;
    padding: 10px 28px;
    font-size: .95rem; font-weight: 700;
    cursor: pointer; font-family: inherit;
    transition: background .15s;
}
.surpresa-modal-btn:hover { background: #d97706; }
@keyframes slideUp {
    from { transform: translateY(16px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

/* ── Botão de zoom (só desktop/hover) ───────────────────────────────────── */
.av-zoom-btn {
    display: none;
    position: absolute;
    bottom: 10px; right: 10px;
    z-index: 10;
    width: 34px; height: 34px;
    border-radius: 50%;
    background: rgba(0,0,0,.52);
    color: #fff;
    border: none;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    transition: background .15s, transform .1s;
}
.av-zoom-btn:hover   { background: rgba(0,0,0,.75); }
.av-zoom-btn:active  { transform: scale(.9); }

/* Aparece no hover do card em dispositivos com ponteiro fino */
@media (hover: hover) and (pointer: fine) {
    .av-card-inner:hover .av-zoom-btn { display: flex; }
}

/* ── Modal de zoom ───────────────────────────────────────────────────────── */
.av-zoom-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 300;
    background: rgba(0,0,0,.82);
    align-items: center;
    justify-content: center;
    padding: 24px;
    cursor: zoom-out;
}
.av-zoom-modal.open { display: flex; }

.av-zoom-close {
    position: fixed;
    top: 16px; right: 16px;
    width: 38px; height: 38px;
    border-radius: 50%;
    background: rgba(255,255,255,.18);
    border: none; color: #fff;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    z-index: 10;
    transition: background .15s;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}
.av-zoom-close:hover { background: rgba(255,255,255,.30); }

.av-zoom-inner {
    position: relative;
    display: inline-flex;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 16px 60px rgba(0,0,0,.5);
    cursor: default;
    max-height: 88vh;
    max-width: 88vw;
}

.av-zoom-img {
    display: block;
    max-height: 88vh;
    max-width: 88vw;
    width: auto;
    height: auto;
    user-select: none;
    pointer-events: none;
    -webkit-user-drag: none;
}

.av-zoom-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

/* ════════════════════════════════════════════════════════════════════════
   MODAL TUTORIAL (primeiro acesso)
   ═══════════════════════════════════════════════════════════════════════ */
.tutorial-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 500;
    background: rgba(0,0,0,.55);
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.tutorial-overlay.open { display: flex; }

.tutorial-box {
    background: #fff;
    border-radius: 20px;
    padding: 32px 28px 28px;
    max-width: 460px;
    width: 100%;
    box-shadow: 0 24px 60px rgba(0,0,0,.18);
    font-family: inherit;
}

.tutorial-header {
    text-align: center;
    margin-bottom: 24px;
}

.tutorial-emoji {
    display: block;
    font-size: 2.4rem;
    margin-bottom: 10px;
}

.tutorial-title {
    font-size: 1.2rem;
    font-weight: 800;
    margin-bottom: 6px;
    color: var(--gray-900);
}

.tutorial-subtitle {
    font-size: .88rem;
    color: var(--gray-600);
}

.tutorial-steps {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

.tutorial-step {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    text-align: left;
}

.tutorial-step-icon {
    font-size: 1.4rem;
    flex-shrink: 0;
    width: 36px;
    text-align: center;
    margin-top: 2px;
}

.tutorial-step strong {
    display: block;
    font-size: .9rem;
    font-weight: 700;
    margin-bottom: 2px;
    color: var(--gray-900);
}

.tutorial-step p {
    font-size: .82rem;
    color: var(--gray-600);
    line-height: 1.5;
    margin: 0;
}

/* ── Card surpresa (página oculta) ── */
.av-page-img--blur {
    filter: blur(18px);
    transform: scale(1.05); /* esconde as bordas do blur */
}

.av-surpresa-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
    text-align: center;
    gap: 10px;
    pointer-events: none;
}

.av-surpresa-emoji {
    font-size: 2.8rem;
    line-height: 1;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,.4));
}

.av-surpresa-titulo {
    font-size: .95rem;
    font-weight: 800;
    color: #fff;
    line-height: 1.4;
    text-shadow: 0 1px 8px rgba(0,0,0,.6);
}

.av-surpresa-desc {
    font-size: .78rem;
    color: rgba(255,255,255,.85);
    line-height: 1.5;
    text-shadow: 0 1px 6px rgba(0,0,0,.5);
}

/* Mobile: spread é transparente — cards participam direto do flex do carrossel */
.av-spread {
    display: contents;
}

/* ════════════════════════════════════════════════════════════════════════
   MODO ÁLBUM — LAYOUT DESKTOP
   ═══════════════════════════════════════════════════════════════════════ */
@media (min-width: 768px) {

    /* Header: back e send-btn nas pontas; mid flutuando ao centro */
    .av-header {
        position: relative;
        padding: 12px 28px;
        align-items: center;
    }

    .av-header-mid {
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        pointer-events: none;
        text-align: center;
        width: 320px;
    }

    .av-counter {
        display: block;
        font-size: .85rem;
        line-height: 1;
        margin-bottom: 4px;
    }

    .av-prog-wrap {
        margin: 0 auto;
    }

    .av-btn-send {
        margin-left: auto;
    }

    /* Carrossel — padding = (100vw - spread_width) / 2 = 168/2 = 84px,
       garante que o scroll-snap:center do primeiro e último spread
       não fique preso em offset negativo/impossível */
    .av-carousel {
        padding: 20px 84px;
        gap: 12px;
    }

    /* Spread: unidade de scroll no desktop.
       Largura = viewport - espaço dos dois botões (60px + 16px gap × 2) */
    .av-spread {
        display: flex;
        flex-direction: row;
        align-items: center;
        height: 100%;
        scroll-snap-align: center;
        scroll-snap-stop: always;
        gap: 2px;
        flex-shrink: 0;
        justify-content: center;
        /* ambos os tipos usam a mesma largura base */
        flex: 0 0 calc(100vw - 168px);
    }

    /* Cards dentro do spread: tamanho pelo conteúdo (imagem da página) */
    .av-spread .av-card {
        flex: 0 0 auto;
        height: 100%;
        width: auto;
        padding: 12px 0;
        scroll-snap-align: none;
        box-sizing: border-box;
    }

    .av-page-img {
        max-width: 44vw;
    }

    /* Nav buttons flutuam sobre o carrossel, centralizados verticalmente no layout */
    .av-layout {
        position: relative;
    }

    .av-nav-btn {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        z-index: 20;
        width: 60px; height: 60px;
        font-size: 1.4rem;
    }

    #btn-pag-prev { left: 16px; }
    #btn-pag-next { right: 16px; }

    /* Footer vira só o label centralizado */
    .av-footer {
        justify-content: center;
        padding-bottom: max(20px, env(safe-area-inset-bottom));
    }

    .av-page-label {
        font-size: .9rem;
        padding: 9px 28px;
    }
}
