@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono:wght@400&family=Orbitron:wght@400;700;900&display=swap');

/* Base Styles (เริ่มต้นจากการออกแบบสำหรับหน้าจอขนาดใหญ่ก่อน) */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Share Tech Mono', monospace;
    background: #0a0a0a;
    color: #ff0000;
    overflow-x: hidden; /* ป้องกัน scrollbar แนวนอน */
    cursor: crosshair;
}

.matrix-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    opacity: 0.1;
}

.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, #1a0000, #330000, #1a0000);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: pulse 2s infinite;
}

.loading-screen.hidden {
    animation: fadeOut 1s forwards;
}

@keyframes fadeOut {
    to { opacity: 0; visibility: hidden; }
}

@keyframes pulse {
    0%, 100% { background: linear-gradient(45deg, #1a0000, #330000, #1a0000); }
    50% { background: linear-gradient(45deg, #330000, #660000, #330000); }
}

.loading-text {
    font-size: 2rem;
    color: #ff3333;
    text-shadow: 0 0 20px #ff0000;
    animation: glitch 2s infinite;
    margin-bottom: 2rem;
}

.loading-bar {
    width: 400px;
    height: 4px;
    background: #330000;
    border-radius: 2px;
    overflow: hidden;
    border: 1px solid #ff0000;
}

.loading-progress {
    height: 100%;
    background: linear-gradient(90deg, #ff0000, #ff6666, #ff0000);
    width: 0%;
    animation: loadProgress 3s forwards;
    box-shadow: 0 0 10px #ff0000;
}

@keyframes loadProgress {
    to { width: 100%; }
}

@keyframes glitch {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-2px); }
    40% { transform: translateX(2px); }
    60% { transform: translateX(-1px); }
    80% { transform: translateX(1px); }
}

.container {
    display: none;
    min-height: 100vh;
    position: relative;
    padding: 20px; /* เพิ่ม padding พื้นฐานสำหรับ container หลัก */
    max-width: 1200px; /* จำกัดความกว้างสูงสุดของเนื้อหา */
    margin: 0 auto; /* จัดกึ่งกลาง container */
}

.container.active {
    display: block;
}

.page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    padding: 2rem 1rem; /* เพิ่ม padding ด้านข้างสำหรับ page */
    position: relative;
}

.nav {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 0;
    overflow: hidden;
}

.nav-btn {
    background: rgba(255, 0, 0, 0.1);
    border: 1px solid #ff0000;
    color: #ff0000;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    text-transform: uppercase;
    letter-spacing: 2px;
    white-space: nowrap;
    margin-bottom: 0.5rem;
    opacity: 1;
    transform: translateY(0);
}

.nav-btn:first-child {
    opacity: 1;
    transform: translateY(0);
    position: relative;
    z-index: 10;
}

.nav-btn:not(:first-child) {
    opacity: 0;
    transform: translateY(-20px);
    pointer-events: none;
    margin-top: -1rem;
}

.nav:hover .nav-btn:not(:first-child) {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    margin-top: 0;
}

.nav:hover .nav-btn:nth-child(2) {
    transition-delay: 0.1s;
}

.nav:hover .nav-btn:nth-child(3) {
    transition-delay: 0.2s;
}

.nav:hover .nav-btn:nth-child(4) {
    transition-delay: 0.3s;
}

.nav-btn:hover, .nav-btn.active {
    background: rgba(255, 0, 0, 0.3);
    box-shadow: 0 0 20px rgba(255, 0, 0, 0.5);
}

.nav .nav-btn:not(:first-child) {
    transition-delay: 0s;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.org-title {
    font-family: 'Orbitron', monospace;
    font-size: 4rem;
    font-weight: 900;
    text-align: center;
    color: #4e0c0c;
    text-shadow:
        0 0 10px #ff0000,
        0 0 20px #ff0000,
        0 0 40px #ff0000;
    margin-bottom: 1rem;
    animation: textGlow 3s ease-in-out infinite alternate;
}

.org-subtitle {
    font-size: 1.2rem;
    text-align: center;
    opacity: 0.8;
    letter-spacing: 3px;
    text-transform: uppercase;
}

@keyframes textGlow {
    from {
        text-shadow:
            0 0 10px #ff0000,
            0 0 20px #ff0000,
            0 0 40px #ff0000;
    }
    to {
        text-shadow:
            0 0 5px #ff0000,
            0 0 10px #ff0000,
            0 0 20px #ff0000,
            0 0 40px #ff0000,
            0 0 80px #ff0000;
    }
}

.page3-title {
    font-family: 'Orbitron', monospace;
    font-size: 3rem;
    font-weight: 900;
    text-align: center;
    color: #ff0000;
    text-shadow: 0 0 20px #ff0000;
    margin-bottom: 2rem;
}

.access-denied {
    font-size: 1.5rem;
    text-align: center;
    color: #ff6666;
    margin-bottom: 2rem;
    animation: blink 2s infinite;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.3; }
}

.access-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 400px;
    width: 100%;
}

.access-input {
    background: rgba(255, 0, 0, 0.1);
    border: 1px solid #ff0000;
    color: #ff0000;
    padding: 1rem;
    font-family: inherit;
    font-size: 1rem;
}

.access-input::placeholder {
    color: #ff6666;
}

.access-btn {
    background: rgba(255, 0, 0, 0.2);
    border: 1px solid #ff0000;
    color: #ff0000;
    padding: 1rem;
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    transition: all 0.3s;
}

.access-btn:hover {
    background: rgba(255, 0, 0, 0.4);
    box-shadow: 0 0 20px rgba(255, 0, 0, 0.5);
}

#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(45deg, #000, #1a0000, #000);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.progress-container {
    width: 400px;
    height: 20px;
    border: 2px solid #ff0000;
    border-radius: 10px;
    background: #000;
    overflow: hidden;
    box-shadow: 0 0 30px #ff0000;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #ff0000, #cc0000, #ff6666);
    width: 0%;
    transition: width 0.1s ease;
    animation: pulse 1s infinite;
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
}

.tiktok-wrapper {
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Member Section Styles */
.member-photo {
    width: 200px;
    height: 200px;
    border-radius: 20%; /* Original border-radius */
    margin: 0 auto 1rem;
    overflow: hidden;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}

.member-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.members-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); /* ปรับ minmax ให้เล็กลงเล็กน้อย */
    gap: 1.5rem;
    max-width: 1200px;
    margin: 2rem auto; /* จัดกึ่งกลาง grid */
    padding: 0 1rem; /* เพิ่ม padding ด้านข้างเพื่อให้ไม่ติดขอบจอ */
}

.member-card {
    background: linear-gradient(135deg, rgba(255, 0, 0, 0.05), rgba(255, 0, 0, 0.15));
    border: 1px solid #ff0000;
    border-radius: 8%;
    padding: 2rem;
    position: relative;
    transition: all 0.3s;
    overflow: hidden;
    cursor: pointer;
    text-align: left; /* จัดเนื้อหาใน card ให้อยู่ชิดซ้าย */
}

.member-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 20px 40px rgba(255, 0, 0, 0.3);
}

.member-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 0, 0, 0.2), transparent);
    transition: left 0.5s;
}

.member-card:hover::before {
    left: 100%;
}

.member-name {
    font-family: 'Orbitron', monospace;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #ff3333;
}

.member-nameEng {
    color: #960909;
    margin-bottom: 1rem;
    font-size: 1rem; /* แก้ font-size ที่เคยเป็น 1 (หน่วยหายไป) */
    padding: 0;
    text-transform: uppercase;
    letter-spacing: 0px;
}

.member-role {
    color: #ff6666;
    padding: 0;
    margin-bottom: 0rem;
    text-transform: uppercase;
    letter-spacing: 0px;
}

.card-header {
    display: flex;
    flex-direction: column; /* เปลี่ยนเป็น column เสมอเพื่อความเข้ากันบนมือถือ */
    align-items: center; /* จัดกึ่งกลางเมื่อเป็น column */
    margin-bottom: 20px;
}

.member-info {
    flex: 1;
    text-align: left; /* จัดข้อมูลให้อยู่ชิดซ้าย */
}

.member-image {
    width: 70px; /* เพิ่มหน่วย px */
    height: 70px; /* เพิ่มหน่วย px */
    overflow: hidden;
    border-radius: 4px;
    border: 2px solid #ff0000;
    object-fit: cover;
    margin: 0 auto 10px; /* จัดกึ่งกลางและเพิ่ม margin ด้านล่าง */
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.5);
    transition: all 0.3s;
}

.textstatus {
    color: rgba(0, 122, 0, 0.671);
}

.member-card:hover .member-image {
  box-shadow: 0 0 25px rgba(255, 0, 0, 0.8);
}

.member-stats {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center; /* จัดกึ่งกลาง stats */
}

.stat {
    display: flex;
    flex-direction: column; /* เปลี่ยนเป็น column เพื่อให้ข้อความและ bar ไม่เบียดกัน */
    justify-content: center; /* จัดกึ่งกลางเนื้อหาใน stat */
    align-items: center; /* จัดกึ่งกลางเนื้อหาใน stat */
    text-align: center;
}

.stat-bar {
    width: 100px;
    height: 4px;
    background: #330000;
    border-radius: 2px;
    overflow: hidden;
    margin-top: 5px; /* เพิ่มระยะห่างจากข้อความ */
}

.stat-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff0000, #ff6666);
    transition: width 2s ease;
}

.glitch-text {
    animation: textGlitch 4s infinite;
}

.section-title {
    font-family: 'Orbitron', monospace;
    font-size: 2.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 2rem;
    color: #ff0000;
    text-shadow: 0 0 20px #ff0000;
}

.terminal-effect {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(255, 0, 0, 0.03) 2px,
            rgba(255, 0, 0, 0.03) 4px
        );
    animation: scanlines 0.1s linear infinite;
}

@keyframes scanlines {
    0% { transform: translateY(0); }
    100% { transform: translateY(4px); }
}

.video-background {
    position: fixed;
    top: 0;
    left: 0;
    min-width: 100vw;
    min-height: 100vh;
    overflow: hidden;
    z-index: -1;
}

.video-background video {
    position: absolute;
    top: 50%;
    left: 50%;
    min-width: 100%;
    min-height: 100%;
    width: auto;
    height: auto;
    transform: translate(-50%, -50%);
    object-fit: cover;
}

.content {
    position: relative;
    z-index: 1;
    color: white;
    text-align: center;
    padding: 3rem;
}

.textstatus {
    color: rgb(5, 80, 5);
    text-align: left;
}

.textstatus2 {
    color: #920f0f;
    text-align: left;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.8);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: linear-gradient(145deg, rgb(36, 1, 1), rgba(0, 0, 0, 0.95));
    margin: 5% auto;
    padding: 0;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 20px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    backdrop-filter: blur(20px);
    box-shadow: 0 20px 60px rgba(58, 1, 1, 0.3);
}

.modal-header {
    background: linear-gradient(45deg, rgb(43, 0, 0), rgba(32, 1, 1, 0.95));
    padding: 20px;
    border-radius: 20px 20px 0 0;
    text-align: center;
    position: relative;
}

.modal-header h2 {
    font-size: 1.8rem;
    margin: 0;
}

.close {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: #fff;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
}

.close:hover {
    color: #4d0101;
}

.modal-body {
    padding: 30px;
}

.profile-photo {
    width: 150px;
    height: 150px;
    border-radius: 20%;
    margin: 0 auto 30px;
    border: 4px solid #300505;
    overflow: hidden;
    box-shadow: 0 0 30px rgba(44, 0, 0, 0.5);
}

.profile-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.info-group {
    background: rgba(255,255,255,0.05);
    padding: 20px;
    border-radius: 15px;
    border: 1px solid rgba(255,255,255,0.1);
}

.info-group h3 {
    color: #ffffff;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.info-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.info-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.info-label {
    color: #ccc;
    font-weight: 600;
}

.info-value {
    color: #fff;
    font-weight: bold;
}

.story-section {
    background: rgba(255,255,255,0.05);
    padding: 25px;
    border-radius: 15px;
    border: 1px solid rgba(255,255,255,0.1);
    margin-top: 20px;
}

.story-section h3 {
    color: #ffffff;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.story-text {
    line-height: 1.8;
    color: #ddd;
    text-align: justify;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
}

.social-link {
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #3b82f6, #06b6d4);
    border-radius: 25px;
    text-decoration: none;
    color: white;
    transition: all 0.3s ease;
}

.social-link:hover {
    transform: scale(1.1);
    box-shadow: 0 5px 15px rgba(59, 130, 246, 0.4);
}

.imageContainer {
    display: none; /* เริ่มต้นให้ซ่อนไว้ */
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    background: rgba(255, 255, 255, 0.95); /* พื้นหลังขาวโปร่งแสง */
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 0 25px rgba(0, 0, 0, 0.3);
    text-align: center;
    max-width: 90vw;
    max-height: 90vh;
    overflow: auto;
}

.imageContainer img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

.social-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding-top: 0rem;
}

.social-icons {
    display: flex;
    gap: 10px;
    align-items: center;
}

.icon-container {
    cursor: pointer;
    transition: all 0.3s ease-in-out;
    padding: 6px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    text-decoration: none;
}

.icon-container:hover {
    color: #ec4899;
    background-color: rgba(236, 72, 153, 0.1);
    transform: scale(1.1);
    text-decoration: none;
}

.icon-container svg {
    width: 20px;
    height: 20px;
}

.status-badge {
    background-color: rgba(34, 197, 94, 0.6);
    color: #000000;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    text-decoration: underline;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.icon-container:hover svg {
    animation: bounce 0.6s ease-in-out;
}

@keyframes bounce {
    0%, 20%, 60%, 100% { transform: translateY(0); }
    40% { transform: translateY(-8px); }
    80% { transform: translateY(-4px); }
}

.image-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(10px);
    animation: fadeIn 0.5s ease;
    padding: 20px; /* เพิ่ม padding เพื่อไม่ให้ภาพชิดขอบ */
    box-sizing: border-box;
}

.image-popup.show {
    display: flex;
}

.popup-content {
    position: relative;
    max-width: 95%; /* จำกัดความกว้างสูงสุด */
    max-height: 95%; /* จำกัดความสูงสูงสุด */
    animation: popupScale 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.popup-image {
    /* ลบการกำหนดขนาดแน่นอนออก */
    max-width: 100%;
    max-height: 90vh;
    width: auto; /* เปลี่ยนเป็น auto เพื่อให้ปรับตามอัตราส่วนจริง */
    height: auto; /* เปลี่ยนเป็น auto เพื่อให้ปรับตามอัตราส่วนจริง */
    border-radius: 15px;
    overflow: hidden;
    object-fit: contain; /* เปลี่ยนจาก cover เป็น contain เพื่อแสดงภาพเต็ม */
    box-shadow:
        0 25px 80px rgba(0, 0, 0, 0.7),
        0 0 50px rgb(17, 0, 0);
    border: 3px solid rgba(41, 2, 2, 0.5);
    display: block; /* เปลี่ยนจาก flex เป็น block */
}

/* สำหรับภาพที่สูงมาก */
.popup-image.tall-image {
    max-height: 85vh;
    width: auto;
}

/* สำหรับภาพที่กว้างมาก */
.popup-image.wide-image {
    max-width: 85vw;
    height: auto;
}

.close-btn {
    position: absolute;
    top: -15px;
    right: -15px;
    width: 50px;
    height: 50px;
    background: linear-gradient(45deg, #ff4444, #cc3333);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(255, 68, 68, 0.4);
    z-index: 1001; /* เพิ่ม z-index เพื่อให้ปุ่มอยู่ด้านบน */
}

.close-btn:hover {
    transform: scale(1.1) rotate(90deg);
    background: linear-gradient(45deg, #ff6666, #ee4444);
}

/* Popup Overlay */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.popup-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* Media Elements (Image & Video) */
.popup-media {
    max-width: 100%;
    max-height: 70vh;
    width: auto;
    height: auto;
    display: block;
    margin: 0 auto;
    border-radius: 4px;
}

/* Video specific styles */
#popupVideo {
    background: #000;
}

#popupVideo::-webkit-media-controls-panel {
    background-color: rgba(0, 0, 0, 0.8);
}


/* Responsive Design */
@media (max-width: 768px) {
    .popup-content {
        max-width: 95%;
        max-height: 95%;
        padding: 15px;
    }
    
    .popup-media {
        max-height: 60vh;
    }
    
    .video-controls {
        flex-direction: column;
        gap: 8px;
    }
    
    .video-controls input[type="range"] {
        width: 150px;
    }
}

/* Loading Animation (optional) */
.popup-media {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.popup-media[src] {
    opacity: 1;
}

/* Animation สำหรับ fade in */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Animation สำหรับ popup scale */
@keyframes popupScale {
    0% {
        opacity: 0;
        transform: scale(0.7);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Responsive สำหรับหน้าจอเล็ก */
@media (max-width: 768px) {
    .image-popup {
        padding: 10px;
    }
    
    .popup-content {
        max-width: 98%;
        max-height: 98%;
    }
    
    .popup-image {
        max-height: 80vh;
        border-radius: 10px;
    }
    
    .close-btn {
        width: 40px;
        height: 40px;
        font-size: 20px;
        top: -10px;
        right: -10px;
    }
}
.iframe-container {
    position: relative;
    background: linear-gradient(45deg, #220000, #440000);
    border-radius: 15px;
    padding: 15px;
    box-shadow:
        0 8px 25px rgba(204, 0, 0, 0.4),
        inset 0 2px 10px rgba(255, 0, 0, 0.1);
    border: 2px solid #cc0000;
    overflow: hidden;
}

.iframe-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 0, 0, 0.1), transparent);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.copyright-container {
    position: fixed; /* ทำให้ลอยค้าง */
    bottom: 5px; /* ระยะจากด้านล่าง */
    left: 12%; /* จัดให้อยู่ตรงกลาง */
    transform: translateX(-50%); /* จัดให้อยู่กึ่งกลางพอดี */
    z-index: 9999; /* ให้อยู่เหนือทุกอย่าง */
    
    padding: 1rem;
    border-radius: 15px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
}


.copyright {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: left; /* เปลี่ยนเป็น center */
    justify-content: flex-start; /* เปลี่ยนเป็น center */
    gap: 0.5rem;
    text-align: center; /* เปลี่ยนเป็น center */
    flex-wrap: wrap;
}

.copyright-icon {
    font-size: 1.2rem;
    color: #ffffff;
    text-shadow: 0 0 10px rgba(59, 59, 59, 0.5);
}

.studio-name {
    font-weight: 700;
    color: #ffffff;
    text-shadow: 0 0 15px rgba(59, 59, 59, 0.5);
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
}

.studio-name:hover {
    text-shadow: 0 0 20px rgba(59, 59, 59, 0.5);
    transform: scale(1.05);
}

@keyframes glow {
    0%, 100% {
        text-shadow: 0 0 15px rgba(59, 59, 59, 0.5);
    }
    50% {
        text-shadow: 0 0 25px rgba(59, 59, 59, 0.5);
    }
}

.studio-name.animated {
    animation: glow 2s ease-in-out infinite;
}

@keyframes flicker {
    0% { opacity: 1; }
    50% { opacity: 0.98; }
    100% { opacity: 1; }
}

.discord-form-header {
    text-align: center;
    margin-bottom: 30px;
}

.discord-form-header h1 {
    color: #ff0000;
    font-size: 3rem;
    margin-bottom: 5px;
    margin-top: 200px;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 0 0 10px #ff0000;
    background: none;
    -webkit-background-clip: unset;
    -webkit-text-fill-color: unset;
    background-clip: unset;
}

.discord-form-header p {
    color: #cc0000;
    font-size: 1.2rem;
}

.discord-form-group {
    margin-bottom: 25px;
    position: relative;
    display: flex; /* ใช้ flexbox จัดกึ่งกลาง input/textarea */
    flex-direction: column;
    align-items: center;
}

.discord-form-label {
    display: block;
    margin-bottom: 8px;
    color: #ff0000;
    font-weight: normal;
    font-size: 1.3rem;
    text-shadow: 0 0 3px rgba(255, 0, 0, 0.5);
    padding-left: 0; /* ลบ padding-left ออกไปเพื่อให้ label จัดกึ่งกลาง */
    text-align: center; /* จัดกึ่งกลาง label */
    width: 100%; /* ให้ label ใช้พื้นที่เต็มความกว้าง */
}

.discord-form-input, .discord-form-textarea {
    width: 60%; /* ปรับ width ให้เล็กลงเล็กน้อย */
    padding: 15px;
    border: 1px solid #cc0000;
    border-radius: 3px;
    font-size: 1.1rem;
    transition: all 0.1s ease;
    background: #0d0000;
    color: #ff0000;
    text-shadow: 0 0 3px rgba(255, 0, 0, 0.5);
    margin: 0; /* ลบ margin auto */
    display: block;
}

.discord-form-input:focus, .discord-form-textarea:focus {
    outline: none;
    border-color: #ff0000;
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.8);
    background: #000000;
}

.discord-form-textarea {
    resize: none;
    height: 150px;
    font-family: 'Share Tech Mono', monospace; /* เปลี่ยนเป็น font ที่ใช้ใน body */
}

.discord-form-submit-btn {
    width: 60%; /* ปรับ width ให้เล็กลงเล็กน้อย */
    padding: 10px;
    background: #800000;
    color: #ffffff;
    border: 1px solid #ff0000;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: normal;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
    margin: 20px auto 0; /* จัดกึ่งกลางและเพิ่ม margin บน */
    display: block;
}

.discord-form-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 25px rgba(255, 0, 0, 0.7);
    background: #ff0000;
    color: #000000;
}

.discord-form-submit-btn:active {
    transform: translateY(0);
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.5);
    background: #660000;
}

.discord-form-submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    background: #333;
    color: #999;
    border-color: #666;
}

.discord-form-loading {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #ff0000;
    text-shadow: 0 0 5px rgba(255, 0, 0, 0.7);
}

.discord-form-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 0, 0, 0.3);
    border-radius: 50%;
    border-top-color: #ff0000;
    animation: spin 0.8s ease-in-out infinite;
}

.discord-form-success-message, .discord-form-error-message {
    padding: 15px;
    border-radius: 5px;
    margin-top: 20px;
    font-weight: normal;
    text-align: center;
    display: none;
    text-shadow: 0 0 5px rgba(255, 0, 0, 0.7);
    font-size: 1.2rem;
    margin: 20px auto 0; /* จัดกึ่งกลาง */
    max-width: 60%; /* จำกัดความกว้าง */
}

.discord-form-success-message {
    background: rgba(128, 0, 0, 0.2);
    color: #573352;
    border: 1px solid #ff0000;
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.5);
}

.discord-form-error-message {
    background: rgba(255, 0, 0, 0.2);
    color: #ff0000;
    border: 1px solid #ff0000;
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.5);
}

/* === Responsive Design (ปรับแก้และเพิ่มใหม่ทั้งหมด) === */

/* สำหรับหน้าจอขนาดใหญ่ (Tablet Landscape ขึ้นไป) */
@media (min-width: 1025px) {
    .members-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 2rem; /* เพิ่ม gap สำหรับจอใหญ่ */
        padding: 0 2rem; /* เพิ่ม padding */
    }
    .member-card {
        padding: 2.5rem; /* เพิ่ม padding */
    }
}

/* สำหรับแท็บเล็ต (Tablet Portrait - Landscape) และบาง Desktop ขนาดเล็ก */
@media (max-width: 1024px) {
    .nav {
        top: 1rem;
        right: 1rem;
        flex-direction: column;
        gap: 0.5rem;
    }
    .nav-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
        letter-spacing: 1px;
    }
    .org-title {
        font-size: 2.5rem;
    }
    .org-subtitle {
        font-size: 1rem;
        letter-spacing: 1px;
    }
    .section-title {
        font-size: 2rem;
    }
    .page3-title {
        font-size: 2rem;
    }
    .members-grid {
        grid-template-columns: repeat(2, 1fr); /* เปลี่ยนเป็น 2 คอลัมน์คงที่ */
        gap: 1rem;
        padding: 0 1rem;
    }
    .member-card {
        padding: 1.5rem;
    }
    .member-photo {
        width: 140px;
        height: 140px;
        margin-bottom: 0.6rem;
    }
    .member-name {
        font-size: 1.3rem;
    }
    .member-nameEng {
        font-size: 0.9rem;
    }
    .member-role {
        font-size: 0.75rem;
    }
    .member-image {
        width: 60px;
        height: 60px;
        margin-left: 0; /* ลบ margin-left ออก */
        margin-bottom: 8px;
    }
    .stat-bar {
        width: 80px;
    }
    .loading-text {
        font-size: 1.5rem;
    }
    .progress-container {
        width: 80%;
        height: 18px;
    }
    .access-denied {
        font-size: 1.2rem;
    }
    .access-input, .access-btn {
        padding: 0.8rem;
        font-size: 0.9rem;
    }
    .modal-content {
        width: 90%;
        margin: 5% auto;
    }
    .profile-info {
        grid-template-columns: 1fr; /* 1 คอลัมน์ใน modal */
    }
    .modal-body {
        padding: 20px;
    }
    .close {
        font-size: 1.8rem;
    }
    .popup-image {
        max-width: 95%;
        height: auto;
    }
    .close-btn {
        width: 40px;
        height: 40px;
        font-size: 20px;
        top: -10px;
        right: -10px;
    }
    .copyright {
        font-size: 0.85rem;
    }
    .discord-form-header h1 {
        font-size: 2rem;
        margin-top: 100px; /* ลด margin-top ลง */
    }
    .discord-form-header p {
        font-size: 1rem;
    }
    .discord-form-input, .discord-form-textarea, .discord-form-submit-btn, .discord-form-success-message, .discord-form-error-message {
        width: 90%; /* ขยายความกว้างของฟอร์ม */
    }
    .discord-form-label {
        font-size: 1.1rem;
    }
}

/* สำหรับมือถือ (Mobile Landscape - Tablet Portrait) */
@media (max-width: 768px) {
    .nav {
        top: 1rem;
        right: 1rem;
        flex-direction: column;
        gap: 0.5rem;
    }
    .nav-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
        letter-spacing: 1px;
    }
    .org-title {
        font-size: 2.5rem;
    }
    .org-subtitle {
        font-size: 1rem;
        letter-spacing: 1px;
    }
    .section-title {
        font-size: 2rem;
    }
    .page3-title {
        font-size: 2rem;
    }
    .members-grid {
        grid-template-columns: repeat(2, 1fr); /* เปลี่ยนเป็น 2 คอลัมน์คงที่ */
        gap: 1rem;
        padding: 0 1rem;
    }
    .member-card {
        padding: 1.5rem;
    }
    .member-photo {
        width: 140px;
        height: 140px;
        margin-bottom: 0.6rem;
    }
    .member-name {
        font-size: 1.3rem;
    }
    .member-nameEng {
        font-size: 0.9rem;
    }
    .member-role {
        font-size: 0.75rem;
    }
    .member-image {
        width: 60px;
        height: 60px;
        margin-left: 0; /* ลบ margin-left ออก */
        margin-bottom: 8px;
    }
    .stat-bar {
        width: 80px;
    }
    .loading-text {
        font-size: 1.5rem;
    }
    .progress-container {
        width: 80%;
        height: 18px;
    }
    .access-denied {
        font-size: 1.2rem;
    }
    .access-input, .access-btn {
        padding: 0.8rem;
        font-size: 0.9rem;
    }
    .modal-content {
        width: 90%;
        margin: 5% auto;
    }
    .profile-info {
        grid-template-columns: 1fr; /* 1 คอลัมน์ใน modal */
    }
    .modal-body {
        padding: 20px;
    }
    .close {
        font-size: 1.8rem;
    }
    .popup-image {
        max-width: 95%;
        height: auto;
    }
    .close-btn {
        width: 40px;
        height: 40px;
        font-size: 20px;
        top: -10px;
        right: -10px;
    }
    .copyright {
        font-size: 0.85rem;
    }
    .discord-form-header h1 {
        font-size: 2rem;
        margin-top: 100px; /* ลด margin-top ลง */
    }
    .discord-form-header p {
        font-size: 1rem;
    }
    .discord-form-input, .discord-form-textarea, .discord-form-submit-btn, .discord-form-success-message, .discord-form-error-message {
        width: 90%; /* ขยายความกว้างของฟอร์ม */
    }
    .discord-form-label {
        font-size: 1.1rem;
    }
}

/* สำหรับมือถือขนาดเล็ก (Mobile Portrait) */
@media (max-width: 480px) {
    .nav {
        top: 0.5rem;
        right: 0.5rem;
        gap: 0.3rem;
    }
    .nav-btn {
        padding: 0.3rem 0.6rem;
        font-size: 0.7rem;
        letter-spacing: 0.5px;
    }
    .org-title {
        font-size: 2rem;
    }
    .org-subtitle {
        font-size: 0.8rem;
        letter-spacing: 0.5px;
    }
    .section-title {
        font-size: 1.5rem;
        margin-bottom: 1.5rem;
    }
    .page3-title {
        font-size: 1.5rem;
    }
    .members-grid {
        grid-template-columns: repeat(2, 1fr); /* เปลี่ยนเป็น 2 คอลัมน์คงที่ */
        gap: 0.8rem;
        padding: 0 0.5rem; /* ลด padding ด้านข้าง */
    }
    .member-card {
        padding: 1rem;
        border-radius: 10px;
    }
    .member-photo {
        width: 100px;
        height: 100px;
        margin-bottom: 0.5rem;
        border-radius: 20%; /* กลับเป็นทรงเดิม */
    }
    .member-name {
        font-size: 1.1rem;
    }
    .member-nameEng {
        font-size: 0.8rem;
        margin-bottom: 0.5rem;
    }
    .member-role {
        font-size: 0.7rem;
    }
    .member-image {
        width: 50px;
        height: 50px;
        margin-bottom: 5px;
    }
    .stat {
        flex-direction: column; /* กลับเป็น column เพื่อให้ข้อความและ bar ไม่เบียดกัน */
        gap: 0.2rem; /* ลด gap */
    }
    .stat-bar {
        width: 80px; /* ปรับให้ใหญ่ขึ้นเล็กน้อยเพื่อให้เห็นชัดเจนขึ้น */
        height: 3px;
        margin-top: 5px; /* เพิ่ม margin */
    }
    .loading-text {
        font-size: 1.2rem;
    }
    .progress-container {
        width: 90%;
        height: 16px;
    }
    .access-denied {
        font-size: 1rem;
    }
    .access-input, .access-btn {
        padding: 0.6rem;
        font-size: 0.8rem;
    }
    .modal-content {
        width: 95%;
        margin: 2% auto; /* ชิดขอบบนเล็กน้อย */
    }
    .modal-header h2 {
        font-size: 1.5rem;
    }
    .profile-photo {
        width: 120px;
        height: 120px;
        margin-bottom: 20px;
    }
    .info-group {
        padding: 15px;
    }
    .info-group h3 {
        font-size: 1.1rem;
    }
    .info-label, .info-value {
        font-size: 0.9rem;
    }
    .story-section {
        padding: 15px;
    }
    .story-section h3 {
        font-size: 1.2rem;
    }
    .story-text {
        font-size: 0.9rem;
    }
    .social-links {
        gap: 0.5rem;
    }
    .social-link {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
    .popup-image {
        max-width: 98%;
    }
    .close-btn {
        width: 35px;
        height: 35px;
        font-size: 18px;
        top: -8px;
        right: -8px;
    }
    .iframe-wrapper {
        height: 60vh;
        min-height: 400px;
    }
    .copyright {
        font-size: 0.75rem;
        justify-content: center; /* จัดกึ่งกลางบนมือถือ */
    }
    .discord-form-header h1 {
        font-size: 1.5rem;
        margin-top: 50px; /* ลด margin-top อีก */
    }
    .discord-form-header p {
        font-size: 0.9rem;
    }
    .discord-form-input, .discord-form-textarea, .discord-form-submit-btn, .discord-form-success-message, .discord-form-error-message {
        width: 95%; /* ขยายความกว้างของฟอร์มให้เต็มที่ */
    }
    .discord-form-label {
        font-size: 1rem;
    }
}

/* Very small screens (e.g., iPhone SE/old Androids) */
@media (max-width: 360px) {
    .org-title {
        font-size: 1.8rem;
    }
    .section-title {
        font-size: 1.4rem;
    }
    .member-photo {
        width: 90px; /* ปรับขนาดลงอีกเล็กน้อยเพื่อให้ 2 คนต่อแถวพอดีขึ้น */
        height: 90px;
    }
    .member-name {
        font-size: 1rem;
    }
    .member-nameEng {
        font-size: 0.7rem;
    }
    .member-role {
        font-size: 0.65rem;
    }
    .member-image {
        width: 40px;
        height: 40px;
    }
    .stat-bar {
        width: 60px; /* ปรับความกว้างของ stat bar */
    }
    .access-input, .access-btn {
        font-size: 0.75rem;
        padding: 0.5rem;
    }
    .discord-form-header h1 {
        font-size: 1.3rem;
    }
}

/* Additional utility classes for better mobile experience */
.mobile-optimized {
    -webkit-tap-highlight-color: rgba(255, 0, 0, 0.2);
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Smooth scrolling for mobile */
@media screen and (max-width: 768px) {
    * {
        -webkit-overflow-scrolling: touch;
    }
}