/* --- Variables & Core Setup --- */
:root {
    --primary: #6366f1;
    --primary-light: #818cf8;
    --secondary: #f43f5e;
    --accent: #fbbf24;
    --bg-dark: #0f172a;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --font-kanit: 'Kanit', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    height: auto !important;
    width: 100% !important;
    margin: 0;
}

body {
    font-family: var(--font-kanit);
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-x: hidden !important;
    width: 100%;
    position: relative;
}

#login-section.card {
    position: relative;
    width: 100%;
    max-width: 400px;
    padding: 3rem 2rem;
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 40px;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    z-index: 10;
    animation: floating 6s ease-in-out infinite;
    /* อนิเมชั่นลอยขึ้นลง */
}

/* --- Animated Background Blobs --- */
.bg-animations {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    filter: blur(80px);
    overflow: hidden;
}

.blob {
    position: absolute;
    width: 300px;
    height: 300px;
    background: var(--primary);
    border-radius: 50%;
    opacity: 0.3;
    animation: move 20s infinite alternate;
}

.blob:nth-child(2) {
    background: var(--secondary);
    width: 400px;
    height: 400px;
    left: 50%;
    animation-duration: 15s;
}

.blob:nth-child(3) {
    background: #4f46e5;
    width: 250px;
    height: 250px;
    bottom: 10%;
    right: 10%;
    animation-duration: 25s;
}

@keyframes move {
    from {
        transform: translate(-10%, -10%);
    }

    to {
        transform: translate(20%, 30%);
    }
}

/* --- Container & Cards --- */
.container {
    width: 100%;
    max-width: 100%;
    perspective: 1000px;
}

.card {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 32px;
    padding: 40px 30px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    position: relative;
    overflow: hidden;
    transition: transform 0.4s ease;

    /* --- ส่วนที่แก้ไขเพื่อให้อยู่ตรงกลาง --- */
    width: 25% !important;
    /* ปรับเพิ่มความกว้างนิดนึงเพื่อให้ดูไม่ผอมเกินไป */
    min-width: 320px;
    /* ป้องกันการ์ดจิ๋วเกินไปในมือถือ */
    margin: 0 auto !important;
    /* จัดกึ่งกลางแนวนอน */
    display: block;
    /* มั่นใจว่าเป็น Block element */
}

/* --- Login Styles --- */
.brand-wrapper {
    position: relative;
    display: inline-block;
    margin-bottom: 1.5rem;
}

.brand-icon {
    /* ปรับขนาดตามต้องการ */
    width: 200px; 
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 2;
    /* ใช้ filter เพื่อให้แสงฟุ้งตามขอบรูปภาพ (ไม่ใช่รูปสี่เหลี่ยม) */
    filter: drop-shadow(0 0 15px rgba(99, 102, 241, 0.6));
    animation: pulseIcon 2s infinite;
}

.brand-icon img {
    width: 100%;
    height: auto;
    display: block;
    /* ถ้าเป็นรูป PNG ที่มีพื้นหลังใส จะสวยมากครับ */
}

/* Animation ให้รูปขยับเบาๆ */
@keyframes pulseIcon {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.brand-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    /* ใช้สีหลักของคุณ */
    background: #ffffff; 
    /* ปรับค่า blur ให้ฟุ้งตามใจชอบ */
    filter: blur(35px); 
    opacity: 0.5;
    z-index: 1;
    border-radius: 50%; /* แสงต้องเป็นวงกลมเพื่อให้ฟุ้งออกเท่ากันทุกทิศทาง */
    animation: pulse 3s infinite;
    pointer-events: none; /* ป้องกันไม่ให้เผลอไปคลิกโดนแสงแทนรูป */
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.4;
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        opacity: 0.8;
        transform: translate(-50%, -50%) scale(1.4);
    }
}

h1 {
    color: #f8fafc;
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

p {
    color: #94a3b8;
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

/* Input Styles */
.input-group {
    margin-bottom: 1.5rem;
}

.input-box {
    position: relative;
    display: flex;
    align-items: center;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 18px;
    padding: 0 1.2rem;
    transition: all 0.3s ease;
}

.input-box:focus-within {
    border-color: #6366f1;
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.2);
    transform: translateY(-2px);
}

.input-box i {
    color: #6366f1;
    margin-right: 1rem;
}

.input-box input {
    background: transparent;
    border: none;
    color: white;
    padding: 1.2rem 0;
    width: 100%;
    outline: none;
    font-family: 'Kanit';
}

/* Buttons */
.btn-primary {
    position: relative;
    width: 100%;
    padding: 1.2rem;
    border-radius: 18px;
    border: none;
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    color: white;
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.4);
    filter: brightness(1.1);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary i {
    transition: 0.3s;
}

.btn-primary:hover i {
    transform: translateX(5px);
}

@keyframes floating {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-15px);
    }
}

@keyframes pulseIcon {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.fade-in {
    animation: entrance 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes entrance {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.9);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* --- Result Section Styles --- */
.welcome-text {
    letter-spacing: 3px;
    font-size: 0.75rem;
    color: var(--primary-light);
    font-weight: 600;
    margin-bottom: 5px;
}

.display-name {
    font-size: 1.7rem;
    margin-bottom: 15px;
    text-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.id-tag {
    background: rgba(255, 255, 255, 0.05);
    padding: 6px 16px;
    border-radius: 100px;
    font-size: 0.8rem;
    color: var(--text-muted);
    border: 1px solid var(--glass-border);
}

/* Junior Contact Card */
.junior-contact-card {
    width: 100% !important;
    /* บังคับกว้างเต็ม Container หลัก */
    max-width: 100% !important;
    /* กำหนดจุดสูงสุดที่ยังดูสวย (หรือปรับเป็น 100% ถ้าต้องการให้ยาวสุดจอจริงๆ) */
    margin: 20px auto;
    /* จัดกึ่งกลางหน้าจอ */
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border-radius: 27px !important;
    padding: 25px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-sizing: border-box;
    /* สำคัญมาก: กันการ์ดล้นจอเมื่อมี Padding */
}

/* แถม: เอฟเฟกต์ตอน Hover ให้ดูมีชีวิตชีวา */
.junior-contact-card:hover {
    border-color: rgba(99, 102, 241, 0.4);
    background: rgba(255, 255, 255, 0.05);
}

.contact-header {
    display: flex;
    justify-content: space-between;
    /* ดันหัวข้อไปซ้าย ปุ่มแก้ไขไปขวา */
    align-items: center;
    width: 100%;
    margin-bottom: 20px;
}

.btn-edit-glow {
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid var(--primary);
    color: var(--primary-light);
    padding: 6px 14px;
    border-radius: 12px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: 0.3s;
}

.btn-edit-glow:hover {
    background: var(--primary);
    color: white;
}

/* Contact Buttons */
.premium-contact-btn {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    border-radius: 20px;
    text-decoration: none !important; /* เอาเส้นใต้ลิงก์ออก */
    color: #ffffff !important;      /* บังคับตัวอักษรเป็นสีขาว */
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.premium-contact-btn:hover {
    transform: scale(1.02);
    filter: brightness(1.2);
}

.premium-contact-btn .text-wrap {
    flex-grow: 1;
    /* ดันให้พื้นที่ข้อความกินที่มากที่สุด เพื่อให้ลูกศรไปอยู่ขวาสุด */
    display: flex;
    flex-direction: column;
    margin-left: 15px;
}

.fb-gradient {
    background: linear-gradient(-45deg, #1877F2, #0056b3, #4e9af1, #003d80);
    background-size: 400% 400% !important;
    animation: gradientMove 6s ease infinite;
}

.ig-gradient {
    background: linear-gradient(-45deg, #833AB4, #FD1D1D, #FCAF45, #5851DB);
    background-size: 400% 400% !important;
    animation: gradientMove 10s ease infinite;
}

@keyframes gradientMove {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.icon-wrap {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    font-size: 1.2rem;
}

.text-wrap {
    display: flex;
    flex-direction: column;
    margin-left: 15px;
    flex-grow: 1;
}

.text-wrap .label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.7); /* สีขาวจางๆ */
    margin-bottom: 2px;
}

.text-wrap .value {
    font-size: 1.1rem;
    font-weight: 600;
    color: #ffffff; /* สีขาวสด */
}

.icon-wrap i, .arrow-icon {
    color: #ffffff;
    opacity: 0.9;
}

/* Timeline */
.code-line-timeline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 35px 0;
}

.timeline-step {
    text-align: center;
    flex: 1;
}

.icon-pulse {
    width: 55px;
    height: 55px;
    background: var(--glass-bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 10px;
    border: 2px solid var(--glass-border);
    color: var(--text-muted);
}

.timeline-step.active .icon-pulse {
    background: var(--primary);
    color: white;
    border-color: var(--primary-light);
    box-shadow: 0 0 20px var(--primary);
    animation: iconPulse 2s infinite;
}

@keyframes iconPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.7);
    }

    70% {
        box-shadow: 0 0 0 15px rgba(99, 102, 241, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0);
    }
}

.timeline-connector {
    height: 2px;
    flex-grow: 1;
    background: var(--glass-border);
    margin: 0 10px;
    position: relative;
    top: -15px;
}

/* Senior Card */
.senior-card-modern {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.1) 0%, rgba(0, 0, 0, 0.4) 100%);
    border: 1px solid rgba(251, 191, 36, 0.3);
    border-radius: 27px !important;
    padding: 30px 20px;
    animation: slideUp 0.6s ease-out;
    width: 100% !important;
}

.card-status-header {
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 2px;
    margin-bottom: 15px;
}

.senior-alias-title {
    color: var(--accent);
    font-size: 1.8rem;
    margin-bottom: 10px;
}

.modern-contact-hint {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-style: italic;
}

/* --- Misc & Animations --- */
.btn-logout {
    width: 100%;
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    padding: 12px;
    border-radius: 15px;
    margin-top: 30px;
    cursor: pointer;
    transition: 0.3s;
}

.btn-logout:hover {
    background: rgba(244, 63, 94, 0.1);
    color: var(--secondary);
    border-color: var(--secondary);
}

.fade-in {
    animation: fadeIn 0.8s ease-out forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.waiting-anim i {
    font-size: 1.8rem;
    color: var(--accent);
    animation: rotate 2s linear infinite;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.d-none {
    display: none !important;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* ปรับแต่งตัวเลือก Dropdown (Select) */
#contact-type-select {
    appearance: none !important;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236366f1'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 15px center !important;
    background-size: 18px !important;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

#contact-type-select:focus {
    border-color: #6366f1 !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2) !important;
    outline: none;
}

/* ปรับแต่งช่องกรอกข้อมูล (Input) */
#swal-input-val {
    transition: all 0.3s ease !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06) !important;
}

#swal-input-val:focus {
    border-color: #6366f1 !important;
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.3) !important;
    background: rgba(15, 23, 42, 0.8) !important;
}

/* ปรับแต่งปุ่มใน Swal */
.swal2-confirm {
    padding: 12px 30px !important;
    font-weight: 500 !important;
    letter-spacing: 0.5px !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4) !important;
}

.swal2-cancel {
    color: #94a3b8 !important;
    font-weight: 400 !important;
}

.swal2-cancel:hover {
    background: transparent !important;
    color: #f8fafc !important;
    text-decoration: underline !important;
}

/* ปรับแต่งกรอบ Modal */
.swal2-popup.rounded-24 {
    border-radius: 24px !important;
    border: 1px solid rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
}

/* Container หลัก */
.empty-state-text {
    width: 100%;
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    border: 2px dashed rgba(255, 255, 255, 0.1);
    border-radius: 20px;
}

/* Responsive: ถ้าหน้าจอเล็กกว่า 576px (มือถือ) ให้ลด Padding ลงนิดหน่อย */
@media (max-width: 576px) {
    .junior-contact-card {
        padding: 15px;
        border-radius: 15px;
    }
}

/* แอนิเมชันไอคอนผี */
.empty-icon-anim {
    font-size: 2.5rem;
    color: #94a3b8;
    margin-bottom: 15px;
    animation: floatGhost 3s ease-in-out infinite;
    /* ใส่แอนิเมชันลอย */
}

@keyframes floatGhost {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
        color: #6366f1;
    }

    /* ลอยขึ้นและเปลี่ยนสีเป็นม่วงจางๆ */
}

/* ข้อความบรรยาย */
.empty-state-text p {
    font-size: 0.95rem;
    color: #94a3b8;
    margin-bottom: 15px;
    font-weight: 300;
}

/* ปุ่มเพิ่มข้อมูลตอนนี้ (Modern Style) */
.btn-add-now {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    /* ไล่เฉดม่วง-น้ำเงิน */
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 500;
    font-family: 'Kanit', sans-serif;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-add-now:hover {
    transform: translateY(-3px) scale(1.05);
    /* เด้งขึ้นเล็กน้อยตอนชี้ */
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
    filter: brightness(1.1);
}

.btn-add-now:active {
    transform: translateY(0) scale(0.95);
    /* เอฟเฟกต์ตอนกดลงไป */
}

/* เพิ่ม Icon Plus หน้าปุ่มผ่าน CSS (ถ้าไม่อยากแก้ HTML) */
.btn-add-now::before {
    content: '\f067';
    /* FontAwesome Plus */
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    font-size: 0.8rem;
}

/* Container หลัก */
.search-wrapper {
    background: rgba(30, 41, 59, 0.4);
    backdrop-filter: blur(12px);
    border-radius: 32px;
    padding: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    width: 100% !important;
    height: auto !important;
}

/* Radar Animation - ปรับขนาดให้เล็กลงและกระชับขึ้น */
.radar-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 80px;        /* ลดจาก 120px */
    width: 80px;         /* กำหนดความกว้างให้เท่ากับความสูง */
    margin: 0 auto 15px; /* จัดกึ่งกลางและลดระยะห่างด้านล่าง */
}

.waiting-anim {
    font-size: 2.2rem;   /* ลดจาก 2.8rem ให้ดูพอดีกับกล่องใหม่ */
    color: #6366f1;
    filter: drop-shadow(0 0 8px rgba(99, 102, 241, 0.4));
    z-index: 5;
    animation: floatIcon 3s ease-in-out infinite;
}

.radar-ring {
    position: absolute;
    width: 30px;         /* ลดขนาดเริ่มต้นของวงแหวน */
    height: 30px;
    border-radius: 50%;
    border: 1.5px solid #6366f1; /* เส้นบางลงเพื่อให้ดูสะอาดตา */
    opacity: 0;
    animation: radarPulse 3s linear infinite;
}

/* Animations ปรับระยะการเคลื่อนที่ให้เข้ากับขนาดใหม่ */
@keyframes floatIcon {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); } /* ลอยขึ้นน้อยลงตามสัดส่วน */
}

@keyframes radarPulse {
    0% {
        transform: scale(1);
        opacity: 0.6;
    }
    100% {
        transform: scale(2.2); /* ขยายออกพอประมาณไม่ให้ล้นจอ */
        opacity: 0;
    }
}

.delay-1 { animation-delay: 1s; }
.delay-2 { animation-delay: 2s; }

/* Status Badge */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    /* Emerald */
    padding: 6px 16px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 1px;
    margin-bottom: 15px;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.pulse-dot {
    width: 6px;
    height: 6px;
    background: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 8px #10b981;
    animation: blink 1.2s infinite;
}

/* Typography */
.search-title {
    font-family: 'Kanit', sans-serif;
    font-weight: 600;
    color: #f8fafc;
    margin-bottom: 10px;
    letter-spacing: 0.5px;
}

.search-subtitle {
    font-family: 'Kanit', sans-serif;
    color: #94a3b8;
    font-size: 0.9rem;
    line-height: 1.6;
    font-weight: 300;
    margin-bottom: -5px;
}

/* --- Animations --- */
@keyframes radarPulse {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }

    100% {
        transform: scale(3);
        opacity: 0;
    }
}

@keyframes floatIcon {

    0%,
    100% {
        transform: translateY(0) rotate(0);
    }

    50% {
        transform: translateY(-10px) rotate(5deg);
    }
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.4;
        transform: scale(1.2);
    }
}

.result-scroll-container {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    justify-content: center !important;
    /* กึ่งกลางแนวนอน */
    align-items: center !important;
    
}

#result-section {
    display: flex;
    flex-direction: column;
    justify-content: center; /* จัดเนื้อหาภายในให้อยู่กลางแนวตั้ง */
    align-items: center;     /* จัดเนื้อหาภายในให้อยู่กลางแนวนอน */
    
    width: 100% !important;
    height: 90% !important;  /* ถ้าใช้ 100% จะมองไม่เห็นความต่างว่าอยู่กลางไหม */
    
    /* หัวใจสำคัญ: ใช้ margin: auto เพื่อดันกล่องให้อยู่กลาง Parent */
    margin: auto !important; 
    
    overflow-y: auto;
}


#result-section::before {
    content: '';
    position: absolute;
    top: 15%;
    left: -10%;
    width: auto;
    height: auto;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.1) 0%, transparent 70%);
    pointer-events: none;
}

#result-section::after {
    content: '';
    position: absolute;
    bottom: 10%;
    right: -10%;
    width: auto;
    height: auto;
    background: radial-gradient(circle, rgba(244, 63, 94, 0.08) 0%, transparent 70%);
    pointer-events: none;
}

/* --- Developer Attribution Style --- */
.developer-attribution {
    margin-top: 30px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    animation: fadeIn 1.5s ease-out;
}

.attr-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.dev-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.03);
    padding: 8px 16px;
    border-radius: 100px;
    border: 1px solid var(--glass-border);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: default;
}

.dev-badge i {
    font-size: 0.9rem;
    color: var(--primary-light);
}

.dev-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-main);
    letter-spacing: 0.5px;
}

/* Hover Effect */
.dev-badge:hover {
    background: rgba(99, 102, 241, 0.1);
    border-color: var(--primary);
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.dev-badge:hover i {
    animation: spinCode 0.8s ease-in-out;
}

@keyframes spinCode {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ปรับให้ชิดล่างจอเสมอ (ถ้าต้องการให้ลอย) */
@media (min-height: 800px) {
    .developer-attribution {
        position: relative;
        bottom: 0;
    }
}

/* --- Social Buttons ใน Attribution --- */
.dev-socials {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 15px;
}

.social-btn {
    width: 45px;            /* ปรับขนาดตามต้องการ */
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 15px;    /* ถ้าอยากได้วงกลมให้ใช้ 50% */
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* --- ส่วนที่ทำให้รูปเต็มขอบ --- */
    padding: 0;             /* เอาช่องว่างออก */
    overflow: hidden;       /* ตัดส่วนเกินของรูปที่ล้นขอบออก */
}

/* เอฟเฟกต์ตอน Hover แยกตามสี */
.social-btn:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary-light);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

/* สีฟ้าสำหรับ Facebook */
.social-btn.fb:hover {
    background: #1877F2;
    border-color: #1877F2;
    box-shadow: 0 0 15px rgba(24, 119, 242, 0.5);
}

/* สีม่วง/น้ำเงินสำหรับ Website หรือลิงก์ทั่วไป */
.social-btn.globe:hover {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.5);
}

/* ปรับระยะห่างของ Attribution หลัก */
.developer-attribution {
    margin-top: 25px;
    margin-bottom: 10px;
}

.social-img {
    width: 100%;
    height: 100%;
    object-fit: contain;    /* ให้รูปปรับขนาดพอดีโดยไม่เสียสัดส่วน */
    transition: transform 0.3s ease;
}

.social-btn:hover .social-img {
    transform: scale(1.1);  /* รูปขยายขึ้นเล็กน้อยตอนชี้ */
}

.jumpscare-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

#jumpscare-img {
    max-width: 90%;
    max-height: 80vh;
    object-fit: contain;
    
    /* --- เอฟเฟกต์จางทุกทิศทางแบบฟุ้งกระจาย (Ultra Soft Edges) --- */
    -webkit-mask-image: radial-gradient(
        circle, 
        black 0%,               /* เริ่มที่จุดกึ่งกลางจุดเดียว */
        rgba(0, 0, 0, 0.8) 20%,  /* เริ่มจางอย่างรวดเร็วตั้งแต่ช่วงต้น */
        rgba(0, 0, 0, 0.3) 50%,  /* จางลงมากในช่วงกลาง */
        transparent 75%         /* จางหายไปสนิทก่อนถึงขอบรูปเยอะๆ */
    );
    mask-image: radial-gradient(
        circle, 
        black 0%, 
        rgba(0, 0, 0, 0.8) 20%, 
        rgba(0, 0, 0, 0.3) 50%, 
        transparent 75%
    );

    /* ปรับแสงให้ดูหลอนๆ แบบวิญญาณ */
    filter: brightness(1.3) contrast(1.2) blur(0.5px); 
    
    animation: zoomScare 0.15s ease-out forwards;
}

@keyframes zoomScare {
    from { 
        transform: scale(0.3); 
        opacity: 0; 
    }
    to { 
        transform: scale(1.1); /* ขยายมาขนาดปกติแบบสั่นๆ */
        opacity: 1; 
    }
}

.jumpscare-text {
    color: red;
    font-size: 3rem;
    font-family: 'Kanit';
    margin-top: 20px;
    text-shadow: 0 0 20px rgba(255,0,0,0.8);
}

/* ใส่สั่นที่ตัว Overlay เลย */
.active-jumpscare {
    display: flex !important;
    animation: shake 0.1s infinite;
}

@keyframes shake {
    0% { transform: translate(2px, 2px); }
    50% { transform: translate(-2px, -2px); }
    100% { transform: translate(2px, -2px); }
}