/**
 * Page help modal — included on all app layout pages (see app.php).
 * Scoped to [data-page-help-modal]; linked after page-specific stylesheets so
 * viewport sheets (desktop/tablet/mobile) and other .modal__dialog rules do not win.
 */

[data-page-help-modal].page-help-modal {
  padding: 24px;
}

[data-page-help-modal] .page-help-modal__overlay {
  background: rgba(26, 24, 21, 0.45);
}

[data-page-help-modal] .page-help-modal__dialog {
  width: min(560px, 100%);
  max-width: min(560px, 100%);
  max-height: 88vh;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18), 0 4px 16px rgba(0, 0, 0, 0.08);
}

[data-page-help-modal] .page-help-modal__header {
  position: relative;
  padding: 20px 22px 16px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.07);
  flex-shrink: 0;
}

[data-page-help-modal] .page-help-modal__eyebrow {
  margin: 0 0 5px;
  color: #c49510;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

[data-page-help-modal] .page-help-modal__title {
  margin: 0;
  padding-right: 36px;
  color: #1a1815;
  font-family: 'Sora', sans-serif;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.025em;
}

[data-page-help-modal] .page-help-modal__close {
  position: absolute;
  top: 18px;
  right: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 8px;
  background: #edeae3;
  color: #9a9188;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

[data-page-help-modal] .page-help-modal__close:hover {
  background: #e5e1d8;
  color: #6b6458;
}

[data-page-help-modal] .page-help-modal__close svg {
  width: 12px;
  height: 12px;
}

[data-page-help-modal] .page-help-modal__body {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 24px 22px;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1 1 auto;
  min-block-size: 0;
  -webkit-overflow-scrolling: touch;
}

[data-page-help-modal] .page-help-modal__body::-webkit-scrollbar {
  width: 4px;
}

[data-page-help-modal] .page-help-modal__body::-webkit-scrollbar-thumb {
  background: #e5e1d8;
  border-radius: 2px;
}

[data-page-help-modal] .page-help-modal__section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

[data-page-help-modal] .page-help-modal__section-title {
  margin: 0;
  color: #1a1815;
  font-size: 14px;
  font-weight: 600;
}

[data-page-help-modal] .page-help-modal__section-copy {
  margin: 0;
  color: #6b6458;
  font-size: 13.5px;
  font-weight: 300;
  line-height: 1.7;
}

[data-page-help-modal] .page-help-modal__list {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin: 0;
  padding: 0 0 0 2px;
  list-style: none;
}

[data-page-help-modal] .page-help-modal__list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: #6b6458;
  font-size: 13.5px;
  font-weight: 300;
  line-height: 1.65;
}

[data-page-help-modal] .page-help-modal__list li::before {
  content: '';
  width: 5px;
  height: 5px;
  margin-top: 8px;
  border-radius: 999px;
  background: #c49510;
  flex-shrink: 0;
}

[data-page-help-modal] .page-help-modal__list strong,
[data-page-help-modal] .page-help-modal__section-copy strong,
[data-page-help-modal] .page-help-modal__tip-copy strong {
  color: #3d3a34;
  font-weight: 600;
}

[data-page-help-modal] .page-help-modal__divider {
  height: 1px;
  background: rgba(0, 0, 0, 0.07);
}

[data-page-help-modal] .page-help-modal__tip {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 16px;
  border: 1px solid rgba(196, 149, 16, 0.22);
  border-radius: 10px;
  background: rgba(196, 149, 16, 0.08);
}

[data-page-help-modal] .page-help-modal__tip svg {
  width: 14px;
  height: 14px;
  margin-top: 1px;
  color: #c49510;
  flex-shrink: 0;
}

[data-page-help-modal] .page-help-modal__tip-copy {
  margin: 0;
  color: #6b6458;
  font-size: 13px;
  font-weight: 300;
  line-height: 1.6;
}

[data-page-help-modal] .page-help-modal__footer {
  display: flex;
  justify-content: flex-end;
  padding: 14px 22px;
  border-top: 1px solid rgba(0, 0, 0, 0.07);
  flex-shrink: 0;
}

[data-page-help-modal] .page-help-modal__footer-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 22px;
  border: 1px solid rgba(0, 0, 0, 0.11);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  color: #6b6458;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

[data-page-help-modal] .page-help-modal__footer-btn:hover {
  background: #f2efe9;
  color: #3d3a34;
}

/* Dark theme */
html[data-theme="dark"] [data-page-help-modal] .page-help-modal__overlay {
  background: rgba(2, 6, 23, 0.65);
}

html[data-theme="dark"] [data-page-help-modal] .page-help-modal__dialog {
  background: var(--card);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45), 0 4px 16px rgba(0, 0, 0, 0.25);
}

html[data-theme="dark"] [data-page-help-modal] .page-help-modal__header {
  border-bottom-color: rgba(148, 163, 184, 0.22);
}

html[data-theme="dark"] [data-page-help-modal] .page-help-modal__title,
html[data-theme="dark"] [data-page-help-modal] .page-help-modal__section-title {
  color: var(--text);
}

html[data-theme="dark"] [data-page-help-modal] .page-help-modal__section-copy,
html[data-theme="dark"] [data-page-help-modal] .page-help-modal__list li,
html[data-theme="dark"] [data-page-help-modal] .page-help-modal__tip-copy {
  color: var(--text-muted);
}

html[data-theme="dark"] [data-page-help-modal] .page-help-modal__list strong,
html[data-theme="dark"] [data-page-help-modal] .page-help-modal__section-copy strong,
html[data-theme="dark"] [data-page-help-modal] .page-help-modal__tip-copy strong {
  color: var(--text);
}

html[data-theme="dark"] [data-page-help-modal] .page-help-modal__close {
  background: rgba(30, 41, 59, 0.85);
  color: rgba(148, 163, 184, 0.95);
}

html[data-theme="dark"] [data-page-help-modal] .page-help-modal__close:hover {
  background: rgba(51, 65, 85, 0.95);
  color: var(--text);
}

html[data-theme="dark"] [data-page-help-modal] .page-help-modal__body::-webkit-scrollbar-thumb {
  background: rgba(71, 85, 105, 0.65);
}

html[data-theme="dark"] [data-page-help-modal] .page-help-modal__divider {
  background: rgba(148, 163, 184, 0.18);
}

html[data-theme="dark"] [data-page-help-modal] .page-help-modal__tip {
  background: rgba(196, 149, 16, 0.1);
  border-color: rgba(196, 149, 16, 0.35);
}

html[data-theme="dark"] [data-page-help-modal] .page-help-modal__footer {
  border-top-color: rgba(148, 163, 184, 0.22);
}

html[data-theme="dark"] [data-page-help-modal] .page-help-modal__footer-btn {
  background: rgba(30, 41, 59, 0.55);
  border-color: rgba(148, 163, 184, 0.28);
  color: var(--text);
  box-shadow: none;
}

html[data-theme="dark"] [data-page-help-modal] .page-help-modal__footer-btn:hover {
  background: rgba(51, 65, 85, 0.75);
  color: var(--text);
}

@media (max-width: 900px) {
  [data-page-help-modal] .page-help-modal__header {
    padding: 16px 18px 14px;
  }

  [data-page-help-modal] .page-help-modal__title {
    font-size: 17px;
    padding-right: 34px;
  }

  /* Close button — 44px touch target */
  [data-page-help-modal] .page-help-modal__close {
    width: 44px;
    height: 44px;
    top: 10px;
    right: 10px;
  }

  [data-page-help-modal] .page-help-modal__body {
    padding: 18px 18px;
    gap: 16px;
  }

  [data-page-help-modal] .page-help-modal__tip {
    padding: 12px 14px;
  }

  [data-page-help-modal] .page-help-modal__footer {
    padding: 12px 18px calc(12px + env(safe-area-inset-bottom, 0px));
  }

  /* Footer button — full width, 44px touch target */
  [data-page-help-modal] .page-help-modal__footer-btn {
    width: 100%;
    min-height: 44px;
    border-radius: 10px;
  }

}
