/* =========================================================================
   Fotos da Festa — estilos gerais
   Paleta: roxo/ameixa profundo + dourado/rosa como destaque festivo,
   fundo com gradiente suave, cards brancos com bastante espaço e
   cantos arredondados. Mobile-first.
   ========================================================================= */

:root {
    --bg-1: #241338;
    --bg-2: #3a1f5d;
    --bg-3: #5b2a63;
    --accent: #ffb648;
    --accent-2: #ff6fa0;
    --success: #2fbf71;
    --danger: #e5484d;
    --ink: #2a1e3d;
    --ink-soft: #6b5f80;
    --card-bg: #ffffff;
    --card-radius: 22px;
    --shadow-soft: 0 10px 30px rgba(36, 19, 56, 0.18);
    --shadow-lift: 0 16px 40px rgba(36, 19, 56, 0.28);
    --max-width: 720px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Helvetica, Arial, sans-serif;
    background: radial-gradient(120% 100% at 50% 0%, var(--bg-3) 0%, var(--bg-2) 45%, var(--bg-1) 100%);
    background-attachment: fixed;
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    overflow-x: hidden;
}

.page {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 28px 18px 60px;
}

/* ---------------------------------------------------------------------- */
/* Cabeçalho / hero                                                       */
/* ---------------------------------------------------------------------- */

.hero {
    text-align: center;
    color: #fff;
    padding: 18px 4px 30px;
}

.hero-compact {
    padding-top: 6px;
    text-align: left;
}

.hero-eyebrow {
    text-transform: uppercase;
    letter-spacing: .14em;
    font-size: 12px;
    font-weight: 700;
    color: var(--accent);
    margin: 0 0 10px;
}

.hero-title {
    font-size: clamp(28px, 7vw, 40px);
    line-height: 1.15;
    font-weight: 800;
    margin: 0 0 14px;
    letter-spacing: -0.02em;
}

.hero-title-sm {
    font-size: clamp(24px, 6vw, 32px);
    margin-top: 10px;
}

.hero-emoji {
    display: inline-block;
    animation: wiggle 2.4s ease-in-out infinite;
}

@keyframes wiggle {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(-8deg) scale(1.05); }
}

.hero-subtitle {
    font-size: 15.5px;
    line-height: 1.55;
    color: rgba(255,255,255,0.82);
    max-width: 46ch;
    margin: 0 auto 22px;
}

.hero-compact .hero-subtitle {
    margin: 6px 0 0;
    max-width: none;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    padding: 8px 0;
}

/* ---------------------------------------------------------------------- */
/* Botões                                                                 */
/* ---------------------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    border-radius: 999px;
    padding: 14px 22px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
    -webkit-tap-highlight-color: transparent;
}

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

.btn-primary {
    background: linear-gradient(135deg, var(--accent-2), var(--accent));
    color: #2a1e3d;
    box-shadow: 0 8px 20px rgba(255, 111, 160, 0.35);
    width: 100%;
}

.btn-secondary {
    background: #f1edf7;
    color: var(--ink);
    width: 100%;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
    width: 100%;
}

.btn-ghost {
    background: rgba(255,255,255,0.12);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.25);
    backdrop-filter: blur(6px);
}

.btn-gallery { margin-top: 4px; }

/* ---------------------------------------------------------------------- */
/* Grid de desafios (2 colunas no celular)                                */
/* ---------------------------------------------------------------------- */

.challenges {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

@media (min-width: 560px) {
    .challenges { grid-template-columns: repeat(3, 1fr); gap: 16px; }
}

@media (min-width: 860px) {
    .challenges { grid-template-columns: repeat(4, 1fr); }
}

.card {
    background: var(--card-bg);
    border-radius: var(--card-radius);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: card-in .5s ease backwards;
    transition: box-shadow .2s ease, transform .2s ease;
}

@keyframes card-in {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}

.card-media {
    position: relative;
    aspect-ratio: 1 / 1;
    background: linear-gradient(160deg, #f4effa, #ece3f6);
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.card-emoji {
    font-size: 40px;
    filter: grayscale(0.1);
}

.card-camera-btn {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    border: none;
    cursor: pointer;
    color: rgba(42, 30, 61, 0.35);
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    padding: 12px;
    -webkit-tap-highlight-color: transparent;
}

.card-camera-btn svg {
    background: #fff;
    border-radius: 50%;
    padding: 9px;
    width: 38px;
    height: 38px;
    box-shadow: 0 6px 16px rgba(36,19,56,0.25);
    color: var(--ink);
    transition: transform .15s ease;
}

.card-camera-btn:active svg { transform: scale(0.9); }

.card-done-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: var(--success);
    color: #fff;
    font-size: 11.5px;
    font-weight: 700;
    padding: 5px 10px 5px 7px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 4px 10px rgba(47, 191, 113, 0.4);
}

.card-delete-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: rgba(20, 10, 30, 0.55);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(3px);
}

.card-body {
    padding: 12px 12px 14px;
}

.card-title {
    font-size: 14.5px;
    font-weight: 700;
    margin: 0 0 3px;
    line-height: 1.3;
}

.card-subtitle {
    font-size: 12.5px;
    color: var(--ink-soft);
    margin: 0;
    line-height: 1.3;
}

.card-done .card-media { background: #eef8f1; }

.page-footer {
    text-align: center;
    color: rgba(255,255,255,0.55);
    font-size: 13px;
    margin-top: 40px;
}

/* ---------------------------------------------------------------------- */
/* Modais (prévia da foto / confirmação de exclusão)                      */
/* ---------------------------------------------------------------------- */

.modal {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

@media (min-width: 560px) {
    .modal { align-items: center; }
}

.modal[hidden] { display: none; }

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(20, 10, 30, 0.55);
    animation: fade-in .18s ease;
}

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.modal-box {
    position: relative;
    background: #fff;
    width: 100%;
    max-width: 460px;
    border-radius: 24px 24px 0 0;
    padding: 22px 20px calc(20px + env(safe-area-inset-bottom));
    animation: sheet-up .22s ease;
}

@media (min-width: 560px) {
    .modal-box { border-radius: 24px; }
}

@keyframes sheet-up {
    from { transform: translateY(24px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-box-small { padding-top: 26px; }

.modal-image-wrap {
    width: 100%;
    max-height: 55vh;
    border-radius: 16px;
    overflow: hidden;
    background: #f1edf7;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

#preview-image {
    width: 100%;
    max-height: 55vh;
    object-fit: contain;
    display: block;
}

.modal-hint {
    text-align: center;
    font-weight: 700;
    font-size: 16px;
    margin: 0 0 16px;
}

.modal-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.modal-box-small .modal-actions { grid-template-columns: 1fr 1fr; }

.modal-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 14px;
    color: var(--ink-soft);
    font-weight: 600;
    font-size: 14px;
}

.spinner {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 3px solid #e4dcf1;
    border-top-color: var(--accent-2);
    animation: spin .7s linear infinite;
}

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

/* ---------------------------------------------------------------------- */
/* Toast                                                                  */
/* ---------------------------------------------------------------------- */

.toast {
    position: fixed;
    left: 50%;
    bottom: 26px;
    transform: translateX(-50%);
    background: #2a1e3d;
    color: #fff;
    padding: 12px 18px;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 600;
    max-width: 88vw;
    text-align: center;
    z-index: 80;
    box-shadow: var(--shadow-lift);
    animation: toast-in .2s ease;
}

.toast[hidden] { display: none; }

@keyframes toast-in {
    from { opacity: 0; transform: translate(-50%, 8px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

/* ---------------------------------------------------------------------- */
/* Confetes                                                               */
/* ---------------------------------------------------------------------- */

#confetti-canvas {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 70;
    width: 100%;
    height: 100%;
}

/* ---------------------------------------------------------------------- */
/* Galeria pública (mosaico)                                              */
/* ---------------------------------------------------------------------- */

.gallery {
    column-count: 2;
    column-gap: 12px;
}

@media (min-width: 560px) { .gallery { column-count: 3; } }
@media (min-width: 860px) { .gallery { column-count: 4; } }

.gallery-item {
    break-inside: avoid;
    margin-bottom: 12px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    background: #fff;
    border: none;
    padding: 0;
    display: block;
    width: 100%;
    cursor: pointer;
    position: relative;
    animation: card-in .45s ease backwards;
}

.gallery-item img {
    width: 100%;
    display: block;
}

.gallery-item .gallery-tag {
    position: absolute;
    left: 8px;
    bottom: 8px;
    background: rgba(20,10,30,0.6);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 9px;
    border-radius: 999px;
    backdrop-filter: blur(3px);
}

.gallery-empty {
    color: rgba(255,255,255,0.8);
    text-align: center;
    grid-column: 1 / -1;
    column-span: all;
    padding: 40px 10px;
    font-size: 15px;
}

/* ---------------------------------------------------------------------- */
/* Lightbox                                                               */
/* ---------------------------------------------------------------------- */

.modal-lightbox { align-items: center; }

.lightbox-content {
    position: relative;
    z-index: 61;
    max-width: 92vw;
    max-height: 86vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.lightbox-content img {
    max-width: 92vw;
    max-height: 78vh;
    border-radius: 14px;
    box-shadow: var(--shadow-lift);
    -webkit-touch-callout: default;
}

.lightbox-caption {
    color: #fff;
    margin-top: 12px;
    font-weight: 600;
    font-size: 14px;
    text-align: center;
}

.lightbox-close {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 62;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.15);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(4px);
}

/* ---------------------------------------------------------------------- */
/* Utilitários                                                            */
/* ---------------------------------------------------------------------- */

[hidden] { display: none !important; }
