/* Typography */
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
}

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

/* Header */
.site-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--bg-secondary);
}

/* Scale up on larger screens to fill space, reduce spacing to compensate */
@media (min-width: 1024px) {
  html {
    font-size: 120%;
  }

  .site-header {
    padding: 0.5rem 1.5rem;
  }

  .container {
    padding: 0 0.75rem;
  }
}

.site-header h1 {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  z-index: 0;
}

/* Back arrow on game pages */
.back-btn {
  display: flex;
  align-items: center;
  z-index: 1;
}

/* Header right icons row */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

/* Icon button shared style (home, github, theme) */
.header-actions a,
.header-actions button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  border: 2px solid var(--bg-secondary);
  transition: border-color 0.2s;
  color: var(--fg-primary);
  padding: 0;
}

.header-actions a:hover,
.header-actions button:hover {
  border-color: var(--accent-purple);
}

.header-actions a:focus-visible,
.header-actions button:focus-visible {
  border-color: var(--accent-purple);
  outline: none;
}

.header-actions svg {
  width: 20px;
  height: 20px;
}

/* Theme toggle icon color (icons use stroke, not fill) */
.theme-toggle svg {
  stroke: var(--fg-primary);
  transition: stroke 0.2s;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  transition: background-color 0.2s, transform 0.1s;
}

.btn:active {
  transform: scale(0.97);
}

.btn:focus-visible {
  outline: 2px solid var(--accent-purple);
  outline-offset: 2px;
}

.btn-primary {
  background-color: var(--accent-purple);
  color: #fff;
}

.btn-primary:hover {
  filter: brightness(1.1);
}

.btn-secondary {
  background-color: var(--bg-secondary);
  color: var(--fg-primary);
}

.btn-secondary:hover {
  filter: brightness(1.15);
}


/* Game cards */
.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.5rem;
  padding: 2rem 0;
}

.game-card {
  background-color: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.game-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.game-card:focus-visible {
  outline: 2px solid var(--accent-purple);
  outline-offset: 2px;
}

.game-card h2 {
  font-size: 1.25rem;
  font-weight: 700;
}

.game-card p {
  color: var(--fg-secondary);
  font-size: 0.875rem;
  line-height: 1.6;
}

.game-card .card-icon {
  font-size: 2rem;
  margin-bottom: 0.25rem;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-lg);
  text-align: center;
  max-width: 400px;
  width: 90%;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: none;
  border: none;
  color: var(--fg-secondary);
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
  font-size: 1.25rem;
  border-radius: 4px;
  transition: color 0.15s, background-color 0.15s;
}

.modal-close:hover {
  color: var(--fg-primary);
  background-color: var(--bg-secondary);
}

.modal h2 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.modal p {
  color: var(--fg-secondary);
  margin-bottom: 1.5rem;
}

/* Toast notifications */
.toast-container {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  background-color: var(--fg-primary);
  color: var(--bg-primary);
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 700;
  opacity: 1;
  transition: opacity 0.4s;
  animation: toast-pop 0.3s ease-out;
}

.toast.fade-out {
  opacity: 0;
}

@keyframes toast-pop {
  0% { transform: scale(0.8); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* Page wrapper for sticky footer */
.page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.page main {
  flex: 1;
}

/* Responsive */
@media (max-width: 600px) {
  .site-header h1 {
    font-size: 1.2rem;
  }

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