:root {
  color-scheme: light;
  --bg-color: #f9fafb;
  --text-main: #111827;
  --text-muted: #9ca3af;
  --link-color: #2563eb;
  --link-hover: #1d4ed8;
  --border-color: #e5e7eb;
  --btn-hover-bg: #f3f4f6;
  --font-main: Helvetica, "Helvetica Neue", Arial, system-ui, -apple-system, sans-serif;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg-color: #111827;
  --text-main: #f9fafb;
  --text-muted: #9ca3af;
  --link-color: #60a5fa;
  --link-hover: #93c5fd;
  --border-color: #374151;
  --btn-hover-bg: #1f2937;
}

html {
  background: var(--bg-color);
}
body {
  min-height: 100vh;
  width: 100%;
  margin: 0;
  background: var(--bg-color);
  font-family: var(--font-main);
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  text-align: center;
}
.preload * {
  transition: none !important;
}
.header-container {
  position: absolute;
  top: 1rem;
  left: 1rem;
  right: 1rem;
  z-index: 10;
}
.main-nav {
  position: relative;
  display: flex;
  gap: 1rem;
  z-index: 2;
  /* Matches body background to seamlessly hide the submenu behind it */
  background: var(--bg-color);
  padding-bottom: 0.25rem;
}
nav button {
  background: none;
  border: none;
  padding: 0;
  font-family: var(--font-main);
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--text-main);
  font-weight: bold;
}
nav button.active { text-decoration: underline; }

/* Theme Toggle Button */
.theme-toggle {
  display: flex;
  align-items: center;
  margin-left: auto; /* Acts as a flex stretching-filler to push it right */
}
.theme-toggle svg {
  width: 20px;
  height: 20px;
  stroke: var(--text-main);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 0.3s ease;
}

/* Sub-menu sliding styles */
.sub-nav {
  position: absolute;
  top: 100%;
  left: 0;
  display: flex;
  gap: 1rem;
  transform: translateY(-100%);
  opacity: 0;
  visibility: hidden;
  transition: transform 0.3s ease, opacity 0.3s ease, visibility 0.3s;
  z-index: 1;
}
.sub-nav button {
  font-size: 1rem; /* Slightly smaller font */
  padding-top: 0.25rem;
}
.sub-nav.is-open {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
}

#mainContent {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  flex: 1;
  padding-top: 3rem;
  width: 100%;
}

/* Shared 600px Column Grid */
.about-text,
.blog-container {
  max-width: 600px;
  width: 100%;
  padding: 0 1rem;
  box-sizing: border-box;
  text-align: left;
}

.about-text {
  line-height: 1.6;
  margin: 0 auto;
}
canvas { 
  display: block;
  margin: 0 auto;
  max-width: calc(100% - 2rem);
  height: auto;
  background-color: #f9fafb; /* Keeps the game background explicitly as-is */
  box-sizing: border-box;
  border-radius: 9px;
  
  /* Android & Mobile fixes for HTML5 Canvas Games */
  touch-action: none; /* Prevents pull-to-refresh and browser swiping */
  -webkit-touch-callout: none; /* Prevents long-press context menu */
  user-select: none; /* Prevents text selection on rapid tapping */
  -webkit-user-select: none;
}
h1 { 
  font-size: 2.5rem; 
  font-weight: 500; 
  margin: 0 0 1rem 0; 
  letter-spacing: 0.02em; 
}
a {
  color: var(--link-color);
  text-decoration: none;
  transition: color 0.2s ease;
}
a:hover { color: var(--link-hover); text-decoration: underline; }
footer {
  width: 100%;
  padding: 0 1rem 1rem 1rem;
  box-sizing: border-box;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: auto;
}

#game-container {
  transition: opacity 0.3s ease-in-out;
}

.game-flipper {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 1rem;
}

.arrow-button {
  background: none;
  border: 2px solid var(--text-main);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  margin: 0 1rem;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.arrow-button:hover {
    background-color: var(--btn-hover-bg);
    transform: scale(1.05);
}

.arrow-button svg {
  width: 20px;
  height: 20px;
  stroke: var(--text-main);
}

/* Blog Styles */
.blog-container {
  margin: 0 auto 2rem auto;
}
.blog-post {
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border-color);
}
.blog-post:last-child {
  border-bottom: none;
}
.blog-title {
  font-size: 1.75rem;
  margin-bottom: 0.25rem;
  font-weight: bold;
}
.blog-date {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}
.blog-body {
  line-height: 1.6;
}
.blog-body p {
  margin-top: 0;
  margin-bottom: 1rem;
}