:root {
            --primary-color: #4f46e5;
            --bg-color: #f8fafc;
            --card-bg: #ffffff;
            --text-main: #1e293b;
            --text-sub: #64748b;
            --accent-color: #10b981;
            --hover-color: #f1f5f9;
        }

        body {
            font-family: 'Kanit', sans-serif, system-ui;
            background-color: var(--bg-color);
            background-image: url('https://siamboardgames.com/wp-content/uploads/2026/03/background.webp');
            background-size: cover;
            background-position: center;
            background-attachment: fixed;
            margin: 0;
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
            padding: 20px;
            box-sizing: border-box;
        }

        .main-container {
            display: flex;
            flex-direction: row;
            align-items: flex-start;
            justify-content: center;
            gap: 30px;
            max-width: 900px;
            width: 100%;
            flex-wrap: wrap;
        }

        /* --- คอลัมน์ซ้าย: โลโก้ + ช่องค้นหา --- */
        .left-column {
            flex: 1;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 20px;
            min-width: 300px;
            width: 100%;
        }

        .logo-img {
            width: 100%;
            max-width: 320px;
            height: auto;
            filter: drop-shadow(0 5px 15px rgba(0,0,0,0.1));
        }

        .search-card {
            background: var(--card-bg);
            padding: 1.5rem;
            border-radius: 1.2rem;
            box-shadow: 0 15px 25px -5px rgba(0, 0, 0, 0.1);
            width: 100%;
            box-sizing: border-box;
        }

        .search-card h2 {
            font-size: 1.2rem;
            color: var(--primary-color);
            margin: 0 0 10px 0;
            text-align: center;
        }

        /* กล่องห่อหุ้มสำหรับทำ Dropdown แบบลอย */
        .search-wrapper {
            position: relative;
            width: 100%;
        }

        #search-input {
            width: 100%;
            border: 2px solid var(--primary-color);
            padding: 1rem;
            font-size: 1.1rem;
            border-radius: 0.6rem;
            box-sizing: border-box;
            transition: all 0.2s;
        }

        #search-input:focus {
            outline: none;
            box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
        }

        /* --- การตั้งค่า Dropdown ที่ลอยอยู่เหนือ Object อื่น --- */
        .search-results {
            position: absolute; /* ลอยอิสระ ไม่ดัน Object อื่นลงไป */
            top: 100%; /* อยู่ต่อจากด้านล่างของช่อง Input พอดี */
            left: 0;
            width: 100%;
            margin-top: 5px; /* เว้นระยะห่างจากช่องกรอกเล็กน้อย */
            background: white;
            border-radius: 0.6rem;
            border: 1px solid #cbd5e1;
            box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2); /* เพิ่มเงาให้ดูมีมิติว่าลอยอยู่ */
            z-index: 100; /* อยู่ Layer บนสุด ทับกล่องคำนวณฝั่งขวาแน่นอน */
            
            /* จำกัดความสูงและเปิดระบบ Scroll */
            max-height: 260px; 
            overflow-y: auto; 
            
            display: none; 
        }

        /* แต่ง Scrollbar ให้ดูสวยขึ้น (เฉพาะ Chrome/Safari/Edge) */
        .search-results::-webkit-scrollbar {
            width: 8px;
        }
        .search-results::-webkit-scrollbar-track {
            background: #f1f5f9; 
            border-radius: 0 0.6rem 0.6rem 0;
        }
        .search-results::-webkit-scrollbar-thumb {
            background: #cbd5e1; 
            border-radius: 4px;
        }
        .search-results::-webkit-scrollbar-thumb:hover {
            background: #94a3b8; 
        }

        .search-item {
            padding: 12px 15px;
            border-bottom: 1px solid #f1f5f9;
            cursor: pointer;
            transition: background 0.2s;
            display: flex;
            flex-direction: column;
        }

        .search-item:hover {
            background-color: var(--hover-color);
        }

        .search-item:last-child {
            border-bottom: none;
        }

        .game-title {
            font-weight: 600;
            color: var(--text-main);
        }

        .game-meta {
            font-size: 0.8rem;
            color: var(--text-sub);
            margin-top: 4px;
        }

        .badge {
            display: inline-block;
            padding: 2px 6px;
            border-radius: 4px;
            font-size: 0.7rem;
            font-weight: bold;
            margin-left: 8px;
        }

        .badge.internal { background: #dbeafe; color: #1e40af; }
        .badge.bgg { background: #fef08a; color: #854d0e; }

        /* --- คอลัมน์ขวา: เครื่องคิดเลข --- */
        .card {
            background: var(--card-bg);
            padding: 2.5rem;
            border-radius: 1.5rem;
            box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
            width: 100%;
            max-width: 400px;
            flex: 1;
            min-width: 300px;
            box-sizing: border-box;
        }

        h1 { font-size: 1.6rem; margin-bottom: 0.5rem; text-align: center; color: var(--primary-color); font-weight: 700; }
        p.subtitle { text-align: center; font-size: 0.9rem; color: var(--text-sub); margin-bottom: 1.5rem; }

        .input-group { margin-bottom: 1.2rem; }
        label { display: block; font-size: 0.9rem; font-weight: 600; margin-bottom: 0.4rem; }
        input[type="number"] {
            width: 100%; padding: 0.8rem; border: 1px solid #e2e8f0;
            border-radius: 0.6rem; font-size: 1rem; box-sizing: border-box;
            transition: all 0.2s;
        }
        input[type="number"]:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15); }
        
        button {
            width: 100%; padding: 1rem; background-color: var(--primary-color); color: white;
            border: none; border-radius: 0.6rem; font-size: 1.1rem; font-weight: 600;
            cursor: pointer; margin-top: 1rem; transition: transform 0.1s, background-color 0.2s;
        }
        button:active { transform: scale(0.98); }
        button:hover { background-color: #4338ca; }

        #result-area {
            margin-top: 1.5rem; padding: 1.2rem; background-color: #f1f5f9;
            border-radius: 0.8rem; display: none; text-align: center; border: 2px dashed #cbd5e1;
        }
        .ref-label { font-size: 0.8rem; color: var(--text-sub); text-transform: uppercase; letter-spacing: 0.05em; }
        .ref-value { font-size: 1.4rem; font-weight: bold; display: block; margin-bottom: 0.8rem; color: var(--text-main); }
        .band-size { font-size: 1.8rem; font-weight: 800; color: var(--primary-color); display: block; }

        @media (max-width: 768px) {
            .main-container { flex-direction: column; align-items: center; }
            .left-column { min-width: 100%; }
            .card { min-width: 100%; padding: 1.5rem; }
            h1 { font-size: 1.4rem; }
            
            /* เมื่อเป็นจอมือถือ กล่องจะแคบลงมาบังปุ่มคำนวณ ให้แน่ใจว่า Scroll ได้ชัดเจน */
            .search-results { max-height: 200px; }
        }
        
        /* --- Floating Social Button --- */
        .floating-social {
            position: fixed;
            bottom: 30px;
            right: 30px;
            display: flex;
            flex-direction: column;
            align-items: center;
            z-index: 1000;
        }

        .social-links {
            display: flex;
            flex-direction: column;
            gap: 15px;
            margin-bottom: 15px;
            /* ซ่อนปุ่มไว้ก่อน และทำให้ค่อยๆ เลื่อนขึ้นมา */
            opacity: 0;
            visibility: hidden;
            transform: translateY(20px);
            transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
        }

        /* เมื่อ Hover ที่คอนเทนเนอร์หลัก ให้แสดงปุ่ม */
        .floating-social:hover .social-links {
            opacity: 1;
            visibility: visible;
            transform: translateY(0);
        }

        .social-icon {
            width: 50px;
            height: 50px;
            border-radius: 50%;
            display: flex;
            justify-content: center;
            align-items: center;
            color: white;
            text-decoration: none;
            box-shadow: 0 4px 10px rgba(0,0,0,0.15);
            transition: transform 0.2s;
            position: relative;
        }

        .social-icon:hover {
            transform: scale(1.1);
        }

        .social-icon svg {
            width: 24px;
            height: 24px;
            fill: currentColor;
        }

        /* สีประจำแต่ละแพลตฟอร์ม */
        .icon-facebook { background-color: #1877F2; }
        .icon-line { background-color: #00B900; }
        .icon-shopee { background-color: #EE4D2D; }

        /* ปุ่มหลัก (Main FAB) */
        .main-fab {
            width: 60px;
            height: 60px;
            border-radius: 50%;
            background-color: var(--primary-color);
            color: white;
            border: none;
            box-shadow: 0 5px 15px rgba(79, 70, 229, 0.4);
            cursor: pointer;
            display: flex;
            justify-content: center;
            align-items: center;
            font-size: 24px;
            transition: transform 0.3s;
            margin-top: 0; /* Override default button margin */
        }

        .floating-social:hover .main-fab {
            transform: rotate(360deg);
            background-color: #4338ca;
        }

        /* Responsive มือถือ */
        @media (max-width: 768px) {
            .floating-social {
                bottom: 20px;
                right: 20px;
            }
            .main-fab { width: 55px; height: 55px; }
            .social-icon { width: 45px; height: 45px; }
        }
