pablorc/snaaake

View on GitHub
www/main.css

Summary

Maintainability
Test Coverage
@import url('https://fonts.googleapis.com/css?family=Share+Tech+Mono');

.u-text-align-right {
  text-align: right;
}

.u-hidden {
  display: none;
}

:root {
  --primary: #333;
  --background: rgb(154, 197, 3);
  --background-transparent: rgba(154, 197, 3, 0.7);
  --snake-part-size: 15px;
}

body {
  background-color: var(--background);
}

.game {
  align-items: center;
  display: flex;
  flex-direction: column;
  margin: 0 auto;
  width: calc(750px + var(--snake-part-size) * 2);

  color: var(--primary);
  font-family: 'Share Tech Mono', monospace;
}

.game__title {
  font-size: 50px;
  letter-spacing: 1px;
}

.game__score {
  align-self: flex-start;
  border-bottom: var(--snake-part-size) solid var(--primary);
  margin-bottom: var(--snake-part-size);
  width: 100%;

  font-size: 30px;
}

.game__info {
  display: flex;
  width: 100%;
}

.game__info__area {
  flex-grow: 1;
}

.maze {
  position: relative;

  border: var(--snake-part-size) solid var(--primary);
}

.snake__body {
  height: var(--snake-part-size);
  position: absolute;
  width: var(--snake-part-size);

  background-color: var(--primary);
}

.food {
  height: var(--snake-part-size);
  position: absolute;
  width: var(--snake-part-size);

  background-color: var(--primary);
  transform: rotate(45deg) scale(0.5);
}

.highscores {
  padding: 0;

  list-style-type: none;
  text-align: right;
}

.highscores__highscore{
  line-height: 1.5em;
  text-align: right;
}

.highscores__highscore:first-child {
  font-size: 1.6em;
}

.highscores__highscore:nth-child(2) {
  font-size: 1.3em;
}

.highscores__highscore:nth-child(3) {
  font-size: 1.1em;
}

.window {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40%;
  padding: 20px 0;

  background-color: var(--primary);
  color: var(--background);
  text-align: center;
}

.window__title {
  margin-top: 0;
}

.window__input {
  border: 0 none;
  font-family: 'Share Tech Mono', monospace;
  outline: 0;
  padding: 4px;
  width: 50px;
  color: var(--background);

  background-color: transparent;
  text-transform: uppercase;
  font-size: 1em;
  border: 1px solid var(--background);
  text-align: center;
}

.window__send {
  border: 0;
  display: inline;
  background: transparent;
  margin-left: 5px;
  color: var(--background);

  font-size: 1em;
  font-family: 'Share Tech Mono', monospace;
}

.window__send:after {
  content: '>>';
}