/* ============================================================
   ธีม "อาณาจักรด้วงจักรกล" (โหมดมืด) : ทอง ดำ ไฟส้ม
   โหลดหลัง style.css  — โหมดสว่างยังหน้าตาเดิม
   ============================================================ */

:root:not([data-theme="light"]) {
    --bg-main: #070a12;
    --bg-card: rgba(18, 22, 34, 0.84);
    --bg-card-hover: rgba(30, 34, 50, 0.92);
    --border-color: rgba(251, 191, 36, 0.14);
    --primary: #fbbf24;
    --primary-hover: #f59e0b;
    --accent: #fb923c;
    --gold-grad: linear-gradient(135deg, #fde68a 0%, #fbbf24 35%, #f59e0b 70%, #ea580c 100%);
}

/* ---------- พื้นหลังทั้งหน้า (ติดอยู่กับที่ เลื่อนแล้วไม่ขยับ) ---------- */
:root:not([data-theme="light"]) body { background-color: #070a12; }
:root:not([data-theme="light"]) body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        linear-gradient(180deg, rgba(7, 10, 18, 0.55) 0%, rgba(7, 10, 18, 0.8) 45%, rgba(7, 10, 18, 0.94) 100%),
        url("img/bg.webp") center top / cover no-repeat;
    pointer-events: none;
}
@media (max-width: 700px) {
    :root:not([data-theme="light"]) body::before {
        background:
            linear-gradient(180deg, rgba(7, 10, 18, 0.5) 0%, rgba(7, 10, 18, 0.82) 40%, rgba(7, 10, 18, 0.95) 100%),
            url("img/bg-mobile.webp") center top / cover no-repeat;
    }
}

/* ---------- หัวเว็บ: กระจกฝ้าโปร่งแสง + โลโก้ด้วง ---------- */
:root:not([data-theme="light"]) .header {
    background: rgba(7, 10, 18, 0.72) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(251, 191, 36, 0.18) !important;
}
body .header .logo {
    display: inline-flex !important;
    align-items: center;
    gap: 8px;
}
body .header .logo .logo-icon {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    box-shadow: 0 0 12px rgba(251, 146, 60, 0.45);
    flex: 0 0 auto;
}
:root:not([data-theme="light"]) .header .logo .logo-text {
    background: var(--gold-grad);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* ---------- แบนเนอร์หัวเว็บ ---------- */
body .hero.hero-banner {
    position: relative;
    overflow: hidden;
    border-radius: 18px;
    padding: 34px 32px 26px !important;
    text-align: left !important;
    min-height: 230px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border: 1px solid rgba(251, 191, 36, 0.28);
    box-shadow: 0 18px 40px -12px rgba(0, 0, 0, 0.7), 0 0 30px -10px rgba(251, 146, 60, 0.35);
    background:
        linear-gradient(90deg, rgba(6, 9, 18, 0.94) 0%, rgba(6, 9, 18, 0.78) 42%, rgba(6, 9, 18, 0.15) 75%, rgba(6, 9, 18, 0) 100%),
        url("img/banner.webp") right center / cover no-repeat #090c16;
}
body .hero.hero-banner h1 {
    font-size: clamp(1.6rem, 3.4vw, 2.4rem) !important;
    line-height: 1.25;
    max-width: 60%;
}
body .hero.hero-banner .hero-title {
    background: var(--gold-grad);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.6));
}
body .hero.hero-banner p { max-width: 52%; color: #e2e8f0 !important; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8); }
body .hero.hero-banner .social-links { justify-content: flex-start; margin-top: 10px; }

@media (max-width: 700px) {
    body .hero.hero-banner {
        min-height: 0;
        padding: 128px 14px 16px !important;
        text-align: center !important;
        border-radius: 14px;
        background:
            linear-gradient(180deg, rgba(9, 12, 22, 0) 0%, rgba(9, 12, 22, 0.15) 45%, rgba(9, 12, 22, 0.85) 80%, #090c16 100%) center top / 100% 190px no-repeat,
            url("img/banner.webp") 72% top / auto 190px no-repeat #090c16;
    }
    body .hero.hero-banner h1, body .hero.hero-banner p { max-width: none; }
    body .hero.hero-banner .social-links { justify-content: center; }
}

/* ---------- กล่องต่าง ๆ: การ์ดโปร่งแสงขอบทอง ---------- */
:root:not([data-theme="light"]) .random-section,
:root:not([data-theme="light"]) .game-card,
:root:not([data-theme="light"]) .hub-ft,
:root:not([data-theme="light"]) .hub-rank {
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
:root:not([data-theme="light"]) .game-card:hover {
    border-color: rgba(251, 191, 36, 0.55) !important;
    box-shadow: 0 12px 28px -10px rgba(0, 0, 0, 0.8), 0 0 18px -6px rgba(251, 146, 60, 0.5);
}

/* ปุ่มสุ่มแมพ / ปุ่มหลัก เป็นโทนทองส้ม */
:root:not([data-theme="light"]) #randomBtn {
    background: linear-gradient(135deg, #fbbf24, #ea580c) !important;
    color: #1a1204 !important;
    box-shadow: 0 6px 18px rgba(234, 88, 12, 0.35) !important;
}
:root:not([data-theme="light"]) .search-box input {
    background: rgba(12, 15, 26, 0.82) !important;
    border-color: rgba(251, 191, 36, 0.25) !important;
}
:root:not([data-theme="light"]) .search-box input:focus {
    border-color: #fbbf24 !important;
    box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.18) !important;
}

/* ---------- ตัวมาสคอตด้วงในข้อความ (กำลังโหลด / ไม่เจอ / error) ---------- */
.hub-mascot {
    width: 130px;
    height: 130px;
    object-fit: contain;
    display: block;
    margin: 0 auto 8px;
    filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.5));
    animation: hubMascotBob 2.4s ease-in-out infinite;
}
.hub-mascot.small { width: 90px; height: 90px; }
@keyframes hubMascotBob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}
@media (prefers-reduced-motion: reduce) { .hub-mascot { animation: none; } }

/* มือถือจอแคบ: โชว์แค่ไอคอนด้วง ให้ปุ่มบนหัวเว็บมีที่พอ */
@media (max-width: 480px) {
    body .header .logo .logo-text { display: none; }
    body .header .logo .logo-icon { width: 38px; height: 38px; }
}
