/* ============================================
   QR SIGN MAKER
   Markup: include/qrSignMaker.php + include/qrSignGuide.php · Behaviour: include/qrsign.js · Drawing: include/qrsign-render.js
   Same studio layout as the seating chart: sticky preview on the left, panel on the right.
   On phones the preview and the tabs stick to the top and the controls scroll under them.
   ============================================ */

.qs {
  --qs-ink: #16131c;
  --qs-muted: #6b6775;
  --qs-faint: #9b97a3;
  --qs-line: #e8e6ec;
  --qs-line-strong: #d6d3dc;
  --qs-brand: #a21ce6;
  --qs-brand-ink: #7d12b3;
  --qs-brand-soft: rgba(162, 28, 230, 0.07);
  --qs-ok: #15803d;
  --qs-warn: #b45309;
  --qs-top: 104px;
  --qs-radius: 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 392px;
  grid-template-rows: auto 1fr;
  column-gap: 36px;
  align-items: start;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px 64px;
  color: var(--qs-ink);
}

.qs [hidden],
.qs-dl [hidden] {
  display: none !important;
}

.qs svg[viewBox="0 0 24 24"],
.qs-dl svg[viewBox="0 0 24 24"],
.qs-head svg[viewBox="0 0 24 24"],
.qs-cta svg[viewBox="0 0 24 24"] {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.qs button,
.qs input,
.qs textarea,
.qs-dl button,
.qs-dl input {
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}

.qs button:focus-visible,
.qs input:focus-visible,
.qs a:focus-visible,
.qs-dl button:focus-visible,
.qs-dl a:focus-visible,
.qsg button:focus-visible {
  outline: 2px solid var(--qs-brand);
  outline-offset: 2px;
}

.qs .qs-input:focus-visible,
.qs input[type="range"]:focus-visible,
.qs input[type="color"]:focus-visible {
  outline: none;
}

.qs-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ============================================
   PAGE HEADER
   ============================================ */
.qs-head {
  max-width: 1280px;
  margin: 0 auto;
  padding: 128px 24px 28px;
  color: #16131c;
}

.qs-head__brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  padding: 5px 12px 5px 8px;
  border: 1px solid rgba(162, 28, 230, 0.16);
  border-radius: 999px;
  background: rgba(162, 28, 230, 0.06);
  color: #6b7280;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.2;
}

.qs-head__brand b {
  color: #7d12b3;
  font-weight: 600;
}

.qs-head__brand svg[viewBox] {
  width: 18px;
  height: 18px;
  color: #a21ce6;
}

.qs-head__title {
  max-width: 22ch;
  margin: 0;
  font-size: clamp(2rem, 3.4vw, 2.875rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.035em;
  color: #16131c;
  text-wrap: balance;
}

.qs-head__text {
  max-width: 62ch;
  margin: 12px 0 0;
  font-size: 1.0625rem;
  line-height: 1.55;
  color: #6b7280;
  text-wrap: pretty;
}

/* ============================================
   STAGE (the preview)
   ============================================ */
.qs__stage {
  --qs-pad-x: 40px;
  --qs-pad-y: 76px;
  grid-column: 1;
  grid-row: 1 / span 2;
  position: sticky;
  top: var(--qs-top);
  height: calc(100vh - var(--qs-top) - 24px);
  height: calc(100svh - var(--qs-top) - 24px);
  min-height: 600px;
  max-height: 940px;
  border: 1px solid #ebe7e1;
  border-radius: 24px;
  background:
    radial-gradient(120% 80% at 50% 38%, #fbfaf8 0%, #f3f0eb 62%, #ece8e1 100%);
  overflow: hidden;
  isolation: isolate;
}

.qs__sheet {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 3px;
  background: #fff;
  box-shadow:
    0 0 0 1px rgba(28, 22, 12, 0.05),
    0 1px 2px rgba(28, 22, 12, 0.08),
    0 6px 14px -4px rgba(28, 22, 12, 0.12),
    0 26px 48px -18px rgba(28, 22, 12, 0.32);
  transition: box-shadow 0.2s ease;
}

.qs__sheet canvas {
  display: block;
  border-radius: 3px;
  cursor: zoom-in;
}

.qs__sheet.is-draggable canvas {
  cursor: grab;
  touch-action: none;
}

.qs__sheet.is-dragging canvas {
  cursor: grabbing;
}

.qs__stage.is-drop .qs__sheet {
  box-shadow: 0 0 0 3px var(--qs-brand), 0 26px 48px -18px rgba(28, 22, 12, 0.32);
}

/* First paint waits for the fonts: a soft shimmer instead of a fallback-font flash */
.qs__stage.is-loading .qs__sheet {
  width: 300px;
  height: 420px;
  background: linear-gradient(110deg, #f6f4f0 30%, #fdfcfa 50%, #f6f4f0 70%) 0 0 / 300% 100%;
  animation: qs-shimmer 1.4s linear infinite;
}

.qs__stage.is-loading canvas {
  opacity: 0;
}

@keyframes qs-shimmer {
  to {
    background-position: -150% 0;
  }
}

.qs__sample {
  position: absolute;
  z-index: 2;
  transform: translate(-50%, -50%);
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(22, 19, 28, 0.82);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  pointer-events: none;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.qs__bar {
  position: absolute;
  top: 14px;
  z-index: 3;
  display: flex;
  gap: 6px;
}

.qs__bar--start {
  inset-inline-start: 14px;
}

.qs__bar--end {
  inset-inline-end: 14px;
}

.qs-tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 40px;
  height: 40px;
  padding: 0 10px;
  border: 1px solid rgba(22, 19, 28, 0.08);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--qs-ink);
  box-shadow: 0 1px 2px rgba(22, 19, 28, 0.06);
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.qs-tool:hover:not(:disabled) {
  background: #fff;
  border-color: rgba(22, 19, 28, 0.16);
}

.qs-tool:disabled {
  opacity: 0.4;
  cursor: default;
}

.qs-tool--text {
  padding: 0 14px;
  font-size: 0.8125rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--qs-muted);
}

.qs__foot {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 14px;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.qs__download {
  padding: 11px 20px !important;
  font-size: 0.9375rem !important;
  border-radius: 12px !important;
}

.qs__download svg[viewBox] {
  width: 19px !important;
  height: 19px !important;
  stroke-width: 2 !important;
}

/* Scan status */
.qs-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  height: 40px;
  padding: 0 14px 0 12px;
  border: 1px solid rgba(22, 19, 28, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--qs-ink);
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(22, 19, 28, 0.06);
  cursor: pointer;
}

.qs-status > span:not(.qs-sr) {
  overflow: hidden;
  text-overflow: ellipsis;
}

.qs-status__dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--qs-faint);
  box-shadow: 0 0 0 3px rgba(155, 151, 163, 0.18);
}

.qs-status[data-state="ok"] .qs-status__dot {
  background: #16a34a;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.16);
}

.qs-status[data-state="warn"] {
  color: var(--qs-warn);
}

.qs-status[data-state="warn"] .qs-status__dot {
  background: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
}

/* "Add your link": a plain button, no status dot */
.qs-status[data-state="empty"] {
  padding: 0 16px;
  color: var(--qs-brand-ink);
}

.qs-status[data-state="empty"] .qs-status__dot {
  display: none;
}

.qs-status[data-state="checking"] .qs-status__dot {
  animation: qs-pulse 1s ease-in-out infinite;
}

@keyframes qs-pulse {
  50% {
    transform: scale(0.7);
    opacity: 0.6;
  }
}

.qs__toast {
  position: absolute;
  left: 50%;
  bottom: 70px;
  z-index: 6;
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  border-radius: 12px;
  background: var(--qs-ink);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.35;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
  transform: translate(-50%, 8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.qs__toast.is-on {
  opacity: 1;
  transform: translate(-50%, 0);
}

.qs.is-busy .qs__stage,
.qs.is-exporting .qs__stage {
  cursor: progress;
}

/* ============================================
   TABS
   ============================================ */
.qs-tabs {
  grid-column: 2;
  grid-row: 1;
  position: sticky;
  top: var(--qs-top);
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 2px;
  margin-bottom: 20px;
  padding: 4px;
  border: 1px solid var(--qs-line);
  border-radius: 16px;
  background: #f6f5f8;
  /* White skirt above: panel content scrolling up never shows between the site header and the tabs */
  box-shadow: 0 -32px 0 8px #fff, 0 0 0 8px #fff, 0 10px 18px -12px rgba(22, 19, 28, 0.18);
}

.qs-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  height: 54px;
  padding: 0 2px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--qs-muted);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.1;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.qs-tab span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qs-tab:hover {
  color: var(--qs-ink);
}

.qs-tab[aria-selected="true"] {
  background: #fff;
  color: var(--qs-brand-ink);
  box-shadow: 0 1px 2px rgba(22, 19, 28, 0.08), 0 0 0 1px rgba(22, 19, 28, 0.04);
}

/* ============================================
   PANEL
   ============================================ */
.qs__panel {
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
}

.qs-pane {
  animation: qs-in 0.18s ease;
}

@keyframes qs-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
}

.qs-group {
  padding-bottom: 22px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--qs-line);
}

.qs-pane > .qs-group:last-of-type {
  margin-bottom: 0;
  border-bottom: 0;
}

.qs-label {
  display: block;
  margin: 0 0 12px;
  font-size: 0.875rem;
  font-weight: 650;
  line-height: 1.3;
  color: var(--qs-ink);
}

.qs-sublabel {
  margin: 16px 0 8px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--qs-muted);
}

.qs-label + .qs-sublabel {
  margin-top: 0;
}

.qs-hint,
.qs-note {
  margin: 8px 0 0;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--qs-muted);
}

.qs-note:empty {
  display: none;
}

.qs-input {
  display: block;
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--qs-line-strong);
  border-radius: 12px;
  background: #fff;
  color: var(--qs-ink);
  font: 400 1rem/1.4 var(--font-sans);
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.qs-input::placeholder {
  color: #a9a5b0;
}

.qs-input:hover {
  border-color: #c4c0cb;
}

.qs-input:focus {
  outline: none;
  border-color: var(--qs-brand);
  box-shadow: 0 0 0 3px rgba(162, 28, 230, 0.13);
}

.qs-input--area {
  height: auto;
  min-height: 72px;
  padding: 11px 14px;
  resize: vertical;
}

/* ---------- Templates ---------- */
.qs-cats {
  display: flex;
  gap: 6px;
  margin: 0 -24px 16px;
  padding: 0 24px 2px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 24px, #000 calc(100% - 24px), transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 24px, #000 calc(100% - 24px), transparent 100%);
}

.qs-cats::-webkit-scrollbar {
  display: none;
}

.qs-cat {
  flex-shrink: 0;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--qs-line);
  border-radius: 999px;
  background: #fff;
  color: var(--qs-muted);
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.qs-cat:hover {
  border-color: var(--qs-line-strong);
  color: var(--qs-ink);
}

.qs-cat[aria-pressed="true"] {
  border-color: var(--qs-ink);
  background: var(--qs-ink);
  color: #fff;
}

.qs-tpls {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 18px 14px;
}

.qs-tpl {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--qs-ink);
  text-align: start;
  cursor: pointer;
}

.qs-tpl__img {
  position: relative;
  display: block;
  aspect-ratio: 5 / 7;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(22, 19, 28, 0.08), 0 4px 12px -6px rgba(22, 19, 28, 0.25);
  transition: box-shadow 0.18s ease, transform 0.18s ease;
}

.qs-tpl__img img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.qs-tpl:hover .qs-tpl__img {
  transform: translateY(-2px);
  box-shadow: 0 0 0 1px rgba(22, 19, 28, 0.12), 0 12px 22px -10px rgba(22, 19, 28, 0.35);
}

.qs-tpl[aria-pressed="true"] .qs-tpl__img {
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--qs-brand), 0 12px 22px -10px rgba(22, 19, 28, 0.3);
}

.qs-tpl__check {
  position: absolute;
  top: 8px;
  inset-inline-end: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--qs-brand);
  color: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.qs-tpl__check svg[viewBox] {
  width: 15px;
  height: 15px;
  stroke-width: 2.6;
}

.qs-tpl[aria-pressed="true"] .qs-tpl__check {
  opacity: 1;
  transform: none;
}

.qs-tpl__name {
  padding: 0 2px;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.25;
}

/* ---------- Link ---------- */
.qs-link__field {
  position: relative;
}

.qs-link__field > svg[viewBox] {
  position: absolute;
  top: 50%;
  left: 13px;
  width: 18px !important;
  height: 18px !important;
  color: var(--qs-faint);
  transform: translateY(-50%);
  pointer-events: none;
}

.qs-link__field .qs-input {
  height: 48px;
  padding-left: 40px;
  padding-right: 44px;
  font-size: 0.9375rem;
  text-overflow: ellipsis;
}

.qs-link__clear {
  position: absolute;
  top: 50%;
  right: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--qs-faint);
  transform: translateY(-50%);
  cursor: pointer;
}

.qs-link__clear:hover {
  background: #f3f2f5;
  color: var(--qs-ink);
}

.qs-link__clear svg[viewBox] {
  width: 16px;
  height: 16px;
}

.qs-link__note {
  padding: 9px 12px;
  border-radius: 10px;
  background: #f4f3f6;
  color: var(--qs-ink);
  font-weight: 500;
}

.qs-link__note[data-state="ok"] {
  background: #edf8f1;
  color: var(--qs-ok);
}

.qs-link__note[data-state="warn"] {
  background: #fdf5e7;
  color: var(--qs-warn);
}

.qs-get-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  color: var(--qs-brand-ink);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
}

.qs-get-link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.qs-get-link svg[viewBox] {
  width: 16px !important;
  height: 16px !important;
  stroke-width: 2 !important;
}

/* ---------- Text fields ---------- */
.qs-field + .qs-field {
  margin-top: 18px;
}

.qs-field__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.qs-field__head .qs-label {
  margin: 0;
  font-weight: 600;
}

.qs-field.is-off .qs-input,
.qs-field.is-off .qs-steps {
  opacity: 0.45;
}

.qs-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.qs-steps__item {
  position: relative;
  display: block;
}

.qs-steps__item span {
  position: absolute;
  top: 50%;
  inset-inline-start: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border: 1.5px solid var(--qs-line-strong);
  border-radius: 50%;
  color: var(--qs-muted);
  font-size: 0.6875rem;
  font-weight: 700;
  transform: translateY(-50%);
  pointer-events: none;
}

.qs-steps__item .qs-input {
  padding: 0 8px 0 37px;
  font-size: 0.9375rem;
}

/* Switch */
.qs-switch {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
  width: 38px;
  height: 22px;
  cursor: pointer;
}

.qs-switch input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.qs-switch span {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: #d9d6de;
  transition: background-color 0.18s ease;
  pointer-events: none;
}

.qs-switch span::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.18s ease;
}

.qs-switch input:checked + span {
  background: var(--qs-brand);
}

.qs-switch input:checked + span::after {
  transform: translateX(16px);
}

.qs-switch input:focus-visible + span {
  outline: 2px solid var(--qs-brand);
  outline-offset: 2px;
}

.qs-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  cursor: pointer;
}

.qs-toggle-row > span:first-child {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.qs-toggle-row b {
  font-size: 0.875rem;
  font-weight: 650;
}

.qs-toggle-row small {
  font-size: 0.8125rem;
  color: var(--qs-muted);
}

/* ---------- Palettes & colours ---------- */
.qs-pals {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.qs-pal {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 10px 4px 9px;
  border: 1px solid var(--qs-line);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.qs-pal:hover {
  border-color: var(--qs-line-strong);
}

.qs-pal[aria-pressed="true"] {
  border-color: var(--qs-brand);
  box-shadow: inset 0 0 0 1px var(--qs-brand);
}

.qs-pal__sw {
  position: relative;
  display: block;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
}

.qs-pal__sw i {
  position: absolute;
  bottom: 4px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.9);
}

.qs-pal__sw i:first-child {
  left: 6px;
}

.qs-pal__sw i:last-child {
  right: 6px;
}

.qs-pal__name {
  max-width: 100%;
  overflow: hidden;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--qs-muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qs-colors {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.qs-color {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 9px 4px 8px;
  border: 1px dashed var(--qs-line-strong);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.qs-color:hover {
  border-color: #b8b4be;
}

.qs-color input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
}

.qs-color:focus-within {
  border-style: solid;
  border-color: var(--qs-brand);
}

.qs-color__sw {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.qs-color__name {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--qs-muted);
}

/* ---------- Fonts ---------- */
.qs-fonts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.qs-font {
  display: flex;
  align-items: center;
  min-width: 0;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--qs-line);
  border-radius: 12px;
  background: #fff;
  color: var(--qs-ink);
  font-size: 1.0625rem;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.qs-font span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.5;
}

.qs-font:hover {
  border-color: var(--qs-line-strong);
}

.qs-font[aria-pressed="true"] {
  border-color: var(--qs-brand);
  box-shadow: inset 0 0 0 1px var(--qs-brand);
  background: var(--qs-brand-soft);
}

/* ---------- Segmented controls ---------- */
.qs-seg {
  display: grid;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--qs-line);
  border-radius: 12px;
  background: #f6f5f8;
}

.qs-seg button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 0;
  height: 38px;
  padding: 0 8px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--qs-muted);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.qs-seg button span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qs-seg button:hover {
  color: var(--qs-ink);
}

.qs-seg button:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.qs-seg button[aria-pressed="true"] {
  background: #fff;
  color: var(--qs-ink);
  box-shadow: 0 1px 2px rgba(22, 19, 28, 0.1), 0 0 0 1px rgba(22, 19, 28, 0.04);
}

.qs-mini {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  fill: currentColor;
}

.qs-seg--tiles button {
  flex-direction: column;
  gap: 4px;
  height: 62px;
  font-size: 0.75rem;
}

.qs-seg--tiles .qs-mini {
  width: 26px;
  height: 26px;
}

.qs-seg button[aria-pressed="true"] .qs-mini {
  color: var(--qs-brand);
}

/* ---------- Photo & logo ---------- */
.qs-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
  padding: 22px 16px;
  border: 1.5px dashed var(--qs-line-strong);
  border-radius: var(--qs-radius);
  background: #fbfafc;
  color: var(--qs-ink);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.qs-drop:hover,
.qs-drop.is-drop {
  border-color: var(--qs-brand);
  background: var(--qs-brand-soft);
}

.qs-drop svg[viewBox] {
  width: 24px !important;
  height: 24px !important;
  margin-bottom: 4px;
  color: var(--qs-brand);
}

.qs-drop b {
  font-size: 0.9375rem;
  font-weight: 650;
}

.qs-drop small {
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--qs-muted);
}

.qs-drop--small {
  padding: 16px;
}

.qs-media {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--qs-line);
  border-radius: var(--qs-radius);
}

.qs-media img {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  border-radius: 10px;
  object-fit: cover;
  background: #f3f2f5;
}

.qs-media--logo img {
  object-fit: contain;
  padding: 6px;
  box-sizing: border-box;
  background: repeating-conic-gradient(#f1f0f3 0% 25%, #fff 0% 50%) 50% / 12px 12px;
}

.qs-media__text {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.qs-media__text b {
  font-size: 0.875rem;
  font-weight: 650;
}

.qs-media__text small {
  font-size: 0.8125rem;
  line-height: 1.35;
  color: var(--qs-muted);
}

.qs-media__actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.qs-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 13px;
  border: 1px solid var(--qs-line);
  border-radius: 999px;
  background: #fff;
  color: var(--qs-ink);
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.qs-chip:hover {
  border-color: var(--qs-line-strong);
  background: #faf9fb;
}

.qs-chip svg[viewBox] {
  width: 17px !important;
  height: 17px !important;
}

.qs-private {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 20px 0 0;
  font-size: 0.8125rem;
  color: var(--qs-muted);
}

.qs-private svg[viewBox] {
  width: 17px !important;
  height: 17px !important;
  color: var(--qs-ok);
}

/* ---------- Range ---------- */
.qs-range {
  margin-top: 16px;
}

.qs-range__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--qs-muted);
}

.qs-range__head output {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--qs-ink);
}

.qs input[type="range"] {
  --p: 50%;
  display: block;
  width: 100%;
  height: 28px;
  margin: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.qs input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--qs-brand) var(--p), #e3e1e7 var(--p));
}

.qs input[type="range"]::-moz-range-track {
  height: 4px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--qs-brand) var(--p), #e3e1e7 var(--p));
}

.qs input[type="range"]::-webkit-slider-thumb {
  width: 20px;
  height: 20px;
  margin-top: -8px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(22, 19, 28, 0.12), 0 2px 6px rgba(22, 19, 28, 0.2);
  -webkit-appearance: none;
  appearance: none;
  transition: box-shadow 0.15s ease;
}

.qs input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(22, 19, 28, 0.12), 0 2px 6px rgba(22, 19, 28, 0.2);
}

.qs input[type="range"]:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 3px rgba(162, 28, 230, 0.3), 0 2px 6px rgba(22, 19, 28, 0.2);
}

/* ---------- Sizes ---------- */
.qs-sizes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.qs-size {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--qs-line);
  border-radius: 12px;
  background: #fff;
  color: var(--qs-ink);
  text-align: start;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.qs-size:hover {
  border-color: var(--qs-line-strong);
}

.qs-size[aria-pressed="true"] {
  border-color: var(--qs-brand);
  box-shadow: inset 0 0 0 1px var(--qs-brand);
}

.qs-size__shape {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
}

.qs-size__shape i {
  display: block;
  border: 1.5px solid #b9b5c0;
  border-radius: 2px;
  box-sizing: border-box;
}

.qs-size[aria-pressed="true"] .qs-size__shape i {
  border-color: var(--qs-brand);
  background: var(--qs-brand-soft);
}

.qs-size__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.qs-size__text b {
  font-size: 0.875rem;
  font-weight: 650;
  line-height: 1.25;
}

.qs-size__text small {
  overflow: hidden;
  font-size: 0.75rem;
  line-height: 1.3;
  color: var(--qs-muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============================================
   DOWNLOAD DIALOG
   ============================================ */
.qs-dl {
  width: min(460px, calc(100% - 32px));
  max-width: none;
  max-height: calc(100% - 32px);
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 20px;
  background: #fff;
  color: #16131c;
  box-shadow: 0 30px 80px -20px rgba(22, 19, 28, 0.45);
  overflow: auto;
}

.qs-dl::backdrop {
  background: rgba(22, 19, 28, 0.42);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.qs-dl[open] {
  animation: qs-dl-in 0.2s ease;
}

@keyframes qs-dl-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
}

.qs-dl__card {
  padding: 22px 22px 20px;
}

.qs-dl__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.qs-dl__title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.qs-dl .qs-tool {
  border-color: transparent;
  box-shadow: none;
  background: #f4f3f6;
}

.qs-dl__group {
  margin: 14px 0 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.qs-dl .qs-sublabel {
  margin: 0 0 8px;
  padding: 0;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #6b6775;
}

.qs-opts {
  display: grid;
  gap: 8px;
}

.qs-opts--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.qs-opt {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding-block: 12px;
  padding-inline: 40px 12px;
  border: 1px solid #e8e6ec;
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.qs-opt:hover {
  border-color: #d6d3dc;
}

.qs-opt input {
  position: absolute;
  top: 14px;
  inset-inline-start: 13px;
  width: 18px;
  height: 18px;
  margin: 0;
  border: 1.5px solid #c4c0cb;
  border-radius: 50%;
  background: #fff;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.qs-opt input:checked {
  border-color: #a21ce6;
  /* A background dot: Safari does not draw inset shadows on form controls */
  background: radial-gradient(circle, #a21ce6 0 4px, #fff 4.6px);
}

.qs-opt:has(input:checked) {
  border-color: #a21ce6;
  background: rgba(162, 28, 230, 0.05);
  box-shadow: inset 0 0 0 1px #a21ce6;
}

.qs-opt input:focus-visible {
  outline: 2px solid #a21ce6;
  outline-offset: 2px;
}

.qs-opt__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.qs-opt__text b,
.qs-check b {
  font-size: 0.9375rem;
  font-weight: 650;
  line-height: 1.3;
}

.qs-opt__text small,
.qs-check small {
  font-size: 0.8125rem;
  line-height: 1.35;
  color: #6b6775;
}

.qs-check {
  position: relative;
  display: flex;
  gap: 10px;
  margin-top: 12px;
  padding-inline-start: 2px;
  cursor: pointer;
}

.qs-check input {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  accent-color: #a21ce6;
  cursor: pointer;
}

.qs-check > span {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.qs-dl__actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.qs-dl__actions .btn {
  padding: 13px 20px;
  font-size: 0.9375rem;
}

.qs-dl__actions .btn-primary {
  flex: 1;
}

.qs-dl__actions .btn:disabled {
  opacity: 0.7;
  cursor: progress;
}

.qs-dl__cta {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(162, 28, 230, 0.07), rgba(33, 212, 253, 0.07));
}

.qs-dl__cta p {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.45;
  color: #4b4755;
}

.qs-dl__cta b {
  display: block;
  margin-bottom: 2px;
  color: #16131c;
  font-size: 0.9375rem;
}

.qs-dl__cta a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  color: #7d12b3;
  font-size: 0.875rem;
  font-weight: 650;
  text-decoration: none;
}

.qs-dl__cta a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.qs-dl__cta svg[viewBox] {
  width: 16px !important;
  height: 16px !important;
  stroke-width: 2 !important;
}

html.qs-modal-open {
  overflow: hidden;
}

/* Enlarged preview */
.qs-zoom {
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.qs-zoom::backdrop {
  background: rgba(18, 15, 22, 0.86);
}

.qs-zoom__inner {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 64px 20px 28px;
  box-sizing: border-box;
  cursor: zoom-out;
}

.qs-zoom img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  border-radius: 3px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}

.qs-zoom__close {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  cursor: pointer;
}

.qs-zoom__close:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.55);
  outline-offset: 2px;
}

.qs-zoom__close svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

/* ============================================
   PRINT (only the generated sheet)
   ============================================ */
.qs-print {
  display: none;
}

@media print {
  html.qs-printing body > * {
    display: none !important;
  }

  html.qs-printing body > .qs-print {
    display: block !important;
  }

  html.qs-printing,
  html.qs-printing body {
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
  }

  .qs-print img {
    display: block;
    break-inside: avoid;
  }
}

/* ============================================
   CTA (below the tool)
   ============================================ */
.qs-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 32px;
  max-width: 1232px;
  width: calc(100% - 48px);
  margin: 0 auto 80px;
  padding: 28px 0;
  border-top: 1px solid var(--color-border, #e5e7eb);
  border-bottom: 1px solid var(--color-border, #e5e7eb);
}

.qs-cta p {
  margin: 0;
}

.qs-cta__title {
  flex-basis: 100%;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--color-text, #1a1a1a);
}

.qs-cta__text {
  flex: 1 1 380px;
  max-width: 64ch;
  margin-top: -8px !important;
  font-size: 1rem;
  line-height: 1.55;
  color: var(--color-text-muted, #6b7280);
}

.qs-cta__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* ============================================
   GUIDE + FAQ (below the tool)
   ============================================ */
.qsg {
  padding: 0 24px 96px;
  color: #16131c;
}

.qsg__wrap {
  max-width: 1232px;
  margin: 0 auto;
}

.qsg__intro {
  max-width: 640px;
}

.qsg__h2 {
  margin: 0;
  font-size: clamp(1.625rem, 2.6vw, 2.125rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.qsg__h2--sm {
  font-size: 1.375rem;
  letter-spacing: -0.02em;
}

.qsg__lead {
  margin: 12px 0 0;
  font-size: 1.0625rem;
  line-height: 1.6;
  color: #6b7280;
}

.qsg-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  margin: 36px 0 0;
  padding: 0;
  list-style: none;
}

.qsg-steps li {
  padding: 24px;
  border: 1px solid #ece9f0;
  border-radius: 20px;
  background: #fff;
}

.qsg-steps__n {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(162, 28, 230, 0.08);
  color: #7d12b3;
  font-weight: 750;
}

.qsg-steps h3 {
  margin: 16px 0 6px;
  font-size: 1.0625rem;
  font-weight: 700;
}

.qsg-steps p,
.qsg-block p {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: #5d5966;
}

.qsg-gallery {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 20px;
  margin: 48px 0 0;
}

.qsg-gallery__item {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0;
  border: 0;
  background: none;
  color: #16131c;
  text-align: start;
  cursor: pointer;
}

.qsg-gallery__item img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 5 / 7;
  border-radius: 10px;
  box-shadow: 0 0 0 1px rgba(22, 19, 28, 0.06), 0 14px 28px -14px rgba(22, 19, 28, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.qsg-gallery__item:hover img {
  transform: translateY(-3px);
  box-shadow: 0 0 0 1px rgba(22, 19, 28, 0.08), 0 20px 34px -14px rgba(22, 19, 28, 0.42);
}

.qsg-gallery__item span {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 0 2px;
}

.qsg-gallery__item b {
  font-size: 0.875rem;
  font-weight: 650;
}

.qsg-gallery__item small {
  font-size: 0.8125rem;
  color: #6b7280;
}

.qsg-cols {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-top: 56px;
}

.qsg-block {
  padding: 28px;
  border: 1px solid #ece9f0;
  border-radius: 20px;
  background: #fff;
}

.qsg-block .qsg__h2 {
  margin-bottom: 10px;
}

.qsg-quotes {
  display: grid;
  gap: 10px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.qsg-quotes li {
  padding: 12px 14px;
  border-radius: 12px;
  background: #f8f7fa;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: #16131c;
}

.qsg-quotes b {
  display: block;
  margin-bottom: 2px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #7d12b3;
}

.qsg-table {
  width: 100%;
  margin-top: 18px;
  border-collapse: collapse;
  font-size: 0.875rem;
  line-height: 1.45;
}

.qsg-table th {
  padding-block: 0 10px;
  padding-inline: 0 10px;
  border-bottom: 1px solid #e8e6ec;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-align: start;
  text-transform: uppercase;
  color: #6b6775;
}

.qsg-table td {
  padding-block: 12px;
  padding-inline: 0 10px;
  border-bottom: 1px solid #f0eef3;
  vertical-align: top;
  color: #3d3946;
}

.qsg-table td:first-child {
  font-weight: 600;
  color: #16131c;
}

.qsg-table tr:last-child td {
  border-bottom: 0;
}

.qsg-tips {
  margin-top: 20px;
}

.qsg-tips ul {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 28px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.qsg-tips li {
  position: relative;
  padding-inline-start: 28px;
  font-size: 0.9375rem;
  line-height: 1.55;
  color: #3d3946;
}

.qsg-tips li::before {
  content: "";
  position: absolute;
  top: 4px;
  inset-inline-start: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(22, 163, 74, 0.12) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2315803d' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4L18 8'/%3E%3C/svg%3E") center / 12px no-repeat;
}

.qsg-faq {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr);
  gap: 32px;
  margin-top: 72px;
}

.qsg-faq__list {
  display: grid;
  gap: 10px;
}

/* ============================================
   TABLET + PHONE
   ============================================ */
@media (max-width: 1100px) {
  .qs {
    grid-template-columns: minmax(0, 1fr) 360px;
    column-gap: 28px;
  }

  .qsg-gallery {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1024px) {
  .qs {
    --qs-top: 96px;
  }
}

@media (max-width: 959px) {
  .qs-head {
    padding: 112px 16px 20px;
  }

  .qs-head__brand {
    margin-bottom: 14px;
  }

  .qs-head__text {
    margin-top: 8px;
    font-size: 1rem;
  }

  .qs {
    --qs-stage-h: clamp(280px, 50svh, 520px);
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none;
    padding: 0 16px 40px;
  }

  .qs__stage {
    --qs-pad-x: 12px;
    --qs-pad-y: 56px;
    grid-column: 1;
    grid-row: auto;
    z-index: 6;
    height: var(--qs-stage-h);
    min-height: 0;
    max-height: none;
    border-radius: 20px;
    /* White in the side gutters and, once stuck, behind the site header, so scrolled controls never peek around the preview */
    box-shadow: 0 0 0 16px #fff;
  }

  .qs__stage.is-stuck {
    box-shadow: 0 calc(-1 * var(--qs-top)) 0 16px #fff, 0 0 0 16px #fff;
  }

  .qs__bar {
    top: 10px;
  }

  .qs__bar--start {
    inset-inline-start: 10px;
  }

  .qs__bar--end {
    inset-inline-end: 10px;
  }

  .qs__foot {
    left: 10px;
    right: 10px;
    bottom: 10px;
  }

  .qs-tool {
    min-width: 38px;
    height: 38px;
  }

  .qs-status {
    height: 40px;
  }

  .qs__toast {
    bottom: 62px;
  }

  /* Tabs stick right under the preview; a white skirt hides content scrolling between them */
  .qs-tabs {
    grid-column: 1;
    grid-row: auto;
    top: calc(var(--qs-top) + var(--qs-stage-h));
    margin: 0 -16px 18px;
    padding: 10px 16px 10px;
    border: 0;
    border-radius: 0;
    background: #fff;
    box-shadow: 0 1px 0 var(--qs-line), 0 10px 16px -14px rgba(22, 19, 28, 0.3);
  }

  .qs-tabs::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 100%;
    height: 12px;
    background: #fff;
  }

  .qs-tab {
    height: 50px;
    background: transparent;
  }

  .qs-tab[aria-selected="true"] {
    background: rgba(162, 28, 230, 0.07);
    box-shadow: none;
  }

  .qs__panel {
    grid-column: 1;
    grid-row: auto;
  }

  /* The site's floating help button would sit on top of the controls while editing */
  html.qs-in-view .help-bubble {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0s linear 0.2s;
  }

  .qs-cats {
    margin: 0 -16px 14px;
    padding: 0 16px 2px;
  }

  .qs-cta {
    width: calc(100% - 32px);
    margin-bottom: 56px;
  }

  .qs-cta__actions,
  .qs-cta__actions .btn {
    width: 100%;
  }

  .qsg {
    padding: 0 16px 72px;
  }

  .qsg-steps,
  .qsg-cols,
  .qsg-faq {
    grid-template-columns: minmax(0, 1fr);
  }

  .qsg-steps {
    gap: 12px;
    margin-top: 24px;
  }

  .qsg-steps li {
    padding: 20px;
  }

  .qsg-gallery {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-top: 32px;
  }

  .qsg-cols {
    margin-top: 32px;
  }

  .qsg-block {
    padding: 22px 20px;
  }

  .qsg-tips ul {
    grid-template-columns: minmax(0, 1fr);
  }

  .qsg-faq {
    gap: 20px;
    margin-top: 48px;
  }

  /* Download dialog becomes a bottom sheet */
  .qs-dl {
    width: 100%;
    max-height: 92%;
    margin: auto 0 0;
    border-radius: 22px 22px 0 0;
  }

  .qs-dl[open] {
    animation: qs-sheet-in 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
  }

  .qs-dl__card {
    padding: 20px 16px calc(18px + env(safe-area-inset-bottom));
  }

  @keyframes qs-sheet-in {
    from {
      transform: translateY(40px);
      opacity: 0;
    }
  }
}

@media (max-width: 480px) {
  .qs {
    --qs-top: 70px;
    --qs-stage-h: clamp(260px, 48svh, 460px);
  }

  .qs-head__title {
    font-size: 1.875rem;
  }

  .qs-tab {
    font-size: 0.6875rem;
  }

  .qs-tab svg[viewBox] {
    width: 19px;
    height: 19px;
  }

  .qs__download {
    padding: 10px 16px !important;
  }

  .qs-tool--text {
    padding: 0 11px;
    font-size: 0.75rem;
  }

  .qs-pals,
  .qs-colors {
    gap: 6px;
  }

  .qs-pal__name {
    font-size: 0.6875rem;
  }

  .qs-seg--tiles button {
    height: 58px;
    font-size: 0.6875rem;
  }

  .qs-sizes {
    gap: 6px;
  }

  .qs-size {
    gap: 8px;
    padding: 9px 8px;
  }

  .qs-media {
    flex-wrap: wrap;
  }

  .qs-media__actions {
    flex-direction: row;
  }

  .qs-opts--2 {
    grid-template-columns: minmax(0, 1fr);
  }

  .qsg-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Short screens (landscape phones, small laptops): keep the tabs in view */
@media (max-width: 959px) and (max-height: 560px) {
  .qs {
    --qs-stage-h: 220px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .qs *,
  .qs-dl,
  .qs-dl * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition: none !important;
  }
}

/* Right-to-left pages (ar): the layout above uses logical sides; these parts stay or flip explicitly */
.qs-link__field {
  direction: ltr; /* a web address reads left to right */
}

[dir="rtl"] .qs input[type="range"] {
  direction: ltr; /* the filled track is drawn left to right */
}

[dir="rtl"] .qs-switch span::after {
  left: auto;
  right: 2px;
}

[dir="rtl"] .qs-switch input:checked + span::after {
  transform: translateX(-16px);
}
