* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    color: white;
}

.container {
    text-align: center;
}

.logo {
    width: 420px;
    height: 145px;
    object-fit: contain;
}

h1 {
    margin-bottom: 20px;
    font-size: 1.5em;
}

.ticket-section {
    display: grid;
    justify-items: center;
    gap: 10px;
    margin-bottom: 30px;
}

#ticketForm {
    display: grid;
    gap: 10px;
}

#ticketCode, #username {
    padding: 10px;
    font-size: 16px;
    width: 100%;
    max-width: 310px;
    border: 1px solid #ccc;
    border-radius: 8px;
    text-align: center;
}

button {
    padding: 10px;
    font-size: 16px;
    cursor: pointer;
    border: none;
    border-radius: 8px;
    transition: background-color 0.3s ease;
}

.screenshot-button {
    background-color: #007bff;
    color: white;
}

.screenshot-button:hover {
    background-color: #0056b3;
}

.submit-button {
    background-color: red;
}

.submit-button:hover {
    background-color: #9c1515;
}

.back-button {
    background-color: cornflowerblue;
}

.back-button:hover {
    background-color: #4f76bc;
}

.prize-button {
    background-color: lightseagreen;
}

.prize-button:hover {
    background-color: #19847e;
}

.terms-button {
    background-color: grey;
}

.terms-button:hover {
    background-color: #5a5959;
}

.result-button {
    background-color: red;
}

.result-button:hover {
    background-color: #9c1515;
}

.last-result-button {
    background-color: gold;
    color: black !important;
    padding: 10px 20px;
    font-size: 16px;
    border-radius: 5px;
    margin-top: 0;
    transition: background-color 0.3s;
}

.last-result-button:hover {
    background-color: darkgoldenrod;
}

.last-result-button:active {
    background-color: goldenrod;
}

.box-container {
    display: grid;
    grid-template-columns: repeat(3, 120px);
    gap: 15px;
    justify-content: center;
    margin-bottom: 20px;
}

.box {
    width: 130px;
    height: 130px;
    border-radius: 15px;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.box:hover {
    transform: scale(1.1);
}

.popup {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 300px;
    max-width: 90vw; /* Responsif di layar kecil */
    padding: 20px;
    background-color: #1e1e1e;
    border-radius: 20px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    animation: popIn 0.5s ease;
    color: #fff;
    text-align: center;
}

@keyframes popIn {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

.popup-content h2 {
    margin-bottom: 15px;
    font-size: 1.5rem;
    color: #ffca00;
    font-weight: bold;
}

.popup-content img {
    max-width: 100%;
    height: auto;
    border-radius: 15px;
    margin-bottom: 20px;
}

.popup .close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 1.5rem;
    color: #ffca00;
    cursor: pointer;
    transition: color 0.3s ease;
}

.popup .close-btn:hover {
    color: #fff;
}

.popup-content p {
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 10px;
}

.popup-content p span {
    color: #ffca00;
}

.popup-content button {
    display: inline-block;
    padding: 10px 20px;
    background-color: #ffca00;
    color: #1e1e1e;
    border: none;
    border-radius: 15px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.popup-content button:hover {
    background-color: #f4c700;
}

.prize-img {
    width: 200px;
    height: 200px;
    margin: 15px auto;
    border-radius: 10px;
}

.close {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 25px;
    cursor: pointer;
    color: #1e3c72;
}

@keyframes popIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.paper {
    position: fixed;
    width: 30px;
    height: 20px;
    border-radius: 5px;
    opacity: 0;
    pointer-events: none;
    z-index: 1100;
    animation: paperFall 7s linear infinite;
}

@keyframes paperFall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(360deg);
        opacity: 0;
    }
}

.rules-popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.rules-popup-content {
    background: #313030;
    padding: 20px;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.rules-popup-content img {
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
}

.rules-popup-content h2,
.rules-popup-content p {
    color: #e74c3c;
    margin: 5px 0;
}

.rules-popup-content button {
    background-color: lightseagreen;
    color: white;
    border: none;
    padding: 10px 20px;
    font-size: 16px;
    border-radius: 5px;
    margin-top: 20px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.rules-popup-content button:hover {
    background-color: #19847e;
}

.rules-popup-content button:active {
    background-color: #156b5e;
}

.close-button {
    position: absolute;
    top: 10px;
    right: 10px;
    background: transparent;
    border: none;
    font-size: 24px;
    color: #ffffff;
    cursor: pointer;
    z-index: 1002;
}

.history-popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    overflow: auto;
}

.history-popup-content {
    background-color: #272626;
    margin: 2% auto;
    padding: 20px;
    border-radius: 10px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4);
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 10px;
    border-bottom: 1px solid #444;
}

.header h2 {
    font-size: 20px;
    color: white;
}

.scrollable-content {
    max-height: 600px;
    overflow-y: auto;
    margin-top: 10px;
}

#historyTable {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

#historyTable th,
#historyTable td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #444;
    color: #ddd;
    background-color: #2c2c2c;
}

#historyTable thead th {
    background-color: #333;
    font-weight: bold;
    border-bottom: 2px solid #555;
}

#historyTable tbody tr:nth-child(even) {
    background-color: #2a2a2a;
}

.popup-container {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.popup-content {
    background-color: #313030;
    padding: 20px;
    border-radius: 10px;
    max-width: 500px;
    width: 100%;
    min-height: 40vh;
    max-height: 90vh;
    overflow-y: auto;
    text-align: center;
    position: relative;
}

.popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding-bottom: 10px;
    border-bottom: 1px solid #444;
}

.close-popup-button {
    font-size: 20px;
    cursor: pointer;
    color: #ff0000;
}

.close-popup-button:hover {
    color: #e74c3c;
}

.popup-prizes-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.popup-prizes-list li {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 10px;
    background: #2c2c2c;
    border-radius: 8px;
    color: white;
    font-weight: bold;
}

.popup-prize-img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    margin-bottom: 8px;
}

.terms-popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.terms-popup-content {
    background-color: #2e2e2e;
    padding: 20px;
    border-radius: 10px;
    max-width: 600px;
    width: 95%;
    min-height: 50vh;
    max-height: 90vh;
    overflow-y: auto;
    text-align: center;
    position: relative;
    color: #f1f1f1;
}

.main-title {
    font-size: 1.2em;
    margin: 15px 0 8px;
    color: #ffca00;
    font-weight: bold;
}

.terms-heading {
    font-size: 1em;
    margin-bottom: 10px;
    color: #e74c3c;
    font-weight: 600;
}

.terms-box {
    border: 2px solid #555;
    border-radius: 8px;
    padding: 10px;
    margin: 10px auto;
    background-color: #333;
    text-align: left;
    max-width: 560px;
}

.terms-list,
.prizes-list {
    font-size: 0.9em;
    margin: 10px 0;
    padding-left: 20px;
    line-height: 1.5;
}

.terms-list li {
    margin-bottom: 6px;
}

.prizes-list {
    list-style: none;
    padding: 0;
    text-align: center;
}

.prizes-list li {
    display: inline-block;
    background: #2c2c2c;
    color: #fff;
    padding: 6px 12px;
    margin: 4px;
    border-radius: 6px;
    font-size: 0.9em;
    min-width: 80px;
}

#result {
    font-size: 18px;
    color: #333;
    background-color: #f9f9f9;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #ddd;
    margin-top: 15px;
    text-align: center;
    word-wrap: break-word;
    max-width: 300px;
    margin-left: auto;
    margin-right: auto;
}

@media (max-width: 768px) {
    .box-container {
        grid-template-columns: repeat(3, 100px);
        gap: 10px;
    }

    .box {
        width: 100px;
        height: 100px;
    }

    .popup {
        width: 280px;
        padding: 15px;
    }

    .prize-img {
        width: 150px;
        height: 150px;
    }

    .header h2 {
        font-size: 18px;
    }

    .history-popup-content,
    .terms-popup-content {
        width: 85%;
        padding: 15px;
    }

    #historyTable th,
    #historyTable td {
        font-size: 14px;
        padding: 6px;
    }

    .main-title {
        font-size: 1.1em;
    }

    .terms-list,
    .prizes-list {
        font-size: 0.85em;
    }
}