:root {
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html {
  min-height: 100%;
  font-size: 16px;
  overflow-x: hidden;
}

body {
  min-width: 0;
  min-height: 100%;
  margin: 0;
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
  padding-bottom: var(--safe-bottom);
  overflow-x: hidden;
}

main {
  min-width: 0;
}

h1, h2, h3, h4, h5, h6,
p, a, span, dd, dt, code, .alert, .navbar-text {
  overflow-wrap: anywhere;
  word-break: normal;
}

img, svg, video, canvas {
  max-width: 100%;
  height: auto;
}

.skip-link {
  position: fixed;
  z-index: 1100;
  top: .5rem;
  left: .5rem;
  padding: .75rem 1rem;
  background: #fff;
  color: #000;
  border-radius: .25rem;
}

.btn,
.nav-link,
.navbar-toggler,
.form-check-label {
  min-height: 44px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: normal;
}

.navbar-toggler {
  min-width: 44px;
}

.navbar .nav-link {
  display: flex;
  align-items: center;
  padding-top: .65rem;
  padding-bottom: .65rem;
}

.nav-logout .btn {
  width: 100%;
}

.btn:focus-visible,
.nav-link:focus-visible,
.form-control:focus,
.form-check-input:focus,
.copy-button:focus-visible {
  outline: 3px solid #0d6efd;
  outline-offset: 2px;
  box-shadow: none;
}

.form-control,
.form-select {
  min-height: 44px;
  font-size: 16px;
}

textarea.form-control {
  min-height: 14rem;
  line-height: 1.7;
  resize: vertical;
}

.form-check {
  min-height: 44px;
  padding-top: .55rem;
  padding-bottom: .45rem;
}

.form-check-input {
  width: 1.25rem;
  height: 1.25rem;
}

.form-check-label {
  display: inline-flex;
  align-items: center;
  padding-left: .25rem;
}

.validation-summary-valid,
.field-validation-valid {
  display: none;
}

.validation-summary-errors,
.field-validation-error {
  display: block;
}

.post-content {
  white-space: pre-wrap;
  line-height: 1.9;
}

.post-preview {
  display: -webkit-box;
  overflow: hidden;
  white-space: pre-line;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.post-image {
  width: 100%;
  max-height: 520px;
  object-fit: contain;
  background: #fff;
}

.action-bar,
.account-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  align-items: stretch;
}

.account-actions form {
  display: flex;
}

.qr-code {
  display: block;
  width: min(240px, 100%);
  height: auto;
  margin-inline: auto;
}

.secret-value,
.recovery-code {
  display: block;
  max-width: 100%;
  padding: .75rem;
  overflow-wrap: anywhere;
  word-break: break-all;
  white-space: normal;
}

.copy-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .5rem;
  align-items: stretch;
}

.image-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(140px, 100%), 1fr));
  gap: .75rem;
}

.image-preview-card {
  min-width: 0;
  padding: .5rem;
  background: #fff;
  border: 1px solid #ced4da;
  border-radius: .375rem;
}

.image-preview-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;
}

.image-file-name {
  margin-top: .5rem;
  font-size: .875rem;
  overflow-wrap: anywhere;
}

.sticky-submit {
  padding-bottom: max(1rem, var(--safe-bottom));
}

.error-page {
  max-width: 38rem;
  padding: 2rem 0;
}

.overflow-wrap-anywhere {
  overflow-wrap: anywhere;
}

.table-responsive {
  max-width: 100%;
}

@media (max-width: 575.98px) {
  .navbar-collapse {
    padding-top: .5rem;
  }

  .card-body {
    padding: 1rem;
  }

  .display-4 {
    font-size: 2.5rem;
  }

  .action-bar,
  .account-actions,
  .sticky-submit {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .action-bar .btn,
  .account-actions .btn,
  .account-actions form,
  .account-actions form .btn,
  .sticky-submit .btn {
    width: 100%;
  }
}

@media (orientation: landscape) and (max-height: 500px) {
  .navbar {
    margin-bottom: 1rem !important;
  }

  textarea.form-control {
    min-height: 8rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
  }
}

.rich-text-editor { max-width: 100%; }
.rich-text-toolbar { display: flex; flex-wrap: wrap; gap: .2rem; border-radius: .375rem .375rem 0 0; }
.rich-text-toolbar .ql-formats { margin-right: .35rem !important; }
.rich-text-toolbar button, .rich-text-toolbar .ql-picker-label { min-width: 44px; min-height: 44px; }
.rich-text-surface { min-height: 20rem; background: #fff; font-size: 1rem; overflow-wrap: anywhere; }
.rich-text-surface img, .article-content img {
  display: block; max-width: 100%; height: auto; margin: 1rem auto;
}
.article-content { overflow-wrap: anywhere; word-break: break-word; line-height: 1.75; }
.article-content blockquote {
  border-left: .3rem solid #adb5bd; padding: .5rem 1rem; color: #495057; background: #f8f9fa;
}
.article-content a { overflow-wrap: anywhere; }
.legacy-plain-text { white-space: pre-wrap; }
.post-thumbnail { width: 100%; max-height: 16rem; object-fit: cover; }

@media (max-width: 575.98px) {
  .rich-text-surface { min-height: 16rem; }
  .ql-toolbar.ql-snow { padding: .35rem; }
  .ql-toolbar.ql-snow .ql-formats { margin-right: .1rem; }
}
