/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ===== Trang trí toàn thiệp (G5): .card-root và #weddingCardFrame cùng nhận tex-*, frame-*, orn-* ===== */
.card-root {
    position: relative;
}

/* Không để nội dung/hoa văn tràn ngang */
.card-root,
#sectionsViewport {
    overflow-x: clip;
}

/* Có khung/hoa góc: chừa lề ngang để chữ không đè lên viền */
.frame-single .wedding-section,
.frame-double .wedding-section,
.frame-floral-corner .wedding-section,
.orn-leaf .wedding-section,
.orn-rose .wedding-section {
    padding-inline: 20px;
}

@media (max-width: 479px) {
    .frame-double::after { border-width: 3px; }
    .frame-floral-corner::after { background-size: 56px 56px; }
    .orn-leaf::before,
    .orn-rose::before {
        background-size: 56px 56px;
        opacity: 0.65;
    }
}

/* Texture (gradient / SVG data URI, không tệp ngoài); nhẹ để chữ vẫn đọc được */
.tex-paper {
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='0.07'/%3E%3C/svg%3E"),
        linear-gradient(rgba(120, 90, 50, 0.04), rgba(120, 90, 50, 0.04));
}

.tex-floral {
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='72'%3E%3Cg fill='%23c9a27a' fill-opacity='0.16'%3E%3Ccircle cx='18' cy='18' r='4'/%3E%3Ccircle cx='18' cy='10' r='3'/%3E%3Ccircle cx='18' cy='26' r='3'/%3E%3Ccircle cx='10' cy='18' r='3'/%3E%3Ccircle cx='26' cy='18' r='3'/%3E%3Ccircle cx='54' cy='54' r='4'/%3E%3Ccircle cx='54' cy='46' r='3'/%3E%3Ccircle cx='54' cy='62' r='3'/%3E%3Ccircle cx='46' cy='54' r='3'/%3E%3Ccircle cx='62' cy='54' r='3'/%3E%3C/g%3E%3C/svg%3E");
    background-size: 72px 72px;
}

.tex-silk {
    background-image: linear-gradient(115deg, rgba(255, 255, 255, 0.35) 0%, rgba(255, 255, 255, 0) 30%, rgba(160, 120, 80, 0.07) 55%, rgba(255, 255, 255, 0.3) 80%, rgba(255, 255, 255, 0) 100%);
}

/* Khung viền + hoa góc: lớp phủ giả, không chặn thao tác */
.frame-single::after,
.frame-double::after,
.frame-floral-corner::after,
.orn-leaf::before,
.orn-rose::before {
    content: "";
    position: absolute;
    pointer-events: none;
    z-index: 35;
}

.frame-single::after,
.frame-double::after,
.frame-floral-corner::after {
    inset: 8px;
    border-radius: 4px;
}

.frame-single::after {
    border: 1px solid rgba(140, 98, 57, 0.55);
}

.frame-double::after {
    border: 4px double rgba(140, 98, 57, 0.55);
}

.frame-floral-corner::after {
    border: 1px solid rgba(140, 98, 57, 0.35);
    background-repeat: no-repeat;
    background-size: 56px 56px;
    background-position: left top, right top, left bottom, right bottom;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 56 56'%3E%3Cg fill='none' stroke='%238c6239' stroke-width='1.5' stroke-linecap='round'%3E%3Cpath d='M4 52C4 24 24 4 52 4'/%3E%3Cpath d='M4 30c8 0 12-6 12-12'/%3E%3Cpath d='M30 4c0 8 6 12 12 12'/%3E%3C/g%3E%3Ccircle cx='10' cy='10' r='3' fill='%238c6239'/%3E%3C/svg%3E"),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 56 56'%3E%3Cg transform='translate(56 0) scale(-1 1)' fill='none' stroke='%238c6239' stroke-width='1.5' stroke-linecap='round'%3E%3Cpath d='M4 52C4 24 24 4 52 4'/%3E%3Cpath d='M4 30c8 0 12-6 12-12'/%3E%3Cpath d='M30 4c0 8 6 12 12 12'/%3E%3Ccircle cx='10' cy='10' r='3' fill='%238c6239' stroke='none'/%3E%3C/g%3E%3C/svg%3E"),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 56 56'%3E%3Cg transform='translate(0 56) scale(1 -1)' fill='none' stroke='%238c6239' stroke-width='1.5' stroke-linecap='round'%3E%3Cpath d='M4 52C4 24 24 4 52 4'/%3E%3Cpath d='M4 30c8 0 12-6 12-12'/%3E%3Cpath d='M30 4c0 8 6 12 12 12'/%3E%3Ccircle cx='10' cy='10' r='3' fill='%238c6239' stroke='none'/%3E%3C/g%3E%3C/svg%3E"),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 56 56'%3E%3Cg transform='translate(56 56) scale(-1 -1)' fill='none' stroke='%238c6239' stroke-width='1.5' stroke-linecap='round'%3E%3Cpath d='M4 52C4 24 24 4 52 4'/%3E%3Cpath d='M4 30c8 0 12-6 12-12'/%3E%3Cpath d='M30 4c0 8 6 12 12 12'/%3E%3Ccircle cx='10' cy='10' r='3' fill='%238c6239' stroke='none'/%3E%3C/g%3E%3C/svg%3E");
}

/* Hoa văn góc trên-trái và dưới-phải */
.orn-leaf::before,
.orn-rose::before {
    inset: 0;
    background-repeat: no-repeat;
    background-size: 72px 72px;
    background-position: left top, right bottom;
    opacity: 0.8;
}

.orn-leaf::before {
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 72 72'%3E%3Cg fill='%237a9a6a' fill-opacity='0.55'%3E%3Cpath d='M4 4c24 0 40 14 40 34-22 0-40-10-40-34z'/%3E%3Cpath d='M4 4c4 20 14 32 30 40' fill='none' stroke='%23fff' stroke-opacity='0.7' stroke-width='1'/%3E%3Cpath d='M30 4c16 2 28 12 30 28-16-2-28-10-30-28z' fill-opacity='0.4'/%3E%3C/g%3E%3C/svg%3E"),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 72 72'%3E%3Cg transform='translate(72 72) scale(-1 -1)' fill='%237a9a6a' fill-opacity='0.55'%3E%3Cpath d='M4 4c24 0 40 14 40 34-22 0-40-10-40-34z'/%3E%3Cpath d='M30 4c16 2 28 12 30 28-16-2-28-10-30-28z' fill-opacity='0.4'/%3E%3C/g%3E%3C/svg%3E");
}

.orn-rose::before {
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 72 72'%3E%3Cg fill='none' stroke='%23c0566b' stroke-opacity='0.7' stroke-width='1.5'%3E%3Ccircle cx='24' cy='24' r='5'/%3E%3Cpath d='M24 14c8 0 14 6 14 14s-6 12-14 12-14-6-14-14'/%3E%3Cpath d='M24 8c14 0 24 10 24 24'/%3E%3C/g%3E%3Cg fill='%237a9a6a' fill-opacity='0.5'%3E%3Cpath d='M44 44c10 2 18 8 22 18-10 0-20-6-22-18z'/%3E%3C/g%3E%3C/svg%3E"),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 72 72'%3E%3Cg transform='translate(72 72) scale(-1 -1)'%3E%3Cg fill='none' stroke='%23c0566b' stroke-opacity='0.7' stroke-width='1.5'%3E%3Ccircle cx='24' cy='24' r='5'/%3E%3Cpath d='M24 14c8 0 14 6 14 14s-6 12-14 12-14-6-14-14'/%3E%3Cpath d='M24 8c14 0 24 10 24 24'/%3E%3C/g%3E%3Cg fill='%237a9a6a' fill-opacity='0.5'%3E%3Cpath d='M44 44c10 2 18 8 22 18-10 0-20-6-22-18z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

/* Nền toàn thiệp trên khung (G2/G3): chồng lớp từ trên xuống = texture, lớp phủ sáng, ảnh nền.
   Biến --card-bg-* do cardBgVars() đặt; không ảnh thì ảnh = none, lớp phủ trong suốt => y như trước.
   Mỗi lớp có đủ size/repeat/position riêng (số lớp phải khớp nhau). */
#weddingCardFrame {
    background-image: linear-gradient(var(--card-bg-veil, rgba(255, 255, 255, 0)), var(--card-bg-veil, rgba(255, 255, 255, 0))), var(--card-bg-image, none);
    background-size: 100% 100%, var(--card-bg-size, cover);
    background-repeat: no-repeat, var(--card-bg-repeat, no-repeat);
    background-position: 0 0, center;
}

#weddingCardFrame.tex-paper {
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='0.07'/%3E%3C/svg%3E"),
        linear-gradient(rgba(120, 90, 50, 0.04), rgba(120, 90, 50, 0.04)),
        linear-gradient(var(--card-bg-veil, rgba(255, 255, 255, 0)), var(--card-bg-veil, rgba(255, 255, 255, 0))),
        var(--card-bg-image, none);
    background-size: 120px 120px, 100% 100%, 100% 100%, var(--card-bg-size, cover);
    background-repeat: repeat, no-repeat, no-repeat, var(--card-bg-repeat, no-repeat);
    background-position: 0 0, 0 0, 0 0, center;
}

#weddingCardFrame.tex-floral {
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='72'%3E%3Cg fill='%23c9a27a' fill-opacity='0.16'%3E%3Ccircle cx='18' cy='18' r='4'/%3E%3Ccircle cx='18' cy='10' r='3'/%3E%3Ccircle cx='18' cy='26' r='3'/%3E%3Ccircle cx='10' cy='18' r='3'/%3E%3Ccircle cx='26' cy='18' r='3'/%3E%3Ccircle cx='54' cy='54' r='4'/%3E%3Ccircle cx='54' cy='46' r='3'/%3E%3Ccircle cx='54' cy='62' r='3'/%3E%3Ccircle cx='46' cy='54' r='3'/%3E%3Ccircle cx='62' cy='54' r='3'/%3E%3C/g%3E%3C/svg%3E"),
        linear-gradient(var(--card-bg-veil, rgba(255, 255, 255, 0)), var(--card-bg-veil, rgba(255, 255, 255, 0))),
        var(--card-bg-image, none);
    background-size: 72px 72px, 100% 100%, var(--card-bg-size, cover);
    background-repeat: repeat, no-repeat, var(--card-bg-repeat, no-repeat);
    background-position: 0 0, 0 0, center;
}

#weddingCardFrame.tex-silk {
    background-image:
        linear-gradient(115deg, rgba(255, 255, 255, 0.35) 0%, rgba(255, 255, 255, 0) 30%, rgba(160, 120, 80, 0.07) 55%, rgba(255, 255, 255, 0.3) 80%, rgba(255, 255, 255, 0) 100%),
        linear-gradient(var(--card-bg-veil, rgba(255, 255, 255, 0)), var(--card-bg-veil, rgba(255, 255, 255, 0))),
        var(--card-bg-image, none);
    background-size: 100% 100%, 100% 100%, var(--card-bg-size, cover);
    background-repeat: no-repeat, no-repeat, var(--card-bg-repeat, no-repeat);
    background-position: 0 0, 0 0, center;
}

/* Trong editor, khung ngoài đã mang lớp; .card-root bên trong không vẽ lại để tránh chồng đôi */
#weddingCardFrame .card-root {
    background-image: none;
}

#weddingCardFrame .card-root::before,
#weddingCardFrame .card-root::after {
    content: none;
}

/* ===== Section: padding / căn chữ / hoa văn viền (G5 sec.style) ===== */
.sec-py-sm { padding-top: 16px; padding-bottom: 16px; }
.sec-py-md { padding-top: 36px; padding-bottom: 36px; }
.sec-py-lg { padding-top: 64px; padding-bottom: 64px; }

.sec-align-left,
.sec-align-left * { text-align: left !important; }
.sec-align-center,
.sec-align-center * { text-align: center !important; }
.sec-align-right,
.sec-align-right * { text-align: right !important; }

.sec-orn-top::before,
.sec-orn-both::before,
.sec-orn-bottom::after,
.sec-orn-both::after {
    content: "";
    position: absolute;
    left: 50%;
    width: 140px;
    max-width: 60%;
    height: 14px;
    transform: translateX(-50%);
    pointer-events: none;
    z-index: 1;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 140 14'%3E%3Cg fill='none' stroke='%238c6239' stroke-opacity='0.7' stroke-width='1.2' stroke-linecap='round'%3E%3Cpath d='M4 7h50M86 7h50'/%3E%3Cpath d='M54 7c4-6 10-6 16 0 6-6 12-6 16 0-4 6-10 6-16 0-6 6-12 6-16 0z'/%3E%3C/g%3E%3C/svg%3E");
}

.sec-orn-top::before,
.sec-orn-both::before { top: 4px; }

.sec-orn-bottom::after,
.sec-orn-both::after { bottom: 4px; }

/* ===== Reveal: chỉ ẩn khi gốc có .reveal-on (runtime trang khách); editor không có lớp này nên luôn hiện ===== */
.reveal-on .reveal-fade-up:not(.is-visible),
.reveal-on .reveal-zoom:not(.is-visible),
.reveal-on .reveal-slide:not(.is-visible) {
    opacity: 0;
}

.reveal-on .reveal-fade-up:not(.is-visible) { transform: translateY(28px); }
.reveal-on .reveal-zoom:not(.is-visible) { transform: scale(0.92); }
.reveal-on .reveal-slide:not(.is-visible) { transform: translateX(-20px); }

.reveal-on .reveal-fade-up,
.reveal-on .reveal-zoom,
.reveal-on .reveal-slide {
    transition: opacity 0.8s ease, transform 0.8s ease;
}

@media (prefers-reduced-motion: reduce) {
    .reveal-on .reveal-fade-up:not(.is-visible),
    .reveal-on .reveal-zoom:not(.is-visible),
    .reveal-on .reveal-slide:not(.is-visible) {
        opacity: 1;
        transform: none;
    }
}

/* Hiệu ứng chọn Section như Canva */
.wedding-section {
    position: relative;
    transition: all 0.25s ease;
    border: 2px solid transparent;
}

.editor-mode .wedding-section:hover {
    border-color: #c084fc;
}

.editor-mode .wedding-section.selected-section {
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.18);
}

.section-badge {
    display: none;
}

.editor-mode .wedding-section:hover .section-badge,
.editor-mode .wedding-section.selected-section .section-badge {
    display: flex;
}

/* Hiệu ứng chỉnh sửa chữ trực tiếp (ContentEditable) */
[contenteditable="true"]:focus {
    outline: 2px dashed #8b5cf6;
    outline-offset: 4px;
    background-color: rgba(139, 92, 246, 0.06);
    border-radius: 4px;
}

/* Hiệu ứng cánh hoa rơi */
@keyframes fall {
    0% {
        transform: translateY(-10vh) translateX(0) rotate(0deg);
        opacity: 0.9;
    }

    50% {
        transform: translateY(45vh) translateX(18px) rotate(180deg);
        opacity: 0.85;
    }

    100% {
        transform: translateY(105vh) translateX(-15px) rotate(360deg);
        opacity: 0.35;
    }
}

.petal {
    position: absolute;
    top: -30px;
    pointer-events: none;
    z-index: 40;
    animation: fall linear infinite;
}

/* ---------- Nút thêm vào lịch (điền vào [data-slot="calendar-actions"]) ---------- */
.cal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: 14px;
}

.cal-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 44px;
    padding: 8px 14px;
    border: 1.5px solid currentColor;
    border-radius: 9999px;
    background: #fff;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    transition: opacity .2s ease, transform .2s ease;
}

.cal-btn:hover { opacity: .85; }
.cal-btn:active { transform: scale(.97); }

/* Lớp rơi cao 0 (sticky) nhưng phải để tràn để thấy cánh hoa; khung thiệp đã overflow-hidden nên không lọt ra ngoài */
#weddingCardFrame #fallingContainer { overflow: visible !important; }

/* ---------- Intro dùng chung (trang khách, export, editor chế độ Xem thực tế) ---------- */
.intro-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: var(--intro-bg, #fdfbf7);
    color: var(--intro-color, #8c6239);
    text-align: center;
    transition: opacity .5s ease .5s;
}

/* Biến thể gọn trong khung điện thoại (editor Xem thực tế); chiều cao do runtime đặt theo vùng nhìn thấy */
.intro-overlay.intro-in-frame {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    z-index: 60;
}

.intro-overlay.is-opening {
    opacity: 0;
    pointer-events: none;
}

.intro-stage {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 430px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    transition: opacity .35s ease, transform .5s ease;
}

.intro-to {
    margin: 0;
    font-size: 12px;
    letter-spacing: .2em;
    text-transform: uppercase;
    opacity: .9;
}

.intro-name {
    margin: 0 0 14px;
    font-size: 26px;
    font-weight: 700;
    line-height: 1.25;
    word-break: break-word;
}

.intro-btn {
    min-height: 48px;
    padding: 12px 28px;
    border: 0;
    border-radius: 9999px;
    background: var(--intro-color, #8c6239);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
    animation: introPulse 1.8s ease-in-out infinite;
}

.intro-btn:focus-visible {
    outline: 3px solid var(--intro-color, #8c6239);
    outline-offset: 3px;
}

@keyframes introPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Phong bì */
.intro-env {
    position: relative;
    width: 240px;
    height: 160px;
    margin-bottom: 22px;
    perspective: 700px;
}

.intro-env-back,
.intro-env-front,
.intro-env-card,
.intro-env-flap {
    position: absolute;
    left: 0;
    right: 0;
}

.intro-env-back {
    inset: 0;
    border-radius: 6px;
    background: var(--intro-color, #8c6239);
    filter: brightness(.88);
}

.intro-env-card {
    top: 10px;
    bottom: 10px;
    left: 12px;
    right: 12px;
    border-radius: 4px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .15);
    transition: transform .6s ease .35s;
}

.intro-env-front {
    bottom: 0;
    height: 100%;
    border-radius: 6px;
    background: var(--intro-color, #8c6239);
    filter: brightness(.96);
    clip-path: polygon(0 0, 50% 55%, 100% 0, 100% 100%, 0 100%);
}

.intro-env-flap {
    top: 0;
    height: 60%;
    background: var(--intro-color, #8c6239);
    filter: brightness(1.15) drop-shadow(0 2px 2px rgba(0, 0, 0, .18));
    clip-path: polygon(0 0, 100% 0, 50% 100%);
    transform-origin: top center;
    transition: transform .6s ease;
}

.intro-env-seal {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 38px;
    height: 38px;
    margin: -19px 0 0 -19px;
    border-radius: 50%;
    background: #fff;
    color: var(--intro-color, #e11d48);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .25);
    z-index: 3;
    transition: opacity .3s ease;
}

.is-opening .intro-env-flap { transform: rotateX(180deg); }
.is-opening .intro-env-seal { opacity: 0; }
.is-opening .intro-env-card { transform: translateY(-46px); }
.is-opening .intro-stage { opacity: 0; transform: scale(1.12); transition-delay: .45s; }

/* Rèm */
.intro-curtain-panel {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 50%;
    z-index: 1;
    background: repeating-linear-gradient(90deg,
        var(--intro-color, #8c6239) 0, var(--intro-color, #8c6239) 18px,
        rgba(0, 0, 0, .18) 18px, rgba(0, 0, 0, .18) 20px);
    transition: transform .9s cubic-bezier(.65, 0, .35, 1);
}

.intro-curtain-l { left: 0; }
.intro-curtain-r { right: 0; }

.intro-curtain { background: transparent; }
.intro-curtain .intro-stage {
    color: #fff;
    text-shadow: 0 1px 6px rgba(0, 0, 0, .45);
}

.intro-curtain .intro-btn {
    background: #fff;
    color: var(--intro-color, #8c6239);
    text-shadow: none;
}

.intro-curtain.is-opening .intro-curtain-l { transform: translateX(-100%); }
.intro-curtain.is-opening .intro-curtain-r { transform: translateX(100%); }
.intro-curtain.is-opening .intro-stage { opacity: 0; transform: none; transition-delay: 0s; }

@media (prefers-reduced-motion: reduce) {
    .intro-btn { animation: none; }
    .intro-overlay,
    .intro-stage,
    .intro-env-card,
    .intro-env-flap,
    .intro-curtain-panel { transition-duration: .01s; transition-delay: 0s; }
}

/* Đĩa nhạc xoay */
@keyframes spinSlow {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.spin-music {
    animation: spinSlow 6s linear infinite;
}

/* ===== Trang bìa: layout (T27) ===== */
/* --- tràn viền: bù padding-inline 20px của khung/hoa góc --- */
.frame-single .hero-bleed,
.frame-double .hero-bleed,
.frame-floral-corner .hero-bleed,
.orn-leaf .hero-bleed,
.orn-rose .hero-bleed {
    margin-inline: -20px;
}

/* --- fade: ảnh tràn viền, mép dưới mờ vào nền khung --- */
.hero-fade { overflow: hidden; }
.hero-fade-stage { position: relative; }
.hero-fade-media {
    position: relative;
    aspect-ratio: 4 / 5;
    overflow: hidden;
    -webkit-mask-image: linear-gradient(to bottom, #000 62%, transparent);
    mask-image: linear-gradient(to bottom, #000 62%, transparent);
}
.hero-fade-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hero-fade-media::after {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background: linear-gradient(to bottom, rgba(255, 255, 255, .6), rgba(255, 255, 255, 0) 45%);
}
.hero-fade-top {
    position: absolute; top: 0; left: 0; right: 0;
    padding: 28px 18px 0;
    text-shadow: 0 0 10px rgba(255, 255, 255, .9), 0 0 22px rgba(255, 255, 255, .7);
}
.hero-fade-invite { font-size: 10px; letter-spacing: .2em; text-transform: uppercase; opacity: .9; margin-bottom: 8px; }
.hero-fade-tag { font-size: 12px; letter-spacing: .3em; text-transform: uppercase; margin-bottom: 4px; }
.hero-fade-names { line-height: 1.1; overflow-wrap: anywhere; }
.hero-fade-info {
    display: grid; grid-template-columns: 1fr 1.25fr 1fr;
    margin: -6px 12px 0; align-items: stretch;
}
.hero-fade-col { padding: 4px 8px; min-width: 0; overflow-wrap: anywhere; display: flex; flex-direction: column; justify-content: center; align-items: center; }
.hero-fade-col + .hero-fade-col { border-left: 1px solid var(--hero-line, currentColor); }
.hero-fade-weekday { font-size: 10px; letter-spacing: .22em; text-transform: uppercase; }
.hero-fade-date { font-size: clamp(18px, 5.4vw, 26px); font-weight: 700; line-height: 1.15; white-space: nowrap; }
.hero-fade-time { font-size: 13px; font-weight: 700; letter-spacing: .1em; }
.hero-fade-venue { font-size: 11px; line-height: 1.45; margin-top: 4px; }
.hero-fade-closing { font-size: 15px; line-height: 1.3; }
.hero-fade-heart { font-size: 12px; margin-top: 6px; }

/* --- arch: khối màu chủ đạo + ảnh mép trên cong elip --- */
.hero-arch { color: var(--hero-arch-ink, #efe3c4); overflow: hidden; }
.hero-arch-head { padding: 32px 20px 22px; }
.hero-arch-mono {
    min-width: 64px; width: fit-content; max-width: 90%; height: 64px; margin: 0 auto 14px; padding: 0 16px;
    border: 1px solid #c9a96e; border-radius: 999px; box-sizing: border-box;
    display: flex; align-items: center; justify-content: center;
    white-space: nowrap; font-size: clamp(15px, 5vw, 22px); color: var(--hero-arch-ink, #efe3c4);
}
.hero-arch-tag { font-size: 10px; letter-spacing: .3em; text-transform: uppercase; margin-bottom: 8px; opacity: .9; }
.hero-arch-names { text-transform: uppercase; letter-spacing: .06em; line-height: 1.15; overflow-wrap: anywhere; }
.hero-arch-rule { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 14px auto 10px; max-width: 220px; color: #c9a96e; font-size: 11px; }
.hero-arch-rule span { flex: 1; height: 1px; background: #c9a96e; opacity: .8; }
.hero-arch-date { font-size: 18px; letter-spacing: .2em; }
.hero-arch-weekday { font-size: 11px; letter-spacing: .3em; text-transform: uppercase; margin-top: 4px; opacity: .9; }
.hero-arch-photo {
    aspect-ratio: 3 / 4; overflow: hidden; background: #fff;
    border: 1px solid #c9a96e; border-bottom: 0;
    border-radius: 50% 50% 0 0 / 14% 14% 0 0;
}
.hero-arch-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hero-arch-note { font-size: 13px; font-style: italic; padding: 20px 24px 26px; opacity: .92; }

/* --- fullscreen: ảnh phủ cả màn hình --- */
.hero-full {
    position: relative; overflow: hidden; color: #fff; text-align: center;
    height: 100vh;
    height: clamp(560px, 100svh, 900px);
}
#canvasScrollArea .hero-full { height: 760px; }
.hero-full-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero-full-shade { position: absolute; inset: 0; background: linear-gradient(to top, rgba(0, 0, 0, .78), rgba(0, 0, 0, .3) 55%, rgba(0, 0, 0, .35)); }
.hero-full-body {
    position: absolute; inset: 0; padding: 0 20px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-shadow: 0 1px 8px rgba(0, 0, 0, .5);
}
.hero-full-tag { font-size: 12px; letter-spacing: .3em; text-transform: uppercase; margin-bottom: 8px; opacity: .95; }
.hero-full-names { line-height: 1.1; overflow-wrap: anywhere; }
.hero-full-date { font-size: 20px; letter-spacing: .2em; font-weight: 600; }
.hero-full-note { font-size: 12px; font-style: italic; margin-top: 14px; opacity: .9; max-width: 320px; }
.hero-full-arrow { position: absolute; bottom: 16px; left: 50%; margin-left: -6px; font-size: 14px; opacity: .85; animation: heroArrow 1.8s ease-in-out infinite; }
@keyframes heroArrow { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) { .hero-full-arrow { animation: none; } }

/* Tab cột phải + thư viện ảnh đã tải (editor) */
.right-tabs { display: flex; border-bottom: 1px solid #e2e8f0; background: #fff; }
.right-tab {
    flex: 1; min-height: 44px; padding: 8px 6px; font-size: 12px; font-weight: 600;
    color: #64748b; border-bottom: 2px solid transparent; cursor: pointer;
}
.right-tab:hover { color: #6d28d9; }
.right-tab.is-active { color: #6d28d9; border-bottom-color: #7c3aed; background: #f5f3ff; }
.upload-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.upload-item { border: 1px solid #e2e8f0; border-radius: 8px; padding: 6px; background: #fff; min-width: 0; }
.upload-thumb { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 6px; background: #f1f5f9; }
.upload-thumb-icon { display: flex; align-items: center; justify-content: center; font-size: 28px; color: #7c3aed; }
.upload-name { margin-top: 6px; font-size: 10px; font-weight: 600; color: #334155; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-meta { font-size: 10px; color: #94a3b8; min-height: 14px; }
.upload-actions { display: flex; gap: 6px; margin-top: 4px; }
.upload-btn {
    flex: 1; min-height: 32px; display: flex; align-items: center; justify-content: center;
    border: 1px solid #e2e8f0; border-radius: 6px; color: #475569; background: #f8fafc; cursor: pointer; font-size: 12px;
}
.upload-btn:hover { background: #ede9fe; color: #6d28d9; }
.upload-refresh {
    min-height: 32px; padding: 4px 10px; border: 1px solid #ddd6fe; border-radius: 6px;
    color: #6d28d9; background: #f5f3ff; font-weight: 600; cursor: pointer;
}

/* Tiến độ tải tệp (editor) */
@keyframes upload-spin-kf { to { transform: rotate(360deg); } }
.upload-spin { display: inline-block; animation: upload-spin-kf 0.9s linear infinite; }
@media (prefers-reduced-motion: reduce) { .upload-spin { animation: none; } }

label.is-uploading {
    position: relative;
    pointer-events: none;
    cursor: progress;
    opacity: 0.85;
}
.upload-status { display: inline-flex; align-items: center; gap: 6px; color: #6d28d9; font-weight: 600; }
.upload-mini-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.8);
    color: #6d28d9;
    font-size: 11px;
    font-weight: 700;
    border-radius: inherit;
}

.upload-indicator {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translate(-50%, 12px);
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: #fff;
    color: #5b21b6;
    border: 1px solid #ddd6fe;
    border-radius: 9999px;
    box-shadow: 0 6px 20px rgba(109, 40, 217, 0.18);
    font-size: 12px;
    font-weight: 600;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.upload-indicator.is-visible { opacity: 1; transform: translate(-50%, 0); }
.upload-indicator-bar { width: 90px; height: 6px; background: #ede9fe; border-radius: 9999px; overflow: hidden; }
.upload-indicator-fill { display: block; height: 100%; width: 0; background: #7c3aed; border-radius: 9999px; transition: width 0.15s linear; }
.upload-indicator.is-indeterminate .upload-indicator-fill { width: 40% !important; animation: upload-slide-kf 1.1s ease-in-out infinite; }
@keyframes upload-slide-kf { 0% { transform: translateX(-100%); } 100% { transform: translateX(250%); } }
@media (prefers-reduced-motion: reduce) { .upload-indicator.is-indeterminate .upload-indicator-fill { animation: none; } }

/* --- inspector: lưới chọn kiểu --- */
.hero-pick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.hero-pick {
    min-height: 88px; min-width: 44px; padding: 8px; border-radius: 10px; border: 2px solid #e2e8f0;
    background: #fff; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 6px;
    transition: border-color .15s, background .15s;
}
.hero-pick:hover { background: #f8fafc; }
.hero-pick.is-on { border-color: #7c3aed; background: #f5f3ff; }
.hero-pick-name { font-size: 12px; font-weight: 600; color: #334155; }
.hero-dia { position: relative; display: block; width: 40px; height: 52px; border-radius: 4px; background: #f1ece3; overflow: hidden; }
.hero-dia i { position: absolute; left: 0; right: 0; display: block; background: #b8a58c; }
.hero-dia b { position: absolute; left: 8px; right: 8px; display: block; height: 3px; border-radius: 2px; background: #5c4938; }
.hero-dia-classic i { top: 0; bottom: 0; background: linear-gradient(to top, #4b3b2e, #b8a58c); }
.hero-dia-classic b { bottom: 8px; background: #fff; }
.hero-dia-fade i { top: 0; height: 34px; background: linear-gradient(to bottom, #b8a58c 55%, transparent); }
.hero-dia-fade b { bottom: 8px; }
.hero-dia-arch { background: #1f3d2b; }
.hero-dia-arch i { top: 20px; bottom: 0; left: 4px; right: 4px; border-radius: 50% 50% 0 0 / 30% 30% 0 0; background: #b8a58c; }
.hero-dia-arch b { top: 8px; background: #efe3c4; }
.hero-dia-fullscreen i { top: 0; bottom: 0; background: linear-gradient(to top, #2a2a2a, #8a7a68); }
.hero-dia-fullscreen b { top: 24px; background: #fff; }
