:root{
  --upload-icon: url("data:image/svg+xml,%3Csvg class='icon' viewBox='0 0 1024 1024' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 341.197V136.294A136.038 136.038 0 0 1 135.885.41h204.851c1.331 0 32.973.46 32.973 32.972 0 32.461-31.642 32.922-32.973 32.922H136.038c-38.656 0-70.144 31.488-70.144 70.144v204.749c0 1.28-.46 32.921-32.972 32.921C.512 374.118 0 342.477 0 341.197zm785.46 138.035c18.124 0 32.767 14.848 32.972 32.922 0 18.227-14.848 32.972-32.973 32.972H238.234a32.973 32.973 0 0 1 0-65.894h547.225zm205.158-105.165c-32.461 0-32.922-31.641-32.922-32.921V136.448c0-38.656-31.488-70.144-70.144-70.144H682.803c-1.28 0-32.921-.46-32.921-32.922C649.882.87 681.523.41 682.803.41h204.903a136.038 136.038 0 0 1 135.884 135.884v204.903c0 1.28-.46 32.921-32.972 32.921zM32.922 650.291c32.512 0 32.972 31.642 32.972 32.973v204.698c0 38.656 31.488 70.144 70.144 70.144h204.698c1.331 0 32.973.46 32.973 32.972 0 32.461-31.642 32.922-32.973 32.922h-204.8A136.038 136.038 0 0 1 0 888.115V683.264c0-1.331.46-32.973 32.922-32.973zm990.668 32.973v204.8A136.038 136.038 0 0 1 887.706 1024H682.803c-1.28 0-32.921-.46-32.921-32.922 0-32.512 31.641-32.972 32.921-32.972h204.749c38.656 0 70.144-31.488 70.144-70.144V683.264c0-1.331.46-32.973 32.922-32.973 32.512 0 32.972 31.642 32.972 32.973z'/%3E%3C/svg%3E%0A") no-repeat 50% 50%;
 };

em {
  font-style: normal;
  -webkit-text-emphasis-position: under;
  -webkit-text-emphasis: circle;
}

header {
  position: fixed;
  z-index: 10;
  top: 0;
  left: 0;
  right: 0;
  box-sizing: border-box;
  height: 50px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px 0 0;
  background: #fff;
  text-align: center;
  border-bottom: 1px solid #eee;
}

header > div {
  position: relative;
}

header > h2 {
  text-align: center;
}

select {
  transform: translate(-50%, -50%);
  left: 0;
  top: 0;
  position: absolute;
  padding: 0 20px 0 0;
  border: none;
  outline: none;
  font-size: 16px;
  font-weight: 600;
  -webkit-appearance: none;
  background: transparent url("data:image/svg+xml,%3Csvg width='8' height='8' viewBox='0 0 164 167' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M81.997 105.183l64.115-64.115c4.09-4.09 10.723-4.09 14.813 0 4.091 4.09 4.091 10.723 0 14.814l-70.14 70.14A10.458 10.458 0 0 1 81.997 129c-3.12.413-6.391-.58-8.789-2.977l-70.14-70.14c-4.09-4.09-4.09-10.723 0-14.814 4.09-4.09 10.723-4.09 14.814 0l64.115 64.115z' fill='%23666' fill-rule='evenodd'/%3E%3C/svg%3E%0A") no-repeat 100% 50%;
}

button {
  appearance: none;
  border: none;
  padding: 1px 6px;
  margin: 0;
  background-color: #fff;
  border-radius: 5px;
  color: #3355ff;
  cursor: pointer;
}
body, pre {
  font: normal 14px/1.8 STFangsong,simsun,serif;
}
h1 {
  display: none;
}
h1, h2, h3 {
  text-align: center;
  font: bolder 14px / 1.8 sans-serif;
}
h2 {
  text-align: left;
}
table {
  max-width:100%;
  border:1px solid;
  border-collapse:collapse;
}
td {
  border:1px solid;
  text-align: center;
  white-space: nowrap;
  font-size:1.15em;
  padding:12px;
}
sup {
  display: inline-block;
  transform: scale(.8);
  transform-origin: left;
  color: #aaa;
}
.question-list {
  padding-top: 40px;
}
.p1 {
  padding: 0;
  margin: 0;
  padding-left: 1em;
}
.question + h2 {
  margin-top: 2em;
}
.katex {
  font-size: 1.1em;
}
.katex .mfrac {
  font-size: 1.3em;
}
.pagebreak {
  width: 100%;
  clear: both;
  page-break-after: always;
}
.question {
  position: relative;
  margin-bottom: 1em;
  box-sizing: border-box;
}
.question-body {
  cursor: pointer;
}
.question-body:hover {
  background-color: #f8f8fa;
}
.question-body:hover::before {
  content: '⚑';
  position: absolute;
  top: 0;
  left: -16px;
  color: #aaa;
}
header .print {
  transform: scale(.9);
}
.selected-num button {
  background: #4caf50;
  color: #fff;
}
.selected-num .bn-close {
  background-color: transparent;
  color: #333;
}
.question.selected::before {
  content: '⚑';
  position: absolute;
  top: 0;
  left: -16px;
  color: #f40;
}
.question.selected .question-body::before {
  display: none;
}
.question .index {
  margin-right: .5em;
  font-family: Times;
  transform: scale(.9);
}
.question .line {
  display: inline-block;
  height: 1em;
  width: 3em;
  border-bottom: 1px solid;
  vertical-align: text-bottom;
}
.question .space {
  display: inline-block;
  width: 1em;
}
.question .blank {
  height: 8em;
}
.choice-options {
  display: flex;
  flex-wrap: wrap;
}
.choice-options .option {
  margin-right: 2em;
  min-width: 20%;
  max-width: 50%;
}
.question-equation,
.question-calculation {
  display: flex;
  flex-wrap: wrap;
}
.question-equation .question,
.question-calculation .question{
  min-width: 50%;
  min-height: 6em;
}
.question-calculation .question:last-child {
  width: auto;
}
.ocr-result {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  z-index: 100;
  padding: 20px;
  display: flex;
  flex-direction: column;
}

.ocr-result-preview {
  flex: 1;
  max-height: 50vh;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ocr-result-content {
  flex: 1;
}
.ocr-result-content textarea {
  appearance: none;
  border: none;
  padding:20px;
  width: 100%;
  height: 100%;
  line-height: 1.8;
  resize: none;
  border: 1px solid #ccc;
  box-sizing: border-box;
}

.ocr-result-preview img {
  max-width: 80%;
  max-height: 100%;
}

.bn-ocr {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 16px;
  height: 16px;
  cursor: pointer;
  overflow:hidden;
  background: var(--upload-icon);
  background-size: 16px;
}

.bn-ocr input[type=file] {
  position: absolute;
  opacity: 0;
  top: -100px;
  cursor: pointer;
}

.ocr-result-close {
  position: absolute;
  right: 20px;
  top: 20px;
  font-size: 2em;
  font-weight: 200;
  color: #333;
}

.ocr-opened {
  overflow: hidden;
}

.ocr-upload-file {
  position: absolute;
  right: 20px;
  top: 65px;
  z-index: 1;
  font-size: 0;
  color: transparent;
  width: 16px;
  height: 16px;
  box-sizing: content-box;
  cursor: pointer;
  overflow:hidden;
  background: var(--upload-icon);
  background-size: 16px;
}

.ocr-img-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.ocr-img-wrapper.ocr-processing::after,
.ocr-img-wrapper.ocr-processing::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 100px;
  opacity: 0;
  border-bottom: 2px solid #222;
  clip-path: polygon(50% 0, 90% 0%,90% 50%, 10% 50%, 10% 0);
  transform: rotate(180deg);
  box-shadow: inset 0 0 50px #222, inset 0 0 0 5px #222;
  animation: scant 2s infinite;
}
.ocr-img-wrapper.ocr-processing::after {
  transform: rotate(0deg);
  animation: scanb 2s infinite;
  animation-delay: 1s;
}

@keyframes scant {
  from {
    top: -100px;
    opacity: .5;
  }
  to {
    top: calc(100% + 100px);
    opacity: 1;
  }
}

@keyframes scanb {
  from {
    top: 100%;
    opacity: .5;
  }
  to {
    top: -100%;
    opacity: 1;
  }
}
  
@media only screen and (max-width: 800px) {
  body {
    margin: 80px 20px;
    box-sizing: border-box;
  }
  img, svg {
    max-width: 80%;
  }
  .question-list {
    padding-top: 0;
  }
  .choice-options .option {
    max-width: 100%;
  }
  .question-calculation .question{
    width: 100%;
    min-height: 6em;
  }
  .question .space {
    width: .5em;
  }
  header .print {
    display: none;
  }
}


@media print {
  @page {
    size: auto;
    margin: 1cm 0;
  }
  body > header {
    display: none;
  }
  h1 {
    display: block;
  }
  .pagebreak + .question-calculation,
  .pagebreak + .question {
    margin-top: 1cm;
  }
  .question.selected::before {
    display: none;
  }
  body {
    font-size: 12px;
    margin-top: 0;
  }
}
