/* Reset & basics */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;

  user-select: none;
  -webkit-user-drag: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

body {
  font-family: "Segoe UI Rounded", "Segoe UI", "SF Pro Rounded", "Helvetica Rounded", "Arial Rounded MT Bold", system-ui, sans-serif;
  background: #fcfff0;
  color: #009487;
}

h1{
  text-align: center;
  padding-bottom: 20px;
}

h2, h3{
  padding-bottom: 20px;
  font-size: 1.2em;
}

p{
  padding: 10px;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  position: relative;
}

.logo {
  font-size: 1.5em;
  color: #7ED6DF; /* pastel accent */
  font-weight: bold;
  cursor: pointer;
}

.logo img{
  width: 100px
}

.logo img:hover {
  animation: shake 0.4s; /* duration: 0.4s */
}

@keyframes shake {
  0%   { transform: translateX(0); }
  20%  { transform: translateX(-3px); }
  40%  { transform: translateX(3px); }
  60%  { transform: translateX(-3px); }
  80%  { transform: translateX(3px); }
  100% { transform: translateX(0); }
}

.search-container {
  display: flex;
  align-items: center;
}


/* Search box with icon */
.search-box {
  padding: 12px 30px 12px 18px; /* right padding makes space for icon */
  border: 2px solid #dcf9e9;
  border-radius: 50px;
  outline: none;
  font-size: 1.2em;
  background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" fill="%231ac5ae" viewBox="0 0 24 24"><path d="M10 2a8 8 0 1 0 4.9 14.3l4.4 4.4c.4.4 1 .4 1.4 0s.4-1 0-1.4l-4.4-4.4A8 8 0 0 0 10 2zm0 2a6 6 0 1 1 0 12A6 6 0 0 1 10 4z"/></svg>') no-repeat right 12px center;
  background-size: 24px 24px; /* bigger icon */
  transition: all 0.3s ease;
  background-color: #dcf9e9;
  color: #117f70;

}

/* Search icon button */
.search-icon {
  display: none; /* shown on mobile */
  background: none;
  border: none;
  font-size: 1.4em;
  color: #7ED6DF;
  cursor: pointer;
}

/* Mobile styles */
@media (max-width: 768px) {
  .header {
    justify-content: center;
    padding-top: 0px;
  }

  .search-box {
    display: none;
    position: absolute;
    top: 100%;
    left: 10px;
    right: 10px;
    margin-top: 5px;
  }
}

/*------------ Backgroudn Blobs ---------------- */
#background-polygons {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: -1;
}
.polygon {
  position: absolute;
  opacity: 0.15; /* faint */
}


/*------------ Footer ----------------------------- */
.footer {
  position: relative; /* so absolute works inside */
  display: flex;
  justify-content: space-between;
  align-items: flex-start; /* left & right parts align top */
  flex-wrap: wrap;
  background: rgba(255, 255, 255, 0);
  padding: 10px 20px;
  font-size: 0.9em;
  color: #333;
  margin-top: 40px;
  padding-bottom: 80px;
  padding-top: 30px;
  box-shadow: rgba(0, 0, 0, 0.05) 0px 6px 24px 0px, rgba(0, 0, 0, 0.08) 0px 0px 0px 1px;
}

.footer a, span{
  color: #1caf9b;
  text-decoration: none;
  margin-left: 8px;
  transition: color 0.3s;
  font-size: 18px;
}

.footer a:hover, span:hover {
  color: #137568;
}

.footer-left,
.footer-right {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Remove column flex on .footer-center */
.footer-center {
  position: absolute;
  bottom: 5px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
}

/* vertical center language icon & text */
.footer-left span {
  cursor: pointer;
  display: flex;
  align-items: center;
  font-size: 16px;
}

.footer-left img {
  width: 24px;
  height: 24px;
  margin-right: 5px;
}

.social-icons {
  margin-bottom: 4px;
  display: flex;
}

.social-icons a img {
  width: 32px;
  height: 32px;
  margin: 0 5px;
}

.footer-links {
  display: flex;
}

.footer-links a {
  margin: 0 12px;
  margin-top: 24px;
}

/* Responsive for mobile */
@media (max-width: 600px) {
  .footer {
    flex-direction: column;
    align-items: center;
  }

  .footer-left, .footer-right {
    margin: 15px 0;
  }

  .footer-center {
    position: static;
    transform: none;
    margin: 5px 0;
  }
}

/*-------------- Game Card --------------------- */
.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
  padding: 20px;
  justify-items: center;
  max-width: 1200px;
  margin: 0 auto;
}

.game-card {
  cursor: pointer;
  width: 100%;          /* fill cell width */
  max-width: 300px;     /* match grid max */
  border-radius: 12px;
  overflow: hidden;
  /*box-shadow: 0 2px 8px rgba(0,0,0,0.15); */
  /*box-shadow: rgba(50, 50, 93, 0.25) 0px 25px 50px -20px, rgba(0, 0, 0, 0.3) 0px 15px 20px -30px, rgba(10, 37, 64, 0.35) 0px -2px 6px 0px inset;*/
  box-shadow: rgba(0, 0, 0, 0.1) 0px 4px 12px, rgba(10, 37, 64, 0.35) 0px -1px 2px 0px inset;
  background: #e9fdf4;
  margin: 0;            /* remove margin; grid handles spacing */
  transition: transform 0.5s;
}

.game-card:hover {
  transform: scale(1.03);
}

.game-card a {
  text-decoration: none;
}

.game-image {
  position: relative;
  width: 100%;
  height: 180px;
  overflow: hidden;
}

.game-image img {
  width: 100%;
  height: auto;
  object-fit: cover;
  display: block;
}

.game-stats {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 5px;
  background: rgba(0,0,0,0.6);
  border-radius: 8px;
  padding: 2px 6px;
  font-size: 0.8em;
  color: #fff;
}

.game-name {
  text-align: center;
  padding: 8px;
  font-size: 1em;
  font-weight: 500;
  color: #009487;
}

/* ---------------------------------- Share and Language Selection ----------------------- */
.cd-popup {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 1003;
  padding-top: 5%;
  height: 100%;
  width: 100%;
  background-color: rgba(94, 110, 141, 0.1);
  opacity: 0;
  visibility: hidden;
  -webkit-transition: opacity 0.3s 0s, visibility 0s 0.3s;
  -moz-transition: opacity 0.3s 0s, visibility 0s 0.3s;
  transition: opacity 0.3s 0s, visibility 0s 0.3s;
}
.cd-popup.is-visible {
  opacity: 1;
  visibility: visible;
  -webkit-transition: opacity 0.3s 0s, visibility 0s 0s;
  -moz-transition: opacity 0.3s 0s, visibility 0s 0s;
  transition: opacity 0.3s 0s, visibility 0s 0s;
}

.cd-popup-container {
  position: relative;
  width: 90%;
  max-width: 400px;
  margin: 4em auto;
  background: #FFF;
  border-radius: 12px;
  text-align: center;
  box-shadow: rgba(0, 0, 0, 0.8) 0px 8px 32px, rgba(10, 37, 64, 0.35) 0px -1px 2px 0px inset;
  background: #e9fdf4;

  -webkit-transform: translateY(-40px);
  -moz-transform: translateY(-40px);
  -ms-transform: translateY(-40px);
  -o-transform: translateY(-40px);
  transform: translateY(-40px);
  /* Force Hardware Acceleration in WebKit */
  -webkit-backface-visibility: hidden;
  -webkit-transition-property: -webkit-transform;
  -moz-transition-property: -moz-transform;
  transition-property: transform;
  -webkit-transition-duration: 0.3s;
  -moz-transition-duration: 0.3s;
  transition-duration: 0.3s;
}
.cd-popup-container p {
  padding: 3em 1em;
}

.cd-popup-container .cd-buttons:after {
  content: "";
  display: table;
  clear: both;
}
.cd-popup-container .cd-buttons li {
  float: left;
  width: 50%;
  list-style: none;
}
.cd-popup-container .cd-buttons a {
  display: block;
  height: 60px;
  line-height: 60px;
  text-transform: uppercase;
  color: #FFF;
  -webkit-transition: background-color 0.2s;
  -moz-transition: background-color 0.2s;
  transition: background-color 0.2s;
}
.cd-popup-container .cd-buttons li:first-child a {
  background: #fc7169;
  border-radius: 0 0 0 .25em;
  cursor: pointer;
}
.no-touch .cd-popup-container .cd-buttons li:first-child a:hover {
  background-color: #fc8982;
}
.cd-popup-container .cd-buttons li:last-child a {
  background: #5cb4f5;
  border-radius: 0 0 .25em 0;
  cursor: pointer;
}
.no-touch .cd-popup-container .cd-buttons li:last-child a:hover {
  background-color: #c5ccd8;
}
.cd-popup-close {
  cursor: pointer;
}
.cd-popup-container .cd-popup-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 30px;
  height: 30px;
}
.cd-popup-container .cd-popup-close::before, .cd-popup-container .cd-popup-close::after {
  content: '';
  position: absolute;
  top: 12px;
  width: 14px;
  height: 3px;
  background-color: #8f9cb5;
}
.cd-popup-container .cd-popup-close::before {
  -webkit-transform: rotate(45deg);
  -moz-transform: rotate(45deg);
  -ms-transform: rotate(45deg);
  -o-transform: rotate(45deg);
  transform: rotate(45deg);
  left: 8px;
}
.cd-popup-container .cd-popup-close::after {
  -webkit-transform: rotate(-45deg);
  -moz-transform: rotate(-45deg);
  -ms-transform: rotate(-45deg);
  -o-transform: rotate(-45deg);
  transform: rotate(-45deg);
  right: 8px;
}
.is-visible .cd-popup-container {
  -webkit-transform: translateY(0);
  -moz-transform: translateY(0);
  -ms-transform: translateY(0);
  -o-transform: translateY(0);
  transform: translateY(0);
}
@media only screen and (min-width: 1170px) {
  .cd-popup-container {
    margin: 8em auto;
  }
}
/* ----------- Langualge Selector ----------------- */
.lang {
  display: inline-block;
  box-sizing: border-box;
  width: 33%;  
  padding: 1% 0% 1% 0%;
  cursor: pointer;
  border: 1px solid #e1fff4;
  transition: border 0.1s ease-out;
}

.selected{
  color: #fff;
  font-weight: 900;
  background-color: #209bd6;
  border-radius: 3px;
}

.lang:hover {
  border: 1px solid #209bd6;
  border-radius: 3px;
}

.langBox{
  padding: 10% 4% 4% 4%;
  font-size: 14px;
}
.langBox a{
  text-decoration: none;
  color: #555;
}

.stat-nav-wrapper button{
    border: none;
    color: #555;
    cursor: pointer;
    background: 0 0;
}

.stat-nav-wrapper .langSel{
  position: absolute;
  right: 5px;
}

.stat-nav-wrapper .share{
  position: absolute;
  right: 95px;
}

.stat-nav-wrapper button>img {
  width: 20px;
  height: auto;
  margin-right: 2px;
  vertical-align: middle;
}

button:focus {outline:0;}
a:focus {outline:0;}
textarea:focus {outline:0;}

@media only screen and (max-width: 900px) {
  .stat-nav-wrapper button {
    font-size: 0;
  }

  .stat-nav-wrapper .langSel{
    right: 5px;
  }
  
  .stat-nav-wrapper .share{
    right: 40px;
  }
}


.cd-popup-trigger {
  display: block;
  width: 170px;
  height: 50px;
  line-height: 50px;
  margin: 3em auto;
  text-align: center;
  color: #FFF;
  font-size: 14px;
  font-size: 0.875rem;
  font-weight: bold;
  text-transform: uppercase;
  border-radius: 50em;
  background: #35a785;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.07);
}
@media only screen and (min-width: 1170px) {
  .cd-popup-trigger {
    margin: 6em auto;
  }
}

/*-------------------------------------- Game Styles ------------------------------------- */
#game-container{
  position: relative; 
  text-align: center;
}

#game-container canvas{
  width: 60vw;
}

/*--------- full screen request button --------- */
#rotateOverlay {
  display: none;                          /* hidden by default */
  position: absolute;
  padding-top: 25px;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 60vw;
  margin: auto;
  background: rgba(0,0,0,0.6);
  color: white;
  font-size: 18px;
  z-index: 99;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

#rotateOverlay p {
  margin: 0;
  margin-bottom: 10px;
}

#rotateOverlay button {
  font-size: 16px;
  padding: 8px 16px;
  background: #FFA726;
  color: white;
  border: none;
  border-radius: 4px;
}

@media (max-width: 768px) and (orientation: portrait) {
  #rotateOverlay {
    display: flex;
  }
}