* {
  box-sizing: border-box;
}

#outer {
  --height-header: 2.5rem;
  --height-message: 2rem;
  --height-ok: 3.5rem;

  min-height: auto;
  min-height: 100dvh;
}

#outer.outer2d {
  min-height: auto;
}

#heading {
  grid-template-rows: var(--height-header);
  z-index: 3;
}

#setupWW {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  min-height: 100vh;
  max-height: 100vh;
  height: 100vh;
  overflow: hidden;
  background-color: var(--color-primary-light);

  display: flex;
  justify-content: center;
}

#setupWW.twod {
  border-radius: 1rem;
}

#setupWWUnder {
  height: calc(var(--height-header) + 0.5rem);
  min-height: calc(var(--height-header) + 0.5rem);
  max-height: calc(var(--height-header) + 0.5rem);
}

#setupW {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#messageWrapper {
  height: 3rem;

  display: flex;
  justify-content: center;
  align-items: center;
}

#appWrapper.resizing > #messageWrapper {
  opacity: 0.6;
}

#message {
  font-size: 1.2rem;
}

.rhythmWrapper {
  width: 100%;
}

div.bar {
  position: relative; /* for guideBar */
  padding: 0;
  margin-bottom: 0.5rem;

  display: flex;
}

div.bar.staff {
  margin-bottom: 0;
}

.beat,
.barEnd,
.barStart {
  padding: 0;
  margin-left: 0;
  margin-right: 0;
  border-bottom: 0.4rem solid var(--color-transparent);

  flex: 2;

  display: flex;
}

.beat {
  position: relative; /* for .pinB */
  background-color: var(--color-primary-fill);
  height: auto;
}

.beat.halfBeat {
  flex: 1;
}

.beat.blankAfterOneBeatRhythm {
  flex: 0;
}

.beat.editing {
  border-bottom: 0.4rem dotted var(--color-secondary-text);
}

.beat.systemStaff,
.beatFixer.systemStaff,
.beat.systemLine,
.beatFixer.systemLine {
  background-color: var(--color-transparent);
}

.beat.systemWords {
  height: min-content;
  padding-top: 0.5rem; /* space for the pin */
}

.beat.halfBeat.hbi > .beatFixer > svg.svgWords {
  transform: translateX(50%);
  background-color: transparent; /* else covers next */
}

.beat.halfBeat.hbi {
  flex: 2;
}

.beat.halfBlank.hbi {
  flex: 0;
}

.pinB {
  display: none;

  cursor: pointer;

  padding: 0;
  opacity: 0.5;
  width: 20%;
  max-width: 1.3rem;

  position: absolute;
  top: 0.2rem;
  left: 0;

  background-color: var(--color-primary-light);
  border-color: var(--color-emphasis-border);
}

.beat.halfBeat > .pinB {
  width: 40%;
}

.pinB.pinned {
  justify-content: flex-end;
}

.pinImg {
  user-select: none;
  width: 90%;
}

.beat.clickable > .pinB {
  display: flex;
}

.beat.clickable > .pinB.pinned {
  opacity: 1;
  border: none;
}

.beat[data-name="blankButton"] > .pinB {
  display: none;
}

.beatSpacer.systemStaff,
.beatFixer.systemStaff,
.beatSpacer.systemLine,
.beatFixer.systemLine,
.barEnd {
  background-position: center;
  background-size: auto 100%;
}

.beatSpacer.systemStaff,
.beatFixer.systemStaff {
  background-image: url("/static/131/images/stafflines.svg");
  background-repeat: repeat;
}

.beatSpacer.systemLine,
.beatFixer.systemLine {
  background-image: url("/static/131/images/staffline.svg");
  background-repeat: repeat;
}

.barEnd {
  background-image: url("/static/131/images/barline.svg"), url("/static/131/images/stafflines.svg");
  background-position: right, center;
  background-repeat: no-repeat, repeat;

  flex: 0.1;
}

.barEnd.systemLine {
  background-image: url("/static/131/images/barlineLine.svg"), url("/static/131/images/staffline.svg");
}

.barEnd.phraseEnd {
  background-image: url("/static/131/images/barline.svg"), url("/static/131/images/barlineEnd.svg"), url("/static/131/images/stafflines.svg");
  background-position: left, right, center;
  background-repeat: no-repeat, no-repeat, repeat;
}

.barEnd.phraseEnd.systemLine {
  background-image: url("/static/131/images/barlineLine.svg"), url("/static/131/images/barlineEndLine.svg"), url("/static/131/images/staffline.svg");
}

.barStart {
  flex: 1;
}

.beatSpacer {
  flex: 0.3;
}

.beatSpacer.clef {
  flex: 0.1;
}

.beatSpacer.appWords {
  flex: 0;
}

.beatFixer {
  /* height: 100%; */
  display: flex;
  align-items: center;
  justify-content: center;

  flex: 1;
}

.beatFixer.systemLine {
  align-items: flex-end;
}

div.timeSignature {
  /* height: 100%; */
  width: 50%;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  /*
  display: grid;
  grid-gap: 0;
  grid-template-columns: auto;
  grid-template-rows: 1fr 1fr;
  */
}

div.timeSignatureNum.top {
  margin-top: auto;
}

.timeSignatureNum {
  display: flex;
  flex-direction: column;

  font-weight: bold;
  margin-top: 0;
  margin-left: 0;
  margin-right: 0;
}

.timeSignatureNumTop {
  flex-direction: column-reverse;
  margin-bottom: 15%;
}

img.timeSignature {
  /* height: 40%; */
  padding-top: 30%;
  padding-bottom: 30%;

  padding-left: 20%;
}

img.phraseEnd {
  margin-left: 0.3rem;
}

img.barSymbol {
  display: flex;
}

img.timeSignature,
img.barSymbol {
  opacity: var(--rhythm-img-opacity);
  pointer-events: none;
}

.barStartClef {
  box-sizing: border-box;
  opacity: var(--rhythm-img-opacity);

  padding: 20%;
}

.barStartClef.gClef {
  padding: 0;
}

.systemLine > .barStartClef {
  padding-bottom: 10%;
}

img.rhythmImgGen {
  box-sizing: border-box;
  user-select: none;

  opacity: var(--rhythm-img-opacity);
  pointer-events: none;

  display: flex;

  /* bg images are for container holding a 60% height rhy img */
  /* Want top,bot padding 20% of container == 3 parts of image + 2 parts margin. */
  padding: 20%;
  /*
  padding-left: 33.3%;
  padding-right: 33.3%;
  padding-top: 20%;
  padding-bottom: 20%;
  */
  width: 100%;
  /*
  padding-top: 20%;
  padding-bottom: 20%;
  width: 60%;
  */
  /*
  height: 60%;
  width: 100%;
  */
}

.halfBeat > .beatFixer > img.rhythmImgGen {
  padding-top: 40%;
  padding-bottom: 40%;
}

.beat.halfBeat.hbi > div > img.rhythmImgGen {
  padding: 20%;
  transform: translateX(50%);
}

img.rhythmImgGen[alt="One Half Rest"],
img.rhythmImgGen[alt="One Whole Rest"] {
  padding-top: 40%;
  padding-bottom: 0;
}

img.rhythmImgGen.clef {
  width: 40%;
  padding-right: 10%;
}

.beatButton {
  width: 100%;
}

#generateWrapper {
  margin-top: 1rem;
  width: 100%;

  display: flex;
  justify-content: space-between;
}

#buttonsLeftWrapper {
  display: block;
}

#buttonsLeft {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-items: flex-start;
}

#buttons {
  flex-wrap: wrap;

  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
}

#setupButton {
  margin-right: 0.5rem;
  margin-bottom: 0.5rem;
}

#playButtonWrapper {
  display: flex;
  justify-content: center;
  flex-direction: column;
  align-items: center;

  margin-right: 0.5rem;
}

#bothButtons {
  display: flex;
}

#practiceButton {
  margin-right: 0.5rem;
}

#playButton {
  margin-right: 0;
}

#loop {
  cursor: pointer;
  opacity: 0.8;
  width: 2.75rem;
  padding: 0.25rem;
  margin-top: 0.3rem;
  margin-bottom: 0.3rem;
  border: none;
  display: flex;
}

#loop.disabled {
  pointer-events: none;
  opacity: 0.3;
}

.loopImg {
  user-select: none;
  pointer-events: none;
  max-width: 100%;
}

.loopImg.off {
  display: none;
}

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

#editorWrapper {
  margin-top: 0.2rem;
  width: 100%;
}

#editorToggleW {
  width: 100%;
  margin-top: 0;
  display: flex;
}

#editorToggle {
  border: 0.15rem solid var(--color-primary-border);
  background-color: var(--color-primary-fill);
  border-radius: 0.3rem;

  padding: 0.4rem;
  cursor: pointer;
  display: flex;

  justify-content: center;
  align-items: center;
}

#editorToggle.opened {
  font-weight: bold;
  font-size: 1.2rem;
}

#editor {
  padding-top: 0.5rem;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
}

#wrapper.retracted,
#setupWW.retracted,
#buttonsLeft.retracted,
#editor.retracted {
  display: none;
}

.clickable {
  cursor: pointer;
}

#infoDropToplink {
  position: absolute;
  top: var(--height-ok);
  background-color: var(--color-primary-light);
  z-index: 4;
  margin-left: 0;
}

#infoDropLink {
  left: 0;
}

#infoDropLinkWrapper {
  margin-top: 0.5rem;
}

.editImg {
  user-select: none;
  width: 1.4rem;
  height: 1.4rem;
  margin: 0;
  transform: scale(-1, 1);
}

#editorToggle.opened > .editImg {
  width: 1.8rem;
  /* For epiphany, else too high. */
  height: 1.8rem;
}

/* setup */

#controlsWW {
  width: 100%;
  min-height: calc(100vh - var(--height-header) - var(--height-message) - var(--height-ok));
  max-height: calc(100vh - var(--height-header) - var(--height-message) - var(--height-ok));
  height: calc(100vh - var(--height-header) - var(--height-message) - var(--height-ok));
  overflow-y: scroll;

  padding: 0 0 0 0;
  border-top: 0.24rem solid var(--color-primary-fill);

  display: flex;
  flex-direction: column;
  align-items: center;
}

#setupWW.twod > #setupW > #controlsWW {
  min-height: auto;
}

label {
  margin-left: 0.5rem;
}

input[type="radio"] {
  margin-left: 1rem;
}

input.formNumber {
  font-size: 1.3rem;
  width: 4rem;
  padding: 0.2rem;
  background-color: var(--color-primary-fill);
  text-align: right;
  margin-top: 0.5rem;
}

#okW {
  position: relative; /* for #infoDropToplink */
  width: 100%;
  height: var(--height-ok);
  max-width: 50rem;
  padding: 0.5rem;
  display: flex;
}

#instrument {
  font-size: 1rem;
  padding: 0.2rem;
  margin-top: 0.5rem;
}

#bpwRadios,
#beatsPerBarRadios,
#beatGuideRadios,
#systemRadios {
  font-size: 1rem;
  padding: 0.2rem;
  margin-top: 0.5rem;
}

#controlsW {
  padding: 0 0.5rem 0 0.5rem;
  width: 100%;
  max-width: 100%;
  height: 100%;
  min-height: 100%;

  display: grid;
  grid-template-rows: minmax(min-content, max-content) minmax(3rem, auto) minmax(min-content, max-content) minmax(3rem, auto);
  grid-template-columns: 1fr;
}

#optionsW {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 0.5rem;
}

#linkIcon {
  height: 100%;
}

#rightButtonWrapper {
  float: right;

  width: 6rem;
  margin-left: auto;
  margin-right: 0.5rem;
  margin-bottom: 0.5rem;
}

#ready {
  font-size: 1.5rem;
  margin-left: auto;
  margin-right: 0.6rem;
  background-color: var(--color-primary-light);
  display: flex;
  justify-content: flex-end;
  text-align: right;
  align-items: center;
}

/* ok button */
#startButton {
  height: 100%;
  width: 6rem;
  text-align: center;
}

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

#saveButton {
  height: 100%;
  width: 4rem;
}

#saveButtonEd {
  margin-top: 0.5rem;
}

#rhythmsWrapper {
  display: grid;
  grid-gap: 0.5rem;
  /* 1 column. */
  grid-template-columns: 1fr;
  /* 2 rows. */
  grid-template-rows: 1.5rem minmax(min-content, max-content);
}

#rhythmsHeading {
  grid-column: 1 / span 1;
  grid-row: 1 / span 1;
}

.rhythmButton {
  background-color: var(--color-primary-fill);

  display: flex;
  align-items: center;
  justify-content: center;
}

.subheading {
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
}

.setupPitchButtonGroup {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
}

.pitchButton {
  font-size: 1.2rem;
  padding: 4rem 0.25rem 0.5rem 0.25rem;
  margin: 0.2rem;
}

.pitchButton.black {
  font-weight: bold;
  padding: 2.5rem 0.25rem 0.5rem 0.25rem;
}

#genreButtonWrapper {
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  align-items: center;
}

.genreButton {
  min-width: 4rem;
  max-width: max-content;
  height: 2rem;
  padding: 1.5rem;

  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
}

.toggleBeats {
  min-width: 4rem;
}

#rhythmsWrapper.retracted,
.retracted {
  display: none;
}

#bottomW {
  width: 100%;
  max-width: 100%;
  height: 100%;
  background-color: var(--color-primary-fill);

  display: flex;
  justify-content: center;
}

#bottom {
  width: 100%;
  max-width: 50rem;
  padding: 0 0.5rem 0.5rem 0.5rem;

  display: flex;
}

#bottomLeft {
  font-size: 0.85rem;

  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

#bottomLeft > a {
  padding-top: 0.5rem;
}

#bottomRight {
  margin-left: auto;

  display: flex;
  flex-direction: column;
}

#bpbSig {
  user-select: none;
}

.toggleSystem.disabled {
  opacity: 0.3;
}

#bpwRadios {
  display: flex;
}

#beatEquationW {
  margin-left: 0.5rem;
  display: flex;
  align-items: center;
}

#beatEquation {
  display: flex;
  align-items: flex-end;
}

#oneBeat {
  margin-right: 0.5rem;
}

#bpwNote {
  width: 2rem;
}

.iconButton {
  /* hack so fits on min gen size in 2d */
  width: 5rem;
}

#ttButton {
  margin-top: 0.5rem;
  margin-bottom: 1rem;
}

#tgButton {
  margin-bottom: auto;
}
