/* ============================================================
   GLOBAL RESET + BASE STYLES
   ============================================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Segoe UI", Arial, sans-serif;
}

html, body {
    width: 100%;
    height: 100%;
    background: #0F172A;
    overflow-x: hidden;
}

/* ============================================================
   HYBRID SCREEN POSITIONING
   ============================================================ */

/* Default: absolute (menu, quiz, matching) */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    padding: 0;
    display: flex;
    flex-direction: column;
}

/* Scrolling screens (leaderboard + KS3 topic pages) */
#leaderboardScreen,
#ks3Screen {
    position: static !important;
    height: auto !important;
    min-height: 100vh;
    overflow-y: auto;
}

/* ============================================================
   CENTERED RADIAL GLOW BACKGROUND
   ============================================================ */
body::before {
    content: "";
    position: fixed;
    top: 50%;
    left: 50%;
    width: 1400px;
    height: 1400px;
    transform: translate(-50%, -50%);
    background: radial-gradient(
        circle,
        rgba(8,145,178,0.45) 0%,
        rgba(52,211,153,0.35) 35%,
        rgba(15,23,42,1) 80%
    );
    z-index: -1;
    filter: blur(40px);
}

/* ============================================================
   WELCOME BANNER + QUOTE
   ============================================================ */
.welcome-banner {
    position: absolute;
    top: 15px;
    left: 20px;
    font-size: 1.6rem;
    font-weight: 900;
    color: #34D399;
    text-shadow: 0 3px 6px rgba(0,0,0,0.3);
}

.quote-banner {
    position: absolute;
    top: 60px;
    left: 20px;
    font-size: 1rem;
    font-weight: 600;
    color: #0891B2;
    opacity: 0.9;
}

/* ============================================================
   BUTTON BASE STYLES
   ============================================================ */

/* MENU BUTTONS — SMALL (KS3 ONLY NOW) */
.menu-btn {
    background: #0891B2;
    color: #ECFEFF;
    border: 3px solid #0F172A;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.25s ease;
    box-shadow: 4px 4px 0 #0F172A;

    width: 100% !important;
    padding: 10px !important;
    font-size: 0.85rem !important;
}

/* QUIZ BUTTONS — LARGE */
.quiz-btn {
    background: #0891B2;
    color: #ECFEFF;
    border: 3px solid #0F172A;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.25s ease;
    box-shadow: 4px 4px 0 #0F172A;

    padding: 20px;
    font-size: 1.4rem;
    min-height: 90px;
}

/* EXAM BUTTONS — LARGE */
.exam-answer-btn {
    background: #0891B2;
    color: #ECFEFF;
    border: 3px solid #0F172A;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.25s ease;
    box-shadow: 4px 4px 0 #0F172A;

    min-height: 90px;
    padding: 18px;
    font-size: 1.3rem;
}

/* MATCHING GAME BOXES */
.match-box {
    background: #0891B2;
    color: #ECFEFF;
    border: 3px solid #0F172A;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.25s ease;
    box-shadow: 4px 4px 0 #0F172A;

    min-height: 80px;
}

/* OTHER BUTTONS */
.back-btn,
.quit-btn-top,
.reveal-btn,
#matchRevealBtn {
    background: #0891B2;
    color: #ECFEFF;
    border: 3px solid #0F172A;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.25s ease;
    box-shadow: 4px 4px 0 #0F172A;
}

.menu-btn:hover,
.quiz-btn:hover,
.exam-answer-btn:hover,
.match-box:hover,
.back-btn:hover,
.quit-btn-top:hover,
.reveal-btn:hover,
#matchRevealBtn:hover {
    background: #34D399;
    color: #0F172A;
    box-shadow: 6px 6px 0 #0F172A;
    transform: translate(-2px, -2px);
}

.menu-btn:active,
.quiz-btn:active,
.exam-answer-btn:active,
.match-box:active,
.back-btn:active,
.quit-btn-top:active,
.reveal-btn:active,
#matchRevealBtn:active {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0 #0F172A;
}

/* ============================================================
   MAIN MENU
   ============================================================ */
.menu-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.menu-title {
    font-size: 3.8rem;
    font-weight: 900;
    color: #ECFEFF;
    text-shadow: 0 4px 10px rgba(0,0,0,0.4);
    margin-top: 120px;
}

.menu-subtitle {
    font-size: 1.4rem;
    color: #34D399;
    margin-bottom: 20px;
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    width: 100%;
    margin-top: 20px;
}

/* ============================================================
   KS3 TOPIC BUTTON GRID
   ============================================================ */
#ks3Screen {
    padding: 20px !important;
}

#ks3Screen .button-row {
    display: grid !important;
    grid-template-columns: repeat(5, 1fr) !important;
    gap: 10px !important;
    width: 100% !important;
}

#ks3Screen .menu-btn {
    width: 100% !important;
    padding: 10px !important;
    font-size: 0.85rem !important;
    border-radius: 6px !important;
    margin: 0 !important;
}

/* ============================================================
   TOP BAR
   ============================================================ */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #0891B2;
    color: #ECFEFF;
    padding: 10px 18px;
    margin-bottom: 10px;
    border-radius: 8px;
    font-size: 1.2rem;
    border: 3px solid #0F172A;
    box-shadow: 4px 4px 0 #0F172A;
}

.quit-btn-top {
    background: #d9534f;
    padding: 10px 22px;
    font-size: 1.2rem;
}

/* ============================================================
   QUESTION BOX
   ============================================================ */
.question-box,
#questionText {
    background: #ECFEFF;
    color: #0F172A;
    padding: 20px;
    font-size: 1.6rem;
    font-weight: 700;
    text-align: center;
    border-radius: 8px;
    border: 3px solid #0F172A;
    box-shadow: 4px 4px 0 #0F172A;
    margin-bottom: 10px;
}

/* ============================================================
   UNIVERSAL QUIZ BUTTON STYLE
   ============================================================ */
.quiz-btn {
    padding: 20px;
    font-size: 1.4rem;
    min-height: 90px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* ============================================================
   BINARY QUIZ — 4×3 GRID
   ============================================================ */
#gameScreen .quiz-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    width: 95%;
    margin: 0 auto;
    padding-bottom: 10px;
}

/* ============================================================
   THEORY QUIZ — 3×3 GRID
   ============================================================ */
#theoryQuizScreen .quiz-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    width: 95%;
    margin: 0 auto;
    padding-bottom: 10px;
}

/* ============================================================
   MATCHING GAME GRID
   ============================================================ */
.match-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    width: 95%;
    margin: 0 auto;
    padding-bottom: 10px;
}

.match-box {
    font-size: 1.2rem;
    padding: 10px;
    min-height: 80px;
    user-select: none;
}

/* ============================================================
   REVEAL BUTTON (MATCHING GAME)
   ============================================================ */
.reveal-btn,
#matchRevealBtn {
    width: 100%;
    padding: 15px;
    margin-top: 20px;
    font-size: 1.2rem;
}

/* ============================================================
   EXAM MODE — 4 BUTTONS FIT PERFECTLY
   ============================================================ */
#quizContainer {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
}

.exam-grid {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    width: 90%;
    margin: 0 auto;
    padding-bottom: 10px;
}

.exam-answer-btn {
    min-height: 90px;
    padding: 18px;
    font-size: 1.3rem;
}

/* ============================================================
   POPUP OVERLAY + BOX
   ============================================================ */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15,23,42,0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999;
}

.popup-box {
    background: #ECFEFF;
    padding: 30px;
    width: 80%;
    max-width: 450px;
    border-radius: 12px;
    border: 3px solid #0F172A;
    box-shadow: 6px 6px 0 #0F172A;
    text-align: center;
}

.popup-buttons {
    margin-top: 25px;
    display: flex;
    justify-content: space-between;
}

.popup-buttons button {
    width: 48%;
}

/* ============================================================
   LOGOUT BUTTON
   ============================================================ */
.logout-btn {
    position: absolute;
    top: 15px;
    right: 25px;
    background-color: #d9534f;
    color: white;
    border: 3px solid #0F172A;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: 4px 4px 0 #0F172A;
}

.logout-btn:hover {
    background-color: #ff6b6b;
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 #0F172A;
}

/* ============================================================
   LEADERBOARD PAGE
   ============================================================ */
h1#leaderboardTitle {
    text-align: center;
    background: #0891B2;
    color: #ECFEFF;
    padding: 18px 0;
    margin: 0;
    font-size: 2.2rem;
    letter-spacing: 1px;
    border-bottom: 3px solid #0F172A;
    box-shadow: 0 4px 0 #0F172A;
}

.leaderboard-container {
    display: flex;
    justify-content: space-around;
    align-items: flex-start;
    flex-wrap: wrap;
    padding: 30px;
    gap: 30px;
    width: 100%;
}

.mode-box {
    background: #ffffff;
    border-radius: 12px;
    border: 3px solid #0F172A;
    box-shadow: 6px 6px 0 rgba(15,23,42,0.8);
    width: 30%;
    min-width: 320px;
    padding: 25px;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.mode-box:hover {
    transform: translate(-4px, -4px);
    box-shadow: 8px 8px 0 rgba(15,23,42,0.9);
}

.mode-box h2 {
    color: #0891B2;
    border-bottom: 3px solid #34D399;
    padding-bottom: 6px;
    margin-bottom: 12px;
    font-size: 1.4rem;
    font-weight: 900;
}

.section-title {
    font-weight: bold;
    color: #0F172A;
    margin-top: 12px;
    font-size: 1.1rem;
}

.entry {
    background: #34D399;              /* consistent mint green */
    color: #0F172A;                   /* dark readable text */
    border-radius: 8px;
    border: 2px solid #0F172A;
    padding: 10px 14px;               /* a bit more breathing room */
    margin: 8px 0;
    font-size: 1rem;
    font-weight: 600;
    box-shadow: 4px 4px 0 #0F172A;
    transition: all 0.25s ease;
    display: flex;                    /* keeps text aligned */
    align-items: center;
    justify-content: flex-start;
    min-height: 45px;                 /* prevents clipping */
    overflow: visible;                /* ensures text never hides */
    word-wrap: break-word;            /* wraps long text */
    white-space: normal;              /* allows multi-line text */
}

.entry:hover {
    background: #7dd3fc;
    color: #0F172A;
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 #0F172A;
}

.entry:nth-child(odd) {
    background: #6ee7b7;
}

.no-data {
    color: #888;
    font-style: italic;
}

/* ============================================================
   LANGUAGE SELECTOR
   ============================================================ */
.language-selector {
  position: absolute;
  top: 15px;
  right: 110px;
}

.language-selector select {
  background: #0891B2;
  color: #ECFEFF;
  border: 3px solid #0F172A;
  border-radius: 6px;
  padding: 6px 10px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 4px 4px 0 #0F172A;
  transition: all 0.25s ease;
}

.language-selector select:hover {
  background: #34D399;
  color: #0F172A;
  box-shadow: 6px 6px 0 #0F172A;
  transform: translate(-2px, -2px);
}

/* ============================================================
   BACK BUTTON
   ============================================================ */
.back-btn {
    position: absolute;
    top: 15px;
    left: 20px;
    background-color: #0891B2;
    color: white;
    border: 3px solid #0F172A;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    font-weight: 700;
    box-shadow: 4px 4px 0 #0F172A;
    transition: all 0.25s ease;
    z-index: 1000;
}

.back-btn:hover {
    background-color: #34D399;
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 #0F172A;
}

.back-btn:active {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0 #0F172A;
}

.menu-btn.locked {
  background-color: #0a6b84; /* darker shade */
  cursor: not-allowed;
  opacity: 0.6;
}

/* ============================================================
   join session button 
   ============================================================ */

/* ✅ Popup overlay */
.popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.7); /* dark transparent backdrop */
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 999;
}

/* ✅ Popup box */
.popup-box {
  background: #e0faff;
  border-radius: 12px;
  padding: 30px 40px;          /* more internal space */
  box-shadow: 6px 6px 0 #0F172A;
  text-align: center;
}

/* ✅ Heading */
.popup-box h2 {
  margin-bottom: 20px;         /* space below title */
  font-size: 1.6rem;
  font-weight: 800;
  color: #0F172A;
}

/* ✅ Input field */
.code-input {
  width: 80%;
  padding: 10px;
  margin-bottom: 18px;         /* space below input */
  border: 2px solid #0F172A;
  border-radius: 6px;
  font-size: 1rem;
}

/* ✅ Join button */
.menu-btn {
  background: #0891B2;
  color: #ECFEFF;
  font-weight: 700;
  border: 2px solid #0F172A;
  border-radius: 6px;
  padding: 10px 20px;
  margin-bottom: 12px;         /* space between Join and Cancel */
  box-shadow: 4px 4px 0 #0F172A;
  cursor: pointer;
}

/* ✅ Cancel button */
.menu-back-btn {
  background: #fff;
  color: #0F172A;
  border: 2px solid #0F172A;
  border-radius: 6px;
  padding: 8px 16px;
  font-weight: 600;
  cursor: pointer;
}




/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
    .mode-box {
        width: 90%;
    }
}





