* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    min-height: 100dvh; /* Dynamic viewport height for mobile */
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    overflow-y: auto;
    position: relative;
    -webkit-overflow-scrolling: touch;
}

body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 50%, rgba(255, 215, 0, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(255, 215, 0, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

.container {
    position: relative;
    width: 100%;
    max-width: 500px;
    padding: 20px;
    z-index: 1;
}

.envelope-wrapper {
    perspective: 1000px;
    margin-bottom: 30px;
}

.envelope {
    position: relative;
    width: 350px;
    height: 240px;
    margin: 0 auto;
    cursor: pointer;
    transform-style: preserve-3d;
    transition: transform 0.6s ease;
}

.envelope.opening {
    transform: rotateY(180deg);
}

.envelope-front,
.envelope-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.envelope-front {
    background: linear-gradient(135deg, #d32f2f 0%, #b71c1c 100%);
    transform: rotateY(0deg);
}

.envelope-back {
    background: linear-gradient(135deg, #f57c00 0%, #e65100 100%);
    transform: rotateY(180deg);
}

.envelope-top {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 50%;
    background: linear-gradient(135deg, #f44336 0%, #c62828 100%);
    border-radius: 10px 10px 0 0;
    transform-origin: top;
    transition: transform 0.6s ease;
    z-index: 2;
}

.envelope.opening .envelope-top {
    transform: rotateX(-180deg);
}

.envelope-body {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 50%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    color: #ffd700;
    text-align: center;
}

.chinese-text {
    font-size: 42px;
    font-weight: bold;
    margin-bottom: 12px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.vietnamese-text {
    font-size: 22px;
    font-weight: 600;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.result-wrapper {
    text-align: center;
    animation: fadeInUp 0.6s ease;
}

.result-content {
    background: white;
    border-radius: 20px;
    padding: 40px 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.result-icon {
    font-size: 80px;
    margin-bottom: 20px;
    animation: bounce 1s ease infinite;
}

.result-title {
    font-size: 32px;
    color: #333;
    margin-bottom: 25px;
}

.result-amount {
    font-size: 56px;
    font-weight: bold;
    color: #d32f2f;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.result-message {
    font-size: 18px;
    color: #666;
    margin-bottom: 35px;
}

.btn-share {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 18px 50px;
    font-size: 20px;
    border-radius: 50px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    font-weight: 600;
    min-height: 60px;
}

.btn-share:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.btn-share:active {
    transform: translateY(0);
}

.message-wrapper {
    text-align: center;
    animation: fadeInUp 0.6s ease;
}

.message-content {
    background: white;
    border-radius: 20px;
    padding: 40px 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.message-icon {
    font-size: 60px;
    margin-bottom: 20px;
}

.message-title {
    font-size: 24px;
    color: #333;
    margin-bottom: 15px;
}

.message-text {
    font-size: 16px;
    color: #666;
    line-height: 1.6;
}

.choices-wrapper {
    text-align: center;
    animation: fadeInUp 0.6s ease;
}

.choices-content {
    background: white;
    border-radius: 20px;
    padding: 30px 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.choices-title {
    font-size: 28px;
    color: #333;
    margin-bottom: 30px;
    font-weight: 700;
}

.choices-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.choice-card {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    border-radius: 20px;
    padding: 25px 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 4px solid transparent;
    position: relative;
    min-height: 150px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transform: translateY(30px) scale(0.8);
    animation: choiceAppear 0.6s ease forwards;
    touch-action: manipulation;
}

.choice-card:nth-child(1) {
    animation-delay: 0.1s;
}

.choice-card:nth-child(2) {
    animation-delay: 0.2s;
}

.choice-card:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes choiceAppear {
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.choice-card:hover {
    transform: translateY(-8px) scale(1.1) !important;
    box-shadow: 0 15px 35px rgba(255, 107, 107, 0.5) !important;
    border-color: #ff6b6b !important;
    border-width: 4px !important;
    background: linear-gradient(135deg, #ffed4e 0%, #ffd700 100%) !important;
    z-index: 10;
}

.choice-card:hover .choice-icon {
    transform: scale(1.2);
    transition: transform 0.3s ease;
}

.choice-card:hover .choice-question {
    transform: scale(1.3);
    transition: transform 0.3s ease;
}

.choice-card.selected {
    border-color: #d32f2f !important;
    border-width: 5px !important;
    background: linear-gradient(135deg, #ff6b6b 0%, #ff8e8e 100%) !important;
    transform: scale(1.2) !important;
    animation: cardSelected 0.6s ease !important;
    box-shadow: 0 20px 50px rgba(211, 47, 47, 0.7) !important;
    z-index: 100 !important;
}

@keyframes cardSelected {
    0% {
        transform: scale(1);
    }
    30% {
        transform: scale(1.3) rotate(-5deg);
    }
    60% {
        transform: scale(1.25) rotate(5deg);
    }
    100% {
        transform: scale(1.2) rotate(0deg);
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0);
    }
}

.choice-card .choice-icon {
    font-size: 50px;
    margin-bottom: 15px;
    transition: transform 0.3s ease;
}

.choice-card .choice-question {
    font-size: 60px;
    font-weight: bold;
    color: #333;
    line-height: 1;
    transition: transform 0.3s ease;
}

.choice-card .choice-amount {
    font-size: 18px;
    font-weight: bold;
    color: #333;
}

.choice-card.selected .choice-amount {
    color: white !important;
    font-size: 28px !important;
    font-weight: 900 !important;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3) !important;
    animation: amountReveal 0.8s ease forwards !important;
}

@keyframes amountReveal {
    0% {
        opacity: 0;
        transform: scale(0) rotate(-360deg);
    }
    50% {
        transform: scale(1.3) rotate(180deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

.instructions {
    text-align: center;
    color: white;
    font-size: 18px;
    margin-top: 25px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    opacity: 0.9;
    font-weight: 500;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-20px);
    }
}

/* Confetti animation */
.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #ffd700;
    position: absolute;
    animation: confetti-fall 3s linear infinite;
}

@keyframes confetti-fall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Responsive - Mobile */
@media (max-width: 768px) {
    .container {
        max-width: 100%;
        padding: 15px;
    }
    
    .envelope {
        width: 90%;
        max-width: 380px;
        height: 260px;
    }
    
    .chinese-text {
        font-size: 42px;
    }
    
    .vietnamese-text {
        font-size: 22px;
    }
    
    .result-content {
        padding: 35px 25px;
    }
    
    .result-icon {
        font-size: 70px;
    }
    
    .result-title {
        font-size: 28px;
    }
    
    .result-amount {
        font-size: 52px;
    }
    
    .result-message {
        font-size: 18px;
    }
    
    .btn-share {
        padding: 18px 45px;
        font-size: 20px;
        min-height: 60px;
        width: 100%;
        max-width: 350px;
    }
    
    .choices-content {
        padding: 30px 20px;
    }
    
    .choices-title {
        font-size: 26px;
        margin-bottom: 30px;
    }
    
    .choices-grid {
        gap: 15px;
    }
    
    .choice-card {
        padding: 25px 15px;
        min-height: 160px;
        border-width: 4px;
    }
    
    .choice-card .choice-icon {
        font-size: 50px;
        margin-bottom: 15px;
    }
    
    .choice-card .choice-question {
        font-size: 60px;
    }
    
    .choice-card.selected .choice-amount {
        font-size: 26px !important;
    }
    
    .instructions {
        font-size: 16px;
        margin-top: 20px;
    }
}

@media (max-width: 480px) {
    .envelope {
        width: 85%;
        max-width: 320px;
        height: 220px;
    }
    
    .chinese-text {
        font-size: 36px;
    }
    
    .vietnamese-text {
        font-size: 20px;
    }
    
    .result-amount {
        font-size: 44px;
    }
    
    .choices-grid {
        grid-template-columns: 1fr;
        gap: 18px;
    }
    
    .choice-card {
        min-height: 150px;
        padding: 22px 15px;
    }
    
    .choice-card .choice-icon {
        font-size: 45px;
    }
    
    .choice-card .choice-question {
        font-size: 55px;
    }
    
    .choice-card.selected .choice-amount {
        font-size: 24px !important;
    }
}

