/* ====== LAYOUT & BASE STYLES ====== */
:root {
  --r: 0;
  --r2: 0;
  --g: 0;
  --g2: 0;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow-x: hidden;
}

body {
  display: flex;
  flex-direction: column;
  font-family: "Montserrat", sans-serif;
  font-size: 16px;
  color: white;
  background: linear-gradient(270deg, #651d94 6.74%, #0f1b4b 82.95%);
  background-attachment: fixed;
}

/* ====== MAIN CONTENT & GAME LAYOUT ====== */
main {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  flex: 1;
  width: 100%;
  padding: 15px;
  position: relative;
  overflow: hidden;
}

/* ====== SCORE & UI ====== */
#scoreDisplay {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  z-index: 10;
  padding: 1.5rem 1rem 1.5rem 1rem;
  width: 100%;
  max-width: 420px;
}

.progress-bar-container {
  width: 100%;
  height: 8px; 
  background-color: #e2e8f0; 
  border-radius: 9999px;     
  overflow: hidden;        
}


.progress-bar-fill {
  width: 100%;
  height: 100%;
  background-color: #3b82f6;
  border-radius: 9999px;
  transform-origin: left;   
  will-change: transform;
}

#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;
}

#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;
}
.progress-bar-wrapper {
  width: 100%;
  max-width: 420px;
}


/* ====== GAME CARDS ====== */


.box-content {
  width: 100%;
  height: 100%;
  overflow-y: auto; /* Włączenie scrolla */
  overflow-x: hidden;
  display: block;
  border-radius: 8px;
  -webkit-overflow-scrolling: touch;
}

#box1 {
  cursor: grab;
  transform-origin: center bottom;

  position: relative;
  inset: 0;

  width: 100%;
  max-width: 420px;
  height: 60vh;
  max-height: 580px;
  border-radius: 16px;
  padding: 8px;
  border: 3px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
  box-sizing: border-box;
  
  user-select: none;
  
  transition: all 0.05s ease;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  will-change: transform;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  margin: auto 0; /* Wyśrodkowanie pionowe w Main */
  z-index: 5;
}

#box1.is-dragging {
  cursor: grabbing;
}

.box-img {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
}

/* ====== LIVES ====== */
#livesContainer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  z-index: 10;
  padding: 1.5rem 1rem 1.5rem 1rem;
}

.heart {
  font-size: 36px;
}

/* ====== MODALS & OVERLAYS ====== */
#eduContainer {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-y: auto;
  z-index: 1000;
  padding: 20px;
  background: rgba(8, 13, 40, 0.68);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

#loginContainer {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  overflow-y: auto;
  z-index: 1000;
  padding: 20px;
  background: rgba(8, 13, 40, 0.68);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

#eduContainer {
  display: none;
}

#education {
  width: min(100%, 430px);
  margin: auto;
  padding: 38px 34px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
  text-align: center;
  color: white;
  background: linear-gradient(145deg, rgba(25, 38, 91, 0.97), rgba(61, 30, 105, 0.97));
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 22px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42), 0 0 35px rgba(167, 197, 235, 0.12);
}

#info {
  width: 100%;
  color: rgba(255, 255, 255, 0.76);
  line-height: 1.5;
}

#info p {
  margin: 0;
}

.login-box {
  width: min(100%, 430px);
  margin: auto;
  padding: 38px 34px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
  text-align: center;
  color: white;
  background: linear-gradient(145deg, rgba(25, 38, 91, 0.97), rgba(61, 30, 105, 0.97));
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 22px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42), 0 0 35px rgba(167, 197, 235, 0.12);
}

.login-box h2 {
  margin: 0;
  font-size: 26px;
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: -0.4px;
}

.login-box p {
  margin: 0 0 6px;
  color: rgba(255, 255, 255, 0.76);
  line-height: 1.5;
}

.login-box input {
  width: 100%;
  min-height: 50px;
  padding: 13px 15px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 11px;
  outline: none;
  background: rgba(255, 255, 255, 0.08);
  color: white;
  font: inherit;
  font-size: 15px;
  transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s;
}

.login-box input::placeholder {
  color: rgba(255, 255, 255, 0.58);
}

.login-box input:focus {
  border-color: #a7c5eb;
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 0 0 3px rgba(167, 197, 235, 0.16);
}

.login-box button {
  min-height: 50px;
  padding: 12px 20px;
  border: 1px solid transparent;
  border-radius: 11px;
  cursor: pointer;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  transition: background-color 0.2s, border-color 0.2s, transform 0.2s, outline-color 0.2s;
}

#nextButton {
  min-height: 50px;
  padding: 12px 20px;
  border: 1px solid transparent;
  border-radius: 11px;
  cursor: pointer;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  color: #0f1b4b;
  background: #a7c5eb;
  transition: background-color 0.2s, border-color 0.2s, transform 0.2s, outline-color 0.2s;
}

.login-box button:hover {
  transform: translateY(-1px);
}

#nextButton:hover {
  background: #c4daf4;
  transform: translateY(-1px);
}

#nextButton:focus-visible {
  outline: 3px solid rgba(167, 197, 235, 0.55);
  outline-offset: 3px;
}

#startGameBtn {
  width: 100%;
  margin-top: 4px;
  background: #a7c5eb;
  color: #0f1b4b;
}

#startGameBtn:hover {
  background: #c4daf4;
}

#startGameBtn:focus-visible,
#closeLoginBtn:focus-visible {
  outline: 3px solid rgba(167, 197, 235, 0.55);
  outline-offset: 3px;
}

.login-box > a {
  display: block;
  width: 100%;
  text-decoration: none;
}

#closeLoginBtn {
  width: 100%;
  background: transparent;
  color: white;
  border-color: rgba(255, 255, 255, 0.24);
}

#closeLoginBtn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.42);
}

/* ====== FOOTER ====== */
footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 0.75rem 2rem;
  font-size: 12px;
  width: 100%;
  background-color: #f1f1f1;
  color: #0f1b4b;
}

/* ====== RESPONSIVENESS ====== */
@media (max-width: 900px) {
  header {
    flex-wrap: wrap;
    position: relative;
  }

  .header-left {
    justify-content: space-between;
    width: 100%;
  }

  .hamburger {
    display: flex;
  }

  .social-icons-desktop {
    display: none;
  }

  nav {
    display: none;
    width: 100%;
    flex-direction: column;
    background-color: #f1f1f1;
    padding: 20px 0;
  }

  nav.active {
    display: flex;
  }

  nav ul {
    flex-direction: column;
    gap: 20px;
    width: 100%;
  }

  .social-icons-mobile {
    display: flex;
    justify-content: center;
    margin-top: 15px;
  }
}

@media (max-width: 480px) {
  .box {
    max-width: 92vw;
    height: 58vh;
  }

  .login-box {
    padding: 30px 24px;
    border-radius: 18px;
  }

  #education {
    padding: 30px 24px;
    border-radius: 18px;
  }

  .login-box h2 {
    font-size: 23px;
  }

  #scoreText {
    font-size: 18px;
  }

  footer {
    justify-content: center;
  }
}

.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)));
}