html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100%;
  background-color: #000;
}

.flake {
  z-index: 0;
  overflow: hidden;
  position: absolute;
  pointer-events: none;
}

.flake {
  width: 70px;
  height: auto;
  z-index: 2;
}

/* Animation for falling flakes */
.flake:nth-child(1) { 
  animation: float1 5s linear infinite;
  left: 10%;
}
.flake:nth-child(2) { 
  animation: float2 7s linear infinite;
  left: 25%;
}
.flake:nth-child(3) { 
  animation: float3 6s linear infinite;
  left: 40%;
}
.flake:nth-child(4) { 
  animation: float4 8s linear infinite;
  left: 15%;
}
.flake:nth-child(5) { 
  animation: float5 9s linear infinite;
  left: 70%;
}
.flake:nth-child(6) { 
  animation: float6 7s linear infinite;
  left: 85%;
}
.flake:nth-child(7) { 
  animation: float7 6s linear infinite;
  left: 15%;
}
.flake:nth-child(8) { 
  animation: float8 8s linear infinite;
  left: 60%;
}

@keyframes float1 {
  0% { top: -100px; transform: rotate(0deg); }
  100% { top: 100vh; transform: rotate(360deg); }
}
@keyframes float2 {
  0% { top: -100px; transform: rotate(0deg); }
  100% { top: 100vh; transform: rotate(-360deg); }
}
@keyframes float3 {
  0% { top: -100px; transform: rotate(0deg) scale(0.8); }
  100% { top: 100vh; transform: rotate(360deg) scale(0.8); }
}
@keyframes float4 {
  0% { top: -100px; transform: rotate(0deg) scale(1.2); }
  100% { top: 100vh; transform: rotate(-360deg) scale(1.2); }
}
@keyframes float5 {
  0% { top: -100px; transform: rotate(0deg); }
  100% { top: 100vh; transform: rotate(360deg); }
}
@keyframes float6 {
  0% { top: -100px; transform: rotate(0deg) scale(0.9); }
  100% { top: 100vh; transform: rotate(-360deg) scale(0.9); }
}
@keyframes float7 {
  0% { top: -100px; transform: rotate(0deg) scale(1.1); }
  100% { top: 100vh; transform: rotate(360deg) scale(1.1); }
}
@keyframes float8 {
  0% { top: -100px; transform: rotate(0deg); }
  100% { top: 100vh; transform: rotate(-360deg); }
}

.lucky-draw-container {
    max-width: 550px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
}

.lucky-draw-container-wrapper {
    background-image: url('../images/background.gif'); 
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center;
    padding-top: 40px;
    padding-bottom: 40px;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;  
}

.lucky-draw-container-wrapper::before {
    content: "";
    background-image: url('../images/new_project_2.png');
    background-repeat: no-repeat;
    background-size: contain;
    background-position: top center;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    animation: floatStar 3s ease-in-out infinite;
}

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

.prize-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    position: relative;
    z-index: 99;
    background-image: url('../images/khung_trong.png');
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
    padding: 40px;
}

.spin-button {
    animation: updown 3s linear infinite;
    grid-column: 2 / span 2;
    grid-row: 2 / span 2;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 90%;
    text-align: center;
    margin: 0 auto;
}

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

.spin-button img {
    width: 100%;
    height: auto;
}

.spin-button:hover {
    transform: scale(1.08);
}

/* Glassmorphism Card Style for Prize Items */
.prize-item {
    aspect-ratio: 1;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.prize-item::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(255,255,255,0.15) 0%, rgba(255,255,255,0) 100%);
    pointer-events: none;
    z-index: 1;
}

.prize-item img {
    max-width: 80%;
    max-height: 80%;
    object-fit: contain;
    z-index: 2;
    transition: transform 0.3s;
}

.prize-item:hover img {
    transform: scale(1.1);
}

.prize-item.active {
    opacity: 1;
    transform: scale(1.08);
    z-index: 10;
    background: rgba(255, 202, 0, 0.25);
    border-color: #ffca00;
    box-shadow: 0 0 15px #ffca00, 0 0 30px rgba(255, 202, 0, 0.5), inset 0 0 10px rgba(255,255,255,0.4);
}

.prize-item.dimmed {
    opacity: 0.4;
    transform: scale(0.96);
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal-content {
    position: relative;
    background-color: #fff;
    margin: 10% auto;
    padding: 25px;
    width: 90%;
    max-width: 420px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.close-modal {
    position: absolute;
    right: 15px;
    top: 10px;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    transition: color 0.2s;
}

.close-modal:hover {
    color: #333;
}

.code-input-section, .search-history-section {
    text-align: center;
    margin: 20px 0 10px;
}

.input-field {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 8px;
    margin-bottom: 15px;
    text-align: center;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.input-field:focus {
    border-color: #ff4444;
    outline: none;
}

.button-primary {
    background: linear-gradient(to right, #ff4444, #d91b1b);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    box-shadow: 0 4px 10px rgba(255, 68, 68, 0.3);
    transition: all 0.2s;
}

.button-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(255, 68, 68, 0.4);
}

.error-message {
    color: #ff4444;
    margin-top: 10px;
    font-size: 14px;
    display: none;
}

/* User winning notifications & details */
.lucky-draw-modal {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.lucky-draw-modal.active {
    display: flex;
}

.winning-popup .modal-content {
    background: #fff;
    padding: 30px;
    text-align: center;
    border-radius: 15px;
    max-width: 400px;
}

.winning-popup .prize-image {
    width: 130px;
    height: 130px;
    object-fit: contain;
    margin: 0 auto 20px;
    display: block;
}

.winning-popup h2 {
    color: #d91b1b;
    font-size: 22px;
    margin: 10px 0;
}

.congratulations-text {
    font-size: 16px;
    color: #666;
    margin-bottom: 20px;
    line-height: 1.5;
}

.winning-popup .button-group {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.winning-popup button {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 15px;
    cursor: pointer;
    border: none;
    font-weight: bold;
    transition: all 0.2s;
}

.winning-popup .go-check-btn {
    background-color: #f0f0f0;
    color: #333;
}

.winning-popup .go-check-btn:hover {
    background-color: #e0e0e0;
}

.winning-popup .draw-again-btn {
    background-color: #ff4444;
    color: white;
    box-shadow: 0 4px 10px rgba(255, 68, 68, 0.3);
}

.winning-popup .draw-again-btn:hover {
    background-color: #d91b1b;
}

/* Prize Details Popup */
.prize-details-popup .modal-content {
    max-width: 450px;
    padding: 0;
    overflow: hidden;
}

.prize-details-popup h2 {
    margin: 0;
    padding: 15px;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
    font-size: 18px;
    color: #333;
    text-align: center;
}

.prize-info {
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.prize-header img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    margin-bottom: 15px;
}

.prize-value {
    color: #d91b1b;
    font-size: 22px;
    font-weight: bold;
    text-align: center;
}

.redemption-section {
    background: #fff5f5;
    padding: 20px;
    border-top: 1px solid #ffe3e3;
}

.redemption-section h3 {
    color: #d91b1b;
    font-size: 16px;
    margin: 0 0 15px;
    text-align: center;
}

.redemption-row {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 15px;
}

.redemption-row .label {
    font-weight: bold;
    color: #666;
    font-size: 14px;
}

.code-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff;
    border: 1px solid #ffd1d1;
    padding: 10px;
    border-radius: 6px;
}

.code {
    font-family: monospace;
    font-size: 16px;
    font-weight: bold;
    color: #333;
}

.copy-btn {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 5px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
}

.copy-btn:hover {
    background: #45a049;
}

.method {
    color: #555;
    font-size: 14px;
    line-height: 1.4;
}

.btn-draw-again {
    width: 100%;
    padding: 10px;
    background: #ff4444;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 10px;
}

.btn-draw-again:hover {
    background: #d91b1b;
}

/* Bottom Actions */
.lucky-draw-bottom-btn {
    text-align: center;
    margin-top: 30px;
    display: flex;
    justify-content: center;
    z-index: 99;
}

.lucky-draw-bottom-btn img {
    width: 140px;
    height: auto;
    cursor: pointer;
    transition: transform 0.2s;
}

.lucky-draw-bottom-btn img:hover {
    transform: scale(1.05);
}

/* Search History Modal Details */
.prize-result {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #eee;
    margin-top: 15px;
    text-align: center;
}

.prize-result img {
    max-width: 100px;
    height: auto;
    margin-bottom: 10px;
}

.prize-result h3 {
    color: #d91b1b;
    font-size: 18px;
    margin: 5px 0;
}

.prize-result p {
    margin: 5px 0;
    color: #666;
    font-size: 14px;
}

.win-date {
    color: #ff9800 !important;
    font-weight: bold;
}

/* How to Participate section */
.q-participate-section {
    width: 100%;
    max-width: 600px;
    text-align: center;
    padding: 30px 10px;
    color: #fff;
    margin-top: 30px;
    position: relative;
    z-index: 9;
}

.q-participate-title {
    font-size: 22px;
    margin-bottom: 25px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.q-participate-steps {
    display: flex;
    justify-content: space-around;
    gap: 15px;
    flex-wrap: wrap;
}

.q-participate-step {
    width: 150px;
    text-align: center;
    background: rgba(0,0,0,0.4);
    padding: 15px 10px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.1);
    backdrop-filter: blur(5px);
}

.q-participate-icon {
    width: 45px;
    height: 45px;
    margin-bottom: 10px;
}

.q-participate-step-title {
    font-size: 15px;
    margin-bottom: 5px;
    color: #ffca00;
}

.q-participate-step-text {
    font-size: 12px;
    line-height: 1.4;
    opacity: 0.9;
}

.music-toggle-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    cursor: pointer;
    z-index: 999;
    background: rgba(0, 0, 0, 0.5);
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.music-toggle-btn svg {
    fill: #ffffff;
}

/* Responsiveness */
@media (max-width: 600px) {
    .prize-grid {
        padding: 20px;
        gap: 6px;
    }
    .q-participate-steps {
        gap: 10px;
    }
    .q-participate-step {
        width: 45%;
    }
}

@media (max-width: 400px) {
    .q-participate-step {
        width: 90%;
    }
}
