body {
  margin-bottom: 112px; /* #controls height + 10px */
}

button {
  margin: 10px 8px;
  padding: 10px 18px;
  font-size: 18px;
  background: #cce;
  border: none;
  border-radius: 6px;
  box-shadow: 2px 2px 5px #aaa;
  cursor: pointer;
}

button:hover {
  background: #bbd;
}

button:disabled,
button:disabled:hover {
  background: #ccc;
  cursor: default;
}

h1 {
  font-size: 24px;
  text-align: center;
  color: #999;
}

h1 > a {
  color: #a9c;
}

#direction-control {
  display: inline-block;
  margin: 10px;
  padding: 7px 8px 7px 0;
  background: #eee;
  border-radius: 6px;
  box-shadow: inset 2px 2px 5px #aaa;
}

#direction-control > button {
  display: inline-block;
  padding: 6px 12px;
  font-size: 14px;
  background: #dce;
  border: none;
  margin: 0 0 0 8px;
  box-shadow: 2px 2px 5px #aaa;
}

#direction-control > button:hover {
  background: #cbd;
}

#direction-control > button.active,
#direction-control > button.active:hover {
  background: #a9c;
  color: #fff;
  box-shadow: inset 1px 1px 2px #999;
}

#controls {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 100px;
  border-top: 2px solid #ccc;
  background: #f9f9f9;
  text-align: center;
}

#controls button {
  display: inline-block;
}

button#next-button {
  width: 150px;
  background: #66a;
  color: #fff;
}

button#next-button:hover {
  background: #99c;
}

.note {
  display: none;
}

.note.question, .note.answer, #finished {
  display: block;
  position: relative;
  margin: 0 auto;
  min-height: 400px;
  width: 600px;
  text-align: center;

  /* Flash card to make it clear that it’s new. */
  opacity: 1;
  transition: opacity 0.3s;
  @starting-style {
    opacity: 0;
  }
}

#finished {
  display: none;
  line-height: 400px;
  font-size: 24px;
}

.note video, .note img {
  display: block;
  max-width: 100%;
  margin: 0 auto;
}

.note > .more {
  padding: 0 25px;
  background: #eee;
  border: 1px solid #ccc;
  border-top: none;
  overflow: hidden; /* Contain margins */
  min-height: 1em; /* If empty, we need to maintain margin for answer */
}

.note.question > .more {
  display: none;
}

.cards {
  display: flex;
  flex-direction: column;
  border: 1px solid #ccc;
  background: #eee;
}

.note.media-first > .cards {
  flex-direction: column-reverse;
}

.note.answer > .cards {
  border-bottom: none;
}

.cards > h3 {
  margin: 0;
}

.cards > .media {
  /* Don’t display scroll bars on page if this hangs off the end when hidden: */
  overflow: hidden;
}

.note.text-first > .cards > h3,
.note.media-first > .cards > .media {
  background: #fff;
}

.metadata {
  display: none;
}

/* Make question area bigger for text questions */
.note.text-first.question > .cards > h3 {
  padding: 200px 25px;
}

.note.text-first.question > .cards > .media {
  height: 0;
  padding: 0;
  visibility: hidden;
}

.note.text-first.answer > .cards > h3 {
  padding: 25px;
  transition: padding 0.1s;
}

.note.text-first.answer > .cards > .media {
  padding: 25px 0;
  padding-bottom: calc(25px - 1em);
  transition: height 0.1s;
  transition: padding 0.1s;
}

/* Make question area bigger for media questions */
.note.media-first.question > .cards > .media {
  padding: 50px 0;
}

.note.media-first.question > .cards > h3 {
  padding: 0;
  height: 0;
  visibility: hidden;
}

.note.media-first.answer > .cards > .media {
  padding: 25px 0;
  transition: padding 0.1s;
}

.note.media-first.answer > .cards > h3 {
  padding: 25px;
  padding-bottom: calc(25px - 1em);
  transition: height 0.1s;
  transition: padding 0.1s;
}

@media (max-width: 600px) {
  body {
    margin-left: 0;
    margin-right: 0;
  }

  .note.question,
  .note.answer,
  #finished {
    width: 100%;
  }

  .cards, .note > .more {
    border: none;
  }

  .note.text-first.question > .cards > .media,
  .note.text-first.answer > .cards > .media,
  .note.media-first.question > .cards > .media,
  .note.media-first.answer > .cards > .media {
    padding: 0;
  }
}
