:root {
  --img-max-height: 300px;
  --img-max-width: 660px;
}

#exercise{
  touch-action: manipulation;
}

#exercise .overlayLayerImage {
  /* override exercise.css */
  display: block;
}

#exercise #question-frame {
  border-radius: 3px;
  background-color: white;

  padding: 10px 30px;
  margin: 40px 0 10px;
}

#exercise #question-wrapper {
  display: flex;
  flex-direction: column;
  justify-content: stretch;
}

#exercise #title:empty,
#exercise #translation:empty,
#exercise #topic:empty {
  display: none;
}

#exercise #title {
  font-size: 28px;
  font-weight: 500;
  margin: 20px 0 10px;
  line-height: 1.3;
}

#exercise #topic {
  font-size: 16px;
  margin-top: 10px;
}

#exercise #translation {
  margin-top: 15px;
  font-size: 20px;
  color: var(--grayHover);
}

.control-panel {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;

  margin: 10px 5px;
  gap: 5px;
}


/*************** SIRKA RAMECKU ***************/

#exercise.small {
  max-width: 650px;
}
#exercise.normal {
  max-width: 780px;
}
#exercise.large {
  max-width: 1050px;
}

/*************** QUESTION ***************/

#exercise #question {
  font-size: 24px;
  line-height: 1.3;
}

#exercise #question-content {
  max-width: 100%;
  margin: 20px 0;
}

#exercise #question .emphasis{
  color: var(--gray );
  font-style: italic;
}

#exercise #question img {
  cursor: pointer;
}

.drawing #exercise #question img {
  pointer-events: none;
}

/*************** INPUT BOXES ***************/

#exercise .box.inline {
  display: inline-block;
  margin: 5px;
}

#exercise .box.newline {
  display: block;
  margin: 10px 0;
}

#exercise .box.separate {
  display: block;
  margin: 25px 0;
  text-align: center;
}

#exercise .box.separate:last-child {
  margin-bottom: 0;
}

#exercise .box .input {
  position: relative;
  display: inline-block;
}

#exercise .box input,
#exercise .box .solution {
  display: inline-block;
  line-height: 1.3;
  padding: 2px 5px;

  border-radius: 3px;
  border-width: 1px;
  border-style: solid;
}

#exercise .box input {
  min-width: 3em;
  margin: 0;

  font-size: 24px;
  color: var(--black);
  border-color:var(--lightGrayHover);
}

#exercise .box input:focus {
  border-color: var(--blue);
}

#exercise .box input.unanswered {
  animation: var(--animation-shake);
}

#exercise .box.large input {
  width: 17em;
}
#exercise .box.large .solution {
  max-width: 17em;
}
#exercise .box.medium input {
  width: 10em;
}
#exercise .box.medium .solution {
  max-width: 10em;
}
#exercise .box.small input {
  width: 7em;
}
#exercise .box.small .solution {
  max-width: 7em;
}
#exercise .box.tiny input {
  width: 3em;
}
#exercise .box.tiny .solution {
  max-width: 3em;
}

#exercise .box .solution:empty {
  opacity: 0;
  max-width: 0;
  overflow: hidden;
  padding: 0;
}

#exercise .box .solution {
  border-color: var(--greenHover);
  position: relative;

  white-space: nowrap;
  vertical-align: top;

  opacity: 1;
  transition-property: opacity, max-width;
  transition-duration: 250ms;
  transition-delay: 250ms;
  transition-timing-function: ease-in;
}

#exercise .box .solution::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--green);
  opacity: .1;
}


/*************** CORRECT AND WRONG ***************/

#exercise .box .input::after {
  position: absolute;
  right: 5px;

  height: 100%;
  width: 1em;

  background-position: center;
  background-size: 1em 1em;
  background-repeat: no-repeat;
}

#exercise .box.correct input,
#exercise .box.wrong input {
  padding-right: calc(1em + 5px);
}

#exercise .box.correct {
  animation: var(--animation-pulse);
}

#exercise .box.correct input {
  border-color: var(--greenHover);
}

#exercise .box.correct .input::after {
  content: '';
  background-image: url("https://umimeto.org/asset/global/img/correct-green.svg"); /* preloaded */
}

#exercise .box.wrong {
  animation: var(--animation-shake);
}

#exercise .box.wrong input {
  border-color: var(--redHover);
}

#exercise .box.wrong .input::after {
  content: '';
  background-image: url("https://umimeto.org/asset/global/img/wrong-red.svg"); /* preloaded */
}

#exercise .box .input::before {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  opacity: 0.1;
  border-radius: 3px;

  pointer-events: none;
}

#exercise .box.correct .input::before {
  content: '';
  background-color: var(--green);
}

#exercise .box.wrong .input::before {
  content: '';
  background-color: var(--red);
}


/*************** EXPLANATION ***************/
#explanation {
  margin-bottom: 20px;
}


/*************** CALCULATOR ***************/

#calculator {
  margin: 20px 0;
  display: flex;
  justify-content: center;
}

#calculator .calculator {
  background-color: white;
  padding: 15px;
  border-radius: 3px;
}

#calculator .button {
  background-color: var(--lightGrayHover);
  color: var(--blue);
}

#calculator .button:hover,
#calculator .button:focus {
  background-color: var(--gray);
  color: var(--blueHover);
}

#calculator .button.number,
#calculator .button[data-special=DSP] {
  color: var(--black);
}

#calculator .button[data-special=RES] {
  background-color: var(--blue);
  color: white;
}

#calculator .button[data-special=RES]:hover,
#calculator .button[data-special=RES]:focus {
  background-color: var(--blueHover);
}

#calculator .button[data-special=CLR] {
  color: var(--red);
}


/*************** WHITE SCREEN ***************/

#exercise.whiteScreen #question-frame {
    padding: 0 10px;
    margin-top: 20px;
}

/*************** DRAWING CANVAS ***************/
#content, #question-frame {
  position: relative;
}

#canvas-buttons {
  position: absolute;
  bottom: 5px;
  right: 5px;
  cursor: pointer;
}

.drawing-button {
  width: 20px;
  height: 20px;
}

.drawing-overlay {
  position: absolute;
  top: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.drawing-button:hover,
.drawing-button.selected {
  filter: invert(45%) sepia(25%) saturate(1997%) hue-rotate(167deg) brightness(89%) contrast(80%);
}


/*************** MOBILE SCREEN ***************/
@media screen and (pointer: coarse) {
  .drawing-button {
    width: 30px;
    height: 30px;
  }
}