/* Layout Styles */
html {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  font-family: 'Montserrat', sans-serif;
  font-size: 16px;
  color: white;
  background-attachment: fixed;
  background: linear-gradient(270deg, #651D94 6.74%, #0F1B4B 82.95%);
}

main {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  flex: 1;
  text-align: center;
  overflow-y: auto;
}

h1 {
  font-size: 18px;
  font-weight: 500;
  letter-spacing: 2px;
  margin-bottom: 40px;
  transition: all 0.3s ease;
}

/* Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-left: 4.75vw;
  padding-right: 4.75vw;
  padding-top: 1rem;
  padding-bottom: 1rem;
  width: 100%;
  box-sizing: border-box;
  background-color: #f1f1f1;
  max-height: 100px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 30px;
  flex: 1;
}

.logo {
  display: flex;
  align-items: center;
  color: #050f66;
  font-family: 'JetBrains Mono', monospace;
  font-size: 28px;
  font-weight: 800;
  flex-shrink: 0;
}

.logo img {
  height: 60px;
  margin-right: 128px;
  padding: 5px;
}

.logo a {
  color: #050f66;
  text-decoration: none;
}

/* Navigation */
nav {
  display: block;
  flex: 1;
}

nav ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 60px;
}

nav li {
  margin: 0;
}

nav li p {
  margin: 0;
  padding: 0;
}

nav a {
  text-decoration: none;
  color: #0f1b4b;
  font-weight: 500;
  font-size: 16px;
  letter-spacing: 0.5px;
  transition: color 0.3s ease;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.15);
}

.underline {
  border-bottom: 2px solid #0f1b4b;
  padding-bottom: 2px;
  display: inline-block;
  transition: all 0.3s ease;
}

.underline:hover {
  border-bottom-color: #a7c5eb;
}

.underline:hover a {
  color: #a7c5eb;
}

nav a:hover {
  color: #a7c5eb;
}

/* Social Icons */
.social-icons {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-shrink: 0;
}

.social-icons a {
  color: #0f1b4b;
  margin-left: 20px;
  font-size: 18px;
  transition: color 0.3s ease;
}

.social-icons a:hover {
  color: #a7c5eb;
}

/* Hide mobile social icons on desktop */
.social-icons-mobile {
  display: none;
}

/* Show desktop social icons */
.social-icons-desktop {
  display: flex;
}

/* Hamburger Menu - Hidden by default */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  padding: 0;
  background: rgba(15, 27, 75, 0.1);
  border: 2px solid #0f1b4b;
  border-radius: 5px;
  z-index: 1000;
  width: 28px;
  height: 28px;
  position: relative;
}

.hamburger span {
  width: 16px;
  height: 2px;
  background-color: #0f1b4b;
  border-radius: 2px;
  transition: all 0.3s ease;
  display: block;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.hamburger span:nth-child(1) {
  top: 5px;
}

.hamburger span:nth-child(2) {
  top: 12px;
}

.hamburger span:nth-child(3) {
  top: 19px;
}

.hamburger.active span:nth-child(1) {
  top: 12px;
  transform: translateX(-50%) rotate(45deg);
}

.hamburger.active span:nth-child(2) {
  opacity: 0;
}

.hamburger.active span:nth-child(3) {
  top: 12px;
  transform: translateX(-50%) rotate(-45deg);
}

/* Text Display Elements */
.text-display {
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 10px;
  padding: 15px 30px;
  margin-bottom: 30px;
  min-width: 200px;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 3px;
  backdrop-filter: blur(5px);
  transition: all 0.3s ease;
}

.text-display.highlight {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.6);
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

/* Footer */
footer {
  text-align: right;
  padding: 0.5rem;
  font-size: 12px;
  width: 100%;
  box-sizing: border-box;
  background-color: #f1f1f1;
  color: #0f1b4b;
}

/* Tablet/Small Desktop - Below 1280px */
@media (max-width: 1280px) {
  .logo img {
    margin-right: 60px;
  }

  nav ul {
    gap: 30px;
  }

  nav a {
    font-size: 14px;
  }
}

/* Tablet - Below 1024px */
@media (max-width: 1024px) {
  .logo img {
    margin-right: 40px;
    height: 50px;
  }

  nav ul {
    gap: 20px;
  }

  nav a {
    font-size: 13px;
  }
}

/* Mobile Landscape - Below 768px */
@media (max-width: 768px) {
  header {
    flex-direction: column;
    padding: 15px;
    gap: 0;
    max-height: none;
    align-items: center;
  }

  .header-left {
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 20px;
    width: 100%;
    position: relative;
    flex: 0 0 auto;
  }

  .logo {
    justify-content: center;
    flex: 0 0 auto;
  }

  .logo img {
    margin-right: 0;
    height: 50px;
  }

  /* Hide desktop nav */
  .header-left nav {
    display: none;
  }

  /* Show hamburger menu */
  .hamburger {
    display: flex !important;
    position: relative;
    flex: 0 0 auto;
  }

  /* Hide desktop social icons on mobile */
  .social-icons-desktop {
    display: none !important;
  }

  /* Show mobile social icons inside nav */
  .social-icons-mobile {
    display: flex !important;
    justify-content: center;
    width: 100%;
    padding-top: 15px;
    padding-bottom: 10px;
  }

  .social-icons-mobile a {
    margin: 0 15px;
  }

  /* Collapsible nav for mobile */
  .header-left nav {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    width: 100%;
    background-color: #f1f1f1;
    z-index: 999;
  }

  .header-left nav.active {
    display: block !important;
    max-height: 600px;
    padding: 15px 0;
  }

  nav ul {
    flex-direction: column;
    text-align: center;
    gap: 15px;
    width: 100%;
  }

  footer {
    padding-right: 3rem;
  }

  .keypad {
    width: 200px;
  }

  .keypad button {
    width: 50px;
    height: 50px;
    font-size: 20px;
  }

  .text-display {
    font-size: 20px;
    padding: 12px 25px;
    min-width: 150px;
  }

}

/* Mobile Portrait - Below 640px */
@media (max-width: 640px) {
  header {
    padding: 10px;
  }

  .logo img {
    height: 40px;
  }

  nav a {
    font-size: 14px;
  }

  footer {
    padding-right: 2rem;
    font-size: 10px;
  }
  #scoreText {
    font-size: 18px !important;
  }

  .box {
    width: 300px !important;
  }
}

/* ====== MAIN GAME AREA ====== */
main {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
}

/* ====== SCORE ====== */
#scoreDisplay {
  position: fixed;
  top: 120px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  z-index: 100;
}

#scoreText {
  font-size: 22px;
  font-weight: 500;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.3s ease;
}

#scoreText.feedback-mode {
  font-size: 26px;
}

#scoreText.success {
  color: #4CAF50;
}

#scoreText.error {
  color: #ff4444;
}

#helpIcon {
  width: 28px;
  height: 28px;
  background: rgba(255, 255, 255, 0.15);
  border: 2px solid white;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
}

#helpIcon:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

/* ====== GAME CARDS ====== */
.box {
  position: absolute;
  width: 450px;
  aspect-ratio: 63.5 / 89;
  border-radius: 12px;
  padding: 5px;
  border: 3px solid white;
  box-sizing: border-box;
  transition: transform 0.3s ease;
  user-select: none;
}

.box-content {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

.box.inactive .box-content {
  overflow: hidden;
  pointer-events: none;
}

#box3 {
  background: rgba(255, 255, 255, 0.05);
  transform: rotate(-3deg) translateY(20px) translateX(-15px);
  z-index: 1;
}

#box2 {
  background: rgba(255, 255, 255, 0.1);
  transform: rotate(2deg) translateY(10px) translateX(10px);
  z-index: 2;
}

#box1 {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  font-size: 20px;
  cursor: grab;
  background: rgba(255, 255, 255, 0.15);
  z-index: 3;
  box-shadow: 29px 34px 100px -24px rgba(66, 68, 90, 1);
}

#box1:hover {
  transform: scale(1.02) rotate(1deg);
}

.box-img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  pointer-events: none;
}

/* ====== EDU OVERLAY ====== */
#eduContainer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.8);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

#education {
  background: #333;
  padding: 30px;
  border-radius: 10px;
  text-align: center;
  max-width: 400px;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
}

#nextButton {
  background: royalblue;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 16px;
  margin-top: 20px;
}

/* ====== LIVES ====== */
#livesContainer {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 15px;
  z-index: 200;
}

.heart {
  font-size: 40px;
  transition: opacity 0.3s ease;
}

/* ====== GRADIENT ====== */
:root {
  --r: 0;
  --r2: 0;
  --g: 0;
  --g2: 0;
}

.gradient {
  background-image:
    linear-gradient(270deg, transparent 75%, rgba(0, 255, 0, var(--g))),
    linear-gradient(-35deg, transparent 75%, rgba(0, 255, 0, var(--g2))),
    linear-gradient(-155deg, transparent 75%, rgba(0, 255, 0, var(--g2))),
    linear-gradient(90deg, transparent 75%, rgba(255, 0, 0, var(--r))),
    linear-gradient(145deg, transparent 75%, rgba(255, 0, 0, var(--r2))),
    linear-gradient(25deg, transparent 75%, rgba(255, 0, 0, var(--r2)));
}