/* 4D Results MY-SG – Modern professional design */
:root {
  --primary: #1e3a8a;
  --primary-light: #2563eb;
  --primary-dark: #1e40af;
  --accent: #dc2626;
  --gold: #d97706;
  --gold-soft: #fef3c7;
  --bg: #f8fafc;
  --surface: #ffffff;
  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 4px 12px rgba(15, 23, 42, 0.04);
  --shadow-hover: 0 4px 6px rgba(15, 23, 42, 0.06), 0 12px 24px rgba(15, 23, 42, 0.08);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SF Mono", "Cascadia Code", "Consolas", ui-monospace, monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-size: 16px;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--primary-light); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--primary-dark); text-decoration: underline; }

.site-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(30, 58, 138, 0.25);
}
.header-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
}
.logo {
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
  text-decoration: none;
  white-space: nowrap;
}
.logo:hover { text-decoration: none; color: #fff; }
.logo span { color: #fcd34d; }
.nav-toggle {
  display: none;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.25);
  color: #fff;
  padding: 0.4rem 0.7rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.15rem;
  line-height: 1;
}
.main-nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem;
  align-items: center;
}
.main-nav a {
  color: rgba(255,255,255,0.88);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.4rem 0.65rem;
  border-radius: 8px;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.main-nav a:hover {
  background: rgba(255,255,255,0.12);
  color: #fff;
  text-decoration: none;
}
.main-nav a.active {
  background: rgba(255,255,255,0.18);
  color: #fcd34d;
}
@media (max-width: 900px) {
  .nav-toggle { display: block; }
  .main-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    background: var(--primary-dark);
    padding: 0.75rem 1rem 1.25rem;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  }
  .main-nav.open { display: block; }
  .main-nav ul { flex-direction: column; align-items: stretch; gap: 0.25rem; }
  .main-nav a { display: block; padding: 0.7rem 0.85rem; font-size: 0.95rem; }
}

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 1.75rem 1.25rem 2.5rem;
  flex: 1;
  width: 100%;
}
.page-title {
  font-size: clamp(1.5rem, 4vw, 1.85rem);
  font-weight: 700;
  margin-bottom: 0.4rem;
  color: var(--primary);
  letter-spacing: -0.025em;
  line-height: 1.25;
}
.page-subtitle {
  color: var(--text-secondary);
  margin-bottom: 1.75rem;
  font-size: 0.95rem;
  max-width: 42rem;
  line-height: 1.6;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.35rem;
  margin-bottom: 2rem;
}
.result-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.result-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}
.card-header {
  padding: 0.9rem 1.15rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  font-weight: 650;
  color: #fff;
  font-size: 0.95rem;
}
.card-header.magnum { background: linear-gradient(135deg, #b45309, #d97706); }
.card-header.toto { background: linear-gradient(135deg, #b91c1c, #dc2626); }
.card-header.damacai { background: linear-gradient(135deg, #1e3a5f, #1e40af); }
.card-header.sg { background: linear-gradient(135deg, #be123c, #e11d48); }
.card-header.sabah88 { background: linear-gradient(135deg, #14532d, #15803d); }
.card-header.stc { background: linear-gradient(135deg, #44403c, #78716c); }
.card-header .draw-meta {
  font-size: 0.75rem;
  font-weight: 500;
  opacity: 0.92;
  text-align: right;
  line-height: 1.35;
}
.card-body { padding: 1.15rem 1.15rem 0.85rem; }
.prize-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border-light);
}
.prize-row:last-of-type { border-bottom: none; }
.prize-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.prize-number {
  font-family: var(--font-mono);
  font-size: 1.55rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
  color: var(--text);
}
.prize-number.first { color: var(--accent); font-size: 1.85rem; }
.prize-group {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
}
.prize-group h4 {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.55rem;
  font-weight: 650;
}
.number-list { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.number-list span {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.3rem 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  min-width: 3.1rem;
  text-align: center;
  color: var(--text);
}
.card-footer {
  padding: 0.65rem 1.15rem;
  background: var(--bg);
  font-size: 0.72rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.25rem;
  border-top: 1px solid var(--border-light);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-bottom: 1.5rem;
  align-items: flex-end;
  padding: 1.1rem 1.2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.toolbar label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.toolbar input[type="date"],
.toolbar select {
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  background: var(--surface);
  color: var(--text);
  min-width: 10rem;
  font-family: inherit;
}
.toolbar input:focus,
.toolbar select:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 1.2rem;
  background: var(--primary-light);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.9rem;
  font-family: inherit;
  transition: background 0.15s, transform 0.1s;
  text-decoration: none;
}
.btn:hover { background: var(--primary-dark); text-decoration: none; color: #fff; }
.btn:active { transform: scale(0.98); }
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--primary-light);
  color: var(--primary-light);
}
.btn-outline:hover { background: var(--primary-light); color: #fff; }

.article {
  max-width: 720px;
  margin: 0 auto 2rem;
  background: var(--surface);
  padding: 1.75rem 1.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.article h2 {
  font-size: 1.25rem;
  margin: 1.6rem 0 0.55rem;
  color: var(--primary);
  letter-spacing: -0.02em;
}
.article h2:first-child { margin-top: 0; }
.article h3 { font-size: 1.05rem; margin: 1.25rem 0 0.45rem; color: var(--text); }
.article p, .article li { margin-bottom: 0.8rem; color: var(--text-secondary); }
.article ul, .article ol { padding-left: 1.35rem; margin-bottom: 1rem; }
.article table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: 0.92rem; }
.article th, .article td { border: 1px solid var(--border); padding: 0.55rem 0.75rem; text-align: left; }
.article th { background: var(--bg); font-weight: 600; color: var(--text); }

.guides-section {
  margin-top: 2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.35rem;
  box-shadow: var(--shadow);
}
.guides-section h2 { font-size: 1.15rem; color: var(--primary); margin-bottom: 0.85rem; }
.guides-section ul {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.5rem;
}
.guides-section a {
  display: block;
  padding: 0.65rem 0.85rem;
  background: var(--bg);
  border-radius: 8px;
  border: 1px solid var(--border-light);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 500;
  transition: border-color 0.15s, background 0.15s;
}
.guides-section a:hover {
  border-color: var(--primary-light);
  background: #eff6ff;
  text-decoration: none;
  color: var(--primary);
}

.site-footer {
  background: #0f172a;
  color: rgba(255,255,255,0.82);
  padding: 2.5rem 1.25rem 1.5rem;
  margin-top: auto;
}
.footer-inner {
  max-width: 1120px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1.75rem;
}
.footer-col h4 {
  color: #fcd34d;
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.footer-col ul { list-style: none; }
.footer-col a {
  color: rgba(255,255,255,0.7);
  font-size: 0.875rem;
  display: block;
  padding: 0.28rem 0;
  transition: color 0.15s;
}
.footer-col a:hover { color: #fff; text-decoration: none; }
.footer-bottom {
  max-width: 1120px;
  margin: 1.75rem auto 0;
  padding-top: 1.15rem;
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 0.78rem;
  color: rgba(255,255,255,0.45);
  text-align: center;
  line-height: 1.5;
}

.ad-slot {
  min-height: 90px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin: 1.35rem 0;
}
.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1.25rem; }
.mb-2 { margin-bottom: 1rem; }
.muted { color: var(--text-muted); font-size: 0.875rem; }
.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 650;
  background: var(--gold-soft);
  color: #92400e;
}
.empty-state {
  text-align: center;
  padding: 3rem 1.25rem;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  grid-column: 1 / -1;
  font-size: 0.95rem;
}
.last-sync {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}
.attribution { display: none !important; }

@media (max-width: 600px) {
  .container { padding: 1.25rem 1rem 2rem; }
  .prize-number { font-size: 1.35rem; }
  .prize-number.first { font-size: 1.6rem; }
  .results-grid { gap: 1rem; }
  .card-header { flex-direction: column; align-items: flex-start; gap: 0.25rem; }
  .card-header .draw-meta { text-align: left; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar input, .toolbar select { min-width: 0; width: 100%; }
  .article { padding: 1.25rem 1rem; }
}

/* Additional operators */
.card-header.cashsweep { background: linear-gradient(135deg, #7c2d12, #c2410c); }
.card-header.gd { background: linear-gradient(135deg, #4c1d95, #7c3aed); }
.card-header.perdana { background: linear-gradient(135deg, #0f766e, #14b8a6); }
.card-header.lotto { background: linear-gradient(135deg, #9f1239, #e11d48); }

.attribution-footer {
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 1.5rem 0 0.5rem;
  padding: 0.75rem;
  background: var(--surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.attribution-footer a { color: var(--primary-light); }

/* Regional sections */
.region-section {
  margin-bottom: 2.25rem;
}
.region-banner {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0 0 1rem;
  padding: 0.65rem 1rem;
  background: linear-gradient(90deg, #eff6ff 0%, #fff 100%);
  border-left: 4px solid var(--primary-light);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  letter-spacing: -0.01em;
}
.region-section .results-grid {
  margin-bottom: 0;
}

/* Logo-style card headers */
.card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
}
.op-logo {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: rgba(255,255,255,0.95);
  color: #1e293b;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.75rem;
  letter-spacing: -0.03em;
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}
.op-info { flex: 1; min-width: 0; }
.op-name {
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.2;
  color: #fff;
}
.card-header .draw-meta {
  font-size: 0.72rem;
  font-weight: 500;
  opacity: 0.9;
  margin-top: 0.15rem;
  text-align: left;
}

.op-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 6px;
  background: #fff;
}

/* ========== Premium Gold Navbar ========== */
.site-header {
  background: linear-gradient(135deg, #D4AF37 0%, #F5D76E 40%, #D4AF37 70%, #A87916 100%);
  color: #172554;
  box-shadow: 0 2px 12px rgba(168, 121, 22, 0.35);
}
.logo {
  color: #172554;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
}
.logo img {
  height: 42px;
  width: auto;
  border-radius: 6px;
}
.logo span { color: #7c2d12; }
.nav-toggle {
  background: rgba(23, 37, 84, 0.12);
  border: 1px solid rgba(23, 37, 84, 0.25);
  color: #172554;
}
.main-nav a {
  color: #172554;
  font-weight: 600;
}
.main-nav a:hover {
  background: rgba(23, 37, 84, 0.12);
  color: #172554;
}
.main-nav a.active {
  background: #B8860B;
  color: #fff;
  border-radius: 8px;
}
@media (max-width: 900px) {
  .main-nav {
    background: linear-gradient(180deg, #D4AF37, #A87916);
  }
  .main-nav a {
    color: #172554;
  }
  .main-nav a.active {
    background: #B8860B;
    color: #fff;
  }
}


  .sidebar-ad { display: none !important; }
}

/* ========== Sidebar Ads (non-intrusive, edge-fixed) ========== */
.sidebar-ad {
  position: fixed;
  top: 90px;
  width: 240px; /* 50% larger than previous 160px */
  z-index: 50;
  pointer-events: auto;
}
.sidebar-ad img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}
.sidebar-left { left: 16px; }
.sidebar-right { right: 16px; }

/* Hide when not enough space (main content ~1120px + 2*240px + gaps) */
@media (max-width: 1650px) {
  .sidebar-ad { display: none !important; }
}
@media (min-width: 1651px) {
  .sidebar-ad { display: block; }
}
