html,
body {
  height: 100%;
}

.qr-shell {
  width: 100%;
  max-width: 1120px;
  margin-inline: auto;
  padding-inline: 1rem;
}

.qr-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  flex: 0 0 auto;
  height: 56px;
}

.qr-topbar .qr-shell {
  height: 100%;
}

@media (min-width: 992px) {
  body {
    overflow: hidden;
  }

  .qr-app {
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
  }

  .qr-main {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }

  .qr-intro {
    flex: 0 0 auto;
  }

  .qr-columns {
    flex: 1 1 auto;
    min-height: 0;
  }

  .qr-col {
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
  }

  .qr-footer {
    flex: 0 0 auto;
  }

  .qr-preview-sticky {
    top: 0;
  }
}

.qr-lang-switch-label {
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1;
  color: var(--bs-secondary-color, #6c757d);
  user-select: none;
}

.qr-lang-switch-label.is-active {
  font-weight: 700;
  color: var(--bs-body-color, #212529);
}

.qr-brand-tagline {
  white-space: nowrap;
}

@media (max-width: 420px) {
  .qr-brand-tagline {
    display: none;
  }
}

.qr-brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: var(--bs-border-radius, 0.5rem);
  background: var(--bs-primary, #0d6efd);
  color: #fff;
  flex: 0 0 auto;
}

.qr-tab-list {
  flex-wrap: wrap;
  height: auto !important;
  width: 100% !important;
}

@media (max-width: 575.98px) {
  .qr-tab-list {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .qr-tab-list > * {
    flex-shrink: 0;
  }
}

/* Notification prompt: a compact card on wide screens that never dims or blocks the form. */
@media (min-width: 768px) {
  .bu-pwa-overlay {
    background: transparent;
    inset: auto 1rem 1rem auto;
    pointer-events: none;
    width: 26rem;
  }

  .bu-pwa-panel {
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius-lg, 0.5rem);
    pointer-events: auto;
    position: static;
  }
}

.qr-preview-sticky {
  position: sticky;
  top: 5.5rem;
}

.qr-preview-body {
  padding: 0.5rem !important;
  gap: 0.5rem;
}

.qr-preview-frame {
  width: 100%;
  max-width: 320px;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--bs-border-color, #dee2e6);
  border-radius: var(--bs-border-radius-lg, 0.75rem);
  padding: 0.25rem;
  background: repeating-conic-gradient(var(--bs-tertiary-bg, #f8f9fa) 0% 25%, transparent 0% 50%) 50% / 16px 16px;
}

.qr-preview-frame svg {
  width: 100%;
  height: 100%;
  display: block;
}

.qr-color-input {
  width: 2.5rem;
  height: 2.375rem;
  padding: 0.2rem;
  border: 1px solid var(--bs-border-color, #dee2e6);
  border-radius: var(--bs-border-radius, 0.5rem);
  background: none;
  flex: 0 0 auto;
}

@media (max-width: 991.98px) {
  .qr-preview-sticky {
    position: static;
  }
}

/* Desktop fixed-viewport mode: shrink the preview column with the available
   height (vh-based) so it fits without scrolling in the common case; if it
   still doesn't fit (very short viewport + long form), .qr-preview-body
   becomes the one scrollable region instead of the whole page or the card
   visually overflowing its own border. */
@media (min-width: 992px) {
  .qr-col-right {
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .qr-preview-sticky {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1 1 auto;
  }

  .qr-preview-card {
    min-height: 0;
    display: flex;
    flex-direction: column;
  }

  .qr-preview-body {
    min-height: 0;
    flex: 1 1 auto;
    justify-content: flex-start;
    overflow-y: auto;
    gap: clamp(0.3rem, 1vh, 0.6rem);
    padding: clamp(0.4rem, 1.2vh, 0.85rem) !important;
  }

  .qr-preview-frame {
    width: clamp(140px, 28vh, 320px);
    padding: clamp(0.15rem, 0.5vh, 0.4rem);
    flex: 0 0 auto;
    margin-inline: auto;
  }

  .qr-preview-note {
    flex: 0 0 auto;
    margin-top: clamp(0.4rem, 1.2vh, 0.75rem);
  }
}

/* Mobile shortcut to the QR output, which sits below the long form. */
.qr-jump {
  border-radius: 999px;
  bottom: 1rem;
  box-shadow: 0 0.25rem 0.75rem rgb(0 0 0 / 0.2);
  position: fixed;
  right: 1rem;
  z-index: 15;
}
