* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Poppins', sans-serif;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    position: relative;
}

.sunburst {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0099ff 0%, #0066cc 50%, #0044aa 100%);
    z-index: -1;
}

.sunburst::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200%;
    height: 200%;
    background:
        repeating-conic-gradient(from 0deg,
            #00aaff 0deg 10deg,
            #0088dd 10deg 20deg);
    animation: rotate 30s linear infinite;
    opacity: 0.3;
}

@keyframes rotate {
    from {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

.screen {
    position: absolute;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.screen.active {
    display: flex;
}

.logo-container {
    text-align: center;
    margin-bottom: 40px;
    animation: bounceIn 1s ease-out;
}

@keyframes bounceIn {
    0% {
        transform: scale(0.3);
        opacity: 0;
    }

    50% {
        transform: scale(1.05);
    }

    70% {
        transform: scale(0.9);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.main-title {
    font-family: 'Bangers', cursive;
    font-size: 3.5rem;
    color: #fff;
    text-shadow:
        4px 4px 0px #003366,
        6px 6px 0px rgba(0, 0, 0, 0.3),
        0 0 20px rgba(0, 153, 255, 0.5);
    letter-spacing: 3px;
    line-height: 1.1;
    margin-bottom: 10px;
}

.subtitle {
    font-family: 'Bangers', cursive;
    font-size: 1.8rem;
    color: #FFD700;
    text-shadow:
        2px 2px 0px #0066cc,
        3px 3px 0px rgba(0, 0, 0, 0.3);
    letter-spacing: 2px;
}

.login-card {
    background: linear-gradient(180deg, rgba(15, 25, 50, 0.98) 0%, rgb(10 20 42 / 25%) 100%);
    backdrop-filter: blur(15px);
    border-radius: 12px;
    padding: 60px 50px 50px 50px;
    width: 100%;
    max-width: 420px;
    box-shadow:
        0 25px 70px rgba(0, 0, 0, 0.9),
        inset 0 0 0 2px rgba(80, 120, 200, 0.2);
    border: 5px solid #ffffff;
    position: relative;
}

.login-title {
    color: #ffffff;
    font-family: 'Bangers', cursive;
    font-size: 2.2rem;
    font-weight: 400;
    text-align: center;
    margin-bottom: 30px;
    text-shadow:
        0 0 20px rgba(0, 212, 255, 0.9),
        3px 3px 0px rgba(0, 0, 0, 0.7),
        0 4px 8px rgba(0, 0, 0, 0.8);
    letter-spacing: 3px;
}

.input-group {
    margin-bottom: 18px;
    position: relative;
}

.input-group input {
    width: 100%;
    padding: 15px 20px;
    border: 2px solid rgba(100, 150, 255, 0.35);
    border-radius: 10px;
    font-size: 1.1rem;
    font-family: 'Bangers', cursive;
    background: linear-gradient(145deg, rgba(35, 50, 85, 0.7), rgba(25, 40, 70, 0.7));
    color: #fff;
    transition: all 0.3s ease;
    box-shadow:
        inset 0 2px 6px rgba(0, 0, 0, 0.6),
        0 3px 8px rgba(0, 0, 0, 0.4);
}

.input-group input:focus {
    outline: none;
    background: linear-gradient(145deg, rgba(40, 55, 95, 0.8), rgba(30, 45, 80, 0.8));
    border-color: #ffffff;
    box-shadow:
        0 0 0 3px rgba(0, 212, 255, 0.25),
        inset 0 2px 6px rgba(0, 0, 0, 0.6),
        0 0 18px rgba(0, 212, 255, 0.3);
}

.input-group input::placeholder {
    color: rgba(160, 180, 220, 0.65);
    font-weight: 400;
    font-family: 'Bangers', cursive;
    letter-spacing: 1px;
}



.btn-submit {
    width: 100%;
    padding: 18px;
    background: linear-gradient(180deg, #4CAF50 0%, #2E7D32 100%);
    border: 3px solid #66BB6A;
    border-radius: 12px;
    color: #fff;
    font-size: 1.5rem;
    font-weight: 400;
    font-family: 'Bangers', cursive;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow:
        0 8px 20px rgba(76, 175, 80, 0.4),
        inset 0 2px 0 rgba(255, 255, 255, 0.3),
        inset 0 -3px 0 rgba(0, 0, 0, 0.3);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-top: 15px;
    text-shadow:
        0 2px 4px rgba(0, 0, 0, 0.5),
        0 0 10px rgba(255, 255, 255, 0.3);
    position: relative;
    overflow: hidden;
}

.btn-submit::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn-submit:hover::before {
    left: 100%;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow:
        0 12px 30px rgba(76, 175, 80, 0.6),
        inset 0 2px 0 rgba(255, 255, 255, 0.4),
        inset 0 -3px 0 rgba(0, 0, 0, 0.3);
    border-color: #81C784;
    background: linear-gradient(180deg, #66BB6A 0%, #388E3C 100%);
}

.btn-submit:active {
    transform: translateY(0);
}

.header {
    position: fixed;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    z-index: 100;
    pointer-events: none;
}

.header>* {
    pointer-events: auto;
}

.game-title {
    display: none;
}

.user-info {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    z-index: 100;
}

.user-info span {
    color: #fff;
    font-family: 'Bangers', cursive;
    font-weight: 400;
    font-size: 1.2rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.btn-logout {
    background: linear-gradient(135deg, #FF6B6B 0%, #EE5A52 100%);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    padding: 8px 20px;
    border-radius: 12px;
    font-size: 1rem;
    font-family: 'Bangers', cursive;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 10px rgba(255, 107, 107, 0.3);
}

.btn-logout:hover {
    background: linear-gradient(135deg, #FF7B7B 0%, #FF6A62 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(255, 107, 107, 0.5);
}

.key-counter {
    position: fixed;
    top: 20px;
    left: 20px;
    background: linear-gradient(135deg, rgba(0, 51, 102, 0.85) 0%, rgba(0, 34, 68, 0.85) 100%);
    backdrop-filter: blur(10px);
    border-radius: 50px;
    padding: 5px 15px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow:
        0 4px 15px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.25);
    z-index: 100;
}

.key-icon {
    font-size: 1.5rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.key-count {
    color: #fff;
    font-family: 'Bangers', cursive;
    font-size: 1.5rem;
    font-weight: 400;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    line-height: 1;
    letter-spacing: 1px;
    letter-spacing: 1px;
    margin-top: 2px;
}

.history-btn {
    position: fixed;
    top: 80px;
    left: 20px;
    background: linear-gradient(135deg, rgba(0, 51, 102, 0.85) 0%, rgba(0, 34, 68, 0.85) 100%);
    backdrop-filter: blur(10px);
    border-radius: 50px;
    padding: 5px 15px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow:
        0 4px 15px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.25);
    z-index: 100;
    cursor: pointer;
    transition: all 0.3s ease;
}

.history-btn:hover {
    transform: scale(1.1);
    background: linear-gradient(135deg, rgba(0, 71, 142, 0.95) 0%, rgba(0, 54, 108, 0.95) 100%);
    box-shadow: 0 6px 20px rgba(0, 191, 255, 0.4);
}

.history-btn:active {
    transform: scale(0.95);
}

.history-icon {
    font-size: 1.5rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.history-label {
    color: #fff;
    font-family: 'Bangers', cursive;
    font-size: 1.2rem;
    font-weight: 400;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    line-height: 1;
    letter-spacing: 1px;
    margin-top: 2px;
}

.instruction {
    margin-top: 150px;
    margin-bottom: 30px;
}

@media (max-width: 768px) {
    .instruction {
        margin-top: 20px;
        margin-bottom: 20px;
    }
}

.instruction p {
    color: #fff;
    font-size: 1.3rem;
    font-family: 'Bangers', cursive;
    font-weight: 400;
    text-align: center;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    letter-spacing: 1px;
}

.chests-container {
    display: flex;
    gap: 30px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 30px;
}

@media (max-width: 768px) {
    .chests-container {
        flex-direction: row;
        padding: 0 10px;
        gap: 15px;
    }
}

.chest {
    width: 110px;
    height: 110px;
    position: relative;
    cursor: pointer;
    transition: all 0.4s ease;
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.5));
}

@media (min-width: 768px) {
    .chest {
        width: 130px;
        height: 130px;
    }

    .chests-container {
        flex-direction: row;
        gap: 40px;
    }
}

.chest:hover:not(.disabled):not(.opening) {
    transform: translateY(-15px) scale(1.08);
    filter: drop-shadow(0 15px 30px rgba(0, 191, 255, 0.6));
}

.chest:active:not(.disabled) {
    transform: translateY(-8px) scale(1.04);
}

.chest.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(70%) drop-shadow(0 5px 10px rgba(0, 0, 0, 0.3));
}

.chest-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.chest-closed {
    opacity: 1;
    z-index: 2;
}

.chest-open {
    opacity: 0;
    z-index: 1;
    transform: scale(0.95);
}

.chest.opening .chest-closed {
    opacity: 0;
    transform: scale(1.05);
}

.chest.opening .chest-open {
    opacity: 1;
    transform: scale(1.1);
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0) rotate(0deg);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-8px) rotate(-2deg);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(8px) rotate(2deg);
    }
}

.chest.shaking {
    animation: shake 0.5s ease-in-out;
}

.floating-reward {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(0);
    z-index: 200;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    background: radial-gradient(circle, rgba(0, 191, 255, 0.2) 0%, transparent 70%);
    padding: 20px;
    border-radius: 50%;
}

.floating-reward::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 200vw;
    height: 200vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: -1;
    transform: translate(-50%, -50%);
}

.floating-icon {
    font-size: 5rem;
    filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.8));
    margin-bottom: 10px;
    animation: float 3s ease-in-out infinite;
}

.floating-text {
    font-family: 'Bangers', cursive;
    color: #FFD700;
    font-size: 2rem;
    text-shadow: 2px 2px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
    white-space: nowrap;
    margin-bottom: 15px;
    animation: float 3s ease-in-out infinite reverse;
}

.btn-claim {
    background: linear-gradient(135deg, #00BFFF 0%, #0099ff 100%);
    border: none;
    border-radius: 50px;
    padding: 10px 30px;
    font-family: 'Bangers', cursive;
    font-size: 1.2rem;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 191, 255, 0.4);
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    animation: pulse 1.5s infinite;
}

.btn-claim:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 191, 255, 0.6);
}

.btn-claim:active {
    transform: scale(0.95);
}

@keyframes popIn {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0;
    }

    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}





/* Sparkle Effect */
.sparkle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: radial-gradient(circle, #fff 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 40;
    animation: sparkleAnim 0.8s ease-out forwards;
}

@keyframes sparkleAnim {
    0% {
        transform: scale(0);
        opacity: 1;
    }

    100% {
        transform: translate(var(--tx), var(--ty)) scale(0);
        opacity: 0;
    }
}



/* Responsive Design */
@media (max-width: 480px) {
    .main-title {
        font-size: 2.8rem;
    }

    .login-card {
        padding: 40px 30px;
        max-width: 90%;
    }

    .login-title {
        font-size: 1.5rem;
    }

    .input-group input {
        padding: 16px 20px;
        font-size: 1rem;
    }

    .btn-submit {
        padding: 16px;
        font-size: 1.1rem;
    }



    .chests-container {
        gap: 10px;
    }
}

/* History Button */
.history-btn {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    border: 2px solid #fff;
    border-radius: 20px;
    padding: 5px 15px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    margin-top: 8px;
    transition: transform 0.2s, box-shadow 0.2s;
    font-family: 'Poppins', sans-serif;
    display: block;
    margin-left: auto;
    margin-right: auto;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.history-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.4);
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
}

.history-btn:active {
    transform: translateY(0);
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    /* Darker backdrop */
    backdrop-filter: blur(8px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal-overlay.active {
    display: flex;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-content {
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    /* Dark Blue Theme */
    border: 3px solid #3b82f6;
    /* Blue Border */
    border-radius: 20px;
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.5), inset 0 0 0 1px rgba(255, 255, 255, 0.1);
    max-width: 90%;
    overflow: hidden;
    position: relative;
    animation: slideUp 0.3s ease-out;
    color: #fff;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close-modal-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    cursor: pointer;
    color: #94a3b8;
    transition: color 0.2s;
    line-height: 1;
}

.close-modal-btn:hover {
    color: #ef4444;
}

/* Table Styles */
.history-table th {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #94a3b8;
    border-bottom: 2px solid #334155;
}

.history-table td {
    padding: 10px 12px;
    /* More compact */
    border-bottom: 1px solid #334155;
    color: #e2e8f0;
    font-size: 0.9rem;
    font-family: 'Poppins', sans-serif;
}

.history-table tr:last-child td {
    border-bottom: none;
}

.history-table tr:hover {
    background-color: rgba(59, 130, 246, 0.1);
}

.modal-content ::-webkit-scrollbar {
    width: 8px;
}

.modal-content ::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.5);
    border-radius: 4px;
}

.modal-content ::-webkit-scrollbar-thumb {
    background: #3b82f6;
    border-radius: 4px;
}

.modal-content ::-webkit-scrollbar-thumb:hover {
    background: #2563eb;
}

.maintenance-screen {
    display: none !important;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    z-index: 99999;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    text-align: center;
}

.maintenance-screen.active {
    display: flex !important;
}

.maintenance-content {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    padding: 40px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    max-width: 500px;
    width: 90%;
}

.maintenance-content .icon-container {
    position: relative;
    height: 100px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.maintenance-content .fa-gear {
    font-size: 5rem;
    color: #3b82f6;
    opacity: 0.2;
    position: absolute;
}

.maintenance-content .static-icon {
    font-size: 3rem;
    color: #fbbf24;
    z-index: 2;
    filter: drop-shadow(0 0 10px rgba(251, 191, 36, 0.5));
}

.maintenance-content h1 {
    font-family: 'Bangers', cursive;
    font-size: 3rem;
    background: linear-gradient(to right, #fbbf24, #f59e0b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0 0 10px 0;
    letter-spacing: 2px;
}

.maintenance-content p {
    font-family: 'Poppins', sans-serif;
    color: #cbd5e1;
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 15px;
}

.maintenance-content .sub-text {
    font-size: 0.9rem;
    color: #64748b;
}

.maintenance-footer {
    margin-top: 30px;
    font-size: 0.8rem;
    color: #475569;
    letter-spacing: 1px;
    text-transform: uppercase;
}


.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast-item {
    min-width: 280px;
    padding: 14px 18px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
    font-family: 'Poppins', sans-serif;
    pointer-events: auto;
    cursor: pointer;
    animation: slideInRight 0.3s ease-out forwards;
}

.toast-item.hide {
    animation: slideOutRight 0.3s ease-in forwards;
}

.toast-success {
    border-left: 4px solid #fbbf24;
}

.toast-error {
    border-left: 4px solid #f87171;
}

@keyframes slideInRight {
    from {
        transform: translateX(120%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(120%);
        opacity: 0;
    }
}

.confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10001;
}

.confirm-overlay.active {
    display: flex;
}

.confirm-card {
    background: #1e293b;
    width: 90%;
    max-width: 380px;
    border-radius: 20px;
    padding: 30px;
    border: 1px solid rgba(251, 191, 36, 0.3);
    text-align: center;
    animation: zoomIn 0.3s forwards;
}

.confirm-icon {
    font-size: 3rem;
    color: #fbbf24;
    margin-bottom: 15px;
}

.confirm-title {
    font-family: 'Bangers', cursive;
    font-size: 2rem;
    color: #fff;
    margin-bottom: 10px;
}

.confirm-body {
    color: #94a3b8;
    margin-bottom: 25px;
}

.confirm-footer {
    display: flex;
    gap: 10px;
}

.btn-confirm {
    flex: 1;
    padding: 12px;
    border-radius: 10px;
    border: none;
    font-family: 'Bangers', cursive;
    cursor: pointer;
    transform: translateY(0);
    transition: 0.2s;
}

.btn-confirm:active {
    transform: translateY(2px);
}

.btn-yes {
    background: #fbbf24;
    color: #000;
}

.btn-no {
    background: #334155;
    color: #fff;
}