/* Add this to the top of your styles.css file to override the overflow hidden rule */

/* Ensure body can scroll by default */
body {
  overflow: auto !important;
  min-height: 100vh;
  max-width: 100%;
  margin: 0 auto;
  font-family: 'Baskerville';
  background-color: #f2e0b3;
  transition: background-color 1s ease;
}

/* Only hide overflow when specifically in a fullscreen game container */
body.game-active .game-container,
body.vowel-game-active #vowelGameContainer {
  overflow-y: auto; /* Allow scrolling within the game container itself */
}

/* Remove the global overflow hidden rule and make it more specific */
body.game-active.fullscreen-game,
body.vowel-game-active.fullscreen-game {
  overflow: hidden;
}

html {
  font-size: 100%;
  -webkit-text-size-adjust: none;
  -ms-text-size-adjust: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  max-width: 100%;
  margin: 0 auto;
  font-family: 'Baskerville';
  background-color: #f2e0b3;
  transition: background-color 1s ease;
}

/* Hide page elements when game is active */
body.game-active .navbar,
body.game-active nav,
body.game-active .content:not(.game-container),
body.game-active .filterPanel,
body.game-active header,
body.game-active footer {
  display: none;
}

/* Full screen game container */
body.game-active {
  overflow: hidden;
}

.game-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: #f2e0b3;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 20px;
  box-sizing: border-box;
  overflow-y: auto;
}

/* External Fonts for Syriac Characters */
@font-face {
  font-family: 'Serto Antioch Bible';
  src: url(melthofonts/SertoAntochBible_2020_Release.ttf);
  font-display: block;
}

@font-face {
  font-family: 'Estrangela Edessa';
  src: url(melthofonts/melthofonts-1.21/SyrCOMEdessa.otf);
  font-display: block;
}

@font-face {
  font-family: 'East Syrian Abiabene';
  src: url(melthofonts/melthofonts-1.21/SyrCOMAdiabene.otf);
  font-display: block;
}

/* navigation bar */
nav div.editNavBar {
  padding: 1% 2%;
}

li.editNavItem {
  margin: 0% 4%;
}

/* content */
.content {
  padding: 4% 4%;
}

/* filter panel */
.filterPanel {
  padding: 2% 2%;
  margin: 0.5% 0%;
  background-color: rgba(251, 243, 233, 0.472);
  border-style: solid;
  border-color: rgb(191, 132, 50);
  border-radius: 8px;
}

/* buttons */
.button {
  padding: 0.5% 1%;
  margin: 1% 0%;
  transition-duration: 0.2s;
  color: rgb(255, 255, 255);
  background-color: rgb(225, 172, 97);
  border-style: solid;
  border-color: rgb(191, 132, 50);
  border-width: 2px;
  border-radius: 8px;
  text-decoration: none;
}

.button:hover {
  color: rgb(191, 132, 50);
  background-color: rgba(255, 255, 255, 0.657);
}

#start-game-btn {
  padding: 0.5% 1%;
  margin: 1% 0%;
  transition-duration: 0.2s;
  color: rgb(255, 255, 255);
  background-color: rgb(255, 172, 97);
  border: 1px solid #ccc;
  border-color: rgb(191, 132, 50);
  border-radius: 14px;
  text-decoration: none;
  font-size: 1.3rem;
  font-family: 'Baskerville';
  text-align: center;
  cursor: pointer;
  word-spacing: 0.1rem;
  width: 200px;
}

#start-game-btn:hover {
  color: rgb(191, 132, 50);
  background-color: rgba(255, 255, 255, 0.657);
}

.button-dropdown-container {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.game-mode-dropdown {
  font-family: 'Baskerville';
  text-align: center;
  font-size: 1.3rem;
  word-spacing: 0.1rem;
  width: 250px;
  height: 50px;
  display: inline-block;
  padding: 0.5% 1%;
  margin: 1% 0%;
  transition-duration: 0.2s;
  color: rgb(225, 172, 97);
  border: 1px solid #ccc;
  border-color: rgb(191, 132, 50);
  border-width: 2px;
  border-radius: 8px;
  border-style: solid;
  background-color: #f9f9f9;
  cursor: pointer;
  text-decoration: none;
}

.time-input-container {
    display: flex;
    align-items: center;
    height: 50px;
    gap: 8px;
}

#timePerQuestion {
    width: 80px;
    height: 100%;
    padding: 0 8px;
    font-family: 'Baskerville';
    font-size: 1.3rem;
    color: rgb(191, 132, 50);
    background-color: #fff;
    border: 2px solid rgb(191, 132, 50);
    border-radius: 8px;
    outline: none;
    transition: all 0.3s ease;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#timePerQuestion:focus {
    border-color: rgb(225, 172, 97);
    box-shadow: 0 0 0 3px rgba(225, 172, 97, 0.2);
    background-color: #fefefe;
}

#timePerQuestion:hover {
    border-color: rgb(200, 150, 75);
    background-color: #fafafa;
}

/* Custom number input styling */
#timePerQuestion::-webkit-outer-spin-button,
#timePerQuestion::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

#timePerQuestion[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* Custom spin buttons */
.time-input-wrapper {
    position: relative;
    display: inline-block;
}

.time-input-wrapper::after {
    content: '';
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-bottom: 6px solid rgb(191, 132, 50);
    pointer-events: none;
    opacity: 0.6;
}

.time-unit {
    font-size: 1.3rem;
    font-family: 'Baskerville';
    color: rgb(191, 132, 50);
    font-weight: 500;
    margin-left: 5px;
    user-select: none;
}

/* Override width for time input wrapper */
#time-input-wrapper {
    width: auto !important;
    max-width: 150px !important;
    min-width: 100px !important;
}

#generate-worksheet-btn,
#start-game-submit-btn {
    height: 50px;
}

select option:disabled {
  color: gray;
}

.disabled-message {
  color: red;
  font-size: 1.5rem;
  margin-left: 10px;
}

/* image buttons */
.imgButton {
  background-color: white;
  color: black;
  border-radius: 8px;
}

.imgButton:hover {
  background-color: rgba(255, 255, 255, 0.78);
  color: rgb(0, 72, 255);
}

/* answer boxes */
.answerBox {
  padding: 0.5% 1%;
  margin: 0% 2%;
  text-align: center;
  border-style: solid;
  border-color: #f0f0f0;
}

/* number-of-questions slider */
.rangeslider,
.rangeslider__fill {
  display: block;
  border-radius: 50px;
}

.rangeslider {
  background: white;
  position: relative;
}

.rangeslider--horizontal {
  height: 5px;
  width: 100%;
}

.rangeslider__fill {
  background: white;
  position: absolute;
}

.rangeslider--horizontal .rangeslider__fill {
  top: 0;
  height: 100%;
}

.rangeslider__handle {
  background: rgb(192, 136, 58);
  color: #ffffff;
  cursor: pointer;
  display: inline-block;
  width: 2em;
  height: 2em;
  position: absolute;
  border-radius: 22px;
  line-height: 2.2em;
  text-align: center;
}

.rangeslider--horizontal .rangeslider__handle {
  top: -15px;
  touch-action: pan-y;
  -ms-touch-action: pan-y;
}

input[type="range"]:focus+.rangeslider .rangeslider__handle {
  box-shadow: 0 0 8px rgba(255, 0, 255, 0.9);
}

/* Progress Tracker */
.progress {
  height: 100%;
  background-color: white;
}

.progress-bar {
  background-color: rgb(141, 255, 125);
  color: black;
}

/* PDF container */
.card {
  box-sizing: border-box;
  width: 7.5in;
  padding: 0in 0in;
  margin: 0% 0%;
  border-radius: 0px;
  border-width: 0;
  font-family: 'Times New Roman', Times, serif;
}

.worksheetHeader {
  padding: 0% 0% 16pt 0%;
  margin: 0% 0%;
  font-size: 16pt;
}

.worksheetNormal {
  padding: 0% 0% 12pt 0%;
  margin: 0% 0%;
  font-size: 12pt;
  font-family: 'Times New Roman', Times, serif;
}

/* --- GAME STYLES START HERE --- */

.score {
  font-family: monospace;
  text-align: center;
  font-size: 2rem;
  font-weight: bold;
  letter-spacing: 0.25rem;
  margin-top: 1rem;
  position: relative;
  transition: opacity 0.2s;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  opacity: 0;
}

#offset {
  position: absolute;
  left: 54%;
  margin-left: -94px;
  opacity: 0;
  transition: opacity 0.5s, transform 0.5s;
}

#offset.offset-entrance {
  opacity: 1;
  transform: translateY(2rem);
}

#play-again-btn {
  position: absolute;
  bottom: 2rem;
  right: 8rem;
  font-size: 1rem;
  font-weight: bold;
  color: rgb(255, 255, 255);
  background-color: rgb(255, 172, 97);
  border: 5px double #fff;
  border-radius: 14px;
  padding: 8px 10px;
  outline: none;
  letter-spacing: .05em;
  cursor: pointer;
  display: none;
  opacity: 0;
  transition: opacity 0.5s, transform 0.5s, background-color 0.2s;
}

#play-again-btn:hover {
  background-color: #333;
}

#play-again-btn.play-again-btn-entrance {
  opacity: 1;
  transform: translateX(6rem);
}

.end-game-message {
  font-family: monospace;
  text-align: center;
  font-size: 1.5rem;
  letter-spacing: 0.05rem;
  margin-top: 1.5rem;
  position: relative;
  transition: opacity 0.5s;
}

.matching-pairs {
  transition: opacity 0.5s;
}

/* --- DRAGGABLE ITEM STYLES --- */

/* 1. Default style for the container (works for Tense mode) */
.draggable-items {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  gap: 50px; /* A good default gap for long words */
  padding: 10px;
  margin: 1rem 0;
  overflow-x: auto;
  transition: opacity 0.5s;
  color: black;
}

/* 2. Default style for the items themselves */
.draggable-items .draggable {
  margin: 0; /* CRITICAL: Override the old margin */
  padding: 0.4rem 0.8rem; /* Use padding to create size, not fixed width/height */
  font-size: 1.8rem;
  font-weight: bold;
  white-space: nowrap;
  cursor: move;
  transition: opacity 0.2s;
}

.draggable-items .draggable:hover {
  opacity: 0.5;
}

/* 3. PGN Mode Specific Overrides */

/* This rule ONLY applies when the container has the 'mode-pgn' class */
.draggable-items.mode-pgn {
  gap: 6px; /* No gap for PGN mode */
  padding: 0;
}

/* These styles ONLY apply to draggable items inside a PGN container */
.draggable-items.mode-pgn .draggable {
  font-size: 1.6rem;
  padding: 1.1rem 1.1rem;
}

/* --- UNMODIFIED STYLES BELOW --- */

.matching-pair {
  height: 6rem;
  width: 22rem;
  margin: 1rem auto;
  display: flex;
  justify-content: space-between;
}

.matching-pair span {
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  user-select: none;
}

.label {
  width: 15rem;
  font-size: 5rem;
  display: flex;
  align-items: center;
}

.droppable-container {
  display: flex;
  justify-content: center;
}

.droppable {
  min-width: 150px;
  font-size: 1.8rem; 
  font-weight: bold;
  padding: 0.4rem 0.5rem; 
  white-space: nowrap;
  background-color: #fff;
  border: 3px dashed #111;
  transition: 0.2s;
  display: flex;
  justify-content: center
}

.droppable-hover {
  background-color: #bee3f0;
  transform: scale(1.1);
}

.dropped {
  border-style: solid;
}

.dragged {
  user-select: none;
  opacity: 1;
}

@media (max-width: 600px) {
  html {
    font-size: 14px;
  }

  #play-again-btn {
    top: -0.4rem;
  }

  #play-again-btn.play-again-btn-entrance {
    transform: translateX(7rem);
  }
}

/* Toggle Switch Styles for Vocalization Checkbox */
.vocalization-container {
  display: flex;
  align-items: center;
  gap: 15px;
  margin: 1.5rem 0;
  padding: 15px;
  background-color: rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  border: 1px solid rgba(191, 132, 50, 0.3);
}

.vocalization-container p {
  margin: 0;
  font-weight: 500;
}

.switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 34px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.3s;
  border-radius: 34px;
  border: 2px solid rgb(191, 132, 50);
}

.slider:before {
  position: absolute;
  content: "";
  height: 26px;
  width: 26px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

input:checked + .slider {
  background-color: rgb(225, 172, 97);
}

input:focus + .slider {
  box-shadow: 0 0 1px rgb(225, 172, 97);
}

input:checked + .slider:before {
  transform: translateX(26px);
  background-color: white;
}

.slider:hover {
  background-color: #b8b8b8;
}

input:checked + .slider:hover {
  background-color: rgb(200, 150, 75);
}

/* Animation for switch state changes */
.slider, .slider:before {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#vocalization-status {
  font-size: 1.2rem;
  color: rgb(101, 67, 33);
  font-weight: 500;
  min-width: 100px;
}

/* Game Stats - Simple layout */
.game-stats {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 1001;
}

.game-stats span {
  color: black;
  font-size: 1.5rem;
  font-weight: bold;
  font-family: 'Baskerville';
  margin-left: 20px;
}

/* For game container */
.game-container .game-stats {
  position: fixed;
  top: 20px;
  right: 20px;
}

/* For matching game container */
#matchingGameContainer .game-stats {
  position: absolute;
  top: 20px;
  right: 20px;
}