/* hover-overlay.css - styles for hover-overlay.js MicroSims.
 *
 * Used by board-explorer overlays built on an already-labeled pinout image
 * (for example cytron-robo-pico-overlay and cytron-maker-pi-rp2040-overlay).
 */
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  padding: 8px 10px;
  font-family: system-ui, -apple-system, Roboto, sans-serif;
  background: aliceblue;
  color: #1a1a1a;
}
/* Cap the width so the description stays close to the image on wide screens */
main { max-width: 900px; margin: 0 auto; }
#sim-title {
  font-size: 1.2rem;
  margin: 0 0 6px;
  color: #1d2b4f;
}

/* ── Image + hotspot layer ───────────────────────────────────────── */
#image-wrapper {
  position: relative;
  width: 100%;
  line-height: 0;
  background: #fff;
  border: 1px solid #cfd8e3;
  border-radius: 8px;
  overflow: hidden;
}
#board-img {
  width: 100%;
  height: auto;
  display: block;
  user-select: none;
  -webkit-user-select: none;
}
#hotspot-layer { position: absolute; inset: 0; }

.hotspot {
  position: absolute;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.12s, box-shadow 0.12s;
}
.hotspot:focus { outline: none; }
.hotspot:focus-visible { box-shadow: 0 0 0 3px #1389A6, 0 0 0 5px #fff; }

/* Every rectangle of the zone being described */
.hotspot.zone-lit {
  background: color-mix(in srgb, var(--zone-color) 20%, transparent);
  box-shadow: 0 0 0 2px var(--zone-color), 0 0 0 3.5px #fff;
}
/* The exact rectangle under the pointer */
.hotspot.zone-lit.rect-hot {
  background: color-mix(in srgb, var(--zone-color) 32%, transparent);
  box-shadow: 0 0 0 3px var(--zone-color), 0 0 0 5px #fff;
}
.hotspot.is-label.zone-lit { background: color-mix(in srgb, var(--zone-color) 12%, transparent); }

/* "Show hotspots" toggle - faint outline on every part */
.show-all .hotspot:not(.zone-lit):not(.zone-aim):not(.zone-right) {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.9);
  outline: 1.5px dashed var(--zone-color);
}

/* Quiz states */
.hotspot.zone-aim {
  background: rgba(19, 137, 166, 0.2);
  box-shadow: 0 0 0 2px #1389A6, 0 0 0 3.5px #fff;
}
.hotspot.zone-right {
  background: rgba(31, 168, 58, 0.3);
  box-shadow: 0 0 0 3px #1FA83A, 0 0 0 5px #fff;
}
.hotspot.zone-wrong {
  background: rgba(224, 38, 43, 0.3);
  box-shadow: 0 0 0 2px #E0262B, 0 0 0 3.5px #fff;
  animation: shake 0.4s;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}

#edit-box {
  display: none;
  position: absolute;
  border: 2px dashed #C45C2A;
  background: rgba(196, 92, 42, 0.15);
  pointer-events: none;
}

/* ── Controls ────────────────────────────────────────────────────── */
#controls {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin: 8px 0;
  font-size: 14px;
}
.mode-btn {
  padding: 4px 16px;
  border: 2px solid #b8c2cc;
  border-radius: 20px;
  background: #fff;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: #1a1a1a;
}
.mode-btn:hover { border-color: #1389A6; color: #1389A6; }
.mode-btn.active { background: #1389A6; border-color: #1389A6; color: #fff; }
#controls label { display: inline-flex; align-items: center; gap: 5px; margin-left: 6px; cursor: pointer; }
#quiz-score { margin-left: auto; color: #444; }

/* ── Info panel (below the drawing) ──────────────────────────────── */
#info-panel {
  background: #fff;
  border: 1px solid #cfd8e3;
  border-radius: 8px;
  padding: 10px 14px 12px;
  font-size: 14.5px;
  line-height: 1.45;
}
#info-prompt { padding: 2px 0; }
#prompt-text { margin: 0 0 10px; color: #555; font-style: italic; }
#part-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.part-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border: 1px solid #cfd8e3;
  border-radius: 14px;
  background: #f7f9fc;
  font-size: 13px;
  color: #1a1a1a;
  cursor: pointer;
}
.part-chip::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--zone-color);
}
.part-chip:hover, .part-chip:focus-visible {
  border-color: var(--zone-color);
  background: color-mix(in srgb, var(--zone-color) 12%, #fff);
}
#info-content { display: none; }
#info-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  border-left: 6px solid var(--zone-color, #1389A6);
  padding-left: 10px;
  margin-bottom: 6px;
}
#info-label { font-size: 1.15rem; margin: 0; color: #1a1a1a; }
#info-note {
  display: none;
  font-size: 13px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--zone-color, #1389A6) 14%, #fff);
  border: 1px solid color-mix(in srgb, var(--zone-color, #1389A6) 45%, #fff);
}
#info-body { display: grid; grid-template-columns: 1fr; gap: 4px 18px; }
#info-side { display: none; }
#info-content.has-table #info-side { display: block; }
@media (min-width: 700px) {
  #info-content.has-table #info-body { grid-template-columns: 1fr 1fr; }
}
#info-summary { margin: 0 0 4px; }
#info-facts { margin: 0 0 6px; padding-left: 20px; }
#info-facts li { margin-bottom: 2px; }
#info-tip {
  margin: 4px 0 0;
  padding: 6px 10px;
  background: #fff8e1;
  border-left: 4px solid #f5b400;
  border-radius: 4px;
}
#info-tip::before { content: "Tip: "; font-weight: 700; }
#info-side #info-tip { margin-top: 10px; }
#info-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
#info-table caption { text-align: left; font-weight: 700; padding-bottom: 4px; }
#info-table th, #info-table td { border: 1px solid #d9dee5; padding: 3px 7px; text-align: left; vertical-align: top; }
#info-table th { background: #eef2f7; }
#info-table td:first-child { white-space: nowrap; }

/* Quiz box */
#quiz-box { display: none; }
.quiz-q { font-size: 15.5px; font-weight: 600; }
.quiz-num {
  display: inline-block;
  margin-right: 8px;
  padding: 1px 8px;
  border-radius: 10px;
  background: #1389A6;
  color: #fff;
  font-size: 12.5px;
}
.quiz-hint { color: #666; font-size: 13.5px; margin: 4px 0; }
#quiz-feedback { margin-top: 6px; }
#quiz-feedback.right { color: #146b27; }
#quiz-feedback.wrong { color: #a51d21; }
#quiz-feedback .mode-btn { margin-left: 6px; }
.quiz-done { margin-bottom: 8px; font-size: 15.5px; }

/* Edit mode (?edit=true) */
#edit-panel { display: none; margin-top: 10px; font: 13px/1.4 monospace; }
#edit-panel textarea { width: 100%; height: 40px; font: inherit; }
