/* v3.1: loaded directly so fixes do not depend on Flarum's legacy LESS cache. */
.Post-body,
.Post-body > * {
  min-width: 0;
}

.Post-body {
  overflow-x: hidden;
}

.ForumGraphButton[hidden] {
  display: none !important;
}

.ForumGraphButton {
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, calc(env(safe-area-inset-bottom) + 16px));
  max-width: calc(100vw - 32px);
  min-height: 44px;
  padding: 10px 16px;
  white-space: nowrap;
}

.ForumGraphDialog-form {
  padding-bottom: 0;
}

.ForumGraphDialog-header p {
  max-width: 50ch;
  margin: 6px 0 0;
  color: #586779;
}

.ForumGraphDialog-date {
  max-width: 260px;
}

.ForumGraphDialog-grid {
  grid-template-columns: repeat(auto-fit, minmax(136px, 1fr));
}

.ForumGraphDialog-field span {
  color: #35465a;
}

.ForumGraphDialog-field input {
  box-sizing: border-box;
  min-height: 42px;
}

.ForumGraphDialog-summary {
  margin: 0;
  padding: 11px 13px;
  color: #334c6e;
  font-weight: 700;
  background: rgba(173, 201, 254, .22);
  border: 1px solid rgba(77, 105, 142, .18);
  border-radius: 9px;
}

.ForumGraphDialog-summary.has-error {
  color: #8d2f26;
  background: #fff0ee;
  border-color: #efb6af;
}

.ForumGraphDialog-actions {
  position: sticky;
  bottom: 0;
  z-index: 2;
  margin: 0 -22px;
  padding: 14px 22px max(14px, env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, .96);
  border-top: 1px solid rgba(77, 105, 142, .16);
  box-shadow: 0 -8px 18px rgba(35, 52, 74, .05);
}

.ForumGraphDialog-actions .Button {
  min-height: 44px;
}

.ForumStudyChartFigure {
  display: block;
  box-sizing: border-box;
  width: 100%;
  max-width: 680px;
  min-width: 0;
  margin: 18px 0;
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(77, 105, 142, .16);
  border-radius: 12px;
  box-shadow: 0 5px 18px rgba(35, 52, 74, .07);
}

.ForumStudyChart {
  display: block;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  height: clamp(320px, 58vw, 420px);
  min-height: 0;
  margin: 0;
  overflow: hidden;
  background: linear-gradient(
      90deg,
      transparent,
      rgba(173, 201, 254, .2),
      transparent
    ) #fff;
  border: 0;
  border-radius: 0;
}

.ForumStudyChartCaption {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  justify-content: space-between;
  padding: 10px 13px;
  color: #586779;
  font-size: 13px;
  background: #fafbfd;
  border-top: 1px solid rgba(77, 105, 142, .16);
}

.ForumStudyChartCaption a {
  font-weight: 600;
}

.ForumStudyChartFigure.has-error .ForumStudyChartCaption {
  color: #8d2f26;
  background: #fff0ee;
}

/* XREA injects a required banner before #app. Keep the fixed desktop header
   below that banner instead of covering most of it. */
@media (min-width: 768px) {
  #vdbanner + #app .App-header {
    position: absolute;
    top: 0;
  }
}

@media (max-width: 767px) {
  .ForumGraphButton {
    right: max(12px, env(safe-area-inset-right));
    bottom: max(12px, calc(env(safe-area-inset-bottom) + 12px));
  }

  .ForumGraphDialog {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
  }

  .ForumGraphDialog-form {
    gap: 14px;
    padding: 16px 16px 0;
  }

  .ForumGraphDialog-header {
    gap: 10px;
  }

  .ForumGraphDialog-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .ForumGraphDialog-actions {
    margin: 0 -16px;
    padding-right: 16px;
    padding-left: 16px;
  }

  .ForumGraphDialog-actions .Button {
    flex: 1 1 0;
  }

  .ForumStudyChart {
    height: clamp(390px, 125vw, 480px);
  }

  .ForumStudyChartCaption {
    display: grid;
  }
}

@media (max-width: 380px) {
  .ForumGraphDialog-grid {
    grid-template-columns: 1fr;
  }
}
