/* ======= 1. Global Background & Font (Neon Cyberpunk Theme) ======= */
body { 
    font-family: 'Kanit', sans-serif; 
    background-color: #0a0000; /* พื้นหลังสีดำอมแดงมืดๆ */
    position: relative;
    overflow-x: hidden; 
    margin: 0;
}

/* พื้นตารางนีออนแบบล้ำๆ วิ่งเข้าหาตัว */
body::before {
    content: '';
    position: fixed;
    bottom: -10%; /* ดันให้อยู่ช่วงครึ่งล่างของจอ */
    left: -50%;
    width: 200%;
    height: 80%;
    /* สร้างเส้นนีออนสีแดงสดทับซ้อนกัน */
    background-image: 
        linear-gradient(rgba(255, 20, 20, 0.8) 2px, transparent 2px),
        linear-gradient(90deg, rgba(255, 20, 20, 0.8) 2px, transparent 2px);
    background-size: 80px 80px;
    transform: perspective(600px) rotateX(75deg);
    transform-origin: center top;
    animation: neonGrid 1.2s linear infinite;
    z-index: -2;
    /* แสงเรืองรองใต้พื้น */
    box-shadow: inset 0 0 100px rgba(255, 0, 0, 0.4);
}

/* ใช้การไล่สีดำมาปิดช่วงขอบฟ้า ให้เส้นค่อยๆ กลืนหายไปในความมืด */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(to bottom, #0a0000 40%, transparent 100%);
    z-index: -1;
    pointer-events: none;
}

@keyframes neonGrid {
    0% { background-position: 0 0; }
    100% { background-position: 0 80px; } /* ขยับให้พอดีกับขนาดช่องตาราง */
}

/* ======= 3. Menu Cards (หน้า Dashboard) ======= */
.menu-card { 
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden; /* บังคับไม่ให้แสงส่องทะลุกรอบ */
}

/* ตอนเอาเมาส์ชี้ การ์ดจะลอยขึ้นและมีเงาสีแดงจางๆ */
.menu-card:hover { 
    transform: translateY(-8px) scale(1.01); 
    box-shadow: 0 20px 25px -5px rgba(220, 38, 38, 0.1), 0 8px 10px -6px rgba(220, 38, 38, 0.05);
}

/* สร้างแสงกระจก (Shine Effect) ซ่อนไว้ข้างซ้าย */
.menu-card::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 50%; height: 100%;
    background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.8) 50%, rgba(255,255,255,0) 100%);
    transform: skewX(-20deg);
    transition: all 0.7s ease;
    pointer-events: none;
    z-index: 10;
}

/* กวาดแสงกระจกผ่านการ์ดตอนเอาเมาส์ชี้ */
.menu-card:hover::before {
    left: 200%;
}

/* ======= 4. Button & Interaction Effects ======= */
/* เอฟเฟกต์การกดปุ่ม (จะยุบลงนิดนึงเวลากด) */
button {
    transition: transform 0.15s ease-out, box-shadow 0.15s ease-out !important;
}
button:active {
    transform: scale(0.96);
}

/* ======= 5. Toggle Switch (ตั้งค่า) ======= */
.toggle-checkbox:checked { 
    right: 0; 
    border-color: #dc2626; 
}
.toggle-checkbox:checked + .toggle-label { 
    background-color: #dc2626; 
    /* เพิ่มแสงเรืองรองตอนเปิดสวิตช์ */
    box-shadow: 0 0 10px rgba(220, 38, 38, 0.3);
}

/* ======= 6. Winner Animation (ประกาศผู้ชนะ) ======= */
.winner-anim { 
    animation: pulseWinner 1.5s infinite; 
}
@keyframes pulseWinner {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.4); }
    70% { transform: scale(1.05); box-shadow: 0 0 0 25px rgba(220, 38, 38, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
}