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

body {
  font-family: 'Courier New', monospace;
  background: #0f0f1e;
  color: #ffffff;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  overflow: hidden;
}

.hidden {
  display: none !important;
}

/* Join Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-content {
  background: #1a1a2e00;
  padding: 30px;
  border-radius: 8px;
  min-width: 500px;
  max-width: 700px;
  padding-bottom: 50px;
  transform: scale(1.2);
}

.modal-content h2 {
  margin-bottom: 30px;
  text-align: center;
  color: #ffffff;
  font-size: 46px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  color: #fff;
  font-size: 14px;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 10px;
  background: #0f0f1e;
  border: 1px solid #333;
  border-radius: 8px;
  color: #ffffff;
  font-family: 'Courier New', monospace;
  font-size: 14px;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: red;
}

.form-group select {
  cursor: pointer;
}

.join-button {
  width: 100%;
  padding: 12px;
  background: #8b1515;
  border: none;
  border-radius: 8px;
  color: white;
  font-family: 'Courier New', monospace;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s;
}

.join-button:hover {
  background: red;
}

.join-button:active {
  background: rgb(141, 57, 57);
}

.bottom-text {
  position: absolute;
  bottom: 0;
  margin-bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 17px;
  color: #ffffffa9;
  animation-name: floatUpDown;
  animation-duration: 4s;
  animation-iteration-count: infinite;
}
@keyframes floatUpDown {
  0%   {margin-bottom: 20px;}
  50%  {margin-bottom: 30px;}
  100% {margin-bottom: 20px;}
}
@keyframes floatDownUp {
  0%   {margin-top: 10px;}
  50%  {margin-top: 20px;}
  100% {margin-top: 10px;}
}


#gameContainer {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}
.img-backdrop {
  align-items: center;
  display: flex;
  height: 100%;
  justify-content: center;
  width: 100%;
  z-index: -2;
  pointer-events: none;
  overflow: hidden;
}
/* Responsive 3x10 image grid that scales with screen size */
.img-grid {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
  pointer-events: none;
  user-select: none;
  row-gap: 0; /* no gaps unless you want them */
  opacity: 0.5;               /* backdrop feel */
}
.img-grid-row{
  display: flex;
  flex-direction: row;
  gap: 0;
  justify-content: space-between;
  align-items: center;
  width: 33%;
}
/* Images scale to fill their grid cell height */
.img-grid img {
  height: 33vh;
  width: auto;
  object-fit: cover;   /* fills space while preserving ratio */
  filter: blur(5px);
}

#heart {
  width: 41vw;
  object-fit: contain;
  position: absolute;
  top: 54%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: -1;
}

#gameCanvas {
  border: 2px solid #333;
  background: #1a1a2e;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

#ui {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}

#info {
  display: flex;
  gap: 20px;
  font-size: 14px;
}

#controls {
  font-size: 12px;
  color: #aaa;
  text-align: center;
}

#playerCount,
#fps {
  color: #00ff00;
  font-weight: bold;
}

/* Image Viewer Overlay */
.image-viewer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
}

.image-viewer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 90%;
  max-height: 90%;
  gap: 20px;
}

.image-viewer-content img {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  opacity: 0;
  transition: opacity 0.4s ease-in;
}

.image-viewer-content img.loaded {
  opacity: 1;
}

.image-description {
  color: #ffffff;
  font-family: 'Courier New', monospace;
  font-size: 18px;
  text-align: center;
  max-width: 800px;
  padding: 0 20px;
  line-height: 1.6;
}

.image-viewer-hint {
  position: absolute;
  top: 0;
  color: rgba(255, 255, 255, 0.4);
  font-family: 'Courier New', monospace;
  font-size: 14px;
  margin-top: 10px;
}

/* Interaction Hint */
.interaction-hint {
  position: absolute;
  margin-bottom: 30px;
  bottom: 0;
  color: rgba(255, 255, 255, 0.8);
  font-family: 'Courier New', monospace;
  font-size: 18px;
  text-align: center;
  z-index: 1500;
  pointer-events: none;
  animation-name: floatUpDown;
  animation-duration: 4s;
  animation-iteration-count: infinite;
}

/* Seated Hint */
.seated-hint {
  position: absolute;
  margin-top: 20px;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.582);
  font-family: 'Courier New', monospace;
  font-size: 24px;
  font-weight: bold;
  text-align: center;
  z-index: 1501;
  pointer-events: none;
  animation-name: floatDownUp;
  animation-duration: 4s;
  animation-iteration-count: infinite;
}

/* Flipbook Styles */
.flipbook {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.425);
  display: flex;
  justify-content: center;
  align-items: center;
}

.flipbook.hidden {
  display: none;
}

.flipbook-wrapper {
  width: 100%;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  font-size: 0.5rem;
}

#flip_book {
  width: 596px;
  height: 840px;
  position: relative;
  transition-duration: 1s;
  perspective: 2000px;
}

.flipbook-wrapper > input{
  display: none;
}

.front_cover,
.back_cover {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  border-radius: 5px 10px 10px 5px;
  background-image: url(./assets/images/flip_book_edge_shading.webp);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-color: rgb(220, 20, 60);
  box-shadow: 0 0 10px 0 rgb(25, 25, 25, 0.25);
}

.front_cover {
  position: absolute;
  cursor: pointer;
  transform-origin: center left;
  transition: transform 0.5s;
  z-index: 99;
}

.front_cover label {
  width: 100%;
  height: 100%;
  position: absolute;
  cursor: pointer;
}

.page {
  width: 576px;
  height: 800px;
  position: absolute;
  top: 20px;
  left: 2px;
  border-radius: 0 15px 15px 0;
  background-color: rgb(134, 32, 32);
  transform-origin: left;
  transform-style: preserve-3d;
  transform: rotateY(0deg);
  transition: transform 1.5s, z-index 0.2s 0.5s;
}

.front_page {
  width: 100%;
  height: 100%;
  position: absolute;
  backface-visibility: hidden;
}

.front_page label {
  width: 100%;
  height: 100%;
  position: absolute;
  cursor: pointer;
  z-index: 100;
}

.back_page {
  width: 100%;
  height: 100%;
  position: absolute;
  backface-visibility: hidden;
  transform: rotateY(180deg);
  z-index: 100;
}

.back_page label {
  width: 100%;
  height: 100%;
  position: absolute;
  cursor: pointer;
  z-index: 100;
}

.edge_shading {
  width: 576px;
  height: 800px;
  position: absolute;
  z-index: 98;
}

.front_content {
  width: 574px;
  height: 796px;
  position: absolute;
  top: 2px;
  border-radius: 0 10px 10px 0;
  z-index: 97;
}

.back_content {
  width: 574px;
  height: 796px;
  position: absolute;
  top: 2px;
  left: 2px;
  border-radius: 10px 0 0 10px;
  z-index: 96;
}

.page_text {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  text-align: center;
  color: #ffffff;
  font-family: 'Courier New', monospace;
  font-size: 22px;
  line-height: 1.3;
  text-shadow: 0 2px 6px rgba(0,0,0,0.6);
  z-index: 99;
  pointer-events: none;
  background-color: rgba(0, 0, 0, 0.5);
}

.back_text{
  position: absolute;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  text-align: left;
  color: #ffffff;
  font-family: 'Courier New', monospace;
  font-size: 22px;
  line-height: 1.3;
  text-shadow: 0 2px 6px rgba(0,0,0,0.6);
  z-index: 99;
  pointer-events: none;
}

.back_cover {
  position: relative;
  z-index: -1;
}

#page1 {
  z-index: 16;
}

#page2 {
  z-index: 13;
}

#page3 {
  z-index: 12;
}

#page4 {
  z-index: 11;
}

#page5 {
  z-index: 10;
}

#page6 {
  z-index: 9;
}

#page7 {
  z-index: 8;
}

#page8 {
  z-index: 7;
}

#page9 {
  z-index: 6;
}

#page10 {
  z-index: 5;
}

#page11 {
  z-index: 4;
}

#page12 {
  z-index: 3;
}

#page13 {
  z-index: 2;
}

#cover_checkbox:checked~#flip_book {
  transform: translateX(288px);
}

#cover_checkbox:checked~#flip_book .front_cover {
  transform: rotateY(-180deg);
  transition: transform 1.5s, z-index 0.5s 0.5s;
  z-index: 1;
}

#cover_checkbox:checked~#flip_book #cover {
  width: 80%;
  height: 80%;
  position: absolute;
}

#page1_checkbox:checked~#flip_book #page1 {
  transform: rotateY(-180deg);
  z-index: 3;
}

#page2_checkbox:checked~#flip_book #page2 {
  transform: rotateY(-180deg);
  z-index: 4;
}

#page3_checkbox:checked~#flip_book #page3 {
  transform: rotateY(-180deg);
  z-index: 5;
}

#page4_checkbox:checked~#flip_book #page4 {
  transform: rotateY(-180deg);
  z-index: 6;
}

#page5_checkbox:checked~#flip_book #page5 {
  transform: rotateY(-180deg);
  z-index: 7;
}

#page6_checkbox:checked~#flip_book #page6 {
  transform: rotateY(-180deg);
  z-index: 8;
}

#page7_checkbox:checked~#flip_book #page7 {
  transform: rotateY(-180deg);
  z-index: 9;
}

#page8_checkbox:checked~#flip_book #page8 {
  transform: rotateY(-180deg);
  z-index: 10;
}

#page9_checkbox:checked~#flip_book #page9 {
  transform: rotateY(-180deg);
  z-index: 11;
}

#page10_checkbox:checked~#flip_book #page10 {
  transform: rotateY(-180deg);
  z-index: 12;
}

#page11_checkbox:checked~#flip_book #page11 {
  transform: rotateY(-180deg);
  z-index: 13;
}

#page12_checkbox:checked~#flip_book #page12 {
  transform: rotateY(-180deg);
  z-index: 14;
}

#page13_checkbox:checked~#flip_book #page13 {
  transform: rotateY(-180deg);
  z-index: 17;
}

.cover_title {
  position: absolute;
  top: 25%;
  width: 100%;
  height: 100px;
  left: 50%;
  transform: translate(-48%, -50%);
  font-family: 'Courier New', monospace;
  font-size: 55px;
  font-weight: bold;
  color: #ffffff;
  text-align: center;
  z-index: 2;
  pointer-events: none;
}

.cover_subtitle {
  position: absolute;
  top: 98%;
  width: 100%;
  text-align: center;
  left: 50%;
  transform: translate(-50%, -80%);
  font-family: 'Courier New', monospace;
  font-size: 18px;
  font-weight: bold;
  color: #ffffffaf;
  text-align: center;
  z-index: 2;
  pointer-events: none;
  text-shadow: 0 2px 6px rgba(0,0,0,0.6);
}

.flipbook-close-hint {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.6);
  font-family: 'Courier New', monospace;
  font-size: 16px;
  pointer-events: none;
  text-shadow: 0 2px 6px rgba(0,0,0,0.6);

}

