:root {
  --bg: #020617;
  --card: #0f172a;
  --accent: #fff27a;
  --text: #e5e7eb;
  --bg-image: url('../assets/img/darkbackground.jpg');
}

.light {
  --bg: #f8fafc;
  --card: #ffffff;
  --accent: #2563eb;
  --text: #000000;
  --bg-image: url('../assets/img/lightbackground.jpg');
}

* {
  box-sizing: border-box;
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: system-ui, sans-serif;
  background-color: var(--bg);
  background-image: var(--bg-image);
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  background-attachment: fixed;
  color: var(--text);
  padding-top: 70px;
  /* space for navbar */
  animation: fade 0.4s ease;

}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at top,
      rgba(255, 255, 255, .08),
      transparent 65%);
  pointer-events: none;
  z-index: -1;
}

@keyframes fade {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* NAV BAR */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 56px;
  background: var(--card);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, .4);
  z-index: 1000;
}

.logo {
  font-weight: 700;
  font-size: 16px;
  text-decoration: none;
  color: inherit;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* NAV BUTTONS */
.nav-buttons {
  display: flex;
  gap: 10px;
}

.nav-buttons a,
.nav-buttons button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #22c55e);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 16px;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, .35);
  transition: 0.25s ease;
  text-decoration: none;
}

.nav-buttons a:hover,
.nav-buttons button:hover {
  transform: translateY(-2px) scale(1.08);
  box-shadow: 0 8px 18px rgba(0, 0, 0, .5);
}

.nav-buttons i {
  pointer-events: none;
}

.nav-buttons span {
  display: none;
}

/* BURGER */
.burger {
  display: none;
  background: none;
  border: none;
  font-size: 26px;
  color: var(--text);
  cursor: pointer;
}

/* HOME PAGE */
.page-wrapper {
  flex: 1;
  padding: 16px;
}

/* CARD */
.card {
  background: rgba(255, 255, 255, .08);
  backdrop-filter: blur(14px);
  border-radius: 22px;
  padding: 30px;
  padding-bottom: 60px;
  width: 100%;
  max-width: 1000px;
  margin: 20px auto 60px;
  box-shadow:
    0 30px 80px rgba(0, 0, 0, .55),
    inset 0 0 0 1px rgba(255, 255, 255, .08);
}

h1 {
  text-align: center;
  margin-bottom: 10px;

}

/* Game Grid */
.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px;
}

/* Tiles */
.game-tile {
  position: relative;
  height: 210px;
  border-radius: 16px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .45);
  transition: all .35s cubic-bezier(.21, .6, .35, 1);
  cursor: pointer;
  text-decoration: none;
  color: white;
  isolation: isolate;
}

.game-tile::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--x, 50%) var(--y, 50%),
      rgba(255, 255, 255, .25), transparent 55%);
  opacity: 0;
  transition: opacity .3s ease;
  z-index: 1;
}

.game-tile:hover::before {
  opacity: 1;
}

.game-tile:hover {
  transform: translateY(-10px) scale(1.06);
  box-shadow: 0 25px 80px rgba(0, 0, 0, .85);
}

.game-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .6s cubic-bezier(.21, .6, .35, 1);
}

.game-tile:hover img {
  transform: scale(1.18);
}

.game-tile::after {
  content: "▶ Play";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, .45);
  backdrop-filter: blur(4px);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 1px;
  opacity: 0;
  transform: scale(.8);
  transition: all .35s ease;
  z-index: 3;
}

.game-tile:hover::after {
  opacity: 1;
  transform: scale(1);
}

.game-info {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  padding: 10px 14px;
  background: linear-gradient(to top,
      rgba(0, 0, 0, 0.45),
      rgba(0, 0, 0, 0.18),
      rgba(0, 0, 0, 0));
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 2;
  color: var(--text);
}

.game-info h3 {
  margin: 0;
  font-size: 18px;
}

.game-info p {
  margin: 0;
  font-size: 13px;
  opacity: .8;
}

/* Full-screen alternating blocks */
.full-screen-blocks {
  width: 100%;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 60px;
}

/* Each block*/
.block {
  background: rgba(255, 255, 255, .08);
  backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 60vh;
  padding: 40px 10%;
  gap: 40px;
}

/* Alternate image position */
.block.reverse {
  flex-direction: row-reverse;
  background: rgba(255, 255, 255, .08);
  backdrop-filter: blur(14px);
}

.block.reverse .text-flow {
  margin-left: 40px;
}

/* Image styling */
.block img {
  width: 45%;
  height: auto;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
  transition: transform 0.3s ease;
}

.block img:hover {
  transform: scale(1.05);
}

/* Text container */
.text-flow {
  width: 50%;
}

.text-flow h2 {
  margin-bottom: 12px;
  font-size: 28px;
  color: var(--accent);
}

.text-flow p,
.text-flow ul {
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
}

.text-flow ul li {
  margin-bottom: 6px;
}

/* Button inside flow */
.text-flow button {
  padding: 16px 32px;
  font-size: 18px;
  font-weight: 700;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, #f6d365, #fda085);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.text-flow button:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

/* ===== Scroll Slide Animations ===== */

/* Initial hidden state */
.block img,
.block .text-flow {
  opacity: 0;
  transform: translateX(80px);
  transition: all 0.8s ease;
}

/* Normal blocks: image from LEFT, text from RIGHT */
.block:not(.reverse) img {
  transform: translateX(-80px);
}

.block:not(.reverse) .text-flow {
  transform: translateX(80px);
}

/* Reverse blocks: image from RIGHT, text from LEFT */
.block.reverse img {
  transform: translateX(80px);
}

.block.reverse .text-flow {
  transform: translateX(-80px);
}

/* When visible */
.block.show img,
.block.show .text-flow {
  opacity: 1;
  transform: translateX(0);
}

/* GAMES */
.start-screen {
  background: rgba(255, 255, 255, .08);
  backdrop-filter: blur(14px);
  border-radius: 20px;
  padding: 40px;
  text-align: center;
  max-width: 420px;
  margin: 0px auto;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .4);
  position: relative;
  overflow: hidden;
}

.start-screen h1 {
  font-size: 34px;
  margin-bottom: 12px;
}

.start-screen p {
  opacity: 0.85;
  margin-bottom: 20px;
  font-size: 16px;
}

/* Individual game colors */
.icon-x {
  color: #ef4444;
}

.icon-o {
  color: #3b82f6;
}

.icon-brain {
  color: #a855f7;
}

.icon-puzzle {
  color: #22c55e;
}

.icon-grid {
  color: #f59e0b;
}


.game-history {
  max-width: 420px;
  margin: 20px auto;
  padding: 20px;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(14px);
  border-radius: 16px;
  text-align: left;
}

/* Header clickable */
.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

.game-history h2 {
  font-size: 20px;
  color: var(--accent);
  margin-bottom: 12px;
}

/* Arrow rotation */
.history-header .arrow {
  transition: transform 0.3s ease;
}

/* Hide the list by default */
.history-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

/* List items style */
.history-list li {
  margin-bottom: 8px;
  font-size: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  padding-bottom: 4px;
}

/* Show the list when checkbox is checked */
#historyToggle:checked~.history-list {
  max-height: 500px;
}

/* Rotate arrow when open */
#historyToggle:checked+.history-header .arrow {
  transform: rotate(180deg);
}

.game-card {
  background: rgba(255, 255, 255, .08);
  backdrop-filter: blur(14px);
  border-radius: 18px;
  padding: 20px;
  width: max-content;
  min-width: 420px;
  margin: 0 auto 60px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .4);
}

.game-card h1 {
  margin-top: 0px;
  font-size: 28px;
}

.top-ui {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin: 10px 0;
    flex-wrap: nowrap;
}

.score {
  text-align: center;
  margin-top: 8px;
  font-size: 14px;
}

.rst-but {
  display: block;
  margin: 14px auto 2px;
  padding: 10px 20px;
  border-radius: 12px;
  background: var(--accent);
  color: var(--card);
  border: none;
  font-size: 16px;
  cursor: pointer;
  text-decoration: none;
}

.best-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 8px 0 10px;
  gap: 10px;
}

.best-row p {
  margin: 0;
  font-weight: 700;
}

.rst-but.small {
  padding: 6px 14px;
  font-size: 14px;
  margin: 0;
}

/* How To Play Button */
/* Position the button in the top right of the card */
.how-to-corner {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 35px;
  height: 35px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  color: var(--accent);
  text-decoration: none;
  font-size: 20px;
  transition: all 0.3s ease;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.how-to-corner:hover {
  background: var(--accent);
  color: var(--card);
  transform: rotate(15deg) scale(1.1);
  box-shadow: 0 0 15px var(--accent);
}

/* UI ANIMATIONS */
.card,
.cell,
button,
a {
  transition: all 0.25s ease;
}

button:hover,
.menu a:hover,
.nav-buttons a:hover {
  transform: scale(1.06);
}

/* Buttons */
.buttons {
  display: flex;
  gap: 8px;
}

/* Result Modal */
.modal {
  display: none;
  /* hidden by default */
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 2000;
  justify-content: center;
  align-items: center;
}

.modal-content {
  background: var(--card);
  color: var(--text);
  padding: 30px 40px;
  border-radius: 20px;
  text-align: center;
  width: 90%;
  max-width: 360px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  animation: popup 0.4s ease;
}

.modal-content h2 {
  font-size: 28px;
  margin-bottom: 15px;
  color: var(--accent);
}

.modal-content p {
  font-size: 16px;
  margin-bottom: 25px;
}

.modal-buttons {
  display: flex;
  justify-content: space-around;
  gap: 12px;
}

.modal-btn {
  flex: 1;
  padding: 10px 20px;
  border-radius: 12px;
  border: none;
  background: var(--accent);
  color: var(--card);
  font-weight: 700;
  cursor: pointer;
  transition: 0.25s ease;
}

.modal-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

/* Modal Icons Styling */
.modal-icons {
  display: flex;
  justify-content: center;
  gap: 25px;
  margin-bottom: 15px;
}

.modal-icons .icon-x {
  color: #ef4444;
  font-size: 36px;
}

.modal-icons .icon-o {
  color: #3b82f6;
  font-size: 36px;
}

@keyframes popup {
  from {
    transform: scale(0.7);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

.menu {
  display: grid;
  gap: 14px;
}

.menu a,
.menu button {
  padding: 14px;
  border-radius: 12px;
  background: var(--accent);
  color: var(--card);
  text-align: center;
  text-decoration: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  font-weight: 700;
  /* Bold text */
}

/* MENU ICON COLORS */
.menu i {
  margin-right: 8px;
  font-size: 24px;
  transition: transform 0.2s ease, filter 0.2s ease;
}

/* Hover glow & scale */
.menu a:hover i {
  transform: scale(1.35);
  filter: drop-shadow(0 0 8px currentColor);
}

.volume-control {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.volume-control input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
}

/* Contact us message */
.success-msg {
  display: none;
  margin-top: 15px;
  padding: 12px;
  border-radius: 8px;
  background: #22c55e;
  color: white;
  text-align: center;
  font-weight: 500;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* FOOTER */
.footer {
  background: var(--card);
  color: var(--text);
  text-align: center;
  padding: 24px 16px;
  margin-top: 100px;
  box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.3);
  width: 100%;
}

.footer-content {
  max-width: 1000px;
  margin: 0 auto;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.footer-links a {
  text-decoration: none;
  color: var(--accent);
  font-weight: 600;
  transition: 0.25s ease;
}

.footer-links a:hover {
  text-decoration: underline;
}

.footer-socials {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 12px;

}

.footer-socials i {
  font-size: 28px;
  color: var(--accent);
}

.footer-socials a:hover .fa-facebook-f {
  color: #1877f2;
}

.footer-socials a:hover .fa-instagram {
  color: #e1306c;
}

.footer-socials a:hover .fa-x-twitter {
  color: #000000;
}


/* RESPONSIVE */
@media (max-width: 480px) {
  .game-card {
    width: 100%;
    min-width: unset;
    max-width: 100%;
    padding: 16px;
    border-radius: 16px;
  }

  .game-card h1 {
    font-size: 22px;
  }

  .page-wrapper {
    padding: 10px;
  }
}

@media (max-width: 768px) {

  .block {
    padding: 30px 5%;
  }

  .burger {
    display: block;
  }

  .nav-buttons {
    position: fixed;
    top: 56px;
    left: 0;
    width: 100%;
    background: var(--card);
    flex-direction: column;
    gap: 14px;
    padding: 16px;
    transform: translateY(-120%);
    transition: 0.35s ease;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
  }

  .nav-buttons.active {
    transform: translateY(0);
  }

  .nav-buttons a,
  .nav-buttons button {
    width: 100%;
    border-radius: 12px;
    justify-content: center;
    font-size: 16px;
  }

  .nav-buttons span {
    display: inline;
    text-decoration: none;
    margin-left: 10px;
  }

  .block,
  .block.reverse {
    flex-direction: column;
    text-align: center;
    padding: 30px 5%;
    min-height: auto;
    justify-content: flex-start;
    gap: 16px;
  }

  .block.reverse .text-flow {
    margin-left: 0;
  }

  .block img {
    width: 80%;
    margin-bottom: 0;
  }

  .text-flow {
    width: 100%;
    margin-top: 0;
  }
}