/* === VARIABEL CSS & RESET === */
:root, [data-theme="dark"] {
  /* Warna Primer (Merah) */
  --primary: #b91c1c; /* Deep Red for main interactions */
  --primary-dark: #8c1616; /* Darker Red */
  --primary-light: #ef4444; /* Brighter Red */
  --primary-light-rgb: 239, 68, 68; /* RGB value for ef4444, useful for shadows */
  
  /* Warna Sekunder (Emas/Kuning Keemasan) */
  --secondary: #fbbf24; /* Gold/Amber for highlights */
  --secondary-dark: #d97706; /* Darker Gold/Amber */
  --accent: #fbbf24; /* Use Gold for accent consistent with secondary */
  
  /* Warna Gelap (Hitam) */
  --dark: #050505; /* Very deep black */
  --darker: #000000; /* Pure black */
  
  /* Warna Terang/Abu-abu */
  --light: #f0f0f0; /* Light gray for contrast */
  --gray: #666666; /* Medium gray */
  --gray-light: #aaaaaa; /* Lighter gray */
  
  /* Warna Status (disesuaikan agar cocok) */
  --success: #10b981; /* Keeping green for success */
  --danger: #ef4444; /* Keep bright red for danger */
  --warning: #fbbf24; /* Use Gold for warning */
  --info: #06b6d4; /* Keeping blue for info */
  
  /* Gradien */
  --gradient-primary: linear-gradient(135deg, var(--primary), var(--secondary)); /* Red to Gold */
  --gradient-dark: linear-gradient(135deg, var(--dark), var(--darker)); /* Black gradient */
  --gradient-gold: linear-gradient(135deg, var(--secondary), #fde047); /* Gold gradient */
  --gradient-hero: linear-gradient(135deg, rgba(0, 0, 0, 0) 0%, rgba(5, 5, 5, 0.6) 100%); /* Darker hero gradient */
  
  /* Shadow dan Radius */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  
  --border-radius: 8px;
  --border-radius-lg: 12px;
  --border-radius-xl: 16px;
  
  /* Background & Warna Teks Utama */
  --bg-primary: #121212; /* Main dark background */
  --bg-secondary: #1a1a1a; /* Slightly lighter dark background for sections/panels */
  --bg-card: #1a1a1a; /* Card background same as secondary */
  --text-primary: #f0f0f0; /* Main text color (light for dark background) */
  --text-secondary: #cccccc; /* Secondary text color */
  --text-muted: #888888; /* Muted text color */
  --border-color: #333333; /* Dark border color for subtle separation */
  --header-bg: rgba(0, 0, 0, 0.85); /* Translucent black header */
  --footer-bg: #0d0d0d; /* Slightly different dark for footer */
}

/* Penyesuaian untuk Light Theme (jika ada) - Disesuaikan agar kontras tetap baik */
[data-theme="light"] {
  --primary: #b91c1c; /* Red */
  --primary-dark: #8c1616;
  --primary-light: #ef4444;
  --primary-light-rgb: 239, 68, 68; /* RGB value for ef4444 */
  --secondary: #fbbf24; /* Gold */
  --secondary-dark: #d97706;
  --accent: #fbbf24; /* Gold */
  
  --bg-primary: #f8fafc; /* Keep light background */
  --bg-secondary: #ffffff; /* Keep white cards */
  --bg-card: #ffffff;
  --text-primary: #0f172a; /* Darker text */
  --text-secondary: #475569;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --header-bg: rgba(255, 255, 255, 0.85);
  --footer-bg: #f0f0f0;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  transition: background 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
  min-height: 100vh;
}

/* === PARTICLE BACKGROUND === */
#particles-js {
  position: fixed;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  z-index: -1;
}

/* === HEADER MODERN === */
.site-header {
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 0.75rem 0;
  transition: all 0.3s ease;
  /* NEW: Flex container for stacking top and bottom parts */
  display: flex; 
  flex-direction: column; 
  align-items: center; 
  gap: 0.5rem; 
}

.site-header.scrolled {
  padding: 0.5rem 0;
  box-shadow: var(--shadow-lg);
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between; /* Default for desktop */
  max-width: 1200px;
  width: 100%; /* Take full width for inner alignment */
  margin: 0 auto;
  padding: 0 1rem;
  gap: 1rem;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 700;
  font-size: clamp(1rem, 4vw, 1.25rem);
  flex-shrink: 0;
}

.header-logo {
  height: clamp(32px, 8vw, 40px);
  width: auto;
  object-fit: contain;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: clamp(1rem, 4vw, 1.25rem);
  padding: 0.5rem;
  border-radius: var(--border-radius);
  transition: all 0.3s ease;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  min-height: 40px;
}

.btn-icon:hover {
  background: var(--bg-secondary);
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--gradient-primary);
  color: white;
  border: none;
  padding: clamp(0.6rem, 2vw, 0.75rem) clamp(1rem, 3vw, 1.5rem);
  border-radius: var(--border-radius);
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.3s ease;
  cursor: pointer;
  font-size: clamp(0.8rem, 3vw, 0.9rem);
  white-space: nowrap;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border: 2px solid var(--border-color);
  padding: clamp(0.6rem, 2vw, 0.75rem) clamp(1rem, 3vw, 1.5rem);
  border-radius: var(--border-radius);
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.3s ease;
  cursor: pointer;
  font-size: clamp(0.8rem, 3vw, 0.9rem);
}

.btn-outline:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}

/* NEW: Mobile Header Actions below logo */
.mobile-header-actions {
  display: none; /* Hidden by default, shown by media query */
  justify-content: center; 
  align-items: center;
  width: 100%;
  max-width: 500px; /* Limit width to keep buttons grouped, adjustable */
  gap: 0.5rem; 
  padding: 0.5rem 0.5rem; /* Reduced padding for mobile */
  border-top: 1px solid var(--border-color); 
}

.btn-mobile-action {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  padding: 0.6rem 0.4rem; /* Adjusted padding */
  border-radius: var(--border-radius);
  font-weight: 500;
  text-decoration: none;
  display: flex;
  flex-direction: column; 
  align-items: center;
  gap: 0.25rem;
  transition: all 0.3s ease;
  cursor: pointer;
  font-size: 0.7rem; /* Smaller font for text */
  flex-grow: 1; 
  max-width: 120px; 
}

.btn-mobile-action i {
  font-size: 1rem; /* Icon size */
  color: var(--primary-light); 
}

.btn-mobile-action:hover {
  background: var(--primary-dark); 
  color: white;
  border-color: var(--primary);
  transform: translateY(-2px) scale(1.02); /* Added subtle scale for more effect */
  box-shadow: 0 0 10px rgba(var(--primary-light-rgb), 0.5); 
}
.btn-mobile-action:hover i {
    color: var(--secondary); 
}


/* === MAIN CONTENT === */
.main-content {
  padding-top: 80px; /* Default for desktop */
  min-height: calc(100vh - 140px);
}
.main-content > section {
    margin-bottom: 2.5rem;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 clamp(0.5rem, 3vw, 1rem);
  width: 100%;
}

/* === HERO SECTION === */
.hero-section {
  background: var(--gradient-hero);
  color: white;
  padding: clamp(3rem, 8vw, 5rem) 0;
  text-align: center;
  position: relative;
  overflow: hidden;
  margin-top: 1rem;
  border-radius: var(--border-radius-xl);
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 800px;
  margin: 0 auto;
  padding: 0 1rem;
}

.hero-title {
  font-size: clamp(1.75rem, 6vw, 3rem);
  font-weight: 700;
  margin-bottom: 1rem;
  /* Warna teks dari putih ke merah ke emas */
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--primary-light) 50%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}

.hero-subtitle {
  font-size: clamp(0.9rem, 3vw, 1.25rem);
  color: var(--gray-light);
  margin-bottom: 1.5rem;
  opacity: 0.9;
  line-height: 1.5;
}

.hero-disclaimer {
    font-size: clamp(0.75rem, 2.5vw, 0.9rem);
    color: var(--text-muted);
    font-style: italic;
    opacity: 0.8;
    max-width: 600px;
    margin: 0 auto 2rem auto;
    padding: 0 1rem;
    line-height: 1.6;
}

/* === LIVE INFO SECTION === */
.live-info-section {
    background: var(--gradient-primary); /* Gradien merah ke emas */
    color: white;
    padding: clamp(1.5rem, 4vw, 2rem);
    border-radius: var(--border-radius-xl);
    text-align: center;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    box-shadow: var(--shadow-lg);
}

.live-info-title {
    font-size: clamp(1rem, 4vw, 1.25rem);
    font-weight: 600;
    margin-bottom: 0;
    opacity: 0.9;
}

.live-clock-widget {
    font-size: clamp(1.1rem, 4vw, 1.3rem);
    font-weight: 700;
    color: white;
}

.live-clock-widget .seconds {
    color: var(--secondary); /* Warna emas */
    font-weight: 700;
}


/* === FEATURES GRID === */
.features-section {
  padding-top: 1rem;
}

.section-title {
  font-size: clamp(1.5rem, 5vw, 2rem);
  font-weight: 700;
  text-align: center;
  margin-bottom: clamp(1.5rem, 4vw, 2rem);
  color: var(--text-primary);
  line-height: 1.2;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: clamp(1rem, 3vw, 1.5rem);
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-xl);
  padding: clamp(1rem, 4vw, 1.5rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  text-decoration: none;
}

.feature-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gradient-primary); /* Gradien merah ke emas */
  transform: scaleX(0);
  transition: transform 0.4s ease;
}

.feature-card:hover::before {
  transform: scaleX(1);
}

.feature-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-xl);
  border-color: var(--primary); /* Border merah saat hover */
}

.feature-icon {
  font-size: clamp(2rem, 6vw, 2.5rem);
  color: var(--primary); /* Ikon merah */
  margin-bottom: 1rem;
}

.feature-title {
  font-size: clamp(1rem, 3vw, 1.1rem);
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
  line-height: 1.3;
}

.feature-description {
  color: var(--text-secondary);
  font-size: clamp(0.8rem, 2.5vw, 0.9rem);
  line-height: 1.5;
  margin-top: auto;
}


/* === RESULTS SECTION (Tampilan Baru) === */
#homepage-results {
  padding-bottom: 2rem;
}
.result-card {
  background: rgba(30, 41, 59, 0.5); /* Glassmorphism background */
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1); /* Subtle border */
  border-radius: var(--border-radius-xl);
  padding: clamp(1rem, 3vw, 1.5rem);
  text-align: center;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  height: 100%;
}

[data-theme="light"] .result-card {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.result-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 30px rgba(0,0,0,0.2);
  border-color: var(--primary);
}

.result-card-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.result-card-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.result-ball-container {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    align-items: center;
    margin-bottom: 1.25rem;
}

.result-ball {
  width: clamp(32px, 8vw, 38px);
  height: clamp(32px, 8vw, 38px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: clamp(0.9rem, 3vw, 1rem);
  background: var(--bg-primary); /* Bola result latar hitam */
  color: var(--secondary); /* Angka emas */
  border: 1px solid var(--border-color);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.2), 0 2px 4px rgba(0,0,0,0.1);
  font-feature-settings: 'tnum'; /* PENAMBAHAN BARU: Agar lebar angka konsisten */
}

.view-data-link {
    font-size: 0.8rem;
    color: var(--primary-light); /* Link merah terang */
    text-decoration: none;
    margin-top: auto;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    transition: all 0.2s ease;
}
.view-data-link:hover {
    color: var(--secondary); /* Link emas saat hover */
    letter-spacing: 0.5px;
}
.view-data-link i {
    transition: transform 0.3s ease;
}
.view-data-link:hover i {
    transform: translateX(4px);
}

/* === TERMINAL INFO === */
.terminal-window {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.terminal-header {
  background: var(--bg-secondary);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
}

.terminal-dots {
  display: flex;
  gap: 0.5rem;
}

.terminal-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.terminal-dot.red { background: #ff5f56; }
.terminal-dot.yellow { background: #ffbd2e; }
.terminal-dot.green { background: #27c93f; }

.terminal-title {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-left: 1rem;
  font-weight: 500;
}

.terminal-body {
  padding: 1.25rem 1rem;
  font-family: 'Courier New', Courier, monospace;
  font-size: clamp(0.9rem, 3vw, 1rem);
  color: var(--secondary); /* PERUBAHAN: Teks terminal emas/kuning */
  min-height: 60px;
  line-height: 1.5;
}

#typing-text::after {
  content: '_';
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  from, to { opacity: 1; }
  50% { opacity: 0; }
}

/* === FOOTER === */
.main-footer {
  background: var(--footer-bg); /* Latar belakang footer lebih gelap */
  color: var(--text-secondary);
  padding: 3rem 1rem; /* Padding lebih besar */
  margin-top: 3rem;
  border-top: 1px solid var(--border-color);
  box-shadow: 0 -10px 20px rgba(0,0,0,0.3); /* Efek terangkat */
}

/* Animasi untuk teks copyright */
@keyframes copyright-color-pulse {
  0% { color: var(--text-secondary); }
  50% { color: var(--secondary); } /* Berubah ke warna emas */
  100% { color: var(--text-secondary); }
}

.copyright-text {
    font-size: clamp(0.85rem, 2.5vw, 1rem);
    font-weight: 500;
    margin-bottom: 1rem; /* Jarak dari ikon sosial */
    animation: copyright-color-pulse 4s infinite ease-in-out; /* Animasi denyut warna */
    display: block; /* Memastikan animasi bekerja pada elemen blok */
}

.social-icons {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem; /* Jarak antar ikon lebih besar */
}

.social-icons a {
    color: var(--text-secondary); /* Warna ikon default abu-abu terang */
    font-size: clamp(1.4rem, 4vw, 1.8rem); /* Ukuran ikon lebih besar */
    transition: all 0.3s ease-in-out;
}

.social-icons a:hover {
    color: var(--primary); /* Warna ikon berubah jadi merah saat hover */
    transform: translateY(-5px) scale(1.1); /* Efek mengangkat dan membesar */
    text-shadow: 0 0 10px rgba(var(--primary-light-rgb), 0.7); /* Efek glow merah */
}


/* === MOBILE NAVIGATION === */
.mobile-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--header-bg);
  border-top: 1px solid var(--border-color);
  z-index: 1000;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  height: 65px;
  padding: 0 5px;
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: var(--text-secondary);
  flex: 1;
  transition: color 0.2s ease-in-out;
  position: relative;
}

.mobile-nav-item:hover, .mobile-nav-item.active {
  color: var(--primary); /* Item aktif/hover merah */
}

.mobile-nav-item i {
  font-size: 1.25rem;
  margin-bottom: 2px;
}

.mobile-nav-item span {
  font-size: 0.7rem;
  font-weight: 500;
}

.mobile-nav-item .mobile-nav-item-main {
  background: var(--gradient-primary); /* Tombol utama gradien merah ke emas */
  color: white;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: -28px;
  border: 4px solid var(--bg-primary);
  box-shadow: var(--shadow-lg);
}
.mobile-nav-item.active .mobile-nav-item-main i {
    font-size: 1.5rem;
    margin: 0;
}
.mobile-nav-item.active span {
    margin-top: 30px; /* Jarak untuk tombol home */
}


/* === MODALS === */
.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-xl);
  box-shadow: var(--shadow-xl);
  color: var(--text-primary);
}

.modal-header {
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 1.25rem;
}
.modal-header .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%); /* Warna tombol close tetap kontras di dark mode */
}

.modal-title {
  font-weight: 600;
  font-size: clamp(1.1rem, 3vw, 1.25rem);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.modal-title i {
    color: var(--secondary); /* Ikon judul modal emas */
}

.modal-body {
  padding: 1.5rem;
}
/* Perbaikan: Warna teks di modal bandar agar terlihat */
#bandarModal .modal-body p.text-muted {
    color: var(--gray-light) !important; /* Gunakan warna terang agar terbaca */
}

/* PERBAIKAN BARU: Warna teks deskripsi di modal agar terbaca */
#polaAiModal .text-muted,
#pangkasLnModal .text-muted {
    color: var(--text-secondary) !important;
}


/* === OFF-CANVAS MENU MODERN === */
.offcanvas {
    background-color: var(--bg-primary);
    color: var(--text-primary);
}
.offcanvas-header {
    border-bottom: 1px solid var(--border-color);
}
.offcanvas-body {
    padding: 1rem;
}
.offcanvas-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.offcanvas-nav-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    transition: all 0.2s ease-in-out;
}
.offcanvas-nav-link:hover {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}
.offcanvas-nav-link i {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
    color: var(--primary); /* Ikon offcanvas merah */
}
.offcanvas-body hr {
    border-color: var(--border-color);
}


/* === PERBAIKAN BOLA WARNA & PALET === */
.bola-merah {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s ease;
    border: 1px solid rgba(255,255,255,0.2);
}
.bola-merah:hover {
    transform: scale(1.1);
}

#manualColorPalette {
    display: flex;
    gap: 8px;
    align-items: center;
}

.color-swatch {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s ease;
}

.color-swatch:hover {
    transform: scale(1.1);
}

.color-swatch.active {
    border-color: var(--secondary); /* Border emas saat aktif */
    transform: scale(1.2);
    box-shadow: 0 0 8px var(--secondary);
}


/* === RESPONSIVE DESIGN === */
@media (min-width: 992px) {
    body {
        padding-bottom: 0;
    }
}

/* Keyframes untuk efek denyut pada logo */
@keyframes pulse {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.05); opacity: 0.9; }
  100% { transform: scale(1); opacity: 1; }
}

/* Aturan untuk tampilan desktop kecil dan mobile (lebar layar kurang dari 992px) */
@media (max-width: 991.98px) {
  .site-header {
    padding: 0.5rem 0; 
    gap: 0.5rem; 
  }

  .header-container {
    justify-content: center; /* Memusatkan logo */
    padding: 0 0.5rem; 
  }

  /* Sembunyikan tombol offcanvas (hamburger) di header container ini */
  .site-header .header-left .btn-icon {
    display: none !important; 
  }

  /* Sembunyikan navigasi desktop */
  .site-header .header-nav {
    display: none !important;
  }

  /* PERUBAHAN: Mengecilkan logo di mobile */
  .site-header .header-brand .header-logo {
    animation: pulse 3s infinite ease-in-out;
    height: 50px; /* Ukuran logo dikecilkan */
  }

  /* NEW: Show mobile-header-actions on mobile screens */
  .mobile-header-actions {
    display: flex; /* Make it visible */
    border-top: 1px solid var(--border-color); /* Add a border to separate from logo */
    margin-top: 0.5rem; /* Space from logo */
    padding: 0.5rem; /* Adjusted padding */
    width: auto; 
    max-width: none; 
    flex-wrap: wrap; 
    justify-content: center; 
    gap: 0.5rem; 
  }

  .btn-mobile-action {
    flex-grow: 0; 
    width: auto;
    min-width: 60px; /* Dikecilkan agar lebih ringkas */
    padding: 0.4rem 0.2rem; /* Dikecilkan agar lebih ringkas */
    font-size: 0.6rem; /* Dikecilkan agar lebih ringkas */
  }
  .btn-mobile-action i {
    font-size: 1rem; 
  }
  
  /* PERUBAHAN: Menyesuaikan padding-top untuk body */
  body {
    padding-top: 130px; /* Disesuaikan agar konten tidak tertutup header */
  }
  .main-content {
      padding-top: 0; 
  }
}

/* Aturan untuk tampilan tablet kecil dan mobile (lebar layar kurang dari 768px) */
@media (max-width: 768px) {
  .header-nav .btn-outline {
    display: none; 
  }

  .hero-section {
    padding: clamp(2rem, 8vw, 4rem) 0;
  }
}

/* Aturan untuk tampilan mobile (lebar layar kurang dari 576px) */
@media (max-width: 576px) {
  .features-grid {
    grid-template-columns: repeat(2, 1fr); 
    gap: 0.75rem;
  }
  .feature-card {
    padding: 0.75rem 0.5rem;
    border-radius: var(--border-radius-lg);
  }
  .feature-icon {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
  }
  .feature-title {
    font-size: 0.75rem; 
    font-weight: 600;
    margin-bottom: 0;
    line-height: 1.2;
  }
  .feature-description {
    display: none; 
  }

  .result-card-title {
    font-size: 0.85rem;
  }
  .result-card-date {
    font-size: 0.7rem;
  }
  .result-ball-container {
    gap: 0.5rem;
  }
  .result-ball {
    width: 30px;
    height: 30px;
    font-size: 0.85rem;
  }

  /* Modals */
  .modal-body {
    padding: 1rem;
  }
  .modal .result-ball {
    width: 28px;
    height: 28px;
    font-size: 0.8rem;
  }
  .modal .result-ball-container {
    gap: 4px;
    flex-wrap: wrap; /* Allow balls to wrap in smaller screens */
  }
  .modal .table td, .modal .table th {
    padding: 0.6rem 0.2rem;
    font-size: 0.8rem;
  }
  .modal-title {
    font-size: 1rem;
  }
  
  /* Footer mobile */
  .main-footer {
    padding: 2rem 1rem;
  }
  .copyright-text {
    font-size: 0.75rem;
    margin-bottom: 0.8rem;
  }
  .social-icons {
    gap: 1rem;
  }
  .social-icons a {
    font-size: 1.2rem;
  }
}

/* Penyesuaian khusus untuk layar sangat kecil (misal, 300-320px lebar) */
@media (max-width: 320px) {
  html {
    font-size: 13px; 
  }

  .header-logo {
    height: 50px; 
  }

  .hero-title {
    font-size: 1.4rem; 
  }
  .hero-subtitle {
    font-size: 0.8rem;
  }
  .hero-disclaimer {
    font-size: 0.65rem;
    margin-bottom: 1.5rem;
  }
  .btn-primary {
    padding: 0.5rem 0.8rem;
    font-size: 0.75rem;
  }

  .live-info-section {
    padding: 1rem;
  }
  .live-info-title {
    font-size: 0.85rem;
  }
  .live-clock-widget {
    font-size: 0.9rem;
  }

  .result-card {
    padding: 0.8rem;
  }
  .result-card-title {
    font-size: 0.75rem;
  }
  .result-card-date {
    font-size: 0.6rem;
  }
  .result-ball-container {
    gap: 3px;
  }
  .result-ball {
    width: 26px; 
    height: 26px;
    font-size: 0.75rem;
  }
  .view-data-link {
    font-size: 0.65rem;
  }

  .features-grid {
    gap: 0.4rem;
  }
  .feature-card {
    padding: 0.4rem;
    border-radius: var(--border-radius);
  }
  .feature-icon {
    font-size: 1.4rem;
    margin-bottom: 0.2rem;
  }
  .feature-title {
    font-size: 0.7rem;
  }

  .terminal-title {
    font-size: 0.75rem;
    margin-left: 0.7rem;
  }
  .terminal-body {
    font-size: 0.8rem;
    min-height: 45px;
    padding: 0.8rem 0.7rem;
  }

  .mobile-bottom-nav {
    height: 60px;
    padding: 0 3px;
  }
  .mobile-nav-item i {
    font-size: 1rem;
  }
  .mobile-nav-item span {
    font-size: 0.6rem;
  }
  .mobile-nav-item .mobile-nav-item-main {
    width: 48px;
    height: 48px;
    top: -24px;
    border-width: 2px;
  }
  .mobile-nav-item.active .mobile-nav-item-main i {
    font-size: 1.2rem;
  }
  .mobile-nav-item.active span {
    margin-top: 25px;
  }

  /* Modals */
  .modal-header {
    padding: 0.8rem 1rem;
  }
  .modal-title {
    font-size: 0.9rem;
  }
  .modal-body {
    padding: 0.8rem;
  }
  .modal .table td, .modal .table th {
    padding: 0.4rem 0.1rem;
    font-size: 0.7rem;
  }
  .bola-merah {
    width: 24px;
    height: 24px;
    font-size: 0.7rem;
  }
  #manualColorPalette {
    gap: 3px;
  }
  .color-swatch {
    width: 18px;
    height: 18px;
  }
  
  /* Footer mobile */
  .copyright-text {
    font-size: 0.7rem;
    margin-bottom: 0.7rem;
  }
  .social-icons {
    gap: 0.8rem;
  }
  .social-icons a {
    font-size: 1.1rem;
  }
}

/* === PERBAIKAN FINAL: Posisi Bola Result di Modal === */
/* Ini adalah perbaikan untuk memastikan konten tabel sejajar secara vertikal */
.modal .table > :not(caption) > * > * {
    vertical-align: middle; /* Pastikan semua konten di tengah secara vertikal */
}

/* Penyesuaian khusus untuk bola result di dalam tabel agar lebih rapi */
.modal .result-ball-container {
    margin-bottom: 0; /* Hapus margin bawah default */
    justify-content: center; /* Pastikan bola result di tengah horizontal */
    display: flex; /* Aktifkan flexbox */
    align-items: center; /* Pusatkan vertikal */
    flex-wrap: nowrap; /* Hindari wrapping jika bola terlalu banyak, akan di-scroll horizontal jika lebar kurang */
    overflow-x: auto; /* Tambahkan scroll horizontal jika bola terlalu banyak */
    -webkit-overflow-scrolling: touch; /* Smooth scrolling di iOS */
    padding-bottom: 5px; /* Sedikit padding untuk scrollbar */
}
/* Style untuk scrollbar jika muncul */
.modal .result-ball-container::-webkit-scrollbar {
    height: 4px;
}
.modal .result-ball-container::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 2px;
}
.modal .result-ball-container::-webkit-scrollbar-track {
    background-color: var(--bg-secondary);
}

/* Pastikan ukuran bola tetap konsisten di dalam tabel modal */
.modal .result-ball {
    width: 28px; /* Ukuran yang konsisten */
    height: 28px;
    font-size: 0.8rem;
    flex-shrink: 0; /* Jangan biarkan bola menyusut */
    margin: 2px; /* Tambahkan sedikit margin antar bola */
}

.modal .placeholder-text {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.modal.fade .modal-dialog {
  transform: translateY(-100px);
  opacity: 0;
  transition: transform 0.5s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.5s ease-out;
}

.modal.show .modal-dialog {
  transform: translateY(0);
  opacity: 1;
}

.result-card,
.feature-card {
  transition: transform 0.6s cubic-bezier(0.23, 1, 0.32, 1);
  transform-style: preserve-3d; /* Menciptakan konteks 3D untuk elemen di dalamnya */
}