html.mg-license-checking body > *:not(#mg-license-root) {
  visibility: hidden !important;
}

#mg-license-root {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
  box-sizing: border-box;
  background:
    radial-gradient(circle at 15% 20%, rgba(245, 127, 23, .12), transparent 34%),
    radial-gradient(circle at 85% 80%, rgba(93, 64, 55, .12), transparent 38%),
    #f4f6f8;
  font-family: "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, sans-serif;
}

#mg-license-root[hidden] { display: none !important; }

.mg-license-card {
  width: min(100%, 420px);
  padding: 30px 24px 24px;
  box-sizing: border-box;
  border: 1px solid rgba(93, 64, 55, .12);
  border-radius: 22px;
  background: rgba(255, 255, 255, .98);
  box-shadow: 0 22px 60px rgba(67, 47, 38, .15);
  color: #3f332e;
  text-align: center;
}

.mg-license-mark {
  display: grid;
  width: 58px;
  height: 58px;
  margin: 0 auto 14px;
  place-items: center;
  border-radius: 18px;
  background: linear-gradient(135deg, #5d4037, #f57f17);
  color: #fff;
  font-size: 28px;
  font-weight: 900;
  box-shadow: 0 10px 24px rgba(93, 64, 55, .22);
}

.mg-license-card h1 {
  margin: 0;
  font-size: 24px;
  letter-spacing: 1px;
}

.mg-license-card p {
  margin: 10px 0 0;
  color: #75645d;
  font-size: 14px;
  line-height: 1.75;
}

.mg-license-form { margin-top: 20px; }

.mg-license-form input {
  width: 100%;
  box-sizing: border-box;
  padding: 14px 15px;
  border: 1px solid #d8cbc4;
  border-radius: 12px;
  background: #fff;
  color: #302824;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 1px;
  text-align: center;
  text-transform: uppercase;
  outline: none;
  user-select: text !important;
  -webkit-user-select: text !important;
}

.mg-license-form input:focus {
  border-color: #8b6239;
  box-shadow: 0 0 0 3px rgba(139, 98, 57, .12);
}

.mg-license-button {
  width: 100%;
  margin-top: 12px;
  padding: 14px 18px;
  border: 0;
  border-radius: 12px;
  background: #3b312d;
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
}

.mg-license-button:disabled { cursor: wait; opacity: .6; }

.mg-license-secondary-button {
  width: 100%;
  margin-top: 10px;
  padding: 11px 14px;
  border: 1px solid #cbbab0;
  border-radius: 10px;
  background: #fff;
  color: #513e35;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.mg-license-secondary-button:disabled { cursor: wait; opacity: .6; }

.mg-license-message {
  min-height: 22px;
  margin-top: 12px;
  color: #9b2c2c;
  font-size: 13px;
  line-height: 1.65;
}

.mg-license-message.success { color: #23743c; }

.mg-license-foot {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid #eee7e2;
  color: #8a7a72;
  font-size: 12px;
  line-height: 1.7;
}

.mg-license-foot a { color: #6f5141; }

.mg-license-handoff-entry {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #eee2da;
  border-radius: 12px;
  background: #fbf8f6;
  text-align: left;
}

.mg-license-handoff-entry summary {
  color: #644b3e;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.mg-license-handoff-entry p {
  margin: 9px 0;
  font-size: 12px;
  line-height: 1.55;
}

.mg-license-handoff-entry input,
.mg-handoff-result textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 11px;
  border: 1px solid #d8cbc4;
  border-radius: 9px;
  background: #fff;
  color: #302824;
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-wrap: anywhere;
  resize: vertical;
  user-select: text !important;
  -webkit-user-select: text !important;
}

#mg-handoff-tools {
  position: relative;
  z-index: 2147482000;
  font-family: "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, sans-serif;
}

.mg-handoff-launcher {
  position: fixed;
  right: 14px;
  bottom: max(14px, env(safe-area-inset-bottom));
  z-index: 2147482001;
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, .55);
  border-radius: 999px;
  background: rgba(59, 49, 45, .94);
  box-shadow: 0 8px 22px rgba(43, 31, 26, .22);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.mg-handoff-dialog {
  position: fixed;
  inset: 0;
  z-index: 2147482002;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  box-sizing: border-box;
  background: rgba(28, 22, 19, .48);
}

.mg-handoff-dialog[hidden] { display: none !important; }

.mg-handoff-card {
  position: relative;
  width: min(100%, 520px);
  max-height: min(88vh, 720px);
  overflow: auto;
  padding: 26px 22px 22px;
  box-sizing: border-box;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 22px 70px rgba(31, 22, 18, .28);
  color: #3f332e;
}

.mg-handoff-card h2 { margin: 0 36px 8px 0; font-size: 20px; }
.mg-handoff-card p,
.mg-handoff-card li { color: #75645d; font-size: 13px; line-height: 1.65; }
.mg-handoff-card ol { margin: 12px 0 16px; padding-left: 21px; }

.mg-handoff-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: #f5efec;
  color: #5d4037;
  font-size: 24px;
  cursor: pointer;
}

.mg-handoff-result {
  margin-top: 14px;
  padding: 14px;
  border-radius: 12px;
  background: #fbf8f6;
}

.mg-handoff-result[hidden] { display: none !important; }
.mg-handoff-result label { display: block; margin-bottom: 6px; font-size: 12px; font-weight: 800; }
.mg-handoff-result details { margin-top: 12px; }
.mg-handoff-result summary { color: #6f5141; font-size: 12px; cursor: pointer; }
.mg-handoff-result details textarea { margin-top: 8px; }

#mg-license-storage-warning {
  box-sizing: border-box;
  max-width: 600px;
  margin: 12px 16px;
  padding: 12px;
  border: 1px solid #e6cbb5;
  border-radius: 10px;
  background: #fff7e8;
  color: #6f5141;
  font-size: 13px;
  line-height: 1.6;
}
#mg-license-storage-warning[hidden] { display: none !important; }

.mg-license-recovery { margin-top: 16px; padding: 14px; border: 1px solid #dfc5b2; border-radius: 12px; background: #fffaf3; text-align: left; }
.mg-license-recovery[hidden] { display: none !important; }
.mg-license-recovery h2 { margin: 0 0 8px; font-size: 18px; }
.mg-license-recovery p { font-size: 13px; line-height: 1.6; }
#mg-license-recovery-options button { display: block; width: 100%; margin: 8px 0; white-space: normal; text-align: left; }
#mg-license-recovery-submit[hidden] { display: none !important; }

@media (max-width: 480px) {
  #mg-license-root { align-items: flex-start; padding: 8vh 16px 24px; }
  .mg-license-card { padding: 26px 18px 22px; border-radius: 18px; }
  .mg-handoff-launcher { right: 10px; bottom: max(10px, env(safe-area-inset-bottom)); }
  .mg-handoff-dialog { align-items: flex-end; padding: 10px; }
  .mg-handoff-card { max-height: 90vh; border-radius: 18px; }
}
