body {
  margin: 0;
  padding: 0;
  font: 17px 'Lato', Courier, Tahoma, sans-serif; /* Capitalized font names, added fallback */
  color: #ffffff;
  background: url("https://peachyvoid.com/CARPET09.png") repeat #352b20;
  background-attachment: fixed;
  background-position: center top;
  cursor: url('https://peachyvoid.com/bestiary/purplevial1.png'), auto;
}

a:hover {
  cursor: url("https://peachyvoid.com/bestiary/purplevial1glow.png"), pointer;
}

.page-wrapper {
  display: flex;
  min-height: 100vh;
  overflow: auto;
  justify-content: center;
}

.content {
  flex: 1;
  padding: 60px;
  max-width: 2300px;
  position: relative;
  z-index: 0;
}

.content::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 56px;
  background: ur[](https://peachyvoid.com/lace.png) repeat-x center top; /* Fixed typo */
  background-size: 659px auto;
  background-position: center -14px;
  z-index: 9999;
  pointer-events: none;
}

#header1 {
  text-align: center;
  margin-bottom: 20px;
}

#header1 img {
  width: 500px;
  height: auto;
}

.boxes {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  max-width: none;
  margin: 0 auto;
  transform-origin: top center;
}

.boxes-row {
  display: flex;
  justify-content: center;
  gap: 20px;
  width: 100%;
  flex-wrap: nowrap;
  overflow-x: auto;
  min-width: 0;
}

.sidebar-left {
  background-color: #2b1d12;
  padding: 20px;
  border-radius: 10px;
  box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.5);
  position: relative;
  width: 150px;
  flex: 0 0 auto;
  min-width: 0;
}

.sidebar-left h2 {
  margin-top: 0;
}

.nav-links {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.nav-links a {
  color: #e2d3c3;
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s ease;
  font-size: 11px; /* Fixed invalid unit */
}

.nav-links a:hover {
  color: #c4ddb1;
}

.switchable-content {
  display: flex;
  gap: 20px;
  flex: 1;
  min-width: 0;
}

.switchable-content.hidden {
  display: none;
}

.main {
  font-family: Verdana, sans-serif; /* Added fallback */
  width: 1200px;
  height: 850px;
  position: relative;
  border-radius: 10px;
  background: none;
  flex: 0 0 auto;
  overflow: hidden;
  min-width: 0;
}

#book {
  width: 100%;
  height: 100%;
  position: relative;
}

.page {
  background: url('https://peachyvoid.com/bestiary/open-blank-book.jpg') center/cover no-repeat;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  padding: 35px 60px;
  font-size: 14px;
  color: #fff;
  text-shadow: 0 0 2px #000;
  border: none;
  box-shadow: none;
  border-radius: 0;
  position: relative;
}

.page h2 {
  font-family: 'IM Fell English', serif;
  color: #e6d9b2;
  text-align: center;
  margin-top: 0;
  margin-bottom: 15px;
}

.creature-grid,
.flower-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr) 40px repeat(4, 1fr);
  grid-template-rows: repeat(5, 1fr);
  row-gap: 10px;    /* vertical spacing */
  column-gap: 18px; /* horizontal spacing */
  margin-top: 20px;
  height: calc(100% - 60px);
  justify-items: center;
  opacity: 1;
  transition: opacity 0.6s ease;
  z-index: 9999;
}

.creature-grid.fade-out,
.flower-grid.fade-out {
  opacity: 0;
}

.creature-grid a,
.flower-grid a {
  display: block;
  text-decoration: none;
  padding: 8px;
}

.creature-grid img,
.flower-grid img {
  image-rendering: pixelated;
  width: 100%;
  max-width: 110px;
  object-fit: contain;
  border-radius: 4px;
  transition: transform 0.25s ease, filter 0.25s ease;
  overflow: visible;
  position: relative; /* create a local stacking context */
  z-index: 9999;

}

.creature-grid img:hover,
.flower-grid img:hover {
  transform: scale(1.75);
  z-index: 10000;
  overflow: visible;
  filter: drop-shadow(0 0 8px rgba(200, 150, 255, 0.8));
}

.creature-grid.hidden,
.flower-grid.hidden {
  display: none;
}

.prev-page,
.next-page {
  position: absolute;
  font-size: 40px;
  color: #fff;
  text-shadow: 0 0 4px #000;
  cursor: pointer;
  z-index: 10000; /* Increased to avoid overlap */
  user-select: none;
  padding: 10px; /* Added for larger click area */
}

.prev-page {
  bottom: 10px;
  left: 10px;
}

.next-page {
  bottom: 10px;
  right: 10px;
}

.sidebar-right {
  background-color: #2b1d12;
  padding: 20px;
  border-radius: 10px;
  box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.5);
  position: relative;
  width: 250px;
  align-self: flex-start;
  flex: 0 0 auto;
  min-width: 0;
}

.sidebar-right h2 {
  margin-top: 0;
  color: #e2d3c3;
  text-align: center;
}

.hatchery-section {
  background-color: #2b1d12;
  padding: 15px;
  border-radius: 8px;
  border: 10px solid transparent;
  margin-bottom: 20px;
}

#menagerie-switch .sidebar-right .hatchery-section {
  border-image: url('https://peachyvoid.com/bestiary/floral5.png') 30 round;
  border-image-width: 30px;
}

#garden-switch .sidebar-right .hatchery-section {
  border-image: url('https://peachyvoid.com/bestiary/floral1v2.png') 30 round;
  border-image-width: 30px;
}

#pokefarm-switch .sidebar-right .hatchery-section {
  border-image: url('https://peachyvoid.com/bestiary/pokefarm-border.png') 30 round;
  border-image-width: 30px;
}

#cave-switch .sidebar-right .hatchery-section {
  border-image: url('https://peachyvoid.com/bestiary/floral2.png') 30 round; /* Reuse Menagerie's border or choose a new one */
  border-image-width: 30px;
}

#lab-switch .sidebar-right .hatchery-section {
  border-image: url('https://peachyvoid.com/bestiary/mini3.png') 30 round; /* Reuse Garden's border or choose a new one */
  border-image-width: 30px;
}

#hold-switch .sidebar-right .hatchery-section {
  border-image: url('https://peachyvoid.com/bestiary/floral3v2.png') 30 round; /* Reuse Pokefarm's border or choose a new one */
  border-image-width: 30px;
}

.hatchery-section h3 {
  margin-top: 0;
  color: #e2d3c3;
  font-family: 'IM Fell English', serif;
  text-align: center;
}

.egg-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-start;
}

.egg-container img {
  image-rendering: pixelated;
  width: 100%;
  max-width: 80px;
  object-fit: contain;
  border-radius: 4px;
  transition: transform 0.25s ease, filter 0.25s ease;
}

.egg-container img:hover {
  transform: scale(2);
  filter: drop-shadow(0 0 8px rgba(200, 150, 255, 0.8));
}

.mode-tabs {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 20px;
}

.mode-tabs a {
  color: #e2d3c3;
  text-decoration: none;
  padding: 10px 20px;
  border-radius: 6px;
  background-color: #3a2b1f;
  transition: all 0.2s ease;
}

.mode-tabs a:hover,
.mode-tabs a.active {
  background-color: #4a3b2f;
  color: #c4ddb1;
}

.windows-box {
  width: 1200px;
  height: 850px;
  background: #c0c0c0;
  border: 2px solid #000;
  border-top-color: #fff;
  border-left-color: #fff;
  border-right-color: #808080;
  border-bottom-color: #808080;
  box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  font-family: 'MS Sans Serif', sans-serif;
  font-size: 12px;
  color: #000;
  flex: 0 0 auto;
  min-width: 0;
}

.windows-titlebar {
  background: linear-gradient(to right, rgb(15, 131, 111), #419aaa);
  color: #fff;
  padding: 2px 5px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 20px;
  font-weight: bold;
}

.windows-title {
  margin-left: 5px;
}

.windows-buttons {
  display: flex;
  gap: 2px;
}

.windows-btn {
  width: 16px;
  height: 14px;
  background: #c0c0c0;
  border-top: 1px solid #fff;
  border-left: 1px solid #fff;
  border-right: 1px solid #808080;
  border-bottom: 1px solid #808080;
  text-align: center;
  line-height: 14px;
  font-size: 10px;
  cursor: pointer;
}

.windows-btn.min {
  font-size: 12px;
  line-height: 12px;
}

.windows-btn.close {
  background: #ff0000;
  color: #fff;
}

.windows-content {
  flex: 1;
  background: url('https://peachyvoid.com/bestiary/grass.jpg') center/cover no-repeat;
  padding: 30px;
  overflow: auto;
  color: #000;
}

.pokemon-grid,
.egg-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  justify-items: center;
}

.pokemon-grid img,
.egg-grid img {
  image-rendering: pixelated;
  width: 100%;
  max-width: 90px;
  object-fit: contain;
  border-radius: 4px;
  transition: transform 0.25s ease, filter 0.25s ease;
}

.pokemon-grid img:hover,
.egg-grid img:hover {
  transform: scale(2);
  filter: drop-shadow(0 0 8px rgba(200, 150, 255, 0.8));
}

.pokefarm-tabs {
  display: flex;
  justify-content: flex-start;
  gap: 5px;
  padding: 5px;
  background: #c0c0c0;
  border-bottom: 1px solid #808080;
  border-top: 1px solid #fff;
}

.pokefarm-tab {
  color: #000;
  text-decoration: none;
  padding: 5px 15px;
  border: 1px solid #808080;
  border-top-color: #fff;
  border-left-color: #fff;
  background: #c0c0c0;
  font-size: 12px;
  font-family: 'MS Sans Serif', sans-serif;
  transition: background 0.2s ease;
}

.pokefarm-tab:hover,
.pokefarm-tab.active {
  background: #e0e0e0;
  color: #000;
}

.pokefarm-content {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.pokefarm-content.hidden {
  display: none;
}

@media (max-width: 1800px) {
  .main,
  .windows-box {
    width: 1000px;
  }
  .creature-grid img,
  .flower-grid img {
    max-width: 90px;
  }
}

@media (max-width: 1200px) {
  .main,
  .windows-box {
    width: 800px;
  }
  .creature-grid,
  .flower-grid {
    grid-template-columns: repeat(3, 1fr) 40px repeat(3, 1fr); /* Reduce columns for smaller screens */
  }
  .creature-grid img,
  .flower-grid img {
    max-width: 80px;
  }
  .sidebar-left,
  .sidebar-right {
    width: 120px;
  }
}