body{
    background-color: rgb(216, 216, 216);
    padding:0px;
    margin:0px;
    display: flex;
    flex-direction: column;
    align-items: center;

}

.header{
    background-color: rgb(255, 255, 255);
    height: 80px;
    width: 100%;
    box-shadow: 0px 7px 10px -3px rgb(158, 158, 158);
    position: fixed;
    top: 0;
    left: 0;
    /* Above worksheet content (#aa 10001, answer imgr 10050, drag ~1100); below share modal / overlays */
    z-index: 20000;
    display:flex;
    align-items: center;
    justify-content: space-between;
}

.page{
    background-color: #fff;
    width: 60%;
    aspect-ratio: 4/3;
    margin: 10px 0px;
    border-radius: 3px;
    box-shadow: 0px 7px 15px -3px rgb(158, 158, 158);
}

.logo{
    display: flex;
    align-items: center;
    margin-left: 60px;
}

@media (max-width: 1200px) {
    .logo{
        margin-left: 30px;
    }
}


.logoimg{
    height: 40px;
    width: auto;
    margin-right: 10px;
}

h1.logotext, .logotext{
    font-family: 'Roboto', sans-serif;
    font-size: 30px;
    color: rgb(20, 20, 20);
    margin: 0;
    font-weight: 500;
    letter-spacing: -0.5px;
}

h1.logotext span:first-child, .logotext span:first-child{
    color: rgb(20, 20, 20);
    font-weight: 700 !important;
}

h1.logotext span:last-child, .logotext span:last-child{
    color: rgb(20, 20, 20);
    font-weight: 300 !important;
}

.logotext strong{
    font-weight: 700;
}



.tools{
    margin-right: 30px;
    height: auto;
    width: auto;
    background-color: rgb(255, 255, 255);
    display: flex;
    align-items: center;
    gap: 2px;
}

.toolbar-buttons {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 2px;
}

.btn{
    height:auto;
    width: auto;
    cursor: pointer;
    background-color: #fff;;
    border:none;
    transition: 0.1s ease-in-out;
}

.btn img{
    height: 45px;
    width: 45px;
    aspect-ratio: 1/1;
    border:1px solid white;
    padding:5px;
    border-radius: 4px;
    transition: border 0.2s;
    opacity:0.7;
}

.btn img:hover{
    border: 1px solid rgb(156, 156, 156);
    background-color: #f7f7f7;
    transition: 0.2s ease-in-out;
}

.qg-mathsf-icon {
    object-fit: contain;
}

.wsheet-bold-math-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    border: 1px solid white;
    border-radius: 4px;
    font-family: 'Roboto', sans-serif;
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
    color: rgb(40, 40, 40);
    opacity: 0.7;
    box-sizing: border-box;
}

img.qg-mathsf-icon {
    height: 45px;
    width: 45px;
    aspect-ratio: 1 / 1;
    border: 1px solid white;
    padding: 5px;
    border-radius: 4px;
    transition: border 0.2s;
    opacity: 0.7;
    box-sizing: border-box;
    display: block;
}

#toggle-bold-math-ws:hover img.qg-mathsf-icon,
#toggle-bold-math-ws-sm:hover img.qg-mathsf-icon {
    border: 1px solid rgb(156, 156, 156);
    background-color: #f7f7f7;
    opacity: 1;
}

#toggle-bold-math-ws.wsheet-bold-math-active img.qg-mathsf-icon,
#toggle-bold-math-ws-sm.wsheet-bold-math-active img.qg-mathsf-icon,
#toggle-bold-math-ws.qg-mathsf-active img.qg-mathsf-icon,
#toggle-bold-math-ws-sm.qg-mathsf-active img.qg-mathsf-icon {
    border-color: rgb(80, 80, 80);
    background-color: #e8e8e8;
    opacity: 1;
}

/* Sans-math toggle: reinforce MathJax CHTML sans-serif when \mathsf is active */
body.wsheet-mathsf-on #grd mjx-container,
body.wsheet-mathsf-on #grd1 mjx-container,
body.qg-mathsf-on .qnssection mjx-container,
body.qg-mathsf-on #mainprint mjx-container {
    font-family: 'Open Sans', 'Nimbus Sans', 'Helvetica Neue', Arial, sans-serif !important;
}

/* Custom tooltip for new questions button */
#newquestions, #newquestions-sm {
    position: relative;
}

#newquestions .tooltip,
#newquestions-sm .tooltip {
    position: absolute;
    top: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 12px;
    background-color: #1f2937;
    color: #ffffff;
    font-size: 13px;
    font-family: 'Roboto', sans-serif;
    font-weight: 400;
    white-space: nowrap;
    border-radius: 6px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    transform: translateX(-50%) translateY(4px);
    z-index: 2000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

#newquestions .tooltip::after,
#newquestions-sm .tooltip::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-bottom-color: #1f2937;
}

#newquestions:hover .tooltip,
#newquestions-sm:hover .tooltip {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: none;
}

#print{
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: 5px;
    padding: 10px 25px 10px 20px;
  font-size: 18px;
  border-radius: 7px;
  color: rgb(255, 255, 255);
  font-weight: 500;
  background-color: #2063e0;
  border: none;
  cursor: pointer;
  transition: 0.2s ease-in-out;
  box-shadow: 0 4px 6px rgba(0,0,0,0.2);
}

#print img{
    height: 17px;
    aspect-ratio: 1/1;
    padding:0px;
    border:none;
    opacity:1;
}

#print img:hover{
    border:none;
    background-color: transparent;}

#print:hover {
  background-color: #2358bb;
}



.dropdown-toggle {
        display: none;

    }


.dropdown-menu {
    display: none;
    position: absolute;
    top: 60px;
    right: 0;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
    flex-direction: column;
    padding: 0px 0;
    z-index: 1500;
    width: 220px;
}


.dropdown-menu .btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 15px;
    text-align: left;
    font-size: 14px;
    border: 1px solid transparent;
    border-radius: 6px;
    background-color: #fff;
    color: #1b1b1b;
    cursor: pointer;
    transition: all 0.2s ease;
}


.dropdown-menu .btn:hover {
    background-color: #f0f4ff;
    border-color: #438eff;
}


.dropdown-menu .btn img {
    height: 22px;
    width: 22px;
    border: 1px solid transparent
}




@media (max-width: 840px) {
    .toolbar-buttons {
        display: none;
    }

    .dropdown-toggle {
        display: block;
        font-size: 28px;
        background: none;
        border: none;
        cursor: pointer;
        margin-right: 10px;
        color: #444;
    }

    .header .tools {
        position: relative;
    }

    #print {
        display: flex;
    }
}







@keyframes info-btn-intro-pulse {
  0%, 100% {
    background-color: #438eff;
    transform: scale(1);
    box-shadow: 0 4px 10px rgba(67, 142, 255, 0.35);
  }
  50% {
    background-color: #1a55d4;
    transform: scale(1.14);
    box-shadow: 0 6px 18px rgba(26, 85, 212, 0.55);
  }
}

#info-btn img{
    height: 60%;
    margin-top:5px;
    aspect-ratio: 1/1;
    padding:0;
    border:none;
}


#info-btn {
  position: fixed;
  bottom: 25px;
  right: 25px;
  background-color: #438eff;
  color: white;
  font-size: 26px;
  border: none;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  transform-origin: center center;
  transition: transform 0.3s ease, background-color 0.3s ease, box-shadow 0.3s ease;
  z-index: 2000;
  animation: info-btn-intro-pulse 0.95s ease-in-out 5;
}

@media (prefers-reduced-motion: reduce) {
  #info-btn {
    animation: none;
  }
}

#info-btn:hover {
  background-color: #1a44ff;
  transform: scale(1.1);
}

#info-popover {
  position: fixed;
  bottom: 100px;
  right: 30px;
  z-index: 3000;
  display: none;
  animation: popUp 0.3s ease;
}

.popover-content {
  position: relative;
  background: white;
  border-radius: 12px;
  padding: 15px;
  width: 420px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
  font-family: 'Roboto', sans-serif;
}


.arrow {
  position: absolute;
  bottom: -10px;
  right: 20px;
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 10px solid white;
}

/* Close button */
#close-popover {
  position: absolute;
  top: 5px;
  right: 8px;
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #888;
}



#close-popover:hover {
  color: rgb(34, 110, 250);
}

/* Popover Header */
.popover-content h2 {
  font-size: 18px;
  text-align: center;
  margin-top: 0;
  margin-bottom: 10px;
  font-family: 'Roboto', sans-serif;
  font-weight: 600;
}

/* Tool List */
.tool-list {
  list-style: none;
  padding: 0px;
  margin: 0 0 0 10px;
}

.tool-list li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 15px;
  margin-bottom: 8px;
  font-family: 'Roboto', sans-serif;
}

.tool-list img {
  width: 22px;
  height: 22px;
}

.tool-list strong {
  color: rgb(34, 110, 250);
  font-family: 'Roboto', sans-serif;
  font-weight: 600;
}

/* Pop-up animation */
@keyframes popUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Responsive for mobile */
@media (max-width: 880px) {
  #info-popover {
    right: 10px;
    bottom: 70px;
  }

  .popover-content {
    width: 90%;
    padding: 10px;
  }

  .tool-list li {
    font-size: 14px;
    gap: 6px;
  }

  .tool-list img {
    width: 18px;
    height: 18px;
  }

  .arrow {
    right: 15px;
  }
}




/* Modal Overlay — above worksheet answers (#aa 10001), dragged images (1100), fixed header */
#share-modal {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.68);
  backdrop-filter: blur(6px);
  justify-content: center;
  align-items: center;
  z-index: 2147483647 !important;
}

#share-modal .modal-content {
  background: rgba(255, 255, 255, 0.94);
}

/* Modal Box */
.modal-content {
  background: rgba(255, 255, 255, 0.85);
  border-radius: 16px;
  padding: 30px;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  font-family: 'Poppins', sans-serif;
  position: relative;
  animation: fadeSlideUp 0.3s ease;
}

/* Close Button */
#close-modal {
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: 28px;
  background: none;
  border: none;
  color: #555;
  cursor: pointer;
  transition: color 0.2s ease;
}

#close-modal:hover {
  color: #ff4c4c;
}

/* Modal Header */
.modal-content h2 {
  font-size: 24px;
  text-align: center;
  margin-bottom: 25px;
  color: #222;
}

/* Share Options */
.share-option {
  margin-bottom: 25px;
  text-align: center;
}

.share-option h3{
  font-size: 18px;
  margin-bottom: 10px;
  color: #333;
   text-align: center !important;
   font-variation-settings: "slnt" 0, "wdth" 100, "wght" 600 !important;
   width:100%;
}

/* Copy Buttons */
.copy-btn {
  background: #2358eb;
  color: white;
  border: none;
  border-radius: 10px;
  padding: 12px 24px;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 6px 12px rgba(0,0,0,0.2);
}

.copy-btn:hover {
  transform: translateY(-2px);
  background: #143cac;
}

/* Description Text */
.share-option p {
  font-size: 14px;
  color: #555;
  margin-top: 10px;
  line-height: 1.5;
  max-width: 360px;
  margin-left: auto;
  margin-right: auto;
}

/* Divider */
hr {
  border: none;
  border-top: 1px solid #ccc;
  margin: 30px 0;
}
.nmes hr {
  border: 0;
  border-top: 2px dotted #8c8c8c;
  margin:0;
    padding:10px !important;
}
/* Animation */
@keyframes fadeSlideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}



.modal {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(6px);
  justify-content: center;
  align-items: center;
  z-index: 999999;
}


.modal-content2 {
  background: #fff;
  padding: 32px 28px;
  border-radius: 12px;
  position: relative;
  width: 380px;
  max-width: 90vw;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
  text-align: center;
  font-family: 'Roboto', sans-serif;
  animation: fadeSlideUp 0.3s ease;
}


.close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 24px;
  background: none;
  border: none;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-family: 'Roboto', sans-serif;
  font-weight: 300;
  line-height: 1;
}

.close-btn:hover {
  color: #ef4444;
  background-color: #f3f4f6;
}

/* Heading */
.modal-heading {
  margin-bottom: 4px;
  font-size: 24px;
  font-weight: 500;
  color: #111827;
  font-family: 'Roboto', sans-serif;
  letter-spacing: -0.3px;
}

/* Label */
.modal-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  font-family: 'Roboto', sans-serif;
  margin-bottom: 8px;
  text-align: left;
}

/* Input field */
.modal-input {
  width: 100%;
  padding: 12px 16px;
  font-size: 16px;
  margin: 0 0 24px 0;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  font-family: 'Roboto', sans-serif;
  color: #111827;
  background-color: transparent;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.modal-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.modal-input::placeholder {
  color: #9ca3af;
  font-weight: 400;
}

/* Submit button */
.modal-submit {
  padding: 12px 32px;
  font-size: 16px;
  font-weight: 500;
  background-color: #2563eb;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-family: 'Roboto', sans-serif;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
  width: auto;
  min-width: 120px;
  margin-top: 8px;
}

.modal-submit:hover {
  background-color: #1d4ed8;
  box-shadow: 0 4px 8px rgba(37, 99, 235, 0.3);
  transform: translateY(-1px);
}

.modal-submit:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

.btn:active{
    scale:1.11;
    transition: 0.1s ease-in-out;
}

/* Fixed .header z-index above A4 page layers; main-contentm padding clears header height; imgr uses ~900–10050 */
.main-contentm {
  padding-top: 20px;
  box-sizing: border-box;
}

/* Free wfsheet.php: disabled toolbar controls (Save / grid / portrait) — faint appearance */
.header .btn.wfsheet-toolbar-faint,
.header .dropdown-menu .btn.wfsheet-toolbar-faint {
  opacity: 0.4;
  filter: grayscale(0.35);
  cursor: not-allowed;
}
.header .btn.wfsheet-toolbar-faint:active {
  transform: none;
  scale: 1;
}
.header .btn.wfsheet-toolbar-faint img {
  opacity: 0.85;
}

/* Per-question refresh (same behaviour as 10q); hidden when printing */
.grid-item .question {
  position: relative;
}
.wsheet-new-q-btn {
  position: absolute;
  top: 4px;
  right: 6px;
  z-index: 12;
  width: 22px;
  height: 22px;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(209, 213, 219, 0.38);
  border-radius: 50%;
  background: rgba(156, 163, 175, 0.38);
  color: rgba(255, 255, 255, 0.82);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.07);
  line-height: 0;
}
.wsheet-new-q-btn:hover {
  background: rgba(107, 114, 128, 0.55);
  border-color: rgba(156, 163, 175, 0.55);
  color: rgba(255, 255, 255, 0.95);
}
.wsheet-new-q-btn svg {
  display: block;
  pointer-events: none;
  width: 11px;
  height: 11px;
  opacity: 0.88;
}

/* Worksheet diagram images: hidden until JS adds .wsheet-imgr-visible after layout (avoids large-then-shrink flash). */
body.wsheet-page img[class*="imgr"]:not(.wsheet-imgr-visible),
body.wsheet-page img[id^="imgr"]:not(.wsheet-imgr-visible),
body.wsheet-page img[id^="imgid"]:not(.wsheet-imgr-visible),
body.wsheet-page img[class*="imgrid"]:not(.wsheet-imgr-visible),
body.wsheet-page img[class*="imgrida"]:not(.wsheet-imgr-visible),
body.wsheet-page img[alt^="qnimage"]:not(.wsheet-imgr-visible) {
  visibility: hidden !important;
}
body.wsheet-page img[class*="imgr"].user-resized,
body.wsheet-page img[id^="imgr"].user-resized,
body.wsheet-page img[id^="imgid"].user-resized,
body.wsheet-page img[class*="imgrid"].user-resized,
body.wsheet-page img[class*="imgrida"].user-resized,
body.wsheet-page img[alt^="qnimage"].user-resized {
  visibility: visible !important;
}

/* Worksheet imgr: do not let qggeneral.css max-width/height cap user-resized diagrams (f1e, f1019m, …). */
body.wsheet-page .question img[class*="imgr"],
body.wsheet-page .question img[id^="imgr"],
body.wsheet-page .question img[class*="imgrid"],
body.wsheet-page .question img[class*="imgrida"],
body.wsheet-page .questiona img[class*="imgr"],
body.wsheet-page .questiona img[id^="imgr"],
body.wsheet-page .questiona img[class*="imgrid"],
body.wsheet-page .questiona img[class*="imgrida"] {
  max-width: none;
  max-height: none;
  bottom: auto !important;
  margin-top: 0 !important;
}

/* Answer sheet (page 2): larger red answers on a white backing, in front of stem text. */
body.wsheet-page #grd1 [id^="aa"],
body.wsheet-page [id^="aa"] {
  color: #cc0000;
  font-size: 20px;
  font-family: 'Open Sans', sans-serif;
  font-weight: 600;
  line-height: 1.25;
  text-align: right;
  position: absolute;
  bottom: 3px;
  right: 4px;
  left: auto;
  width: auto;
  max-width: 100%;
  display: inline-block;
  padding: 1px 12px 0 4px;
  background: #ffffff;
  z-index: 10070;
  box-sizing: border-box;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
body.wsheet-page #grd1 [id^="aa"] mjx-container,
body.wsheet-page [id^="aa"] mjx-container {
  font-size: inherit !important;
  max-width: 100%;
}
body.wsheet-page #grd1 [id^="aq"] {
  position: relative;
  z-index: 1;
}

/* Question + answer sheets: keep cell size fixed; long stems shrink via JS instead of stretching the grid. */
body.wsheet-page #grd .grid-item,
body.wsheet-page #grd1 .grid-item {
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}
body.wsheet-page.wsheet-list #grd .grid-item,
body.wsheet-page.wsheet-list #grd1 .grid-item {
  overflow: visible;
}
body.wsheet-page #grd1 .grid-item {
  padding-right: 2px;
  padding-bottom: 0;
}
body.wsheet-page #grd .question,
body.wsheet-page #grd1 .questiona {
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
}
body.wsheet-page.wsheet-list #grd .question,
body.wsheet-page.wsheet-list #grd1 .questiona {
  overflow: visible;
  max-height: none;
}
body.wsheet-page.wsheet-list .page-main #grd,
body.wsheet-page.wsheet-list .page-main #grd1 {
  overflow: visible;
}
body.wsheet-page.wsheet-list [id^="qq"],
body.wsheet-page.wsheet-list [id^="aq"] {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}
body.wsheet-page #grd1 .questiona {
  width: 100%;
  margin-left: 0;
  margin-right: 0;
}
body.wsheet-page #grd [id^="qq"] mjx-container,
body.wsheet-page #grd1 [id^="aq"] mjx-container {
  /* TeX glyphs sit smaller than Open Sans at the same px size. 1.21em matches the question text and still scales when that text is resized. */
  font-size: 1.21em !important;
  max-width: 100%;
}

/* f131e/f133e wireframes (f231e): cap intrinsic PNG before imgr layout runs (avoids 400px flash). */
body.wsheet-page img[data-elc="f131e-wireframe"]:not(.user-resized):not(.wsheet-imgr-auto-fit) {
  max-width: min(100%, 260px) !important;
  max-height: 240px !important;
  width: auto !important;
  height: auto !important;
  object-fit: contain !important;
}

@media print {
.header{display:none !important
}
#info-btn{display:none !important;}
.main-contentm {
  padding-top: 0 !important;
}
.wsheet-new-q-btn {
  display: none !important;
}
body.wsheet-page img[class*="imgr"],
body.wsheet-page img[id^="imgr"],
body.wsheet-page img[id^="imgid"],
body.wsheet-page img[class*="imgrida"] {
  visibility: visible !important;
}
}