@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@300..700&display=swap');
@import url("/css/footer.css");

* {
  font-family: "Fredoka", sans-serif;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ------------------ Base Styles ------------------ */
body {
  background-color: #f9f9fb;
  color: #333;
  line-height: 1.5;
}

a {
  text-decoration: none;
  color: inherit;
}

/* ------------------ Header / Topbar ------------------ */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, var(--primary, #B37EFF), #dbc2ff);
  padding: 12px 20px;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.header .logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 20px;
  font-weight: 700;
  color: white;
}

.header .logo img {
  width: 32px;
  height: 32px;
}

.topbar-menu {
  display: flex;
  list-style: none;
  gap: 16px;
  flex-wrap: wrap;
}

.topbar-menu li a {
  color: white;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.topbar-menu li a:hover {
  background: rgba(255, 255, 255, 0.2);
}

.logo a {
  text-decoration: none;
  color: inherit;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}


/* ------------------ Game Section ------------------ */
.game-section {
  max-width: 1200px;
  margin: 20px auto;
  padding: 0 16px;
}

/* Game wrapper - combines top-bar and game container */
.game-wrapper {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

/* Top bar inside game section */
.top-bar {
  background: linear-gradient(90deg, #B37EFF, #dbc2ff);
  padding: 10px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 18px;
  font-weight: 500;
  color: black;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
}

.top-bar button {
  padding: 8px 14px;
  border: none;
  background: none;
  color: #7a42f4;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 16px;
}

.top-bar button:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

/* ------------------ Game Brand ------------------ */
.game-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.game-brand img {
  width: 80px;
  height: 80px;
  border-radius: 16px;
  object-fit: cover;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.game-brand .game-name {
  color: white;
  font-size: 28px;
  font-weight: 700;
  text-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* Center game title in top bar */
.top-bar #game-title {
  flex: 1;
  text-align: center;
  margin: 0 8px;
}

/* Back button with white background */
.top-bar button:first-child {
  background: white;
}

/* Fullscreen button with no background */
.top-bar button:last-child {
  background: none;
}

#game-title {
  font-weight: 700;
  font-size: 20px;
}

/* ------------------ Game Container ------------------ */
.game-container {
  width: 100%;
  height: calc(100vh - 120px); /* header + top-bar */
  position: relative;
  overflow: hidden;
  background: #fff;
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
}

iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  overflow: hidden;
}

/* ------------------ Loading Screen ------------------ */
.loading-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #f9f9fb;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 18px;
  font-weight: 500;
  color: #555;
  z-index: 10;
  opacity: 1;
  transition: opacity 0.6s ease;
}

/* ------------------ Play Button Overlay ------------------ */
.play-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #1a1a2e;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 20;
  transition: opacity 0.4s ease;
}

.play-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

/* Wrapper to stack game brand and play button vertically */
.play-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.play-button {
  display: flex;
  flex-direction: row !important;
  align-items: center;
  gap: 12px;
  padding: 16px 32px !important;
  background: linear-gradient(135deg, #B37EFF, #7a42f4);
  border: none;
  border-radius: 16px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 4px 20px rgba(123, 66, 244, 0.4);
}

.play-button:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 30px rgba(123, 66, 244, 0.6);
}

.play-button svg {
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
  width: 32px !important;
  height: 32px !important;
}

.play-button span {
  color: white;
  font-size: 20px;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.loading-screen.hidden {
  opacity: 0;
  pointer-events: none;
}

.spinner {
  border: 5px solid #ddd;
  border-top: 5px solid #7a42f4;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin-right: 12px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ------------------ SEO Game Info ------------------ */
.game-info {
  margin-top: 24px;
  padding: 24px 28px;
  background: var(--seo-bg);
  color: var(--seo-text);
  border-radius: 12px;
  line-height: 1.6;
  display: flex;
  align-items: flex-start;
  gap: 24px;
}

.game-info .game-icon {
  width: 120px;
  height: 120px;
  border-radius: 12px;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.game-info .game-text {
  flex: 1;
}

.game-info h1 {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 12px;
}

.game-info p {
  font-size: 18px;
  margin-bottom: 8px;
}

.game-info .additional-header {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent, #4c2cd9);
  margin: 16px 0 8px 0;
}

/* Responsive for game info card */
@media (max-width: 600px) {
  .game-info {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 20px;
  }
  
  .game-info .game-icon {
    width: 100px;
    height: 100px;
  }
  
  .game-info h1 {
    font-size: 24px;
  }
  
  .game-info p {
    font-size: 16px;
  }
}


/* ------------------ Q&A Section ------------------ */
.qa-section {
  margin-top: 32px;
  padding: 0 64px;
}

.qa-section h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--accent, #4c2cd9);
}

.qa-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.qa-item {
  background: var(--card-bg, #fff);
  border-radius: 12px;
  overflow: hidden;
  transition: box-shadow 0.2s ease;
}

.qa-item:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.qa-question {
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-weight: 600;
  color: var(--text-color, #333);
  font-size: 15px;
}

.qa-arrow {
  font-size: 12px;
  transition: transform 0.3s ease;
  color: var(--accent, #4c2cd9);
}

.qa-item.qa-open .qa-arrow {
  transform: rotate(180deg);
}

.qa-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
  background: rgba(0,0,0,0.03);
}

.qa-item.qa-open .qa-answer {
  max-height: 200px;
}

.qa-answer p {
  padding: 16px 20px;
  font-size: 14px;
  color: var(--text-color, #555);
  line-height: 1.6;
}


/* ------------------ More Like This ------------------ */
.more-games {
  margin-top: 40px;
  padding: 0px 56px
}

.more-games h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 16px;
  text-align: center;
  color: var(--accent, #4c2cd9);
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 12px;
}

/* ------------------ Random Games (8 columns) ------------------ */
.random-games {
  margin-top: 40px;
  margin-bottom: 40px;
  padding: 0 56px;
}

.random-games h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 16px;
  text-align: center;
  color: var(--accent, #4c2cd9);
}

.game-grid-8 {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 12px;
}

/* Responsive for random games grid */
@media (max-width: 1400px) {
  .game-grid-8 {
    grid-template-columns: repeat(7, 1fr);
  }
}

@media (max-width: 1200px) {
  .game-grid-8 {
    grid-template-columns: repeat(6, 1fr);
  }
}

@media (max-width: 1000px) {
  .game-grid-8 {
    grid-template-columns: repeat(5, 1fr);
  }
}

@media (max-width: 850px) {
  .game-grid-8 {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 650px) {
  .game-grid-8 {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 450px) {
  .game-grid-8 {
    grid-template-columns: repeat(2, 1fr);
  }
}

.game-card{
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  cursor: pointer;
  transition: transform 0.3s, box-shadow 0.3s;
  background: var(--card-bg, #fff);
}

/* Thumbnail wrapper inside a card (matching index.html) */
.game-card .thumb-container{
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.3s ease;
}

.game-card img{
  width: 100%;
  height: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
  flex-shrink: 0;
}

.game-card .game-title{
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-color, #333);
  text-align: center;
  padding: 8px 10px;
}

/* Overlay info that appears on hover (scoped to cards) */
.game-card .game-info{
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 10px 12px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  color: white;
  text-shadow: 0 2px 4px rgba(0,0,0,0.8);
  transition: opacity 0.25s ease;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0 !important;
}

.game-card:hover{
  transform: translateY(-8px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}

.game-card:hover .game-info{
  opacity: 1;
  background: rgba(0,0,0,0.5);
  pointer-events: auto;
}

/* Match index.html behavior: inset gradient on hover for the thumbnail (hidden by default) */
.game-card .thumb-container::after{
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 50%;
  pointer-events: none;
  box-shadow: inset 0 -60px 30px -20px rgba(0,0,0,0.5);
  border-radius: 0;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.game-card:hover .thumb-container::after{
  opacity: 1;
}

/* When the title is inside the overlay, ensure it appears white and is truncated like index.html */
.game-card .game-info .game-title{
  color: white;
  font-weight: 600;
  font-size: 0.95rem;
  word-wrap: break-word;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  text-decoration: none;
  margin: 0;
  width: 100%;
  text-align: center;
}

/* ensure the inset shadow doesn't get rounded corners visually */
/* (pseudo-element defined above) */

/* ------------------ Theme Variables ------------------ */
:root {
  --card-bg: #fff;
  --text-color: #333;
  --accent: #4c2cd9;

  /* ADD */
  --seo-bg: #f3f3f8;
  --seo-text: #333;

  /* Footer background color - stays dark regardless of theme */
  --dark: #1a1a2e;
}

body.dark {
  --card-bg: #2b2b3d;
  --text-color: #eee;
  --accent: #b37eff;

  /* ADD */
  --seo-bg: #23233a;
  --seo-text: #eee;

  background-color: #1a1a2e;
}

/* Footer styles - stays dark regardless of theme */
body.dark footer.footer {
  background: #1a1a2e !important;
  color: white !important;
}
body.dark footer.footer .footer-logo-text,
body.dark footer.footer .footer-title,
body.dark footer.footer .footer-brand-desc,
body.dark footer.footer .footer-link {
  color: white !important;
}
body.dark footer.footer .footer-link:hover {
  color: #B37EFF !important;
}
body.dark footer.footer .footer-bottom {
  border-top-color: rgba(255, 255, 255, 0.1) !important;
}

/* ---------- FULLSCREEN MODE ---------- */
body.fullscreen-mode {
  overflow: hidden;
}

/* Game container fills screen */
body.fullscreen-mode .game-section {
  max-width: 100%;
  padding: 0;
  margin: 0;
}

body.fullscreen-mode .game-wrapper {
  height: 100vh;
  width: 100vw;
  max-width: 100vw;
  position: relative;
  z-index: 2;
  margin: 0;
  padding: 0;
  border-radius: 0 !important;
  overflow: hidden;
}

body.fullscreen-mode .game-container {
  position: absolute;
  top: 45px;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  height: auto;
  max-width: 100%;
  margin: 0;
  padding: 0;
  border-radius: 0 !important;
  overflow: hidden;
}

/* Only the game top-bar is visible */
body.fullscreen-mode .top-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: linear-gradient(90deg, #B37EFF, #dbc2ff);
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  border-radius: 0 !important;
}

/* Remove footer in fullscreen mode */
body.fullscreen-mode footer {
  display: none !important;
}

/* Hide all other UI in fullscreen */
body.fullscreen-mode .header,
body.fullscreen-mode .site-footer,
body.fullscreen-mode .more-games,
body.fullscreen-mode .loading-screen,
body.fullscreen-mode .game-info ,
body.fullscreen-mode .random-games {
  display: none !important;
}

/* Play overlay remains visible in fullscreen until user clicks Play */

/* Iframe fills remaining space */
body.fullscreen-mode iframe {
  width: 100%;
  height: 100%;
  margin: 0;
  display: block;
  border-radius: 0 !important;
  overflow: hidden;
}

/* ------------------ Responsive ------------------ */
@media (max-width: 768px) {
  .top-bar {
    flex-direction: row;
    gap: 8px;
    padding: 6px 12px;
  }
  .top-bar button {
    padding: 4px 8px;
    font-size: 14px;
  }
  #game-title {
    font-size: 16px;
  }
  .game-card img {
    height: 90px;
  }
}

/* ------------------ Category Buttons Styles ------------------ */
.category-section {
    max-width: 1400px;
    margin: 0 auto;
    padding: 25px 20px;
}
.category-section h2 {
    font-size: 1.4rem;
    color: #2d3436;
    margin-bottom: 20px;
    text-align: center;
}
body.dark .category-section h2 {
    color: #f5f5f5;
}
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 15px;
    max-width: 1200px;
    margin: 0 auto;
}
.category-btn-rect {
    display: flex;
    align-items: center;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    text-decoration: none;
    transition: 0.3s;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    height: 80px;
}
.category-btn-rect:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}
.category-btn-rect:hover {
    background: var(--primary, #B37EFF);
}
.category-btn-rect:hover .cat-btn-icon {
    background: var(--primary-dark, #9458d9);
}
.category-btn-rect .cat-btn-icon {
    width: 80px;
    height: 100%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s;
}
.category-btn-rect .cat-btn-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.category-btn-rect .cat-btn-text {
    flex: 1;
    padding: 0 20px;
    text-align: left;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--dark, #1a1a2e);
    transition: 0.3s;
}
.category-btn-rect:hover .cat-btn-text {
    color: white;
}
body.dark .category-btn-rect {
    background: #1a1a3e;
}
body.dark .category-btn-rect .cat-btn-text {
    color: #f5f5f5;
}
body.dark .category-btn-rect:hover {
    background: linear-gradient(135deg, #4a3fcf 0%, #6b4db8 100%);
}
body.dark .category-btn-rect:hover .cat-btn-icon {
    background: linear-gradient(135deg, #5a4fdf 0%, #7b5dc8 100%);
}

@media (max-width: 480px) {
    .category-btn-rect {
        height: 65px;
    }
    .category-btn-rect .cat-btn-icon {
        width: 65px;
    }
    .category-btn-rect .cat-btn-text {
        font-size: 1rem;
        padding: 0 15px;
    }
    .category-btn-rect .cat-btn-icon span {
        font-size: 1.6rem;
    }
    .category-grid {
        gap: 12px;
    }
}
