/*
 * General styles for the Room 8 Learn website.
 * The palette uses soft colours to create a welcoming learning environment.
 */

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: #333;
  background: #f7f7f7;
  line-height: 1.5;
}

.site-header {
  background: #00695c;
  color: #fff;
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-header h1 {
  margin: 0;
  font-size: 1.5rem;
}

.main-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 1rem;
}

.main-nav a {
  color: #fff;
  text-decoration: none;
  font-weight: bold;
}

.main-nav a:hover {
  text-decoration: underline;
}

.hero {
  position: relative;
  background-size: cover;
  background-position: center;
  height: 45vh;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.hero .overlay {
  background: rgba(0, 0, 0, 0.45);
  padding: 2rem;
  border-radius: 8px;
  text-align: center;
  max-width: 80%;
}

.hero h2 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.hero p {
  font-size: 1rem;
  margin: 0;
}

.features {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  padding: 2rem;
  max-width: 1200px;
  margin: auto;
}

.features article {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  flex: 1 1 300px;
  padding: 1.5rem;
}

.features h3 {
  margin-top: 0;
  color: #00695c;
}

.btn {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.5rem 1rem;
  background: #00897b;
  color: #fff;
  border-radius: 4px;
  text-decoration: none;
  font-weight: bold;
}

.btn:hover {
  background: #00695c;
}

.site-footer {
  background: #00695c;
  color: #fff;
  text-align: center;
  padding: 1rem;
}

/* Quiz pages */
.quiz-main {
  max-width: 800px;
  margin: 2rem auto;
  padding: 1rem;
}

.quiz-subjects {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1rem;
}

.quiz-subjects .btn {
  flex: 1 1 150px;
}

#quiz-section, #subject-selection, #quiz-summary {
  background: #fff;
  border-radius: 8px;
  padding: 1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  margin-top: 1rem;
}

#quiz-progress {
  font-weight: bold;
  margin-bottom: 0.5rem;
}

#quiz-question {
  font-size: 1.1rem;
  margin-top: 0.5rem;
}

#quiz-options {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.option-btn {
  width: 100%;
  text-align: left;
}

.quiz-explanation {
  margin-top: 0.75rem;
  padding: 0.5rem;
  border-left: 4px solid #00897b;
  background: #e0f2f1;
  white-space: pre-line;
}

/* Multi-question quiz styles for Year 5 */
.quiz-instruction {
  margin-bottom: 1rem;
  font-weight: bold;
}
.quiz-question-block {
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #e0e0e0;
}
.quiz-question-block p {
  margin: 0.25rem 0;
}
.quiz-multi-options {
  list-style: none;
  padding-left: 0;
}
.quiz-multi-options li {
  margin: 0.25rem 0;
}

/* Maths page styles */

.math-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 1rem;
}

.math-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}

.math-controls label {
  margin-right: 0.5rem;
}

/*
  Labeled progress grid for multiplication/division facts. It uses 13
  columns and rows: the first row and column are headers (1–12) and
  the rest are progress bars. The grid scales to the available width.
*/
.progress-grid-labeled {
  display: grid;
  grid-template-columns: repeat(13, 1fr);
  gap: 4px;
  margin-bottom: 1rem;
  align-items: center;
}

/* Header cells for row/column labels */
.header-cell {
  background: #f1f8e9;
  font-weight: 600;
  text-align: center;
  padding: 0.25rem;
  border-radius: 3px;
  font-size: 0.8rem;
  color: #33691e;
}

/* Top-left corner of progress grid */
.top-left {
  background: transparent;
}

.progress-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 4px;
  margin-bottom: 1rem;
}

.progress-cell {
  background: #e0e0e0;
  /* Increase the height of each progress cell bar to make progress more visible */
  height: 24px;
  position: relative;
  border-radius: 3px;
  overflow: hidden;
}

.progress-cell .bar {
  background: #00897b;
  height: 100%;
  width: 0%;
  transition: width 0.3s ease;
}

.progress-cell.mastered {
  background: #c8e6c9;
}

.progress-cell.mastered .bar {
  background: #2e7d32;
}

.question-card {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  padding: 1rem;
  text-align: center;
}

.question-card h2 {
  margin-top: 0;
  font-size: 1.5rem;
}

.question-card input[type="text"], .question-card input[type="number"] {
  font-size: 1.5rem;
  padding: 0.5rem;
  width: 100%;
  margin: 0.5rem 0;
  border: 1px solid #ccc;
  border-radius: 4px;
  text-align: center;
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  max-width: 300px;
  margin: 1rem auto;
}

.keypad button {
  padding: 1rem;
  font-size: 1.25rem;
  background: #eee;
  border: 1px solid #ccc;
  border-radius: 4px;
  cursor: pointer;
}

.keypad button:hover {
  background: #ddd;
}

.timer-bar {
  height: 10px;
  background: #e0e0e0;
  border-radius: 5px;
  overflow: hidden;
  margin-top: 1rem;
}

.timer-bar-inner {
  height: 100%;
  background: #d32f2f;
  width: 100%;
  transition: width linear;
}

.message {
  font-weight: bold;
  margin-top: 0.5rem;
}

/* Spelling page styles */

.spelling-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 1rem;
}

.week-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.week-list li {
  /* list items act as flex containers for week card buttons. They take up space
     but have no visual styling themselves. */
  flex: 1 1 250px;
  display: flex;
}


/* Style the week card buttons inside each list item */
/* Week cards are links styled like cards */
.week-card-link {
  display: block;
  width: 100%;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  padding: 1rem;
  text-align: left;
  color: inherit;
  text-decoration: none;
  transition: transform 0.2s;
}

.week-card-link:hover {
  transform: translateY(-3px);
}

/* Indicator showing a week is fully mastered. It appears as a small
   green checkmark in the top‑right corner of a week card. */
.week-card-link {
  position: relative;
}
.week-card-link .complete-indicator {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #c8e6c9;
  color: #2e7d32;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 0.9rem;
  pointer-events: none;
}

.week-list h4 {
  margin-top: 0;
  color: #00695c;
}

.word-list {
  margin-top: 1rem;
}

.word-item {
  margin-bottom: 1rem;
  padding: 0.75rem;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.word-item h5 {
  margin: 0 0 0.25rem;
  color: #00695c;
}

.examples {
  margin: 0.5rem 0 0;
  padding-left: 1.2rem;
}

.spelling-practice {
  margin-top: 2rem;
  background: #fff;
  padding: 1rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.spelling-practice input[type="text"] {
  width: 100%;
  padding: 0.5rem;
  font-size: 1.25rem;
  margin-top: 0.5rem;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.practice-controls {
  margin-top: 1rem;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.practice-controls button {
  padding: 0.5rem 1rem;
  background: #00897b;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.practice-controls button:hover {
  background: #00695c;
}

.practice-progress {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.practice-progress .word-progress {
  flex: 1 1 80px;
  background: #e0e0e0;
  border-radius: 3px;
  /* Increase height of progress bars for spelling to improve visibility */
  height: 20px;
  position: relative;
}

.practice-progress .word-progress .bar {
  height: 100%;
  background: #00897b;
  width: 0%;
  transition: width 0.3s ease;
}

.practice-progress .word-progress.mastered {
  background: #c8e6c9;
}

.practice-progress .word-progress.mastered .bar {
  background: #2e7d32;
}

@media (max-width: 600px) {
  .features {
    flex-direction: column;
  }
  .progress-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

/* Letters & Numbers game styles */
.selection-area {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  margin-top: 1.5rem;
}
.selection-group {
  flex: 1 1 300px;
  background: #fff;
  padding: 1rem;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.selection-group h3 {
  margin-top: 0;
  color: #00695c;
}
.number-buttons {
  /* Arrange number tiles in a fixed 2×5 grid for both large and small selections */
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.number-select {
  /* Buttons take full cell width in the grid layout. Remove flex sizing. */
  width: 100%;
  padding: 0.5rem;
  background: #e0e0e0;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  /* Use black text for better readability when numbers are revealed */
  color: #000;
}
/* When a tile is selected, keep the text black and bold for clarity. The
   background colour will be set inline for large and small tiles. */
.number-select.selected {
  color: #000;
  font-weight: bold;
}
.number-select:disabled {
  background: #f0f0f0;
  color: #aaa;
  cursor: default;
}

/* When a tile has been selected (and therefore disabled), ensure the
   text remains black for readability.  This overrides the default
   disabled colouring applied above. */
.number-select.selected:disabled {
  color: #000;
  font-weight: bold;
}
.game-area {
  margin-top: 2rem;
  background: #fff;
  padding: 1rem;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.selected-numbers {
  display: flex;
  gap: 0.5rem;
  margin: 1rem 0;
}
.selected-number {
  background: #00897b;
  color: #fff;
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  font-weight: bold;
}
.solution-display {
  margin-top: 1rem;
  padding: 0.75rem;
  background: #e0f2f1;
  border-left: 4px solid #00897b;
  border-radius: 4px;
  font-family: monospace;
  white-space: pre-wrap;
}

/* Advanced spellers grouping: each section holds 10 words. */
.advanced-section {
  margin-bottom: 2rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #e0e0e0;
}
.advanced-section h4 {
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  color: #00695c;
  font-size: 1.2rem;
}

/* Vocabulary matching exercise styles */
.match-container {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  margin-top: 1rem;
  gap: 2rem;
}

.match-column-left,
.match-column-right {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.match-item,
.match-target {
  padding: 0.5rem 0.75rem;
  border: 2px solid #555;
  border-radius: 20px;
  background-color: #f5f5f5;
  color: #333;
  display: flex;
  align-items: center;
  min-width: 180px;
  cursor: grab;
  user-select: none;
}

.match-item.dragging {
  opacity: 0.6;
}

.match-item .dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 0.5rem;
  /* default color will be overridden inline */
}

.match-lines-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.match-item.matched,
.match-target.matched {
  background-color: #c8e6c9;
  border-color: #2e7d32;
  color: #2e7d32;
}

.match-item.incorrect,
.match-target.incorrect {
  background-color: #ffcdd2;
  border-color: #d32f2f;
  color: #d32f2f;
}

/* Emphasise vocabulary and spelling words within example sentences.  Bold
   the <strong> elements and give them a dark green colour so they
   stand out clearly in the sentence. */
.word-item strong,
.word-item li strong {
  font-weight: bold;
  color: #00695c;
}