/* Page wrapper with test container */
.page-wrapper {
  display: flex;
  justify-content: center; /* center horizontally */
  padding: 20px;
  width: 100%;
  box-sizing: border-box;
  
}

/* Typing Test Container */
.test-container {
  width: 700px;
  min-height: 400px;        /* changed from fixed height */
  max-height: 90vh;         /* max height relative to viewport */
  background: #cccfcf;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  padding: 20px;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  overflow-y: auto;         /* allow vertical scroll if content overflows */
}

/* Header inside test container */
.header {
  text-align: center;
  margin-bottom: 10px;
  color: #130f0f;
  flex-shrink: 0;
}

.header h2 {
  font-size: 24px;
}

.header div {
  font-size: 16px;
}

/* Passage box styling */
.passage-box {
  background: #fff;
  color: #000;
  padding: 15px 20px;
  height: 150px;
  overflow-y: auto;
  margin-bottom: 10px;
  border-radius: 6px;
  flex-shrink: 0;
}

#passage {
  font-family: 'Poppins', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  font-weight: bold;
  text-align: justify;
  margin: 0;
  padding: 0;
}

/* Word highlighting */
.correct {
  color: #2e7d32;    /* Dark green */
}

.incorrect {
  color: #c62828;    /* Red */
}

.current {
  color: #0d47a1;    /* Blue */
  text-decoration: underline;
}

/* Stats bar */
.stats {
  background-color: #fabefa;
  color: #000;
  padding: 10px 15px;
  display: flex;
  justify-content: space-around;
  align-items: center;
  gap: 15px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  margin-top: 10px;
  font-size: 14px;
  flex-wrap: wrap;
  text-align: center;
  border-radius: 6px;
  flex-shrink: 0;
}

.stats p {
  margin: 0;
  font-weight: 500;
  flex: 1;
  min-width: 110px;
  background: #410853;
  color: #ece6e6;
  padding: 10px;
  border-radius: 4px;
  transition: background-color 0.3s, transform 0.3s;
}

.stats p:hover {
  background: #3a3a78;
  transform: scale(1.05);
}

/* Typing area */
#typingArea {
  width: 100%;
  height: 50px;
  font-size: 20px;
  padding: 10px;
  border-radius: 8px;
  resize: none;
  overflow: hidden;
  white-space: nowrap;
  border: 2px solid #ccc;
  outline-offset: 2px;
  transition: border-color 0.3s;
  flex-shrink: 0;
  margin-top: none;
  box-sizing: border-box;
}

#typingArea:focus {
  border-color: #0044cc;
}

/* Options checkboxes container */
.options {
  margin-top: 6px;
  display: flex;
  justify-content: left;
  font-size: 13px;
  color: #0a0909;
  gap: 20px; /* gap between options */
}

/* Control buttons container */
.controls {
  margin-top: auto; /* push to bottom */
  text-align: center;
  flex-shrink: 0;
  z-index: 1; /* keep buttons visible inside container */
}

.controls button {
  padding: 12px 24px;
  margin: 0 12px;
  font-size: 18px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  color: white;
  transition: background-color 0.3s;
}

#restartBtn {
  background-color: #1976d2;
}
#restartBtn:hover {
  background-color: #125ea9;
}

#endTestBtn {
  background-color: #d32f2f;
}
#endTestBtn:hover {
  background-color: #a02727;
}

/* Timer warning style */
#timeLeft.warning {
  color: red;
  font-weight: bold;
  animation: blink 1s step-start infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

/* Responsive */
@media (max-width: 1024px) {
  .page-wrapper {
    padding: 10px;
  }
  .test-container {
    width: 100%;
    height: auto;
  }
}
