html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background-color: var(--primary-2);
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    font-family: sans-serif;
}

#viewport {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: 450px;
    max-height: 900px;
    background: var(--primary-2);
    overflow: hidden;
    box-shadow: 0 20px 50px var(--shadow);
    container-type: size;
}

.sections,
.section,
.box,
.repair-layout,
.flow-step,
.location-layout,
.cube {
    width: 100%;
    height: 100%;
}

/* ==========================================================================
   1. GLOBAL ENGINE & BASE LAYOUT
   ========================================================================== */

.box {
    position: relative;
    background: var(--primary-2);
    z-index: 50;
}

.sections {
    position: relative;
    background: var(--primary-2);
}

/* ==========================================================================
   2. GLOBAL COMPONENTS (TOPBAR)
   ========================================================================== */

.topbar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: var(--pd-5);
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 9999;
    box-sizing: border-box;
}

.topbar button {
    height: 50px;
    font-weight: var(--fw-extra);
}

#whatsapp-btn {
    color: var(--text-white);
    background: radial-gradient(circle, var(--green-color-1) 0%, var(--green-color-2) 50%);
    animation: pulse 2s infinite;
}

/* ==========================================================================
   3. SCENES CORE SYSTEM
   ========================================================================== */
.section {
    --section-opacity: 0;
    --section-pointer-events: none;
    /* --transition é setado via JS em CK.activatePage() a partir do SCENE_MAP.
       O valor fixo abaixo é só um fallback de segurança caso o JS falhe. */
    --transition: .8s;
    --delay: 0s;
    position: absolute;
    inset: 0;
    opacity: var(--section-opacity);
    pointer-events: var(--section-pointer-events);
    transition: all var(--transition) ease-in-out;
}

.section * {
    transition: all var(--transition) ease-in-out;
}

.section.is-active {
    --section-opacity: 1;
    --section-pointer-events: all;
}

/* Page Base Colors / Backgrounds */
#page-1 {}

#page-2 {
    background: radial-gradient(circle,
            var(--primary-3) 0%,
            var(--primary-1) 50%,
            var(--primary-2) 90%);
}

#page-3 {
    background: radial-gradient(circle at bottom left,
            var(--primary-shadow-1) 0%,
            var(--primary-1) 50%,
            var(--primary-2) 90%);
}

#page-4 {
    background: radial-gradient(circle at top center,
            var(--accent-1) 0%,
            var(--accent-2) 90%);
    overflow: hidden;
    perspective: 1000px;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: var(--pd-1);
    box-sizing: border-box;
}

/* ==========================================================================
   4. SCENE STATE CLASSES (controladas via JS)
   ========================================================================== */
#page-1 .box.is-shrunk {
    scale: .5;
}

#page-1 .box .is-frozen {
    animation: none !important;
}

#page-2 .phone.is-visible {
    --opacity: 1;
    transform: translateX(var(--phone-x)) translateY(var(--phone-y)) rotate(var(--phone-r));
}

#page-2 .cta-content.is-visible {
    --opacity: 1;
}

#page-3 .repair-image img.is-visible {
    --opacity: 1;
}

#page-3 .repair-content.is-visible {
    --opacity: 1;
}

/* Transições horizontais adaptadas para usar 100% da largura do container de trabalho */
#page-4 .laser-flow.is-shifted-1 {
    transform: translateX(-100%);
}

#page-4 .laser-flow.is-shifted-2 {
    transform: translateX(-200%);
}

#page-4 .laser-flow.is-shifted-3 {
    transform: translateX(-300%);
}

#page-4 .laser-flow .flow-step.final-step .cta-group.is-visible {
    --opacity: 1;
}

#page-4 .cube.is-spinning {
    transform: rotateX(90deg);
}

/* ==========================================================================
   5. PAGE 1 - HERO INTERNAL COMPONENTS
   ========================================================================== */
#page-1 {
    transform-origin: center 60%;
    overflow: hidden;
}

#page-1 .logo {
    position: absolute;
    top: 18%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
}

#page-1 .subtitle {
    position: absolute;
    width: 100%;
    top: calc(18% + 55px);
    text-align: center;
}

#backpage-1 {
    position: absolute;
    bottom: 5%;
    text-align: center;
    color: var(--text-white);
    left: 0;
    width: 100%;
    pointer-events: none;
}

/* Avatar */
#avatar_1 {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    display: flex;
    background: radial-gradient(circle at center right,
            var(--shadow-white),
            transparent 90%);
    z-index: 2;
    perspective: 1000px;
}

#avatar_1::before {
    content: "";
    position: absolute;
    inset: 0;
    background: url(../../assets/images/landingPage/avatar_1.png);
    background-size: 60cqh;
    background-repeat: no-repeat;
    background-position: bottom;
    filter: drop-shadow(-5px 0px 10px var(--orange-color-s));
    z-index: 9999;
    animation: breathe 4s ease-in-out infinite;
}

/* Drag Hint */
.drag-hint {
    position: absolute;
    height: 200px;
    right: 5%;
    bottom: 4%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    opacity: .7;
    pointer-events: none;
    z-index: 100;
    color: var(--shadow-white);
    text-align: center;
    animation: dragLoop 2s infinite;
}

.drag-finger {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--shadow-white);
    backdrop-filter: blur(20px);
    display: flex;
    justify-content: center;
    align-items: center;
    animation: dragLoop 2s infinite;
}

/* Orbit System (Unidades convertidas para cqw para manter proporção perfeita) */
.orbit-wrapper {
    position: absolute;
    --orbit-s: 60cqw;
    width: calc(var(--orbit-s) + 20px);
    aspect-ratio: 1;
    bottom: 48%;
    left: calc(50% - var(--orbit-s) / 2);
    border-radius: 50%;
    transform-style: preserve-3d;
    perspective: 1000px;
    transform: rotateX(97deg) rotateY(-7deg) rotateZ(0deg);
    animation: orbit 10s linear infinite;
}

.orbit {
    position: relative;
    width: var(--orbit-s);
    aspect-ratio: 1;
    border-radius: 50%;
    transform-style: preserve-3d;
    backface-visibility: visible;
    -webkit-backface-visibility: visible;
    -moz-backface-visibility: visible;
}

.orbit-item {
    position: absolute;
    width: calc(var(--orbit-s) / 4);
    aspect-ratio: 9/16;
    top: 50%;
    left: 50%;
    translate: -50% -50%;
    transform-style: preserve-3d;
    backface-visibility: visible;
    -webkit-backface-visibility: visible;
    -moz-backface-visibility: visible;
    filter: drop-shadow(0 0 10px var(--orange-color-s));
    animation: reverse-orbit 10s linear infinite;
}

.o-item-1 {
    background: url(../../assets/images/landingPage/cell_rear_realme_note_70.png) no-repeat center/contain;
    translate: calc(-50% + (var(--orbit-s) / 2)) -50%;
    rotate: x -90deg;
}

.o-item-2 {
    background: url(../../assets/images/landingPage/cell_rear_redmi_15c.png) no-repeat center/contain;
    translate: calc(-50% + (var(--orbit-s) / -2)) -50%;
    rotate: x -90deg;
}

.o-item-3 {
    background: url(../../assets/images/landingPage/cell_rear_samsung_a17.png) no-repeat center/contain;
    translate: -50% calc(-50% + (var(--orbit-s) / 2));
    rotate: x -90deg;
}

.o-item-4 {
    background: url(../../assets/images/landingPage/cell_rear_poco_x8_pro.png) no-repeat center/contain;
    translate: -50% calc(-50% + (var(--orbit-s) / -2));
    rotate: x -90deg;
}

.o-item-5 {
    background: url(../../assets/images/landingPage/pacco_blue.png) no-repeat center/contain;
    translate: calc(-50% + (var(--orbit-s) / 2 * 0.7071)) calc(-50% + (var(--orbit-s) / -2 * 0.7071));
    rotate: x -90deg;
}

.o-item-6 {
    background: url(../../assets/images/landingPage/baseus.png) no-repeat center/contain;
    translate: calc(-50% + (var(--orbit-s) / 2 * 0.7071)) calc(-50% + (var(--orbit-s) / 2 * 0.7071));
    rotate: x -90deg;
}

.o-item-7 {
    background: url(../../assets/images/landingPage/kaidi.png) no-repeat center/contain;
    translate: calc(-50% + (var(--orbit-s) / -2 * 0.7071)) calc(-50% + (var(--orbit-s) / 2 * 0.7071));
    rotate: x -90deg;
}

.o-item-8 {
    background: url(../../assets/images/landingPage/pacco_black.png) no-repeat center/contain;
    translate: calc(-50% + (var(--orbit-s) / -2 * 0.7071)) calc(-50% + (var(--orbit-s) / -2 * 0.7071));
    rotate: x -90deg;
}

/* ==========================================================================
   6. PAGE 2 - PHONES & CTA INTERNAL COMPONENTS
   ========================================================================== */
.phones-stage {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -60%);
    width: 100%;
    aspect-ratio: 1;
    pointer-events: none;
}

.phone {
    position: absolute;
    width: calc(100% / 3);
    aspect-ratio: 9/16;
    right: 0;
    transform: translate(-50%, -100%);
    transition: all var(--transition, .8s) var(--delay, 0s) ease;
    opacity: var(--opacity);
    filter: drop-shadow(-5px 0px 10px var(--orange-color-s));
}

.phone-1 {
    z-index: 0;
}

.phone-1::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    aspect-ratio: 9/16;
    background: url(../../assets/images/landingPage/cell_rear_realme_note_70.png) no-repeat bottom/contain;
}

.phone-2 {
    z-index: 1;
}

.phone-2::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    aspect-ratio: 9/16;
    background: url(../../assets/images/landingPage/cell_rear_redmi_15c.png) no-repeat bottom/contain;
}

.phone-3 {
    z-index: 2;
}

.phone-3::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    aspect-ratio: 9/16;
    background: url(../../assets/images/landingPage/cell_rear_samsung_a17.png) no-repeat bottom/contain;
}

/* CTA Elements */
.cta-content {
    --opacity: 0;
    position: absolute;
    display: flex;
    justify-content: space-between;
    flex-direction: column;
    left: 50%;
    bottom: 10%;
    height: min(295px, 44cqh);
    width: min(700px, 90%);
    transform: translateX(-50%);
    transition: all var(--transition, .8s) var(--delay, 0s) ease;
    text-align: center;
    color: var(--text-white);
    opacity: var(--opacity);
}

.cta-content h2 {
    font-size: clamp(1.5rem, 5cqw, 3rem);
    font-weight: var(--fw-extra);
    line-height: 1.1;
    margin-bottom: 24px;
}

.cta-btn {
    min-width: 260px;
    max-width: 90%;
    height: 60px !important;
    align-self: center;
    box-shadow: 0px 0px 10px var(--orange-color-s);
    animation: pulse_cta 2s ease infinite;
}

/* ==========================================================================
   7. PAGE 3 - REPAIR INTERNAL COMPONENTS (inclui Floating Cards)
   ========================================================================== */
.repair-layout {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    box-sizing: border-box;
}

.repair-image {
    position: relative;
    display: flex;
    align-self: start;
    align-items: end;
    justify-content: end;
    width: 70%;
    aspect-ratio: 5/7;
    flex-shrink: 0;
    will-change: transform, opacity;
}

.repair-image img {
    --opacity: 0;
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: auto;
    object-fit: cover;
    border-radius: 0 40px 40px 0;
    opacity: var(--opacity);
    transition: all var(--transition, .8s) var(--delay, 0s) ease;
}

/* Floating Cards */
.floating-card {
    --opacity: 0;
    position: absolute;
    padding: 18px 24px;
    border-radius: 20px;
    right: -30%;
    backdrop-filter: blur(20px);
    background: var(--primary-shadow-2);
    border: 2px solid var(--primary-1);
    color: var(--text-white);
    font-weight: 700;
    opacity: var(--opacity);
    transition: all var(--transition, .8s) var(--delay, 0s) ease;
    animation: floatCard 3s ease-in-out infinite;
}

.floating-card.is-visible {
    --opacity: 1;
}

.card-1 {
    top: 5%;
}

.card-2 {
    top: 40%;
    animation-delay: .5s;
}

.card-3 {
    top: 75%;
    animation-delay: 1s;
}

.repair-content {
    --opacity: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    opacity: var(--opacity);
    padding: 0 8%;
    color: var(--text-white);
    text-align: center;
    transition: all var(--transition, .8s) var(--delay, 0s) ease;
    box-sizing: border-box;
}

.repair-content h2 {
    font-size: clamp(28px, 8cqw, 50px);
    line-height: 1.1;
    margin-bottom: 20px;
}

.repair-content p {
    font-size: 18px;
    opacity: .8;
}

.repair-tag {
    display: inline-block;
    margin-bottom: 20px;
    padding: 10px 20px;
    border-radius: 999px;
    background: var(--primary-2);
}

/* ==========================================================================
   8. PAGE 4 - LASER FLOW & LOCATION SYSTEM
   ========================================================================== */
.laser-bg {
    background: #ff4d4d;
}

.bottle-bg {
    background: #ffb84d;
}

.customer-bg {
    background: #4db8ff;
}

.final-bg {
    background: #7a5cff;
}

.laser-flow {
    display: flex;
    flex-direction: row;
    height: 100%;
    gap: 0;
    align-items: center;
    transition: all var(--transition, .8s) var(--delay, 0s) ease;
    width: max-content;
}

.flow-step {
    position: relative;
    width: 100cqw;
    flex-shrink: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 10%;
    box-sizing: border-box;
}

#page-4 .laser-flow.is-shifted-1 {
    transform: translateX(-100cqw);
}

#page-4 .laser-flow.is-shifted-2 {
    transform: translateX(-200cqw);
}

#page-4 .laser-flow.is-shifted-3 {
    transform: translateX(-300cqw);
}

.flow-step.final-step .cta-group {
    --opacity: 0;
    opacity: var(--opacity);
    transition: all var(--transition, .8s) var(--delay, 0s) ease;
}

.flow-image {
    width: 70cqw;
    aspect-ratio: 1;
    will-change: transform, opacity;
    transition: transform 0.8s ease;
}

.flow-content {
    width: 70cqw;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: start;
    gap: 15px;
    color: var(--primary-2);
    will-change: transform, opacity;
    transition: transform 0.8s ease;
}

.flow-content h2 {
    color: var(--primary-1);
}

.flow-arrow {
    color: var(--primary-1);
    font-size: 45px;
    will-change: transform, opacity;
    transition: transform 0.8s ease;
    animation: arrow 1s ease-in-out infinite;
}

/* Location Layout */
.location-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    padding-top: 60px;
    box-sizing: border-box;
}

.location-top,
.location-bottom {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
    gap: 24px;
}

.location-main {
    display: flex;
    flex-direction: column;
    text-align: center;
    gap: 30px;
}

.location-main h2,
.location-main p {
    color: var(--primary-1);
}

.location-actions {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

.store-map,
.store-video {
    width: 70%;
    aspect-ratio: 16/9;
    right: auto;
    top: auto;
    border-radius: 30px;
    overflow: hidden;
    background: red;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .2);
}

/* 3D Cube System */
.cube {
    position: relative;
    top: 0;
    left: 0;
    padding: 0;
    transform-style: preserve-3d;
    transition: all var(--transition, .8s) var(--delay, 0s) ease;
}

.cube-face {
    position: absolute;
    height: 100%;
    width: 100%;
    display: flex;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    -moz-backface-visibility: hidden;
    overflow: hidden;
}

.cube-face .flow-step,
.cube-face .location-layout {
    transform: scale(.55);
}

.face-front {
    transform: rotateX(0deg) translateZ(50cqh);
    background: radial-gradient(circle at top center,
            var(--text-muted) 0%,
            var(--sidebar-bg) 90%);
}

.face-bottom {
    background: radial-gradient(circle at top,
            var(--primary-1),
            var(--primary-2) 30%);
    transform: rotateX(-90deg) translateZ(50cqh);
}

.face-bottom::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: rotateZ(45deg);
    background: radial-gradient(circle at top,
            var(--accent-1),
            var(--accent-2));
    z-index: -1;
}

/* ==========================================================================
   9. GLOBAL KEYFRAMES ANIMATIONS
   ========================================================================== */

@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 20px var(--green-color-s);
    }

    50% {
        transform: scale(1.025);
        box-shadow: 0 0 50px var(--green-color-1);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 20px var(--green-color-s);
    }
}

@keyframes breathe {

    0%,
    100% {
        transform: translateY(0px) scale(1);
    }

    50% {
        transform: translateY(-4px) scale(1.015);
    }
}

@keyframes dragLoop {
    0% {
        transform: translateY(0);
        opacity: 1;
    }

    40% {
        transform: translateY(-3cqh);
        opacity: .75;
    }

    60% {
        opacity: 0;
    }

    61% {
        transform: translateY(1cqh);
        opacity: 0;
    }

    100% {
        opacity: 1;
    }
}

@keyframes orbit {
    0% {
        transform: rotateX(98deg) rotateY(-9deg) rotateZ(0deg);
    }

    100% {
        transform: rotateX(98deg) rotateY(-9deg) rotateZ(360deg);
    }
}

@keyframes reverse-orbit {
    0% {
        transform: rotateY(0deg);
    }

    100% {
        transform: rotateY(360deg);
    }
}

@keyframes pulse_cta {

    0%,
    100% {
        box-shadow: 0 0 10px var(--orange-color-s);
    }

    50% {
        box-shadow: 0 0 30px var(--orange-color-s);
    }
}

@keyframes floatCard {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-12px);
    }
}

@keyframes arrow {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateX(12px);
    }
}
