/* 4D Results MY-SG – Modern mobile-first design */
:root {
  --blue: #0b5ed7;
  --blue-dark: #084298;
  --red: #c41e3a;
  --gold: #d4a017;
  --gold-light: #f5e6a3;
  --bg: #ffffff;
  --bg-alt: #f8f9fa;
  --text: #1a1a1a;
  --text-muted: #6c757d;
  --border: #dee2e6;
  --radius: 12px;
  --shadow: 0 4px 14px rgba(0,0,0,.08);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img { max-width: 100%; height: auto; }

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header */
.site-header {
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-dark) 100%);
  color: #fff;
  padding: 0.75rem 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.logo span { color: var(--gold-light); }

.nav-toggle {
  display: none;
  background: transparent;
  border: 2px solid rgba(255,255,255,.5);
  color: #fff;
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1.1rem;
}

.main-nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
}
.main-nav a {
  color: rgba(255,255,255,.92);
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0.25rem 0;
}
.main-nav a:hover, .main-nav a.active {
  color: var(--gold-light);
  text-decoration: none;
}

/* Mobile nav */
@media (max-width: 768px) {
  .nav-toggle { display: block; }
  .main-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    background: var(--blue-dark);
    padding: 1rem;
  }
  .main-nav.open { display: block; }
  .main-nav ul { flex-direction: column; gap: 0.75rem; }
}

/* Layout */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.25rem 1rem;
  flex: 1;
}

.page-title {
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
  color: var(--blue-dark);
}
.page-subtitle {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

/* Result cards */
.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.result-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform .15s ease;
}
.result-card:hover { transform: translateY(-2px); }

.card-header {
  padding: 0.75rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  color: #fff;
}
.card-header.magnum { background: #c9a227; }
.card-header.toto { background: #c41e3a; }
.card-header.damacai { background: #1a3a6b; }
.card-header.sg { background: #ed1c24; }
.card-header.sabah88 { background: #006400; }
.card-header.stc { background: #4a3728; }

.card-header .draw-meta {
  font-size: 0.8rem;
  font-weight: 400;
  opacity: .95;
}

.card-body { padding: 1rem; }

.prize-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.65rem;
}
.prize-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}
.prize-number {
  font-size: 1.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.05em;
  color: var(--text);
}
.prize-number.first { color: var(--red); font-size: 2rem; }

.prize-group {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}
.prize-group h4 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}
.number-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.number-list span {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.25rem 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  min-width: 3.2rem;
  text-align: center;
}

.card-footer {
  padding: 0.6rem 1rem;
  background: var(--bg-alt);
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.25rem;
}

/* Date selector & history */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  align-items: center;
}
.toolbar label { font-size: 0.9rem; font-weight: 500; }
.toolbar input[type="date"],
.toolbar select {
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
}
.btn {
  display: inline-block;
  padding: 0.5rem 1.1rem;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.95rem;
}
.btn:hover { background: var(--blue-dark); text-decoration: none; color: #fff; }
.btn-outline {
  background: transparent;
  border: 2px solid var(--blue);
  color: var(--blue);
}
.btn-outline:hover { background: var(--blue); color: #fff; }

/* Content articles */
.article {
  max-width: 720px;
  margin: 0 auto 2rem;
}
.article h2 {
  font-size: 1.35rem;
  margin: 1.5rem 0 0.6rem;
  color: var(--blue-dark);
}
.article h3 {
  font-size: 1.1rem;
  margin: 1.2rem 0 0.5rem;
}
.article p, .article li {
  margin-bottom: 0.85rem;
}
.article ul, .article ol {
  padding-left: 1.4rem;
  margin-bottom: 1rem;
}
.article table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.95rem;
}
.article th, .article td {
  border: 1px solid var(--border);
  padding: 0.5rem 0.75rem;
  text-align: left;
}
.article th { background: var(--bg-alt); }

/* Footer */
.site-footer {
  background: #1a1a2e;
  color: rgba(255,255,255,.85);
  padding: 2rem 1rem 1.5rem;
  margin-top: auto;
}
.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.5rem;
}
.footer-col h4 {
  color: var(--gold-light);
  font-size: 0.95rem;
  margin-bottom: 0.6rem;
}
.footer-col ul { list-style: none; }
.footer-col a {
  color: rgba(255,255,255,.75);
  font-size: 0.9rem;
  display: block;
  padding: 0.2rem 0;
}
.footer-col a:hover { color: #fff; }
.footer-bottom {
  max-width: 1100px;
  margin: 1.5rem auto 0;
  padding-top: 1rem;
  border-top: 1px solid rgba(255,255,255,.15);
  font-size: 0.8rem;
  color: rgba(255,255,255,.55);
  text-align: center;
}
.attribution {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 1.5rem;
  padding: 0.75rem;
  background: var(--bg-alt);
  border-radius: 8px;
  border-left: 4px solid var(--gold);
}

/* Ad placeholders – never cover numbers */
.ad-slot {
  min-height: 90px;
  background: var(--bg-alt);
  border: 1px dashed var(--border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 1.25rem 0;
}
.ad-slot.leaderboard { min-height: 90px; }
.ad-slot.sidebar { min-height: 250px; }

/* Utilities */
.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-2 { margin-bottom: 1rem; }
.muted { color: var(--text-muted); }
.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--gold-light);
  color: #5c4800;
}

/* Loading & empty states */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 6px;
  height: 1.2rem;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-muted);
}
