/* In-app User guide (#107) — wide TOC overlay */
.user-guide-modal {
  max-width: min(920px, 100%);
  width: 100%;
  max-height: min(92vh, 900px);
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: linear-gradient(165deg, #f8fafc 0%, #eef2ff 42%, #fff 100%);
  border: 1px solid rgba(26, 35, 126, 0.12);
}

.user-guide-modal .pl-safety-hd {
  margin: 0;
  padding: 14px 16px 12px;
  border-bottom: 1px solid rgba(26, 35, 126, 0.1);
  background: linear-gradient(90deg, rgba(26, 35, 126, 0.08), rgba(255, 193, 7, 0.12));
  flex-shrink: 0;
}

.user-guide-hero {
  padding: 0 16px 12px;
  flex-shrink: 0;
}

.user-guide-hero-kicker {
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--primary, #1a237e);
}

.user-guide-hero p {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-muted, #64748b);
}

.user-guide-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 0;
  min-height: 0;
  flex: 1;
  overflow: hidden;
}

.user-guide-toc {
  overflow-y: auto;
  padding: 10px 8px 16px 10px;
  border-right: 1px solid rgba(26, 35, 126, 0.1);
  background: rgba(255, 255, 255, 0.55);
  position: sticky;
  top: 0;
  align-self: stretch;
}

.user-guide-toc-label {
  margin: 0 8px 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted, #64748b);
}

.user-guide-toc a {
  display: block;
  padding: 7px 10px;
  margin-bottom: 2px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text, #1e293b);
  text-decoration: none;
}

.user-guide-toc a:hover {
  background: rgba(26, 35, 126, 0.08);
  color: var(--primary, #1a237e);
}

.user-guide-toc a.is-active {
  background: rgba(26, 35, 126, 0.12);
  color: var(--primary, #1a237e);
  box-shadow: inset 3px 0 0 var(--primary, #1a237e);
}

.user-guide-body {
  overflow-y: auto;
  padding: 12px 16px 24px;
  scroll-behavior: smooth;
}

.ug-section {
  margin: 0 0 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(26, 35, 126, 0.08);
  scroll-margin-top: 8px;
}

.ug-section:last-child {
  border-bottom: 0;
  margin-bottom: 0;
}

.ug-section h3 {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 700;
  color: var(--primary, #1a237e);
}

.ug-section > .ug-lead {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text, #1e293b);
}

.ug-steps {
  margin: 0 0 12px;
  padding-left: 0;
  list-style: none;
  counter-reset: ug-step;
}

.ug-steps li {
  position: relative;
  margin: 0 0 8px;
  padding: 10px 12px 10px 42px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(26, 35, 126, 0.1);
  font-size: 13px;
  line-height: 1.4;
  counter-increment: ug-step;
}

.ug-steps li::before {
  content: counter(ug-step);
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(145deg, #1a237e, #3949ab);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 24px;
  text-align: center;
}

.ug-tip {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: linear-gradient(90deg, rgba(255, 193, 7, 0.18), rgba(255, 193, 7, 0.06));
  border: 1px solid rgba(255, 193, 7, 0.35);
  font-size: 12px;
  line-height: 1.4;
  color: var(--text, #1e293b);
}

.ug-tip strong {
  color: #b45309;
}

.ug-figure {
  margin: 0 0 12px;
  padding: 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(26, 35, 126, 0.1);
}

.ug-figure img {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  object-position: top;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.ug-figure figcaption {
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-muted, #64748b);
  line-height: 1.35;
}

/* CSS mini chrome mocks */
.ug-mock {
  margin: 0 0 12px;
  padding: 12px;
  border-radius: 12px;
  background: linear-gradient(160deg, #e8eaf6, #fff 55%);
  border: 1px solid rgba(26, 35, 126, 0.12);
}

.ug-mock-chrome {
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(26, 35, 126, 0.15);
  background: #fff;
  box-shadow: 0 6px 18px rgba(26, 35, 126, 0.08);
}

.ug-mock-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: linear-gradient(90deg, #1a237e, #283593);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.ug-mock-bar .ug-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.45);
}

.ug-mock-bar .ug-dot.on {
  background: #ffc107;
}

.ug-mock-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid #eef2f7;
  font-size: 12px;
}

.ug-mock-row:last-child {
  border-bottom: 0;
}

.ug-mock-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(145deg, #3949ab, #1a237e);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ug-mock-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  background: rgba(26, 35, 126, 0.1);
  color: #1a237e;
}

.ug-mock-pill.gold {
  background: rgba(255, 193, 7, 0.25);
  color: #92400e;
}

.ug-mock-tabs {
  display: flex;
  gap: 4px;
  padding: 8px 10px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  overflow-x: auto;
}

.ug-mock-tab {
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
  color: #64748b;
  background: transparent;
}

.ug-mock-tab.on {
  background: #1a237e;
  color: #fff;
}

.ug-mock-caption {
  margin: 8px 0 0;
  font-size: 11px;
  color: var(--text-muted, #64748b);
  line-height: 1.35;
}

.ug-ring-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 12px;
}

.ug-ring {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 4px solid #ffc107;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #fff;
  font-weight: 800;
  color: #1a237e;
  font-size: 14px;
  line-height: 1.1;
}

.ug-ring span {
  font-size: 9px;
  font-weight: 600;
  color: #64748b;
}

.ug-ring.singles {
  border-color: #7c4dff;
}

.user-guide-footer {
  flex-shrink: 0;
  padding: 10px 16px 14px;
  border-top: 1px solid rgba(26, 35, 126, 0.1);
  display: flex;
  justify-content: flex-end;
  background: rgba(255, 255, 255, 0.85);
}

@media (max-width: 820px) {
  .user-guide-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .user-guide-toc {
    display: flex;
    flex-wrap: nowrap;
    gap: 4px;
    overflow-x: auto;
    overflow-y: hidden;
    border-right: 0;
    border-bottom: 1px solid rgba(26, 35, 126, 0.1);
    padding: 8px 10px;
    position: relative;
    -webkit-overflow-scrolling: touch;
  }

  .user-guide-toc-label {
    display: none;
  }

  .user-guide-toc a {
    flex: 0 0 auto;
    margin: 0;
    white-space: nowrap;
    font-size: 11px;
    padding: 6px 10px;
  }

  .user-guide-toc a.is-active {
    box-shadow: none;
  }

  .user-guide-modal {
    max-height: min(96vh, 100%);
  }

  #user-guide-overlay.pl-safety-overlay {
    padding: 8px;
    align-items: stretch;
  }
}

@media (max-width: 420px) {
  .user-guide-body {
    padding: 10px 12px 20px;
  }

  .ug-section h3 {
    font-size: 15px;
  }

  .ug-figure img {
    max-height: 160px;
  }
}
