* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Prompt', sans-serif;
}

body {
    background-color: #ffffff;
    color: #333333;
    line-height: 1.6;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 5%;
    background-color: #ffffff;
    position: fixed;
    width: 100%;
    top: 0;
    left: 0;
    z-index: 1000;
}

nav.scrolled {
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

nav > a {
    text-decoration: none;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-img {
    height: 40px;
    width: auto;
    object-fit: contain;
}

.logo-text {
    font-weight: 500;
    font-size: 16px;
    color: #111111;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 25px;
}

.nav-links li a {
    text-decoration: none;
    color: #111111;
    font-size: 14px;
    font-weight: 400;
    transition: color 0.3s ease, transform 0.2s ease;
    text-transform: capitalize;
}

.nav-links li a:hover {
    color: #f37b21;
}

.dropdown-icon {
    font-size: 10px;
    margin-left: 5px;
}

.hero {
    padding: 150px 5% 80px;
    max-width: 100%;
    margin: 0 auto;
    background-image: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)), url('image/background3.JPG');
    background-size: cover;
    background-position: center; 
    background-repeat: no-repeat; 
}

.hero h1 {
    font-size: 48px;
    font-weight: 500;
    color: #ffffff;
    margin-bottom: 10px;
    line-height: 1.2;
}

.hero h2 {
    font-size: 20px;
    font-weight: 400;
    color: #ffffff;
    margin-bottom: 30px;
}

.btn-primary {
    display: inline-block;
    background-color: #f37b21;
    color: #ffffff;
    padding: 12px 30px;
    font-size: 16px;
    font-weight: 500;
    text-decoration: none;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.btn-primary:hover {
    background-color: #d96a1b;
    transform: translateY(-2px);
}

.strengths-section {
    padding: 60px 5% 100px;
    text-align: center;
    background-color: #ffffff;
}

.strengths-section h2 {
    font-size: 32px;
    font-weight: 500;
    margin-bottom: 50px;
    color: #111111;
}

.cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto;
}

.card {
    background-color: #f9f9f9;
    padding: 40px 20px;
    border-radius: 15px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.05);
}

.card-icon {
    font-size: 40px;
    color: #f37b21;
    margin-bottom: 20px;
}

.card h3 {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 15px;
    color: #111111;
}

.card p {
    font-size: 14px;
    color: #555555;
    line-height: 1.6;
}

@media (max-width: 992px) {
    .nav-links {
        display: none;
    }
    .hero h1 {
        font-size: 36px;
    }
}
.academics-section {
    padding: 20px 5% 100px;
    text-align: center;
    background-color: #ffffff;
}

.academics-section h2 {
    font-size: 32px;
    font-weight: 500;
    margin-bottom: 50px;
    color: #111111;
}

.deg-title {
    font-size: 13px;
    color: #111111 !important; 
    font-weight: 500;
    line-height: 1.5 !important;
}


.community-section {
    padding: 60px 5% 100px;
    max-width: 1200px;
    margin: 0 auto;
}

.community-top {
    display: flex;
    justify-content: space-between;
    gap: 40px;
    margin-bottom: 50px;
}

.community-title h2 {
    font-size: 32px;
    font-weight: 500;
    line-height: 1.2;
}

/* --- Carousel Section (สไลด์โชว์รูปภาพ) --- */
.carousel-container {
    position: relative;
    flex: 2; /* ให้สัดส่วนแบ่งกับตัวหนังสือด้านซ้าย */
    width: 100%;
    max-width: 600px;
    height: 400px; /* ปรับความสูงของช่องรูปภาพได้ตรงนี้ */
    overflow: hidden; /* ซ่อนรูปที่ล้นขอบจอ */
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.carousel-slide {
    display: flex;
    width: 100%;
    height: 100%;
    transition: transform 0.5s ease-in-out; /* ทำให้เลื่อนแบบสมูทๆ */
}

.carousel-slide img {
    min-width: 100%;
    height: 100%;
    object-fit: cover;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.5); /* พื้นหลังปุ่มสีดำโปร่งใส */
    color: white;
    border: none;
    padding: 12px 15px;
    cursor: pointer;
    font-size: 18px;
    border-radius: 50%; /* ทำให้ปุ่มเป็นวงกลม */
    z-index: 10;
    transition: background-color 0.3s ease;
}

.carousel-btn:hover {
    background-color: #f37b21; /* เปลี่ยนเป็นสีส้มเมื่อเอาเมาส์ชี้ */
}

.prev-btn {
    left: 10px;
}

.next-btn {
    right: 10px;
}

.video-container {
    display: flex;
    justify-content: center;
    width: 100%;
    margin-top: 40px;
}

.video-wrapper {
    position: relative;
    width: 100%;
    max-width: 1024px;
    padding-bottom: 56.25%;
    height: 0;
    border-radius: 10px;
    overflow: hidden;
    background-color: #000;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* --- Contact Section --- */
.contact-section {
    padding: 60px 5% 100px;
    max-width: 1200px;
    margin: 0 auto;
}

.contact-header {
    font-size: 40px;
    font-weight: 500;
    margin-bottom: 40px;
}

.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
}

.contact-col h3 {
    font-size: 24px;
    font-weight: 500;
    margin-bottom: 20px;
}

.contact-col .desc {
    font-size: 14px;
    color: #444;
    margin-bottom: 30px;
}

.address-box {
    display: flex;
    gap: 15px;
    margin-bottom: 40px;
}

.pin-icon {
    font-size: 20px;
    color: #111;
    margin-top: 5px;
}

.address-box p {
    font-size: 14px;
    color: #333;
    line-height: 1.6;
}

.contact-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.detail-item strong {
    display: block;
    font-weight: 500;
    font-size: 14px;
    margin-bottom: 5px;
    color: #111;
}

.detail-item p {
    font-size: 13px;
    color: #444;
}

@media (max-width: 768px) {
    .community-top {
        flex-direction: column;
    }
    .contact-grid {
        grid-template-columns: 1fr;
    }
    .contact-details {
        grid-template-columns: 1fr;
    }
}

.theme-toggle {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: #111111;
    color: #ffffff;
    border: none;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.3s ease, background-color 0.3s ease;
}

.theme-toggle:hover {
    transform: scale(1.1);
    background-color: #f37b21;
}

body.dark-mode {
    background-color: #121212;
    color: #e0e0e0;
}

body.dark-mode nav,
body.dark-mode .strengths-section,
body.dark-mode .academics-section {
    background-color: #121212;
}

body.dark-mode .nav-links li a,
body.dark-mode .logo-text {
    color: #e0e0e0;
}

body.dark-mode .nav-links li a:hover {
    color: #f37b21;
}

body.dark-mode .hero h1,
body.dark-mode .hero h2,
body.dark-mode .strengths-section h2,
body.dark-mode .academics-section h2,
body.dark-mode .community-title h2,
body.dark-mode .contact-header,
body.dark-mode .contact-col h3,
body.dark-mode .detail-item strong,
body.dark-mode .contact-col .desc {
    color: #ffffff;
}

body.dark-mode .address-box p,
body.dark-mode .detail-item p {
    color: #bbbbbb;
}

body.dark-mode .pin-icon {
    color: #f37b21;
}

body.dark-mode .card {
    background-color: #1e1e1e;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}

body.dark-mode .card h3,
body.dark-mode .deg-title {
    color: #ffffff !important;
}

body.dark-mode .card p {
    color: #bbbbbb;
}

.news-carousel-container {
    position: relative;
    width: 100%;
    max-width: 100%; 
    margin: 80px 0 40px 0; 
    overflow: hidden;
    border-radius: 0; 
}

.news-carousel-slide {
    display: flex;
    width: 100%;
    transition: transform 0.5s ease-in-out;
}

.news-carousel-slide img {
    min-width: 100%;
    width: 100%;      /* ✅ เพิ่ม width: 100%; เข้ามา บังคับให้รูปกว้างพอดีจอเสมอ */
    height: auto;     /* ✅ อันนี้ถูกต้องแล้วครับ รักษาสัดส่วนภาพ ไม่ให้เบี้ยว */
    display: block;
}

/* ปุ่มเลื่อนซ้ายขวา (คงเดิม) */
.news-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    padding: 10px 15px;
    cursor: pointer;
    font-size: 20px;
    z-index: 10;
}

.news-btn:hover { background-color: #f37b21; }
.prev-news-btn { left: 0; border-radius: 0 5px 5px 0; }
.next-news-btn { right: 0; border-radius: 5px 0 0 5px; }

/* ========================================= */
/* --- ตกแต่งกล่องนับเวลาถอยหลัง (Countdown) --- */
/* ========================================= */

/* ☀️ 1. ค่าเริ่มต้น (สำหรับโหมดสว่าง - Light Mode) */
.countdown-container {
    text-align: center;
    margin: 40px auto; 
    padding: 20px 30px;
    background-color: #ffffff; /* พื้นหลังกล่องสีขาว */
    border-radius: 10px;
    max-width: 600px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.25); /* เงาบางๆ ให้ดูมีมิติ */
    transition: all 0.3s ease; /* ทำให้เวลาเปลี่ยนโหมดสีจะค่อยๆ เปลี่ยนแบบสมูท */
}

.countdown-title {
    color: #f37b21; 
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 24px;
    font-weight: bold;
}

.countdown-timer {
    display: flex;
    justify-content: center;
    gap: 15px; 
}

.time-box {
    background-color: #f8f9fa; /* พื้นหลังกล่องตัวเลขสีเทาอ่อนมาก */
    padding: 15px;
    border-radius: 8px;
    min-width: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 6px 20px rgba(0,0,0,0.25);
    border-bottom: 3px solid #f37b21; 
    transition: all 0.3s ease;
}

.time-box span:first-child {
    font-size: 36px;
    font-weight: bold;
    color: #333333; /* ตัวเลขสีดำเข้ม */
    line-height: 1;
}

.time-label {
    font-size: 14px;
    color: #666666; /* ตัวหนังสือคำว่า วัน/ชม. สีเทา */
    margin-top: 8px;
}

.countdown-expired {
    font-size: 28px;
    color: #ff4c4c; 
    font-weight: bold;
    padding: 10px;
}

/* 🌙 2. ตั้งค่าสำหรับโหมดกลางคืน (Dark Mode) */
/* หมายเหตุ: แก้ไขคำว่า .dark-mode ให้ตรงกับชื่อคลาสที่คุณใช้ในระบบสลับโหมดของคุณ */
body.dark-mode .countdown-container {
    background-color: #333333; /* พื้นหลังกล่องสีดำเทา */
    border: 1px solid #333333;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}

body.dark-mode .time-box {
    background-color: #000000; /* พื้นหลังกล่องตัวเลขสีดำสนิท */
}

body.dark-mode .time-box span:first-child {
    color: #ffffff; /* ตัวเลขสีขาว */
}

body.dark-mode .time-label {
    color: #aaaaaa; /* ตัวหนังสือคำว่า วัน/ชม. สีเทาอ่อน */
}

/* ========================================= */
/* --- ปุ่มลอยไปหน้าเว็บบอร์ด (Floating Button) --- */
/* ========================================= */
.floating-forum-btn {
    position: fixed;
    bottom: 90px; /* ระยะห่างจากด้านล่าง (ปรับให้ลอยอยู่เหนือปุ่มดาร์กโหมด) */
    right: 30px;  /* ระยะห่างจากขอบขวา */
    background-color: #f37b21; /* สีส้มของเว็บ */
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    text-decoration: none;
    z-index: 1000;
    transition: all 0.3s ease;
}

.floating-forum-btn:hover {
    transform: scale(1.1);
    background-color: #d66819; /* สีส้มเข้มขึ้นตอนเอาเมาส์ชี้ */
}

/* สำหรับหน้าจอขนาดแท็บเล็ตและมือถือ (ต่ำกว่า 992px) */
@media (max-width: 992px) {
    nav {
        flex-direction: column; /* จัดโลโก้กับเมนูให้อยู่คนละบรรทัด */
        padding: 10px 2%;
    }

    .nav-links {
        display: flex;
        flex-wrap: wrap; /* ให้เมนูที่ล้น ปัดลงมาบรรทัดใหม่ */
        justify-content: center;
        gap: 10px;
        margin-top: 10px;
    }

    .logo-text {
        font-size: 14px; /* ลดขนาดชื่อภาควิชา */
        text-align: center;
    }
}

/* สำหรับมือถือขนาดเล็ก (ต่ำกว่า 600px) */
@media (max-width: 600px) {
    .logo-container {
        flex-direction: column;
        gap: 5px;
    }
    
    .logo-img {
        height: 30px; /* ลดขนาดโลโก้ */
    }
}

/* ========================================= */
/* --- Dropdown Menu (ยุบรวมโค้ดที่ซ้ำซ้อน) --- */
/* ========================================= */

/* โหมดปกติ (Light Mode) */
.dropdown-content {
    display: none; 
    position: absolute;
    background-color: #ffffff;
    min-width: 250px;
    box-shadow: 0px 8px 16px rgba(0,0,0,0.15);
    z-index: 1001;
    border-radius: 8px;
    margin-top: 10px;
}

.dropdown-content a {
    color: #333333;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    font-size: 14px;
    transition: background-color 0.2s, color 0.2s;
}

.dropdown-content a:hover {
    background-color: #f37b21;
    color: #ffffff;
}

.show {
    display: block;
}

/* โหมดกลางคืน (Dark Mode) */
body.dark-mode .dropdown-content {
    background-color: #1a1a1a;
    border: 1px solid #333333;
    box-shadow: 0px 8px 16px rgba(0, 0, 0, 0.6);
}

body.dark-mode .dropdown-content a {
    color: #ffffff !important; /* บังคับให้ตัวหนังสือสีขาว */
}

.dropdown-content a:hover {
    background-color: #f37b21; /* แถบพื้นหลังสีส้มตอนเอาเมาส์ชี้ */
    color: #333333 !important; /* บังคับตัวหนังสือให้เป็นสีดำ/เทาเข้มเสมอ */
}

/* ========================================= */
/* --- Responsive (รวมไว้ล่างสุดที่เดียว) --- */
/* ========================================= */

@media (max-width: 992px) {
    /* ลบคำสั่ง display: none; เดิมทิ้ง แล้วใช้การจัดเรียงใหม่ */
    nav {
        flex-direction: column; 
        padding: 10px 2%;
    }

    .nav-links {
        display: flex;
        flex-wrap: wrap; 
        justify-content: center;
        gap: 10px;
        margin-top: 10px;
    }

    .logo-text {
        font-size: 14px;
        text-align: center;
    }
    
    .hero h1 {
        font-size: 36px;
    }
}

@media (max-width: 768px) {
    .community-top {
        flex-direction: column;
    }
    .contact-grid, .contact-details {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .logo-container {
        flex-direction: column;
        gap: 5px;
    }
    .logo-img {
        height: 30px; 
    }
}

/* ========================================= */
/* --- สไตล์สำหรับหน้าเพจอื่นๆ (Template Styles) --- */
/* ========================================= */

/* ดันพื้นที่เนื้อหาลงมาไม่ให้โดน Navbar บัง (Navbar สูงประมาณ 70-80px) */
.page-container {
    padding-top: 100px; /* ระยะห่างจากด้านบนสุด */
    min-height: 70vh; /* บังคับให้หน้าเว็บมีความสูงขั้นต่ำ ป้องกัน Footer ลอย */
    max-width: 1200px;
    margin: 0 auto;
    padding-bottom: 60px;
    padding-left: 5%;
    padding-right: 5%;
}

.page-header {
    text-align: center;
    margin-bottom: 50px;
    padding: 40px 0;
    border-bottom: 1px solid #eeeeee;
}

.page-header h1 {
    font-size: 36px;
    color: #f37b21;
    margin-bottom: 15px;
}

.page-header p {
    font-size: 18px;
    color: #666666;
}

.page-content {
    line-height: 1.8;
}

/* 🌙 รองรับโหมดกลางคืนสำหรับหน้าใหม่ */
body.dark-mode .page-header {
    border-bottom: 1px solid #333333;
}

body.dark-mode .page-header p {
    color: #bbbbbb;
}

body.dark-mode .page-content {
    color: #e0e0e0;
}

/* ========================================= */
/* --- ปุ่มลอยไปหน้ามินิเกม (Floating Game) --- */
/* ========================================= */
.floating-game-btn {
    position: fixed;
    bottom: 150px; /* ปรับให้ลอยอยู่เหนือปุ่มเว็บบอร์ดที่ตั้งไว้ 90px */
    right: 30px;
    background-color: #28a745; /* ใช้สีเขียวให้ดูแตกต่างและน่ากด */
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    text-decoration: none;
    z-index: 1000;
    transition: all 0.3s ease;
}

.floating-game-btn:hover {
    transform: scale(1.1);
    background-color: #218838;
}

/* บังคับให้ลิงก์ในสไลด์มีพฤติกรรมเหมือนกล่องภาพ */
.news-carousel-slide a {
    display: block;      /* ให้ลิงก์แผ่เต็มพื้นที่ */
    flex-shrink: 0;      /* ป้องกันลิงก์ถูกบีบตัว */
    width: 100%;         /* หรือตามขนาดที่ Carousel เดิมตั้งไว้ */
    height: auto;
}

.news-carousel-slide a img {
    width: 100%;
    display: block;      /* ลบช่องว่างใต้ภาพ */
    cursor: pointer;     /* เปลี่ยนเมาส์เป็นรูปมือเวลาชี้ */
    transition: opacity 0.3s;
}

/* เพิ่ม Effect นิดหน่อยเวลาเอาเมาส์ไปชี้ภาพที่มีลิงก์ */
.news-carousel-slide a:hover img {
    opacity: 0.9;
}

.floating-info-btn {
    position: fixed;
    bottom: 210px; /* ขยับขึ้นจากปุ่มเกม (150px + 50px + 10px) */
    right: 30px;
    background-color: #007bff; /* ใช้สีน้ำเงินให้ดูเด่นแยกจากปุ่มอื่น */
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 22px; /* ปรับขนาดไอคอนเล็กน้อย */
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    text-decoration: none;
    z-index: 1000;
    transition: all 0.3s ease;
}

.floating-info-btn:hover {
    transform: scale(1.1);
    background-color: #0056b3;
    box-shadow: 0 6px 15px rgba(0,0,0,0.4);
}

/* --- Hamburger Menu (Mobile/Tablet) --- */
/* ========================================= */

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    color: #111;
    cursor: pointer;
    padding: 8px;
    z-index: 1001;
    transition: color 0.3s ease;
}

.menu-toggle:hover {
    color: #f37b21;
}

/* dark mode - hamburger button */
body.dark-mode .menu-toggle {
    color: #e0e0e0;
}

body.dark-mode .menu-toggle:hover {
    color: #f37b21;
}

/* ========================================= */
/* --- Responsive: Tablet & Mobile --- */
/* ========================================= */

@media (max-width: 992px) {
    nav {
        flex-wrap: wrap;
        padding: 10px 5%;
    }

    .menu-toggle {
        display: block;
        order: 3; /* ปุ่มไปอยู่ด้านขวา */
    }

    .logo-container {
        order: 1; /* โลโก้ไปอยู่ด้านซ้าย */
    }

    .nav-links {
        display: none;         /* ซ่อนตามค่าเริ่มต้น */
        order: 4;              /* เมนูอยู่ด้านล่าง */
        position: absolute;
        top: 60px;             /* อยู่ใต้ navbar */
        left: 0;
        right: 0;
        width: 100%;
        flex-direction: column;
        background-color: #ffffff;
        border-top: 1px solid #eeeeee;
        gap: 0;
        margin-top: 0;
        padding: 10px 0;
        box-shadow: 0 4px 10px rgba(0,0,0,0.1);
        z-index: 1000;
    }

    .nav-links.active {
        display: flex;
    }

    .nav-links li {
        width: 100%;
    }

    .nav-links li a {
        display: block;
        padding: 12px 5%;
        border-bottom: 1px solid #f0f0f0;
    }

    .nav-links li a:hover {
        background-color: #f37b21;
        color: #ffffff;
    }

    /* dropdown submenu */
    .dropdown {
        position: static;
    }

    .dropdown-content {
        position: static;
        display: none !important;
        background-color: #f9f9f9;
        box-shadow: none;
        border: none;
        width: 100%;
        min-width: unset;
        margin-top: 0;
    }

    .dropdown-content.show {
        display: flex !important;
        flex-direction: column;
    }

    .dropdown-content a {
        padding: 10px 5% 10px 10%;
        border-bottom: 1px solid #eeeeee;
    }

    .logo-text {
        font-size: 13px;
        text-align: center;
    }

    .hero h1 {
        font-size: 36px;
    }
}

/* dark mode - mobile menu */
body.dark-mode .nav-links {
    background-color: #1a1a1a;
    border-top: 1px solid #333;
}

body.dark-mode .nav-links li a {
    color: #e0e0e0;
    border-bottom: 1px solid #333;
}

body.dark-mode .nav-links li a:hover {
    background-color: #f37b21;
    color: #333;
}

body.dark-mode .dropdown-content {
    background-color: #252525;
}

body.dark-mode .dropdown-content a {
    color: #e0e0e0;
    border-bottom: 1px solid #333;
}

body.dark-mode .dropdown-content a:hover {
    background-color: #f37b21;
    color: #333;
}

/* responsive - tablet up */
@media (max-width: 768px) {
    nav {
        padding: 10px 3%;
    }

    .logo-img {
        height: 35px;
    }

    .logo-text {
        font-size: 12px;
    }
}

/* responsive - mobile small */
@media (max-width: 600px) {
    nav {
        padding: 8px 3%;
    }

    .logo-container {
        flex-direction: column;
        gap: 5px;
    }

    .logo-img {
        height: 30px;
    }

    .logo-text {
        font-size: 11px;
        text-align: center;
    }

    .menu-toggle {
        font-size: 20px;
        padding: 5px;
    }

    .nav-links {
        top: 50px !important;
    }

    .nav-links li a {
        padding: 10px 4%;
        font-size: 13px;
    }

    .dropdown-content a {
        padding: 8px 4% 8px 8% !important;
        font-size: 12px;
    }
}

/* ========================================= */
/* --- แก้ไข Navbar แนวนอนในจอมือถือ --- */
/* ========================================= */
@media (max-width: 992px) {
    nav {
        flex-direction: row !important; /* บังคับแนวนอน */
        justify-content: space-between !important;
        align-items: center !important;
        flex-wrap: nowrap !important; /* ห้ามตกบรรทัด */
    }
    
    .logo-container {
        flex-direction: row !important; /* โลโก้กับข้อความแนวนอน */
        align-items: center !important;
        gap: 10px;
    }

    .logo-text {
        font-size: 14px !important;
        text-align: left !important;
        /* ตัดคำด้วย ... ถ้าจอมือถือแคบเกินไป */
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 250px; 
    }

    .menu-toggle {
        order: unset !important;
        margin-left: auto; /* ดันปุ่ม Hamburger ไปขวาสุด */
    }
}

@media (max-width: 600px) {
    .logo-text {
        font-size: 12px !important;
        max-width: 160px; /* ลดพื้นที่ข้อความลงในมือถือจอเล็ก */
    }
}

/* ========================================= */
/* --- แก้ไขสไลด์โชว์ให้สมส่วน (Responsive) --- */
/* ========================================= */
.carousel-container {
    height: auto !important; /* ยกเลิก height 400px เดิม */
    aspect-ratio: 4 / 3; /* ล็อคสัดส่วนภาพให้เป็น 4:3 (เปลี่ยนเป็น 16/9 ได้ถ้าต้องการภาพกว้าง) */
}

.carousel-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover !important; /* ครอปภาพให้เต็มกรอบโดยไม่เสียสัดส่วน */
    object-position: center; /* จัดภาพให้อยู่กึ่งกลางเสมอ */
}

/* ========================================= */
/* --- ปรับปุ่มลอยให้เล็กลงในหน้าจอมือถือ --- */
/* ========================================= */
@media (max-width: 600px) {
    .floating-forum-btn {
        width: 40px; height: 40px; font-size: 18px; bottom: 70px; right: 15px;
    }
    .floating-game-btn {
        width: 40px; height: 40px; font-size: 18px; bottom: 120px; right: 15px;
    }
    .floating-info-btn {
        width: 40px; height: 40px; font-size: 18px; bottom: 170px; right: 15px;
    }
    .theme-toggle {
        width: 40px; height: 40px; font-size: 16px; bottom: 20px; right: 15px;
    }
}

/* ========================================= */
/* 1. แก้ไข Navbar: โลโก้ซ้าย - แฮมเบอร์เกอร์ขวา */
/* ========================================= */
@media (max-width: 992px) {
    nav {
        display: flex !important;
        flex-direction: row !important; 
        justify-content: space-between !important; 
        align-items: center !important;
        padding: 10px 5% !important;
        width: 100%;
    }

    .logo-container {
        order: 1 !important; /* บังคับให้อยู่ซ้ายสุดเป็นอันดับ 1 */
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 10px !important;
        max-width: calc(100% - 60px); 
    }

    .logo-text {
        font-size: 13px !important;
        white-space: nowrap !important; 
        overflow: hidden !important; 
        text-overflow: ellipsis !important; 
    }

    .menu-toggle {
        order: 2 !important; /* บังคับให้อยู่ขวาสุดเป็นอันดับ 2 */
        display: block !important;
        margin: 0 !important;
        padding: 5px !important;
    }
}

/* ========================================= */
/* 2. แก้ไขสไลด์โชว์: ให้รูปมีขนาดเท่ากันเสมอไม่ว่าจะจอไหน */
/* ========================================= */
.carousel-container {
    width: 100%;
    height: auto !important; /* ยกเลิกการฟิกซ์ความสูง */
    aspect-ratio: 4 / 3; /* ล็อคสัดส่วนความกว้างต่อความสูงให้เป็น 4:3 (หรือเปลี่ยนเป็น 16/9 ได้) */
    overflow: hidden;
}

.carousel-slide {
    height: 100%;
}

.carousel-slide img {
    min-width: 100%;
    width: 100%;
    height: 100% !important; /* บังคับความสูงให้เต็มคอนเทนเนอร์เสมอ */
    object-fit: cover !important; /* สำคัญมาก! ทำให้ภาพไม่ยืด/หด แต่จะครอปส่วนที่เกินออก */
    object-position: center !important; /* จัดให้ภาพอยู่กึ่งกลาง */
}

/* ========================================= */
/* 3. ปรับขนาดปุ่ม Icon ลอยต่างๆ ให้พอดีกับมือถือ */
/* ========================================= */
@media (max-width: 600px) {
    .floating-forum-btn,
    .floating-game-btn,
    .floating-info-btn,
    .theme-toggle {
        width: 40px !important;
        height: 40px !important;
        font-size: 18px !important;
    }
    
    /* จัดระยะห่างไม่ให้ปุ่มทับกันตอนเล็กลง */
    .theme-toggle { bottom: 20px; right: 20px; }
    .floating-forum-btn { bottom: 70px; right: 20px; }
    .floating-game-btn { bottom: 120px; right: 20px; }
    .floating-info-btn { bottom: 170px; right: 20px; }
}

