.wrapper {
  position: relative;
  /* 7 columns. */
  grid-template-columns: auto 1fr 1fr 2fr 1fr 1fr auto;
  /* 8 rows. */
  grid-template-rows: minmax(min-content, max-content) minmax(3rem, max-content) minmax(min-content, max-content) minmax(min-content, max-content) minmax(min-content, max-content) auto auto minmax(1rem, auto);
}

#heading {
  grid-column: 1 / span 7;
}

#messageWrapper {
  grid-column: 1 / span 7;
  grid-row: 2 / span 1;

  display: flex;
  justify-content: center;
}

#message {
  font-size: 1.2rem;
}

#calibrateWrapper {
  grid-column: 1 / span 7;
  grid-row: 3 / span 7;
}

#calibrateTop {
  display: flex;
  justify-content: center;
}

li {
  margin: 1rem;
}

#calibrateImg {
  width: 3rem;
  margin: 1rem;
}

#calibrateButtons {
  width: 100%;

  margin-top: 1rem;

  display: grid;
  grid-gap: 0;
  grid-template-columns: minmax(min-content, 10%) 1fr 1fr minmax(min-content, 10%);
  grid-template-rows: 1fr;
}

#calibrateRightButtons {
  display: flex;
  justify-content: flex-end;
}

#calibrateCancelButton,
#calibrateStartButton {
  height: 4.5rem;
  width: 6rem;

  margin: 0.5rem;
}

#rhythmWrapper {
  grid-column: 1 / span 7;
  grid-row: 3 / span 1;

  display: grid;
  grid-gap: 0;
  grid-template-columns: auto auto auto;
  grid-template-rows: 1fr;
}

#tapButtonWrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
}

#bar.retracted,
.space.retracted,
#barSpacePost.retracted {
  display: none;
}

div.bar {
  grid-column: 2 / span 1;
  grid-row: 1 / span 1;

  padding: 0;
  margin-bottom: 0.5rem;

  display: flex;
  justify-content: center;
}

.blankOrTapit {
  flex: 1 1 0;

  max-width: var(--width-rhythm-img);
  height: var(--height-rhythm-img);
}

.tapit,
.blank {
  background-color: var(--color-primary-fill);
}

.blank.lighter {
  background-color: var(--color-primary-light);
}

img.rhythmImgTapit {
  height: 80%;
  opacity: var(--rhythm-img-opacity);
}

img.smallRhythmImgTapit {
  opacity: 0.85;
  pointer-events: none;

  min-height: 1.6rem;
  max-height: 1.6rem;
}

.space {
  text-align: right;
}

#rollWrapper {
  grid-column: 2 / span 4;
  grid-row: 4 / span 1;
}

.roll.retracted {
  display: none;
}

.roll {
  border-left-style: solid;
  border-left-color: var(--color-emphasis-border);
  border-left-width: 0.12rem;

  background: linear-gradient(90deg, var(--color-primary-fill) 98%, var(--color-emphasis-border) 2%);
  background-size: var(--width-rhythm-img);

  margin-top: 0.5rem;
  height: 1rem;
  width: 100%;

  padding: 0;

  display: flex;
}

.blank {
  width: var(--width-rhythm-img);
}

.sound {
  height: 0.5rem;
  opacity: 0.75;
  background: var(--color-primary-text);
  box-shadow: inset -0.12rem 0 var(--color-primary-fill);
}

.dot {
  display: inline-block;
  height: 1rem;
  width: 1rem;
  background-color: var(--color-emphasis-fill);
  border-radius: 50%;
}

#questionRoll > div > .dot {
  opacity: 0.7;
  background-color: var(--color-primary-text);
}

.rest {
  flex-grow: 1;
}

.s2n {
  min-width: 200%;
  max-width: 200%;
}

.s4n {
  min-width: 100%;
  max-width: 100%;
}

.s8n {
  min-width: 50%;
  max-width: 50%;
}

.s16n {
  min-width: 25%;
  max-width: 25%;
}

#tapWrapper {
  grid-column: 2 / span 4;
  grid-row: 5 / span 1;
}

#tapButton.retracted {
  display: none;
}

#tapButton {
  margin-top: 1rem;
  border-radius: 50%;
  border-style: dotted;
  width: 9rem;
  height: 9rem;
  z-index: 998;

  user-select: none;
}

#tapButton.down {
  border-color: var(--color-primary-fill);
  background-color: var(--color-emphasis-fill);
  opacity: 0.7;
}

#tapButtonImg {
  opacity: 0.8;
  width: 3rem;
  height: 3rem;
  margin-bottom: 0.5rem;
}

#goal {
  font-size: 0.9rem;
  margin-top: 1rem;
}

#warmup {
  margin-top: 1rem;
}

.resultPart.retracted {
  display: none;
}

.accuracy {
  font-size: 0.8rem;
  margin-top: 0.2rem;
  margin-bottom: 1rem;
}

.scoreWords {
  margin: 0.5rem;
}

#score {
  margin-top: 1rem;
  font-size: 0.8rem;
}

#structureWrapper {
  grid-column: 2 / span 5;
  grid-row: 6 / span 1;
}

#buttonWrapper {
  grid-column: 1 / span 7;
  grid-row: 7 / span 1;

  display: grid;
  grid-gap: 0.5rem;
  grid-template-columns: auto auto;
}

#mainButtonWrapper {
  display: grid;
  grid-gap: 0.5rem;
  grid-template-columns: auto;
  grid-template-rows: auto;
}

#playButton,
#doneButton,
#nextButton {
  grid-column: 1 / span 1;
  grid-row: 1 / span 1;
}

#playButton,
#doneButton,
#setupButton,
#nextButton,
#calibrateButton {
  height: 4.5rem;
  width: 6rem;
}

#doneButton.down {
  background-color: var(--color-emphasis-border);
}

#debugWrapper {
  grid-column: 1 / span 7;
  grid-row: 8 / span 1;
}

#sourceVolume {
  display: grid;
  grid-gap: 0.5rem;
  /* 6 columns */
  grid-template-columns: auto auto auto auto auto auto;

  margin-top: 2rem;
}

.frameCount {
  grid-column: 1 / span 6;
}

.debugHead {
  font-weight: bold;
}

.debugTwoRest {
  grid-column: 2 / span 5;
}

.debugBeatOn {
  display: inline-block;
  background-color: var(--color-emphasis-fill);
  width: 6rem;
  margin-left: 0.5rem;
  margin-right: 0.5rem;
}

.debugBeatOff {
  display: inline-block;
  background-color: var(--color-primary-light);
  width: 6rem;
  margin-left: 0.5rem;
  margin-right: 0.5rem;
}

.debugUser {
  display: inline-block;
  background-color: var(--color-primary-light);
  width: 16rem;
}

.debugUserOn {
  display: inline-block;
  background-color: var(--color-emphasis-fill);
}

/* Override common.css because tapit block are fixed and small. */
.words.numbers {
  margin-left: 5%;
  font-size: 1rem;
  justify-content: flex-start;
}

.titleSection {
  font-weight: normal;
}
