:root {
  --nav-bg-light: rgba(135, 206, 235, 0.95);
  --nav-bg-dark: rgba(26, 26, 46, 0.95);
  --nav-text-light: #fff;
  --nav-text-dark: #eee;
  --footer-bg-light: #2c3e50;
  --footer-bg-dark: #0f0f1f;
  --footer-text: #aaa;
  --footer-link: #3498db;
  --content-max-width: 800px;
  --text-primary-light: #333;
  --text-primary-dark: #eee;
  --bg-light: #f5f7fa;
  --bg-dark: #1a1a2e;
  --card-bg-light: #fff;
  --card-bg-dark: #16213e;
  --accent: #f0c040;
  --accent-hover: #ffd700;
  --link-color-light: #007bff;
  --link-color-dark: #4dabf7;
  --border-light: #e0e0e0;
  --border-dark: #2a2a4a;
  --section-padding: 60px 20px;
}

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

html {
  scroll-padding-top: 60px;
}

body {
  font-family: 'Segoe UI', Arial, sans-serif;
  line-height: 1.7;
  transition: background-color 0.8s ease, color 0.8s ease;
}

body.light {
  background-color: var(--bg-light);
  color: var(--text-primary-light);
}

body.dark {
  background-color: var(--bg-dark);
  color: var(--text-primary-dark);
}

a {
  text-decoration: none;
  transition: color 0.2s;
}

body.light a { color: var(--link-color-light); }
body.dark a { color: var(--link-color-dark); }

a:hover { text-decoration: underline; }

h1 { font-size: 36px; margin-bottom: 20px; line-height: 1.2; }
h2 { font-size: 28px; margin-top: 40px; margin-bottom: 16px; line-height: 1.3; }
h3 { font-size: 22px; margin-top: 28px; margin-bottom: 12px; }
p { margin-bottom: 16px; }
ul, ol { margin-bottom: 16px; padding-left: 28px; }
li { margin-bottom: 8px; }

.container {
  max-width: var(--content-max-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* ===== NAV ===== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  padding: 0 24px;
  transition: background-color 0.8s ease;
}

body.light .navbar { background-color: var(--nav-bg-light); }
body.dark .navbar { background-color: var(--nav-bg-dark); }

.nav-logo {
  font-size: 20px;
  font-weight: 900;
  color: #fff;
  text-decoration: none;
  flex-shrink: 0;
}

body.dark .nav-logo { color: var(--accent); }

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

.nav-link {
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  text-decoration: none;
  padding: 6px 0;
  border-bottom: 2px solid transparent;
  transition: border-color 0.2s;
}

body.dark .nav-link { color: #ddd; }
.nav-link:hover { text-decoration: none; border-bottom-color: rgba(255,255,255,0.5); }
.nav-link.active { border-bottom-color: #fff; font-weight: 800; }
body.dark .nav-link.active { border-bottom-color: var(--accent); color: var(--accent); }

.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 4px;
}

.hamburger span {
  display: block;
  width: 100%;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

body.dark .hamburger span { background: var(--accent); }

.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ===== MOBILE NAV ===== */
@media (max-width: 767px) {
  .hamburger { display: flex; }

  .nav-links {
    position: absolute;
    top: 56px;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background-color: rgba(0,0,0,0.9);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
  }

  .nav-links.menu-open {
    max-height: 300px;
  }

  body.light .nav-links { background-color: rgba(135, 206, 235, 0.98); }
  body.dark .nav-links { background-color: rgba(10, 10, 30, 0.98); }

  .nav-link {
    display: block;
    padding: 14px 24px;
    min-height: 48px;
    border-bottom: none;
    border-left: 3px solid transparent;
    font-size: 17px;
  }

  .nav-link:hover { border-left-color: rgba(255,255,255,0.5); }
  .nav-link.active { border-left-color: #fff; font-weight: 800; }
  body.dark .nav-link.active { border-left-color: var(--accent); color: var(--accent); }
}

/* ===== FOOTER ===== */
.site-footer {
  text-align: center;
  padding: 24px 20px;
  transition: background-color 0.8s ease;
}

body.light .site-footer { background-color: var(--footer-bg-light); }
body.dark .site-footer { background-color: var(--footer-bg-dark); }

.footer-inner {
  max-width: var(--content-max-width);
  margin: 0 auto;
}

.footer-brand {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
}

.footer-copy {
  font-size: 13px;
  color: var(--footer-text);
  margin-bottom: 8px;
}

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

.footer-links a {
  font-size: 13px;
  color: var(--footer-link);
  text-decoration: none;
}

.footer-links a:hover { text-decoration: underline; }

/* ===== PAGE CONTENT ===== */
.page-content {
  padding: var(--section-padding);
}

.hero {
  text-align: center;
  padding: 48px 20px 32px;
  max-width: 700px;
  margin: 0 auto;
}

.hero h1 {
  font-size: 40px;
  margin-bottom: 12px;
}

.hero .subtitle {
  font-size: 18px;
  opacity: 0.85;
  margin-bottom: 24px;
}

.hero .btn {
  display: inline-block;
  padding: 14px 40px;
  font-size: 18px;
  font-weight: 700;
  border: none;
  border-radius: 30px;
  cursor: pointer;
  background: var(--accent);
  color: #333;
  box-shadow: 0 4px 14px rgba(0,0,0,0.25);
  text-decoration: none;
}

.hero .btn:hover {
  background: var(--accent-hover);
  text-decoration: none;
}

/* ===== GAME SECTION ===== */
.game-section {
  display: flex;
  justify-content: center;
  padding: 20px;
}

#game-container {
  position: relative;
  width: 400px;
  max-width: 100%;
  height: 600px;
  overflow: hidden;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  transition: background-color 0.8s ease;
}

.light #game-container { background-color: #87CEEB; }
.dark #game-container { background-color: #16213e; }

#game-container canvas {
  display: block;
  width: 100%;
  height: 100%;
}

#ui-overlay {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 10;
}

#score {
  position: absolute;
  top: 30px;
  width: 100%;
  text-align: center;
  font-size: 48px;
  font-weight: 900;
  color: #fff;
  text-shadow: 2px 2px 6px rgba(0,0,0,0.5);
  z-index: 11;
}

#best-score {
  position: absolute;
  top: 84px;
  width: 100%;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  color: #ffd700;
  text-shadow: 1px 1px 4px rgba(0,0,0,0.5);
  z-index: 11;
}

#lives {
  position: absolute;
  top: 30px;
  right: 16px;
  font-size: 22px;
  z-index: 11;
}

#start-screen, #gameover-screen, #pause-screen {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 20;
  pointer-events: all;
}

#pause-screen {
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(2px);
}

#pause-screen h1 {
  font-size: 48px;
  margin-bottom: 10px;
  color: #fff;
  text-shadow: 2px 2px 8px rgba(0,0,0,0.6);
}

#pause-screen p {
  font-size: 18px;
  color: #fff;
  text-shadow: 1px 1px 4px rgba(0,0,0,0.6);
}

#start-screen h1 {
  font-size: 42px;
  margin-bottom: 10px;
  text-shadow: 2px 2px 8px rgba(0,0,0,0.4);
}

.light #start-screen h1 { color: #fff; }
.dark #start-screen h1 { color: #f0c040; }

#start-screen p, #gameover-screen p {
  font-size: 16px;
  margin-bottom: 20px;
  opacity: 0.8;
}

.light #start-screen p { color: #fff; }
.dark #start-screen p { color: #ccc; }

.game-btn {
  padding: 14px 40px;
  font-size: 20px;
  font-weight: 700;
  border: none;
  border-radius: 30px;
  cursor: pointer;
  background: var(--accent);
  color: #333;
  box-shadow: 0 4px 14px rgba(0,0,0,0.25);
  pointer-events: all;
}

.game-btn:hover { background: var(--accent-hover); }

#final-score {
  font-size: 60px;
  font-weight: 900;
  color: #f0c040;
  text-shadow: 2px 2px 8px rgba(0,0,0,0.5);
  margin: 10px 0 2px;
}

#gameover-best {
  font-size: 28px;
  font-weight: 900;
  color: #ffd700;
  text-shadow: 2px 2px 6px rgba(0,0,0,0.5);
  margin: 2px 0 4px;
}

#theme-indicator {
  position: absolute;
  bottom: 12px;
  width: 100%;
  text-align: center;
  font-size: 13px;
  opacity: 0.6;
  z-index: 11;
}

.light #theme-indicator { color: #fff; }
.dark #theme-indicator { color: #888; }

#new-best {
  font-size: 22px;
  font-weight: 900;
  color: #ffd700;
  text-shadow: 0 0 14px rgba(255,215,0,0.9);
  margin-bottom: 8px;
  display: none;
  animation: pulse 0.6s ease-in-out infinite alternate;
}

@keyframes pulse {
  from { transform: scale(1); }
  to { transform: scale(1.08); }
}

.info-icon {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  z-index: 25;
  opacity: 0.7;
  transition: opacity 0.2s, transform 0.2s;
  color: #fff;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
}

.info-icon:hover {
  opacity: 1;
  transform: scale(1.1);
}

.modal-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.6);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  pointer-events: all;
}

.modal-content {
  background: var(--card-bg-light);
  padding: 24px;
  border-radius: 12px;
  max-width: 320px;
  width: 90%;
  position: relative;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

body.light .modal-content { background: #fff; color: #333; }
body.dark .modal-content { background: #1a1a2e; color: #eee; }

.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: 24px;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.modal-close:hover { opacity: 1; }

.modal-content h3 { margin-top: 0; margin-bottom: 16px; font-size: 20px; }
.modal-content p { margin-bottom: 12px; line-height: 1.5; font-size: 14px; }

/* ===== CONTENT CARDS ===== */
.content-card {
  padding: 32px;
  border-radius: 12px;
  transition: background-color 0.8s ease;
  margin-bottom: 32px;
}

body.light .content-card {
  background: var(--card-bg-light);
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

body.dark .content-card {
  background: var(--card-bg-dark);
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}

/* ===== FEATURE GRID ===== */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.feature-item {
  padding: 24px;
  border-radius: 10px;
  text-align: center;
  transition: background-color 0.8s ease;
}

body.light .feature-item {
  background: var(--card-bg-light);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

body.dark .feature-item {
  background: var(--card-bg-dark);
}

.feature-icon { font-size: 36px; margin-bottom: 12px; }
.feature-title { font-size: 16px; font-weight: 700; margin-bottom: 8px; }
.feature-desc { font-size: 14px; opacity: 0.8; margin-bottom: 0; }

/* ===== BLOG ===== */
.blog-meta {
  font-size: 14px;
  opacity: 0.7;
  margin-bottom: 32px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 767px) {
  .hero h1 { font-size: 28px; }
  .hero .subtitle { font-size: 16px; }
  h1 { font-size: 28px; }
  h2 { font-size: 22px; }
  h3 { font-size: 18px; }
  .page-content { padding: 32px 16px; }
  .content-card { padding: 20px; }
  .feature-grid { grid-template-columns: 1fr; }
  #game-container { height: 500px; }
}

@media (max-width: 420px) {
  #game-container { width: 100%; height: 480px; }
  .game-section { padding: 0 8px; }
}
