/* ═══════════════════════════════════════════════════
   MAINAKOB - Main CSS (Shared)
   Theme: Modern Dark Gaming / Navy Blue
═══════════════════════════════════════════════════ */

:root {
  --navy: #060d1f;
  --navy-mid: #0a1428;
  --navy-card: #0d1a35;
  --navy-light: #152244;
  --blue: #1e3a8a;
  --blue-mid: #2563eb;
  --blue-bright: #3b82f6;
  --blue-glow: rgba(59, 130, 246, 0.3);
  --gold: #f59e0b;
  --gold-light: #fbbf24;
  --gold-dim: rgba(245,158,11,0.15);
  --text: #e2e8f0;
  --text-dim: #94a3b8;
  --text-faint: #475569;
  --founder: #f59e0b;
  --leader: #a78bfa;
  --support: #34d399;
  --member: #60a5fa;
  --danger: #ef4444;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Noto Sans Thai', 'Rajdhani', sans-serif;
  background: var(--navy);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ─── Background System ─────────────────────────── */
#bg-layer {
  position: fixed; inset: 0; z-index: 0;
  background: var(--navy);
  background-image:
    radial-gradient(ellipse 100% 60% at 50% -10%, rgba(30,58,138,0.5) 0%, transparent 60%),
    radial-gradient(ellipse 80% 50% at 100% 100%, rgba(6,13,31,0.9) 0%, transparent 50%),
    radial-gradient(ellipse 60% 40% at 0% 80%, rgba(37,99,235,0.15) 0%, transparent 50%);
  transition: background-image 0.8s ease;
}
.bg-noise {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}
.bg-grid {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background-image:
    linear-gradient(rgba(59,130,246,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(59,130,246,0.04) 1px, transparent 1px);
  background-size: 50px 50px;
}
.scanlines {
  position: fixed; inset: 0; z-index: 2; pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.03) 2px,
    rgba(0,0,0,0.03) 4px
  );
}

/* ─── Floating Social Buttons ───────────────────── */
.floating-social {
  position: fixed; right: 20px; top: 50%; transform: translateY(-50%);
  z-index: 100; display: flex; flex-direction: column; gap: 10px;
}
.float-btn {
  width: 46px; height: 46px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: white; text-decoration: none;
  transition: all 0.25s; position: relative;
  box-shadow: 0 4px 15px rgba(0,0,0,0.4);
}
.float-btn::before {
  content: ''; position: absolute; inset: -3px;
  border-radius: 50%; border: 2px solid transparent;
  transition: border-color 0.25s;
}
.fb-btn { background: linear-gradient(135deg, #1877f2, #0d5db5); }
.fb-btn:hover { transform: scale(1.15); box-shadow: 0 6px 20px rgba(24,119,242,0.5); }
.fb-btn:hover::before { border-color: rgba(24,119,242,0.5); }
.ig-btn { background: linear-gradient(135deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888); }
.ig-btn:hover { transform: scale(1.15); box-shadow: 0 6px 20px rgba(220,39,67,0.5); }

/* ─── Music Player ──────────────────────────────── */
.music-player {
  position: fixed; bottom: 20px; right: 20px; z-index: 100;
  display: flex; align-items: center; gap: 8px;
  background: rgba(10,20,40,0.85);
  border: 1px solid rgba(59,130,246,0.25);
  border-radius: 50px;
  padding: 8px 14px;
  backdrop-filter: blur(20px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.music-btn {
  background: none; border: none; color: var(--blue-bright);
  font-size: 16px; cursor: pointer; padding: 2px 4px;
  transition: color 0.2s, transform 0.2s;
}
.music-btn:hover { color: white; transform: scale(1.1); }
.volume-wrap { display: flex; align-items: center; gap: 6px; }
#volume-slider {
  -webkit-appearance: none; width: 70px; height: 3px;
  background: linear-gradient(90deg, var(--blue-bright) 50%, rgba(255,255,255,0.15) 50%);
  border-radius: 2px; outline: none; cursor: pointer;
}
#volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 12px; height: 12px;
  background: var(--blue-bright); border-radius: 50%;
  box-shadow: 0 0 6px var(--blue-glow);
}

/* ─── Homepage Specific ─────────────────────────── */
.home-main {
  position: relative; z-index: 10;
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 40px 20px;
}

.home-frame {
  text-align: center;
  max-width: 480px; width: 100%;
  animation: fadeInUp 0.8s ease both;
}

.gang-name-wrap {
  display: flex; align-items: center; gap: 16px;
  justify-content: center; margin-bottom: 28px;
}
.gang-accent-line {
  flex: 1; height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  max-width: 80px;
}
.gang-name {
  font-family: 'Saira Condensed', sans-serif;
  font-size: clamp(42px, 8vw, 72px);
  font-weight: 900; letter-spacing: 6px;
  color: white;
  text-shadow: 0 0 30px rgba(59,130,246,0.6), 0 0 60px rgba(59,130,246,0.3);
  line-height: 1;
}

/* Logo Frame */
.logo-frame {
  width: 220px; height: 220px;
  position: relative;
  margin: 0 auto 28px;
}
.logo-ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid transparent;
}
.ring-1 {
  border-color: rgba(59,130,246,0.4);
  animation: spin-cw 8s linear infinite;
  background: radial-gradient(ellipse, transparent 65%, rgba(59,130,246,0.05) 100%);
}
.ring-2 {
  inset: 12px;
  border-color: rgba(245,158,11,0.3);
  border-style: dashed;
  animation: spin-ccw 12s linear infinite;
}
.ring-3 {
  inset: 24px;
  border-color: rgba(59,130,246,0.2);
  animation: spin-cw 20s linear infinite;
}
.logo-inner {
  position: absolute; inset: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--navy-card), var(--navy-light));
  border: 2px solid rgba(59,130,246,0.3);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  animation: pulse-glow 3s ease-in-out infinite;
  box-shadow: 0 0 30px rgba(59,130,246,0.2), inset 0 0 30px rgba(0,0,0,0.3);
}
.logo-inner img {
  width: 100%; height: 100%; object-fit: cover;
  animation: rotate-logo 20s linear infinite;
}
.logo-placeholder {
  display: flex; flex-direction: column; align-items: center;
  color: rgba(59,130,246,0.5);
}
.logo-placeholder i { font-size: 36px; margin-bottom: 4px; }
.logo-placeholder span { font-size: 11px; letter-spacing: 2px; color: var(--text-faint); }

.logo-corner {
  position: absolute; width: 12px; height: 12px;
  border-color: var(--gold);
  border-style: solid;
}
.logo-corner.tl { top: 2px; left: 2px; border-width: 2px 0 0 2px; }
.logo-corner.tr { top: 2px; right: 2px; border-width: 2px 2px 0 0; }
.logo-corner.bl { bottom: 2px; left: 2px; border-width: 0 0 2px 2px; }
.logo-corner.br { bottom: 2px; right: 2px; border-width: 0 2px 2px 0; }

/* Partners Section */
.partners-section { 
  margin-bottom: 28px; 
  /* ดันเลเยอร์ส่วนพาร์ทเนอร์ทั้งหมดให้อยู่เหนือน้ำตกแผ่นใสอื่นๆ */
  position: relative;
  z-index: 20;
}

.partners-label {
  font-size: 11px; letter-spacing: 3px; color: var(--text-faint);
  margin-bottom: 10px; text-transform: uppercase;
}

.partners-list {
  display: flex; flex-wrap: wrap; gap: 8px;
  justify-content: center;
  /* เปิดให้เลเยอร์นี้ยอมรับการคลิกทะลุผ่านได้อย่างแม่นยำ */
  position: relative;
  z-index: 21;
}

/* ปรับปรุงสไตล์ตัวแท็กพาร์ทเนอร์ให้รองรับการกดลิงก์ (แท็ก a) */
.partner-tag {
  display: inline-block;
  padding: 4px 14px;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: 100px;
  color: var(--gold-light) !important; /* บังคับให้เป็นสีทองสว่างตามเดิมไม่ให้เปลี่ยนเป็นสีลิงก์ทั่วไป */
  font-size: 13px; 
  font-weight: 600;
  letter-spacing: 1px;
  text-decoration: none; /* ลบเส้นใต้ลิงก์ออก */
  
  /* 🛠️ จุดสำคัญ: ดัน z-index ตัวเองขึ้นมา และเปิด Pointer บังคับเมาส์เป็นรูปมือ */
  position: relative;
  z-index: 25;
  cursor: pointer !important;
  pointer-events: auto !important;
  transition: all 0.2s ease-in-out;
}

/* ✨ เพิ่มเอฟเฟกต์เวลาเมาส์ชี้ (Hover) ให้ปุ่มดูมีมิติและรู้ว่ากดได้ */
a.partner-tag:hover {
  background: rgba(245, 158, 11, 0.2) !important;
  border-color: var(--gold-light) !important;
  color: #fff !important; /* ชี้แล้วชื่อเปลี่ยนเป็นสีขาวสว่าง */
  transform: translateY(-2px); /* ลอยขึ้นเล็กน้อย */
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3); /* เรืองแสงสีทองบางๆ */
}

.partner-loading { color: var(--text-faint); font-size: 13px; }

/* CTA Button */
.cta-btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 32px;
  background: linear-gradient(135deg, var(--blue), var(--blue-mid));
  border: 1px solid rgba(59,130,246,0.4);
  border-radius: 12px;
  color: white; text-decoration: none;
  font-family: 'Saira Condensed', sans-serif;
  font-size: 18px; font-weight: 700; letter-spacing: 2px;
  transition: all 0.25s;
  box-shadow: 0 8px 30px rgba(30,58,138,0.4), inset 0 1px 0 rgba(255,255,255,0.1);
  margin-bottom: 16px;
}
.cta-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 40px rgba(59,130,246,0.4), inset 0 1px 0 rgba(255,255,255,0.15);
  border-color: rgba(59,130,246,0.7);
}
.cta-btn:active { transform: translateY(0); }

.powered-by {
  font-size: 10px; letter-spacing: 4px;
  color: var(--text-faint); text-transform: uppercase;
}

/* ─── Ad Pop-up ─────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  backdrop-filter: blur(8px);
  animation: fadeIn 0.3s ease both;
  
}
.modal-overlay.hidden { display: none; }

.ad-card {
  background: rgba(10, 20, 40, 0.92);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: 24px; 
  overflow: hidden;
  width: 100%; 
  /* 1. ขยายหน้ากว้างของการ์ดให้ใหญ่ขึ้นเต็มตาเท่ารูปแรก (ปรับจาก 340px เป็น 390px) */
  max-width: 600px; 
  animation: slideUp 0.35s cubic-bezier(0.34,1.56,0.64,1) both;
  backdrop-filter: blur(20px);
  box-shadow: 0 30px 80px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,255,255,0.05);
}
.ad-img-wrap {   
  width: 100%; 
  aspect-ratio: 1; 
  background: var(--navy-light); 
  position: relative; 
  overflow: hidden;

  /* 2. ปรับความเนียนในการ Fade ขอบล่างภาพให้สมดุลกับกล่องที่ขยายใหญ่ขึ้น */
  -webkit-mask-image: linear-gradient(to bottom, black 65%, transparent 98%);
  mask-image: linear-gradient(to bottom, black 65%, transparent 98%);
}
.ad-img-wrap img { width: 100%; height: 100%; object-fit: cover; }
.ad-close {
  position: absolute; top: 10px; right: 10px;
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(0,0,0,0.6); border: none;
  color: white; font-size: 14px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
  z-index: 20;
}
.ad-close:hover { background: rgba(0,0,0,0.9); }
.ad-body { padding: 20px;   text-align: center; }
.ad-body h3 { font-family: 'Saira Condensed', sans-serif; font-size: 22px; letter-spacing: 1px; color: white; margin-bottom: 8px; text-align: center; }
.ad-body p { color: var(--text-dim); font-size: 14px; line-height: 1.6; margin-bottom: 16px; text-align: center; }
.ad-action-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px;
  background: linear-gradient(135deg, var(--blue), var(--blue-bright));
  border-radius: 8px; color: white;
  text-decoration: none; font-weight: 600; font-size: 14px;
  transition: all 0.2s; 
}
.ad-action-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(59,130,246,0.4); }

a.partner-tag-link {
  display: inline-flex;
  align-items: center;
  padding: 4px 14px;
  background: rgba(245,158,11,0.08);
  border: 1px solid rgba(245,158,11,0.25);
  border-radius: 100px;
  color: var(--gold-light);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 1px;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s;
}
a.partner-tag-link:hover {
  background: rgba(245,158,11,0.2);
  border-color: rgba(245,158,11,0.6);
  color: white;
  transform: translateY(-2px);
}
a.partner-tag-link:active {
  transform: translateY(0);
}

/* ─── Animations ────────────────────────────────── */
@keyframes spin-cw { to { transform: rotate(360deg); } }
@keyframes spin-ccw { to { transform: rotate(-360deg); } }
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 30px rgba(59,130,246,0.2), inset 0 0 30px rgba(0,0,0,0.3); }
  50% { box-shadow: 0 0 50px rgba(59,130,246,0.4), inset 0 0 30px rgba(0,0,0,0.3); }
}
@keyframes rotate-logo { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(40px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ─── Page Loader Overlay ───────────────────────── */
.page-loader {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--navy);
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}
.page-loader.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.loader-content {
  display: flex; flex-direction: column; align-items: center; gap: 16px;
}
.loader-icon {
  font-size: 38px; color: var(--blue-bright);
}
.loader-text {
  font-family: 'Saira Condensed', sans-serif;
  font-size: 24px; font-weight: 700; letter-spacing: 3px;
  color: var(--text);
}

/* ─── Utilities ─────────────────────────────────── */
.hidden { display: none !important; }

/* ─── Responsive ────────────────────────────────── */
@media (max-width: 1024px) {
  .home-frame { max-width: 420px; }
  .gang-name { font-size: clamp(36px, 7vw, 60px); }
  .ad-card { max-width: 500px; }
}

@media (max-width: 768px) {
  /* Optimize performance on mobile by reducing heavy filters */
  .ad-card, .music-player { backdrop-filter: blur(8px); box-shadow: 0 10px 30px rgba(0,0,0,0.5); }
  .bg-noise { display: none; } /* Disable noise on smaller screens for better framerate */
  .logo-inner { animation: none; box-shadow: 0 0 15px rgba(59,130,246,0.3); } /* Simplify animation */
  
  .home-frame { max-width: 380px; }
  .logo-frame { width: 180px; height: 180px; }
  .logo-inner { inset: 24px; }
  .gang-name { font-size: clamp(32px, 6vw, 48px); }
  .ad-body h3 { font-size: 20px; }
}

@media (max-width: 480px) {
  .music-player { bottom: 12px; right: 12px; padding: 6px 10px; }
  #volume-slider { width: 50px; }
  .floating-social { right: 10px; }
  .float-btn { width: 40px; height: 40px; font-size: 15px; }
  .cta-btn { padding: 12px 24px; font-size: 16px; }
  .ad-card { max-width: 340px; }
  .ad-body h3 { font-size: 18px; }
  .ad-body p { font-size: 13px; }
}
