/* QR sheet (settings) */
.qr-glyph {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  width: 18px;
  height: 18px;
}
.qr-glyph i {
  display: block;
  background: currentColor;
  border-radius: 2px;
}
.qr-glyph i.dot {
  width: 3px;
  height: 3px;
  border-radius: 999px;
  margin: 1px;
}
.qr-glyph .dots {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  align-content: center;
  justify-items: center;
}

.qr-sheet-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 200;
}
.qr-sheet-backdrop.show { display: block; }

.qr-sheet {
  position: fixed;
  inset: 0;
  z-index: 201;
  display: none;
  flex-direction: column;
  pointer-events: none;
}
.qr-sheet.show {
  display: flex;
  pointer-events: auto;
}

.qr-sheet-hero {
  flex: 1;
  min-height: 52%;
  padding: 40px 20px 96px;
  background: linear-gradient(160deg, #b8e986 0%, #7ed56f 45%, #55c57a 100%);
  position: relative;
  overflow: visible;
}
.qr-sheet-hero.theme-blue { background: linear-gradient(160deg, #74b9ff, #0984e3); }
.qr-sheet-hero.theme-purple { background: linear-gradient(160deg, #a29bfe, #6c5ce7); }
.qr-sheet-hero.theme-orange { background: linear-gradient(160deg, #ffeaa7, #fdcb6e); }
.qr-sheet-hero.theme-pink { background: linear-gradient(160deg, #fd79a8, #e84393); }

.qr-sheet-avatar {
  width: 88px;
  height: 88px;
  border-radius: 999px;
  border: 4px solid #fff;
  margin: 0 auto -44px;
  position: relative;
  z-index: 2;
  overflow: hidden;
  background: #ffffff; color: #c7c7cc;
  font-size: 32px;
  font-weight: 600;
}
.qr-sheet-avatar #qr-sheet-avatar-fallback {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
}
.qr-sheet-avatar img {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.qr-sheet-avatar.has-photo 
.qr-sheet-avatar.has-photo img { display: block !important; }
.qr-sheet-avatar:not(.has-photo) img { display: none !important; }

.qr-sheet-card-wrap {
  position: absolute;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%);
  width: min(280px, 78vw);
  z-index: 2;
}
.qr-sheet-card {
  background: #fff;
  border-radius: 20px;
  padding: 52px 20px 18px;
  text-align: center;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
}
.qr-sheet-card img {
  width: 200px;
  height: 200px;
  display: block;
  margin: 0 auto 10px;
  border-radius: 8px;
}
.qr-sheet-handle {
  font-size: 17px;
  font-weight: 600;
  color: #2e9e4b;
  word-break: break-all;
}
.qr-sheet-handle.no-user { color: var(--muted); font-weight: 500; }

.qr-sheet-panel {
  margin-top: auto;
  position: relative;
  z-index: 1;
  background: var(--card);
  border-radius: 18px 18px 0 0;
  padding: 12px 16px calc(16px + env(safe-area-inset-bottom, 0));
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.08);
}
.qr-sheet-nav {
  display: grid;
  grid-template-columns: 72px 1fr 72px;
  align-items: center;
  margin-bottom: 12px;
}
.qr-sheet-nav h2 {
  text-align: center;
  font-size: 17px;
  font-weight: 600;
  margin: 0;
}
.qr-sheet-nav button {
  border: 0;
  background: transparent;
  color: var(--blue);
  font-size: 17px;
  cursor: pointer;
}
.qr-sheet-nav .qr-close { justify-self: start; font-size: 22px; line-height: 1; }

.qr-theme-row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 2px 14px;
  -webkit-overflow-scrolling: touch;
}
.qr-theme-btn {
  flex: 0 0 56px;
  height: 56px;
  border-radius: 12px;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
}
.qr-theme-btn.on { border-color: var(--blue); }
.qr-theme-btn[data-theme="green"] { background: linear-gradient(145deg, #b8e986, #55c57a); }
.qr-theme-btn[data-theme="blue"] { background: linear-gradient(145deg, #74b9ff, #0984e3); }
.qr-theme-btn[data-theme="purple"] { background: linear-gradient(145deg, #a29bfe, #6c5ce7); }
.qr-theme-btn[data-theme="orange"] { background: linear-gradient(145deg, #ffeaa7, #fdcb6e); }
.qr-theme-btn[data-theme="pink"] { background: linear-gradient(145deg, #fd79a8, #e84393); }

.qr-sheet-actions { display: flex; flex-direction: column; gap: 10px; }
.qr-btn-primary {
  width: 100%;
  border: 0;
  border-radius: 12px;
  padding: 14px;
  font-size: 17px;
  font-weight: 600;
  background: var(--blue);
  color: #fff;
  cursor: pointer;
}
.qr-btn-secondary {
  width: 100%;
  border: 0;
  border-radius: 12px;
  padding: 14px;
  font-size: 17px;
  background: rgba(120, 120, 128, 0.12);
  color: var(--blue);
  cursor: pointer;
}

/* QR scanner overlay */
.qr-scan-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 220;
  background: #000;
}
.qr-scan-backdrop.show { display: block; }
.qr-scan-panel {
  height: 100%;
  display: flex;
  flex-direction: column;
  color: #fff;
}
.qr-scan-nav {
  display: grid;
  grid-template-columns: 72px 1fr 72px;
  align-items: center;
  padding: calc(10px + env(safe-area-inset-top, 0)) 12px 10px;
  background: rgba(0, 0, 0, 0.55);
}
.qr-scan-nav span {
  text-align: center;
  font-size: 17px;
  font-weight: 600;
}
.qr-scan-nav button {
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 17px;
  cursor: pointer;
  padding: 8px 4px;
  font-family: inherit;
}
.qr-scan-cancel { justify-self: start; }
.qr-scan-album { justify-self: end; color: #7ecbff; }
.qr-scan-viewport {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: #111;
}
.qr-scan-viewport video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.qr-scan-viewport video.qr-scan-video-hidden {
  visibility: hidden;
}
.qr-scan-frame {
  position: absolute;
  left: 50%;
  top: 42%;
  width: min(68vw, 280px);
  height: min(68vw, 280px);
  transform: translate(-50%, -50%);
  border: 2px solid rgba(255, 255, 255, 0.92);
  border-radius: 18px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}
.qr-scan-hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(48px + env(safe-area-inset-bottom, 0));
  text-align: center;
  font-size: 15px;
  color: rgba(255, 255, 255, 0.88);
  margin: 0;
  padding: 0 20px;
}

.scan-icon-btn svg {
  display: block;
}


/* x16: white bg, no card shell, TEXT ALWAYS VISIBLE */
.qr-sheet-backdrop {
  background: #ffffff !important;
}
.qr-sheet-hero,
.qr-sheet-hero.theme-green,
.qr-sheet-hero.theme-blue,
.qr-sheet-hero.theme-purple,
.qr-sheet-hero.theme-orange,
.qr-sheet-hero.theme-pink {
  background: #ffffff !important;
  background-image: none !important;
  padding: 28px 20px 24px !important;
  min-height: 0 !important;
  overflow: visible !important;
}
.qr-sheet-avatar {
  margin: 0 auto 16px !important;
  border-color: #ffffff !important;
}
.qr-sheet-card-wrap {
  position: static !important;
  left: auto !important;
  right: auto !important;
  bottom: auto !important;
  transform: none !important;
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  z-index: 2 !important;
  display: block !important;
  visibility: visible !important;
}
.qr-sheet-card {
  display: block !important;
  visibility: visible !important;
  background: transparent !important;
  background-color: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  padding: 0 !important;
  box-shadow: none !important;
  text-align: center !important;
  overflow: visible !important;
}
.qr-sheet-card img#qr-sheet-img {
  display: block !important;
  width: 200px !important;
  height: 200px !important;
  margin: 0 auto 14px !important;
  visibility: visible !important;
}
.qr-sheet-handle,
.qr-sheet-handle.copy-link,
.qr-sheet-handle.jw-copy-link,
.qr-sheet-handle.no-user,
button.qr-sheet-handle {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 auto !important;
  padding: 8px 8px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  background-color: transparent !important;
  color: #000000 !important;
  font-size: 15px !important;
  font-weight: 500 !important;
  line-height: 1.4 !important;
  word-break: break-all !important;
  white-space: normal !important;
  text-align: center !important;
  box-shadow: none !important;
  height: auto !important;
  min-height: 1.2em !important;
  overflow: visible !important;
}
.qr-sheet-copy-tip {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  margin-top: 8px !important;
  font-size: 13px !important;
  color: #000000 !important;
  text-align: center !important;
}
.qr-sheet-panel {
  background: #ffffff !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  border-top: 1px solid rgba(0,0,0,.06) !important;
}
.qr-btn-primary,
#qr-btn-share,
.qr-btn-secondary,
#qr-btn-scan {
  display: inline-block !important;
  width: auto !important;
  margin: 8px auto 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: #000000 !important;
  font-size: 16px !important;
  font-weight: 500 !important;
  box-shadow: none !important;
}
.qr-sheet-actions {
  align-items: center !important;
}


/* x16: remove bottom QR panel (title / colors / share) */
.qr-sheet-panel,
#qr-sheet .qr-sheet-panel {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  border: 0 !important;
}

.qr-sheet-close-float {
  position: fixed !important;
  top: calc(10px + env(safe-area-inset-top, 0px)) !important;
  left: 12px !important;
  z-index: 210 !important;
  border: 0 !important;
  background: transparent !important;
  color: #007aff !important;
  font-size: 28px !important;
  line-height: 1 !important;
  padding: 4px 10px !important;
  cursor: pointer !important;
}


/* x16: share text under tip */
.qr-sheet-share-text,
#qr-btn-share-text {
  display: block !important;
  visibility: visible !important;
  width: auto !important;
  margin: 28px auto 8px !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: #000000 !important;
  font-size: 16px !important;
  font-weight: 500 !important;
  text-align: center !important;
  cursor: pointer !important;
  box-shadow: none !important;
}

/* Avatar: plain white circle + gray ? (default placeholder) */
.qr-sheet-avatar,
#qr-sheet-avatar {
  width: 88px !important;
  height: 88px !important;
  border-radius: 999px !important;
  border: 1.5px solid #d1d1d6 !important;
  margin: 0 auto 16px !important;
  position: relative !important;
  z-index: 2 !important;
  overflow: hidden !important;
  background: #ffffff !important;
  color: #c7c7cc !important;
  font-size: 36px !important;
  font-weight: 500 !important;
  box-shadow: none !important;
}
.qr-sheet-avatar #qr-sheet-avatar-fallback,
#qr-sheet-avatar-fallback {
  position: absolute !important;
  inset: 0 !important;
  z-index: 1 !important;
  display: grid !important;
  place-items: center !important;
  color: #c7c7cc !important;
  font-size: 36px !important;
  font-weight: 500 !important;
  line-height: 1 !important;
}
.qr-sheet-avatar.has-photo #qr-sheet-avatar-fallback,
#qr-sheet-avatar.has-photo #qr-sheet-avatar-fallback {
  display: none !important;
}
.qr-sheet-avatar:not(.has-photo) img,
#qr-sheet-avatar:not(.has-photo) img {
  display: none !important;
}
.qr-sheet-avatar.has-photo img,
#qr-sheet-avatar.has-photo img {
  display: block !important;
}
