/* =========================
   Base + Layout
========================= */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: "Chewy", system-ui;
  font-weight: 400;
  background: center / cover no-repeat fixed url(Images/MathBackground3.png);
  color: black;
}

/* =========================
   Site Header / Title
========================= */
#MainTitle {
  display: flex;
  justify-content: center;
  text-align: center;
  height: auto;
  font-size: 5rem;
  margin-bottom: 3rem;
}

#Home_heading {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 40vh;
  text-align: center;
  line-height: 2;
  margin-top: 60px;
}

/* =========================
   Nav
========================= */
#navbar {
  background-color: transparent;
  padding: 0 20px;
  height: 60px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.menu-hamburger {
  display: none;
  margin-left: 30px;
  margin-right: auto;
  font-size: 2rem;
  line-height: 1;
  color: black;
  cursor: pointer;
}

.nav-links {
  list-style: none;
  display: flex;
  justify-content: center;
  gap: 20px;
}

.nav-links a {
  color: black;
  text-decoration: none;
  font-size: 2.2rem;
}
.nav-links a:hover { color: teal; }

/* =========================
   Problem UI (shared)
========================= */
#add-problem-container,
#sub-problem-container,
#multi-problem-container,
#div-problem-container,
#challenge-problem-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 8rem;
  font-size: 3rem;
}

.input-checkanswer-container,
.next-question-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 2rem;
}

.answer-input {
  border: none;
  border-radius: 10px;
  padding: 6px 12px;
  font-family: "Chewy";
  font-size: 1.2rem;
  text-align: center;
  color: teal;
}
.answer-input::placeholder { color: teal; font-size: 1.1rem; }

.check-answer-btn,
.next-question-btn {
  border: none;
  border-radius: 12px;
  padding: 5px 12px;
  margin-left: 1rem;
  font-family: "Chewy";
  font-size: 1.1rem;
  color: teal;
  background-color: rgb(216, 205, 205);
  cursor: pointer;
}

.feedback-text {
  display: flex;
  justify-content: center;
  margin-top: 2rem;
  font-size: 2.5rem;
}

/* =========================
   Challenge Bar
========================= */
#milo-challenge-bar {
  margin: 20px auto;
  padding: 12px;
  background: rgba(39,31,21,0.80);
  border-radius: 12px;
  text-align: center;
  max-width: 640px;
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
}
#milo-challenge-bar .milo-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
#milo-player {
  padding: 6px 10px;
  border-radius: 10px;
  border: none;
  min-width: 220px;
}
#milo-start {
  border: none;
  padding: 6px 12px;
  background: #4bc1ff;
  color: #111;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
}
#milo-timer { font-weight: 700; letter-spacing: .5px; }
#milo-count { opacity: .95; }

/* =========================
   Leaderboard Panel + Table
========================= */
/* Optional class for your dark rounded panel/card */
.leaderboard-panel {
  width: min(960px, 92vw);
  margin: 0 auto;
}

/* Wrapper is added by JS so CSS can target safely */
.leaderboard-table-container {
  width: 100%;
  max-width: 100%;
  overflow: hidden; /* the mobile layout stacks; no horiz scroll needed */
}

.leaderboard-table-container table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto; /* desktop/tablet: natural column sizing */
}

.leaderboard-table-container th,
.leaderboard-table-container td {
  padding: 10px 12px;
  white-space: normal;
  word-break: break-word;
  vertical-align: middle;
}

/* =========================
   Responsive
========================= */
@media (max-width: 1180px) {
  .menu-hamburger {
    display: block;
    z-index: 10001; /* ensures the hamburger is always clickable */
    position: relative;
  }

  .nav-links {
    display: none;
    position: fixed;     /* fixed so it covers content and prevents bleed-through */
    top: 70px;
    left: 0;
    width: 100%;
    flex-direction: column;

    background-color: rgba(37, 161, 170, 0.97); /* nearly opaque to hide page text */
    backdrop-filter: blur(4px); /* optional but nice effect */

    border: 2px solid #050505;
    border-radius: 25px 25px 20px 20px;

    padding: 10px 0;
    z-index: 10000; /* sits ABOVE everything on the page */
  }

  .nav-links.active {
    display: flex;
  }

  .nav-links li {
    text-align: center;
    padding: 14px 10px;
    border-top: 1px solid #555;
  }

  #MainTitle {
    margin-top: 3rem;
  }
}


@media (max-width: 768px) {
  #MainTitle { font-size: 3rem; margin-top: 3rem; }
  #Home_heading { margin-top: -1rem; }

  /* tighten spacing on problem UIs */
  #add-problem-container,
  #sub-problem-container,
  #multi-problem-container,
  #div-problem-container,
  #challenge-problem-container {
    margin-top: 3rem;
    font-size: 2.4rem;
  }

  .input-checkanswer-container,
  .next-question-container { margin-top: 1.2rem; }

  .answer-input { width: 50%; }
  .check-answer-btn,
  .next-question-btn { font-size: 1.2rem; padding: 8px 16px; }
}

/* ===== Phone portrait: stack each table row with labels (no sideways scroll) ===== */
@media (max-width: 480px) {
  .leaderboard-table-container table,
  .leaderboard-table-container thead,
  .leaderboard-table-container tbody,
  .leaderboard-table-container th,
  .leaderboard-table-container td,
  .leaderboard-table-container tr { display: block; }

  /* keep header for a11y but hide visually */
  .leaderboard-table-container thead tr {
    position: absolute;
    top: -9999px; left: -9999px;
  }

  .leaderboard-table-container tr {
    background: rgba(0,0,0,0.12);
    border-radius: 12px;
    margin: 12px 0;
    padding: 6px 0;
  }

  .leaderboard-table-container td {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    padding: 8px 12px;
    font-size: clamp(14px, 3.8vw, 18px);
  }

  /* Labels (match your column order: #, Player, Correct, Points, When) */
  .leaderboard-table-container td:nth-child(1)::before { content: "#"; font-weight: 700; }
  .leaderboard-table-container td:nth-child(2)::before { content: "Player"; font-weight: 700; }
  .leaderboard-table-container td:nth-child(3)::before { content: "Correct"; font-weight: 700; }
  .leaderboard-table-container td:nth-child(4)::before { content: "Points"; font-weight: 700; }
  .leaderboard-table-container td:nth-child(5)::before { content: "When"; font-weight: 700; }
}
