@import url('https://fonts.googleapis.com/css2?family=Kanit:wght@300;500;700&display=swap');

:root {
    --gold-bright: #ffed4a;
    --gold-main: #d4af37;
    --gold-dark: #8a6d3b;
    --primary-green: #4ade80;
    --dark-bg: #050505;
    --card-bg: rgba(26, 26, 26, 0.9); /* ปรับให้ทึบขึ้นเล็กน้อยเพื่อตัดกับพื้นหลัง */
}

body {
    margin: 0; padding: 0;
    font-family: 'Kanit', sans-serif;
    background-color: var(--dark-bg);
    color: white;
    overflow-x: hidden;
}

/* --- Loading System --- */
#loader {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: #000; display: flex; justify-content: center;
    align-items: center; z-index: 9999; transition: opacity 0.8s ease-out;
}
.gold-ring {
    width: 80px; height: 80px;
    border: 4px solid rgba(212, 175, 55, 0.1);
    border-top: 4px solid var(--gold-bright);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    filter: drop-shadow(0 0 10px var(--gold-main));
}
@keyframes spin { 100% { transform: rotate(360deg); } }

#main-content { opacity: 0; transition: opacity 1.5s ease-out; }

/* --- Particles --- */
#stars {
    position: fixed;
    top: 0; left: 0;
    z-index: -1;
    background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.5) 100%);
}

/* --- Navigation (จุดที่แก้ไข: เพิ่มพื้นหลังให้อ่านง่ายขึ้น) --- */
nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 10%;
    position: fixed; /* เปลี่ยนเป็น fixed เพื่อให้เกาะขอบบน */
    top: 0; left: 0; width: 100%;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.7); /* เพิ่มพื้นหลังดำโปร่งแสง */
    backdrop-filter: blur(10px); /* เพิ่มความเบลอเพื่อให้ตัวหนังสือลอยออกมา */
    box-sizing: border-box;
    border-bottom: 1px solid rgba(212, 175, 55, 0.2);
}
nav ul { display: flex; list-style: none; gap: 20px; margin: 0; padding: 0; }
nav ul li a {
    color: #fff; /* ปรับเป็นสีขาวให้อ่านง่าย */
    text-decoration: none;
    font-size: 1rem;
    transition: color 0.3s ease;
}
nav ul li a:hover { color: var(--gold-bright); }

.logo {
    font-weight: 700;
    font-size: 1.5rem;
    letter-spacing: 2px;
}
.logo span {
    color: var(--primary-green);
    text-shadow: 0 0 10px rgba(74, 222, 128, 0.5);
}

/* --- Hero Section --- */
.hero {
    height: 85vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 0 20px;
    margin-top: 60px; /* ชดเชยระยะจาก nav fixed */
}

.main-title {
    font-size: 5rem;
    font-weight: 700;
    letter-spacing: 5px;
    background: linear-gradient(to bottom, #fff, var(--gold-main));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 15px rgba(212, 175, 55, 0.5));
    margin-bottom: 10px;
    opacity: 0;
}

.description {
    color: #bbb;
    line-height: 1.6;
    max-width: 800px;
    margin-bottom: 30px;
    opacity: 0;
}

/* --- Animation --- */
.reveal { animation: fadeInUp 1s ease forwards; }
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Buttons --- */
.cta-buttons {
    display: flex;
    gap: 15px;
    margin-bottom: 40px;
    opacity: 0;
}

.btn-gold {
    padding: 15px 40px;
    border-radius: 5px;
    border: none;
    background: linear-gradient(45deg, var(--gold-dark), var(--gold-bright));
    color: black;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.3);
    text-decoration: none;
    display: inline-block;
}
.btn-gold:hover {
    transform: scale(1.05);
    box-shadow: 0 0 25px var(--gold-main);
}

.btn-white {
    padding: 15px 40px;
    border-radius: 5px;
    border: 1px solid white;
    background: none;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
    text-decoration: none;
    display: inline-block;
}

/* --- Download & Article Cards (จุดที่แก้ไข: เพิ่มกรอบทองและพื้นหลังดำ) --- */
.download-card, .card {
    background: var(--card-bg) !important;
    padding: 30px;
    border-radius: 20px;
    border: 1px solid rgba(212, 175, 55, 0.3) !important; /* เพิ่มกรอบทองจางๆ */
    transition: 0.3s;
    backdrop-filter: blur(5px);
}
.card:hover, .download-card:hover {
    border-color: var(--gold-main) !important;
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.2);
}

/* --- Download Page Specific --- */
.download-container { padding: 100px 5% 50px; text-align: center; }
.platform-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 40px;
}
.mobile-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 20px;
}
.full-width { grid-column: span 2; }

/* --- Mobile Responsive (ปรับปรุงใหม่ให้ดูดีขึ้น) --- */
@media (max-width: 768px) {
    /* ปรับ Navigation ให้โลโก้อยู่บน เมนูอยู่ล่าง เพื่อไม่ให้เบียดกัน */
    nav { 
        flex-direction: column; 
        padding: 15px 5%; 
        gap: 15px; 
        text-align: center;
    }

    nav ul { 
        gap: 12px; 
        justify-content: center;
        flex-wrap: wrap; /* ให้เมนูลงบรรทัดใหม่ได้ถ้าไม่พอ */
    }

    nav ul li a { 
        font-size: 0.85rem; 
        padding: 5px 8px; 
    }

    /* ปรับแต่ง Hero Section บนมือถือ */
    .hero { 
        height: auto; 
        padding: 120px 20px 60px; /* เพิ่ม padding บนเพื่อให้ไม่โดนเมนูบัง */
    }
    
    .main-title { 
        font-size: 2.8rem; 
        letter-spacing: 2px; 
        line-height: 1.2;
    }
    
    .description { 
        font-size: 0.95rem; 
        margin-bottom: 25px;
        padding: 0 10px;
    }
    
    /* ปุ่มกดให้เต็มความกว้างในมือถือเพื่อกดง่ายขึ้น */
    .cta-buttons { 
        flex-direction: column; 
        width: 100%; 
        max-width: 300px;
        gap: 12px;
    }
    
    .btn-gold, .btn-white { 
        width: 100%; 
        padding: 14px 0; 
        text-align: center;
        box-sizing: border-box; 
    }

    /* ปรับหน้าบทความ/ดาวน์โหลดในมือถือ */
    .container { padding-top: 140px; }
    .platform-grid { grid-template-columns: 1fr; }
    .mobile-grid { grid-template-columns: 1fr; }
}

/* --- Server Status --- */
.server-status {
    margin-top: 20px;
    background: rgba(255,255,255,0.05);
    padding: 10px 20px;
    border-radius: 30px;
    border: 1px solid rgba(255,255,255,0.1);
    display: inline-flex;
    align-items: center;
    opacity: 0;
}
.status-dot {
    height: 10px; width: 10px;
    background: var(--primary-green);
    border-radius: 50%;
    margin-right: 8px;
    box-shadow: 0 0 8px var(--primary-green);
}

/* ===============================
   Floating Right Image (Isolated)
   =============================== */

.floating-right-image {
    position: fixed;        /* ไม่ยุ่งกับ layout เดิม */
    right: 4%;
    bottom: 6%;             /* ขวาล่างของจอ */
    width: 360px;
    max-width: 40vw;
    z-index: 5;

    pointer-events: none;   /* ไม่บังปุ่ม */
    filter: drop-shadow(0 0 30px rgba(160, 100, 255, 0.45));
    opacity: 0.95;

    animation: floatingImage 7s ease-in-out infinite;
}

/* ลอยเบา ๆ */
@keyframes floatingImage {
    0%, 100% {
        transform: translateY(0) translateX(0);
    }
    50% {
        transform: translateY(-14px) translateX(-10px);
    }
}


/* ===============================
   Floating Left Image (Isolated)
   =============================== */

.floating-right-image1 {
    position: fixed;        /* แยกจาก layout เดิม */
    left: 4%;
    bottom: 6%;             /* ซ้ายล่างของจอ */
    width: 360px;
    max-width: 40vw;
    z-index: 5;

    pointer-events: none;
    filter: drop-shadow(0 0 30px rgba(255, 215, 100, 0.35));
    opacity: 0.95;

    animation: floatingImageLeft 7s ease-in-out infinite;
}

/* ลอยเบา ๆ (ทิศตรงข้ามฝั่งขวา) */
@keyframes floatingImageLeft {
    0%, 100% {
        transform: translateY(0) translateX(0);
    }
    50% {
        transform: translateY(-14px) translateX(10px);
    }
}
