:root {
    --bg-color: #000;
    --box-color: #d32f2f;
    --ribbon-color: #ffd700;
    --voucher-bg: #fff;
    --text-color: #333;
    --link-color: #007bff;
    --ps-blue: #00439c;
    /* Standard PS Blue */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

body {
    height: 100vh;
    width: 100vw;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    overflow: hidden;
    color: var(--text-color);
    transition: background-color 1s ease;
}

body.white-bg {
    background-color: #121212;
    /* Dark reveal background */
}

/* --- 3D Scene (Gift Box) --- */
.scene {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 200px;
    perspective: 1000px;
    z-index: 10;
    transition: opacity 0.5s;
}

.scene.hidden {
    opacity: 0;
    pointer-events: none;
}

.gift-box-container {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    cursor: pointer;
    transition: transform 1s ease;
    will-change: transform;
    /* Hardware acceleration hint */
}

.gift-box-container:hover .gift-box {
    transform: rotateX(-20deg) rotateY(45deg) scale(1.05);
}

.gift-box {
    width: 200px;
    height: 200px;
    position: absolute;
    transform-style: preserve-3d;
    transform: rotateX(-20deg) rotateY(45deg);
    transition: transform 0.5s ease-in-out;
    will-change: transform;
    /* Hardware acceleration hint */
}

/* Explosive Open Animation */
.gift-box-container.explode .gift-box {
    animation: explodeBox 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
    /* Smooth cubic-bezier */
}

@keyframes explodeBox {
    0% {
        transform: rotateX(-20deg) rotateY(45deg) scale(1);
    }

    30% {
        transform: rotateX(-10deg) rotateY(20deg) scale(0.9);
    }

    /* Anticipation */
    100% {
        transform: rotateX(0deg) rotateY(0deg) scale(15);
        opacity: 0;
    }

    /* Explosion, reduced max scale */
}

.face {
    position: absolute;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, #e53935 0%, #b71c1c 100%);
    border: 1px solid #9a0007;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.3);
}

/* Positioning Faces */
.front {
    transform: translateZ(100px);
}

.back {
    transform: rotateY(180deg) translateZ(100px);
}

.right {
    transform: rotateY(90deg) translateZ(100px);
}

.left {
    transform: rotateY(-90deg) translateZ(100px);
}

.top {
    transform: rotateX(90deg) translateZ(100px);
    background: radial-gradient(circle, #ff6f60 0%, #d32f2f 100%);
    transform-origin: top;
    border: 1px solid #c62828;
}

.bottom {
    transform: rotateX(-90deg) translateZ(100px);
    background: #8e0000;
}

/* Ribbons */
.ribbon-vertical {
    width: 40px;
    height: 100%;
    background: linear-gradient(90deg, #ffd700 0%, #ffecb3 50%, #ffd700 100%);
    position: absolute;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
}

.ribbon-horizontal {
    width: 100%;
    height: 40px;
    background: linear-gradient(0deg, #ffd700 0%, #ffecb3 50%, #ffd700 100%);
    position: absolute;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
}

/* Bow */
.bow {
    position: absolute;
    width: 100%;
    height: 100%;
    transform: translateZ(2px);
    display: flex;
    justify-content: center;
    align-items: center;
}

.bow-left,
.bow-right {
    position: absolute;
    width: 60px;
    height: 60px;
    border: 10px solid #ffd700;
    border-radius: 50% 50% 0 50%;
    transform: rotate(45deg);
    top: 50px;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.3);
    background: radial-gradient(circle at 30% 30%, #fffbe0, #ffd700);
}

.bow-left {
    left: 30px;
    transform: rotate(45deg);
}

.bow-right {
    right: 30px;
    transform: rotate(135deg);
    border-radius: 50% 50% 50% 0;
}

.bow-center {
    position: absolute;
    width: 30px;
    height: 30px;
    background: radial-gradient(circle at 30% 30%, #fffbe0, #ffd700);
    border-radius: 50%;
    z-index: 2;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
}

.instruction-text {
    position: absolute;
    bottom: -80px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-family: 'Poppins', sans-serif;
    font-size: 1.2rem;
    white-space: nowrap;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* --- Voucher Screen --- */
.voucher-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #121212;
    /* Dark Background */
    display: flex;
    flex-direction: column;
    justify-content: center;
    /* Vertical Center */
    align-items: center;
    /* Horizontal Center */
    z-index: 20;
    /* Above scene */
    color: #fff;
    /* Default text white */

    /* Reveal Animation Init State */
    clip-path: circle(0% at 100% 100%);
    /* Start hidden at bottom right */
    transition: clip-path 1.5s cubic-bezier(0.645, 0.045, 0.355, 1);
    /* Smooth wipe */
    will-change: clip-path;
    opacity: 1;
}

.voucher-container.visible {
    clip-path: circle(150% at 100% 100%);
    /* Expand to full screen */
}

/* Ensure no display:none overrides transition */
.voucher-container.hidden {
    /* We don't use display:none anymore, rely on clip-path */
    pointer-events: none;
}

/* Voucher Content */
.voucher-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    max-width: 500px;
    margin: 0 auto;
    width: 100%;
}

.logo-section {
    margin-bottom: 30px;
    margin-top: 10px;
}

.ps-logo-box {
    background: linear-gradient(135deg, #0070d1 0%, #00439c 100%);
    width: 280px;
    height: 160px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #fff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    /* Stronger shadow for pop */
}

.ps-logo-box i {
    font-size: 4rem;
    margin-bottom: 10px;
}

.ps-logo-box .ps-text {
    font-family: sans-serif;
    font-weight: bold;
    font-size: 1.2rem;
    letter-spacing: 0.5px;
}

.code-section {
    width: 100%;
    margin-bottom: 20px;
}

.label {
    font-size: 0.8rem;
    color: #aaa;
    /* Lighter grey for dark mode labels */
    margin-bottom: 5px;
    font-weight: 500;
}

.value {
    font-size: 1.3rem;
    color: #fff;
    /* White text for values */
    margin-bottom: 20px;
    font-weight: 400;
    letter-spacing: 0.5px;
}

.value.pin-code {
    font-size: 1.5rem;
    font-weight: 500;
    font-family: monospace;
}

.link-btn {
    background: none;
    border: none;
    color: #4da3ff;
    /* Lighter blue for dark mode */
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
}

.separator {
    width: 100%;
    border: none;
    border-top: 1px solid #333;
    /* Darker separator */
    margin: 10px 0 20px 0;
}

.details-section {
    width: 100%;
    text-align: left;
}

.detail-row {
    margin-bottom: 20px;
}

.detail-row .value {
    margin-bottom: 0;
}

.detail-block {
    margin-bottom: 20px;
}

.detail-block .value {
    font-size: 1.1rem;
    margin-bottom: 2px;
}

.detail-block .date {
    font-size: 0.95rem;
    color: #888;
    /* Dimmed date */
}

.info-link {
    color: #007aff;
    text-decoration: none;
    font-size: 0.9rem;
    display: block;
    margin-top: 20px;
}

.feedback-banner {
    width: 100%;
    background: #1c1c1e;
    color: #fff;
    padding: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 30px;
    cursor: pointer;
}

.feedback-text {
    text-align: center;
    font-size: 0.95rem;
    line-height: 1.3;
}

#confettiCanvas {
    position: fixed;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 100;
}