/* ===== Grid Container ===== */
#wrapper {
  display: grid;
  grid-template-columns: repeat(4, 5rem);
  grid-template-rows: repeat(4, 5rem);
  gap: 0.3rem;
  background-color: #000;
  width: 22.6rem;
  margin: 1rem auto;
  padding: 0.5rem;
  border: 3px solid navy;
  border-radius: 8px;
}

/* ===== Grid Cells ===== */
#wrapper div {
  font: 2rem sans-serif;
  color: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  user-select: none;
  border-radius: 4px;
  transition: border 0.15s;
}

/* ===== Color Classes ===== */
.rd { background-color: red; }
.gr { background-color: green; }
.bl { background-color: dodgerblue; }
.or { background-color: darkorange; }

/* ===== Selected (white rim) ===== */
.rim {
  border: 7px solid #fff !important;
}

/* ===== Answer feedback — blink boxes the user missed or wrongly picked ===== */
@keyframes blink-missed {
  0%, 100% { box-shadow: 0 0 0 0 #0f0, inset 0 0 0 0 #0f0; }
  50%      { box-shadow: 0 0 14px 4px #0f0, inset 0 0 10px 2px rgba(0,255,0,0.6); }
}
@keyframes blink-extra {
  0%, 100% { box-shadow: 0 0 0 0 #ffffe0, inset 0 0 0 0 #ffffe0; }
  50%      { box-shadow: 0 0 14px 4px #ffffe0, inset 0 0 10px 2px rgba(255,255,224,0.7); }
}
#wrapper div.missed {
  animation: blink-missed 0.8s ease-in-out infinite;
  border: 7px solid #0f0 !important;
}
#wrapper div.extra {
  animation: blink-extra 0.8s ease-in-out infinite;
  border: 7px solid lightyellow !important;
}

/* ===== Layout ===== */
#container {
  position: relative;
  max-width: 600px;
  margin: 0 auto;
  text-align: center;
}

#q-id-badge {
  position: absolute;
  top: 0;
  right: 0;
  font-size: 0.8rem;
  font-weight: bold;
  color: #888;
  background: #f0f0f0;
  padding: 0;
  border-radius: 4px;
  display: none;
}

#control {
  margin-bottom: 1rem;
}

.instructions {
  min-height: 4rem;
  padding: 0.8rem;
  font-size: 1.2rem;
  line-height: 1.6;
}

#result {
  min-height: 2rem;
  padding: 0.5rem;
  font-size: 1.1rem;
}

#buttons {
  margin-top: 1rem;
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  align-items: center;
}

/* ===== Progress Bar (scoreMe) ===== */
.progress-container {
  width: 100%;
  max-width: 500px;
  margin: 2rem auto;
  background: #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
  height: 40px;
}

.progress-bar {
  height: 100%;
  width: 0%;
  transition: width 1.5s ease-out;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: #fff;
  font-size: 1.2rem;
}

.progress-green { background: linear-gradient(90deg, darkgreen, forestgreen); }
.progress-yellow { background: linear-gradient(90deg, forestgreen, #cc0); }
.progress-red { background: linear-gradient(90deg, orange, red); }

/* ===== Result summary table ===== */
.score-summary {
  max-width: 500px;
  margin: 1.5rem auto;
}

.score-summary table {
  width: 100%;
}

/* ===== Banner ===== */
.banner {
  background: #1a1a2e;
  color: #fff;
  padding: 0.8rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.banner nav a {
  color: #aaa;
  margin-left: 1rem;
  text-decoration: none;
}

.banner nav a:hover {
  color: #fff;
}

/* ===== Helpers ===== */
.hotred { color: red; }
.text-success { color: green; }
.text-danger { color: red; }
.hidden { display: none; }

.showMe { display: none; }

.timer-display {
  font-size: 0.95rem;
  color: #666;
  margin-top: 0.3rem;
}

/* ===== Responsive ===== */
@media (max-width: 767px) {
  .banner { display: none; }
  #container { padding: 0.5rem; }
  #wrapper {
    grid-template-columns: repeat(4, 4rem);
    grid-template-rows: repeat(4, 4rem);
    width: 18.6rem;
  }
  #wrapper div { font-size: 1.5rem; }
}
