/* ── Instructions Widget ──────────────────────────────────────────
   Self-contained styles for the help modal. Drop this into any
   one‑page project alongside instructions-widget.js.
   ──────────────────────────────────────────────────────────────── */

/* Top‑right ? button */
#instructions-btn {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 1000;
  width: 36px;
  height: 36px;
  border: 2px solid rgba(0, 0, 0, 0.25);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  color: #333;
  font-family: 'Georgia', serif;
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, border-color 0.2s;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  touch-action: manipulation;
}

#instructions-btn:hover {
  background: #fff;
  border-color: rgba(0, 0, 0, 0.5);
}

/* Overlay (click‑to‑close backdrop) */
#instructions-overlay {
  position: fixed;
  inset: 0;
  z-index: 1999;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

#instructions-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

/* Modal card */
#instructions-modal {
  position: relative;
  max-width: 600px;
  width: 90vw;
  max-height: min(80vh, 90dvh);
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background: #fff;
  border-radius: 12px;
  padding: 32px 28px 28px;
  margin: 16px auto;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.25);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    Helvetica, Arial, sans-serif;
  color: #222;
  line-height: 1.6;
}

/* Close button */
#instructions-close {
  position: sticky;
  top: 0;
  float: right;
  background: none;
  border: none;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  color: #888;
  padding: 0 0 0 8px;
  transition: color 0.15s;
}

#instructions-close:hover {
  color: #222;
}

/* Prevent body scrolling while modal is open */
body.instructions-open {
  overflow: hidden;
}

/* ── Markdown rendered content ─────────────────────────────────── */

#instructions-content {
  /* Ensure last lines aren't hidden behind the scroll edge */
  padding-bottom: 8px;
}

#instructions-content h1,
#instructions-content h2,
#instructions-content h3 {
  margin-top: 1.2em;
  margin-bottom: 0.4em;
  line-height: 1.3;
}

#instructions-content h1 { font-size: 1.6em; }
#instructions-content h2 { font-size: 1.3em; }
#instructions-content h3 { font-size: 1.1em; }

#instructions-content p {
  margin: 0.6em 0;
}

#instructions-content img {
  max-width: 100%;
  border-radius: 6px;
  margin: 0.8em 0;
}

#instructions-content a {
  color: #1a73e8;
  text-decoration: underline;
}

#instructions-content a:hover {
  color: #1557b0;
}

#instructions-content strong {
  font-weight: 600;
}

#instructions-content ul,
#instructions-content ol {
  padding-left: 1.5em;
  margin: 0.6em 0;
}

#instructions-content li {
  margin: 0.3em 0;
}

#instructions-content hr {
  border: none;
  border-top: 1px solid #ddd;
  margin: 1.2em 0;
}

#instructions-content code {
  background: #f4f4f4;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
}

#instructions-content pre {
  background: #f4f4f4;
  padding: 12px;
  border-radius: 6px;
  overflow-x: auto;
}

#instructions-content blockquote {
  border-left: 4px solid #ddd;
  margin: 0.8em 0;
  padding-left: 16px;
  color: #555;
}
