@import url('https://fonts.googleapis.com/css2?family=Kanit:wght@400;600&display=swap');

body {
    font-family: 'Kanit', Tahoma, sans-serif;
    margin: 0;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: url('https://file.joymaker.com/game/rooc/web/assets/bg1-DBGogZSO.png') no-repeat center center fixed;
    background-size: cover;
    color: #fff;
    perspective: 1000px; /* มิติความลึกสำหรับ 3D */
}

/* =========================================
   🌟 ระบบพลิกการ์ด (Flip Modal)
   ========================================= */
.flip-wrapper {
    width: 100%;
    max-width: 400px;
    position: relative;
}

.flipper {
    transition: transform 0.6s cubic-bezier(0.4, 0.2, 0.2, 1);
    transform-style: preserve-3d;
    position: relative;
    width: 100%;
}

.flip-wrapper.flipped .flipper {
    transform: rotateY(180deg);
}

/* โครงสร้างกล่อง หน้า/หลัง */
.box-face {
    background: #1a2235;
    padding: 40px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 15px 35px rgba(0,0,0,0.6);
    width: 100%;
    text-align: center;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    box-sizing: border-box;
}

.front {
    transform: rotateY(0deg);
    position: relative; /* ให้ดันขนาดกล่องรวม */
    z-index: 2;
}

.back {
    transform: rotateY(180deg);
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* ข้อความและปุ่ม */
.logo-text {
    font-size: 26px;
    font-weight: 600;
    margin-bottom: 30px;
    color: #fde047;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    letter-spacing: 1px;
}

.back-title {
    font-size: 22px;
    color: #fff;
    margin-bottom: 15px;
    font-weight: 600;
}

.btn-main {
    width: 100%;
    padding: 16px;
    margin-bottom: 15px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Kanit', sans-serif;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}
.btn-main:active { 
    transform: translateY(2px); 
    box-shadow: 0 2px 4px rgba(0,0,0,0.3); 
}

/* สีปุ่มต่างๆ */
.btn-yellow { background: linear-gradient(180deg, #fef08a 0%, #eab308 100%); color: #451a03; }
.btn-yellow:hover { background: linear-gradient(180deg, #fef08a 0%, #ca8a04 100%); box-shadow: 0 6px 12px rgba(234, 179, 8, 0.4); }

.btn-blue { background: linear-gradient(180deg, #60a5fa 0%, #2563eb 100%); color: #ffffff; }
.btn-blue:hover { background: linear-gradient(180deg, #93c5fd 0%, #1d4ed8 100%); box-shadow: 0 6px 12px rgba(37, 99, 235, 0.4); }

.btn-red { background: linear-gradient(180deg, #ef4444 0%, #b91c1c 100%); color: #ffffff; margin-bottom: 0; }
.btn-red:hover { background: linear-gradient(180deg, #f87171 0%, #991b1b 100%); box-shadow: 0 6px 12px rgba(220, 38, 38, 0.4); }

.btn-green { background: linear-gradient(180deg, #34d399 0%, #059669 100%); color: #ffffff; }
.btn-green:hover { background: linear-gradient(180deg, #6ee7b7 0%, #047857 100%); box-shadow: 0 6px 12px rgba(5, 150, 105, 0.4); }

/* ปุ่มย้อนกลับ */
.btn-back {
    background: transparent; 
    border: none; 
    color: #9ca3af; 
    cursor: pointer;
    margin-top: 15px; 
    font-family: 'Kanit', sans-serif; 
    font-size: 14px; 
    text-decoration: underline;
}
.btn-back:hover { color: #fff; }

/* ช่องกรอกข้อความ */
input { 
    width: 100%; 
    padding: 14px; 
    margin-bottom: 15px; 
    border: 1px solid rgba(255,255,255,0.2); 
    border-radius: 8px; 
    background: rgba(0, 0, 0, 0.4); 
    color: white; 
    font-size: 15px; 
    box-sizing: border-box; 
    transition: all 0.3s ease; 
    font-family: 'Kanit', sans-serif;
}
input:focus { 
    outline: none; 
    border-color: #60a5fa; 
    box-shadow: 0 0 10px rgba(96, 165, 250, 0.3); 
}

/* =========================================
   🌟 ของเก่า (หน้าดึงข้อมูล/แอดมิน)
   ========================================= */
.logout-btn { 
    position: absolute; 
    top: -15px; 
    right: -15px; 
    background: #ef4444; 
    color: white; 
    padding: 8px 15px; 
    font-size: 14px; 
    border-radius: 20px; 
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.4); 
    cursor: pointer; 
    border: none;
}
.logout-btn:hover { background: #dc2626; }
.hidden { display: none !important; }
.result-box { 
    margin-top: 20px; 
    background: rgba(0, 0, 0, 0.5); 
    padding: 20px; 
    border-radius: 8px; 
    border: 1px solid rgba(96, 165, 250, 0.3); 
    text-align: left; 
}
.result-box p { margin: 8px 0; font-size: 15px; color: #cbd5e1; }
.result-box span { color: #fde047; font-weight: 600; }
#resLink { background: rgba(0,0,0,0.8); color: #38bdf8; cursor: copy; margin-bottom: 0; }
.error { color: #fca5a5; margin-top: 5px; margin-bottom: 15px; font-size: 14px; }

/* =========================================
   🌟 Custom Modal Popup (กล่องแจ้งเตือนสวยๆ)
   ========================================= */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: #1a2235;
    padding: 35px 25px;
    border-radius: 16px;
    border: 1px solid rgba(255, 215, 0, 0.2);
    box-shadow: 0 15px 40px rgba(0,0,0,0.8), inset 0 0 20px rgba(255, 215, 0, 0.05);
    text-align: center;
    max-width: 320px;
    width: 90%;
    transform: translateY(-30px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.show .modal-content {
    transform: translateY(0) scale(1);
}

.modal-icon {
    font-size: 50px;
    margin-bottom: 15px;
    animation: bounce 2s infinite;
}

.modal-title {
    color: #fde047;
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 10px;
}

.modal-text {
    color: #cbd5e1;
    font-size: 15px;
    margin-bottom: 25px;
    line-height: 1.5;
}

.btn-close-modal {
    background: #374151;
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    font-family: 'Kanit', sans-serif;
    transition: background 0.2s;
    width: 100%;
}

.btn-close-modal:hover {
    background: #4b5563;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}