html.context-guide-open,
body.context-guide-open { max-width: 100%; overflow: hidden; }

.context-guide-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(5, 7, 10, 0.78);
  backdrop-filter: blur(5px);
}
.context-guide-backdrop[hidden] { display: none; }

.context-guide-dialog {
  width: min(760px, 100%);
  max-height: min(82vh, 780px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: #eef2f7;
  background: #171a21;
  border: 1px solid #2a3242;
  border-radius: 16px;
  box-shadow: 0 18px 52px rgba(0, 0, 0, 0.52);
}
.context-guide-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  background: #1d2230;
  border-bottom: 1px solid #2a3242;
}
.context-guide-header h2 {
  margin: 0;
  color: #eef2f7;
  font: 700 1.1rem/1.3 system-ui, sans-serif;
  text-transform: none;
  letter-spacing: 0;
}
.context-guide-close {
  flex: 0 0 auto;
  padding: 8px 14px;
  color: #111;
  background: #ffe58f;
  border: 0;
  border-radius: 999px;
  font: 700 0.9rem/1 system-ui, sans-serif;
  cursor: pointer;
}
.context-guide-close:focus-visible,
.context-guide-content:focus-visible {
  outline: 3px solid #7cc4ff;
  outline-offset: 2px;
}
.context-guide-content {
  overflow: auto;
  padding: 18px;
  overscroll-behavior: contain;
  font: 16px/1.6 system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}
.context-guide-content .pattern {
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}
.context-guide-content .pattern-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 10px;
}
.context-guide-content .pattern-name { display: none; }
.context-guide-content.group-guide-content .pattern-name {
  display: block;
  color: #ffe58f;
  font-size: 1.08rem;
  line-height: 1.35;
}
.context-guide-content.group-guide-content .pattern + .pattern {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid #2a3242;
}
.context-guide-content .meta { color: #b7c0cf; text-align: right; white-space: nowrap; }
.context-guide-content .badge {
  display: inline-block;
  margin: 4px 6px 0 0;
  padding: 4px 10px;
  color: #eef2f7;
  border: 1px solid #2a3242;
  border-radius: 999px;
  font-size: 0.86rem;
}
.context-guide-content .badge.high { background: rgba(88, 214, 141, 0.14); color: #c9f5da; }
.context-guide-content .badge.medium { background: rgba(244, 208, 63, 0.14); color: #fff1b5; }
.context-guide-content .badge.low { background: rgba(255, 143, 112, 0.14); color: #ffd2c4; }
.context-guide-content p { margin: 10px 0 14px; color: #eef2f7; }
.context-guide-content .examples { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 8px; }
.context-guide-content .word {
  display: inline-block;
  padding: 6px 10px;
  color: #eef2f7;
  background: #222938;
  border: 1px solid #2a3242;
  border-radius: 999px;
}
.context-guide-content mark {
  padding: 0.06em 0.22em;
  color: #111;
  background: #ffe58f;
  border-radius: 4px;
}
.context-guide-loading { color: #b7c0cf; }

@media (max-width: 600px) {
  .context-guide-backdrop { place-items: stretch; padding: 10px; }
  .context-guide-dialog { width: 100%; max-height: calc(100dvh - 20px); border-radius: 12px; }
  .context-guide-header { padding: 13px 14px; }
  .context-guide-content { padding: 15px; }
  .context-guide-content .pattern-header { flex-direction: column; gap: 8px; }
  .context-guide-content .meta { text-align: left; white-space: normal; }
  .context-guide-content .word { white-space: normal; }
}
