/* ===== 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;
}

/* ===== Gauge (scoreMe) — fixed gradient with a marker that slides to the user's position ===== */
.gauge {
  position: relative;
  width: 100%;
  max-width: 500px;
  margin: 2rem auto 0.5rem;
}

.gauge-bar {
  position: relative;
  height: 45px;
  background: linear-gradient(
    to right,
    #006400 0%,
    #43a047 35%,
    #ffc107 60%,
    #e65100 80%,
    #b71c1c 100%
  );
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.25);
  overflow: hidden;
}

.gauge-fill {
  position: absolute;
  top: 50%;
  left: 0;
  width: 0%;
  height: 6px;
  background: #000;
  transform: translateY(-50%);
  transition: width 2.7s ease-out;
  box-shadow: 0 0 4px rgba(0,0,0,0.5);
}

.gauge-marker {
  position: absolute;
  top: -6px;
  left: 0;
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 14px solid #1a1a2e;
  transform: translateX(-50%);
  transition: left 2.7s ease-out;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.4));
}

.gauge-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 0.4rem;
  font-size: 0.85rem;
  color: #666;
}

/* ===== Persistent safety notice on results screen ===== */
.safety-notice {
  max-width: 500px;
  margin: 0 auto;
  padding: 0 1.25rem;
  background-color: #fff8e1;
  border: 0 solid #f0b400;
  border-left-width: 0;
  border-radius: 6px;
  color: #222;
  font-size: 1rem;
  line-height: 1.5;
  text-align: left;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition:
    max-height 0.8s ease-out,
    opacity 0.8s ease-out,
    margin 0.8s ease-out,
    padding 0.8s ease-out,
    border-width 0.8s ease-out;
}

.safety-notice.visible {
  max-height: 400px;
  opacity: 1;
  margin: 1.2rem auto;
  padding: 1rem 1.25rem;
  border-width: 2px;
  border-left-width: 6px;
}

/* ===== 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; }
}
