body {
  max-width: 50em;
  margin: 0 auto 0 auto;
  counter-reset: tehtavasarja tehtava stack;
  font-family: "Georgia", FreeSerif, "Times New Roman", serif;
  font-size: 16pt;
  hyphens: auto;
  background-color: hsl(359, 71%, 43%);
}

p {
  margin: 0.7em 0;
}

ul {
  margin: 0.2em 0;
}

#preamble {
  display: none;
}

a:link {
  color: hsl(330, 85%, 55%);
}

a:visited {
  color: hsl(330, 60%, 30%);
}

header {
  background-color: hsl(147, 35%, 70%);
  margin: 0.5em 0;
  padding: 0 1em;
  border-style: solid;
  border-width: 1px;
  border-color: hsl(359, 71%, 43%);
  border-radius: 10px;
}

.tehtavasarja {
  padding: 0 1em;
  margin: 0.5em 0;
  border-style: solid;
  border-width: 1px;
  border-color: hsl(359, 71%, 43%);
  border-radius: 10px;
  background-color: hsl(147, 30%, 85%);
  overflow: auto;
}

.tehtavasarja:not(.ylimaarainen) h2::after {
  counter-increment: tehtavasarja;
  content: " " counter(tehtavasarja, upper-roman);
}

.tehtavalista {
  padding-left: 0em;
  list-style-type: none;
}

/*.tehtavalista > li:nth-child(odd) {
  background-color: hsl(300, 10%, 95%);
}*/

.tehtavalista > li {
  margin: 0.5em 0;
  padding: 0.5em;
  background-color: white;
  border-style: solid;
  border-color: hsl(359, 60%, 30%);
  border-width: 4px;
  transition: all 1s ease-in;
}

.tehtavalista > li::before {
  counter-increment: tehtava;
  content: counter(tehtava) ".12. ";
  font-weight: bold;
}

.tehtavateksti {
  transition: all 1s ease-in;
}

.tehtavateksti * {    /* MathJaxin divejä varten */
  transition: all 1s ease-in;
}

.vastaustaulu {
  table-layout: fixed;
  transition: all 1s ease-in;
}

.tehtavalista > li.avaamaton {
  background-color: hsl(359, 71%, 43%);
  cursor: pointer;
}

.tehtavalista > li.avaamaton:hover {
  box-shadow: 0 4px 8px 4px rgba(0, 0, 0, 0.4);
  transition: none;
}

.avaamaton .tehtavateksti {
  opacity: 0;
}

.avaamaton .tehtavateksti * {    /* MathJaxin divejä varten */
  opacity: 0;
}

.avaamaton .vastaustaulu {
  opacity: 0;
}

/*
.tahtitehtava::before {
  counter-increment: tehtava;
  content: "*" counter(tehtava) ". ";
  font-weight: bold;
}

.stacktehtava::before {
  counter-increment: stack;
  content: "S" counter(stack) ". ";
  font-weight: bold;
}*/

.tehtavalista > li > ol {
  list-style-type: lower-alpha;
}

.tehtavalista ol li {
  margin: 0.25em 0;
}

table {
  border-style: none;
  border-collapse: collapse;
  margin: 1em 0;
}

th, td {
  border-style: solid none;
  border-width: 1px;
  padding: 0.1em 0.5em;
}

table.reunaton th, td {
  border-style: none;
}

.ratkaisu {
  margin: 0.5em 0;  
}

.ratkaisu > ol {
  list-style-type: lower-alpha;
}

.ratkaisu img {
  margin: 1em;
}

@media only screen and (max-width: 640px) {

  h1 {
    font-size: 1.8em
  }

  body {
    font-size: 10pt;
  }
  
  .tehtavasarja {
    padding: 0 0.6em;
  }
  
  .vastaustaulu input[type=text] {
    width: 13em;
  }
}

@media only print {

  body {
    background: white;
    font-size: 11pt;
    font-family: "Latin Modern Roman", Georgia, FreeSerif, "Times New Roman", serif;
  }
  
  p, li {
    line-height: 1.3;
  }

  header {
    background: white;
    border-radius: 0;
    border-style: solid none solid none;
    border-width: 1px;
    color: #444444;
    /*padding: 0;*/
  }
  
  #pdf_linkki {
    display: none;
  }
  
  .tehtavasarja {
    margin: 0;
    padding: 0;
  }
  
  .tehtavasarja h2 {
    margin: 0.3em 0;
  }
  
  .tehtavalista > li {
    padding: 0.3em;
  }
  
  .tehtavalista > li:nth-child(odd) {
    background: white;
  }
  .tehtavalista > li:nth-child(even) {
    background: white;
  }

  .tehtavalista ol {
    page-break-before: avoid;
  }
  
  body a:link, a:visited {
    text-decoration: none;
    color: black;
  }
}