:root {
  --blue: #4285f4;
  --red: #ea4335;
  --yellow: #fbbc04;
  --green: #34a853;
  /* Four more bean colours, so a crowd of 20 isn't five identical blue beans. */
  --purple: #a142f4;
  --pink: #f538a0;
  --teal: #12b5cb;
  --orange: #fa7b17;
  --ink: #16181d;
  --paper: #f6f7fb;
  --shadow: 0 6px 0 rgba(0, 0, 0, 0.25);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  overscroll-behavior: none;
  touch-action: manipulation;
}

button {
  font: inherit;
  font-weight: 800;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: #fff;
  padding: 0.7em 1.4em;
  box-shadow: var(--shadow);
  cursor: pointer;
}

button:active {
  transform: translateY(3px);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.25);
}

.hidden {
  display: none !important;
}

/* A bean: capsule body, two eyes. */
.bean {
  position: relative;
  width: var(--size, 56px);
  height: calc(var(--size, 56px) * 1.25);
  border-radius: 999px;
  border: 3px solid var(--ink);
  background: var(--bean, var(--blue));
  box-shadow: inset 0 -8px 0 rgba(0, 0, 0, 0.12);
}

.bean::before,
.bean::after {
  content: "";
  position: absolute;
  top: 28%;
  width: 16%;
  height: 16%;
  border-radius: 50%;
  background: var(--ink);
}

.bean::before {
  left: 26%;
}

.bean::after {
  right: 26%;
}

.bean.out {
  filter: grayscale(1);
  opacity: 0.45;
}

.zone {
  position: relative;
  border: 4px solid var(--ink);
  border-radius: 22px;
  background: var(--zone);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0.6em;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.3);
  transition: opacity 0.35s, transform 0.35s;
}

.zone[data-zone="0"] {
  --zone: var(--blue);
}
.zone[data-zone="1"] {
  --zone: var(--red);
}
.zone[data-zone="2"] {
  --zone: var(--yellow);
}
.zone[data-zone="3"] {
  --zone: var(--green);
}

.zone.wrong {
  opacity: 0.25;
  transform: scale(0.96);
}

.zone.right {
  animation: pop 0.5s ease-out;
}

@keyframes pop {
  50% {
    transform: scale(1.06);
  }
}

.timerbar {
  height: 14px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: #fff;
  overflow: hidden;
}

.timerbar > i {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--green);
  transform-origin: left center;
}

.timerbar.low > i {
  background: var(--red);
}
