/* ================= 🎨 Custom Scrollbar (บังคับเปลี่ยนทั้งเว็บ) ================= */
*::-webkit-scrollbar {
    width: 15px; /* ขยายให้กว้างขึ้นนิดนึงจะได้จับง่ายๆ */
}

*::-webkit-scrollbar-track {
    background: var(--bg-main); 
    background-color: #153b3d; /* สีมิ้นต์ตอนเอาเมาส์ชี้ */
}

*::-webkit-scrollbar-thumb {
    background-color: #64ffda; /* สีเทาเข้ม */
    border-radius: 20px;
    border: 3px solid var(--bg-main); /* ขอบหนาขึ้นเพื่อให้ดูเล็กลงและมนขึ้น */
}

*::-webkit-scrollbar-thumb:hover {
    background-color: #22b7c2; /* สีมิ้นต์ตอนเอาเมาส์ชี้ */
}

/* ================= CSS Variables & Reset ================= */
:root {
    --bg-main: #121212;
    --bg-alt: #1a1a1a;
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0a0;
    --accent: #64ffda;

    --font-heading: 'Space Grotesk', 'Prompt', sans-serif;
    --font-body: 'Inter', 'Prompt', sans-serif;

    --section-spacing: 100px;
    --container-width: 1000px;
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ================= 🎨 Custom Text Selection (เปลี่ยนสีตอนไฮไลท์คลุมดำ) ================= */
::selection {
    background-color: var(--accent);
    color: #121212; 
}

::-moz-selection { 
    background-color: var(--accent);
    color: #121212;
}

/* ================= 🚀 FINAL IPAD & TABLET FIX (แก้จอทะลุในแท็บเล็ต 100%) ================= */

/* 1. บังคับเบราว์เซอร์ตระกูล Safari / iOS ไม่ให้ดื้อ */
html, body {
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch !important; /* ให้เลื่อนจอใน iPad สมูทขึ้น */
}

/* 2. จัดการหน้าจอมือถือโดยเฉพาะ */
@media (max-width: 768px) {
    /* 🔴 ซ่อนปุ่มวงกลมและกล่องเครื่องมือสี */
    .gui-floating-btn, .dg.ac {
        display: none !important; 
    }

    /* 🔴 ป้องกันตัวอักษรพิมพ์ดีดดันขอบจอให้ทะลุ */
    .typing-wrapper {
        max-width: 90vw; /* บังคับให้กว้างไม่เกินหน้าจอ */
        overflow: hidden; 
    }
    
    /* ปรับลดขนาดฟอนต์นิดนึง จะได้อยู่พอดีบรรทัด ไม่ดันจอ */
    #hero h1 {
        font-size: 2.2rem !important;
    }
    .role-title {
        font-size: 1.4rem !important; 
    }
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-body);
    line-height: 1.6;
    overflow-x: hidden;
}


/* Utility Classes */
.container {
    width: 90%;
    max-width: var(--container-width);
    margin: 0 auto;
}

.section-pad {
    padding: var(--section-spacing) 0;
}

.bg-alt {
    background-color: var(--bg-alt);
}

.accent-text {
    color: var(--accent);
}

h1, h2, h3, h4 {
    font-family: var(--font-heading);
    color: #ffffff;
    font-weight: 700;
}

a {
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
}

.section-title {
    font-size: clamp(1.5rem, 4vw, 2rem);
    margin-bottom: 3rem;
    display: flex;
    align-items: center;
    letter-spacing: 6px;
}

.section-title::after {
    content: "";
    display: block;
    height: 1px;
    background-color: #333;
    flex-grow: 1;
    margin-left: 20px;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.8rem 1.5rem;
    border-radius: 4px;
    font-family: var(--font-heading);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    border: 1px solid var(--accent);
    color: var(--accent);
    background: transparent;
}

.btn-primary:hover {
    background: rgba(100, 255, 218, 0.1);
    transform: translateY(-3px);
    box-shadow: 0 0 15px rgba(100, 255, 218, 0.4), 0 0 30px rgba(100, 255, 218, 0.2);
}

/* ================= HERO SECTION ================= */
#hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding-top: 0;
}

.hero-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    background: rgba(100, 255, 218, 0.1);
    border-radius: 50px;
    color: var(--accent);
    font-family: var(--font-heading);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.status-dot {
    height: 10px;
    width: 10px;
    background-color: var(--accent);
    border-radius: 50%;
    margin-right: 10px;
    box-shadow: 0 0 0 rgba(100, 255, 218, 0.4);
}

#hero h1 {
    font-size: clamp(2.5rem, 7vw, 4.5rem);
    line-height: 1.1;
    margin-bottom: 1rem;
}

.role-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.hero-desc {
    max-width: 500px;
    color: var(--text-secondary);
    margin-bottom: 2.5rem;
    font-size: 1.1rem;
}

/* Animation: Fade In Up */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in-up {
    animation: fadeInUp 1s ease-out forwards;
}

/* Animation: Pulse for Status Dot */
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(100, 255, 218, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(100, 255, 218, 0); }
    100% { box-shadow: 0 0 0 0 rgba(100, 255, 218, 0); }
}

.pulse {
    animation: pulse 2s infinite;
}

/* 3. Typing Effect */
.typing-wrapper {
    display: inline-block;
}

.typing-text {
    overflow: hidden;
    white-space: nowrap;
    border-right: 3px solid var(--accent);
    width: 0;
    animation: typing 2s steps(30, end) forwards, blink-caret 0.75s step-end infinite;
    animation-delay: 1s;
}

@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes blink-caret {
    from, to { border-color: transparent; }
    50% { border-color: var(--accent); }
}

/* ================= ABOUT SECTION (Bento Box UI) ================= */
.about-bento-grid {
    display: grid;
    grid-template-columns: 450px 1fr; 
    gap: 1.5rem;
}

.bento-middle-right {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.bento-bottom-split {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 1.5rem;
    flex: 1;
}

.bento-card {
    background-color: var(--bg-alt);
    border: 1px solid #333;
    border-radius: 24px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.bento-card:hover {
    border-color: #555;
}

/* 1. รูปภาพ (ซ้าย) */
.photo-card {
    padding: 0;
    overflow: hidden;
    position: relative;
    min-height: 500px;
}

.profile-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.photo-card:hover .profile-img {
    transform: scale(1.05);
}

.photo-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(18, 18, 18, 0.85);
    backdrop-filter: blur(10px);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border-top: 1px solid #333;
}

.caption-icon {
    width: 45px;
    height: 45px;
    min-width: 45px;
    border-radius: 12px;
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.caption-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.caption-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    letter-spacing: 1px;
    display: block;
    margin-bottom: 0.2rem;
}

.caption-text p {
    margin: 0;
    font-weight: 600;
    font-size: 0.95rem;
    color: #fff;
    line-height: 1.4;
}

/* 2. Statement (บนกลาง) */
.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-bottom: 1.5rem;
}

.card-tags .tag {
    padding: 0.4rem 1rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
    background: rgba(100, 255, 218, 0.1);
    color: var(--accent);
    letter-spacing: 0.5px;
}

.card-tags .tag.outline {
    background: transparent;
    border: 1px solid #444;
    color: var(--text-secondary);
}

.statement-text { 
    font-family: var(--font-body); 
    font-size: 1.4rem; 
    line-height: 1.6; 
    color: #fff; 
    margin: 0; 
    font-weight: 500;
    display: inline-block; 
    transform: scaleY(1.1);
    transform-origin: left top;
    letter-spacing: 1px; 
}

/* 3D FLIP CARD EFFECT */
.bento-card.statement-card {
    padding: 0;
    background-color: transparent;
    border: none;
    perspective: 1000px;
}

.flip-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s cubic-bezier(0.4, 0.2, 0.2, 1);
    transform-style: preserve-3d;
}

.flip-inner.is-flipped {
    transform: rotateY(180deg);
}

.flip-front, .flip-back {
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border-radius: 24px;
    padding: 2rem;
    background-color: var(--bg-alt); 
    border: 1px solid #333;
    display: flex;
    flex-direction: column;
}

.flip-back {
    position: absolute;
    top: 0;
    left: 0;
    transform: rotateY(180deg);
    border-color: var(--accent);
}

.flip-btn, .flip-btn-back {
    cursor: pointer;
    transition: all 0.3s ease;
}

.flip-btn:hover, .flip-btn-back:hover {
    background-color: rgba(100, 255, 218, 0.15) !important;
    border-color: var(--accent) !important;
    color: var(--accent) !important;
    transform: translateY(-2px);
}

/* 3. Profile Info (ล่างกลาง) */
.card-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
}

.card-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    letter-spacing: 1px;
    font-weight: 700;
}

.card-title {
    font-size: 1.4rem;
    margin-top: 0.3rem;
}

.header-icon {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: 1px solid #444;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
}

.profile-info-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    background: var(--bg-main);
    padding: 1rem 1.2rem;
    border-radius: 16px;
    border: 1px solid #2a2a2a;
}

.info-icon {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    font-size: 1.1rem;
}

.info-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    letter-spacing: 1px;
    display: block;
    margin-bottom: 0.2rem;
    font-weight: 600;
}

.info-text p {
    margin: 0;
    font-weight: 600;
    color: #fff;
    font-size: 0.95rem;
}

/* 4. Highlight Card (กล่องขวาสุด สี Accent) */
.highlight-card {
    background-color: var(--accent);
    border: none;
}

.highlight-card .card-label.dark {
    color: rgba(0, 0, 0, 0.6);
}

.highlight-card .card-title.dark {
    color: #121212;
    font-size: 1.6rem;
    margin-bottom: 1.5rem;
    line-height: 1.3;
}

.highlight-desc {
    color: rgba(0, 0, 0, 0.8);
    line-height: 1.6;
    font-weight: 500;
    font-size: 0.95rem;
    margin-bottom: 2rem;
}

.highlight-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: auto;
}

.btn-solid-dark {
    background: #121212;
    color: #fff;
    text-align: center;
    border: none;
    border-radius: 50px;
    padding: 1rem;
    font-weight: 600;
    transition: 0.3s;
}

.btn-solid-dark:hover {
    background: #333;
    color: #fff;
    transform: translateY(-3px);
}

.btn-outline-dark {
    background: transparent;
    color: #121212;
    text-align: center;
    border: 1px solid rgba(0, 0, 0, 0.3);
    border-radius: 50px;
    padding: 1rem;
    font-weight: 600;
    transition: 0.3s;
}

.btn-outline-dark:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* ================= PROJECTS SECTION ================= */
.project-list {
    list-style: none;
    counter-reset: project-counter;
    padding-left: 0;
}

.project-item {
    counter-increment: project-counter;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 2rem;
    margin-bottom: 4rem;
    background-color: var(--bg-main);
    border: 1px solid #333;
    border-radius: 12px;
    padding: 2.5rem;
    transition: all 0.3s ease;
    align-items: center;
}

.project-item:hover {
    border-color: var(--accent);
    transform: translateY(-5px);
    box-shadow: 0 10px 30px -15px rgba(100, 255, 218, 0.2);
}

/* ================= อัปเดต PROJECTS (แก้ระบบรันตัวเลข 01-09, 10+) ================= */
.project-item::before {
    /* 💡 ใช้ decimal-leading-zero เพื่อให้ CSS จัดการเลข 0 อัตโนมัติ */
    content: counter(project-counter, decimal-leading-zero) ".";
    
    font-family: var(--font-heading);
    font-size: 3rem;
    font-weight: 700;
    color: var(--accent);
    opacity: 0.5;
}

.project-title {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.project-desc {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    max-width: 100%;
    line-height: 1.7;
}

.project-tech {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    list-style: none;
    margin-bottom: 1.5rem;
    font-family: var(--font-heading);
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.project-links a {
    margin-right: 1.5rem;
    font-family: var(--font-heading);
    font-weight: 500;
}

.project-links a:hover {
    color: var(--accent);
}

/* Project Status Badges */
.status-badge-project {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.8rem;
    border-radius: 50px;
    font-size: 0.7rem;
    font-family: var(--font-heading);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px; 
}

.status-badge-project .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}

.status-badge-project.online {
    background-color: rgba(100, 255, 218, 0.1);
    color: var(--accent);
    border: 1px solid rgba(100, 255, 218, 0.2);
}

.status-badge-project.online .status-dot {
    background-color: var(--accent);
    animation: pulse-online 2s infinite;
}

@keyframes pulse-online {
    0% { box-shadow: 0 0 0 0 rgba(100, 255, 218, 0.7); }
    70% { box-shadow: 0 0 0 8px rgba(100, 255, 218, 0); }
    100% { box-shadow: 0 0 0 0 rgba(100, 255, 218, 0); }
}

.status-badge-project.offline {
    background-color: rgba(242, 63, 66, 0.1);
    color: #f23f42;
    border: 1px solid rgba(242, 63, 66, 0.2);
}

.status-badge-project.offline .status-dot {
    background-color: #f23f42;
    animation: pulse-offline 2s infinite;
}

@keyframes pulse-offline {
    0% { box-shadow: 0 0 0 0 rgba(242, 63, 66, 0.7); }
    70% { box-shadow: 0 0 0 8px rgba(242, 63, 66, 0); }
    100% { box-shadow: 0 0 0 0 rgba(242, 63, 66, 0); }
}

/* ================= CERTIFICATES SECTION ================= */
.cert-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.cert-card {
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-alt);
    border-radius: 8px;
    border: 1px solid #333;
    transition: all 0.3s ease;
}

.cert-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent);
}

.cert-info {
    padding: 1.5rem 2rem 2rem 2rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex-grow: 1;
}

.cert-img-wrapper {
    width: 100%;
    aspect-ratio: 297 / 210;
    height: auto;
    overflow: hidden;
    border-bottom: 1px solid #333;
    background-color: #0a0a0a;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cert-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.5s ease;
    cursor: pointer;
}

.cert-card:hover .cert-img {
    transform: scale(1.08);
}

.cert-title {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    line-height: 1.4;
}

.cert-issuer, .cert-date {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.cert-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 0.5rem;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cert-link {
    margin-top: 1.5rem;
    display: inline-block;
    font-family: var(--font-heading);
    font-weight: 500;
    font-size: 0.9rem;
}

/* ================= POPUPS / MODALS ================= */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--bg-alt);
    border: 1px solid var(--accent);
    border-radius: 12px;
    padding: 2rem;
    width: 90%;
    max-width: 600px;
    position: relative;
    transform: translateY(30px);
    transition: all 0.3s ease;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.3s;
}

.modal-close:hover {
    color: var(--accent);
}

.modal-img-full {
    width: 100%;
    aspect-ratio: 297 / 210;
    object-fit: contain;
    background-color: #000;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    border: 1px solid #333;
}

.modal-title {
    font-size: 1.5rem;
    margin-bottom: 0.2rem;
}

.modal-subtitle {
    color: var(--accent);
    font-size: 0.9rem;
    font-weight: 600;
}

.modal-divider {
    border: 0;
    height: 1px;
    background: #333;
    margin: 1rem 0;
}

.modal-desc-full {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.6;
}

/* Lightbox */
.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.lightbox-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.lightbox-img {
    max-width: 90%;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
    transform: scale(0.8);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.lightbox-overlay.active .lightbox-img {
    transform: scale(1);
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    transition: color 0.3s;
    z-index: 10001;
}

.lightbox-close:hover {
    color: var(--accent);
}

/* ================= CONTACT SECTION (3 Columns) ================= */
.contact-layout {
    display: grid;
    grid-template-columns: 320px 1fr 260px;
    gap: 1rem;
    align-items: stretch;
    max-width: 1100px;
    margin: 0 auto;
}

/* Discord Widget */
.discord-card {
    background-color: var(--bg-main);
    border-radius: 16px;
    padding: 1.5rem;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    font-family: var(--font-body);
    color: var(--text-primary);
    border: 1px solid #333;
}

.discord-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

.discord-label {
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    display: block;
    margin-bottom: 0.3rem;
}

.discord-label i { color: #5865F2; }

.discord-username {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0;
}

.discord-link-btn {
    width: 35px;
    height: 35px;
    border-radius: 8px;
    background-color: var(--bg-alt);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.3s ease;
    border: 1px solid #333;
}

.discord-link-btn:hover {
    background-color: rgba(100, 255, 218, 0.1);
    color: var(--accent);
    border-color: var(--accent);
}

.discord-inner-box {
    background-color: var(--bg-alt);
    border-radius: 12px;
    padding: 1.2rem;
    border: 1px solid #333;
}

.discord-profile {
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
}

.discord-avatar-wrapper {
    position: relative;
    margin-right: 1.2rem;
}

.discord-avatar {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    object-fit: cover;
}

.discord-status-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 3.5px solid var(--bg-alt);
}

.discord-info {
    display: flex;
    flex-direction: column;
}

.discord-name {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0 0 0.1rem 0;
}

.discord-tag {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 0 0 0.5rem 0;
}

.discord-status-badge {
    display: inline-flex;
    align-items: center;
    background-color: var(--bg-main);
    padding: 0.3rem 0.6rem;
    border-radius: 50px;
    font-size: 0.8rem;
    border: 1px solid #333;
    width: fit-content;
}

.status-circle {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}

.discord-activity-section {
    background-color: #0a0a0a;
    border-radius: 8px;
    padding: 1rem;
    border: 1px solid #333;
}

.activity-header {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 1px;
    margin: 0 0 1rem 0;
}

.activity-content {
    display: flex;
    align-items: flex-start;
}

.activity-icon-box {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    background-color: var(--bg-alt);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
    border: 1px solid #333;
}

.activity-icon-box i {
    font-size: 1.5rem;
    color: var(--accent);
}

.spotify-art {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    margin-right: 1rem;
    object-fit: cover;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

.activity-details {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.activity-label {
    color: var(--accent);
    font-size: 0.75rem;
    font-weight: 700;
    margin: 0 0 0.3rem 0;
    letter-spacing: 0.5px;
}

.activity-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 0.2rem 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.activity-subtitle {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin: 0 0 0.1rem 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Contact Form Box */
.contact-form-box {
    background-color: var(--bg-main);
    border-radius: 16px;
    padding: 2.5rem;
    border: 1px solid #333;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.form-label {
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    margin-bottom: 0.5rem;
    display: block;
}

.form-title {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    color: #fff;
}

.form-desc {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 2rem;
    line-height: 1.6;
}

#emailForm {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    color: var(--accent);
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.form-group label i { margin-right: 5px; }

.form-group input,
.form-group textarea {
    width: 100%;
    background-color: transparent;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 1rem;
    color: #fff;
    font-family: var(--font-body);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-group textarea {
    min-height: 120px;
    resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(100, 255, 218, 0.1);
}

.form-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

#submitBtn {
    background-color: var(--accent);
    color: #000;
    border: none;
    font-weight: 700;
    padding: 1rem 2rem;
    border-radius: 8px;
}

#submitBtn:hover {
    background-color: #4cdbba;
    box-shadow: 0 5px 15px rgba(100, 255, 218, 0.3);
}

/* Social Links */
.social-links { list-style: none; }
.social-links li { margin-bottom: 1rem; }
.social-links a {
    display: flex;
    align-items: center;
    font-family: var(--font-heading);
    font-size: 1.1rem;
    color: var(--text-secondary);
}
.social-links a:hover { color: var(--accent); }
.social-icon {
    margin-right: 15px;
    font-size: 1.3rem;
    width: 25px;
    text-align: center;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-family: var(--font-heading);
}

/* ================= ANIMATIONS (Delay Utilities) ================= */
.reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: all 0.8s cubic-bezier(0.5, 0, 0, 1);
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}



.delay1-1 { transition-delay: 0.1s !important; }
.delay1-2 { transition-delay: 0.25s !important; }
.delay1-3 { transition-delay: 0.4s !important; }
.delay1-4 { transition-delay: 0.55s !important; }

/* ================= FLUID SIMULATION & GUI CONTROL PANEL ================= */
.webgl-fluid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0; 
}

/* 💡 แอนิเมชันเปิด/ปิด (เด้งเต็มๆ จากขวาบน) */
.dg.ac {
    position: absolute !important;
    top: 20px !important; 
    right: 20px !important;
    z-index: 9999 !important;
    
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease !important;
    transform: translateX(120%) !important; 
    opacity: 0 !important;
    pointer-events: none !important;
}

.dg.ac.show-panel {
    transform: translateX(0) !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* 💡 จัดหน้าตากล่อง และปลดล็อกความสูงให้กาง 100% */
.dg.main {
    max-height: 85vh !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    
    background: rgba(10, 10, 10, 0.6) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 12px !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5) !important;
}

/* ================= 📱 ซ่อนกล่องแผงควบคุม Fluid ในจอมือถือ ================= */
@media (max-width: 768px) {
    /* ซ่อนปุ่มวงกลมมุมขวาล่าง */
    .gui-floating-btn {
        display: none !important; 
    }
    
    /* ซ่อนตัวกล่องเมนูควบคุมสี */
    .dg.ac {
        display: none !important; 
    }
}

/* บังคับให้เมนูทุกตัวกางออก 100% เสมอ */
.dg.main ul {
    height: auto !important;
    max-height: none !important;
}

/* 💡 ไม้ตาย: ซ่อนปุ่ม Close Controls เดิมของ Library ทิ้งไปเลย! */
.dg .close-button {
    display: none !important; 
}

/* แต่งสีเมนูด้านในกล่อง GUI */
.dg .property-name {
    color: #a8b2d1 !important; 
    font-family: var(--font-body), sans-serif !important;
}

.dg .c .slider {
    background: rgba(255, 255, 255, 0.1) !important;
}

.dg .c .slider-fg {
    background: var(--accent) !important; 
    box-shadow: 0 0 10px rgba(100, 255, 218, 0.5) !important; 
}

.dg .c input[type=text] {
    background: rgba(0, 0, 0, 0.5) !important;
    color: var(--accent) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 4px !important;
    font-family: var(--font-body), sans-serif !important;
}

.dg li:not(.folder):hover {
    background: rgba(255, 255, 255, 0.05) !important;
}

/* ================= Floating Button ================= */
.gui-floating-btn {
    position: absolute; 
    bottom: 30px;
    right: 30px;
    width: 55px;
    height: 55px;
    border-radius: 50%;
    background: rgba(10, 10, 10, 0.7);
    border: 2px solid var(--accent);
    color: var(--accent);
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 1000 !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 0 15px rgba(100, 255, 218, 0.2);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto !important;
}

.gui-floating-btn:hover {
    background: var(--accent);
    color: #000;
    transform: scale(1.1);
    box-shadow: 0 0 25px rgba(100, 255, 218, 0.5);
}

/* ================= SCROLL PROGRESS BAR ================= */
.scroll-progress-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px; 
    background: transparent;
    z-index: 100000; 
    pointer-events: none; 
}

.scroll-progress-bar {
    height: 100%;
    background: var(--accent); 
    width: 0%; 
    border-top-right-radius: 4px;
    border-bottom-right-radius: 4px;
    box-shadow: 0 0 10px rgba(100, 255, 218, 0.8); 
}

/* ================= RESPONSIVE BENTO GRID ================= */
@media (max-width: 1150px) {
    .about-bento-grid {
        grid-template-columns: 1fr; /* 💡 เปลี่ยนให้เรียงซ้อนกันบน iPad */
    }
    .photo-card {
        min-height: 450px;
    }
    .bento-bottom-split {
        grid-template-columns: 1fr;
    }
}

/* ================= RESPONSIVE ================= */
/* 💡 ปรับให้ครอบคลุม iPad Pro (1024px) และ iPad ปกติ */
@media (max-width: 1024px) {
    .contact-layout {
        grid-template-columns: 1fr; /* เปลี่ยนเป็นเรียงซ้อนกัน 1 คอลัมน์ */
        gap: 3rem; 
    }
    
    .discord-card {
        margin: 0 auto;
        max-width: 100%; /* ให้กว้างเต็มพื้นที่ หรืออาจจะตั้งค่า max-width ตามชอบ */
    }

    .contact-middle {
        text-align: center;
    }

    .social-links {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 1.5rem;
    }

    .social-links li {
        margin-bottom: 0;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .form-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    #submitBtn {
        width: 100%;
    }

    /* --- ตัวหนังสือพิมพ์ดีด ห้ามดันจอ --- */
    .typing-wrapper {
        max-width: 90vw !important;
        overflow: hidden !important;
    }
    #hero h1 { font-size: 3.5rem !important; }
    .role-title { font-size: 2rem !important; }

    /* --- Navbar: บังคับให้เป็นปุ่มแฮมเบอร์เกอร์ (เพราะเมนูยาวๆ มันดันจอ iPad) --- */
    .nav-container { padding: 15px 5% !important; }
    .hamburger { display: block !important; }
    .nav-links {
        position: absolute !important;
        top: 60px !important; right: 0 !important;
        width: 30% !important; max-width: 100vw !important;
        background: rgba(18, 18, 18, 0.95) !important;
        flex-direction: column !important;
        text-align: center !important;
        overflow: hidden !important;
        max-height: 0 !important; /* ซ่อนเมนูไว้ก่อน */
        transition: max-height 0.4s ease-in-out !important;
    }
    .nav-links.nav-active { max-height: 400px !important; }
    .nav-item { display: block !important; padding: 5px 0 !important; width: 100% !important; }
    
    /* เอฟเฟกต์ปุ่มแฮมเบอร์เกอร์กากบาท */
    .hamburger.toggle .bar:nth-child(1) { transform: translateY(8px) rotate(45deg) !important; }
    .hamburger.toggle .bar:nth-child(2) { opacity: 0 !important; }
    .hamburger.toggle .bar:nth-child(3) { transform: translateY(-8px) rotate(-45deg) !important; }

    /* --- กล่อง About Me บังคับเรียง 1 แถว --- */
    .about-bento-grid {
        grid-template-columns: 1fr !important;
    }
    .bento-bottom-split {
        grid-template-columns: 1fr !important;
    }
    .photo-card { min-height: 400px !important; }

    /* --- กล่อง Contact บังคับเรียง 1 แถว --- */
    .contact-layout {
        grid-template-columns: 1fr !important;
        gap: 2.5rem !important;
        width: 100% !important;
        max-width: 100vw !important;
        padding: 0 !important;
    }
    .discord-card {
        margin: 0 auto !important;
        max-width: 100% !important;
    }
    .form-row { grid-template-columns: 1fr !important; }
    .contact-middle { text-align: center !important; }
    .social-links { 
        display: flex !important; 
        flex-wrap: wrap !important; 
        justify-content: center !important; 
        gap: 1.5rem !important; 
    }
    
    /* --- ซ่อนปุ่มฟิสิกส์มุมขวาล่างใน iPad ไปเลย จะได้ไม่เกะกะ --- */
    .gui-floating-btn, .dg.ac {
        display: none !important;
    }
}


@media (max-width: 900px) {
    .about-bento-grid {
        grid-template-columns: 1fr;
    }
    .photo-card {
        min-height: 450px;
    }
    .form-row {
        grid-template-columns: 1fr;
    }
    .form-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    #submitBtn {
        width: 100%;
    }
}

@media (max-width: 768px) {
    :root {
        --section-spacing: 70px;
    }
    .project-item {
        grid-template-columns: 1fr;
        gap: 0.5rem;
        position: relative;
        padding: 1.5rem;
    }
    .project-item::before {
        font-size: 2rem;
        margin-bottom: 0.5rem;
    }
    .status-badge-project {
        position: absolute;
        top: 3rem;
        left: 4.8rem;
        transform: translateY(-50%);
    }
    .contact-card {
        padding: 2rem;
    }
}

/* ================= ⏳ PRELOADER STYLES (MINIMAL CODE TAG) ================= */
.preloader {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: #0a0a0a; /* สีดำเข้มพรีเมียม */
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: center;
    /* แอนิเมชันเปิดม่านขึ้นบน */
    transition: transform 0.8s cubic-bezier(0.77, 0, 0.175, 1), opacity 0.8s ease; 
}

.preloader.finish {
    transform: translateY(-100%);
    opacity: 0;
}

.loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

/* 💡 เอฟเฟกต์แท็กโค้ด < /> */
.code-tag-loader {
    font-family: var(--font-heading);
    font-size: 4.5rem;
    font-weight: 700;
    color: var(--accent); /* สีเขียวมิ้นต์ */
    display: flex;
    align-items: center;
    gap: 0.8rem;
    text-shadow: 0 0 20px rgba(100, 255, 218, 0.4);
}

/* แอนิเมชันให้วงเล็บกระเพื่อมเรืองแสง */
.code-tag-loader .bracket {
    animation: pulseBracket 1.5s ease-in-out infinite alternate;
}

/* แอนิเมชันให้ขีด Slash หมุนกลิ้งเท่ๆ */
.code-tag-loader .slash {
    animation: spinSlash 2s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
    display: inline-block;
}

/* 💡 ข้อความ Loading... */
.loader-text {
    font-family: var(--font-body);
    font-size: 1rem;
    letter-spacing: 6px; /* ถ่างช่องไฟให้ดูมินิมอล */
    color: var(--text-secondary);
    text-transform: uppercase;
    animation: blinkText 1.5s linear infinite;
}

/* --- Keyframes สำหรับแอนิเมชัน --- */
@keyframes pulseBracket {
    0% { transform: scale(0.9); opacity: 0.7; }
    100% { transform: scale(1.1); opacity: 1; text-shadow: 0 0 35px var(--accent); }
}

@keyframes spinSlash {
    0% { transform: rotate(0deg); }
    50% { transform: rotate(180deg); color: #fff; text-shadow: 0 0 10px #fff; }
    100% { transform: rotate(360deg); }
}

@keyframes blinkText {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; color: var(--accent); }
}

/* ย่อขนาดลงนิดนึงเวลาเปิดในมือถือ */
@media (max-width: 768px) {
    .code-tag-loader { font-size: 3.5rem; }
    .loader-text { font-size: 0.85rem; }
}
/* ================= 🌟 NAVBAR STYLES ================= */
.navbar {
    position: fixed;
    top: 0; left: 0;
    width: 100%;
    z-index: 900;
    background: rgba(18, 18, 18, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 8%; 
    max-width: 1200px; 
    margin: 0 auto;
}

/* โลโก้ฝั่งซ้าย */
.nav-logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: 1px;
}

.nav-logo .status-dot {
    width: 8px; height: 8px;
    background-color: var(--accent);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--accent);
    animation: pulse-nav-dot 2s infinite;
}

@keyframes pulse-nav-dot {
    0% { opacity: 1; box-shadow: 0 0 8px var(--accent); }
    50% { opacity: 0.5; box-shadow: 0 0 15px var(--accent); }
    100% { opacity: 1; box-shadow: 0 0 8px var(--accent); }
}

/* ลิงก์เมนูฝั่งขวา */
.nav-links {
    display: flex;
    gap: 3rem; 
    list-style: none;
    margin: 0; padding: 0;
}

.nav-item {
    color: var(--text-secondary);
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 500;
    position: relative;
    padding-bottom: 5px;
    transition: color 0.3s ease;
}

.nav-item:hover { color: var(--accent); }

/* เอฟเฟกต์ขีดเส้นใต้ตอนเอาเมาส์ชี้ */
.nav-item::after {
    content: '';
    position: absolute;
    width: 0; height: 2px;
    bottom: 0; left: 0;
    background-color: var(--accent);
    transition: width 0.3s ease;
}

.nav-item:hover::after { width: 100%; }

/* ซ่อนปุ่มแฮมเบอร์เกอร์ในจอคอม */
.hamburger {
    display: none; 
    cursor: pointer;
    z-index: 1000;
}

.hamburger .bar {
    display: block;
    width: 25px; height: 3px;
    margin: 5px auto;
    transition: all 0.3s ease-in-out;
    background-color: #fff; 
    border-radius: 3px;
}

/* ================= 🌐 MY NETWORK SECTION (เว็บไซต์ในเครือ) ================= */
.network-grid {
    display: grid;
    /* จัดเรียงอัตโนมัติ: ถ้าจอคอมจะเป็น 2 คอลัมน์ จอมือถือจะเป็น 1 คอลัมน์ */
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.network-card {
    display: flex;
    align-items: center;
    background-color: var(--bg-alt);
    border: 1px solid #333;
    border-radius: 12px;
    padding: 1.5rem;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    overflow: hidden;
}

/* เอฟเฟกต์ตอนเอาเมาส์ชี้การ์ด */
.network-card:hover {
    border-color: var(--accent);
    transform: translateY(-5px);
    box-shadow: 0 10px 30px -15px rgba(100, 255, 218, 0.25);
}

/* แถบสีมิ้นต์ด้านซ้ายที่จะโผล่มาตอน Hover */
.network-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 4px;
    height: 100%;
    background-color: var(--accent);
    transform: scaleY(0);
    transition: transform 0.3s ease;
    transform-origin: bottom;
}

.network-card:hover::before {
    transform: scaleY(1);
}

/* ไอคอนด้านซ้ายของแต่ละเว็บ */
.network-icon {
    width: 50px;
    height: 50px;
    min-width: 50px;
    border-radius: 10px;
    background: rgba(100, 255, 218, 0.05);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-right: 1.2rem;
    transition: all 0.3s ease;
}

.network-card:hover .network-icon {
    background: var(--accent);
    color: #121212;
    transform: scale(1.1) rotate(5deg);
}

.network-info {
    flex-grow: 1;
}

.network-domain {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    color: #fff;
    margin-bottom: 0.3rem;
    transition: color 0.3s ease;
}

.network-card:hover .network-domain {
    color: var(--accent);
}

.network-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.4;
}

/* ลูกศรด้านขวาสุด */
.network-arrow {
    color: #444;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    opacity: 0.5;
}

.network-card:hover .network-arrow {
    color: var(--accent);
    opacity: 1;
    transform: translateX(5px) scale(1.1); /* ขยับลูกศรไปทางขวานิดนึง */
}

/* ปรับขนาดในจอมือถือ */
@media (max-width: 768px) {
    .network-grid {
        grid-template-columns: 1fr; /* บังคับ 1 คอลัมน์ */
    }
    .network-card {
        padding: 1.2rem;
    }
    .network-icon {
        width: 40px; height: 40px; min-width: 40px;
        font-size: 1.2rem;
    }
    .network-domain { font-size: 1.1rem; }
}