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

/* Dark mode (default) */
body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #1a1a2e, #16213e, #0f3460);
  min-height: 100vh;
  color: #fff;
  transition: background 0.4s, color 0.4s;
  display: flex;
  flex-direction: column;
}

/* Light mode */
body.light {
  background: linear-gradient(135deg, #f0f4f8, #d9e2ec, #bcccdc);
  color: #222;
}

/* ===== Navigation ===== */
.nav {
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

body.light .nav {
  background: rgba(255, 255, 255, 0.7);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.nav-inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.nav-logo {
  font-size: 1.2rem;
  font-weight: 700;
  color: #e94560;
  text-decoration: none;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
}

.nav-links a {
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.9rem;
  transition: background 0.2s, color 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

body.light .nav-links a {
  color: rgba(0, 0, 0, 0.6);
}

body.light .nav-links a:hover,
body.light .nav-links a.active {
  background: rgba(0, 0, 0, 0.07);
  color: #222;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

#themeToggle {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  transition: background 0.3s, transform 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

#themeToggle:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.1);
}

body.light #themeToggle {
  background: rgba(0, 0, 0, 0.1);
}

body.light #themeToggle:hover {
  background: rgba(0, 0, 0, 0.2);
}

.nav-hamburger {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px;
}

body.light .nav-hamburger {
  color: #222;
}

/* ===== Main Content ===== */
.main-content {
  flex: 1;
  display: flex;
  justify-content: center;
  padding: 30px 20px 40px;
}

.container {
  text-align: center;
  max-width: 800px;
  width: 100%;
}

h1 {
  font-size: 2.2rem;
  margin-bottom: 10px;
}

.subtitle {
  font-size: 1.1rem;
  color: #aaa;
  margin-bottom: 30px;
  transition: color 0.4s;
}

body.light .subtitle {
  color: #555;
}

/* ===== Generate Button ===== */
#generateBtn {
  background: linear-gradient(135deg, #e94560, #c23152);
  color: #fff;
  border: none;
  padding: 16px 40px;
  font-size: 1.2rem;
  border-radius: 50px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 15px rgba(233, 69, 96, 0.4);
}

#generateBtn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(233, 69, 96, 0.6);
}

#generateBtn:active {
  transform: scale(0.98);
}

/* ===== Lotto Results ===== */
#results {
  margin-top: 30px;
}

.set {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 16px 20px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: fadeIn 0.4s ease forwards;
  opacity: 0;
  transition: background 0.4s;
}

body.light .set {
  background: rgba(0, 0, 0, 0.06);
}

.set-label {
  font-weight: bold;
  font-size: 0.9rem;
  color: #aaa;
  min-width: 30px;
  transition: color 0.4s;
}

body.light .set-label {
  color: #666;
}

.balls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.ball {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: bold;
  font-size: 1rem;
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.ball.range-1 { background: #fbc531; color: #222; }
.ball.range-2 { background: #487eb0; }
.ball.range-3 { background: #e84118; }
.ball.range-4 { background: #8c8c8c; }
.ball.range-5 { background: #44bd32; }

/* ===== Info Sections ===== */
.info-section {
  margin-top: 50px;
  text-align: left;
}

.info-section h2 {
  font-size: 1.5rem;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 2px solid rgba(233, 69, 96, 0.4);
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.info-card {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 20px;
  transition: background 0.4s, transform 0.2s;
}

.info-card:hover {
  transform: translateY(-2px);
}

body.light .info-card {
  background: rgba(0, 0, 0, 0.05);
}

.info-card h3 {
  font-size: 1.05rem;
  margin-bottom: 8px;
  color: #e94560;
}

.info-card p {
  font-size: 0.92rem;
  line-height: 1.6;
  color: #ccc;
}

body.light .info-card p {
  color: #555;
}

/* Color guide */
.color-guide {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
}

.color-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: #ccc;
}

body.light .color-item {
  color: #555;
}

.color-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: bold;
  color: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* ===== Content Blocks (Tips, About, Privacy) ===== */
.content-block {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 28px;
  margin-bottom: 24px;
  text-align: left;
  transition: background 0.4s;
}

body.light .content-block {
  background: rgba(0, 0, 0, 0.05);
}

.content-block h2 {
  font-size: 1.4rem;
  margin-bottom: 16px;
  color: #e94560;
}

.content-block h3 {
  font-size: 1.1rem;
  margin: 18px 0 10px;
}

.content-block p {
  font-size: 0.95rem;
  line-height: 1.75;
  color: #ccc;
  margin-bottom: 10px;
}

body.light .content-block p {
  color: #444;
}

.content-block ul,
.content-block ol {
  margin: 10px 0 10px 24px;
  font-size: 0.95rem;
  line-height: 1.75;
  color: #ccc;
}

body.light .content-block ul,
body.light .content-block ol {
  color: #444;
}

.content-block li {
  margin-bottom: 6px;
}

/* ===== FAQ ===== */
.faq-item {
  margin-bottom: 18px;
}

.faq-q {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 6px;
  color: #e94560;
}

.faq-a {
  font-size: 0.93rem;
  line-height: 1.7;
  color: #ccc;
}

body.light .faq-a {
  color: #444;
}

/* ===== Stats Page ===== */
.chart-container {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;
  overflow-x: auto;
}

body.light .chart-container {
  background: rgba(0, 0, 0, 0.04);
}

.chart-title {
  font-size: 1.2rem;
  margin-bottom: 16px;
  text-align: center;
}

.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 200px;
  padding: 0 4px;
  min-width: 600px;
}

.bar-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
}

.bar {
  width: 100%;
  max-width: 14px;
  border-radius: 3px 3px 0 0;
  transition: height 0.6s ease;
  min-height: 2px;
}

.bar-label {
  font-size: 0.6rem;
  margin-top: 4px;
  color: #aaa;
}

body.light .bar-label {
  color: #666;
}

.recent-draws {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

.recent-draws th,
.recent-draws td {
  padding: 10px 12px;
  text-align: center;
  font-size: 0.9rem;
}

.recent-draws th {
  background: rgba(233, 69, 96, 0.2);
  border-bottom: 2px solid rgba(233, 69, 96, 0.4);
  font-weight: 600;
}

.recent-draws tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.04);
}

body.light .recent-draws tr:nth-child(even) {
  background: rgba(0, 0, 0, 0.03);
}

.draw-row:hover {
  background: rgba(233, 69, 96, 0.1) !important;
}

.draw-row td:first-child::before {
  content: '▶ ';
  font-size: 0.6rem;
  opacity: 0.5;
}

.prize-detail td {
  padding: 12px 16px !important;
  background: rgba(233, 69, 96, 0.06);
  border-bottom: 1px solid rgba(233, 69, 96, 0.15);
}

body.light .prize-detail td {
  background: rgba(233, 69, 96, 0.04);
}

.prize-info {
  font-size: 0.88rem;
  color: #ddd;
  text-align: center;
  line-height: 1.8;
}

body.light .prize-info {
  color: #444;
}

.prize-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
}

.prize-badge.p1 {
  background: #e94560;
}

.prize-badge.p2 {
  background: #487eb0;
}

.analysis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.analysis-card {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 18px;
  text-align: center;
}

body.light .analysis-card {
  background: rgba(0, 0, 0, 0.04);
}

.analysis-card .label {
  font-size: 0.85rem;
  color: #aaa;
  margin-bottom: 8px;
}

body.light .analysis-card .label {
  color: #666;
}

.analysis-card .value {
  font-size: 1.4rem;
  font-weight: 700;
  color: #e94560;
}

/* ===== Disqus Section ===== */
.disqus-section {
  margin-top: 40px;
  padding-top: 30px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  text-align: left;
}

body.light .disqus-section {
  border-top-color: rgba(0, 0, 0, 0.1);
}

.disqus-section h2 {
  font-size: 1.4rem;
  margin-bottom: 16px;
  text-align: center;
}

#disqus_thread {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  padding: 20px;
}

body.light #disqus_thread {
  background: rgba(0, 0, 0, 0.03);
}

/* ===== Contact Link (legacy) ===== */
.contact-link {
  display: inline-block;
  margin-top: 28px;
  color: #aaa;
  text-decoration: none;
  font-size: 1rem;
  transition: color 0.3s;
}

.contact-link:hover {
  color: #e94560;
}

body.light .contact-link {
  color: #666;
}

/* ===== Footer ===== */
.footer {
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
  padding: 24px 20px;
  text-align: center;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin-top: auto;
}

body.light .footer {
  background: rgba(255, 255, 255, 0.7);
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.footer-links a {
  color: rgba(255, 255, 255, 0.6);
  text-decoration: none;
  font-size: 0.85rem;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: #e94560;
}

body.light .footer-links a {
  color: rgba(0, 0, 0, 0.5);
}

.footer-copy {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.4);
}

body.light .footer-copy {
  color: rgba(0, 0, 0, 0.35);
}

/* ===== Animations ===== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
  .nav-links {
    display: none;
    position: absolute;
    top: 56px;
    left: 0;
    right: 0;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.95);
    padding: 12px;
    gap: 2px;
  }

  body.light .nav-links {
    background: rgba(255, 255, 255, 0.95);
  }

  .nav-links.open {
    display: flex;
  }

  .nav-hamburger {
    display: block;
  }

  h1 {
    font-size: 1.7rem;
  }

  .info-grid {
    grid-template-columns: 1fr;
  }

  .bar-chart {
    min-width: 500px;
  }
}
