@keyframes fade-in {
  0% {
    opacity: 0.001;
  }
  99.9% {
    opacity: 1.0;
  }
  100% {
    opacity: inherit;
  }
}

@keyframes fade-out {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}


#head {
  background-color: black;
  font-size: xx-large;
  animation: fade-in ease .3s;
  display: grid;
  grid-template-columns: 1fr 2ex;
  grid-gap: 10px;
  margin-bottom: 10px;
}

#head > a {
  text-decoration: none;
}

#logo {
  grid-column-start: 1;
  grid-column-end: 3;
  grid-row: 1;
}

#q {
  grid-column-start: 1;
  grid-column-end: 3;
  grid-row: 2;
}

body.data-loading #q,
body.data-loading #gear {
  opacity: 0.001;
}
body:not(.data-loading) #q,
body:not(.data-loading) #gear {
  animation: fade-in ease .5s;
}

#gear {
  display: none;
  grid-column-start: 2;
  grid-column-end: 3;
  grid-row: 2;
}

#hints {
  grid-column-start: 1;
  grid-column-end: 3;
  grid-row: 3;
  overflow: hidden;
  white-space: nowrap;
}

body._pinnedToTop ul {
  margin-top: 156px;
}

@media (min-width: 560px) {
  #q {
    grid-column-start: 1;
    grid-column-end: 2;
  }

  #gear {
    display: inline-block;
    color: white;
    cursor: pointer;
  }
}

@media (min-width: 750px) {
  body._pinnedToTop ul {
    margin-top: 146px;
  }
}

@media (min-width: 980px) {
  body._pinnedToTop ul {
    margin-top: 91px;
  }

  #head {
    grid-template-columns: 450px 1fr 2ex;
    grid-template-rows: 44px 1fr 1fr;
  }

  #logo {
    grid-column-start: 1;
    grid-column-end: 2;
    grid-row-start: 1;
    grid-row-end: 3;
  }

  #q {
    grid-row-start: 2;
    grid-row-end: 3;
    grid-column-start: 2;
    grid-column-end: 3;
  }

  #gear {
    grid-row-start: 2;
    grid-row-end: 3;
    grid-column-start: 3;
    grid-column-end: 4;
  }

  #hints {
    grid-row: 3;
    grid-column-start: 1;
    grid-column-end: 4;
  }
}

@media (min-width: 100px) {

  body._pinnedToTop #head {
    grid-template-columns: minmax(200px, auto) 230px;
    grid-template-rows: 1fr;
    padding-top: 10px;
    padding-bottom: 10px;
    z-index: 1;
  }

  body._pinnedToTop #logo {
    grid-row-start: 1;
    grid-row-end: 1;
    grid-column-start: 2;
    grid-column-end: 3;
    text-align: right;
  }

  body._pinnedToTop #q {
    grid-row: 1;
    grid-column-start: 1;
    grid-column-end: 2;
  }

  body._pinnedToTop #gear,
  body._pinnedToTop #hints {
    display: none;
  }
}

#head._moving {
  opacity: 0;
  animation: fade-out ease .2s;
}

#head:not(._moving) {
  opacity: inherit;
}

#head._pinnedToTop {
  animation: fade-in ease .3s
}

#head h1 {
  color: #555;
  font: 26vw/21vw courier, monospace;
  margin: 0;
  padding: 0;
  max-width: 500px;
}

@media (min-width: 400px) {
  #head h1 {
    font-size: 100px;
    line-height: 110px;
    margin-top: -10px;
  }
}

#head._pinnedToTop h1 {
  display: inline-block;
  font: 6vw courier, monospace;
  color: #aaa;
  margin-bottom: -3px;
}

@media (min-width: 600px) {
  #head._pinnedToTop h1 {
    font-size: 36px;
  }
}

#head h2 {
  display: none;
  animation-duration: 3s;
  animation-timing-function: ease-in;
  animation-iteration-count: 1;
  animation-name: fade-in;
}

@media (min-width: 400px) {
  #head h2 {
    display: block;
    margin-left: 7px;
    margin-top: -21px;
    color: #aaa;
    font: 22px/22px ImpactLabelReversedRegular, verdana;
    max-width: 500px;
  }

  #head._pinnedToTop h2 {
    display: none;
  }
}

#head input {
  background-color: #333333;
  color: #FFFFFF;
  font: xx-large/1.4 courier, monospace;
  padding: 0 8px;
  border: none;
}

#head input:focus-visible,
#head select:focus-visible {
  outline-color: yellow;
}

#head select {
  width: 11ex;
}

#head > p {
  font: medium courier, monospace;
  padding: 10px 2px 0 0;
  color: #999;
}

#head p a,
#head p a:link,
#head p a:visited,
#head p a:active {
  position: relative;
  display: inline-block;
  color: #ccc;
  text-decoration: none;
  line-height: 1.4;
  width: 28px;
  height: 28px;
  padding: 0;
  font-size: 20px;
  border-radius: 50%;
  border: 2px solid transparent;
  background-clip: content-box;
  transition: transform 0.3s ease, border 0.2s ease;
  text-align: center;
  margin: 0 -8px 3px -8px;
}
#head p a:first-child,
#head p a:link:first-child,
#head p a:visited:first-child,
#head p a:active:first-child {
  width: auto;
  padding: 0 2px;
  margin-right: 0;
  border-radius: 2px;
  margin-left: 5px;
}

#head p a:hover {
  background-color: #000;
  color: white;
  border: 2px solid white;
  transform: scale(1.2);
  z-index: 1000;
}

#head p a:hover:first-child {
  transform: inherit;
}


@media (min-width: 750px) {

  #head._pinnedToTop h2 {
    display: block;
    margin-top: 3px;
    font: 14px/14px ImpactLabelReversedRegular, verdana;
  }

  #head._pinnedToTop input {
    width: 66vw;
  }

}

@media (min-width: 1140px) {
  #head h1 {
    color: #fff;
  }
}

